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,82 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.TextareaControl = void 0;
var _react = require("react");
var _compose = require("@wordpress/compose");
var _element = require("@wordpress/element");
var _baseControl = _interopRequireDefault(require("../base-control"));
var _textareaControlStyles = require("./styles/textarea-control-styles");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTextareaControl(props, ref) {
const {
__nextHasNoMarginBottom,
label,
hideLabelFromVision,
value,
help,
onChange,
rows = 4,
className,
...additionalProps
} = props;
const instanceId = (0, _compose.useInstanceId)(TextareaControl);
const id = `inspector-textarea-control-${instanceId}`;
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)(_textareaControlStyles.StyledTextarea, {
className: "components-textarea-control__input",
id: id,
rows: rows,
onChange: onChangeValue,
"aria-describedby": !!help ? id + '__help' : undefined,
value: value,
ref: ref,
...additionalProps
}));
}
/**
* TextareaControls are TextControls that allow for multiple lines of text, and
* wrap overflow text onto a new line. They are a fixed height and scroll
* vertically when the cursor reaches the bottom of the field.
*
* ```jsx
* import { TextareaControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyTextareaControl = () => {
* const [ text, setText ] = useState( '' );
*
* return (
* <TextareaControl
* label="Text"
* help="Enter some text"
* value={ text }
* onChange={ ( value ) => setText( value ) }
* />
* );
* };
* ```
*/
const TextareaControl = (0, _element.forwardRef)(UnforwardedTextareaControl);
exports.TextareaControl = TextareaControl;
var _default = TextareaControl;
exports.default = _default;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_compose","require","_element","_baseControl","_interopRequireDefault","_textareaControlStyles","UnforwardedTextareaControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","onChange","rows","className","additionalProps","instanceId","useInstanceId","TextareaControl","id","onChangeValue","event","target","_react","createElement","default","StyledTextarea","undefined","forwardRef","exports","_default"],"sources":["@wordpress/components/src/textarea-control/index.tsx"],"sourcesContent":["/**\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 { StyledTextarea } from './styles/textarea-control-styles';\nimport type { TextareaControlProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nfunction UnforwardedTextareaControl(\n\tprops: WordPressComponentProps< TextareaControlProps, 'textarea', false >,\n\tref: React.ForwardedRef< HTMLTextAreaElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tonChange,\n\t\trows = 4,\n\t\tclassName,\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( TextareaControl );\n\tconst id = `inspector-textarea-control-${ instanceId }`;\n\tconst onChangeValue = ( event: React.ChangeEvent< HTMLTextAreaElement > ) =>\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<StyledTextarea\n\t\t\t\tclassName=\"components-textarea-control__input\"\n\t\t\t\tid={ id }\n\t\t\t\trows={ rows }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tvalue={ value }\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 * TextareaControls are TextControls that allow for multiple lines of text, and\n * wrap overflow text onto a new line. They are a fixed height and scroll\n * vertically when the cursor reaches the bottom of the field.\n *\n * ```jsx\n * import { TextareaControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextareaControl = () => {\n * const [ text, setText ] = useState( '' );\n *\n * return (\n * <TextareaControl\n * label=\"Text\"\n * help=\"Enter some text\"\n * value={ text }\n * onChange={ ( value ) => setText( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextareaControl = forwardRef( UnforwardedTextareaControl );\n\nexport default TextareaControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAMA,SAASK,0BAA0BA,CAClCC,KAAyE,EACzEC,GAA8C,EAC7C;EACD,MAAM;IACLC,uBAAuB;IACvBC,KAAK;IACLC,mBAAmB;IACnBC,KAAK;IACLC,IAAI;IACJC,QAAQ;IACRC,IAAI,GAAG,CAAC;IACRC,SAAS;IACT,GAAGC;EACJ,CAAC,GAAGV,KAAK;EACT,MAAMW,UAAU,GAAG,IAAAC,sBAAa,EAAEC,eAAgB,CAAC;EACnD,MAAMC,EAAE,GAAI,8BAA8BH,UAAY,EAAC;EACvD,MAAMI,aAAa,GAAKC,KAA+C,IACtET,QAAQ,CAAES,KAAK,CAACC,MAAM,CAACZ,KAAM,CAAC;EAE/B,OACC,IAAAa,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAAwB,OAAW;IACXlB,uBAAuB,EAAGA,uBAAyB;IACnDC,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CU,EAAE,EAAGA,EAAI;IACTR,IAAI,EAAGA,IAAM;IACbG,SAAS,EAAGA;EAAW,GAEvB,IAAAS,MAAA,CAAAC,aAAA,EAACrB,sBAAA,CAAAuB,cAAc;IACdZ,SAAS,EAAC,oCAAoC;IAC9CK,EAAE,EAAGA,EAAI;IACTN,IAAI,EAAGA,IAAM;IACbD,QAAQ,EAAGQ,aAAe;IAC1B,oBAAmB,CAAC,CAAET,IAAI,GAAGQ,EAAE,GAAG,QAAQ,GAAGQ,SAAW;IACxDjB,KAAK,EAAGA,KAAO;IACfJ,GAAG,EAAGA,GAAK;IAAA,GACNS;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;AACA;AACA;AACA;AACO,MAAMG,eAAe,GAAG,IAAAU,mBAAU,EAAExB,0BAA2B,CAAC;AAACyB,OAAA,CAAAX,eAAA,GAAAA,eAAA;AAAA,IAAAY,QAAA,GAEzDZ,eAAe;AAAAW,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}

View File

@@ -0,0 +1,44 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _baseControl = _interopRequireDefault(require("../base-control"));
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function TextareaControl({
label,
value,
help,
onChange,
rows = 4
}) {
return (0, _react.createElement)(_baseControl.default, {
label: label,
help: help
}, (0, _react.createElement)(_reactNative.TextInput, {
style: {
height: 80,
borderColor: 'gray',
borderWidth: 1
},
value: value,
onChangeText: onChange,
numberOfLines: rows,
multiline: rows > 1,
textAlignVertical: "top"
}));
}
var _default = TextareaControl;
exports.default = _default;
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNative","require","_baseControl","_interopRequireDefault","TextareaControl","label","value","help","onChange","rows","_react","createElement","default","TextInput","style","height","borderColor","borderWidth","onChangeText","numberOfLines","multiline","textAlignVertical","_default","exports"],"sources":["@wordpress/components/src/textarea-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TextInput } from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\n\nfunction TextareaControl( { label, value, help, onChange, rows = 4 } ) {\n\treturn (\n\t\t<BaseControl label={ label } help={ help }>\n\t\t\t<TextInput\n\t\t\t\tstyle={ { height: 80, borderColor: 'gray', borderWidth: 1 } }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChangeText={ onChange }\n\t\t\t\tnumberOfLines={ rows }\n\t\t\t\tmultiline={ rows > 1 }\n\t\t\t\ttextAlignVertical=\"top\"\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\nexport default TextareaControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,SAASG,eAAeA,CAAE;EAAEC,KAAK;EAAEC,KAAK;EAAEC,IAAI;EAAEC,QAAQ;EAAEC,IAAI,GAAG;AAAE,CAAC,EAAG;EACtE,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACT,YAAA,CAAAU,OAAW;IAACP,KAAK,EAAGA,KAAO;IAACE,IAAI,EAAGA;EAAM,GACzC,IAAAG,MAAA,CAAAC,aAAA,EAACX,YAAA,CAAAa,SAAS;IACTC,KAAK,EAAG;MAAEC,MAAM,EAAE,EAAE;MAAEC,WAAW,EAAE,MAAM;MAAEC,WAAW,EAAE;IAAE,CAAG;IAC7DX,KAAK,EAAGA,KAAO;IACfY,YAAY,EAAGV,QAAU;IACzBW,aAAa,EAAGV,IAAM;IACtBW,SAAS,EAAGX,IAAI,GAAG,CAAG;IACtBY,iBAAiB,EAAC;EAAK,CACvB,CACW,CAAC;AAEhB;AAAC,IAAAC,QAAA,GAEclB,eAAe;AAAAmB,OAAA,CAAAX,OAAA,GAAAU,QAAA"}

View File

@@ -0,0 +1,25 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.StyledTextarea = void 0;
var _base = _interopRequireDefault(require("@emotion/styled/base"));
var _input = require("../../utils/input");
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const StyledTextarea = (0, _base.default)("textarea", process.env.NODE_ENV === "production" ? {
target: "e1w5nnrk0"
} : {
target: "e1w5nnrk0",
label: "StyledTextarea"
})("width:100%;", _input.inputControl, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGV4dGFyZWEtY29udHJvbC9zdHlsZXMvdGV4dGFyZWEtY29udHJvbC1zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBVTZDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGV4dGFyZWEtY29udHJvbC9zdHlsZXMvdGV4dGFyZWEtY29udHJvbC1zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGlucHV0Q29udHJvbCB9IGZyb20gJy4uLy4uL3V0aWxzL2lucHV0JztcblxuZXhwb3J0IGNvbnN0IFN0eWxlZFRleHRhcmVhID0gc3R5bGVkLnRleHRhcmVhYFxuXHR3aWR0aDogMTAwJTtcblx0JHsgaW5wdXRDb250cm9sIH1cbmA7XG4iXX0= */"));
exports.StyledTextarea = StyledTextarea;
//# sourceMappingURL=textarea-control-styles.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_input","require","StyledTextarea","_base","default","process","env","NODE_ENV","target","label","inputControl","exports"],"sources":["@wordpress/components/src/textarea-control/styles/textarea-control-styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport { inputControl } from '../../utils/input';\n\nexport const StyledTextarea = styled.textarea`\n\twidth: 100%;\n\t${ inputControl }\n`;\n"],"mappings":";;;;;;;;AAQA,IAAAA,MAAA,GAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGO,MAAMC,cAAc,OAAAC,KAAA,CAAAC,OAAA,cAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,kBAEvBC,mBAAY,SAAAL,OAAA,CAAAC,GAAA,CAAAC,QAAA,wvBACf;AAACI,OAAA,CAAAT,cAAA,GAAAA,cAAA"}

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/textarea-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { TextareaHTMLAttributes } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { BaseControlProps } from '../base-control/types';\n\nexport type TextareaControlProps = Pick<\n\tBaseControlProps,\n\t'hideLabelFromVision' | 'help' | 'label' | '__nextHasNoMarginBottom'\n> & {\n\t/**\n\t * A function that receives the new value of the textarea each time it\n\t * changes.\n\t */\n\tonChange: ( value: string ) => void;\n\t/**\n\t * The current value of the textarea.\n\t */\n\tvalue: string;\n\t/**\n\t * The number of rows the textarea should contain.\n\t *\n\t * @default 4\n\t */\n\trows?: TextareaHTMLAttributes< HTMLTextAreaElement >[ 'rows' ];\n};\n"],"mappings":""}