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,92 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DatePicker", {
enumerable: true,
get: function () {
return _date.default;
}
});
exports.DateTimePicker = void 0;
Object.defineProperty(exports, "TimePicker", {
enumerable: true,
get: function () {
return _time.default;
}
});
exports.default = void 0;
var _react = require("react");
var _element = require("@wordpress/element");
var _date = _interopRequireDefault(require("../date"));
var _time = _interopRequireDefault(require("../time"));
var _styles = require("./styles");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const noop = () => {};
function UnforwardedDateTimePicker({
currentDate,
is12Hour,
isInvalidDate,
onMonthPreviewed = noop,
onChange,
events,
startOfWeek
}, ref) {
return (0, _react.createElement)(_styles.Wrapper, {
ref: ref,
className: "components-datetime",
spacing: 4
}, (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_time.default, {
currentTime: currentDate,
onChange: onChange,
is12Hour: is12Hour
}), (0, _react.createElement)(_date.default, {
currentDate: currentDate,
onChange: onChange,
isInvalidDate: isInvalidDate,
events: events,
onMonthPreviewed: onMonthPreviewed,
startOfWeek: startOfWeek
})));
}
/**
* DateTimePicker is a React component that renders a calendar and clock for
* date and time selection. The calendar and clock components can be accessed
* individually using the `DatePicker` and `TimePicker` components respectively.
*
* ```jsx
* import { DateTimePicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyDateTimePicker = () => {
* const [ date, setDate ] = useState( new Date() );
*
* return (
* <DateTimePicker
* currentDate={ date }
* onChange={ ( newDate ) => setDate( newDate ) }
* is12Hour
* />
* );
* };
* ```
*/
const DateTimePicker = (0, _element.forwardRef)(UnforwardedDateTimePicker);
exports.DateTimePicker = DateTimePicker;
var _default = DateTimePicker;
exports.default = _default;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_element","require","_date","_interopRequireDefault","_time","_styles","noop","UnforwardedDateTimePicker","currentDate","is12Hour","isInvalidDate","onMonthPreviewed","onChange","events","startOfWeek","ref","_react","createElement","Wrapper","className","spacing","Fragment","default","currentTime","DateTimePicker","forwardRef","exports","_default"],"sources":["@wordpress/components/src/date-time/date-time/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { default as DatePicker } from '../date';\nimport { default as TimePicker } from '../time';\nimport type { DateTimePickerProps } from '../types';\nimport { Wrapper } from './styles';\n\nexport { DatePicker, TimePicker };\n\nconst noop = () => {};\n\nfunction UnforwardedDateTimePicker(\n\t{\n\t\tcurrentDate,\n\t\tis12Hour,\n\t\tisInvalidDate,\n\t\tonMonthPreviewed = noop,\n\t\tonChange,\n\t\tevents,\n\t\tstartOfWeek,\n\t}: DateTimePickerProps,\n\tref: ForwardedRef< any >\n) {\n\treturn (\n\t\t<Wrapper ref={ ref } className=\"components-datetime\" spacing={ 4 }>\n\t\t\t<>\n\t\t\t\t<TimePicker\n\t\t\t\t\tcurrentTime={ currentDate }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tis12Hour={ is12Hour }\n\t\t\t\t/>\n\t\t\t\t<DatePicker\n\t\t\t\t\tcurrentDate={ currentDate }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tisInvalidDate={ isInvalidDate }\n\t\t\t\t\tevents={ events }\n\t\t\t\t\tonMonthPreviewed={ onMonthPreviewed }\n\t\t\t\t\tstartOfWeek={ startOfWeek }\n\t\t\t\t/>\n\t\t\t</>\n\t\t</Wrapper>\n\t);\n}\n\n/**\n * DateTimePicker is a React component that renders a calendar and clock for\n * date and time selection. The calendar and clock components can be accessed\n * individually using the `DatePicker` and `TimePicker` components respectively.\n *\n * ```jsx\n * import { DateTimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDateTimePicker = () => {\n * const [ date, setDate ] = useState( new Date() );\n *\n * return (\n * <DateTimePicker\n * currentDate={ date }\n * onChange={ ( newDate ) => setDate( newDate ) }\n * is12Hour\n * />\n * );\n * };\n * ```\n */\nexport const DateTimePicker = forwardRef( UnforwardedDateTimePicker );\n\nexport default DateTimePicker;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAQA,MAAMK,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,yBAAyBA,CACjC;EACCC,WAAW;EACXC,QAAQ;EACRC,aAAa;EACbC,gBAAgB,GAAGL,IAAI;EACvBM,QAAQ;EACRC,MAAM;EACNC;AACoB,CAAC,EACtBC,GAAwB,EACvB;EACD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACZ,OAAA,CAAAa,OAAO;IAACH,GAAG,EAAGA,GAAK;IAACI,SAAS,EAAC,qBAAqB;IAACC,OAAO,EAAG;EAAG,GACjE,IAAAJ,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAK,QAAA,QACC,IAAAL,MAAA,CAAAC,aAAA,EAACb,KAAA,CAAAkB,OAAU;IACVC,WAAW,EAAGf,WAAa;IAC3BI,QAAQ,EAAGA,QAAU;IACrBH,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACF,IAAAO,MAAA,CAAAC,aAAA,EAACf,KAAA,CAAAoB,OAAU;IACVd,WAAW,EAAGA,WAAa;IAC3BI,QAAQ,EAAGA,QAAU;IACrBF,aAAa,EAAGA,aAAe;IAC/BG,MAAM,EAAGA,MAAQ;IACjBF,gBAAgB,EAAGA,gBAAkB;IACrCG,WAAW,EAAGA;EAAa,CAC3B,CACA,CACM,CAAC;AAEZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMU,cAAc,GAAG,IAAAC,mBAAU,EAAElB,yBAA0B,CAAC;AAACmB,OAAA,CAAAF,cAAA,GAAAA,cAAA;AAAA,IAAAG,QAAA,GAEvDH,cAAc;AAAAE,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}

View File

@@ -0,0 +1,26 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Wrapper = void 0;
var _base = _interopRequireDefault(require("@emotion/styled/base"));
var _vStack = require("../../v-stack");
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const Wrapper = ( /*#__PURE__*/0, _base.default)(_vStack.VStack, process.env.NODE_ENV === "production" ? {
target: "e1p5onf00"
} : {
target: "e1p5onf00",
label: "Wrapper"
})(process.env.NODE_ENV === "production" ? {
name: "1khn195",
styles: "box-sizing:border-box"
} : {
name: "1khn195",
styles: "box-sizing:border-box",
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGF0ZS10aW1lL2RhdGUtdGltZS9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBVXVDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGF0ZS10aW1lL2RhdGUtdGltZS9zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IFZTdGFjayB9IGZyb20gJy4uLy4uL3Ytc3RhY2snO1xuXG5leHBvcnQgY29uc3QgV3JhcHBlciA9IHN0eWxlZCggVlN0YWNrIClgXG5cdGJveC1zaXppbmc6IGJvcmRlci1ib3g7XG5gO1xuIl19 */",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
});
exports.Wrapper = Wrapper;
//# sourceMappingURL=styles.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_vStack","require","_EMOTION_STRINGIFIED_CSS_ERROR__","Wrapper","_base","default","VStack","process","env","NODE_ENV","target","label","name","styles","map","toString","exports"],"sources":["@wordpress/components/src/date-time/date-time/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport { VStack } from '../../v-stack';\n\nexport const Wrapper = styled( VStack )`\n\tbox-sizing: border-box;\n`;\n"],"mappings":";;;;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AAAuC,SAAAC,iCAAA;AAEhC,MAAMC,OAAO,GAAG,kBAAAC,KAAA,CAAAC,OAAA,EAAQC,cAAM,EAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,CAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAG,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAb;AAAA,EAEtC;AAACc,OAAA,CAAAb,OAAA,GAAAA,OAAA"}