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

126
node_modules/reakit/lib/Rover/Rover.js generated vendored Normal file
View File

@@ -0,0 +1,126 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../_rollupPluginBabelHelpers-8f9a8751.js');
var createComponent = require('reakit-system/createComponent');
var createHook = require('reakit-system/createHook');
require('reakit-utils/shallowEqual');
var React = require('react');
var useForkRef = require('reakit-utils/useForkRef');
require('reakit-utils/isButton');
var reakitWarning = require('reakit-warning');
require('reakit-utils/useLiveRef');
require('reakit-utils/isSelfTarget');
require('reakit-utils/useIsomorphicEffect');
var hasFocusWithin = require('reakit-utils/hasFocusWithin');
require('reakit-utils/isPortalEvent');
require('reakit-utils/dom');
require('reakit-utils/tabbable');
require('../Role/Role.js');
require('../Tabbable/Tabbable.js');
var Clickable_Clickable = require('../Clickable/Clickable.js');
require('../Id/IdProvider.js');
var Id_Id = require('../Id/Id.js');
var createOnKeyDown = require('reakit-utils/createOnKeyDown');
// Automatically generated
var ROVER_STATE_KEYS = ["baseId", "unstable_idCountRef", "orientation", "stops", "currentId", "unstable_pastId", "unstable_moves", "loop", "setBaseId", "register", "unregister", "move", "next", "previous", "first", "last", "unstable_reset", "unstable_orientate"];
var ROVER_KEYS = [].concat(ROVER_STATE_KEYS, ["stopId"]);
function useAllCallbacks() {
for (var _len = arguments.length, callbacks = new Array(_len), _key = 0; _key < _len; _key++) {
callbacks[_key] = arguments[_key];
}
return React.useCallback(function () {
var fns = callbacks.filter(Boolean);
for (var _iterator = _rollupPluginBabelHelpers._createForOfIteratorHelperLoose(fns), _step; !(_step = _iterator()).done;) {
var callback = _step.value;
callback.apply(void 0, arguments);
}
}, callbacks);
}
var useRover = createHook.createHook({
name: "Rover",
compose: [Clickable_Clickable.useClickable, Id_Id.unstable_useId],
keys: ROVER_KEYS,
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
_ref$tabIndex = _ref.tabIndex,
htmlTabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
htmlOnFocus = _ref.onFocus,
htmlOnKeyDown = _ref.onKeyDown,
htmlProps = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, ["ref", "tabIndex", "onFocus", "onKeyDown"]);
var ref = React.useRef(null);
var id = options.stopId || options.id;
var trulyDisabled = options.disabled && !options.focusable;
var noFocused = options.currentId == null;
var focused = options.currentId === id;
var isFirst = (options.stops || [])[0] && options.stops[0].id === id;
var shouldTabIndex = focused || isFirst && noFocused;
React.useEffect(function () {
if (trulyDisabled || !id) return undefined;
options.register && options.register(id, ref);
return function () {
return options.unregister && options.unregister(id);
};
}, [id, trulyDisabled, options.register, options.unregister]);
React.useEffect(function () {
var rover = ref.current;
if (!rover) {
process.env.NODE_ENV !== "production" ? reakitWarning.warning(true, "Can't focus rover component because `ref` wasn't passed to component.", "See https://reakit.io/docs/rover") : void 0;
return;
}
if (options.unstable_moves && focused && !hasFocusWithin.hasFocusWithin(rover)) {
rover.focus();
}
}, [focused, options.unstable_moves]);
var onFocus = React.useCallback(function (event) {
if (!id || !event.currentTarget.contains(event.target)) return; // this is already focused, so we move silently
options.move(id, true);
}, [options.move, id]);
var onKeyDown = React.useMemo(function () {
return createOnKeyDown.createOnKeyDown({
onKeyDown: htmlOnKeyDown,
stopPropagation: true,
shouldKeyDown: function shouldKeyDown(event) {
return (// Ignore portals
// https://github.com/facebook/react/issues/11387
event.currentTarget.contains(event.target)
);
},
keyMap: {
ArrowUp: options.orientation !== "horizontal" && options.previous,
ArrowRight: options.orientation !== "vertical" && options.next,
ArrowDown: options.orientation !== "horizontal" && options.next,
ArrowLeft: options.orientation !== "vertical" && options.previous,
Home: options.first,
End: options.last,
PageUp: options.first,
PageDown: options.last
}
});
}, [htmlOnKeyDown, options.orientation, options.previous, options.next, options.first, options.last]);
return _rollupPluginBabelHelpers._objectSpread2({
id: id,
ref: useForkRef.useForkRef(ref, htmlRef),
tabIndex: shouldTabIndex ? htmlTabIndex : -1,
onFocus: useAllCallbacks(onFocus, htmlOnFocus),
onKeyDown: onKeyDown
}, htmlProps);
}
});
var Rover = createComponent.createComponent({
as: "button",
useHook: useRover
});
exports.Rover = Rover;
exports.useRover = useRover;

