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>
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
/**
|
|
* Sets a constant default value for the property when it is undefined.
|
|
* @template T
|
|
* @template {keyof T} Property
|
|
* @param {T} object An object.
|
|
* @param {Property} property A property of the provided object.
|
|
* @param {T[Property]} [defaultValue] The default value to set for the property.
|
|
* @returns {T[Property]} The defaulted property value.
|
|
*/
|
|
const d = (object, property, defaultValue) => {
|
|
if (typeof object[property] === 'undefined' && typeof defaultValue !== 'undefined') {
|
|
object[property] = defaultValue;
|
|
}
|
|
return object[property];
|
|
};
|
|
|
|
/**
|
|
* Resolves the value for a nested object option.
|
|
* @template T
|
|
* @template {keyof T} Property
|
|
* @template Result
|
|
* @param {T} object An object.
|
|
* @param {Property} property A property of the provided object.
|
|
* @param {function(T | undefined): Result} fn The handler to resolve the property's value.
|
|
* @returns {Result} The resolved option value.
|
|
*/
|
|
const n = (object, property, fn) => {
|
|
object[property] = fn(object[property]);
|
|
return object[property];
|
|
};
|
|
|
|
module.exports = { d, n };
|