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>
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
var $TypeError = require('es-errors/type');
|
|
|
|
var MAX_SAFE_INTEGER = require('math-intrinsics/constants/maxSafeInteger');
|
|
|
|
var Call = require('./Call');
|
|
var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow');
|
|
var Get = require('./Get');
|
|
var HasProperty = require('./HasProperty');
|
|
var IsArray = require('./IsArray');
|
|
var ToLength = require('./ToLength');
|
|
var ToString = require('./ToString');
|
|
|
|
// https://262.ecma-international.org/10.0/#sec-flattenintoarray
|
|
|
|
module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) {
|
|
var mapperFunction;
|
|
if (arguments.length > 5) {
|
|
mapperFunction = arguments[5];
|
|
}
|
|
|
|
var targetIndex = start;
|
|
var sourceIndex = 0;
|
|
while (sourceIndex < sourceLen) {
|
|
var P = ToString(sourceIndex);
|
|
var exists = HasProperty(source, P);
|
|
if (exists === true) {
|
|
var element = Get(source, P);
|
|
if (typeof mapperFunction !== 'undefined') {
|
|
if (arguments.length <= 6) {
|
|
throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided');
|
|
}
|
|
element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]);
|
|
}
|
|
var shouldFlatten = false;
|
|
if (depth > 0) {
|
|
shouldFlatten = IsArray(element);
|
|
}
|
|
if (shouldFlatten) {
|
|
var elementLen = ToLength(Get(element, 'length'));
|
|
targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1);
|
|
} else {
|
|
if (targetIndex >= MAX_SAFE_INTEGER) {
|
|
throw new $TypeError('index too large');
|
|
}
|
|
CreateDataPropertyOrThrow(target, ToString(targetIndex), element);
|
|
targetIndex += 1;
|
|
}
|
|
}
|
|
sourceIndex += 1;
|
|
}
|
|
|
|
return targetIndex;
|
|
};
|