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

121
node_modules/reakit/es/Rover/Rover.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2, b as _createForOfIteratorHelperLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import { useRef, useEffect, useCallback, useMemo } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import { warning } from 'reakit-warning';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import { hasFocusWithin } from 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import { useClickable } from '../Clickable/Clickable.js';
import '../Id/IdProvider.js';
import { unstable_useId } from '../Id/Id.js';
import { createOnKeyDown } from '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 useCallback(function () {
var fns = callbacks.filter(Boolean);
for (var _iterator = _createForOfIteratorHelperLoose(fns), _step; !(_step = _iterator()).done;) {
var callback = _step.value;
callback.apply(void 0, arguments);
}
}, callbacks);
}
var useRover = createHook({
name: "Rover",
compose: [useClickable, 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 = _objectWithoutPropertiesLoose(_ref, ["ref", "tabIndex", "onFocus", "onKeyDown"]);
var ref = 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;
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]);
useEffect(function () {
var rover = ref.current;
if (!rover) {
process.env.NODE_ENV !== "production" ? 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(rover)) {
rover.focus();
}
}, [focused, options.unstable_moves]);
var onFocus = 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 = useMemo(function () {
return 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 _objectSpread2({
id: id,
ref: useForkRef(ref, htmlRef),
tabIndex: shouldTabIndex ? htmlTabIndex : -1,
onFocus: useAllCallbacks(onFocus, htmlOnFocus),
onKeyDown: onKeyDown
}, htmlProps);
}
});
var Rover = createComponent({
as: "button",
useHook: useRover
});
export { Rover, useRover };

275
node_modules/reakit/es/Rover/RoverState.js generated vendored Normal file
View File

@@ -0,0 +1,275 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useReducer, useCallback } from 'react';
import { useSealedState } from 'reakit-utils/useSealedState';
import '../Id/IdProvider.js';
import { unstable_useIdState } from '../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 _objectSpread2(_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 _objectSpread2(_objectSpread2({}, state), {}, {
stops: [].concat(stops, [{
id: _id,
ref: _ref
}])
});
}
return _objectSpread2(_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 _objectSpread2(_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 _objectSpread2(_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 _objectSpread2(_objectSpread2({}, state), {}, {
unstable_moves: nextMoves
});
}
return _objectSpread2(_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(_objectSpread2(_objectSpread2({}, state), {}, {
stops: stops.slice().reverse()
}), {
type: "next"
}),
_ = _reducer.stops,
nextState = _objectWithoutPropertiesLoose(_reducer, ["stops"]);
return _objectSpread2(_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 _objectSpread2(_objectSpread2({}, state), {}, {
currentId: null,
unstable_pastId: null
});
}
case "orientate":
return _objectSpread2(_objectSpread2({}, state), {}, {
orientation: action.orientation
});
default:
throw new Error();
}
}
function useRoverState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _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 = _objectWithoutPropertiesLoose(_useSealedState, ["orientation", "currentId", "loop"]);
var _React$useReducer = 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 = unstable_useIdState(sealed);
return _objectSpread2(_objectSpread2(_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 useCallback(fn, []);
}
export { useRoverState };

25
node_modules/reakit/es/Rover/index.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-system/createComponent';
import 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import 'reakit-warning';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import '../Clickable/Clickable.js';
import 'reakit-utils/useSealedState';
import '../Id/IdProvider.js';
import '../Id/Id.js';
import '../Id/IdState.js';
import 'reakit-utils/createOnKeyDown';
export { Rover, useRover } from './Rover.js';
export { useRoverState } from './RoverState.js';