279
node_modules/reakit/lib/Rover/RoverState.js generated vendored Normal file
View File

@@ -0,0 +1,279 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../_rollupPluginBabelHelpers-8f9a8751.js');
var React = require('react');
var useSealedState = require('reakit-utils/useSealedState');
require('../Id/IdProvider.js');
var Id_IdState = require('../Id/IdState.js');
function reducer(state, action) {
var stops = state.stops,
currentId = state.currentId,
pastId = state.unstable_pastId,
moves = state.unstable_moves,
loop = state.loop;
switch (action.type) {
case "register":
{
var _id = action.id,
_ref = action.ref;
if (stops.length === 0) {
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
stops: [{
id: _id,
ref: _ref
}]
});
}
var index = stops.findIndex(function (stop) {
return stop.id === _id;
});
if (index >= 0) {
return state;
}
var indexToInsertAt = stops.findIndex(function (stop) {
if (!stop.ref.current || !_ref.current) return false; // Return true if the new rover element is located earlier in the DOM
// than stop's element, else false:
return Boolean(stop.ref.current.compareDocumentPosition(_ref.current) & Node.DOCUMENT_POSITION_PRECEDING);
}); // findIndex returns -1 when the new rover should be inserted
// at the end of stops (the compareDocumentPosition test
// always returns false in that case).
if (indexToInsertAt === -1) {
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
stops: [].concat(stops, [{
id: _id,
ref: _ref
}])
});
}
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
stops: [].concat(stops.slice(0, indexToInsertAt), [{
id: _id,
ref: _ref
}], stops.slice(indexToInsertAt))
});
}
case "unregister":
{
var _id2 = action.id;
var nextStops = stops.filter(function (stop) {
return stop.id !== _id2;
});
if (nextStops.length === stops.length) {
return state;
}
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
stops: nextStops,
unstable_pastId: pastId && pastId === _id2 ? null : pastId,
currentId: currentId && currentId === _id2 ? null : currentId
});
}
case "move":
{
var _id3 = action.id,
silent = action.silent;
var nextMoves = silent ? moves : moves + 1;
if (_id3 === null) {
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
currentId: null,
unstable_pastId: currentId,
unstable_moves: nextMoves
});
}
var _index = stops.findIndex(function (stop) {
return stop.id === _id3;
}); // Item doesn't exist, so we don't count a move
if (_index === -1) {
return state;
}
if (stops[_index].id === currentId) {
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
unstable_moves: nextMoves
});
}
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
currentId: stops[_index].id,
unstable_pastId: currentId,
unstable_moves: nextMoves
});
}
case "next":
{
if (currentId == null) {
return reducer(state, {
type: "move",
id: stops[0] && stops[0].id
});
}
var _index2 = stops.findIndex(function (stop) {
return stop.id === currentId;
}); // If loop is truthy, turns [0, currentId, 2, 3] into [currentId, 2, 3, 0]
// Otherwise turns into [currentId, 2, 3]
var reorderedStops = [].concat(stops.slice(_index2 + 1), loop ? stops.slice(0, _index2) : []);
var nextIndex = reorderedStops.findIndex(function (stop) {
return stop.id === currentId;
}) + 1;
return reducer(state, {
type: "move",
id: reorderedStops[nextIndex] && reorderedStops[nextIndex].id
});
}
case "previous":
{
var _reducer = reducer(_rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
stops: stops.slice().reverse()
}), {
type: "next"
}),
_ = _reducer.stops,
nextState = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_reducer, ["stops"]);
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), nextState);
}
case "first":
{
var stop = stops[0];
return reducer(state, {
type: "move",
id: stop && stop.id
});
}
case "last":
{
var _stop = stops[stops.length - 1];
return reducer(state, {
type: "move",
id: _stop && _stop.id
});
}
case "reset":
{
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
currentId: null,
unstable_pastId: null
});
}
case "orientate":
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), {}, {
orientation: action.orientation
});
default:
throw new Error();
}
}
function useRoverState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState.useSealedState(initialState),
orientation = _useSealedState.orientation,
_useSealedState$curre = _useSealedState.currentId,
currentId = _useSealedState$curre === void 0 ? null : _useSealedState$curre,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,
sealed = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_useSealedState, ["orientation", "currentId", "loop"]);
var _React$useReducer = React.useReducer(reducer, {
orientation: orientation,
stops: [],
currentId: currentId,
unstable_pastId: null,
unstable_moves: 0,
loop: loop
}),
state = _React$useReducer[0],
dispatch = _React$useReducer[1];
var idState = Id_IdState.unstable_useIdState(sealed);
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, idState), state), {}, {
register: useAction(function (id, ref) {
return dispatch({
type: "register",
id: id,
ref: ref
});
}),
unregister: useAction(function (id) {
return dispatch({
type: "unregister",
id: id
});
}),
move: useAction(function (id, silent) {
return dispatch({
type: "move",
id: id,
silent: silent
});
}),
next: useAction(function () {
return dispatch({
type: "next"
});
}),
previous: useAction(function () {
return dispatch({
type: "previous"
});
}),
first: useAction(function () {
return dispatch({
type: "first"
});
}),
last: useAction(function () {
return dispatch({
type: "last"
});
}),
unstable_reset: useAction(function () {
return dispatch({
type: "reset"
});
}),
unstable_orientate: useAction(function (o) {
return dispatch({
type: "orientate",
orientation: o
});
})
});
}
function useAction(fn) {
return React.useCallback(fn, []);
}
exports.useRoverState = useRoverState;

35
node_modules/reakit/lib/Rover/index.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
require('../_rollupPluginBabelHelpers-8f9a8751.js');
require('reakit-system/createComponent');
require('reakit-system/createHook');
require('reakit-utils/shallowEqual');
require('react');
require('reakit-utils/useForkRef');
require('reakit-utils/isButton');
require('reakit-warning');
require('reakit-utils/useLiveRef');
require('reakit-utils/isSelfTarget');
require('reakit-utils/useIsomorphicEffect');
require('reakit-utils/hasFocusWithin');
require('reakit-utils/isPortalEvent');
require('reakit-utils/dom');
require('reakit-utils/tabbable');
require('../Role/Role.js');
require('../Tabbable/Tabbable.js');
require('../Clickable/Clickable.js');
require('reakit-utils/useSealedState');
require('../Id/IdProvider.js');
require('../Id/Id.js');
require('../Id/IdState.js');
require('reakit-utils/createOnKeyDown');
var Rover_Rover = require('./Rover.js');
var Rover_RoverState = require('./RoverState.js');
exports.Rover = Rover_Rover.Rover;
exports.useRover = Rover_Rover.useRover;
exports.useRoverState = Rover_RoverState.useRoverState;