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>
43 lines
1.7 KiB
JavaScript
43 lines
1.7 KiB
JavaScript
'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 Role_Role = require('../Role/Role.js');
|
|
var __keys = require('../__keys-4b3c7cdc.js');
|
|
require('../getInputId-cbd3bbcc.js');
|
|
var Form_utils_getIn = require('./utils/getIn.js');
|
|
var shouldShowError = require('../shouldShowError-880a39c9.js');
|
|
|
|
function shouldShowMessage(_ref, name) {
|
|
var touched = _ref.touched,
|
|
messages = _ref.messages;
|
|
return !!(Form_utils_getIn.unstable_getIn(touched, name) && Form_utils_getIn.unstable_getIn(messages, name));
|
|
}
|
|
|
|
var unstable_useFormMessage = createHook.createHook({
|
|
name: "FormMessage",
|
|
compose: Role_Role.useRole,
|
|
keys: __keys.FORM_MESSAGE_KEYS,
|
|
useProps: function useProps(options, htmlProps) {
|
|
var children = shouldShowError.shouldShowError(options, options.name) ? Form_utils_getIn.unstable_getIn(options.errors, options.name) : undefined;
|
|
children = children || (shouldShowMessage(options, options.name) ? Form_utils_getIn.unstable_getIn(options.messages, options.name) : undefined);
|
|
return _rollupPluginBabelHelpers._objectSpread2({
|
|
role: "alert",
|
|
id: shouldShowError.getMessageId(options.name, options.baseId),
|
|
children: children
|
|
}, htmlProps);
|
|
}
|
|
});
|
|
var unstable_FormMessage = createComponent.createComponent({
|
|
as: "div",
|
|
memo: true,
|
|
useHook: unstable_useFormMessage
|
|
});
|
|
|
|
exports.unstable_FormMessage = unstable_FormMessage;
|
|
exports.unstable_useFormMessage = unstable_useFormMessage;
|