fix: prevent asset conflicts between React and Grid.js versions

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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

57
node_modules/intl-messageformat/lib/compiler.d.ts generated vendored Normal file
View File

@@ -0,0 +1,57 @@
import { MessageFormatPattern, MessageTextElement, ArgumentElement } from 'intl-messageformat-parser';
export interface Formats {
number: Record<string, Intl.NumberFormatOptions>;
date: Record<string, Intl.DateTimeFormatOptions>;
time: Record<string, Intl.DateTimeFormatOptions>;
}
export interface Formatters {
getNumberFormat(...args: ConstructorParameters<typeof Intl.NumberFormat>): Intl.NumberFormat;
getDateTimeFormat(...args: ConstructorParameters<typeof Intl.DateTimeFormat>): Intl.DateTimeFormat;
getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl.PluralRules;
}
export declare type Pattern = string | PluralOffsetString | PluralFormat | SelectFormat | StringFormat;
export default class Compiler {
private locales;
private formats;
private pluralNumberFormat;
private currentPlural;
private pluralStack;
private formatters;
constructor(locales: string | string[], formats: Formats, formatters: Formatters);
compile(ast: MessageFormatPattern): Pattern[];
compileMessage(ast: MessageFormatPattern): Pattern[];
compileMessageText(element: MessageTextElement): string | PluralOffsetString;
compileArgument(element: ArgumentElement): PluralFormat | SelectFormat | StringFormat;
compileOptions(element: ArgumentElement): {};
}
declare abstract class Formatter {
id: string;
constructor(id: string);
abstract format(value: string | number): string;
}
declare class StringFormat extends Formatter {
format(value: number | string): string;
}
declare class PluralFormat {
id: string;
private offset;
private options;
private pluralRules;
constructor(id: string, offset: number, options: Record<string, Pattern[]>, pluralRules: Intl.PluralRules);
getOption(value: number): Pattern[];
}
export declare class PluralOffsetString extends Formatter {
private offset;
private numberFormat;
private string;
constructor(id: string, offset: number, numberFormat: Intl.NumberFormat, string: string);
format(value: number): string;
}
export declare class SelectFormat {
id: string;
private options;
constructor(id: string, options: Record<string, Pattern[]>);
getOption(value: string): Pattern[];
}
export declare function isSelectOrPluralFormat(f: any): f is SelectFormat | PluralFormat;
export {};

197
node_modules/intl-messageformat/lib/compiler.js generated vendored Normal file
View File

