fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,35 @@
import { createElement } from "react";
/**
* External dependencies
*/
/**
* Internal dependencies
*/
import { contextConnect } from '../../context';
import { Flex } from '../../flex';
import { useCardFooter } from './hook';
function UnconnectedCardFooter(props, forwardedRef) {
const footerProps = useCardFooter(props);
return createElement(Flex, {
...footerProps,
ref: forwardedRef
});
}
/**
* `CardFooter` renders an optional footer within a `Card`.
*
* ```jsx
* import { Card, CardBody, CardFooter } from `@wordpress/components`;
*
* <Card>
* <CardBody>...</CardBody>
* <CardFooter>...</CardFooter>
* </Card>
* ```
*/
export const CardFooter = contextConnect(UnconnectedCardFooter, 'CardFooter');
export default CardFooter;
//# sourceMappingURL=component.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["contextConnect","Flex","useCardFooter","UnconnectedCardFooter","props","forwardedRef","footerProps","createElement","ref","CardFooter"],"sources":["@wordpress/components/src/card/card-footer/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { Flex } from '../../flex';\nimport { useCardFooter } from './hook';\nimport type { FooterProps } from '../types';\n\nfunction UnconnectedCardFooter(\n\tprops: WordPressComponentProps< FooterProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst footerProps = useCardFooter( props );\n\n\treturn <Flex { ...footerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardFooter` renders an optional footer within a `Card`.\n *\n * ```jsx\n * import { Card, CardBody, CardFooter } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardBody>...</CardBody>\n * \t<CardFooter>...</CardFooter>\n * </Card>\n * ```\n */\nexport const CardFooter = contextConnect( UnconnectedCardFooter, 'CardFooter' );\n\nexport default CardFooter;\n"],"mappings":";AAAA;AACA;AACA;;AAGA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,aAAa,QAAQ,QAAQ;AAGtC,SAASC,qBAAqBA,CAC7BC,KAAoD,EACpDC,YAAiC,EAChC;EACD,MAAMC,WAAW,GAAGJ,aAAa,CAAEE,KAAM,CAAC;EAE1C,OAAOG,aAAA,CAACN,IAAI;IAAA,GAAMK,WAAW;IAAGE,GAAG,EAAGH;EAAc,CAAE,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,UAAU,GAAGT,cAAc,CAAEG,qBAAqB,EAAE,YAAa,CAAC;AAE/E,eAAeM,UAAU"}

View File

@@ -0,0 +1,32 @@
/**
* WordPress dependencies
*/
import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import { useContextSystem } from '../../context';
import * as styles from '../styles';
import { useCx } from '../../utils/hooks/use-cx';
export function useCardFooter(props) {
const {
className,
justify,
isBorderless = false,
isShady = false,
size = 'medium',
...otherProps
} = useContextSystem(props, 'CardFooter');
const cx = useCx();
const classes = useMemo(() => cx(styles.Footer, styles.borderRadius, styles.borderColor, styles.cardPaddings[size], isBorderless && styles.borderless, isShady && styles.shady,
// This classname is added for legacy compatibility reasons.
'components-card__footer', className), [className, cx, isBorderless, isShady, size]);
return {
...otherProps,
className: classes,
justify
};
}
//# sourceMappingURL=hook.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useMemo","useContextSystem","styles","useCx","useCardFooter","props","className","justify","isBorderless","isShady","size","otherProps","cx","classes","Footer","borderRadius","borderColor","cardPaddings","borderless","shady"],"sources":["@wordpress/components/src/card/card-footer/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport * as styles from '../styles';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { FooterProps } from '../types';\n\nexport function useCardFooter(\n\tprops: WordPressComponentProps< FooterProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tjustify,\n\t\tisBorderless = false,\n\t\tisShady = false,\n\t\tsize = 'medium',\n\t\t...otherProps\n\t} = useContextSystem( props, 'CardFooter' );\n\n\tconst cx = useCx();\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.Footer,\n\t\t\t\tstyles.borderRadius,\n\t\t\t\tstyles.borderColor,\n\t\t\t\tstyles.cardPaddings[ size ],\n\t\t\t\tisBorderless && styles.borderless,\n\t\t\t\tisShady && styles.shady,\n\t\t\t\t// This classname is added for legacy compatibility reasons.\n\t\t\t\t'components-card__footer',\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBorderless, isShady, size ]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\tclassName: classes,\n\t\tjustify,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;;AAEA,SAASC,gBAAgB,QAAQ,eAAe;AAChD,OAAO,KAAKC,MAAM,MAAM,WAAW;AACnC,SAASC,KAAK,QAAQ,0BAA0B;AAGhD,OAAO,SAASC,aAAaA,CAC5BC,KAAoD,EACnD;EACD,MAAM;IACLC,SAAS;IACTC,OAAO;IACPC,YAAY,GAAG,KAAK;IACpBC,OAAO,GAAG,KAAK;IACfC,IAAI,GAAG,QAAQ;IACf,GAAGC;EACJ,CAAC,GAAGV,gBAAgB,CAAEI,KAAK,EAAE,YAAa,CAAC;EAE3C,MAAMO,EAAE,GAAGT,KAAK,CAAC,CAAC;EAElB,MAAMU,OAAO,GAAGb,OAAO,CACtB,MACCY,EAAE,CACDV,MAAM,CAACY,MAAM,EACbZ,MAAM,CAACa,YAAY,EACnBb,MAAM,CAACc,WAAW,EAClBd,MAAM,CAACe,YAAY,CAAEP,IAAI,CAAE,EAC3BF,YAAY,IAAIN,MAAM,CAACgB,UAAU,EACjCT,OAAO,IAAIP,MAAM,CAACiB,KAAK;EACvB;EACA,yBAAyB,EACzBb,SACD,CAAC,EACF,CAAEA,SAAS,EAAEM,EAAE,EAAEJ,YAAY,EAAEC,OAAO,EAAEC,IAAI,CAC7C,CAAC;EAED,OAAO;IACN,GAAGC,UAAU;IACbL,SAAS,EAAEO,OAAO;IAClBN;EACD,CAAC;AACF"}

View File

@@ -0,0 +1,3 @@
export { default } from './component';
export { useCardFooter } from './hook';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["default","useCardFooter"],"sources":["@wordpress/components/src/card/card-footer/index.ts"],"sourcesContent":["export { default } from './component';\nexport { useCardFooter } from './hook';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,aAAa;AACrC,SAASC,aAAa,QAAQ,QAAQ"}