@fctc/sme-widget-ui 2.6.9 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +502 -495
- package/dist/index.mjs +500 -493
- package/dist/widgets.js +502 -495
- package/dist/widgets.mjs +500 -493
- package/package.json +1 -1
package/dist/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 = {
|
|
@@ -10862,6 +10862,10 @@ var Row = (props) => {
|
|
|
10862
10862
|
isDisplayCheckbox && /* @__PURE__ */ jsx47(
|
|
10863
10863
|
"td",
|
|
10864
10864
|
{
|
|
10865
|
+
style: {
|
|
10866
|
+
width: "40px",
|
|
10867
|
+
maxWidth: "40px"
|
|
10868
|
+
},
|
|
10865
10869
|
className: `td-checkbox column w-max whitespace-nowrap p-3 border-b border-gray-200 text-sm font-normal text-gray-900`,
|
|
10866
10870
|
children: /* @__PURE__ */ jsx47(
|
|
10867
10871
|
"input",
|
|
@@ -11353,7 +11357,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11353
11357
|
let resetCount = 0;
|
|
11354
11358
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
11355
11359
|
const {
|
|
11356
|
-
name
|
|
11360
|
+
name,
|
|
11357
11361
|
fn
|
|
11358
11362
|
} = validMiddleware[i3];
|
|
11359
11363
|
const {
|
|
@@ -11379,8 +11383,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11379
11383
|
y3 = nextY != null ? nextY : y3;
|
|
11380
11384
|
middlewareData = {
|
|
11381
11385
|
...middlewareData,
|
|
11382
|
-
[
|
|
11383
|
-
...middlewareData[
|
|
11386
|
+
[name]: {
|
|
11387
|
+
...middlewareData[name],
|
|
11384
11388
|
...data
|
|
11385
11389
|
}
|
|
11386
11390
|
};
|
|
@@ -12970,7 +12974,8 @@ var TableHead = (props) => {
|
|
|
12970
12974
|
{
|
|
12971
12975
|
style: {
|
|
12972
12976
|
width: "40px",
|
|
12973
|
-
maxWidth: "40px"
|
|
12977
|
+
maxWidth: "40px",
|
|
12978
|
+
overflow: "unset !important"
|
|
12974
12979
|
},
|
|
12975
12980
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
12976
12981
|
children: /* @__PURE__ */ jsx51(
|
|
@@ -13445,8 +13450,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
13445
13450
|
var isObjectType = (value) => typeof value === "object";
|
|
13446
13451
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
13447
13452
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
13448
|
-
var getNodeParentName = (
|
|
13449
|
-
var isNameInFieldArray = (names,
|
|
13453
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
13454
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
13450
13455
|
var isPlainObject = (tempObject) => {
|
|
13451
13456
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
13452
13457
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -13550,7 +13555,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
13550
13555
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
13551
13556
|
function useFormState(props) {
|
|
13552
13557
|
const methods = useFormContext();
|
|
13553
|
-
const { control = methods.control, disabled, name
|
|
13558
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
13554
13559
|
const [formState, updateFormState] = React.useState(control._formState);
|
|
13555
13560
|
const _localProxyFormState = React.useRef({
|
|
13556
13561
|
isDirty: false,
|
|
@@ -13563,7 +13568,7 @@ function useFormState(props) {
|
|
|
13563
13568
|
errors: false
|
|
13564
13569
|
});
|
|
13565
13570
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13566
|
-
name
|
|
13571
|
+
name,
|
|
13567
13572
|
formState: _localProxyFormState.current,
|
|
13568
13573
|
exact,
|
|
13569
13574
|
callback: (formState2) => {
|
|
@@ -13572,7 +13577,7 @@ function useFormState(props) {
|
|
|
13572
13577
|
...formState2
|
|
13573
13578
|
});
|
|
13574
13579
|
}
|
|
13575
|
-
}), [
|
|
13580
|
+
}), [name, disabled, exact]);
|
|
13576
13581
|
React.useEffect(() => {
|
|
13577
13582
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
13578
13583
|
}, [control]);
|
|
@@ -13624,22 +13629,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
13624
13629
|
}
|
|
13625
13630
|
function useWatch(props) {
|
|
13626
13631
|
const methods = useFormContext();
|
|
13627
|
-
const { control = methods.control, name
|
|
13632
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
13628
13633
|
const _defaultValue = React.useRef(defaultValue);
|
|
13629
13634
|
const _compute = React.useRef(compute);
|
|
13630
13635
|
const _computeFormValues = React.useRef(void 0);
|
|
13631
13636
|
_compute.current = compute;
|
|
13632
|
-
const defaultValueMemo = React.useMemo(() => control._getWatch(
|
|
13637
|
+
const defaultValueMemo = React.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
13633
13638
|
const [value, updateValue] = React.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
13634
13639
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13635
|
-
name
|
|
13640
|
+
name,
|
|
13636
13641
|
formState: {
|
|
13637
13642
|
values: true
|
|
13638
13643
|
},
|
|
13639
13644
|
exact,
|
|
13640
13645
|
callback: (formState) => {
|
|
13641
13646
|
if (!disabled) {
|
|
13642
|
-
const formValues = generateWatchOutput(
|
|
13647
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
13643
13648
|
if (_compute.current) {
|
|
13644
13649
|
const computedFormValues = _compute.current(formValues);
|
|
13645
13650
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -13651,28 +13656,28 @@ function useWatch(props) {
|
|
|
13651
13656
|
}
|
|
13652
13657
|
}
|
|
13653
13658
|
}
|
|
13654
|
-
}), [control, disabled,
|
|
13659
|
+
}), [control, disabled, name, exact]);
|
|
13655
13660
|
React.useEffect(() => control._removeUnmounted());
|
|
13656
13661
|
return value;
|
|
13657
13662
|
}
|
|
13658
13663
|
function useController(props) {
|
|
13659
13664
|
const methods = useFormContext();
|
|
13660
|
-
const { name
|
|
13661
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
13662
|
-
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]);
|
|
13663
13668
|
const value = useWatch({
|
|
13664
13669
|
control,
|
|
13665
|
-
name
|
|
13670
|
+
name,
|
|
13666
13671
|
defaultValue: defaultValueMemo,
|
|
13667
13672
|
exact: true
|
|
13668
13673
|
});
|
|
13669
13674
|
const formState = useFormState({
|
|
13670
13675
|
control,
|
|
13671
|
-
name
|
|
13676
|
+
name,
|
|
13672
13677
|
exact: true
|
|
13673
13678
|
});
|
|
13674
13679
|
const _props = React.useRef(props);
|
|
13675
|
-
const _registerProps = React.useRef(control.register(
|
|
13680
|
+
const _registerProps = React.useRef(control.register(name, {
|
|
13676
13681
|
...props.rules,
|
|
13677
13682
|
value,
|
|
13678
13683
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -13681,41 +13686,41 @@ function useController(props) {
|
|
|
13681
13686
|
const fieldState = React.useMemo(() => Object.defineProperties({}, {
|
|
13682
13687
|
invalid: {
|
|
13683
13688
|
enumerable: true,
|
|
13684
|
-
get: () => !!get2(formState.errors,
|
|
13689
|
+
get: () => !!get2(formState.errors, name)
|
|
13685
13690
|
},
|
|
13686
13691
|
isDirty: {
|
|
13687
13692
|
enumerable: true,
|
|
13688
|
-
get: () => !!get2(formState.dirtyFields,
|
|
13693
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
13689
13694
|
},
|
|
13690
13695
|
isTouched: {
|
|
13691
13696
|
enumerable: true,
|
|
13692
|
-
get: () => !!get2(formState.touchedFields,
|
|
13697
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
13693
13698
|
},
|
|
13694
13699
|
isValidating: {
|
|
13695
13700
|
enumerable: true,
|
|
13696
|
-
get: () => !!get2(formState.validatingFields,
|
|
13701
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
13697
13702
|
},
|
|
13698
13703
|
error: {
|
|
13699
13704
|
enumerable: true,
|
|
13700
|
-
get: () => get2(formState.errors,
|
|
13705
|
+
get: () => get2(formState.errors, name)
|
|
13701
13706
|
}
|
|
13702
|
-
}), [formState,
|
|
13707
|
+
}), [formState, name]);
|
|
13703
13708
|
const onChange2 = React.useCallback((event) => _registerProps.current.onChange({
|
|
13704
13709
|
target: {
|
|
13705
13710
|
value: getEventValue(event),
|
|
13706
|
-
name
|
|
13711
|
+
name
|
|
13707
13712
|
},
|
|
13708
13713
|
type: EVENTS.CHANGE
|
|
13709
|
-
}), [
|
|
13714
|
+
}), [name]);
|
|
13710
13715
|
const onBlur = React.useCallback(() => _registerProps.current.onBlur({
|
|
13711
13716
|
target: {
|
|
13712
|
-
value: get2(control._formValues,
|
|
13713
|
-
name
|
|
13717
|
+
value: get2(control._formValues, name),
|
|
13718
|
+
name
|
|
13714
13719
|
},
|
|
13715
13720
|
type: EVENTS.BLUR
|
|
13716
|
-
}), [
|
|
13721
|
+
}), [name, control._formValues]);
|
|
13717
13722
|
const ref = React.useCallback((elm) => {
|
|
13718
|
-
const field2 = get2(control._fields,
|
|
13723
|
+
const field2 = get2(control._fields, name);
|
|
13719
13724
|
if (field2 && elm) {
|
|
13720
13725
|
field2._f.ref = {
|
|
13721
13726
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -13724,46 +13729,46 @@ function useController(props) {
|
|
|
13724
13729
|
reportValidity: () => elm.reportValidity()
|
|
13725
13730
|
};
|
|
13726
13731
|
}
|
|
13727
|
-
}, [control._fields,
|
|
13732
|
+
}, [control._fields, name]);
|
|
13728
13733
|
const field = React.useMemo(() => ({
|
|
13729
|
-
name
|
|
13734
|
+
name,
|
|
13730
13735
|
value,
|
|
13731
13736
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
13732
13737
|
onChange: onChange2,
|
|
13733
13738
|
onBlur,
|
|
13734
13739
|
ref
|
|
13735
|
-
}), [
|
|
13740
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
13736
13741
|
React.useEffect(() => {
|
|
13737
13742
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
13738
|
-
control.register(
|
|
13743
|
+
control.register(name, {
|
|
13739
13744
|
..._props.current.rules,
|
|
13740
13745
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
13741
13746
|
});
|
|
13742
|
-
const updateMounted = (
|
|
13743
|
-
const field2 = get2(control._fields,
|
|
13747
|
+
const updateMounted = (name2, value2) => {
|
|
13748
|
+
const field2 = get2(control._fields, name2);
|
|
13744
13749
|
if (field2 && field2._f) {
|
|
13745
13750
|
field2._f.mount = value2;
|
|
13746
13751
|
}
|
|
13747
13752
|
};
|
|
13748
|
-
updateMounted(
|
|
13753
|
+
updateMounted(name, true);
|
|
13749
13754
|
if (_shouldUnregisterField) {
|
|
13750
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
13751
|
-
set(control._defaultValues,
|
|
13752
|
-
if (isUndefined(get2(control._formValues,
|
|
13753
|
-
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);
|
|
13754
13759
|
}
|
|
13755
13760
|
}
|
|
13756
|
-
!isArrayField && control.register(
|
|
13761
|
+
!isArrayField && control.register(name);
|
|
13757
13762
|
return () => {
|
|
13758
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
13763
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
13759
13764
|
};
|
|
13760
|
-
}, [
|
|
13765
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
13761
13766
|
React.useEffect(() => {
|
|
13762
13767
|
control._setDisabledField({
|
|
13763
13768
|
disabled,
|
|
13764
|
-
name
|
|
13769
|
+
name
|
|
13765
13770
|
});
|
|
13766
|
-
}, [disabled,
|
|
13771
|
+
}, [disabled, name, control]);
|
|
13767
13772
|
return React.useMemo(() => ({
|
|
13768
13773
|
field,
|
|
13769
13774
|
formState,
|
|
@@ -13771,10 +13776,10 @@ function useController(props) {
|
|
|
13771
13776
|
}), [field, formState, fieldState]);
|
|
13772
13777
|
}
|
|
13773
13778
|
var Controller = (props) => props.render(useController(props));
|
|
13774
|
-
var appendErrors = (
|
|
13775
|
-
...errors[
|
|
13779
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
13780
|
+
...errors[name],
|
|
13776
13781
|
types: {
|
|
13777
|
-
...errors[
|
|
13782
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
13778
13783
|
[type]: message2 || true
|
|
13779
13784
|
}
|
|
13780
13785
|
} : {};
|
|
@@ -13934,9 +13939,9 @@ function getFieldValue(_f) {
|
|
|
13934
13939
|
}
|
|
13935
13940
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
13936
13941
|
const fields = {};
|
|
13937
|
-
for (const
|
|
13938
|
-
const field = get2(_fields,
|
|
13939
|
-
field && set(fields,
|
|
13942
|
+
for (const name of fieldsNames) {
|
|
13943
|
+
const field = get2(_fields, name);
|
|
13944
|
+
field && set(fields, name, field._f);
|
|
13940
13945
|
}
|
|
13941
13946
|
return {
|
|
13942
13947
|
criteriaMode,
|
|
@@ -13957,7 +13962,7 @@ var getValidationModes = (mode) => ({
|
|
|
13957
13962
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
13958
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));
|
|
13959
13964
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
13960
|
-
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))));
|
|
13961
13966
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
13962
13967
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
13963
13968
|
const field = get2(fields, key);
|
|
@@ -13982,21 +13987,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
13982
13987
|
}
|
|
13983
13988
|
return;
|
|
13984
13989
|
};
|
|
13985
|
-
function schemaErrorLookup(errors, _fields,
|
|
13986
|
-
const error2 = get2(errors,
|
|
13987
|
-
if (error2 || isKey(
|
|
13990
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
13991
|
+
const error2 = get2(errors, name);
|
|
13992
|
+
if (error2 || isKey(name)) {
|
|
13988
13993
|
return {
|
|
13989
13994
|
error: error2,
|
|
13990
|
-
name
|
|
13995
|
+
name
|
|
13991
13996
|
};
|
|
13992
13997
|
}
|
|
13993
|
-
const names =
|
|
13998
|
+
const names = name.split(".");
|
|
13994
13999
|
while (names.length) {
|
|
13995
14000
|
const fieldName = names.join(".");
|
|
13996
14001
|
const field = get2(_fields, fieldName);
|
|
13997
14002
|
const foundError = get2(errors, fieldName);
|
|
13998
|
-
if (field && !Array.isArray(field) &&
|
|
13999
|
-
return { name
|
|
14003
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
14004
|
+
return { name };
|
|
14000
14005
|
}
|
|
14001
14006
|
if (foundError && foundError.type) {
|
|
14002
14007
|
return {
|
|
@@ -14013,15 +14018,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
14013
14018
|
names.pop();
|
|
14014
14019
|
}
|
|
14015
14020
|
return {
|
|
14016
|
-
name
|
|
14021
|
+
name
|
|
14017
14022
|
};
|
|
14018
14023
|
}
|
|
14019
14024
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
14020
14025
|
updateFormState(formStateData);
|
|
14021
|
-
const { name
|
|
14026
|
+
const { name, ...formState } = formStateData;
|
|
14022
14027
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
14023
14028
|
};
|
|
14024
|
-
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)));
|
|
14025
14030
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
14026
14031
|
if (mode.isOnAll) {
|
|
14027
14032
|
return false;
|
|
@@ -14034,11 +14039,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
14034
14039
|
}
|
|
14035
14040
|
return true;
|
|
14036
14041
|
};
|
|
14037
|
-
var unsetEmptyArray = (ref,
|
|
14038
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
14039
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
14040
|
-
set(fieldArrayErrors, "root", error2[
|
|
14041
|
-
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);
|
|
14042
14047
|
return errors;
|
|
14043
14048
|
};
|
|
14044
14049
|
var isMessage = (value) => isString3(value);
|
|
@@ -14056,9 +14061,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
14056
14061
|
message: ""
|
|
14057
14062
|
};
|
|
14058
14063
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
14059
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
14060
|
-
const inputValue = get2(formValues,
|
|
14061
|
-
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)) {
|
|
14062
14067
|
return {};
|
|
14063
14068
|
}
|
|
14064
14069
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -14073,10 +14078,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14073
14078
|
const isCheckBox = isCheckBoxInput(ref);
|
|
14074
14079
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
14075
14080
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
14076
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
14081
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
14077
14082
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
14078
14083
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
14079
|
-
error2[
|
|
14084
|
+
error2[name] = {
|
|
14080
14085
|
type: exceedMax ? maxType : minType,
|
|
14081
14086
|
message: message2,
|
|
14082
14087
|
ref,
|
|
@@ -14086,7 +14091,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14086
14091
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
14087
14092
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
14088
14093
|
if (value) {
|
|
14089
|
-
error2[
|
|
14094
|
+
error2[name] = {
|
|
14090
14095
|
type: INPUT_VALIDATION_RULES.required,
|
|
14091
14096
|
message: message2,
|
|
14092
14097
|
ref: inputRef,
|
|
@@ -14126,7 +14131,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14126
14131
|
if (exceedMax || exceedMin) {
|
|
14127
14132
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
14128
14133
|
if (!validateAllFieldCriteria) {
|
|
14129
|
-
setCustomValidity(error2[
|
|
14134
|
+
setCustomValidity(error2[name].message);
|
|
14130
14135
|
return error2;
|
|
14131
14136
|
}
|
|
14132
14137
|
}
|
|
@@ -14139,7 +14144,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14139
14144
|
if (exceedMax || exceedMin) {
|
|
14140
14145
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
14141
14146
|
if (!validateAllFieldCriteria) {
|
|
14142
|
-
setCustomValidity(error2[
|
|
14147
|
+
setCustomValidity(error2[name].message);
|
|
14143
14148
|
return error2;
|
|
14144
14149
|
}
|
|
14145
14150
|
}
|
|
@@ -14147,7 +14152,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14147
14152
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
14148
14153
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
14149
14154
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
14150
|
-
error2[
|
|
14155
|
+
error2[name] = {
|
|
14151
14156
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
14152
14157
|
message: message2,
|
|
14153
14158
|
ref,
|
|
@@ -14164,7 +14169,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14164
14169
|
const result = await validate(inputValue, formValues);
|
|
14165
14170
|
const validateError = getValidateError(result, inputRef);
|
|
14166
14171
|
if (validateError) {
|
|
14167
|
-
error2[
|
|
14172
|
+
error2[name] = {
|
|
14168
14173
|
...validateError,
|
|
14169
14174
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
14170
14175
|
};
|
|
@@ -14187,12 +14192,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14187
14192
|
};
|
|
14188
14193
|
setCustomValidity(validateError.message);
|
|
14189
14194
|
if (validateAllFieldCriteria) {
|
|
14190
|
-
error2[
|
|
14195
|
+
error2[name] = validationResult;
|
|
14191
14196
|
}
|
|
14192
14197
|
}
|
|
14193
14198
|
}
|
|
14194
14199
|
if (!isEmptyObject(validationResult)) {
|
|
14195
|
-
error2[
|
|
14200
|
+
error2[name] = {
|
|
14196
14201
|
ref: inputRef,
|
|
14197
14202
|
...validationResult
|
|
14198
14203
|
};
|
|
@@ -14281,9 +14286,9 @@ function createFormControl(props = {}) {
|
|
|
14281
14286
|
};
|
|
14282
14287
|
const _updateIsValidating = (names, isValidating) => {
|
|
14283
14288
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
14284
|
-
(names || Array.from(_names.mount)).forEach((
|
|
14285
|
-
if (
|
|
14286
|
-
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);
|
|
14287
14292
|
}
|
|
14288
14293
|
});
|
|
14289
14294
|
_subjects.state.next({
|
|
@@ -14292,38 +14297,38 @@ function createFormControl(props = {}) {
|
|
|
14292
14297
|
});
|
|
14293
14298
|
}
|
|
14294
14299
|
};
|
|
14295
|
-
const _setFieldArray = (
|
|
14300
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
14296
14301
|
if (args && method && !_options.disabled) {
|
|
14297
14302
|
_state.action = true;
|
|
14298
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
14299
|
-
const fieldValues = method(get2(_fields,
|
|
14300
|
-
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);
|
|
14301
14306
|
}
|
|
14302
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
14303
|
-
const errors = method(get2(_formState.errors,
|
|
14304
|
-
shouldSetValues && set(_formState.errors,
|
|
14305
|
-
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);
|
|
14306
14311
|
}
|
|
14307
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
14308
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
14309
|
-
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);
|
|
14310
14315
|
}
|
|
14311
14316
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
14312
14317
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
14313
14318
|
}
|
|
14314
14319
|
_subjects.state.next({
|
|
14315
|
-
name
|
|
14316
|
-
isDirty: _getDirty(
|
|
14320
|
+
name,
|
|
14321
|
+
isDirty: _getDirty(name, values),
|
|
14317
14322
|
dirtyFields: _formState.dirtyFields,
|
|
14318
14323
|
errors: _formState.errors,
|
|
14319
14324
|
isValid: _formState.isValid
|
|
14320
14325
|
});
|
|
14321
14326
|
} else {
|
|
14322
|
-
set(_formValues,
|
|
14327
|
+
set(_formValues, name, values);
|
|
14323
14328
|
}
|
|
14324
14329
|
};
|
|
14325
|
-
const updateErrors = (
|
|
14326
|
-
set(_formState.errors,
|
|
14330
|
+
const updateErrors = (name, error2) => {
|
|
14331
|
+
set(_formState.errors, name, error2);
|
|
14327
14332
|
_subjects.state.next({
|
|
14328
14333
|
errors: _formState.errors
|
|
14329
14334
|
});
|
|
@@ -14335,19 +14340,19 @@ function createFormControl(props = {}) {
|
|
|
14335
14340
|
isValid: false
|
|
14336
14341
|
});
|
|
14337
14342
|
};
|
|
14338
|
-
const updateValidAndValue = (
|
|
14339
|
-
const field = get2(_fields,
|
|
14343
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
14344
|
+
const field = get2(_fields, name);
|
|
14340
14345
|
if (field) {
|
|
14341
|
-
const defaultValue = get2(_formValues,
|
|
14342
|
-
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);
|
|
14343
14348
|
_state.mount && _setValid();
|
|
14344
14349
|
}
|
|
14345
14350
|
};
|
|
14346
|
-
const updateTouchAndDirty = (
|
|
14351
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
14347
14352
|
let shouldUpdateField = false;
|
|
14348
14353
|
let isPreviousDirty = false;
|
|
14349
14354
|
const output = {
|
|
14350
|
-
name
|
|
14355
|
+
name
|
|
14351
14356
|
};
|
|
14352
14357
|
if (!_options.disabled) {
|
|
14353
14358
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -14356,16 +14361,16 @@ function createFormControl(props = {}) {
|
|
|
14356
14361
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
14357
14362
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
14358
14363
|
}
|
|
14359
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
14360
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
14361
|
-
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);
|
|
14362
14367
|
output.dirtyFields = _formState.dirtyFields;
|
|
14363
14368
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
14364
14369
|
}
|
|
14365
14370
|
if (isBlurEvent) {
|
|
14366
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
14371
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
14367
14372
|
if (!isPreviousFieldTouched) {
|
|
14368
|
-
set(_formState.touchedFields,
|
|
14373
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
14369
14374
|
output.touchedFields = _formState.touchedFields;
|
|
14370
14375
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
14371
14376
|
}
|
|
@@ -14374,23 +14379,23 @@ function createFormControl(props = {}) {
|
|
|
14374
14379
|
}
|
|
14375
14380
|
return shouldUpdateField ? output : {};
|
|
14376
14381
|
};
|
|
14377
|
-
const shouldRenderByError = (
|
|
14378
|
-
const previousFieldError = get2(_formState.errors,
|
|
14382
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
14383
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
14379
14384
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
14380
14385
|
if (_options.delayError && error2) {
|
|
14381
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
14386
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
14382
14387
|
delayErrorCallback(_options.delayError);
|
|
14383
14388
|
} else {
|
|
14384
14389
|
clearTimeout(timer);
|
|
14385
14390
|
delayErrorCallback = null;
|
|
14386
|
-
error2 ? set(_formState.errors,
|
|
14391
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
14387
14392
|
}
|
|
14388
14393
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
14389
14394
|
const updatedFormState = {
|
|
14390
14395
|
...fieldState,
|
|
14391
14396
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
14392
14397
|
errors: _formState.errors,
|
|
14393
|
-
name
|
|
14398
|
+
name
|
|
14394
14399
|
};
|
|
14395
14400
|
_formState = {
|
|
14396
14401
|
..._formState,
|
|
@@ -14399,18 +14404,18 @@ function createFormControl(props = {}) {
|
|
|
14399
14404
|
_subjects.state.next(updatedFormState);
|
|
14400
14405
|
}
|
|
14401
14406
|
};
|
|
14402
|
-
const _runSchema = async (
|
|
14403
|
-
_updateIsValidating(
|
|
14404
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
14405
|
-
_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);
|
|
14406
14411
|
return result;
|
|
14407
14412
|
};
|
|
14408
14413
|
const executeSchemaAndUpdateState = async (names) => {
|
|
14409
14414
|
const { errors } = await _runSchema(names);
|
|
14410
14415
|
if (names) {
|
|
14411
|
-
for (const
|
|
14412
|
-
const error2 = get2(errors,
|
|
14413
|
-
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);
|
|
14414
14419
|
}
|
|
14415
14420
|
} else {
|
|
14416
14421
|
_formState.errors = errors;
|
|
@@ -14420,19 +14425,19 @@ function createFormControl(props = {}) {
|
|
|
14420
14425
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
14421
14426
|
valid: true
|
|
14422
14427
|
}) => {
|
|
14423
|
-
for (const
|
|
14424
|
-
const field = fields[
|
|
14428
|
+
for (const name in fields) {
|
|
14429
|
+
const field = fields[name];
|
|
14425
14430
|
if (field) {
|
|
14426
14431
|
const { _f, ...fieldValue } = field;
|
|
14427
14432
|
if (_f) {
|
|
14428
14433
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
14429
14434
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
14430
14435
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14431
|
-
_updateIsValidating([
|
|
14436
|
+
_updateIsValidating([name], true);
|
|
14432
14437
|
}
|
|
14433
14438
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
14434
14439
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14435
|
-
_updateIsValidating([
|
|
14440
|
+
_updateIsValidating([name]);
|
|
14436
14441
|
}
|
|
14437
14442
|
if (fieldError[_f.name]) {
|
|
14438
14443
|
context.valid = false;
|
|
@@ -14448,24 +14453,24 @@ function createFormControl(props = {}) {
|
|
|
14448
14453
|
return context.valid;
|
|
14449
14454
|
};
|
|
14450
14455
|
const _removeUnmounted = () => {
|
|
14451
|
-
for (const
|
|
14452
|
-
const field = get2(_fields,
|
|
14453
|
-
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);
|
|
14454
14459
|
}
|
|
14455
14460
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
14456
14461
|
};
|
|
14457
|
-
const _getDirty = (
|
|
14462
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
14458
14463
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
14459
14464
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
14460
14465
|
}, isGlobal, defaultValue);
|
|
14461
|
-
const _getFieldArray = (
|
|
14462
|
-
const setFieldValue = (
|
|
14463
|
-
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);
|
|
14464
14469
|
let fieldValue = value;
|
|
14465
14470
|
if (field) {
|
|
14466
14471
|
const fieldReference = field._f;
|
|
14467
14472
|
if (fieldReference) {
|
|
14468
|
-
!fieldReference.disabled && set(_formValues,
|
|
14473
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
14469
14474
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
14470
14475
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
14471
14476
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -14489,61 +14494,61 @@ function createFormControl(props = {}) {
|
|
|
14489
14494
|
fieldReference.ref.value = fieldValue;
|
|
14490
14495
|
if (!fieldReference.ref.type) {
|
|
14491
14496
|
_subjects.state.next({
|
|
14492
|
-
name
|
|
14497
|
+
name,
|
|
14493
14498
|
values: cloneObject(_formValues)
|
|
14494
14499
|
});
|
|
14495
14500
|
}
|
|
14496
14501
|
}
|
|
14497
14502
|
}
|
|
14498
14503
|
}
|
|
14499
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
14500
|
-
options2.shouldValidate && trigger(
|
|
14504
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
14505
|
+
options2.shouldValidate && trigger(name);
|
|
14501
14506
|
};
|
|
14502
|
-
const setValues = (
|
|
14507
|
+
const setValues = (name, value, options2) => {
|
|
14503
14508
|
for (const fieldKey in value) {
|
|
14504
14509
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
14505
14510
|
return;
|
|
14506
14511
|
}
|
|
14507
14512
|
const fieldValue = value[fieldKey];
|
|
14508
|
-
const fieldName =
|
|
14513
|
+
const fieldName = name + "." + fieldKey;
|
|
14509
14514
|
const field = get2(_fields, fieldName);
|
|
14510
|
-
(_names.array.has(
|
|
14515
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
14511
14516
|
}
|
|
14512
14517
|
};
|
|
14513
|
-
const setValue = (
|
|
14514
|
-
const field = get2(_fields,
|
|
14515
|
-
const isFieldArray = _names.array.has(
|
|
14518
|
+
const setValue = (name, value, options2 = {}) => {
|
|
14519
|
+
const field = get2(_fields, name);
|
|
14520
|
+
const isFieldArray = _names.array.has(name);
|
|
14516
14521
|
const cloneValue = cloneObject(value);
|
|
14517
|
-
set(_formValues,
|
|
14522
|
+
set(_formValues, name, cloneValue);
|
|
14518
14523
|
if (isFieldArray) {
|
|
14519
14524
|
_subjects.array.next({
|
|
14520
|
-
name
|
|
14525
|
+
name,
|
|
14521
14526
|
values: cloneObject(_formValues)
|
|
14522
14527
|
});
|
|
14523
14528
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
14524
14529
|
_subjects.state.next({
|
|
14525
|
-
name
|
|
14530
|
+
name,
|
|
14526
14531
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
14527
|
-
isDirty: _getDirty(
|
|
14532
|
+
isDirty: _getDirty(name, cloneValue)
|
|
14528
14533
|
});
|
|
14529
14534
|
}
|
|
14530
14535
|
} else {
|
|
14531
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
14536
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
14532
14537
|
}
|
|
14533
|
-
isWatched(
|
|
14538
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
14534
14539
|
_subjects.state.next({
|
|
14535
|
-
name: _state.mount ?
|
|
14540
|
+
name: _state.mount ? name : void 0,
|
|
14536
14541
|
values: cloneObject(_formValues)
|
|
14537
14542
|
});
|
|
14538
14543
|
};
|
|
14539
14544
|
const onChange2 = async (event) => {
|
|
14540
14545
|
_state.mount = true;
|
|
14541
14546
|
const target = event.target;
|
|
14542
|
-
let
|
|
14547
|
+
let name = target.name;
|
|
14543
14548
|
let isFieldValueUpdated = true;
|
|
14544
|
-
const field = get2(_fields,
|
|
14549
|
+
const field = get2(_fields, name);
|
|
14545
14550
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
14546
|
-
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));
|
|
14547
14552
|
};
|
|
14548
14553
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
14549
14554
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -14552,9 +14557,9 @@ function createFormControl(props = {}) {
|
|
|
14552
14557
|
let isValid3;
|
|
14553
14558
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
14554
14559
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
14555
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
14556
|
-
const watched = isWatched(
|
|
14557
|
-
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);
|
|
14558
14563
|
if (isBlurEvent) {
|
|
14559
14564
|
if (!target || !target.readOnly) {
|
|
14560
14565
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -14563,10 +14568,10 @@ function createFormControl(props = {}) {
|
|
|
14563
14568
|
} else if (field._f.onChange) {
|
|
14564
14569
|
field._f.onChange(event);
|
|
14565
14570
|
}
|
|
14566
|
-
const fieldState = updateTouchAndDirty(
|
|
14571
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
14567
14572
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
14568
14573
|
!isBlurEvent && _subjects.state.next({
|
|
14569
|
-
name
|
|
14574
|
+
name,
|
|
14570
14575
|
type: event.type,
|
|
14571
14576
|
values: cloneObject(_formValues)
|
|
14572
14577
|
});
|
|
@@ -14580,23 +14585,23 @@ function createFormControl(props = {}) {
|
|
|
14580
14585
|
_setValid();
|
|
14581
14586
|
}
|
|
14582
14587
|
}
|
|
14583
|
-
return shouldRender && _subjects.state.next({ name
|
|
14588
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
14584
14589
|
}
|
|
14585
14590
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
14586
14591
|
if (_options.resolver) {
|
|
14587
|
-
const { errors } = await _runSchema([
|
|
14592
|
+
const { errors } = await _runSchema([name]);
|
|
14588
14593
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14589
14594
|
if (isFieldValueUpdated) {
|
|
14590
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
14591
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
14595
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
14596
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
14592
14597
|
error2 = errorLookupResult.error;
|
|
14593
|
-
|
|
14598
|
+
name = errorLookupResult.name;
|
|
14594
14599
|
isValid3 = isEmptyObject(errors);
|
|
14595
14600
|
}
|
|
14596
14601
|
} else {
|
|
14597
|
-
_updateIsValidating([
|
|
14598
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
14599
|
-
_updateIsValidating([
|
|
14602
|
+
_updateIsValidating([name], true);
|
|
14603
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
14604
|
+
_updateIsValidating([name]);
|
|
14600
14605
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14601
14606
|
if (isFieldValueUpdated) {
|
|
14602
14607
|
if (error2) {
|
|
@@ -14608,7 +14613,7 @@ function createFormControl(props = {}) {
|
|
|
14608
14613
|
}
|
|
14609
14614
|
if (isFieldValueUpdated) {
|
|
14610
14615
|
field._f.deps && trigger(field._f.deps);
|
|
14611
|
-
shouldRenderByError(
|
|
14616
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
14612
14617
|
}
|
|
14613
14618
|
}
|
|
14614
14619
|
};
|
|
@@ -14619,15 +14624,15 @@ function createFormControl(props = {}) {
|
|
|
14619
14624
|
}
|
|
14620
14625
|
return;
|
|
14621
14626
|
};
|
|
14622
|
-
const trigger = async (
|
|
14627
|
+
const trigger = async (name, options2 = {}) => {
|
|
14623
14628
|
let isValid3;
|
|
14624
14629
|
let validationResult;
|
|
14625
|
-
const fieldNames = convertToArrayPayload(
|
|
14630
|
+
const fieldNames = convertToArrayPayload(name);
|
|
14626
14631
|
if (_options.resolver) {
|
|
14627
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
14632
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
14628
14633
|
isValid3 = isEmptyObject(errors);
|
|
14629
|
-
validationResult =
|
|
14630
|
-
} else if (
|
|
14634
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
14635
|
+
} else if (name) {
|
|
14631
14636
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
14632
14637
|
const field = get2(_fields, fieldName);
|
|
14633
14638
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -14637,51 +14642,51 @@ function createFormControl(props = {}) {
|
|
|
14637
14642
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
14638
14643
|
}
|
|
14639
14644
|
_subjects.state.next({
|
|
14640
|
-
...!isString3(
|
|
14641
|
-
..._options.resolver || !
|
|
14645
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
14646
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
14642
14647
|
errors: _formState.errors
|
|
14643
14648
|
});
|
|
14644
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
14649
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
14645
14650
|
return validationResult;
|
|
14646
14651
|
};
|
|
14647
14652
|
const getValues = (fieldNames) => {
|
|
14648
14653
|
const values = {
|
|
14649
14654
|
..._state.mount ? _formValues : _defaultValues
|
|
14650
14655
|
};
|
|
14651
|
-
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));
|
|
14652
14657
|
};
|
|
14653
|
-
const getFieldState = (
|
|
14654
|
-
invalid: !!get2((formState || _formState).errors,
|
|
14655
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
14656
|
-
error: get2((formState || _formState).errors,
|
|
14657
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
14658
|
-
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)
|
|
14659
14664
|
});
|
|
14660
|
-
const clearErrors = (
|
|
14661
|
-
|
|
14665
|
+
const clearErrors = (name) => {
|
|
14666
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
14662
14667
|
_subjects.state.next({
|
|
14663
|
-
errors:
|
|
14668
|
+
errors: name ? _formState.errors : {}
|
|
14664
14669
|
});
|
|
14665
14670
|
};
|
|
14666
|
-
const setError = (
|
|
14667
|
-
const ref = (get2(_fields,
|
|
14668
|
-
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) || {};
|
|
14669
14674
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
14670
|
-
set(_formState.errors,
|
|
14675
|
+
set(_formState.errors, name, {
|
|
14671
14676
|
...restOfErrorTree,
|
|
14672
14677
|
...error2,
|
|
14673
14678
|
ref
|
|
14674
14679
|
});
|
|
14675
14680
|
_subjects.state.next({
|
|
14676
|
-
name
|
|
14681
|
+
name,
|
|
14677
14682
|
errors: _formState.errors,
|
|
14678
14683
|
isValid: false
|
|
14679
14684
|
});
|
|
14680
14685
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
14681
14686
|
};
|
|
14682
|
-
const watch = (
|
|
14683
|
-
next: (payload) => "values" in payload &&
|
|
14684
|
-
}) : _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);
|
|
14685
14690
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
14686
14691
|
next: (formState) => {
|
|
14687
14692
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -14705,8 +14710,8 @@ function createFormControl(props = {}) {
|
|
|
14705
14710
|
formState: _proxySubscribeFormState
|
|
14706
14711
|
});
|
|
14707
14712
|
};
|
|
14708
|
-
const unregister = (
|
|
14709
|
-
for (const fieldName of
|
|
14713
|
+
const unregister = (name, options2 = {}) => {
|
|
14714
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
14710
14715
|
_names.mount.delete(fieldName);
|
|
14711
14716
|
_names.array.delete(fieldName);
|
|
14712
14717
|
if (!options2.keepValue) {
|
|
@@ -14728,31 +14733,31 @@ function createFormControl(props = {}) {
|
|
|
14728
14733
|
});
|
|
14729
14734
|
!options2.keepIsValid && _setValid();
|
|
14730
14735
|
};
|
|
14731
|
-
const _setDisabledField = ({ disabled, name
|
|
14732
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
14733
|
-
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);
|
|
14734
14739
|
}
|
|
14735
14740
|
};
|
|
14736
|
-
const register = (
|
|
14737
|
-
let field = get2(_fields,
|
|
14741
|
+
const register = (name, options2 = {}) => {
|
|
14742
|
+
let field = get2(_fields, name);
|
|
14738
14743
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
14739
|
-
set(_fields,
|
|
14744
|
+
set(_fields, name, {
|
|
14740
14745
|
...field || {},
|
|
14741
14746
|
_f: {
|
|
14742
|
-
...field && field._f ? field._f : { ref: { name
|
|
14743
|
-
name
|
|
14747
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
14748
|
+
name,
|
|
14744
14749
|
mount: true,
|
|
14745
14750
|
...options2
|
|
14746
14751
|
}
|
|
14747
14752
|
});
|
|
14748
|
-
_names.mount.add(
|
|
14753
|
+
_names.mount.add(name);
|
|
14749
14754
|
if (field) {
|
|
14750
14755
|
_setDisabledField({
|
|
14751
14756
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
14752
|
-
name
|
|
14757
|
+
name
|
|
14753
14758
|
});
|
|
14754
14759
|
} else {
|
|
14755
|
-
updateValidAndValue(
|
|
14760
|
+
updateValidAndValue(name, true, options2.value);
|
|
14756
14761
|
}
|
|
14757
14762
|
return {
|
|
14758
14763
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -14764,39 +14769,39 @@ function createFormControl(props = {}) {
|
|
|
14764
14769
|
maxLength: getRuleValue(options2.maxLength),
|
|
14765
14770
|
pattern: getRuleValue(options2.pattern)
|
|
14766
14771
|
} : {},
|
|
14767
|
-
name
|
|
14772
|
+
name,
|
|
14768
14773
|
onChange: onChange2,
|
|
14769
14774
|
onBlur: onChange2,
|
|
14770
14775
|
ref: (ref) => {
|
|
14771
14776
|
if (ref) {
|
|
14772
|
-
register(
|
|
14773
|
-
field = get2(_fields,
|
|
14777
|
+
register(name, options2);
|
|
14778
|
+
field = get2(_fields, name);
|
|
14774
14779
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
14775
14780
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
14776
14781
|
const refs = field._f.refs || [];
|
|
14777
14782
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
14778
14783
|
return;
|
|
14779
14784
|
}
|
|
14780
|
-
set(_fields,
|
|
14785
|
+
set(_fields, name, {
|
|
14781
14786
|
_f: {
|
|
14782
14787
|
...field._f,
|
|
14783
14788
|
...radioOrCheckbox ? {
|
|
14784
14789
|
refs: [
|
|
14785
14790
|
...refs.filter(live),
|
|
14786
14791
|
fieldRef,
|
|
14787
|
-
...Array.isArray(get2(_defaultValues,
|
|
14792
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
14788
14793
|
],
|
|
14789
|
-
ref: { type: fieldRef.type, name
|
|
14794
|
+
ref: { type: fieldRef.type, name }
|
|
14790
14795
|
} : { ref: fieldRef }
|
|
14791
14796
|
}
|
|
14792
14797
|
});
|
|
14793
|
-
updateValidAndValue(
|
|
14798
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
14794
14799
|
} else {
|
|
14795
|
-
field = get2(_fields,
|
|
14800
|
+
field = get2(_fields, name, {});
|
|
14796
14801
|
if (field._f) {
|
|
14797
14802
|
field._f.mount = false;
|
|
14798
14803
|
}
|
|
14799
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
14804
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
14800
14805
|
}
|
|
14801
14806
|
}
|
|
14802
14807
|
};
|
|
@@ -14805,8 +14810,8 @@ function createFormControl(props = {}) {
|
|
|
14805
14810
|
const _disableForm = (disabled) => {
|
|
14806
14811
|
if (isBoolean(disabled)) {
|
|
14807
14812
|
_subjects.state.next({ disabled });
|
|
14808
|
-
iterateFieldsByAction(_fields, (ref,
|
|
14809
|
-
const currentField = get2(_fields,
|
|
14813
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
14814
|
+
const currentField = get2(_fields, name);
|
|
14810
14815
|
if (currentField) {
|
|
14811
14816
|
ref.disabled = currentField._f.disabled || disabled;
|
|
14812
14817
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -14836,8 +14841,8 @@ function createFormControl(props = {}) {
|
|
|
14836
14841
|
await executeBuiltInValidation(_fields);
|
|
14837
14842
|
}
|
|
14838
14843
|
if (_names.disabled.size) {
|
|
14839
|
-
for (const
|
|
14840
|
-
unset(fieldValues,
|
|
14844
|
+
for (const name of _names.disabled) {
|
|
14845
|
+
unset(fieldValues, name);
|
|
14841
14846
|
}
|
|
14842
14847
|
}
|
|
14843
14848
|
unset(_formState.errors, "root");
|
|
@@ -14868,23 +14873,23 @@ function createFormControl(props = {}) {
|
|
|
14868
14873
|
throw onValidError;
|
|
14869
14874
|
}
|
|
14870
14875
|
};
|
|
14871
|
-
const resetField = (
|
|
14872
|
-
if (get2(_fields,
|
|
14876
|
+
const resetField = (name, options2 = {}) => {
|
|
14877
|
+
if (get2(_fields, name)) {
|
|
14873
14878
|
if (isUndefined(options2.defaultValue)) {
|
|
14874
|
-
setValue(
|
|
14879
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
14875
14880
|
} else {
|
|
14876
|
-
setValue(
|
|
14877
|
-
set(_defaultValues,
|
|
14881
|
+
setValue(name, options2.defaultValue);
|
|
14882
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
14878
14883
|
}
|
|
14879
14884
|
if (!options2.keepTouched) {
|
|
14880
|
-
unset(_formState.touchedFields,
|
|
14885
|
+
unset(_formState.touchedFields, name);
|
|
14881
14886
|
}
|
|
14882
14887
|
if (!options2.keepDirty) {
|
|
14883
|
-
unset(_formState.dirtyFields,
|
|
14884
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
14888
|
+
unset(_formState.dirtyFields, name);
|
|
14889
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
14885
14890
|
}
|
|
14886
14891
|
if (!options2.keepError) {
|
|
14887
|
-
unset(_formState.errors,
|
|
14892
|
+
unset(_formState.errors, name);
|
|
14888
14893
|
_proxyFormState.isValid && _setValid();
|
|
14889
14894
|
}
|
|
14890
14895
|
_subjects.state.next({ ..._formState });
|
|
@@ -14909,8 +14914,8 @@ function createFormControl(props = {}) {
|
|
|
14909
14914
|
}
|
|
14910
14915
|
} else {
|
|
14911
14916
|
if (isWeb && isUndefined(formValues)) {
|
|
14912
|
-
for (const
|
|
14913
|
-
const field = get2(_fields,
|
|
14917
|
+
for (const name of _names.mount) {
|
|
14918
|
+
const field = get2(_fields, name);
|
|
14914
14919
|
if (field && field._f) {
|
|
14915
14920
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
14916
14921
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -14963,8 +14968,8 @@ function createFormControl(props = {}) {
|
|
|
14963
14968
|
});
|
|
14964
14969
|
};
|
|
14965
14970
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
14966
|
-
const setFocus = (
|
|
14967
|
-
const field = get2(_fields,
|
|
14971
|
+
const setFocus = (name, options2 = {}) => {
|
|
14972
|
+
const field = get2(_fields, name);
|
|
14968
14973
|
const fieldReference = field && field._f;
|
|
14969
14974
|
if (fieldReference) {
|
|
14970
14975
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -15280,7 +15285,7 @@ function TextInput(props) {
|
|
|
15280
15285
|
inputWrapperClassName,
|
|
15281
15286
|
label,
|
|
15282
15287
|
placeholder,
|
|
15283
|
-
name
|
|
15288
|
+
name,
|
|
15284
15289
|
type = "text",
|
|
15285
15290
|
register,
|
|
15286
15291
|
errors,
|
|
@@ -15303,7 +15308,7 @@ function TextInput(props) {
|
|
|
15303
15308
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
15304
15309
|
placeholder,
|
|
15305
15310
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
15306
|
-
...register(
|
|
15311
|
+
...register(name)
|
|
15307
15312
|
}
|
|
15308
15313
|
),
|
|
15309
15314
|
type === "password" && /* @__PURE__ */ jsx55(
|
|
@@ -15317,11 +15322,11 @@ function TextInput(props) {
|
|
|
15317
15322
|
]
|
|
15318
15323
|
}
|
|
15319
15324
|
),
|
|
15320
|
-
errors?.[
|
|
15325
|
+
errors?.[name]?.message && /* @__PURE__ */ jsx55(
|
|
15321
15326
|
"p",
|
|
15322
15327
|
{
|
|
15323
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
15324
|
-
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
|
|
15325
15330
|
}
|
|
15326
15331
|
)
|
|
15327
15332
|
] });
|
|
@@ -16083,7 +16088,7 @@ var ModalLayer = ({
|
|
|
16083
16088
|
// src/widgets/common/modal-confirm.tsx
|
|
16084
16089
|
import { jsx as jsx68, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
16085
16090
|
var ModalConfirm = ({
|
|
16086
|
-
name
|
|
16091
|
+
name,
|
|
16087
16092
|
isShowModal,
|
|
16088
16093
|
onClick,
|
|
16089
16094
|
onClose,
|
|
@@ -16092,8 +16097,8 @@ var ModalConfirm = ({
|
|
|
16092
16097
|
isLoading
|
|
16093
16098
|
}) => {
|
|
16094
16099
|
const { t: t3 } = useI18n();
|
|
16095
|
-
const renderButtonAction = (
|
|
16096
|
-
switch (
|
|
16100
|
+
const renderButtonAction = (name2) => {
|
|
16101
|
+
switch (name2) {
|
|
16097
16102
|
case "duplicate":
|
|
16098
16103
|
return /* @__PURE__ */ jsxs43(
|
|
16099
16104
|
"button",
|
|
@@ -16169,7 +16174,7 @@ var ModalConfirm = ({
|
|
|
16169
16174
|
children: t3("cancel")
|
|
16170
16175
|
}
|
|
16171
16176
|
),
|
|
16172
|
-
renderButtonAction(
|
|
16177
|
+
renderButtonAction(name)
|
|
16173
16178
|
] })
|
|
16174
16179
|
] }) });
|
|
16175
16180
|
};
|
|
@@ -16718,7 +16723,7 @@ import { useEffect as useEffect10, useState as useState10 } from "react";
|
|
|
16718
16723
|
import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
16719
16724
|
var BinaryField = (props) => {
|
|
16720
16725
|
const {
|
|
16721
|
-
name
|
|
16726
|
+
name,
|
|
16722
16727
|
methods,
|
|
16723
16728
|
readonly = false,
|
|
16724
16729
|
placeholder,
|
|
@@ -16757,7 +16762,7 @@ var BinaryField = (props) => {
|
|
|
16757
16762
|
try {
|
|
16758
16763
|
let type = "application/octet-stream";
|
|
16759
16764
|
let size4 = 0;
|
|
16760
|
-
let
|
|
16765
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16761
16766
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16762
16767
|
type = "image/*";
|
|
16763
16768
|
} else {
|
|
@@ -16770,7 +16775,7 @@ var BinaryField = (props) => {
|
|
|
16770
16775
|
}
|
|
16771
16776
|
}
|
|
16772
16777
|
setFileInfo({
|
|
16773
|
-
name:
|
|
16778
|
+
name: name2,
|
|
16774
16779
|
type,
|
|
16775
16780
|
url: initialFile,
|
|
16776
16781
|
size: size4,
|
|
@@ -16806,13 +16811,13 @@ var BinaryField = (props) => {
|
|
|
16806
16811
|
};
|
|
16807
16812
|
const renderPreview = (file) => {
|
|
16808
16813
|
if (!file) return /* @__PURE__ */ jsx75(PlaceHolderIcon, {});
|
|
16809
|
-
const { name:
|
|
16814
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16810
16815
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16811
16816
|
return /* @__PURE__ */ jsx75(
|
|
16812
16817
|
"img",
|
|
16813
16818
|
{
|
|
16814
16819
|
src: url,
|
|
16815
|
-
alt:
|
|
16820
|
+
alt: name2,
|
|
16816
16821
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16817
16822
|
style: {
|
|
16818
16823
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16852,7 +16857,7 @@ var BinaryField = (props) => {
|
|
|
16852
16857
|
maxWidth: "120px"
|
|
16853
16858
|
},
|
|
16854
16859
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16855
|
-
children:
|
|
16860
|
+
children: name2
|
|
16856
16861
|
}
|
|
16857
16862
|
),
|
|
16858
16863
|
isShowSize && /* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16862,7 +16867,7 @@ var BinaryField = (props) => {
|
|
|
16862
16867
|
return /* @__PURE__ */ jsx75(
|
|
16863
16868
|
Controller,
|
|
16864
16869
|
{
|
|
16865
|
-
name:
|
|
16870
|
+
name: name ?? "",
|
|
16866
16871
|
control: methods?.control,
|
|
16867
16872
|
rules: {
|
|
16868
16873
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17155,7 +17160,7 @@ import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-
|
|
|
17155
17160
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
17156
17161
|
var CharField = (props) => {
|
|
17157
17162
|
const {
|
|
17158
|
-
name
|
|
17163
|
+
name,
|
|
17159
17164
|
readonly,
|
|
17160
17165
|
placeholder,
|
|
17161
17166
|
required,
|
|
@@ -17186,7 +17191,7 @@ var CharField = (props) => {
|
|
|
17186
17191
|
return /* @__PURE__ */ jsx78(
|
|
17187
17192
|
Controller,
|
|
17188
17193
|
{
|
|
17189
|
-
name:
|
|
17194
|
+
name: name ?? "",
|
|
17190
17195
|
control: methods.control,
|
|
17191
17196
|
rules: {
|
|
17192
17197
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -17213,15 +17218,15 @@ var CharField = (props) => {
|
|
|
17213
17218
|
const { setError, clearErrors } = methods;
|
|
17214
17219
|
useEffect11(() => {
|
|
17215
17220
|
if (value2) {
|
|
17216
|
-
clearErrors(
|
|
17221
|
+
clearErrors(name);
|
|
17217
17222
|
}
|
|
17218
|
-
}, [value2, clearErrors,
|
|
17223
|
+
}, [value2, clearErrors, name]);
|
|
17219
17224
|
useEffect11(() => {
|
|
17220
17225
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
17221
17226
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
17222
|
-
const currentValue = methods?.getValues(
|
|
17227
|
+
const currentValue = methods?.getValues(name);
|
|
17223
17228
|
if (currentValue !== depValue) {
|
|
17224
|
-
methods?.setValue(
|
|
17229
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
17225
17230
|
}
|
|
17226
17231
|
}, [widget, formValues]);
|
|
17227
17232
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -17246,14 +17251,14 @@ var CharField = (props) => {
|
|
|
17246
17251
|
const inputValue = e3.target.value;
|
|
17247
17252
|
if (readonly) return;
|
|
17248
17253
|
fieldOnchange(inputValue);
|
|
17249
|
-
clearErrors(
|
|
17254
|
+
clearErrors(name);
|
|
17250
17255
|
},
|
|
17251
17256
|
onBlur: (e3) => {
|
|
17252
17257
|
if (readonly) return;
|
|
17253
17258
|
const inputValue = e3.target.value || "";
|
|
17254
17259
|
if (widget === "custom_passord") {
|
|
17255
17260
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
17256
|
-
setError(
|
|
17261
|
+
setError(name, {
|
|
17257
17262
|
type: "pattern",
|
|
17258
17263
|
message: getPasswordMessage(
|
|
17259
17264
|
min3,
|
|
@@ -17268,7 +17273,7 @@ var CharField = (props) => {
|
|
|
17268
17273
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
17269
17274
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
17270
17275
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
17271
|
-
setError(
|
|
17276
|
+
setError(name, {
|
|
17272
17277
|
type: "pattern",
|
|
17273
17278
|
message: t3(
|
|
17274
17279
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -17278,14 +17283,14 @@ var CharField = (props) => {
|
|
|
17278
17283
|
}
|
|
17279
17284
|
}
|
|
17280
17285
|
fieldOnchange(inputValue);
|
|
17281
|
-
onChange2 && onChange2(
|
|
17286
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
17282
17287
|
if (!inputValue && required && !invisible) {
|
|
17283
|
-
setError(
|
|
17288
|
+
setError(name, {
|
|
17284
17289
|
type: "required",
|
|
17285
17290
|
message: `${string} ${t3("must_required")}`
|
|
17286
17291
|
});
|
|
17287
17292
|
} else {
|
|
17288
|
-
clearErrors(
|
|
17293
|
+
clearErrors(name);
|
|
17289
17294
|
}
|
|
17290
17295
|
},
|
|
17291
17296
|
readOnly: readonly,
|
|
@@ -17339,14 +17344,14 @@ function EyeIconComponent({ open }) {
|
|
|
17339
17344
|
}
|
|
17340
17345
|
var SecureField = (props) => {
|
|
17341
17346
|
const {
|
|
17342
|
-
name
|
|
17347
|
+
name,
|
|
17343
17348
|
readonly,
|
|
17344
17349
|
placeholder,
|
|
17345
17350
|
required,
|
|
17346
17351
|
invisible,
|
|
17347
17352
|
methods,
|
|
17348
17353
|
onChange: onChange2,
|
|
17349
|
-
string =
|
|
17354
|
+
string = name,
|
|
17350
17355
|
widget,
|
|
17351
17356
|
min: min3,
|
|
17352
17357
|
max: max3,
|
|
@@ -17376,7 +17381,7 @@ var SecureField = (props) => {
|
|
|
17376
17381
|
return /* @__PURE__ */ jsx80(
|
|
17377
17382
|
Controller,
|
|
17378
17383
|
{
|
|
17379
|
-
name: String(
|
|
17384
|
+
name: String(name),
|
|
17380
17385
|
control: methods.control,
|
|
17381
17386
|
rules: {
|
|
17382
17387
|
...required && !invisible ? {
|
|
@@ -17410,8 +17415,8 @@ var SecureField = (props) => {
|
|
|
17410
17415
|
if (canToggle) setShowPlain(false);
|
|
17411
17416
|
}, [canToggle]);
|
|
17412
17417
|
useEffect12(() => {
|
|
17413
|
-
if (value2) clearErrors(
|
|
17414
|
-
}, [value2, clearErrors,
|
|
17418
|
+
if (value2) clearErrors(name);
|
|
17419
|
+
}, [value2, clearErrors, name]);
|
|
17415
17420
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
17416
17421
|
isCappedToken && shouldMask && /* @__PURE__ */ jsx80(
|
|
17417
17422
|
"div",
|
|
@@ -17429,20 +17434,20 @@ var SecureField = (props) => {
|
|
|
17429
17434
|
if (readonly) return;
|
|
17430
17435
|
const inputValue = e3.target.value ?? "";
|
|
17431
17436
|
fieldOnchange(inputValue);
|
|
17432
|
-
clearErrors(
|
|
17437
|
+
clearErrors(name);
|
|
17433
17438
|
},
|
|
17434
17439
|
onBlur: (e3) => {
|
|
17435
17440
|
if (readonly) return;
|
|
17436
17441
|
const inputValue = (e3.target.value ?? "").trim();
|
|
17437
17442
|
if (!inputValue && required && !invisible) {
|
|
17438
|
-
setError(
|
|
17443
|
+
setError(name, {
|
|
17439
17444
|
type: "required",
|
|
17440
17445
|
message: `${string} ${t3("must_required")}`
|
|
17441
17446
|
});
|
|
17442
17447
|
return;
|
|
17443
17448
|
}
|
|
17444
17449
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
17445
|
-
setError(
|
|
17450
|
+
setError(name, {
|
|
17446
17451
|
type: "pattern",
|
|
17447
17452
|
message: getPasswordMessage2(
|
|
17448
17453
|
min3,
|
|
@@ -17455,8 +17460,8 @@ var SecureField = (props) => {
|
|
|
17455
17460
|
return;
|
|
17456
17461
|
}
|
|
17457
17462
|
fieldOnchange(inputValue);
|
|
17458
|
-
onChange2 && onChange2(String(
|
|
17459
|
-
clearErrors(
|
|
17463
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
17464
|
+
clearErrors(name);
|
|
17460
17465
|
},
|
|
17461
17466
|
readOnly: readonly,
|
|
17462
17467
|
disabled: readonly,
|
|
@@ -17500,7 +17505,7 @@ var SecureField = (props) => {
|
|
|
17500
17505
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
17501
17506
|
var CheckboxField = (props) => {
|
|
17502
17507
|
const {
|
|
17503
|
-
name
|
|
17508
|
+
name,
|
|
17504
17509
|
readonly = false,
|
|
17505
17510
|
required = false,
|
|
17506
17511
|
invisible = false,
|
|
@@ -17511,7 +17516,7 @@ var CheckboxField = (props) => {
|
|
|
17511
17516
|
isEditTable = false
|
|
17512
17517
|
} = props;
|
|
17513
17518
|
if (!isForm) {
|
|
17514
|
-
if (
|
|
17519
|
+
if (name === "is_active" || name === "active") {
|
|
17515
17520
|
return /* @__PURE__ */ jsx81(ActiveBadgeField, { type: value });
|
|
17516
17521
|
} else {
|
|
17517
17522
|
return /* @__PURE__ */ jsx81(
|
|
@@ -17528,7 +17533,7 @@ var CheckboxField = (props) => {
|
|
|
17528
17533
|
return /* @__PURE__ */ jsx81(
|
|
17529
17534
|
Controller,
|
|
17530
17535
|
{
|
|
17531
|
-
name:
|
|
17536
|
+
name: name ?? "",
|
|
17532
17537
|
control: methods?.control,
|
|
17533
17538
|
render: ({ field }) => /* @__PURE__ */ jsx81(
|
|
17534
17539
|
"div",
|
|
@@ -17537,10 +17542,10 @@ var CheckboxField = (props) => {
|
|
|
17537
17542
|
onClick: () => {
|
|
17538
17543
|
const checked = !field.value;
|
|
17539
17544
|
if (!isEditTable && readonly) return;
|
|
17540
|
-
methods.setValue(
|
|
17545
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17541
17546
|
field.onChange(checked);
|
|
17542
17547
|
if (onChange2) {
|
|
17543
|
-
onChange2(
|
|
17548
|
+
onChange2(name ?? "", checked);
|
|
17544
17549
|
}
|
|
17545
17550
|
},
|
|
17546
17551
|
children: /* @__PURE__ */ jsx81(
|
|
@@ -17550,10 +17555,10 @@ var CheckboxField = (props) => {
|
|
|
17550
17555
|
onChange: (e3) => {
|
|
17551
17556
|
const checked = e3.target.checked;
|
|
17552
17557
|
if (!isEditTable && readonly) return;
|
|
17553
|
-
methods.setValue(
|
|
17558
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17554
17559
|
field.onChange(checked);
|
|
17555
17560
|
if (onChange2) {
|
|
17556
|
-
onChange2(
|
|
17561
|
+
onChange2(name ?? "", checked);
|
|
17557
17562
|
}
|
|
17558
17563
|
},
|
|
17559
17564
|
type: "checkbox",
|
|
@@ -17647,19 +17652,19 @@ var ColorWrapper = (props) => {
|
|
|
17647
17652
|
// src/widgets/basic/color-field/color.tsx
|
|
17648
17653
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
17649
17654
|
var ColorField = (props) => {
|
|
17650
|
-
const { value, isForm, name
|
|
17655
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
17651
17656
|
if (!isForm) {
|
|
17652
17657
|
return /* @__PURE__ */ jsx83(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
17653
17658
|
}
|
|
17654
17659
|
return /* @__PURE__ */ jsx83(
|
|
17655
17660
|
Controller,
|
|
17656
17661
|
{
|
|
17657
|
-
name:
|
|
17662
|
+
name: name ?? "",
|
|
17658
17663
|
control: methods?.control,
|
|
17659
17664
|
render: ({ field }) => {
|
|
17660
17665
|
const handlePickColorChange = (color) => {
|
|
17661
17666
|
field.onChange(color?.id);
|
|
17662
|
-
onChange2 && onChange2(
|
|
17667
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
17663
17668
|
};
|
|
17664
17669
|
return /* @__PURE__ */ jsx83(
|
|
17665
17670
|
ColorWrapper,
|
|
@@ -17680,7 +17685,7 @@ import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
|
17680
17685
|
var CopyLinkButtonField = (props) => {
|
|
17681
17686
|
const {
|
|
17682
17687
|
isForm,
|
|
17683
|
-
name
|
|
17688
|
+
name,
|
|
17684
17689
|
methods,
|
|
17685
17690
|
onChange: onChange2,
|
|
17686
17691
|
readonly,
|
|
@@ -17702,7 +17707,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17702
17707
|
return /* @__PURE__ */ jsx84(
|
|
17703
17708
|
Controller,
|
|
17704
17709
|
{
|
|
17705
|
-
name:
|
|
17710
|
+
name: name ?? "",
|
|
17706
17711
|
control: methods.control,
|
|
17707
17712
|
rules: {
|
|
17708
17713
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17714,7 +17719,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17714
17719
|
const { setError, clearErrors } = methods;
|
|
17715
17720
|
useEffect14(() => {
|
|
17716
17721
|
if (value) {
|
|
17717
|
-
clearErrors(
|
|
17722
|
+
clearErrors(name);
|
|
17718
17723
|
}
|
|
17719
17724
|
}, [value]);
|
|
17720
17725
|
return /* @__PURE__ */ jsxs54("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17732,11 +17737,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17732
17737
|
if (readonly) return;
|
|
17733
17738
|
const newValue = e3.target.value || "";
|
|
17734
17739
|
fieldOnchange(newValue);
|
|
17735
|
-
onChange2 && onChange2(
|
|
17740
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17736
17741
|
if (e3.target.value) {
|
|
17737
|
-
clearErrors(
|
|
17742
|
+
clearErrors(name);
|
|
17738
17743
|
} else if (required && !invisible) {
|
|
17739
|
-
setError(
|
|
17744
|
+
setError(name, {
|
|
17740
17745
|
type: "required",
|
|
17741
17746
|
message: `${string} ${t3("must_required")}`
|
|
17742
17747
|
});
|
|
@@ -17746,9 +17751,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17746
17751
|
if (!readonly) {
|
|
17747
17752
|
fieldOnchange(e3.target.value);
|
|
17748
17753
|
if (e3.target.value) {
|
|
17749
|
-
clearErrors(
|
|
17754
|
+
clearErrors(name);
|
|
17750
17755
|
} else if (required && !invisible) {
|
|
17751
|
-
setError(
|
|
17756
|
+
setError(name, {
|
|
17752
17757
|
type: "required",
|
|
17753
17758
|
message: `${string} ${t3("must_required")}`
|
|
17754
17759
|
});
|
|
@@ -27612,23 +27617,23 @@ var createCache = function createCache2(options2) {
|
|
|
27612
27617
|
};
|
|
27613
27618
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
27614
27619
|
var getRules3 = function getRules4(selector, serialized) {
|
|
27615
|
-
var
|
|
27616
|
-
if (serverStylisCache[
|
|
27617
|
-
serverStylisCache[
|
|
27620
|
+
var name = serialized.name;
|
|
27621
|
+
if (serverStylisCache[name] === void 0) {
|
|
27622
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
27618
27623
|
}
|
|
27619
|
-
return serverStylisCache[
|
|
27624
|
+
return serverStylisCache[name];
|
|
27620
27625
|
};
|
|
27621
27626
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
27622
|
-
var
|
|
27627
|
+
var name = serialized.name;
|
|
27623
27628
|
var rules = getRules3(selector, serialized);
|
|
27624
27629
|
if (cache.compat === void 0) {
|
|
27625
27630
|
if (shouldCache) {
|
|
27626
|
-
cache.inserted[
|
|
27631
|
+
cache.inserted[name] = true;
|
|
27627
27632
|
}
|
|
27628
27633
|
return rules;
|
|
27629
27634
|
} else {
|
|
27630
27635
|
if (shouldCache) {
|
|
27631
|
-
cache.inserted[
|
|
27636
|
+
cache.inserted[name] = rules;
|
|
27632
27637
|
} else {
|
|
27633
27638
|
return rules;
|
|
27634
27639
|
}
|
|
@@ -27951,9 +27956,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
27951
27956
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
27952
27957
|
identifierName += "-" + match3[1];
|
|
27953
27958
|
}
|
|
27954
|
-
var
|
|
27959
|
+
var name = murmur2(styles) + identifierName;
|
|
27955
27960
|
return {
|
|
27956
|
-
name
|
|
27961
|
+
name,
|
|
27957
27962
|
styles,
|
|
27958
27963
|
next: cursor
|
|
27959
27964
|
};
|
|
@@ -28103,10 +28108,10 @@ function css() {
|
|
|
28103
28108
|
}
|
|
28104
28109
|
function keyframes() {
|
|
28105
28110
|
var insertable = css.apply(void 0, arguments);
|
|
28106
|
-
var
|
|
28111
|
+
var name = "animation-" + insertable.name;
|
|
28107
28112
|
return {
|
|
28108
|
-
name
|
|
28109
|
-
styles: "@keyframes " +
|
|
28113
|
+
name,
|
|
28114
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
28110
28115
|
anim: 1,
|
|
28111
28116
|
toString: function toString() {
|
|
28112
28117
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -28138,13 +28143,13 @@ var index3 = isClient3 ? useLayoutEffect4 : noop6;
|
|
|
28138
28143
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
28139
28144
|
var noop8 = function noop9() {
|
|
28140
28145
|
};
|
|
28141
|
-
function applyPrefixToName(prefix2,
|
|
28142
|
-
if (!
|
|
28146
|
+
function applyPrefixToName(prefix2, name) {
|
|
28147
|
+
if (!name) {
|
|
28143
28148
|
return prefix2;
|
|
28144
|
-
} else if (
|
|
28145
|
-
return prefix2 +
|
|
28149
|
+
} else if (name[0] === "-") {
|
|
28150
|
+
return prefix2 + name;
|
|
28146
28151
|
} else {
|
|
28147
|
-
return prefix2 + "__" +
|
|
28152
|
+
return prefix2 + "__" + name;
|
|
28148
28153
|
}
|
|
28149
28154
|
}
|
|
28150
28155
|
function classNames(prefix2, state) {
|
|
@@ -28188,11 +28193,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
28188
28193
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
28189
28194
|
return _objectSpread2({}, innerProps);
|
|
28190
28195
|
};
|
|
28191
|
-
var getStyleProps = function getStyleProps2(props,
|
|
28196
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
28192
28197
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
28193
28198
|
return {
|
|
28194
|
-
css: getStyles(
|
|
28195
|
-
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)
|
|
28196
28201
|
};
|
|
28197
28202
|
};
|
|
28198
28203
|
function isDocumentElement(el) {
|
|
@@ -29941,10 +29946,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
29941
29946
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
29942
29947
|
};
|
|
29943
29948
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
29944
|
-
var
|
|
29949
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
29945
29950
|
return jsx86("input", {
|
|
29946
29951
|
required: true,
|
|
29947
|
-
name
|
|
29952
|
+
name,
|
|
29948
29953
|
tabIndex: -1,
|
|
29949
29954
|
"aria-hidden": "true",
|
|
29950
29955
|
onFocus: onFocus2,
|
|
@@ -30270,8 +30275,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30270
30275
|
_this.focus = _this.focusInput;
|
|
30271
30276
|
_this.blur = _this.blurInput;
|
|
30272
30277
|
_this.onChange = function(newValue, actionMeta) {
|
|
30273
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
30274
|
-
actionMeta.name =
|
|
30278
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
30279
|
+
actionMeta.name = name;
|
|
30275
30280
|
_this.ariaOnChange(newValue, actionMeta);
|
|
30276
30281
|
onChange2(newValue, actionMeta);
|
|
30277
30282
|
};
|
|
@@ -30296,7 +30301,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30296
30301
|
});
|
|
30297
30302
|
};
|
|
30298
30303
|
_this.selectOption = function(newValue) {
|
|
30299
|
-
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;
|
|
30300
30305
|
var selectValue = _this.state.selectValue;
|
|
30301
30306
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
30302
30307
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -30315,7 +30320,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30315
30320
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
30316
30321
|
action: "select-option",
|
|
30317
30322
|
option: newValue,
|
|
30318
|
-
name
|
|
30323
|
+
name
|
|
30319
30324
|
});
|
|
30320
30325
|
return;
|
|
30321
30326
|
}
|
|
@@ -31369,22 +31374,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31369
31374
|
key: "renderFormField",
|
|
31370
31375
|
value: function renderFormField() {
|
|
31371
31376
|
var _this5 = this;
|
|
31372
|
-
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;
|
|
31373
31378
|
var selectValue = this.state.selectValue;
|
|
31374
31379
|
if (required && !this.hasValue() && !isDisabled) {
|
|
31375
31380
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
31376
|
-
name
|
|
31381
|
+
name,
|
|
31377
31382
|
onFocus: this.onValueInputFocus
|
|
31378
31383
|
});
|
|
31379
31384
|
}
|
|
31380
|
-
if (!
|
|
31385
|
+
if (!name || isDisabled) return;
|
|
31381
31386
|
if (isMulti) {
|
|
31382
31387
|
if (delimiter2) {
|
|
31383
31388
|
var value = selectValue.map(function(opt) {
|
|
31384
31389
|
return _this5.getOptionValue(opt);
|
|
31385
31390
|
}).join(delimiter2);
|
|
31386
31391
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31387
|
-
name
|
|
31392
|
+
name,
|
|
31388
31393
|
type: "hidden",
|
|
31389
31394
|
value
|
|
31390
31395
|
});
|
|
@@ -31392,12 +31397,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31392
31397
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
31393
31398
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31394
31399
|
key: "i-".concat(i3),
|
|
31395
|
-
name
|
|
31400
|
+
name,
|
|
31396
31401
|
type: "hidden",
|
|
31397
31402
|
value: _this5.getOptionValue(opt)
|
|
31398
31403
|
});
|
|
31399
31404
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
31400
|
-
name
|
|
31405
|
+
name,
|
|
31401
31406
|
type: "hidden",
|
|
31402
31407
|
value: ""
|
|
31403
31408
|
});
|
|
@@ -31406,7 +31411,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31406
31411
|
} else {
|
|
31407
31412
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
31408
31413
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31409
|
-
name
|
|
31414
|
+
name,
|
|
31410
31415
|
type: "hidden",
|
|
31411
31416
|
value: _value
|
|
31412
31417
|
});
|
|
@@ -31535,7 +31540,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
31535
31540
|
import { Fragment as Fragment24, jsx as jsx88, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
31536
31541
|
var DateField = (props) => {
|
|
31537
31542
|
const {
|
|
31538
|
-
name
|
|
31543
|
+
name,
|
|
31539
31544
|
value,
|
|
31540
31545
|
readonly,
|
|
31541
31546
|
placeholder = "DD/MM/YYYY",
|
|
@@ -31585,7 +31590,7 @@ var DateField = (props) => {
|
|
|
31585
31590
|
return /* @__PURE__ */ jsx88(
|
|
31586
31591
|
Controller,
|
|
31587
31592
|
{
|
|
31588
|
-
name:
|
|
31593
|
+
name: name || "",
|
|
31589
31594
|
control: methods?.control,
|
|
31590
31595
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
31591
31596
|
rules: {
|
|
@@ -31600,9 +31605,9 @@ var DateField = (props) => {
|
|
|
31600
31605
|
const { setError, clearErrors } = methods;
|
|
31601
31606
|
useEffect18(() => {
|
|
31602
31607
|
if (value) {
|
|
31603
|
-
clearErrors(
|
|
31608
|
+
clearErrors(name);
|
|
31604
31609
|
}
|
|
31605
|
-
}, [value, clearErrors,
|
|
31610
|
+
}, [value, clearErrors, name]);
|
|
31606
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;
|
|
31607
31612
|
return /* @__PURE__ */ jsxs56(Fragment24, { children: [
|
|
31608
31613
|
/* @__PURE__ */ jsx88(
|
|
@@ -31621,7 +31626,7 @@ var DateField = (props) => {
|
|
|
31621
31626
|
adjustedDate.toDate()
|
|
31622
31627
|
);
|
|
31623
31628
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
31624
|
-
setError(
|
|
31629
|
+
setError(name, {
|
|
31625
31630
|
type: "manual",
|
|
31626
31631
|
message: validateCustomResult
|
|
31627
31632
|
});
|
|
@@ -31629,20 +31634,20 @@ var DateField = (props) => {
|
|
|
31629
31634
|
}
|
|
31630
31635
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31631
31636
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
31632
|
-
handleOnchange && handleOnchange(
|
|
31633
|
-
clearErrors(
|
|
31637
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31638
|
+
clearErrors(name);
|
|
31634
31639
|
} else {
|
|
31635
31640
|
field.onChange(null);
|
|
31636
|
-
handleOnchange && handleOnchange(
|
|
31641
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
31637
31642
|
if (required && !invisible) {
|
|
31638
31643
|
if (!isEditTable) {
|
|
31639
|
-
setError(
|
|
31644
|
+
setError(name, {
|
|
31640
31645
|
type: "manual",
|
|
31641
31646
|
message: `${string} ${t3("must_required")}`
|
|
31642
31647
|
});
|
|
31643
31648
|
}
|
|
31644
31649
|
} else {
|
|
31645
|
-
clearErrors(
|
|
31650
|
+
clearErrors(name);
|
|
31646
31651
|
}
|
|
31647
31652
|
}
|
|
31648
31653
|
},
|
|
@@ -31663,7 +31668,7 @@ var DateField = (props) => {
|
|
|
31663
31668
|
}
|
|
31664
31669
|
),
|
|
31665
31670
|
timeInputLabel: textPlaceHolder,
|
|
31666
|
-
portalId:
|
|
31671
|
+
portalId: name,
|
|
31667
31672
|
renderCustomHeader: ({
|
|
31668
31673
|
date,
|
|
31669
31674
|
changeYear,
|
|
@@ -32002,7 +32007,7 @@ var RenderFile = ({
|
|
|
32002
32007
|
};
|
|
32003
32008
|
var FileUploadField = (props) => {
|
|
32004
32009
|
const {
|
|
32005
|
-
name
|
|
32010
|
+
name,
|
|
32006
32011
|
methods,
|
|
32007
32012
|
isForm,
|
|
32008
32013
|
model,
|
|
@@ -32033,7 +32038,7 @@ var FileUploadField = (props) => {
|
|
|
32033
32038
|
return /* @__PURE__ */ jsx93(
|
|
32034
32039
|
Controller,
|
|
32035
32040
|
{
|
|
32036
|
-
name:
|
|
32041
|
+
name: name || "",
|
|
32037
32042
|
control: methods?.control,
|
|
32038
32043
|
rules: {
|
|
32039
32044
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32099,7 +32104,7 @@ import { useEffect as useEffect20, useRef as useRef15, useState as useState19 }
|
|
|
32099
32104
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
32100
32105
|
var FloatField = (props) => {
|
|
32101
32106
|
const {
|
|
32102
|
-
name
|
|
32107
|
+
name,
|
|
32103
32108
|
value: propValue,
|
|
32104
32109
|
readonly,
|
|
32105
32110
|
placeholder,
|
|
@@ -32120,7 +32125,7 @@ var FloatField = (props) => {
|
|
|
32120
32125
|
return /* @__PURE__ */ jsx94(
|
|
32121
32126
|
Controller,
|
|
32122
32127
|
{
|
|
32123
|
-
name:
|
|
32128
|
+
name: name ?? "",
|
|
32124
32129
|
control: methods.control,
|
|
32125
32130
|
rules: {
|
|
32126
32131
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32138,14 +32143,14 @@ var FloatField = (props) => {
|
|
|
32138
32143
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
32139
32144
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
32140
32145
|
setInputValue(formatFloatNumber(propValue));
|
|
32141
|
-
clearErrors(
|
|
32146
|
+
clearErrors(name);
|
|
32142
32147
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
32143
32148
|
setInputValue(formatFloatNumber(value));
|
|
32144
|
-
clearErrors(
|
|
32149
|
+
clearErrors(name);
|
|
32145
32150
|
} else if (value === null || value === void 0) {
|
|
32146
32151
|
setInputValue("");
|
|
32147
32152
|
}
|
|
32148
|
-
}, [value,
|
|
32153
|
+
}, [value, name, clearErrors, propValue]);
|
|
32149
32154
|
const handleInputChange = (e3) => {
|
|
32150
32155
|
let newValue = e3.target.value;
|
|
32151
32156
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -32165,7 +32170,7 @@ var FloatField = (props) => {
|
|
|
32165
32170
|
);
|
|
32166
32171
|
if (!isNaN(parsedValue)) {
|
|
32167
32172
|
onChange2(parsedValue);
|
|
32168
|
-
clearErrors(
|
|
32173
|
+
clearErrors(name);
|
|
32169
32174
|
isDirtyRef.current = true;
|
|
32170
32175
|
} else {
|
|
32171
32176
|
onChange2(null);
|
|
@@ -32177,7 +32182,7 @@ var FloatField = (props) => {
|
|
|
32177
32182
|
const parsedValue = parseFloat(rawValue);
|
|
32178
32183
|
if (rawValue === "" || rawValue === ".") {
|
|
32179
32184
|
if (required) {
|
|
32180
|
-
setError(
|
|
32185
|
+
setError(name, {
|
|
32181
32186
|
type: "required",
|
|
32182
32187
|
message: `${string} ${t3("must_required")}`
|
|
32183
32188
|
});
|
|
@@ -32187,7 +32192,7 @@ var FloatField = (props) => {
|
|
|
32187
32192
|
lastCommittedValueRef.current = null;
|
|
32188
32193
|
} else if (!isNaN(parsedValue)) {
|
|
32189
32194
|
if (parsedValue < 0) {
|
|
32190
|
-
setError(
|
|
32195
|
+
setError(name, {
|
|
32191
32196
|
type: "validate",
|
|
32192
32197
|
message: t3("invalid_number")
|
|
32193
32198
|
});
|
|
@@ -32197,12 +32202,12 @@ var FloatField = (props) => {
|
|
|
32197
32202
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
32198
32203
|
setInputValue(formattedValue);
|
|
32199
32204
|
onChange2(parsedValue);
|
|
32200
|
-
handleOnchange?.(
|
|
32201
|
-
clearErrors(
|
|
32205
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
32206
|
+
clearErrors(name);
|
|
32202
32207
|
lastCommittedValueRef.current = parsedValue;
|
|
32203
32208
|
}
|
|
32204
32209
|
} else {
|
|
32205
|
-
setError(
|
|
32210
|
+
setError(name, {
|
|
32206
32211
|
type: "validate",
|
|
32207
32212
|
message: t3("invalid_number")
|
|
32208
32213
|
});
|
|
@@ -32241,7 +32246,7 @@ import { useState as useState20 } from "react";
|
|
|
32241
32246
|
import { Fragment as Fragment27, jsx as jsx95, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
32242
32247
|
var FloatTimeField = (props) => {
|
|
32243
32248
|
const {
|
|
32244
|
-
name
|
|
32249
|
+
name,
|
|
32245
32250
|
methods,
|
|
32246
32251
|
defaultValue = 0,
|
|
32247
32252
|
isForm = true,
|
|
@@ -32259,7 +32264,7 @@ var FloatTimeField = (props) => {
|
|
|
32259
32264
|
return /* @__PURE__ */ jsx95(
|
|
32260
32265
|
Controller,
|
|
32261
32266
|
{
|
|
32262
|
-
name:
|
|
32267
|
+
name: name ?? "",
|
|
32263
32268
|
control: methods?.control,
|
|
32264
32269
|
defaultValue,
|
|
32265
32270
|
rules: {
|
|
@@ -32306,13 +32311,13 @@ var FloatTimeField = (props) => {
|
|
|
32306
32311
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
32307
32312
|
fieldOnChange(floatVal);
|
|
32308
32313
|
if (onChange2) {
|
|
32309
|
-
onChange2(
|
|
32314
|
+
onChange2(name ?? "", floatVal);
|
|
32310
32315
|
}
|
|
32311
32316
|
} else {
|
|
32312
32317
|
setInput("00:00");
|
|
32313
32318
|
fieldOnChange(0);
|
|
32314
32319
|
if (onChange2) {
|
|
32315
|
-
onChange2(
|
|
32320
|
+
onChange2(name ?? "", 0);
|
|
32316
32321
|
}
|
|
32317
32322
|
setErrors("");
|
|
32318
32323
|
}
|
|
@@ -32363,7 +32368,7 @@ import { useEffect as useEffect21, useRef as useRef16 } from "react";
|
|
|
32363
32368
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
32364
32369
|
var HtmlField = (props) => {
|
|
32365
32370
|
const {
|
|
32366
|
-
name
|
|
32371
|
+
name,
|
|
32367
32372
|
methods,
|
|
32368
32373
|
readonly = false,
|
|
32369
32374
|
isForm = true,
|
|
@@ -32380,7 +32385,7 @@ var HtmlField = (props) => {
|
|
|
32380
32385
|
return /* @__PURE__ */ jsx96(
|
|
32381
32386
|
Controller,
|
|
32382
32387
|
{
|
|
32383
|
-
name:
|
|
32388
|
+
name: name ?? "",
|
|
32384
32389
|
control: methods?.control,
|
|
32385
32390
|
defaultValue,
|
|
32386
32391
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -32413,10 +32418,10 @@ var HtmlField = (props) => {
|
|
|
32413
32418
|
// src/widgets/basic/image-field/image.tsx
|
|
32414
32419
|
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
32415
32420
|
var ImageField = (props) => {
|
|
32416
|
-
const { value, type, name
|
|
32421
|
+
const { value, type, name, baseURL } = props;
|
|
32417
32422
|
if (!value) return null;
|
|
32418
32423
|
if (type === "url") {
|
|
32419
|
-
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 });
|
|
32420
32425
|
}
|
|
32421
32426
|
return /* @__PURE__ */ jsx97("div", { id: "qr-code", children: /* @__PURE__ */ jsx97("img", { src: `data:image/png;base64,${value}`, alt: "QR Code" }) });
|
|
32422
32427
|
};
|
|
@@ -32518,7 +32523,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32518
32523
|
const {
|
|
32519
32524
|
relation,
|
|
32520
32525
|
value,
|
|
32521
|
-
name
|
|
32526
|
+
name,
|
|
32522
32527
|
methods,
|
|
32523
32528
|
required,
|
|
32524
32529
|
invisible,
|
|
@@ -32559,7 +32564,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32559
32564
|
return /* @__PURE__ */ jsx99(
|
|
32560
32565
|
Controller,
|
|
32561
32566
|
{
|
|
32562
|
-
name:
|
|
32567
|
+
name: name ?? "",
|
|
32563
32568
|
control: methods.control,
|
|
32564
32569
|
rules: {
|
|
32565
32570
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32568,7 +32573,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32568
32573
|
const { clearErrors } = methods;
|
|
32569
32574
|
useEffect22(() => {
|
|
32570
32575
|
if (field.value) {
|
|
32571
|
-
clearErrors(
|
|
32576
|
+
clearErrors(name);
|
|
32572
32577
|
}
|
|
32573
32578
|
}, [field.value]);
|
|
32574
32579
|
const filteredValue = useMemo11(() => {
|
|
@@ -32588,12 +32593,12 @@ var Many2ManyTagField = (props) => {
|
|
|
32588
32593
|
}, [field?.value, options2]);
|
|
32589
32594
|
const handleChange = (selectedOptions) => {
|
|
32590
32595
|
const newValue = transfer(selectedOptions);
|
|
32591
|
-
methods?.setValue(
|
|
32592
|
-
onChange2?.(
|
|
32593
|
-
clearErrors(
|
|
32596
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
32597
|
+
onChange2?.(name ?? "", newValue);
|
|
32598
|
+
clearErrors(name);
|
|
32594
32599
|
newValue.forEach((item, index4) => {
|
|
32595
32600
|
Object.keys(item).forEach((key) => {
|
|
32596
|
-
methods.setValue(`${
|
|
32601
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
32597
32602
|
shouldDirty: true
|
|
32598
32603
|
});
|
|
32599
32604
|
});
|
|
@@ -32718,7 +32723,7 @@ import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx
|
|
|
32718
32723
|
var MonetaryField = (props) => {
|
|
32719
32724
|
const { t: t3 } = useI18n();
|
|
32720
32725
|
const {
|
|
32721
|
-
name
|
|
32726
|
+
name,
|
|
32722
32727
|
value,
|
|
32723
32728
|
readonly,
|
|
32724
32729
|
required,
|
|
@@ -32735,7 +32740,7 @@ var MonetaryField = (props) => {
|
|
|
32735
32740
|
symbol = "VND",
|
|
32736
32741
|
baseClassName
|
|
32737
32742
|
} = props;
|
|
32738
|
-
if (isForm &&
|
|
32743
|
+
if (isForm && name === "amount_residual") {
|
|
32739
32744
|
return /* @__PURE__ */ jsxs66("div", { className: "flex justify-end gap-x-4 gap-y-2 ml-auto mt-2 lg:mt-5", children: [
|
|
32740
32745
|
/* @__PURE__ */ jsxs66("span", { className: "font-semibold", children: [
|
|
32741
32746
|
string,
|
|
@@ -32752,7 +32757,7 @@ var MonetaryField = (props) => {
|
|
|
32752
32757
|
return /* @__PURE__ */ jsx100(
|
|
32753
32758
|
Controller,
|
|
32754
32759
|
{
|
|
32755
|
-
name:
|
|
32760
|
+
name: name ?? "",
|
|
32756
32761
|
control: methods.control,
|
|
32757
32762
|
rules: {
|
|
32758
32763
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32765,7 +32770,7 @@ var MonetaryField = (props) => {
|
|
|
32765
32770
|
const { setError, clearErrors } = methods;
|
|
32766
32771
|
useEffect23(() => {
|
|
32767
32772
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32768
|
-
clearErrors(
|
|
32773
|
+
clearErrors(name);
|
|
32769
32774
|
}
|
|
32770
32775
|
}, [value2]);
|
|
32771
32776
|
return /* @__PURE__ */ jsxs66(Fragment29, { children: [
|
|
@@ -32776,18 +32781,18 @@ var MonetaryField = (props) => {
|
|
|
32776
32781
|
onBlur: () => {
|
|
32777
32782
|
if (!readonly && !isNaN(value2)) {
|
|
32778
32783
|
onBlur();
|
|
32779
|
-
handleOnchange && handleOnchange(
|
|
32780
|
-
clearErrors(
|
|
32784
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32785
|
+
clearErrors(name);
|
|
32781
32786
|
}
|
|
32782
32787
|
},
|
|
32783
32788
|
onChange: (e3) => {
|
|
32784
32789
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32785
32790
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32786
32791
|
onChange2(parsedValue);
|
|
32787
|
-
clearErrors(
|
|
32792
|
+
clearErrors(name);
|
|
32788
32793
|
} else {
|
|
32789
32794
|
if (required) {
|
|
32790
|
-
setError(
|
|
32795
|
+
setError(name, {
|
|
32791
32796
|
type: "required",
|
|
32792
32797
|
message: `${string} ${t3("must_required")}`
|
|
32793
32798
|
});
|
|
@@ -32902,9 +32907,11 @@ var PriorityField = (props) => {
|
|
|
32902
32907
|
onChange: onChange2,
|
|
32903
32908
|
id,
|
|
32904
32909
|
viewData,
|
|
32905
|
-
model
|
|
32910
|
+
model,
|
|
32911
|
+
name,
|
|
32912
|
+
string
|
|
32906
32913
|
} = props;
|
|
32907
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
32914
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
32908
32915
|
const defaultPriority = parseInt(value) + 1;
|
|
32909
32916
|
if (!isForm) {
|
|
32910
32917
|
return /* @__PURE__ */ jsx103(
|
|
@@ -32948,7 +32955,7 @@ import { useEffect as useEffect25 } from "react";
|
|
|
32948
32955
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
32949
32956
|
var RadioGroupField = (props) => {
|
|
32950
32957
|
const {
|
|
32951
|
-
name
|
|
32958
|
+
name,
|
|
32952
32959
|
readonly,
|
|
32953
32960
|
required,
|
|
32954
32961
|
placeholder,
|
|
@@ -32960,14 +32967,14 @@ var RadioGroupField = (props) => {
|
|
|
32960
32967
|
} = props;
|
|
32961
32968
|
useEffect25(() => {
|
|
32962
32969
|
if (selection?.length > 0) {
|
|
32963
|
-
if (setValue) setValue(
|
|
32970
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32964
32971
|
}
|
|
32965
|
-
}, [selection,
|
|
32972
|
+
}, [selection, name, setValue]);
|
|
32966
32973
|
if (!methods) return null;
|
|
32967
32974
|
return /* @__PURE__ */ jsx104(
|
|
32968
32975
|
Controller,
|
|
32969
32976
|
{
|
|
32970
|
-
name:
|
|
32977
|
+
name: name ?? "",
|
|
32971
32978
|
control: methods.control,
|
|
32972
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: [
|
|
32973
32980
|
/* @__PURE__ */ jsx104(
|
|
@@ -32980,8 +32987,8 @@ var RadioGroupField = (props) => {
|
|
|
32980
32987
|
onChange: (e3) => {
|
|
32981
32988
|
if (readonly) return;
|
|
32982
32989
|
field.onChange(e3.target.value);
|
|
32983
|
-
methods.setValue(
|
|
32984
|
-
onChange2?.(
|
|
32990
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
32991
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
32985
32992
|
},
|
|
32986
32993
|
readOnly: readonly,
|
|
32987
32994
|
required: !invisible && required,
|
|
@@ -33033,7 +33040,7 @@ var SelectDropdownField = (props) => {
|
|
|
33033
33040
|
const { t: t3 } = useI18n();
|
|
33034
33041
|
const {
|
|
33035
33042
|
selection,
|
|
33036
|
-
name
|
|
33043
|
+
name,
|
|
33037
33044
|
methods,
|
|
33038
33045
|
value,
|
|
33039
33046
|
readonly,
|
|
@@ -33056,7 +33063,7 @@ var SelectDropdownField = (props) => {
|
|
|
33056
33063
|
return /* @__PURE__ */ jsx106(
|
|
33057
33064
|
Controller,
|
|
33058
33065
|
{
|
|
33059
|
-
name:
|
|
33066
|
+
name: name || "",
|
|
33060
33067
|
control: methods.control,
|
|
33061
33068
|
rules: {
|
|
33062
33069
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -33075,7 +33082,7 @@ var SelectDropdownField = (props) => {
|
|
|
33075
33082
|
menuPlacement: "auto",
|
|
33076
33083
|
onChange: (selectedOption) => {
|
|
33077
33084
|
field.onChange(selectedOption.value);
|
|
33078
|
-
onChange2 && onChange2(
|
|
33085
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
33079
33086
|
},
|
|
33080
33087
|
value: defaultValue || null,
|
|
33081
33088
|
required: !invisible && required
|
|
@@ -33156,7 +33163,7 @@ import { jsx as jsx107 } from "react/jsx-runtime";
|
|
|
33156
33163
|
var TextAreaField = (props) => {
|
|
33157
33164
|
const {
|
|
33158
33165
|
methods,
|
|
33159
|
-
name
|
|
33166
|
+
name,
|
|
33160
33167
|
readonly,
|
|
33161
33168
|
placeholder,
|
|
33162
33169
|
required,
|
|
@@ -33167,7 +33174,7 @@ var TextAreaField = (props) => {
|
|
|
33167
33174
|
onChange: onChange2,
|
|
33168
33175
|
baseClassName
|
|
33169
33176
|
} = props;
|
|
33170
|
-
const formProps = methods ? methods.register(
|
|
33177
|
+
const formProps = methods ? methods.register(name, {
|
|
33171
33178
|
onBlur: (e3) => {
|
|
33172
33179
|
const newValue = e3.target.value;
|
|
33173
33180
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -33189,7 +33196,7 @@ var TextAreaField = (props) => {
|
|
|
33189
33196
|
disabled: readonly,
|
|
33190
33197
|
placeholder,
|
|
33191
33198
|
required: !invisible && required,
|
|
33192
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
33199
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
33193
33200
|
}
|
|
33194
33201
|
);
|
|
33195
33202
|
};
|
|
@@ -33198,7 +33205,7 @@ var TextAreaField = (props) => {
|
|
|
33198
33205
|
import { jsx as jsx108, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
33199
33206
|
var ToggleButtonField = (props) => {
|
|
33200
33207
|
const {
|
|
33201
|
-
name
|
|
33208
|
+
name,
|
|
33202
33209
|
readonly = false,
|
|
33203
33210
|
required = false,
|
|
33204
33211
|
invisible = false,
|
|
@@ -33208,7 +33215,7 @@ var ToggleButtonField = (props) => {
|
|
|
33208
33215
|
return /* @__PURE__ */ jsx108(
|
|
33209
33216
|
Controller,
|
|
33210
33217
|
{
|
|
33211
|
-
name:
|
|
33218
|
+
name: name ?? "",
|
|
33212
33219
|
control: methods?.control,
|
|
33213
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: [
|
|
33214
33221
|
/* @__PURE__ */ jsx108(
|
|
@@ -33218,10 +33225,10 @@ var ToggleButtonField = (props) => {
|
|
|
33218
33225
|
type: "checkbox",
|
|
33219
33226
|
onChange: (e3) => {
|
|
33220
33227
|
if (readonly) return;
|
|
33221
|
-
methods.setValue(
|
|
33228
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
33222
33229
|
field.onChange(e3.target.checked);
|
|
33223
33230
|
if (onChange2) {
|
|
33224
|
-
onChange2(
|
|
33231
|
+
onChange2(name ?? "", e3.target.checked);
|
|
33225
33232
|
}
|
|
33226
33233
|
},
|
|
33227
33234
|
disabled: readonly,
|
|
@@ -33268,7 +33275,7 @@ import { useEffect as useEffect26, useRef as useRef17, useState as useState22 }
|
|
|
33268
33275
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
33269
33276
|
var IntegerField = (props) => {
|
|
33270
33277
|
const {
|
|
33271
|
-
name
|
|
33278
|
+
name,
|
|
33272
33279
|
value,
|
|
33273
33280
|
readonly,
|
|
33274
33281
|
placeholder,
|
|
@@ -33290,7 +33297,7 @@ var IntegerField = (props) => {
|
|
|
33290
33297
|
return /* @__PURE__ */ jsx109(
|
|
33291
33298
|
Controller,
|
|
33292
33299
|
{
|
|
33293
|
-
name:
|
|
33300
|
+
name: name || "",
|
|
33294
33301
|
control: methods.control,
|
|
33295
33302
|
rules: {
|
|
33296
33303
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -33310,12 +33317,12 @@ var IntegerField = (props) => {
|
|
|
33310
33317
|
useEffect26(() => {
|
|
33311
33318
|
if (value2 !== void 0 && value2 !== null) {
|
|
33312
33319
|
setInputValue(String(value2));
|
|
33313
|
-
clearErrors(
|
|
33320
|
+
clearErrors(name);
|
|
33314
33321
|
}
|
|
33315
33322
|
}, [value2]);
|
|
33316
33323
|
const noticeError = () => {
|
|
33317
33324
|
if (required) {
|
|
33318
|
-
setError(
|
|
33325
|
+
setError(name, {
|
|
33319
33326
|
type: "required",
|
|
33320
33327
|
message: `${string} ${t3("must_required")}`
|
|
33321
33328
|
});
|
|
@@ -33333,7 +33340,7 @@ var IntegerField = (props) => {
|
|
|
33333
33340
|
if (!isNaN(parsed)) {
|
|
33334
33341
|
fieldOnChange(parsed);
|
|
33335
33342
|
isDirtyRef.current = true;
|
|
33336
|
-
clearErrors(
|
|
33343
|
+
clearErrors(name);
|
|
33337
33344
|
} else {
|
|
33338
33345
|
noticeError();
|
|
33339
33346
|
}
|
|
@@ -33359,11 +33366,11 @@ var IntegerField = (props) => {
|
|
|
33359
33366
|
return;
|
|
33360
33367
|
}
|
|
33361
33368
|
fieldOnChange(parsed);
|
|
33362
|
-
onChange2?.(
|
|
33369
|
+
onChange2?.(name ?? "", parsed);
|
|
33363
33370
|
lastCommittedValueRef.current = parsed;
|
|
33364
33371
|
isDirtyRef.current = false;
|
|
33365
33372
|
inputRef.current?.blur();
|
|
33366
|
-
clearErrors(
|
|
33373
|
+
clearErrors(name);
|
|
33367
33374
|
};
|
|
33368
33375
|
return /* @__PURE__ */ jsxs72(Fragment31, { children: [
|
|
33369
33376
|
/* @__PURE__ */ jsx109(
|
|
@@ -33772,7 +33779,7 @@ var Many2OneField = (props) => {
|
|
|
33772
33779
|
isForm,
|
|
33773
33780
|
isEditTable,
|
|
33774
33781
|
value: propValue,
|
|
33775
|
-
name
|
|
33782
|
+
name,
|
|
33776
33783
|
readonly,
|
|
33777
33784
|
methods,
|
|
33778
33785
|
required,
|
|
@@ -33799,7 +33806,7 @@ var Many2OneField = (props) => {
|
|
|
33799
33806
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33800
33807
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33801
33808
|
allowShowDetail && renderDetail({
|
|
33802
|
-
idToolTip: String(
|
|
33809
|
+
idToolTip: String(name) + Number(index4),
|
|
33803
33810
|
model: options2?.model ?? relation,
|
|
33804
33811
|
context: contextObject,
|
|
33805
33812
|
idForm: id
|
|
@@ -33808,8 +33815,8 @@ var Many2OneField = (props) => {
|
|
|
33808
33815
|
"span",
|
|
33809
33816
|
{
|
|
33810
33817
|
className: "cursor-pointer",
|
|
33811
|
-
"data-tooltip-id": String(
|
|
33812
|
-
id:
|
|
33818
|
+
"data-tooltip-id": String(name) + index4,
|
|
33819
|
+
id: name,
|
|
33813
33820
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33814
33821
|
}
|
|
33815
33822
|
)
|
|
@@ -33817,21 +33824,21 @@ var Many2OneField = (props) => {
|
|
|
33817
33824
|
}
|
|
33818
33825
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33819
33826
|
allowShowDetail && renderDetail({
|
|
33820
|
-
idToolTip: String(
|
|
33827
|
+
idToolTip: String(name),
|
|
33821
33828
|
model: options2?.model ?? relation,
|
|
33822
33829
|
context: contextObject,
|
|
33823
|
-
idForm: methods?.getValues(
|
|
33830
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33824
33831
|
}),
|
|
33825
33832
|
/* @__PURE__ */ jsx112(
|
|
33826
33833
|
"div",
|
|
33827
33834
|
{
|
|
33828
|
-
id:
|
|
33829
|
-
"data-tooltip-id":
|
|
33835
|
+
id: name,
|
|
33836
|
+
"data-tooltip-id": name,
|
|
33830
33837
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33831
33838
|
children: /* @__PURE__ */ jsx112(
|
|
33832
33839
|
Controller,
|
|
33833
33840
|
{
|
|
33834
|
-
name:
|
|
33841
|
+
name: name ?? "",
|
|
33835
33842
|
control: methods?.control,
|
|
33836
33843
|
rules: {
|
|
33837
33844
|
required: required ? {
|
|
@@ -33852,7 +33859,7 @@ var Many2OneField = (props) => {
|
|
|
33852
33859
|
) ?? currentValue : currentValue ?? null;
|
|
33853
33860
|
useEffect28(() => {
|
|
33854
33861
|
if (error2 && selectedOption) {
|
|
33855
|
-
methods?.clearErrors(
|
|
33862
|
+
methods?.clearErrors(name);
|
|
33856
33863
|
}
|
|
33857
33864
|
}, [selectedOption]);
|
|
33858
33865
|
return /* @__PURE__ */ jsxs75(
|
|
@@ -34215,7 +34222,7 @@ var ICCheck = () => {
|
|
|
34215
34222
|
import { jsx as jsx115, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
34216
34223
|
var DateOptionField = (props) => {
|
|
34217
34224
|
const {
|
|
34218
|
-
name
|
|
34225
|
+
name,
|
|
34219
34226
|
readonly,
|
|
34220
34227
|
required,
|
|
34221
34228
|
invisible,
|
|
@@ -34226,7 +34233,7 @@ var DateOptionField = (props) => {
|
|
|
34226
34233
|
return /* @__PURE__ */ jsx115(
|
|
34227
34234
|
Controller,
|
|
34228
34235
|
{
|
|
34229
|
-
name:
|
|
34236
|
+
name: name ?? "",
|
|
34230
34237
|
control: methods?.control,
|
|
34231
34238
|
render: ({ field }) => /* @__PURE__ */ jsxs78(
|
|
34232
34239
|
"label",
|
|
@@ -34247,9 +34254,9 @@ var DateOptionField = (props) => {
|
|
|
34247
34254
|
onChange: (e3) => {
|
|
34248
34255
|
if (readonly) return;
|
|
34249
34256
|
const value = e3.target.checked;
|
|
34250
|
-
methods.setValue(
|
|
34257
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
34251
34258
|
field.onChange(value);
|
|
34252
|
-
onChange2?.(
|
|
34259
|
+
onChange2?.(name ?? "", value);
|
|
34253
34260
|
}
|
|
34254
34261
|
}
|
|
34255
34262
|
),
|