@@ -0,0 +1,197 @@
/*
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
Copyrights licensed under the New BSD License.
See the accompanying LICENSE file for terms.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Compiler = /** @class */ (function () {
function Compiler(locales, formats, formatters) {
this.locales = [];
this.formats = {
number: {},
date: {},
time: {}
};
this.pluralNumberFormat = null;
this.currentPlural = null;
this.pluralStack = [];
this.locales = locales;
this.formats = formats;
this.formatters = formatters;
}
Compiler.prototype.compile = function (ast) {
this.pluralStack = [];
this.currentPlural = null;
this.pluralNumberFormat = null;
return this.compileMessage(ast);
};
Compiler.prototype.compileMessage = function (ast) {
var _this = this;
if (!(ast && ast.type === 'messageFormatPattern')) {
throw new Error('Message AST is not of type: "messageFormatPattern"');
}
var elements = ast.elements;
var pattern = elements
.filter(function (el) {
return el.type === 'messageTextElement' || el.type === 'argumentElement';
})
.map(function (el) {
return el.type === 'messageTextElement'
? _this.compileMessageText(el)
: _this.compileArgument(el);
});
if (pattern.length !== elements.length) {
throw new Error('Message element does not have a valid type');
}
return pattern;
};
Compiler.prototype.compileMessageText = function (element) {
// When this `element` is part of plural sub-pattern and its value contains
// an unescaped '#', use a `PluralOffsetString` helper to properly output
// the number with the correct offset in the string.
if (this.currentPlural && /(^|[^\\])#/g.test(element.value)) {
// Create a cache a NumberFormat instance that can be reused for any
// PluralOffsetString instance in this message.
if (!this.pluralNumberFormat) {
this.pluralNumberFormat = new Intl.NumberFormat(this.locales);
}
return new PluralOffsetString(this.currentPlural.id, this.currentPlural.format.offset, this.pluralNumberFormat, element.value);
}
// Unescape the escaped '#'s in the message text.
return element.value.replace(/\\#/g, '#');
};
Compiler.prototype.compileArgument = function (element) {
var format = element.format, id = element.id;
var formatters = this.formatters;
if (!format) {
return new StringFormat(id);
}
var _a = this, formats = _a.formats, locales = _a.locales;
switch (format.type) {
case 'numberFormat':
return {
id: id,
format: formatters.getNumberFormat(locales, formats.number[format.style]).format
};
case 'dateFormat':
return {
id: id,
format: formatters.getDateTimeFormat(locales, formats.date[format.style]).format
};
case 'timeFormat':
return {
id: id,
format: formatters.getDateTimeFormat(locales, formats.time[format.style]).format
};
case 'pluralFormat':
return new PluralFormat(id, format.offset, this.compileOptions(element), formatters.getPluralRules(locales, {
type: format.ordinal ? 'ordinal' : 'cardinal'
}));
case 'selectFormat':
return new SelectFormat(id, this.compileOptions(element));
default:
throw new Error('Message element does not have a valid format type');
}
};
Compiler.prototype.compileOptions = function (element) {
var _this = this;
var format = element.format;
var options = format.options;
// Save the current plural element, if any, then set it to a new value when
// compiling the options sub-patterns. This conforms the spec's algorithm
// for handling `"#"` syntax in message text.
this.pluralStack.push(this.currentPlural);
this.currentPlural = format.type === 'pluralFormat' ? element : null;
var optionsHash = options.reduce(function (all, option) {
// Compile the sub-pattern and save it under the options's selector.
all[option.selector] = _this.compileMessage(option.value);
return all;
}, {});
// Pop the plural stack to put back the original current plural value.
this.currentPlural = this.pluralStack.pop();
return optionsHash;
};
return Compiler;
}());
export default Compiler;
// -- Compiler Helper Classes --------------------------------------------------
var Formatter = /** @class */ (function () {
function Formatter(id) {
this.id = id;
}
return Formatter;
}());
var StringFormat = /** @class */ (function (_super) {
__extends(StringFormat, _super);
function StringFormat() {
return _super !== null && _super.apply(this, arguments) || this;
}
StringFormat.prototype.format = function (value) {
if (!value && typeof value !== 'number') {
return '';
}
return typeof value === 'string' ? value : String(value);
};
return StringFormat;
}(Formatter));
var PluralFormat = /** @class */ (function () {
function PluralFormat(id, offset, options, pluralRules) {
this.id = id;
this.offset = offset;
this.options = options;
this.pluralRules = pluralRules;
}
PluralFormat.prototype.getOption = function (value) {
var options = this.options;
var option = options['=' + value] ||
options[this.pluralRules.select(value - this.offset)];
return option || options.other;
};
return PluralFormat;
}());
var PluralOffsetString = /** @class */ (function (_super) {
__extends(PluralOffsetString, _super);
function PluralOffsetString(id, offset, numberFormat, string) {
var _this = _super.call(this, id) || this;
_this.offset = offset;
_this.numberFormat = numberFormat;
_this.string = string;
return _this;
}
PluralOffsetString.prototype.format = function (value) {
var number = this.numberFormat.format(value - this.offset);
return this.string
.replace(/(^|[^\\])#/g, '$1' + number)
.replace(/\\#/g, '#');
};
return PluralOffsetString;
}(Formatter));
export { PluralOffsetString };
var SelectFormat = /** @class */ (function () {
function SelectFormat(id, options) {
this.id = id;
this.options = options;
}
SelectFormat.prototype.getOption = function (value) {
var options = this.options;
return options[value] || options.other;
};
return SelectFormat;
}());
export { SelectFormat };
export function isSelectOrPluralFormat(f) {
return !!f.options;
}
//# sourceMappingURL=compiler.js.map

1
node_modules/intl-messageformat/lib/compiler.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

78
node_modules/intl-messageformat/lib/core.d.ts generated vendored Normal file
View File

@@ -0,0 +1,78 @@
import { Formats, Formatters } from './compiler';
import parser, { MessageFormatPattern } from 'intl-messageformat-parser';
export interface Options {
formatters?: Formatters;
}
export declare function createDefaultFormatters(): Formatters;
export declare class IntlMessageFormat {
private ast;
private locale;
private pattern;
private message;
constructor(message: string | MessageFormatPattern, locales?: string | string[], overrideFormats?: Partial<Formats>, opts?: Options);
format: (values?: Record<string, string | number | boolean | null | undefined> | undefined) => string;
resolvedOptions(): {
locale: string;
};
getAst(): MessageFormatPattern;
static defaultLocale: string;
static __parse: typeof parser['parse'] | undefined;
static formats: {
number: {
currency: {
style: string;
};
percent: {
style: string;
};
};
date: {
short: {
month: string;
day: string;
year: string;
};
medium: {
month: string;
day: string;
year: string;
};
long: {
month: string;
day: string;
year: string;
};
full: {
weekday: string;
month: string;
day: string;
year: string;
};
};
time: {
short: {
hour: string;
minute: string;
};
medium: {
hour: string;
minute: string;
second: string;
};
long: {
hour: string;
minute: string;
second: string;
timeZoneName: string;
};
full: {
hour: string;
minute: string;
second: string;
timeZoneName: string;
};
};
};
}
export { Formats, Pattern } from './compiler';
export default IntlMessageFormat;

245
node_modules/intl-messageformat/lib/core.js generated vendored Normal file
View File

@@ -0,0 +1,245 @@
/*
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
Copyrights licensed under the New BSD License.
See the accompanying LICENSE file for terms.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/* jslint esnext: true */
import Compiler, { isSelectOrPluralFormat } from './compiler';
// -- MessageFormat --------------------------------------------------------
function resolveLocale(locales) {
if (typeof locales === 'string') {
locales = [locales];
}
try {
return Intl.NumberFormat.supportedLocalesOf(locales, {
// IE11 localeMatcher `lookup` seems to convert `en` -> `en-US`
// but not other browsers,
localeMatcher: 'best fit'
})[0];
}
catch (e) {
return IntlMessageFormat.defaultLocale;
}
}
function formatPatterns(pattern, values) {
var result = '';
for (var _i = 0, pattern_1 = pattern; _i < pattern_1.length; _i++) {
var part = pattern_1[_i];
// Exist early for string parts.
if (typeof part === 'string') {
result += part;
continue;
}
var id = part.id;
// Enforce that all required values are provided by the caller.
if (!(values && id in values)) {
throw new FormatError("A value must be provided for: " + id, id);
}
var value = values[id];
// Recursively format plural and select parts' option — which can be a
// nested pattern structure. The choosing of the option to use is
// abstracted-by and delegated-to the part helper object.
if (isSelectOrPluralFormat(part)) {
result += formatPatterns(part.getOption(value), values);
}
else {
result += part.format(value);
}
}
return result;
}
function mergeConfig(c1, c2) {
if (!c2) {
return c1;
}
return __assign({}, (c1 || {}), (c2 || {}), Object.keys(c1).reduce(function (all, k) {
all[k] = __assign({}, c1[k], (c2[k] || {}));
return all;
}, {}));
}
function mergeConfigs(defaultConfig, configs) {
if (!configs) {
return defaultConfig;
}
return Object.keys(defaultConfig).reduce(function (all, k) {
all[k] = mergeConfig(defaultConfig[k], configs[k]);
return all;
}, __assign({}, defaultConfig));
}
var FormatError = /** @class */ (function (_super) {
__extends(FormatError, _super);
function FormatError(msg, variableId) {
var _this = _super.call(this, msg) || this;
_this.variableId = variableId;
return _this;
}
return FormatError;
}(Error));
export function createDefaultFormatters() {
return {
getNumberFormat: function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new ((_a = Intl.NumberFormat).bind.apply(_a, [void 0].concat(args)))();
},
getDateTimeFormat: function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, [void 0].concat(args)))();
},
getPluralRules: function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new ((_a = Intl.PluralRules).bind.apply(_a, [void 0].concat(args)))();
}
};
}
var IntlMessageFormat = /** @class */ (function () {
function IntlMessageFormat(message, locales, overrideFormats, opts) {
var _this = this;
if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
this.format = function (values) {
try {
return formatPatterns(_this.pattern, values);
}
catch (e) {
if (e.variableId) {
throw new Error("The intl string context variable '" + e.variableId + "' was not provided to the string '" + _this.message + "'");
}
else {
throw e;
}
}
};
if (typeof message === 'string') {
if (!IntlMessageFormat.__parse) {
throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`');
}
// Parse string messages into an AST.
this.ast = IntlMessageFormat.__parse(message);
}
else {
this.ast = message;
}
this.message = message;
if (!(this.ast && this.ast.type === 'messageFormatPattern')) {
throw new TypeError('A message must be provided as a String or AST.');
}
// Creates a new object with the specified `formats` merged with the default
// formats.
var formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);
// Defined first because it's used to build the format pattern.
this.locale = resolveLocale(locales || []);
var formatters = (opts && opts.formatters) || createDefaultFormatters();
// Compile the `ast` to a pattern that is highly optimized for repeated
// `format()` invocations. **Note:** This passes the `locales` set provided
// to the constructor instead of just the resolved locale.
this.pattern = new Compiler(locales, formats, formatters).compile(this.ast);
// "Bind" `format()` method to `this` so it can be passed by reference like
// the other `Intl` APIs.
}
IntlMessageFormat.prototype.resolvedOptions = function () {
return { locale: this.locale };
};
IntlMessageFormat.prototype.getAst = function () {
return this.ast;
};
IntlMessageFormat.defaultLocale = 'en';
IntlMessageFormat.__parse = undefined;
// Default format options used as the prototype of the `formats` provided to the
// constructor. These are used when constructing the internal Intl.NumberFormat
// and Intl.DateTimeFormat instances.
IntlMessageFormat.formats = {
number: {
currency: {
style: 'currency'
},
percent: {
style: 'percent'
}
},
date: {
short: {
month: 'numeric',
day: 'numeric',
year: '2-digit'
},
medium: {
month: 'short',
day: 'numeric',
year: 'numeric'
},
long: {
month: 'long',
day: 'numeric',
year: 'numeric'
},
full: {
weekday: 'long',
month: 'long',
day: 'numeric',
year: 'numeric'
}
},
time: {
short: {
hour: 'numeric',
minute: 'numeric'
},
medium: {
hour: 'numeric',
minute: 'numeric',
second: 'numeric'
},
long: {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
timeZoneName: 'short'
},
full: {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
timeZoneName: 'short'
}
}
};
return IntlMessageFormat;
}());
export { IntlMessageFormat };
export default IntlMessageFormat;
//# sourceMappingURL=core.js.map

1
node_modules/intl-messageformat/lib/core.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

5
node_modules/intl-messageformat/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import IntlMessageFormat from './core';
export { Formats, Pattern } from './compiler';
export * from './core';
export { Formatters } from './compiler';
export default IntlMessageFormat;

11
node_modules/intl-messageformat/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/*
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
Copyrights licensed under the New BSD License.
See the accompanying LICENSE file for terms.
*/
import parser from 'intl-messageformat-parser';
import IntlMessageFormat from './core';
IntlMessageFormat.__parse = parser.parse;
export * from './core';
export default IntlMessageFormat;
//# sourceMappingURL=index.js.map

1
node_modules/intl-messageformat/lib/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,iBAAiB,MAAM,QAAQ,CAAC;AAEvC,iBAAiB,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAGzC,cAAc,QAAQ,CAAC;AAEvB,eAAe,iBAAiB,CAAC"}