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,45 @@
"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 _toolbarItem = _interopRequireDefault(require("../toolbar-item"));
var _toolbarContext = _interopRequireDefault(require("../toolbar-context"));
var _dropdownMenu = _interopRequireDefault(require("../../dropdown-menu"));
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToolbarDropdownMenu(props, ref) {
const accessibleToolbarState = (0, _element.useContext)(_toolbarContext.default);
if (!accessibleToolbarState) {
return (0, _react.createElement)(_dropdownMenu.default, {
...props
});
}
// ToolbarItem will pass all props to the render prop child, which will pass
// all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu
// has the same API as DropdownMenu.
return (0, _react.createElement)(_toolbarItem.default, {
ref: ref,
...props.toggleProps
}, toolbarItemProps => (0, _react.createElement)(_dropdownMenu.default, {
...props,
popoverProps: {
...props.popoverProps
},
toggleProps: toolbarItemProps
}));
}
var _default = (0, _element.forwardRef)(ToolbarDropdownMenu);
exports.default = _default;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_element","require","_toolbarItem","_interopRequireDefault","_toolbarContext","_dropdownMenu","ToolbarDropdownMenu","props","ref","accessibleToolbarState","useContext","ToolbarContext","_react","createElement","default","toggleProps","toolbarItemProps","popoverProps","_default","forwardRef","exports"],"sources":["@wordpress/components/src/toolbar/toolbar-dropdown-menu/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ToolbarItem from '../toolbar-item';\nimport ToolbarContext from '../toolbar-context';\nimport DropdownMenu from '../../dropdown-menu';\nimport type { DropdownMenuProps } from '../../dropdown-menu/types';\n\nfunction ToolbarDropdownMenu(\n\tprops: DropdownMenuProps,\n\tref: ForwardedRef< any >\n) {\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ! accessibleToolbarState ) {\n\t\treturn <DropdownMenu { ...props } />;\n\t}\n\n\t// ToolbarItem will pass all props to the render prop child, which will pass\n\t// all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu\n\t// has the same API as DropdownMenu.\n\treturn (\n\t\t<ToolbarItem ref={ ref } { ...props.toggleProps }>\n\t\t\t{ ( toolbarItemProps ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t...props.popoverProps,\n\t\t\t\t\t} }\n\t\t\t\t\ttoggleProps={ toolbarItemProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</ToolbarItem>\n\t);\n}\n\nexport default forwardRef( ToolbarDropdownMenu );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAUA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAF,sBAAA,CAAAF,OAAA;AAfA;AACA;AACA;;AAQA;AACA;AACA;;AAMA,SAASK,mBAAmBA,CAC3BC,KAAwB,EACxBC,GAAwB,EACvB;EACD,MAAMC,sBAAsB,GAAG,IAAAC,mBAAU,EAAEC,uBAAe,CAAC;EAE3D,IAAK,CAAEF,sBAAsB,EAAG;IAC/B,OAAO,IAAAG,MAAA,CAAAC,aAAA,EAACR,aAAA,CAAAS,OAAY;MAAA,GAAMP;IAAK,CAAI,CAAC;EACrC;;EAEA;EACA;EACA;EACA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACX,YAAA,CAAAY,OAAW;IAACN,GAAG,EAAGA,GAAK;IAAA,GAAMD,KAAK,CAACQ;EAAW,GAC1CC,gBAAgB,IACnB,IAAAJ,MAAA,CAAAC,aAAA,EAACR,aAAA,CAAAS,OAAY;IAAA,GACPP,KAAK;IACVU,YAAY,EAAG;MACd,GAAGV,KAAK,CAACU;IACV,CAAG;IACHF,WAAW,EAAGC;EAAkB,CAChC,CAEU,CAAC;AAEhB;AAAC,IAAAE,QAAA,GAEc,IAAAC,mBAAU,EAAEb,mBAAoB,CAAC;AAAAc,OAAA,CAAAN,OAAA,GAAAI,QAAA"}