@fctc/sme-widget-ui 2.6.9 → 2.7.1
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 +502 -495
- package/dist/index.mjs +500 -493
- package/dist/widgets.js +502 -495
- package/dist/widgets.mjs +500 -493
- package/package.json +1 -1
package/dist/widgets.js
CHANGED
|
@@ -9,8 +9,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
9
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
10
|
};
|
|
11
11
|
var __export = (target, all) => {
|
|
12
|
-
for (var
|
|
13
|
-
__defProp(target,
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to2, from2, except, desc) => {
|
|
16
16
|
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
@@ -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 module2 !== "undefined" && module2 && module2.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");
|
|
@@ -6463,11 +6463,11 @@ var Formatter = class {
|
|
|
6463
6463
|
};
|
|
6464
6464
|
this.formatSeparator = options2.interpolation.formatSeparator || ",";
|
|
6465
6465
|
}
|
|
6466
|
-
add(
|
|
6467
|
-
this.formats[
|
|
6466
|
+
add(name, fc) {
|
|
6467
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
6468
6468
|
}
|
|
6469
|
-
addCached(
|
|
6470
|
-
this.formats[
|
|
6469
|
+
addCached(name, fc) {
|
|
6470
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
6471
6471
|
}
|
|
6472
6472
|
format(value, format2, lng) {
|
|
6473
6473
|
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -6503,9 +6503,9 @@ var Formatter = class {
|
|
|
6503
6503
|
return result;
|
|
6504
6504
|
}
|
|
6505
6505
|
};
|
|
6506
|
-
var removePending = (q3,
|
|
6507
|
-
if (q3.pending[
|
|
6508
|
-
delete q3.pending[
|
|
6506
|
+
var removePending = (q3, name) => {
|
|
6507
|
+
if (q3.pending[name] !== void 0) {
|
|
6508
|
+
delete q3.pending[name];
|
|
6509
6509
|
q3.pendingCount--;
|
|
6510
6510
|
}
|
|
6511
6511
|
};
|
|
@@ -6536,17 +6536,17 @@ var Connector = class extends EventEmitter {
|
|
|
6536
6536
|
languages.forEach((lng) => {
|
|
6537
6537
|
let hasAllNamespaces = true;
|
|
6538
6538
|
namespaces.forEach((ns) => {
|
|
6539
|
-
const
|
|
6539
|
+
const name = `${lng}|${ns}`;
|
|
6540
6540
|
if (!options2.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
6541
|
-
this.state[
|
|
6542
|
-
} else if (this.state[
|
|
6543
|
-
else if (this.state[
|
|
6544
|
-
if (pending[
|
|
6541
|
+
this.state[name] = 2;
|
|
6542
|
+
} else if (this.state[name] < 0) ;
|
|
6543
|
+
else if (this.state[name] === 1) {
|
|
6544
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
6545
6545
|
} else {
|
|
6546
|
-
this.state[
|
|
6546
|
+
this.state[name] = 1;
|
|
6547
6547
|
hasAllNamespaces = false;
|
|
6548
|
-
if (pending[
|
|
6549
|
-
if (toLoad[
|
|
6548
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
6549
|
+
if (toLoad[name] === void 0) toLoad[name] = true;
|
|
6550
6550
|
if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true;
|
|
6551
6551
|
}
|
|
6552
6552
|
});
|
|
@@ -6568,8 +6568,8 @@ var Connector = class extends EventEmitter {
|
|
|
6568
6568
|
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
6569
6569
|
};
|
|
6570
6570
|
}
|
|
6571
|
-
loaded(
|
|
6572
|
-
const s4 =
|
|
6571
|
+
loaded(name, err, data) {
|
|
6572
|
+
const s4 = name.split("|");
|
|
6573
6573
|
const lng = s4[0];
|
|
6574
6574
|
const ns = s4[1];
|
|
6575
6575
|
if (err) this.emit("failedLoading", lng, ns, err);
|
|
@@ -6578,12 +6578,12 @@ var Connector = class extends EventEmitter {
|
|
|
6578
6578
|
skipCopy: true
|
|
6579
6579
|
});
|
|
6580
6580
|
}
|
|
6581
|
-
this.state[
|
|
6582
|
-
if (err && data) this.state[
|
|
6581
|
+
this.state[name] = err ? -1 : 2;
|
|
6582
|
+
if (err && data) this.state[name] = 0;
|
|
6583
6583
|
const loaded = {};
|
|
6584
6584
|
this.queue.forEach((q3) => {
|
|
6585
6585
|
pushPath(q3.loaded, [lng], ns);
|
|
6586
|
-
removePending(q3,
|
|
6586
|
+
removePending(q3, name);
|
|
6587
6587
|
if (err) q3.errors.push(err);
|
|
6588
6588
|
if (q3.pendingCount === 0 && !q3.done) {
|
|
6589
6589
|
Object.keys(q3.loaded).forEach((l2) => {
|
|
@@ -6667,8 +6667,8 @@ var Connector = class extends EventEmitter {
|
|
|
6667
6667
|
if (!toLoad.pending.length) callback();
|
|
6668
6668
|
return null;
|
|
6669
6669
|
}
|
|
6670
|
-
toLoad.toLoad.forEach((
|
|
6671
|
-
this.loadOne(
|
|
6670
|
+
toLoad.toLoad.forEach((name) => {
|
|
6671
|
+
this.loadOne(name);
|
|
6672
6672
|
});
|
|
6673
6673
|
}
|
|
6674
6674
|
load(languages, namespaces, callback) {
|
|
@@ -6679,15 +6679,15 @@ var Connector = class extends EventEmitter {
|
|
|
6679
6679
|
reload: true
|
|
6680
6680
|
}, callback);
|
|
6681
6681
|
}
|
|
6682
|
-
loadOne(
|
|
6682
|
+
loadOne(name) {
|
|
6683
6683
|
let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
6684
|
-
const s4 =
|
|
6684
|
+
const s4 = name.split("|");
|
|
6685
6685
|
const lng = s4[0];
|
|
6686
6686
|
const ns = s4[1];
|
|
6687
6687
|
this.read(lng, ns, "read", void 0, void 0, (err, data) => {
|
|
6688
6688
|
if (err) this.logger.warn(`${prefix2}loading namespace ${ns} for language ${lng} failed`, err);
|
|
6689
6689
|
if (!err && data) this.logger.log(`${prefix2}loaded namespace ${ns} for language ${lng}`, data);
|
|
6690
|
-
this.loaded(
|
|
6690
|
+
this.loaded(name, err, data);
|
|
6691
6691
|
});
|
|
6692
6692
|
}
|
|
6693
6693
|
saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
@@ -7337,13 +7337,13 @@ function hasXSS(input) {
|
|
|
7337
7337
|
return xssPatterns.some((pattern) => pattern.test(input));
|
|
7338
7338
|
}
|
|
7339
7339
|
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
7340
|
-
var serializeCookie = function(
|
|
7340
|
+
var serializeCookie = function(name, val) {
|
|
7341
7341
|
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
7342
7342
|
path: "/"
|
|
7343
7343
|
};
|
|
7344
7344
|
const opt = options2;
|
|
7345
7345
|
const value = encodeURIComponent(val);
|
|
7346
|
-
let str = `${
|
|
7346
|
+
let str = `${name}=${value}`;
|
|
7347
7347
|
if (opt.maxAge > 0) {
|
|
7348
7348
|
const maxAge = opt.maxAge - 0;
|
|
7349
7349
|
if (Number.isNaN(maxAge)) throw new Error("maxAge should be a Number");
|
|
@@ -7392,7 +7392,7 @@ var serializeCookie = function(name2, val) {
|
|
|
7392
7392
|
return str;
|
|
7393
7393
|
};
|
|
7394
7394
|
var cookie = {
|
|
7395
|
-
create(
|
|
7395
|
+
create(name, value, minutes, domain) {
|
|
7396
7396
|
let cookieOptions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
7397
7397
|
path: "/",
|
|
7398
7398
|
sameSite: "strict"
|
|
@@ -7402,10 +7402,10 @@ var cookie = {
|
|
|
7402
7402
|
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1e3);
|
|
7403
7403
|
}
|
|
7404
7404
|
if (domain) cookieOptions.domain = domain;
|
|
7405
|
-
document.cookie = serializeCookie(
|
|
7405
|
+
document.cookie = serializeCookie(name, value, cookieOptions);
|
|
7406
7406
|
},
|
|
7407
|
-
read(
|
|
7408
|
-
const nameEQ = `${
|
|
7407
|
+
read(name) {
|
|
7408
|
+
const nameEQ = `${name}=`;
|
|
7409
7409
|
const ca = document.cookie.split(";");
|
|
7410
7410
|
for (let i3 = 0; i3 < ca.length; i3++) {
|
|
7411
7411
|
let c2 = ca[i3];
|
|
@@ -7414,8 +7414,8 @@ var cookie = {
|
|
|
7414
7414
|
}
|
|
7415
7415
|
return null;
|
|
7416
7416
|
},
|
|
7417
|
-
remove(
|
|
7418
|
-
this.create(
|
|
7417
|
+
remove(name, domain) {
|
|
7418
|
+
this.create(name, "", -1, domain);
|
|
7419
7419
|
}
|
|
7420
7420
|
};
|
|
7421
7421
|
var cookie$1 = {
|
|
@@ -9981,6 +9981,10 @@ var Row = (props) => {
|
|
|
9981
9981
|
isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9982
9982
|
"td",
|
|
9983
9983
|
{
|
|
9984
|
+
style: {
|
|
9985
|
+
width: "40px",
|
|
9986
|
+
maxWidth: "40px"
|
|
9987
|
+
},
|
|
9984
9988
|
className: `td-checkbox column w-max whitespace-nowrap p-3 border-b border-gray-200 text-sm font-normal text-gray-900`,
|
|
9985
9989
|
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9986
9990
|
"input",
|
|
@@ -10472,7 +10476,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10472
10476
|
let resetCount = 0;
|
|
10473
10477
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
10474
10478
|
const {
|
|
10475
|
-
name
|
|
10479
|
+
name,
|
|
10476
10480
|
fn
|
|
10477
10481
|
} = validMiddleware[i3];
|
|
10478
10482
|
const {
|
|
@@ -10498,8 +10502,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10498
10502
|
y3 = nextY != null ? nextY : y3;
|
|
10499
10503
|
middlewareData = {
|
|
10500
10504
|
...middlewareData,
|
|
10501
|
-
[
|
|
10502
|
-
...middlewareData[
|
|
10505
|
+
[name]: {
|
|
10506
|
+
...middlewareData[name],
|
|
10503
10507
|
...data
|
|
10504
10508
|
}
|
|
10505
10509
|
};
|
|
@@ -12089,7 +12093,8 @@ var TableHead = (props) => {
|
|
|
12089
12093
|
{
|
|
12090
12094
|
style: {
|
|
12091
12095
|
width: "40px",
|
|
12092
|
-
maxWidth: "40px"
|
|
12096
|
+
maxWidth: "40px",
|
|
12097
|
+
overflow: "unset !important"
|
|
12093
12098
|
},
|
|
12094
12099
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
12095
12100
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -12564,8 +12569,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
12564
12569
|
var isObjectType = (value) => typeof value === "object";
|
|
12565
12570
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
12566
12571
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
12567
|
-
var getNodeParentName = (
|
|
12568
|
-
var isNameInFieldArray = (names,
|
|
12572
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
12573
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
12569
12574
|
var isPlainObject = (tempObject) => {
|
|
12570
12575
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
12571
12576
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -12669,7 +12674,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
12669
12674
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react15.default.useLayoutEffect : import_react15.default.useEffect;
|
|
12670
12675
|
function useFormState(props) {
|
|
12671
12676
|
const methods = useFormContext();
|
|
12672
|
-
const { control = methods.control, disabled, name
|
|
12677
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
12673
12678
|
const [formState, updateFormState] = import_react15.default.useState(control._formState);
|
|
12674
12679
|
const _localProxyFormState = import_react15.default.useRef({
|
|
12675
12680
|
isDirty: false,
|
|
@@ -12682,7 +12687,7 @@ function useFormState(props) {
|
|
|
12682
12687
|
errors: false
|
|
12683
12688
|
});
|
|
12684
12689
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12685
|
-
name
|
|
12690
|
+
name,
|
|
12686
12691
|
formState: _localProxyFormState.current,
|
|
12687
12692
|
exact,
|
|
12688
12693
|
callback: (formState2) => {
|
|
@@ -12691,7 +12696,7 @@ function useFormState(props) {
|
|
|
12691
12696
|
...formState2
|
|
12692
12697
|
});
|
|
12693
12698
|
}
|
|
12694
|
-
}), [
|
|
12699
|
+
}), [name, disabled, exact]);
|
|
12695
12700
|
import_react15.default.useEffect(() => {
|
|
12696
12701
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
12697
12702
|
}, [control]);
|
|
@@ -12743,22 +12748,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
12743
12748
|
}
|
|
12744
12749
|
function useWatch(props) {
|
|
12745
12750
|
const methods = useFormContext();
|
|
12746
|
-
const { control = methods.control, name
|
|
12751
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
12747
12752
|
const _defaultValue = import_react15.default.useRef(defaultValue);
|
|
12748
12753
|
const _compute = import_react15.default.useRef(compute);
|
|
12749
12754
|
const _computeFormValues = import_react15.default.useRef(void 0);
|
|
12750
12755
|
_compute.current = compute;
|
|
12751
|
-
const defaultValueMemo = import_react15.default.useMemo(() => control._getWatch(
|
|
12756
|
+
const defaultValueMemo = import_react15.default.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
12752
12757
|
const [value, updateValue] = import_react15.default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
12753
12758
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12754
|
-
name
|
|
12759
|
+
name,
|
|
12755
12760
|
formState: {
|
|
12756
12761
|
values: true
|
|
12757
12762
|
},
|
|
12758
12763
|
exact,
|
|
12759
12764
|
callback: (formState) => {
|
|
12760
12765
|
if (!disabled) {
|
|
12761
|
-
const formValues = generateWatchOutput(
|
|
12766
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
12762
12767
|
if (_compute.current) {
|
|
12763
12768
|
const computedFormValues = _compute.current(formValues);
|
|
12764
12769
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -12770,28 +12775,28 @@ function useWatch(props) {
|
|
|
12770
12775
|
}
|
|
12771
12776
|
}
|
|
12772
12777
|
}
|
|
12773
|
-
}), [control, disabled,
|
|
12778
|
+
}), [control, disabled, name, exact]);
|
|
12774
12779
|
import_react15.default.useEffect(() => control._removeUnmounted());
|
|
12775
12780
|
return value;
|
|
12776
12781
|
}
|
|
12777
12782
|
function useController(props) {
|
|
12778
12783
|
const methods = useFormContext();
|
|
12779
|
-
const { name
|
|
12780
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
12781
|
-
const defaultValueMemo = import_react15.default.useMemo(() => get2(control._formValues,
|
|
12784
|
+
const { name, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
12785
|
+
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
12786
|
+
const defaultValueMemo = import_react15.default.useMemo(() => get2(control._formValues, name, get2(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
12782
12787
|
const value = useWatch({
|
|
12783
12788
|
control,
|
|
12784
|
-
name
|
|
12789
|
+
name,
|
|
12785
12790
|
defaultValue: defaultValueMemo,
|
|
12786
12791
|
exact: true
|
|
12787
12792
|
});
|
|
12788
12793
|
const formState = useFormState({
|
|
12789
12794
|
control,
|
|
12790
|
-
name
|
|
12795
|
+
name,
|
|
12791
12796
|
exact: true
|
|
12792
12797
|
});
|
|
12793
12798
|
const _props = import_react15.default.useRef(props);
|
|
12794
|
-
const _registerProps = import_react15.default.useRef(control.register(
|
|
12799
|
+
const _registerProps = import_react15.default.useRef(control.register(name, {
|
|
12795
12800
|
...props.rules,
|
|
12796
12801
|
value,
|
|
12797
12802
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -12800,41 +12805,41 @@ function useController(props) {
|
|
|
12800
12805
|
const fieldState = import_react15.default.useMemo(() => Object.defineProperties({}, {
|
|
12801
12806
|
invalid: {
|
|
12802
12807
|
enumerable: true,
|
|
12803
|
-
get: () => !!get2(formState.errors,
|
|
12808
|
+
get: () => !!get2(formState.errors, name)
|
|
12804
12809
|
},
|
|
12805
12810
|
isDirty: {
|
|
12806
12811
|
enumerable: true,
|
|
12807
|
-
get: () => !!get2(formState.dirtyFields,
|
|
12812
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
12808
12813
|
},
|
|
12809
12814
|
isTouched: {
|
|
12810
12815
|
enumerable: true,
|
|
12811
|
-
get: () => !!get2(formState.touchedFields,
|
|
12816
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
12812
12817
|
},
|
|
12813
12818
|
isValidating: {
|
|
12814
12819
|
enumerable: true,
|
|
12815
|
-
get: () => !!get2(formState.validatingFields,
|
|
12820
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
12816
12821
|
},
|
|
12817
12822
|
error: {
|
|
12818
12823
|
enumerable: true,
|
|
12819
|
-
get: () => get2(formState.errors,
|
|
12824
|
+
get: () => get2(formState.errors, name)
|
|
12820
12825
|
}
|
|
12821
|
-
}), [formState,
|
|
12826
|
+
}), [formState, name]);
|
|
12822
12827
|
const onChange2 = import_react15.default.useCallback((event) => _registerProps.current.onChange({
|
|
12823
12828
|
target: {
|
|
12824
12829
|
value: getEventValue(event),
|
|
12825
|
-
name
|
|
12830
|
+
name
|
|
12826
12831
|
},
|
|
12827
12832
|
type: EVENTS.CHANGE
|
|
12828
|
-
}), [
|
|
12833
|
+
}), [name]);
|
|
12829
12834
|
const onBlur = import_react15.default.useCallback(() => _registerProps.current.onBlur({
|
|
12830
12835
|
target: {
|
|
12831
|
-
value: get2(control._formValues,
|
|
12832
|
-
name
|
|
12836
|
+
value: get2(control._formValues, name),
|
|
12837
|
+
name
|
|
12833
12838
|
},
|
|
12834
12839
|
type: EVENTS.BLUR
|
|
12835
|
-
}), [
|
|
12840
|
+
}), [name, control._formValues]);
|
|
12836
12841
|
const ref = import_react15.default.useCallback((elm) => {
|
|
12837
|
-
const field2 = get2(control._fields,
|
|
12842
|
+
const field2 = get2(control._fields, name);
|
|
12838
12843
|
if (field2 && elm) {
|
|
12839
12844
|
field2._f.ref = {
|
|
12840
12845
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -12843,46 +12848,46 @@ function useController(props) {
|
|
|
12843
12848
|
reportValidity: () => elm.reportValidity()
|
|
12844
12849
|
};
|
|
12845
12850
|
}
|
|
12846
|
-
}, [control._fields,
|
|
12851
|
+
}, [control._fields, name]);
|
|
12847
12852
|
const field = import_react15.default.useMemo(() => ({
|
|
12848
|
-
name
|
|
12853
|
+
name,
|
|
12849
12854
|
value,
|
|
12850
12855
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
12851
12856
|
onChange: onChange2,
|
|
12852
12857
|
onBlur,
|
|
12853
12858
|
ref
|
|
12854
|
-
}), [
|
|
12859
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
12855
12860
|
import_react15.default.useEffect(() => {
|
|
12856
12861
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
12857
|
-
control.register(
|
|
12862
|
+
control.register(name, {
|
|
12858
12863
|
..._props.current.rules,
|
|
12859
12864
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
12860
12865
|
});
|
|
12861
|
-
const updateMounted = (
|
|
12862
|
-
const field2 = get2(control._fields,
|
|
12866
|
+
const updateMounted = (name2, value2) => {
|
|
12867
|
+
const field2 = get2(control._fields, name2);
|
|
12863
12868
|
if (field2 && field2._f) {
|
|
12864
12869
|
field2._f.mount = value2;
|
|
12865
12870
|
}
|
|
12866
12871
|
};
|
|
12867
|
-
updateMounted(
|
|
12872
|
+
updateMounted(name, true);
|
|
12868
12873
|
if (_shouldUnregisterField) {
|
|
12869
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
12870
|
-
set(control._defaultValues,
|
|
12871
|
-
if (isUndefined(get2(control._formValues,
|
|
12872
|
-
set(control._formValues,
|
|
12874
|
+
const value2 = cloneObject(get2(control._options.defaultValues, name));
|
|
12875
|
+
set(control._defaultValues, name, value2);
|
|
12876
|
+
if (isUndefined(get2(control._formValues, name))) {
|
|
12877
|
+
set(control._formValues, name, value2);
|
|
12873
12878
|
}
|
|
12874
12879
|
}
|
|
12875
|
-
!isArrayField && control.register(
|
|
12880
|
+
!isArrayField && control.register(name);
|
|
12876
12881
|
return () => {
|
|
12877
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
12882
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
12878
12883
|
};
|
|
12879
|
-
}, [
|
|
12884
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
12880
12885
|
import_react15.default.useEffect(() => {
|
|
12881
12886
|
control._setDisabledField({
|
|
12882
12887
|
disabled,
|
|
12883
|
-
name
|
|
12888
|
+
name
|
|
12884
12889
|
});
|
|
12885
|
-
}, [disabled,
|
|
12890
|
+
}, [disabled, name, control]);
|
|
12886
12891
|
return import_react15.default.useMemo(() => ({
|
|
12887
12892
|
field,
|
|
12888
12893
|
formState,
|
|
@@ -12890,10 +12895,10 @@ function useController(props) {
|
|
|
12890
12895
|
}), [field, formState, fieldState]);
|
|
12891
12896
|
}
|
|
12892
12897
|
var Controller = (props) => props.render(useController(props));
|
|
12893
|
-
var appendErrors = (
|
|
12894
|
-
...errors[
|
|
12898
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
12899
|
+
...errors[name],
|
|
12895
12900
|
types: {
|
|
12896
|
-
...errors[
|
|
12901
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
12897
12902
|
[type]: message2 || true
|
|
12898
12903
|
}
|
|
12899
12904
|
} : {};
|
|
@@ -13053,9 +13058,9 @@ function getFieldValue(_f) {
|
|
|
13053
13058
|
}
|
|
13054
13059
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
13055
13060
|
const fields = {};
|
|
13056
|
-
for (const
|
|
13057
|
-
const field = get2(_fields,
|
|
13058
|
-
field && set(fields,
|
|
13061
|
+
for (const name of fieldsNames) {
|
|
13062
|
+
const field = get2(_fields, name);
|
|
13063
|
+
field && set(fields, name, field._f);
|
|
13059
13064
|
}
|
|
13060
13065
|
return {
|
|
13061
13066
|
criteriaMode,
|
|
@@ -13076,7 +13081,7 @@ var getValidationModes = (mode) => ({
|
|
|
13076
13081
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
13077
13082
|
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));
|
|
13078
13083
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
13079
|
-
var isWatched = (
|
|
13084
|
+
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))));
|
|
13080
13085
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
13081
13086
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
13082
13087
|
const field = get2(fields, key);
|
|
@@ -13101,21 +13106,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
13101
13106
|
}
|
|
13102
13107
|
return;
|
|
13103
13108
|
};
|
|
13104
|
-
function schemaErrorLookup(errors, _fields,
|
|
13105
|
-
const error2 = get2(errors,
|
|
13106
|
-
if (error2 || isKey(
|
|
13109
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
13110
|
+
const error2 = get2(errors, name);
|
|
13111
|
+
if (error2 || isKey(name)) {
|
|
13107
13112
|
return {
|
|
13108
13113
|
error: error2,
|
|
13109
|
-
name
|
|
13114
|
+
name
|
|
13110
13115
|
};
|
|
13111
13116
|
}
|
|
13112
|
-
const names =
|
|
13117
|
+
const names = name.split(".");
|
|
13113
13118
|
while (names.length) {
|
|
13114
13119
|
const fieldName = names.join(".");
|
|
13115
13120
|
const field = get2(_fields, fieldName);
|
|
13116
13121
|
const foundError = get2(errors, fieldName);
|
|
13117
|
-
if (field && !Array.isArray(field) &&
|
|
13118
|
-
return { name
|
|
13122
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
13123
|
+
return { name };
|
|
13119
13124
|
}
|
|
13120
13125
|
if (foundError && foundError.type) {
|
|
13121
13126
|
return {
|
|
@@ -13132,15 +13137,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
13132
13137
|
names.pop();
|
|
13133
13138
|
}
|
|
13134
13139
|
return {
|
|
13135
|
-
name
|
|
13140
|
+
name
|
|
13136
13141
|
};
|
|
13137
13142
|
}
|
|
13138
13143
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
13139
13144
|
updateFormState(formStateData);
|
|
13140
|
-
const { name
|
|
13145
|
+
const { name, ...formState } = formStateData;
|
|
13141
13146
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
13142
13147
|
};
|
|
13143
|
-
var shouldSubscribeByName = (
|
|
13148
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
13144
13149
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
13145
13150
|
if (mode.isOnAll) {
|
|
13146
13151
|
return false;
|
|
@@ -13153,11 +13158,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
13153
13158
|
}
|
|
13154
13159
|
return true;
|
|
13155
13160
|
};
|
|
13156
|
-
var unsetEmptyArray = (ref,
|
|
13157
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
13158
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
13159
|
-
set(fieldArrayErrors, "root", error2[
|
|
13160
|
-
set(errors,
|
|
13161
|
+
var unsetEmptyArray = (ref, name) => !compact(get2(ref, name)).length && unset(ref, name);
|
|
13162
|
+
var updateFieldArrayRootError = (errors, error2, name) => {
|
|
13163
|
+
const fieldArrayErrors = convertToArrayPayload(get2(errors, name));
|
|
13164
|
+
set(fieldArrayErrors, "root", error2[name]);
|
|
13165
|
+
set(errors, name, fieldArrayErrors);
|
|
13161
13166
|
return errors;
|
|
13162
13167
|
};
|
|
13163
13168
|
var isMessage = (value) => isString3(value);
|
|
@@ -13175,9 +13180,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
13175
13180
|
message: ""
|
|
13176
13181
|
};
|
|
13177
13182
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
13178
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
13179
|
-
const inputValue = get2(formValues,
|
|
13180
|
-
if (!mount || disabledFieldNames.has(
|
|
13183
|
+
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name, valueAsNumber, mount } = field._f;
|
|
13184
|
+
const inputValue = get2(formValues, name);
|
|
13185
|
+
if (!mount || disabledFieldNames.has(name)) {
|
|
13181
13186
|
return {};
|
|
13182
13187
|
}
|
|
13183
13188
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -13192,10 +13197,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13192
13197
|
const isCheckBox = isCheckBoxInput(ref);
|
|
13193
13198
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
13194
13199
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
13195
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
13200
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
13196
13201
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
13197
13202
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
13198
|
-
error2[
|
|
13203
|
+
error2[name] = {
|
|
13199
13204
|
type: exceedMax ? maxType : minType,
|
|
13200
13205
|
message: message2,
|
|
13201
13206
|
ref,
|
|
@@ -13205,7 +13210,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13205
13210
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
13206
13211
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
13207
13212
|
if (value) {
|
|
13208
|
-
error2[
|
|
13213
|
+
error2[name] = {
|
|
13209
13214
|
type: INPUT_VALIDATION_RULES.required,
|
|
13210
13215
|
message: message2,
|
|
13211
13216
|
ref: inputRef,
|
|
@@ -13245,7 +13250,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13245
13250
|
if (exceedMax || exceedMin) {
|
|
13246
13251
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
13247
13252
|
if (!validateAllFieldCriteria) {
|
|
13248
|
-
setCustomValidity(error2[
|
|
13253
|
+
setCustomValidity(error2[name].message);
|
|
13249
13254
|
return error2;
|
|
13250
13255
|
}
|
|
13251
13256
|
}
|
|
@@ -13258,7 +13263,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13258
13263
|
if (exceedMax || exceedMin) {
|
|
13259
13264
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
13260
13265
|
if (!validateAllFieldCriteria) {
|
|
13261
|
-
setCustomValidity(error2[
|
|
13266
|
+
setCustomValidity(error2[name].message);
|
|
13262
13267
|
return error2;
|
|
13263
13268
|
}
|
|
13264
13269
|
}
|
|
@@ -13266,7 +13271,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13266
13271
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
13267
13272
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
13268
13273
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
13269
|
-
error2[
|
|
13274
|
+
error2[name] = {
|
|
13270
13275
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
13271
13276
|
message: message2,
|
|
13272
13277
|
ref,
|
|
@@ -13283,7 +13288,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13283
13288
|
const result = await validate(inputValue, formValues);
|
|
13284
13289
|
const validateError = getValidateError(result, inputRef);
|
|
13285
13290
|
if (validateError) {
|
|
13286
|
-
error2[
|
|
13291
|
+
error2[name] = {
|
|
13287
13292
|
...validateError,
|
|
13288
13293
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
13289
13294
|
};
|
|
@@ -13306,12 +13311,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13306
13311
|
};
|
|
13307
13312
|
setCustomValidity(validateError.message);
|
|
13308
13313
|
if (validateAllFieldCriteria) {
|
|
13309
|
-
error2[
|
|
13314
|
+
error2[name] = validationResult;
|
|
13310
13315
|
}
|
|
13311
13316
|
}
|
|
13312
13317
|
}
|
|
13313
13318
|
if (!isEmptyObject(validationResult)) {
|
|
13314
|
-
error2[
|
|
13319
|
+
error2[name] = {
|
|
13315
13320
|
ref: inputRef,
|
|
13316
13321
|
...validationResult
|
|
13317
13322
|
};
|
|
@@ -13400,9 +13405,9 @@ function createFormControl(props = {}) {
|
|
|
13400
13405
|
};
|
|
13401
13406
|
const _updateIsValidating = (names, isValidating) => {
|
|
13402
13407
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
13403
|
-
(names || Array.from(_names.mount)).forEach((
|
|
13404
|
-
if (
|
|
13405
|
-
isValidating ? set(_formState.validatingFields,
|
|
13408
|
+
(names || Array.from(_names.mount)).forEach((name) => {
|
|
13409
|
+
if (name) {
|
|
13410
|
+
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
13406
13411
|
}
|
|
13407
13412
|
});
|
|
13408
13413
|
_subjects.state.next({
|
|
@@ -13411,38 +13416,38 @@ function createFormControl(props = {}) {
|
|
|
13411
13416
|
});
|
|
13412
13417
|
}
|
|
13413
13418
|
};
|
|
13414
|
-
const _setFieldArray = (
|
|
13419
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
13415
13420
|
if (args && method && !_options.disabled) {
|
|
13416
13421
|
_state.action = true;
|
|
13417
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
13418
|
-
const fieldValues = method(get2(_fields,
|
|
13419
|
-
shouldSetValues && set(_fields,
|
|
13422
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields, name))) {
|
|
13423
|
+
const fieldValues = method(get2(_fields, name), args.argA, args.argB);
|
|
13424
|
+
shouldSetValues && set(_fields, name, fieldValues);
|
|
13420
13425
|
}
|
|
13421
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
13422
|
-
const errors = method(get2(_formState.errors,
|
|
13423
|
-
shouldSetValues && set(_formState.errors,
|
|
13424
|
-
unsetEmptyArray(_formState.errors,
|
|
13426
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors, name))) {
|
|
13427
|
+
const errors = method(get2(_formState.errors, name), args.argA, args.argB);
|
|
13428
|
+
shouldSetValues && set(_formState.errors, name, errors);
|
|
13429
|
+
unsetEmptyArray(_formState.errors, name);
|
|
13425
13430
|
}
|
|
13426
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
13427
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
13428
|
-
shouldSetValues && set(_formState.touchedFields,
|
|
13431
|
+
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields, name))) {
|
|
13432
|
+
const touchedFields = method(get2(_formState.touchedFields, name), args.argA, args.argB);
|
|
13433
|
+
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
13429
13434
|
}
|
|
13430
13435
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
13431
13436
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
13432
13437
|
}
|
|
13433
13438
|
_subjects.state.next({
|
|
13434
|
-
name
|
|
13435
|
-
isDirty: _getDirty(
|
|
13439
|
+
name,
|
|
13440
|
+
isDirty: _getDirty(name, values),
|
|
13436
13441
|
dirtyFields: _formState.dirtyFields,
|
|
13437
13442
|
errors: _formState.errors,
|
|
13438
13443
|
isValid: _formState.isValid
|
|
13439
13444
|
});
|
|
13440
13445
|
} else {
|
|
13441
|
-
set(_formValues,
|
|
13446
|
+
set(_formValues, name, values);
|
|
13442
13447
|
}
|
|
13443
13448
|
};
|
|
13444
|
-
const updateErrors = (
|
|
13445
|
-
set(_formState.errors,
|
|
13449
|
+
const updateErrors = (name, error2) => {
|
|
13450
|
+
set(_formState.errors, name, error2);
|
|
13446
13451
|
_subjects.state.next({
|
|
13447
13452
|
errors: _formState.errors
|
|
13448
13453
|
});
|
|
@@ -13454,19 +13459,19 @@ function createFormControl(props = {}) {
|
|
|
13454
13459
|
isValid: false
|
|
13455
13460
|
});
|
|
13456
13461
|
};
|
|
13457
|
-
const updateValidAndValue = (
|
|
13458
|
-
const field = get2(_fields,
|
|
13462
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
13463
|
+
const field = get2(_fields, name);
|
|
13459
13464
|
if (field) {
|
|
13460
|
-
const defaultValue = get2(_formValues,
|
|
13461
|
-
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues,
|
|
13465
|
+
const defaultValue = get2(_formValues, name, isUndefined(value) ? get2(_defaultValues, name) : value);
|
|
13466
|
+
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
13462
13467
|
_state.mount && _setValid();
|
|
13463
13468
|
}
|
|
13464
13469
|
};
|
|
13465
|
-
const updateTouchAndDirty = (
|
|
13470
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
13466
13471
|
let shouldUpdateField = false;
|
|
13467
13472
|
let isPreviousDirty = false;
|
|
13468
13473
|
const output = {
|
|
13469
|
-
name
|
|
13474
|
+
name
|
|
13470
13475
|
};
|
|
13471
13476
|
if (!_options.disabled) {
|
|
13472
13477
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -13475,16 +13480,16 @@ function createFormControl(props = {}) {
|
|
|
13475
13480
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
13476
13481
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
13477
13482
|
}
|
|
13478
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
13479
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
13480
|
-
isCurrentFieldPristine ? unset(_formState.dirtyFields,
|
|
13483
|
+
const isCurrentFieldPristine = deepEqual(get2(_defaultValues, name), fieldValue);
|
|
13484
|
+
isPreviousDirty = !!get2(_formState.dirtyFields, name);
|
|
13485
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
13481
13486
|
output.dirtyFields = _formState.dirtyFields;
|
|
13482
13487
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
13483
13488
|
}
|
|
13484
13489
|
if (isBlurEvent) {
|
|
13485
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
13490
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
13486
13491
|
if (!isPreviousFieldTouched) {
|
|
13487
|
-
set(_formState.touchedFields,
|
|
13492
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
13488
13493
|
output.touchedFields = _formState.touchedFields;
|
|
13489
13494
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
13490
13495
|
}
|
|
@@ -13493,23 +13498,23 @@ function createFormControl(props = {}) {
|
|
|
13493
13498
|
}
|
|
13494
13499
|
return shouldUpdateField ? output : {};
|
|
13495
13500
|
};
|
|
13496
|
-
const shouldRenderByError = (
|
|
13497
|
-
const previousFieldError = get2(_formState.errors,
|
|
13501
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
13502
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
13498
13503
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
13499
13504
|
if (_options.delayError && error2) {
|
|
13500
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
13505
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
13501
13506
|
delayErrorCallback(_options.delayError);
|
|
13502
13507
|
} else {
|
|
13503
13508
|
clearTimeout(timer);
|
|
13504
13509
|
delayErrorCallback = null;
|
|
13505
|
-
error2 ? set(_formState.errors,
|
|
13510
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
13506
13511
|
}
|
|
13507
13512
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
13508
13513
|
const updatedFormState = {
|
|
13509
13514
|
...fieldState,
|
|
13510
13515
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
13511
13516
|
errors: _formState.errors,
|
|
13512
|
-
name
|
|
13517
|
+
name
|
|
13513
13518
|
};
|
|
13514
13519
|
_formState = {
|
|
13515
13520
|
..._formState,
|
|
@@ -13518,18 +13523,18 @@ function createFormControl(props = {}) {
|
|
|
13518
13523
|
_subjects.state.next(updatedFormState);
|
|
13519
13524
|
}
|
|
13520
13525
|
};
|
|
13521
|
-
const _runSchema = async (
|
|
13522
|
-
_updateIsValidating(
|
|
13523
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
13524
|
-
_updateIsValidating(
|
|
13526
|
+
const _runSchema = async (name) => {
|
|
13527
|
+
_updateIsValidating(name, true);
|
|
13528
|
+
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
13529
|
+
_updateIsValidating(name);
|
|
13525
13530
|
return result;
|
|
13526
13531
|
};
|
|
13527
13532
|
const executeSchemaAndUpdateState = async (names) => {
|
|
13528
13533
|
const { errors } = await _runSchema(names);
|
|
13529
13534
|
if (names) {
|
|
13530
|
-
for (const
|
|
13531
|
-
const error2 = get2(errors,
|
|
13532
|
-
error2 ? set(_formState.errors,
|
|
13535
|
+
for (const name of names) {
|
|
13536
|
+
const error2 = get2(errors, name);
|
|
13537
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
13533
13538
|
}
|
|
13534
13539
|
} else {
|
|
13535
13540
|
_formState.errors = errors;
|
|
@@ -13539,19 +13544,19 @@ function createFormControl(props = {}) {
|
|
|
13539
13544
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
13540
13545
|
valid: true
|
|
13541
13546
|
}) => {
|
|
13542
|
-
for (const
|
|
13543
|
-
const field = fields[
|
|
13547
|
+
for (const name in fields) {
|
|
13548
|
+
const field = fields[name];
|
|
13544
13549
|
if (field) {
|
|
13545
13550
|
const { _f, ...fieldValue } = field;
|
|
13546
13551
|
if (_f) {
|
|
13547
13552
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
13548
13553
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
13549
13554
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13550
|
-
_updateIsValidating([
|
|
13555
|
+
_updateIsValidating([name], true);
|
|
13551
13556
|
}
|
|
13552
13557
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
13553
13558
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13554
|
-
_updateIsValidating([
|
|
13559
|
+
_updateIsValidating([name]);
|
|
13555
13560
|
}
|
|
13556
13561
|
if (fieldError[_f.name]) {
|
|
13557
13562
|
context.valid = false;
|
|
@@ -13567,24 +13572,24 @@ function createFormControl(props = {}) {
|
|
|
13567
13572
|
return context.valid;
|
|
13568
13573
|
};
|
|
13569
13574
|
const _removeUnmounted = () => {
|
|
13570
|
-
for (const
|
|
13571
|
-
const field = get2(_fields,
|
|
13572
|
-
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(
|
|
13575
|
+
for (const name of _names.unMount) {
|
|
13576
|
+
const field = get2(_fields, name);
|
|
13577
|
+
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name);
|
|
13573
13578
|
}
|
|
13574
13579
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
13575
13580
|
};
|
|
13576
|
-
const _getDirty = (
|
|
13581
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
13577
13582
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
13578
13583
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
13579
13584
|
}, isGlobal, defaultValue);
|
|
13580
|
-
const _getFieldArray = (
|
|
13581
|
-
const setFieldValue = (
|
|
13582
|
-
const field = get2(_fields,
|
|
13585
|
+
const _getFieldArray = (name) => compact(get2(_state.mount ? _formValues : _defaultValues, name, _options.shouldUnregister ? get2(_defaultValues, name, []) : []));
|
|
13586
|
+
const setFieldValue = (name, value, options2 = {}) => {
|
|
13587
|
+
const field = get2(_fields, name);
|
|
13583
13588
|
let fieldValue = value;
|
|
13584
13589
|
if (field) {
|
|
13585
13590
|
const fieldReference = field._f;
|
|
13586
13591
|
if (fieldReference) {
|
|
13587
|
-
!fieldReference.disabled && set(_formValues,
|
|
13592
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
13588
13593
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
13589
13594
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
13590
13595
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -13608,61 +13613,61 @@ function createFormControl(props = {}) {
|
|
|
13608
13613
|
fieldReference.ref.value = fieldValue;
|
|
13609
13614
|
if (!fieldReference.ref.type) {
|
|
13610
13615
|
_subjects.state.next({
|
|
13611
|
-
name
|
|
13616
|
+
name,
|
|
13612
13617
|
values: cloneObject(_formValues)
|
|
13613
13618
|
});
|
|
13614
13619
|
}
|
|
13615
13620
|
}
|
|
13616
13621
|
}
|
|
13617
13622
|
}
|
|
13618
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
13619
|
-
options2.shouldValidate && trigger(
|
|
13623
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
13624
|
+
options2.shouldValidate && trigger(name);
|
|
13620
13625
|
};
|
|
13621
|
-
const setValues = (
|
|
13626
|
+
const setValues = (name, value, options2) => {
|
|
13622
13627
|
for (const fieldKey in value) {
|
|
13623
13628
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
13624
13629
|
return;
|
|
13625
13630
|
}
|
|
13626
13631
|
const fieldValue = value[fieldKey];
|
|
13627
|
-
const fieldName =
|
|
13632
|
+
const fieldName = name + "." + fieldKey;
|
|
13628
13633
|
const field = get2(_fields, fieldName);
|
|
13629
|
-
(_names.array.has(
|
|
13634
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
13630
13635
|
}
|
|
13631
13636
|
};
|
|
13632
|
-
const setValue = (
|
|
13633
|
-
const field = get2(_fields,
|
|
13634
|
-
const isFieldArray = _names.array.has(
|
|
13637
|
+
const setValue = (name, value, options2 = {}) => {
|
|
13638
|
+
const field = get2(_fields, name);
|
|
13639
|
+
const isFieldArray = _names.array.has(name);
|
|
13635
13640
|
const cloneValue = cloneObject(value);
|
|
13636
|
-
set(_formValues,
|
|
13641
|
+
set(_formValues, name, cloneValue);
|
|
13637
13642
|
if (isFieldArray) {
|
|
13638
13643
|
_subjects.array.next({
|
|
13639
|
-
name
|
|
13644
|
+
name,
|
|
13640
13645
|
values: cloneObject(_formValues)
|
|
13641
13646
|
});
|
|
13642
13647
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
13643
13648
|
_subjects.state.next({
|
|
13644
|
-
name
|
|
13649
|
+
name,
|
|
13645
13650
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
13646
|
-
isDirty: _getDirty(
|
|
13651
|
+
isDirty: _getDirty(name, cloneValue)
|
|
13647
13652
|
});
|
|
13648
13653
|
}
|
|
13649
13654
|
} else {
|
|
13650
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
13655
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
13651
13656
|
}
|
|
13652
|
-
isWatched(
|
|
13657
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
13653
13658
|
_subjects.state.next({
|
|
13654
|
-
name: _state.mount ?
|
|
13659
|
+
name: _state.mount ? name : void 0,
|
|
13655
13660
|
values: cloneObject(_formValues)
|
|
13656
13661
|
});
|
|
13657
13662
|
};
|
|
13658
13663
|
const onChange2 = async (event) => {
|
|
13659
13664
|
_state.mount = true;
|
|
13660
13665
|
const target = event.target;
|
|
13661
|
-
let
|
|
13666
|
+
let name = target.name;
|
|
13662
13667
|
let isFieldValueUpdated = true;
|
|
13663
|
-
const field = get2(_fields,
|
|
13668
|
+
const field = get2(_fields, name);
|
|
13664
13669
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
13665
|
-
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues,
|
|
13670
|
+
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues, name, fieldValue));
|
|
13666
13671
|
};
|
|
13667
13672
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
13668
13673
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -13671,9 +13676,9 @@ function createFormControl(props = {}) {
|
|
|
13671
13676
|
let isValid3;
|
|
13672
13677
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
13673
13678
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
13674
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
13675
|
-
const watched = isWatched(
|
|
13676
|
-
set(_formValues,
|
|
13679
|
+
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get2(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
13680
|
+
const watched = isWatched(name, _names, isBlurEvent);
|
|
13681
|
+
set(_formValues, name, fieldValue);
|
|
13677
13682
|
if (isBlurEvent) {
|
|
13678
13683
|
if (!target || !target.readOnly) {
|
|
13679
13684
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -13682,10 +13687,10 @@ function createFormControl(props = {}) {
|
|
|
13682
13687
|
} else if (field._f.onChange) {
|
|
13683
13688
|
field._f.onChange(event);
|
|
13684
13689
|
}
|
|
13685
|
-
const fieldState = updateTouchAndDirty(
|
|
13690
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
13686
13691
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
13687
13692
|
!isBlurEvent && _subjects.state.next({
|
|
13688
|
-
name
|
|
13693
|
+
name,
|
|
13689
13694
|
type: event.type,
|
|
13690
13695
|
values: cloneObject(_formValues)
|
|
13691
13696
|
});
|
|
@@ -13699,23 +13704,23 @@ function createFormControl(props = {}) {
|
|
|
13699
13704
|
_setValid();
|
|
13700
13705
|
}
|
|
13701
13706
|
}
|
|
13702
|
-
return shouldRender && _subjects.state.next({ name
|
|
13707
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
13703
13708
|
}
|
|
13704
13709
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
13705
13710
|
if (_options.resolver) {
|
|
13706
|
-
const { errors } = await _runSchema([
|
|
13711
|
+
const { errors } = await _runSchema([name]);
|
|
13707
13712
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13708
13713
|
if (isFieldValueUpdated) {
|
|
13709
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
13710
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
13714
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
13715
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
13711
13716
|
error2 = errorLookupResult.error;
|
|
13712
|
-
|
|
13717
|
+
name = errorLookupResult.name;
|
|
13713
13718
|
isValid3 = isEmptyObject(errors);
|
|
13714
13719
|
}
|
|
13715
13720
|
} else {
|
|
13716
|
-
_updateIsValidating([
|
|
13717
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
13718
|
-
_updateIsValidating([
|
|
13721
|
+
_updateIsValidating([name], true);
|
|
13722
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
13723
|
+
_updateIsValidating([name]);
|
|
13719
13724
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13720
13725
|
if (isFieldValueUpdated) {
|
|
13721
13726
|
if (error2) {
|
|
@@ -13727,7 +13732,7 @@ function createFormControl(props = {}) {
|
|
|
13727
13732
|
}
|
|
13728
13733
|
if (isFieldValueUpdated) {
|
|
13729
13734
|
field._f.deps && trigger(field._f.deps);
|
|
13730
|
-
shouldRenderByError(
|
|
13735
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
13731
13736
|
}
|
|
13732
13737
|
}
|
|
13733
13738
|
};
|
|
@@ -13738,15 +13743,15 @@ function createFormControl(props = {}) {
|
|
|
13738
13743
|
}
|
|
13739
13744
|
return;
|
|
13740
13745
|
};
|
|
13741
|
-
const trigger = async (
|
|
13746
|
+
const trigger = async (name, options2 = {}) => {
|
|
13742
13747
|
let isValid3;
|
|
13743
13748
|
let validationResult;
|
|
13744
|
-
const fieldNames = convertToArrayPayload(
|
|
13749
|
+
const fieldNames = convertToArrayPayload(name);
|
|
13745
13750
|
if (_options.resolver) {
|
|
13746
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
13751
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
13747
13752
|
isValid3 = isEmptyObject(errors);
|
|
13748
|
-
validationResult =
|
|
13749
|
-
} else if (
|
|
13753
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
13754
|
+
} else if (name) {
|
|
13750
13755
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
13751
13756
|
const field = get2(_fields, fieldName);
|
|
13752
13757
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -13756,51 +13761,51 @@ function createFormControl(props = {}) {
|
|
|
13756
13761
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
13757
13762
|
}
|
|
13758
13763
|
_subjects.state.next({
|
|
13759
|
-
...!isString3(
|
|
13760
|
-
..._options.resolver || !
|
|
13764
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
13765
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
13761
13766
|
errors: _formState.errors
|
|
13762
13767
|
});
|
|
13763
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
13768
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
13764
13769
|
return validationResult;
|
|
13765
13770
|
};
|
|
13766
13771
|
const getValues = (fieldNames) => {
|
|
13767
13772
|
const values = {
|
|
13768
13773
|
..._state.mount ? _formValues : _defaultValues
|
|
13769
13774
|
};
|
|
13770
|
-
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((
|
|
13775
|
+
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((name) => get2(values, name));
|
|
13771
13776
|
};
|
|
13772
|
-
const getFieldState = (
|
|
13773
|
-
invalid: !!get2((formState || _formState).errors,
|
|
13774
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
13775
|
-
error: get2((formState || _formState).errors,
|
|
13776
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
13777
|
-
isTouched: !!get2((formState || _formState).touchedFields,
|
|
13777
|
+
const getFieldState = (name, formState) => ({
|
|
13778
|
+
invalid: !!get2((formState || _formState).errors, name),
|
|
13779
|
+
isDirty: !!get2((formState || _formState).dirtyFields, name),
|
|
13780
|
+
error: get2((formState || _formState).errors, name),
|
|
13781
|
+
isValidating: !!get2(_formState.validatingFields, name),
|
|
13782
|
+
isTouched: !!get2((formState || _formState).touchedFields, name)
|
|
13778
13783
|
});
|
|
13779
|
-
const clearErrors = (
|
|
13780
|
-
|
|
13784
|
+
const clearErrors = (name) => {
|
|
13785
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
13781
13786
|
_subjects.state.next({
|
|
13782
|
-
errors:
|
|
13787
|
+
errors: name ? _formState.errors : {}
|
|
13783
13788
|
});
|
|
13784
13789
|
};
|
|
13785
|
-
const setError = (
|
|
13786
|
-
const ref = (get2(_fields,
|
|
13787
|
-
const currentError = get2(_formState.errors,
|
|
13790
|
+
const setError = (name, error2, options2) => {
|
|
13791
|
+
const ref = (get2(_fields, name, { _f: {} })._f || {}).ref;
|
|
13792
|
+
const currentError = get2(_formState.errors, name) || {};
|
|
13788
13793
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
13789
|
-
set(_formState.errors,
|
|
13794
|
+
set(_formState.errors, name, {
|
|
13790
13795
|
...restOfErrorTree,
|
|
13791
13796
|
...error2,
|
|
13792
13797
|
ref
|
|
13793
13798
|
});
|
|
13794
13799
|
_subjects.state.next({
|
|
13795
|
-
name
|
|
13800
|
+
name,
|
|
13796
13801
|
errors: _formState.errors,
|
|
13797
13802
|
isValid: false
|
|
13798
13803
|
});
|
|
13799
13804
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
13800
13805
|
};
|
|
13801
|
-
const watch = (
|
|
13802
|
-
next: (payload) => "values" in payload &&
|
|
13803
|
-
}) : _getWatch(
|
|
13806
|
+
const watch = (name, defaultValue) => isFunction(name) ? _subjects.state.subscribe({
|
|
13807
|
+
next: (payload) => "values" in payload && name(_getWatch(void 0, defaultValue), payload)
|
|
13808
|
+
}) : _getWatch(name, defaultValue, true);
|
|
13804
13809
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
13805
13810
|
next: (formState) => {
|
|
13806
13811
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -13824,8 +13829,8 @@ function createFormControl(props = {}) {
|
|
|
13824
13829
|
formState: _proxySubscribeFormState
|
|
13825
13830
|
});
|
|
13826
13831
|
};
|
|
13827
|
-
const unregister = (
|
|
13828
|
-
for (const fieldName of
|
|
13832
|
+
const unregister = (name, options2 = {}) => {
|
|
13833
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
13829
13834
|
_names.mount.delete(fieldName);
|
|
13830
13835
|
_names.array.delete(fieldName);
|
|
13831
13836
|
if (!options2.keepValue) {
|
|
@@ -13847,31 +13852,31 @@ function createFormControl(props = {}) {
|
|
|
13847
13852
|
});
|
|
13848
13853
|
!options2.keepIsValid && _setValid();
|
|
13849
13854
|
};
|
|
13850
|
-
const _setDisabledField = ({ disabled, name
|
|
13851
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
13852
|
-
disabled ? _names.disabled.add(
|
|
13855
|
+
const _setDisabledField = ({ disabled, name }) => {
|
|
13856
|
+
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) {
|
|
13857
|
+
disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
|
|
13853
13858
|
}
|
|
13854
13859
|
};
|
|
13855
|
-
const register = (
|
|
13856
|
-
let field = get2(_fields,
|
|
13860
|
+
const register = (name, options2 = {}) => {
|
|
13861
|
+
let field = get2(_fields, name);
|
|
13857
13862
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
13858
|
-
set(_fields,
|
|
13863
|
+
set(_fields, name, {
|
|
13859
13864
|
...field || {},
|
|
13860
13865
|
_f: {
|
|
13861
|
-
...field && field._f ? field._f : { ref: { name
|
|
13862
|
-
name
|
|
13866
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
13867
|
+
name,
|
|
13863
13868
|
mount: true,
|
|
13864
13869
|
...options2
|
|
13865
13870
|
}
|
|
13866
13871
|
});
|
|
13867
|
-
_names.mount.add(
|
|
13872
|
+
_names.mount.add(name);
|
|
13868
13873
|
if (field) {
|
|
13869
13874
|
_setDisabledField({
|
|
13870
13875
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
13871
|
-
name
|
|
13876
|
+
name
|
|
13872
13877
|
});
|
|
13873
13878
|
} else {
|
|
13874
|
-
updateValidAndValue(
|
|
13879
|
+
updateValidAndValue(name, true, options2.value);
|
|
13875
13880
|
}
|
|
13876
13881
|
return {
|
|
13877
13882
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -13883,39 +13888,39 @@ function createFormControl(props = {}) {
|
|
|
13883
13888
|
maxLength: getRuleValue(options2.maxLength),
|
|
13884
13889
|
pattern: getRuleValue(options2.pattern)
|
|
13885
13890
|
} : {},
|
|
13886
|
-
name
|
|
13891
|
+
name,
|
|
13887
13892
|
onChange: onChange2,
|
|
13888
13893
|
onBlur: onChange2,
|
|
13889
13894
|
ref: (ref) => {
|
|
13890
13895
|
if (ref) {
|
|
13891
|
-
register(
|
|
13892
|
-
field = get2(_fields,
|
|
13896
|
+
register(name, options2);
|
|
13897
|
+
field = get2(_fields, name);
|
|
13893
13898
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
13894
13899
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
13895
13900
|
const refs = field._f.refs || [];
|
|
13896
13901
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
13897
13902
|
return;
|
|
13898
13903
|
}
|
|
13899
|
-
set(_fields,
|
|
13904
|
+
set(_fields, name, {
|
|
13900
13905
|
_f: {
|
|
13901
13906
|
...field._f,
|
|
13902
13907
|
...radioOrCheckbox ? {
|
|
13903
13908
|
refs: [
|
|
13904
13909
|
...refs.filter(live),
|
|
13905
13910
|
fieldRef,
|
|
13906
|
-
...Array.isArray(get2(_defaultValues,
|
|
13911
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
13907
13912
|
],
|
|
13908
|
-
ref: { type: fieldRef.type, name
|
|
13913
|
+
ref: { type: fieldRef.type, name }
|
|
13909
13914
|
} : { ref: fieldRef }
|
|
13910
13915
|
}
|
|
13911
13916
|
});
|
|
13912
|
-
updateValidAndValue(
|
|
13917
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
13913
13918
|
} else {
|
|
13914
|
-
field = get2(_fields,
|
|
13919
|
+
field = get2(_fields, name, {});
|
|
13915
13920
|
if (field._f) {
|
|
13916
13921
|
field._f.mount = false;
|
|
13917
13922
|
}
|
|
13918
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
13923
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
13919
13924
|
}
|
|
13920
13925
|
}
|
|
13921
13926
|
};
|
|
@@ -13924,8 +13929,8 @@ function createFormControl(props = {}) {
|
|
|
13924
13929
|
const _disableForm = (disabled) => {
|
|
13925
13930
|
if (isBoolean(disabled)) {
|
|
13926
13931
|
_subjects.state.next({ disabled });
|
|
13927
|
-
iterateFieldsByAction(_fields, (ref,
|
|
13928
|
-
const currentField = get2(_fields,
|
|
13932
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
13933
|
+
const currentField = get2(_fields, name);
|
|
13929
13934
|
if (currentField) {
|
|
13930
13935
|
ref.disabled = currentField._f.disabled || disabled;
|
|
13931
13936
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -13955,8 +13960,8 @@ function createFormControl(props = {}) {
|
|
|
13955
13960
|
await executeBuiltInValidation(_fields);
|
|
13956
13961
|
}
|
|
13957
13962
|
if (_names.disabled.size) {
|
|
13958
|
-
for (const
|
|
13959
|
-
unset(fieldValues,
|
|
13963
|
+
for (const name of _names.disabled) {
|
|
13964
|
+
unset(fieldValues, name);
|
|
13960
13965
|
}
|
|
13961
13966
|
}
|
|
13962
13967
|
unset(_formState.errors, "root");
|
|
@@ -13987,23 +13992,23 @@ function createFormControl(props = {}) {
|
|
|
13987
13992
|
throw onValidError;
|
|
13988
13993
|
}
|
|
13989
13994
|
};
|
|
13990
|
-
const resetField = (
|
|
13991
|
-
if (get2(_fields,
|
|
13995
|
+
const resetField = (name, options2 = {}) => {
|
|
13996
|
+
if (get2(_fields, name)) {
|
|
13992
13997
|
if (isUndefined(options2.defaultValue)) {
|
|
13993
|
-
setValue(
|
|
13998
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
13994
13999
|
} else {
|
|
13995
|
-
setValue(
|
|
13996
|
-
set(_defaultValues,
|
|
14000
|
+
setValue(name, options2.defaultValue);
|
|
14001
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
13997
14002
|
}
|
|
13998
14003
|
if (!options2.keepTouched) {
|
|
13999
|
-
unset(_formState.touchedFields,
|
|
14004
|
+
unset(_formState.touchedFields, name);
|
|
14000
14005
|
}
|
|
14001
14006
|
if (!options2.keepDirty) {
|
|
14002
|
-
unset(_formState.dirtyFields,
|
|
14003
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
14007
|
+
unset(_formState.dirtyFields, name);
|
|
14008
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
14004
14009
|
}
|
|
14005
14010
|
if (!options2.keepError) {
|
|
14006
|
-
unset(_formState.errors,
|
|
14011
|
+
unset(_formState.errors, name);
|
|
14007
14012
|
_proxyFormState.isValid && _setValid();
|
|
14008
14013
|
}
|
|
14009
14014
|
_subjects.state.next({ ..._formState });
|
|
@@ -14028,8 +14033,8 @@ function createFormControl(props = {}) {
|
|
|
14028
14033
|
}
|
|
14029
14034
|
} else {
|
|
14030
14035
|
if (isWeb && isUndefined(formValues)) {
|
|
14031
|
-
for (const
|
|
14032
|
-
const field = get2(_fields,
|
|
14036
|
+
for (const name of _names.mount) {
|
|
14037
|
+
const field = get2(_fields, name);
|
|
14033
14038
|
if (field && field._f) {
|
|
14034
14039
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
14035
14040
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -14082,8 +14087,8 @@ function createFormControl(props = {}) {
|
|
|
14082
14087
|
});
|
|
14083
14088
|
};
|
|
14084
14089
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
14085
|
-
const setFocus = (
|
|
14086
|
-
const field = get2(_fields,
|
|
14090
|
+
const setFocus = (name, options2 = {}) => {
|
|
14091
|
+
const field = get2(_fields, name);
|
|
14087
14092
|
const fieldReference = field && field._f;
|
|
14088
14093
|
if (fieldReference) {
|
|
14089
14094
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -14399,7 +14404,7 @@ function TextInput(props) {
|
|
|
14399
14404
|
inputWrapperClassName,
|
|
14400
14405
|
label,
|
|
14401
14406
|
placeholder,
|
|
14402
|
-
name
|
|
14407
|
+
name,
|
|
14403
14408
|
type = "text",
|
|
14404
14409
|
register,
|
|
14405
14410
|
errors,
|
|
@@ -14422,7 +14427,7 @@ function TextInput(props) {
|
|
|
14422
14427
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
14423
14428
|
placeholder,
|
|
14424
14429
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
14425
|
-
...register(
|
|
14430
|
+
...register(name)
|
|
14426
14431
|
}
|
|
14427
14432
|
),
|
|
14428
14433
|
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -14436,11 +14441,11 @@ function TextInput(props) {
|
|
|
14436
14441
|
]
|
|
14437
14442
|
}
|
|
14438
14443
|
),
|
|
14439
|
-
errors?.[
|
|
14444
|
+
errors?.[name]?.message && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
14440
14445
|
"p",
|
|
14441
14446
|
{
|
|
14442
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
14443
|
-
children: errors?.[
|
|
14447
|
+
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[name] ? "h-4" : "h-0 -mt-1"}`,
|
|
14448
|
+
children: errors?.[name]?.message
|
|
14444
14449
|
}
|
|
14445
14450
|
)
|
|
14446
14451
|
] });
|
|
@@ -14847,10 +14852,10 @@ function useFileInfo(source, options2) {
|
|
|
14847
14852
|
let localUrl = null;
|
|
14848
14853
|
let fr = null;
|
|
14849
14854
|
let mediaEl = null;
|
|
14850
|
-
const makeExtension = (
|
|
14851
|
-
if (
|
|
14852
|
-
const idx =
|
|
14853
|
-
if (idx > -1) return
|
|
14855
|
+
const makeExtension = (name, type) => {
|
|
14856
|
+
if (name) {
|
|
14857
|
+
const idx = name.lastIndexOf(".");
|
|
14858
|
+
if (idx > -1) return name.slice(idx + 1).toLowerCase();
|
|
14854
14859
|
}
|
|
14855
14860
|
if (type) {
|
|
14856
14861
|
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
@@ -15459,7 +15464,7 @@ var ModalLayer = ({
|
|
|
15459
15464
|
// src/widgets/common/modal-confirm.tsx
|
|
15460
15465
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
15461
15466
|
var ModalConfirm = ({
|
|
15462
|
-
name
|
|
15467
|
+
name,
|
|
15463
15468
|
isShowModal,
|
|
15464
15469
|
onClick,
|
|
15465
15470
|
onClose,
|
|
@@ -15468,8 +15473,8 @@ var ModalConfirm = ({
|
|
|
15468
15473
|
isLoading
|
|
15469
15474
|
}) => {
|
|
15470
15475
|
const { t: t3 } = useI18n();
|
|
15471
|
-
const renderButtonAction = (
|
|
15472
|
-
switch (
|
|
15476
|
+
const renderButtonAction = (name2) => {
|
|
15477
|
+
switch (name2) {
|
|
15473
15478
|
case "duplicate":
|
|
15474
15479
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
15475
15480
|
"button",
|
|
@@ -15545,7 +15550,7 @@ var ModalConfirm = ({
|
|
|
15545
15550
|
children: t3("cancel")
|
|
15546
15551
|
}
|
|
15547
15552
|
),
|
|
15548
|
-
renderButtonAction(
|
|
15553
|
+
renderButtonAction(name)
|
|
15549
15554
|
] })
|
|
15550
15555
|
] }) });
|
|
15551
15556
|
};
|
|
@@ -16094,7 +16099,7 @@ var import_react39 = require("react");
|
|
|
16094
16099
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
16095
16100
|
var BinaryField = (props) => {
|
|
16096
16101
|
const {
|
|
16097
|
-
name
|
|
16102
|
+
name,
|
|
16098
16103
|
methods,
|
|
16099
16104
|
readonly = false,
|
|
16100
16105
|
placeholder,
|
|
@@ -16133,7 +16138,7 @@ var BinaryField = (props) => {
|
|
|
16133
16138
|
try {
|
|
16134
16139
|
let type = "application/octet-stream";
|
|
16135
16140
|
let size4 = 0;
|
|
16136
|
-
let
|
|
16141
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16137
16142
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16138
16143
|
type = "image/*";
|
|
16139
16144
|
} else {
|
|
@@ -16146,7 +16151,7 @@ var BinaryField = (props) => {
|
|
|
16146
16151
|
}
|
|
16147
16152
|
}
|
|
16148
16153
|
setFileInfo({
|
|
16149
|
-
name:
|
|
16154
|
+
name: name2,
|
|
16150
16155
|
type,
|
|
16151
16156
|
url: initialFile,
|
|
16152
16157
|
size: size4,
|
|
@@ -16182,13 +16187,13 @@ var BinaryField = (props) => {
|
|
|
16182
16187
|
};
|
|
16183
16188
|
const renderPreview = (file) => {
|
|
16184
16189
|
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PlaceHolderIcon, {});
|
|
16185
|
-
const { name:
|
|
16190
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16186
16191
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16187
16192
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16188
16193
|
"img",
|
|
16189
16194
|
{
|
|
16190
16195
|
src: url,
|
|
16191
|
-
alt:
|
|
16196
|
+
alt: name2,
|
|
16192
16197
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16193
16198
|
style: {
|
|
16194
16199
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16228,7 +16233,7 @@ var BinaryField = (props) => {
|
|
|
16228
16233
|
maxWidth: "120px"
|
|
16229
16234
|
},
|
|
16230
16235
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16231
|
-
children:
|
|
16236
|
+
children: name2
|
|
16232
16237
|
}
|
|
16233
16238
|
),
|
|
16234
16239
|
isShowSize && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16238,7 +16243,7 @@ var BinaryField = (props) => {
|
|
|
16238
16243
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16239
16244
|
Controller,
|
|
16240
16245
|
{
|
|
16241
|
-
name:
|
|
16246
|
+
name: name ?? "",
|
|
16242
16247
|
control: methods?.control,
|
|
16243
16248
|
rules: {
|
|
16244
16249
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -16531,7 +16536,7 @@ var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
|
16531
16536
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
16532
16537
|
var CharField = (props) => {
|
|
16533
16538
|
const {
|
|
16534
|
-
name
|
|
16539
|
+
name,
|
|
16535
16540
|
readonly,
|
|
16536
16541
|
placeholder,
|
|
16537
16542
|
required,
|
|
@@ -16562,7 +16567,7 @@ var CharField = (props) => {
|
|
|
16562
16567
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
16563
16568
|
Controller,
|
|
16564
16569
|
{
|
|
16565
|
-
name:
|
|
16570
|
+
name: name ?? "",
|
|
16566
16571
|
control: methods.control,
|
|
16567
16572
|
rules: {
|
|
16568
16573
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -16589,15 +16594,15 @@ var CharField = (props) => {
|
|
|
16589
16594
|
const { setError, clearErrors } = methods;
|
|
16590
16595
|
(0, import_react40.useEffect)(() => {
|
|
16591
16596
|
if (value2) {
|
|
16592
|
-
clearErrors(
|
|
16597
|
+
clearErrors(name);
|
|
16593
16598
|
}
|
|
16594
|
-
}, [value2, clearErrors,
|
|
16599
|
+
}, [value2, clearErrors, name]);
|
|
16595
16600
|
(0, import_react40.useEffect)(() => {
|
|
16596
16601
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
16597
16602
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
16598
|
-
const currentValue = methods?.getValues(
|
|
16603
|
+
const currentValue = methods?.getValues(name);
|
|
16599
16604
|
if (currentValue !== depValue) {
|
|
16600
|
-
methods?.setValue(
|
|
16605
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
16601
16606
|
}
|
|
16602
16607
|
}, [widget, formValues]);
|
|
16603
16608
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -16622,14 +16627,14 @@ var CharField = (props) => {
|
|
|
16622
16627
|
const inputValue = e3.target.value;
|
|
16623
16628
|
if (readonly) return;
|
|
16624
16629
|
fieldOnchange(inputValue);
|
|
16625
|
-
clearErrors(
|
|
16630
|
+
clearErrors(name);
|
|
16626
16631
|
},
|
|
16627
16632
|
onBlur: (e3) => {
|
|
16628
16633
|
if (readonly) return;
|
|
16629
16634
|
const inputValue = e3.target.value || "";
|
|
16630
16635
|
if (widget === "custom_passord") {
|
|
16631
16636
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
16632
|
-
setError(
|
|
16637
|
+
setError(name, {
|
|
16633
16638
|
type: "pattern",
|
|
16634
16639
|
message: getPasswordMessage(
|
|
16635
16640
|
min3,
|
|
@@ -16644,7 +16649,7 @@ var CharField = (props) => {
|
|
|
16644
16649
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
16645
16650
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
16646
16651
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
16647
|
-
setError(
|
|
16652
|
+
setError(name, {
|
|
16648
16653
|
type: "pattern",
|
|
16649
16654
|
message: t3(
|
|
16650
16655
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -16654,14 +16659,14 @@ var CharField = (props) => {
|
|
|
16654
16659
|
}
|
|
16655
16660
|
}
|
|
16656
16661
|
fieldOnchange(inputValue);
|
|
16657
|
-
onChange2 && onChange2(
|
|
16662
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
16658
16663
|
if (!inputValue && required && !invisible) {
|
|
16659
|
-
setError(
|
|
16664
|
+
setError(name, {
|
|
16660
16665
|
type: "required",
|
|
16661
16666
|
message: `${string} ${t3("must_required")}`
|
|
16662
16667
|
});
|
|
16663
16668
|
} else {
|
|
16664
|
-
clearErrors(
|
|
16669
|
+
clearErrors(name);
|
|
16665
16670
|
}
|
|
16666
16671
|
},
|
|
16667
16672
|
readOnly: readonly,
|
|
@@ -16715,14 +16720,14 @@ function EyeIconComponent({ open }) {
|
|
|
16715
16720
|
}
|
|
16716
16721
|
var SecureField = (props) => {
|
|
16717
16722
|
const {
|
|
16718
|
-
name
|
|
16723
|
+
name,
|
|
16719
16724
|
readonly,
|
|
16720
16725
|
placeholder,
|
|
16721
16726
|
required,
|
|
16722
16727
|
invisible,
|
|
16723
16728
|
methods,
|
|
16724
16729
|
onChange: onChange2,
|
|
16725
|
-
string =
|
|
16730
|
+
string = name,
|
|
16726
16731
|
widget,
|
|
16727
16732
|
min: min3,
|
|
16728
16733
|
max: max3,
|
|
@@ -16752,7 +16757,7 @@ var SecureField = (props) => {
|
|
|
16752
16757
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
16753
16758
|
Controller,
|
|
16754
16759
|
{
|
|
16755
|
-
name: String(
|
|
16760
|
+
name: String(name),
|
|
16756
16761
|
control: methods.control,
|
|
16757
16762
|
rules: {
|
|
16758
16763
|
...required && !invisible ? {
|
|
@@ -16786,8 +16791,8 @@ var SecureField = (props) => {
|
|
|
16786
16791
|
if (canToggle) setShowPlain(false);
|
|
16787
16792
|
}, [canToggle]);
|
|
16788
16793
|
(0, import_react41.useEffect)(() => {
|
|
16789
|
-
if (value2) clearErrors(
|
|
16790
|
-
}, [value2, clearErrors,
|
|
16794
|
+
if (value2) clearErrors(name);
|
|
16795
|
+
}, [value2, clearErrors, name]);
|
|
16791
16796
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
16792
16797
|
isCappedToken && shouldMask && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
16793
16798
|
"div",
|
|
@@ -16805,20 +16810,20 @@ var SecureField = (props) => {
|
|
|
16805
16810
|
if (readonly) return;
|
|
16806
16811
|
const inputValue = e3.target.value ?? "";
|
|
16807
16812
|
fieldOnchange(inputValue);
|
|
16808
|
-
clearErrors(
|
|
16813
|
+
clearErrors(name);
|
|
16809
16814
|
},
|
|
16810
16815
|
onBlur: (e3) => {
|
|
16811
16816
|
if (readonly) return;
|
|
16812
16817
|
const inputValue = (e3.target.value ?? "").trim();
|
|
16813
16818
|
if (!inputValue && required && !invisible) {
|
|
16814
|
-
setError(
|
|
16819
|
+
setError(name, {
|
|
16815
16820
|
type: "required",
|
|
16816
16821
|
message: `${string} ${t3("must_required")}`
|
|
16817
16822
|
});
|
|
16818
16823
|
return;
|
|
16819
16824
|
}
|
|
16820
16825
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
16821
|
-
setError(
|
|
16826
|
+
setError(name, {
|
|
16822
16827
|
type: "pattern",
|
|
16823
16828
|
message: getPasswordMessage2(
|
|
16824
16829
|
min3,
|
|
@@ -16831,8 +16836,8 @@ var SecureField = (props) => {
|
|
|
16831
16836
|
return;
|
|
16832
16837
|
}
|
|
16833
16838
|
fieldOnchange(inputValue);
|
|
16834
|
-
onChange2 && onChange2(String(
|
|
16835
|
-
clearErrors(
|
|
16839
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
16840
|
+
clearErrors(name);
|
|
16836
16841
|
},
|
|
16837
16842
|
readOnly: readonly,
|
|
16838
16843
|
disabled: readonly,
|
|
@@ -16876,7 +16881,7 @@ var SecureField = (props) => {
|
|
|
16876
16881
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
16877
16882
|
var CheckboxField = (props) => {
|
|
16878
16883
|
const {
|
|
16879
|
-
name
|
|
16884
|
+
name,
|
|
16880
16885
|
readonly = false,
|
|
16881
16886
|
required = false,
|
|
16882
16887
|
invisible = false,
|
|
@@ -16887,7 +16892,7 @@ var CheckboxField = (props) => {
|
|
|
16887
16892
|
isEditTable = false
|
|
16888
16893
|
} = props;
|
|
16889
16894
|
if (!isForm) {
|
|
16890
|
-
if (
|
|
16895
|
+
if (name === "is_active" || name === "active") {
|
|
16891
16896
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ActiveBadgeField, { type: value });
|
|
16892
16897
|
} else {
|
|
16893
16898
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -16904,7 +16909,7 @@ var CheckboxField = (props) => {
|
|
|
16904
16909
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16905
16910
|
Controller,
|
|
16906
16911
|
{
|
|
16907
|
-
name:
|
|
16912
|
+
name: name ?? "",
|
|
16908
16913
|
control: methods?.control,
|
|
16909
16914
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16910
16915
|
"div",
|
|
@@ -16913,10 +16918,10 @@ var CheckboxField = (props) => {
|
|
|
16913
16918
|
onClick: () => {
|
|
16914
16919
|
const checked = !field.value;
|
|
16915
16920
|
if (!isEditTable && readonly) return;
|
|
16916
|
-
methods.setValue(
|
|
16921
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16917
16922
|
field.onChange(checked);
|
|
16918
16923
|
if (onChange2) {
|
|
16919
|
-
onChange2(
|
|
16924
|
+
onChange2(name ?? "", checked);
|
|
16920
16925
|
}
|
|
16921
16926
|
},
|
|
16922
16927
|
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -16926,10 +16931,10 @@ var CheckboxField = (props) => {
|
|
|
16926
16931
|
onChange: (e3) => {
|
|
16927
16932
|
const checked = e3.target.checked;
|
|
16928
16933
|
if (!isEditTable && readonly) return;
|
|
16929
|
-
methods.setValue(
|
|
16934
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16930
16935
|
field.onChange(checked);
|
|
16931
16936
|
if (onChange2) {
|
|
16932
|
-
onChange2(
|
|
16937
|
+
onChange2(name ?? "", checked);
|
|
16933
16938
|
}
|
|
16934
16939
|
},
|
|
16935
16940
|
type: "checkbox",
|
|
@@ -17023,19 +17028,19 @@ var ColorWrapper = (props) => {
|
|
|
17023
17028
|
// src/widgets/basic/color-field/color.tsx
|
|
17024
17029
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
17025
17030
|
var ColorField = (props) => {
|
|
17026
|
-
const { value, isForm, name
|
|
17031
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
17027
17032
|
if (!isForm) {
|
|
17028
17033
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
17029
17034
|
}
|
|
17030
17035
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17031
17036
|
Controller,
|
|
17032
17037
|
{
|
|
17033
|
-
name:
|
|
17038
|
+
name: name ?? "",
|
|
17034
17039
|
control: methods?.control,
|
|
17035
17040
|
render: ({ field }) => {
|
|
17036
17041
|
const handlePickColorChange = (color) => {
|
|
17037
17042
|
field.onChange(color?.id);
|
|
17038
|
-
onChange2 && onChange2(
|
|
17043
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
17039
17044
|
};
|
|
17040
17045
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17041
17046
|
ColorWrapper,
|
|
@@ -17056,7 +17061,7 @@ var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
|
17056
17061
|
var CopyLinkButtonField = (props) => {
|
|
17057
17062
|
const {
|
|
17058
17063
|
isForm,
|
|
17059
|
-
name
|
|
17064
|
+
name,
|
|
17060
17065
|
methods,
|
|
17061
17066
|
onChange: onChange2,
|
|
17062
17067
|
readonly,
|
|
@@ -17078,7 +17083,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17078
17083
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
17079
17084
|
Controller,
|
|
17080
17085
|
{
|
|
17081
|
-
name:
|
|
17086
|
+
name: name ?? "",
|
|
17082
17087
|
control: methods.control,
|
|
17083
17088
|
rules: {
|
|
17084
17089
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17090,7 +17095,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17090
17095
|
const { setError, clearErrors } = methods;
|
|
17091
17096
|
(0, import_react43.useEffect)(() => {
|
|
17092
17097
|
if (value) {
|
|
17093
|
-
clearErrors(
|
|
17098
|
+
clearErrors(name);
|
|
17094
17099
|
}
|
|
17095
17100
|
}, [value]);
|
|
17096
17101
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17108,11 +17113,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17108
17113
|
if (readonly) return;
|
|
17109
17114
|
const newValue = e3.target.value || "";
|
|
17110
17115
|
fieldOnchange(newValue);
|
|
17111
|
-
onChange2 && onChange2(
|
|
17116
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17112
17117
|
if (e3.target.value) {
|
|
17113
|
-
clearErrors(
|
|
17118
|
+
clearErrors(name);
|
|
17114
17119
|
} else if (required && !invisible) {
|
|
17115
|
-
setError(
|
|
17120
|
+
setError(name, {
|
|
17116
17121
|
type: "required",
|
|
17117
17122
|
message: `${string} ${t3("must_required")}`
|
|
17118
17123
|
});
|
|
@@ -17122,9 +17127,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17122
17127
|
if (!readonly) {
|
|
17123
17128
|
fieldOnchange(e3.target.value);
|
|
17124
17129
|
if (e3.target.value) {
|
|
17125
|
-
clearErrors(
|
|
17130
|
+
clearErrors(name);
|
|
17126
17131
|
} else if (required && !invisible) {
|
|
17127
|
-
setError(
|
|
17132
|
+
setError(name, {
|
|
17128
17133
|
type: "required",
|
|
17129
17134
|
message: `${string} ${t3("must_required")}`
|
|
17130
17135
|
});
|
|
@@ -26988,23 +26993,23 @@ var createCache = function createCache2(options2) {
|
|
|
26988
26993
|
};
|
|
26989
26994
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
26990
26995
|
var getRules3 = function getRules4(selector, serialized) {
|
|
26991
|
-
var
|
|
26992
|
-
if (serverStylisCache[
|
|
26993
|
-
serverStylisCache[
|
|
26996
|
+
var name = serialized.name;
|
|
26997
|
+
if (serverStylisCache[name] === void 0) {
|
|
26998
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
26994
26999
|
}
|
|
26995
|
-
return serverStylisCache[
|
|
27000
|
+
return serverStylisCache[name];
|
|
26996
27001
|
};
|
|
26997
27002
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
26998
|
-
var
|
|
27003
|
+
var name = serialized.name;
|
|
26999
27004
|
var rules = getRules3(selector, serialized);
|
|
27000
27005
|
if (cache.compat === void 0) {
|
|
27001
27006
|
if (shouldCache) {
|
|
27002
|
-
cache.inserted[
|
|
27007
|
+
cache.inserted[name] = true;
|
|
27003
27008
|
}
|
|
27004
27009
|
return rules;
|
|
27005
27010
|
} else {
|
|
27006
27011
|
if (shouldCache) {
|
|
27007
|
-
cache.inserted[
|
|
27012
|
+
cache.inserted[name] = rules;
|
|
27008
27013
|
} else {
|
|
27009
27014
|
return rules;
|
|
27010
27015
|
}
|
|
@@ -27327,9 +27332,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
27327
27332
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
27328
27333
|
identifierName += "-" + match3[1];
|
|
27329
27334
|
}
|
|
27330
|
-
var
|
|
27335
|
+
var name = murmur2(styles) + identifierName;
|
|
27331
27336
|
return {
|
|
27332
|
-
name
|
|
27337
|
+
name,
|
|
27333
27338
|
styles,
|
|
27334
27339
|
next: cursor
|
|
27335
27340
|
};
|
|
@@ -27479,10 +27484,10 @@ function css() {
|
|
|
27479
27484
|
}
|
|
27480
27485
|
function keyframes() {
|
|
27481
27486
|
var insertable = css.apply(void 0, arguments);
|
|
27482
|
-
var
|
|
27487
|
+
var name = "animation-" + insertable.name;
|
|
27483
27488
|
return {
|
|
27484
|
-
name
|
|
27485
|
-
styles: "@keyframes " +
|
|
27489
|
+
name,
|
|
27490
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
27486
27491
|
anim: 1,
|
|
27487
27492
|
toString: function toString() {
|
|
27488
27493
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -27514,13 +27519,13 @@ var index3 = isClient3 ? import_react50.useLayoutEffect : noop6;
|
|
|
27514
27519
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
27515
27520
|
var noop8 = function noop9() {
|
|
27516
27521
|
};
|
|
27517
|
-
function applyPrefixToName(prefix2,
|
|
27518
|
-
if (!
|
|
27522
|
+
function applyPrefixToName(prefix2, name) {
|
|
27523
|
+
if (!name) {
|
|
27519
27524
|
return prefix2;
|
|
27520
|
-
} else if (
|
|
27521
|
-
return prefix2 +
|
|
27525
|
+
} else if (name[0] === "-") {
|
|
27526
|
+
return prefix2 + name;
|
|
27522
27527
|
} else {
|
|
27523
|
-
return prefix2 + "__" +
|
|
27528
|
+
return prefix2 + "__" + name;
|
|
27524
27529
|
}
|
|
27525
27530
|
}
|
|
27526
27531
|
function classNames(prefix2, state) {
|
|
@@ -27564,11 +27569,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
27564
27569
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
27565
27570
|
return _objectSpread2({}, innerProps);
|
|
27566
27571
|
};
|
|
27567
|
-
var getStyleProps = function getStyleProps2(props,
|
|
27572
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
27568
27573
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
27569
27574
|
return {
|
|
27570
|
-
css: getStyles(
|
|
27571
|
-
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(
|
|
27575
|
+
css: getStyles(name, props),
|
|
27576
|
+
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className)
|
|
27572
27577
|
};
|
|
27573
27578
|
};
|
|
27574
27579
|
function isDocumentElement(el) {
|
|
@@ -29317,10 +29322,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
29317
29322
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
29318
29323
|
};
|
|
29319
29324
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
29320
|
-
var
|
|
29325
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
29321
29326
|
return jsx86("input", {
|
|
29322
29327
|
required: true,
|
|
29323
|
-
name
|
|
29328
|
+
name,
|
|
29324
29329
|
tabIndex: -1,
|
|
29325
29330
|
"aria-hidden": "true",
|
|
29326
29331
|
onFocus: onFocus2,
|
|
@@ -29646,8 +29651,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29646
29651
|
_this.focus = _this.focusInput;
|
|
29647
29652
|
_this.blur = _this.blurInput;
|
|
29648
29653
|
_this.onChange = function(newValue, actionMeta) {
|
|
29649
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
29650
|
-
actionMeta.name =
|
|
29654
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
29655
|
+
actionMeta.name = name;
|
|
29651
29656
|
_this.ariaOnChange(newValue, actionMeta);
|
|
29652
29657
|
onChange2(newValue, actionMeta);
|
|
29653
29658
|
};
|
|
@@ -29672,7 +29677,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29672
29677
|
});
|
|
29673
29678
|
};
|
|
29674
29679
|
_this.selectOption = function(newValue) {
|
|
29675
|
-
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti,
|
|
29680
|
+
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name;
|
|
29676
29681
|
var selectValue = _this.state.selectValue;
|
|
29677
29682
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
29678
29683
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -29691,7 +29696,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29691
29696
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
29692
29697
|
action: "select-option",
|
|
29693
29698
|
option: newValue,
|
|
29694
|
-
name
|
|
29699
|
+
name
|
|
29695
29700
|
});
|
|
29696
29701
|
return;
|
|
29697
29702
|
}
|
|
@@ -30745,22 +30750,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30745
30750
|
key: "renderFormField",
|
|
30746
30751
|
value: function renderFormField() {
|
|
30747
30752
|
var _this5 = this;
|
|
30748
|
-
var _this$props13 = this.props, delimiter2 = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti,
|
|
30753
|
+
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;
|
|
30749
30754
|
var selectValue = this.state.selectValue;
|
|
30750
30755
|
if (required && !this.hasValue() && !isDisabled) {
|
|
30751
30756
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
30752
|
-
name
|
|
30757
|
+
name,
|
|
30753
30758
|
onFocus: this.onValueInputFocus
|
|
30754
30759
|
});
|
|
30755
30760
|
}
|
|
30756
|
-
if (!
|
|
30761
|
+
if (!name || isDisabled) return;
|
|
30757
30762
|
if (isMulti) {
|
|
30758
30763
|
if (delimiter2) {
|
|
30759
30764
|
var value = selectValue.map(function(opt) {
|
|
30760
30765
|
return _this5.getOptionValue(opt);
|
|
30761
30766
|
}).join(delimiter2);
|
|
30762
30767
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30763
|
-
name
|
|
30768
|
+
name,
|
|
30764
30769
|
type: "hidden",
|
|
30765
30770
|
value
|
|
30766
30771
|
});
|
|
@@ -30768,12 +30773,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30768
30773
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
30769
30774
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30770
30775
|
key: "i-".concat(i3),
|
|
30771
|
-
name
|
|
30776
|
+
name,
|
|
30772
30777
|
type: "hidden",
|
|
30773
30778
|
value: _this5.getOptionValue(opt)
|
|
30774
30779
|
});
|
|
30775
30780
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
30776
|
-
name
|
|
30781
|
+
name,
|
|
30777
30782
|
type: "hidden",
|
|
30778
30783
|
value: ""
|
|
30779
30784
|
});
|
|
@@ -30782,7 +30787,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30782
30787
|
} else {
|
|
30783
30788
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
30784
30789
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30785
|
-
name
|
|
30790
|
+
name,
|
|
30786
30791
|
type: "hidden",
|
|
30787
30792
|
value: _value
|
|
30788
30793
|
});
|
|
@@ -30911,7 +30916,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
30911
30916
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
30912
30917
|
var DateField = (props) => {
|
|
30913
30918
|
const {
|
|
30914
|
-
name
|
|
30919
|
+
name,
|
|
30915
30920
|
value,
|
|
30916
30921
|
readonly,
|
|
30917
30922
|
placeholder = "DD/MM/YYYY",
|
|
@@ -30961,7 +30966,7 @@ var DateField = (props) => {
|
|
|
30961
30966
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
30962
30967
|
Controller,
|
|
30963
30968
|
{
|
|
30964
|
-
name:
|
|
30969
|
+
name: name || "",
|
|
30965
30970
|
control: methods?.control,
|
|
30966
30971
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
30967
30972
|
rules: {
|
|
@@ -30976,9 +30981,9 @@ var DateField = (props) => {
|
|
|
30976
30981
|
const { setError, clearErrors } = methods;
|
|
30977
30982
|
(0, import_react56.useEffect)(() => {
|
|
30978
30983
|
if (value) {
|
|
30979
|
-
clearErrors(
|
|
30984
|
+
clearErrors(name);
|
|
30980
30985
|
}
|
|
30981
|
-
}, [value, clearErrors,
|
|
30986
|
+
}, [value, clearErrors, name]);
|
|
30982
30987
|
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;
|
|
30983
30988
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
30984
30989
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
@@ -30997,7 +31002,7 @@ var DateField = (props) => {
|
|
|
30997
31002
|
adjustedDate.toDate()
|
|
30998
31003
|
);
|
|
30999
31004
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
31000
|
-
setError(
|
|
31005
|
+
setError(name, {
|
|
31001
31006
|
type: "manual",
|
|
31002
31007
|
message: validateCustomResult
|
|
31003
31008
|
});
|
|
@@ -31005,20 +31010,20 @@ var DateField = (props) => {
|
|
|
31005
31010
|
}
|
|
31006
31011
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31007
31012
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
31008
|
-
handleOnchange && handleOnchange(
|
|
31009
|
-
clearErrors(
|
|
31013
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31014
|
+
clearErrors(name);
|
|
31010
31015
|
} else {
|
|
31011
31016
|
field.onChange(null);
|
|
31012
|
-
handleOnchange && handleOnchange(
|
|
31017
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
31013
31018
|
if (required && !invisible) {
|
|
31014
31019
|
if (!isEditTable) {
|
|
31015
|
-
setError(
|
|
31020
|
+
setError(name, {
|
|
31016
31021
|
type: "manual",
|
|
31017
31022
|
message: `${string} ${t3("must_required")}`
|
|
31018
31023
|
});
|
|
31019
31024
|
}
|
|
31020
31025
|
} else {
|
|
31021
|
-
clearErrors(
|
|
31026
|
+
clearErrors(name);
|
|
31022
31027
|
}
|
|
31023
31028
|
}
|
|
31024
31029
|
},
|
|
@@ -31039,7 +31044,7 @@ var DateField = (props) => {
|
|
|
31039
31044
|
}
|
|
31040
31045
|
),
|
|
31041
31046
|
timeInputLabel: textPlaceHolder,
|
|
31042
|
-
portalId:
|
|
31047
|
+
portalId: name,
|
|
31043
31048
|
renderCustomHeader: ({
|
|
31044
31049
|
date,
|
|
31045
31050
|
changeYear,
|
|
@@ -31378,7 +31383,7 @@ var RenderFile = ({
|
|
|
31378
31383
|
};
|
|
31379
31384
|
var FileUploadField = (props) => {
|
|
31380
31385
|
const {
|
|
31381
|
-
name
|
|
31386
|
+
name,
|
|
31382
31387
|
methods,
|
|
31383
31388
|
isForm,
|
|
31384
31389
|
model,
|
|
@@ -31409,7 +31414,7 @@ var FileUploadField = (props) => {
|
|
|
31409
31414
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
31410
31415
|
Controller,
|
|
31411
31416
|
{
|
|
31412
|
-
name:
|
|
31417
|
+
name: name || "",
|
|
31413
31418
|
control: methods?.control,
|
|
31414
31419
|
rules: {
|
|
31415
31420
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31475,7 +31480,7 @@ var import_react59 = require("react");
|
|
|
31475
31480
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
31476
31481
|
var FloatField = (props) => {
|
|
31477
31482
|
const {
|
|
31478
|
-
name
|
|
31483
|
+
name,
|
|
31479
31484
|
value: propValue,
|
|
31480
31485
|
readonly,
|
|
31481
31486
|
placeholder,
|
|
@@ -31496,7 +31501,7 @@ var FloatField = (props) => {
|
|
|
31496
31501
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
31497
31502
|
Controller,
|
|
31498
31503
|
{
|
|
31499
|
-
name:
|
|
31504
|
+
name: name ?? "",
|
|
31500
31505
|
control: methods.control,
|
|
31501
31506
|
rules: {
|
|
31502
31507
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -31514,14 +31519,14 @@ var FloatField = (props) => {
|
|
|
31514
31519
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
31515
31520
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
31516
31521
|
setInputValue(formatFloatNumber(propValue));
|
|
31517
|
-
clearErrors(
|
|
31522
|
+
clearErrors(name);
|
|
31518
31523
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
31519
31524
|
setInputValue(formatFloatNumber(value));
|
|
31520
|
-
clearErrors(
|
|
31525
|
+
clearErrors(name);
|
|
31521
31526
|
} else if (value === null || value === void 0) {
|
|
31522
31527
|
setInputValue("");
|
|
31523
31528
|
}
|
|
31524
|
-
}, [value,
|
|
31529
|
+
}, [value, name, clearErrors, propValue]);
|
|
31525
31530
|
const handleInputChange = (e3) => {
|
|
31526
31531
|
let newValue = e3.target.value;
|
|
31527
31532
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -31541,7 +31546,7 @@ var FloatField = (props) => {
|
|
|
31541
31546
|
);
|
|
31542
31547
|
if (!isNaN(parsedValue)) {
|
|
31543
31548
|
onChange2(parsedValue);
|
|
31544
|
-
clearErrors(
|
|
31549
|
+
clearErrors(name);
|
|
31545
31550
|
isDirtyRef.current = true;
|
|
31546
31551
|
} else {
|
|
31547
31552
|
onChange2(null);
|
|
@@ -31553,7 +31558,7 @@ var FloatField = (props) => {
|
|
|
31553
31558
|
const parsedValue = parseFloat(rawValue);
|
|
31554
31559
|
if (rawValue === "" || rawValue === ".") {
|
|
31555
31560
|
if (required) {
|
|
31556
|
-
setError(
|
|
31561
|
+
setError(name, {
|
|
31557
31562
|
type: "required",
|
|
31558
31563
|
message: `${string} ${t3("must_required")}`
|
|
31559
31564
|
});
|
|
@@ -31563,7 +31568,7 @@ var FloatField = (props) => {
|
|
|
31563
31568
|
lastCommittedValueRef.current = null;
|
|
31564
31569
|
} else if (!isNaN(parsedValue)) {
|
|
31565
31570
|
if (parsedValue < 0) {
|
|
31566
|
-
setError(
|
|
31571
|
+
setError(name, {
|
|
31567
31572
|
type: "validate",
|
|
31568
31573
|
message: t3("invalid_number")
|
|
31569
31574
|
});
|
|
@@ -31573,12 +31578,12 @@ var FloatField = (props) => {
|
|
|
31573
31578
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
31574
31579
|
setInputValue(formattedValue);
|
|
31575
31580
|
onChange2(parsedValue);
|
|
31576
|
-
handleOnchange?.(
|
|
31577
|
-
clearErrors(
|
|
31581
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
31582
|
+
clearErrors(name);
|
|
31578
31583
|
lastCommittedValueRef.current = parsedValue;
|
|
31579
31584
|
}
|
|
31580
31585
|
} else {
|
|
31581
|
-
setError(
|
|
31586
|
+
setError(name, {
|
|
31582
31587
|
type: "validate",
|
|
31583
31588
|
message: t3("invalid_number")
|
|
31584
31589
|
});
|
|
@@ -31617,7 +31622,7 @@ var import_react60 = require("react");
|
|
|
31617
31622
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
31618
31623
|
var FloatTimeField = (props) => {
|
|
31619
31624
|
const {
|
|
31620
|
-
name
|
|
31625
|
+
name,
|
|
31621
31626
|
methods,
|
|
31622
31627
|
defaultValue = 0,
|
|
31623
31628
|
isForm = true,
|
|
@@ -31635,7 +31640,7 @@ var FloatTimeField = (props) => {
|
|
|
31635
31640
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
31636
31641
|
Controller,
|
|
31637
31642
|
{
|
|
31638
|
-
name:
|
|
31643
|
+
name: name ?? "",
|
|
31639
31644
|
control: methods?.control,
|
|
31640
31645
|
defaultValue,
|
|
31641
31646
|
rules: {
|
|
@@ -31682,13 +31687,13 @@ var FloatTimeField = (props) => {
|
|
|
31682
31687
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
31683
31688
|
fieldOnChange(floatVal);
|
|
31684
31689
|
if (onChange2) {
|
|
31685
|
-
onChange2(
|
|
31690
|
+
onChange2(name ?? "", floatVal);
|
|
31686
31691
|
}
|
|
31687
31692
|
} else {
|
|
31688
31693
|
setInput("00:00");
|
|
31689
31694
|
fieldOnChange(0);
|
|
31690
31695
|
if (onChange2) {
|
|
31691
|
-
onChange2(
|
|
31696
|
+
onChange2(name ?? "", 0);
|
|
31692
31697
|
}
|
|
31693
31698
|
setErrors("");
|
|
31694
31699
|
}
|
|
@@ -31739,7 +31744,7 @@ var import_react61 = require("react");
|
|
|
31739
31744
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
31740
31745
|
var HtmlField = (props) => {
|
|
31741
31746
|
const {
|
|
31742
|
-
name
|
|
31747
|
+
name,
|
|
31743
31748
|
methods,
|
|
31744
31749
|
readonly = false,
|
|
31745
31750
|
isForm = true,
|
|
@@ -31756,7 +31761,7 @@ var HtmlField = (props) => {
|
|
|
31756
31761
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
31757
31762
|
Controller,
|
|
31758
31763
|
{
|
|
31759
|
-
name:
|
|
31764
|
+
name: name ?? "",
|
|
31760
31765
|
control: methods?.control,
|
|
31761
31766
|
defaultValue,
|
|
31762
31767
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -31789,10 +31794,10 @@ var HtmlField = (props) => {
|
|
|
31789
31794
|
// src/widgets/basic/image-field/image.tsx
|
|
31790
31795
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
31791
31796
|
var ImageField = (props) => {
|
|
31792
|
-
const { value, type, name
|
|
31797
|
+
const { value, type, name, baseURL } = props;
|
|
31793
31798
|
if (!value) return null;
|
|
31794
31799
|
if (type === "url") {
|
|
31795
|
-
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt:
|
|
31800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt: name });
|
|
31796
31801
|
}
|
|
31797
31802
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { id: "qr-code", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("img", { src: `data:image/png;base64,${value}`, alt: "QR Code" }) });
|
|
31798
31803
|
};
|
|
@@ -31894,7 +31899,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31894
31899
|
const {
|
|
31895
31900
|
relation,
|
|
31896
31901
|
value,
|
|
31897
|
-
name
|
|
31902
|
+
name,
|
|
31898
31903
|
methods,
|
|
31899
31904
|
required,
|
|
31900
31905
|
invisible,
|
|
@@ -31935,7 +31940,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31935
31940
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
31936
31941
|
Controller,
|
|
31937
31942
|
{
|
|
31938
|
-
name:
|
|
31943
|
+
name: name ?? "",
|
|
31939
31944
|
control: methods.control,
|
|
31940
31945
|
rules: {
|
|
31941
31946
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31944,7 +31949,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31944
31949
|
const { clearErrors } = methods;
|
|
31945
31950
|
(0, import_react62.useEffect)(() => {
|
|
31946
31951
|
if (field.value) {
|
|
31947
|
-
clearErrors(
|
|
31952
|
+
clearErrors(name);
|
|
31948
31953
|
}
|
|
31949
31954
|
}, [field.value]);
|
|
31950
31955
|
const filteredValue = (0, import_react62.useMemo)(() => {
|
|
@@ -31964,12 +31969,12 @@ var Many2ManyTagField = (props) => {
|
|
|
31964
31969
|
}, [field?.value, options2]);
|
|
31965
31970
|
const handleChange = (selectedOptions) => {
|
|
31966
31971
|
const newValue = transfer(selectedOptions);
|
|
31967
|
-
methods?.setValue(
|
|
31968
|
-
onChange2?.(
|
|
31969
|
-
clearErrors(
|
|
31972
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
31973
|
+
onChange2?.(name ?? "", newValue);
|
|
31974
|
+
clearErrors(name);
|
|
31970
31975
|
newValue.forEach((item, index4) => {
|
|
31971
31976
|
Object.keys(item).forEach((key) => {
|
|
31972
|
-
methods.setValue(`${
|
|
31977
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
31973
31978
|
shouldDirty: true
|
|
31974
31979
|
});
|
|
31975
31980
|
});
|
|
@@ -32094,7 +32099,7 @@ var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
|
32094
32099
|
var MonetaryField = (props) => {
|
|
32095
32100
|
const { t: t3 } = useI18n();
|
|
32096
32101
|
const {
|
|
32097
|
-
name
|
|
32102
|
+
name,
|
|
32098
32103
|
value,
|
|
32099
32104
|
readonly,
|
|
32100
32105
|
required,
|
|
@@ -32111,7 +32116,7 @@ var MonetaryField = (props) => {
|
|
|
32111
32116
|
symbol = "VND",
|
|
32112
32117
|
baseClassName
|
|
32113
32118
|
} = props;
|
|
32114
|
-
if (isForm &&
|
|
32119
|
+
if (isForm && name === "amount_residual") {
|
|
32115
32120
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex justify-end gap-x-4 gap-y-2 ml-auto mt-2 lg:mt-5", children: [
|
|
32116
32121
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "font-semibold", children: [
|
|
32117
32122
|
string,
|
|
@@ -32128,7 +32133,7 @@ var MonetaryField = (props) => {
|
|
|
32128
32133
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
32129
32134
|
Controller,
|
|
32130
32135
|
{
|
|
32131
|
-
name:
|
|
32136
|
+
name: name ?? "",
|
|
32132
32137
|
control: methods.control,
|
|
32133
32138
|
rules: {
|
|
32134
32139
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32141,7 +32146,7 @@ var MonetaryField = (props) => {
|
|
|
32141
32146
|
const { setError, clearErrors } = methods;
|
|
32142
32147
|
(0, import_react63.useEffect)(() => {
|
|
32143
32148
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32144
|
-
clearErrors(
|
|
32149
|
+
clearErrors(name);
|
|
32145
32150
|
}
|
|
32146
32151
|
}, [value2]);
|
|
32147
32152
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
@@ -32152,18 +32157,18 @@ var MonetaryField = (props) => {
|
|
|
32152
32157
|
onBlur: () => {
|
|
32153
32158
|
if (!readonly && !isNaN(value2)) {
|
|
32154
32159
|
onBlur();
|
|
32155
|
-
handleOnchange && handleOnchange(
|
|
32156
|
-
clearErrors(
|
|
32160
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32161
|
+
clearErrors(name);
|
|
32157
32162
|
}
|
|
32158
32163
|
},
|
|
32159
32164
|
onChange: (e3) => {
|
|
32160
32165
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32161
32166
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32162
32167
|
onChange2(parsedValue);
|
|
32163
|
-
clearErrors(
|
|
32168
|
+
clearErrors(name);
|
|
32164
32169
|
} else {
|
|
32165
32170
|
if (required) {
|
|
32166
|
-
setError(
|
|
32171
|
+
setError(name, {
|
|
32167
32172
|
type: "required",
|
|
32168
32173
|
message: `${string} ${t3("must_required")}`
|
|
32169
32174
|
});
|
|
@@ -32278,9 +32283,11 @@ var PriorityField = (props) => {
|
|
|
32278
32283
|
onChange: onChange2,
|
|
32279
32284
|
id,
|
|
32280
32285
|
viewData,
|
|
32281
|
-
model
|
|
32286
|
+
model,
|
|
32287
|
+
name,
|
|
32288
|
+
string
|
|
32282
32289
|
} = props;
|
|
32283
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
32290
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
32284
32291
|
const defaultPriority = parseInt(value) + 1;
|
|
32285
32292
|
if (!isForm) {
|
|
32286
32293
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
@@ -32324,7 +32331,7 @@ var import_react65 = require("react");
|
|
|
32324
32331
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
32325
32332
|
var RadioGroupField = (props) => {
|
|
32326
32333
|
const {
|
|
32327
|
-
name
|
|
32334
|
+
name,
|
|
32328
32335
|
readonly,
|
|
32329
32336
|
required,
|
|
32330
32337
|
placeholder,
|
|
@@ -32336,14 +32343,14 @@ var RadioGroupField = (props) => {
|
|
|
32336
32343
|
} = props;
|
|
32337
32344
|
(0, import_react65.useEffect)(() => {
|
|
32338
32345
|
if (selection?.length > 0) {
|
|
32339
|
-
if (setValue) setValue(
|
|
32346
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32340
32347
|
}
|
|
32341
|
-
}, [selection,
|
|
32348
|
+
}, [selection, name, setValue]);
|
|
32342
32349
|
if (!methods) return null;
|
|
32343
32350
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
32344
32351
|
Controller,
|
|
32345
32352
|
{
|
|
32346
|
-
name:
|
|
32353
|
+
name: name ?? "",
|
|
32347
32354
|
control: methods.control,
|
|
32348
32355
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "widget radio-group-widget flex items-center gap-[10px] pb-4", children: selection?.map((select) => /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
32349
32356
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
@@ -32356,8 +32363,8 @@ var RadioGroupField = (props) => {
|
|
|
32356
32363
|
onChange: (e3) => {
|
|
32357
32364
|
if (readonly) return;
|
|
32358
32365
|
field.onChange(e3.target.value);
|
|
32359
|
-
methods.setValue(
|
|
32360
|
-
onChange2?.(
|
|
32366
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
32367
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
32361
32368
|
},
|
|
32362
32369
|
readOnly: readonly,
|
|
32363
32370
|
required: !invisible && required,
|
|
@@ -32409,7 +32416,7 @@ var SelectDropdownField = (props) => {
|
|
|
32409
32416
|
const { t: t3 } = useI18n();
|
|
32410
32417
|
const {
|
|
32411
32418
|
selection,
|
|
32412
|
-
name
|
|
32419
|
+
name,
|
|
32413
32420
|
methods,
|
|
32414
32421
|
value,
|
|
32415
32422
|
readonly,
|
|
@@ -32432,7 +32439,7 @@ var SelectDropdownField = (props) => {
|
|
|
32432
32439
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
32433
32440
|
Controller,
|
|
32434
32441
|
{
|
|
32435
|
-
name:
|
|
32442
|
+
name: name || "",
|
|
32436
32443
|
control: methods.control,
|
|
32437
32444
|
rules: {
|
|
32438
32445
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32451,7 +32458,7 @@ var SelectDropdownField = (props) => {
|
|
|
32451
32458
|
menuPlacement: "auto",
|
|
32452
32459
|
onChange: (selectedOption) => {
|
|
32453
32460
|
field.onChange(selectedOption.value);
|
|
32454
|
-
onChange2 && onChange2(
|
|
32461
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
32455
32462
|
},
|
|
32456
32463
|
value: defaultValue || null,
|
|
32457
32464
|
required: !invisible && required
|
|
@@ -32532,7 +32539,7 @@ var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
|
32532
32539
|
var TextAreaField = (props) => {
|
|
32533
32540
|
const {
|
|
32534
32541
|
methods,
|
|
32535
|
-
name
|
|
32542
|
+
name,
|
|
32536
32543
|
readonly,
|
|
32537
32544
|
placeholder,
|
|
32538
32545
|
required,
|
|
@@ -32543,7 +32550,7 @@ var TextAreaField = (props) => {
|
|
|
32543
32550
|
onChange: onChange2,
|
|
32544
32551
|
baseClassName
|
|
32545
32552
|
} = props;
|
|
32546
|
-
const formProps = methods ? methods.register(
|
|
32553
|
+
const formProps = methods ? methods.register(name, {
|
|
32547
32554
|
onBlur: (e3) => {
|
|
32548
32555
|
const newValue = e3.target.value;
|
|
32549
32556
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -32565,7 +32572,7 @@ var TextAreaField = (props) => {
|
|
|
32565
32572
|
disabled: readonly,
|
|
32566
32573
|
placeholder,
|
|
32567
32574
|
required: !invisible && required,
|
|
32568
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
32575
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
32569
32576
|
}
|
|
32570
32577
|
);
|
|
32571
32578
|
};
|
|
@@ -32574,7 +32581,7 @@ var TextAreaField = (props) => {
|
|
|
32574
32581
|
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
32575
32582
|
var ToggleButtonField = (props) => {
|
|
32576
32583
|
const {
|
|
32577
|
-
name
|
|
32584
|
+
name,
|
|
32578
32585
|
readonly = false,
|
|
32579
32586
|
required = false,
|
|
32580
32587
|
invisible = false,
|
|
@@ -32584,7 +32591,7 @@ var ToggleButtonField = (props) => {
|
|
|
32584
32591
|
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
32585
32592
|
Controller,
|
|
32586
32593
|
{
|
|
32587
|
-
name:
|
|
32594
|
+
name: name ?? "",
|
|
32588
32595
|
control: methods?.control,
|
|
32589
32596
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "widget toggle-widget inline-flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("label", { className: "relative inline-block w-8 h-5 cursor-pointer", children: [
|
|
32590
32597
|
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
@@ -32594,10 +32601,10 @@ var ToggleButtonField = (props) => {
|
|
|
32594
32601
|
type: "checkbox",
|
|
32595
32602
|
onChange: (e3) => {
|
|
32596
32603
|
if (readonly) return;
|
|
32597
|
-
methods.setValue(
|
|
32604
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
32598
32605
|
field.onChange(e3.target.checked);
|
|
32599
32606
|
if (onChange2) {
|
|
32600
|
-
onChange2(
|
|
32607
|
+
onChange2(name ?? "", e3.target.checked);
|
|
32601
32608
|
}
|
|
32602
32609
|
},
|
|
32603
32610
|
disabled: readonly,
|
|
@@ -32644,7 +32651,7 @@ var import_react66 = require("react");
|
|
|
32644
32651
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
32645
32652
|
var IntegerField = (props) => {
|
|
32646
32653
|
const {
|
|
32647
|
-
name
|
|
32654
|
+
name,
|
|
32648
32655
|
value,
|
|
32649
32656
|
readonly,
|
|
32650
32657
|
placeholder,
|
|
@@ -32666,7 +32673,7 @@ var IntegerField = (props) => {
|
|
|
32666
32673
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
32667
32674
|
Controller,
|
|
32668
32675
|
{
|
|
32669
|
-
name:
|
|
32676
|
+
name: name || "",
|
|
32670
32677
|
control: methods.control,
|
|
32671
32678
|
rules: {
|
|
32672
32679
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32686,12 +32693,12 @@ var IntegerField = (props) => {
|
|
|
32686
32693
|
(0, import_react66.useEffect)(() => {
|
|
32687
32694
|
if (value2 !== void 0 && value2 !== null) {
|
|
32688
32695
|
setInputValue(String(value2));
|
|
32689
|
-
clearErrors(
|
|
32696
|
+
clearErrors(name);
|
|
32690
32697
|
}
|
|
32691
32698
|
}, [value2]);
|
|
32692
32699
|
const noticeError = () => {
|
|
32693
32700
|
if (required) {
|
|
32694
|
-
setError(
|
|
32701
|
+
setError(name, {
|
|
32695
32702
|
type: "required",
|
|
32696
32703
|
message: `${string} ${t3("must_required")}`
|
|
32697
32704
|
});
|
|
@@ -32709,7 +32716,7 @@ var IntegerField = (props) => {
|
|
|
32709
32716
|
if (!isNaN(parsed)) {
|
|
32710
32717
|
fieldOnChange(parsed);
|
|
32711
32718
|
isDirtyRef.current = true;
|
|
32712
|
-
clearErrors(
|
|
32719
|
+
clearErrors(name);
|
|
32713
32720
|
} else {
|
|
32714
32721
|
noticeError();
|
|
32715
32722
|
}
|
|
@@ -32735,11 +32742,11 @@ var IntegerField = (props) => {
|
|
|
32735
32742
|
return;
|
|
32736
32743
|
}
|
|
32737
32744
|
fieldOnChange(parsed);
|
|
32738
|
-
onChange2?.(
|
|
32745
|
+
onChange2?.(name ?? "", parsed);
|
|
32739
32746
|
lastCommittedValueRef.current = parsed;
|
|
32740
32747
|
isDirtyRef.current = false;
|
|
32741
32748
|
inputRef.current?.blur();
|
|
32742
|
-
clearErrors(
|
|
32749
|
+
clearErrors(name);
|
|
32743
32750
|
};
|
|
32744
32751
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
32745
32752
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
@@ -33148,7 +33155,7 @@ var Many2OneField = (props) => {
|
|
|
33148
33155
|
isForm,
|
|
33149
33156
|
isEditTable,
|
|
33150
33157
|
value: propValue,
|
|
33151
|
-
name
|
|
33158
|
+
name,
|
|
33152
33159
|
readonly,
|
|
33153
33160
|
methods,
|
|
33154
33161
|
required,
|
|
@@ -33175,7 +33182,7 @@ var Many2OneField = (props) => {
|
|
|
33175
33182
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33176
33183
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33177
33184
|
allowShowDetail && renderDetail({
|
|
33178
|
-
idToolTip: String(
|
|
33185
|
+
idToolTip: String(name) + Number(index4),
|
|
33179
33186
|
model: options2?.model ?? relation,
|
|
33180
33187
|
context: contextObject,
|
|
33181
33188
|
idForm: id
|
|
@@ -33184,8 +33191,8 @@ var Many2OneField = (props) => {
|
|
|
33184
33191
|
"span",
|
|
33185
33192
|
{
|
|
33186
33193
|
className: "cursor-pointer",
|
|
33187
|
-
"data-tooltip-id": String(
|
|
33188
|
-
id:
|
|
33194
|
+
"data-tooltip-id": String(name) + index4,
|
|
33195
|
+
id: name,
|
|
33189
33196
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33190
33197
|
}
|
|
33191
33198
|
)
|
|
@@ -33193,21 +33200,21 @@ var Many2OneField = (props) => {
|
|
|
33193
33200
|
}
|
|
33194
33201
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33195
33202
|
allowShowDetail && renderDetail({
|
|
33196
|
-
idToolTip: String(
|
|
33203
|
+
idToolTip: String(name),
|
|
33197
33204
|
model: options2?.model ?? relation,
|
|
33198
33205
|
context: contextObject,
|
|
33199
|
-
idForm: methods?.getValues(
|
|
33206
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33200
33207
|
}),
|
|
33201
33208
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33202
33209
|
"div",
|
|
33203
33210
|
{
|
|
33204
|
-
id:
|
|
33205
|
-
"data-tooltip-id":
|
|
33211
|
+
id: name,
|
|
33212
|
+
"data-tooltip-id": name,
|
|
33206
33213
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33207
33214
|
children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33208
33215
|
Controller,
|
|
33209
33216
|
{
|
|
33210
|
-
name:
|
|
33217
|
+
name: name ?? "",
|
|
33211
33218
|
control: methods?.control,
|
|
33212
33219
|
rules: {
|
|
33213
33220
|
required: required ? {
|
|
@@ -33228,7 +33235,7 @@ var Many2OneField = (props) => {
|
|
|
33228
33235
|
) ?? currentValue : currentValue ?? null;
|
|
33229
33236
|
(0, import_react68.useEffect)(() => {
|
|
33230
33237
|
if (error2 && selectedOption) {
|
|
33231
|
-
methods?.clearErrors(
|
|
33238
|
+
methods?.clearErrors(name);
|
|
33232
33239
|
}
|
|
33233
33240
|
}, [selectedOption]);
|
|
33234
33241
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
@@ -33591,7 +33598,7 @@ var ICCheck = () => {
|
|
|
33591
33598
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
33592
33599
|
var DateOptionField = (props) => {
|
|
33593
33600
|
const {
|
|
33594
|
-
name
|
|
33601
|
+
name,
|
|
33595
33602
|
readonly,
|
|
33596
33603
|
required,
|
|
33597
33604
|
invisible,
|
|
@@ -33602,7 +33609,7 @@ var DateOptionField = (props) => {
|
|
|
33602
33609
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
33603
33610
|
Controller,
|
|
33604
33611
|
{
|
|
33605
|
-
name:
|
|
33612
|
+
name: name ?? "",
|
|
33606
33613
|
control: methods?.control,
|
|
33607
33614
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
|
|
33608
33615
|
"label",
|
|
@@ -33623,9 +33630,9 @@ var DateOptionField = (props) => {
|
|
|
33623
33630
|
onChange: (e3) => {
|
|
33624
33631
|
if (readonly) return;
|
|
33625
33632
|
const value = e3.target.checked;
|
|
33626
|
-
methods.setValue(
|
|
33633
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
33627
33634
|
field.onChange(value);
|
|
33628
|
-
onChange2?.(
|
|
33635
|
+
onChange2?.(name ?? "", value);
|
|
33629
33636
|
}
|
|
33630
33637
|
}
|
|
33631
33638
|
),
|