@fctc/sme-widget-ui 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +499 -496
- package/dist/index.mjs +497 -494
- package/dist/widgets.js +499 -496
- package/dist/widgets.mjs +497 -494
- package/package.json +1 -1
package/dist/widgets.mjs
CHANGED
|
@@ -264,13 +264,13 @@ var require_moment = __commonJS({
|
|
|
264
264
|
}, fn);
|
|
265
265
|
}
|
|
266
266
|
var deprecations = {};
|
|
267
|
-
function deprecateSimple(
|
|
267
|
+
function deprecateSimple(name, msg) {
|
|
268
268
|
if (hooks.deprecationHandler != null) {
|
|
269
|
-
hooks.deprecationHandler(
|
|
269
|
+
hooks.deprecationHandler(name, msg);
|
|
270
270
|
}
|
|
271
|
-
if (!deprecations[
|
|
271
|
+
if (!deprecations[name]) {
|
|
272
272
|
warn3(msg);
|
|
273
|
-
deprecations[
|
|
273
|
+
deprecations[name] = true;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
hooks.suppressDeprecationWarnings = false;
|
|
@@ -1552,22 +1552,22 @@ var require_moment = __commonJS({
|
|
|
1552
1552
|
}
|
|
1553
1553
|
return globalLocale;
|
|
1554
1554
|
}
|
|
1555
|
-
function isLocaleNameSane(
|
|
1556
|
-
return !!(
|
|
1555
|
+
function isLocaleNameSane(name) {
|
|
1556
|
+
return !!(name && name.match("^[^/\\\\]*$"));
|
|
1557
1557
|
}
|
|
1558
|
-
function loadLocale(
|
|
1558
|
+
function loadLocale(name) {
|
|
1559
1559
|
var oldLocale = null, aliasedRequire;
|
|
1560
|
-
if (locales[
|
|
1560
|
+
if (locales[name] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name)) {
|
|
1561
1561
|
try {
|
|
1562
1562
|
oldLocale = globalLocale._abbr;
|
|
1563
1563
|
aliasedRequire = __require;
|
|
1564
|
-
aliasedRequire("./locale/" +
|
|
1564
|
+
aliasedRequire("./locale/" + name);
|
|
1565
1565
|
getSetGlobalLocale(oldLocale);
|
|
1566
1566
|
} catch (e3) {
|
|
1567
|
-
locales[
|
|
1567
|
+
locales[name] = null;
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
-
return locales[
|
|
1570
|
+
return locales[name];
|
|
1571
1571
|
}
|
|
1572
1572
|
function getSetGlobalLocale(key, values) {
|
|
1573
1573
|
var data;
|
|
@@ -1589,16 +1589,16 @@ var require_moment = __commonJS({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
return globalLocale._abbr;
|
|
1591
1591
|
}
|
|
1592
|
-
function defineLocale(
|
|
1592
|
+
function defineLocale(name, config) {
|
|
1593
1593
|
if (config !== null) {
|
|
1594
1594
|
var locale2, parentConfig = baseConfig;
|
|
1595
|
-
config.abbr =
|
|
1596
|
-
if (locales[
|
|
1595
|
+
config.abbr = name;
|
|
1596
|
+
if (locales[name] != null) {
|
|
1597
1597
|
deprecateSimple(
|
|
1598
1598
|
"defineLocaleOverride",
|
|
1599
1599
|
"use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
|
|
1600
1600
|
);
|
|
1601
|
-
parentConfig = locales[
|
|
1601
|
+
parentConfig = locales[name]._config;
|
|
1602
1602
|
} else if (config.parentLocale != null) {
|
|
1603
1603
|
if (locales[config.parentLocale] != null) {
|
|
1604
1604
|
parentConfig = locales[config.parentLocale]._config;
|
|
@@ -1611,58 +1611,58 @@ var require_moment = __commonJS({
|
|
|
1611
1611
|
localeFamilies[config.parentLocale] = [];
|
|
1612
1612
|
}
|
|
1613
1613
|
localeFamilies[config.parentLocale].push({
|
|
1614
|
-
name
|
|
1614
|
+
name,
|
|
1615
1615
|
config
|
|
1616
1616
|
});
|
|
1617
1617
|
return null;
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
|
-
locales[
|
|
1622
|
-
if (localeFamilies[
|
|
1623
|
-
localeFamilies[
|
|
1621
|
+
locales[name] = new Locale(mergeConfigs(parentConfig, config));
|
|
1622
|
+
if (localeFamilies[name]) {
|
|
1623
|
+
localeFamilies[name].forEach(function(x2) {
|
|
1624
1624
|
defineLocale(x2.name, x2.config);
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
|
-
getSetGlobalLocale(
|
|
1628
|
-
return locales[
|
|
1627
|
+
getSetGlobalLocale(name);
|
|
1628
|
+
return locales[name];
|
|
1629
1629
|
} else {
|
|
1630
|
-
delete locales[
|
|
1630
|
+
delete locales[name];
|
|
1631
1631
|
return null;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
|
-
function updateLocale(
|
|
1634
|
+
function updateLocale(name, config) {
|
|
1635
1635
|
if (config != null) {
|
|
1636
1636
|
var locale2, tmpLocale, parentConfig = baseConfig;
|
|
1637
|
-
if (locales[
|
|
1638
|
-
locales[
|
|
1637
|
+
if (locales[name] != null && locales[name].parentLocale != null) {
|
|
1638
|
+
locales[name].set(mergeConfigs(locales[name]._config, config));
|
|
1639
1639
|
} else {
|
|
1640
|
-
tmpLocale = loadLocale(
|
|
1640
|
+
tmpLocale = loadLocale(name);
|
|
1641
1641
|
if (tmpLocale != null) {
|
|
1642
1642
|
parentConfig = tmpLocale._config;
|
|
1643
1643
|
}
|
|
1644
1644
|
config = mergeConfigs(parentConfig, config);
|
|
1645
1645
|
if (tmpLocale == null) {
|
|
1646
|
-
config.abbr =
|
|
1646
|
+
config.abbr = name;
|
|
1647
1647
|
}
|
|
1648
1648
|
locale2 = new Locale(config);
|
|
1649
|
-
locale2.parentLocale = locales[
|
|
1650
|
-
locales[
|
|
1649
|
+
locale2.parentLocale = locales[name];
|
|
1650
|
+
locales[name] = locale2;
|
|
1651
1651
|
}
|
|
1652
|
-
getSetGlobalLocale(
|
|
1652
|
+
getSetGlobalLocale(name);
|
|
1653
1653
|
} else {
|
|
1654
|
-
if (locales[
|
|
1655
|
-
if (locales[
|
|
1656
|
-
locales[
|
|
1657
|
-
if (
|
|
1658
|
-
getSetGlobalLocale(
|
|
1654
|
+
if (locales[name] != null) {
|
|
1655
|
+
if (locales[name].parentLocale != null) {
|
|
1656
|
+
locales[name] = locales[name].parentLocale;
|
|
1657
|
+
if (name === getSetGlobalLocale()) {
|
|
1658
|
+
getSetGlobalLocale(name);
|
|
1659
1659
|
}
|
|
1660
|
-
} else if (locales[
|
|
1661
|
-
delete locales[
|
|
1660
|
+
} else if (locales[name] != null) {
|
|
1661
|
+
delete locales[name];
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
-
return locales[
|
|
1665
|
+
return locales[name];
|
|
1666
1666
|
}
|
|
1667
1667
|
function getLocale(key) {
|
|
1668
1668
|
var locale2;
|
|
@@ -2568,13 +2568,13 @@ var require_moment = __commonJS({
|
|
|
2568
2568
|
}
|
|
2569
2569
|
return res;
|
|
2570
2570
|
}
|
|
2571
|
-
function createAdder(direction,
|
|
2571
|
+
function createAdder(direction, name) {
|
|
2572
2572
|
return function(val, period) {
|
|
2573
2573
|
var dur, tmp;
|
|
2574
2574
|
if (period !== null && !isNaN(+period)) {
|
|
2575
2575
|
deprecateSimple(
|
|
2576
|
-
|
|
2577
|
-
"moment()." +
|
|
2576
|
+
name,
|
|
2577
|
+
"moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
|
|
2578
2578
|
);
|
|
2579
2579
|
tmp = val;
|
|
2580
2580
|
val = period;
|
|
@@ -3153,10 +3153,10 @@ var require_moment = __commonJS({
|
|
|
3153
3153
|
return eras;
|
|
3154
3154
|
}
|
|
3155
3155
|
function localeErasParse(eraName, format3, strict) {
|
|
3156
|
-
var i3, l2, eras = this.eras(),
|
|
3156
|
+
var i3, l2, eras = this.eras(), name, abbr, narrow;
|
|
3157
3157
|
eraName = eraName.toUpperCase();
|
|
3158
3158
|
for (i3 = 0, l2 = eras.length; i3 < l2; ++i3) {
|
|
3159
|
-
|
|
3159
|
+
name = eras[i3].name.toUpperCase();
|
|
3160
3160
|
abbr = eras[i3].abbr.toUpperCase();
|
|
3161
3161
|
narrow = eras[i3].narrow.toUpperCase();
|
|
3162
3162
|
if (strict) {
|
|
@@ -3169,7 +3169,7 @@ var require_moment = __commonJS({
|
|
|
3169
3169
|
}
|
|
3170
3170
|
break;
|
|
3171
3171
|
case "NNNN":
|
|
3172
|
-
if (
|
|
3172
|
+
if (name === eraName) {
|
|
3173
3173
|
return eras[i3];
|
|
3174
3174
|
}
|
|
3175
3175
|
break;
|
|
@@ -3179,7 +3179,7 @@ var require_moment = __commonJS({
|
|
|
3179
3179
|
}
|
|
3180
3180
|
break;
|
|
3181
3181
|
}
|
|
3182
|
-
} else if ([
|
|
3182
|
+
} else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
|
|
3183
3183
|
return eras[i3];
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
@@ -3817,9 +3817,9 @@ var require_moment = __commonJS({
|
|
|
3817
3817
|
units = normalizeUnits(units);
|
|
3818
3818
|
return this.isValid() ? this[units + "s"]() : NaN;
|
|
3819
3819
|
}
|
|
3820
|
-
function makeGetter(
|
|
3820
|
+
function makeGetter(name) {
|
|
3821
3821
|
return function() {
|
|
3822
|
-
return this.isValid() ? this._data[
|
|
3822
|
+
return this.isValid() ? this._data[name] : NaN;
|
|
3823
3823
|
};
|
|
3824
3824
|
}
|
|
3825
3825
|
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
|
|
@@ -6400,11 +6400,11 @@ var Formatter = class {
|
|
|
6400
6400
|
};
|
|
6401
6401
|
this.formatSeparator = options2.interpolation.formatSeparator || ",";
|
|
6402
6402
|
}
|
|
6403
|
-
add(
|
|
6404
|
-
this.formats[
|
|
6403
|
+
add(name, fc) {
|
|
6404
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
6405
6405
|
}
|
|
6406
|
-
addCached(
|
|
6407
|
-
this.formats[
|
|
6406
|
+
addCached(name, fc) {
|
|
6407
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
6408
6408
|
}
|
|
6409
6409
|
format(value, format2, lng) {
|
|
6410
6410
|
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -6440,9 +6440,9 @@ var Formatter = class {
|
|
|
6440
6440
|
return result;
|
|
6441
6441
|
}
|
|
6442
6442
|
};
|
|
6443
|
-
var removePending = (q3,
|
|
6444
|
-
if (q3.pending[
|
|
6445
|
-
delete q3.pending[
|
|
6443
|
+
var removePending = (q3, name) => {
|
|
6444
|
+
if (q3.pending[name] !== void 0) {
|
|
6445
|
+
delete q3.pending[name];
|
|
6446
6446
|
q3.pendingCount--;
|
|
6447
6447
|
}
|
|
6448
6448
|
};
|
|
@@ -6473,17 +6473,17 @@ var Connector = class extends EventEmitter {
|
|
|
6473
6473
|
languages.forEach((lng) => {
|
|
6474
6474
|
let hasAllNamespaces = true;
|
|
6475
6475
|
namespaces.forEach((ns) => {
|
|
6476
|
-
const
|
|
6476
|
+
const name = `${lng}|${ns}`;
|
|
6477
6477
|
if (!options2.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
6478
|
-
this.state[
|
|
6479
|
-
} else if (this.state[
|
|
6480
|
-
else if (this.state[
|
|
6481
|
-
if (pending[
|
|
6478
|
+
this.state[name] = 2;
|
|
6479
|
+
} else if (this.state[name] < 0) ;
|
|
6480
|
+
else if (this.state[name] === 1) {
|
|
6481
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
6482
6482
|
} else {
|
|
6483
|
-
this.state[
|
|
6483
|
+
this.state[name] = 1;
|
|
6484
6484
|
hasAllNamespaces = false;
|
|
6485
|
-
if (pending[
|
|
6486
|
-
if (toLoad[
|
|
6485
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
6486
|
+
if (toLoad[name] === void 0) toLoad[name] = true;
|
|
6487
6487
|
if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true;
|
|
6488
6488
|
}
|
|
6489
6489
|
});
|
|
@@ -6505,8 +6505,8 @@ var Connector = class extends EventEmitter {
|
|
|
6505
6505
|
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
6506
6506
|
};
|
|
6507
6507
|
}
|
|
6508
|
-
loaded(
|
|
6509
|
-
const s4 =
|
|
6508
|
+
loaded(name, err, data) {
|
|
6509
|
+
const s4 = name.split("|");
|
|
6510
6510
|
const lng = s4[0];
|
|
6511
6511
|
const ns = s4[1];
|
|
6512
6512
|
if (err) this.emit("failedLoading", lng, ns, err);
|
|
@@ -6515,12 +6515,12 @@ var Connector = class extends EventEmitter {
|
|
|
6515
6515
|
skipCopy: true
|
|
6516
6516
|
});
|
|
6517
6517
|
}
|
|
6518
|
-
this.state[
|
|
6519
|
-
if (err && data) this.state[
|
|
6518
|
+
this.state[name] = err ? -1 : 2;
|
|
6519
|
+
if (err && data) this.state[name] = 0;
|
|
6520
6520
|
const loaded = {};
|
|
6521
6521
|
this.queue.forEach((q3) => {
|
|
6522
6522
|
pushPath(q3.loaded, [lng], ns);
|
|
6523
|
-
removePending(q3,
|
|
6523
|
+
removePending(q3, name);
|
|
6524
6524
|
if (err) q3.errors.push(err);
|
|
6525
6525
|
if (q3.pendingCount === 0 && !q3.done) {
|
|
6526
6526
|
Object.keys(q3.loaded).forEach((l2) => {
|
|
@@ -6604,8 +6604,8 @@ var Connector = class extends EventEmitter {
|
|
|
6604
6604
|
if (!toLoad.pending.length) callback();
|
|
6605
6605
|
return null;
|
|
6606
6606
|
}
|
|
6607
|
-
toLoad.toLoad.forEach((
|
|
6608
|
-
this.loadOne(
|
|
6607
|
+
toLoad.toLoad.forEach((name) => {
|
|
6608
|
+
this.loadOne(name);
|
|
6609
6609
|
});
|
|
6610
6610
|
}
|
|
6611
6611
|
load(languages, namespaces, callback) {
|
|
@@ -6616,15 +6616,15 @@ var Connector = class extends EventEmitter {
|
|
|
6616
6616
|
reload: true
|
|
6617
6617
|
}, callback);
|
|
6618
6618
|
}
|
|
6619
|
-
loadOne(
|
|
6619
|
+
loadOne(name) {
|
|
6620
6620
|
let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
6621
|
-
const s4 =
|
|
6621
|
+
const s4 = name.split("|");
|
|
6622
6622
|
const lng = s4[0];
|
|
6623
6623
|
const ns = s4[1];
|
|
6624
6624
|
this.read(lng, ns, "read", void 0, void 0, (err, data) => {
|
|
6625
6625
|
if (err) this.logger.warn(`${prefix2}loading namespace ${ns} for language ${lng} failed`, err);
|
|
6626
6626
|
if (!err && data) this.logger.log(`${prefix2}loaded namespace ${ns} for language ${lng}`, data);
|
|
6627
|
-
this.loaded(
|
|
6627
|
+
this.loaded(name, err, data);
|
|
6628
6628
|
});
|
|
6629
6629
|
}
|
|
6630
6630
|
saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
@@ -7274,13 +7274,13 @@ function hasXSS(input) {
|
|
|
7274
7274
|
return xssPatterns.some((pattern) => pattern.test(input));
|
|
7275
7275
|
}
|
|
7276
7276
|
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
7277
|
-
var serializeCookie = function(
|
|
7277
|
+
var serializeCookie = function(name, val) {
|
|
7278
7278
|
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
7279
7279
|
path: "/"
|
|
7280
7280
|
};
|
|
7281
7281
|
const opt = options2;
|
|
7282
7282
|
const value = encodeURIComponent(val);
|
|
7283
|
-
let str = `${
|
|
7283
|
+
let str = `${name}=${value}`;
|
|
7284
7284
|
if (opt.maxAge > 0) {
|
|
7285
7285
|
const maxAge = opt.maxAge - 0;
|
|
7286
7286
|
if (Number.isNaN(maxAge)) throw new Error("maxAge should be a Number");
|
|
@@ -7329,7 +7329,7 @@ var serializeCookie = function(name2, val) {
|
|
|
7329
7329
|
return str;
|
|
7330
7330
|
};
|
|
7331
7331
|
var cookie = {
|
|
7332
|
-
create(
|
|
7332
|
+
create(name, value, minutes, domain) {
|
|
7333
7333
|
let cookieOptions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
7334
7334
|
path: "/",
|
|
7335
7335
|
sameSite: "strict"
|
|
@@ -7339,10 +7339,10 @@ var cookie = {
|
|
|
7339
7339
|
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1e3);
|
|
7340
7340
|
}
|
|
7341
7341
|
if (domain) cookieOptions.domain = domain;
|
|
7342
|
-
document.cookie = serializeCookie(
|
|
7342
|
+
document.cookie = serializeCookie(name, value, cookieOptions);
|
|
7343
7343
|
},
|
|
7344
|
-
read(
|
|
7345
|
-
const nameEQ = `${
|
|
7344
|
+
read(name) {
|
|
7345
|
+
const nameEQ = `${name}=`;
|
|
7346
7346
|
const ca = document.cookie.split(";");
|
|
7347
7347
|
for (let i3 = 0; i3 < ca.length; i3++) {
|
|
7348
7348
|
let c2 = ca[i3];
|
|
@@ -7351,8 +7351,8 @@ var cookie = {
|
|
|
7351
7351
|
}
|
|
7352
7352
|
return null;
|
|
7353
7353
|
},
|
|
7354
|
-
remove(
|
|
7355
|
-
this.create(
|
|
7354
|
+
remove(name, domain) {
|
|
7355
|
+
this.create(name, "", -1, domain);
|
|
7356
7356
|
}
|
|
7357
7357
|
};
|
|
7358
7358
|
var cookie$1 = {
|
|
@@ -10413,7 +10413,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10413
10413
|
let resetCount = 0;
|
|
10414
10414
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
10415
10415
|
const {
|
|
10416
|
-
name
|
|
10416
|
+
name,
|
|
10417
10417
|
fn
|
|
10418
10418
|
} = validMiddleware[i3];
|
|
10419
10419
|
const {
|
|
@@ -10439,8 +10439,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10439
10439
|
y3 = nextY != null ? nextY : y3;
|
|
10440
10440
|
middlewareData = {
|
|
10441
10441
|
...middlewareData,
|
|
10442
|
-
[
|
|
10443
|
-
...middlewareData[
|
|
10442
|
+
[name]: {
|
|
10443
|
+
...middlewareData[name],
|
|
10444
10444
|
...data
|
|
10445
10445
|
}
|
|
10446
10446
|
};
|
|
@@ -12030,7 +12030,8 @@ var TableHead = (props) => {
|
|
|
12030
12030
|
{
|
|
12031
12031
|
style: {
|
|
12032
12032
|
width: "40px",
|
|
12033
|
-
maxWidth: "40px"
|
|
12033
|
+
maxWidth: "40px",
|
|
12034
|
+
overflow: "unset !important"
|
|
12034
12035
|
},
|
|
12035
12036
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
12036
12037
|
children: /* @__PURE__ */ jsx51(
|
|
@@ -12505,8 +12506,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
12505
12506
|
var isObjectType = (value) => typeof value === "object";
|
|
12506
12507
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
12507
12508
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
12508
|
-
var getNodeParentName = (
|
|
12509
|
-
var isNameInFieldArray = (names,
|
|
12509
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
12510
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
12510
12511
|
var isPlainObject = (tempObject) => {
|
|
12511
12512
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
12512
12513
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -12610,7 +12611,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
12610
12611
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
12611
12612
|
function useFormState(props) {
|
|
12612
12613
|
const methods = useFormContext();
|
|
12613
|
-
const { control = methods.control, disabled, name
|
|
12614
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
12614
12615
|
const [formState, updateFormState] = React.useState(control._formState);
|
|
12615
12616
|
const _localProxyFormState = React.useRef({
|
|
12616
12617
|
isDirty: false,
|
|
@@ -12623,7 +12624,7 @@ function useFormState(props) {
|
|
|
12623
12624
|
errors: false
|
|
12624
12625
|
});
|
|
12625
12626
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12626
|
-
name
|
|
12627
|
+
name,
|
|
12627
12628
|
formState: _localProxyFormState.current,
|
|
12628
12629
|
exact,
|
|
12629
12630
|
callback: (formState2) => {
|
|
@@ -12632,7 +12633,7 @@ function useFormState(props) {
|
|
|
12632
12633
|
...formState2
|
|
12633
12634
|
});
|
|
12634
12635
|
}
|
|
12635
|
-
}), [
|
|
12636
|
+
}), [name, disabled, exact]);
|
|
12636
12637
|
React.useEffect(() => {
|
|
12637
12638
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
12638
12639
|
}, [control]);
|
|
@@ -12684,22 +12685,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
12684
12685
|
}
|
|
12685
12686
|
function useWatch(props) {
|
|
12686
12687
|
const methods = useFormContext();
|
|
12687
|
-
const { control = methods.control, name
|
|
12688
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
12688
12689
|
const _defaultValue = React.useRef(defaultValue);
|
|
12689
12690
|
const _compute = React.useRef(compute);
|
|
12690
12691
|
const _computeFormValues = React.useRef(void 0);
|
|
12691
12692
|
_compute.current = compute;
|
|
12692
|
-
const defaultValueMemo = React.useMemo(() => control._getWatch(
|
|
12693
|
+
const defaultValueMemo = React.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
12693
12694
|
const [value, updateValue] = React.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
12694
12695
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12695
|
-
name
|
|
12696
|
+
name,
|
|
12696
12697
|
formState: {
|
|
12697
12698
|
values: true
|
|
12698
12699
|
},
|
|
12699
12700
|
exact,
|
|
12700
12701
|
callback: (formState) => {
|
|
12701
12702
|
if (!disabled) {
|
|
12702
|
-
const formValues = generateWatchOutput(
|
|
12703
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
12703
12704
|
if (_compute.current) {
|
|
12704
12705
|
const computedFormValues = _compute.current(formValues);
|
|
12705
12706
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -12711,28 +12712,28 @@ function useWatch(props) {
|
|
|
12711
12712
|
}
|
|
12712
12713
|
}
|
|
12713
12714
|
}
|
|
12714
|
-
}), [control, disabled,
|
|
12715
|
+
}), [control, disabled, name, exact]);
|
|
12715
12716
|
React.useEffect(() => control._removeUnmounted());
|
|
12716
12717
|
return value;
|
|
12717
12718
|
}
|
|
12718
12719
|
function useController(props) {
|
|
12719
12720
|
const methods = useFormContext();
|
|
12720
|
-
const { name
|
|
12721
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
12722
|
-
const defaultValueMemo = React.useMemo(() => get2(control._formValues,
|
|
12721
|
+
const { name, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
12722
|
+
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
12723
|
+
const defaultValueMemo = React.useMemo(() => get2(control._formValues, name, get2(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
12723
12724
|
const value = useWatch({
|
|
12724
12725
|
control,
|
|
12725
|
-
name
|
|
12726
|
+
name,
|
|
12726
12727
|
defaultValue: defaultValueMemo,
|
|
12727
12728
|
exact: true
|
|
12728
12729
|
});
|
|
12729
12730
|
const formState = useFormState({
|
|
12730
12731
|
control,
|
|
12731
|
-
name
|
|
12732
|
+
name,
|
|
12732
12733
|
exact: true
|
|
12733
12734
|
});
|
|
12734
12735
|
const _props = React.useRef(props);
|
|
12735
|
-
const _registerProps = React.useRef(control.register(
|
|
12736
|
+
const _registerProps = React.useRef(control.register(name, {
|
|
12736
12737
|
...props.rules,
|
|
12737
12738
|
value,
|
|
12738
12739
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -12741,41 +12742,41 @@ function useController(props) {
|
|
|
12741
12742
|
const fieldState = React.useMemo(() => Object.defineProperties({}, {
|
|
12742
12743
|
invalid: {
|
|
12743
12744
|
enumerable: true,
|
|
12744
|
-
get: () => !!get2(formState.errors,
|
|
12745
|
+
get: () => !!get2(formState.errors, name)
|
|
12745
12746
|
},
|
|
12746
12747
|
isDirty: {
|
|
12747
12748
|
enumerable: true,
|
|
12748
|
-
get: () => !!get2(formState.dirtyFields,
|
|
12749
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
12749
12750
|
},
|
|
12750
12751
|
isTouched: {
|
|
12751
12752
|
enumerable: true,
|
|
12752
|
-
get: () => !!get2(formState.touchedFields,
|
|
12753
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
12753
12754
|
},
|
|
12754
12755
|
isValidating: {
|
|
12755
12756
|
enumerable: true,
|
|
12756
|
-
get: () => !!get2(formState.validatingFields,
|
|
12757
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
12757
12758
|
},
|
|
12758
12759
|
error: {
|
|
12759
12760
|
enumerable: true,
|
|
12760
|
-
get: () => get2(formState.errors,
|
|
12761
|
+
get: () => get2(formState.errors, name)
|
|
12761
12762
|
}
|
|
12762
|
-
}), [formState,
|
|
12763
|
+
}), [formState, name]);
|
|
12763
12764
|
const onChange2 = React.useCallback((event) => _registerProps.current.onChange({
|
|
12764
12765
|
target: {
|
|
12765
12766
|
value: getEventValue(event),
|
|
12766
|
-
name
|
|
12767
|
+
name
|
|
12767
12768
|
},
|
|
12768
12769
|
type: EVENTS.CHANGE
|
|
12769
|
-
}), [
|
|
12770
|
+
}), [name]);
|
|
12770
12771
|
const onBlur = React.useCallback(() => _registerProps.current.onBlur({
|
|
12771
12772
|
target: {
|
|
12772
|
-
value: get2(control._formValues,
|
|
12773
|
-
name
|
|
12773
|
+
value: get2(control._formValues, name),
|
|
12774
|
+
name
|
|
12774
12775
|
},
|
|
12775
12776
|
type: EVENTS.BLUR
|
|
12776
|
-
}), [
|
|
12777
|
+
}), [name, control._formValues]);
|
|
12777
12778
|
const ref = React.useCallback((elm) => {
|
|
12778
|
-
const field2 = get2(control._fields,
|
|
12779
|
+
const field2 = get2(control._fields, name);
|
|
12779
12780
|
if (field2 && elm) {
|
|
12780
12781
|
field2._f.ref = {
|
|
12781
12782
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -12784,46 +12785,46 @@ function useController(props) {
|
|
|
12784
12785
|
reportValidity: () => elm.reportValidity()
|
|
12785
12786
|
};
|
|
12786
12787
|
}
|
|
12787
|
-
}, [control._fields,
|
|
12788
|
+
}, [control._fields, name]);
|
|
12788
12789
|
const field = React.useMemo(() => ({
|
|
12789
|
-
name
|
|
12790
|
+
name,
|
|
12790
12791
|
value,
|
|
12791
12792
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
12792
12793
|
onChange: onChange2,
|
|
12793
12794
|
onBlur,
|
|
12794
12795
|
ref
|
|
12795
|
-
}), [
|
|
12796
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
12796
12797
|
React.useEffect(() => {
|
|
12797
12798
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
12798
|
-
control.register(
|
|
12799
|
+
control.register(name, {
|
|
12799
12800
|
..._props.current.rules,
|
|
12800
12801
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
12801
12802
|
});
|
|
12802
|
-
const updateMounted = (
|
|
12803
|
-
const field2 = get2(control._fields,
|
|
12803
|
+
const updateMounted = (name2, value2) => {
|
|
12804
|
+
const field2 = get2(control._fields, name2);
|
|
12804
12805
|
if (field2 && field2._f) {
|
|
12805
12806
|
field2._f.mount = value2;
|
|
12806
12807
|
}
|
|
12807
12808
|
};
|
|
12808
|
-
updateMounted(
|
|
12809
|
+
updateMounted(name, true);
|
|
12809
12810
|
if (_shouldUnregisterField) {
|
|
12810
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
12811
|
-
set(control._defaultValues,
|
|
12812
|
-
if (isUndefined(get2(control._formValues,
|
|
12813
|
-
set(control._formValues,
|
|
12811
|
+
const value2 = cloneObject(get2(control._options.defaultValues, name));
|
|
12812
|
+
set(control._defaultValues, name, value2);
|
|
12813
|
+
if (isUndefined(get2(control._formValues, name))) {
|
|
12814
|
+
set(control._formValues, name, value2);
|
|
12814
12815
|
}
|
|
12815
12816
|
}
|
|
12816
|
-
!isArrayField && control.register(
|
|
12817
|
+
!isArrayField && control.register(name);
|
|
12817
12818
|
return () => {
|
|
12818
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
12819
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
12819
12820
|
};
|
|
12820
|
-
}, [
|
|
12821
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
12821
12822
|
React.useEffect(() => {
|
|
12822
12823
|
control._setDisabledField({
|
|
12823
12824
|
disabled,
|
|
12824
|
-
name
|
|
12825
|
+
name
|
|
12825
12826
|
});
|
|
12826
|
-
}, [disabled,
|
|
12827
|
+
}, [disabled, name, control]);
|
|
12827
12828
|
return React.useMemo(() => ({
|
|
12828
12829
|
field,
|
|
12829
12830
|
formState,
|
|
@@ -12831,10 +12832,10 @@ function useController(props) {
|
|
|
12831
12832
|
}), [field, formState, fieldState]);
|
|
12832
12833
|
}
|
|
12833
12834
|
var Controller = (props) => props.render(useController(props));
|
|
12834
|
-
var appendErrors = (
|
|
12835
|
-
...errors[
|
|
12835
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
12836
|
+
...errors[name],
|
|
12836
12837
|
types: {
|
|
12837
|
-
...errors[
|
|
12838
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
12838
12839
|
[type]: message2 || true
|
|
12839
12840
|
}
|
|
12840
12841
|
} : {};
|
|
@@ -12994,9 +12995,9 @@ function getFieldValue(_f) {
|
|
|
12994
12995
|
}
|
|
12995
12996
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
12996
12997
|
const fields = {};
|
|
12997
|
-
for (const
|
|
12998
|
-
const field = get2(_fields,
|
|
12999
|
-
field && set(fields,
|
|
12998
|
+
for (const name of fieldsNames) {
|
|
12999
|
+
const field = get2(_fields, name);
|
|
13000
|
+
field && set(fields, name, field._f);
|
|
13000
13001
|
}
|
|
13001
13002
|
return {
|
|
13002
13003
|
criteriaMode,
|
|
@@ -13017,7 +13018,7 @@ var getValidationModes = (mode) => ({
|
|
|
13017
13018
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
13018
13019
|
var hasPromiseValidation = (fieldReference) => !!fieldReference && !!fieldReference.validate && !!(isFunction(fieldReference.validate) && fieldReference.validate.constructor.name === ASYNC_FUNCTION || isObject2(fieldReference.validate) && Object.values(fieldReference.validate).find((validateFunction) => validateFunction.constructor.name === ASYNC_FUNCTION));
|
|
13019
13020
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
13020
|
-
var isWatched = (
|
|
13021
|
+
var isWatched = (name, _names, isBlurEvent) => !isBlurEvent && (_names.watchAll || _names.watch.has(name) || [..._names.watch].some((watchName) => name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length))));
|
|
13021
13022
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
13022
13023
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
13023
13024
|
const field = get2(fields, key);
|
|
@@ -13042,21 +13043,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
13042
13043
|
}
|
|
13043
13044
|
return;
|
|
13044
13045
|
};
|
|
13045
|
-
function schemaErrorLookup(errors, _fields,
|
|
13046
|
-
const error2 = get2(errors,
|
|
13047
|
-
if (error2 || isKey(
|
|
13046
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
13047
|
+
const error2 = get2(errors, name);
|
|
13048
|
+
if (error2 || isKey(name)) {
|
|
13048
13049
|
return {
|
|
13049
13050
|
error: error2,
|
|
13050
|
-
name
|
|
13051
|
+
name
|
|
13051
13052
|
};
|
|
13052
13053
|
}
|
|
13053
|
-
const names =
|
|
13054
|
+
const names = name.split(".");
|
|
13054
13055
|
while (names.length) {
|
|
13055
13056
|
const fieldName = names.join(".");
|
|
13056
13057
|
const field = get2(_fields, fieldName);
|
|
13057
13058
|
const foundError = get2(errors, fieldName);
|
|
13058
|
-
if (field && !Array.isArray(field) &&
|
|
13059
|
-
return { name
|
|
13059
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
13060
|
+
return { name };
|
|
13060
13061
|
}
|
|
13061
13062
|
if (foundError && foundError.type) {
|
|
13062
13063
|
return {
|
|
@@ -13073,15 +13074,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
13073
13074
|
names.pop();
|
|
13074
13075
|
}
|
|
13075
13076
|
return {
|
|
13076
|
-
name
|
|
13077
|
+
name
|
|
13077
13078
|
};
|
|
13078
13079
|
}
|
|
13079
13080
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
13080
13081
|
updateFormState(formStateData);
|
|
13081
|
-
const { name
|
|
13082
|
+
const { name, ...formState } = formStateData;
|
|
13082
13083
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
13083
13084
|
};
|
|
13084
|
-
var shouldSubscribeByName = (
|
|
13085
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
13085
13086
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
13086
13087
|
if (mode.isOnAll) {
|
|
13087
13088
|
return false;
|
|
@@ -13094,11 +13095,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
13094
13095
|
}
|
|
13095
13096
|
return true;
|
|
13096
13097
|
};
|
|
13097
|
-
var unsetEmptyArray = (ref,
|
|
13098
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
13099
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
13100
|
-
set(fieldArrayErrors, "root", error2[
|
|
13101
|
-
set(errors,
|
|
13098
|
+
var unsetEmptyArray = (ref, name) => !compact(get2(ref, name)).length && unset(ref, name);
|
|
13099
|
+
var updateFieldArrayRootError = (errors, error2, name) => {
|
|
13100
|
+
const fieldArrayErrors = convertToArrayPayload(get2(errors, name));
|
|
13101
|
+
set(fieldArrayErrors, "root", error2[name]);
|
|
13102
|
+
set(errors, name, fieldArrayErrors);
|
|
13102
13103
|
return errors;
|
|
13103
13104
|
};
|
|
13104
13105
|
var isMessage = (value) => isString3(value);
|
|
@@ -13116,9 +13117,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
13116
13117
|
message: ""
|
|
13117
13118
|
};
|
|
13118
13119
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
13119
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
13120
|
-
const inputValue = get2(formValues,
|
|
13121
|
-
if (!mount || disabledFieldNames.has(
|
|
13120
|
+
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name, valueAsNumber, mount } = field._f;
|
|
13121
|
+
const inputValue = get2(formValues, name);
|
|
13122
|
+
if (!mount || disabledFieldNames.has(name)) {
|
|
13122
13123
|
return {};
|
|
13123
13124
|
}
|
|
13124
13125
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -13133,10 +13134,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13133
13134
|
const isCheckBox = isCheckBoxInput(ref);
|
|
13134
13135
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
13135
13136
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
13136
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
13137
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
13137
13138
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
13138
13139
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
13139
|
-
error2[
|
|
13140
|
+
error2[name] = {
|
|
13140
13141
|
type: exceedMax ? maxType : minType,
|
|
13141
13142
|
message: message2,
|
|
13142
13143
|
ref,
|
|
@@ -13146,7 +13147,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13146
13147
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
13147
13148
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
13148
13149
|
if (value) {
|
|
13149
|
-
error2[
|
|
13150
|
+
error2[name] = {
|
|
13150
13151
|
type: INPUT_VALIDATION_RULES.required,
|
|
13151
13152
|
message: message2,
|
|
13152
13153
|
ref: inputRef,
|
|
@@ -13186,7 +13187,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13186
13187
|
if (exceedMax || exceedMin) {
|
|
13187
13188
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
13188
13189
|
if (!validateAllFieldCriteria) {
|
|
13189
|
-
setCustomValidity(error2[
|
|
13190
|
+
setCustomValidity(error2[name].message);
|
|
13190
13191
|
return error2;
|
|
13191
13192
|
}
|
|
13192
13193
|
}
|
|
@@ -13199,7 +13200,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13199
13200
|
if (exceedMax || exceedMin) {
|
|
13200
13201
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
13201
13202
|
if (!validateAllFieldCriteria) {
|
|
13202
|
-
setCustomValidity(error2[
|
|
13203
|
+
setCustomValidity(error2[name].message);
|
|
13203
13204
|
return error2;
|
|
13204
13205
|
}
|
|
13205
13206
|
}
|
|
@@ -13207,7 +13208,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13207
13208
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
13208
13209
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
13209
13210
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
13210
|
-
error2[
|
|
13211
|
+
error2[name] = {
|
|
13211
13212
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
13212
13213
|
message: message2,
|
|
13213
13214
|
ref,
|
|
@@ -13224,7 +13225,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13224
13225
|
const result = await validate(inputValue, formValues);
|
|
13225
13226
|
const validateError = getValidateError(result, inputRef);
|
|
13226
13227
|
if (validateError) {
|
|
13227
|
-
error2[
|
|
13228
|
+
error2[name] = {
|
|
13228
13229
|
...validateError,
|
|
13229
13230
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
13230
13231
|
};
|
|
@@ -13247,12 +13248,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13247
13248
|
};
|
|
13248
13249
|
setCustomValidity(validateError.message);
|
|
13249
13250
|
if (validateAllFieldCriteria) {
|
|
13250
|
-
error2[
|
|
13251
|
+
error2[name] = validationResult;
|
|
13251
13252
|
}
|
|
13252
13253
|
}
|
|
13253
13254
|
}
|
|
13254
13255
|
if (!isEmptyObject(validationResult)) {
|
|
13255
|
-
error2[
|
|
13256
|
+
error2[name] = {
|
|
13256
13257
|
ref: inputRef,
|
|
13257
13258
|
...validationResult
|
|
13258
13259
|
};
|
|
@@ -13341,9 +13342,9 @@ function createFormControl(props = {}) {
|
|
|
13341
13342
|
};
|
|
13342
13343
|
const _updateIsValidating = (names, isValidating) => {
|
|
13343
13344
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
13344
|
-
(names || Array.from(_names.mount)).forEach((
|
|
13345
|
-
if (
|
|
13346
|
-
isValidating ? set(_formState.validatingFields,
|
|
13345
|
+
(names || Array.from(_names.mount)).forEach((name) => {
|
|
13346
|
+
if (name) {
|
|
13347
|
+
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
13347
13348
|
}
|
|
13348
13349
|
});
|
|
13349
13350
|
_subjects.state.next({
|
|
@@ -13352,38 +13353,38 @@ function createFormControl(props = {}) {
|
|
|
13352
13353
|
});
|
|
13353
13354
|
}
|
|
13354
13355
|
};
|
|
13355
|
-
const _setFieldArray = (
|
|
13356
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
13356
13357
|
if (args && method && !_options.disabled) {
|
|
13357
13358
|
_state.action = true;
|
|
13358
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
13359
|
-
const fieldValues = method(get2(_fields,
|
|
13360
|
-
shouldSetValues && set(_fields,
|
|
13359
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields, name))) {
|
|
13360
|
+
const fieldValues = method(get2(_fields, name), args.argA, args.argB);
|
|
13361
|
+
shouldSetValues && set(_fields, name, fieldValues);
|
|
13361
13362
|
}
|
|
13362
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
13363
|
-
const errors = method(get2(_formState.errors,
|
|
13364
|
-
shouldSetValues && set(_formState.errors,
|
|
13365
|
-
unsetEmptyArray(_formState.errors,
|
|
13363
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors, name))) {
|
|
13364
|
+
const errors = method(get2(_formState.errors, name), args.argA, args.argB);
|
|
13365
|
+
shouldSetValues && set(_formState.errors, name, errors);
|
|
13366
|
+
unsetEmptyArray(_formState.errors, name);
|
|
13366
13367
|
}
|
|
13367
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
13368
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
13369
|
-
shouldSetValues && set(_formState.touchedFields,
|
|
13368
|
+
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields, name))) {
|
|
13369
|
+
const touchedFields = method(get2(_formState.touchedFields, name), args.argA, args.argB);
|
|
13370
|
+
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
13370
13371
|
}
|
|
13371
13372
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
13372
13373
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
13373
13374
|
}
|
|
13374
13375
|
_subjects.state.next({
|
|
13375
|
-
name
|
|
13376
|
-
isDirty: _getDirty(
|
|
13376
|
+
name,
|
|
13377
|
+
isDirty: _getDirty(name, values),
|
|
13377
13378
|
dirtyFields: _formState.dirtyFields,
|
|
13378
13379
|
errors: _formState.errors,
|
|
13379
13380
|
isValid: _formState.isValid
|
|
13380
13381
|
});
|
|
13381
13382
|
} else {
|
|
13382
|
-
set(_formValues,
|
|
13383
|
+
set(_formValues, name, values);
|
|
13383
13384
|
}
|
|
13384
13385
|
};
|
|
13385
|
-
const updateErrors = (
|
|
13386
|
-
set(_formState.errors,
|
|
13386
|
+
const updateErrors = (name, error2) => {
|
|
13387
|
+
set(_formState.errors, name, error2);
|
|
13387
13388
|
_subjects.state.next({
|
|
13388
13389
|
errors: _formState.errors
|
|
13389
13390
|
});
|
|
@@ -13395,19 +13396,19 @@ function createFormControl(props = {}) {
|
|
|
13395
13396
|
isValid: false
|
|
13396
13397
|
});
|
|
13397
13398
|
};
|
|
13398
|
-
const updateValidAndValue = (
|
|
13399
|
-
const field = get2(_fields,
|
|
13399
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
13400
|
+
const field = get2(_fields, name);
|
|
13400
13401
|
if (field) {
|
|
13401
|
-
const defaultValue = get2(_formValues,
|
|
13402
|
-
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues,
|
|
13402
|
+
const defaultValue = get2(_formValues, name, isUndefined(value) ? get2(_defaultValues, name) : value);
|
|
13403
|
+
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
13403
13404
|
_state.mount && _setValid();
|
|
13404
13405
|
}
|
|
13405
13406
|
};
|
|
13406
|
-
const updateTouchAndDirty = (
|
|
13407
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
13407
13408
|
let shouldUpdateField = false;
|
|
13408
13409
|
let isPreviousDirty = false;
|
|
13409
13410
|
const output = {
|
|
13410
|
-
name
|
|
13411
|
+
name
|
|
13411
13412
|
};
|
|
13412
13413
|
if (!_options.disabled) {
|
|
13413
13414
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -13416,16 +13417,16 @@ function createFormControl(props = {}) {
|
|
|
13416
13417
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
13417
13418
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
13418
13419
|
}
|
|
13419
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
13420
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
13421
|
-
isCurrentFieldPristine ? unset(_formState.dirtyFields,
|
|
13420
|
+
const isCurrentFieldPristine = deepEqual(get2(_defaultValues, name), fieldValue);
|
|
13421
|
+
isPreviousDirty = !!get2(_formState.dirtyFields, name);
|
|
13422
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
13422
13423
|
output.dirtyFields = _formState.dirtyFields;
|
|
13423
13424
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
13424
13425
|
}
|
|
13425
13426
|
if (isBlurEvent) {
|
|
13426
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
13427
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
13427
13428
|
if (!isPreviousFieldTouched) {
|
|
13428
|
-
set(_formState.touchedFields,
|
|
13429
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
13429
13430
|
output.touchedFields = _formState.touchedFields;
|
|
13430
13431
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
13431
13432
|
}
|
|
@@ -13434,23 +13435,23 @@ function createFormControl(props = {}) {
|
|
|
13434
13435
|
}
|
|
13435
13436
|
return shouldUpdateField ? output : {};
|
|
13436
13437
|
};
|
|
13437
|
-
const shouldRenderByError = (
|
|
13438
|
-
const previousFieldError = get2(_formState.errors,
|
|
13438
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
13439
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
13439
13440
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
13440
13441
|
if (_options.delayError && error2) {
|
|
13441
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
13442
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
13442
13443
|
delayErrorCallback(_options.delayError);
|
|
13443
13444
|
} else {
|
|
13444
13445
|
clearTimeout(timer);
|
|
13445
13446
|
delayErrorCallback = null;
|
|
13446
|
-
error2 ? set(_formState.errors,
|
|
13447
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
13447
13448
|
}
|
|
13448
13449
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
13449
13450
|
const updatedFormState = {
|
|
13450
13451
|
...fieldState,
|
|
13451
13452
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
13452
13453
|
errors: _formState.errors,
|
|
13453
|
-
name
|
|
13454
|
+
name
|
|
13454
13455
|
};
|
|
13455
13456
|
_formState = {
|
|
13456
13457
|
..._formState,
|
|
@@ -13459,18 +13460,18 @@ function createFormControl(props = {}) {
|
|
|
13459
13460
|
_subjects.state.next(updatedFormState);
|
|
13460
13461
|
}
|
|
13461
13462
|
};
|
|
13462
|
-
const _runSchema = async (
|
|
13463
|
-
_updateIsValidating(
|
|
13464
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
13465
|
-
_updateIsValidating(
|
|
13463
|
+
const _runSchema = async (name) => {
|
|
13464
|
+
_updateIsValidating(name, true);
|
|
13465
|
+
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
13466
|
+
_updateIsValidating(name);
|
|
13466
13467
|
return result;
|
|
13467
13468
|
};
|
|
13468
13469
|
const executeSchemaAndUpdateState = async (names) => {
|
|
13469
13470
|
const { errors } = await _runSchema(names);
|
|
13470
13471
|
if (names) {
|
|
13471
|
-
for (const
|
|
13472
|
-
const error2 = get2(errors,
|
|
13473
|
-
error2 ? set(_formState.errors,
|
|
13472
|
+
for (const name of names) {
|
|
13473
|
+
const error2 = get2(errors, name);
|
|
13474
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
13474
13475
|
}
|
|
13475
13476
|
} else {
|
|
13476
13477
|
_formState.errors = errors;
|
|
@@ -13480,19 +13481,19 @@ function createFormControl(props = {}) {
|
|
|
13480
13481
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
13481
13482
|
valid: true
|
|
13482
13483
|
}) => {
|
|
13483
|
-
for (const
|
|
13484
|
-
const field = fields[
|
|
13484
|
+
for (const name in fields) {
|
|
13485
|
+
const field = fields[name];
|
|
13485
13486
|
if (field) {
|
|
13486
13487
|
const { _f, ...fieldValue } = field;
|
|
13487
13488
|
if (_f) {
|
|
13488
13489
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
13489
13490
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
13490
13491
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13491
|
-
_updateIsValidating([
|
|
13492
|
+
_updateIsValidating([name], true);
|
|
13492
13493
|
}
|
|
13493
13494
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
13494
13495
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13495
|
-
_updateIsValidating([
|
|
13496
|
+
_updateIsValidating([name]);
|
|
13496
13497
|
}
|
|
13497
13498
|
if (fieldError[_f.name]) {
|
|
13498
13499
|
context.valid = false;
|
|
@@ -13508,24 +13509,24 @@ function createFormControl(props = {}) {
|
|
|
13508
13509
|
return context.valid;
|
|
13509
13510
|
};
|
|
13510
13511
|
const _removeUnmounted = () => {
|
|
13511
|
-
for (const
|
|
13512
|
-
const field = get2(_fields,
|
|
13513
|
-
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(
|
|
13512
|
+
for (const name of _names.unMount) {
|
|
13513
|
+
const field = get2(_fields, name);
|
|
13514
|
+
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name);
|
|
13514
13515
|
}
|
|
13515
13516
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
13516
13517
|
};
|
|
13517
|
-
const _getDirty = (
|
|
13518
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
13518
13519
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
13519
13520
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
13520
13521
|
}, isGlobal, defaultValue);
|
|
13521
|
-
const _getFieldArray = (
|
|
13522
|
-
const setFieldValue = (
|
|
13523
|
-
const field = get2(_fields,
|
|
13522
|
+
const _getFieldArray = (name) => compact(get2(_state.mount ? _formValues : _defaultValues, name, _options.shouldUnregister ? get2(_defaultValues, name, []) : []));
|
|
13523
|
+
const setFieldValue = (name, value, options2 = {}) => {
|
|
13524
|
+
const field = get2(_fields, name);
|
|
13524
13525
|
let fieldValue = value;
|
|
13525
13526
|
if (field) {
|
|
13526
13527
|
const fieldReference = field._f;
|
|
13527
13528
|
if (fieldReference) {
|
|
13528
|
-
!fieldReference.disabled && set(_formValues,
|
|
13529
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
13529
13530
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
13530
13531
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
13531
13532
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -13549,61 +13550,61 @@ function createFormControl(props = {}) {
|
|
|
13549
13550
|
fieldReference.ref.value = fieldValue;
|
|
13550
13551
|
if (!fieldReference.ref.type) {
|
|
13551
13552
|
_subjects.state.next({
|
|
13552
|
-
name
|
|
13553
|
+
name,
|
|
13553
13554
|
values: cloneObject(_formValues)
|
|
13554
13555
|
});
|
|
13555
13556
|
}
|
|
13556
13557
|
}
|
|
13557
13558
|
}
|
|
13558
13559
|
}
|
|
13559
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
13560
|
-
options2.shouldValidate && trigger(
|
|
13560
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
13561
|
+
options2.shouldValidate && trigger(name);
|
|
13561
13562
|
};
|
|
13562
|
-
const setValues = (
|
|
13563
|
+
const setValues = (name, value, options2) => {
|
|
13563
13564
|
for (const fieldKey in value) {
|
|
13564
13565
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
13565
13566
|
return;
|
|
13566
13567
|
}
|
|
13567
13568
|
const fieldValue = value[fieldKey];
|
|
13568
|
-
const fieldName =
|
|
13569
|
+
const fieldName = name + "." + fieldKey;
|
|
13569
13570
|
const field = get2(_fields, fieldName);
|
|
13570
|
-
(_names.array.has(
|
|
13571
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
13571
13572
|
}
|
|
13572
13573
|
};
|
|
13573
|
-
const setValue = (
|
|
13574
|
-
const field = get2(_fields,
|
|
13575
|
-
const isFieldArray = _names.array.has(
|
|
13574
|
+
const setValue = (name, value, options2 = {}) => {
|
|
13575
|
+
const field = get2(_fields, name);
|
|
13576
|
+
const isFieldArray = _names.array.has(name);
|
|
13576
13577
|
const cloneValue = cloneObject(value);
|
|
13577
|
-
set(_formValues,
|
|
13578
|
+
set(_formValues, name, cloneValue);
|
|
13578
13579
|
if (isFieldArray) {
|
|
13579
13580
|
_subjects.array.next({
|
|
13580
|
-
name
|
|
13581
|
+
name,
|
|
13581
13582
|
values: cloneObject(_formValues)
|
|
13582
13583
|
});
|
|
13583
13584
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
13584
13585
|
_subjects.state.next({
|
|
13585
|
-
name
|
|
13586
|
+
name,
|
|
13586
13587
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
13587
|
-
isDirty: _getDirty(
|
|
13588
|
+
isDirty: _getDirty(name, cloneValue)
|
|
13588
13589
|
});
|
|
13589
13590
|
}
|
|
13590
13591
|
} else {
|
|
13591
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
13592
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
13592
13593
|
}
|
|
13593
|
-
isWatched(
|
|
13594
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
13594
13595
|
_subjects.state.next({
|
|
13595
|
-
name: _state.mount ?
|
|
13596
|
+
name: _state.mount ? name : void 0,
|
|
13596
13597
|
values: cloneObject(_formValues)
|
|
13597
13598
|
});
|
|
13598
13599
|
};
|
|
13599
13600
|
const onChange2 = async (event) => {
|
|
13600
13601
|
_state.mount = true;
|
|
13601
13602
|
const target = event.target;
|
|
13602
|
-
let
|
|
13603
|
+
let name = target.name;
|
|
13603
13604
|
let isFieldValueUpdated = true;
|
|
13604
|
-
const field = get2(_fields,
|
|
13605
|
+
const field = get2(_fields, name);
|
|
13605
13606
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
13606
|
-
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues,
|
|
13607
|
+
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues, name, fieldValue));
|
|
13607
13608
|
};
|
|
13608
13609
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
13609
13610
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -13612,9 +13613,9 @@ function createFormControl(props = {}) {
|
|
|
13612
13613
|
let isValid3;
|
|
13613
13614
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
13614
13615
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
13615
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
13616
|
-
const watched = isWatched(
|
|
13617
|
-
set(_formValues,
|
|
13616
|
+
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get2(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
13617
|
+
const watched = isWatched(name, _names, isBlurEvent);
|
|
13618
|
+
set(_formValues, name, fieldValue);
|
|
13618
13619
|
if (isBlurEvent) {
|
|
13619
13620
|
if (!target || !target.readOnly) {
|
|
13620
13621
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -13623,10 +13624,10 @@ function createFormControl(props = {}) {
|
|
|
13623
13624
|
} else if (field._f.onChange) {
|
|
13624
13625
|
field._f.onChange(event);
|
|
13625
13626
|
}
|
|
13626
|
-
const fieldState = updateTouchAndDirty(
|
|
13627
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
13627
13628
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
13628
13629
|
!isBlurEvent && _subjects.state.next({
|
|
13629
|
-
name
|
|
13630
|
+
name,
|
|
13630
13631
|
type: event.type,
|
|
13631
13632
|
values: cloneObject(_formValues)
|
|
13632
13633
|
});
|
|
@@ -13640,23 +13641,23 @@ function createFormControl(props = {}) {
|
|
|
13640
13641
|
_setValid();
|
|
13641
13642
|
}
|
|
13642
13643
|
}
|
|
13643
|
-
return shouldRender && _subjects.state.next({ name
|
|
13644
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
13644
13645
|
}
|
|
13645
13646
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
13646
13647
|
if (_options.resolver) {
|
|
13647
|
-
const { errors } = await _runSchema([
|
|
13648
|
+
const { errors } = await _runSchema([name]);
|
|
13648
13649
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13649
13650
|
if (isFieldValueUpdated) {
|
|
13650
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
13651
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
13651
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
13652
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
13652
13653
|
error2 = errorLookupResult.error;
|
|
13653
|
-
|
|
13654
|
+
name = errorLookupResult.name;
|
|
13654
13655
|
isValid3 = isEmptyObject(errors);
|
|
13655
13656
|
}
|
|
13656
13657
|
} else {
|
|
13657
|
-
_updateIsValidating([
|
|
13658
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
13659
|
-
_updateIsValidating([
|
|
13658
|
+
_updateIsValidating([name], true);
|
|
13659
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
13660
|
+
_updateIsValidating([name]);
|
|
13660
13661
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13661
13662
|
if (isFieldValueUpdated) {
|
|
13662
13663
|
if (error2) {
|
|
@@ -13668,7 +13669,7 @@ function createFormControl(props = {}) {
|
|
|
13668
13669
|
}
|
|
13669
13670
|
if (isFieldValueUpdated) {
|
|
13670
13671
|
field._f.deps && trigger(field._f.deps);
|
|
13671
|
-
shouldRenderByError(
|
|
13672
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
13672
13673
|
}
|
|
13673
13674
|
}
|
|
13674
13675
|
};
|
|
@@ -13679,15 +13680,15 @@ function createFormControl(props = {}) {
|
|
|
13679
13680
|
}
|
|
13680
13681
|
return;
|
|
13681
13682
|
};
|
|
13682
|
-
const trigger = async (
|
|
13683
|
+
const trigger = async (name, options2 = {}) => {
|
|
13683
13684
|
let isValid3;
|
|
13684
13685
|
let validationResult;
|
|
13685
|
-
const fieldNames = convertToArrayPayload(
|
|
13686
|
+
const fieldNames = convertToArrayPayload(name);
|
|
13686
13687
|
if (_options.resolver) {
|
|
13687
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
13688
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
13688
13689
|
isValid3 = isEmptyObject(errors);
|
|
13689
|
-
validationResult =
|
|
13690
|
-
} else if (
|
|
13690
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
13691
|
+
} else if (name) {
|
|
13691
13692
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
13692
13693
|
const field = get2(_fields, fieldName);
|
|
13693
13694
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -13697,51 +13698,51 @@ function createFormControl(props = {}) {
|
|
|
13697
13698
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
13698
13699
|
}
|
|
13699
13700
|
_subjects.state.next({
|
|
13700
|
-
...!isString3(
|
|
13701
|
-
..._options.resolver || !
|
|
13701
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
13702
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
13702
13703
|
errors: _formState.errors
|
|
13703
13704
|
});
|
|
13704
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
13705
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
13705
13706
|
return validationResult;
|
|
13706
13707
|
};
|
|
13707
13708
|
const getValues = (fieldNames) => {
|
|
13708
13709
|
const values = {
|
|
13709
13710
|
..._state.mount ? _formValues : _defaultValues
|
|
13710
13711
|
};
|
|
13711
|
-
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((
|
|
13712
|
+
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((name) => get2(values, name));
|
|
13712
13713
|
};
|
|
13713
|
-
const getFieldState = (
|
|
13714
|
-
invalid: !!get2((formState || _formState).errors,
|
|
13715
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
13716
|
-
error: get2((formState || _formState).errors,
|
|
13717
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
13718
|
-
isTouched: !!get2((formState || _formState).touchedFields,
|
|
13714
|
+
const getFieldState = (name, formState) => ({
|
|
13715
|
+
invalid: !!get2((formState || _formState).errors, name),
|
|
13716
|
+
isDirty: !!get2((formState || _formState).dirtyFields, name),
|
|
13717
|
+
error: get2((formState || _formState).errors, name),
|
|
13718
|
+
isValidating: !!get2(_formState.validatingFields, name),
|
|
13719
|
+
isTouched: !!get2((formState || _formState).touchedFields, name)
|
|
13719
13720
|
});
|
|
13720
|
-
const clearErrors = (
|
|
13721
|
-
|
|
13721
|
+
const clearErrors = (name) => {
|
|
13722
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
13722
13723
|
_subjects.state.next({
|
|
13723
|
-
errors:
|
|
13724
|
+
errors: name ? _formState.errors : {}
|
|
13724
13725
|
});
|
|
13725
13726
|
};
|
|
13726
|
-
const setError = (
|
|
13727
|
-
const ref = (get2(_fields,
|
|
13728
|
-
const currentError = get2(_formState.errors,
|
|
13727
|
+
const setError = (name, error2, options2) => {
|
|
13728
|
+
const ref = (get2(_fields, name, { _f: {} })._f || {}).ref;
|
|
13729
|
+
const currentError = get2(_formState.errors, name) || {};
|
|
13729
13730
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
13730
|
-
set(_formState.errors,
|
|
13731
|
+
set(_formState.errors, name, {
|
|
13731
13732
|
...restOfErrorTree,
|
|
13732
13733
|
...error2,
|
|
13733
13734
|
ref
|
|
13734
13735
|
});
|
|
13735
13736
|
_subjects.state.next({
|
|
13736
|
-
name
|
|
13737
|
+
name,
|
|
13737
13738
|
errors: _formState.errors,
|
|
13738
13739
|
isValid: false
|
|
13739
13740
|
});
|
|
13740
13741
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
13741
13742
|
};
|
|
13742
|
-
const watch = (
|
|
13743
|
-
next: (payload) => "values" in payload &&
|
|
13744
|
-
}) : _getWatch(
|
|
13743
|
+
const watch = (name, defaultValue) => isFunction(name) ? _subjects.state.subscribe({
|
|
13744
|
+
next: (payload) => "values" in payload && name(_getWatch(void 0, defaultValue), payload)
|
|
13745
|
+
}) : _getWatch(name, defaultValue, true);
|
|
13745
13746
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
13746
13747
|
next: (formState) => {
|
|
13747
13748
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -13765,8 +13766,8 @@ function createFormControl(props = {}) {
|
|
|
13765
13766
|
formState: _proxySubscribeFormState
|
|
13766
13767
|
});
|
|
13767
13768
|
};
|
|
13768
|
-
const unregister = (
|
|
13769
|
-
for (const fieldName of
|
|
13769
|
+
const unregister = (name, options2 = {}) => {
|
|
13770
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
13770
13771
|
_names.mount.delete(fieldName);
|
|
13771
13772
|
_names.array.delete(fieldName);
|
|
13772
13773
|
if (!options2.keepValue) {
|
|
@@ -13788,31 +13789,31 @@ function createFormControl(props = {}) {
|
|
|
13788
13789
|
});
|
|
13789
13790
|
!options2.keepIsValid && _setValid();
|
|
13790
13791
|
};
|
|
13791
|
-
const _setDisabledField = ({ disabled, name
|
|
13792
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
13793
|
-
disabled ? _names.disabled.add(
|
|
13792
|
+
const _setDisabledField = ({ disabled, name }) => {
|
|
13793
|
+
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) {
|
|
13794
|
+
disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
|
|
13794
13795
|
}
|
|
13795
13796
|
};
|
|
13796
|
-
const register = (
|
|
13797
|
-
let field = get2(_fields,
|
|
13797
|
+
const register = (name, options2 = {}) => {
|
|
13798
|
+
let field = get2(_fields, name);
|
|
13798
13799
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
13799
|
-
set(_fields,
|
|
13800
|
+
set(_fields, name, {
|
|
13800
13801
|
...field || {},
|
|
13801
13802
|
_f: {
|
|
13802
|
-
...field && field._f ? field._f : { ref: { name
|
|
13803
|
-
name
|
|
13803
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
13804
|
+
name,
|
|
13804
13805
|
mount: true,
|
|
13805
13806
|
...options2
|
|
13806
13807
|
}
|
|
13807
13808
|
});
|
|
13808
|
-
_names.mount.add(
|
|
13809
|
+
_names.mount.add(name);
|
|
13809
13810
|
if (field) {
|
|
13810
13811
|
_setDisabledField({
|
|
13811
13812
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
13812
|
-
name
|
|
13813
|
+
name
|
|
13813
13814
|
});
|
|
13814
13815
|
} else {
|
|
13815
|
-
updateValidAndValue(
|
|
13816
|
+
updateValidAndValue(name, true, options2.value);
|
|
13816
13817
|
}
|
|
13817
13818
|
return {
|
|
13818
13819
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -13824,39 +13825,39 @@ function createFormControl(props = {}) {
|
|
|
13824
13825
|
maxLength: getRuleValue(options2.maxLength),
|
|
13825
13826
|
pattern: getRuleValue(options2.pattern)
|
|
13826
13827
|
} : {},
|
|
13827
|
-
name
|
|
13828
|
+
name,
|
|
13828
13829
|
onChange: onChange2,
|
|
13829
13830
|
onBlur: onChange2,
|
|
13830
13831
|
ref: (ref) => {
|
|
13831
13832
|
if (ref) {
|
|
13832
|
-
register(
|
|
13833
|
-
field = get2(_fields,
|
|
13833
|
+
register(name, options2);
|
|
13834
|
+
field = get2(_fields, name);
|
|
13834
13835
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
13835
13836
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
13836
13837
|
const refs = field._f.refs || [];
|
|
13837
13838
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
13838
13839
|
return;
|
|
13839
13840
|
}
|
|
13840
|
-
set(_fields,
|
|
13841
|
+
set(_fields, name, {
|
|
13841
13842
|
_f: {
|
|
13842
13843
|
...field._f,
|
|
13843
13844
|
...radioOrCheckbox ? {
|
|
13844
13845
|
refs: [
|
|
13845
13846
|
...refs.filter(live),
|
|
13846
13847
|
fieldRef,
|
|
13847
|
-
...Array.isArray(get2(_defaultValues,
|
|
13848
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
13848
13849
|
],
|
|
13849
|
-
ref: { type: fieldRef.type, name
|
|
13850
|
+
ref: { type: fieldRef.type, name }
|
|
13850
13851
|
} : { ref: fieldRef }
|
|
13851
13852
|
}
|
|
13852
13853
|
});
|
|
13853
|
-
updateValidAndValue(
|
|
13854
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
13854
13855
|
} else {
|
|
13855
|
-
field = get2(_fields,
|
|
13856
|
+
field = get2(_fields, name, {});
|
|
13856
13857
|
if (field._f) {
|
|
13857
13858
|
field._f.mount = false;
|
|
13858
13859
|
}
|
|
13859
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
13860
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
13860
13861
|
}
|
|
13861
13862
|
}
|
|
13862
13863
|
};
|
|
@@ -13865,8 +13866,8 @@ function createFormControl(props = {}) {
|
|
|
13865
13866
|
const _disableForm = (disabled) => {
|
|
13866
13867
|
if (isBoolean(disabled)) {
|
|
13867
13868
|
_subjects.state.next({ disabled });
|
|
13868
|
-
iterateFieldsByAction(_fields, (ref,
|
|
13869
|
-
const currentField = get2(_fields,
|
|
13869
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
13870
|
+
const currentField = get2(_fields, name);
|
|
13870
13871
|
if (currentField) {
|
|
13871
13872
|
ref.disabled = currentField._f.disabled || disabled;
|
|
13872
13873
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -13896,8 +13897,8 @@ function createFormControl(props = {}) {
|
|
|
13896
13897
|
await executeBuiltInValidation(_fields);
|
|
13897
13898
|
}
|
|
13898
13899
|
if (_names.disabled.size) {
|
|
13899
|
-
for (const
|
|
13900
|
-
unset(fieldValues,
|
|
13900
|
+
for (const name of _names.disabled) {
|
|
13901
|
+
unset(fieldValues, name);
|
|
13901
13902
|
}
|
|
13902
13903
|
}
|
|
13903
13904
|
unset(_formState.errors, "root");
|
|
@@ -13928,23 +13929,23 @@ function createFormControl(props = {}) {
|
|
|
13928
13929
|
throw onValidError;
|
|
13929
13930
|
}
|
|
13930
13931
|
};
|
|
13931
|
-
const resetField = (
|
|
13932
|
-
if (get2(_fields,
|
|
13932
|
+
const resetField = (name, options2 = {}) => {
|
|
13933
|
+
if (get2(_fields, name)) {
|
|
13933
13934
|
if (isUndefined(options2.defaultValue)) {
|
|
13934
|
-
setValue(
|
|
13935
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
13935
13936
|
} else {
|
|
13936
|
-
setValue(
|
|
13937
|
-
set(_defaultValues,
|
|
13937
|
+
setValue(name, options2.defaultValue);
|
|
13938
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
13938
13939
|
}
|
|
13939
13940
|
if (!options2.keepTouched) {
|
|
13940
|
-
unset(_formState.touchedFields,
|
|
13941
|
+
unset(_formState.touchedFields, name);
|
|
13941
13942
|
}
|
|
13942
13943
|
if (!options2.keepDirty) {
|
|
13943
|
-
unset(_formState.dirtyFields,
|
|
13944
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
13944
|
+
unset(_formState.dirtyFields, name);
|
|
13945
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
13945
13946
|
}
|
|
13946
13947
|
if (!options2.keepError) {
|
|
13947
|
-
unset(_formState.errors,
|
|
13948
|
+
unset(_formState.errors, name);
|
|
13948
13949
|
_proxyFormState.isValid && _setValid();
|
|
13949
13950
|
}
|
|
13950
13951
|
_subjects.state.next({ ..._formState });
|
|
@@ -13969,8 +13970,8 @@ function createFormControl(props = {}) {
|
|
|
13969
13970
|
}
|
|
13970
13971
|
} else {
|
|
13971
13972
|
if (isWeb && isUndefined(formValues)) {
|
|
13972
|
-
for (const
|
|
13973
|
-
const field = get2(_fields,
|
|
13973
|
+
for (const name of _names.mount) {
|
|
13974
|
+
const field = get2(_fields, name);
|
|
13974
13975
|
if (field && field._f) {
|
|
13975
13976
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
13976
13977
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -14023,8 +14024,8 @@ function createFormControl(props = {}) {
|
|
|
14023
14024
|
});
|
|
14024
14025
|
};
|
|
14025
14026
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
14026
|
-
const setFocus = (
|
|
14027
|
-
const field = get2(_fields,
|
|
14027
|
+
const setFocus = (name, options2 = {}) => {
|
|
14028
|
+
const field = get2(_fields, name);
|
|
14028
14029
|
const fieldReference = field && field._f;
|
|
14029
14030
|
if (fieldReference) {
|
|
14030
14031
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -14340,7 +14341,7 @@ function TextInput(props) {
|
|
|
14340
14341
|
inputWrapperClassName,
|
|
14341
14342
|
label,
|
|
14342
14343
|
placeholder,
|
|
14343
|
-
name
|
|
14344
|
+
name,
|
|
14344
14345
|
type = "text",
|
|
14345
14346
|
register,
|
|
14346
14347
|
errors,
|
|
@@ -14363,7 +14364,7 @@ function TextInput(props) {
|
|
|
14363
14364
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
14364
14365
|
placeholder,
|
|
14365
14366
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
14366
|
-
...register(
|
|
14367
|
+
...register(name)
|
|
14367
14368
|
}
|
|
14368
14369
|
),
|
|
14369
14370
|
type === "password" && /* @__PURE__ */ jsx55(
|
|
@@ -14377,11 +14378,11 @@ function TextInput(props) {
|
|
|
14377
14378
|
]
|
|
14378
14379
|
}
|
|
14379
14380
|
),
|
|
14380
|
-
errors?.[
|
|
14381
|
+
errors?.[name]?.message && /* @__PURE__ */ jsx55(
|
|
14381
14382
|
"p",
|
|
14382
14383
|
{
|
|
14383
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
14384
|
-
children: errors?.[
|
|
14384
|
+
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[name] ? "h-4" : "h-0 -mt-1"}`,
|
|
14385
|
+
children: errors?.[name]?.message
|
|
14385
14386
|
}
|
|
14386
14387
|
)
|
|
14387
14388
|
] });
|
|
@@ -14788,10 +14789,10 @@ function useFileInfo(source, options2) {
|
|
|
14788
14789
|
let localUrl = null;
|
|
14789
14790
|
let fr = null;
|
|
14790
14791
|
let mediaEl = null;
|
|
14791
|
-
const makeExtension = (
|
|
14792
|
-
if (
|
|
14793
|
-
const idx =
|
|
14794
|
-
if (idx > -1) return
|
|
14792
|
+
const makeExtension = (name, type) => {
|
|
14793
|
+
if (name) {
|
|
14794
|
+
const idx = name.lastIndexOf(".");
|
|
14795
|
+
if (idx > -1) return name.slice(idx + 1).toLowerCase();
|
|
14795
14796
|
}
|
|
14796
14797
|
if (type) {
|
|
14797
14798
|
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
@@ -15400,7 +15401,7 @@ var ModalLayer = ({
|
|
|
15400
15401
|
// src/widgets/common/modal-confirm.tsx
|
|
15401
15402
|
import { jsx as jsx68, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
15402
15403
|
var ModalConfirm = ({
|
|
15403
|
-
name
|
|
15404
|
+
name,
|
|
15404
15405
|
isShowModal,
|
|
15405
15406
|
onClick,
|
|
15406
15407
|
onClose,
|
|
@@ -15409,8 +15410,8 @@ var ModalConfirm = ({
|
|
|
15409
15410
|
isLoading
|
|
15410
15411
|
}) => {
|
|
15411
15412
|
const { t: t3 } = useI18n();
|
|
15412
|
-
const renderButtonAction = (
|
|
15413
|
-
switch (
|
|
15413
|
+
const renderButtonAction = (name2) => {
|
|
15414
|
+
switch (name2) {
|
|
15414
15415
|
case "duplicate":
|
|
15415
15416
|
return /* @__PURE__ */ jsxs43(
|
|
15416
15417
|
"button",
|
|
@@ -15486,7 +15487,7 @@ var ModalConfirm = ({
|
|
|
15486
15487
|
children: t3("cancel")
|
|
15487
15488
|
}
|
|
15488
15489
|
),
|
|
15489
|
-
renderButtonAction(
|
|
15490
|
+
renderButtonAction(name)
|
|
15490
15491
|
] })
|
|
15491
15492
|
] }) });
|
|
15492
15493
|
};
|
|
@@ -16035,7 +16036,7 @@ import { useEffect as useEffect10, useState as useState10 } from "react";
|
|
|
16035
16036
|
import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
16036
16037
|
var BinaryField = (props) => {
|
|
16037
16038
|
const {
|
|
16038
|
-
name
|
|
16039
|
+
name,
|
|
16039
16040
|
methods,
|
|
16040
16041
|
readonly = false,
|
|
16041
16042
|
placeholder,
|
|
@@ -16074,7 +16075,7 @@ var BinaryField = (props) => {
|
|
|
16074
16075
|
try {
|
|
16075
16076
|
let type = "application/octet-stream";
|
|
16076
16077
|
let size4 = 0;
|
|
16077
|
-
let
|
|
16078
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16078
16079
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16079
16080
|
type = "image/*";
|
|
16080
16081
|
} else {
|
|
@@ -16087,7 +16088,7 @@ var BinaryField = (props) => {
|
|
|
16087
16088
|
}
|
|
16088
16089
|
}
|
|
16089
16090
|
setFileInfo({
|
|
16090
|
-
name:
|
|
16091
|
+
name: name2,
|
|
16091
16092
|
type,
|
|
16092
16093
|
url: initialFile,
|
|
16093
16094
|
size: size4,
|
|
@@ -16123,13 +16124,13 @@ var BinaryField = (props) => {
|
|
|
16123
16124
|
};
|
|
16124
16125
|
const renderPreview = (file) => {
|
|
16125
16126
|
if (!file) return /* @__PURE__ */ jsx75(PlaceHolderIcon, {});
|
|
16126
|
-
const { name:
|
|
16127
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16127
16128
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16128
16129
|
return /* @__PURE__ */ jsx75(
|
|
16129
16130
|
"img",
|
|
16130
16131
|
{
|
|
16131
16132
|
src: url,
|
|
16132
|
-
alt:
|
|
16133
|
+
alt: name2,
|
|
16133
16134
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16134
16135
|
style: {
|
|
16135
16136
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16169,7 +16170,7 @@ var BinaryField = (props) => {
|
|
|
16169
16170
|
maxWidth: "120px"
|
|
16170
16171
|
},
|
|
16171
16172
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16172
|
-
children:
|
|
16173
|
+
children: name2
|
|
16173
16174
|
}
|
|
16174
16175
|
),
|
|
16175
16176
|
isShowSize && /* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16179,7 +16180,7 @@ var BinaryField = (props) => {
|
|
|
16179
16180
|
return /* @__PURE__ */ jsx75(
|
|
16180
16181
|
Controller,
|
|
16181
16182
|
{
|
|
16182
|
-
name:
|
|
16183
|
+
name: name ?? "",
|
|
16183
16184
|
control: methods?.control,
|
|
16184
16185
|
rules: {
|
|
16185
16186
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -16472,7 +16473,7 @@ import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-
|
|
|
16472
16473
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
16473
16474
|
var CharField = (props) => {
|
|
16474
16475
|
const {
|
|
16475
|
-
name
|
|
16476
|
+
name,
|
|
16476
16477
|
readonly,
|
|
16477
16478
|
placeholder,
|
|
16478
16479
|
required,
|
|
@@ -16503,7 +16504,7 @@ var CharField = (props) => {
|
|
|
16503
16504
|
return /* @__PURE__ */ jsx78(
|
|
16504
16505
|
Controller,
|
|
16505
16506
|
{
|
|
16506
|
-
name:
|
|
16507
|
+
name: name ?? "",
|
|
16507
16508
|
control: methods.control,
|
|
16508
16509
|
rules: {
|
|
16509
16510
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -16530,15 +16531,15 @@ var CharField = (props) => {
|
|
|
16530
16531
|
const { setError, clearErrors } = methods;
|
|
16531
16532
|
useEffect11(() => {
|
|
16532
16533
|
if (value2) {
|
|
16533
|
-
clearErrors(
|
|
16534
|
+
clearErrors(name);
|
|
16534
16535
|
}
|
|
16535
|
-
}, [value2, clearErrors,
|
|
16536
|
+
}, [value2, clearErrors, name]);
|
|
16536
16537
|
useEffect11(() => {
|
|
16537
16538
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
16538
16539
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
16539
|
-
const currentValue = methods?.getValues(
|
|
16540
|
+
const currentValue = methods?.getValues(name);
|
|
16540
16541
|
if (currentValue !== depValue) {
|
|
16541
|
-
methods?.setValue(
|
|
16542
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
16542
16543
|
}
|
|
16543
16544
|
}, [widget, formValues]);
|
|
16544
16545
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -16563,14 +16564,14 @@ var CharField = (props) => {
|
|
|
16563
16564
|
const inputValue = e3.target.value;
|
|
16564
16565
|
if (readonly) return;
|
|
16565
16566
|
fieldOnchange(inputValue);
|
|
16566
|
-
clearErrors(
|
|
16567
|
+
clearErrors(name);
|
|
16567
16568
|
},
|
|
16568
16569
|
onBlur: (e3) => {
|
|
16569
16570
|
if (readonly) return;
|
|
16570
16571
|
const inputValue = e3.target.value || "";
|
|
16571
16572
|
if (widget === "custom_passord") {
|
|
16572
16573
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
16573
|
-
setError(
|
|
16574
|
+
setError(name, {
|
|
16574
16575
|
type: "pattern",
|
|
16575
16576
|
message: getPasswordMessage(
|
|
16576
16577
|
min3,
|
|
@@ -16585,7 +16586,7 @@ var CharField = (props) => {
|
|
|
16585
16586
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
16586
16587
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
16587
16588
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
16588
|
-
setError(
|
|
16589
|
+
setError(name, {
|
|
16589
16590
|
type: "pattern",
|
|
16590
16591
|
message: t3(
|
|
16591
16592
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -16595,14 +16596,14 @@ var CharField = (props) => {
|
|
|
16595
16596
|
}
|
|
16596
16597
|
}
|
|
16597
16598
|
fieldOnchange(inputValue);
|
|
16598
|
-
onChange2 && onChange2(
|
|
16599
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
16599
16600
|
if (!inputValue && required && !invisible) {
|
|
16600
|
-
setError(
|
|
16601
|
+
setError(name, {
|
|
16601
16602
|
type: "required",
|
|
16602
16603
|
message: `${string} ${t3("must_required")}`
|
|
16603
16604
|
});
|
|
16604
16605
|
} else {
|
|
16605
|
-
clearErrors(
|
|
16606
|
+
clearErrors(name);
|
|
16606
16607
|
}
|
|
16607
16608
|
},
|
|
16608
16609
|
readOnly: readonly,
|
|
@@ -16656,14 +16657,14 @@ function EyeIconComponent({ open }) {
|
|
|
16656
16657
|
}
|
|
16657
16658
|
var SecureField = (props) => {
|
|
16658
16659
|
const {
|
|
16659
|
-
name
|
|
16660
|
+
name,
|
|
16660
16661
|
readonly,
|
|
16661
16662
|
placeholder,
|
|
16662
16663
|
required,
|
|
16663
16664
|
invisible,
|
|
16664
16665
|
methods,
|
|
16665
16666
|
onChange: onChange2,
|
|
16666
|
-
string =
|
|
16667
|
+
string = name,
|
|
16667
16668
|
widget,
|
|
16668
16669
|
min: min3,
|
|
16669
16670
|
max: max3,
|
|
@@ -16693,7 +16694,7 @@ var SecureField = (props) => {
|
|
|
16693
16694
|
return /* @__PURE__ */ jsx80(
|
|
16694
16695
|
Controller,
|
|
16695
16696
|
{
|
|
16696
|
-
name: String(
|
|
16697
|
+
name: String(name),
|
|
16697
16698
|
control: methods.control,
|
|
16698
16699
|
rules: {
|
|
16699
16700
|
...required && !invisible ? {
|
|
@@ -16727,8 +16728,8 @@ var SecureField = (props) => {
|
|
|
16727
16728
|
if (canToggle) setShowPlain(false);
|
|
16728
16729
|
}, [canToggle]);
|
|
16729
16730
|
useEffect12(() => {
|
|
16730
|
-
if (value2) clearErrors(
|
|
16731
|
-
}, [value2, clearErrors,
|
|
16731
|
+
if (value2) clearErrors(name);
|
|
16732
|
+
}, [value2, clearErrors, name]);
|
|
16732
16733
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
16733
16734
|
isCappedToken && shouldMask && /* @__PURE__ */ jsx80(
|
|
16734
16735
|
"div",
|
|
@@ -16746,20 +16747,20 @@ var SecureField = (props) => {
|
|
|
16746
16747
|
if (readonly) return;
|
|
16747
16748
|
const inputValue = e3.target.value ?? "";
|
|
16748
16749
|
fieldOnchange(inputValue);
|
|
16749
|
-
clearErrors(
|
|
16750
|
+
clearErrors(name);
|
|
16750
16751
|
},
|
|
16751
16752
|
onBlur: (e3) => {
|
|
16752
16753
|
if (readonly) return;
|
|
16753
16754
|
const inputValue = (e3.target.value ?? "").trim();
|
|
16754
16755
|
if (!inputValue && required && !invisible) {
|
|
16755
|
-
setError(
|
|
16756
|
+
setError(name, {
|
|
16756
16757
|
type: "required",
|
|
16757
16758
|
message: `${string} ${t3("must_required")}`
|
|
16758
16759
|
});
|
|
16759
16760
|
return;
|
|
16760
16761
|
}
|
|
16761
16762
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
16762
|
-
setError(
|
|
16763
|
+
setError(name, {
|
|
16763
16764
|
type: "pattern",
|
|
16764
16765
|
message: getPasswordMessage2(
|
|
16765
16766
|
min3,
|
|
@@ -16772,8 +16773,8 @@ var SecureField = (props) => {
|
|
|
16772
16773
|
return;
|
|
16773
16774
|
}
|
|
16774
16775
|
fieldOnchange(inputValue);
|
|
16775
|
-
onChange2 && onChange2(String(
|
|
16776
|
-
clearErrors(
|
|
16776
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
16777
|
+
clearErrors(name);
|
|
16777
16778
|
},
|
|
16778
16779
|
readOnly: readonly,
|
|
16779
16780
|
disabled: readonly,
|
|
@@ -16817,7 +16818,7 @@ var SecureField = (props) => {
|
|
|
16817
16818
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
16818
16819
|
var CheckboxField = (props) => {
|
|
16819
16820
|
const {
|
|
16820
|
-
name
|
|
16821
|
+
name,
|
|
16821
16822
|
readonly = false,
|
|
16822
16823
|
required = false,
|
|
16823
16824
|
invisible = false,
|
|
@@ -16828,7 +16829,7 @@ var CheckboxField = (props) => {
|
|
|
16828
16829
|
isEditTable = false
|
|
16829
16830
|
} = props;
|
|
16830
16831
|
if (!isForm) {
|
|
16831
|
-
if (
|
|
16832
|
+
if (name === "is_active" || name === "active") {
|
|
16832
16833
|
return /* @__PURE__ */ jsx81(ActiveBadgeField, { type: value });
|
|
16833
16834
|
} else {
|
|
16834
16835
|
return /* @__PURE__ */ jsx81(
|
|
@@ -16845,7 +16846,7 @@ var CheckboxField = (props) => {
|
|
|
16845
16846
|
return /* @__PURE__ */ jsx81(
|
|
16846
16847
|
Controller,
|
|
16847
16848
|
{
|
|
16848
|
-
name:
|
|
16849
|
+
name: name ?? "",
|
|
16849
16850
|
control: methods?.control,
|
|
16850
16851
|
render: ({ field }) => /* @__PURE__ */ jsx81(
|
|
16851
16852
|
"div",
|
|
@@ -16854,10 +16855,10 @@ var CheckboxField = (props) => {
|
|
|
16854
16855
|
onClick: () => {
|
|
16855
16856
|
const checked = !field.value;
|
|
16856
16857
|
if (!isEditTable && readonly) return;
|
|
16857
|
-
methods.setValue(
|
|
16858
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16858
16859
|
field.onChange(checked);
|
|
16859
16860
|
if (onChange2) {
|
|
16860
|
-
onChange2(
|
|
16861
|
+
onChange2(name ?? "", checked);
|
|
16861
16862
|
}
|
|
16862
16863
|
},
|
|
16863
16864
|
children: /* @__PURE__ */ jsx81(
|
|
@@ -16867,10 +16868,10 @@ var CheckboxField = (props) => {
|
|
|
16867
16868
|
onChange: (e3) => {
|
|
16868
16869
|
const checked = e3.target.checked;
|
|
16869
16870
|
if (!isEditTable && readonly) return;
|
|
16870
|
-
methods.setValue(
|
|
16871
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16871
16872
|
field.onChange(checked);
|
|
16872
16873
|
if (onChange2) {
|
|
16873
|
-
onChange2(
|
|
16874
|
+
onChange2(name ?? "", checked);
|
|
16874
16875
|
}
|
|
16875
16876
|
},
|
|
16876
16877
|
type: "checkbox",
|
|
@@ -16964,19 +16965,19 @@ var ColorWrapper = (props) => {
|
|
|
16964
16965
|
// src/widgets/basic/color-field/color.tsx
|
|
16965
16966
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
16966
16967
|
var ColorField = (props) => {
|
|
16967
|
-
const { value, isForm, name
|
|
16968
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
16968
16969
|
if (!isForm) {
|
|
16969
16970
|
return /* @__PURE__ */ jsx83(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
16970
16971
|
}
|
|
16971
16972
|
return /* @__PURE__ */ jsx83(
|
|
16972
16973
|
Controller,
|
|
16973
16974
|
{
|
|
16974
|
-
name:
|
|
16975
|
+
name: name ?? "",
|
|
16975
16976
|
control: methods?.control,
|
|
16976
16977
|
render: ({ field }) => {
|
|
16977
16978
|
const handlePickColorChange = (color) => {
|
|
16978
16979
|
field.onChange(color?.id);
|
|
16979
|
-
onChange2 && onChange2(
|
|
16980
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
16980
16981
|
};
|
|
16981
16982
|
return /* @__PURE__ */ jsx83(
|
|
16982
16983
|
ColorWrapper,
|
|
@@ -16997,7 +16998,7 @@ import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
|
16997
16998
|
var CopyLinkButtonField = (props) => {
|
|
16998
16999
|
const {
|
|
16999
17000
|
isForm,
|
|
17000
|
-
name
|
|
17001
|
+
name,
|
|
17001
17002
|
methods,
|
|
17002
17003
|
onChange: onChange2,
|
|
17003
17004
|
readonly,
|
|
@@ -17019,7 +17020,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17019
17020
|
return /* @__PURE__ */ jsx84(
|
|
17020
17021
|
Controller,
|
|
17021
17022
|
{
|
|
17022
|
-
name:
|
|
17023
|
+
name: name ?? "",
|
|
17023
17024
|
control: methods.control,
|
|
17024
17025
|
rules: {
|
|
17025
17026
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17031,7 +17032,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17031
17032
|
const { setError, clearErrors } = methods;
|
|
17032
17033
|
useEffect14(() => {
|
|
17033
17034
|
if (value) {
|
|
17034
|
-
clearErrors(
|
|
17035
|
+
clearErrors(name);
|
|
17035
17036
|
}
|
|
17036
17037
|
}, [value]);
|
|
17037
17038
|
return /* @__PURE__ */ jsxs54("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17049,11 +17050,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17049
17050
|
if (readonly) return;
|
|
17050
17051
|
const newValue = e3.target.value || "";
|
|
17051
17052
|
fieldOnchange(newValue);
|
|
17052
|
-
onChange2 && onChange2(
|
|
17053
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17053
17054
|
if (e3.target.value) {
|
|
17054
|
-
clearErrors(
|
|
17055
|
+
clearErrors(name);
|
|
17055
17056
|
} else if (required && !invisible) {
|
|
17056
|
-
setError(
|
|
17057
|
+
setError(name, {
|
|
17057
17058
|
type: "required",
|
|
17058
17059
|
message: `${string} ${t3("must_required")}`
|
|
17059
17060
|
});
|
|
@@ -17063,9 +17064,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17063
17064
|
if (!readonly) {
|
|
17064
17065
|
fieldOnchange(e3.target.value);
|
|
17065
17066
|
if (e3.target.value) {
|
|
17066
|
-
clearErrors(
|
|
17067
|
+
clearErrors(name);
|
|
17067
17068
|
} else if (required && !invisible) {
|
|
17068
|
-
setError(
|
|
17069
|
+
setError(name, {
|
|
17069
17070
|
type: "required",
|
|
17070
17071
|
message: `${string} ${t3("must_required")}`
|
|
17071
17072
|
});
|
|
@@ -26929,23 +26930,23 @@ var createCache = function createCache2(options2) {
|
|
|
26929
26930
|
};
|
|
26930
26931
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
26931
26932
|
var getRules3 = function getRules4(selector, serialized) {
|
|
26932
|
-
var
|
|
26933
|
-
if (serverStylisCache[
|
|
26934
|
-
serverStylisCache[
|
|
26933
|
+
var name = serialized.name;
|
|
26934
|
+
if (serverStylisCache[name] === void 0) {
|
|
26935
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
26935
26936
|
}
|
|
26936
|
-
return serverStylisCache[
|
|
26937
|
+
return serverStylisCache[name];
|
|
26937
26938
|
};
|
|
26938
26939
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
26939
|
-
var
|
|
26940
|
+
var name = serialized.name;
|
|
26940
26941
|
var rules = getRules3(selector, serialized);
|
|
26941
26942
|
if (cache.compat === void 0) {
|
|
26942
26943
|
if (shouldCache) {
|
|
26943
|
-
cache.inserted[
|
|
26944
|
+
cache.inserted[name] = true;
|
|
26944
26945
|
}
|
|
26945
26946
|
return rules;
|
|
26946
26947
|
} else {
|
|
26947
26948
|
if (shouldCache) {
|
|
26948
|
-
cache.inserted[
|
|
26949
|
+
cache.inserted[name] = rules;
|
|
26949
26950
|
} else {
|
|
26950
26951
|
return rules;
|
|
26951
26952
|
}
|
|
@@ -27268,9 +27269,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
27268
27269
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
27269
27270
|
identifierName += "-" + match3[1];
|
|
27270
27271
|
}
|
|
27271
|
-
var
|
|
27272
|
+
var name = murmur2(styles) + identifierName;
|
|
27272
27273
|
return {
|
|
27273
|
-
name
|
|
27274
|
+
name,
|
|
27274
27275
|
styles,
|
|
27275
27276
|
next: cursor
|
|
27276
27277
|
};
|
|
@@ -27420,10 +27421,10 @@ function css() {
|
|
|
27420
27421
|
}
|
|
27421
27422
|
function keyframes() {
|
|
27422
27423
|
var insertable = css.apply(void 0, arguments);
|
|
27423
|
-
var
|
|
27424
|
+
var name = "animation-" + insertable.name;
|
|
27424
27425
|
return {
|
|
27425
|
-
name
|
|
27426
|
-
styles: "@keyframes " +
|
|
27426
|
+
name,
|
|
27427
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
27427
27428
|
anim: 1,
|
|
27428
27429
|
toString: function toString() {
|
|
27429
27430
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -27455,13 +27456,13 @@ var index3 = isClient3 ? useLayoutEffect4 : noop6;
|
|
|
27455
27456
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
27456
27457
|
var noop8 = function noop9() {
|
|
27457
27458
|
};
|
|
27458
|
-
function applyPrefixToName(prefix2,
|
|
27459
|
-
if (!
|
|
27459
|
+
function applyPrefixToName(prefix2, name) {
|
|
27460
|
+
if (!name) {
|
|
27460
27461
|
return prefix2;
|
|
27461
|
-
} else if (
|
|
27462
|
-
return prefix2 +
|
|
27462
|
+
} else if (name[0] === "-") {
|
|
27463
|
+
return prefix2 + name;
|
|
27463
27464
|
} else {
|
|
27464
|
-
return prefix2 + "__" +
|
|
27465
|
+
return prefix2 + "__" + name;
|
|
27465
27466
|
}
|
|
27466
27467
|
}
|
|
27467
27468
|
function classNames(prefix2, state) {
|
|
@@ -27505,11 +27506,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
27505
27506
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
27506
27507
|
return _objectSpread2({}, innerProps);
|
|
27507
27508
|
};
|
|
27508
|
-
var getStyleProps = function getStyleProps2(props,
|
|
27509
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
27509
27510
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
27510
27511
|
return {
|
|
27511
|
-
css: getStyles(
|
|
27512
|
-
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(
|
|
27512
|
+
css: getStyles(name, props),
|
|
27513
|
+
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className)
|
|
27513
27514
|
};
|
|
27514
27515
|
};
|
|
27515
27516
|
function isDocumentElement(el) {
|
|
@@ -29258,10 +29259,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
29258
29259
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
29259
29260
|
};
|
|
29260
29261
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
29261
|
-
var
|
|
29262
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
29262
29263
|
return jsx86("input", {
|
|
29263
29264
|
required: true,
|
|
29264
|
-
name
|
|
29265
|
+
name,
|
|
29265
29266
|
tabIndex: -1,
|
|
29266
29267
|
"aria-hidden": "true",
|
|
29267
29268
|
onFocus: onFocus2,
|
|
@@ -29587,8 +29588,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29587
29588
|
_this.focus = _this.focusInput;
|
|
29588
29589
|
_this.blur = _this.blurInput;
|
|
29589
29590
|
_this.onChange = function(newValue, actionMeta) {
|
|
29590
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
29591
|
-
actionMeta.name =
|
|
29591
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
29592
|
+
actionMeta.name = name;
|
|
29592
29593
|
_this.ariaOnChange(newValue, actionMeta);
|
|
29593
29594
|
onChange2(newValue, actionMeta);
|
|
29594
29595
|
};
|
|
@@ -29613,7 +29614,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29613
29614
|
});
|
|
29614
29615
|
};
|
|
29615
29616
|
_this.selectOption = function(newValue) {
|
|
29616
|
-
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti,
|
|
29617
|
+
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name;
|
|
29617
29618
|
var selectValue = _this.state.selectValue;
|
|
29618
29619
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
29619
29620
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -29632,7 +29633,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29632
29633
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
29633
29634
|
action: "select-option",
|
|
29634
29635
|
option: newValue,
|
|
29635
|
-
name
|
|
29636
|
+
name
|
|
29636
29637
|
});
|
|
29637
29638
|
return;
|
|
29638
29639
|
}
|
|
@@ -30686,22 +30687,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30686
30687
|
key: "renderFormField",
|
|
30687
30688
|
value: function renderFormField() {
|
|
30688
30689
|
var _this5 = this;
|
|
30689
|
-
var _this$props13 = this.props, delimiter2 = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti,
|
|
30690
|
+
var _this$props13 = this.props, delimiter2 = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti, name = _this$props13.name, required = _this$props13.required;
|
|
30690
30691
|
var selectValue = this.state.selectValue;
|
|
30691
30692
|
if (required && !this.hasValue() && !isDisabled) {
|
|
30692
30693
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
30693
|
-
name
|
|
30694
|
+
name,
|
|
30694
30695
|
onFocus: this.onValueInputFocus
|
|
30695
30696
|
});
|
|
30696
30697
|
}
|
|
30697
|
-
if (!
|
|
30698
|
+
if (!name || isDisabled) return;
|
|
30698
30699
|
if (isMulti) {
|
|
30699
30700
|
if (delimiter2) {
|
|
30700
30701
|
var value = selectValue.map(function(opt) {
|
|
30701
30702
|
return _this5.getOptionValue(opt);
|
|
30702
30703
|
}).join(delimiter2);
|
|
30703
30704
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30704
|
-
name
|
|
30705
|
+
name,
|
|
30705
30706
|
type: "hidden",
|
|
30706
30707
|
value
|
|
30707
30708
|
});
|
|
@@ -30709,12 +30710,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30709
30710
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
30710
30711
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30711
30712
|
key: "i-".concat(i3),
|
|
30712
|
-
name
|
|
30713
|
+
name,
|
|
30713
30714
|
type: "hidden",
|
|
30714
30715
|
value: _this5.getOptionValue(opt)
|
|
30715
30716
|
});
|
|
30716
30717
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
30717
|
-
name
|
|
30718
|
+
name,
|
|
30718
30719
|
type: "hidden",
|
|
30719
30720
|
value: ""
|
|
30720
30721
|
});
|
|
@@ -30723,7 +30724,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30723
30724
|
} else {
|
|
30724
30725
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
30725
30726
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30726
|
-
name
|
|
30727
|
+
name,
|
|
30727
30728
|
type: "hidden",
|
|
30728
30729
|
value: _value
|
|
30729
30730
|
});
|
|
@@ -30852,7 +30853,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
30852
30853
|
import { Fragment as Fragment24, jsx as jsx88, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
30853
30854
|
var DateField = (props) => {
|
|
30854
30855
|
const {
|
|
30855
|
-
name
|
|
30856
|
+
name,
|
|
30856
30857
|
value,
|
|
30857
30858
|
readonly,
|
|
30858
30859
|
placeholder = "DD/MM/YYYY",
|
|
@@ -30902,7 +30903,7 @@ var DateField = (props) => {
|
|
|
30902
30903
|
return /* @__PURE__ */ jsx88(
|
|
30903
30904
|
Controller,
|
|
30904
30905
|
{
|
|
30905
|
-
name:
|
|
30906
|
+
name: name || "",
|
|
30906
30907
|
control: methods?.control,
|
|
30907
30908
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
30908
30909
|
rules: {
|
|
@@ -30917,9 +30918,9 @@ var DateField = (props) => {
|
|
|
30917
30918
|
const { setError, clearErrors } = methods;
|
|
30918
30919
|
useEffect18(() => {
|
|
30919
30920
|
if (value) {
|
|
30920
|
-
clearErrors(
|
|
30921
|
+
clearErrors(name);
|
|
30921
30922
|
}
|
|
30922
|
-
}, [value, clearErrors,
|
|
30923
|
+
}, [value, clearErrors, name]);
|
|
30923
30924
|
const selectedDate = !methods ? value && (0, import_moment2.default)(value, formatDateParse).isValid() ? (0, import_moment2.default)(value, formatDateParse).add(7, "hours").toDate() : null : field?.value && (0, import_moment2.default)(field.value, formatDateParse).isValid() ? (0, import_moment2.default)(field.value, formatDateParse).add(7, "hours").toDate() : null;
|
|
30924
30925
|
return /* @__PURE__ */ jsxs56(Fragment24, { children: [
|
|
30925
30926
|
/* @__PURE__ */ jsx88(
|
|
@@ -30938,7 +30939,7 @@ var DateField = (props) => {
|
|
|
30938
30939
|
adjustedDate.toDate()
|
|
30939
30940
|
);
|
|
30940
30941
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
30941
|
-
setError(
|
|
30942
|
+
setError(name, {
|
|
30942
30943
|
type: "manual",
|
|
30943
30944
|
message: validateCustomResult
|
|
30944
30945
|
});
|
|
@@ -30946,20 +30947,20 @@ var DateField = (props) => {
|
|
|
30946
30947
|
}
|
|
30947
30948
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
30948
30949
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
30949
|
-
handleOnchange && handleOnchange(
|
|
30950
|
-
clearErrors(
|
|
30950
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
30951
|
+
clearErrors(name);
|
|
30951
30952
|
} else {
|
|
30952
30953
|
field.onChange(null);
|
|
30953
|
-
handleOnchange && handleOnchange(
|
|
30954
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
30954
30955
|
if (required && !invisible) {
|
|
30955
30956
|
if (!isEditTable) {
|
|
30956
|
-
setError(
|
|
30957
|
+
setError(name, {
|
|
30957
30958
|
type: "manual",
|
|
30958
30959
|
message: `${string} ${t3("must_required")}`
|
|
30959
30960
|
});
|
|
30960
30961
|
}
|
|
30961
30962
|
} else {
|
|
30962
|
-
clearErrors(
|
|
30963
|
+
clearErrors(name);
|
|
30963
30964
|
}
|
|
30964
30965
|
}
|
|
30965
30966
|
},
|
|
@@ -30980,7 +30981,7 @@ var DateField = (props) => {
|
|
|
30980
30981
|
}
|
|
30981
30982
|
),
|
|
30982
30983
|
timeInputLabel: textPlaceHolder,
|
|
30983
|
-
portalId:
|
|
30984
|
+
portalId: name,
|
|
30984
30985
|
renderCustomHeader: ({
|
|
30985
30986
|
date,
|
|
30986
30987
|
changeYear,
|
|
@@ -31319,7 +31320,7 @@ var RenderFile = ({
|
|
|
31319
31320
|
};
|
|
31320
31321
|
var FileUploadField = (props) => {
|
|
31321
31322
|
const {
|
|
31322
|
-
name
|
|
31323
|
+
name,
|
|
31323
31324
|
methods,
|
|
31324
31325
|
isForm,
|
|
31325
31326
|
model,
|
|
@@ -31350,7 +31351,7 @@ var FileUploadField = (props) => {
|
|
|
31350
31351
|
return /* @__PURE__ */ jsx93(
|
|
31351
31352
|
Controller,
|
|
31352
31353
|
{
|
|
31353
|
-
name:
|
|
31354
|
+
name: name || "",
|
|
31354
31355
|
control: methods?.control,
|
|
31355
31356
|
rules: {
|
|
31356
31357
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31416,7 +31417,7 @@ import { useEffect as useEffect20, useRef as useRef15, useState as useState19 }
|
|
|
31416
31417
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
31417
31418
|
var FloatField = (props) => {
|
|
31418
31419
|
const {
|
|
31419
|
-
name
|
|
31420
|
+
name,
|
|
31420
31421
|
value: propValue,
|
|
31421
31422
|
readonly,
|
|
31422
31423
|
placeholder,
|
|
@@ -31437,7 +31438,7 @@ var FloatField = (props) => {
|
|
|
31437
31438
|
return /* @__PURE__ */ jsx94(
|
|
31438
31439
|
Controller,
|
|
31439
31440
|
{
|
|
31440
|
-
name:
|
|
31441
|
+
name: name ?? "",
|
|
31441
31442
|
control: methods.control,
|
|
31442
31443
|
rules: {
|
|
31443
31444
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -31455,14 +31456,14 @@ var FloatField = (props) => {
|
|
|
31455
31456
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
31456
31457
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
31457
31458
|
setInputValue(formatFloatNumber(propValue));
|
|
31458
|
-
clearErrors(
|
|
31459
|
+
clearErrors(name);
|
|
31459
31460
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
31460
31461
|
setInputValue(formatFloatNumber(value));
|
|
31461
|
-
clearErrors(
|
|
31462
|
+
clearErrors(name);
|
|
31462
31463
|
} else if (value === null || value === void 0) {
|
|
31463
31464
|
setInputValue("");
|
|
31464
31465
|
}
|
|
31465
|
-
}, [value,
|
|
31466
|
+
}, [value, name, clearErrors, propValue]);
|
|
31466
31467
|
const handleInputChange = (e3) => {
|
|
31467
31468
|
let newValue = e3.target.value;
|
|
31468
31469
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -31482,7 +31483,7 @@ var FloatField = (props) => {
|
|
|
31482
31483
|
);
|
|
31483
31484
|
if (!isNaN(parsedValue)) {
|
|
31484
31485
|
onChange2(parsedValue);
|
|
31485
|
-
clearErrors(
|
|
31486
|
+
clearErrors(name);
|
|
31486
31487
|
isDirtyRef.current = true;
|
|
31487
31488
|
} else {
|
|
31488
31489
|
onChange2(null);
|
|
@@ -31494,7 +31495,7 @@ var FloatField = (props) => {
|
|
|
31494
31495
|
const parsedValue = parseFloat(rawValue);
|
|
31495
31496
|
if (rawValue === "" || rawValue === ".") {
|
|
31496
31497
|
if (required) {
|
|
31497
|
-
setError(
|
|
31498
|
+
setError(name, {
|
|
31498
31499
|
type: "required",
|
|
31499
31500
|
message: `${string} ${t3("must_required")}`
|
|
31500
31501
|
});
|
|
@@ -31504,7 +31505,7 @@ var FloatField = (props) => {
|
|
|
31504
31505
|
lastCommittedValueRef.current = null;
|
|
31505
31506
|
} else if (!isNaN(parsedValue)) {
|
|
31506
31507
|
if (parsedValue < 0) {
|
|
31507
|
-
setError(
|
|
31508
|
+
setError(name, {
|
|
31508
31509
|
type: "validate",
|
|
31509
31510
|
message: t3("invalid_number")
|
|
31510
31511
|
});
|
|
@@ -31514,12 +31515,12 @@ var FloatField = (props) => {
|
|
|
31514
31515
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
31515
31516
|
setInputValue(formattedValue);
|
|
31516
31517
|
onChange2(parsedValue);
|
|
31517
|
-
handleOnchange?.(
|
|
31518
|
-
clearErrors(
|
|
31518
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
31519
|
+
clearErrors(name);
|
|
31519
31520
|
lastCommittedValueRef.current = parsedValue;
|
|
31520
31521
|
}
|
|
31521
31522
|
} else {
|
|
31522
|
-
setError(
|
|
31523
|
+
setError(name, {
|
|
31523
31524
|
type: "validate",
|
|
31524
31525
|
message: t3("invalid_number")
|
|
31525
31526
|
});
|
|
@@ -31558,7 +31559,7 @@ import { useState as useState20 } from "react";
|
|
|
31558
31559
|
import { Fragment as Fragment27, jsx as jsx95, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
31559
31560
|
var FloatTimeField = (props) => {
|
|
31560
31561
|
const {
|
|
31561
|
-
name
|
|
31562
|
+
name,
|
|
31562
31563
|
methods,
|
|
31563
31564
|
defaultValue = 0,
|
|
31564
31565
|
isForm = true,
|
|
@@ -31576,7 +31577,7 @@ var FloatTimeField = (props) => {
|
|
|
31576
31577
|
return /* @__PURE__ */ jsx95(
|
|
31577
31578
|
Controller,
|
|
31578
31579
|
{
|
|
31579
|
-
name:
|
|
31580
|
+
name: name ?? "",
|
|
31580
31581
|
control: methods?.control,
|
|
31581
31582
|
defaultValue,
|
|
31582
31583
|
rules: {
|
|
@@ -31623,13 +31624,13 @@ var FloatTimeField = (props) => {
|
|
|
31623
31624
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
31624
31625
|
fieldOnChange(floatVal);
|
|
31625
31626
|
if (onChange2) {
|
|
31626
|
-
onChange2(
|
|
31627
|
+
onChange2(name ?? "", floatVal);
|
|
31627
31628
|
}
|
|
31628
31629
|
} else {
|
|
31629
31630
|
setInput("00:00");
|
|
31630
31631
|
fieldOnChange(0);
|
|
31631
31632
|
if (onChange2) {
|
|
31632
|
-
onChange2(
|
|
31633
|
+
onChange2(name ?? "", 0);
|
|
31633
31634
|
}
|
|
31634
31635
|
setErrors("");
|
|
31635
31636
|
}
|
|
@@ -31680,7 +31681,7 @@ import { useEffect as useEffect21, useRef as useRef16 } from "react";
|
|
|
31680
31681
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
31681
31682
|
var HtmlField = (props) => {
|
|
31682
31683
|
const {
|
|
31683
|
-
name
|
|
31684
|
+
name,
|
|
31684
31685
|
methods,
|
|
31685
31686
|
readonly = false,
|
|
31686
31687
|
isForm = true,
|
|
@@ -31697,7 +31698,7 @@ var HtmlField = (props) => {
|
|
|
31697
31698
|
return /* @__PURE__ */ jsx96(
|
|
31698
31699
|
Controller,
|
|
31699
31700
|
{
|
|
31700
|
-
name:
|
|
31701
|
+
name: name ?? "",
|
|
31701
31702
|
control: methods?.control,
|
|
31702
31703
|
defaultValue,
|
|
31703
31704
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -31730,10 +31731,10 @@ var HtmlField = (props) => {
|
|
|
31730
31731
|
// src/widgets/basic/image-field/image.tsx
|
|
31731
31732
|
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
31732
31733
|
var ImageField = (props) => {
|
|
31733
|
-
const { value, type, name
|
|
31734
|
+
const { value, type, name, baseURL } = props;
|
|
31734
31735
|
if (!value) return null;
|
|
31735
31736
|
if (type === "url") {
|
|
31736
|
-
return /* @__PURE__ */ jsx97("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt:
|
|
31737
|
+
return /* @__PURE__ */ jsx97("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt: name });
|
|
31737
31738
|
}
|
|
31738
31739
|
return /* @__PURE__ */ jsx97("div", { id: "qr-code", children: /* @__PURE__ */ jsx97("img", { src: `data:image/png;base64,${value}`, alt: "QR Code" }) });
|
|
31739
31740
|
};
|
|
@@ -31835,7 +31836,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31835
31836
|
const {
|
|
31836
31837
|
relation,
|
|
31837
31838
|
value,
|
|
31838
|
-
name
|
|
31839
|
+
name,
|
|
31839
31840
|
methods,
|
|
31840
31841
|
required,
|
|
31841
31842
|
invisible,
|
|
@@ -31876,7 +31877,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31876
31877
|
return /* @__PURE__ */ jsx99(
|
|
31877
31878
|
Controller,
|
|
31878
31879
|
{
|
|
31879
|
-
name:
|
|
31880
|
+
name: name ?? "",
|
|
31880
31881
|
control: methods.control,
|
|
31881
31882
|
rules: {
|
|
31882
31883
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31885,7 +31886,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31885
31886
|
const { clearErrors } = methods;
|
|
31886
31887
|
useEffect22(() => {
|
|
31887
31888
|
if (field.value) {
|
|
31888
|
-
clearErrors(
|
|
31889
|
+
clearErrors(name);
|
|
31889
31890
|
}
|
|
31890
31891
|
}, [field.value]);
|
|
31891
31892
|
const filteredValue = useMemo11(() => {
|
|
@@ -31905,18 +31906,18 @@ var Many2ManyTagField = (props) => {
|
|
|
31905
31906
|
}, [field?.value, options2]);
|
|
31906
31907
|
const handleChange = (selectedOptions) => {
|
|
31907
31908
|
const newValue = transfer(selectedOptions);
|
|
31908
|
-
methods?.setValue(
|
|
31909
|
-
onChange2?.(
|
|
31910
|
-
clearErrors(
|
|
31909
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
31910
|
+
onChange2?.(name ?? "", newValue);
|
|
31911
|
+
clearErrors(name);
|
|
31911
31912
|
newValue.forEach((item, index4) => {
|
|
31912
31913
|
Object.keys(item).forEach((key) => {
|
|
31913
|
-
methods.setValue(`${
|
|
31914
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
31914
31915
|
shouldDirty: true
|
|
31915
31916
|
});
|
|
31916
31917
|
});
|
|
31917
31918
|
});
|
|
31918
31919
|
};
|
|
31919
|
-
return /* @__PURE__ */ jsxs65("div", { className: "group h-full
|
|
31920
|
+
return /* @__PURE__ */ jsxs65("div", { className: "group h-full", children: [
|
|
31920
31921
|
/* @__PURE__ */ jsx99(
|
|
31921
31922
|
StateManagedSelect$1,
|
|
31922
31923
|
{
|
|
@@ -32035,7 +32036,7 @@ import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx
|
|
|
32035
32036
|
var MonetaryField = (props) => {
|
|
32036
32037
|
const { t: t3 } = useI18n();
|
|
32037
32038
|
const {
|
|
32038
|
-
name
|
|
32039
|
+
name,
|
|
32039
32040
|
value,
|
|
32040
32041
|
readonly,
|
|
32041
32042
|
required,
|
|
@@ -32052,7 +32053,7 @@ var MonetaryField = (props) => {
|
|
|
32052
32053
|
symbol = "VND",
|
|
32053
32054
|
baseClassName
|
|
32054
32055
|
} = props;
|
|
32055
|
-
if (isForm &&
|
|
32056
|
+
if (isForm && name === "amount_residual") {
|
|
32056
32057
|
return /* @__PURE__ */ jsxs66("div", { className: "flex justify-end gap-x-4 gap-y-2 ml-auto mt-2 lg:mt-5", children: [
|
|
32057
32058
|
/* @__PURE__ */ jsxs66("span", { className: "font-semibold", children: [
|
|
32058
32059
|
string,
|
|
@@ -32069,7 +32070,7 @@ var MonetaryField = (props) => {
|
|
|
32069
32070
|
return /* @__PURE__ */ jsx100(
|
|
32070
32071
|
Controller,
|
|
32071
32072
|
{
|
|
32072
|
-
name:
|
|
32073
|
+
name: name ?? "",
|
|
32073
32074
|
control: methods.control,
|
|
32074
32075
|
rules: {
|
|
32075
32076
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32082,7 +32083,7 @@ var MonetaryField = (props) => {
|
|
|
32082
32083
|
const { setError, clearErrors } = methods;
|
|
32083
32084
|
useEffect23(() => {
|
|
32084
32085
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32085
|
-
clearErrors(
|
|
32086
|
+
clearErrors(name);
|
|
32086
32087
|
}
|
|
32087
32088
|
}, [value2]);
|
|
32088
32089
|
return /* @__PURE__ */ jsxs66(Fragment29, { children: [
|
|
@@ -32093,18 +32094,18 @@ var MonetaryField = (props) => {
|
|
|
32093
32094
|
onBlur: () => {
|
|
32094
32095
|
if (!readonly && !isNaN(value2)) {
|
|
32095
32096
|
onBlur();
|
|
32096
|
-
handleOnchange && handleOnchange(
|
|
32097
|
-
clearErrors(
|
|
32097
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32098
|
+
clearErrors(name);
|
|
32098
32099
|
}
|
|
32099
32100
|
},
|
|
32100
32101
|
onChange: (e3) => {
|
|
32101
32102
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32102
32103
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32103
32104
|
onChange2(parsedValue);
|
|
32104
|
-
clearErrors(
|
|
32105
|
+
clearErrors(name);
|
|
32105
32106
|
} else {
|
|
32106
32107
|
if (required) {
|
|
32107
|
-
setError(
|
|
32108
|
+
setError(name, {
|
|
32108
32109
|
type: "required",
|
|
32109
32110
|
message: `${string} ${t3("must_required")}`
|
|
32110
32111
|
});
|
|
@@ -32219,9 +32220,11 @@ var PriorityField = (props) => {
|
|
|
32219
32220
|
onChange: onChange2,
|
|
32220
32221
|
id,
|
|
32221
32222
|
viewData,
|
|
32222
|
-
model
|
|
32223
|
+
model,
|
|
32224
|
+
name,
|
|
32225
|
+
string
|
|
32223
32226
|
} = props;
|
|
32224
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
32227
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
32225
32228
|
const defaultPriority = parseInt(value) + 1;
|
|
32226
32229
|
if (!isForm) {
|
|
32227
32230
|
return /* @__PURE__ */ jsx103(
|
|
@@ -32265,7 +32268,7 @@ import { useEffect as useEffect25 } from "react";
|
|
|
32265
32268
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
32266
32269
|
var RadioGroupField = (props) => {
|
|
32267
32270
|
const {
|
|
32268
|
-
name
|
|
32271
|
+
name,
|
|
32269
32272
|
readonly,
|
|
32270
32273
|
required,
|
|
32271
32274
|
placeholder,
|
|
@@ -32277,14 +32280,14 @@ var RadioGroupField = (props) => {
|
|
|
32277
32280
|
} = props;
|
|
32278
32281
|
useEffect25(() => {
|
|
32279
32282
|
if (selection?.length > 0) {
|
|
32280
|
-
if (setValue) setValue(
|
|
32283
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32281
32284
|
}
|
|
32282
|
-
}, [selection,
|
|
32285
|
+
}, [selection, name, setValue]);
|
|
32283
32286
|
if (!methods) return null;
|
|
32284
32287
|
return /* @__PURE__ */ jsx104(
|
|
32285
32288
|
Controller,
|
|
32286
32289
|
{
|
|
32287
|
-
name:
|
|
32290
|
+
name: name ?? "",
|
|
32288
32291
|
control: methods.control,
|
|
32289
32292
|
render: ({ field }) => /* @__PURE__ */ jsx104("div", { className: "widget radio-group-widget flex items-center gap-[10px] pb-4", children: selection?.map((select) => /* @__PURE__ */ jsxs68("div", { className: "flex items-center gap-1", children: [
|
|
32290
32293
|
/* @__PURE__ */ jsx104(
|
|
@@ -32297,8 +32300,8 @@ var RadioGroupField = (props) => {
|
|
|
32297
32300
|
onChange: (e3) => {
|
|
32298
32301
|
if (readonly) return;
|
|
32299
32302
|
field.onChange(e3.target.value);
|
|
32300
|
-
methods.setValue(
|
|
32301
|
-
onChange2?.(
|
|
32303
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
32304
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
32302
32305
|
},
|
|
32303
32306
|
readOnly: readonly,
|
|
32304
32307
|
required: !invisible && required,
|
|
@@ -32350,7 +32353,7 @@ var SelectDropdownField = (props) => {
|
|
|
32350
32353
|
const { t: t3 } = useI18n();
|
|
32351
32354
|
const {
|
|
32352
32355
|
selection,
|
|
32353
|
-
name
|
|
32356
|
+
name,
|
|
32354
32357
|
methods,
|
|
32355
32358
|
value,
|
|
32356
32359
|
readonly,
|
|
@@ -32373,7 +32376,7 @@ var SelectDropdownField = (props) => {
|
|
|
32373
32376
|
return /* @__PURE__ */ jsx106(
|
|
32374
32377
|
Controller,
|
|
32375
32378
|
{
|
|
32376
|
-
name:
|
|
32379
|
+
name: name || "",
|
|
32377
32380
|
control: methods.control,
|
|
32378
32381
|
rules: {
|
|
32379
32382
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32392,7 +32395,7 @@ var SelectDropdownField = (props) => {
|
|
|
32392
32395
|
menuPlacement: "auto",
|
|
32393
32396
|
onChange: (selectedOption) => {
|
|
32394
32397
|
field.onChange(selectedOption.value);
|
|
32395
|
-
onChange2 && onChange2(
|
|
32398
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
32396
32399
|
},
|
|
32397
32400
|
value: defaultValue || null,
|
|
32398
32401
|
required: !invisible && required
|
|
@@ -32473,7 +32476,7 @@ import { jsx as jsx107 } from "react/jsx-runtime";
|
|
|
32473
32476
|
var TextAreaField = (props) => {
|
|
32474
32477
|
const {
|
|
32475
32478
|
methods,
|
|
32476
|
-
name
|
|
32479
|
+
name,
|
|
32477
32480
|
readonly,
|
|
32478
32481
|
placeholder,
|
|
32479
32482
|
required,
|
|
@@ -32484,7 +32487,7 @@ var TextAreaField = (props) => {
|
|
|
32484
32487
|
onChange: onChange2,
|
|
32485
32488
|
baseClassName
|
|
32486
32489
|
} = props;
|
|
32487
|
-
const formProps = methods ? methods.register(
|
|
32490
|
+
const formProps = methods ? methods.register(name, {
|
|
32488
32491
|
onBlur: (e3) => {
|
|
32489
32492
|
const newValue = e3.target.value;
|
|
32490
32493
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -32506,7 +32509,7 @@ var TextAreaField = (props) => {
|
|
|
32506
32509
|
disabled: readonly,
|
|
32507
32510
|
placeholder,
|
|
32508
32511
|
required: !invisible && required,
|
|
32509
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
32512
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
32510
32513
|
}
|
|
32511
32514
|
);
|
|
32512
32515
|
};
|
|
@@ -32515,7 +32518,7 @@ var TextAreaField = (props) => {
|
|
|
32515
32518
|
import { jsx as jsx108, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
32516
32519
|
var ToggleButtonField = (props) => {
|
|
32517
32520
|
const {
|
|
32518
|
-
name
|
|
32521
|
+
name,
|
|
32519
32522
|
readonly = false,
|
|
32520
32523
|
required = false,
|
|
32521
32524
|
invisible = false,
|
|
@@ -32525,7 +32528,7 @@ var ToggleButtonField = (props) => {
|
|
|
32525
32528
|
return /* @__PURE__ */ jsx108(
|
|
32526
32529
|
Controller,
|
|
32527
32530
|
{
|
|
32528
|
-
name:
|
|
32531
|
+
name: name ?? "",
|
|
32529
32532
|
control: methods?.control,
|
|
32530
32533
|
render: ({ field }) => /* @__PURE__ */ jsx108("div", { className: "widget toggle-widget inline-flex items-center", children: /* @__PURE__ */ jsxs71("label", { className: "relative inline-block w-8 h-5 cursor-pointer", children: [
|
|
32531
32534
|
/* @__PURE__ */ jsx108(
|
|
@@ -32535,10 +32538,10 @@ var ToggleButtonField = (props) => {
|
|
|
32535
32538
|
type: "checkbox",
|
|
32536
32539
|
onChange: (e3) => {
|
|
32537
32540
|
if (readonly) return;
|
|
32538
|
-
methods.setValue(
|
|
32541
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
32539
32542
|
field.onChange(e3.target.checked);
|
|
32540
32543
|
if (onChange2) {
|
|
32541
|
-
onChange2(
|
|
32544
|
+
onChange2(name ?? "", e3.target.checked);
|
|
32542
32545
|
}
|
|
32543
32546
|
},
|
|
32544
32547
|
disabled: readonly,
|
|
@@ -32585,7 +32588,7 @@ import { useEffect as useEffect26, useRef as useRef17, useState as useState22 }
|
|
|
32585
32588
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
32586
32589
|
var IntegerField = (props) => {
|
|
32587
32590
|
const {
|
|
32588
|
-
name
|
|
32591
|
+
name,
|
|
32589
32592
|
value,
|
|
32590
32593
|
readonly,
|
|
32591
32594
|
placeholder,
|
|
@@ -32607,7 +32610,7 @@ var IntegerField = (props) => {
|
|
|
32607
32610
|
return /* @__PURE__ */ jsx109(
|
|
32608
32611
|
Controller,
|
|
32609
32612
|
{
|
|
32610
|
-
name:
|
|
32613
|
+
name: name || "",
|
|
32611
32614
|
control: methods.control,
|
|
32612
32615
|
rules: {
|
|
32613
32616
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32627,12 +32630,12 @@ var IntegerField = (props) => {
|
|
|
32627
32630
|
useEffect26(() => {
|
|
32628
32631
|
if (value2 !== void 0 && value2 !== null) {
|
|
32629
32632
|
setInputValue(String(value2));
|
|
32630
|
-
clearErrors(
|
|
32633
|
+
clearErrors(name);
|
|
32631
32634
|
}
|
|
32632
32635
|
}, [value2]);
|
|
32633
32636
|
const noticeError = () => {
|
|
32634
32637
|
if (required) {
|
|
32635
|
-
setError(
|
|
32638
|
+
setError(name, {
|
|
32636
32639
|
type: "required",
|
|
32637
32640
|
message: `${string} ${t3("must_required")}`
|
|
32638
32641
|
});
|
|
@@ -32650,7 +32653,7 @@ var IntegerField = (props) => {
|
|
|
32650
32653
|
if (!isNaN(parsed)) {
|
|
32651
32654
|
fieldOnChange(parsed);
|
|
32652
32655
|
isDirtyRef.current = true;
|
|
32653
|
-
clearErrors(
|
|
32656
|
+
clearErrors(name);
|
|
32654
32657
|
} else {
|
|
32655
32658
|
noticeError();
|
|
32656
32659
|
}
|
|
@@ -32676,11 +32679,11 @@ var IntegerField = (props) => {
|
|
|
32676
32679
|
return;
|
|
32677
32680
|
}
|
|
32678
32681
|
fieldOnChange(parsed);
|
|
32679
|
-
onChange2?.(
|
|
32682
|
+
onChange2?.(name ?? "", parsed);
|
|
32680
32683
|
lastCommittedValueRef.current = parsed;
|
|
32681
32684
|
isDirtyRef.current = false;
|
|
32682
32685
|
inputRef.current?.blur();
|
|
32683
|
-
clearErrors(
|
|
32686
|
+
clearErrors(name);
|
|
32684
32687
|
};
|
|
32685
32688
|
return /* @__PURE__ */ jsxs72(Fragment31, { children: [
|
|
32686
32689
|
/* @__PURE__ */ jsx109(
|
|
@@ -33089,7 +33092,7 @@ var Many2OneField = (props) => {
|
|
|
33089
33092
|
isForm,
|
|
33090
33093
|
isEditTable,
|
|
33091
33094
|
value: propValue,
|
|
33092
|
-
name
|
|
33095
|
+
name,
|
|
33093
33096
|
readonly,
|
|
33094
33097
|
methods,
|
|
33095
33098
|
required,
|
|
@@ -33116,7 +33119,7 @@ var Many2OneField = (props) => {
|
|
|
33116
33119
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33117
33120
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33118
33121
|
allowShowDetail && renderDetail({
|
|
33119
|
-
idToolTip: String(
|
|
33122
|
+
idToolTip: String(name) + Number(index4),
|
|
33120
33123
|
model: options2?.model ?? relation,
|
|
33121
33124
|
context: contextObject,
|
|
33122
33125
|
idForm: id
|
|
@@ -33125,8 +33128,8 @@ var Many2OneField = (props) => {
|
|
|
33125
33128
|
"span",
|
|
33126
33129
|
{
|
|
33127
33130
|
className: "cursor-pointer",
|
|
33128
|
-
"data-tooltip-id": String(
|
|
33129
|
-
id:
|
|
33131
|
+
"data-tooltip-id": String(name) + index4,
|
|
33132
|
+
id: name,
|
|
33130
33133
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33131
33134
|
}
|
|
33132
33135
|
)
|
|
@@ -33134,21 +33137,21 @@ var Many2OneField = (props) => {
|
|
|
33134
33137
|
}
|
|
33135
33138
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33136
33139
|
allowShowDetail && renderDetail({
|
|
33137
|
-
idToolTip: String(
|
|
33140
|
+
idToolTip: String(name),
|
|
33138
33141
|
model: options2?.model ?? relation,
|
|
33139
33142
|
context: contextObject,
|
|
33140
|
-
idForm: methods?.getValues(
|
|
33143
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33141
33144
|
}),
|
|
33142
33145
|
/* @__PURE__ */ jsx112(
|
|
33143
33146
|
"div",
|
|
33144
33147
|
{
|
|
33145
|
-
id:
|
|
33146
|
-
"data-tooltip-id":
|
|
33148
|
+
id: name,
|
|
33149
|
+
"data-tooltip-id": name,
|
|
33147
33150
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33148
33151
|
children: /* @__PURE__ */ jsx112(
|
|
33149
33152
|
Controller,
|
|
33150
33153
|
{
|
|
33151
|
-
name:
|
|
33154
|
+
name: name ?? "",
|
|
33152
33155
|
control: methods?.control,
|
|
33153
33156
|
rules: {
|
|
33154
33157
|
required: required ? {
|
|
@@ -33169,7 +33172,7 @@ var Many2OneField = (props) => {
|
|
|
33169
33172
|
) ?? currentValue : currentValue ?? null;
|
|
33170
33173
|
useEffect28(() => {
|
|
33171
33174
|
if (error2 && selectedOption) {
|
|
33172
|
-
methods?.clearErrors(
|
|
33175
|
+
methods?.clearErrors(name);
|
|
33173
33176
|
}
|
|
33174
33177
|
}, [selectedOption]);
|
|
33175
33178
|
return /* @__PURE__ */ jsxs75(
|
|
@@ -33532,7 +33535,7 @@ var ICCheck = () => {
|
|
|
33532
33535
|
import { jsx as jsx115, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
33533
33536
|
var DateOptionField = (props) => {
|
|
33534
33537
|
const {
|
|
33535
|
-
name
|
|
33538
|
+
name,
|
|
33536
33539
|
readonly,
|
|
33537
33540
|
required,
|
|
33538
33541
|
invisible,
|
|
@@ -33543,7 +33546,7 @@ var DateOptionField = (props) => {
|
|
|
33543
33546
|
return /* @__PURE__ */ jsx115(
|
|
33544
33547
|
Controller,
|
|
33545
33548
|
{
|
|
33546
|
-
name:
|
|
33549
|
+
name: name ?? "",
|
|
33547
33550
|
control: methods?.control,
|
|
33548
33551
|
render: ({ field }) => /* @__PURE__ */ jsxs78(
|
|
33549
33552
|
"label",
|
|
@@ -33564,9 +33567,9 @@ var DateOptionField = (props) => {
|
|
|
33564
33567
|
onChange: (e3) => {
|
|
33565
33568
|
if (readonly) return;
|
|
33566
33569
|
const value = e3.target.checked;
|
|
33567
|
-
methods.setValue(
|
|
33570
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
33568
33571
|
field.onChange(value);
|
|
33569
|
-
onChange2?.(
|
|
33572
|
+
onChange2?.(name ?? "", value);
|
|
33570
33573
|
}
|
|
33571
33574
|
}
|
|
33572
33575
|
),
|