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,97 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.RadioControl = RadioControl;
exports.default = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _compose = require("@wordpress/compose");
var _baseControl = _interopRequireDefault(require("../base-control"));
var _vStack = require("../v-stack");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Render a user interface to select the user type using radio inputs.
*
* ```jsx
* import { RadioControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyRadioControl = () => {
* const [ option, setOption ] = useState( 'a' );
*
* return (
* <RadioControl
* label="User type"
* help="The type of the current user"
* selected={ option }
* options={ [
* { label: 'Author', value: 'a' },
* { label: 'Editor', value: 'e' },
* ] }
* onChange={ ( value ) => setOption( value ) }
* />
* );
* };
* ```
*/
function RadioControl(props) {
const {
label,
className,
selected,
help,
onChange,
hideLabelFromVision,
options = [],
...additionalProps
} = props;
const instanceId = (0, _compose.useInstanceId)(RadioControl);
const id = `inspector-radio-control-${instanceId}`;
const onChangeValue = event => onChange(event.target.value);
if (!options?.length) {
return null;
}
return (0, _react.createElement)(_baseControl.default, {
__nextHasNoMarginBottom: true,
label: label,
id: id,
hideLabelFromVision: hideLabelFromVision,
help: help,
className: (0, _classnames.default)(className, 'components-radio-control')
}, (0, _react.createElement)(_vStack.VStack, {
spacing: 1
}, options.map((option, index) => (0, _react.createElement)("div", {
key: `${id}-${index}`,
className: "components-radio-control__option"
}, (0, _react.createElement)("input", {
id: `${id}-${index}`,
className: "components-radio-control__input",
type: "radio",
name: id,
value: option.value,
onChange: onChangeValue,
checked: option.value === selected,
"aria-describedby": !!help ? `${id}__help` : undefined,
...additionalProps
}), (0, _react.createElement)("label", {
className: "components-radio-control__label",
htmlFor: `${id}-${index}`
}, option.label)))));
}
var _default = RadioControl;
exports.default = _default;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,32 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _radioCell = _interopRequireDefault(require("../mobile/bottom-sheet/radio-cell"));
/**
* Internal dependencies
*/
function RadioControl({
onChange,
selected,
options = [],
...props
}) {
return (0, _react.createElement)(_react.Fragment, null, options.map((option, index) => {
return (0, _react.createElement)(_radioCell.default, {
label: option.label,
onPress: () => onChange(option.value),
selected: option.value === selected,
key: `${option.value}-${index}`,
...props
});
}));
}
var _default = RadioControl;
exports.default = _default;
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_radioCell","_interopRequireDefault","require","RadioControl","onChange","selected","options","props","_react","createElement","Fragment","map","option","index","default","label","onPress","value","key","_default","exports"],"sources":["@wordpress/components/src/radio-control/index.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport RadioCell from '../mobile/bottom-sheet/radio-cell';\n\nfunction RadioControl( { onChange, selected, options = [], ...props } ) {\n\treturn (\n\t\t<>\n\t\t\t{ options.map( ( option, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<RadioCell\n\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t\tonPress={ () => onChange( option.value ) }\n\t\t\t\t\t\tselected={ option.value === selected }\n\t\t\t\t\t\tkey={ `${ option.value }-${ index }` }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport default RadioControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA,SAASC,YAAYA,CAAE;EAAEC,QAAQ;EAAEC,QAAQ;EAAEC,OAAO,GAAG,EAAE;EAAE,GAAGC;AAAM,CAAC,EAAG;EACvE,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACGJ,OAAO,CAACK,GAAG,CAAE,CAAEC,MAAM,EAAEC,KAAK,KAAM;IACnC,OACC,IAAAL,MAAA,CAAAC,aAAA,EAACT,UAAA,CAAAc,OAAS;MACTC,KAAK,EAAGH,MAAM,CAACG,KAAO;MACtBC,OAAO,EAAGA,CAAA,KAAMZ,QAAQ,CAAEQ,MAAM,CAACK,KAAM,CAAG;MAC1CZ,QAAQ,EAAGO,MAAM,CAACK,KAAK,KAAKZ,QAAU;MACtCa,GAAG,EAAI,GAAGN,MAAM,CAACK,KAAO,IAAIJ,KAAO,EAAG;MAAA,GACjCN;IAAK,CACV,CAAC;EAEJ,CAAE,CACD,CAAC;AAEL;AAAC,IAAAY,QAAA,GAEchB,YAAY;AAAAiB,OAAA,CAAAN,OAAA,GAAAK,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/radio-control/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { BaseControlProps } from '../base-control/types';\n\nexport type RadioControlProps = Pick<\n\tBaseControlProps,\n\t'label' | 'help' | 'hideLabelFromVision'\n> & {\n\t/**\n\t * A function that receives the value of the new option that is being\n\t * selected as input.\n\t */\n\tonChange: ( value: string ) => void;\n\t/**\n\t * An array of objects containing the value and label of the options.\n\t */\n\toptions?: {\n\t\t/**\n\t\t * The label to be shown to the user\n\t\t */\n\t\tlabel: string;\n\t\t/**\n\t\t * The internal value compared against select and passed to onChange\n\t\t */\n\t\tvalue: string;\n\t}[];\n\t/**\n\t * The value property of the currently selected option.\n\t */\n\tselected?: string;\n};\n"],"mappings":""}