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,86 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.TextControl = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _compose = require("@wordpress/compose");
var _element = require("@wordpress/element");
var _baseControl = _interopRequireDefault(require("../base-control"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTextControl(props, ref) {
const {
__nextHasNoMarginBottom,
__next40pxDefaultSize = false,
label,
hideLabelFromVision,
value,
help,
id: idProp,
className,
onChange,
type = 'text',
...additionalProps
} = props;
const id = (0, _compose.useInstanceId)(TextControl, 'inspector-text-control', idProp);
const onChangeValue = event => onChange(event.target.value);
return (0, _react.createElement)(_baseControl.default, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
label: label,
hideLabelFromVision: hideLabelFromVision,
id: id,
help: help,
className: className
}, (0, _react.createElement)("input", {
className: (0, _classnames.default)('components-text-control__input', {
'is-next-40px-default-size': __next40pxDefaultSize
}),
type: type,
id: id,
value: value,
onChange: onChangeValue,
"aria-describedby": !!help ? id + '__help' : undefined,
ref: ref,
...additionalProps
}));
}
/**
* TextControl components let users enter and edit text.
*
* ```jsx
* import { TextControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyTextControl = () => {
* const [ className, setClassName ] = useState( '' );
*
* return (
* <TextControl
* label="Additional CSS Class"
* value={ className }
* onChange={ ( value ) => setClassName( value ) }
* />
* );
* };
* ```
*/
const TextControl = (0, _element.forwardRef)(UnforwardedTextControl);
exports.TextControl = TextControl;
var _default = TextControl;
exports.default = _default;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_element","_baseControl","UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","__next40pxDefaultSize","label","hideLabelFromVision","value","help","id","idProp","className","onChange","type","additionalProps","useInstanceId","TextControl","onChangeValue","event","target","_react","createElement","default","classnames","undefined","forwardRef","exports","_default"],"sources":["@wordpress/components/src/text-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context';\nimport type { TextControlProps } from './types';\n\nfunction UnforwardedTextControl(\n\tprops: WordPressComponentProps< TextControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\t__next40pxDefaultSize = false,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tid: idProp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...additionalProps\n\t} = props;\n\tconst id = useInstanceId( TextControl, 'inspector-text-control', idProp );\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName={ classnames( 'components-text-control__input', {\n\t\t\t\t\t'is-next-40px-default-size': __next40pxDefaultSize,\n\t\t\t\t} ) }\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextControl components let users enter and edit text.\n *\n * ```jsx\n * import { TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextControl = () => {\n * const [ className, setClassName ] = useState( '' );\n *\n * return (\n * <TextControl\n * label=\"Additional CSS Class\"\n * value={ className }\n * onChange={ ( value ) => setClassName( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextControl = forwardRef( UnforwardedTextControl );\n\nexport default TextControl;\n"],"mappings":";;;;;;;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,SAASI,sBAAsBA,CAC9BC,KAAkE,EAClEC,GAAqC,EACpC;EACD,MAAM;IACLC,uBAAuB;IACvBC,qBAAqB,GAAG,KAAK;IAC7BC,KAAK;IACLC,mBAAmB;IACnBC,KAAK;IACLC,IAAI;IACJC,EAAE,EAAEC,MAAM;IACVC,SAAS;IACTC,QAAQ;IACRC,IAAI,GAAG,MAAM;IACb,GAAGC;EACJ,CAAC,GAAGb,KAAK;EACT,MAAMQ,EAAE,GAAG,IAAAM,sBAAa,EAAEC,WAAW,EAAE,wBAAwB,EAAEN,MAAO,CAAC;EACzE,MAAMO,aAAa,GAAKC,KAAsC,IAC7DN,QAAQ,CAAEM,KAAK,CAACC,MAAM,CAACZ,KAAM,CAAC;EAE/B,OACC,IAAAa,MAAA,CAAAC,aAAA,EAACtB,YAAA,CAAAuB,OAAW;IACXnB,uBAAuB,EAAGA,uBAAyB;IACnDE,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CG,EAAE,EAAGA,EAAI;IACTD,IAAI,EAAGA,IAAM;IACbG,SAAS,EAAGA;EAAW,GAEvB,IAAAS,MAAA,CAAAC,aAAA;IACCV,SAAS,EAAG,IAAAY,mBAAU,EAAE,gCAAgC,EAAE;MACzD,2BAA2B,EAAEnB;IAC9B,CAAE,CAAG;IACLS,IAAI,EAAGA,IAAM;IACbJ,EAAE,EAAGA,EAAI;IACTF,KAAK,EAAGA,KAAO;IACfK,QAAQ,EAAGK,aAAe;IAC1B,oBAAmB,CAAC,CAAET,IAAI,GAAGC,EAAE,GAAG,QAAQ,GAAGe,SAAW;IACxDtB,GAAG,EAAGA,GAAK;IAAA,GACNY;EAAe,CACpB,CACW,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,WAAW,GAAG,IAAAS,mBAAU,EAAEzB,sBAAuB,CAAC;AAAC0B,OAAA,CAAAV,WAAA,GAAAA,WAAA;AAAA,IAAAW,QAAA,GAEjDX,WAAW;AAAAU,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}

View File

@@ -0,0 +1,48 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _element = require("@wordpress/element");
var _cell = _interopRequireDefault(require("../mobile/bottom-sheet/cell"));
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TextControl({
label,
hideLabelFromVision,
value,
help,
className,
instanceId,
onChange,
type = 'text',
placeholder,
...props
}) {
const id = `inspector-text-control-${instanceId}`;
return (0, _react.createElement)(_cell.default, {
label: label,
hideLabelFromVision: hideLabelFromVision,
id: id,
help: help,
className: className,
type: type,
value: value,
onChangeValue: onChange,
"aria-describedby": !!help ? id + '__help' : undefined,
valuePlaceholder: placeholder,
...props
});
}
var _default = (0, _element.memo)(TextControl);
exports.default = _default;
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_element","require","_cell","_interopRequireDefault","TextControl","label","hideLabelFromVision","value","help","className","instanceId","onChange","type","placeholder","props","id","_react","createElement","default","onChangeValue","undefined","valuePlaceholder","_default","memo","exports"],"sources":["@wordpress/components/src/text-control/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport Cell from '../mobile/bottom-sheet/cell';\n\nfunction TextControl( {\n\tlabel,\n\thideLabelFromVision,\n\tvalue,\n\thelp,\n\tclassName,\n\tinstanceId,\n\tonChange,\n\ttype = 'text',\n\tplaceholder,\n\t...props\n} ) {\n\tconst id = `inspector-text-control-${ instanceId }`;\n\n\treturn (\n\t\t<Cell\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t\ttype={ type }\n\t\t\tvalue={ value }\n\t\t\tonChangeValue={ onChange }\n\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\tvaluePlaceholder={ placeholder }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default memo( TextControl );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAPA;AACA;AACA;;AAEA;AACA;AACA;;AAGA,SAASG,WAAWA,CAAE;EACrBC,KAAK;EACLC,mBAAmB;EACnBC,KAAK;EACLC,IAAI;EACJC,SAAS;EACTC,UAAU;EACVC,QAAQ;EACRC,IAAI,GAAG,MAAM;EACbC,WAAW;EACX,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,EAAE,GAAI,0BAA0BL,UAAY,EAAC;EAEnD,OACC,IAAAM,MAAA,CAAAC,aAAA,EAACf,KAAA,CAAAgB,OAAI;IACJb,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CS,EAAE,EAAGA,EAAI;IACTP,IAAI,EAAGA,IAAM;IACbC,SAAS,EAAGA,SAAW;IACvBG,IAAI,EAAGA,IAAM;IACbL,KAAK,EAAGA,KAAO;IACfY,aAAa,EAAGR,QAAU;IAC1B,oBAAmB,CAAC,CAAEH,IAAI,GAAGO,EAAE,GAAG,QAAQ,GAAGK,SAAW;IACxDC,gBAAgB,EAAGR,WAAa;IAAA,GAC3BC;EAAK,CACV,CAAC;AAEJ;AAAC,IAAAQ,QAAA,GAEc,IAAAC,aAAI,EAAEnB,WAAY,CAAC;AAAAoB,OAAA,CAAAN,OAAA,GAAAI,QAAA"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["@wordpress/components/src/text-control/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { BaseControlProps } from '../base-control/types';\n\nexport type TextControlProps = Pick<\n\tBaseControlProps,\n\t| 'className'\n\t| 'hideLabelFromVision'\n\t| 'help'\n\t| 'label'\n\t| '__nextHasNoMarginBottom'\n> & {\n\t/**\n\t * A function that receives the value of the input.\n\t */\n\tonChange: ( value: string ) => void;\n\t/**\n\t * The current value of the input.\n\t */\n\tvalue: string | number;\n\t/**\n\t * Type of the input element to render. Defaults to \"text\".\n\t *\n\t * @default 'text'\n\t */\n\ttype?: 'email' | 'number' | 'password' | 'tel' | 'text' | 'search' | 'url';\n\t/**\n\t * Start opting into the larger default height that will become the default size in a future version.\n\t *\n\t * @default false\n\t */\n\t__next40pxDefaultSize?: boolean;\n};\n"],"mappings":""}