@fctc/sme-widget-ui 2.6.9 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +502 -495
- package/dist/index.mjs +500 -493
- package/dist/widgets.js +502 -495
- package/dist/widgets.mjs +500 -493
- package/package.json +1 -1
package/dist/index.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 = {
|
|
@@ -10989,6 +10989,10 @@ var Row = (props) => {
|
|
|
10989
10989
|
isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10990
10990
|
"td",
|
|
10991
10991
|
{
|
|
10992
|
+
style: {
|
|
10993
|
+
width: "40px",
|
|
10994
|
+
maxWidth: "40px"
|
|
10995
|
+
},
|
|
10992
10996
|
className: `td-checkbox column w-max whitespace-nowrap p-3 border-b border-gray-200 text-sm font-normal text-gray-900`,
|
|
10993
10997
|
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
10994
10998
|
"input",
|
|
@@ -11480,7 +11484,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11480
11484
|
let resetCount = 0;
|
|
11481
11485
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
11482
11486
|
const {
|
|
11483
|
-
name
|
|
11487
|
+
name,
|
|
11484
11488
|
fn
|
|
11485
11489
|
} = validMiddleware[i3];
|
|
11486
11490
|
const {
|
|
@@ -11506,8 +11510,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
11506
11510
|
y3 = nextY != null ? nextY : y3;
|
|
11507
11511
|
middlewareData = {
|
|
11508
11512
|
...middlewareData,
|
|
11509
|
-
[
|
|
11510
|
-
...middlewareData[
|
|
11513
|
+
[name]: {
|
|
11514
|
+
...middlewareData[name],
|
|
11511
11515
|
...data
|
|
11512
11516
|
}
|
|
11513
11517
|
};
|
|
@@ -13097,7 +13101,8 @@ var TableHead = (props) => {
|
|
|
13097
13101
|
{
|
|
13098
13102
|
style: {
|
|
13099
13103
|
width: "40px",
|
|
13100
|
-
maxWidth: "40px"
|
|
13104
|
+
maxWidth: "40px",
|
|
13105
|
+
overflow: "unset !important"
|
|
13101
13106
|
},
|
|
13102
13107
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
13103
13108
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -13572,8 +13577,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
13572
13577
|
var isObjectType = (value) => typeof value === "object";
|
|
13573
13578
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
13574
13579
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
13575
|
-
var getNodeParentName = (
|
|
13576
|
-
var isNameInFieldArray = (names,
|
|
13580
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
13581
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
13577
13582
|
var isPlainObject = (tempObject) => {
|
|
13578
13583
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
13579
13584
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -13677,7 +13682,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
13677
13682
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react17.default.useLayoutEffect : import_react17.default.useEffect;
|
|
13678
13683
|
function useFormState(props) {
|
|
13679
13684
|
const methods = useFormContext();
|
|
13680
|
-
const { control = methods.control, disabled, name
|
|
13685
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
13681
13686
|
const [formState, updateFormState] = import_react17.default.useState(control._formState);
|
|
13682
13687
|
const _localProxyFormState = import_react17.default.useRef({
|
|
13683
13688
|
isDirty: false,
|
|
@@ -13690,7 +13695,7 @@ function useFormState(props) {
|
|
|
13690
13695
|
errors: false
|
|
13691
13696
|
});
|
|
13692
13697
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13693
|
-
name
|
|
13698
|
+
name,
|
|
13694
13699
|
formState: _localProxyFormState.current,
|
|
13695
13700
|
exact,
|
|
13696
13701
|
callback: (formState2) => {
|
|
@@ -13699,7 +13704,7 @@ function useFormState(props) {
|
|
|
13699
13704
|
...formState2
|
|
13700
13705
|
});
|
|
13701
13706
|
}
|
|
13702
|
-
}), [
|
|
13707
|
+
}), [name, disabled, exact]);
|
|
13703
13708
|
import_react17.default.useEffect(() => {
|
|
13704
13709
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
13705
13710
|
}, [control]);
|
|
@@ -13751,22 +13756,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
13751
13756
|
}
|
|
13752
13757
|
function useWatch(props) {
|
|
13753
13758
|
const methods = useFormContext();
|
|
13754
|
-
const { control = methods.control, name
|
|
13759
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
13755
13760
|
const _defaultValue = import_react17.default.useRef(defaultValue);
|
|
13756
13761
|
const _compute = import_react17.default.useRef(compute);
|
|
13757
13762
|
const _computeFormValues = import_react17.default.useRef(void 0);
|
|
13758
13763
|
_compute.current = compute;
|
|
13759
|
-
const defaultValueMemo = import_react17.default.useMemo(() => control._getWatch(
|
|
13764
|
+
const defaultValueMemo = import_react17.default.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
13760
13765
|
const [value, updateValue] = import_react17.default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
13761
13766
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
13762
|
-
name
|
|
13767
|
+
name,
|
|
13763
13768
|
formState: {
|
|
13764
13769
|
values: true
|
|
13765
13770
|
},
|
|
13766
13771
|
exact,
|
|
13767
13772
|
callback: (formState) => {
|
|
13768
13773
|
if (!disabled) {
|
|
13769
|
-
const formValues = generateWatchOutput(
|
|
13774
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
13770
13775
|
if (_compute.current) {
|
|
13771
13776
|
const computedFormValues = _compute.current(formValues);
|
|
13772
13777
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -13778,28 +13783,28 @@ function useWatch(props) {
|
|
|
13778
13783
|
}
|
|
13779
13784
|
}
|
|
13780
13785
|
}
|
|
13781
|
-
}), [control, disabled,
|
|
13786
|
+
}), [control, disabled, name, exact]);
|
|
13782
13787
|
import_react17.default.useEffect(() => control._removeUnmounted());
|
|
13783
13788
|
return value;
|
|
13784
13789
|
}
|
|
13785
13790
|
function useController(props) {
|
|
13786
13791
|
const methods = useFormContext();
|
|
13787
|
-
const { name
|
|
13788
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
13789
|
-
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]);
|
|
13790
13795
|
const value = useWatch({
|
|
13791
13796
|
control,
|
|
13792
|
-
name
|
|
13797
|
+
name,
|
|
13793
13798
|
defaultValue: defaultValueMemo,
|
|
13794
13799
|
exact: true
|
|
13795
13800
|
});
|
|
13796
13801
|
const formState = useFormState({
|
|
13797
13802
|
control,
|
|
13798
|
-
name
|
|
13803
|
+
name,
|
|
13799
13804
|
exact: true
|
|
13800
13805
|
});
|
|
13801
13806
|
const _props = import_react17.default.useRef(props);
|
|
13802
|
-
const _registerProps = import_react17.default.useRef(control.register(
|
|
13807
|
+
const _registerProps = import_react17.default.useRef(control.register(name, {
|
|
13803
13808
|
...props.rules,
|
|
13804
13809
|
value,
|
|
13805
13810
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -13808,41 +13813,41 @@ function useController(props) {
|
|
|
13808
13813
|
const fieldState = import_react17.default.useMemo(() => Object.defineProperties({}, {
|
|
13809
13814
|
invalid: {
|
|
13810
13815
|
enumerable: true,
|
|
13811
|
-
get: () => !!get2(formState.errors,
|
|
13816
|
+
get: () => !!get2(formState.errors, name)
|
|
13812
13817
|
},
|
|
13813
13818
|
isDirty: {
|
|
13814
13819
|
enumerable: true,
|
|
13815
|
-
get: () => !!get2(formState.dirtyFields,
|
|
13820
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
13816
13821
|
},
|
|
13817
13822
|
isTouched: {
|
|
13818
13823
|
enumerable: true,
|
|
13819
|
-
get: () => !!get2(formState.touchedFields,
|
|
13824
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
13820
13825
|
},
|
|
13821
13826
|
isValidating: {
|
|
13822
13827
|
enumerable: true,
|
|
13823
|
-
get: () => !!get2(formState.validatingFields,
|
|
13828
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
13824
13829
|
},
|
|
13825
13830
|
error: {
|
|
13826
13831
|
enumerable: true,
|
|
13827
|
-
get: () => get2(formState.errors,
|
|
13832
|
+
get: () => get2(formState.errors, name)
|
|
13828
13833
|
}
|
|
13829
|
-
}), [formState,
|
|
13834
|
+
}), [formState, name]);
|
|
13830
13835
|
const onChange2 = import_react17.default.useCallback((event) => _registerProps.current.onChange({
|
|
13831
13836
|
target: {
|
|
13832
13837
|
value: getEventValue(event),
|
|
13833
|
-
name
|
|
13838
|
+
name
|
|
13834
13839
|
},
|
|
13835
13840
|
type: EVENTS.CHANGE
|
|
13836
|
-
}), [
|
|
13841
|
+
}), [name]);
|
|
13837
13842
|
const onBlur = import_react17.default.useCallback(() => _registerProps.current.onBlur({
|
|
13838
13843
|
target: {
|
|
13839
|
-
value: get2(control._formValues,
|
|
13840
|
-
name
|
|
13844
|
+
value: get2(control._formValues, name),
|
|
13845
|
+
name
|
|
13841
13846
|
},
|
|
13842
13847
|
type: EVENTS.BLUR
|
|
13843
|
-
}), [
|
|
13848
|
+
}), [name, control._formValues]);
|
|
13844
13849
|
const ref = import_react17.default.useCallback((elm) => {
|
|
13845
|
-
const field2 = get2(control._fields,
|
|
13850
|
+
const field2 = get2(control._fields, name);
|
|
13846
13851
|
if (field2 && elm) {
|
|
13847
13852
|
field2._f.ref = {
|
|
13848
13853
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -13851,46 +13856,46 @@ function useController(props) {
|
|
|
13851
13856
|
reportValidity: () => elm.reportValidity()
|
|
13852
13857
|
};
|
|
13853
13858
|
}
|
|
13854
|
-
}, [control._fields,
|
|
13859
|
+
}, [control._fields, name]);
|
|
13855
13860
|
const field = import_react17.default.useMemo(() => ({
|
|
13856
|
-
name
|
|
13861
|
+
name,
|
|
13857
13862
|
value,
|
|
13858
13863
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
13859
13864
|
onChange: onChange2,
|
|
13860
13865
|
onBlur,
|
|
13861
13866
|
ref
|
|
13862
|
-
}), [
|
|
13867
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
13863
13868
|
import_react17.default.useEffect(() => {
|
|
13864
13869
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
13865
|
-
control.register(
|
|
13870
|
+
control.register(name, {
|
|
13866
13871
|
..._props.current.rules,
|
|
13867
13872
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
13868
13873
|
});
|
|
13869
|
-
const updateMounted = (
|
|
13870
|
-
const field2 = get2(control._fields,
|
|
13874
|
+
const updateMounted = (name2, value2) => {
|
|
13875
|
+
const field2 = get2(control._fields, name2);
|
|
13871
13876
|
if (field2 && field2._f) {
|
|
13872
13877
|
field2._f.mount = value2;
|
|
13873
13878
|
}
|
|
13874
13879
|
};
|
|
13875
|
-
updateMounted(
|
|
13880
|
+
updateMounted(name, true);
|
|
13876
13881
|
if (_shouldUnregisterField) {
|
|
13877
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
13878
|
-
set(control._defaultValues,
|
|
13879
|
-
if (isUndefined(get2(control._formValues,
|
|
13880
|
-
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);
|
|
13881
13886
|
}
|
|
13882
13887
|
}
|
|
13883
|
-
!isArrayField && control.register(
|
|
13888
|
+
!isArrayField && control.register(name);
|
|
13884
13889
|
return () => {
|
|
13885
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
13890
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
13886
13891
|
};
|
|
13887
|
-
}, [
|
|
13892
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
13888
13893
|
import_react17.default.useEffect(() => {
|
|
13889
13894
|
control._setDisabledField({
|
|
13890
13895
|
disabled,
|
|
13891
|
-
name
|
|
13896
|
+
name
|
|
13892
13897
|
});
|
|
13893
|
-
}, [disabled,
|
|
13898
|
+
}, [disabled, name, control]);
|
|
13894
13899
|
return import_react17.default.useMemo(() => ({
|
|
13895
13900
|
field,
|
|
13896
13901
|
formState,
|
|
@@ -13898,10 +13903,10 @@ function useController(props) {
|
|
|
13898
13903
|
}), [field, formState, fieldState]);
|
|
13899
13904
|
}
|
|
13900
13905
|
var Controller = (props) => props.render(useController(props));
|
|
13901
|
-
var appendErrors = (
|
|
13902
|
-
...errors[
|
|
13906
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
13907
|
+
...errors[name],
|
|
13903
13908
|
types: {
|
|
13904
|
-
...errors[
|
|
13909
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
13905
13910
|
[type]: message2 || true
|
|
13906
13911
|
}
|
|
13907
13912
|
} : {};
|
|
@@ -14061,9 +14066,9 @@ function getFieldValue(_f) {
|
|
|
14061
14066
|
}
|
|
14062
14067
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
14063
14068
|
const fields = {};
|
|
14064
|
-
for (const
|
|
14065
|
-
const field = get2(_fields,
|
|
14066
|
-
field && set(fields,
|
|
14069
|
+
for (const name of fieldsNames) {
|
|
14070
|
+
const field = get2(_fields, name);
|
|
14071
|
+
field && set(fields, name, field._f);
|
|
14067
14072
|
}
|
|
14068
14073
|
return {
|
|
14069
14074
|
criteriaMode,
|
|
@@ -14084,7 +14089,7 @@ var getValidationModes = (mode) => ({
|
|
|
14084
14089
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
14085
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));
|
|
14086
14091
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
14087
|
-
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))));
|
|
14088
14093
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
14089
14094
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
14090
14095
|
const field = get2(fields, key);
|
|
@@ -14109,21 +14114,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
14109
14114
|
}
|
|
14110
14115
|
return;
|
|
14111
14116
|
};
|
|
14112
|
-
function schemaErrorLookup(errors, _fields,
|
|
14113
|
-
const error2 = get2(errors,
|
|
14114
|
-
if (error2 || isKey(
|
|
14117
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
14118
|
+
const error2 = get2(errors, name);
|
|
14119
|
+
if (error2 || isKey(name)) {
|
|
14115
14120
|
return {
|
|
14116
14121
|
error: error2,
|
|
14117
|
-
name
|
|
14122
|
+
name
|
|
14118
14123
|
};
|
|
14119
14124
|
}
|
|
14120
|
-
const names =
|
|
14125
|
+
const names = name.split(".");
|
|
14121
14126
|
while (names.length) {
|
|
14122
14127
|
const fieldName = names.join(".");
|
|
14123
14128
|
const field = get2(_fields, fieldName);
|
|
14124
14129
|
const foundError = get2(errors, fieldName);
|
|
14125
|
-
if (field && !Array.isArray(field) &&
|
|
14126
|
-
return { name
|
|
14130
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
14131
|
+
return { name };
|
|
14127
14132
|
}
|
|
14128
14133
|
if (foundError && foundError.type) {
|
|
14129
14134
|
return {
|
|
@@ -14140,15 +14145,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
14140
14145
|
names.pop();
|
|
14141
14146
|
}
|
|
14142
14147
|
return {
|
|
14143
|
-
name
|
|
14148
|
+
name
|
|
14144
14149
|
};
|
|
14145
14150
|
}
|
|
14146
14151
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
14147
14152
|
updateFormState(formStateData);
|
|
14148
|
-
const { name
|
|
14153
|
+
const { name, ...formState } = formStateData;
|
|
14149
14154
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
14150
14155
|
};
|
|
14151
|
-
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)));
|
|
14152
14157
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
14153
14158
|
if (mode.isOnAll) {
|
|
14154
14159
|
return false;
|
|
@@ -14161,11 +14166,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
14161
14166
|
}
|
|
14162
14167
|
return true;
|
|
14163
14168
|
};
|
|
14164
|
-
var unsetEmptyArray = (ref,
|
|
14165
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
14166
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
14167
|
-
set(fieldArrayErrors, "root", error2[
|
|
14168
|
-
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);
|
|
14169
14174
|
return errors;
|
|
14170
14175
|
};
|
|
14171
14176
|
var isMessage = (value) => isString3(value);
|
|
@@ -14183,9 +14188,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
14183
14188
|
message: ""
|
|
14184
14189
|
};
|
|
14185
14190
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
14186
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
14187
|
-
const inputValue = get2(formValues,
|
|
14188
|
-
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)) {
|
|
14189
14194
|
return {};
|
|
14190
14195
|
}
|
|
14191
14196
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -14200,10 +14205,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14200
14205
|
const isCheckBox = isCheckBoxInput(ref);
|
|
14201
14206
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
14202
14207
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
14203
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
14208
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
14204
14209
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
14205
14210
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
14206
|
-
error2[
|
|
14211
|
+
error2[name] = {
|
|
14207
14212
|
type: exceedMax ? maxType : minType,
|
|
14208
14213
|
message: message2,
|
|
14209
14214
|
ref,
|
|
@@ -14213,7 +14218,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14213
14218
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
14214
14219
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
14215
14220
|
if (value) {
|
|
14216
|
-
error2[
|
|
14221
|
+
error2[name] = {
|
|
14217
14222
|
type: INPUT_VALIDATION_RULES.required,
|
|
14218
14223
|
message: message2,
|
|
14219
14224
|
ref: inputRef,
|
|
@@ -14253,7 +14258,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14253
14258
|
if (exceedMax || exceedMin) {
|
|
14254
14259
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
14255
14260
|
if (!validateAllFieldCriteria) {
|
|
14256
|
-
setCustomValidity(error2[
|
|
14261
|
+
setCustomValidity(error2[name].message);
|
|
14257
14262
|
return error2;
|
|
14258
14263
|
}
|
|
14259
14264
|
}
|
|
@@ -14266,7 +14271,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14266
14271
|
if (exceedMax || exceedMin) {
|
|
14267
14272
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
14268
14273
|
if (!validateAllFieldCriteria) {
|
|
14269
|
-
setCustomValidity(error2[
|
|
14274
|
+
setCustomValidity(error2[name].message);
|
|
14270
14275
|
return error2;
|
|
14271
14276
|
}
|
|
14272
14277
|
}
|
|
@@ -14274,7 +14279,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14274
14279
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
14275
14280
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
14276
14281
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
14277
|
-
error2[
|
|
14282
|
+
error2[name] = {
|
|
14278
14283
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
14279
14284
|
message: message2,
|
|
14280
14285
|
ref,
|
|
@@ -14291,7 +14296,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14291
14296
|
const result = await validate(inputValue, formValues);
|
|
14292
14297
|
const validateError = getValidateError(result, inputRef);
|
|
14293
14298
|
if (validateError) {
|
|
14294
|
-
error2[
|
|
14299
|
+
error2[name] = {
|
|
14295
14300
|
...validateError,
|
|
14296
14301
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
14297
14302
|
};
|
|
@@ -14314,12 +14319,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14314
14319
|
};
|
|
14315
14320
|
setCustomValidity(validateError.message);
|
|
14316
14321
|
if (validateAllFieldCriteria) {
|
|
14317
|
-
error2[
|
|
14322
|
+
error2[name] = validationResult;
|
|
14318
14323
|
}
|
|
14319
14324
|
}
|
|
14320
14325
|
}
|
|
14321
14326
|
if (!isEmptyObject(validationResult)) {
|
|
14322
|
-
error2[
|
|
14327
|
+
error2[name] = {
|
|
14323
14328
|
ref: inputRef,
|
|
14324
14329
|
...validationResult
|
|
14325
14330
|
};
|
|
@@ -14408,9 +14413,9 @@ function createFormControl(props = {}) {
|
|
|
14408
14413
|
};
|
|
14409
14414
|
const _updateIsValidating = (names, isValidating) => {
|
|
14410
14415
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
14411
|
-
(names || Array.from(_names.mount)).forEach((
|
|
14412
|
-
if (
|
|
14413
|
-
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);
|
|
14414
14419
|
}
|
|
14415
14420
|
});
|
|
14416
14421
|
_subjects.state.next({
|
|
@@ -14419,38 +14424,38 @@ function createFormControl(props = {}) {
|
|
|
14419
14424
|
});
|
|
14420
14425
|
}
|
|
14421
14426
|
};
|
|
14422
|
-
const _setFieldArray = (
|
|
14427
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
14423
14428
|
if (args && method && !_options.disabled) {
|
|
14424
14429
|
_state.action = true;
|
|
14425
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
14426
|
-
const fieldValues = method(get2(_fields,
|
|
14427
|
-
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);
|
|
14428
14433
|
}
|
|
14429
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
14430
|
-
const errors = method(get2(_formState.errors,
|
|
14431
|
-
shouldSetValues && set(_formState.errors,
|
|
14432
|
-
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);
|
|
14433
14438
|
}
|
|
14434
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
14435
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
14436
|
-
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);
|
|
14437
14442
|
}
|
|
14438
14443
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
14439
14444
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
14440
14445
|
}
|
|
14441
14446
|
_subjects.state.next({
|
|
14442
|
-
name
|
|
14443
|
-
isDirty: _getDirty(
|
|
14447
|
+
name,
|
|
14448
|
+
isDirty: _getDirty(name, values),
|
|
14444
14449
|
dirtyFields: _formState.dirtyFields,
|
|
14445
14450
|
errors: _formState.errors,
|
|
14446
14451
|
isValid: _formState.isValid
|
|
14447
14452
|
});
|
|
14448
14453
|
} else {
|
|
14449
|
-
set(_formValues,
|
|
14454
|
+
set(_formValues, name, values);
|
|
14450
14455
|
}
|
|
14451
14456
|
};
|
|
14452
|
-
const updateErrors = (
|
|
14453
|
-
set(_formState.errors,
|
|
14457
|
+
const updateErrors = (name, error2) => {
|
|
14458
|
+
set(_formState.errors, name, error2);
|
|
14454
14459
|
_subjects.state.next({
|
|
14455
14460
|
errors: _formState.errors
|
|
14456
14461
|
});
|
|
@@ -14462,19 +14467,19 @@ function createFormControl(props = {}) {
|
|
|
14462
14467
|
isValid: false
|
|
14463
14468
|
});
|
|
14464
14469
|
};
|
|
14465
|
-
const updateValidAndValue = (
|
|
14466
|
-
const field = get2(_fields,
|
|
14470
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
14471
|
+
const field = get2(_fields, name);
|
|
14467
14472
|
if (field) {
|
|
14468
|
-
const defaultValue = get2(_formValues,
|
|
14469
|
-
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);
|
|
14470
14475
|
_state.mount && _setValid();
|
|
14471
14476
|
}
|
|
14472
14477
|
};
|
|
14473
|
-
const updateTouchAndDirty = (
|
|
14478
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
14474
14479
|
let shouldUpdateField = false;
|
|
14475
14480
|
let isPreviousDirty = false;
|
|
14476
14481
|
const output = {
|
|
14477
|
-
name
|
|
14482
|
+
name
|
|
14478
14483
|
};
|
|
14479
14484
|
if (!_options.disabled) {
|
|
14480
14485
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -14483,16 +14488,16 @@ function createFormControl(props = {}) {
|
|
|
14483
14488
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
14484
14489
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
14485
14490
|
}
|
|
14486
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
14487
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
14488
|
-
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);
|
|
14489
14494
|
output.dirtyFields = _formState.dirtyFields;
|
|
14490
14495
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
14491
14496
|
}
|
|
14492
14497
|
if (isBlurEvent) {
|
|
14493
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
14498
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
14494
14499
|
if (!isPreviousFieldTouched) {
|
|
14495
|
-
set(_formState.touchedFields,
|
|
14500
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
14496
14501
|
output.touchedFields = _formState.touchedFields;
|
|
14497
14502
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
14498
14503
|
}
|
|
@@ -14501,23 +14506,23 @@ function createFormControl(props = {}) {
|
|
|
14501
14506
|
}
|
|
14502
14507
|
return shouldUpdateField ? output : {};
|
|
14503
14508
|
};
|
|
14504
|
-
const shouldRenderByError = (
|
|
14505
|
-
const previousFieldError = get2(_formState.errors,
|
|
14509
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
14510
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
14506
14511
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
14507
14512
|
if (_options.delayError && error2) {
|
|
14508
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
14513
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
14509
14514
|
delayErrorCallback(_options.delayError);
|
|
14510
14515
|
} else {
|
|
14511
14516
|
clearTimeout(timer);
|
|
14512
14517
|
delayErrorCallback = null;
|
|
14513
|
-
error2 ? set(_formState.errors,
|
|
14518
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
14514
14519
|
}
|
|
14515
14520
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
14516
14521
|
const updatedFormState = {
|
|
14517
14522
|
...fieldState,
|
|
14518
14523
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
14519
14524
|
errors: _formState.errors,
|
|
14520
|
-
name
|
|
14525
|
+
name
|
|
14521
14526
|
};
|
|
14522
14527
|
_formState = {
|
|
14523
14528
|
..._formState,
|
|
@@ -14526,18 +14531,18 @@ function createFormControl(props = {}) {
|
|
|
14526
14531
|
_subjects.state.next(updatedFormState);
|
|
14527
14532
|
}
|
|
14528
14533
|
};
|
|
14529
|
-
const _runSchema = async (
|
|
14530
|
-
_updateIsValidating(
|
|
14531
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
14532
|
-
_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);
|
|
14533
14538
|
return result;
|
|
14534
14539
|
};
|
|
14535
14540
|
const executeSchemaAndUpdateState = async (names) => {
|
|
14536
14541
|
const { errors } = await _runSchema(names);
|
|
14537
14542
|
if (names) {
|
|
14538
|
-
for (const
|
|
14539
|
-
const error2 = get2(errors,
|
|
14540
|
-
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);
|
|
14541
14546
|
}
|
|
14542
14547
|
} else {
|
|
14543
14548
|
_formState.errors = errors;
|
|
@@ -14547,19 +14552,19 @@ function createFormControl(props = {}) {
|
|
|
14547
14552
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
14548
14553
|
valid: true
|
|
14549
14554
|
}) => {
|
|
14550
|
-
for (const
|
|
14551
|
-
const field = fields[
|
|
14555
|
+
for (const name in fields) {
|
|
14556
|
+
const field = fields[name];
|
|
14552
14557
|
if (field) {
|
|
14553
14558
|
const { _f, ...fieldValue } = field;
|
|
14554
14559
|
if (_f) {
|
|
14555
14560
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
14556
14561
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
14557
14562
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14558
|
-
_updateIsValidating([
|
|
14563
|
+
_updateIsValidating([name], true);
|
|
14559
14564
|
}
|
|
14560
14565
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
14561
14566
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
14562
|
-
_updateIsValidating([
|
|
14567
|
+
_updateIsValidating([name]);
|
|
14563
14568
|
}
|
|
14564
14569
|
if (fieldError[_f.name]) {
|
|
14565
14570
|
context.valid = false;
|
|
@@ -14575,24 +14580,24 @@ function createFormControl(props = {}) {
|
|
|
14575
14580
|
return context.valid;
|
|
14576
14581
|
};
|
|
14577
14582
|
const _removeUnmounted = () => {
|
|
14578
|
-
for (const
|
|
14579
|
-
const field = get2(_fields,
|
|
14580
|
-
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);
|
|
14581
14586
|
}
|
|
14582
14587
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
14583
14588
|
};
|
|
14584
|
-
const _getDirty = (
|
|
14589
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
14585
14590
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
14586
14591
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
14587
14592
|
}, isGlobal, defaultValue);
|
|
14588
|
-
const _getFieldArray = (
|
|
14589
|
-
const setFieldValue = (
|
|
14590
|
-
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);
|
|
14591
14596
|
let fieldValue = value;
|
|
14592
14597
|
if (field) {
|
|
14593
14598
|
const fieldReference = field._f;
|
|
14594
14599
|
if (fieldReference) {
|
|
14595
|
-
!fieldReference.disabled && set(_formValues,
|
|
14600
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
14596
14601
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
14597
14602
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
14598
14603
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -14616,61 +14621,61 @@ function createFormControl(props = {}) {
|
|
|
14616
14621
|
fieldReference.ref.value = fieldValue;
|
|
14617
14622
|
if (!fieldReference.ref.type) {
|
|
14618
14623
|
_subjects.state.next({
|
|
14619
|
-
name
|
|
14624
|
+
name,
|
|
14620
14625
|
values: cloneObject(_formValues)
|
|
14621
14626
|
});
|
|
14622
14627
|
}
|
|
14623
14628
|
}
|
|
14624
14629
|
}
|
|
14625
14630
|
}
|
|
14626
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
14627
|
-
options2.shouldValidate && trigger(
|
|
14631
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
14632
|
+
options2.shouldValidate && trigger(name);
|
|
14628
14633
|
};
|
|
14629
|
-
const setValues = (
|
|
14634
|
+
const setValues = (name, value, options2) => {
|
|
14630
14635
|
for (const fieldKey in value) {
|
|
14631
14636
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
14632
14637
|
return;
|
|
14633
14638
|
}
|
|
14634
14639
|
const fieldValue = value[fieldKey];
|
|
14635
|
-
const fieldName =
|
|
14640
|
+
const fieldName = name + "." + fieldKey;
|
|
14636
14641
|
const field = get2(_fields, fieldName);
|
|
14637
|
-
(_names.array.has(
|
|
14642
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
14638
14643
|
}
|
|
14639
14644
|
};
|
|
14640
|
-
const setValue = (
|
|
14641
|
-
const field = get2(_fields,
|
|
14642
|
-
const isFieldArray = _names.array.has(
|
|
14645
|
+
const setValue = (name, value, options2 = {}) => {
|
|
14646
|
+
const field = get2(_fields, name);
|
|
14647
|
+
const isFieldArray = _names.array.has(name);
|
|
14643
14648
|
const cloneValue = cloneObject(value);
|
|
14644
|
-
set(_formValues,
|
|
14649
|
+
set(_formValues, name, cloneValue);
|
|
14645
14650
|
if (isFieldArray) {
|
|
14646
14651
|
_subjects.array.next({
|
|
14647
|
-
name
|
|
14652
|
+
name,
|
|
14648
14653
|
values: cloneObject(_formValues)
|
|
14649
14654
|
});
|
|
14650
14655
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
14651
14656
|
_subjects.state.next({
|
|
14652
|
-
name
|
|
14657
|
+
name,
|
|
14653
14658
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
14654
|
-
isDirty: _getDirty(
|
|
14659
|
+
isDirty: _getDirty(name, cloneValue)
|
|
14655
14660
|
});
|
|
14656
14661
|
}
|
|
14657
14662
|
} else {
|
|
14658
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
14663
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
14659
14664
|
}
|
|
14660
|
-
isWatched(
|
|
14665
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
14661
14666
|
_subjects.state.next({
|
|
14662
|
-
name: _state.mount ?
|
|
14667
|
+
name: _state.mount ? name : void 0,
|
|
14663
14668
|
values: cloneObject(_formValues)
|
|
14664
14669
|
});
|
|
14665
14670
|
};
|
|
14666
14671
|
const onChange2 = async (event) => {
|
|
14667
14672
|
_state.mount = true;
|
|
14668
14673
|
const target = event.target;
|
|
14669
|
-
let
|
|
14674
|
+
let name = target.name;
|
|
14670
14675
|
let isFieldValueUpdated = true;
|
|
14671
|
-
const field = get2(_fields,
|
|
14676
|
+
const field = get2(_fields, name);
|
|
14672
14677
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
14673
|
-
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));
|
|
14674
14679
|
};
|
|
14675
14680
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
14676
14681
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -14679,9 +14684,9 @@ function createFormControl(props = {}) {
|
|
|
14679
14684
|
let isValid3;
|
|
14680
14685
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
14681
14686
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
14682
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
14683
|
-
const watched = isWatched(
|
|
14684
|
-
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);
|
|
14685
14690
|
if (isBlurEvent) {
|
|
14686
14691
|
if (!target || !target.readOnly) {
|
|
14687
14692
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -14690,10 +14695,10 @@ function createFormControl(props = {}) {
|
|
|
14690
14695
|
} else if (field._f.onChange) {
|
|
14691
14696
|
field._f.onChange(event);
|
|
14692
14697
|
}
|
|
14693
|
-
const fieldState = updateTouchAndDirty(
|
|
14698
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
14694
14699
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
14695
14700
|
!isBlurEvent && _subjects.state.next({
|
|
14696
|
-
name
|
|
14701
|
+
name,
|
|
14697
14702
|
type: event.type,
|
|
14698
14703
|
values: cloneObject(_formValues)
|
|
14699
14704
|
});
|
|
@@ -14707,23 +14712,23 @@ function createFormControl(props = {}) {
|
|
|
14707
14712
|
_setValid();
|
|
14708
14713
|
}
|
|
14709
14714
|
}
|
|
14710
|
-
return shouldRender && _subjects.state.next({ name
|
|
14715
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
14711
14716
|
}
|
|
14712
14717
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
14713
14718
|
if (_options.resolver) {
|
|
14714
|
-
const { errors } = await _runSchema([
|
|
14719
|
+
const { errors } = await _runSchema([name]);
|
|
14715
14720
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14716
14721
|
if (isFieldValueUpdated) {
|
|
14717
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
14718
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
14722
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
14723
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
14719
14724
|
error2 = errorLookupResult.error;
|
|
14720
|
-
|
|
14725
|
+
name = errorLookupResult.name;
|
|
14721
14726
|
isValid3 = isEmptyObject(errors);
|
|
14722
14727
|
}
|
|
14723
14728
|
} else {
|
|
14724
|
-
_updateIsValidating([
|
|
14725
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
14726
|
-
_updateIsValidating([
|
|
14729
|
+
_updateIsValidating([name], true);
|
|
14730
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
14731
|
+
_updateIsValidating([name]);
|
|
14727
14732
|
_updateIsFieldValueUpdated(fieldValue);
|
|
14728
14733
|
if (isFieldValueUpdated) {
|
|
14729
14734
|
if (error2) {
|
|
@@ -14735,7 +14740,7 @@ function createFormControl(props = {}) {
|
|
|
14735
14740
|
}
|
|
14736
14741
|
if (isFieldValueUpdated) {
|
|
14737
14742
|
field._f.deps && trigger(field._f.deps);
|
|
14738
|
-
shouldRenderByError(
|
|
14743
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
14739
14744
|
}
|
|
14740
14745
|
}
|
|
14741
14746
|
};
|
|
@@ -14746,15 +14751,15 @@ function createFormControl(props = {}) {
|
|
|
14746
14751
|
}
|
|
14747
14752
|
return;
|
|
14748
14753
|
};
|
|
14749
|
-
const trigger = async (
|
|
14754
|
+
const trigger = async (name, options2 = {}) => {
|
|
14750
14755
|
let isValid3;
|
|
14751
14756
|
let validationResult;
|
|
14752
|
-
const fieldNames = convertToArrayPayload(
|
|
14757
|
+
const fieldNames = convertToArrayPayload(name);
|
|
14753
14758
|
if (_options.resolver) {
|
|
14754
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
14759
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
14755
14760
|
isValid3 = isEmptyObject(errors);
|
|
14756
|
-
validationResult =
|
|
14757
|
-
} else if (
|
|
14761
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
14762
|
+
} else if (name) {
|
|
14758
14763
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
14759
14764
|
const field = get2(_fields, fieldName);
|
|
14760
14765
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -14764,51 +14769,51 @@ function createFormControl(props = {}) {
|
|
|
14764
14769
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
14765
14770
|
}
|
|
14766
14771
|
_subjects.state.next({
|
|
14767
|
-
...!isString3(
|
|
14768
|
-
..._options.resolver || !
|
|
14772
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
14773
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
14769
14774
|
errors: _formState.errors
|
|
14770
14775
|
});
|
|
14771
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
14776
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
14772
14777
|
return validationResult;
|
|
14773
14778
|
};
|
|
14774
14779
|
const getValues = (fieldNames) => {
|
|
14775
14780
|
const values = {
|
|
14776
14781
|
..._state.mount ? _formValues : _defaultValues
|
|
14777
14782
|
};
|
|
14778
|
-
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));
|
|
14779
14784
|
};
|
|
14780
|
-
const getFieldState = (
|
|
14781
|
-
invalid: !!get2((formState || _formState).errors,
|
|
14782
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
14783
|
-
error: get2((formState || _formState).errors,
|
|
14784
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
14785
|
-
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)
|
|
14786
14791
|
});
|
|
14787
|
-
const clearErrors = (
|
|
14788
|
-
|
|
14792
|
+
const clearErrors = (name) => {
|
|
14793
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
14789
14794
|
_subjects.state.next({
|
|
14790
|
-
errors:
|
|
14795
|
+
errors: name ? _formState.errors : {}
|
|
14791
14796
|
});
|
|
14792
14797
|
};
|
|
14793
|
-
const setError = (
|
|
14794
|
-
const ref = (get2(_fields,
|
|
14795
|
-
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) || {};
|
|
14796
14801
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
14797
|
-
set(_formState.errors,
|
|
14802
|
+
set(_formState.errors, name, {
|
|
14798
14803
|
...restOfErrorTree,
|
|
14799
14804
|
...error2,
|
|
14800
14805
|
ref
|
|
14801
14806
|
});
|
|
14802
14807
|
_subjects.state.next({
|
|
14803
|
-
name
|
|
14808
|
+
name,
|
|
14804
14809
|
errors: _formState.errors,
|
|
14805
14810
|
isValid: false
|
|
14806
14811
|
});
|
|
14807
14812
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
14808
14813
|
};
|
|
14809
|
-
const watch = (
|
|
14810
|
-
next: (payload) => "values" in payload &&
|
|
14811
|
-
}) : _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);
|
|
14812
14817
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
14813
14818
|
next: (formState) => {
|
|
14814
14819
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -14832,8 +14837,8 @@ function createFormControl(props = {}) {
|
|
|
14832
14837
|
formState: _proxySubscribeFormState
|
|
14833
14838
|
});
|
|
14834
14839
|
};
|
|
14835
|
-
const unregister = (
|
|
14836
|
-
for (const fieldName of
|
|
14840
|
+
const unregister = (name, options2 = {}) => {
|
|
14841
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
14837
14842
|
_names.mount.delete(fieldName);
|
|
14838
14843
|
_names.array.delete(fieldName);
|
|
14839
14844
|
if (!options2.keepValue) {
|
|
@@ -14855,31 +14860,31 @@ function createFormControl(props = {}) {
|
|
|
14855
14860
|
});
|
|
14856
14861
|
!options2.keepIsValid && _setValid();
|
|
14857
14862
|
};
|
|
14858
|
-
const _setDisabledField = ({ disabled, name
|
|
14859
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
14860
|
-
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);
|
|
14861
14866
|
}
|
|
14862
14867
|
};
|
|
14863
|
-
const register = (
|
|
14864
|
-
let field = get2(_fields,
|
|
14868
|
+
const register = (name, options2 = {}) => {
|
|
14869
|
+
let field = get2(_fields, name);
|
|
14865
14870
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
14866
|
-
set(_fields,
|
|
14871
|
+
set(_fields, name, {
|
|
14867
14872
|
...field || {},
|
|
14868
14873
|
_f: {
|
|
14869
|
-
...field && field._f ? field._f : { ref: { name
|
|
14870
|
-
name
|
|
14874
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
14875
|
+
name,
|
|
14871
14876
|
mount: true,
|
|
14872
14877
|
...options2
|
|
14873
14878
|
}
|
|
14874
14879
|
});
|
|
14875
|
-
_names.mount.add(
|
|
14880
|
+
_names.mount.add(name);
|
|
14876
14881
|
if (field) {
|
|
14877
14882
|
_setDisabledField({
|
|
14878
14883
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
14879
|
-
name
|
|
14884
|
+
name
|
|
14880
14885
|
});
|
|
14881
14886
|
} else {
|
|
14882
|
-
updateValidAndValue(
|
|
14887
|
+
updateValidAndValue(name, true, options2.value);
|
|
14883
14888
|
}
|
|
14884
14889
|
return {
|
|
14885
14890
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -14891,39 +14896,39 @@ function createFormControl(props = {}) {
|
|
|
14891
14896
|
maxLength: getRuleValue(options2.maxLength),
|
|
14892
14897
|
pattern: getRuleValue(options2.pattern)
|
|
14893
14898
|
} : {},
|
|
14894
|
-
name
|
|
14899
|
+
name,
|
|
14895
14900
|
onChange: onChange2,
|
|
14896
14901
|
onBlur: onChange2,
|
|
14897
14902
|
ref: (ref) => {
|
|
14898
14903
|
if (ref) {
|
|
14899
|
-
register(
|
|
14900
|
-
field = get2(_fields,
|
|
14904
|
+
register(name, options2);
|
|
14905
|
+
field = get2(_fields, name);
|
|
14901
14906
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
14902
14907
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
14903
14908
|
const refs = field._f.refs || [];
|
|
14904
14909
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
14905
14910
|
return;
|
|
14906
14911
|
}
|
|
14907
|
-
set(_fields,
|
|
14912
|
+
set(_fields, name, {
|
|
14908
14913
|
_f: {
|
|
14909
14914
|
...field._f,
|
|
14910
14915
|
...radioOrCheckbox ? {
|
|
14911
14916
|
refs: [
|
|
14912
14917
|
...refs.filter(live),
|
|
14913
14918
|
fieldRef,
|
|
14914
|
-
...Array.isArray(get2(_defaultValues,
|
|
14919
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
14915
14920
|
],
|
|
14916
|
-
ref: { type: fieldRef.type, name
|
|
14921
|
+
ref: { type: fieldRef.type, name }
|
|
14917
14922
|
} : { ref: fieldRef }
|
|
14918
14923
|
}
|
|
14919
14924
|
});
|
|
14920
|
-
updateValidAndValue(
|
|
14925
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
14921
14926
|
} else {
|
|
14922
|
-
field = get2(_fields,
|
|
14927
|
+
field = get2(_fields, name, {});
|
|
14923
14928
|
if (field._f) {
|
|
14924
14929
|
field._f.mount = false;
|
|
14925
14930
|
}
|
|
14926
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
14931
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
14927
14932
|
}
|
|
14928
14933
|
}
|
|
14929
14934
|
};
|
|
@@ -14932,8 +14937,8 @@ function createFormControl(props = {}) {
|
|
|
14932
14937
|
const _disableForm = (disabled) => {
|
|
14933
14938
|
if (isBoolean(disabled)) {
|
|
14934
14939
|
_subjects.state.next({ disabled });
|
|
14935
|
-
iterateFieldsByAction(_fields, (ref,
|
|
14936
|
-
const currentField = get2(_fields,
|
|
14940
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
14941
|
+
const currentField = get2(_fields, name);
|
|
14937
14942
|
if (currentField) {
|
|
14938
14943
|
ref.disabled = currentField._f.disabled || disabled;
|
|
14939
14944
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -14963,8 +14968,8 @@ function createFormControl(props = {}) {
|
|
|
14963
14968
|
await executeBuiltInValidation(_fields);
|
|
14964
14969
|
}
|
|
14965
14970
|
if (_names.disabled.size) {
|
|
14966
|
-
for (const
|
|
14967
|
-
unset(fieldValues,
|
|
14971
|
+
for (const name of _names.disabled) {
|
|
14972
|
+
unset(fieldValues, name);
|
|
14968
14973
|
}
|
|
14969
14974
|
}
|
|
14970
14975
|
unset(_formState.errors, "root");
|
|
@@ -14995,23 +15000,23 @@ function createFormControl(props = {}) {
|
|
|
14995
15000
|
throw onValidError;
|
|
14996
15001
|
}
|
|
14997
15002
|
};
|
|
14998
|
-
const resetField = (
|
|
14999
|
-
if (get2(_fields,
|
|
15003
|
+
const resetField = (name, options2 = {}) => {
|
|
15004
|
+
if (get2(_fields, name)) {
|
|
15000
15005
|
if (isUndefined(options2.defaultValue)) {
|
|
15001
|
-
setValue(
|
|
15006
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
15002
15007
|
} else {
|
|
15003
|
-
setValue(
|
|
15004
|
-
set(_defaultValues,
|
|
15008
|
+
setValue(name, options2.defaultValue);
|
|
15009
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
15005
15010
|
}
|
|
15006
15011
|
if (!options2.keepTouched) {
|
|
15007
|
-
unset(_formState.touchedFields,
|
|
15012
|
+
unset(_formState.touchedFields, name);
|
|
15008
15013
|
}
|
|
15009
15014
|
if (!options2.keepDirty) {
|
|
15010
|
-
unset(_formState.dirtyFields,
|
|
15011
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
15015
|
+
unset(_formState.dirtyFields, name);
|
|
15016
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
15012
15017
|
}
|
|
15013
15018
|
if (!options2.keepError) {
|
|
15014
|
-
unset(_formState.errors,
|
|
15019
|
+
unset(_formState.errors, name);
|
|
15015
15020
|
_proxyFormState.isValid && _setValid();
|
|
15016
15021
|
}
|
|
15017
15022
|
_subjects.state.next({ ..._formState });
|
|
@@ -15036,8 +15041,8 @@ function createFormControl(props = {}) {
|
|
|
15036
15041
|
}
|
|
15037
15042
|
} else {
|
|
15038
15043
|
if (isWeb && isUndefined(formValues)) {
|
|
15039
|
-
for (const
|
|
15040
|
-
const field = get2(_fields,
|
|
15044
|
+
for (const name of _names.mount) {
|
|
15045
|
+
const field = get2(_fields, name);
|
|
15041
15046
|
if (field && field._f) {
|
|
15042
15047
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
15043
15048
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -15090,8 +15095,8 @@ function createFormControl(props = {}) {
|
|
|
15090
15095
|
});
|
|
15091
15096
|
};
|
|
15092
15097
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
15093
|
-
const setFocus = (
|
|
15094
|
-
const field = get2(_fields,
|
|
15098
|
+
const setFocus = (name, options2 = {}) => {
|
|
15099
|
+
const field = get2(_fields, name);
|
|
15095
15100
|
const fieldReference = field && field._f;
|
|
15096
15101
|
if (fieldReference) {
|
|
15097
15102
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -15407,7 +15412,7 @@ function TextInput(props) {
|
|
|
15407
15412
|
inputWrapperClassName,
|
|
15408
15413
|
label,
|
|
15409
15414
|
placeholder,
|
|
15410
|
-
name
|
|
15415
|
+
name,
|
|
15411
15416
|
type = "text",
|
|
15412
15417
|
register,
|
|
15413
15418
|
errors,
|
|
@@ -15430,7 +15435,7 @@ function TextInput(props) {
|
|
|
15430
15435
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
15431
15436
|
placeholder,
|
|
15432
15437
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
15433
|
-
...register(
|
|
15438
|
+
...register(name)
|
|
15434
15439
|
}
|
|
15435
15440
|
),
|
|
15436
15441
|
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -15444,11 +15449,11 @@ function TextInput(props) {
|
|
|
15444
15449
|
]
|
|
15445
15450
|
}
|
|
15446
15451
|
),
|
|
15447
|
-
errors?.[
|
|
15452
|
+
errors?.[name]?.message && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15448
15453
|
"p",
|
|
15449
15454
|
{
|
|
15450
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
15451
|
-
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
|
|
15452
15457
|
}
|
|
15453
15458
|
)
|
|
15454
15459
|
] });
|
|
@@ -16210,7 +16215,7 @@ var ModalLayer = ({
|
|
|
16210
16215
|
// src/widgets/common/modal-confirm.tsx
|
|
16211
16216
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
16212
16217
|
var ModalConfirm = ({
|
|
16213
|
-
name
|
|
16218
|
+
name,
|
|
16214
16219
|
isShowModal,
|
|
16215
16220
|
onClick,
|
|
16216
16221
|
onClose,
|
|
@@ -16219,8 +16224,8 @@ var ModalConfirm = ({
|
|
|
16219
16224
|
isLoading
|
|
16220
16225
|
}) => {
|
|
16221
16226
|
const { t: t3 } = useI18n();
|
|
16222
|
-
const renderButtonAction = (
|
|
16223
|
-
switch (
|
|
16227
|
+
const renderButtonAction = (name2) => {
|
|
16228
|
+
switch (name2) {
|
|
16224
16229
|
case "duplicate":
|
|
16225
16230
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
16226
16231
|
"button",
|
|
@@ -16296,7 +16301,7 @@ var ModalConfirm = ({
|
|
|
16296
16301
|
children: t3("cancel")
|
|
16297
16302
|
}
|
|
16298
16303
|
),
|
|
16299
|
-
renderButtonAction(
|
|
16304
|
+
renderButtonAction(name)
|
|
16300
16305
|
] })
|
|
16301
16306
|
] }) });
|
|
16302
16307
|
};
|
|
@@ -16845,7 +16850,7 @@ var import_react39 = require("react");
|
|
|
16845
16850
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
16846
16851
|
var BinaryField = (props) => {
|
|
16847
16852
|
const {
|
|
16848
|
-
name
|
|
16853
|
+
name,
|
|
16849
16854
|
methods,
|
|
16850
16855
|
readonly = false,
|
|
16851
16856
|
placeholder,
|
|
@@ -16884,7 +16889,7 @@ var BinaryField = (props) => {
|
|
|
16884
16889
|
try {
|
|
16885
16890
|
let type = "application/octet-stream";
|
|
16886
16891
|
let size4 = 0;
|
|
16887
|
-
let
|
|
16892
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16888
16893
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16889
16894
|
type = "image/*";
|
|
16890
16895
|
} else {
|
|
@@ -16897,7 +16902,7 @@ var BinaryField = (props) => {
|
|
|
16897
16902
|
}
|
|
16898
16903
|
}
|
|
16899
16904
|
setFileInfo({
|
|
16900
|
-
name:
|
|
16905
|
+
name: name2,
|
|
16901
16906
|
type,
|
|
16902
16907
|
url: initialFile,
|
|
16903
16908
|
size: size4,
|
|
@@ -16933,13 +16938,13 @@ var BinaryField = (props) => {
|
|
|
16933
16938
|
};
|
|
16934
16939
|
const renderPreview = (file) => {
|
|
16935
16940
|
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PlaceHolderIcon, {});
|
|
16936
|
-
const { name:
|
|
16941
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16937
16942
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16938
16943
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16939
16944
|
"img",
|
|
16940
16945
|
{
|
|
16941
16946
|
src: url,
|
|
16942
|
-
alt:
|
|
16947
|
+
alt: name2,
|
|
16943
16948
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16944
16949
|
style: {
|
|
16945
16950
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16979,7 +16984,7 @@ var BinaryField = (props) => {
|
|
|
16979
16984
|
maxWidth: "120px"
|
|
16980
16985
|
},
|
|
16981
16986
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16982
|
-
children:
|
|
16987
|
+
children: name2
|
|
16983
16988
|
}
|
|
16984
16989
|
),
|
|
16985
16990
|
isShowSize && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16989,7 +16994,7 @@ var BinaryField = (props) => {
|
|
|
16989
16994
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16990
16995
|
Controller,
|
|
16991
16996
|
{
|
|
16992
|
-
name:
|
|
16997
|
+
name: name ?? "",
|
|
16993
16998
|
control: methods?.control,
|
|
16994
16999
|
rules: {
|
|
16995
17000
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17282,7 +17287,7 @@ var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
|
17282
17287
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
17283
17288
|
var CharField = (props) => {
|
|
17284
17289
|
const {
|
|
17285
|
-
name
|
|
17290
|
+
name,
|
|
17286
17291
|
readonly,
|
|
17287
17292
|
placeholder,
|
|
17288
17293
|
required,
|
|
@@ -17313,7 +17318,7 @@ var CharField = (props) => {
|
|
|
17313
17318
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
17314
17319
|
Controller,
|
|
17315
17320
|
{
|
|
17316
|
-
name:
|
|
17321
|
+
name: name ?? "",
|
|
17317
17322
|
control: methods.control,
|
|
17318
17323
|
rules: {
|
|
17319
17324
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -17340,15 +17345,15 @@ var CharField = (props) => {
|
|
|
17340
17345
|
const { setError, clearErrors } = methods;
|
|
17341
17346
|
(0, import_react40.useEffect)(() => {
|
|
17342
17347
|
if (value2) {
|
|
17343
|
-
clearErrors(
|
|
17348
|
+
clearErrors(name);
|
|
17344
17349
|
}
|
|
17345
|
-
}, [value2, clearErrors,
|
|
17350
|
+
}, [value2, clearErrors, name]);
|
|
17346
17351
|
(0, import_react40.useEffect)(() => {
|
|
17347
17352
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
17348
17353
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
17349
|
-
const currentValue = methods?.getValues(
|
|
17354
|
+
const currentValue = methods?.getValues(name);
|
|
17350
17355
|
if (currentValue !== depValue) {
|
|
17351
|
-
methods?.setValue(
|
|
17356
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
17352
17357
|
}
|
|
17353
17358
|
}, [widget, formValues]);
|
|
17354
17359
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -17373,14 +17378,14 @@ var CharField = (props) => {
|
|
|
17373
17378
|
const inputValue = e3.target.value;
|
|
17374
17379
|
if (readonly) return;
|
|
17375
17380
|
fieldOnchange(inputValue);
|
|
17376
|
-
clearErrors(
|
|
17381
|
+
clearErrors(name);
|
|
17377
17382
|
},
|
|
17378
17383
|
onBlur: (e3) => {
|
|
17379
17384
|
if (readonly) return;
|
|
17380
17385
|
const inputValue = e3.target.value || "";
|
|
17381
17386
|
if (widget === "custom_passord") {
|
|
17382
17387
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
17383
|
-
setError(
|
|
17388
|
+
setError(name, {
|
|
17384
17389
|
type: "pattern",
|
|
17385
17390
|
message: getPasswordMessage(
|
|
17386
17391
|
min3,
|
|
@@ -17395,7 +17400,7 @@ var CharField = (props) => {
|
|
|
17395
17400
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
17396
17401
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
17397
17402
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
17398
|
-
setError(
|
|
17403
|
+
setError(name, {
|
|
17399
17404
|
type: "pattern",
|
|
17400
17405
|
message: t3(
|
|
17401
17406
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -17405,14 +17410,14 @@ var CharField = (props) => {
|
|
|
17405
17410
|
}
|
|
17406
17411
|
}
|
|
17407
17412
|
fieldOnchange(inputValue);
|
|
17408
|
-
onChange2 && onChange2(
|
|
17413
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
17409
17414
|
if (!inputValue && required && !invisible) {
|
|
17410
|
-
setError(
|
|
17415
|
+
setError(name, {
|
|
17411
17416
|
type: "required",
|
|
17412
17417
|
message: `${string} ${t3("must_required")}`
|
|
17413
17418
|
});
|
|
17414
17419
|
} else {
|
|
17415
|
-
clearErrors(
|
|
17420
|
+
clearErrors(name);
|
|
17416
17421
|
}
|
|
17417
17422
|
},
|
|
17418
17423
|
readOnly: readonly,
|
|
@@ -17466,14 +17471,14 @@ function EyeIconComponent({ open }) {
|
|
|
17466
17471
|
}
|
|
17467
17472
|
var SecureField = (props) => {
|
|
17468
17473
|
const {
|
|
17469
|
-
name
|
|
17474
|
+
name,
|
|
17470
17475
|
readonly,
|
|
17471
17476
|
placeholder,
|
|
17472
17477
|
required,
|
|
17473
17478
|
invisible,
|
|
17474
17479
|
methods,
|
|
17475
17480
|
onChange: onChange2,
|
|
17476
|
-
string =
|
|
17481
|
+
string = name,
|
|
17477
17482
|
widget,
|
|
17478
17483
|
min: min3,
|
|
17479
17484
|
max: max3,
|
|
@@ -17503,7 +17508,7 @@ var SecureField = (props) => {
|
|
|
17503
17508
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
17504
17509
|
Controller,
|
|
17505
17510
|
{
|
|
17506
|
-
name: String(
|
|
17511
|
+
name: String(name),
|
|
17507
17512
|
control: methods.control,
|
|
17508
17513
|
rules: {
|
|
17509
17514
|
...required && !invisible ? {
|
|
@@ -17537,8 +17542,8 @@ var SecureField = (props) => {
|
|
|
17537
17542
|
if (canToggle) setShowPlain(false);
|
|
17538
17543
|
}, [canToggle]);
|
|
17539
17544
|
(0, import_react41.useEffect)(() => {
|
|
17540
|
-
if (value2) clearErrors(
|
|
17541
|
-
}, [value2, clearErrors,
|
|
17545
|
+
if (value2) clearErrors(name);
|
|
17546
|
+
}, [value2, clearErrors, name]);
|
|
17542
17547
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
17543
17548
|
isCappedToken && shouldMask && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
17544
17549
|
"div",
|
|
@@ -17556,20 +17561,20 @@ var SecureField = (props) => {
|
|
|
17556
17561
|
if (readonly) return;
|
|
17557
17562
|
const inputValue = e3.target.value ?? "";
|
|
17558
17563
|
fieldOnchange(inputValue);
|
|
17559
|
-
clearErrors(
|
|
17564
|
+
clearErrors(name);
|
|
17560
17565
|
},
|
|
17561
17566
|
onBlur: (e3) => {
|
|
17562
17567
|
if (readonly) return;
|
|
17563
17568
|
const inputValue = (e3.target.value ?? "").trim();
|
|
17564
17569
|
if (!inputValue && required && !invisible) {
|
|
17565
|
-
setError(
|
|
17570
|
+
setError(name, {
|
|
17566
17571
|
type: "required",
|
|
17567
17572
|
message: `${string} ${t3("must_required")}`
|
|
17568
17573
|
});
|
|
17569
17574
|
return;
|
|
17570
17575
|
}
|
|
17571
17576
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
17572
|
-
setError(
|
|
17577
|
+
setError(name, {
|
|
17573
17578
|
type: "pattern",
|
|
17574
17579
|
message: getPasswordMessage2(
|
|
17575
17580
|
min3,
|
|
@@ -17582,8 +17587,8 @@ var SecureField = (props) => {
|
|
|
17582
17587
|
return;
|
|
17583
17588
|
}
|
|
17584
17589
|
fieldOnchange(inputValue);
|
|
17585
|
-
onChange2 && onChange2(String(
|
|
17586
|
-
clearErrors(
|
|
17590
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
17591
|
+
clearErrors(name);
|
|
17587
17592
|
},
|
|
17588
17593
|
readOnly: readonly,
|
|
17589
17594
|
disabled: readonly,
|
|
@@ -17627,7 +17632,7 @@ var SecureField = (props) => {
|
|
|
17627
17632
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
17628
17633
|
var CheckboxField = (props) => {
|
|
17629
17634
|
const {
|
|
17630
|
-
name
|
|
17635
|
+
name,
|
|
17631
17636
|
readonly = false,
|
|
17632
17637
|
required = false,
|
|
17633
17638
|
invisible = false,
|
|
@@ -17638,7 +17643,7 @@ var CheckboxField = (props) => {
|
|
|
17638
17643
|
isEditTable = false
|
|
17639
17644
|
} = props;
|
|
17640
17645
|
if (!isForm) {
|
|
17641
|
-
if (
|
|
17646
|
+
if (name === "is_active" || name === "active") {
|
|
17642
17647
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ActiveBadgeField, { type: value });
|
|
17643
17648
|
} else {
|
|
17644
17649
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -17655,7 +17660,7 @@ var CheckboxField = (props) => {
|
|
|
17655
17660
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
17656
17661
|
Controller,
|
|
17657
17662
|
{
|
|
17658
|
-
name:
|
|
17663
|
+
name: name ?? "",
|
|
17659
17664
|
control: methods?.control,
|
|
17660
17665
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
17661
17666
|
"div",
|
|
@@ -17664,10 +17669,10 @@ var CheckboxField = (props) => {
|
|
|
17664
17669
|
onClick: () => {
|
|
17665
17670
|
const checked = !field.value;
|
|
17666
17671
|
if (!isEditTable && readonly) return;
|
|
17667
|
-
methods.setValue(
|
|
17672
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17668
17673
|
field.onChange(checked);
|
|
17669
17674
|
if (onChange2) {
|
|
17670
|
-
onChange2(
|
|
17675
|
+
onChange2(name ?? "", checked);
|
|
17671
17676
|
}
|
|
17672
17677
|
},
|
|
17673
17678
|
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -17677,10 +17682,10 @@ var CheckboxField = (props) => {
|
|
|
17677
17682
|
onChange: (e3) => {
|
|
17678
17683
|
const checked = e3.target.checked;
|
|
17679
17684
|
if (!isEditTable && readonly) return;
|
|
17680
|
-
methods.setValue(
|
|
17685
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
17681
17686
|
field.onChange(checked);
|
|
17682
17687
|
if (onChange2) {
|
|
17683
|
-
onChange2(
|
|
17688
|
+
onChange2(name ?? "", checked);
|
|
17684
17689
|
}
|
|
17685
17690
|
},
|
|
17686
17691
|
type: "checkbox",
|
|
@@ -17774,19 +17779,19 @@ var ColorWrapper = (props) => {
|
|
|
17774
17779
|
// src/widgets/basic/color-field/color.tsx
|
|
17775
17780
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
17776
17781
|
var ColorField = (props) => {
|
|
17777
|
-
const { value, isForm, name
|
|
17782
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
17778
17783
|
if (!isForm) {
|
|
17779
17784
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
17780
17785
|
}
|
|
17781
17786
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17782
17787
|
Controller,
|
|
17783
17788
|
{
|
|
17784
|
-
name:
|
|
17789
|
+
name: name ?? "",
|
|
17785
17790
|
control: methods?.control,
|
|
17786
17791
|
render: ({ field }) => {
|
|
17787
17792
|
const handlePickColorChange = (color) => {
|
|
17788
17793
|
field.onChange(color?.id);
|
|
17789
|
-
onChange2 && onChange2(
|
|
17794
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
17790
17795
|
};
|
|
17791
17796
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
17792
17797
|
ColorWrapper,
|
|
@@ -17807,7 +17812,7 @@ var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
|
17807
17812
|
var CopyLinkButtonField = (props) => {
|
|
17808
17813
|
const {
|
|
17809
17814
|
isForm,
|
|
17810
|
-
name
|
|
17815
|
+
name,
|
|
17811
17816
|
methods,
|
|
17812
17817
|
onChange: onChange2,
|
|
17813
17818
|
readonly,
|
|
@@ -17829,7 +17834,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17829
17834
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
17830
17835
|
Controller,
|
|
17831
17836
|
{
|
|
17832
|
-
name:
|
|
17837
|
+
name: name ?? "",
|
|
17833
17838
|
control: methods.control,
|
|
17834
17839
|
rules: {
|
|
17835
17840
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17841,7 +17846,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17841
17846
|
const { setError, clearErrors } = methods;
|
|
17842
17847
|
(0, import_react43.useEffect)(() => {
|
|
17843
17848
|
if (value) {
|
|
17844
|
-
clearErrors(
|
|
17849
|
+
clearErrors(name);
|
|
17845
17850
|
}
|
|
17846
17851
|
}, [value]);
|
|
17847
17852
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17859,11 +17864,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17859
17864
|
if (readonly) return;
|
|
17860
17865
|
const newValue = e3.target.value || "";
|
|
17861
17866
|
fieldOnchange(newValue);
|
|
17862
|
-
onChange2 && onChange2(
|
|
17867
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17863
17868
|
if (e3.target.value) {
|
|
17864
|
-
clearErrors(
|
|
17869
|
+
clearErrors(name);
|
|
17865
17870
|
} else if (required && !invisible) {
|
|
17866
|
-
setError(
|
|
17871
|
+
setError(name, {
|
|
17867
17872
|
type: "required",
|
|
17868
17873
|
message: `${string} ${t3("must_required")}`
|
|
17869
17874
|
});
|
|
@@ -17873,9 +17878,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17873
17878
|
if (!readonly) {
|
|
17874
17879
|
fieldOnchange(e3.target.value);
|
|
17875
17880
|
if (e3.target.value) {
|
|
17876
|
-
clearErrors(
|
|
17881
|
+
clearErrors(name);
|
|
17877
17882
|
} else if (required && !invisible) {
|
|
17878
|
-
setError(
|
|
17883
|
+
setError(name, {
|
|
17879
17884
|
type: "required",
|
|
17880
17885
|
message: `${string} ${t3("must_required")}`
|
|
17881
17886
|
});
|
|
@@ -27739,23 +27744,23 @@ var createCache = function createCache2(options2) {
|
|
|
27739
27744
|
};
|
|
27740
27745
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
27741
27746
|
var getRules3 = function getRules4(selector, serialized) {
|
|
27742
|
-
var
|
|
27743
|
-
if (serverStylisCache[
|
|
27744
|
-
serverStylisCache[
|
|
27747
|
+
var name = serialized.name;
|
|
27748
|
+
if (serverStylisCache[name] === void 0) {
|
|
27749
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
27745
27750
|
}
|
|
27746
|
-
return serverStylisCache[
|
|
27751
|
+
return serverStylisCache[name];
|
|
27747
27752
|
};
|
|
27748
27753
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
27749
|
-
var
|
|
27754
|
+
var name = serialized.name;
|
|
27750
27755
|
var rules = getRules3(selector, serialized);
|
|
27751
27756
|
if (cache.compat === void 0) {
|
|
27752
27757
|
if (shouldCache) {
|
|
27753
|
-
cache.inserted[
|
|
27758
|
+
cache.inserted[name] = true;
|
|
27754
27759
|
}
|
|
27755
27760
|
return rules;
|
|
27756
27761
|
} else {
|
|
27757
27762
|
if (shouldCache) {
|
|
27758
|
-
cache.inserted[
|
|
27763
|
+
cache.inserted[name] = rules;
|
|
27759
27764
|
} else {
|
|
27760
27765
|
return rules;
|
|
27761
27766
|
}
|
|
@@ -28078,9 +28083,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
28078
28083
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
28079
28084
|
identifierName += "-" + match3[1];
|
|
28080
28085
|
}
|
|
28081
|
-
var
|
|
28086
|
+
var name = murmur2(styles) + identifierName;
|
|
28082
28087
|
return {
|
|
28083
|
-
name
|
|
28088
|
+
name,
|
|
28084
28089
|
styles,
|
|
28085
28090
|
next: cursor
|
|
28086
28091
|
};
|
|
@@ -28230,10 +28235,10 @@ function css() {
|
|
|
28230
28235
|
}
|
|
28231
28236
|
function keyframes() {
|
|
28232
28237
|
var insertable = css.apply(void 0, arguments);
|
|
28233
|
-
var
|
|
28238
|
+
var name = "animation-" + insertable.name;
|
|
28234
28239
|
return {
|
|
28235
|
-
name
|
|
28236
|
-
styles: "@keyframes " +
|
|
28240
|
+
name,
|
|
28241
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
28237
28242
|
anim: 1,
|
|
28238
28243
|
toString: function toString() {
|
|
28239
28244
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -28265,13 +28270,13 @@ var index3 = isClient3 ? import_react50.useLayoutEffect : noop6;
|
|
|
28265
28270
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
28266
28271
|
var noop8 = function noop9() {
|
|
28267
28272
|
};
|
|
28268
|
-
function applyPrefixToName(prefix2,
|
|
28269
|
-
if (!
|
|
28273
|
+
function applyPrefixToName(prefix2, name) {
|
|
28274
|
+
if (!name) {
|
|
28270
28275
|
return prefix2;
|
|
28271
|
-
} else if (
|
|
28272
|
-
return prefix2 +
|
|
28276
|
+
} else if (name[0] === "-") {
|
|
28277
|
+
return prefix2 + name;
|
|
28273
28278
|
} else {
|
|
28274
|
-
return prefix2 + "__" +
|
|
28279
|
+
return prefix2 + "__" + name;
|
|
28275
28280
|
}
|
|
28276
28281
|
}
|
|
28277
28282
|
function classNames(prefix2, state) {
|
|
@@ -28315,11 +28320,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
28315
28320
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
28316
28321
|
return _objectSpread2({}, innerProps);
|
|
28317
28322
|
};
|
|
28318
|
-
var getStyleProps = function getStyleProps2(props,
|
|
28323
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
28319
28324
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
28320
28325
|
return {
|
|
28321
|
-
css: getStyles(
|
|
28322
|
-
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)
|
|
28323
28328
|
};
|
|
28324
28329
|
};
|
|
28325
28330
|
function isDocumentElement(el) {
|
|
@@ -30068,10 +30073,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
30068
30073
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
30069
30074
|
};
|
|
30070
30075
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
30071
|
-
var
|
|
30076
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
30072
30077
|
return jsx86("input", {
|
|
30073
30078
|
required: true,
|
|
30074
|
-
name
|
|
30079
|
+
name,
|
|
30075
30080
|
tabIndex: -1,
|
|
30076
30081
|
"aria-hidden": "true",
|
|
30077
30082
|
onFocus: onFocus2,
|
|
@@ -30397,8 +30402,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30397
30402
|
_this.focus = _this.focusInput;
|
|
30398
30403
|
_this.blur = _this.blurInput;
|
|
30399
30404
|
_this.onChange = function(newValue, actionMeta) {
|
|
30400
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
30401
|
-
actionMeta.name =
|
|
30405
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
30406
|
+
actionMeta.name = name;
|
|
30402
30407
|
_this.ariaOnChange(newValue, actionMeta);
|
|
30403
30408
|
onChange2(newValue, actionMeta);
|
|
30404
30409
|
};
|
|
@@ -30423,7 +30428,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30423
30428
|
});
|
|
30424
30429
|
};
|
|
30425
30430
|
_this.selectOption = function(newValue) {
|
|
30426
|
-
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;
|
|
30427
30432
|
var selectValue = _this.state.selectValue;
|
|
30428
30433
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
30429
30434
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -30442,7 +30447,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30442
30447
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
30443
30448
|
action: "select-option",
|
|
30444
30449
|
option: newValue,
|
|
30445
|
-
name
|
|
30450
|
+
name
|
|
30446
30451
|
});
|
|
30447
30452
|
return;
|
|
30448
30453
|
}
|
|
@@ -31496,22 +31501,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31496
31501
|
key: "renderFormField",
|
|
31497
31502
|
value: function renderFormField() {
|
|
31498
31503
|
var _this5 = this;
|
|
31499
|
-
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;
|
|
31500
31505
|
var selectValue = this.state.selectValue;
|
|
31501
31506
|
if (required && !this.hasValue() && !isDisabled) {
|
|
31502
31507
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
31503
|
-
name
|
|
31508
|
+
name,
|
|
31504
31509
|
onFocus: this.onValueInputFocus
|
|
31505
31510
|
});
|
|
31506
31511
|
}
|
|
31507
|
-
if (!
|
|
31512
|
+
if (!name || isDisabled) return;
|
|
31508
31513
|
if (isMulti) {
|
|
31509
31514
|
if (delimiter2) {
|
|
31510
31515
|
var value = selectValue.map(function(opt) {
|
|
31511
31516
|
return _this5.getOptionValue(opt);
|
|
31512
31517
|
}).join(delimiter2);
|
|
31513
31518
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31514
|
-
name
|
|
31519
|
+
name,
|
|
31515
31520
|
type: "hidden",
|
|
31516
31521
|
value
|
|
31517
31522
|
});
|
|
@@ -31519,12 +31524,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31519
31524
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
31520
31525
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31521
31526
|
key: "i-".concat(i3),
|
|
31522
|
-
name
|
|
31527
|
+
name,
|
|
31523
31528
|
type: "hidden",
|
|
31524
31529
|
value: _this5.getOptionValue(opt)
|
|
31525
31530
|
});
|
|
31526
31531
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
31527
|
-
name
|
|
31532
|
+
name,
|
|
31528
31533
|
type: "hidden",
|
|
31529
31534
|
value: ""
|
|
31530
31535
|
});
|
|
@@ -31533,7 +31538,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
31533
31538
|
} else {
|
|
31534
31539
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
31535
31540
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
31536
|
-
name
|
|
31541
|
+
name,
|
|
31537
31542
|
type: "hidden",
|
|
31538
31543
|
value: _value
|
|
31539
31544
|
});
|
|
@@ -31662,7 +31667,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
31662
31667
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
31663
31668
|
var DateField = (props) => {
|
|
31664
31669
|
const {
|
|
31665
|
-
name
|
|
31670
|
+
name,
|
|
31666
31671
|
value,
|
|
31667
31672
|
readonly,
|
|
31668
31673
|
placeholder = "DD/MM/YYYY",
|
|
@@ -31712,7 +31717,7 @@ var DateField = (props) => {
|
|
|
31712
31717
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
31713
31718
|
Controller,
|
|
31714
31719
|
{
|
|
31715
|
-
name:
|
|
31720
|
+
name: name || "",
|
|
31716
31721
|
control: methods?.control,
|
|
31717
31722
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
31718
31723
|
rules: {
|
|
@@ -31727,9 +31732,9 @@ var DateField = (props) => {
|
|
|
31727
31732
|
const { setError, clearErrors } = methods;
|
|
31728
31733
|
(0, import_react56.useEffect)(() => {
|
|
31729
31734
|
if (value) {
|
|
31730
|
-
clearErrors(
|
|
31735
|
+
clearErrors(name);
|
|
31731
31736
|
}
|
|
31732
|
-
}, [value, clearErrors,
|
|
31737
|
+
}, [value, clearErrors, name]);
|
|
31733
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;
|
|
31734
31739
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
31735
31740
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
@@ -31748,7 +31753,7 @@ var DateField = (props) => {
|
|
|
31748
31753
|
adjustedDate.toDate()
|
|
31749
31754
|
);
|
|
31750
31755
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
31751
|
-
setError(
|
|
31756
|
+
setError(name, {
|
|
31752
31757
|
type: "manual",
|
|
31753
31758
|
message: validateCustomResult
|
|
31754
31759
|
});
|
|
@@ -31756,20 +31761,20 @@ var DateField = (props) => {
|
|
|
31756
31761
|
}
|
|
31757
31762
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31758
31763
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
31759
|
-
handleOnchange && handleOnchange(
|
|
31760
|
-
clearErrors(
|
|
31764
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31765
|
+
clearErrors(name);
|
|
31761
31766
|
} else {
|
|
31762
31767
|
field.onChange(null);
|
|
31763
|
-
handleOnchange && handleOnchange(
|
|
31768
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
31764
31769
|
if (required && !invisible) {
|
|
31765
31770
|
if (!isEditTable) {
|
|
31766
|
-
setError(
|
|
31771
|
+
setError(name, {
|
|
31767
31772
|
type: "manual",
|
|
31768
31773
|
message: `${string} ${t3("must_required")}`
|
|
31769
31774
|
});
|
|
31770
31775
|
}
|
|
31771
31776
|
} else {
|
|
31772
|
-
clearErrors(
|
|
31777
|
+
clearErrors(name);
|
|
31773
31778
|
}
|
|
31774
31779
|
}
|
|
31775
31780
|
},
|
|
@@ -31790,7 +31795,7 @@ var DateField = (props) => {
|
|
|
31790
31795
|
}
|
|
31791
31796
|
),
|
|
31792
31797
|
timeInputLabel: textPlaceHolder,
|
|
31793
|
-
portalId:
|
|
31798
|
+
portalId: name,
|
|
31794
31799
|
renderCustomHeader: ({
|
|
31795
31800
|
date,
|
|
31796
31801
|
changeYear,
|
|
@@ -32129,7 +32134,7 @@ var RenderFile = ({
|
|
|
32129
32134
|
};
|
|
32130
32135
|
var FileUploadField = (props) => {
|
|
32131
32136
|
const {
|
|
32132
|
-
name
|
|
32137
|
+
name,
|
|
32133
32138
|
methods,
|
|
32134
32139
|
isForm,
|
|
32135
32140
|
model,
|
|
@@ -32160,7 +32165,7 @@ var FileUploadField = (props) => {
|
|
|
32160
32165
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32161
32166
|
Controller,
|
|
32162
32167
|
{
|
|
32163
|
-
name:
|
|
32168
|
+
name: name || "",
|
|
32164
32169
|
control: methods?.control,
|
|
32165
32170
|
rules: {
|
|
32166
32171
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32226,7 +32231,7 @@ var import_react59 = require("react");
|
|
|
32226
32231
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
32227
32232
|
var FloatField = (props) => {
|
|
32228
32233
|
const {
|
|
32229
|
-
name
|
|
32234
|
+
name,
|
|
32230
32235
|
value: propValue,
|
|
32231
32236
|
readonly,
|
|
32232
32237
|
placeholder,
|
|
@@ -32247,7 +32252,7 @@ var FloatField = (props) => {
|
|
|
32247
32252
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
32248
32253
|
Controller,
|
|
32249
32254
|
{
|
|
32250
|
-
name:
|
|
32255
|
+
name: name ?? "",
|
|
32251
32256
|
control: methods.control,
|
|
32252
32257
|
rules: {
|
|
32253
32258
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32265,14 +32270,14 @@ var FloatField = (props) => {
|
|
|
32265
32270
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
32266
32271
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
32267
32272
|
setInputValue(formatFloatNumber(propValue));
|
|
32268
|
-
clearErrors(
|
|
32273
|
+
clearErrors(name);
|
|
32269
32274
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
32270
32275
|
setInputValue(formatFloatNumber(value));
|
|
32271
|
-
clearErrors(
|
|
32276
|
+
clearErrors(name);
|
|
32272
32277
|
} else if (value === null || value === void 0) {
|
|
32273
32278
|
setInputValue("");
|
|
32274
32279
|
}
|
|
32275
|
-
}, [value,
|
|
32280
|
+
}, [value, name, clearErrors, propValue]);
|
|
32276
32281
|
const handleInputChange = (e3) => {
|
|
32277
32282
|
let newValue = e3.target.value;
|
|
32278
32283
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -32292,7 +32297,7 @@ var FloatField = (props) => {
|
|
|
32292
32297
|
);
|
|
32293
32298
|
if (!isNaN(parsedValue)) {
|
|
32294
32299
|
onChange2(parsedValue);
|
|
32295
|
-
clearErrors(
|
|
32300
|
+
clearErrors(name);
|
|
32296
32301
|
isDirtyRef.current = true;
|
|
32297
32302
|
} else {
|
|
32298
32303
|
onChange2(null);
|
|
@@ -32304,7 +32309,7 @@ var FloatField = (props) => {
|
|
|
32304
32309
|
const parsedValue = parseFloat(rawValue);
|
|
32305
32310
|
if (rawValue === "" || rawValue === ".") {
|
|
32306
32311
|
if (required) {
|
|
32307
|
-
setError(
|
|
32312
|
+
setError(name, {
|
|
32308
32313
|
type: "required",
|
|
32309
32314
|
message: `${string} ${t3("must_required")}`
|
|
32310
32315
|
});
|
|
@@ -32314,7 +32319,7 @@ var FloatField = (props) => {
|
|
|
32314
32319
|
lastCommittedValueRef.current = null;
|
|
32315
32320
|
} else if (!isNaN(parsedValue)) {
|
|
32316
32321
|
if (parsedValue < 0) {
|
|
32317
|
-
setError(
|
|
32322
|
+
setError(name, {
|
|
32318
32323
|
type: "validate",
|
|
32319
32324
|
message: t3("invalid_number")
|
|
32320
32325
|
});
|
|
@@ -32324,12 +32329,12 @@ var FloatField = (props) => {
|
|
|
32324
32329
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
32325
32330
|
setInputValue(formattedValue);
|
|
32326
32331
|
onChange2(parsedValue);
|
|
32327
|
-
handleOnchange?.(
|
|
32328
|
-
clearErrors(
|
|
32332
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
32333
|
+
clearErrors(name);
|
|
32329
32334
|
lastCommittedValueRef.current = parsedValue;
|
|
32330
32335
|
}
|
|
32331
32336
|
} else {
|
|
32332
|
-
setError(
|
|
32337
|
+
setError(name, {
|
|
32333
32338
|
type: "validate",
|
|
32334
32339
|
message: t3("invalid_number")
|
|
32335
32340
|
});
|
|
@@ -32368,7 +32373,7 @@ var import_react60 = require("react");
|
|
|
32368
32373
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
32369
32374
|
var FloatTimeField = (props) => {
|
|
32370
32375
|
const {
|
|
32371
|
-
name
|
|
32376
|
+
name,
|
|
32372
32377
|
methods,
|
|
32373
32378
|
defaultValue = 0,
|
|
32374
32379
|
isForm = true,
|
|
@@ -32386,7 +32391,7 @@ var FloatTimeField = (props) => {
|
|
|
32386
32391
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
32387
32392
|
Controller,
|
|
32388
32393
|
{
|
|
32389
|
-
name:
|
|
32394
|
+
name: name ?? "",
|
|
32390
32395
|
control: methods?.control,
|
|
32391
32396
|
defaultValue,
|
|
32392
32397
|
rules: {
|
|
@@ -32433,13 +32438,13 @@ var FloatTimeField = (props) => {
|
|
|
32433
32438
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
32434
32439
|
fieldOnChange(floatVal);
|
|
32435
32440
|
if (onChange2) {
|
|
32436
|
-
onChange2(
|
|
32441
|
+
onChange2(name ?? "", floatVal);
|
|
32437
32442
|
}
|
|
32438
32443
|
} else {
|
|
32439
32444
|
setInput("00:00");
|
|
32440
32445
|
fieldOnChange(0);
|
|
32441
32446
|
if (onChange2) {
|
|
32442
|
-
onChange2(
|
|
32447
|
+
onChange2(name ?? "", 0);
|
|
32443
32448
|
}
|
|
32444
32449
|
setErrors("");
|
|
32445
32450
|
}
|
|
@@ -32490,7 +32495,7 @@ var import_react61 = require("react");
|
|
|
32490
32495
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
32491
32496
|
var HtmlField = (props) => {
|
|
32492
32497
|
const {
|
|
32493
|
-
name
|
|
32498
|
+
name,
|
|
32494
32499
|
methods,
|
|
32495
32500
|
readonly = false,
|
|
32496
32501
|
isForm = true,
|
|
@@ -32507,7 +32512,7 @@ var HtmlField = (props) => {
|
|
|
32507
32512
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
32508
32513
|
Controller,
|
|
32509
32514
|
{
|
|
32510
|
-
name:
|
|
32515
|
+
name: name ?? "",
|
|
32511
32516
|
control: methods?.control,
|
|
32512
32517
|
defaultValue,
|
|
32513
32518
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -32540,10 +32545,10 @@ var HtmlField = (props) => {
|
|
|
32540
32545
|
// src/widgets/basic/image-field/image.tsx
|
|
32541
32546
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
32542
32547
|
var ImageField = (props) => {
|
|
32543
|
-
const { value, type, name
|
|
32548
|
+
const { value, type, name, baseURL } = props;
|
|
32544
32549
|
if (!value) return null;
|
|
32545
32550
|
if (type === "url") {
|
|
32546
|
-
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 });
|
|
32547
32552
|
}
|
|
32548
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" }) });
|
|
32549
32554
|
};
|
|
@@ -32645,7 +32650,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32645
32650
|
const {
|
|
32646
32651
|
relation,
|
|
32647
32652
|
value,
|
|
32648
|
-
name
|
|
32653
|
+
name,
|
|
32649
32654
|
methods,
|
|
32650
32655
|
required,
|
|
32651
32656
|
invisible,
|
|
@@ -32686,7 +32691,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32686
32691
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32687
32692
|
Controller,
|
|
32688
32693
|
{
|
|
32689
|
-
name:
|
|
32694
|
+
name: name ?? "",
|
|
32690
32695
|
control: methods.control,
|
|
32691
32696
|
rules: {
|
|
32692
32697
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32695,7 +32700,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32695
32700
|
const { clearErrors } = methods;
|
|
32696
32701
|
(0, import_react62.useEffect)(() => {
|
|
32697
32702
|
if (field.value) {
|
|
32698
|
-
clearErrors(
|
|
32703
|
+
clearErrors(name);
|
|
32699
32704
|
}
|
|
32700
32705
|
}, [field.value]);
|
|
32701
32706
|
const filteredValue = (0, import_react62.useMemo)(() => {
|
|
@@ -32715,12 +32720,12 @@ var Many2ManyTagField = (props) => {
|
|
|
32715
32720
|
}, [field?.value, options2]);
|
|
32716
32721
|
const handleChange = (selectedOptions) => {
|
|
32717
32722
|
const newValue = transfer(selectedOptions);
|
|
32718
|
-
methods?.setValue(
|
|
32719
|
-
onChange2?.(
|
|
32720
|
-
clearErrors(
|
|
32723
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
32724
|
+
onChange2?.(name ?? "", newValue);
|
|
32725
|
+
clearErrors(name);
|
|
32721
32726
|
newValue.forEach((item, index4) => {
|
|
32722
32727
|
Object.keys(item).forEach((key) => {
|
|
32723
|
-
methods.setValue(`${
|
|
32728
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
32724
32729
|
shouldDirty: true
|
|
32725
32730
|
});
|
|
32726
32731
|
});
|
|
@@ -32845,7 +32850,7 @@ var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
|
32845
32850
|
var MonetaryField = (props) => {
|
|
32846
32851
|
const { t: t3 } = useI18n();
|
|
32847
32852
|
const {
|
|
32848
|
-
name
|
|
32853
|
+
name,
|
|
32849
32854
|
value,
|
|
32850
32855
|
readonly,
|
|
32851
32856
|
required,
|
|
@@ -32862,7 +32867,7 @@ var MonetaryField = (props) => {
|
|
|
32862
32867
|
symbol = "VND",
|
|
32863
32868
|
baseClassName
|
|
32864
32869
|
} = props;
|
|
32865
|
-
if (isForm &&
|
|
32870
|
+
if (isForm && name === "amount_residual") {
|
|
32866
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: [
|
|
32867
32872
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "font-semibold", children: [
|
|
32868
32873
|
string,
|
|
@@ -32879,7 +32884,7 @@ var MonetaryField = (props) => {
|
|
|
32879
32884
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
32880
32885
|
Controller,
|
|
32881
32886
|
{
|
|
32882
|
-
name:
|
|
32887
|
+
name: name ?? "",
|
|
32883
32888
|
control: methods.control,
|
|
32884
32889
|
rules: {
|
|
32885
32890
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32892,7 +32897,7 @@ var MonetaryField = (props) => {
|
|
|
32892
32897
|
const { setError, clearErrors } = methods;
|
|
32893
32898
|
(0, import_react63.useEffect)(() => {
|
|
32894
32899
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32895
|
-
clearErrors(
|
|
32900
|
+
clearErrors(name);
|
|
32896
32901
|
}
|
|
32897
32902
|
}, [value2]);
|
|
32898
32903
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
@@ -32903,18 +32908,18 @@ var MonetaryField = (props) => {
|
|
|
32903
32908
|
onBlur: () => {
|
|
32904
32909
|
if (!readonly && !isNaN(value2)) {
|
|
32905
32910
|
onBlur();
|
|
32906
|
-
handleOnchange && handleOnchange(
|
|
32907
|
-
clearErrors(
|
|
32911
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32912
|
+
clearErrors(name);
|
|
32908
32913
|
}
|
|
32909
32914
|
},
|
|
32910
32915
|
onChange: (e3) => {
|
|
32911
32916
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32912
32917
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32913
32918
|
onChange2(parsedValue);
|
|
32914
|
-
clearErrors(
|
|
32919
|
+
clearErrors(name);
|
|
32915
32920
|
} else {
|
|
32916
32921
|
if (required) {
|
|
32917
|
-
setError(
|
|
32922
|
+
setError(name, {
|
|
32918
32923
|
type: "required",
|
|
32919
32924
|
message: `${string} ${t3("must_required")}`
|
|
32920
32925
|
});
|
|
@@ -33029,9 +33034,11 @@ var PriorityField = (props) => {
|
|
|
33029
33034
|
onChange: onChange2,
|
|
33030
33035
|
id,
|
|
33031
33036
|
viewData,
|
|
33032
|
-
model
|
|
33037
|
+
model,
|
|
33038
|
+
name,
|
|
33039
|
+
string
|
|
33033
33040
|
} = props;
|
|
33034
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
33041
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
33035
33042
|
const defaultPriority = parseInt(value) + 1;
|
|
33036
33043
|
if (!isForm) {
|
|
33037
33044
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
@@ -33075,7 +33082,7 @@ var import_react65 = require("react");
|
|
|
33075
33082
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
33076
33083
|
var RadioGroupField = (props) => {
|
|
33077
33084
|
const {
|
|
33078
|
-
name
|
|
33085
|
+
name,
|
|
33079
33086
|
readonly,
|
|
33080
33087
|
required,
|
|
33081
33088
|
placeholder,
|
|
@@ -33087,14 +33094,14 @@ var RadioGroupField = (props) => {
|
|
|
33087
33094
|
} = props;
|
|
33088
33095
|
(0, import_react65.useEffect)(() => {
|
|
33089
33096
|
if (selection?.length > 0) {
|
|
33090
|
-
if (setValue) setValue(
|
|
33097
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
33091
33098
|
}
|
|
33092
|
-
}, [selection,
|
|
33099
|
+
}, [selection, name, setValue]);
|
|
33093
33100
|
if (!methods) return null;
|
|
33094
33101
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
33095
33102
|
Controller,
|
|
33096
33103
|
{
|
|
33097
|
-
name:
|
|
33104
|
+
name: name ?? "",
|
|
33098
33105
|
control: methods.control,
|
|
33099
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: [
|
|
33100
33107
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
@@ -33107,8 +33114,8 @@ var RadioGroupField = (props) => {
|
|
|
33107
33114
|
onChange: (e3) => {
|
|
33108
33115
|
if (readonly) return;
|
|
33109
33116
|
field.onChange(e3.target.value);
|
|
33110
|
-
methods.setValue(
|
|
33111
|
-
onChange2?.(
|
|
33117
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
33118
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
33112
33119
|
},
|
|
33113
33120
|
readOnly: readonly,
|
|
33114
33121
|
required: !invisible && required,
|
|
@@ -33160,7 +33167,7 @@ var SelectDropdownField = (props) => {
|
|
|
33160
33167
|
const { t: t3 } = useI18n();
|
|
33161
33168
|
const {
|
|
33162
33169
|
selection,
|
|
33163
|
-
name
|
|
33170
|
+
name,
|
|
33164
33171
|
methods,
|
|
33165
33172
|
value,
|
|
33166
33173
|
readonly,
|
|
@@ -33183,7 +33190,7 @@ var SelectDropdownField = (props) => {
|
|
|
33183
33190
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
33184
33191
|
Controller,
|
|
33185
33192
|
{
|
|
33186
|
-
name:
|
|
33193
|
+
name: name || "",
|
|
33187
33194
|
control: methods.control,
|
|
33188
33195
|
rules: {
|
|
33189
33196
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -33202,7 +33209,7 @@ var SelectDropdownField = (props) => {
|
|
|
33202
33209
|
menuPlacement: "auto",
|
|
33203
33210
|
onChange: (selectedOption) => {
|
|
33204
33211
|
field.onChange(selectedOption.value);
|
|
33205
|
-
onChange2 && onChange2(
|
|
33212
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
33206
33213
|
},
|
|
33207
33214
|
value: defaultValue || null,
|
|
33208
33215
|
required: !invisible && required
|
|
@@ -33283,7 +33290,7 @@ var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
|
33283
33290
|
var TextAreaField = (props) => {
|
|
33284
33291
|
const {
|
|
33285
33292
|
methods,
|
|
33286
|
-
name
|
|
33293
|
+
name,
|
|
33287
33294
|
readonly,
|
|
33288
33295
|
placeholder,
|
|
33289
33296
|
required,
|
|
@@ -33294,7 +33301,7 @@ var TextAreaField = (props) => {
|
|
|
33294
33301
|
onChange: onChange2,
|
|
33295
33302
|
baseClassName
|
|
33296
33303
|
} = props;
|
|
33297
|
-
const formProps = methods ? methods.register(
|
|
33304
|
+
const formProps = methods ? methods.register(name, {
|
|
33298
33305
|
onBlur: (e3) => {
|
|
33299
33306
|
const newValue = e3.target.value;
|
|
33300
33307
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -33316,7 +33323,7 @@ var TextAreaField = (props) => {
|
|
|
33316
33323
|
disabled: readonly,
|
|
33317
33324
|
placeholder,
|
|
33318
33325
|
required: !invisible && required,
|
|
33319
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
33326
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
33320
33327
|
}
|
|
33321
33328
|
);
|
|
33322
33329
|
};
|
|
@@ -33325,7 +33332,7 @@ var TextAreaField = (props) => {
|
|
|
33325
33332
|
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
33326
33333
|
var ToggleButtonField = (props) => {
|
|
33327
33334
|
const {
|
|
33328
|
-
name
|
|
33335
|
+
name,
|
|
33329
33336
|
readonly = false,
|
|
33330
33337
|
required = false,
|
|
33331
33338
|
invisible = false,
|
|
@@ -33335,7 +33342,7 @@ var ToggleButtonField = (props) => {
|
|
|
33335
33342
|
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
33336
33343
|
Controller,
|
|
33337
33344
|
{
|
|
33338
|
-
name:
|
|
33345
|
+
name: name ?? "",
|
|
33339
33346
|
control: methods?.control,
|
|
33340
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: [
|
|
33341
33348
|
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
@@ -33345,10 +33352,10 @@ var ToggleButtonField = (props) => {
|
|
|
33345
33352
|
type: "checkbox",
|
|
33346
33353
|
onChange: (e3) => {
|
|
33347
33354
|
if (readonly) return;
|
|
33348
|
-
methods.setValue(
|
|
33355
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
33349
33356
|
field.onChange(e3.target.checked);
|
|
33350
33357
|
if (onChange2) {
|
|
33351
|
-
onChange2(
|
|
33358
|
+
onChange2(name ?? "", e3.target.checked);
|
|
33352
33359
|
}
|
|
33353
33360
|
},
|
|
33354
33361
|
disabled: readonly,
|
|
@@ -33395,7 +33402,7 @@ var import_react66 = require("react");
|
|
|
33395
33402
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
33396
33403
|
var IntegerField = (props) => {
|
|
33397
33404
|
const {
|
|
33398
|
-
name
|
|
33405
|
+
name,
|
|
33399
33406
|
value,
|
|
33400
33407
|
readonly,
|
|
33401
33408
|
placeholder,
|
|
@@ -33417,7 +33424,7 @@ var IntegerField = (props) => {
|
|
|
33417
33424
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
33418
33425
|
Controller,
|
|
33419
33426
|
{
|
|
33420
|
-
name:
|
|
33427
|
+
name: name || "",
|
|
33421
33428
|
control: methods.control,
|
|
33422
33429
|
rules: {
|
|
33423
33430
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -33437,12 +33444,12 @@ var IntegerField = (props) => {
|
|
|
33437
33444
|
(0, import_react66.useEffect)(() => {
|
|
33438
33445
|
if (value2 !== void 0 && value2 !== null) {
|
|
33439
33446
|
setInputValue(String(value2));
|
|
33440
|
-
clearErrors(
|
|
33447
|
+
clearErrors(name);
|
|
33441
33448
|
}
|
|
33442
33449
|
}, [value2]);
|
|
33443
33450
|
const noticeError = () => {
|
|
33444
33451
|
if (required) {
|
|
33445
|
-
setError(
|
|
33452
|
+
setError(name, {
|
|
33446
33453
|
type: "required",
|
|
33447
33454
|
message: `${string} ${t3("must_required")}`
|
|
33448
33455
|
});
|
|
@@ -33460,7 +33467,7 @@ var IntegerField = (props) => {
|
|
|
33460
33467
|
if (!isNaN(parsed)) {
|
|
33461
33468
|
fieldOnChange(parsed);
|
|
33462
33469
|
isDirtyRef.current = true;
|
|
33463
|
-
clearErrors(
|
|
33470
|
+
clearErrors(name);
|
|
33464
33471
|
} else {
|
|
33465
33472
|
noticeError();
|
|
33466
33473
|
}
|
|
@@ -33486,11 +33493,11 @@ var IntegerField = (props) => {
|
|
|
33486
33493
|
return;
|
|
33487
33494
|
}
|
|
33488
33495
|
fieldOnChange(parsed);
|
|
33489
|
-
onChange2?.(
|
|
33496
|
+
onChange2?.(name ?? "", parsed);
|
|
33490
33497
|
lastCommittedValueRef.current = parsed;
|
|
33491
33498
|
isDirtyRef.current = false;
|
|
33492
33499
|
inputRef.current?.blur();
|
|
33493
|
-
clearErrors(
|
|
33500
|
+
clearErrors(name);
|
|
33494
33501
|
};
|
|
33495
33502
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
33496
33503
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
@@ -33899,7 +33906,7 @@ var Many2OneField = (props) => {
|
|
|
33899
33906
|
isForm,
|
|
33900
33907
|
isEditTable,
|
|
33901
33908
|
value: propValue,
|
|
33902
|
-
name
|
|
33909
|
+
name,
|
|
33903
33910
|
readonly,
|
|
33904
33911
|
methods,
|
|
33905
33912
|
required,
|
|
@@ -33926,7 +33933,7 @@ var Many2OneField = (props) => {
|
|
|
33926
33933
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33927
33934
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33928
33935
|
allowShowDetail && renderDetail({
|
|
33929
|
-
idToolTip: String(
|
|
33936
|
+
idToolTip: String(name) + Number(index4),
|
|
33930
33937
|
model: options2?.model ?? relation,
|
|
33931
33938
|
context: contextObject,
|
|
33932
33939
|
idForm: id
|
|
@@ -33935,8 +33942,8 @@ var Many2OneField = (props) => {
|
|
|
33935
33942
|
"span",
|
|
33936
33943
|
{
|
|
33937
33944
|
className: "cursor-pointer",
|
|
33938
|
-
"data-tooltip-id": String(
|
|
33939
|
-
id:
|
|
33945
|
+
"data-tooltip-id": String(name) + index4,
|
|
33946
|
+
id: name,
|
|
33940
33947
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33941
33948
|
}
|
|
33942
33949
|
)
|
|
@@ -33944,21 +33951,21 @@ var Many2OneField = (props) => {
|
|
|
33944
33951
|
}
|
|
33945
33952
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
33946
33953
|
allowShowDetail && renderDetail({
|
|
33947
|
-
idToolTip: String(
|
|
33954
|
+
idToolTip: String(name),
|
|
33948
33955
|
model: options2?.model ?? relation,
|
|
33949
33956
|
context: contextObject,
|
|
33950
|
-
idForm: methods?.getValues(
|
|
33957
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33951
33958
|
}),
|
|
33952
33959
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33953
33960
|
"div",
|
|
33954
33961
|
{
|
|
33955
|
-
id:
|
|
33956
|
-
"data-tooltip-id":
|
|
33962
|
+
id: name,
|
|
33963
|
+
"data-tooltip-id": name,
|
|
33957
33964
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33958
33965
|
children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
33959
33966
|
Controller,
|
|
33960
33967
|
{
|
|
33961
|
-
name:
|
|
33968
|
+
name: name ?? "",
|
|
33962
33969
|
control: methods?.control,
|
|
33963
33970
|
rules: {
|
|
33964
33971
|
required: required ? {
|
|
@@ -33979,7 +33986,7 @@ var Many2OneField = (props) => {
|
|
|
33979
33986
|
) ?? currentValue : currentValue ?? null;
|
|
33980
33987
|
(0, import_react68.useEffect)(() => {
|
|
33981
33988
|
if (error2 && selectedOption) {
|
|
33982
|
-
methods?.clearErrors(
|
|
33989
|
+
methods?.clearErrors(name);
|
|
33983
33990
|
}
|
|
33984
33991
|
}, [selectedOption]);
|
|
33985
33992
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
@@ -34342,7 +34349,7 @@ var ICCheck = () => {
|
|
|
34342
34349
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
34343
34350
|
var DateOptionField = (props) => {
|
|
34344
34351
|
const {
|
|
34345
|
-
name
|
|
34352
|
+
name,
|
|
34346
34353
|
readonly,
|
|
34347
34354
|
required,
|
|
34348
34355
|
invisible,
|
|
@@ -34353,7 +34360,7 @@ var DateOptionField = (props) => {
|
|
|
34353
34360
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
34354
34361
|
Controller,
|
|
34355
34362
|
{
|
|
34356
|
-
name:
|
|
34363
|
+
name: name ?? "",
|
|
34357
34364
|
control: methods?.control,
|
|
34358
34365
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
|
|
34359
34366
|
"label",
|
|
@@ -34374,9 +34381,9 @@ var DateOptionField = (props) => {
|
|
|
34374
34381
|
onChange: (e3) => {
|
|
34375
34382
|
if (readonly) return;
|
|
34376
34383
|
const value = e3.target.checked;
|
|
34377
|
-
methods.setValue(
|
|
34384
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
34378
34385
|
field.onChange(value);
|
|
34379
|
-
onChange2?.(
|
|
34386
|
+
onChange2?.(name ?? "", value);
|
|
34380
34387
|
}
|
|
34381
34388
|
}
|
|
34382
34389
|
),
|