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>
78 lines
3.1 KiB
JavaScript
78 lines
3.1 KiB
JavaScript
import { a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
|
|
import { createComponent } from 'reakit-system/createComponent';
|
|
import { createHook } from 'reakit-system/createHook';
|
|
import 'reakit-utils/shallowEqual';
|
|
import { useCallback } from 'react';
|
|
import 'reakit-utils/useForkRef';
|
|
import 'reakit-utils/isButton';
|
|
import 'reakit-warning';
|
|
import { useLiveRef } from '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 { useButton } from '../Button/Button.js';
|
|
import { getDocument } from 'reakit-utils/getDocument';
|
|
import { f as FORM_PUSH_BUTTON_KEYS } from '../__keys-54ad6269.js';
|
|
import { g as getInputId, f as formatInputName } from '../getInputId-aa144169.js';
|
|
import { unstable_getIn } from './utils/getIn.js';
|
|
import { g as getPushButtonId } from '../getPushButtonId-9f434755.js';
|
|
|
|
var unstable_useFormPushButton = createHook({
|
|
name: "FormPushButton",
|
|
compose: useButton,
|
|
keys: FORM_PUSH_BUTTON_KEYS,
|
|
useOptions: function useOptions(options, _ref) {
|
|
var _options$value;
|
|
|
|
var name = _ref.name,
|
|
value = _ref.value;
|
|
return _objectSpread2(_objectSpread2({}, options), {}, {
|
|
name: options.name || name,
|
|
value: (_options$value = options.value) != null ? _options$value : value
|
|
});
|
|
},
|
|
useProps: function useProps(options, _ref2) {
|
|
var htmlOnClick = _ref2.onClick,
|
|
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["onClick"]);
|
|
|
|
var onClickRef = useLiveRef(htmlOnClick);
|
|
var onClick = useCallback(function (event) {
|
|
var _onClickRef$current, _options$push;
|
|
|
|
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
|
|
if (event.defaultPrevented) return;
|
|
(_options$push = options.push) === null || _options$push === void 0 ? void 0 : _options$push.call(options, options.name, options.value);
|
|
|
|
var _unstable_getIn = unstable_getIn(options.values, options.name, []),
|
|
length = _unstable_getIn.length;
|
|
|
|
var inputId = getInputId(formatInputName(options.name, "-") + "-" + length, options.baseId);
|
|
if (!inputId) return;
|
|
var element = event.currentTarget;
|
|
window.requestAnimationFrame(function () {
|
|
var selector = "[id^=\"" + inputId + "\"]";
|
|
var document = getDocument(element);
|
|
var input = document.querySelector(selector);
|
|
input === null || input === void 0 ? void 0 : input.focus();
|
|
});
|
|
}, [options.push, options.name, options.value, options.values, options.baseId]);
|
|
return _objectSpread2({
|
|
id: getPushButtonId(options.name, options.baseId),
|
|
onClick: onClick
|
|
}, htmlProps);
|
|
}
|
|
});
|
|
var unstable_FormPushButton = createComponent({
|
|
as: "button",
|
|
memo: true,
|
|
useHook: unstable_useFormPushButton
|
|
});
|
|
|
|
export { unstable_FormPushButton, unstable_useFormPushButton };
|