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>
174 lines
4.8 KiB
JavaScript
174 lines
4.8 KiB
JavaScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
var objectToString = Object.prototype.toString;
|
|
/**
|
|
* Checks whether given value's type is one of a few Error or Error-like
|
|
* {@link isError}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isError(wat) {
|
|
switch (objectToString.call(wat)) {
|
|
case '[object Error]':
|
|
case '[object Exception]':
|
|
case '[object DOMException]':
|
|
return true;
|
|
default:
|
|
return isInstanceOf(wat, Error);
|
|
}
|
|
}
|
|
exports.isError = isError;
|
|
function isBuiltin(wat, ty) {
|
|
return objectToString.call(wat) === "[object " + ty + "]";
|
|
}
|
|
/**
|
|
* Checks whether given value's type is ErrorEvent
|
|
* {@link isErrorEvent}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isErrorEvent(wat) {
|
|
return isBuiltin(wat, 'ErrorEvent');
|
|
}
|
|
exports.isErrorEvent = isErrorEvent;
|
|
/**
|
|
* Checks whether given value's type is DOMError
|
|
* {@link isDOMError}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isDOMError(wat) {
|
|
return isBuiltin(wat, 'DOMError');
|
|
}
|
|
exports.isDOMError = isDOMError;
|
|
/**
|
|
* Checks whether given value's type is DOMException
|
|
* {@link isDOMException}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isDOMException(wat) {
|
|
return isBuiltin(wat, 'DOMException');
|
|
}
|
|
exports.isDOMException = isDOMException;
|
|
/**
|
|
* Checks whether given value's type is a string
|
|
* {@link isString}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isString(wat) {
|
|
return isBuiltin(wat, 'String');
|
|
}
|
|
exports.isString = isString;
|
|
/**
|
|
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)
|
|
* {@link isPrimitive}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isPrimitive(wat) {
|
|
return wat === null || (typeof wat !== 'object' && typeof wat !== 'function');
|
|
}
|
|
exports.isPrimitive = isPrimitive;
|
|
/**
|
|
* Checks whether given value's type is an object literal
|
|
* {@link isPlainObject}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isPlainObject(wat) {
|
|
return isBuiltin(wat, 'Object');
|
|
}
|
|
exports.isPlainObject = isPlainObject;
|
|
/**
|
|
* Checks whether given value's type is an Event instance
|
|
* {@link isEvent}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isEvent(wat) {
|
|
return typeof Event !== 'undefined' && isInstanceOf(wat, Event);
|
|
}
|
|
exports.isEvent = isEvent;
|
|
/**
|
|
* Checks whether given value's type is an Element instance
|
|
* {@link isElement}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isElement(wat) {
|
|
return typeof Element !== 'undefined' && isInstanceOf(wat, Element);
|
|
}
|
|
exports.isElement = isElement;
|
|
/**
|
|
* Checks whether given value's type is an regexp
|
|
* {@link isRegExp}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isRegExp(wat) {
|
|
return isBuiltin(wat, 'RegExp');
|
|
}
|
|
exports.isRegExp = isRegExp;
|
|
/**
|
|
* Checks whether given value has a then function.
|
|
* @param wat A value to be checked.
|
|
*/
|
|
function isThenable(wat) {
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
return Boolean(wat && wat.then && typeof wat.then === 'function');
|
|
}
|
|
exports.isThenable = isThenable;
|
|
/**
|
|
* Checks whether given value's type is a SyntheticEvent
|
|
* {@link isSyntheticEvent}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isSyntheticEvent(wat) {
|
|
return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;
|
|
}
|
|
exports.isSyntheticEvent = isSyntheticEvent;
|
|
/**
|
|
* Checks whether given value is NaN
|
|
* {@link isNaN}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isNaN(wat) {
|
|
return typeof wat === 'number' && wat !== wat;
|
|
}
|
|
exports.isNaN = isNaN;
|
|
/**
|
|
* Checks whether given value's type is an instance of provided constructor.
|
|
* {@link isInstanceOf}.
|
|
*
|
|
* @param wat A value to be checked.
|
|
* @param base A constructor to be used in a check.
|
|
* @returns A boolean representing the result.
|
|
*/
|
|
function isInstanceOf(wat, base) {
|
|
try {
|
|
return wat instanceof base;
|
|
}
|
|
catch (_e) {
|
|
return false;
|
|
}
|
|
}
|
|
exports.isInstanceOf = isInstanceOf;
|
|
//# sourceMappingURL=is.js.map
|