@fctc/sme-widget-ui 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +499 -496
- package/dist/index.mjs +497 -494
- package/dist/widgets.js +499 -496
- package/dist/widgets.mjs +497 -494
- package/package.json +1 -1
package/dist/widgets.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 = {
|
|
@@ -10476,7 +10476,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10476
10476
|
let resetCount = 0;
|
|
10477
10477
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
10478
10478
|
const {
|
|
10479
|
-
name
|
|
10479
|
+
name,
|
|
10480
10480
|
fn
|
|
10481
10481
|
} = validMiddleware[i3];
|
|
10482
10482
|
const {
|
|
@@ -10502,8 +10502,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10502
10502
|
y3 = nextY != null ? nextY : y3;
|
|
10503
10503
|
middlewareData = {
|
|
10504
10504
|
...middlewareData,
|
|
10505
|
-
[
|
|
10506
|
-
...middlewareData[
|
|
10505
|
+
[name]: {
|
|
10506
|
+
...middlewareData[name],
|
|
10507
10507
|
...data
|
|
10508
10508
|
}
|
|
10509
10509
|
};
|
|
@@ -12093,7 +12093,8 @@ var TableHead = (props) => {
|
|
|
12093
12093
|
{
|
|
12094
12094
|
style: {
|
|
12095
12095
|
width: "40px",
|
|
12096
|
-
maxWidth: "40px"
|
|
12096
|
+
maxWidth: "40px",
|
|
12097
|
+
overflow: "unset !important"
|
|
12097
12098
|
},
|
|
12098
12099
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
12099
12100
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -12568,8 +12569,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
12568
12569
|
var isObjectType = (value) => typeof value === "object";
|
|
12569
12570
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
12570
12571
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
12571
|
-
var getNodeParentName = (
|
|
12572
|
-
var isNameInFieldArray = (names,
|
|
12572
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
12573
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
12573
12574
|
var isPlainObject = (tempObject) => {
|
|
12574
12575
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
12575
12576
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -12673,7 +12674,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
12673
12674
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react15.default.useLayoutEffect : import_react15.default.useEffect;
|
|
12674
12675
|
function useFormState(props) {
|
|
12675
12676
|
const methods = useFormContext();
|
|
12676
|
-
const { control = methods.control, disabled, name
|
|
12677
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
12677
12678
|
const [formState, updateFormState] = import_react15.default.useState(control._formState);
|
|
12678
12679
|
const _localProxyFormState = import_react15.default.useRef({
|
|
12679
12680
|
isDirty: false,
|
|
@@ -12686,7 +12687,7 @@ function useFormState(props) {
|
|
|
12686
12687
|
errors: false
|
|
12687
12688
|
});
|
|
12688
12689
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12689
|
-
name
|
|
12690
|
+
name,
|
|
12690
12691
|
formState: _localProxyFormState.current,
|
|
12691
12692
|
exact,
|
|
12692
12693
|
callback: (formState2) => {
|
|
@@ -12695,7 +12696,7 @@ function useFormState(props) {
|
|
|
12695
12696
|
...formState2
|
|
12696
12697
|
});
|
|
12697
12698
|
}
|
|
12698
|
-
}), [
|
|
12699
|
+
}), [name, disabled, exact]);
|
|
12699
12700
|
import_react15.default.useEffect(() => {
|
|
12700
12701
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
12701
12702
|
}, [control]);
|
|
@@ -12747,22 +12748,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
12747
12748
|
}
|
|
12748
12749
|
function useWatch(props) {
|
|
12749
12750
|
const methods = useFormContext();
|
|
12750
|
-
const { control = methods.control, name
|
|
12751
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
12751
12752
|
const _defaultValue = import_react15.default.useRef(defaultValue);
|
|
12752
12753
|
const _compute = import_react15.default.useRef(compute);
|
|
12753
12754
|
const _computeFormValues = import_react15.default.useRef(void 0);
|
|
12754
12755
|
_compute.current = compute;
|
|
12755
|
-
const defaultValueMemo = import_react15.default.useMemo(() => control._getWatch(
|
|
12756
|
+
const defaultValueMemo = import_react15.default.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
12756
12757
|
const [value, updateValue] = import_react15.default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
12757
12758
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12758
|
-
name
|
|
12759
|
+
name,
|
|
12759
12760
|
formState: {
|
|
12760
12761
|
values: true
|
|
12761
12762
|
},
|
|
12762
12763
|
exact,
|
|
12763
12764
|
callback: (formState) => {
|
|
12764
12765
|
if (!disabled) {
|
|
12765
|
-
const formValues = generateWatchOutput(
|
|
12766
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
12766
12767
|
if (_compute.current) {
|
|
12767
12768
|
const computedFormValues = _compute.current(formValues);
|
|
12768
12769
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -12774,28 +12775,28 @@ function useWatch(props) {
|
|
|
12774
12775
|
}
|
|
12775
12776
|
}
|
|
12776
12777
|
}
|
|
12777
|
-
}), [control, disabled,
|
|
12778
|
+
}), [control, disabled, name, exact]);
|
|
12778
12779
|
import_react15.default.useEffect(() => control._removeUnmounted());
|
|
12779
12780
|
return value;
|
|
12780
12781
|
}
|
|
12781
12782
|
function useController(props) {
|
|
12782
12783
|
const methods = useFormContext();
|
|
12783
|
-
const { name
|
|
12784
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
12785
|
-
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]);
|
|
12786
12787
|
const value = useWatch({
|
|
12787
12788
|
control,
|
|
12788
|
-
name
|
|
12789
|
+
name,
|
|
12789
12790
|
defaultValue: defaultValueMemo,
|
|
12790
12791
|
exact: true
|
|
12791
12792
|
});
|
|
12792
12793
|
const formState = useFormState({
|
|
12793
12794
|
control,
|
|
12794
|
-
name
|
|
12795
|
+
name,
|
|
12795
12796
|
exact: true
|
|
12796
12797
|
});
|
|
12797
12798
|
const _props = import_react15.default.useRef(props);
|
|
12798
|
-
const _registerProps = import_react15.default.useRef(control.register(
|
|
12799
|
+
const _registerProps = import_react15.default.useRef(control.register(name, {
|
|
12799
12800
|
...props.rules,
|
|
12800
12801
|
value,
|
|
12801
12802
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -12804,41 +12805,41 @@ function useController(props) {
|
|
|
12804
12805
|
const fieldState = import_react15.default.useMemo(() => Object.defineProperties({}, {
|
|
12805
12806
|
invalid: {
|
|
12806
12807
|
enumerable: true,
|
|
12807
|
-
get: () => !!get2(formState.errors,
|
|
12808
|
+
get: () => !!get2(formState.errors, name)
|
|
12808
12809
|
},
|
|
12809
12810
|
isDirty: {
|
|
12810
12811
|
enumerable: true,
|
|
12811
|
-
get: () => !!get2(formState.dirtyFields,
|
|
12812
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
12812
12813
|
},
|
|
12813
12814
|
isTouched: {
|
|
12814
12815
|
enumerable: true,
|
|
12815
|
-
get: () => !!get2(formState.touchedFields,
|
|
12816
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
12816
12817
|
},
|
|
12817
12818
|
isValidating: {
|
|
12818
12819
|
enumerable: true,
|
|
12819
|
-
get: () => !!get2(formState.validatingFields,
|
|
12820
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
12820
12821
|
},
|
|
12821
12822
|
error: {
|
|
12822
12823
|
enumerable: true,
|
|
12823
|
-
get: () => get2(formState.errors,
|
|
12824
|
+
get: () => get2(formState.errors, name)
|
|
12824
12825
|
}
|
|
12825
|
-
}), [formState,
|
|
12826
|
+
}), [formState, name]);
|
|
12826
12827
|
const onChange2 = import_react15.default.useCallback((event) => _registerProps.current.onChange({
|
|
12827
12828
|
target: {
|
|
12828
12829
|
value: getEventValue(event),
|
|
12829
|
-
name
|
|
12830
|
+
name
|
|
12830
12831
|
},
|
|
12831
12832
|
type: EVENTS.CHANGE
|
|
12832
|
-
}), [
|
|
12833
|
+
}), [name]);
|
|
12833
12834
|
const onBlur = import_react15.default.useCallback(() => _registerProps.current.onBlur({
|
|
12834
12835
|
target: {
|
|
12835
|
-
value: get2(control._formValues,
|
|
12836
|
-
name
|
|
12836
|
+
value: get2(control._formValues, name),
|
|
12837
|
+
name
|
|
12837
12838
|
},
|
|
12838
12839
|
type: EVENTS.BLUR
|
|
12839
|
-
}), [
|
|
12840
|
+
}), [name, control._formValues]);
|
|
12840
12841
|
const ref = import_react15.default.useCallback((elm) => {
|
|
12841
|
-
const field2 = get2(control._fields,
|
|
12842
|
+
const field2 = get2(control._fields, name);
|
|
12842
12843
|
if (field2 && elm) {
|
|
12843
12844
|
field2._f.ref = {
|
|
12844
12845
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -12847,46 +12848,46 @@ function useController(props) {
|
|
|
12847
12848
|
reportValidity: () => elm.reportValidity()
|
|
12848
12849
|
};
|
|
12849
12850
|
}
|
|
12850
|
-
}, [control._fields,
|
|
12851
|
+
}, [control._fields, name]);
|
|
12851
12852
|
const field = import_react15.default.useMemo(() => ({
|
|
12852
|
-
name
|
|
12853
|
+
name,
|
|
12853
12854
|
value,
|
|
12854
12855
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
12855
12856
|
onChange: onChange2,
|
|
12856
12857
|
onBlur,
|
|
12857
12858
|
ref
|
|
12858
|
-
}), [
|
|
12859
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
12859
12860
|
import_react15.default.useEffect(() => {
|
|
12860
12861
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
12861
|
-
control.register(
|
|
12862
|
+
control.register(name, {
|
|
12862
12863
|
..._props.current.rules,
|
|
12863
12864
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
12864
12865
|
});
|
|
12865
|
-
const updateMounted = (
|
|
12866
|
-
const field2 = get2(control._fields,
|
|
12866
|
+
const updateMounted = (name2, value2) => {
|
|
12867
|
+
const field2 = get2(control._fields, name2);
|
|
12867
12868
|
if (field2 && field2._f) {
|
|
12868
12869
|
field2._f.mount = value2;
|
|
12869
12870
|
}
|
|
12870
12871
|
};
|
|
12871
|
-
updateMounted(
|
|
12872
|
+
updateMounted(name, true);
|
|
12872
12873
|
if (_shouldUnregisterField) {
|
|
12873
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
12874
|
-
set(control._defaultValues,
|
|
12875
|
-
if (isUndefined(get2(control._formValues,
|
|
12876
|
-
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);
|
|
12877
12878
|
}
|
|
12878
12879
|
}
|
|
12879
|
-
!isArrayField && control.register(
|
|
12880
|
+
!isArrayField && control.register(name);
|
|
12880
12881
|
return () => {
|
|
12881
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
12882
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
12882
12883
|
};
|
|
12883
|
-
}, [
|
|
12884
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
12884
12885
|
import_react15.default.useEffect(() => {
|
|
12885
12886
|
control._setDisabledField({
|
|
12886
12887
|
disabled,
|
|
12887
|
-
name
|
|
12888
|
+
name
|
|
12888
12889
|
});
|
|
12889
|
-
}, [disabled,
|
|
12890
|
+
}, [disabled, name, control]);
|
|
12890
12891
|
return import_react15.default.useMemo(() => ({
|
|
12891
12892
|
field,
|
|
12892
12893
|
formState,
|
|
@@ -12894,10 +12895,10 @@ function useController(props) {
|
|
|
12894
12895
|
}), [field, formState, fieldState]);
|
|
12895
12896
|
}
|
|
12896
12897
|
var Controller = (props) => props.render(useController(props));
|
|
12897
|
-
var appendErrors = (
|
|
12898
|
-
...errors[
|
|
12898
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
12899
|
+
...errors[name],
|
|
12899
12900
|
types: {
|
|
12900
|
-
...errors[
|
|
12901
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
12901
12902
|
[type]: message2 || true
|
|
12902
12903
|
}
|
|
12903
12904
|
} : {};
|
|
@@ -13057,9 +13058,9 @@ function getFieldValue(_f) {
|
|
|
13057
13058
|
}
|
|
13058
13059
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
13059
13060
|
const fields = {};
|
|
13060
|
-
for (const
|
|
13061
|
-
const field = get2(_fields,
|
|
13062
|
-
field && set(fields,
|
|
13061
|
+
for (const name of fieldsNames) {
|
|
13062
|
+
const field = get2(_fields, name);
|
|
13063
|
+
field && set(fields, name, field._f);
|
|
13063
13064
|
}
|
|
13064
13065
|
return {
|
|
13065
13066
|
criteriaMode,
|
|
@@ -13080,7 +13081,7 @@ var getValidationModes = (mode) => ({
|
|
|
13080
13081
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
13081
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));
|
|
13082
13083
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
13083
|
-
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))));
|
|
13084
13085
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
13085
13086
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
13086
13087
|
const field = get2(fields, key);
|
|
@@ -13105,21 +13106,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
13105
13106
|
}
|
|
13106
13107
|
return;
|
|
13107
13108
|
};
|
|
13108
|
-
function schemaErrorLookup(errors, _fields,
|
|
13109
|
-
const error2 = get2(errors,
|
|
13110
|
-
if (error2 || isKey(
|
|
13109
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
13110
|
+
const error2 = get2(errors, name);
|
|
13111
|
+
if (error2 || isKey(name)) {
|
|
13111
13112
|
return {
|
|
13112
13113
|
error: error2,
|
|
13113
|
-
name
|
|
13114
|
+
name
|
|
13114
13115
|
};
|
|
13115
13116
|
}
|
|
13116
|
-
const names =
|
|
13117
|
+
const names = name.split(".");
|
|
13117
13118
|
while (names.length) {
|
|
13118
13119
|
const fieldName = names.join(".");
|
|
13119
13120
|
const field = get2(_fields, fieldName);
|
|
13120
13121
|
const foundError = get2(errors, fieldName);
|
|
13121
|
-
if (field && !Array.isArray(field) &&
|
|
13122
|
-
return { name
|
|
13122
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
13123
|
+
return { name };
|
|
13123
13124
|
}
|
|
13124
13125
|
if (foundError && foundError.type) {
|
|
13125
13126
|
return {
|
|
@@ -13136,15 +13137,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
13136
13137
|
names.pop();
|
|
13137
13138
|
}
|
|
13138
13139
|
return {
|
|
13139
|
-
name
|
|
13140
|
+
name
|
|
13140
13141
|
};
|
|
13141
13142
|
}
|
|
13142
13143
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
13143
13144
|
updateFormState(formStateData);
|
|
13144
|
-
const { name
|
|
13145
|
+
const { name, ...formState } = formStateData;
|
|
13145
13146
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
13146
13147
|
};
|
|
13147
|
-
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)));
|
|
13148
13149
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
13149
13150
|
if (mode.isOnAll) {
|
|
13150
13151
|
return false;
|
|
@@ -13157,11 +13158,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
13157
13158
|
}
|
|
13158
13159
|
return true;
|
|
13159
13160
|
};
|
|
13160
|
-
var unsetEmptyArray = (ref,
|
|
13161
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
13162
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
13163
|
-
set(fieldArrayErrors, "root", error2[
|
|
13164
|
-
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);
|
|
13165
13166
|
return errors;
|
|
13166
13167
|
};
|
|
13167
13168
|
var isMessage = (value) => isString3(value);
|
|
@@ -13179,9 +13180,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
13179
13180
|
message: ""
|
|
13180
13181
|
};
|
|
13181
13182
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
13182
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
13183
|
-
const inputValue = get2(formValues,
|
|
13184
|
-
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)) {
|
|
13185
13186
|
return {};
|
|
13186
13187
|
}
|
|
13187
13188
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -13196,10 +13197,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13196
13197
|
const isCheckBox = isCheckBoxInput(ref);
|
|
13197
13198
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
13198
13199
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
13199
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
13200
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
13200
13201
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
13201
13202
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
13202
|
-
error2[
|
|
13203
|
+
error2[name] = {
|
|
13203
13204
|
type: exceedMax ? maxType : minType,
|
|
13204
13205
|
message: message2,
|
|
13205
13206
|
ref,
|
|
@@ -13209,7 +13210,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13209
13210
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
13210
13211
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
13211
13212
|
if (value) {
|
|
13212
|
-
error2[
|
|
13213
|
+
error2[name] = {
|
|
13213
13214
|
type: INPUT_VALIDATION_RULES.required,
|
|
13214
13215
|
message: message2,
|
|
13215
13216
|
ref: inputRef,
|
|
@@ -13249,7 +13250,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13249
13250
|
if (exceedMax || exceedMin) {
|
|
13250
13251
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
13251
13252
|
if (!validateAllFieldCriteria) {
|
|
13252
|
-
setCustomValidity(error2[
|
|
13253
|
+
setCustomValidity(error2[name].message);
|
|
13253
13254
|
return error2;
|
|
13254
13255
|
}
|
|
13255
13256
|
}
|
|
@@ -13262,7 +13263,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13262
13263
|
if (exceedMax || exceedMin) {
|
|
13263
13264
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
13264
13265
|
if (!validateAllFieldCriteria) {
|
|
13265
|
-
setCustomValidity(error2[
|
|
13266
|
+
setCustomValidity(error2[name].message);
|
|
13266
13267
|
return error2;
|
|
13267
13268
|
}
|
|
13268
13269
|
}
|
|
@@ -13270,7 +13271,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13270
13271
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
13271
13272
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
13272
13273
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
13273
|
-
error2[
|
|
13274
|
+
error2[name] = {
|
|
13274
13275
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
13275
13276
|
message: message2,
|
|
13276
13277
|
ref,
|
|
@@ -13287,7 +13288,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13287
13288
|
const result = await validate(inputValue, formValues);
|
|
13288
13289
|
const validateError = getValidateError(result, inputRef);
|
|
13289
13290
|
if (validateError) {
|
|
13290
|
-
error2[
|
|
13291
|
+
error2[name] = {
|
|
13291
13292
|
...validateError,
|
|
13292
13293
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
13293
13294
|
};
|
|
@@ -13310,12 +13311,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13310
13311
|
};
|
|
13311
13312
|
setCustomValidity(validateError.message);
|
|
13312
13313
|
if (validateAllFieldCriteria) {
|
|
13313
|
-
error2[
|
|
13314
|
+
error2[name] = validationResult;
|
|
13314
13315
|
}
|
|
13315
13316
|
}
|
|
13316
13317
|
}
|
|
13317
13318
|
if (!isEmptyObject(validationResult)) {
|
|
13318
|
-
error2[
|
|
13319
|
+
error2[name] = {
|
|
13319
13320
|
ref: inputRef,
|
|
13320
13321
|
...validationResult
|
|
13321
13322
|
};
|
|
@@ -13404,9 +13405,9 @@ function createFormControl(props = {}) {
|
|
|
13404
13405
|
};
|
|
13405
13406
|
const _updateIsValidating = (names, isValidating) => {
|
|
13406
13407
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
13407
|
-
(names || Array.from(_names.mount)).forEach((
|
|
13408
|
-
if (
|
|
13409
|
-
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);
|
|
13410
13411
|
}
|
|
13411
13412
|
});
|
|
13412
13413
|
_subjects.state.next({
|
|
@@ -13415,38 +13416,38 @@ function createFormControl(props = {}) {
|
|
|
13415
13416
|
});
|
|
13416
13417
|
}
|
|
13417
13418
|
};
|
|
13418
|
-
const _setFieldArray = (
|
|
13419
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
13419
13420
|
if (args && method && !_options.disabled) {
|
|
13420
13421
|
_state.action = true;
|
|
13421
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
13422
|
-
const fieldValues = method(get2(_fields,
|
|
13423
|
-
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);
|
|
13424
13425
|
}
|
|
13425
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
13426
|
-
const errors = method(get2(_formState.errors,
|
|
13427
|
-
shouldSetValues && set(_formState.errors,
|
|
13428
|
-
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);
|
|
13429
13430
|
}
|
|
13430
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
13431
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
13432
|
-
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);
|
|
13433
13434
|
}
|
|
13434
13435
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
13435
13436
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
13436
13437
|
}
|
|
13437
13438
|
_subjects.state.next({
|
|
13438
|
-
name
|
|
13439
|
-
isDirty: _getDirty(
|
|
13439
|
+
name,
|
|
13440
|
+
isDirty: _getDirty(name, values),
|
|
13440
13441
|
dirtyFields: _formState.dirtyFields,
|
|
13441
13442
|
errors: _formState.errors,
|
|
13442
13443
|
isValid: _formState.isValid
|
|
13443
13444
|
});
|
|
13444
13445
|
} else {
|
|
13445
|
-
set(_formValues,
|
|
13446
|
+
set(_formValues, name, values);
|
|
13446
13447
|
}
|
|
13447
13448
|
};
|
|
13448
|
-
const updateErrors = (
|
|
13449
|
-
set(_formState.errors,
|
|
13449
|
+
const updateErrors = (name, error2) => {
|
|
13450
|
+
set(_formState.errors, name, error2);
|
|
13450
13451
|
_subjects.state.next({
|
|
13451
13452
|
errors: _formState.errors
|
|
13452
13453
|
});
|
|
@@ -13458,19 +13459,19 @@ function createFormControl(props = {}) {
|
|
|
13458
13459
|
isValid: false
|
|
13459
13460
|
});
|
|
13460
13461
|
};
|
|
13461
|
-
const updateValidAndValue = (
|
|
13462
|
-
const field = get2(_fields,
|
|
13462
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
13463
|
+
const field = get2(_fields, name);
|
|
13463
13464
|
if (field) {
|
|
13464
|
-
const defaultValue = get2(_formValues,
|
|
13465
|
-
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);
|
|
13466
13467
|
_state.mount && _setValid();
|
|
13467
13468
|
}
|
|
13468
13469
|
};
|
|
13469
|
-
const updateTouchAndDirty = (
|
|
13470
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
13470
13471
|
let shouldUpdateField = false;
|
|
13471
13472
|
let isPreviousDirty = false;
|
|
13472
13473
|
const output = {
|
|
13473
|
-
name
|
|
13474
|
+
name
|
|
13474
13475
|
};
|
|
13475
13476
|
if (!_options.disabled) {
|
|
13476
13477
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -13479,16 +13480,16 @@ function createFormControl(props = {}) {
|
|
|
13479
13480
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
13480
13481
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
13481
13482
|
}
|
|
13482
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
13483
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
13484
|
-
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);
|
|
13485
13486
|
output.dirtyFields = _formState.dirtyFields;
|
|
13486
13487
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
13487
13488
|
}
|
|
13488
13489
|
if (isBlurEvent) {
|
|
13489
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
13490
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
13490
13491
|
if (!isPreviousFieldTouched) {
|
|
13491
|
-
set(_formState.touchedFields,
|
|
13492
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
13492
13493
|
output.touchedFields = _formState.touchedFields;
|
|
13493
13494
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
13494
13495
|
}
|
|
@@ -13497,23 +13498,23 @@ function createFormControl(props = {}) {
|
|
|
13497
13498
|
}
|
|
13498
13499
|
return shouldUpdateField ? output : {};
|
|
13499
13500
|
};
|
|
13500
|
-
const shouldRenderByError = (
|
|
13501
|
-
const previousFieldError = get2(_formState.errors,
|
|
13501
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
13502
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
13502
13503
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
13503
13504
|
if (_options.delayError && error2) {
|
|
13504
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
13505
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
13505
13506
|
delayErrorCallback(_options.delayError);
|
|
13506
13507
|
} else {
|
|
13507
13508
|
clearTimeout(timer);
|
|
13508
13509
|
delayErrorCallback = null;
|
|
13509
|
-
error2 ? set(_formState.errors,
|
|
13510
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
13510
13511
|
}
|
|
13511
13512
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
13512
13513
|
const updatedFormState = {
|
|
13513
13514
|
...fieldState,
|
|
13514
13515
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
13515
13516
|
errors: _formState.errors,
|
|
13516
|
-
name
|
|
13517
|
+
name
|
|
13517
13518
|
};
|
|
13518
13519
|
_formState = {
|
|
13519
13520
|
..._formState,
|
|
@@ -13522,18 +13523,18 @@ function createFormControl(props = {}) {
|
|
|
13522
13523
|
_subjects.state.next(updatedFormState);
|
|
13523
13524
|
}
|
|
13524
13525
|
};
|
|
13525
|
-
const _runSchema = async (
|
|
13526
|
-
_updateIsValidating(
|
|
13527
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
13528
|
-
_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);
|
|
13529
13530
|
return result;
|
|
13530
13531
|
};
|
|
13531
13532
|
const executeSchemaAndUpdateState = async (names) => {
|
|
13532
13533
|
const { errors } = await _runSchema(names);
|
|
13533
13534
|
if (names) {
|
|
13534
|
-
for (const
|
|
13535
|
-
const error2 = get2(errors,
|
|
13536
|
-
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);
|
|
13537
13538
|
}
|
|
13538
13539
|
} else {
|
|
13539
13540
|
_formState.errors = errors;
|
|
@@ -13543,19 +13544,19 @@ function createFormControl(props = {}) {
|
|
|
13543
13544
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
13544
13545
|
valid: true
|
|
13545
13546
|
}) => {
|
|
13546
|
-
for (const
|
|
13547
|
-
const field = fields[
|
|
13547
|
+
for (const name in fields) {
|
|
13548
|
+
const field = fields[name];
|
|
13548
13549
|
if (field) {
|
|
13549
13550
|
const { _f, ...fieldValue } = field;
|
|
13550
13551
|
if (_f) {
|
|
13551
13552
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
13552
13553
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
13553
13554
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13554
|
-
_updateIsValidating([
|
|
13555
|
+
_updateIsValidating([name], true);
|
|
13555
13556
|
}
|
|
13556
13557
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
13557
13558
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13558
|
-
_updateIsValidating([
|
|
13559
|
+
_updateIsValidating([name]);
|
|
13559
13560
|
}
|
|
13560
13561
|
if (fieldError[_f.name]) {
|
|
13561
13562
|
context.valid = false;
|
|
@@ -13571,24 +13572,24 @@ function createFormControl(props = {}) {
|
|
|
13571
13572
|
return context.valid;
|
|
13572
13573
|
};
|
|
13573
13574
|
const _removeUnmounted = () => {
|
|
13574
|
-
for (const
|
|
13575
|
-
const field = get2(_fields,
|
|
13576
|
-
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);
|
|
13577
13578
|
}
|
|
13578
13579
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
13579
13580
|
};
|
|
13580
|
-
const _getDirty = (
|
|
13581
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
13581
13582
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
13582
13583
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
13583
13584
|
}, isGlobal, defaultValue);
|
|
13584
|
-
const _getFieldArray = (
|
|
13585
|
-
const setFieldValue = (
|
|
13586
|
-
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);
|
|
13587
13588
|
let fieldValue = value;
|
|
13588
13589
|
if (field) {
|
|
13589
13590
|
const fieldReference = field._f;
|
|
13590
13591
|
if (fieldReference) {
|
|
13591
|
-
!fieldReference.disabled && set(_formValues,
|
|
13592
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
13592
13593
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
13593
13594
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
13594
13595
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -13612,61 +13613,61 @@ function createFormControl(props = {}) {
|
|
|
13612
13613
|
fieldReference.ref.value = fieldValue;
|
|
13613
13614
|
if (!fieldReference.ref.type) {
|
|
13614
13615
|
_subjects.state.next({
|
|
13615
|
-
name
|
|
13616
|
+
name,
|
|
13616
13617
|
values: cloneObject(_formValues)
|
|
13617
13618
|
});
|
|
13618
13619
|
}
|
|
13619
13620
|
}
|
|
13620
13621
|
}
|
|
13621
13622
|
}
|
|
13622
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
13623
|
-
options2.shouldValidate && trigger(
|
|
13623
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
13624
|
+
options2.shouldValidate && trigger(name);
|
|
13624
13625
|
};
|
|
13625
|
-
const setValues = (
|
|
13626
|
+
const setValues = (name, value, options2) => {
|
|
13626
13627
|
for (const fieldKey in value) {
|
|
13627
13628
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
13628
13629
|
return;
|
|
13629
13630
|
}
|
|
13630
13631
|
const fieldValue = value[fieldKey];
|
|
13631
|
-
const fieldName =
|
|
13632
|
+
const fieldName = name + "." + fieldKey;
|
|
13632
13633
|
const field = get2(_fields, fieldName);
|
|
13633
|
-
(_names.array.has(
|
|
13634
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
13634
13635
|
}
|
|
13635
13636
|
};
|
|
13636
|
-
const setValue = (
|
|
13637
|
-
const field = get2(_fields,
|
|
13638
|
-
const isFieldArray = _names.array.has(
|
|
13637
|
+
const setValue = (name, value, options2 = {}) => {
|
|
13638
|
+
const field = get2(_fields, name);
|
|
13639
|
+
const isFieldArray = _names.array.has(name);
|
|
13639
13640
|
const cloneValue = cloneObject(value);
|
|
13640
|
-
set(_formValues,
|
|
13641
|
+
set(_formValues, name, cloneValue);
|
|
13641
13642
|
if (isFieldArray) {
|
|
13642
13643
|
_subjects.array.next({
|
|
13643
|
-
name
|
|
13644
|
+
name,
|
|
13644
13645
|
values: cloneObject(_formValues)
|
|
13645
13646
|
});
|
|
13646
13647
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
13647
13648
|
_subjects.state.next({
|
|
13648
|
-
name
|
|
13649
|
+
name,
|
|
13649
13650
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
13650
|
-
isDirty: _getDirty(
|
|
13651
|
+
isDirty: _getDirty(name, cloneValue)
|
|
13651
13652
|
});
|
|
13652
13653
|
}
|
|
13653
13654
|
} else {
|
|
13654
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
13655
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
13655
13656
|
}
|
|
13656
|
-
isWatched(
|
|
13657
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
13657
13658
|
_subjects.state.next({
|
|
13658
|
-
name: _state.mount ?
|
|
13659
|
+
name: _state.mount ? name : void 0,
|
|
13659
13660
|
values: cloneObject(_formValues)
|
|
13660
13661
|
});
|
|
13661
13662
|
};
|
|
13662
13663
|
const onChange2 = async (event) => {
|
|
13663
13664
|
_state.mount = true;
|
|
13664
13665
|
const target = event.target;
|
|
13665
|
-
let
|
|
13666
|
+
let name = target.name;
|
|
13666
13667
|
let isFieldValueUpdated = true;
|
|
13667
|
-
const field = get2(_fields,
|
|
13668
|
+
const field = get2(_fields, name);
|
|
13668
13669
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
13669
|
-
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));
|
|
13670
13671
|
};
|
|
13671
13672
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
13672
13673
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -13675,9 +13676,9 @@ function createFormControl(props = {}) {
|
|
|
13675
13676
|
let isValid3;
|
|
13676
13677
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
13677
13678
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
13678
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
13679
|
-
const watched = isWatched(
|
|
13680
|
-
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);
|
|
13681
13682
|
if (isBlurEvent) {
|
|
13682
13683
|
if (!target || !target.readOnly) {
|
|
13683
13684
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -13686,10 +13687,10 @@ function createFormControl(props = {}) {
|
|
|
13686
13687
|
} else if (field._f.onChange) {
|
|
13687
13688
|
field._f.onChange(event);
|
|
13688
13689
|
}
|
|
13689
|
-
const fieldState = updateTouchAndDirty(
|
|
13690
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
13690
13691
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
13691
13692
|
!isBlurEvent && _subjects.state.next({
|
|
13692
|
-
name
|
|
13693
|
+
name,
|
|
13693
13694
|
type: event.type,
|
|
13694
13695
|
values: cloneObject(_formValues)
|
|
13695
13696
|
});
|
|
@@ -13703,23 +13704,23 @@ function createFormControl(props = {}) {
|
|
|
13703
13704
|
_setValid();
|
|
13704
13705
|
}
|
|
13705
13706
|
}
|
|
13706
|
-
return shouldRender && _subjects.state.next({ name
|
|
13707
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
13707
13708
|
}
|
|
13708
13709
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
13709
13710
|
if (_options.resolver) {
|
|
13710
|
-
const { errors } = await _runSchema([
|
|
13711
|
+
const { errors } = await _runSchema([name]);
|
|
13711
13712
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13712
13713
|
if (isFieldValueUpdated) {
|
|
13713
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
13714
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
13714
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
13715
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
13715
13716
|
error2 = errorLookupResult.error;
|
|
13716
|
-
|
|
13717
|
+
name = errorLookupResult.name;
|
|
13717
13718
|
isValid3 = isEmptyObject(errors);
|
|
13718
13719
|
}
|
|
13719
13720
|
} else {
|
|
13720
|
-
_updateIsValidating([
|
|
13721
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
13722
|
-
_updateIsValidating([
|
|
13721
|
+
_updateIsValidating([name], true);
|
|
13722
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
13723
|
+
_updateIsValidating([name]);
|
|
13723
13724
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13724
13725
|
if (isFieldValueUpdated) {
|
|
13725
13726
|
if (error2) {
|
|
@@ -13731,7 +13732,7 @@ function createFormControl(props = {}) {
|
|
|
13731
13732
|
}
|
|
13732
13733
|
if (isFieldValueUpdated) {
|
|
13733
13734
|
field._f.deps && trigger(field._f.deps);
|
|
13734
|
-
shouldRenderByError(
|
|
13735
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
13735
13736
|
}
|
|
13736
13737
|
}
|
|
13737
13738
|
};
|
|
@@ -13742,15 +13743,15 @@ function createFormControl(props = {}) {
|
|
|
13742
13743
|
}
|
|
13743
13744
|
return;
|
|
13744
13745
|
};
|
|
13745
|
-
const trigger = async (
|
|
13746
|
+
const trigger = async (name, options2 = {}) => {
|
|
13746
13747
|
let isValid3;
|
|
13747
13748
|
let validationResult;
|
|
13748
|
-
const fieldNames = convertToArrayPayload(
|
|
13749
|
+
const fieldNames = convertToArrayPayload(name);
|
|
13749
13750
|
if (_options.resolver) {
|
|
13750
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
13751
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
13751
13752
|
isValid3 = isEmptyObject(errors);
|
|
13752
|
-
validationResult =
|
|
13753
|
-
} else if (
|
|
13753
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
13754
|
+
} else if (name) {
|
|
13754
13755
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
13755
13756
|
const field = get2(_fields, fieldName);
|
|
13756
13757
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -13760,51 +13761,51 @@ function createFormControl(props = {}) {
|
|
|
13760
13761
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
13761
13762
|
}
|
|
13762
13763
|
_subjects.state.next({
|
|
13763
|
-
...!isString3(
|
|
13764
|
-
..._options.resolver || !
|
|
13764
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
13765
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
13765
13766
|
errors: _formState.errors
|
|
13766
13767
|
});
|
|
13767
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
13768
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
13768
13769
|
return validationResult;
|
|
13769
13770
|
};
|
|
13770
13771
|
const getValues = (fieldNames) => {
|
|
13771
13772
|
const values = {
|
|
13772
13773
|
..._state.mount ? _formValues : _defaultValues
|
|
13773
13774
|
};
|
|
13774
|
-
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));
|
|
13775
13776
|
};
|
|
13776
|
-
const getFieldState = (
|
|
13777
|
-
invalid: !!get2((formState || _formState).errors,
|
|
13778
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
13779
|
-
error: get2((formState || _formState).errors,
|
|
13780
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
13781
|
-
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)
|
|
13782
13783
|
});
|
|
13783
|
-
const clearErrors = (
|
|
13784
|
-
|
|
13784
|
+
const clearErrors = (name) => {
|
|
13785
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
13785
13786
|
_subjects.state.next({
|
|
13786
|
-
errors:
|
|
13787
|
+
errors: name ? _formState.errors : {}
|
|
13787
13788
|
});
|
|
13788
13789
|
};
|
|
13789
|
-
const setError = (
|
|
13790
|
-
const ref = (get2(_fields,
|
|
13791
|
-
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) || {};
|
|
13792
13793
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
13793
|
-
set(_formState.errors,
|
|
13794
|
+
set(_formState.errors, name, {
|
|
13794
13795
|
...restOfErrorTree,
|
|
13795
13796
|
...error2,
|
|
13796
13797
|
ref
|
|
13797
13798
|
});
|
|
13798
13799
|
_subjects.state.next({
|
|
13799
|
-
name
|
|
13800
|
+
name,
|
|
13800
13801
|
errors: _formState.errors,
|
|
13801
13802
|
isValid: false
|
|
13802
13803
|
});
|
|
13803
13804
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
13804
13805
|
};
|
|
13805
|
-
const watch = (
|
|
13806
|
-
next: (payload) => "values" in payload &&
|
|
13807
|
-
}) : _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);
|
|
13808
13809
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
13809
13810
|
next: (formState) => {
|
|
13810
13811
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -13828,8 +13829,8 @@ function createFormControl(props = {}) {
|
|
|
13828
13829
|
formState: _proxySubscribeFormState
|
|
13829
13830
|
});
|
|
13830
13831
|
};
|
|
13831
|
-
const unregister = (
|
|
13832
|
-
for (const fieldName of
|
|
13832
|
+
const unregister = (name, options2 = {}) => {
|
|
13833
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
13833
13834
|
_names.mount.delete(fieldName);
|
|
13834
13835
|
_names.array.delete(fieldName);
|
|
13835
13836
|
if (!options2.keepValue) {
|
|
@@ -13851,31 +13852,31 @@ function createFormControl(props = {}) {
|
|
|
13851
13852
|
});
|
|
13852
13853
|
!options2.keepIsValid && _setValid();
|
|
13853
13854
|
};
|
|
13854
|
-
const _setDisabledField = ({ disabled, name
|
|
13855
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
13856
|
-
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);
|
|
13857
13858
|
}
|
|
13858
13859
|
};
|
|
13859
|
-
const register = (
|
|
13860
|
-
let field = get2(_fields,
|
|
13860
|
+
const register = (name, options2 = {}) => {
|
|
13861
|
+
let field = get2(_fields, name);
|
|
13861
13862
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
13862
|
-
set(_fields,
|
|
13863
|
+
set(_fields, name, {
|
|
13863
13864
|
...field || {},
|
|
13864
13865
|
_f: {
|
|
13865
|
-
...field && field._f ? field._f : { ref: { name
|
|
13866
|
-
name
|
|
13866
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
13867
|
+
name,
|
|
13867
13868
|
mount: true,
|
|
13868
13869
|
...options2
|
|
13869
13870
|
}
|
|
13870
13871
|
});
|
|
13871
|
-
_names.mount.add(
|
|
13872
|
+
_names.mount.add(name);
|
|
13872
13873
|
if (field) {
|
|
13873
13874
|
_setDisabledField({
|
|
13874
13875
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
13875
|
-
name
|
|
13876
|
+
name
|
|
13876
13877
|
});
|
|
13877
13878
|
} else {
|
|
13878
|
-
updateValidAndValue(
|
|
13879
|
+
updateValidAndValue(name, true, options2.value);
|
|
13879
13880
|
}
|
|
13880
13881
|
return {
|
|
13881
13882
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -13887,39 +13888,39 @@ function createFormControl(props = {}) {
|
|
|
13887
13888
|
maxLength: getRuleValue(options2.maxLength),
|
|
13888
13889
|
pattern: getRuleValue(options2.pattern)
|
|
13889
13890
|
} : {},
|
|
13890
|
-
name
|
|
13891
|
+
name,
|
|
13891
13892
|
onChange: onChange2,
|
|
13892
13893
|
onBlur: onChange2,
|
|
13893
13894
|
ref: (ref) => {
|
|
13894
13895
|
if (ref) {
|
|
13895
|
-
register(
|
|
13896
|
-
field = get2(_fields,
|
|
13896
|
+
register(name, options2);
|
|
13897
|
+
field = get2(_fields, name);
|
|
13897
13898
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
13898
13899
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
13899
13900
|
const refs = field._f.refs || [];
|
|
13900
13901
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
13901
13902
|
return;
|
|
13902
13903
|
}
|
|
13903
|
-
set(_fields,
|
|
13904
|
+
set(_fields, name, {
|
|
13904
13905
|
_f: {
|
|
13905
13906
|
...field._f,
|
|
13906
13907
|
...radioOrCheckbox ? {
|
|
13907
13908
|
refs: [
|
|
13908
13909
|
...refs.filter(live),
|
|
13909
13910
|
fieldRef,
|
|
13910
|
-
...Array.isArray(get2(_defaultValues,
|
|
13911
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
13911
13912
|
],
|
|
13912
|
-
ref: { type: fieldRef.type, name
|
|
13913
|
+
ref: { type: fieldRef.type, name }
|
|
13913
13914
|
} : { ref: fieldRef }
|
|
13914
13915
|
}
|
|
13915
13916
|
});
|
|
13916
|
-
updateValidAndValue(
|
|
13917
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
13917
13918
|
} else {
|
|
13918
|
-
field = get2(_fields,
|
|
13919
|
+
field = get2(_fields, name, {});
|
|
13919
13920
|
if (field._f) {
|
|
13920
13921
|
field._f.mount = false;
|
|
13921
13922
|
}
|
|
13922
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
13923
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
13923
13924
|
}
|
|
13924
13925
|
}
|
|
13925
13926
|
};
|
|
@@ -13928,8 +13929,8 @@ function createFormControl(props = {}) {
|
|
|
13928
13929
|
const _disableForm = (disabled) => {
|
|
13929
13930
|
if (isBoolean(disabled)) {
|
|
13930
13931
|
_subjects.state.next({ disabled });
|
|
13931
|
-
iterateFieldsByAction(_fields, (ref,
|
|
13932
|
-
const currentField = get2(_fields,
|
|
13932
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
13933
|
+
const currentField = get2(_fields, name);
|
|
13933
13934
|
if (currentField) {
|
|
13934
13935
|
ref.disabled = currentField._f.disabled || disabled;
|
|
13935
13936
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -13959,8 +13960,8 @@ function createFormControl(props = {}) {
|
|
|
13959
13960
|
await executeBuiltInValidation(_fields);
|
|
13960
13961
|
}
|
|
13961
13962
|
if (_names.disabled.size) {
|
|
13962
|
-
for (const
|
|
13963
|
-
unset(fieldValues,
|
|
13963
|
+
for (const name of _names.disabled) {
|
|
13964
|
+
unset(fieldValues, name);
|
|
13964
13965
|
}
|
|
13965
13966
|
}
|
|
13966
13967
|
unset(_formState.errors, "root");
|
|
@@ -13991,23 +13992,23 @@ function createFormControl(props = {}) {
|
|
|
13991
13992
|
throw onValidError;
|
|
13992
13993
|
}
|
|
13993
13994
|
};
|
|
13994
|
-
const resetField = (
|
|
13995
|
-
if (get2(_fields,
|
|
13995
|
+
const resetField = (name, options2 = {}) => {
|
|
13996
|
+
if (get2(_fields, name)) {
|
|
13996
13997
|
if (isUndefined(options2.defaultValue)) {
|
|
13997
|
-
setValue(
|
|
13998
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
13998
13999
|
} else {
|
|
13999
|
-
setValue(
|
|
14000
|
-
set(_defaultValues,
|
|
14000
|
+
setValue(name, options2.defaultValue);
|
|
14001
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
14001
14002
|
}
|
|
14002
14003
|
if (!options2.keepTouched) {
|
|
14003
|
-
unset(_formState.touchedFields,
|
|
14004
|
+
unset(_formState.touchedFields, name);
|
|
14004
14005
|
}
|
|
14005
14006
|
if (!options2.keepDirty) {
|
|
14006
|
-
unset(_formState.dirtyFields,
|
|
14007
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
14007
|
+
unset(_formState.dirtyFields, name);
|
|
14008
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
14008
14009
|
}
|
|
14009
14010
|
if (!options2.keepError) {
|
|
14010
|
-
unset(_formState.errors,
|
|
14011
|
+
unset(_formState.errors, name);
|
|
14011
14012
|
_proxyFormState.isValid && _setValid();
|
|
14012
14013
|
}
|
|
14013
14014
|
_subjects.state.next({ ..._formState });
|
|
@@ -14032,8 +14033,8 @@ function createFormControl(props = {}) {
|
|
|
14032
14033
|
}
|
|
14033
14034
|
} else {
|
|
14034
14035
|
if (isWeb && isUndefined(formValues)) {
|
|
14035
|
-
for (const
|
|
14036
|
-
const field = get2(_fields,
|
|
14036
|
+
for (const name of _names.mount) {
|
|
14037
|
+
const field = get2(_fields, name);
|
|
14037
14038
|
if (field && field._f) {
|
|
14038
14039
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
14039
14040
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -14086,8 +14087,8 @@ function createFormControl(props = {}) {
|
|
|
14086
14087
|
});
|
|
14087
14088
|
};
|
|
14088
14089
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
14089
|
-
const setFocus = (
|
|
14090
|
-
const field = get2(_fields,
|
|
14090
|
+
const setFocus = (name, options2 = {}) => {
|
|
14091
|
+
const field = get2(_fields, name);
|
|
14091
14092
|
const fieldReference = field && field._f;
|
|
14092
14093
|
if (fieldReference) {
|
|
14093
14094
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -14403,7 +14404,7 @@ function TextInput(props) {
|
|
|
14403
14404
|
inputWrapperClassName,
|
|
14404
14405
|
label,
|
|
14405
14406
|
placeholder,
|
|
14406
|
-
name
|
|
14407
|
+
name,
|
|
14407
14408
|
type = "text",
|
|
14408
14409
|
register,
|
|
14409
14410
|
errors,
|
|
@@ -14426,7 +14427,7 @@ function TextInput(props) {
|
|
|
14426
14427
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
14427
14428
|
placeholder,
|
|
14428
14429
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
14429
|
-
...register(
|
|
14430
|
+
...register(name)
|
|
14430
14431
|
}
|
|
14431
14432
|
),
|
|
14432
14433
|
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -14440,11 +14441,11 @@ function TextInput(props) {
|
|
|
14440
14441
|
]
|
|
14441
14442
|
}
|
|
14442
14443
|
),
|
|
14443
|
-
errors?.[
|
|
14444
|
+
errors?.[name]?.message && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
14444
14445
|
"p",
|
|
14445
14446
|
{
|
|
14446
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
14447
|
-
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
|
|
14448
14449
|
}
|
|
14449
14450
|
)
|
|
14450
14451
|
] });
|
|
@@ -14851,10 +14852,10 @@ function useFileInfo(source, options2) {
|
|
|
14851
14852
|
let localUrl = null;
|
|
14852
14853
|
let fr = null;
|
|
14853
14854
|
let mediaEl = null;
|
|
14854
|
-
const makeExtension = (
|
|
14855
|
-
if (
|
|
14856
|
-
const idx =
|
|
14857
|
-
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();
|
|
14858
14859
|
}
|
|
14859
14860
|
if (type) {
|
|
14860
14861
|
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
@@ -15463,7 +15464,7 @@ var ModalLayer = ({
|
|
|
15463
15464
|
// src/widgets/common/modal-confirm.tsx
|
|
15464
15465
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
15465
15466
|
var ModalConfirm = ({
|
|
15466
|
-
name
|
|
15467
|
+
name,
|
|
15467
15468
|
isShowModal,
|
|
15468
15469
|
onClick,
|
|
15469
15470
|
onClose,
|
|
@@ -15472,8 +15473,8 @@ var ModalConfirm = ({
|
|
|
15472
15473
|
isLoading
|
|
15473
15474
|
}) => {
|
|
15474
15475
|
const { t: t3 } = useI18n();
|
|
15475
|
-
const renderButtonAction = (
|
|
15476
|
-
switch (
|
|
15476
|
+
const renderButtonAction = (name2) => {
|
|
15477
|
+
switch (name2) {
|
|
15477
15478
|
case "duplicate":
|
|
15478
15479
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
15479
15480
|
"button",
|
|
@@ -15549,7 +15550,7 @@ var ModalConfirm = ({
|
|
|
15549
15550
|
children: t3("cancel")
|
|
15550
15551
|
}
|
|
15551
15552
|
),
|
|
15552
|
-
renderButtonAction(
|
|
15553
|
+
renderButtonAction(name)
|
|
15553
15554
|
] })
|
|
15554
15555
|
] }) });
|
|
15555
15556
|
};
|
|
@@ -16098,7 +16099,7 @@ var import_react39 = require("react");
|
|
|
16098
16099
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
16099
16100
|
var BinaryField = (props) => {
|
|
16100
16101
|
const {
|
|
16101
|
-
name
|
|
16102
|
+
name,
|
|
16102
16103
|
methods,
|
|
16103
16104
|
readonly = false,
|
|
16104
16105
|
placeholder,
|
|
@@ -16137,7 +16138,7 @@ var BinaryField = (props) => {
|
|
|
16137
16138
|
try {
|
|
16138
16139
|
let type = "application/octet-stream";
|
|
16139
16140
|
let size4 = 0;
|
|
16140
|
-
let
|
|
16141
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16141
16142
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16142
16143
|
type = "image/*";
|
|
16143
16144
|
} else {
|
|
@@ -16150,7 +16151,7 @@ var BinaryField = (props) => {
|
|
|
16150
16151
|
}
|
|
16151
16152
|
}
|
|
16152
16153
|
setFileInfo({
|
|
16153
|
-
name:
|
|
16154
|
+
name: name2,
|
|
16154
16155
|
type,
|
|
16155
16156
|
url: initialFile,
|
|
16156
16157
|
size: size4,
|
|
@@ -16186,13 +16187,13 @@ var BinaryField = (props) => {
|
|
|
16186
16187
|
};
|
|
16187
16188
|
const renderPreview = (file) => {
|
|
16188
16189
|
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PlaceHolderIcon, {});
|
|
16189
|
-
const { name:
|
|
16190
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16190
16191
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16191
16192
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16192
16193
|
"img",
|
|
16193
16194
|
{
|
|
16194
16195
|
src: url,
|
|
16195
|
-
alt:
|
|
16196
|
+
alt: name2,
|
|
16196
16197
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16197
16198
|
style: {
|
|
16198
16199
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16232,7 +16233,7 @@ var BinaryField = (props) => {
|
|
|
16232
16233
|
maxWidth: "120px"
|
|
16233
16234
|
},
|
|
16234
16235
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16235
|
-
children:
|
|
16236
|
+
children: name2
|
|
16236
16237
|
}
|
|
16237
16238
|
),
|
|
16238
16239
|
isShowSize && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16242,7 +16243,7 @@ var BinaryField = (props) => {
|
|
|
16242
16243
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16243
16244
|
Controller,
|
|
16244
16245
|
{
|
|
16245
|
-
name:
|
|
16246
|
+
name: name ?? "",
|
|
16246
16247
|
control: methods?.control,
|
|
16247
16248
|
rules: {
|
|
16248
16249
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -16535,7 +16536,7 @@ var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
|
16535
16536
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
16536
16537
|
var CharField = (props) => {
|
|
16537
16538
|
const {
|
|
16538
|
-
name
|
|
16539
|
+
name,
|
|
16539
16540
|
readonly,
|
|
16540
16541
|
placeholder,
|
|
16541
16542
|
required,
|
|
@@ -16566,7 +16567,7 @@ var CharField = (props) => {
|
|
|
16566
16567
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
16567
16568
|
Controller,
|
|
16568
16569
|
{
|
|
16569
|
-
name:
|
|
16570
|
+
name: name ?? "",
|
|
16570
16571
|
control: methods.control,
|
|
16571
16572
|
rules: {
|
|
16572
16573
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -16593,15 +16594,15 @@ var CharField = (props) => {
|
|
|
16593
16594
|
const { setError, clearErrors } = methods;
|
|
16594
16595
|
(0, import_react40.useEffect)(() => {
|
|
16595
16596
|
if (value2) {
|
|
16596
|
-
clearErrors(
|
|
16597
|
+
clearErrors(name);
|
|
16597
16598
|
}
|
|
16598
|
-
}, [value2, clearErrors,
|
|
16599
|
+
}, [value2, clearErrors, name]);
|
|
16599
16600
|
(0, import_react40.useEffect)(() => {
|
|
16600
16601
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
16601
16602
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
16602
|
-
const currentValue = methods?.getValues(
|
|
16603
|
+
const currentValue = methods?.getValues(name);
|
|
16603
16604
|
if (currentValue !== depValue) {
|
|
16604
|
-
methods?.setValue(
|
|
16605
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
16605
16606
|
}
|
|
16606
16607
|
}, [widget, formValues]);
|
|
16607
16608
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -16626,14 +16627,14 @@ var CharField = (props) => {
|
|
|
16626
16627
|
const inputValue = e3.target.value;
|
|
16627
16628
|
if (readonly) return;
|
|
16628
16629
|
fieldOnchange(inputValue);
|
|
16629
|
-
clearErrors(
|
|
16630
|
+
clearErrors(name);
|
|
16630
16631
|
},
|
|
16631
16632
|
onBlur: (e3) => {
|
|
16632
16633
|
if (readonly) return;
|
|
16633
16634
|
const inputValue = e3.target.value || "";
|
|
16634
16635
|
if (widget === "custom_passord") {
|
|
16635
16636
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
16636
|
-
setError(
|
|
16637
|
+
setError(name, {
|
|
16637
16638
|
type: "pattern",
|
|
16638
16639
|
message: getPasswordMessage(
|
|
16639
16640
|
min3,
|
|
@@ -16648,7 +16649,7 @@ var CharField = (props) => {
|
|
|
16648
16649
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
16649
16650
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
16650
16651
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
16651
|
-
setError(
|
|
16652
|
+
setError(name, {
|
|
16652
16653
|
type: "pattern",
|
|
16653
16654
|
message: t3(
|
|
16654
16655
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -16658,14 +16659,14 @@ var CharField = (props) => {
|
|
|
16658
16659
|
}
|
|
16659
16660
|
}
|
|
16660
16661
|
fieldOnchange(inputValue);
|
|
16661
|
-
onChange2 && onChange2(
|
|
16662
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
16662
16663
|
if (!inputValue && required && !invisible) {
|
|
16663
|
-
setError(
|
|
16664
|
+
setError(name, {
|
|
16664
16665
|
type: "required",
|
|
16665
16666
|
message: `${string} ${t3("must_required")}`
|
|
16666
16667
|
});
|
|
16667
16668
|
} else {
|
|
16668
|
-
clearErrors(
|
|
16669
|
+
clearErrors(name);
|
|
16669
16670
|
}
|
|
16670
16671
|
},
|
|
16671
16672
|
readOnly: readonly,
|
|
@@ -16719,14 +16720,14 @@ function EyeIconComponent({ open }) {
|
|
|
16719
16720
|
}
|
|
16720
16721
|
var SecureField = (props) => {
|
|
16721
16722
|
const {
|
|
16722
|
-
name
|
|
16723
|
+
name,
|
|
16723
16724
|
readonly,
|
|
16724
16725
|
placeholder,
|
|
16725
16726
|
required,
|
|
16726
16727
|
invisible,
|
|
16727
16728
|
methods,
|
|
16728
16729
|
onChange: onChange2,
|
|
16729
|
-
string =
|
|
16730
|
+
string = name,
|
|
16730
16731
|
widget,
|
|
16731
16732
|
min: min3,
|
|
16732
16733
|
max: max3,
|
|
@@ -16756,7 +16757,7 @@ var SecureField = (props) => {
|
|
|
16756
16757
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
16757
16758
|
Controller,
|
|
16758
16759
|
{
|
|
16759
|
-
name: String(
|
|
16760
|
+
name: String(name),
|
|
16760
16761
|
control: methods.control,
|
|
16761
16762
|
rules: {
|
|
16762
16763
|
...required && !invisible ? {
|
|
@@ -16790,8 +16791,8 @@ var SecureField = (props) => {
|
|
|
16790
16791
|
if (canToggle) setShowPlain(false);
|
|
16791
16792
|
}, [canToggle]);
|
|
16792
16793
|
(0, import_react41.useEffect)(() => {
|
|
16793
|
-
if (value2) clearErrors(
|
|
16794
|
-
}, [value2, clearErrors,
|
|
16794
|
+
if (value2) clearErrors(name);
|
|
16795
|
+
}, [value2, clearErrors, name]);
|
|
16795
16796
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
16796
16797
|
isCappedToken && shouldMask && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
16797
16798
|
"div",
|
|
@@ -16809,20 +16810,20 @@ var SecureField = (props) => {
|
|
|
16809
16810
|
if (readonly) return;
|
|
16810
16811
|
const inputValue = e3.target.value ?? "";
|
|
16811
16812
|
fieldOnchange(inputValue);
|
|
16812
|
-
clearErrors(
|
|
16813
|
+
clearErrors(name);
|
|
16813
16814
|
},
|
|
16814
16815
|
onBlur: (e3) => {
|
|
16815
16816
|
if (readonly) return;
|
|
16816
16817
|
const inputValue = (e3.target.value ?? "").trim();
|
|
16817
16818
|
if (!inputValue && required && !invisible) {
|
|
16818
|
-
setError(
|
|
16819
|
+
setError(name, {
|
|
16819
16820
|
type: "required",
|
|
16820
16821
|
message: `${string} ${t3("must_required")}`
|
|
16821
16822
|
});
|
|
16822
16823
|
return;
|
|
16823
16824
|
}
|
|
16824
16825
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
16825
|
-
setError(
|
|
16826
|
+
setError(name, {
|
|
16826
16827
|
type: "pattern",
|
|
16827
16828
|
message: getPasswordMessage2(
|
|
16828
16829
|
min3,
|
|
@@ -16835,8 +16836,8 @@ var SecureField = (props) => {
|
|
|
16835
16836
|
return;
|
|
16836
16837
|
}
|
|
16837
16838
|
fieldOnchange(inputValue);
|
|
16838
|
-
onChange2 && onChange2(String(
|
|
16839
|
-
clearErrors(
|
|
16839
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
16840
|
+
clearErrors(name);
|
|
16840
16841
|
},
|
|
16841
16842
|
readOnly: readonly,
|
|
16842
16843
|
disabled: readonly,
|
|
@@ -16880,7 +16881,7 @@ var SecureField = (props) => {
|
|
|
16880
16881
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
16881
16882
|
var CheckboxField = (props) => {
|
|
16882
16883
|
const {
|
|
16883
|
-
name
|
|
16884
|
+
name,
|
|
16884
16885
|
readonly = false,
|
|
16885
16886
|
required = false,
|
|
16886
16887
|
invisible = false,
|
|
@@ -16891,7 +16892,7 @@ var CheckboxField = (props) => {
|
|
|
16891
16892
|
isEditTable = false
|
|
16892
16893
|
} = props;
|
|
16893
16894
|
if (!isForm) {
|
|
16894
|
-
if (
|
|
16895
|
+
if (name === "is_active" || name === "active") {
|
|
16895
16896
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ActiveBadgeField, { type: value });
|
|
16896
16897
|
} else {
|
|
16897
16898
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -16908,7 +16909,7 @@ var CheckboxField = (props) => {
|
|
|
16908
16909
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16909
16910
|
Controller,
|
|
16910
16911
|
{
|
|
16911
|
-
name:
|
|
16912
|
+
name: name ?? "",
|
|
16912
16913
|
control: methods?.control,
|
|
16913
16914
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
16914
16915
|
"div",
|
|
@@ -16917,10 +16918,10 @@ var CheckboxField = (props) => {
|
|
|
16917
16918
|
onClick: () => {
|
|
16918
16919
|
const checked = !field.value;
|
|
16919
16920
|
if (!isEditTable && readonly) return;
|
|
16920
|
-
methods.setValue(
|
|
16921
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16921
16922
|
field.onChange(checked);
|
|
16922
16923
|
if (onChange2) {
|
|
16923
|
-
onChange2(
|
|
16924
|
+
onChange2(name ?? "", checked);
|
|
16924
16925
|
}
|
|
16925
16926
|
},
|
|
16926
16927
|
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -16930,10 +16931,10 @@ var CheckboxField = (props) => {
|
|
|
16930
16931
|
onChange: (e3) => {
|
|
16931
16932
|
const checked = e3.target.checked;
|
|
16932
16933
|
if (!isEditTable && readonly) return;
|
|
16933
|
-
methods.setValue(
|
|
16934
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16934
16935
|
field.onChange(checked);
|
|
16935
16936
|
if (onChange2) {
|
|
16936
|
-
onChange2(
|
|
16937
|
+
onChange2(name ?? "", checked);
|
|
16937
16938
|
}
|
|
16938
16939
|
},
|
|
16939
16940
|
type: "checkbox",
|
|
@@ -17027,19 +17028,19 @@ var ColorWrapper = (props) => {
|
|
|
17027
17028
|
// src/widgets/basic/color-field/color.tsx
|
|
17028
17029
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
17029
17030
|
var ColorField = (props) => {
|
|
17030
|
-
const { value, isForm, name
|
|
17031
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
17031
17032
|
if (!isForm) {
|
|
17032
17033
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
17033
17034
|
}
|
|
17034
17035
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17035
17036
|
Controller,
|
|
17036
17037
|
{
|
|
17037
|
-
name:
|
|
17038
|
+
name: name ?? "",
|
|
17038
17039
|
control: methods?.control,
|
|
17039
17040
|
render: ({ field }) => {
|
|
17040
17041
|
const handlePickColorChange = (color) => {
|
|
17041
17042
|
field.onChange(color?.id);
|
|
17042
|
-
onChange2 && onChange2(
|
|
17043
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
17043
17044
|
};
|
|
17044
17045
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17045
17046
|
ColorWrapper,
|
|
@@ -17060,7 +17061,7 @@ var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
|
17060
17061
|
var CopyLinkButtonField = (props) => {
|
|
17061
17062
|
const {
|
|
17062
17063
|
isForm,
|
|
17063
|
-
name
|
|
17064
|
+
name,
|
|
17064
17065
|
methods,
|
|
17065
17066
|
onChange: onChange2,
|
|
17066
17067
|
readonly,
|
|
@@ -17082,7 +17083,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17082
17083
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
17083
17084
|
Controller,
|
|
17084
17085
|
{
|
|
17085
|
-
name:
|
|
17086
|
+
name: name ?? "",
|
|
17086
17087
|
control: methods.control,
|
|
17087
17088
|
rules: {
|
|
17088
17089
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17094,7 +17095,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17094
17095
|
const { setError, clearErrors } = methods;
|
|
17095
17096
|
(0, import_react43.useEffect)(() => {
|
|
17096
17097
|
if (value) {
|
|
17097
|
-
clearErrors(
|
|
17098
|
+
clearErrors(name);
|
|
17098
17099
|
}
|
|
17099
17100
|
}, [value]);
|
|
17100
17101
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17112,11 +17113,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17112
17113
|
if (readonly) return;
|
|
17113
17114
|
const newValue = e3.target.value || "";
|
|
17114
17115
|
fieldOnchange(newValue);
|
|
17115
|
-
onChange2 && onChange2(
|
|
17116
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17116
17117
|
if (e3.target.value) {
|
|
17117
|
-
clearErrors(
|
|
17118
|
+
clearErrors(name);
|
|
17118
17119
|
} else if (required && !invisible) {
|
|
17119
|
-
setError(
|
|
17120
|
+
setError(name, {
|
|
17120
17121
|
type: "required",
|
|
17121
17122
|
message: `${string} ${t3("must_required")}`
|
|
17122
17123
|
});
|
|
@@ -17126,9 +17127,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17126
17127
|
if (!readonly) {
|
|
17127
17128
|
fieldOnchange(e3.target.value);
|
|
17128
17129
|
if (e3.target.value) {
|
|
17129
|
-
clearErrors(
|
|
17130
|
+
clearErrors(name);
|
|
17130
17131
|
} else if (required && !invisible) {
|
|
17131
|
-
setError(
|
|
17132
|
+
setError(name, {
|
|
17132
17133
|
type: "required",
|
|
17133
17134
|
message: `${string} ${t3("must_required")}`
|
|
17134
17135
|
});
|
|
@@ -26992,23 +26993,23 @@ var createCache = function createCache2(options2) {
|
|
|
26992
26993
|
};
|
|
26993
26994
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
26994
26995
|
var getRules3 = function getRules4(selector, serialized) {
|
|
26995
|
-
var
|
|
26996
|
-
if (serverStylisCache[
|
|
26997
|
-
serverStylisCache[
|
|
26996
|
+
var name = serialized.name;
|
|
26997
|
+
if (serverStylisCache[name] === void 0) {
|
|
26998
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
26998
26999
|
}
|
|
26999
|
-
return serverStylisCache[
|
|
27000
|
+
return serverStylisCache[name];
|
|
27000
27001
|
};
|
|
27001
27002
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
27002
|
-
var
|
|
27003
|
+
var name = serialized.name;
|
|
27003
27004
|
var rules = getRules3(selector, serialized);
|
|
27004
27005
|
if (cache.compat === void 0) {
|
|
27005
27006
|
if (shouldCache) {
|
|
27006
|
-
cache.inserted[
|
|
27007
|
+
cache.inserted[name] = true;
|
|
27007
27008
|
}
|
|
27008
27009
|
return rules;
|
|
27009
27010
|
} else {
|
|
27010
27011
|
if (shouldCache) {
|
|
27011
|
-
cache.inserted[
|
|
27012
|
+
cache.inserted[name] = rules;
|
|
27012
27013
|
} else {
|
|
27013
27014
|
return rules;
|
|
27014
27015
|
}
|
|
@@ -27331,9 +27332,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
27331
27332
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
27332
27333
|
identifierName += "-" + match3[1];
|
|
27333
27334
|
}
|
|
27334
|
-
var
|
|
27335
|
+
var name = murmur2(styles) + identifierName;
|
|
27335
27336
|
return {
|
|
27336
|
-
name
|
|
27337
|
+
name,
|
|
27337
27338
|
styles,
|
|
27338
27339
|
next: cursor
|
|
27339
27340
|
};
|
|
@@ -27483,10 +27484,10 @@ function css() {
|
|
|
27483
27484
|
}
|
|
27484
27485
|
function keyframes() {
|
|
27485
27486
|
var insertable = css.apply(void 0, arguments);
|
|
27486
|
-
var
|
|
27487
|
+
var name = "animation-" + insertable.name;
|
|
27487
27488
|
return {
|
|
27488
|
-
name
|
|
27489
|
-
styles: "@keyframes " +
|
|
27489
|
+
name,
|
|
27490
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
27490
27491
|
anim: 1,
|
|
27491
27492
|
toString: function toString() {
|
|
27492
27493
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -27518,13 +27519,13 @@ var index3 = isClient3 ? import_react50.useLayoutEffect : noop6;
|
|
|
27518
27519
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
27519
27520
|
var noop8 = function noop9() {
|
|
27520
27521
|
};
|
|
27521
|
-
function applyPrefixToName(prefix2,
|
|
27522
|
-
if (!
|
|
27522
|
+
function applyPrefixToName(prefix2, name) {
|
|
27523
|
+
if (!name) {
|
|
27523
27524
|
return prefix2;
|
|
27524
|
-
} else if (
|
|
27525
|
-
return prefix2 +
|
|
27525
|
+
} else if (name[0] === "-") {
|
|
27526
|
+
return prefix2 + name;
|
|
27526
27527
|
} else {
|
|
27527
|
-
return prefix2 + "__" +
|
|
27528
|
+
return prefix2 + "__" + name;
|
|
27528
27529
|
}
|
|
27529
27530
|
}
|
|
27530
27531
|
function classNames(prefix2, state) {
|
|
@@ -27568,11 +27569,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
27568
27569
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
27569
27570
|
return _objectSpread2({}, innerProps);
|
|
27570
27571
|
};
|
|
27571
|
-
var getStyleProps = function getStyleProps2(props,
|
|
27572
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
27572
27573
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
27573
27574
|
return {
|
|
27574
|
-
css: getStyles(
|
|
27575
|
-
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)
|
|
27576
27577
|
};
|
|
27577
27578
|
};
|
|
27578
27579
|
function isDocumentElement(el) {
|
|
@@ -29321,10 +29322,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
29321
29322
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
29322
29323
|
};
|
|
29323
29324
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
29324
|
-
var
|
|
29325
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
29325
29326
|
return jsx86("input", {
|
|
29326
29327
|
required: true,
|
|
29327
|
-
name
|
|
29328
|
+
name,
|
|
29328
29329
|
tabIndex: -1,
|
|
29329
29330
|
"aria-hidden": "true",
|
|
29330
29331
|
onFocus: onFocus2,
|
|
@@ -29650,8 +29651,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29650
29651
|
_this.focus = _this.focusInput;
|
|
29651
29652
|
_this.blur = _this.blurInput;
|
|
29652
29653
|
_this.onChange = function(newValue, actionMeta) {
|
|
29653
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
29654
|
-
actionMeta.name =
|
|
29654
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
29655
|
+
actionMeta.name = name;
|
|
29655
29656
|
_this.ariaOnChange(newValue, actionMeta);
|
|
29656
29657
|
onChange2(newValue, actionMeta);
|
|
29657
29658
|
};
|
|
@@ -29676,7 +29677,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29676
29677
|
});
|
|
29677
29678
|
};
|
|
29678
29679
|
_this.selectOption = function(newValue) {
|
|
29679
|
-
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;
|
|
29680
29681
|
var selectValue = _this.state.selectValue;
|
|
29681
29682
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
29682
29683
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -29695,7 +29696,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29695
29696
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
29696
29697
|
action: "select-option",
|
|
29697
29698
|
option: newValue,
|
|
29698
|
-
name
|
|
29699
|
+
name
|
|
29699
29700
|
});
|
|
29700
29701
|
return;
|
|
29701
29702
|
}
|
|
@@ -30749,22 +30750,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30749
30750
|
key: "renderFormField",
|
|
30750
30751
|
value: function renderFormField() {
|
|
30751
30752
|
var _this5 = this;
|
|
30752
|
-
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;
|
|
30753
30754
|
var selectValue = this.state.selectValue;
|
|
30754
30755
|
if (required && !this.hasValue() && !isDisabled) {
|
|
30755
30756
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
30756
|
-
name
|
|
30757
|
+
name,
|
|
30757
30758
|
onFocus: this.onValueInputFocus
|
|
30758
30759
|
});
|
|
30759
30760
|
}
|
|
30760
|
-
if (!
|
|
30761
|
+
if (!name || isDisabled) return;
|
|
30761
30762
|
if (isMulti) {
|
|
30762
30763
|
if (delimiter2) {
|
|
30763
30764
|
var value = selectValue.map(function(opt) {
|
|
30764
30765
|
return _this5.getOptionValue(opt);
|
|
30765
30766
|
}).join(delimiter2);
|
|
30766
30767
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30767
|
-
name
|
|
30768
|
+
name,
|
|
30768
30769
|
type: "hidden",
|
|
30769
30770
|
value
|
|
30770
30771
|
});
|
|
@@ -30772,12 +30773,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30772
30773
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
30773
30774
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30774
30775
|
key: "i-".concat(i3),
|
|
30775
|
-
name
|
|
30776
|
+
name,
|
|
30776
30777
|
type: "hidden",
|
|
30777
30778
|
value: _this5.getOptionValue(opt)
|
|
30778
30779
|
});
|
|
30779
30780
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
30780
|
-
name
|
|
30781
|
+
name,
|
|
30781
30782
|
type: "hidden",
|
|
30782
30783
|
value: ""
|
|
30783
30784
|
});
|
|
@@ -30786,7 +30787,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30786
30787
|
} else {
|
|
30787
30788
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
30788
30789
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30789
|
-
name
|
|
30790
|
+
name,
|
|
30790
30791
|
type: "hidden",
|
|
30791
30792
|
value: _value
|
|
30792
30793
|
});
|
|
@@ -30915,7 +30916,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
30915
30916
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
30916
30917
|
var DateField = (props) => {
|
|
30917
30918
|
const {
|
|
30918
|
-
name
|
|
30919
|
+
name,
|
|
30919
30920
|
value,
|
|
30920
30921
|
readonly,
|
|
30921
30922
|
placeholder = "DD/MM/YYYY",
|
|
@@ -30965,7 +30966,7 @@ var DateField = (props) => {
|
|
|
30965
30966
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
30966
30967
|
Controller,
|
|
30967
30968
|
{
|
|
30968
|
-
name:
|
|
30969
|
+
name: name || "",
|
|
30969
30970
|
control: methods?.control,
|
|
30970
30971
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
30971
30972
|
rules: {
|
|
@@ -30980,9 +30981,9 @@ var DateField = (props) => {
|
|
|
30980
30981
|
const { setError, clearErrors } = methods;
|
|
30981
30982
|
(0, import_react56.useEffect)(() => {
|
|
30982
30983
|
if (value) {
|
|
30983
|
-
clearErrors(
|
|
30984
|
+
clearErrors(name);
|
|
30984
30985
|
}
|
|
30985
|
-
}, [value, clearErrors,
|
|
30986
|
+
}, [value, clearErrors, name]);
|
|
30986
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;
|
|
30987
30988
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
30988
30989
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
@@ -31001,7 +31002,7 @@ var DateField = (props) => {
|
|
|
31001
31002
|
adjustedDate.toDate()
|
|
31002
31003
|
);
|
|
31003
31004
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
31004
|
-
setError(
|
|
31005
|
+
setError(name, {
|
|
31005
31006
|
type: "manual",
|
|
31006
31007
|
message: validateCustomResult
|
|
31007
31008
|
});
|
|
@@ -31009,20 +31010,20 @@ var DateField = (props) => {
|
|
|
31009
31010
|
}
|
|
31010
31011
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31011
31012
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
31012
|
-
handleOnchange && handleOnchange(
|
|
31013
|
-
clearErrors(
|
|
31013
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31014
|
+
clearErrors(name);
|
|
31014
31015
|
} else {
|
|
31015
31016
|
field.onChange(null);
|
|
31016
|
-
handleOnchange && handleOnchange(
|
|
31017
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
31017
31018
|
if (required && !invisible) {
|
|
31018
31019
|
if (!isEditTable) {
|
|
31019
|
-
setError(
|
|
31020
|
+
setError(name, {
|
|
31020
31021
|
type: "manual",
|
|
31021
31022
|
message: `${string} ${t3("must_required")}`
|
|
31022
31023
|
});
|
|
31023
31024
|
}
|
|
31024
31025
|
} else {
|
|
31025
|
-
clearErrors(
|
|
31026
|
+
clearErrors(name);
|
|
31026
31027
|
}
|
|
31027
31028
|
}
|
|
31028
31029
|
},
|
|
@@ -31043,7 +31044,7 @@ var DateField = (props) => {
|
|
|
31043
31044
|
}
|
|
31044
31045
|
),
|
|
31045
31046
|
timeInputLabel: textPlaceHolder,
|
|
31046
|
-
portalId:
|
|
31047
|
+
portalId: name,
|
|
31047
31048
|
renderCustomHeader: ({
|
|
31048
31049
|
date,
|
|
31049
31050
|
changeYear,
|
|
@@ -31382,7 +31383,7 @@ var RenderFile = ({
|
|
|
31382
31383
|
};
|
|
31383
31384
|
var FileUploadField = (props) => {
|
|
31384
31385
|
const {
|
|
31385
|
-
name
|
|
31386
|
+
name,
|
|
31386
31387
|
methods,
|
|
31387
31388
|
isForm,
|
|
31388
31389
|
model,
|
|
@@ -31413,7 +31414,7 @@ var FileUploadField = (props) => {
|
|
|
31413
31414
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
31414
31415
|
Controller,
|
|
31415
31416
|
{
|
|
31416
|
-
name:
|
|
31417
|
+
name: name || "",
|
|
31417
31418
|
control: methods?.control,
|
|
31418
31419
|
rules: {
|
|
31419
31420
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31479,7 +31480,7 @@ var import_react59 = require("react");
|
|
|
31479
31480
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
31480
31481
|
var FloatField = (props) => {
|
|
31481
31482
|
const {
|
|
31482
|
-
name
|
|
31483
|
+
name,
|
|
31483
31484
|
value: propValue,
|
|
31484
31485
|
readonly,
|
|
31485
31486
|
placeholder,
|
|
@@ -31500,7 +31501,7 @@ var FloatField = (props) => {
|
|
|
31500
31501
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
31501
31502
|
Controller,
|
|
31502
31503
|
{
|
|
31503
|
-
name:
|
|
31504
|
+
name: name ?? "",
|
|
31504
31505
|
control: methods.control,
|
|
31505
31506
|
rules: {
|
|
31506
31507
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -31518,14 +31519,14 @@ var FloatField = (props) => {
|
|
|
31518
31519
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
31519
31520
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
31520
31521
|
setInputValue(formatFloatNumber(propValue));
|
|
31521
|
-
clearErrors(
|
|
31522
|
+
clearErrors(name);
|
|
31522
31523
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
31523
31524
|
setInputValue(formatFloatNumber(value));
|
|
31524
|
-
clearErrors(
|
|
31525
|
+
clearErrors(name);
|
|
31525
31526
|
} else if (value === null || value === void 0) {
|
|
31526
31527
|
setInputValue("");
|
|
31527
31528
|
}
|
|
31528
|
-
}, [value,
|
|
31529
|
+
}, [value, name, clearErrors, propValue]);
|
|
31529
31530
|
const handleInputChange = (e3) => {
|
|
31530
31531
|
let newValue = e3.target.value;
|
|
31531
31532
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -31545,7 +31546,7 @@ var FloatField = (props) => {
|
|
|
31545
31546
|
);
|
|
31546
31547
|
if (!isNaN(parsedValue)) {
|
|
31547
31548
|
onChange2(parsedValue);
|
|
31548
|
-
clearErrors(
|
|
31549
|
+
clearErrors(name);
|
|
31549
31550
|
isDirtyRef.current = true;
|
|
31550
31551
|
} else {
|
|
31551
31552
|
onChange2(null);
|
|
@@ -31557,7 +31558,7 @@ var FloatField = (props) => {
|
|
|
31557
31558
|
const parsedValue = parseFloat(rawValue);
|
|
31558
31559
|
if (rawValue === "" || rawValue === ".") {
|
|
31559
31560
|
if (required) {
|
|
31560
|
-
setError(
|
|
31561
|
+
setError(name, {
|
|
31561
31562
|
type: "required",
|
|
31562
31563
|
message: `${string} ${t3("must_required")}`
|
|
31563
31564
|
});
|
|
@@ -31567,7 +31568,7 @@ var FloatField = (props) => {
|
|
|
31567
31568
|
lastCommittedValueRef.current = null;
|
|
31568
31569
|
} else if (!isNaN(parsedValue)) {
|
|
31569
31570
|
if (parsedValue < 0) {
|
|
31570
|
-
setError(
|
|
31571
|
+
setError(name, {
|
|
31571
31572
|
type: "validate",
|
|
31572
31573
|
message: t3("invalid_number")
|
|
31573
31574
|
});
|
|
@@ -31577,12 +31578,12 @@ var FloatField = (props) => {
|
|
|
31577
31578
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
31578
31579
|
setInputValue(formattedValue);
|
|
31579
31580
|
onChange2(parsedValue);
|
|
31580
|
-
handleOnchange?.(
|
|
31581
|
-
clearErrors(
|
|
31581
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
31582
|
+
clearErrors(name);
|
|
31582
31583
|
lastCommittedValueRef.current = parsedValue;
|
|
31583
31584
|
}
|
|
31584
31585
|
} else {
|
|
31585
|
-
setError(
|
|
31586
|
+
setError(name, {
|
|
31586
31587
|
type: "validate",
|
|
31587
31588
|
message: t3("invalid_number")
|
|
31588
31589
|
});
|
|
@@ -31621,7 +31622,7 @@ var import_react60 = require("react");
|
|
|
31621
31622
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
31622
31623
|
var FloatTimeField = (props) => {
|
|
31623
31624
|
const {
|
|
31624
|
-
name
|
|
31625
|
+
name,
|
|
31625
31626
|
methods,
|
|
31626
31627
|
defaultValue = 0,
|
|
31627
31628
|
isForm = true,
|
|
@@ -31639,7 +31640,7 @@ var FloatTimeField = (props) => {
|
|
|
31639
31640
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
31640
31641
|
Controller,
|
|
31641
31642
|
{
|
|
31642
|
-
name:
|
|
31643
|
+
name: name ?? "",
|
|
31643
31644
|
control: methods?.control,
|
|
31644
31645
|
defaultValue,
|
|
31645
31646
|
rules: {
|
|
@@ -31686,13 +31687,13 @@ var FloatTimeField = (props) => {
|
|
|
31686
31687
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
31687
31688
|
fieldOnChange(floatVal);
|
|
31688
31689
|
if (onChange2) {
|
|
31689
|
-
onChange2(
|
|
31690
|
+
onChange2(name ?? "", floatVal);
|
|
31690
31691
|
}
|
|
31691
31692
|
} else {
|
|
31692
31693
|
setInput("00:00");
|
|
31693
31694
|
fieldOnChange(0);
|
|
31694
31695
|
if (onChange2) {
|
|
31695
|
-
onChange2(
|
|
31696
|
+
onChange2(name ?? "", 0);
|
|
31696
31697
|
}
|
|
31697
31698
|
setErrors("");
|
|
31698
31699
|
}
|
|
@@ -31743,7 +31744,7 @@ var import_react61 = require("react");
|
|
|
31743
31744
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
31744
31745
|
var HtmlField = (props) => {
|
|
31745
31746
|
const {
|
|
31746
|
-
name
|
|
31747
|
+
name,
|
|
31747
31748
|
methods,
|
|
31748
31749
|
readonly = false,
|
|
31749
31750
|
isForm = true,
|
|
@@ -31760,7 +31761,7 @@ var HtmlField = (props) => {
|
|
|
31760
31761
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
31761
31762
|
Controller,
|
|
31762
31763
|
{
|
|
31763
|
-
name:
|
|
31764
|
+
name: name ?? "",
|
|
31764
31765
|
control: methods?.control,
|
|
31765
31766
|
defaultValue,
|
|
31766
31767
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -31793,10 +31794,10 @@ var HtmlField = (props) => {
|
|
|
31793
31794
|
// src/widgets/basic/image-field/image.tsx
|
|
31794
31795
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
31795
31796
|
var ImageField = (props) => {
|
|
31796
|
-
const { value, type, name
|
|
31797
|
+
const { value, type, name, baseURL } = props;
|
|
31797
31798
|
if (!value) return null;
|
|
31798
31799
|
if (type === "url") {
|
|
31799
|
-
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 });
|
|
31800
31801
|
}
|
|
31801
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" }) });
|
|
31802
31803
|
};
|
|
@@ -31898,7 +31899,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31898
31899
|
const {
|
|
31899
31900
|
relation,
|
|
31900
31901
|
value,
|
|
31901
|
-
name
|
|
31902
|
+
name,
|
|
31902
31903
|
methods,
|
|
31903
31904
|
required,
|
|
31904
31905
|
invisible,
|
|
@@ -31939,7 +31940,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31939
31940
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
31940
31941
|
Controller,
|
|
31941
31942
|
{
|
|
31942
|
-
name:
|
|
31943
|
+
name: name ?? "",
|
|
31943
31944
|
control: methods.control,
|
|
31944
31945
|
rules: {
|
|
31945
31946
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31948,7 +31949,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31948
31949
|
const { clearErrors } = methods;
|
|
31949
31950
|
(0, import_react62.useEffect)(() => {
|
|
31950
31951
|
if (field.value) {
|
|
31951
|
-
clearErrors(
|
|
31952
|
+
clearErrors(name);
|
|
31952
31953
|
}
|
|
31953
31954
|
}, [field.value]);
|
|
31954
31955
|
const filteredValue = (0, import_react62.useMemo)(() => {
|
|
@@ -31968,18 +31969,18 @@ var Many2ManyTagField = (props) => {
|
|
|
31968
31969
|
}, [field?.value, options2]);
|
|
31969
31970
|
const handleChange = (selectedOptions) => {
|
|
31970
31971
|
const newValue = transfer(selectedOptions);
|
|
31971
|
-
methods?.setValue(
|
|
31972
|
-
onChange2?.(
|
|
31973
|
-
clearErrors(
|
|
31972
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
31973
|
+
onChange2?.(name ?? "", newValue);
|
|
31974
|
+
clearErrors(name);
|
|
31974
31975
|
newValue.forEach((item, index4) => {
|
|
31975
31976
|
Object.keys(item).forEach((key) => {
|
|
31976
|
-
methods.setValue(`${
|
|
31977
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
31977
31978
|
shouldDirty: true
|
|
31978
31979
|
});
|
|
31979
31980
|
});
|
|
31980
31981
|
});
|
|
31981
31982
|
};
|
|
31982
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "group h-full
|
|
31983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "group h-full", children: [
|
|
31983
31984
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
31984
31985
|
StateManagedSelect$1,
|
|
31985
31986
|
{
|
|
@@ -32098,7 +32099,7 @@ var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
|
32098
32099
|
var MonetaryField = (props) => {
|
|
32099
32100
|
const { t: t3 } = useI18n();
|
|
32100
32101
|
const {
|
|
32101
|
-
name
|
|
32102
|
+
name,
|
|
32102
32103
|
value,
|
|
32103
32104
|
readonly,
|
|
32104
32105
|
required,
|
|
@@ -32115,7 +32116,7 @@ var MonetaryField = (props) => {
|
|
|
32115
32116
|
symbol = "VND",
|
|
32116
32117
|
baseClassName
|
|
32117
32118
|
} = props;
|
|
32118
|
-
if (isForm &&
|
|
32119
|
+
if (isForm && name === "amount_residual") {
|
|
32119
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: [
|
|
32120
32121
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "font-semibold", children: [
|
|
32121
32122
|
string,
|
|
@@ -32132,7 +32133,7 @@ var MonetaryField = (props) => {
|
|
|
32132
32133
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
32133
32134
|
Controller,
|
|
32134
32135
|
{
|
|
32135
|
-
name:
|
|
32136
|
+
name: name ?? "",
|
|
32136
32137
|
control: methods.control,
|
|
32137
32138
|
rules: {
|
|
32138
32139
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32145,7 +32146,7 @@ var MonetaryField = (props) => {
|
|
|
32145
32146
|
const { setError, clearErrors } = methods;
|
|
32146
32147
|
(0, import_react63.useEffect)(() => {
|
|
32147
32148
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32148
|
-
clearErrors(
|
|
32149
|
+
clearErrors(name);
|
|
32149
32150
|
}
|
|
32150
32151
|
}, [value2]);
|
|
32151
32152
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
@@ -32156,18 +32157,18 @@ var MonetaryField = (props) => {
|
|
|
32156
32157
|
onBlur: () => {
|
|
32157
32158
|
if (!readonly && !isNaN(value2)) {
|
|
32158
32159
|
onBlur();
|
|
32159
|
-
handleOnchange && handleOnchange(
|
|
32160
|
-
clearErrors(
|
|
32160
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32161
|
+
clearErrors(name);
|
|
32161
32162
|
}
|
|
32162
32163
|
},
|
|
32163
32164
|
onChange: (e3) => {
|
|
32164
32165
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32165
32166
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32166
32167
|
onChange2(parsedValue);
|
|
32167
|
-
clearErrors(
|
|
32168
|
+
clearErrors(name);
|
|
32168
32169
|
} else {
|
|
32169
32170
|
if (required) {
|
|
32170
|
-
setError(
|
|
32171
|
+
setError(name, {
|
|
32171
32172
|
type: "required",
|
|
32172
32173
|
message: `${string} ${t3("must_required")}`
|
|
32173
32174
|
});
|
|
@@ -32282,9 +32283,11 @@ var PriorityField = (props) => {
|
|
|
32282
32283
|
onChange: onChange2,
|
|
32283
32284
|
id,
|
|
32284
32285
|
viewData,
|
|
32285
|
-
model
|
|
32286
|
+
model,
|
|
32287
|
+
name,
|
|
32288
|
+
string
|
|
32286
32289
|
} = props;
|
|
32287
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
32290
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
32288
32291
|
const defaultPriority = parseInt(value) + 1;
|
|
32289
32292
|
if (!isForm) {
|
|
32290
32293
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
@@ -32328,7 +32331,7 @@ var import_react65 = require("react");
|
|
|
32328
32331
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
32329
32332
|
var RadioGroupField = (props) => {
|
|
32330
32333
|
const {
|
|
32331
|
-
name
|
|
32334
|
+
name,
|
|
32332
32335
|
readonly,
|
|
32333
32336
|
required,
|
|
32334
32337
|
placeholder,
|
|
@@ -32340,14 +32343,14 @@ var RadioGroupField = (props) => {
|
|
|
32340
32343
|
} = props;
|
|
32341
32344
|
(0, import_react65.useEffect)(() => {
|
|
32342
32345
|
if (selection?.length > 0) {
|
|
32343
|
-
if (setValue) setValue(
|
|
32346
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32344
32347
|
}
|
|
32345
|
-
}, [selection,
|
|
32348
|
+
}, [selection, name, setValue]);
|
|
32346
32349
|
if (!methods) return null;
|
|
32347
32350
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
32348
32351
|
Controller,
|
|
32349
32352
|
{
|
|
32350
|
-
name:
|
|
32353
|
+
name: name ?? "",
|
|
32351
32354
|
control: methods.control,
|
|
32352
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: [
|
|
32353
32356
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
@@ -32360,8 +32363,8 @@ var RadioGroupField = (props) => {
|
|
|
32360
32363
|
onChange: (e3) => {
|
|
32361
32364
|
if (readonly) return;
|
|
32362
32365
|
field.onChange(e3.target.value);
|
|
32363
|
-
methods.setValue(
|
|
32364
|
-
onChange2?.(
|
|
32366
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
32367
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
32365
32368
|
},
|
|
32366
32369
|
readOnly: readonly,
|
|
32367
32370
|
required: !invisible && required,
|
|
@@ -32413,7 +32416,7 @@ var SelectDropdownField = (props) => {
|
|
|
32413
32416
|
const { t: t3 } = useI18n();
|
|
32414
32417
|
const {
|
|
32415
32418
|
selection,
|
|
32416
|
-
name
|
|
32419
|
+
name,
|
|
32417
32420
|
methods,
|
|
32418
32421
|
value,
|
|
32419
32422
|
readonly,
|
|
@@ -32436,7 +32439,7 @@ var SelectDropdownField = (props) => {
|
|
|
32436
32439
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
32437
32440
|
Controller,
|
|
32438
32441
|
{
|
|
32439
|
-
name:
|
|
32442
|
+
name: name || "",
|
|
32440
32443
|
control: methods.control,
|
|
32441
32444
|
rules: {
|
|
32442
32445
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32455,7 +32458,7 @@ var SelectDropdownField = (props) => {
|
|
|
32455
32458
|
menuPlacement: "auto",
|
|
32456
32459
|
onChange: (selectedOption) => {
|
|
32457
32460
|
field.onChange(selectedOption.value);
|
|
32458
|
-
onChange2 && onChange2(
|
|
32461
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
32459
32462
|
},
|
|
32460
32463
|
value: defaultValue || null,
|
|
32461
32464
|
required: !invisible && required
|
|
@@ -32536,7 +32539,7 @@ var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
|
32536
32539
|
var TextAreaField = (props) => {
|
|
32537
32540
|
const {
|
|
32538
32541
|
methods,
|
|
32539
|
-
name
|
|
32542
|
+
name,
|
|
32540
32543
|
readonly,
|
|
32541
32544
|
placeholder,
|
|
32542
32545
|
required,
|
|
@@ -32547,7 +32550,7 @@ var TextAreaField = (props) => {
|
|
|
32547
32550
|
onChange: onChange2,
|
|
32548
32551
|
baseClassName
|
|
32549
32552
|
} = props;
|
|
32550
|
-
const formProps = methods ? methods.register(
|
|
32553
|
+
const formProps = methods ? methods.register(name, {
|
|
32551
32554
|
onBlur: (e3) => {
|
|
32552
32555
|
const newValue = e3.target.value;
|
|
32553
32556
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -32569,7 +32572,7 @@ var TextAreaField = (props) => {
|
|
|
32569
32572
|
disabled: readonly,
|
|
32570
32573
|
placeholder,
|
|
32571
32574
|
required: !invisible && required,
|
|
32572
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
32575
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
32573
32576
|
}
|
|
32574
32577
|
);
|
|
32575
32578
|
};
|
|
@@ -32578,7 +32581,7 @@ var TextAreaField = (props) => {
|
|
|
32578
32581
|
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
32579
32582
|
var ToggleButtonField = (props) => {
|
|
32580
32583
|
const {
|
|
32581
|
-
name
|
|
32584
|
+
name,
|
|
32582
32585
|
readonly = false,
|
|
32583
32586
|
required = false,
|
|
32584
32587
|
invisible = false,
|
|
@@ -32588,7 +32591,7 @@ var ToggleButtonField = (props) => {
|
|
|
32588
32591
|
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
32589
32592
|
Controller,
|
|
32590
32593
|
{
|
|
32591
|
-
name:
|
|
32594
|
+
name: name ?? "",
|
|
32592
32595
|
control: methods?.control,
|
|
32593
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: [
|
|
32594
32597
|
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
@@ -32598,10 +32601,10 @@ var ToggleButtonField = (props) => {
|
|
|
32598
32601
|
type: "checkbox",
|
|
32599
32602
|
onChange: (e3) => {
|
|
32600
32603
|
if (readonly) return;
|
|
32601
|
-
methods.setValue(
|
|
32604
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
32602
32605
|
field.onChange(e3.target.checked);
|
|
32603
32606
|
if (onChange2) {
|
|
32604
|
-
onChange2(
|
|
32607
|
+
onChange2(name ?? "", e3.target.checked);
|
|
32605
32608
|
}
|
|
32606
32609
|
},
|
|
32607
32610
|
disabled: readonly,
|
|
@@ -32648,7 +32651,7 @@ var import_react66 = require("react");
|
|
|
32648
32651
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
32649
32652
|
var IntegerField = (props) => {
|
|
32650
32653
|
const {
|
|
32651
|
-
name
|
|
32654
|
+
name,
|
|
32652
32655
|
value,
|
|
32653
32656
|
readonly,
|
|
32654
32657
|
placeholder,
|
|
@@ -32670,7 +32673,7 @@ var IntegerField = (props) => {
|
|
|
32670
32673
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
32671
32674
|
Controller,
|
|
32672
32675
|
{
|
|
32673
|
-
name:
|
|
32676
|
+
name: name || "",
|
|
32674
32677
|
control: methods.control,
|
|
32675
32678
|
rules: {
|
|
32676
32679
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32690,12 +32693,12 @@ var IntegerField = (props) => {
|
|
|
32690
32693
|
(0, import_react66.useEffect)(() => {
|
|
32691
32694
|
if (value2 !== void 0 && value2 !== null) {
|
|
32692
32695
|
setInputValue(String(value2));
|
|
32693
|
-
clearErrors(
|
|
32696
|
+
clearErrors(name);
|
|
32694
32697
|
}
|
|
32695
32698
|
}, [value2]);
|
|
32696
32699
|
const noticeError = () => {
|
|
32697
32700
|
if (required) {
|
|
32698
|
-
setError(
|
|
32701
|
+
setError(name, {
|
|
32699
32702
|
type: "required",
|
|
32700
32703
|
message: `${string} ${t3("must_required")}`
|
|
32701
32704
|
});
|
|
@@ -32713,7 +32716,7 @@ var IntegerField = (props) => {
|
|
|
32713
32716
|
if (!isNaN(parsed)) {
|
|
32714
32717
|
fieldOnChange(parsed);
|
|
32715
32718
|
isDirtyRef.current = true;
|
|
32716
|
-
clearErrors(
|
|
32719
|
+
clearErrors(name);
|
|
32717
32720
|
} else {
|
|
32718
32721
|
noticeError();
|
|
32719
32722
|
}
|
|
@@ -32739,11 +32742,11 @@ var IntegerField = (props) => {
|
|
|
32739
32742
|
return;
|
|
32740
32743
|
}
|
|
32741
32744
|
fieldOnChange(parsed);
|
|
32742
|
-
onChange2?.(
|
|
32745
|
+
onChange2?.(name ?? "", parsed);
|
|
32743
32746
|
lastCommittedValueRef.current = parsed;
|
|
32744
32747
|
isDirtyRef.current = false;
|
|
32745
32748
|
inputRef.current?.blur();
|
|
32746
|
-
clearErrors(
|
|
32749
|
+
clearErrors(name);
|
|
32747
32750
|
};
|
|
32748
32751
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
32749
32752
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
@@ -33152,7 +33155,7 @@ var Many2OneField = (props) => {
|
|
|
33152
33155
|
isForm,
|
|
33153
33156
|
isEditTable,
|
|
33154
33157
|
value: propValue,
|
|
33155
|
-
name
|
|
33158
|
+
name,
|
|
33156
33159
|
readonly,
|
|
33157
33160
|
methods,
|
|
33158
33161
|
required,
|
|
@@ -33179,7 +33182,7 @@ var Many2OneField = (props) => {
|
|
|
33179
33182
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33180
33183
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33181
33184
|
allowShowDetail && renderDetail({
|
|
33182
|
-
idToolTip: String(
|
|
33185
|
+
idToolTip: String(name) + Number(index4),
|
|
33183
33186
|
model: options2?.model ?? relation,
|
|
33184
33187
|
context: contextObject,
|
|
33185
33188
|
idForm: id
|
|
@@ -33188,8 +33191,8 @@ var Many2OneField = (props) => {
|
|
|
33188
33191
|
"span",
|
|
33189
33192
|
{
|
|
33190
33193
|
className: "cursor-pointer",
|
|
33191
|
-
"data-tooltip-id": String(
|
|
33192
|
-
id:
|
|
33194
|
+
"data-tooltip-id": String(name) + index4,
|
|
33195
|
+
id: name,
|
|
33193
33196
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33194
33197
|
}
|
|
33195
33198
|
)
|
|
@@ -33197,21 +33200,21 @@ var Many2OneField = (props) => {
|
|
|
33197
33200
|
}
|
|
33198
33201
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33199
33202
|
allowShowDetail && renderDetail({
|
|
33200
|
-
idToolTip: String(
|
|
33203
|
+
idToolTip: String(name),
|
|
33201
33204
|
model: options2?.model ?? relation,
|
|
33202
33205
|
context: contextObject,
|
|
33203
|
-
idForm: methods?.getValues(
|
|
33206
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33204
33207
|
}),
|
|
33205
33208
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33206
33209
|
"div",
|
|
33207
33210
|
{
|
|
33208
|
-
id:
|
|
33209
|
-
"data-tooltip-id":
|
|
33211
|
+
id: name,
|
|
33212
|
+
"data-tooltip-id": name,
|
|
33210
33213
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33211
33214
|
children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33212
33215
|
Controller,
|
|
33213
33216
|
{
|
|
33214
|
-
name:
|
|
33217
|
+
name: name ?? "",
|
|
33215
33218
|
control: methods?.control,
|
|
33216
33219
|
rules: {
|
|
33217
33220
|
required: required ? {
|
|
@@ -33232,7 +33235,7 @@ var Many2OneField = (props) => {
|
|
|
33232
33235
|
) ?? currentValue : currentValue ?? null;
|
|
33233
33236
|
(0, import_react68.useEffect)(() => {
|
|
33234
33237
|
if (error2 && selectedOption) {
|
|
33235
|
-
methods?.clearErrors(
|
|
33238
|
+
methods?.clearErrors(name);
|
|
33236
33239
|
}
|
|
33237
33240
|
}, [selectedOption]);
|
|
33238
33241
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
@@ -33595,7 +33598,7 @@ var ICCheck = () => {
|
|
|
33595
33598
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
33596
33599
|
var DateOptionField = (props) => {
|
|
33597
33600
|
const {
|
|
33598
|
-
name
|
|
33601
|
+
name,
|
|
33599
33602
|
readonly,
|
|
33600
33603
|
required,
|
|
33601
33604
|
invisible,
|
|
@@ -33606,7 +33609,7 @@ var DateOptionField = (props) => {
|
|
|
33606
33609
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
33607
33610
|
Controller,
|
|
33608
33611
|
{
|
|
33609
|
-
name:
|
|
33612
|
+
name: name ?? "",
|
|
33610
33613
|
control: methods?.control,
|
|
33611
33614
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
|
|
33612
33615
|
"label",
|
|
@@ -33627,9 +33630,9 @@ var DateOptionField = (props) => {
|
|
|
33627
33630
|
onChange: (e3) => {
|
|
33628
33631
|
if (readonly) return;
|
|
33629
33632
|
const value = e3.target.checked;
|
|
33630
|
-
methods.setValue(
|
|
33633
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
33631
33634
|
field.onChange(value);
|
|
33632
|
-
onChange2?.(
|
|
33635
|
+
onChange2?.(name ?? "", value);
|
|
33633
33636
|
}
|
|
33634
33637
|
}
|
|
33635
33638
|
),
|