@fctc/sme-widget-ui 2.7.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +498 -495
- package/dist/index.mjs +496 -493
- package/dist/widgets.js +498 -495
- package/dist/widgets.mjs +496 -493
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -264,13 +264,13 @@ var require_moment = __commonJS({
|
|
|
264
264
|
}, fn);
|
|
265
265
|
}
|
|
266
266
|
var deprecations = {};
|
|
267
|
-
function deprecateSimple(
|
|
267
|
+
function deprecateSimple(name, msg) {
|
|
268
268
|
if (hooks.deprecationHandler != null) {
|
|
269
|
-
hooks.deprecationHandler(
|
|
269
|
+
hooks.deprecationHandler(name, msg);
|
|
270
270
|
}
|
|
271
|
-
if (!deprecations[
|
|
271
|
+
if (!deprecations[name]) {
|
|
272
272
|
warn3(msg);
|
|
273
|
-
deprecations[
|
|
273
|
+
deprecations[name] = true;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
hooks.suppressDeprecationWarnings = false;
|
|
@@ -1552,22 +1552,22 @@ var require_moment = __commonJS({
|
|
|
1552
1552
|
}
|
|
1553
1553
|
return globalLocale;
|
|
1554
1554
|
}
|
|
1555
|
-
function isLocaleNameSane(
|
|
1556
|
-
return !!(
|
|
1555
|
+
function isLocaleNameSane(name) {
|
|
1556
|
+
return !!(name && name.match("^[^/\\\\]*$"));
|
|
1557
1557
|
}
|
|
1558
|
-
function loadLocale(
|
|
1558
|
+
function loadLocale(name) {
|
|
1559
1559
|
var oldLocale = null, aliasedRequire;
|
|
1560
|
-
if (locales[
|
|
1560
|
+
if (locales[name] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name)) {
|
|
1561
1561
|
try {
|
|
1562
1562
|
oldLocale = globalLocale._abbr;
|
|
1563
1563
|
aliasedRequire = __require;
|
|
1564
|
-
aliasedRequire("./locale/" +
|
|
1564
|
+
aliasedRequire("./locale/" + name);
|
|
1565
1565
|
getSetGlobalLocale(oldLocale);
|
|
1566
1566
|
} catch (e3) {
|
|
1567
|
-
locales[
|
|
1567
|
+
locales[name] = null;
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
-
return locales[
|
|
1570
|
+
return locales[name];
|
|
1571
1571
|
}
|
|
1572
1572
|
function getSetGlobalLocale(key, values) {
|
|
1573
1573
|
var data;
|
|
@@ -1589,16 +1589,16 @@ var require_moment = __commonJS({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
return globalLocale._abbr;
|
|
1591
1591
|
}
|
|
1592
|
-
function defineLocale(
|
|
1592
|
+
function defineLocale(name, config) {
|
|
1593
1593
|
if (config !== null) {
|
|
1594
1594
|
var locale2, parentConfig = baseConfig;
|
|
1595
|
-
config.abbr =
|
|
1596
|
-
if (locales[
|
|
1595
|
+
config.abbr = name;
|
|
1596
|
+
if (locales[name] != null) {
|
|
1597
1597
|
deprecateSimple(
|
|
1598
1598
|
"defineLocaleOverride",
|
|
1599
1599
|
"use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
|
|
1600
1600
|
);
|
|
1601
|
-
parentConfig = locales[
|
|
1601
|
+
parentConfig = locales[name]._config;
|
|
1602
1602
|
} else if (config.parentLocale != null) {
|
|
1603
1603
|
if (locales[config.parentLocale] != null) {
|
|
1604
1604
|
parentConfig = locales[config.parentLocale]._config;
|
|
@@ -1611,58 +1611,58 @@ var require_moment = __commonJS({
|
|
|
1611
1611
|
localeFamilies[config.parentLocale] = [];
|
|
1612
1612
|
}
|
|
1613
1613
|
localeFamilies[config.parentLocale].push({
|
|
1614
|
-
name
|
|
1614
|
+
name,
|
|
1615
1615
|
config
|
|
1616
1616
|
});
|
|
1617
1617
|
return null;
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
|
-
locales[
|
|
1622
|
-
if (localeFamilies[
|
|
1623
|
-
localeFamilies[
|
|
1621
|
+
locales[name] = new Locale(mergeConfigs(parentConfig, config));
|
|
1622
|
+
if (localeFamilies[name]) {
|
|
1623
|
+
localeFamilies[name].forEach(function(x2) {
|
|
1624
1624
|
defineLocale(x2.name, x2.config);
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
|
-
getSetGlobalLocale(
|
|
1628
|
-
return locales[
|
|
1627
|
+
getSetGlobalLocale(name);
|
|
1628
|
+
return locales[name];
|
|
1629
1629
|
} else {
|
|
1630
|
-
delete locales[
|
|
1630
|
+
delete locales[name];
|
|
1631
1631
|
return null;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
|
-
function updateLocale(
|
|
1634
|
+
function updateLocale(name, config) {
|
|
1635
1635
|
if (config != null) {
|
|
1636
1636
|
var locale2, tmpLocale, parentConfig = baseConfig;
|
|
1637
|
-
if (locales[
|
|
1638
|
-
locales[
|
|
1637
|
+
if (locales[name] != null && locales[name].parentLocale != null) {
|
|
1638
|
+
locales[name].set(mergeConfigs(locales[name]._config, config));
|
|
1639
1639
|
} else {
|
|
1640
|
-
tmpLocale = loadLocale(
|
|
1640
|
+
tmpLocale = loadLocale(name);
|
|
1641
1641
|
if (tmpLocale != null) {
|
|
1642
1642
|
parentConfig = tmpLocale._config;
|
|
1643
1643
|
}
|
|
1644
1644
|
config = mergeConfigs(parentConfig, config);
|
|
1645
1645
|
if (tmpLocale == null) {
|
|
1646
|
-
config.abbr =
|
|
1646
|
+
config.abbr = name;
|
|
1647
1647
|
}
|
|
1648
1648
|
locale2 = new Locale(config);
|
|
1649
|
-
locale2.parentLocale = locales[
|
|
1650
|
-
locales[
|
|
1649
|
+
locale2.parentLocale = locales[name];
|
|
1650
|
+
locales[name] = locale2;
|
|
1651
1651
|
}
|
|
1652
|
-
getSetGlobalLocale(
|
|
1652
|
+
getSetGlobalLocale(name);
|
|
1653
1653
|
} else {
|
|
1654
|
-
if (locales[
|
|
1655
|
-
if (locales[
|
|
1656
|
-
locales[
|
|
1657
|
-
if (
|
|
1658
|
-
getSetGlobalLocale(
|
|
1654
|
+
if (locales[name] != null) {
|
|
1655
|
+
if (locales[name].parentLocale != null) {
|
|
1656
|
+
locales[name] = locales[name].parentLocale;
|
|
1657
|
+
if (name === getSetGlobalLocale()) {
|
|
1658
|
+
getSetGlobalLocale(name);
|
|
1659
1659
|
}
|
|
1660
|
-
} else if (locales[
|
|
1661
|
-
delete locales[
|
|
1660
|
+
} else if (locales[name] != null) {
|
|
1661
|
+
delete locales[name];
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
-
return locales[
|
|
1665
|
+
return locales[name];
|
|
1666
1666
|
}
|
|
1667
1667
|
function getLocale(key) {
|
|
1668
1668
|
var locale2;
|
|
@@ -2568,13 +2568,13 @@ var require_moment = __commonJS({
|
|
|
2568
2568
|
}
|
|
2569
2569
|
return res;
|
|
2570
2570
|
}
|
|
2571
|
-
function createAdder(direction,
|
|
2571
|
+
function createAdder(direction, name) {
|
|
2572
2572
|
return function(val, period) {
|
|
2573
2573
|
var dur, tmp;
|
|
2574
2574
|
if (period !== null && !isNaN(+period)) {
|
|
2575
2575
|
deprecateSimple(
|
|
2576
|
-
|
|
2577
|
-
"moment()." +
|
|
2576
|
+
name,
|
|
2577
|
+
"moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
|
|
2578
2578
|
);
|
|
2579
2579
|
tmp = val;
|
|
2580
2580
|
val = period;
|
|
@@ -3153,10 +3153,10 @@ var require_moment = __commonJS({
|
|
|
3153
3153
|
return eras;
|
|
3154
3154
|
}
|
|
3155
3155
|
function localeErasParse(eraName, format3, strict) {
|
|
3156
|
-
var i3, l2, eras = this.eras(),
|
|
3156
|
+
var i3, l2, eras = this.eras(), name, abbr, narrow;
|
|
3157
3157
|
eraName = eraName.toUpperCase();
|
|
3158
3158
|
for (i3 = 0, l2 = eras.length; i3 < l2; ++i3) {
|
|
3159
|
-
|
|
3159
|
+
name = eras[i3].name.toUpperCase();
|
|
3160
3160
|
abbr = eras[i3].abbr.toUpperCase();
|
|
3161
3161
|
narrow = eras[i3].narrow.toUpperCase();
|
|
3162
3162
|
if (strict) {
|
|
@@ -3169,7 +3169,7 @@ var require_moment = __commonJS({
|
|
|
3169
3169
|
}
|
|
3170
3170
|
break;
|
|
3171
3171
|
case "NNNN":
|
|
3172
|
-
if (
|
|
3172
|
+
if (name === eraName) {
|
|
3173
3173
|
return eras[i3];
|
|
3174
3174
|
}
|
|
3175
3175
|
break;
|
|
@@ -3179,7 +3179,7 @@ var require_moment = __commonJS({
|
|
|
3179
3179
|
}
|
|
3180
3180
|
break;
|
|
3181
3181
|
}
|
|
3182
|
-
} else if ([
|
|
3182
|
+
} else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
|
|
3183
3183
|
return eras[i3];
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
@@ -3817,9 +3817,9 @@ var require_moment = __commonJS({
|
|
|
3817
3817
|
units = normalizeUnits(units);
|
|
3818
3818
|
return this.isValid() ? this[units + "s"]() : NaN;
|
|
3819
3819
|
}
|
|
3820
|
-
function makeGetter(
|
|
3820
|
+
function makeGetter(name) {
|
|
3821
3821
|
return function() {
|
|
3822
|
-
return this.isValid() ? this._data[
|
|
3822
|
+
return this.isValid() ? this._data[name] : NaN;
|
|
3823
3823
|
};
|
|
3824
3824
|
}
|
|
3825
3825
|
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
|
|
@@ -5004,10 +5004,10 @@ function useFileInfo(source, options2) {
|
|
|
5004
5004
|
let localUrl = null;
|
|
5005
5005
|
let fr = null;
|
|
5006
5006
|
let mediaEl = null;
|
|
5007
|
-
const makeExtension = (
|
|
5008
|
-
if (
|
|
5009
|
-
const idx =
|
|
5010
|
-
if (idx > -1) return
|
|
5007
|
+
const makeExtension = (name, type) => {
|
|
5008
|
+
if (name) {
|
|
5009
|
+
const idx = name.lastIndexOf(".");
|
|
5010
|
+
if (idx > -1) return name.slice(idx + 1).toLowerCase();
|
|
5011
5011
|
}
|
|
5012
5012
|
if (type) {
|
|
5013
5013
|
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
@@ -8543,11 +8543,11 @@ var Formatter = class {
|
|
|
8543
8543
|
};
|
|
8544
8544
|
this.formatSeparator = options2.interpolation.formatSeparator || ",";
|
|
8545
8545
|
}
|
|
8546
|
-
add(
|
|
8547
|
-
this.formats[
|
|
8546
|
+
add(name, fc) {
|
|
8547
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
8548
8548
|
}
|
|
8549
|
-
addCached(
|
|
8550
|
-
this.formats[
|
|
8549
|
+
addCached(name, fc) {
|
|
8550
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
8551
8551
|
}
|
|
8552
8552
|
format(value, format2, lng) {
|
|
8553
8553
|
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -8583,9 +8583,9 @@ var Formatter = class {
|
|
|
8583
8583
|
return result;
|
|
8584
8584
|
}
|
|
8585
8585
|
};
|
|
8586
|
-
var removePending = (q3,
|
|
8587
|
-
if (q3.pending[
|
|
8588
|
-
delete q3.pending[
|
|
8586
|
+
var removePending = (q3, name) => {
|
|
8587
|
+
if (q3.pending[name] !== void 0) {
|
|
8588
|
+
delete q3.pending[name];
|
|
8589
8589
|
q3.pendingCount--;
|
|
8590
8590
|
}
|
|
8591
8591
|
};
|
|
@@ -8616,17 +8616,17 @@ var Connector = class extends EventEmitter {
|
|
|
8616
8616
|
languages.forEach((lng) => {
|
|
8617
8617
|
let hasAllNamespaces = true;
|
|
8618
8618
|
namespaces.forEach((ns) => {
|
|
8619
|
-
const
|
|
8619
|
+
const name = `${lng}|${ns}`;
|
|
8620
8620
|
if (!options2.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
8621
|
-
this.state[
|
|
8622
|
-
} else if (this.state[
|
|
8623
|
-
else if (this.state[
|
|
8624
|
-
if (pending[
|
|
8621
|
+
this.state[name] = 2;
|
|
8622
|
+
} else if (this.state[name] < 0) ;
|
|
8623
|
+
else if (this.state[name] === 1) {
|
|
8624
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
8625
8625
|
} else {
|
|
8626
|
-
this.state[
|
|
8626
|
+
this.state[name] = 1;
|
|
8627
8627
|
hasAllNamespaces = false;
|
|
8628
|
-
if (pending[
|
|
8629
|
-
if (toLoad[
|
|
8628
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
8629
|
+
if (toLoad[name] === void 0) toLoad[name] = true;
|
|
8630
8630
|
if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true;
|
|
8631
8631
|
}
|
|
8632
8632
|
});
|
|
@@ -8648,8 +8648,8 @@ var Connector = class extends EventEmitter {
|
|
|
8648
8648
|
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
8649
8649
|
};
|
|
8650
8650
|
}
|
|
8651
|
-
loaded(
|
|
8652
|
-
const s4 =
|
|
8651
|
+
loaded(name, err, data) {
|
|
8652
|
+
const s4 = name.split("|");
|
|
8653
8653
|
const lng = s4[0];
|
|
8654
8654
|
const ns = s4[1];
|
|
8655
8655
|
if (err) this.emit("failedLoading", lng, ns, err);
|
|
@@ -8658,12 +8658,12 @@ var Connector = class extends EventEmitter {
|
|
|
8658
8658
|
skipCopy: true
|
|
8659
8659
|
});
|
|
8660
8660
|
}
|
|
8661
|
-
this.state[
|
|
8662
|
-
if (err && data) this.state[
|
|
8661
|
+
this.state[name] = err ? -1 : 2;
|
|
8662
|
+
if (err && data) this.state[name] = 0;
|
|
8663
8663
|
const loaded = {};
|
|
8664
8664
|
this.queue.forEach((q3) => {
|
|
8665
8665
|
pushPath(q3.loaded, [lng], ns);
|
|
8666
|
-
removePending(q3,
|
|
8666
|
+
removePending(q3, name);
|
|
8667
8667
|
if (err) q3.errors.push(err);
|
|
8668
8668
|
if (q3.pendingCount === 0 && !q3.done) {
|
|
8669
8669
|
Object.keys(q3.loaded).forEach((l2) => {
|
|
@@ -8747,8 +8747,8 @@ var Connector = class extends EventEmitter {
|
|
|
8747
8747
|
if (!toLoad.pending.length) callback();
|
|
8748
8748
|
return null;
|
|
8749
8749
|
}
|
|
8750
|
-
toLoad.toLoad.forEach((
|
|
8751
|
-
this.loadOne(
|
|
8750
|
+
toLoad.toLoad.forEach((name) => {
|
|
8751
|
+
this.loadOne(name);
|
|
8752
8752
|
});
|
|
8753
8753
|
}
|
|
8754
8754
|
load(languages, namespaces, callback) {
|
|
@@ -8759,15 +8759,15 @@ var Connector = class extends EventEmitter {
|
|
|
8759
8759
|
reload: true
|
|
8760
8760
|
}, callback);
|
|
8761
8761
|
}
|
|
8762
|
-
loadOne(
|
|
8762
|
+
loadOne(name) {
|
|
8763
8763
|
let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
8764
|
-
const s4 =
|
|
8764
|
+
const s4 = name.split("|");
|
|
8765
8765
|
const lng = s4[0];
|
|
8766
8766
|
const ns = s4[1];
|
|
8767
8767
|
this.read(lng, ns, "read", void 0, void 0, (err, data) => {
|
|
8768
8768
|
if (err) this.logger.warn(`${prefix2}loading namespace ${ns} for language ${lng} failed`, err);
|
|
8769
8769
|
if (!err && data) this.logger.log(`${prefix2}loaded namespace ${ns} for language ${lng}`, data);
|
|
8770
|
-
this.loaded(
|
|
8770
|
+
this.loaded(name, err, data);
|
|
8771
8771
|
});
|
|
8772
8772
|
}
|
|
8773
8773
|
saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
@@ -9417,13 +9417,13 @@ function hasXSS(input) {
|
|
|
9417
9417
|
return xssPatterns.some((pattern) => pattern.test(input));
|
|
9418
9418
|
}
|
|
9419
9419
|
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
9420
|
-
var serializeCookie = function(
|
|
9420
|
+
var serializeCookie = function(name, val) {
|
|
9421
9421
|
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
9422
9422
|
path: "/"
|
|
9423
9423
|
};
|
|
9424
9424
|
const opt = options2;
|
|
9425
9425
|
const value = encodeURIComponent(val);
|
|
9426
|
-
let str = `${
|
|
9426
|
+
let str = `${name}=${value}`;
|
|
9427
9427
|
if (opt.maxAge > 0) {
|
|
9428
9428
|
const maxAge = opt.maxAge - 0;
|
|
9429
9429
|
if (Number.isNaN(maxAge)) throw new Error("maxAge should be a Number");
|
|
@@ -9472,7 +9472,7 @@ var serializeCookie = function(name2, val) {
|
|
|
9472
9472
|
return str;
|
|
9473
9473
|
};
|
|
9474
9474
|
var cookie = {
|
|
9475
|
-
create(
|
|
9475
|
+
create(name, value, minutes, domain) {
|
|
9476
9476
|
let cookieOptions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
9477
9477
|
path: "/",
|
|
9478
9478
|
sameSite: "strict"
|
|
@@ -9482,10 +9482,10 @@ var cookie = {
|
|
|
9482
9482
|
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1e3);
|
|
9483
9483
|
}
|
|
9484
9484
|
if (domain) cookieOptions.domain = domain;
|
|
9485
|
-
document.cookie = serializeCookie(
|
|
9485
|
+
document.cookie = serializeCookie(name, value, cookieOptions);
|
|
9486
9486
|
},
|
|
9487
|
-
read(
|
|
9488
|
-
const nameEQ = `${
|
|
9487
|
+
read(name) {
|
|
9488
|
+
const nameEQ = `${name}=`;
|
|
9489
9489
|
const ca = document.cookie.split(";");
|
|
9490
9490
|
for (let i3 = 0; i3 < ca.length; i3++) {
|
|
9491
9491
|
let c2 = ca[i3];
|
|
@@ -9494,8 +9494,8 @@ var cookie = {
|
|
|
9494
9494
|
}
|
|
9495
9495
|
return null;
|
|
9496
9496
|
},
|
|
9497
|
-
remove(
|
|
9498
|
-
this.create(
|
|
9497
|
+
remove(name, domain) {
|
|
9498
|
+
this.create(name, "", -1, domain);
|
|
9499
9499
|
}
|
|
9500
9500
|
};
|
|
9501
9501
|
var cookie$1 = {
|
|
@@ -11357,7 +11357,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11357
11357
|
let resetCount = 0;
|
|
11358
11358
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
11359
11359
|
const {
|
|
11360
|
-
name
|
|
11360
|
+
name,
|
|
11361
11361
|
fn
|
|
11362
11362
|
} = validMiddleware[i3];
|
|
11363
11363
|
const {
|
|
@@ -11383,8 +11383,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11383
11383
|
y3 = nextY != null ? nextY : y3;
|
|
11384
11384
|
middlewareData = {
|
|
11385
11385
|
...middlewareData,
|
|
11386
|
-
[
|
|
11387
|
-
...middlewareData[
|
|
11386
|
+
[name]: {
|
|
11387
|
+
...middlewareData[name],
|
|
11388
11388
|
...data
|
|
11389
11389
|
}
|
|
11390
11390
|
};
|
|
@@ -12974,7 +12974,8 @@ var TableHead = (props) => {
|
|
|
12974
12974
|
{
|
|
12975
12975
|
style: {
|
|
12976
12976
|
width: "40px",
|
|
12977
|
-
maxWidth: "40px"
|
|
12977
|
+
maxWidth: "40px",
|
|
12978
|
+
overflow: "unset !important"
|
|
12978
12979
|
},
|
|
12979
12980
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
12980
12981
|
children: /* @__PURE__ */ jsx51(
|
|
@@ -13449,8 +13450,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
13449
13450
|
var isObjectType = (value) => typeof value === "object";
|
|
13450
13451
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
13451
13452
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
13452
|
-
var getNodeParentName = (
|
|
13453
|
-
var isNameInFieldArray = (names,
|
|
13453
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
13454
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
13454
13455
|
var isPlainObject = (tempObject) => {
|
|
13455
13456
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
13456
13457
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -13554,7 +13555,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
13554
13555
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
13555
13556
|
function useFormState(props) {
|
|
13556
13557
|
const methods = useFormContext();
|
|
13557
|
-
const { control = methods.control, disabled, name
|
|
13558
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
13558
13559
|
const [formState, updateFormState] = React.useState(control._formState);
|
|
13559
13560
|
const _localProxyFormState = React.useRef({
|
|
13560
13561
|
isDirty: false,
|
|
@@ -13567,7 +13568,7 @@ function useFormState(props) {
|
|
|
13567
13568
|
errors: false
|
|
13568
13569
|
});
|
|
13569
13570
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13570
|
-
name
|
|
13571
|
+
name,
|
|
13571
13572
|
formState: _localProxyFormState.current,
|
|
13572
13573
|
exact,
|
|
13573
13574
|
callback: (formState2) => {
|
|
@@ -13576,7 +13577,7 @@ function useFormState(props) {
|
|
|
13576
13577
|
...formState2
|
|
13577
13578
|
});
|
|
13578
13579
|
}
|
|
13579
|
-
}), [
|
|
13580
|
+
}), [name, disabled, exact]);
|
|
13580
13581
|
React.useEffect(() => {
|
|
13581
13582
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
13582
13583
|
}, [control]);
|
|
@@ -13628,22 +13629,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
13628
13629
|
}
|
|
13629
13630
|
function useWatch(props) {
|
|
13630
13631
|
const methods = useFormContext();
|
|
13631
|
-
const { control = methods.control, name
|
|
13632
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
13632
13633
|
const _defaultValue = React.useRef(defaultValue);
|
|
13633
13634
|
const _compute = React.useRef(compute);
|
|
13634
13635
|
const _computeFormValues = React.useRef(void 0);
|
|
13635
13636
|
_compute.current = compute;
|
|
13636
|
-
const defaultValueMemo = React.useMemo(() => control._getWatch(
|
|
13637
|
+
const defaultValueMemo = React.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
13637
13638
|
const [value, updateValue] = React.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
13638
13639
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13639
|
-
name
|
|
13640
|
+
name,
|
|
13640
13641
|
formState: {
|
|
13641
13642
|
values: true
|
|
13642
13643
|
},
|
|
13643
13644
|
exact,
|
|
13644
13645
|
callback: (formState) => {
|
|
13645
13646
|
if (!disabled) {
|
|
13646
|
-
const formValues = generateWatchOutput(
|
|
13647
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
13647
13648
|
if (_compute.current) {
|
|
13648
13649
|
const computedFormValues = _compute.current(formValues);
|
|
13649
13650
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -13655,28 +13656,28 @@ function useWatch(props) {
|
|
|
13655
13656
|
}
|
|
13656
13657
|
}
|
|
13657
13658
|
}
|
|
13658
|
-
}), [control, disabled,
|
|
13659
|
+
}), [control, disabled, name, exact]);
|
|
13659
13660
|
React.useEffect(() => control._removeUnmounted());
|
|
13660
13661
|
return value;
|
|
13661
13662
|
}
|
|
13662
13663
|
function useController(props) {
|
|
13663
13664
|
const methods = useFormContext();
|
|
13664
|
-
const { name
|
|
13665
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
13666
|
-
const defaultValueMemo = React.useMemo(() => get2(control._formValues,
|
|
13665
|
+
const { name, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
13666
|
+
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
13667
|
+
const defaultValueMemo = React.useMemo(() => get2(control._formValues, name, get2(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
13667
13668
|
const value = useWatch({
|
|
13668
13669
|
control,
|
|
13669
|
-
name
|
|
13670
|
+
name,
|
|
13670
13671
|
defaultValue: defaultValueMemo,
|
|
13671
13672
|
exact: true
|
|
13672
13673
|
});
|
|
13673
13674
|
const formState = useFormState({
|
|
13674
13675
|
control,
|
|
13675
|
-
name
|
|
13676
|
+
name,
|
|
13676
13677
|
exact: true
|
|
13677
13678
|
});
|
|
13678
13679
|
const _props = React.useRef(props);
|
|
13679
|
-
const _registerProps = React.useRef(control.register(
|
|
13680
|
+
const _registerProps = React.useRef(control.register(name, {
|
|
13680
13681
|
...props.rules,
|
|
13681
13682
|
value,
|
|
13682
13683
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -13685,41 +13686,41 @@ function useController(props) {
|
|
|
13685
13686
|
const fieldState = React.useMemo(() => Object.defineProperties({}, {
|
|
13686
13687
|
invalid: {
|
|
13687
13688
|
enumerable: true,
|
|
13688
|
-
get: () => !!get2(formState.errors,
|
|
13689
|
+
get: () => !!get2(formState.errors, name)
|
|
13689
13690
|
},
|
|
13690
13691
|
isDirty: {
|
|
13691
13692
|
enumerable: true,
|
|
13692
|
-
get: () => !!get2(formState.dirtyFields,
|
|
13693
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
13693
13694
|
},
|
|
13694
13695
|
isTouched: {
|
|
13695
13696
|
enumerable: true,
|
|
13696
|
-
get: () => !!get2(formState.touchedFields,
|
|
13697
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
13697
13698
|
},
|
|
13698
13699
|
isValidating: {
|
|
13699
13700
|
enumerable: true,
|
|
13700
|
-
get: () => !!get2(formState.validatingFields,
|
|
13701
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
13701
13702
|
},
|
|
13702
13703
|
error: {
|
|
13703
13704
|
enumerable: true,
|
|
13704
|
-
get: () => get2(formState.errors,
|
|
13705
|
+
get: () => get2(formState.errors, name)
|
|
13705
13706
|
}
|
|
13706
|
-
}), [formState,
|
|
13707
|
+
}), [formState, name]);
|
|
13707
13708
|
const onChange2 = React.useCallback((event) => _registerProps.current.onChange({
|
|
13708
13709
|
target: {
|
|
13709
13710
|
value: getEventValue(event),
|
|
13710
|
-
name
|
|
13711
|
+
name
|
|
13711
13712
|
},
|
|
13712
13713
|
type: EVENTS.CHANGE
|
|
13713
|
-
}), [
|
|
13714
|
+
}), [name]);
|
|
13714
13715
|
const onBlur = React.useCallback(() => _registerProps.current.onBlur({
|
|
13715
13716
|
target: {
|
|
13716
|
-
value: get2(control._formValues,
|
|
13717
|
-
name
|
|
13717
|
+
value: get2(control._formValues, name),
|
|
13718
|
+
name
|
|
13718
13719
|
},
|
|
13719
13720
|
type: EVENTS.BLUR
|
|
13720
|
-
}), [
|
|
13721
|
+
}), [name, control._formValues]);
|
|
13721
13722
|
const ref = React.useCallback((elm) => {
|
|
13722
|
-
const field2 = get2(control._fields,
|
|
13723
|
+
const field2 = get2(control._fields, name);
|
|
13723
13724
|
if (field2 && elm) {
|
|
13724
13725
|
field2._f.ref = {
|
|
13725
13726
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -13728,46 +13729,46 @@ function useController(props) {
|
|
|
13728
13729
|
reportValidity: () => elm.reportValidity()
|
|
13729
13730
|
};
|
|
13730
13731
|
}
|
|
13731
|
-
}, [control._fields,
|
|
13732
|
+
}, [control._fields, name]);
|
|
13732
13733
|
const field = React.useMemo(() => ({
|
|
13733
|
-
name
|
|
13734
|
+
name,
|
|
13734
13735
|
value,
|
|
13735
13736
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
13736
13737
|
onChange: onChange2,
|
|
13737
13738
|
onBlur,
|
|
13738
13739
|
ref
|
|
13739
|
-
}), [
|
|
13740
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
13740
13741
|
React.useEffect(() => {
|
|
13741
13742
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
13742
|
-
control.register(
|
|
13743
|
+
control.register(name, {
|
|
13743
13744
|
..._props.current.rules,
|
|
13744
13745
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
13745
13746
|
});
|
|
13746
|
-
const updateMounted = (
|
|
13747
|
-
const field2 = get2(control._fields,
|
|
13747
|
+
const updateMounted = (name2, value2) => {
|
|
13748
|
+
const field2 = get2(control._fields, name2);
|
|
13748
13749
|
if (field2 && field2._f) {
|
|
13749
13750
|
field2._f.mount = value2;
|
|
13750
13751
|
}
|
|
13751
13752
|
};
|
|
13752
|
-
updateMounted(
|
|
13753
|
+
updateMounted(name, true);
|
|
13753
13754
|
if (_shouldUnregisterField) {
|
|
13754
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
13755
|
-
set(control._defaultValues,
|
|
13756
|
-
if (isUndefined(get2(control._formValues,
|
|
13757
|
-
set(control._formValues,
|
|
13755
|
+
const value2 = cloneObject(get2(control._options.defaultValues, name));
|
|
13756
|
+
set(control._defaultValues, name, value2);
|
|
13757
|
+
if (isUndefined(get2(control._formValues, name))) {
|
|
13758
|
+
set(control._formValues, name, value2);
|
|
13758
13759
|
}
|
|
13759
13760
|
}
|
|
13760
|
-
!isArrayField && control.register(
|
|
13761
|
+
!isArrayField && control.register(name);
|
|
13761
13762
|
return () => {
|
|
13762
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
13763
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
13763
13764
|
};
|
|
13764
|
-
}, [
|
|
13765
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
13765
13766
|
React.useEffect(() => {
|
|
13766
13767
|
control._setDisabledField({
|
|
13767
13768
|
disabled,
|
|
13768
|
-
name
|
|
13769
|
+
name
|
|
13769
13770
|
});
|
|
13770
|
-
}, [disabled,
|
|
13771
|
+
}, [disabled, name, control]);
|
|
13771
13772
|
return React.useMemo(() => ({
|
|
13772
13773
|
field,
|
|
13773
13774
|
formState,
|
|
@@ -13775,10 +13776,10 @@ function useController(props) {
|
|
|
13775
13776
|
}), [field, formState, fieldState]);
|
|
13776
13777
|
}
|
|
13777
13778
|
var Controller = (props) => props.render(useController(props));
|
|
13778
|
-
var appendErrors = (
|
|
13779
|
-
...errors[
|
|
13779
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
13780
|
+
...errors[name],
|
|
13780
13781
|
types: {
|
|
13781
|
-
...errors[
|
|
13782
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
13782
13783
|
[type]: message2 || true
|
|
13783
13784
|
}
|
|
13784
13785
|
} : {};
|
|
@@ -13938,9 +13939,9 @@ function getFieldValue(_f) {
|
|
|
13938
13939
|
}
|
|
13939
13940
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
13940
13941
|
const fields = {};
|
|
13941
|
-
for (const
|
|
13942
|
-
const field = get2(_fields,
|
|
13943
|
-
field && set(fields,
|
|
13942
|
+
for (const name of fieldsNames) {
|
|
13943
|
+
const field = get2(_fields, name);
|
|
13944
|
+
field && set(fields, name, field._f);
|
|
13944
13945
|
}
|
|
13945
13946
|
return {
|
|
13946
13947
|
criteriaMode,
|
|
@@ -13961,7 +13962,7 @@ var getValidationModes = (mode) => ({
|
|
|
13961
13962
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
13962
13963
|
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));
|
|
13963
13964
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
13964
|
-
var isWatched = (
|
|
13965
|
+
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))));
|
|
13965
13966
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
13966
13967
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
13967
13968
|
const field = get2(fields, key);
|
|
@@ -13986,21 +13987,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
13986
13987
|
}
|
|
13987
13988
|
return;
|
|
13988
13989
|
};
|
|
13989
|
-
function schemaErrorLookup(errors, _fields,
|
|
13990
|
-
const error2 = get2(errors,
|
|
13991
|
-
if (error2 || isKey(
|
|
13990
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
13991
|
+
const error2 = get2(errors, name);
|
|
13992
|
+
if (error2 || isKey(name)) {
|
|
13992
13993
|
return {
|
|
13993
13994
|
error: error2,
|
|
13994
|
-
name
|
|
13995
|
+
name
|
|
13995
13996
|
};
|
|
13996
13997
|
}
|
|
13997
|
-
const names =
|
|
13998
|
+
const names = name.split(".");
|
|
13998
13999
|
while (names.length) {
|
|
13999
14000
|
const fieldName = names.join(".");
|
|
14000
14001
|
const field = get2(_fields, fieldName);
|
|
14001
14002
|
const foundError = get2(errors, fieldName);
|
|
14002
|
-
if (field && !Array.isArray(field) &&
|
|
14003
|
-
return { name
|
|
14003
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
14004
|
+
return { name };
|
|
14004
14005
|
}
|
|
14005
14006
|
if (foundError && foundError.type) {
|
|
14006
14007
|
return {
|
|
@@ -14017,15 +14018,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
14017
14018
|
names.pop();
|
|
14018
14019
|
}
|
|
14019
14020
|
return {
|
|
14020
|
-
name
|
|
14021
|
+
name
|
|
14021
14022
|
};
|
|
14022
14023
|
}
|
|
14023
14024
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
14024
14025
|
updateFormState(formStateData);
|
|
14025
|
-
const { name
|
|
14026
|
+
const { name, ...formState } = formStateData;
|
|
14026
14027
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
14027
14028
|
};
|
|
14028
|
-
var shouldSubscribeByName = (
|
|
14029
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
14029
14030
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
14030
14031
|
if (mode.isOnAll) {
|
|
14031
14032
|
return false;
|
|
@@ -14038,11 +14039,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
14038
14039
|
}
|
|
14039
14040
|
return true;
|
|
14040
14041
|
};
|
|
14041
|
-
var unsetEmptyArray = (ref,
|
|
14042
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
14043
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
14044
|
-
set(fieldArrayErrors, "root", error2[
|
|
14045
|
-
set(errors,
|
|
14042
|
+
var unsetEmptyArray = (ref, name) => !compact(get2(ref, name)).length && unset(ref, name);
|
|
14043
|
+
var updateFieldArrayRootError = (errors, error2, name) => {
|
|
14044
|
+
const fieldArrayErrors = convertToArrayPayload(get2(errors, name));
|
|
14045
|
+
set(fieldArrayErrors, "root", error2[name]);
|
|
14046
|
+
set(errors, name, fieldArrayErrors);
|
|
14046
14047
|
return errors;
|
|
14047
14048
|
};
|
|
14048
14049
|
var isMessage = (value) => isString3(value);
|
|
@@ -14060,9 +14061,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
14060
14061
|
message: ""
|
|
14061
14062
|
};
|
|
14062
14063
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
14063
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
14064
|
-
const inputValue = get2(formValues,
|
|
14065
|
-
if (!mount || disabledFieldNames.has(
|
|
14064
|
+
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name, valueAsNumber, mount } = field._f;
|
|
14065
|
+
const inputValue = get2(formValues, name);
|
|
14066
|
+
if (!mount || disabledFieldNames.has(name)) {
|
|
14066
14067
|
return {};
|
|
14067
14068
|
}
|
|
14068
14069
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -14077,10 +14078,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14077
14078
|
const isCheckBox = isCheckBoxInput(ref);
|
|
14078
14079
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
14079
14080
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
14080
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
14081
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
14081
14082
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
14082
14083
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
14083
|
-
error2[
|
|
14084
|
+
error2[name] = {
|
|
14084
14085
|
type: exceedMax ? maxType : minType,
|
|
14085
14086
|
message: message2,
|
|
14086
14087
|
ref,
|
|
@@ -14090,7 +14091,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14090
14091
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
14091
14092
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
14092
14093
|
if (value) {
|
|
14093
|
-
error2[
|
|
14094
|
+
error2[name] = {
|
|
14094
14095
|
type: INPUT_VALIDATION_RULES.required,
|
|
14095
14096
|
message: message2,
|
|
14096
14097
|
ref: inputRef,
|
|
@@ -14130,7 +14131,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14130
14131
|
if (exceedMax || exceedMin) {
|
|
14131
14132
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
14132
14133
|
if (!validateAllFieldCriteria) {
|
|
14133
|
-
setCustomValidity(error2[
|
|
14134
|
+
setCustomValidity(error2[name].message);
|
|
14134
14135
|
return error2;
|
|
14135
14136
|
}
|
|
14136
14137
|
}
|
|
@@ -14143,7 +14144,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14143
14144
|
if (exceedMax || exceedMin) {
|
|
14144
14145
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
14145
14146
|
if (!validateAllFieldCriteria) {
|
|
14146
|
-
setCustomValidity(error2[
|
|
14147
|
+
setCustomValidity(error2[name].message);
|
|
14147
14148
|
return error2;
|
|
14148
14149
|
}
|
|
14149
14150
|
}
|
|
@@ -14151,7 +14152,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14151
14152
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
14152
14153
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
14153
14154
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
14154
|
-
error2[
|
|
14155
|
+
error2[name] = {
|
|
14155
14156
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
14156
14157
|
message: message2,
|
|
14157
14158
|
ref,
|
|
@@ -14168,7 +14169,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14168
14169
|
const result = await validate(inputValue, formValues);
|
|
14169
14170
|
const validateError = getValidateError(result, inputRef);
|
|
14170
14171
|
if (validateError) {
|
|
14171
|
-
error2[
|
|
14172
|
+
error2[name] = {
|
|
14172
14173
|
...validateError,
|
|
14173
14174
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
14174
14175
|
};
|
|
@@ -14191,12 +14192,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14191
14192
|
};
|
|
14192
14193
|
setCustomValidity(validateError.message);
|
|
14193
14194
|
if (validateAllFieldCriteria) {
|
|
14194
|
-
error2[
|
|
14195
|
+
error2[name] = validationResult;
|
|
14195
14196
|
}
|
|
14196
14197
|
}
|
|
14197
14198
|
}
|
|
14198
14199
|
if (!isEmptyObject(validationResult)) {
|
|
14199
|
-
error2[
|
|
14200
|
+
error2[name] = {
|
|
14200
14201
|
ref: inputRef,
|
|
14201
14202
|
...validationResult
|
|
14202
14203
|
};
|
|
@@ -14285,9 +14286,9 @@ function createFormControl(props = {}) {
|
|
|
14285
14286
|
};
|
|
14286
14287
|
const _updateIsValidating = (names, isValidating) => {
|
|
14287
14288
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
14288
|
-
(names || Array.from(_names.mount)).forEach((
|
|
14289
|
-
if (
|
|
14290
|
-
isValidating ? set(_formState.validatingFields,
|
|
14289
|
+
(names || Array.from(_names.mount)).forEach((name) => {
|
|
14290
|
+
if (name) {
|
|
14291
|
+
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
14291
14292
|
}
|
|
14292
14293
|
});
|
|
14293
14294
|
_subjects.state.next({
|
|
@@ -14296,38 +14297,38 @@ function createFormControl(props = {}) {
|
|
|
14296
14297
|
});
|
|
14297
14298
|
}
|
|
14298
14299
|
};
|
|
14299
|
-
const _setFieldArray = (
|
|
14300
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
14300
14301
|
if (args && method && !_options.disabled) {
|
|
14301
14302
|
_state.action = true;
|
|
14302
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
14303
|
-
const fieldValues = method(get2(_fields,
|
|
14304
|
-
shouldSetValues && set(_fields,
|
|
14303
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields, name))) {
|
|
14304
|
+
const fieldValues = method(get2(_fields, name), args.argA, args.argB);
|
|
14305
|
+
shouldSetValues && set(_fields, name, fieldValues);
|
|
14305
14306
|
}
|
|
14306
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
14307
|
-
const errors = method(get2(_formState.errors,
|
|
14308
|
-
shouldSetValues && set(_formState.errors,
|
|
14309
|
-
unsetEmptyArray(_formState.errors,
|
|
14307
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors, name))) {
|
|
14308
|
+
const errors = method(get2(_formState.errors, name), args.argA, args.argB);
|
|
14309
|
+
shouldSetValues && set(_formState.errors, name, errors);
|
|
14310
|
+
unsetEmptyArray(_formState.errors, name);
|
|
14310
14311
|
}
|
|
14311
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
14312
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
14313
|
-
shouldSetValues && set(_formState.touchedFields,
|
|
14312
|
+
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields, name))) {
|
|
14313
|
+
const touchedFields = method(get2(_formState.touchedFields, name), args.argA, args.argB);
|
|
14314
|
+
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
14314
14315
|
}
|
|
14315
14316
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
14316
14317
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
14317
14318
|
}
|
|
14318
14319
|
_subjects.state.next({
|
|
14319
|
-
name
|
|
14320
|
-
isDirty: _getDirty(
|
|
14320
|
+
name,
|
|
14321
|
+
isDirty: _getDirty(name, values),
|
|
14321
14322
|
dirtyFields: _formState.dirtyFields,
|
|
14322
14323
|
errors: _formState.errors,
|
|
14323
14324
|
isValid: _formState.isValid
|
|
14324
14325
|
});
|
|
14325
14326
|
} else {
|
|
14326
|
-
set(_formValues,
|
|
14327
|
+
set(_formValues, name, values);
|
|
14327
14328
|
}
|
|
14328
14329
|
};
|
|
14329
|
-
const updateErrors = (
|
|
14330
|
-
set(_formState.errors,
|
|
14330
|
+
const updateErrors = (name, error2) => {
|
|
14331
|
+
set(_formState.errors, name, error2);
|
|
14331
14332
|
_subjects.state.next({
|
|
14332
14333
|
errors: _formState.errors
|
|
14333
14334
|
});
|
|
@@ -14339,19 +14340,19 @@ function createFormControl(props = {}) {
|
|
|
14339
14340
|
isValid: false
|
|
14340
14341
|
});
|
|
14341
14342
|
};
|
|
14342
|
-
const updateValidAndValue = (
|
|
14343
|
-
const field = get2(_fields,
|
|
14343
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
14344
|
+
const field = get2(_fields, name);
|
|
14344
14345
|
if (field) {
|
|
14345
|
-
const defaultValue = get2(_formValues,
|
|
14346
|
-
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues,
|
|
14346
|
+
const defaultValue = get2(_formValues, name, isUndefined(value) ? get2(_defaultValues, name) : value);
|
|
14347
|
+
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
14347
14348
|
_state.mount && _setValid();
|
|
14348
14349
|
}
|
|
14349
14350
|
};
|
|
14350
|
-
const updateTouchAndDirty = (
|
|
14351
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
14351
14352
|
let shouldUpdateField = false;
|
|
14352
14353
|
let isPreviousDirty = false;
|
|
14353
14354
|
const output = {
|
|
14354
|
-
name
|
|
14355
|
+
name
|
|
14355
14356
|
};
|
|
14356
14357
|
if (!_options.disabled) {
|
|
14357
14358
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -14360,16 +14361,16 @@ function createFormControl(props = {}) {
|
|
|
14360
14361
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
14361
14362
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
14362
14363
|
}
|
|
14363
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
14364
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
14365
|
-
isCurrentFieldPristine ? unset(_formState.dirtyFields,
|
|
14364
|
+
const isCurrentFieldPristine = deepEqual(get2(_defaultValues, name), fieldValue);
|
|
14365
|
+
isPreviousDirty = !!get2(_formState.dirtyFields, name);
|
|
14366
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
14366
14367
|
output.dirtyFields = _formState.dirtyFields;
|
|
14367
14368
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
14368
14369
|
}
|
|
14369
14370
|
if (isBlurEvent) {
|
|
14370
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
14371
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
14371
14372
|
if (!isPreviousFieldTouched) {
|
|
14372
|
-
set(_formState.touchedFields,
|
|
14373
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
14373
14374
|
output.touchedFields = _formState.touchedFields;
|
|
14374
14375
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
14375
14376
|
}
|
|
@@ -14378,23 +14379,23 @@ function createFormControl(props = {}) {
|
|
|
14378
14379
|
}
|
|
14379
14380
|
return shouldUpdateField ? output : {};
|
|
14380
14381
|
};
|
|
14381
|
-
const shouldRenderByError = (
|
|
14382
|
-
const previousFieldError = get2(_formState.errors,
|
|
14382
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
14383
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
14383
14384
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
14384
14385
|
if (_options.delayError && error2) {
|
|
14385
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
14386
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
14386
14387
|
delayErrorCallback(_options.delayError);
|
|
14387
14388
|
} else {
|
|
14388
14389
|
clearTimeout(timer);
|
|
14389
14390
|
delayErrorCallback = null;
|
|
14390
|
-
error2 ? set(_formState.errors,
|
|
14391
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
14391
14392
|
}
|
|
14392
14393
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
14393
14394
|
const updatedFormState = {
|
|
14394
14395
|
...fieldState,
|
|
14395
14396
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
14396
14397
|
errors: _formState.errors,
|
|
14397
|
-
name
|
|
14398
|
+
name
|
|
14398
14399
|
};
|
|
14399
14400
|
_formState = {
|
|
14400
14401
|
..._formState,
|
|
@@ -14403,18 +14404,18 @@ function createFormControl(props = {}) {
|
|
|
14403
14404
|
_subjects.state.next(updatedFormState);
|
|
14404
14405
|
}
|
|
14405
14406
|
};
|
|
14406
|
-
const _runSchema = async (
|
|
14407
|
-
_updateIsValidating(
|
|
14408
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
14409
|
-
_updateIsValidating(
|
|
14407
|
+
const _runSchema = async (name) => {
|
|
14408
|
+
_updateIsValidating(name, true);
|
|
14409
|
+
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
14410
|
+
_updateIsValidating(name);
|
|
14410
14411
|
return result;
|
|
14411
14412
|
};
|
|
14412
14413
|
const executeSchemaAndUpdateState = async (names) => {
|
|
14413
14414
|
const { errors } = await _runSchema(names);
|
|
14414
14415
|
if (names) {
|
|
14415
|
-
for (const
|
|
14416
|
-
const error2 = get2(errors,
|
|
14417
|
-
error2 ? set(_formState.errors,
|
|
14416
|
+
for (const name of names) {
|
|
14417
|
+
const error2 = get2(errors, name);
|
|
14418
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
14418
14419
|
}
|
|
14419
14420
|
} else {
|
|
14420
14421
|
_formState.errors = errors;
|
|
@@ -14424,19 +14425,19 @@ function createFormControl(props = {}) {
|
|
|
14424
14425
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
14425
14426
|
valid: true
|
|
14426
14427
|
}) => {
|
|
14427
|
-
for (const
|
|
14428
|
-
const field = fields[
|
|
14428
|
+
for (const name in fields) {
|
|
14429
|
+
const field = fields[name];
|
|
14429
14430
|
if (field) {
|
|
14430
14431
|
const { _f, ...fieldValue } = field;
|
|
14431
14432
|
if (_f) {
|
|
14432
14433
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
14433
14434
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
14434
14435
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14435
|
-
_updateIsValidating([
|
|
14436
|
+
_updateIsValidating([name], true);
|
|
14436
14437
|
}
|
|
14437
14438
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
14438
14439
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14439
|
-
_updateIsValidating([
|
|
14440
|
+
_updateIsValidating([name]);
|
|
14440
14441
|
}
|
|
14441
14442
|
if (fieldError[_f.name]) {
|
|
14442
14443
|
context.valid = false;
|
|
@@ -14452,24 +14453,24 @@ function createFormControl(props = {}) {
|
|
|
14452
14453
|
return context.valid;
|
|
14453
14454
|
};
|
|
14454
14455
|
const _removeUnmounted = () => {
|
|
14455
|
-
for (const
|
|
14456
|
-
const field = get2(_fields,
|
|
14457
|
-
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(
|
|
14456
|
+
for (const name of _names.unMount) {
|
|
14457
|
+
const field = get2(_fields, name);
|
|
14458
|
+
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name);
|
|
14458
14459
|
}
|
|
14459
14460
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
14460
14461
|
};
|
|
14461
|
-
const _getDirty = (
|
|
14462
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
14462
14463
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
14463
14464
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
14464
14465
|
}, isGlobal, defaultValue);
|
|
14465
|
-
const _getFieldArray = (
|
|
14466
|
-
const setFieldValue = (
|
|
14467
|
-
const field = get2(_fields,
|
|
14466
|
+
const _getFieldArray = (name) => compact(get2(_state.mount ? _formValues : _defaultValues, name, _options.shouldUnregister ? get2(_defaultValues, name, []) : []));
|
|
14467
|
+
const setFieldValue = (name, value, options2 = {}) => {
|
|
14468
|
+
const field = get2(_fields, name);
|
|
14468
14469
|
let fieldValue = value;
|
|
14469
14470
|
if (field) {
|
|
14470
14471
|
const fieldReference = field._f;
|
|
14471
14472
|
if (fieldReference) {
|
|
14472
|
-
!fieldReference.disabled && set(_formValues,
|
|
14473
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
14473
14474
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
14474
14475
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
14475
14476
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -14493,61 +14494,61 @@ function createFormControl(props = {}) {
|
|
|
14493
14494
|
fieldReference.ref.value = fieldValue;
|
|
14494
14495
|
if (!fieldReference.ref.type) {
|
|
14495
14496
|
_subjects.state.next({
|
|
14496
|
-
name
|
|
14497
|
+
name,
|
|
14497
14498
|
values: cloneObject(_formValues)
|
|
14498
14499
|
});
|
|
14499
14500
|
}
|
|
14500
14501
|
}
|
|
14501
14502
|
}
|
|
14502
14503
|
}
|
|
14503
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
14504
|
-
options2.shouldValidate && trigger(
|
|
14504
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
14505
|
+
options2.shouldValidate && trigger(name);
|
|
14505
14506
|
};
|
|
14506
|
-
const setValues = (
|
|
14507
|
+
const setValues = (name, value, options2) => {
|
|
14507
14508
|
for (const fieldKey in value) {
|
|
14508
14509
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
14509
14510
|
return;
|
|
14510
14511
|
}
|
|
14511
14512
|
const fieldValue = value[fieldKey];
|
|
14512
|
-
const fieldName =
|
|
14513
|
+
const fieldName = name + "." + fieldKey;
|
|
14513
14514
|
const field = get2(_fields, fieldName);
|
|
14514
|
-
(_names.array.has(
|
|
14515
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
14515
14516
|
}
|
|
14516
14517
|
};
|
|
14517
|
-
const setValue = (
|
|
14518
|
-
const field = get2(_fields,
|
|
14519
|
-
const isFieldArray = _names.array.has(
|
|
14518
|
+
const setValue = (name, value, options2 = {}) => {
|
|
14519
|
+
const field = get2(_fields, name);
|
|
14520
|
+
const isFieldArray = _names.array.has(name);
|
|
14520
14521
|
const cloneValue = cloneObject(value);
|
|
14521
|
-
set(_formValues,
|
|
14522
|
+
set(_formValues, name, cloneValue);
|
|
14522
14523
|
if (isFieldArray) {
|
|
14523
14524
|
_subjects.array.next({
|
|
14524
|
-
name
|
|
14525
|
+
name,
|
|
14525
14526
|
values: cloneObject(_formValues)
|
|
14526
14527
|
});
|
|
14527
14528
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
14528
14529
|
_subjects.state.next({
|
|
14529
|
-
name
|
|
14530
|
+
name,
|
|
14530
14531
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
14531
|
-
isDirty: _getDirty(
|
|
14532
|
+
isDirty: _getDirty(name, cloneValue)
|
|
14532
14533
|
});
|
|
14533
14534
|
}
|
|
14534
14535
|
} else {
|
|
14535
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
14536
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
14536
14537
|
}
|
|
14537
|
-
isWatched(
|
|
14538
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
14538
14539
|
_subjects.state.next({
|
|
14539
|
-
name: _state.mount ?
|
|
14540
|
+
name: _state.mount ? name : void 0,
|
|
14540
14541
|
values: cloneObject(_formValues)
|
|
14541
14542
|
});
|
|
14542
14543
|
};
|
|
14543
14544
|
const onChange2 = async (event) => {
|
|
14544
14545
|
_state.mount = true;
|
|
14545
14546
|
const target = event.target;
|
|
14546
|
-
let
|
|
14547
|
+
let name = target.name;
|
|
14547
14548
|
let isFieldValueUpdated = true;
|
|
14548
|
-
const field = get2(_fields,
|
|
14549
|
+
const field = get2(_fields, name);
|
|
14549
14550
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
14550
|
-
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues,
|
|
14551
|
+
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues, name, fieldValue));
|
|
14551
14552
|
};
|
|
14552
14553
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
14553
14554
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -14556,9 +14557,9 @@ function createFormControl(props = {}) {
|
|
|
14556
14557
|
let isValid3;
|
|
14557
14558
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
14558
14559
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
14559
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
14560
|
-
const watched = isWatched(
|
|
14561
|
-
set(_formValues,
|
|
14560
|
+
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get2(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
14561
|
+
const watched = isWatched(name, _names, isBlurEvent);
|
|
14562
|
+
set(_formValues, name, fieldValue);
|
|
14562
14563
|
if (isBlurEvent) {
|
|
14563
14564
|
if (!target || !target.readOnly) {
|
|
14564
14565
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -14567,10 +14568,10 @@ function createFormControl(props = {}) {
|
|
|
14567
14568
|
} else if (field._f.onChange) {
|
|
14568
14569
|
field._f.onChange(event);
|
|
14569
14570
|
}
|
|
14570
|
-
const fieldState = updateTouchAndDirty(
|
|
14571
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
14571
14572
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
14572
14573
|
!isBlurEvent && _subjects.state.next({
|
|
14573
|
-
name
|
|
14574
|
+
name,
|
|
14574
14575
|
type: event.type,
|
|
14575
14576
|
values: cloneObject(_formValues)
|
|
14576
14577
|
});
|
|
@@ -14584,23 +14585,23 @@ function createFormControl(props = {}) {
|
|
|
14584
14585
|
_setValid();
|
|
14585
14586
|
}
|
|
14586
14587
|
}
|
|
14587
|
-
return shouldRender && _subjects.state.next({ name
|
|
14588
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
14588
14589
|
}
|
|
14589
14590
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
14590
14591
|
if (_options.resolver) {
|
|
14591
|
-
const { errors } = await _runSchema([
|
|
14592
|
+
const { errors } = await _runSchema([name]);
|
|
14592
14593
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14593
14594
|
if (isFieldValueUpdated) {
|
|
14594
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
14595
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
14595
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
14596
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
14596
14597
|
error2 = errorLookupResult.error;
|
|
14597
|
-
|
|
14598
|
+
name = errorLookupResult.name;
|
|
14598
14599
|
isValid3 = isEmptyObject(errors);
|
|
14599
14600
|
}
|
|
14600
14601
|
} else {
|
|
14601
|
-
_updateIsValidating([
|
|
14602
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
14603
|
-
_updateIsValidating([
|
|
14602
|
+
_updateIsValidating([name], true);
|
|
14603
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
14604
|
+
_updateIsValidating([name]);
|
|
14604
14605
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14605
14606
|
if (isFieldValueUpdated) {
|
|
14606
14607
|
if (error2) {
|
|
@@ -14612,7 +14613,7 @@ function createFormControl(props = {}) {
|
|
|
14612
14613
|
}
|
|
14613
14614
|
if (isFieldValueUpdated) {
|
|
14614
14615
|
field._f.deps && trigger(field._f.deps);
|
|
14615
|
-
shouldRenderByError(
|
|
14616
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
14616
14617
|
}
|
|
14617
14618
|
}
|
|
14618
14619
|
};
|
|
@@ -14623,15 +14624,15 @@ function createFormControl(props = {}) {
|
|
|
14623
14624
|
}
|
|
14624
14625
|
return;
|
|
14625
14626
|
};
|
|
14626
|
-
const trigger = async (
|
|
14627
|
+
const trigger = async (name, options2 = {}) => {
|
|
14627
14628
|
let isValid3;
|
|
14628
14629
|
let validationResult;
|
|
14629
|
-
const fieldNames = convertToArrayPayload(
|
|
14630
|
+
const fieldNames = convertToArrayPayload(name);
|
|
14630
14631
|
if (_options.resolver) {
|
|
14631
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
14632
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
14632
14633
|
isValid3 = isEmptyObject(errors);
|
|
14633
|
-
validationResult =
|
|
14634
|
-
} else if (
|
|
14634
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
14635
|
+
} else if (name) {
|
|
14635
14636
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
14636
14637
|
const field = get2(_fields, fieldName);
|
|
14637
14638
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -14641,51 +14642,51 @@ function createFormControl(props = {}) {
|
|
|
14641
14642
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
14642
14643
|
}
|
|
14643
14644
|
_subjects.state.next({
|
|
14644
|
-
...!isString3(
|
|
14645
|
-
..._options.resolver || !
|
|
14645
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
14646
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
14646
14647
|
errors: _formState.errors
|
|
14647
14648
|
});
|
|
14648
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
14649
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
14649
14650
|
return validationResult;
|
|
14650
14651
|
};
|
|
14651
14652
|
const getValues = (fieldNames) => {
|
|
14652
14653
|
const values = {
|
|
14653
14654
|
..._state.mount ? _formValues : _defaultValues
|
|
14654
14655
|
};
|
|
14655
|
-
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((
|
|
14656
|
+
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((name) => get2(values, name));
|
|
14656
14657
|
};
|
|
14657
|
-
const getFieldState = (
|
|
14658
|
-
invalid: !!get2((formState || _formState).errors,
|
|
14659
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
14660
|
-
error: get2((formState || _formState).errors,
|
|
14661
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
14662
|
-
isTouched: !!get2((formState || _formState).touchedFields,
|
|
14658
|
+
const getFieldState = (name, formState) => ({
|
|
14659
|
+
invalid: !!get2((formState || _formState).errors, name),
|
|
14660
|
+
isDirty: !!get2((formState || _formState).dirtyFields, name),
|
|
14661
|
+
error: get2((formState || _formState).errors, name),
|
|
14662
|
+
isValidating: !!get2(_formState.validatingFields, name),
|
|
14663
|
+
isTouched: !!get2((formState || _formState).touchedFields, name)
|
|
14663
14664
|
});
|
|
14664
|
-
const clearErrors = (
|
|
14665
|
-
|
|
14665
|
+
const clearErrors = (name) => {
|
|
14666
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
14666
14667
|
_subjects.state.next({
|
|
14667
|
-
errors:
|
|
14668
|
+
errors: name ? _formState.errors : {}
|
|
14668
14669
|
});
|
|
14669
14670
|
};
|
|
14670
|
-
const setError = (
|
|
14671
|
-
const ref = (get2(_fields,
|
|
14672
|
-
const currentError = get2(_formState.errors,
|
|
14671
|
+
const setError = (name, error2, options2) => {
|
|
14672
|
+
const ref = (get2(_fields, name, { _f: {} })._f || {}).ref;
|
|
14673
|
+
const currentError = get2(_formState.errors, name) || {};
|
|
14673
14674
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
14674
|
-
set(_formState.errors,
|
|
14675
|
+
set(_formState.errors, name, {
|
|
14675
14676
|
...restOfErrorTree,
|
|
14676
14677
|
...error2,
|
|
14677
14678
|
ref
|
|
14678
14679
|
});
|
|
14679
14680
|
_subjects.state.next({
|
|
14680
|
-
name
|
|
14681
|
+
name,
|
|
14681
14682
|
errors: _formState.errors,
|
|
14682
14683
|
isValid: false
|
|
14683
14684
|
});
|
|
14684
14685
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
14685
14686
|
};
|
|
14686
|
-
const watch = (
|
|
14687
|
-
next: (payload) => "values" in payload &&
|
|
14688
|
-
}) : _getWatch(
|
|
14687
|
+
const watch = (name, defaultValue) => isFunction(name) ? _subjects.state.subscribe({
|
|
14688
|
+
next: (payload) => "values" in payload && name(_getWatch(void 0, defaultValue), payload)
|
|
14689
|
+
}) : _getWatch(name, defaultValue, true);
|
|
14689
14690
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
14690
14691
|
next: (formState) => {
|
|
14691
14692
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -14709,8 +14710,8 @@ function createFormControl(props = {}) {
|
|
|
14709
14710
|
formState: _proxySubscribeFormState
|
|
14710
14711
|
});
|
|
14711
14712
|
};
|
|
14712
|
-
const unregister = (
|
|
14713
|
-
for (const fieldName of
|
|
14713
|
+
const unregister = (name, options2 = {}) => {
|
|
14714
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
14714
14715
|
_names.mount.delete(fieldName);
|
|
14715
14716
|
_names.array.delete(fieldName);
|
|
14716
14717
|
if (!options2.keepValue) {
|
|
@@ -14732,31 +14733,31 @@ function createFormControl(props = {}) {
|
|
|
14732
14733
|
});
|
|
14733
14734
|
!options2.keepIsValid && _setValid();
|
|
14734
14735
|
};
|
|
14735
|
-
const _setDisabledField = ({ disabled, name
|
|
14736
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
14737
|
-
disabled ? _names.disabled.add(
|
|
14736
|
+
const _setDisabledField = ({ disabled, name }) => {
|
|
14737
|
+
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) {
|
|
14738
|
+
disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
|
|
14738
14739
|
}
|
|
14739
14740
|
};
|
|
14740
|
-
const register = (
|
|
14741
|
-
let field = get2(_fields,
|
|
14741
|
+
const register = (name, options2 = {}) => {
|
|
14742
|
+
let field = get2(_fields, name);
|
|
14742
14743
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
14743
|
-
set(_fields,
|
|
14744
|
+
set(_fields, name, {
|
|
14744
14745
|
...field || {},
|
|
14745
14746
|
_f: {
|
|
14746
|
-
...field && field._f ? field._f : { ref: { name
|
|
14747
|
-
name
|
|
14747
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
14748
|
+
name,
|
|
14748
14749
|
mount: true,
|
|
14749
14750
|
...options2
|
|
14750
14751
|
}
|
|
14751
14752
|
});
|
|
14752
|
-
_names.mount.add(
|
|
14753
|
+
_names.mount.add(name);
|
|
14753
14754
|
if (field) {
|
|
14754
14755
|
_setDisabledField({
|
|
14755
14756
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
14756
|
-
name
|
|
14757
|
+
name
|
|
14757
14758
|
});
|
|
14758
14759
|
} else {
|
|
14759
|
-
updateValidAndValue(
|
|
14760
|
+
updateValidAndValue(name, true, options2.value);
|
|
14760
14761
|
}
|
|
14761
14762
|
return {
|
|
14762
14763
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -14768,39 +14769,39 @@ function createFormControl(props = {}) {
|
|
|
14768
14769
|
maxLength: getRuleValue(options2.maxLength),
|
|
14769
14770
|
pattern: getRuleValue(options2.pattern)
|
|
14770
14771
|
} : {},
|
|
14771
|
-
name
|
|
14772
|
+
name,
|
|
14772
14773
|
onChange: onChange2,
|
|
14773
14774
|
onBlur: onChange2,
|
|
14774
14775
|
ref: (ref) => {
|
|
14775
14776
|
if (ref) {
|
|
14776
|
-
register(
|
|
14777
|
-
field = get2(_fields,
|
|
14777
|
+
register(name, options2);
|
|
14778
|
+
field = get2(_fields, name);
|
|
14778
14779
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
14779
14780
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
14780
14781
|
const refs = field._f.refs || [];
|
|
14781
14782
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
14782
14783
|
return;
|
|
14783
14784
|
}
|
|
14784
|
-
set(_fields,
|
|
14785
|
+
set(_fields, name, {
|
|
14785
14786
|
_f: {
|
|
14786
14787
|
...field._f,
|
|
14787
14788
|
...radioOrCheckbox ? {
|
|
14788
14789
|
refs: [
|
|
14789
14790
|
...refs.filter(live),
|
|
14790
14791
|
fieldRef,
|
|
14791
|
-
...Array.isArray(get2(_defaultValues,
|
|
14792
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
14792
14793
|
],
|
|
14793
|
-
ref: { type: fieldRef.type, name
|
|
14794
|
+
ref: { type: fieldRef.type, name }
|
|
14794
14795
|
} : { ref: fieldRef }
|
|
14795
14796
|
}
|
|
14796
14797
|
});
|
|
14797
|
-
updateValidAndValue(
|
|
14798
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
14798
14799
|
} else {
|
|
14799
|
-
field = get2(_fields,
|
|
14800
|
+
field = get2(_fields, name, {});
|
|
14800
14801
|
if (field._f) {
|
|
14801
14802
|
field._f.mount = false;
|
|
14802
14803
|
}
|
|
14803
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
14804
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
14804
14805
|
}
|
|
14805
14806
|
}
|
|
14806
14807
|
};
|
|
@@ -14809,8 +14810,8 @@ function createFormControl(props = {}) {
|
|
|
14809
14810
|
const _disableForm = (disabled) => {
|
|
14810
14811
|
if (isBoolean(disabled)) {
|
|
14811
14812
|
_subjects.state.next({ disabled });
|
|
14812
|
-
iterateFieldsByAction(_fields, (ref,
|
|
14813
|
-
const currentField = get2(_fields,
|
|
14813
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
14814
|
+
const currentField = get2(_fields, name);
|
|
14814
14815
|
if (currentField) {
|
|
14815
14816
|
ref.disabled = currentField._f.disabled || disabled;
|
|
14816
14817
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -14840,8 +14841,8 @@ function createFormControl(props = {}) {
|
|
|
14840
14841
|
await executeBuiltInValidation(_fields);
|
|
14841
14842
|
}
|
|
14842
14843
|
if (_names.disabled.size) {
|
|
14843
|
-
for (const
|
|
14844
|
-
unset(fieldValues,
|
|
14844
|
+
for (const name of _names.disabled) {
|
|
14845
|
+
unset(fieldValues, name);
|
|
14845
14846
|
}
|
|
14846
14847
|
}
|
|
14847
14848
|
unset(_formState.errors, "root");
|
|
@@ -14872,23 +14873,23 @@ function createFormControl(props = {}) {
|
|
|
14872
14873
|
throw onValidError;
|
|
14873
14874
|
}
|
|
14874
14875
|
};
|
|
14875
|
-
const resetField = (
|
|
14876
|
-
if (get2(_fields,
|
|
14876
|
+
const resetField = (name, options2 = {}) => {
|
|
14877
|
+
if (get2(_fields, name)) {
|
|
14877
14878
|
if (isUndefined(options2.defaultValue)) {
|
|
14878
|
-
setValue(
|
|
14879
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
14879
14880
|
} else {
|
|
14880
|
-
setValue(
|
|
14881
|
-
set(_defaultValues,
|
|
14881
|
+
setValue(name, options2.defaultValue);
|
|
14882
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
14882
14883
|
}
|
|
14883
14884
|
if (!options2.keepTouched) {
|
|
14884
|
-
unset(_formState.touchedFields,
|
|
14885
|
+
unset(_formState.touchedFields, name);
|
|
14885
14886
|
}
|
|
14886
14887
|
if (!options2.keepDirty) {
|
|
14887
|
-
unset(_formState.dirtyFields,
|
|
14888
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
14888
|
+
unset(_formState.dirtyFields, name);
|
|
14889
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
14889
14890
|
}
|
|
14890
14891
|
if (!options2.keepError) {
|
|
14891
|
-
unset(_formState.errors,
|
|
14892
|
+
unset(_formState.errors, name);
|
|
14892
14893
|
_proxyFormState.isValid && _setValid();
|
|
14893
14894
|
}
|
|
14894
14895
|
_subjects.state.next({ ..._formState });
|
|
@@ -14913,8 +14914,8 @@ function createFormControl(props = {}) {
|
|
|
14913
14914
|
}
|
|
14914
14915
|
} else {
|
|
14915
14916
|
if (isWeb && isUndefined(formValues)) {
|
|
14916
|
-
for (const
|
|
14917
|
-
const field = get2(_fields,
|
|
14917
|
+
for (const name of _names.mount) {
|
|
14918
|
+
const field = get2(_fields, name);
|
|
14918
14919
|
if (field && field._f) {
|
|
14919
14920
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
14920
14921
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -14967,8 +14968,8 @@ function createFormControl(props = {}) {
|
|
|
14967
14968
|
});
|
|
14968
14969
|
};
|
|
14969
14970
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
14970
|
-
const setFocus = (
|
|
14971
|
-
const field = get2(_fields,
|
|
14971
|
+
const setFocus = (name, options2 = {}) => {
|
|
14972
|
+
const field = get2(_fields, name);
|
|
14972
14973
|
const fieldReference = field && field._f;
|
|
14973
14974
|
if (fieldReference) {
|
|
14974
14975
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -15284,7 +15285,7 @@ function TextInput(props) {
|
|
|
15284
15285
|
inputWrapperClassName,
|
|
15285
15286
|
label,
|
|
15286
15287
|
placeholder,
|
|
15287
|
-
name
|
|
15288
|
+
name,
|
|
15288
15289
|
type = "text",
|
|
15289
15290
|
register,
|
|
15290
15291
|
errors,
|
|
@@ -15307,7 +15308,7 @@ function TextInput(props) {
|
|
|
15307
15308
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
15308
15309
|
placeholder,
|
|
15309
15310
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
15310
|
-
...register(
|
|
15311
|
+
...register(name)
|
|
15311
15312
|
}
|
|
15312
15313
|
),
|
|
15313
15314
|
type === "password" && /* @__PURE__ */ jsx55(
|
|
@@ -15321,11 +15322,11 @@ function TextInput(props) {
|
|
|
15321
15322
|
]
|
|
15322
15323
|
}
|
|
15323
15324
|
),
|
|
15324
|
-
errors?.[
|
|
15325
|
+
errors?.[name]?.message && /* @__PURE__ */ jsx55(
|
|
15325
15326
|
"p",
|
|
15326
15327
|
{
|
|
15327
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
15328
|
-
children: errors?.[
|
|
15328
|
+
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[name] ? "h-4" : "h-0 -mt-1"}`,
|
|
15329
|
+
children: errors?.[name]?.message
|
|
15329
15330
|
}
|
|
15330
15331
|
)
|
|
15331
15332
|
] });
|
|
@@ -16087,7 +16088,7 @@ var ModalLayer = ({
|
|
|
16087
16088
|
// src/widgets/common/modal-confirm.tsx
|
|
16088
16089
|
import { jsx as jsx68, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
16089
16090
|
var ModalConfirm = ({
|
|
16090
|
-
name
|
|
16091
|
+
name,
|
|
16091
16092
|
isShowModal,
|
|
16092
16093
|
onClick,
|
|
16093
16094
|
onClose,
|
|
@@ -16096,8 +16097,8 @@ var ModalConfirm = ({
|
|
|
16096
16097
|
isLoading
|
|
16097
16098
|
}) => {
|
|
16098
16099
|
const { t: t3 } = useI18n();
|
|
16099
|
-
const renderButtonAction = (
|
|
16100
|
-
switch (
|
|
16100
|
+
const renderButtonAction = (name2) => {
|
|
16101
|
+
switch (name2) {
|
|
16101
16102
|
case "duplicate":
|
|
16102
16103
|
return /* @__PURE__ */ jsxs43(
|
|
16103
16104
|
"button",
|
|
@@ -16173,7 +16174,7 @@ var ModalConfirm = ({
|
|
|
16173
16174
|
children: t3("cancel")
|
|
16174
16175
|
}
|
|
16175
16176
|
),
|
|
16176
|
-
renderButtonAction(
|
|
16177
|
+
renderButtonAction(name)
|
|
16177
16178
|
] })
|
|
16178
16179
|
] }) });
|
|
16179
16180
|
};
|
|
@@ -16722,7 +16723,7 @@ import { useEffect as useEffect10, useState as useState10 } from "react";
|
|
|
16722
16723
|
import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
16723
16724
|
var BinaryField = (props) => {
|
|
16724
16725
|
const {
|
|
16725
|
-
name
|
|
16726
|
+
name,
|
|
16726
16727
|
methods,
|
|
16727
16728
|
readonly = false,
|
|
16728
16729
|
placeholder,
|
|
@@ -16761,7 +16762,7 @@ var BinaryField = (props) => {
|
|
|
16761
16762
|
try {
|
|
16762
16763
|
let type = "application/octet-stream";
|
|
16763
16764
|
let size4 = 0;
|
|
16764
|
-
let
|
|
16765
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16765
16766
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16766
16767
|
type = "image/*";
|
|
16767
16768
|
} else {
|
|
@@ -16774,7 +16775,7 @@ var BinaryField = (props) => {
|
|
|
16774
16775
|
}
|
|
16775
16776
|
}
|
|
16776
16777
|
setFileInfo({
|
|
16777
|
-
name:
|
|
16778
|
+
name: name2,
|
|
16778
16779
|
type,
|
|
16779
16780
|
url: initialFile,
|
|
16780
16781
|
size: size4,
|
|
@@ -16810,13 +16811,13 @@ var BinaryField = (props) => {
|
|
|
16810
16811
|
};
|
|
16811
16812
|
const renderPreview = (file) => {
|
|
16812
16813
|
if (!file) return /* @__PURE__ */ jsx75(PlaceHolderIcon, {});
|
|
16813
|
-
const { name:
|
|
16814
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16814
16815
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16815
16816
|
return /* @__PURE__ */ jsx75(
|
|
16816
16817
|
"img",
|
|
16817
16818
|
{
|
|
16818
16819
|
src: url,
|
|
16819
|
-
alt:
|
|
16820
|
+
alt: name2,
|
|
16820
16821
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16821
16822
|
style: {
|
|
16822
16823
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16856,7 +16857,7 @@ var BinaryField = (props) => {
|
|
|
16856
16857
|
maxWidth: "120px"
|
|
16857
16858
|
},
|
|
16858
16859
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16859
|
-
children:
|
|
16860
|
+
children: name2
|
|
16860
16861
|
}
|
|
16861
16862
|
),
|
|
16862
16863
|
isShowSize && /* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16866,7 +16867,7 @@ var BinaryField = (props) => {
|
|
|
16866
16867
|
return /* @__PURE__ */ jsx75(
|
|
16867
16868
|
Controller,
|
|
16868
16869
|
{
|
|
16869
|
-
name:
|
|
16870
|
+
name: name ?? "",
|
|
16870
16871
|
control: methods?.control,
|
|
16871
16872
|
rules: {
|
|
16872
16873
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17159,7 +17160,7 @@ import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-
|
|
|
17159
17160
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
17160
17161
|
var CharField = (props) => {
|
|
17161
17162
|
const {
|
|
17162
|
-
name
|
|
17163
|
+
name,
|
|
17163
17164
|
readonly,
|
|
17164
17165
|
placeholder,
|
|
17165
17166
|
required,
|
|
@@ -17190,7 +17191,7 @@ var CharField = (props) => {
|
|
|
17190
17191
|
return /* @__PURE__ */ jsx78(
|
|
17191
17192
|
Controller,
|
|
17192
17193
|
{
|
|
17193
|
-
name:
|
|
17194
|
+
name: name ?? "",
|
|
17194
17195
|
control: methods.control,
|
|
17195
17196
|
rules: {
|
|
17196
17197
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -17217,15 +17218,15 @@ var CharField = (props) => {
|
|
|
17217
17218
|
const { setError, clearErrors } = methods;
|
|
17218
17219
|
useEffect11(() => {
|
|
17219
17220
|
if (value2) {
|
|
17220
|
-
clearErrors(
|
|
17221
|
+
clearErrors(name);
|
|
17221
17222
|
}
|
|
17222
|
-
}, [value2, clearErrors,
|
|
17223
|
+
}, [value2, clearErrors, name]);
|
|
17223
17224
|
useEffect11(() => {
|
|
17224
17225
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
17225
17226
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
17226
|
-
const currentValue = methods?.getValues(
|
|
17227
|
+
const currentValue = methods?.getValues(name);
|
|
17227
17228
|
if (currentValue !== depValue) {
|
|
17228
|
-
methods?.setValue(
|
|
17229
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
17229
17230
|
}
|
|
17230
17231
|
}, [widget, formValues]);
|
|
17231
17232
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -17250,14 +17251,14 @@ var CharField = (props) => {
|
|
|
17250
17251
|
const inputValue = e3.target.value;
|
|
17251
17252
|
if (readonly) return;
|
|
17252
17253
|
fieldOnchange(inputValue);
|
|
17253
|
-
clearErrors(
|
|
17254
|
+
clearErrors(name);
|
|
17254
17255
|
},
|
|
17255
17256
|
onBlur: (e3) => {
|
|
17256
17257
|
if (readonly) return;
|
|
17257
17258
|
const inputValue = e3.target.value || "";
|
|
17258
17259
|
if (widget === "custom_passord") {
|
|
17259
17260
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
17260
|
-
setError(
|
|
17261
|
+
setError(name, {
|
|
17261
17262
|
type: "pattern",
|
|
17262
17263
|
message: getPasswordMessage(
|
|
17263
17264
|
min3,
|
|
@@ -17272,7 +17273,7 @@ var CharField = (props) => {
|
|
|
17272
17273
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
17273
17274
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
17274
17275
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
17275
|
-
setError(
|
|
17276
|
+
setError(name, {
|
|
17276
17277
|
type: "pattern",
|
|
17277
17278
|
message: t3(
|
|
17278
17279
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -17282,14 +17283,14 @@ var CharField = (props) => {
|
|
|
17282
17283
|
}
|
|
17283
17284
|
}
|
|
17284
17285
|
fieldOnchange(inputValue);
|
|
17285
|
-
onChange2 && onChange2(
|
|
17286
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
17286
17287
|
if (!inputValue && required && !invisible) {
|
|
17287
|
-
setError(
|
|
17288
|
+
setError(name, {
|
|
17288
17289
|
type: "required",
|
|
17289
17290
|
message: `${string} ${t3("must_required")}`
|
|
17290
17291
|
});
|
|
17291
17292
|
} else {
|
|
17292
|
-
clearErrors(
|
|
17293
|
+
clearErrors(name);
|
|
17293
17294
|
}
|
|
17294
17295
|
},
|
|
17295
17296
|
readOnly: readonly,
|
|
@@ -17343,14 +17344,14 @@ function EyeIconComponent({ open }) {
|
|
|
17343
17344
|
}
|
|
17344
17345
|
var SecureField = (props) => {
|
|
17345
17346
|
const {
|
|
17346
|
-
name
|
|
17347
|
+
name,
|
|
17347
17348
|
readonly,
|
|
17348
17349
|
placeholder,
|
|
17349
17350
|
required,
|
|
17350
17351
|
invisible,
|
|
17351
17352
|
methods,
|
|
17352
17353
|
onChange: onChange2,
|
|
17353
|
-
string =
|
|
17354
|
+
string = name,
|
|
17354
17355
|
widget,
|
|
17355
17356
|
min: min3,
|
|
17356
17357
|
max: max3,
|
|
@@ -17380,7 +17381,7 @@ var SecureField = (props) => {
|
|
|
17380
17381
|
return /* @__PURE__ */ jsx80(
|
|
17381
17382
|
Controller,
|
|
17382
17383
|
{
|
|
17383
|
-
name: String(
|
|
17384
|
+
name: String(name),
|
|
17384
17385
|
control: methods.control,
|
|
17385
17386
|
rules: {
|
|
17386
17387
|
...required && !invisible ? {
|
|
@@ -17414,8 +17415,8 @@ var SecureField = (props) => {
|
|
|
17414
17415
|
if (canToggle) setShowPlain(false);
|
|
17415
17416
|
}, [canToggle]);
|
|
17416
17417
|
useEffect12(() => {
|
|
17417
|
-
if (value2) clearErrors(
|
|
17418
|
-
}, [value2, clearErrors,
|
|
17418
|
+
if (value2) clearErrors(name);
|
|
17419
|
+
}, [value2, clearErrors, name]);
|
|
17419
17420
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
17420
17421
|
isCappedToken && shouldMask && /* @__PURE__ */ jsx80(
|
|
17421
17422
|
"div",
|
|
@@ -17433,20 +17434,20 @@ var SecureField = (props) => {
|
|
|
17433
17434
|
if (readonly) return;
|
|
17434
17435
|
const inputValue = e3.target.value ?? "";
|
|
17435
17436
|
fieldOnchange(inputValue);
|
|
17436
|
-
clearErrors(
|
|
17437
|
+
clearErrors(name);
|
|
17437
17438
|
},
|
|
17438
17439
|
onBlur: (e3) => {
|
|
17439
17440
|
if (readonly) return;
|
|
17440
17441
|
const inputValue = (e3.target.value ?? "").trim();
|
|
17441
17442
|
if (!inputValue && required && !invisible) {
|
|
17442
|
-
setError(
|
|
17443
|
+
setError(name, {
|
|
17443
17444
|
type: "required",
|
|
17444
17445
|
message: `${string} ${t3("must_required")}`
|
|
17445
17446
|
});
|
|
17446
17447
|
return;
|
|
17447
17448
|
}
|
|
17448
17449
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
17449
|
-
setError(
|
|
17450
|
+
setError(name, {
|
|
17450
17451
|
type: "pattern",
|
|
17451
17452
|
message: getPasswordMessage2(
|
|
17452
17453
|
min3,
|
|
@@ -17459,8 +17460,8 @@ var SecureField = (props) => {
|
|
|
17459
17460
|
return;
|
|
17460
17461
|
}
|
|
17461
17462
|
fieldOnchange(inputValue);
|
|
17462
|
-
onChange2 && onChange2(String(
|
|
17463
|
-
clearErrors(
|
|
17463
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
17464
|
+
clearErrors(name);
|
|
17464
17465
|
},
|
|
17465
17466
|
readOnly: readonly,
|
|
17466
17467
|
disabled: readonly,
|
|
@@ -17504,7 +17505,7 @@ var SecureField = (props) => {
|
|
|
17504
17505
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
17505
17506
|
var CheckboxField = (props) => {
|
|
17506
17507
|
const {
|
|
17507
|
-
name
|
|
17508
|
+
name,
|
|
17508
17509
|
readonly = false,
|
|
17509
17510
|
required = false,
|
|
17510
17511
|
invisible = false,
|
|
@@ -17515,7 +17516,7 @@ var CheckboxField = (props) => {
|
|
|
17515
17516
|
isEditTable = false
|
|
17516
17517
|
} = props;
|
|
17517
17518
|
if (!isForm) {
|
|
17518
|
-
if (
|
|
17519
|
+
if (name === "is_active" || name === "active") {
|
|
17519
17520
|
return /* @__PURE__ */ jsx81(ActiveBadgeField, { type: value });
|
|
17520
17521
|
} else {
|
|
17521
17522
|
return /* @__PURE__ */ jsx81(
|
|
@@ -17532,7 +17533,7 @@ var CheckboxField = (props) => {
|
|
|
17532
17533
|
return /* @__PURE__ */ jsx81(
|
|
17533
17534
|
Controller,
|
|
17534
17535
|
{
|
|
17535
|
-
name:
|
|
17536
|
+
name: name ?? "",
|
|
17536
17537
|
control: methods?.control,
|
|
17537
17538
|
render: ({ field }) => /* @__PURE__ */ jsx81(
|
|
17538
17539
|
"div",
|
|
@@ -17541,10 +17542,10 @@ var CheckboxField = (props) => {
|
|
|
17541
17542
|
onClick: () => {
|
|
17542
17543
|
const checked = !field.value;
|
|
17543
17544
|
if (!isEditTable && readonly) return;
|
|
17544
|
-
methods.setValue(
|
|
17545
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17545
17546
|
field.onChange(checked);
|
|
17546
17547
|
if (onChange2) {
|
|
17547
|
-
onChange2(
|
|
17548
|
+
onChange2(name ?? "", checked);
|
|
17548
17549
|
}
|
|
17549
17550
|
},
|
|
17550
17551
|
children: /* @__PURE__ */ jsx81(
|
|
@@ -17554,10 +17555,10 @@ var CheckboxField = (props) => {
|
|
|
17554
17555
|
onChange: (e3) => {
|
|
17555
17556
|
const checked = e3.target.checked;
|
|
17556
17557
|
if (!isEditTable && readonly) return;
|
|
17557
|
-
methods.setValue(
|
|
17558
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17558
17559
|
field.onChange(checked);
|
|
17559
17560
|
if (onChange2) {
|
|
17560
|
-
onChange2(
|
|
17561
|
+
onChange2(name ?? "", checked);
|
|
17561
17562
|
}
|
|
17562
17563
|
},
|
|
17563
17564
|
type: "checkbox",
|
|
@@ -17651,19 +17652,19 @@ var ColorWrapper = (props) => {
|
|
|
17651
17652
|
// src/widgets/basic/color-field/color.tsx
|
|
17652
17653
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
17653
17654
|
var ColorField = (props) => {
|
|
17654
|
-
const { value, isForm, name
|
|
17655
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
17655
17656
|
if (!isForm) {
|
|
17656
17657
|
return /* @__PURE__ */ jsx83(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
17657
17658
|
}
|
|
17658
17659
|
return /* @__PURE__ */ jsx83(
|
|
17659
17660
|
Controller,
|
|
17660
17661
|
{
|
|
17661
|
-
name:
|
|
17662
|
+
name: name ?? "",
|
|
17662
17663
|
control: methods?.control,
|
|
17663
17664
|
render: ({ field }) => {
|
|
17664
17665
|
const handlePickColorChange = (color) => {
|
|
17665
17666
|
field.onChange(color?.id);
|
|
17666
|
-
onChange2 && onChange2(
|
|
17667
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
17667
17668
|
};
|
|
17668
17669
|
return /* @__PURE__ */ jsx83(
|
|
17669
17670
|
ColorWrapper,
|
|
@@ -17684,7 +17685,7 @@ import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
|
17684
17685
|
var CopyLinkButtonField = (props) => {
|
|
17685
17686
|
const {
|
|
17686
17687
|
isForm,
|
|
17687
|
-
name
|
|
17688
|
+
name,
|
|
17688
17689
|
methods,
|
|
17689
17690
|
onChange: onChange2,
|
|
17690
17691
|
readonly,
|
|
@@ -17706,7 +17707,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17706
17707
|
return /* @__PURE__ */ jsx84(
|
|
17707
17708
|
Controller,
|
|
17708
17709
|
{
|
|
17709
|
-
name:
|
|
17710
|
+
name: name ?? "",
|
|
17710
17711
|
control: methods.control,
|
|
17711
17712
|
rules: {
|
|
17712
17713
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17718,7 +17719,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17718
17719
|
const { setError, clearErrors } = methods;
|
|
17719
17720
|
useEffect14(() => {
|
|
17720
17721
|
if (value) {
|
|
17721
|
-
clearErrors(
|
|
17722
|
+
clearErrors(name);
|
|
17722
17723
|
}
|
|
17723
17724
|
}, [value]);
|
|
17724
17725
|
return /* @__PURE__ */ jsxs54("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17736,11 +17737,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17736
17737
|
if (readonly) return;
|
|
17737
17738
|
const newValue = e3.target.value || "";
|
|
17738
17739
|
fieldOnchange(newValue);
|
|
17739
|
-
onChange2 && onChange2(
|
|
17740
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17740
17741
|
if (e3.target.value) {
|
|
17741
|
-
clearErrors(
|
|
17742
|
+
clearErrors(name);
|
|
17742
17743
|
} else if (required && !invisible) {
|
|
17743
|
-
setError(
|
|
17744
|
+
setError(name, {
|
|
17744
17745
|
type: "required",
|
|
17745
17746
|
message: `${string} ${t3("must_required")}`
|
|
17746
17747
|
});
|
|
@@ -17750,9 +17751,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17750
17751
|
if (!readonly) {
|
|
17751
17752
|
fieldOnchange(e3.target.value);
|
|
17752
17753
|
if (e3.target.value) {
|
|
17753
|
-
clearErrors(
|
|
17754
|
+
clearErrors(name);
|
|
17754
17755
|
} else if (required && !invisible) {
|
|
17755
|
-
setError(
|
|
17756
|
+
setError(name, {
|
|
17756
17757
|
type: "required",
|
|
17757
17758
|
message: `${string} ${t3("must_required")}`
|
|
17758
17759
|
});
|
|
@@ -27616,23 +27617,23 @@ var createCache = function createCache2(options2) {
|
|
|
27616
27617
|
};
|
|
27617
27618
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
27618
27619
|
var getRules3 = function getRules4(selector, serialized) {
|
|
27619
|
-
var
|
|
27620
|
-
if (serverStylisCache[
|
|
27621
|
-
serverStylisCache[
|
|
27620
|
+
var name = serialized.name;
|
|
27621
|
+
if (serverStylisCache[name] === void 0) {
|
|
27622
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
27622
27623
|
}
|
|
27623
|
-
return serverStylisCache[
|
|
27624
|
+
return serverStylisCache[name];
|
|
27624
27625
|
};
|
|
27625
27626
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
27626
|
-
var
|
|
27627
|
+
var name = serialized.name;
|
|
27627
27628
|
var rules = getRules3(selector, serialized);
|
|
27628
27629
|
if (cache.compat === void 0) {
|
|
27629
27630
|
if (shouldCache) {
|
|
27630
|
-
cache.inserted[
|
|
27631
|
+
cache.inserted[name] = true;
|
|
27631
27632
|
}
|
|
27632
27633
|
return rules;
|
|
27633
27634
|
} else {
|
|
27634
27635
|
if (shouldCache) {
|
|
27635
|
-
cache.inserted[
|
|
27636
|
+
cache.inserted[name] = rules;
|
|
27636
27637
|
} else {
|
|
27637
27638
|
return rules;
|
|
27638
27639
|
}
|
|
@@ -27955,9 +27956,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
27955
27956
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
27956
27957
|
identifierName += "-" + match3[1];
|
|
27957
27958
|
}
|
|
27958
|
-
var
|
|
27959
|
+
var name = murmur2(styles) + identifierName;
|
|
27959
27960
|
return {
|
|
27960
|
-
name
|
|
27961
|
+
name,
|
|
27961
27962
|
styles,
|
|
27962
27963
|
next: cursor
|
|
27963
27964
|
};
|
|
@@ -28107,10 +28108,10 @@ function css() {
|
|
|
28107
28108
|
}
|
|
28108
28109
|
function keyframes() {
|
|
28109
28110
|
var insertable = css.apply(void 0, arguments);
|
|
28110
|
-
var
|
|
28111
|
+
var name = "animation-" + insertable.name;
|
|
28111
28112
|
return {
|
|
28112
|
-
name
|
|
28113
|
-
styles: "@keyframes " +
|
|
28113
|
+
name,
|
|
28114
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
28114
28115
|
anim: 1,
|
|
28115
28116
|
toString: function toString() {
|
|
28116
28117
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -28142,13 +28143,13 @@ var index3 = isClient3 ? useLayoutEffect4 : noop6;
|
|
|
28142
28143
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
28143
28144
|
var noop8 = function noop9() {
|
|
28144
28145
|
};
|
|
28145
|
-
function applyPrefixToName(prefix2,
|
|
28146
|
-
if (!
|
|
28146
|
+
function applyPrefixToName(prefix2, name) {
|
|
28147
|
+
if (!name) {
|
|
28147
28148
|
return prefix2;
|
|
28148
|
-
} else if (
|
|
28149
|
-
return prefix2 +
|
|
28149
|
+
} else if (name[0] === "-") {
|
|
28150
|
+
return prefix2 + name;
|
|
28150
28151
|
} else {
|
|
28151
|
-
return prefix2 + "__" +
|
|
28152
|
+
return prefix2 + "__" + name;
|
|
28152
28153
|
}
|
|
28153
28154
|
}
|
|
28154
28155
|
function classNames(prefix2, state) {
|
|
@@ -28192,11 +28193,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
28192
28193
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
28193
28194
|
return _objectSpread2({}, innerProps);
|
|
28194
28195
|
};
|
|
28195
|
-
var getStyleProps = function getStyleProps2(props,
|
|
28196
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
28196
28197
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
28197
28198
|
return {
|
|
28198
|
-
css: getStyles(
|
|
28199
|
-
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(
|
|
28199
|
+
css: getStyles(name, props),
|
|
28200
|
+
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className)
|
|
28200
28201
|
};
|
|
28201
28202
|
};
|
|
28202
28203
|
function isDocumentElement(el) {
|
|
@@ -29945,10 +29946,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
29945
29946
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
29946
29947
|
};
|
|
29947
29948
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
29948
|
-
var
|
|
29949
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
29949
29950
|
return jsx86("input", {
|
|
29950
29951
|
required: true,
|
|
29951
|
-
name
|
|
29952
|
+
name,
|
|
29952
29953
|
tabIndex: -1,
|
|
29953
29954
|
"aria-hidden": "true",
|
|
29954
29955
|
onFocus: onFocus2,
|
|
@@ -30274,8 +30275,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30274
30275
|
_this.focus = _this.focusInput;
|
|
30275
30276
|
_this.blur = _this.blurInput;
|
|
30276
30277
|
_this.onChange = function(newValue, actionMeta) {
|
|
30277
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
30278
|
-
actionMeta.name =
|
|
30278
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
30279
|
+
actionMeta.name = name;
|
|
30279
30280
|
_this.ariaOnChange(newValue, actionMeta);
|
|
30280
30281
|
onChange2(newValue, actionMeta);
|
|
30281
30282
|
};
|
|
@@ -30300,7 +30301,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30300
30301
|
});
|
|
30301
30302
|
};
|
|
30302
30303
|
_this.selectOption = function(newValue) {
|
|
30303
|
-
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti,
|
|
30304
|
+
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name;
|
|
30304
30305
|
var selectValue = _this.state.selectValue;
|
|
30305
30306
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
30306
30307
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -30319,7 +30320,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30319
30320
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
30320
30321
|
action: "select-option",
|
|
30321
30322
|
option: newValue,
|
|
30322
|
-
name
|
|
30323
|
+
name
|
|
30323
30324
|
});
|
|
30324
30325
|
return;
|
|
30325
30326
|
}
|
|
@@ -31373,22 +31374,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31373
31374
|
key: "renderFormField",
|
|
31374
31375
|
value: function renderFormField() {
|
|
31375
31376
|
var _this5 = this;
|
|
31376
|
-
var _this$props13 = this.props, delimiter2 = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti,
|
|
31377
|
+
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;
|
|
31377
31378
|
var selectValue = this.state.selectValue;
|
|
31378
31379
|
if (required && !this.hasValue() && !isDisabled) {
|
|
31379
31380
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
31380
|
-
name
|
|
31381
|
+
name,
|
|
31381
31382
|
onFocus: this.onValueInputFocus
|
|
31382
31383
|
});
|
|
31383
31384
|
}
|
|
31384
|
-
if (!
|
|
31385
|
+
if (!name || isDisabled) return;
|
|
31385
31386
|
if (isMulti) {
|
|
31386
31387
|
if (delimiter2) {
|
|
31387
31388
|
var value = selectValue.map(function(opt) {
|
|
31388
31389
|
return _this5.getOptionValue(opt);
|
|
31389
31390
|
}).join(delimiter2);
|
|
31390
31391
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31391
|
-
name
|
|
31392
|
+
name,
|
|
31392
31393
|
type: "hidden",
|
|
31393
31394
|
value
|
|
31394
31395
|
});
|
|
@@ -31396,12 +31397,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31396
31397
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
31397
31398
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31398
31399
|
key: "i-".concat(i3),
|
|
31399
|
-
name
|
|
31400
|
+
name,
|
|
31400
31401
|
type: "hidden",
|
|
31401
31402
|
value: _this5.getOptionValue(opt)
|
|
31402
31403
|
});
|
|
31403
31404
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
31404
|
-
name
|
|
31405
|
+
name,
|
|
31405
31406
|
type: "hidden",
|
|
31406
31407
|
value: ""
|
|
31407
31408
|
});
|
|
@@ -31410,7 +31411,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31410
31411
|
} else {
|
|
31411
31412
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
31412
31413
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31413
|
-
name
|
|
31414
|
+
name,
|
|
31414
31415
|
type: "hidden",
|
|
31415
31416
|
value: _value
|
|
31416
31417
|
});
|
|
@@ -31539,7 +31540,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
31539
31540
|
import { Fragment as Fragment24, jsx as jsx88, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
31540
31541
|
var DateField = (props) => {
|
|
31541
31542
|
const {
|
|
31542
|
-
name
|
|
31543
|
+
name,
|
|
31543
31544
|
value,
|
|
31544
31545
|
readonly,
|
|
31545
31546
|
placeholder = "DD/MM/YYYY",
|
|
@@ -31589,7 +31590,7 @@ var DateField = (props) => {
|
|
|
31589
31590
|
return /* @__PURE__ */ jsx88(
|
|
31590
31591
|
Controller,
|
|
31591
31592
|
{
|
|
31592
|
-
name:
|
|
31593
|
+
name: name || "",
|
|
31593
31594
|
control: methods?.control,
|
|
31594
31595
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
31595
31596
|
rules: {
|
|
@@ -31604,9 +31605,9 @@ var DateField = (props) => {
|
|
|
31604
31605
|
const { setError, clearErrors } = methods;
|
|
31605
31606
|
useEffect18(() => {
|
|
31606
31607
|
if (value) {
|
|
31607
|
-
clearErrors(
|
|
31608
|
+
clearErrors(name);
|
|
31608
31609
|
}
|
|
31609
|
-
}, [value, clearErrors,
|
|
31610
|
+
}, [value, clearErrors, name]);
|
|
31610
31611
|
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;
|
|
31611
31612
|
return /* @__PURE__ */ jsxs56(Fragment24, { children: [
|
|
31612
31613
|
/* @__PURE__ */ jsx88(
|
|
@@ -31625,7 +31626,7 @@ var DateField = (props) => {
|
|
|
31625
31626
|
adjustedDate.toDate()
|
|
31626
31627
|
);
|
|
31627
31628
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
31628
|
-
setError(
|
|
31629
|
+
setError(name, {
|
|
31629
31630
|
type: "manual",
|
|
31630
31631
|
message: validateCustomResult
|
|
31631
31632
|
});
|
|
@@ -31633,20 +31634,20 @@ var DateField = (props) => {
|
|
|
31633
31634
|
}
|
|
31634
31635
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31635
31636
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
31636
|
-
handleOnchange && handleOnchange(
|
|
31637
|
-
clearErrors(
|
|
31637
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31638
|
+
clearErrors(name);
|
|
31638
31639
|
} else {
|
|
31639
31640
|
field.onChange(null);
|
|
31640
|
-
handleOnchange && handleOnchange(
|
|
31641
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
31641
31642
|
if (required && !invisible) {
|
|
31642
31643
|
if (!isEditTable) {
|
|
31643
|
-
setError(
|
|
31644
|
+
setError(name, {
|
|
31644
31645
|
type: "manual",
|
|
31645
31646
|
message: `${string} ${t3("must_required")}`
|
|
31646
31647
|
});
|
|
31647
31648
|
}
|
|
31648
31649
|
} else {
|
|
31649
|
-
clearErrors(
|
|
31650
|
+
clearErrors(name);
|
|
31650
31651
|
}
|
|
31651
31652
|
}
|
|
31652
31653
|
},
|
|
@@ -31667,7 +31668,7 @@ var DateField = (props) => {
|
|
|
31667
31668
|
}
|
|
31668
31669
|
),
|
|
31669
31670
|
timeInputLabel: textPlaceHolder,
|
|
31670
|
-
portalId:
|
|
31671
|
+
portalId: name,
|
|
31671
31672
|
renderCustomHeader: ({
|
|
31672
31673
|
date,
|
|
31673
31674
|
changeYear,
|
|
@@ -32006,7 +32007,7 @@ var RenderFile = ({
|
|
|
32006
32007
|
};
|
|
32007
32008
|
var FileUploadField = (props) => {
|
|
32008
32009
|
const {
|
|
32009
|
-
name
|
|
32010
|
+
name,
|
|
32010
32011
|
methods,
|
|
32011
32012
|
isForm,
|
|
32012
32013
|
model,
|
|
@@ -32037,7 +32038,7 @@ var FileUploadField = (props) => {
|
|
|
32037
32038
|
return /* @__PURE__ */ jsx93(
|
|
32038
32039
|
Controller,
|
|
32039
32040
|
{
|
|
32040
|
-
name:
|
|
32041
|
+
name: name || "",
|
|
32041
32042
|
control: methods?.control,
|
|
32042
32043
|
rules: {
|
|
32043
32044
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32103,7 +32104,7 @@ import { useEffect as useEffect20, useRef as useRef15, useState as useState19 }
|
|
|
32103
32104
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
32104
32105
|
var FloatField = (props) => {
|
|
32105
32106
|
const {
|
|
32106
|
-
name
|
|
32107
|
+
name,
|
|
32107
32108
|
value: propValue,
|
|
32108
32109
|
readonly,
|
|
32109
32110
|
placeholder,
|
|
@@ -32124,7 +32125,7 @@ var FloatField = (props) => {
|
|
|
32124
32125
|
return /* @__PURE__ */ jsx94(
|
|
32125
32126
|
Controller,
|
|
32126
32127
|
{
|
|
32127
|
-
name:
|
|
32128
|
+
name: name ?? "",
|
|
32128
32129
|
control: methods.control,
|
|
32129
32130
|
rules: {
|
|
32130
32131
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32142,14 +32143,14 @@ var FloatField = (props) => {
|
|
|
32142
32143
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
32143
32144
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
32144
32145
|
setInputValue(formatFloatNumber(propValue));
|
|
32145
|
-
clearErrors(
|
|
32146
|
+
clearErrors(name);
|
|
32146
32147
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
32147
32148
|
setInputValue(formatFloatNumber(value));
|
|
32148
|
-
clearErrors(
|
|
32149
|
+
clearErrors(name);
|
|
32149
32150
|
} else if (value === null || value === void 0) {
|
|
32150
32151
|
setInputValue("");
|
|
32151
32152
|
}
|
|
32152
|
-
}, [value,
|
|
32153
|
+
}, [value, name, clearErrors, propValue]);
|
|
32153
32154
|
const handleInputChange = (e3) => {
|
|
32154
32155
|
let newValue = e3.target.value;
|
|
32155
32156
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -32169,7 +32170,7 @@ var FloatField = (props) => {
|
|
|
32169
32170
|
);
|
|
32170
32171
|
if (!isNaN(parsedValue)) {
|
|
32171
32172
|
onChange2(parsedValue);
|
|
32172
|
-
clearErrors(
|
|
32173
|
+
clearErrors(name);
|
|
32173
32174
|
isDirtyRef.current = true;
|
|
32174
32175
|
} else {
|
|
32175
32176
|
onChange2(null);
|
|
@@ -32181,7 +32182,7 @@ var FloatField = (props) => {
|
|
|
32181
32182
|
const parsedValue = parseFloat(rawValue);
|
|
32182
32183
|
if (rawValue === "" || rawValue === ".") {
|
|
32183
32184
|
if (required) {
|
|
32184
|
-
setError(
|
|
32185
|
+
setError(name, {
|
|
32185
32186
|
type: "required",
|
|
32186
32187
|
message: `${string} ${t3("must_required")}`
|
|
32187
32188
|
});
|
|
@@ -32191,7 +32192,7 @@ var FloatField = (props) => {
|
|
|
32191
32192
|
lastCommittedValueRef.current = null;
|
|
32192
32193
|
} else if (!isNaN(parsedValue)) {
|
|
32193
32194
|
if (parsedValue < 0) {
|
|
32194
|
-
setError(
|
|
32195
|
+
setError(name, {
|
|
32195
32196
|
type: "validate",
|
|
32196
32197
|
message: t3("invalid_number")
|
|
32197
32198
|
});
|
|
@@ -32201,12 +32202,12 @@ var FloatField = (props) => {
|
|
|
32201
32202
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
32202
32203
|
setInputValue(formattedValue);
|
|
32203
32204
|
onChange2(parsedValue);
|
|
32204
|
-
handleOnchange?.(
|
|
32205
|
-
clearErrors(
|
|
32205
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
32206
|
+
clearErrors(name);
|
|
32206
32207
|
lastCommittedValueRef.current = parsedValue;
|
|
32207
32208
|
}
|
|
32208
32209
|
} else {
|
|
32209
|
-
setError(
|
|
32210
|
+
setError(name, {
|
|
32210
32211
|
type: "validate",
|
|
32211
32212
|
message: t3("invalid_number")
|
|
32212
32213
|
});
|
|
@@ -32245,7 +32246,7 @@ import { useState as useState20 } from "react";
|
|
|
32245
32246
|
import { Fragment as Fragment27, jsx as jsx95, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
32246
32247
|
var FloatTimeField = (props) => {
|
|
32247
32248
|
const {
|
|
32248
|
-
name
|
|
32249
|
+
name,
|
|
32249
32250
|
methods,
|
|
32250
32251
|
defaultValue = 0,
|
|
32251
32252
|
isForm = true,
|
|
@@ -32263,7 +32264,7 @@ var FloatTimeField = (props) => {
|
|
|
32263
32264
|
return /* @__PURE__ */ jsx95(
|
|
32264
32265
|
Controller,
|
|
32265
32266
|
{
|
|
32266
|
-
name:
|
|
32267
|
+
name: name ?? "",
|
|
32267
32268
|
control: methods?.control,
|
|
32268
32269
|
defaultValue,
|
|
32269
32270
|
rules: {
|
|
@@ -32310,13 +32311,13 @@ var FloatTimeField = (props) => {
|
|
|
32310
32311
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
32311
32312
|
fieldOnChange(floatVal);
|
|
32312
32313
|
if (onChange2) {
|
|
32313
|
-
onChange2(
|
|
32314
|
+
onChange2(name ?? "", floatVal);
|
|
32314
32315
|
}
|
|
32315
32316
|
} else {
|
|
32316
32317
|
setInput("00:00");
|
|
32317
32318
|
fieldOnChange(0);
|
|
32318
32319
|
if (onChange2) {
|
|
32319
|
-
onChange2(
|
|
32320
|
+
onChange2(name ?? "", 0);
|
|
32320
32321
|
}
|
|
32321
32322
|
setErrors("");
|
|
32322
32323
|
}
|
|
@@ -32367,7 +32368,7 @@ import { useEffect as useEffect21, useRef as useRef16 } from "react";
|
|
|
32367
32368
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
32368
32369
|
var HtmlField = (props) => {
|
|
32369
32370
|
const {
|
|
32370
|
-
name
|
|
32371
|
+
name,
|
|
32371
32372
|
methods,
|
|
32372
32373
|
readonly = false,
|
|
32373
32374
|
isForm = true,
|
|
@@ -32384,7 +32385,7 @@ var HtmlField = (props) => {
|
|
|
32384
32385
|
return /* @__PURE__ */ jsx96(
|
|
32385
32386
|
Controller,
|
|
32386
32387
|
{
|
|
32387
|
-
name:
|
|
32388
|
+
name: name ?? "",
|
|
32388
32389
|
control: methods?.control,
|
|
32389
32390
|
defaultValue,
|
|
32390
32391
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -32417,10 +32418,10 @@ var HtmlField = (props) => {
|
|
|
32417
32418
|
// src/widgets/basic/image-field/image.tsx
|
|
32418
32419
|
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
32419
32420
|
var ImageField = (props) => {
|
|
32420
|
-
const { value, type, name
|
|
32421
|
+
const { value, type, name, baseURL } = props;
|
|
32421
32422
|
if (!value) return null;
|
|
32422
32423
|
if (type === "url") {
|
|
32423
|
-
return /* @__PURE__ */ jsx97("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt:
|
|
32424
|
+
return /* @__PURE__ */ jsx97("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt: name });
|
|
32424
32425
|
}
|
|
32425
32426
|
return /* @__PURE__ */ jsx97("div", { id: "qr-code", children: /* @__PURE__ */ jsx97("img", { src: `data:image/png;base64,${value}`, alt: "QR Code" }) });
|
|
32426
32427
|
};
|
|
@@ -32522,7 +32523,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32522
32523
|
const {
|
|
32523
32524
|
relation,
|
|
32524
32525
|
value,
|
|
32525
|
-
name
|
|
32526
|
+
name,
|
|
32526
32527
|
methods,
|
|
32527
32528
|
required,
|
|
32528
32529
|
invisible,
|
|
@@ -32563,7 +32564,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32563
32564
|
return /* @__PURE__ */ jsx99(
|
|
32564
32565
|
Controller,
|
|
32565
32566
|
{
|
|
32566
|
-
name:
|
|
32567
|
+
name: name ?? "",
|
|
32567
32568
|
control: methods.control,
|
|
32568
32569
|
rules: {
|
|
32569
32570
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32572,7 +32573,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32572
32573
|
const { clearErrors } = methods;
|
|
32573
32574
|
useEffect22(() => {
|
|
32574
32575
|
if (field.value) {
|
|
32575
|
-
clearErrors(
|
|
32576
|
+
clearErrors(name);
|
|
32576
32577
|
}
|
|
32577
32578
|
}, [field.value]);
|
|
32578
32579
|
const filteredValue = useMemo11(() => {
|
|
@@ -32592,12 +32593,12 @@ var Many2ManyTagField = (props) => {
|
|
|
32592
32593
|
}, [field?.value, options2]);
|
|
32593
32594
|
const handleChange = (selectedOptions) => {
|
|
32594
32595
|
const newValue = transfer(selectedOptions);
|
|
32595
|
-
methods?.setValue(
|
|
32596
|
-
onChange2?.(
|
|
32597
|
-
clearErrors(
|
|
32596
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
32597
|
+
onChange2?.(name ?? "", newValue);
|
|
32598
|
+
clearErrors(name);
|
|
32598
32599
|
newValue.forEach((item, index4) => {
|
|
32599
32600
|
Object.keys(item).forEach((key) => {
|
|
32600
|
-
methods.setValue(`${
|
|
32601
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
32601
32602
|
shouldDirty: true
|
|
32602
32603
|
});
|
|
32603
32604
|
});
|
|
@@ -32722,7 +32723,7 @@ import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx
|
|
|
32722
32723
|
var MonetaryField = (props) => {
|
|
32723
32724
|
const { t: t3 } = useI18n();
|
|
32724
32725
|
const {
|
|
32725
|
-
name
|
|
32726
|
+
name,
|
|
32726
32727
|
value,
|
|
32727
32728
|
readonly,
|
|
32728
32729
|
required,
|
|
@@ -32739,7 +32740,7 @@ var MonetaryField = (props) => {
|
|
|
32739
32740
|
symbol = "VND",
|
|
32740
32741
|
baseClassName
|
|
32741
32742
|
} = props;
|
|
32742
|
-
if (isForm &&
|
|
32743
|
+
if (isForm && name === "amount_residual") {
|
|
32743
32744
|
return /* @__PURE__ */ jsxs66("div", { className: "flex justify-end gap-x-4 gap-y-2 ml-auto mt-2 lg:mt-5", children: [
|
|
32744
32745
|
/* @__PURE__ */ jsxs66("span", { className: "font-semibold", children: [
|
|
32745
32746
|
string,
|
|
@@ -32756,7 +32757,7 @@ var MonetaryField = (props) => {
|
|
|
32756
32757
|
return /* @__PURE__ */ jsx100(
|
|
32757
32758
|
Controller,
|
|
32758
32759
|
{
|
|
32759
|
-
name:
|
|
32760
|
+
name: name ?? "",
|
|
32760
32761
|
control: methods.control,
|
|
32761
32762
|
rules: {
|
|
32762
32763
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32769,7 +32770,7 @@ var MonetaryField = (props) => {
|
|
|
32769
32770
|
const { setError, clearErrors } = methods;
|
|
32770
32771
|
useEffect23(() => {
|
|
32771
32772
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32772
|
-
clearErrors(
|
|
32773
|
+
clearErrors(name);
|
|
32773
32774
|
}
|
|
32774
32775
|
}, [value2]);
|
|
32775
32776
|
return /* @__PURE__ */ jsxs66(Fragment29, { children: [
|
|
@@ -32780,18 +32781,18 @@ var MonetaryField = (props) => {
|
|
|
32780
32781
|
onBlur: () => {
|
|
32781
32782
|
if (!readonly && !isNaN(value2)) {
|
|
32782
32783
|
onBlur();
|
|
32783
|
-
handleOnchange && handleOnchange(
|
|
32784
|
-
clearErrors(
|
|
32784
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32785
|
+
clearErrors(name);
|
|
32785
32786
|
}
|
|
32786
32787
|
},
|
|
32787
32788
|
onChange: (e3) => {
|
|
32788
32789
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32789
32790
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32790
32791
|
onChange2(parsedValue);
|
|
32791
|
-
clearErrors(
|
|
32792
|
+
clearErrors(name);
|
|
32792
32793
|
} else {
|
|
32793
32794
|
if (required) {
|
|
32794
|
-
setError(
|
|
32795
|
+
setError(name, {
|
|
32795
32796
|
type: "required",
|
|
32796
32797
|
message: `${string} ${t3("must_required")}`
|
|
32797
32798
|
});
|
|
@@ -32906,9 +32907,11 @@ var PriorityField = (props) => {
|
|
|
32906
32907
|
onChange: onChange2,
|
|
32907
32908
|
id,
|
|
32908
32909
|
viewData,
|
|
32909
|
-
model
|
|
32910
|
+
model,
|
|
32911
|
+
name,
|
|
32912
|
+
string
|
|
32910
32913
|
} = props;
|
|
32911
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
32914
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
32912
32915
|
const defaultPriority = parseInt(value) + 1;
|
|
32913
32916
|
if (!isForm) {
|
|
32914
32917
|
return /* @__PURE__ */ jsx103(
|
|
@@ -32952,7 +32955,7 @@ import { useEffect as useEffect25 } from "react";
|
|
|
32952
32955
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
32953
32956
|
var RadioGroupField = (props) => {
|
|
32954
32957
|
const {
|
|
32955
|
-
name
|
|
32958
|
+
name,
|
|
32956
32959
|
readonly,
|
|
32957
32960
|
required,
|
|
32958
32961
|
placeholder,
|
|
@@ -32964,14 +32967,14 @@ var RadioGroupField = (props) => {
|
|
|
32964
32967
|
} = props;
|
|
32965
32968
|
useEffect25(() => {
|
|
32966
32969
|
if (selection?.length > 0) {
|
|
32967
|
-
if (setValue) setValue(
|
|
32970
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32968
32971
|
}
|
|
32969
|
-
}, [selection,
|
|
32972
|
+
}, [selection, name, setValue]);
|
|
32970
32973
|
if (!methods) return null;
|
|
32971
32974
|
return /* @__PURE__ */ jsx104(
|
|
32972
32975
|
Controller,
|
|
32973
32976
|
{
|
|
32974
|
-
name:
|
|
32977
|
+
name: name ?? "",
|
|
32975
32978
|
control: methods.control,
|
|
32976
32979
|
render: ({ field }) => /* @__PURE__ */ jsx104("div", { className: "widget radio-group-widget flex items-center gap-[10px] pb-4", children: selection?.map((select) => /* @__PURE__ */ jsxs68("div", { className: "flex items-center gap-1", children: [
|
|
32977
32980
|
/* @__PURE__ */ jsx104(
|
|
@@ -32984,8 +32987,8 @@ var RadioGroupField = (props) => {
|
|
|
32984
32987
|
onChange: (e3) => {
|
|
32985
32988
|
if (readonly) return;
|
|
32986
32989
|
field.onChange(e3.target.value);
|
|
32987
|
-
methods.setValue(
|
|
32988
|
-
onChange2?.(
|
|
32990
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
32991
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
32989
32992
|
},
|
|
32990
32993
|
readOnly: readonly,
|
|
32991
32994
|
required: !invisible && required,
|
|
@@ -33037,7 +33040,7 @@ var SelectDropdownField = (props) => {
|
|
|
33037
33040
|
const { t: t3 } = useI18n();
|
|
33038
33041
|
const {
|
|
33039
33042
|
selection,
|
|
33040
|
-
name
|
|
33043
|
+
name,
|
|
33041
33044
|
methods,
|
|
33042
33045
|
value,
|
|
33043
33046
|
readonly,
|
|
@@ -33060,7 +33063,7 @@ var SelectDropdownField = (props) => {
|
|
|
33060
33063
|
return /* @__PURE__ */ jsx106(
|
|
33061
33064
|
Controller,
|
|
33062
33065
|
{
|
|
33063
|
-
name:
|
|
33066
|
+
name: name || "",
|
|
33064
33067
|
control: methods.control,
|
|
33065
33068
|
rules: {
|
|
33066
33069
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -33079,7 +33082,7 @@ var SelectDropdownField = (props) => {
|
|
|
33079
33082
|
menuPlacement: "auto",
|
|
33080
33083
|
onChange: (selectedOption) => {
|
|
33081
33084
|
field.onChange(selectedOption.value);
|
|
33082
|
-
onChange2 && onChange2(
|
|
33085
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
33083
33086
|
},
|
|
33084
33087
|
value: defaultValue || null,
|
|
33085
33088
|
required: !invisible && required
|
|
@@ -33160,7 +33163,7 @@ import { jsx as jsx107 } from "react/jsx-runtime";
|
|
|
33160
33163
|
var TextAreaField = (props) => {
|
|
33161
33164
|
const {
|
|
33162
33165
|
methods,
|
|
33163
|
-
name
|
|
33166
|
+
name,
|
|
33164
33167
|
readonly,
|
|
33165
33168
|
placeholder,
|
|
33166
33169
|
required,
|
|
@@ -33171,7 +33174,7 @@ var TextAreaField = (props) => {
|
|
|
33171
33174
|
onChange: onChange2,
|
|
33172
33175
|
baseClassName
|
|
33173
33176
|
} = props;
|
|
33174
|
-
const formProps = methods ? methods.register(
|
|
33177
|
+
const formProps = methods ? methods.register(name, {
|
|
33175
33178
|
onBlur: (e3) => {
|
|
33176
33179
|
const newValue = e3.target.value;
|
|
33177
33180
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -33193,7 +33196,7 @@ var TextAreaField = (props) => {
|
|
|
33193
33196
|
disabled: readonly,
|
|
33194
33197
|
placeholder,
|
|
33195
33198
|
required: !invisible && required,
|
|
33196
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
33199
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
33197
33200
|
}
|
|
33198
33201
|
);
|
|
33199
33202
|
};
|
|
@@ -33202,7 +33205,7 @@ var TextAreaField = (props) => {
|
|
|
33202
33205
|
import { jsx as jsx108, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
33203
33206
|
var ToggleButtonField = (props) => {
|
|
33204
33207
|
const {
|
|
33205
|
-
name
|
|
33208
|
+
name,
|
|
33206
33209
|
readonly = false,
|
|
33207
33210
|
required = false,
|
|
33208
33211
|
invisible = false,
|
|
@@ -33212,7 +33215,7 @@ var ToggleButtonField = (props) => {
|
|
|
33212
33215
|
return /* @__PURE__ */ jsx108(
|
|
33213
33216
|
Controller,
|
|
33214
33217
|
{
|
|
33215
|
-
name:
|
|
33218
|
+
name: name ?? "",
|
|
33216
33219
|
control: methods?.control,
|
|
33217
33220
|
render: ({ field }) => /* @__PURE__ */ jsx108("div", { className: "widget toggle-widget inline-flex items-center", children: /* @__PURE__ */ jsxs71("label", { className: "relative inline-block w-8 h-5 cursor-pointer", children: [
|
|
33218
33221
|
/* @__PURE__ */ jsx108(
|
|
@@ -33222,10 +33225,10 @@ var ToggleButtonField = (props) => {
|
|
|
33222
33225
|
type: "checkbox",
|
|
33223
33226
|
onChange: (e3) => {
|
|
33224
33227
|
if (readonly) return;
|
|
33225
|
-
methods.setValue(
|
|
33228
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
33226
33229
|
field.onChange(e3.target.checked);
|
|
33227
33230
|
if (onChange2) {
|
|
33228
|
-
onChange2(
|
|
33231
|
+
onChange2(name ?? "", e3.target.checked);
|
|
33229
33232
|
}
|
|
33230
33233
|
},
|
|
33231
33234
|
disabled: readonly,
|
|
@@ -33272,7 +33275,7 @@ import { useEffect as useEffect26, useRef as useRef17, useState as useState22 }
|
|
|
33272
33275
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
33273
33276
|
var IntegerField = (props) => {
|
|
33274
33277
|
const {
|
|
33275
|
-
name
|
|
33278
|
+
name,
|
|
33276
33279
|
value,
|
|
33277
33280
|
readonly,
|
|
33278
33281
|
placeholder,
|
|
@@ -33294,7 +33297,7 @@ var IntegerField = (props) => {
|
|
|
33294
33297
|
return /* @__PURE__ */ jsx109(
|
|
33295
33298
|
Controller,
|
|
33296
33299
|
{
|
|
33297
|
-
name:
|
|
33300
|
+
name: name || "",
|
|
33298
33301
|
control: methods.control,
|
|
33299
33302
|
rules: {
|
|
33300
33303
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -33314,12 +33317,12 @@ var IntegerField = (props) => {
|
|
|
33314
33317
|
useEffect26(() => {
|
|
33315
33318
|
if (value2 !== void 0 && value2 !== null) {
|
|
33316
33319
|
setInputValue(String(value2));
|
|
33317
|
-
clearErrors(
|
|
33320
|
+
clearErrors(name);
|
|
33318
33321
|
}
|
|
33319
33322
|
}, [value2]);
|
|
33320
33323
|
const noticeError = () => {
|
|
33321
33324
|
if (required) {
|
|
33322
|
-
setError(
|
|
33325
|
+
setError(name, {
|
|
33323
33326
|
type: "required",
|
|
33324
33327
|
message: `${string} ${t3("must_required")}`
|
|
33325
33328
|
});
|
|
@@ -33337,7 +33340,7 @@ var IntegerField = (props) => {
|
|
|
33337
33340
|
if (!isNaN(parsed)) {
|
|
33338
33341
|
fieldOnChange(parsed);
|
|
33339
33342
|
isDirtyRef.current = true;
|
|
33340
|
-
clearErrors(
|
|
33343
|
+
clearErrors(name);
|
|
33341
33344
|
} else {
|
|
33342
33345
|
noticeError();
|
|
33343
33346
|
}
|
|
@@ -33363,11 +33366,11 @@ var IntegerField = (props) => {
|
|
|
33363
33366
|
return;
|
|
33364
33367
|
}
|
|
33365
33368
|
fieldOnChange(parsed);
|
|
33366
|
-
onChange2?.(
|
|
33369
|
+
onChange2?.(name ?? "", parsed);
|
|
33367
33370
|
lastCommittedValueRef.current = parsed;
|
|
33368
33371
|
isDirtyRef.current = false;
|
|
33369
33372
|
inputRef.current?.blur();
|
|
33370
|
-
clearErrors(
|
|
33373
|
+
clearErrors(name);
|
|
33371
33374
|
};
|
|
33372
33375
|
return /* @__PURE__ */ jsxs72(Fragment31, { children: [
|
|
33373
33376
|
/* @__PURE__ */ jsx109(
|
|
@@ -33776,7 +33779,7 @@ var Many2OneField = (props) => {
|
|
|
33776
33779
|
isForm,
|
|
33777
33780
|
isEditTable,
|
|
33778
33781
|
value: propValue,
|
|
33779
|
-
name
|
|
33782
|
+
name,
|
|
33780
33783
|
readonly,
|
|
33781
33784
|
methods,
|
|
33782
33785
|
required,
|
|
@@ -33803,7 +33806,7 @@ var Many2OneField = (props) => {
|
|
|
33803
33806
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33804
33807
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33805
33808
|
allowShowDetail && renderDetail({
|
|
33806
|
-
idToolTip: String(
|
|
33809
|
+
idToolTip: String(name) + Number(index4),
|
|
33807
33810
|
model: options2?.model ?? relation,
|
|
33808
33811
|
context: contextObject,
|
|
33809
33812
|
idForm: id
|
|
@@ -33812,8 +33815,8 @@ var Many2OneField = (props) => {
|
|
|
33812
33815
|
"span",
|
|
33813
33816
|
{
|
|
33814
33817
|
className: "cursor-pointer",
|
|
33815
|
-
"data-tooltip-id": String(
|
|
33816
|
-
id:
|
|
33818
|
+
"data-tooltip-id": String(name) + index4,
|
|
33819
|
+
id: name,
|
|
33817
33820
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33818
33821
|
}
|
|
33819
33822
|
)
|
|
@@ -33821,21 +33824,21 @@ var Many2OneField = (props) => {
|
|
|
33821
33824
|
}
|
|
33822
33825
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33823
33826
|
allowShowDetail && renderDetail({
|
|
33824
|
-
idToolTip: String(
|
|
33827
|
+
idToolTip: String(name),
|
|
33825
33828
|
model: options2?.model ?? relation,
|
|
33826
33829
|
context: contextObject,
|
|
33827
|
-
idForm: methods?.getValues(
|
|
33830
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33828
33831
|
}),
|
|
33829
33832
|
/* @__PURE__ */ jsx112(
|
|
33830
33833
|
"div",
|
|
33831
33834
|
{
|
|
33832
|
-
id:
|
|
33833
|
-
"data-tooltip-id":
|
|
33835
|
+
id: name,
|
|
33836
|
+
"data-tooltip-id": name,
|
|
33834
33837
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33835
33838
|
children: /* @__PURE__ */ jsx112(
|
|
33836
33839
|
Controller,
|
|
33837
33840
|
{
|
|
33838
|
-
name:
|
|
33841
|
+
name: name ?? "",
|
|
33839
33842
|
control: methods?.control,
|
|
33840
33843
|
rules: {
|
|
33841
33844
|
required: required ? {
|
|
@@ -33856,7 +33859,7 @@ var Many2OneField = (props) => {
|
|
|
33856
33859
|
) ?? currentValue : currentValue ?? null;
|
|
33857
33860
|
useEffect28(() => {
|
|
33858
33861
|
if (error2 && selectedOption) {
|
|
33859
|
-
methods?.clearErrors(
|
|
33862
|
+
methods?.clearErrors(name);
|
|
33860
33863
|
}
|
|
33861
33864
|
}, [selectedOption]);
|
|
33862
33865
|
return /* @__PURE__ */ jsxs75(
|
|
@@ -34219,7 +34222,7 @@ var ICCheck = () => {
|
|
|
34219
34222
|
import { jsx as jsx115, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
34220
34223
|
var DateOptionField = (props) => {
|
|
34221
34224
|
const {
|
|
34222
|
-
name
|
|
34225
|
+
name,
|
|
34223
34226
|
readonly,
|
|
34224
34227
|
required,
|
|
34225
34228
|
invisible,
|
|
@@ -34230,7 +34233,7 @@ var DateOptionField = (props) => {
|
|
|
34230
34233
|
return /* @__PURE__ */ jsx115(
|
|
34231
34234
|
Controller,
|
|
34232
34235
|
{
|
|
34233
|
-
name:
|
|
34236
|
+
name: name ?? "",
|
|
34234
34237
|
control: methods?.control,
|
|
34235
34238
|
render: ({ field }) => /* @__PURE__ */ jsxs78(
|
|
34236
34239
|
"label",
|
|
@@ -34251,9 +34254,9 @@ var DateOptionField = (props) => {
|
|
|
34251
34254
|
onChange: (e3) => {
|
|
34252
34255
|
if (readonly) return;
|
|
34253
34256
|
const value = e3.target.checked;
|
|
34254
|
-
methods.setValue(
|
|
34257
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
34255
34258
|
field.onChange(value);
|
|
34256
|
-
onChange2?.(
|
|
34259
|
+
onChange2?.(name ?? "", value);
|
|
34257
34260
|
}
|
|
34258
34261
|
}
|
|
34259
34262
|
),
|