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>
52 lines
977 B
JavaScript
52 lines
977 B
JavaScript
export function klona(x) {
|
|
if (typeof x !== 'object') return x;
|
|
|
|
var k, tmp, str=Object.prototype.toString.call(x);
|
|
|
|
if (str === '[object Object]') {
|
|
if (x.constructor !== Object && typeof x.constructor === 'function') {
|
|
tmp = new x.constructor();
|
|
for (k in x) {
|
|
if (x.hasOwnProperty(k) && tmp[k] !== x[k]) {
|
|
tmp[k] = klona(x[k]);
|
|
}
|
|
}
|
|
} else {
|
|
tmp = {}; // null
|
|
for (k in x) {
|
|
if (k === '__proto__') {
|
|
Object.defineProperty(tmp, k, {
|
|
value: klona(x[k]),
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
});
|
|
} else {
|
|
tmp[k] = klona(x[k]);
|
|
}
|
|
}
|
|
}
|
|
return tmp;
|
|
}
|
|
|
|
if (str === '[object Array]') {
|
|
k = x.length;
|
|
for (tmp=Array(k); k--;) {
|
|
tmp[k] = klona(x[k]);
|
|
}
|
|
return tmp;
|
|
}
|
|
|
|
if (str === '[object Date]') {
|
|
return new Date(+x);
|
|
}
|
|
|
|
if (str === '[object RegExp]') {
|
|
tmp = new RegExp(x.source, x.flags);
|
|
tmp.lastIndex = x.lastIndex;
|
|
return tmp;
|
|
}
|
|
|
|
return x;
|
|
}
|