@fctc/sme-widget-ui 2.7.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +498 -495
- package/dist/index.mjs +496 -493
- package/dist/widgets.js +498 -495
- package/dist/widgets.mjs +496 -493
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,8 +9,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
9
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
10
|
};
|
|
11
11
|
var __export = (target, all) => {
|
|
12
|
-
for (var
|
|
13
|
-
__defProp(target,
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to2, from2, except, desc) => {
|
|
16
16
|
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
@@ -264,13 +264,13 @@ var require_moment = __commonJS({
|
|
|
264
264
|
}, fn);
|
|
265
265
|
}
|
|
266
266
|
var deprecations = {};
|
|
267
|
-
function deprecateSimple(
|
|
267
|
+
function deprecateSimple(name, msg) {
|
|
268
268
|
if (hooks.deprecationHandler != null) {
|
|
269
|
-
hooks.deprecationHandler(
|
|
269
|
+
hooks.deprecationHandler(name, msg);
|
|
270
270
|
}
|
|
271
|
-
if (!deprecations[
|
|
271
|
+
if (!deprecations[name]) {
|
|
272
272
|
warn3(msg);
|
|
273
|
-
deprecations[
|
|
273
|
+
deprecations[name] = true;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
hooks.suppressDeprecationWarnings = false;
|
|
@@ -1552,22 +1552,22 @@ var require_moment = __commonJS({
|
|
|
1552
1552
|
}
|
|
1553
1553
|
return globalLocale;
|
|
1554
1554
|
}
|
|
1555
|
-
function isLocaleNameSane(
|
|
1556
|
-
return !!(
|
|
1555
|
+
function isLocaleNameSane(name) {
|
|
1556
|
+
return !!(name && name.match("^[^/\\\\]*$"));
|
|
1557
1557
|
}
|
|
1558
|
-
function loadLocale(
|
|
1558
|
+
function loadLocale(name) {
|
|
1559
1559
|
var oldLocale = null, aliasedRequire;
|
|
1560
|
-
if (locales[
|
|
1560
|
+
if (locales[name] === void 0 && typeof module2 !== "undefined" && module2 && module2.exports && isLocaleNameSane(name)) {
|
|
1561
1561
|
try {
|
|
1562
1562
|
oldLocale = globalLocale._abbr;
|
|
1563
1563
|
aliasedRequire = require;
|
|
1564
|
-
aliasedRequire("./locale/" +
|
|
1564
|
+
aliasedRequire("./locale/" + name);
|
|
1565
1565
|
getSetGlobalLocale(oldLocale);
|
|
1566
1566
|
} catch (e3) {
|
|
1567
|
-
locales[
|
|
1567
|
+
locales[name] = null;
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
-
return locales[
|
|
1570
|
+
return locales[name];
|
|
1571
1571
|
}
|
|
1572
1572
|
function getSetGlobalLocale(key, values) {
|
|
1573
1573
|
var data;
|
|
@@ -1589,16 +1589,16 @@ var require_moment = __commonJS({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
return globalLocale._abbr;
|
|
1591
1591
|
}
|
|
1592
|
-
function defineLocale(
|
|
1592
|
+
function defineLocale(name, config) {
|
|
1593
1593
|
if (config !== null) {
|
|
1594
1594
|
var locale2, parentConfig = baseConfig;
|
|
1595
|
-
config.abbr =
|
|
1596
|
-
if (locales[
|
|
1595
|
+
config.abbr = name;
|
|
1596
|
+
if (locales[name] != null) {
|
|
1597
1597
|
deprecateSimple(
|
|
1598
1598
|
"defineLocaleOverride",
|
|
1599
1599
|
"use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
|
|
1600
1600
|
);
|
|
1601
|
-
parentConfig = locales[
|
|
1601
|
+
parentConfig = locales[name]._config;
|
|
1602
1602
|
} else if (config.parentLocale != null) {
|
|
1603
1603
|
if (locales[config.parentLocale] != null) {
|
|
1604
1604
|
parentConfig = locales[config.parentLocale]._config;
|
|
@@ -1611,58 +1611,58 @@ var require_moment = __commonJS({
|
|
|
1611
1611
|
localeFamilies[config.parentLocale] = [];
|
|
1612
1612
|
}
|
|
1613
1613
|
localeFamilies[config.parentLocale].push({
|
|
1614
|
-
name
|
|
1614
|
+
name,
|
|
1615
1615
|
config
|
|
1616
1616
|
});
|
|
1617
1617
|
return null;
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
|
-
locales[
|
|
1622
|
-
if (localeFamilies[
|
|
1623
|
-
localeFamilies[
|
|
1621
|
+
locales[name] = new Locale(mergeConfigs(parentConfig, config));
|
|
1622
|
+
if (localeFamilies[name]) {
|
|
1623
|
+
localeFamilies[name].forEach(function(x2) {
|
|
1624
1624
|
defineLocale(x2.name, x2.config);
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
|
-
getSetGlobalLocale(
|
|
1628
|
-
return locales[
|
|
1627
|
+
getSetGlobalLocale(name);
|
|
1628
|
+
return locales[name];
|
|
1629
1629
|
} else {
|
|
1630
|
-
delete locales[
|
|
1630
|
+
delete locales[name];
|
|
1631
1631
|
return null;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
|
-
function updateLocale(
|
|
1634
|
+
function updateLocale(name, config) {
|
|
1635
1635
|
if (config != null) {
|
|
1636
1636
|
var locale2, tmpLocale, parentConfig = baseConfig;
|
|
1637
|
-
if (locales[
|
|
1638
|
-
locales[
|
|
1637
|
+
if (locales[name] != null && locales[name].parentLocale != null) {
|
|
1638
|
+
locales[name].set(mergeConfigs(locales[name]._config, config));
|
|
1639
1639
|
} else {
|
|
1640
|
-
tmpLocale = loadLocale(
|
|
1640
|
+
tmpLocale = loadLocale(name);
|
|
1641
1641
|
if (tmpLocale != null) {
|
|
1642
1642
|
parentConfig = tmpLocale._config;
|
|
1643
1643
|
}
|
|
1644
1644
|
config = mergeConfigs(parentConfig, config);
|
|
1645
1645
|
if (tmpLocale == null) {
|
|
1646
|
-
config.abbr =
|
|
1646
|
+
config.abbr = name;
|
|
1647
1647
|
}
|
|
1648
1648
|
locale2 = new Locale(config);
|
|
1649
|
-
locale2.parentLocale = locales[
|
|
1650
|
-
locales[
|
|
1649
|
+
locale2.parentLocale = locales[name];
|
|
1650
|
+
locales[name] = locale2;
|
|
1651
1651
|
}
|
|
1652
|
-
getSetGlobalLocale(
|
|
1652
|
+
getSetGlobalLocale(name);
|
|
1653
1653
|
} else {
|
|
1654
|
-
if (locales[
|
|
1655
|
-
if (locales[
|
|
1656
|
-
locales[
|
|
1657
|
-
if (
|
|
1658
|
-
getSetGlobalLocale(
|
|
1654
|
+
if (locales[name] != null) {
|
|
1655
|
+
if (locales[name].parentLocale != null) {
|
|
1656
|
+
locales[name] = locales[name].parentLocale;
|
|
1657
|
+
if (name === getSetGlobalLocale()) {
|
|
1658
|
+
getSetGlobalLocale(name);
|
|
1659
1659
|
}
|
|
1660
|
-
} else if (locales[
|
|
1661
|
-
delete locales[
|
|
1660
|
+
} else if (locales[name] != null) {
|
|
1661
|
+
delete locales[name];
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
-
return locales[
|
|
1665
|
+
return locales[name];
|
|
1666
1666
|
}
|
|
1667
1667
|
function getLocale(key) {
|
|
1668
1668
|
var locale2;
|
|
@@ -2568,13 +2568,13 @@ var require_moment = __commonJS({
|
|
|
2568
2568
|
}
|
|
2569
2569
|
return res;
|
|
2570
2570
|
}
|
|
2571
|
-
function createAdder(direction,
|
|
2571
|
+
function createAdder(direction, name) {
|
|
2572
2572
|
return function(val, period) {
|
|
2573
2573
|
var dur, tmp;
|
|
2574
2574
|
if (period !== null && !isNaN(+period)) {
|
|
2575
2575
|
deprecateSimple(
|
|
2576
|
-
|
|
2577
|
-
"moment()." +
|
|
2576
|
+
name,
|
|
2577
|
+
"moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
|
|
2578
2578
|
);
|
|
2579
2579
|
tmp = val;
|
|
2580
2580
|
val = period;
|
|
@@ -3153,10 +3153,10 @@ var require_moment = __commonJS({
|
|
|
3153
3153
|
return eras;
|
|
3154
3154
|
}
|
|
3155
3155
|
function localeErasParse(eraName, format3, strict) {
|
|
3156
|
-
var i3, l2, eras = this.eras(),
|
|
3156
|
+
var i3, l2, eras = this.eras(), name, abbr, narrow;
|
|
3157
3157
|
eraName = eraName.toUpperCase();
|
|
3158
3158
|
for (i3 = 0, l2 = eras.length; i3 < l2; ++i3) {
|
|
3159
|
-
|
|
3159
|
+
name = eras[i3].name.toUpperCase();
|
|
3160
3160
|
abbr = eras[i3].abbr.toUpperCase();
|
|
3161
3161
|
narrow = eras[i3].narrow.toUpperCase();
|
|
3162
3162
|
if (strict) {
|
|
@@ -3169,7 +3169,7 @@ var require_moment = __commonJS({
|
|
|
3169
3169
|
}
|
|
3170
3170
|
break;
|
|
3171
3171
|
case "NNNN":
|
|
3172
|
-
if (
|
|
3172
|
+
if (name === eraName) {
|
|
3173
3173
|
return eras[i3];
|
|
3174
3174
|
}
|
|
3175
3175
|
break;
|
|
@@ -3179,7 +3179,7 @@ var require_moment = __commonJS({
|
|
|
3179
3179
|
}
|
|
3180
3180
|
break;
|
|
3181
3181
|
}
|
|
3182
|
-
} else if ([
|
|
3182
|
+
} else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
|
|
3183
3183
|
return eras[i3];
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
@@ -3817,9 +3817,9 @@ var require_moment = __commonJS({
|
|
|
3817
3817
|
units = normalizeUnits(units);
|
|
3818
3818
|
return this.isValid() ? this[units + "s"]() : NaN;
|
|
3819
3819
|
}
|
|
3820
|
-
function makeGetter(
|
|
3820
|
+
function makeGetter(name) {
|
|
3821
3821
|
return function() {
|
|
3822
|
-
return this.isValid() ? this._data[
|
|
3822
|
+
return this.isValid() ? this._data[name] : NaN;
|
|
3823
3823
|
};
|
|
3824
3824
|
}
|
|
3825
3825
|
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
|
|
@@ -5131,10 +5131,10 @@ function useFileInfo(source, options2) {
|
|
|
5131
5131
|
let localUrl = null;
|
|
5132
5132
|
let fr = null;
|
|
5133
5133
|
let mediaEl = null;
|
|
5134
|
-
const makeExtension = (
|
|
5135
|
-
if (
|
|
5136
|
-
const idx =
|
|
5137
|
-
if (idx > -1) return
|
|
5134
|
+
const makeExtension = (name, type) => {
|
|
5135
|
+
if (name) {
|
|
5136
|
+
const idx = name.lastIndexOf(".");
|
|
5137
|
+
if (idx > -1) return name.slice(idx + 1).toLowerCase();
|
|
5138
5138
|
}
|
|
5139
5139
|
if (type) {
|
|
5140
5140
|
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
@@ -8670,11 +8670,11 @@ var Formatter = class {
|
|
|
8670
8670
|
};
|
|
8671
8671
|
this.formatSeparator = options2.interpolation.formatSeparator || ",";
|
|
8672
8672
|
}
|
|
8673
|
-
add(
|
|
8674
|
-
this.formats[
|
|
8673
|
+
add(name, fc) {
|
|
8674
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
8675
8675
|
}
|
|
8676
|
-
addCached(
|
|
8677
|
-
this.formats[
|
|
8676
|
+
addCached(name, fc) {
|
|
8677
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
8678
8678
|
}
|
|
8679
8679
|
format(value, format2, lng) {
|
|
8680
8680
|
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -8710,9 +8710,9 @@ var Formatter = class {
|
|
|
8710
8710
|
return result;
|
|
8711
8711
|
}
|
|
8712
8712
|
};
|
|
8713
|
-
var removePending = (q3,
|
|
8714
|
-
if (q3.pending[
|
|
8715
|
-
delete q3.pending[
|
|
8713
|
+
var removePending = (q3, name) => {
|
|
8714
|
+
if (q3.pending[name] !== void 0) {
|
|
8715
|
+
delete q3.pending[name];
|
|
8716
8716
|
q3.pendingCount--;
|
|
8717
8717
|
}
|
|
8718
8718
|
};
|
|
@@ -8743,17 +8743,17 @@ var Connector = class extends EventEmitter {
|
|
|
8743
8743
|
languages.forEach((lng) => {
|
|
8744
8744
|
let hasAllNamespaces = true;
|
|
8745
8745
|
namespaces.forEach((ns) => {
|
|
8746
|
-
const
|
|
8746
|
+
const name = `${lng}|${ns}`;
|
|
8747
8747
|
if (!options2.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
8748
|
-
this.state[
|
|
8749
|
-
} else if (this.state[
|
|
8750
|
-
else if (this.state[
|
|
8751
|
-
if (pending[
|
|
8748
|
+
this.state[name] = 2;
|
|
8749
|
+
} else if (this.state[name] < 0) ;
|
|
8750
|
+
else if (this.state[name] === 1) {
|
|
8751
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
8752
8752
|
} else {
|
|
8753
|
-
this.state[
|
|
8753
|
+
this.state[name] = 1;
|
|
8754
8754
|
hasAllNamespaces = false;
|
|
8755
|
-
if (pending[
|
|
8756
|
-
if (toLoad[
|
|
8755
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
8756
|
+
if (toLoad[name] === void 0) toLoad[name] = true;
|
|
8757
8757
|
if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true;
|
|
8758
8758
|
}
|
|
8759
8759
|
});
|
|
@@ -8775,8 +8775,8 @@ var Connector = class extends EventEmitter {
|
|
|
8775
8775
|
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
8776
8776
|
};
|
|
8777
8777
|
}
|
|
8778
|
-
loaded(
|
|
8779
|
-
const s4 =
|
|
8778
|
+
loaded(name, err, data) {
|
|
8779
|
+
const s4 = name.split("|");
|
|
8780
8780
|
const lng = s4[0];
|
|
8781
8781
|
const ns = s4[1];
|
|
8782
8782
|
if (err) this.emit("failedLoading", lng, ns, err);
|
|
@@ -8785,12 +8785,12 @@ var Connector = class extends EventEmitter {
|
|
|
8785
8785
|
skipCopy: true
|
|
8786
8786
|
});
|
|
8787
8787
|
}
|
|
8788
|
-
this.state[
|
|
8789
|
-
if (err && data) this.state[
|
|
8788
|
+
this.state[name] = err ? -1 : 2;
|
|
8789
|
+
if (err && data) this.state[name] = 0;
|
|
8790
8790
|
const loaded = {};
|
|
8791
8791
|
this.queue.forEach((q3) => {
|
|
8792
8792
|
pushPath(q3.loaded, [lng], ns);
|
|
8793
|
-
removePending(q3,
|
|
8793
|
+
removePending(q3, name);
|
|
8794
8794
|
if (err) q3.errors.push(err);
|
|
8795
8795
|
if (q3.pendingCount === 0 && !q3.done) {
|
|
8796
8796
|
Object.keys(q3.loaded).forEach((l2) => {
|
|
@@ -8874,8 +8874,8 @@ var Connector = class extends EventEmitter {
|
|
|
8874
8874
|
if (!toLoad.pending.length) callback();
|
|
8875
8875
|
return null;
|
|
8876
8876
|
}
|
|
8877
|
-
toLoad.toLoad.forEach((
|
|
8878
|
-
this.loadOne(
|
|
8877
|
+
toLoad.toLoad.forEach((name) => {
|
|
8878
|
+
this.loadOne(name);
|
|
8879
8879
|
});
|
|
8880
8880
|
}
|
|
8881
8881
|
load(languages, namespaces, callback) {
|
|
@@ -8886,15 +8886,15 @@ var Connector = class extends EventEmitter {
|
|
|
8886
8886
|
reload: true
|
|
8887
8887
|
}, callback);
|
|
8888
8888
|
}
|
|
8889
|
-
loadOne(
|
|
8889
|
+
loadOne(name) {
|
|
8890
8890
|
let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
8891
|
-
const s4 =
|
|
8891
|
+
const s4 = name.split("|");
|
|
8892
8892
|
const lng = s4[0];
|
|
8893
8893
|
const ns = s4[1];
|
|
8894
8894
|
this.read(lng, ns, "read", void 0, void 0, (err, data) => {
|
|
8895
8895
|
if (err) this.logger.warn(`${prefix2}loading namespace ${ns} for language ${lng} failed`, err);
|
|
8896
8896
|
if (!err && data) this.logger.log(`${prefix2}loaded namespace ${ns} for language ${lng}`, data);
|
|
8897
|
-
this.loaded(
|
|
8897
|
+
this.loaded(name, err, data);
|
|
8898
8898
|
});
|
|
8899
8899
|
}
|
|
8900
8900
|
saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
@@ -9544,13 +9544,13 @@ function hasXSS(input) {
|
|
|
9544
9544
|
return xssPatterns.some((pattern) => pattern.test(input));
|
|
9545
9545
|
}
|
|
9546
9546
|
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
9547
|
-
var serializeCookie = function(
|
|
9547
|
+
var serializeCookie = function(name, val) {
|
|
9548
9548
|
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
9549
9549
|
path: "/"
|
|
9550
9550
|
};
|
|
9551
9551
|
const opt = options2;
|
|
9552
9552
|
const value = encodeURIComponent(val);
|
|
9553
|
-
let str = `${
|
|
9553
|
+
let str = `${name}=${value}`;
|
|
9554
9554
|
if (opt.maxAge > 0) {
|
|
9555
9555
|
const maxAge = opt.maxAge - 0;
|
|
9556
9556
|
if (Number.isNaN(maxAge)) throw new Error("maxAge should be a Number");
|
|
@@ -9599,7 +9599,7 @@ var serializeCookie = function(name2, val) {
|
|
|
9599
9599
|
return str;
|
|
9600
9600
|
};
|
|
9601
9601
|
var cookie = {
|
|
9602
|
-
create(
|
|
9602
|
+
create(name, value, minutes, domain) {
|
|
9603
9603
|
let cookieOptions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
9604
9604
|
path: "/",
|
|
9605
9605
|
sameSite: "strict"
|
|
@@ -9609,10 +9609,10 @@ var cookie = {
|
|
|
9609
9609
|
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1e3);
|
|
9610
9610
|
}
|
|
9611
9611
|
if (domain) cookieOptions.domain = domain;
|
|
9612
|
-
document.cookie = serializeCookie(
|
|
9612
|
+
document.cookie = serializeCookie(name, value, cookieOptions);
|
|
9613
9613
|
},
|
|
9614
|
-
read(
|
|
9615
|
-
const nameEQ = `${
|
|
9614
|
+
read(name) {
|
|
9615
|
+
const nameEQ = `${name}=`;
|
|
9616
9616
|
const ca = document.cookie.split(";");
|
|
9617
9617
|
for (let i3 = 0; i3 < ca.length; i3++) {
|
|
9618
9618
|
let c2 = ca[i3];
|
|
@@ -9621,8 +9621,8 @@ var cookie = {
|
|
|
9621
9621
|
}
|
|
9622
9622
|
return null;
|
|
9623
9623
|
},
|
|
9624
|
-
remove(
|
|
9625
|
-
this.create(
|
|
9624
|
+
remove(name, domain) {
|
|
9625
|
+
this.create(name, "", -1, domain);
|
|
9626
9626
|
}
|
|
9627
9627
|
};
|
|
9628
9628
|
var cookie$1 = {
|
|
@@ -11484,7 +11484,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11484
11484
|
let resetCount = 0;
|
|
11485
11485
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
11486
11486
|
const {
|
|
11487
|
-
name
|
|
11487
|
+
name,
|
|
11488
11488
|
fn
|
|
11489
11489
|
} = validMiddleware[i3];
|
|
11490
11490
|
const {
|
|
@@ -11510,8 +11510,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11510
11510
|
y3 = nextY != null ? nextY : y3;
|
|
11511
11511
|
middlewareData = {
|
|
11512
11512
|
...middlewareData,
|
|
11513
|
-
[
|
|
11514
|
-
...middlewareData[
|
|
11513
|
+
[name]: {
|
|
11514
|
+
...middlewareData[name],
|
|
11515
11515
|
...data
|
|
11516
11516
|
}
|
|
11517
11517
|
};
|
|
@@ -13101,7 +13101,8 @@ var TableHead = (props) => {
|
|
|
13101
13101
|
{
|
|
13102
13102
|
style: {
|
|
13103
13103
|
width: "40px",
|
|
13104
|
-
maxWidth: "40px"
|
|
13104
|
+
maxWidth: "40px",
|
|
13105
|
+
overflow: "unset !important"
|
|
13105
13106
|
},
|
|
13106
13107
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
13107
13108
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -13576,8 +13577,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
13576
13577
|
var isObjectType = (value) => typeof value === "object";
|
|
13577
13578
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
13578
13579
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
13579
|
-
var getNodeParentName = (
|
|
13580
|
-
var isNameInFieldArray = (names,
|
|
13580
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
13581
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
13581
13582
|
var isPlainObject = (tempObject) => {
|
|
13582
13583
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
13583
13584
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -13681,7 +13682,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
13681
13682
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react17.default.useLayoutEffect : import_react17.default.useEffect;
|
|
13682
13683
|
function useFormState(props) {
|
|
13683
13684
|
const methods = useFormContext();
|
|
13684
|
-
const { control = methods.control, disabled, name
|
|
13685
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
13685
13686
|
const [formState, updateFormState] = import_react17.default.useState(control._formState);
|
|
13686
13687
|
const _localProxyFormState = import_react17.default.useRef({
|
|
13687
13688
|
isDirty: false,
|
|
@@ -13694,7 +13695,7 @@ function useFormState(props) {
|
|
|
13694
13695
|
errors: false
|
|
13695
13696
|
});
|
|
13696
13697
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13697
|
-
name
|
|
13698
|
+
name,
|
|
13698
13699
|
formState: _localProxyFormState.current,
|
|
13699
13700
|
exact,
|
|
13700
13701
|
callback: (formState2) => {
|
|
@@ -13703,7 +13704,7 @@ function useFormState(props) {
|
|
|
13703
13704
|
...formState2
|
|
13704
13705
|
});
|
|
13705
13706
|
}
|
|
13706
|
-
}), [
|
|
13707
|
+
}), [name, disabled, exact]);
|
|
13707
13708
|
import_react17.default.useEffect(() => {
|
|
13708
13709
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
13709
13710
|
}, [control]);
|
|
@@ -13755,22 +13756,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
13755
13756
|
}
|
|
13756
13757
|
function useWatch(props) {
|
|
13757
13758
|
const methods = useFormContext();
|
|
13758
|
-
const { control = methods.control, name
|
|
13759
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
13759
13760
|
const _defaultValue = import_react17.default.useRef(defaultValue);
|
|
13760
13761
|
const _compute = import_react17.default.useRef(compute);
|
|
13761
13762
|
const _computeFormValues = import_react17.default.useRef(void 0);
|
|
13762
13763
|
_compute.current = compute;
|
|
13763
|
-
const defaultValueMemo = import_react17.default.useMemo(() => control._getWatch(
|
|
13764
|
+
const defaultValueMemo = import_react17.default.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
13764
13765
|
const [value, updateValue] = import_react17.default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
13765
13766
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13766
|
-
name
|
|
13767
|
+
name,
|
|
13767
13768
|
formState: {
|
|
13768
13769
|
values: true
|
|
13769
13770
|
},
|
|
13770
13771
|
exact,
|
|
13771
13772
|
callback: (formState) => {
|
|
13772
13773
|
if (!disabled) {
|
|
13773
|
-
const formValues = generateWatchOutput(
|
|
13774
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
13774
13775
|
if (_compute.current) {
|
|
13775
13776
|
const computedFormValues = _compute.current(formValues);
|
|
13776
13777
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -13782,28 +13783,28 @@ function useWatch(props) {
|
|
|
13782
13783
|
}
|
|
13783
13784
|
}
|
|
13784
13785
|
}
|
|
13785
|
-
}), [control, disabled,
|
|
13786
|
+
}), [control, disabled, name, exact]);
|
|
13786
13787
|
import_react17.default.useEffect(() => control._removeUnmounted());
|
|
13787
13788
|
return value;
|
|
13788
13789
|
}
|
|
13789
13790
|
function useController(props) {
|
|
13790
13791
|
const methods = useFormContext();
|
|
13791
|
-
const { name
|
|
13792
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
13793
|
-
const defaultValueMemo = import_react17.default.useMemo(() => get2(control._formValues,
|
|
13792
|
+
const { name, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
13793
|
+
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
13794
|
+
const defaultValueMemo = import_react17.default.useMemo(() => get2(control._formValues, name, get2(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
13794
13795
|
const value = useWatch({
|
|
13795
13796
|
control,
|
|
13796
|
-
name
|
|
13797
|
+
name,
|
|
13797
13798
|
defaultValue: defaultValueMemo,
|
|
13798
13799
|
exact: true
|
|
13799
13800
|
});
|
|
13800
13801
|
const formState = useFormState({
|
|
13801
13802
|
control,
|
|
13802
|
-
name
|
|
13803
|
+
name,
|
|
13803
13804
|
exact: true
|
|
13804
13805
|
});
|
|
13805
13806
|
const _props = import_react17.default.useRef(props);
|
|
13806
|
-
const _registerProps = import_react17.default.useRef(control.register(
|
|
13807
|
+
const _registerProps = import_react17.default.useRef(control.register(name, {
|
|
13807
13808
|
...props.rules,
|
|
13808
13809
|
value,
|
|
13809
13810
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -13812,41 +13813,41 @@ function useController(props) {
|
|
|
13812
13813
|
const fieldState = import_react17.default.useMemo(() => Object.defineProperties({}, {
|
|
13813
13814
|
invalid: {
|
|
13814
13815
|
enumerable: true,
|
|
13815
|
-
get: () => !!get2(formState.errors,
|
|
13816
|
+
get: () => !!get2(formState.errors, name)
|
|
13816
13817
|
},
|
|
13817
13818
|
isDirty: {
|
|
13818
13819
|
enumerable: true,
|
|
13819
|
-
get: () => !!get2(formState.dirtyFields,
|
|
13820
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
13820
13821
|
},
|
|
13821
13822
|
isTouched: {
|
|
13822
13823
|
enumerable: true,
|
|
13823
|
-
get: () => !!get2(formState.touchedFields,
|
|
13824
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
13824
13825
|
},
|
|
13825
13826
|
isValidating: {
|
|
13826
13827
|
enumerable: true,
|
|
13827
|
-
get: () => !!get2(formState.validatingFields,
|
|
13828
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
13828
13829
|
},
|
|
13829
13830
|
error: {
|
|
13830
13831
|
enumerable: true,
|
|
13831
|
-
get: () => get2(formState.errors,
|
|
13832
|
+
get: () => get2(formState.errors, name)
|
|
13832
13833
|
}
|
|
13833
|
-
}), [formState,
|
|
13834
|
+
}), [formState, name]);
|
|
13834
13835
|
const onChange2 = import_react17.default.useCallback((event) => _registerProps.current.onChange({
|
|
13835
13836
|
target: {
|
|
13836
13837
|
value: getEventValue(event),
|
|
13837
|
-
name
|
|
13838
|
+
name
|
|
13838
13839
|
},
|
|
13839
13840
|
type: EVENTS.CHANGE
|
|
13840
|
-
}), [
|
|
13841
|
+
}), [name]);
|
|
13841
13842
|
const onBlur = import_react17.default.useCallback(() => _registerProps.current.onBlur({
|
|
13842
13843
|
target: {
|
|
13843
|
-
value: get2(control._formValues,
|
|
13844
|
-
name
|
|
13844
|
+
value: get2(control._formValues, name),
|
|
13845
|
+
name
|
|
13845
13846
|
},
|
|
13846
13847
|
type: EVENTS.BLUR
|
|
13847
|
-
}), [
|
|
13848
|
+
}), [name, control._formValues]);
|
|
13848
13849
|
const ref = import_react17.default.useCallback((elm) => {
|
|
13849
|
-
const field2 = get2(control._fields,
|
|
13850
|
+
const field2 = get2(control._fields, name);
|
|
13850
13851
|
if (field2 && elm) {
|
|
13851
13852
|
field2._f.ref = {
|
|
13852
13853
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -13855,46 +13856,46 @@ function useController(props) {
|
|
|
13855
13856
|
reportValidity: () => elm.reportValidity()
|
|
13856
13857
|
};
|
|
13857
13858
|
}
|
|
13858
|
-
}, [control._fields,
|
|
13859
|
+
}, [control._fields, name]);
|
|
13859
13860
|
const field = import_react17.default.useMemo(() => ({
|
|
13860
|
-
name
|
|
13861
|
+
name,
|
|
13861
13862
|
value,
|
|
13862
13863
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
13863
13864
|
onChange: onChange2,
|
|
13864
13865
|
onBlur,
|
|
13865
13866
|
ref
|
|
13866
|
-
}), [
|
|
13867
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
13867
13868
|
import_react17.default.useEffect(() => {
|
|
13868
13869
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
13869
|
-
control.register(
|
|
13870
|
+
control.register(name, {
|
|
13870
13871
|
..._props.current.rules,
|
|
13871
13872
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
13872
13873
|
});
|
|
13873
|
-
const updateMounted = (
|
|
13874
|
-
const field2 = get2(control._fields,
|
|
13874
|
+
const updateMounted = (name2, value2) => {
|
|
13875
|
+
const field2 = get2(control._fields, name2);
|
|
13875
13876
|
if (field2 && field2._f) {
|
|
13876
13877
|
field2._f.mount = value2;
|
|
13877
13878
|
}
|
|
13878
13879
|
};
|
|
13879
|
-
updateMounted(
|
|
13880
|
+
updateMounted(name, true);
|
|
13880
13881
|
if (_shouldUnregisterField) {
|
|
13881
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
13882
|
-
set(control._defaultValues,
|
|
13883
|
-
if (isUndefined(get2(control._formValues,
|
|
13884
|
-
set(control._formValues,
|
|
13882
|
+
const value2 = cloneObject(get2(control._options.defaultValues, name));
|
|
13883
|
+
set(control._defaultValues, name, value2);
|
|
13884
|
+
if (isUndefined(get2(control._formValues, name))) {
|
|
13885
|
+
set(control._formValues, name, value2);
|
|
13885
13886
|
}
|
|
13886
13887
|
}
|
|
13887
|
-
!isArrayField && control.register(
|
|
13888
|
+
!isArrayField && control.register(name);
|
|
13888
13889
|
return () => {
|
|
13889
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
13890
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
13890
13891
|
};
|
|
13891
|
-
}, [
|
|
13892
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
13892
13893
|
import_react17.default.useEffect(() => {
|
|
13893
13894
|
control._setDisabledField({
|
|
13894
13895
|
disabled,
|
|
13895
|
-
name
|
|
13896
|
+
name
|
|
13896
13897
|
});
|
|
13897
|
-
}, [disabled,
|
|
13898
|
+
}, [disabled, name, control]);
|
|
13898
13899
|
return import_react17.default.useMemo(() => ({
|
|
13899
13900
|
field,
|
|
13900
13901
|
formState,
|
|
@@ -13902,10 +13903,10 @@ function useController(props) {
|
|
|
13902
13903
|
}), [field, formState, fieldState]);
|
|
13903
13904
|
}
|
|
13904
13905
|
var Controller = (props) => props.render(useController(props));
|
|
13905
|
-
var appendErrors = (
|
|
13906
|
-
...errors[
|
|
13906
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
13907
|
+
...errors[name],
|
|
13907
13908
|
types: {
|
|
13908
|
-
...errors[
|
|
13909
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
13909
13910
|
[type]: message2 || true
|
|
13910
13911
|
}
|
|
13911
13912
|
} : {};
|
|
@@ -14065,9 +14066,9 @@ function getFieldValue(_f) {
|
|
|
14065
14066
|
}
|
|
14066
14067
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
14067
14068
|
const fields = {};
|
|
14068
|
-
for (const
|
|
14069
|
-
const field = get2(_fields,
|
|
14070
|
-
field && set(fields,
|
|
14069
|
+
for (const name of fieldsNames) {
|
|
14070
|
+
const field = get2(_fields, name);
|
|
14071
|
+
field && set(fields, name, field._f);
|
|
14071
14072
|
}
|
|
14072
14073
|
return {
|
|
14073
14074
|
criteriaMode,
|
|
@@ -14088,7 +14089,7 @@ var getValidationModes = (mode) => ({
|
|
|
14088
14089
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
14089
14090
|
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));
|
|
14090
14091
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
14091
|
-
var isWatched = (
|
|
14092
|
+
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))));
|
|
14092
14093
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
14093
14094
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
14094
14095
|
const field = get2(fields, key);
|
|
@@ -14113,21 +14114,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
14113
14114
|
}
|
|
14114
14115
|
return;
|
|
14115
14116
|
};
|
|
14116
|
-
function schemaErrorLookup(errors, _fields,
|
|
14117
|
-
const error2 = get2(errors,
|
|
14118
|
-
if (error2 || isKey(
|
|
14117
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
14118
|
+
const error2 = get2(errors, name);
|
|
14119
|
+
if (error2 || isKey(name)) {
|
|
14119
14120
|
return {
|
|
14120
14121
|
error: error2,
|
|
14121
|
-
name
|
|
14122
|
+
name
|
|
14122
14123
|
};
|
|
14123
14124
|
}
|
|
14124
|
-
const names =
|
|
14125
|
+
const names = name.split(".");
|
|
14125
14126
|
while (names.length) {
|
|
14126
14127
|
const fieldName = names.join(".");
|
|
14127
14128
|
const field = get2(_fields, fieldName);
|
|
14128
14129
|
const foundError = get2(errors, fieldName);
|
|
14129
|
-
if (field && !Array.isArray(field) &&
|
|
14130
|
-
return { name
|
|
14130
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
14131
|
+
return { name };
|
|
14131
14132
|
}
|
|
14132
14133
|
if (foundError && foundError.type) {
|
|
14133
14134
|
return {
|
|
@@ -14144,15 +14145,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
14144
14145
|
names.pop();
|
|
14145
14146
|
}
|
|
14146
14147
|
return {
|
|
14147
|
-
name
|
|
14148
|
+
name
|
|
14148
14149
|
};
|
|
14149
14150
|
}
|
|
14150
14151
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
14151
14152
|
updateFormState(formStateData);
|
|
14152
|
-
const { name
|
|
14153
|
+
const { name, ...formState } = formStateData;
|
|
14153
14154
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
14154
14155
|
};
|
|
14155
|
-
var shouldSubscribeByName = (
|
|
14156
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
14156
14157
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
14157
14158
|
if (mode.isOnAll) {
|
|
14158
14159
|
return false;
|
|
@@ -14165,11 +14166,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
14165
14166
|
}
|
|
14166
14167
|
return true;
|
|
14167
14168
|
};
|
|
14168
|
-
var unsetEmptyArray = (ref,
|
|
14169
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
14170
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
14171
|
-
set(fieldArrayErrors, "root", error2[
|
|
14172
|
-
set(errors,
|
|
14169
|
+
var unsetEmptyArray = (ref, name) => !compact(get2(ref, name)).length && unset(ref, name);
|
|
14170
|
+
var updateFieldArrayRootError = (errors, error2, name) => {
|
|
14171
|
+
const fieldArrayErrors = convertToArrayPayload(get2(errors, name));
|
|
14172
|
+
set(fieldArrayErrors, "root", error2[name]);
|
|
14173
|
+
set(errors, name, fieldArrayErrors);
|
|
14173
14174
|
return errors;
|
|
14174
14175
|
};
|
|
14175
14176
|
var isMessage = (value) => isString3(value);
|
|
@@ -14187,9 +14188,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
14187
14188
|
message: ""
|
|
14188
14189
|
};
|
|
14189
14190
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
14190
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
14191
|
-
const inputValue = get2(formValues,
|
|
14192
|
-
if (!mount || disabledFieldNames.has(
|
|
14191
|
+
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name, valueAsNumber, mount } = field._f;
|
|
14192
|
+
const inputValue = get2(formValues, name);
|
|
14193
|
+
if (!mount || disabledFieldNames.has(name)) {
|
|
14193
14194
|
return {};
|
|
14194
14195
|
}
|
|
14195
14196
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -14204,10 +14205,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14204
14205
|
const isCheckBox = isCheckBoxInput(ref);
|
|
14205
14206
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
14206
14207
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
14207
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
14208
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
14208
14209
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
14209
14210
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
14210
|
-
error2[
|
|
14211
|
+
error2[name] = {
|
|
14211
14212
|
type: exceedMax ? maxType : minType,
|
|
14212
14213
|
message: message2,
|
|
14213
14214
|
ref,
|
|
@@ -14217,7 +14218,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14217
14218
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
14218
14219
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
14219
14220
|
if (value) {
|
|
14220
|
-
error2[
|
|
14221
|
+
error2[name] = {
|
|
14221
14222
|
type: INPUT_VALIDATION_RULES.required,
|
|
14222
14223
|
message: message2,
|
|
14223
14224
|
ref: inputRef,
|
|
@@ -14257,7 +14258,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14257
14258
|
if (exceedMax || exceedMin) {
|
|
14258
14259
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
14259
14260
|
if (!validateAllFieldCriteria) {
|
|
14260
|
-
setCustomValidity(error2[
|
|
14261
|
+
setCustomValidity(error2[name].message);
|
|
14261
14262
|
return error2;
|
|
14262
14263
|
}
|
|
14263
14264
|
}
|
|
@@ -14270,7 +14271,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14270
14271
|
if (exceedMax || exceedMin) {
|
|
14271
14272
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
14272
14273
|
if (!validateAllFieldCriteria) {
|
|
14273
|
-
setCustomValidity(error2[
|
|
14274
|
+
setCustomValidity(error2[name].message);
|
|
14274
14275
|
return error2;
|
|
14275
14276
|
}
|
|
14276
14277
|
}
|
|
@@ -14278,7 +14279,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14278
14279
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
14279
14280
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
14280
14281
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
14281
|
-
error2[
|
|
14282
|
+
error2[name] = {
|
|
14282
14283
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
14283
14284
|
message: message2,
|
|
14284
14285
|
ref,
|
|
@@ -14295,7 +14296,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14295
14296
|
const result = await validate(inputValue, formValues);
|
|
14296
14297
|
const validateError = getValidateError(result, inputRef);
|
|
14297
14298
|
if (validateError) {
|
|
14298
|
-
error2[
|
|
14299
|
+
error2[name] = {
|
|
14299
14300
|
...validateError,
|
|
14300
14301
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
14301
14302
|
};
|
|
@@ -14318,12 +14319,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14318
14319
|
};
|
|
14319
14320
|
setCustomValidity(validateError.message);
|
|
14320
14321
|
if (validateAllFieldCriteria) {
|
|
14321
|
-
error2[
|
|
14322
|
+
error2[name] = validationResult;
|
|
14322
14323
|
}
|
|
14323
14324
|
}
|
|
14324
14325
|
}
|
|
14325
14326
|
if (!isEmptyObject(validationResult)) {
|
|
14326
|
-
error2[
|
|
14327
|
+
error2[name] = {
|
|
14327
14328
|
ref: inputRef,
|
|
14328
14329
|
...validationResult
|
|
14329
14330
|
};
|
|
@@ -14412,9 +14413,9 @@ function createFormControl(props = {}) {
|
|
|
14412
14413
|
};
|
|
14413
14414
|
const _updateIsValidating = (names, isValidating) => {
|
|
14414
14415
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
14415
|
-
(names || Array.from(_names.mount)).forEach((
|
|
14416
|
-
if (
|
|
14417
|
-
isValidating ? set(_formState.validatingFields,
|
|
14416
|
+
(names || Array.from(_names.mount)).forEach((name) => {
|
|
14417
|
+
if (name) {
|
|
14418
|
+
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
14418
14419
|
}
|
|
14419
14420
|
});
|
|
14420
14421
|
_subjects.state.next({
|
|
@@ -14423,38 +14424,38 @@ function createFormControl(props = {}) {
|
|
|
14423
14424
|
});
|
|
14424
14425
|
}
|
|
14425
14426
|
};
|
|
14426
|
-
const _setFieldArray = (
|
|
14427
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
14427
14428
|
if (args && method && !_options.disabled) {
|
|
14428
14429
|
_state.action = true;
|
|
14429
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
14430
|
-
const fieldValues = method(get2(_fields,
|
|
14431
|
-
shouldSetValues && set(_fields,
|
|
14430
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields, name))) {
|
|
14431
|
+
const fieldValues = method(get2(_fields, name), args.argA, args.argB);
|
|
14432
|
+
shouldSetValues && set(_fields, name, fieldValues);
|
|
14432
14433
|
}
|
|
14433
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
14434
|
-
const errors = method(get2(_formState.errors,
|
|
14435
|
-
shouldSetValues && set(_formState.errors,
|
|
14436
|
-
unsetEmptyArray(_formState.errors,
|
|
14434
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors, name))) {
|
|
14435
|
+
const errors = method(get2(_formState.errors, name), args.argA, args.argB);
|
|
14436
|
+
shouldSetValues && set(_formState.errors, name, errors);
|
|
14437
|
+
unsetEmptyArray(_formState.errors, name);
|
|
14437
14438
|
}
|
|
14438
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
14439
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
14440
|
-
shouldSetValues && set(_formState.touchedFields,
|
|
14439
|
+
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields, name))) {
|
|
14440
|
+
const touchedFields = method(get2(_formState.touchedFields, name), args.argA, args.argB);
|
|
14441
|
+
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
14441
14442
|
}
|
|
14442
14443
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
14443
14444
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
14444
14445
|
}
|
|
14445
14446
|
_subjects.state.next({
|
|
14446
|
-
name
|
|
14447
|
-
isDirty: _getDirty(
|
|
14447
|
+
name,
|
|
14448
|
+
isDirty: _getDirty(name, values),
|
|
14448
14449
|
dirtyFields: _formState.dirtyFields,
|
|
14449
14450
|
errors: _formState.errors,
|
|
14450
14451
|
isValid: _formState.isValid
|
|
14451
14452
|
});
|
|
14452
14453
|
} else {
|
|
14453
|
-
set(_formValues,
|
|
14454
|
+
set(_formValues, name, values);
|
|
14454
14455
|
}
|
|
14455
14456
|
};
|
|
14456
|
-
const updateErrors = (
|
|
14457
|
-
set(_formState.errors,
|
|
14457
|
+
const updateErrors = (name, error2) => {
|
|
14458
|
+
set(_formState.errors, name, error2);
|
|
14458
14459
|
_subjects.state.next({
|
|
14459
14460
|
errors: _formState.errors
|
|
14460
14461
|
});
|
|
@@ -14466,19 +14467,19 @@ function createFormControl(props = {}) {
|
|
|
14466
14467
|
isValid: false
|
|
14467
14468
|
});
|
|
14468
14469
|
};
|
|
14469
|
-
const updateValidAndValue = (
|
|
14470
|
-
const field = get2(_fields,
|
|
14470
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
14471
|
+
const field = get2(_fields, name);
|
|
14471
14472
|
if (field) {
|
|
14472
|
-
const defaultValue = get2(_formValues,
|
|
14473
|
-
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues,
|
|
14473
|
+
const defaultValue = get2(_formValues, name, isUndefined(value) ? get2(_defaultValues, name) : value);
|
|
14474
|
+
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
14474
14475
|
_state.mount && _setValid();
|
|
14475
14476
|
}
|
|
14476
14477
|
};
|
|
14477
|
-
const updateTouchAndDirty = (
|
|
14478
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
14478
14479
|
let shouldUpdateField = false;
|
|
14479
14480
|
let isPreviousDirty = false;
|
|
14480
14481
|
const output = {
|
|
14481
|
-
name
|
|
14482
|
+
name
|
|
14482
14483
|
};
|
|
14483
14484
|
if (!_options.disabled) {
|
|
14484
14485
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -14487,16 +14488,16 @@ function createFormControl(props = {}) {
|
|
|
14487
14488
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
14488
14489
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
14489
14490
|
}
|
|
14490
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
14491
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
14492
|
-
isCurrentFieldPristine ? unset(_formState.dirtyFields,
|
|
14491
|
+
const isCurrentFieldPristine = deepEqual(get2(_defaultValues, name), fieldValue);
|
|
14492
|
+
isPreviousDirty = !!get2(_formState.dirtyFields, name);
|
|
14493
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
14493
14494
|
output.dirtyFields = _formState.dirtyFields;
|
|
14494
14495
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
14495
14496
|
}
|
|
14496
14497
|
if (isBlurEvent) {
|
|
14497
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
14498
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
14498
14499
|
if (!isPreviousFieldTouched) {
|
|
14499
|
-
set(_formState.touchedFields,
|
|
14500
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
14500
14501
|
output.touchedFields = _formState.touchedFields;
|
|
14501
14502
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
14502
14503
|
}
|
|
@@ -14505,23 +14506,23 @@ function createFormControl(props = {}) {
|
|
|
14505
14506
|
}
|
|
14506
14507
|
return shouldUpdateField ? output : {};
|
|
14507
14508
|
};
|
|
14508
|
-
const shouldRenderByError = (
|
|
14509
|
-
const previousFieldError = get2(_formState.errors,
|
|
14509
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
14510
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
14510
14511
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
14511
14512
|
if (_options.delayError && error2) {
|
|
14512
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
14513
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
14513
14514
|
delayErrorCallback(_options.delayError);
|
|
14514
14515
|
} else {
|
|
14515
14516
|
clearTimeout(timer);
|
|
14516
14517
|
delayErrorCallback = null;
|
|
14517
|
-
error2 ? set(_formState.errors,
|
|
14518
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
14518
14519
|
}
|
|
14519
14520
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
14520
14521
|
const updatedFormState = {
|
|
14521
14522
|
...fieldState,
|
|
14522
14523
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
14523
14524
|
errors: _formState.errors,
|
|
14524
|
-
name
|
|
14525
|
+
name
|
|
14525
14526
|
};
|
|
14526
14527
|
_formState = {
|
|
14527
14528
|
..._formState,
|
|
@@ -14530,18 +14531,18 @@ function createFormControl(props = {}) {
|
|
|
14530
14531
|
_subjects.state.next(updatedFormState);
|
|
14531
14532
|
}
|
|
14532
14533
|
};
|
|
14533
|
-
const _runSchema = async (
|
|
14534
|
-
_updateIsValidating(
|
|
14535
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
14536
|
-
_updateIsValidating(
|
|
14534
|
+
const _runSchema = async (name) => {
|
|
14535
|
+
_updateIsValidating(name, true);
|
|
14536
|
+
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
14537
|
+
_updateIsValidating(name);
|
|
14537
14538
|
return result;
|
|
14538
14539
|
};
|
|
14539
14540
|
const executeSchemaAndUpdateState = async (names) => {
|
|
14540
14541
|
const { errors } = await _runSchema(names);
|
|
14541
14542
|
if (names) {
|
|
14542
|
-
for (const
|
|
14543
|
-
const error2 = get2(errors,
|
|
14544
|
-
error2 ? set(_formState.errors,
|
|
14543
|
+
for (const name of names) {
|
|
14544
|
+
const error2 = get2(errors, name);
|
|
14545
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
14545
14546
|
}
|
|
14546
14547
|
} else {
|
|
14547
14548
|
_formState.errors = errors;
|
|
@@ -14551,19 +14552,19 @@ function createFormControl(props = {}) {
|
|
|
14551
14552
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
14552
14553
|
valid: true
|
|
14553
14554
|
}) => {
|
|
14554
|
-
for (const
|
|
14555
|
-
const field = fields[
|
|
14555
|
+
for (const name in fields) {
|
|
14556
|
+
const field = fields[name];
|
|
14556
14557
|
if (field) {
|
|
14557
14558
|
const { _f, ...fieldValue } = field;
|
|
14558
14559
|
if (_f) {
|
|
14559
14560
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
14560
14561
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
14561
14562
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14562
|
-
_updateIsValidating([
|
|
14563
|
+
_updateIsValidating([name], true);
|
|
14563
14564
|
}
|
|
14564
14565
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
14565
14566
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14566
|
-
_updateIsValidating([
|
|
14567
|
+
_updateIsValidating([name]);
|
|
14567
14568
|
}
|
|
14568
14569
|
if (fieldError[_f.name]) {
|
|
14569
14570
|
context.valid = false;
|
|
@@ -14579,24 +14580,24 @@ function createFormControl(props = {}) {
|
|
|
14579
14580
|
return context.valid;
|
|
14580
14581
|
};
|
|
14581
14582
|
const _removeUnmounted = () => {
|
|
14582
|
-
for (const
|
|
14583
|
-
const field = get2(_fields,
|
|
14584
|
-
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(
|
|
14583
|
+
for (const name of _names.unMount) {
|
|
14584
|
+
const field = get2(_fields, name);
|
|
14585
|
+
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name);
|
|
14585
14586
|
}
|
|
14586
14587
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
14587
14588
|
};
|
|
14588
|
-
const _getDirty = (
|
|
14589
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
14589
14590
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
14590
14591
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
14591
14592
|
}, isGlobal, defaultValue);
|
|
14592
|
-
const _getFieldArray = (
|
|
14593
|
-
const setFieldValue = (
|
|
14594
|
-
const field = get2(_fields,
|
|
14593
|
+
const _getFieldArray = (name) => compact(get2(_state.mount ? _formValues : _defaultValues, name, _options.shouldUnregister ? get2(_defaultValues, name, []) : []));
|
|
14594
|
+
const setFieldValue = (name, value, options2 = {}) => {
|
|
14595
|
+
const field = get2(_fields, name);
|
|
14595
14596
|
let fieldValue = value;
|
|
14596
14597
|
if (field) {
|
|
14597
14598
|
const fieldReference = field._f;
|
|
14598
14599
|
if (fieldReference) {
|
|
14599
|
-
!fieldReference.disabled && set(_formValues,
|
|
14600
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
14600
14601
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
14601
14602
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
14602
14603
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -14620,61 +14621,61 @@ function createFormControl(props = {}) {
|
|
|
14620
14621
|
fieldReference.ref.value = fieldValue;
|
|
14621
14622
|
if (!fieldReference.ref.type) {
|
|
14622
14623
|
_subjects.state.next({
|
|
14623
|
-
name
|
|
14624
|
+
name,
|
|
14624
14625
|
values: cloneObject(_formValues)
|
|
14625
14626
|
});
|
|
14626
14627
|
}
|
|
14627
14628
|
}
|
|
14628
14629
|
}
|
|
14629
14630
|
}
|
|
14630
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
14631
|
-
options2.shouldValidate && trigger(
|
|
14631
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
14632
|
+
options2.shouldValidate && trigger(name);
|
|
14632
14633
|
};
|
|
14633
|
-
const setValues = (
|
|
14634
|
+
const setValues = (name, value, options2) => {
|
|
14634
14635
|
for (const fieldKey in value) {
|
|
14635
14636
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
14636
14637
|
return;
|
|
14637
14638
|
}
|
|
14638
14639
|
const fieldValue = value[fieldKey];
|
|
14639
|
-
const fieldName =
|
|
14640
|
+
const fieldName = name + "." + fieldKey;
|
|
14640
14641
|
const field = get2(_fields, fieldName);
|
|
14641
|
-
(_names.array.has(
|
|
14642
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
14642
14643
|
}
|
|
14643
14644
|
};
|
|
14644
|
-
const setValue = (
|
|
14645
|
-
const field = get2(_fields,
|
|
14646
|
-
const isFieldArray = _names.array.has(
|
|
14645
|
+
const setValue = (name, value, options2 = {}) => {
|
|
14646
|
+
const field = get2(_fields, name);
|
|
14647
|
+
const isFieldArray = _names.array.has(name);
|
|
14647
14648
|
const cloneValue = cloneObject(value);
|
|
14648
|
-
set(_formValues,
|
|
14649
|
+
set(_formValues, name, cloneValue);
|
|
14649
14650
|
if (isFieldArray) {
|
|
14650
14651
|
_subjects.array.next({
|
|
14651
|
-
name
|
|
14652
|
+
name,
|
|
14652
14653
|
values: cloneObject(_formValues)
|
|
14653
14654
|
});
|
|
14654
14655
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
14655
14656
|
_subjects.state.next({
|
|
14656
|
-
name
|
|
14657
|
+
name,
|
|
14657
14658
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
14658
|
-
isDirty: _getDirty(
|
|
14659
|
+
isDirty: _getDirty(name, cloneValue)
|
|
14659
14660
|
});
|
|
14660
14661
|
}
|
|
14661
14662
|
} else {
|
|
14662
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
14663
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
14663
14664
|
}
|
|
14664
|
-
isWatched(
|
|
14665
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
14665
14666
|
_subjects.state.next({
|
|
14666
|
-
name: _state.mount ?
|
|
14667
|
+
name: _state.mount ? name : void 0,
|
|
14667
14668
|
values: cloneObject(_formValues)
|
|
14668
14669
|
});
|
|
14669
14670
|
};
|
|
14670
14671
|
const onChange2 = async (event) => {
|
|
14671
14672
|
_state.mount = true;
|
|
14672
14673
|
const target = event.target;
|
|
14673
|
-
let
|
|
14674
|
+
let name = target.name;
|
|
14674
14675
|
let isFieldValueUpdated = true;
|
|
14675
|
-
const field = get2(_fields,
|
|
14676
|
+
const field = get2(_fields, name);
|
|
14676
14677
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
14677
|
-
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues,
|
|
14678
|
+
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues, name, fieldValue));
|
|
14678
14679
|
};
|
|
14679
14680
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
14680
14681
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -14683,9 +14684,9 @@ function createFormControl(props = {}) {
|
|
|
14683
14684
|
let isValid3;
|
|
14684
14685
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
14685
14686
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
14686
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
14687
|
-
const watched = isWatched(
|
|
14688
|
-
set(_formValues,
|
|
14687
|
+
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get2(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
14688
|
+
const watched = isWatched(name, _names, isBlurEvent);
|
|
14689
|
+
set(_formValues, name, fieldValue);
|
|
14689
14690
|
if (isBlurEvent) {
|
|
14690
14691
|
if (!target || !target.readOnly) {
|
|
14691
14692
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -14694,10 +14695,10 @@ function createFormControl(props = {}) {
|
|
|
14694
14695
|
} else if (field._f.onChange) {
|
|
14695
14696
|
field._f.onChange(event);
|
|
14696
14697
|
}
|
|
14697
|
-
const fieldState = updateTouchAndDirty(
|
|
14698
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
14698
14699
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
14699
14700
|
!isBlurEvent && _subjects.state.next({
|
|
14700
|
-
name
|
|
14701
|
+
name,
|
|
14701
14702
|
type: event.type,
|
|
14702
14703
|
values: cloneObject(_formValues)
|
|
14703
14704
|
});
|
|
@@ -14711,23 +14712,23 @@ function createFormControl(props = {}) {
|
|
|
14711
14712
|
_setValid();
|
|
14712
14713
|
}
|
|
14713
14714
|
}
|
|
14714
|
-
return shouldRender && _subjects.state.next({ name
|
|
14715
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
14715
14716
|
}
|
|
14716
14717
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
14717
14718
|
if (_options.resolver) {
|
|
14718
|
-
const { errors } = await _runSchema([
|
|
14719
|
+
const { errors } = await _runSchema([name]);
|
|
14719
14720
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14720
14721
|
if (isFieldValueUpdated) {
|
|
14721
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
14722
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
14722
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
14723
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
14723
14724
|
error2 = errorLookupResult.error;
|
|
14724
|
-
|
|
14725
|
+
name = errorLookupResult.name;
|
|
14725
14726
|
isValid3 = isEmptyObject(errors);
|
|
14726
14727
|
}
|
|
14727
14728
|
} else {
|
|
14728
|
-
_updateIsValidating([
|
|
14729
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
14730
|
-
_updateIsValidating([
|
|
14729
|
+
_updateIsValidating([name], true);
|
|
14730
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
14731
|
+
_updateIsValidating([name]);
|
|
14731
14732
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14732
14733
|
if (isFieldValueUpdated) {
|
|
14733
14734
|
if (error2) {
|
|
@@ -14739,7 +14740,7 @@ function createFormControl(props = {}) {
|
|
|
14739
14740
|
}
|
|
14740
14741
|
if (isFieldValueUpdated) {
|
|
14741
14742
|
field._f.deps && trigger(field._f.deps);
|
|
14742
|
-
shouldRenderByError(
|
|
14743
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
14743
14744
|
}
|
|
14744
14745
|
}
|
|
14745
14746
|
};
|
|
@@ -14750,15 +14751,15 @@ function createFormControl(props = {}) {
|
|
|
14750
14751
|
}
|
|
14751
14752
|
return;
|
|
14752
14753
|
};
|
|
14753
|
-
const trigger = async (
|
|
14754
|
+
const trigger = async (name, options2 = {}) => {
|
|
14754
14755
|
let isValid3;
|
|
14755
14756
|
let validationResult;
|
|
14756
|
-
const fieldNames = convertToArrayPayload(
|
|
14757
|
+
const fieldNames = convertToArrayPayload(name);
|
|
14757
14758
|
if (_options.resolver) {
|
|
14758
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
14759
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
14759
14760
|
isValid3 = isEmptyObject(errors);
|
|
14760
|
-
validationResult =
|
|
14761
|
-
} else if (
|
|
14761
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
14762
|
+
} else if (name) {
|
|
14762
14763
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
14763
14764
|
const field = get2(_fields, fieldName);
|
|
14764
14765
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -14768,51 +14769,51 @@ function createFormControl(props = {}) {
|
|
|
14768
14769
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
14769
14770
|
}
|
|
14770
14771
|
_subjects.state.next({
|
|
14771
|
-
...!isString3(
|
|
14772
|
-
..._options.resolver || !
|
|
14772
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
14773
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
14773
14774
|
errors: _formState.errors
|
|
14774
14775
|
});
|
|
14775
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
14776
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
14776
14777
|
return validationResult;
|
|
14777
14778
|
};
|
|
14778
14779
|
const getValues = (fieldNames) => {
|
|
14779
14780
|
const values = {
|
|
14780
14781
|
..._state.mount ? _formValues : _defaultValues
|
|
14781
14782
|
};
|
|
14782
|
-
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((
|
|
14783
|
+
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((name) => get2(values, name));
|
|
14783
14784
|
};
|
|
14784
|
-
const getFieldState = (
|
|
14785
|
-
invalid: !!get2((formState || _formState).errors,
|
|
14786
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
14787
|
-
error: get2((formState || _formState).errors,
|
|
14788
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
14789
|
-
isTouched: !!get2((formState || _formState).touchedFields,
|
|
14785
|
+
const getFieldState = (name, formState) => ({
|
|
14786
|
+
invalid: !!get2((formState || _formState).errors, name),
|
|
14787
|
+
isDirty: !!get2((formState || _formState).dirtyFields, name),
|
|
14788
|
+
error: get2((formState || _formState).errors, name),
|
|
14789
|
+
isValidating: !!get2(_formState.validatingFields, name),
|
|
14790
|
+
isTouched: !!get2((formState || _formState).touchedFields, name)
|
|
14790
14791
|
});
|
|
14791
|
-
const clearErrors = (
|
|
14792
|
-
|
|
14792
|
+
const clearErrors = (name) => {
|
|
14793
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
14793
14794
|
_subjects.state.next({
|
|
14794
|
-
errors:
|
|
14795
|
+
errors: name ? _formState.errors : {}
|
|
14795
14796
|
});
|
|
14796
14797
|
};
|
|
14797
|
-
const setError = (
|
|
14798
|
-
const ref = (get2(_fields,
|
|
14799
|
-
const currentError = get2(_formState.errors,
|
|
14798
|
+
const setError = (name, error2, options2) => {
|
|
14799
|
+
const ref = (get2(_fields, name, { _f: {} })._f || {}).ref;
|
|
14800
|
+
const currentError = get2(_formState.errors, name) || {};
|
|
14800
14801
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
14801
|
-
set(_formState.errors,
|
|
14802
|
+
set(_formState.errors, name, {
|
|
14802
14803
|
...restOfErrorTree,
|
|
14803
14804
|
...error2,
|
|
14804
14805
|
ref
|
|
14805
14806
|
});
|
|
14806
14807
|
_subjects.state.next({
|
|
14807
|
-
name
|
|
14808
|
+
name,
|
|
14808
14809
|
errors: _formState.errors,
|
|
14809
14810
|
isValid: false
|
|
14810
14811
|
});
|
|
14811
14812
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
14812
14813
|
};
|
|
14813
|
-
const watch = (
|
|
14814
|
-
next: (payload) => "values" in payload &&
|
|
14815
|
-
}) : _getWatch(
|
|
14814
|
+
const watch = (name, defaultValue) => isFunction(name) ? _subjects.state.subscribe({
|
|
14815
|
+
next: (payload) => "values" in payload && name(_getWatch(void 0, defaultValue), payload)
|
|
14816
|
+
}) : _getWatch(name, defaultValue, true);
|
|
14816
14817
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
14817
14818
|
next: (formState) => {
|
|
14818
14819
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -14836,8 +14837,8 @@ function createFormControl(props = {}) {
|
|
|
14836
14837
|
formState: _proxySubscribeFormState
|
|
14837
14838
|
});
|
|
14838
14839
|
};
|
|
14839
|
-
const unregister = (
|
|
14840
|
-
for (const fieldName of
|
|
14840
|
+
const unregister = (name, options2 = {}) => {
|
|
14841
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
14841
14842
|
_names.mount.delete(fieldName);
|
|
14842
14843
|
_names.array.delete(fieldName);
|
|
14843
14844
|
if (!options2.keepValue) {
|
|
@@ -14859,31 +14860,31 @@ function createFormControl(props = {}) {
|
|
|
14859
14860
|
});
|
|
14860
14861
|
!options2.keepIsValid && _setValid();
|
|
14861
14862
|
};
|
|
14862
|
-
const _setDisabledField = ({ disabled, name
|
|
14863
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
14864
|
-
disabled ? _names.disabled.add(
|
|
14863
|
+
const _setDisabledField = ({ disabled, name }) => {
|
|
14864
|
+
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) {
|
|
14865
|
+
disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
|
|
14865
14866
|
}
|
|
14866
14867
|
};
|
|
14867
|
-
const register = (
|
|
14868
|
-
let field = get2(_fields,
|
|
14868
|
+
const register = (name, options2 = {}) => {
|
|
14869
|
+
let field = get2(_fields, name);
|
|
14869
14870
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
14870
|
-
set(_fields,
|
|
14871
|
+
set(_fields, name, {
|
|
14871
14872
|
...field || {},
|
|
14872
14873
|
_f: {
|
|
14873
|
-
...field && field._f ? field._f : { ref: { name
|
|
14874
|
-
name
|
|
14874
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
14875
|
+
name,
|
|
14875
14876
|
mount: true,
|
|
14876
14877
|
...options2
|
|
14877
14878
|
}
|
|
14878
14879
|
});
|
|
14879
|
-
_names.mount.add(
|
|
14880
|
+
_names.mount.add(name);
|
|
14880
14881
|
if (field) {
|
|
14881
14882
|
_setDisabledField({
|
|
14882
14883
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
14883
|
-
name
|
|
14884
|
+
name
|
|
14884
14885
|
});
|
|
14885
14886
|
} else {
|
|
14886
|
-
updateValidAndValue(
|
|
14887
|
+
updateValidAndValue(name, true, options2.value);
|
|
14887
14888
|
}
|
|
14888
14889
|
return {
|
|
14889
14890
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -14895,39 +14896,39 @@ function createFormControl(props = {}) {
|
|
|
14895
14896
|
maxLength: getRuleValue(options2.maxLength),
|
|
14896
14897
|
pattern: getRuleValue(options2.pattern)
|
|
14897
14898
|
} : {},
|
|
14898
|
-
name
|
|
14899
|
+
name,
|
|
14899
14900
|
onChange: onChange2,
|
|
14900
14901
|
onBlur: onChange2,
|
|
14901
14902
|
ref: (ref) => {
|
|
14902
14903
|
if (ref) {
|
|
14903
|
-
register(
|
|
14904
|
-
field = get2(_fields,
|
|
14904
|
+
register(name, options2);
|
|
14905
|
+
field = get2(_fields, name);
|
|
14905
14906
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
14906
14907
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
14907
14908
|
const refs = field._f.refs || [];
|
|
14908
14909
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
14909
14910
|
return;
|
|
14910
14911
|
}
|
|
14911
|
-
set(_fields,
|
|
14912
|
+
set(_fields, name, {
|
|
14912
14913
|
_f: {
|
|
14913
14914
|
...field._f,
|
|
14914
14915
|
...radioOrCheckbox ? {
|
|
14915
14916
|
refs: [
|
|
14916
14917
|
...refs.filter(live),
|
|
14917
14918
|
fieldRef,
|
|
14918
|
-
...Array.isArray(get2(_defaultValues,
|
|
14919
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
14919
14920
|
],
|
|
14920
|
-
ref: { type: fieldRef.type, name
|
|
14921
|
+
ref: { type: fieldRef.type, name }
|
|
14921
14922
|
} : { ref: fieldRef }
|
|
14922
14923
|
}
|
|
14923
14924
|
});
|
|
14924
|
-
updateValidAndValue(
|
|
14925
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
14925
14926
|
} else {
|
|
14926
|
-
field = get2(_fields,
|
|
14927
|
+
field = get2(_fields, name, {});
|
|
14927
14928
|
if (field._f) {
|
|
14928
14929
|
field._f.mount = false;
|
|
14929
14930
|
}
|
|
14930
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
14931
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
14931
14932
|
}
|
|
14932
14933
|
}
|
|
14933
14934
|
};
|
|
@@ -14936,8 +14937,8 @@ function createFormControl(props = {}) {
|
|
|
14936
14937
|
const _disableForm = (disabled) => {
|
|
14937
14938
|
if (isBoolean(disabled)) {
|
|
14938
14939
|
_subjects.state.next({ disabled });
|
|
14939
|
-
iterateFieldsByAction(_fields, (ref,
|
|
14940
|
-
const currentField = get2(_fields,
|
|
14940
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
14941
|
+
const currentField = get2(_fields, name);
|
|
14941
14942
|
if (currentField) {
|
|
14942
14943
|
ref.disabled = currentField._f.disabled || disabled;
|
|
14943
14944
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -14967,8 +14968,8 @@ function createFormControl(props = {}) {
|
|
|
14967
14968
|
await executeBuiltInValidation(_fields);
|
|
14968
14969
|
}
|
|
14969
14970
|
if (_names.disabled.size) {
|
|
14970
|
-
for (const
|
|
14971
|
-
unset(fieldValues,
|
|
14971
|
+
for (const name of _names.disabled) {
|
|
14972
|
+
unset(fieldValues, name);
|
|
14972
14973
|
}
|
|
14973
14974
|
}
|
|
14974
14975
|
unset(_formState.errors, "root");
|
|
@@ -14999,23 +15000,23 @@ function createFormControl(props = {}) {
|
|
|
14999
15000
|
throw onValidError;
|
|
15000
15001
|
}
|
|
15001
15002
|
};
|
|
15002
|
-
const resetField = (
|
|
15003
|
-
if (get2(_fields,
|
|
15003
|
+
const resetField = (name, options2 = {}) => {
|
|
15004
|
+
if (get2(_fields, name)) {
|
|
15004
15005
|
if (isUndefined(options2.defaultValue)) {
|
|
15005
|
-
setValue(
|
|
15006
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
15006
15007
|
} else {
|
|
15007
|
-
setValue(
|
|
15008
|
-
set(_defaultValues,
|
|
15008
|
+
setValue(name, options2.defaultValue);
|
|
15009
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
15009
15010
|
}
|
|
15010
15011
|
if (!options2.keepTouched) {
|
|
15011
|
-
unset(_formState.touchedFields,
|
|
15012
|
+
unset(_formState.touchedFields, name);
|
|
15012
15013
|
}
|
|
15013
15014
|
if (!options2.keepDirty) {
|
|
15014
|
-
unset(_formState.dirtyFields,
|
|
15015
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
15015
|
+
unset(_formState.dirtyFields, name);
|
|
15016
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
15016
15017
|
}
|
|
15017
15018
|
if (!options2.keepError) {
|
|
15018
|
-
unset(_formState.errors,
|
|
15019
|
+
unset(_formState.errors, name);
|
|
15019
15020
|
_proxyFormState.isValid && _setValid();
|
|
15020
15021
|
}
|
|
15021
15022
|
_subjects.state.next({ ..._formState });
|
|
@@ -15040,8 +15041,8 @@ function createFormControl(props = {}) {
|
|
|
15040
15041
|
}
|
|
15041
15042
|
} else {
|
|
15042
15043
|
if (isWeb && isUndefined(formValues)) {
|
|
15043
|
-
for (const
|
|
15044
|
-
const field = get2(_fields,
|
|
15044
|
+
for (const name of _names.mount) {
|
|
15045
|
+
const field = get2(_fields, name);
|
|
15045
15046
|
if (field && field._f) {
|
|
15046
15047
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
15047
15048
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -15094,8 +15095,8 @@ function createFormControl(props = {}) {
|
|
|
15094
15095
|
});
|
|
15095
15096
|
};
|
|
15096
15097
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
15097
|
-
const setFocus = (
|
|
15098
|
-
const field = get2(_fields,
|
|
15098
|
+
const setFocus = (name, options2 = {}) => {
|
|
15099
|
+
const field = get2(_fields, name);
|
|
15099
15100
|
const fieldReference = field && field._f;
|
|
15100
15101
|
if (fieldReference) {
|
|
15101
15102
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -15411,7 +15412,7 @@ function TextInput(props) {
|
|
|
15411
15412
|
inputWrapperClassName,
|
|
15412
15413
|
label,
|
|
15413
15414
|
placeholder,
|
|
15414
|
-
name
|
|
15415
|
+
name,
|
|
15415
15416
|
type = "text",
|
|
15416
15417
|
register,
|
|
15417
15418
|
errors,
|
|
@@ -15434,7 +15435,7 @@ function TextInput(props) {
|
|
|
15434
15435
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
15435
15436
|
placeholder,
|
|
15436
15437
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
15437
|
-
...register(
|
|
15438
|
+
...register(name)
|
|
15438
15439
|
}
|
|
15439
15440
|
),
|
|
15440
15441
|
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -15448,11 +15449,11 @@ function TextInput(props) {
|
|
|
15448
15449
|
]
|
|
15449
15450
|
}
|
|
15450
15451
|
),
|
|
15451
|
-
errors?.[
|
|
15452
|
+
errors?.[name]?.message && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15452
15453
|
"p",
|
|
15453
15454
|
{
|
|
15454
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
15455
|
-
children: errors?.[
|
|
15455
|
+
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[name] ? "h-4" : "h-0 -mt-1"}`,
|
|
15456
|
+
children: errors?.[name]?.message
|
|
15456
15457
|
}
|
|
15457
15458
|
)
|
|
15458
15459
|
] });
|
|
@@ -16214,7 +16215,7 @@ var ModalLayer = ({
|
|
|
16214
16215
|
// src/widgets/common/modal-confirm.tsx
|
|
16215
16216
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
16216
16217
|
var ModalConfirm = ({
|
|
16217
|
-
name
|
|
16218
|
+
name,
|
|
16218
16219
|
isShowModal,
|
|
16219
16220
|
onClick,
|
|
16220
16221
|
onClose,
|
|
@@ -16223,8 +16224,8 @@ var ModalConfirm = ({
|
|
|
16223
16224
|
isLoading
|
|
16224
16225
|
}) => {
|
|
16225
16226
|
const { t: t3 } = useI18n();
|
|
16226
|
-
const renderButtonAction = (
|
|
16227
|
-
switch (
|
|
16227
|
+
const renderButtonAction = (name2) => {
|
|
16228
|
+
switch (name2) {
|
|
16228
16229
|
case "duplicate":
|
|
16229
16230
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
16230
16231
|
"button",
|
|
@@ -16300,7 +16301,7 @@ var ModalConfirm = ({
|
|
|
16300
16301
|
children: t3("cancel")
|
|
16301
16302
|
}
|
|
16302
16303
|
),
|
|
16303
|
-
renderButtonAction(
|
|
16304
|
+
renderButtonAction(name)
|
|
16304
16305
|
] })
|
|
16305
16306
|
] }) });
|
|
16306
16307
|
};
|
|
@@ -16849,7 +16850,7 @@ var import_react39 = require("react");
|
|
|
16849
16850
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
16850
16851
|
var BinaryField = (props) => {
|
|
16851
16852
|
const {
|
|
16852
|
-
name
|
|
16853
|
+
name,
|
|
16853
16854
|
methods,
|
|
16854
16855
|
readonly = false,
|
|
16855
16856
|
placeholder,
|
|
@@ -16888,7 +16889,7 @@ var BinaryField = (props) => {
|
|
|
16888
16889
|
try {
|
|
16889
16890
|
let type = "application/octet-stream";
|
|
16890
16891
|
let size4 = 0;
|
|
16891
|
-
let
|
|
16892
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16892
16893
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16893
16894
|
type = "image/*";
|
|
16894
16895
|
} else {
|
|
@@ -16901,7 +16902,7 @@ var BinaryField = (props) => {
|
|
|
16901
16902
|
}
|
|
16902
16903
|
}
|
|
16903
16904
|
setFileInfo({
|
|
16904
|
-
name:
|
|
16905
|
+
name: name2,
|
|
16905
16906
|
type,
|
|
16906
16907
|
url: initialFile,
|
|
16907
16908
|
size: size4,
|
|
@@ -16937,13 +16938,13 @@ var BinaryField = (props) => {
|
|
|
16937
16938
|
};
|
|
16938
16939
|
const renderPreview = (file) => {
|
|
16939
16940
|
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PlaceHolderIcon, {});
|
|
16940
|
-
const { name:
|
|
16941
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16941
16942
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16942
16943
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16943
16944
|
"img",
|
|
16944
16945
|
{
|
|
16945
16946
|
src: url,
|
|
16946
|
-
alt:
|
|
16947
|
+
alt: name2,
|
|
16947
16948
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16948
16949
|
style: {
|
|
16949
16950
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16983,7 +16984,7 @@ var BinaryField = (props) => {
|
|
|
16983
16984
|
maxWidth: "120px"
|
|
16984
16985
|
},
|
|
16985
16986
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16986
|
-
children:
|
|
16987
|
+
children: name2
|
|
16987
16988
|
}
|
|
16988
16989
|
),
|
|
16989
16990
|
isShowSize && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16993,7 +16994,7 @@ var BinaryField = (props) => {
|
|
|
16993
16994
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16994
16995
|
Controller,
|
|
16995
16996
|
{
|
|
16996
|
-
name:
|
|
16997
|
+
name: name ?? "",
|
|
16997
16998
|
control: methods?.control,
|
|
16998
16999
|
rules: {
|
|
16999
17000
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17286,7 +17287,7 @@ var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
|
17286
17287
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
17287
17288
|
var CharField = (props) => {
|
|
17288
17289
|
const {
|
|
17289
|
-
name
|
|
17290
|
+
name,
|
|
17290
17291
|
readonly,
|
|
17291
17292
|
placeholder,
|
|
17292
17293
|
required,
|
|
@@ -17317,7 +17318,7 @@ var CharField = (props) => {
|
|
|
17317
17318
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
17318
17319
|
Controller,
|
|
17319
17320
|
{
|
|
17320
|
-
name:
|
|
17321
|
+
name: name ?? "",
|
|
17321
17322
|
control: methods.control,
|
|
17322
17323
|
rules: {
|
|
17323
17324
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -17344,15 +17345,15 @@ var CharField = (props) => {
|
|
|
17344
17345
|
const { setError, clearErrors } = methods;
|
|
17345
17346
|
(0, import_react40.useEffect)(() => {
|
|
17346
17347
|
if (value2) {
|
|
17347
|
-
clearErrors(
|
|
17348
|
+
clearErrors(name);
|
|
17348
17349
|
}
|
|
17349
|
-
}, [value2, clearErrors,
|
|
17350
|
+
}, [value2, clearErrors, name]);
|
|
17350
17351
|
(0, import_react40.useEffect)(() => {
|
|
17351
17352
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
17352
17353
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
17353
|
-
const currentValue = methods?.getValues(
|
|
17354
|
+
const currentValue = methods?.getValues(name);
|
|
17354
17355
|
if (currentValue !== depValue) {
|
|
17355
|
-
methods?.setValue(
|
|
17356
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
17356
17357
|
}
|
|
17357
17358
|
}, [widget, formValues]);
|
|
17358
17359
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -17377,14 +17378,14 @@ var CharField = (props) => {
|
|
|
17377
17378
|
const inputValue = e3.target.value;
|
|
17378
17379
|
if (readonly) return;
|
|
17379
17380
|
fieldOnchange(inputValue);
|
|
17380
|
-
clearErrors(
|
|
17381
|
+
clearErrors(name);
|
|
17381
17382
|
},
|
|
17382
17383
|
onBlur: (e3) => {
|
|
17383
17384
|
if (readonly) return;
|
|
17384
17385
|
const inputValue = e3.target.value || "";
|
|
17385
17386
|
if (widget === "custom_passord") {
|
|
17386
17387
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
17387
|
-
setError(
|
|
17388
|
+
setError(name, {
|
|
17388
17389
|
type: "pattern",
|
|
17389
17390
|
message: getPasswordMessage(
|
|
17390
17391
|
min3,
|
|
@@ -17399,7 +17400,7 @@ var CharField = (props) => {
|
|
|
17399
17400
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
17400
17401
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
17401
17402
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
17402
|
-
setError(
|
|
17403
|
+
setError(name, {
|
|
17403
17404
|
type: "pattern",
|
|
17404
17405
|
message: t3(
|
|
17405
17406
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -17409,14 +17410,14 @@ var CharField = (props) => {
|
|
|
17409
17410
|
}
|
|
17410
17411
|
}
|
|
17411
17412
|
fieldOnchange(inputValue);
|
|
17412
|
-
onChange2 && onChange2(
|
|
17413
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
17413
17414
|
if (!inputValue && required && !invisible) {
|
|
17414
|
-
setError(
|
|
17415
|
+
setError(name, {
|
|
17415
17416
|
type: "required",
|
|
17416
17417
|
message: `${string} ${t3("must_required")}`
|
|
17417
17418
|
});
|
|
17418
17419
|
} else {
|
|
17419
|
-
clearErrors(
|
|
17420
|
+
clearErrors(name);
|
|
17420
17421
|
}
|
|
17421
17422
|
},
|
|
17422
17423
|
readOnly: readonly,
|
|
@@ -17470,14 +17471,14 @@ function EyeIconComponent({ open }) {
|
|
|
17470
17471
|
}
|
|
17471
17472
|
var SecureField = (props) => {
|
|
17472
17473
|
const {
|
|
17473
|
-
name
|
|
17474
|
+
name,
|
|
17474
17475
|
readonly,
|
|
17475
17476
|
placeholder,
|
|
17476
17477
|
required,
|
|
17477
17478
|
invisible,
|
|
17478
17479
|
methods,
|
|
17479
17480
|
onChange: onChange2,
|
|
17480
|
-
string =
|
|
17481
|
+
string = name,
|
|
17481
17482
|
widget,
|
|
17482
17483
|
min: min3,
|
|
17483
17484
|
max: max3,
|
|
@@ -17507,7 +17508,7 @@ var SecureField = (props) => {
|
|
|
17507
17508
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
17508
17509
|
Controller,
|
|
17509
17510
|
{
|
|
17510
|
-
name: String(
|
|
17511
|
+
name: String(name),
|
|
17511
17512
|
control: methods.control,
|
|
17512
17513
|
rules: {
|
|
17513
17514
|
...required && !invisible ? {
|
|
@@ -17541,8 +17542,8 @@ var SecureField = (props) => {
|
|
|
17541
17542
|
if (canToggle) setShowPlain(false);
|
|
17542
17543
|
}, [canToggle]);
|
|
17543
17544
|
(0, import_react41.useEffect)(() => {
|
|
17544
|
-
if (value2) clearErrors(
|
|
17545
|
-
}, [value2, clearErrors,
|
|
17545
|
+
if (value2) clearErrors(name);
|
|
17546
|
+
}, [value2, clearErrors, name]);
|
|
17546
17547
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
17547
17548
|
isCappedToken && shouldMask && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
17548
17549
|
"div",
|
|
@@ -17560,20 +17561,20 @@ var SecureField = (props) => {
|
|
|
17560
17561
|
if (readonly) return;
|
|
17561
17562
|
const inputValue = e3.target.value ?? "";
|
|
17562
17563
|
fieldOnchange(inputValue);
|
|
17563
|
-
clearErrors(
|
|
17564
|
+
clearErrors(name);
|
|
17564
17565
|
},
|
|
17565
17566
|
onBlur: (e3) => {
|
|
17566
17567
|
if (readonly) return;
|
|
17567
17568
|
const inputValue = (e3.target.value ?? "").trim();
|
|
17568
17569
|
if (!inputValue && required && !invisible) {
|
|
17569
|
-
setError(
|
|
17570
|
+
setError(name, {
|
|
17570
17571
|
type: "required",
|
|
17571
17572
|
message: `${string} ${t3("must_required")}`
|
|
17572
17573
|
});
|
|
17573
17574
|
return;
|
|
17574
17575
|
}
|
|
17575
17576
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
17576
|
-
setError(
|
|
17577
|
+
setError(name, {
|
|
17577
17578
|
type: "pattern",
|
|
17578
17579
|
message: getPasswordMessage2(
|
|
17579
17580
|
min3,
|
|
@@ -17586,8 +17587,8 @@ var SecureField = (props) => {
|
|
|
17586
17587
|
return;
|
|
17587
17588
|
}
|
|
17588
17589
|
fieldOnchange(inputValue);
|
|
17589
|
-
onChange2 && onChange2(String(
|
|
17590
|
-
clearErrors(
|
|
17590
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
17591
|
+
clearErrors(name);
|
|
17591
17592
|
},
|
|
17592
17593
|
readOnly: readonly,
|
|
17593
17594
|
disabled: readonly,
|
|
@@ -17631,7 +17632,7 @@ var SecureField = (props) => {
|
|
|
17631
17632
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
17632
17633
|
var CheckboxField = (props) => {
|
|
17633
17634
|
const {
|
|
17634
|
-
name
|
|
17635
|
+
name,
|
|
17635
17636
|
readonly = false,
|
|
17636
17637
|
required = false,
|
|
17637
17638
|
invisible = false,
|
|
@@ -17642,7 +17643,7 @@ var CheckboxField = (props) => {
|
|
|
17642
17643
|
isEditTable = false
|
|
17643
17644
|
} = props;
|
|
17644
17645
|
if (!isForm) {
|
|
17645
|
-
if (
|
|
17646
|
+
if (name === "is_active" || name === "active") {
|
|
17646
17647
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ActiveBadgeField, { type: value });
|
|
17647
17648
|
} else {
|
|
17648
17649
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -17659,7 +17660,7 @@ var CheckboxField = (props) => {
|
|
|
17659
17660
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
17660
17661
|
Controller,
|
|
17661
17662
|
{
|
|
17662
|
-
name:
|
|
17663
|
+
name: name ?? "",
|
|
17663
17664
|
control: methods?.control,
|
|
17664
17665
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
17665
17666
|
"div",
|
|
@@ -17668,10 +17669,10 @@ var CheckboxField = (props) => {
|
|
|
17668
17669
|
onClick: () => {
|
|
17669
17670
|
const checked = !field.value;
|
|
17670
17671
|
if (!isEditTable && readonly) return;
|
|
17671
|
-
methods.setValue(
|
|
17672
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17672
17673
|
field.onChange(checked);
|
|
17673
17674
|
if (onChange2) {
|
|
17674
|
-
onChange2(
|
|
17675
|
+
onChange2(name ?? "", checked);
|
|
17675
17676
|
}
|
|
17676
17677
|
},
|
|
17677
17678
|
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -17681,10 +17682,10 @@ var CheckboxField = (props) => {
|
|
|
17681
17682
|
onChange: (e3) => {
|
|
17682
17683
|
const checked = e3.target.checked;
|
|
17683
17684
|
if (!isEditTable && readonly) return;
|
|
17684
|
-
methods.setValue(
|
|
17685
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17685
17686
|
field.onChange(checked);
|
|
17686
17687
|
if (onChange2) {
|
|
17687
|
-
onChange2(
|
|
17688
|
+
onChange2(name ?? "", checked);
|
|
17688
17689
|
}
|
|
17689
17690
|
},
|
|
17690
17691
|
type: "checkbox",
|
|
@@ -17778,19 +17779,19 @@ var ColorWrapper = (props) => {
|
|
|
17778
17779
|
// src/widgets/basic/color-field/color.tsx
|
|
17779
17780
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
17780
17781
|
var ColorField = (props) => {
|
|
17781
|
-
const { value, isForm, name
|
|
17782
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
17782
17783
|
if (!isForm) {
|
|
17783
17784
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
17784
17785
|
}
|
|
17785
17786
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17786
17787
|
Controller,
|
|
17787
17788
|
{
|
|
17788
|
-
name:
|
|
17789
|
+
name: name ?? "",
|
|
17789
17790
|
control: methods?.control,
|
|
17790
17791
|
render: ({ field }) => {
|
|
17791
17792
|
const handlePickColorChange = (color) => {
|
|
17792
17793
|
field.onChange(color?.id);
|
|
17793
|
-
onChange2 && onChange2(
|
|
17794
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
17794
17795
|
};
|
|
17795
17796
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17796
17797
|
ColorWrapper,
|
|
@@ -17811,7 +17812,7 @@ var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
|
17811
17812
|
var CopyLinkButtonField = (props) => {
|
|
17812
17813
|
const {
|
|
17813
17814
|
isForm,
|
|
17814
|
-
name
|
|
17815
|
+
name,
|
|
17815
17816
|
methods,
|
|
17816
17817
|
onChange: onChange2,
|
|
17817
17818
|
readonly,
|
|
@@ -17833,7 +17834,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17833
17834
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
17834
17835
|
Controller,
|
|
17835
17836
|
{
|
|
17836
|
-
name:
|
|
17837
|
+
name: name ?? "",
|
|
17837
17838
|
control: methods.control,
|
|
17838
17839
|
rules: {
|
|
17839
17840
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17845,7 +17846,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17845
17846
|
const { setError, clearErrors } = methods;
|
|
17846
17847
|
(0, import_react43.useEffect)(() => {
|
|
17847
17848
|
if (value) {
|
|
17848
|
-
clearErrors(
|
|
17849
|
+
clearErrors(name);
|
|
17849
17850
|
}
|
|
17850
17851
|
}, [value]);
|
|
17851
17852
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17863,11 +17864,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17863
17864
|
if (readonly) return;
|
|
17864
17865
|
const newValue = e3.target.value || "";
|
|
17865
17866
|
fieldOnchange(newValue);
|
|
17866
|
-
onChange2 && onChange2(
|
|
17867
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17867
17868
|
if (e3.target.value) {
|
|
17868
|
-
clearErrors(
|
|
17869
|
+
clearErrors(name);
|
|
17869
17870
|
} else if (required && !invisible) {
|
|
17870
|
-
setError(
|
|
17871
|
+
setError(name, {
|
|
17871
17872
|
type: "required",
|
|
17872
17873
|
message: `${string} ${t3("must_required")}`
|
|
17873
17874
|
});
|
|
@@ -17877,9 +17878,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17877
17878
|
if (!readonly) {
|
|
17878
17879
|
fieldOnchange(e3.target.value);
|
|
17879
17880
|
if (e3.target.value) {
|
|
17880
|
-
clearErrors(
|
|
17881
|
+
clearErrors(name);
|
|
17881
17882
|
} else if (required && !invisible) {
|
|
17882
|
-
setError(
|
|
17883
|
+
setError(name, {
|
|
17883
17884
|
type: "required",
|
|
17884
17885
|
message: `${string} ${t3("must_required")}`
|
|
17885
17886
|
});
|
|
@@ -27743,23 +27744,23 @@ var createCache = function createCache2(options2) {
|
|
|
27743
27744
|
};
|
|
27744
27745
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
27745
27746
|
var getRules3 = function getRules4(selector, serialized) {
|
|
27746
|
-
var
|
|
27747
|
-
if (serverStylisCache[
|
|
27748
|
-
serverStylisCache[
|
|
27747
|
+
var name = serialized.name;
|
|
27748
|
+
if (serverStylisCache[name] === void 0) {
|
|
27749
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
27749
27750
|
}
|
|
27750
|
-
return serverStylisCache[
|
|
27751
|
+
return serverStylisCache[name];
|
|
27751
27752
|
};
|
|
27752
27753
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
27753
|
-
var
|
|
27754
|
+
var name = serialized.name;
|
|
27754
27755
|
var rules = getRules3(selector, serialized);
|
|
27755
27756
|
if (cache.compat === void 0) {
|
|
27756
27757
|
if (shouldCache) {
|
|
27757
|
-
cache.inserted[
|
|
27758
|
+
cache.inserted[name] = true;
|
|
27758
27759
|
}
|
|
27759
27760
|
return rules;
|
|
27760
27761
|
} else {
|
|
27761
27762
|
if (shouldCache) {
|
|
27762
|
-
cache.inserted[
|
|
27763
|
+
cache.inserted[name] = rules;
|
|
27763
27764
|
} else {
|
|
27764
27765
|
return rules;
|
|
27765
27766
|
}
|
|
@@ -28082,9 +28083,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
28082
28083
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
28083
28084
|
identifierName += "-" + match3[1];
|
|
28084
28085
|
}
|
|
28085
|
-
var
|
|
28086
|
+
var name = murmur2(styles) + identifierName;
|
|
28086
28087
|
return {
|
|
28087
|
-
name
|
|
28088
|
+
name,
|
|
28088
28089
|
styles,
|
|
28089
28090
|
next: cursor
|
|
28090
28091
|
};
|
|
@@ -28234,10 +28235,10 @@ function css() {
|
|
|
28234
28235
|
}
|
|
28235
28236
|
function keyframes() {
|
|
28236
28237
|
var insertable = css.apply(void 0, arguments);
|
|
28237
|
-
var
|
|
28238
|
+
var name = "animation-" + insertable.name;
|
|
28238
28239
|
return {
|
|
28239
|
-
name
|
|
28240
|
-
styles: "@keyframes " +
|
|
28240
|
+
name,
|
|
28241
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
28241
28242
|
anim: 1,
|
|
28242
28243
|
toString: function toString() {
|
|
28243
28244
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -28269,13 +28270,13 @@ var index3 = isClient3 ? import_react50.useLayoutEffect : noop6;
|
|
|
28269
28270
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
28270
28271
|
var noop8 = function noop9() {
|
|
28271
28272
|
};
|
|
28272
|
-
function applyPrefixToName(prefix2,
|
|
28273
|
-
if (!
|
|
28273
|
+
function applyPrefixToName(prefix2, name) {
|
|
28274
|
+
if (!name) {
|
|
28274
28275
|
return prefix2;
|
|
28275
|
-
} else if (
|
|
28276
|
-
return prefix2 +
|
|
28276
|
+
} else if (name[0] === "-") {
|
|
28277
|
+
return prefix2 + name;
|
|
28277
28278
|
} else {
|
|
28278
|
-
return prefix2 + "__" +
|
|
28279
|
+
return prefix2 + "__" + name;
|
|
28279
28280
|
}
|
|
28280
28281
|
}
|
|
28281
28282
|
function classNames(prefix2, state) {
|
|
@@ -28319,11 +28320,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
28319
28320
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
28320
28321
|
return _objectSpread2({}, innerProps);
|
|
28321
28322
|
};
|
|
28322
|
-
var getStyleProps = function getStyleProps2(props,
|
|
28323
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
28323
28324
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
28324
28325
|
return {
|
|
28325
|
-
css: getStyles(
|
|
28326
|
-
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(
|
|
28326
|
+
css: getStyles(name, props),
|
|
28327
|
+
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className)
|
|
28327
28328
|
};
|
|
28328
28329
|
};
|
|
28329
28330
|
function isDocumentElement(el) {
|
|
@@ -30072,10 +30073,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
30072
30073
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
30073
30074
|
};
|
|
30074
30075
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
30075
|
-
var
|
|
30076
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
30076
30077
|
return jsx86("input", {
|
|
30077
30078
|
required: true,
|
|
30078
|
-
name
|
|
30079
|
+
name,
|
|
30079
30080
|
tabIndex: -1,
|
|
30080
30081
|
"aria-hidden": "true",
|
|
30081
30082
|
onFocus: onFocus2,
|
|
@@ -30401,8 +30402,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30401
30402
|
_this.focus = _this.focusInput;
|
|
30402
30403
|
_this.blur = _this.blurInput;
|
|
30403
30404
|
_this.onChange = function(newValue, actionMeta) {
|
|
30404
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
30405
|
-
actionMeta.name =
|
|
30405
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
30406
|
+
actionMeta.name = name;
|
|
30406
30407
|
_this.ariaOnChange(newValue, actionMeta);
|
|
30407
30408
|
onChange2(newValue, actionMeta);
|
|
30408
30409
|
};
|
|
@@ -30427,7 +30428,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30427
30428
|
});
|
|
30428
30429
|
};
|
|
30429
30430
|
_this.selectOption = function(newValue) {
|
|
30430
|
-
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti,
|
|
30431
|
+
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name;
|
|
30431
30432
|
var selectValue = _this.state.selectValue;
|
|
30432
30433
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
30433
30434
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -30446,7 +30447,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30446
30447
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
30447
30448
|
action: "select-option",
|
|
30448
30449
|
option: newValue,
|
|
30449
|
-
name
|
|
30450
|
+
name
|
|
30450
30451
|
});
|
|
30451
30452
|
return;
|
|
30452
30453
|
}
|
|
@@ -31500,22 +31501,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31500
31501
|
key: "renderFormField",
|
|
31501
31502
|
value: function renderFormField() {
|
|
31502
31503
|
var _this5 = this;
|
|
31503
|
-
var _this$props13 = this.props, delimiter2 = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti,
|
|
31504
|
+
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;
|
|
31504
31505
|
var selectValue = this.state.selectValue;
|
|
31505
31506
|
if (required && !this.hasValue() && !isDisabled) {
|
|
31506
31507
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
31507
|
-
name
|
|
31508
|
+
name,
|
|
31508
31509
|
onFocus: this.onValueInputFocus
|
|
31509
31510
|
});
|
|
31510
31511
|
}
|
|
31511
|
-
if (!
|
|
31512
|
+
if (!name || isDisabled) return;
|
|
31512
31513
|
if (isMulti) {
|
|
31513
31514
|
if (delimiter2) {
|
|
31514
31515
|
var value = selectValue.map(function(opt) {
|
|
31515
31516
|
return _this5.getOptionValue(opt);
|
|
31516
31517
|
}).join(delimiter2);
|
|
31517
31518
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31518
|
-
name
|
|
31519
|
+
name,
|
|
31519
31520
|
type: "hidden",
|
|
31520
31521
|
value
|
|
31521
31522
|
});
|
|
@@ -31523,12 +31524,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31523
31524
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
31524
31525
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31525
31526
|
key: "i-".concat(i3),
|
|
31526
|
-
name
|
|
31527
|
+
name,
|
|
31527
31528
|
type: "hidden",
|
|
31528
31529
|
value: _this5.getOptionValue(opt)
|
|
31529
31530
|
});
|
|
31530
31531
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
31531
|
-
name
|
|
31532
|
+
name,
|
|
31532
31533
|
type: "hidden",
|
|
31533
31534
|
value: ""
|
|
31534
31535
|
});
|
|
@@ -31537,7 +31538,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31537
31538
|
} else {
|
|
31538
31539
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
31539
31540
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31540
|
-
name
|
|
31541
|
+
name,
|
|
31541
31542
|
type: "hidden",
|
|
31542
31543
|
value: _value
|
|
31543
31544
|
});
|
|
@@ -31666,7 +31667,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
31666
31667
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
31667
31668
|
var DateField = (props) => {
|
|
31668
31669
|
const {
|
|
31669
|
-
name
|
|
31670
|
+
name,
|
|
31670
31671
|
value,
|
|
31671
31672
|
readonly,
|
|
31672
31673
|
placeholder = "DD/MM/YYYY",
|
|
@@ -31716,7 +31717,7 @@ var DateField = (props) => {
|
|
|
31716
31717
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
31717
31718
|
Controller,
|
|
31718
31719
|
{
|
|
31719
|
-
name:
|
|
31720
|
+
name: name || "",
|
|
31720
31721
|
control: methods?.control,
|
|
31721
31722
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
31722
31723
|
rules: {
|
|
@@ -31731,9 +31732,9 @@ var DateField = (props) => {
|
|
|
31731
31732
|
const { setError, clearErrors } = methods;
|
|
31732
31733
|
(0, import_react56.useEffect)(() => {
|
|
31733
31734
|
if (value) {
|
|
31734
|
-
clearErrors(
|
|
31735
|
+
clearErrors(name);
|
|
31735
31736
|
}
|
|
31736
|
-
}, [value, clearErrors,
|
|
31737
|
+
}, [value, clearErrors, name]);
|
|
31737
31738
|
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;
|
|
31738
31739
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
31739
31740
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
@@ -31752,7 +31753,7 @@ var DateField = (props) => {
|
|
|
31752
31753
|
adjustedDate.toDate()
|
|
31753
31754
|
);
|
|
31754
31755
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
31755
|
-
setError(
|
|
31756
|
+
setError(name, {
|
|
31756
31757
|
type: "manual",
|
|
31757
31758
|
message: validateCustomResult
|
|
31758
31759
|
});
|
|
@@ -31760,20 +31761,20 @@ var DateField = (props) => {
|
|
|
31760
31761
|
}
|
|
31761
31762
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31762
31763
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
31763
|
-
handleOnchange && handleOnchange(
|
|
31764
|
-
clearErrors(
|
|
31764
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31765
|
+
clearErrors(name);
|
|
31765
31766
|
} else {
|
|
31766
31767
|
field.onChange(null);
|
|
31767
|
-
handleOnchange && handleOnchange(
|
|
31768
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
31768
31769
|
if (required && !invisible) {
|
|
31769
31770
|
if (!isEditTable) {
|
|
31770
|
-
setError(
|
|
31771
|
+
setError(name, {
|
|
31771
31772
|
type: "manual",
|
|
31772
31773
|
message: `${string} ${t3("must_required")}`
|
|
31773
31774
|
});
|
|
31774
31775
|
}
|
|
31775
31776
|
} else {
|
|
31776
|
-
clearErrors(
|
|
31777
|
+
clearErrors(name);
|
|
31777
31778
|
}
|
|
31778
31779
|
}
|
|
31779
31780
|
},
|
|
@@ -31794,7 +31795,7 @@ var DateField = (props) => {
|
|
|
31794
31795
|
}
|
|
31795
31796
|
),
|
|
31796
31797
|
timeInputLabel: textPlaceHolder,
|
|
31797
|
-
portalId:
|
|
31798
|
+
portalId: name,
|
|
31798
31799
|
renderCustomHeader: ({
|
|
31799
31800
|
date,
|
|
31800
31801
|
changeYear,
|
|
@@ -32133,7 +32134,7 @@ var RenderFile = ({
|
|
|
32133
32134
|
};
|
|
32134
32135
|
var FileUploadField = (props) => {
|
|
32135
32136
|
const {
|
|
32136
|
-
name
|
|
32137
|
+
name,
|
|
32137
32138
|
methods,
|
|
32138
32139
|
isForm,
|
|
32139
32140
|
model,
|
|
@@ -32164,7 +32165,7 @@ var FileUploadField = (props) => {
|
|
|
32164
32165
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32165
32166
|
Controller,
|
|
32166
32167
|
{
|
|
32167
|
-
name:
|
|
32168
|
+
name: name || "",
|
|
32168
32169
|
control: methods?.control,
|
|
32169
32170
|
rules: {
|
|
32170
32171
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32230,7 +32231,7 @@ var import_react59 = require("react");
|
|
|
32230
32231
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
32231
32232
|
var FloatField = (props) => {
|
|
32232
32233
|
const {
|
|
32233
|
-
name
|
|
32234
|
+
name,
|
|
32234
32235
|
value: propValue,
|
|
32235
32236
|
readonly,
|
|
32236
32237
|
placeholder,
|
|
@@ -32251,7 +32252,7 @@ var FloatField = (props) => {
|
|
|
32251
32252
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
32252
32253
|
Controller,
|
|
32253
32254
|
{
|
|
32254
|
-
name:
|
|
32255
|
+
name: name ?? "",
|
|
32255
32256
|
control: methods.control,
|
|
32256
32257
|
rules: {
|
|
32257
32258
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32269,14 +32270,14 @@ var FloatField = (props) => {
|
|
|
32269
32270
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
32270
32271
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
32271
32272
|
setInputValue(formatFloatNumber(propValue));
|
|
32272
|
-
clearErrors(
|
|
32273
|
+
clearErrors(name);
|
|
32273
32274
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
32274
32275
|
setInputValue(formatFloatNumber(value));
|
|
32275
|
-
clearErrors(
|
|
32276
|
+
clearErrors(name);
|
|
32276
32277
|
} else if (value === null || value === void 0) {
|
|
32277
32278
|
setInputValue("");
|
|
32278
32279
|
}
|
|
32279
|
-
}, [value,
|
|
32280
|
+
}, [value, name, clearErrors, propValue]);
|
|
32280
32281
|
const handleInputChange = (e3) => {
|
|
32281
32282
|
let newValue = e3.target.value;
|
|
32282
32283
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -32296,7 +32297,7 @@ var FloatField = (props) => {
|
|
|
32296
32297
|
);
|
|
32297
32298
|
if (!isNaN(parsedValue)) {
|
|
32298
32299
|
onChange2(parsedValue);
|
|
32299
|
-
clearErrors(
|
|
32300
|
+
clearErrors(name);
|
|
32300
32301
|
isDirtyRef.current = true;
|
|
32301
32302
|
} else {
|
|
32302
32303
|
onChange2(null);
|
|
@@ -32308,7 +32309,7 @@ var FloatField = (props) => {
|
|
|
32308
32309
|
const parsedValue = parseFloat(rawValue);
|
|
32309
32310
|
if (rawValue === "" || rawValue === ".") {
|
|
32310
32311
|
if (required) {
|
|
32311
|
-
setError(
|
|
32312
|
+
setError(name, {
|
|
32312
32313
|
type: "required",
|
|
32313
32314
|
message: `${string} ${t3("must_required")}`
|
|
32314
32315
|
});
|
|
@@ -32318,7 +32319,7 @@ var FloatField = (props) => {
|
|
|
32318
32319
|
lastCommittedValueRef.current = null;
|
|
32319
32320
|
} else if (!isNaN(parsedValue)) {
|
|
32320
32321
|
if (parsedValue < 0) {
|
|
32321
|
-
setError(
|
|
32322
|
+
setError(name, {
|
|
32322
32323
|
type: "validate",
|
|
32323
32324
|
message: t3("invalid_number")
|
|
32324
32325
|
});
|
|
@@ -32328,12 +32329,12 @@ var FloatField = (props) => {
|
|
|
32328
32329
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
32329
32330
|
setInputValue(formattedValue);
|
|
32330
32331
|
onChange2(parsedValue);
|
|
32331
|
-
handleOnchange?.(
|
|
32332
|
-
clearErrors(
|
|
32332
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
32333
|
+
clearErrors(name);
|
|
32333
32334
|
lastCommittedValueRef.current = parsedValue;
|
|
32334
32335
|
}
|
|
32335
32336
|
} else {
|
|
32336
|
-
setError(
|
|
32337
|
+
setError(name, {
|
|
32337
32338
|
type: "validate",
|
|
32338
32339
|
message: t3("invalid_number")
|
|
32339
32340
|
});
|
|
@@ -32372,7 +32373,7 @@ var import_react60 = require("react");
|
|
|
32372
32373
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
32373
32374
|
var FloatTimeField = (props) => {
|
|
32374
32375
|
const {
|
|
32375
|
-
name
|
|
32376
|
+
name,
|
|
32376
32377
|
methods,
|
|
32377
32378
|
defaultValue = 0,
|
|
32378
32379
|
isForm = true,
|
|
@@ -32390,7 +32391,7 @@ var FloatTimeField = (props) => {
|
|
|
32390
32391
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
32391
32392
|
Controller,
|
|
32392
32393
|
{
|
|
32393
|
-
name:
|
|
32394
|
+
name: name ?? "",
|
|
32394
32395
|
control: methods?.control,
|
|
32395
32396
|
defaultValue,
|
|
32396
32397
|
rules: {
|
|
@@ -32437,13 +32438,13 @@ var FloatTimeField = (props) => {
|
|
|
32437
32438
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
32438
32439
|
fieldOnChange(floatVal);
|
|
32439
32440
|
if (onChange2) {
|
|
32440
|
-
onChange2(
|
|
32441
|
+
onChange2(name ?? "", floatVal);
|
|
32441
32442
|
}
|
|
32442
32443
|
} else {
|
|
32443
32444
|
setInput("00:00");
|
|
32444
32445
|
fieldOnChange(0);
|
|
32445
32446
|
if (onChange2) {
|
|
32446
|
-
onChange2(
|
|
32447
|
+
onChange2(name ?? "", 0);
|
|
32447
32448
|
}
|
|
32448
32449
|
setErrors("");
|
|
32449
32450
|
}
|
|
@@ -32494,7 +32495,7 @@ var import_react61 = require("react");
|
|
|
32494
32495
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
32495
32496
|
var HtmlField = (props) => {
|
|
32496
32497
|
const {
|
|
32497
|
-
name
|
|
32498
|
+
name,
|
|
32498
32499
|
methods,
|
|
32499
32500
|
readonly = false,
|
|
32500
32501
|
isForm = true,
|
|
@@ -32511,7 +32512,7 @@ var HtmlField = (props) => {
|
|
|
32511
32512
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
32512
32513
|
Controller,
|
|
32513
32514
|
{
|
|
32514
|
-
name:
|
|
32515
|
+
name: name ?? "",
|
|
32515
32516
|
control: methods?.control,
|
|
32516
32517
|
defaultValue,
|
|
32517
32518
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -32544,10 +32545,10 @@ var HtmlField = (props) => {
|
|
|
32544
32545
|
// src/widgets/basic/image-field/image.tsx
|
|
32545
32546
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
32546
32547
|
var ImageField = (props) => {
|
|
32547
|
-
const { value, type, name
|
|
32548
|
+
const { value, type, name, baseURL } = props;
|
|
32548
32549
|
if (!value) return null;
|
|
32549
32550
|
if (type === "url") {
|
|
32550
|
-
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt:
|
|
32551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt: name });
|
|
32551
32552
|
}
|
|
32552
32553
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { id: "qr-code", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("img", { src: `data:image/png;base64,${value}`, alt: "QR Code" }) });
|
|
32553
32554
|
};
|
|
@@ -32649,7 +32650,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32649
32650
|
const {
|
|
32650
32651
|
relation,
|
|
32651
32652
|
value,
|
|
32652
|
-
name
|
|
32653
|
+
name,
|
|
32653
32654
|
methods,
|
|
32654
32655
|
required,
|
|
32655
32656
|
invisible,
|
|
@@ -32690,7 +32691,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32690
32691
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32691
32692
|
Controller,
|
|
32692
32693
|
{
|
|
32693
|
-
name:
|
|
32694
|
+
name: name ?? "",
|
|
32694
32695
|
control: methods.control,
|
|
32695
32696
|
rules: {
|
|
32696
32697
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32699,7 +32700,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32699
32700
|
const { clearErrors } = methods;
|
|
32700
32701
|
(0, import_react62.useEffect)(() => {
|
|
32701
32702
|
if (field.value) {
|
|
32702
|
-
clearErrors(
|
|
32703
|
+
clearErrors(name);
|
|
32703
32704
|
}
|
|
32704
32705
|
}, [field.value]);
|
|
32705
32706
|
const filteredValue = (0, import_react62.useMemo)(() => {
|
|
@@ -32719,12 +32720,12 @@ var Many2ManyTagField = (props) => {
|
|
|
32719
32720
|
}, [field?.value, options2]);
|
|
32720
32721
|
const handleChange = (selectedOptions) => {
|
|
32721
32722
|
const newValue = transfer(selectedOptions);
|
|
32722
|
-
methods?.setValue(
|
|
32723
|
-
onChange2?.(
|
|
32724
|
-
clearErrors(
|
|
32723
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
32724
|
+
onChange2?.(name ?? "", newValue);
|
|
32725
|
+
clearErrors(name);
|
|
32725
32726
|
newValue.forEach((item, index4) => {
|
|
32726
32727
|
Object.keys(item).forEach((key) => {
|
|
32727
|
-
methods.setValue(`${
|
|
32728
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
32728
32729
|
shouldDirty: true
|
|
32729
32730
|
});
|
|
32730
32731
|
});
|
|
@@ -32849,7 +32850,7 @@ var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
|
32849
32850
|
var MonetaryField = (props) => {
|
|
32850
32851
|
const { t: t3 } = useI18n();
|
|
32851
32852
|
const {
|
|
32852
|
-
name
|
|
32853
|
+
name,
|
|
32853
32854
|
value,
|
|
32854
32855
|
readonly,
|
|
32855
32856
|
required,
|
|
@@ -32866,7 +32867,7 @@ var MonetaryField = (props) => {
|
|
|
32866
32867
|
symbol = "VND",
|
|
32867
32868
|
baseClassName
|
|
32868
32869
|
} = props;
|
|
32869
|
-
if (isForm &&
|
|
32870
|
+
if (isForm && name === "amount_residual") {
|
|
32870
32871
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex justify-end gap-x-4 gap-y-2 ml-auto mt-2 lg:mt-5", children: [
|
|
32871
32872
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "font-semibold", children: [
|
|
32872
32873
|
string,
|
|
@@ -32883,7 +32884,7 @@ var MonetaryField = (props) => {
|
|
|
32883
32884
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
32884
32885
|
Controller,
|
|
32885
32886
|
{
|
|
32886
|
-
name:
|
|
32887
|
+
name: name ?? "",
|
|
32887
32888
|
control: methods.control,
|
|
32888
32889
|
rules: {
|
|
32889
32890
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32896,7 +32897,7 @@ var MonetaryField = (props) => {
|
|
|
32896
32897
|
const { setError, clearErrors } = methods;
|
|
32897
32898
|
(0, import_react63.useEffect)(() => {
|
|
32898
32899
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32899
|
-
clearErrors(
|
|
32900
|
+
clearErrors(name);
|
|
32900
32901
|
}
|
|
32901
32902
|
}, [value2]);
|
|
32902
32903
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
@@ -32907,18 +32908,18 @@ var MonetaryField = (props) => {
|
|
|
32907
32908
|
onBlur: () => {
|
|
32908
32909
|
if (!readonly && !isNaN(value2)) {
|
|
32909
32910
|
onBlur();
|
|
32910
|
-
handleOnchange && handleOnchange(
|
|
32911
|
-
clearErrors(
|
|
32911
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32912
|
+
clearErrors(name);
|
|
32912
32913
|
}
|
|
32913
32914
|
},
|
|
32914
32915
|
onChange: (e3) => {
|
|
32915
32916
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32916
32917
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32917
32918
|
onChange2(parsedValue);
|
|
32918
|
-
clearErrors(
|
|
32919
|
+
clearErrors(name);
|
|
32919
32920
|
} else {
|
|
32920
32921
|
if (required) {
|
|
32921
|
-
setError(
|
|
32922
|
+
setError(name, {
|
|
32922
32923
|
type: "required",
|
|
32923
32924
|
message: `${string} ${t3("must_required")}`
|
|
32924
32925
|
});
|
|
@@ -33033,9 +33034,11 @@ var PriorityField = (props) => {
|
|
|
33033
33034
|
onChange: onChange2,
|
|
33034
33035
|
id,
|
|
33035
33036
|
viewData,
|
|
33036
|
-
model
|
|
33037
|
+
model,
|
|
33038
|
+
name,
|
|
33039
|
+
string
|
|
33037
33040
|
} = props;
|
|
33038
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
33041
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
33039
33042
|
const defaultPriority = parseInt(value) + 1;
|
|
33040
33043
|
if (!isForm) {
|
|
33041
33044
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
@@ -33079,7 +33082,7 @@ var import_react65 = require("react");
|
|
|
33079
33082
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
33080
33083
|
var RadioGroupField = (props) => {
|
|
33081
33084
|
const {
|
|
33082
|
-
name
|
|
33085
|
+
name,
|
|
33083
33086
|
readonly,
|
|
33084
33087
|
required,
|
|
33085
33088
|
placeholder,
|
|
@@ -33091,14 +33094,14 @@ var RadioGroupField = (props) => {
|
|
|
33091
33094
|
} = props;
|
|
33092
33095
|
(0, import_react65.useEffect)(() => {
|
|
33093
33096
|
if (selection?.length > 0) {
|
|
33094
|
-
if (setValue) setValue(
|
|
33097
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
33095
33098
|
}
|
|
33096
|
-
}, [selection,
|
|
33099
|
+
}, [selection, name, setValue]);
|
|
33097
33100
|
if (!methods) return null;
|
|
33098
33101
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
33099
33102
|
Controller,
|
|
33100
33103
|
{
|
|
33101
|
-
name:
|
|
33104
|
+
name: name ?? "",
|
|
33102
33105
|
control: methods.control,
|
|
33103
33106
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "widget radio-group-widget flex items-center gap-[10px] pb-4", children: selection?.map((select) => /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
33104
33107
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
@@ -33111,8 +33114,8 @@ var RadioGroupField = (props) => {
|
|
|
33111
33114
|
onChange: (e3) => {
|
|
33112
33115
|
if (readonly) return;
|
|
33113
33116
|
field.onChange(e3.target.value);
|
|
33114
|
-
methods.setValue(
|
|
33115
|
-
onChange2?.(
|
|
33117
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
33118
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
33116
33119
|
},
|
|
33117
33120
|
readOnly: readonly,
|
|
33118
33121
|
required: !invisible && required,
|
|
@@ -33164,7 +33167,7 @@ var SelectDropdownField = (props) => {
|
|
|
33164
33167
|
const { t: t3 } = useI18n();
|
|
33165
33168
|
const {
|
|
33166
33169
|
selection,
|
|
33167
|
-
name
|
|
33170
|
+
name,
|
|
33168
33171
|
methods,
|
|
33169
33172
|
value,
|
|
33170
33173
|
readonly,
|
|
@@ -33187,7 +33190,7 @@ var SelectDropdownField = (props) => {
|
|
|
33187
33190
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
33188
33191
|
Controller,
|
|
33189
33192
|
{
|
|
33190
|
-
name:
|
|
33193
|
+
name: name || "",
|
|
33191
33194
|
control: methods.control,
|
|
33192
33195
|
rules: {
|
|
33193
33196
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -33206,7 +33209,7 @@ var SelectDropdownField = (props) => {
|
|
|
33206
33209
|
menuPlacement: "auto",
|
|
33207
33210
|
onChange: (selectedOption) => {
|
|
33208
33211
|
field.onChange(selectedOption.value);
|
|
33209
|
-
onChange2 && onChange2(
|
|
33212
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
33210
33213
|
},
|
|
33211
33214
|
value: defaultValue || null,
|
|
33212
33215
|
required: !invisible && required
|
|
@@ -33287,7 +33290,7 @@ var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
|
33287
33290
|
var TextAreaField = (props) => {
|
|
33288
33291
|
const {
|
|
33289
33292
|
methods,
|
|
33290
|
-
name
|
|
33293
|
+
name,
|
|
33291
33294
|
readonly,
|
|
33292
33295
|
placeholder,
|
|
33293
33296
|
required,
|
|
@@ -33298,7 +33301,7 @@ var TextAreaField = (props) => {
|
|
|
33298
33301
|
onChange: onChange2,
|
|
33299
33302
|
baseClassName
|
|
33300
33303
|
} = props;
|
|
33301
|
-
const formProps = methods ? methods.register(
|
|
33304
|
+
const formProps = methods ? methods.register(name, {
|
|
33302
33305
|
onBlur: (e3) => {
|
|
33303
33306
|
const newValue = e3.target.value;
|
|
33304
33307
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -33320,7 +33323,7 @@ var TextAreaField = (props) => {
|
|
|
33320
33323
|
disabled: readonly,
|
|
33321
33324
|
placeholder,
|
|
33322
33325
|
required: !invisible && required,
|
|
33323
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
33326
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
33324
33327
|
}
|
|
33325
33328
|
);
|
|
33326
33329
|
};
|
|
@@ -33329,7 +33332,7 @@ var TextAreaField = (props) => {
|
|
|
33329
33332
|
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
33330
33333
|
var ToggleButtonField = (props) => {
|
|
33331
33334
|
const {
|
|
33332
|
-
name
|
|
33335
|
+
name,
|
|
33333
33336
|
readonly = false,
|
|
33334
33337
|
required = false,
|
|
33335
33338
|
invisible = false,
|
|
@@ -33339,7 +33342,7 @@ var ToggleButtonField = (props) => {
|
|
|
33339
33342
|
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
33340
33343
|
Controller,
|
|
33341
33344
|
{
|
|
33342
|
-
name:
|
|
33345
|
+
name: name ?? "",
|
|
33343
33346
|
control: methods?.control,
|
|
33344
33347
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "widget toggle-widget inline-flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("label", { className: "relative inline-block w-8 h-5 cursor-pointer", children: [
|
|
33345
33348
|
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
@@ -33349,10 +33352,10 @@ var ToggleButtonField = (props) => {
|
|
|
33349
33352
|
type: "checkbox",
|
|
33350
33353
|
onChange: (e3) => {
|
|
33351
33354
|
if (readonly) return;
|
|
33352
|
-
methods.setValue(
|
|
33355
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
33353
33356
|
field.onChange(e3.target.checked);
|
|
33354
33357
|
if (onChange2) {
|
|
33355
|
-
onChange2(
|
|
33358
|
+
onChange2(name ?? "", e3.target.checked);
|
|
33356
33359
|
}
|
|
33357
33360
|
},
|
|
33358
33361
|
disabled: readonly,
|
|
@@ -33399,7 +33402,7 @@ var import_react66 = require("react");
|
|
|
33399
33402
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
33400
33403
|
var IntegerField = (props) => {
|
|
33401
33404
|
const {
|
|
33402
|
-
name
|
|
33405
|
+
name,
|
|
33403
33406
|
value,
|
|
33404
33407
|
readonly,
|
|
33405
33408
|
placeholder,
|
|
@@ -33421,7 +33424,7 @@ var IntegerField = (props) => {
|
|
|
33421
33424
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
33422
33425
|
Controller,
|
|
33423
33426
|
{
|
|
33424
|
-
name:
|
|
33427
|
+
name: name || "",
|
|
33425
33428
|
control: methods.control,
|
|
33426
33429
|
rules: {
|
|
33427
33430
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -33441,12 +33444,12 @@ var IntegerField = (props) => {
|
|
|
33441
33444
|
(0, import_react66.useEffect)(() => {
|
|
33442
33445
|
if (value2 !== void 0 && value2 !== null) {
|
|
33443
33446
|
setInputValue(String(value2));
|
|
33444
|
-
clearErrors(
|
|
33447
|
+
clearErrors(name);
|
|
33445
33448
|
}
|
|
33446
33449
|
}, [value2]);
|
|
33447
33450
|
const noticeError = () => {
|
|
33448
33451
|
if (required) {
|
|
33449
|
-
setError(
|
|
33452
|
+
setError(name, {
|
|
33450
33453
|
type: "required",
|
|
33451
33454
|
message: `${string} ${t3("must_required")}`
|
|
33452
33455
|
});
|
|
@@ -33464,7 +33467,7 @@ var IntegerField = (props) => {
|
|
|
33464
33467
|
if (!isNaN(parsed)) {
|
|
33465
33468
|
fieldOnChange(parsed);
|
|
33466
33469
|
isDirtyRef.current = true;
|
|
33467
|
-
clearErrors(
|
|
33470
|
+
clearErrors(name);
|
|
33468
33471
|
} else {
|
|
33469
33472
|
noticeError();
|
|
33470
33473
|
}
|
|
@@ -33490,11 +33493,11 @@ var IntegerField = (props) => {
|
|
|
33490
33493
|
return;
|
|
33491
33494
|
}
|
|
33492
33495
|
fieldOnChange(parsed);
|
|
33493
|
-
onChange2?.(
|
|
33496
|
+
onChange2?.(name ?? "", parsed);
|
|
33494
33497
|
lastCommittedValueRef.current = parsed;
|
|
33495
33498
|
isDirtyRef.current = false;
|
|
33496
33499
|
inputRef.current?.blur();
|
|
33497
|
-
clearErrors(
|
|
33500
|
+
clearErrors(name);
|
|
33498
33501
|
};
|
|
33499
33502
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
33500
33503
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
@@ -33903,7 +33906,7 @@ var Many2OneField = (props) => {
|
|
|
33903
33906
|
isForm,
|
|
33904
33907
|
isEditTable,
|
|
33905
33908
|
value: propValue,
|
|
33906
|
-
name
|
|
33909
|
+
name,
|
|
33907
33910
|
readonly,
|
|
33908
33911
|
methods,
|
|
33909
33912
|
required,
|
|
@@ -33930,7 +33933,7 @@ var Many2OneField = (props) => {
|
|
|
33930
33933
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33931
33934
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33932
33935
|
allowShowDetail && renderDetail({
|
|
33933
|
-
idToolTip: String(
|
|
33936
|
+
idToolTip: String(name) + Number(index4),
|
|
33934
33937
|
model: options2?.model ?? relation,
|
|
33935
33938
|
context: contextObject,
|
|
33936
33939
|
idForm: id
|
|
@@ -33939,8 +33942,8 @@ var Many2OneField = (props) => {
|
|
|
33939
33942
|
"span",
|
|
33940
33943
|
{
|
|
33941
33944
|
className: "cursor-pointer",
|
|
33942
|
-
"data-tooltip-id": String(
|
|
33943
|
-
id:
|
|
33945
|
+
"data-tooltip-id": String(name) + index4,
|
|
33946
|
+
id: name,
|
|
33944
33947
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33945
33948
|
}
|
|
33946
33949
|
)
|
|
@@ -33948,21 +33951,21 @@ var Many2OneField = (props) => {
|
|
|
33948
33951
|
}
|
|
33949
33952
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33950
33953
|
allowShowDetail && renderDetail({
|
|
33951
|
-
idToolTip: String(
|
|
33954
|
+
idToolTip: String(name),
|
|
33952
33955
|
model: options2?.model ?? relation,
|
|
33953
33956
|
context: contextObject,
|
|
33954
|
-
idForm: methods?.getValues(
|
|
33957
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33955
33958
|
}),
|
|
33956
33959
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33957
33960
|
"div",
|
|
33958
33961
|
{
|
|
33959
|
-
id:
|
|
33960
|
-
"data-tooltip-id":
|
|
33962
|
+
id: name,
|
|
33963
|
+
"data-tooltip-id": name,
|
|
33961
33964
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33962
33965
|
children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33963
33966
|
Controller,
|
|
33964
33967
|
{
|
|
33965
|
-
name:
|
|
33968
|
+
name: name ?? "",
|
|
33966
33969
|
control: methods?.control,
|
|
33967
33970
|
rules: {
|
|
33968
33971
|
required: required ? {
|
|
@@ -33983,7 +33986,7 @@ var Many2OneField = (props) => {
|
|
|
33983
33986
|
) ?? currentValue : currentValue ?? null;
|
|
33984
33987
|
(0, import_react68.useEffect)(() => {
|
|
33985
33988
|
if (error2 && selectedOption) {
|
|
33986
|
-
methods?.clearErrors(
|
|
33989
|
+
methods?.clearErrors(name);
|
|
33987
33990
|
}
|
|
33988
33991
|
}, [selectedOption]);
|
|
33989
33992
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
@@ -34346,7 +34349,7 @@ var ICCheck = () => {
|
|
|
34346
34349
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
34347
34350
|
var DateOptionField = (props) => {
|
|
34348
34351
|
const {
|
|
34349
|
-
name
|
|
34352
|
+
name,
|
|
34350
34353
|
readonly,
|
|
34351
34354
|
required,
|
|
34352
34355
|
invisible,
|
|
@@ -34357,7 +34360,7 @@ var DateOptionField = (props) => {
|
|
|
34357
34360
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
34358
34361
|
Controller,
|
|
34359
34362
|
{
|
|
34360
|
-
name:
|
|
34363
|
+
name: name ?? "",
|
|
34361
34364
|
control: methods?.control,
|
|
34362
34365
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
|
|
34363
34366
|
"label",
|
|
@@ -34378,9 +34381,9 @@ var DateOptionField = (props) => {
|
|
|
34378
34381
|
onChange: (e3) => {
|
|
34379
34382
|
if (readonly) return;
|
|
34380
34383
|
const value = e3.target.checked;
|
|
34381
|
-
methods.setValue(
|
|
34384
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
34382
34385
|
field.onChange(value);
|
|
34383
|
-
onChange2?.(
|
|
34386
|
+
onChange2?.(name ?? "", value);
|
|
34384
34387
|
}
|
|
34385
34388
|
}
|
|
34386
34389
|
),
|