@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/widgets.mjs
CHANGED
|
@@ -264,13 +264,13 @@ var require_moment = __commonJS({
|
|
|
264
264
|
}, fn);
|
|
265
265
|
}
|
|
266
266
|
var deprecations = {};
|
|
267
|
-
function deprecateSimple(
|
|
267
|
+
function deprecateSimple(name, msg) {
|
|
268
268
|
if (hooks.deprecationHandler != null) {
|
|
269
|
-
hooks.deprecationHandler(
|
|
269
|
+
hooks.deprecationHandler(name, msg);
|
|
270
270
|
}
|
|
271
|
-
if (!deprecations[
|
|
271
|
+
if (!deprecations[name]) {
|
|
272
272
|
warn3(msg);
|
|
273
|
-
deprecations[
|
|
273
|
+
deprecations[name] = true;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
hooks.suppressDeprecationWarnings = false;
|
|
@@ -1552,22 +1552,22 @@ var require_moment = __commonJS({
|
|
|
1552
1552
|
}
|
|
1553
1553
|
return globalLocale;
|
|
1554
1554
|
}
|
|
1555
|
-
function isLocaleNameSane(
|
|
1556
|
-
return !!(
|
|
1555
|
+
function isLocaleNameSane(name) {
|
|
1556
|
+
return !!(name && name.match("^[^/\\\\]*$"));
|
|
1557
1557
|
}
|
|
1558
|
-
function loadLocale(
|
|
1558
|
+
function loadLocale(name) {
|
|
1559
1559
|
var oldLocale = null, aliasedRequire;
|
|
1560
|
-
if (locales[
|
|
1560
|
+
if (locales[name] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name)) {
|
|
1561
1561
|
try {
|
|
1562
1562
|
oldLocale = globalLocale._abbr;
|
|
1563
1563
|
aliasedRequire = __require;
|
|
1564
|
-
aliasedRequire("./locale/" +
|
|
1564
|
+
aliasedRequire("./locale/" + name);
|
|
1565
1565
|
getSetGlobalLocale(oldLocale);
|
|
1566
1566
|
} catch (e3) {
|
|
1567
|
-
locales[
|
|
1567
|
+
locales[name] = null;
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
-
return locales[
|
|
1570
|
+
return locales[name];
|
|
1571
1571
|
}
|
|
1572
1572
|
function getSetGlobalLocale(key, values) {
|
|
1573
1573
|
var data;
|
|
@@ -1589,16 +1589,16 @@ var require_moment = __commonJS({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
return globalLocale._abbr;
|
|
1591
1591
|
}
|
|
1592
|
-
function defineLocale(
|
|
1592
|
+
function defineLocale(name, config) {
|
|
1593
1593
|
if (config !== null) {
|
|
1594
1594
|
var locale2, parentConfig = baseConfig;
|
|
1595
|
-
config.abbr =
|
|
1596
|
-
if (locales[
|
|
1595
|
+
config.abbr = name;
|
|
1596
|
+
if (locales[name] != null) {
|
|
1597
1597
|
deprecateSimple(
|
|
1598
1598
|
"defineLocaleOverride",
|
|
1599
1599
|
"use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
|
|
1600
1600
|
);
|
|
1601
|
-
parentConfig = locales[
|
|
1601
|
+
parentConfig = locales[name]._config;
|
|
1602
1602
|
} else if (config.parentLocale != null) {
|
|
1603
1603
|
if (locales[config.parentLocale] != null) {
|
|
1604
1604
|
parentConfig = locales[config.parentLocale]._config;
|
|
@@ -1611,58 +1611,58 @@ var require_moment = __commonJS({
|
|
|
1611
1611
|
localeFamilies[config.parentLocale] = [];
|
|
1612
1612
|
}
|
|
1613
1613
|
localeFamilies[config.parentLocale].push({
|
|
1614
|
-
name
|
|
1614
|
+
name,
|
|
1615
1615
|
config
|
|
1616
1616
|
});
|
|
1617
1617
|
return null;
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
|
-
locales[
|
|
1622
|
-
if (localeFamilies[
|
|
1623
|
-
localeFamilies[
|
|
1621
|
+
locales[name] = new Locale(mergeConfigs(parentConfig, config));
|
|
1622
|
+
if (localeFamilies[name]) {
|
|
1623
|
+
localeFamilies[name].forEach(function(x2) {
|
|
1624
1624
|
defineLocale(x2.name, x2.config);
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
|
-
getSetGlobalLocale(
|
|
1628
|
-
return locales[
|
|
1627
|
+
getSetGlobalLocale(name);
|
|
1628
|
+
return locales[name];
|
|
1629
1629
|
} else {
|
|
1630
|
-
delete locales[
|
|
1630
|
+
delete locales[name];
|
|
1631
1631
|
return null;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
|
-
function updateLocale(
|
|
1634
|
+
function updateLocale(name, config) {
|
|
1635
1635
|
if (config != null) {
|
|
1636
1636
|
var locale2, tmpLocale, parentConfig = baseConfig;
|
|
1637
|
-
if (locales[
|
|
1638
|
-
locales[
|
|
1637
|
+
if (locales[name] != null && locales[name].parentLocale != null) {
|
|
1638
|
+
locales[name].set(mergeConfigs(locales[name]._config, config));
|
|
1639
1639
|
} else {
|
|
1640
|
-
tmpLocale = loadLocale(
|
|
1640
|
+
tmpLocale = loadLocale(name);
|
|
1641
1641
|
if (tmpLocale != null) {
|
|
1642
1642
|
parentConfig = tmpLocale._config;
|
|
1643
1643
|
}
|
|
1644
1644
|
config = mergeConfigs(parentConfig, config);
|
|
1645
1645
|
if (tmpLocale == null) {
|
|
1646
|
-
config.abbr =
|
|
1646
|
+
config.abbr = name;
|
|
1647
1647
|
}
|
|
1648
1648
|
locale2 = new Locale(config);
|
|
1649
|
-
locale2.parentLocale = locales[
|
|
1650
|
-
locales[
|
|
1649
|
+
locale2.parentLocale = locales[name];
|
|
1650
|
+
locales[name] = locale2;
|
|
1651
1651
|
}
|
|
1652
|
-
getSetGlobalLocale(
|
|
1652
|
+
getSetGlobalLocale(name);
|
|
1653
1653
|
} else {
|
|
1654
|
-
if (locales[
|
|
1655
|
-
if (locales[
|
|
1656
|
-
locales[
|
|
1657
|
-
if (
|
|
1658
|
-
getSetGlobalLocale(
|
|
1654
|
+
if (locales[name] != null) {
|
|
1655
|
+
if (locales[name].parentLocale != null) {
|
|
1656
|
+
locales[name] = locales[name].parentLocale;
|
|
1657
|
+
if (name === getSetGlobalLocale()) {
|
|
1658
|
+
getSetGlobalLocale(name);
|
|
1659
1659
|
}
|
|
1660
|
-
} else if (locales[
|
|
1661
|
-
delete locales[
|
|
1660
|
+
} else if (locales[name] != null) {
|
|
1661
|
+
delete locales[name];
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
-
return locales[
|
|
1665
|
+
return locales[name];
|
|
1666
1666
|
}
|
|
1667
1667
|
function getLocale(key) {
|
|
1668
1668
|
var locale2;
|
|
@@ -2568,13 +2568,13 @@ var require_moment = __commonJS({
|
|
|
2568
2568
|
}
|
|
2569
2569
|
return res;
|
|
2570
2570
|
}
|
|
2571
|
-
function createAdder(direction,
|
|
2571
|
+
function createAdder(direction, name) {
|
|
2572
2572
|
return function(val, period) {
|
|
2573
2573
|
var dur, tmp;
|
|
2574
2574
|
if (period !== null && !isNaN(+period)) {
|
|
2575
2575
|
deprecateSimple(
|
|
2576
|
-
|
|
2577
|
-
"moment()." +
|
|
2576
|
+
name,
|
|
2577
|
+
"moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
|
|
2578
2578
|
);
|
|
2579
2579
|
tmp = val;
|
|
2580
2580
|
val = period;
|
|
@@ -3153,10 +3153,10 @@ var require_moment = __commonJS({
|
|
|
3153
3153
|
return eras;
|
|
3154
3154
|
}
|
|
3155
3155
|
function localeErasParse(eraName, format3, strict) {
|
|
3156
|
-
var i3, l2, eras = this.eras(),
|
|
3156
|
+
var i3, l2, eras = this.eras(), name, abbr, narrow;
|
|
3157
3157
|
eraName = eraName.toUpperCase();
|
|
3158
3158
|
for (i3 = 0, l2 = eras.length; i3 < l2; ++i3) {
|
|
3159
|
-
|
|
3159
|
+
name = eras[i3].name.toUpperCase();
|
|
3160
3160
|
abbr = eras[i3].abbr.toUpperCase();
|
|
3161
3161
|
narrow = eras[i3].narrow.toUpperCase();
|
|
3162
3162
|
if (strict) {
|
|
@@ -3169,7 +3169,7 @@ var require_moment = __commonJS({
|
|
|
3169
3169
|
}
|
|
3170
3170
|
break;
|
|
3171
3171
|
case "NNNN":
|
|
3172
|
-
if (
|
|
3172
|
+
if (name === eraName) {
|
|
3173
3173
|
return eras[i3];
|
|
3174
3174
|
}
|
|
3175
3175
|
break;
|
|
@@ -3179,7 +3179,7 @@ var require_moment = __commonJS({
|
|
|
3179
3179
|
}
|
|
3180
3180
|
break;
|
|
3181
3181
|
}
|
|
3182
|
-
} else if ([
|
|
3182
|
+
} else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
|
|
3183
3183
|
return eras[i3];
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
@@ -3817,9 +3817,9 @@ var require_moment = __commonJS({
|
|
|
3817
3817
|
units = normalizeUnits(units);
|
|
3818
3818
|
return this.isValid() ? this[units + "s"]() : NaN;
|
|
3819
3819
|
}
|
|
3820
|
-
function makeGetter(
|
|
3820
|
+
function makeGetter(name) {
|
|
3821
3821
|
return function() {
|
|
3822
|
-
return this.isValid() ? this._data[
|
|
3822
|
+
return this.isValid() ? this._data[name] : NaN;
|
|
3823
3823
|
};
|
|
3824
3824
|
}
|
|
3825
3825
|
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
|
|
@@ -6400,11 +6400,11 @@ var Formatter = class {
|
|
|
6400
6400
|
};
|
|
6401
6401
|
this.formatSeparator = options2.interpolation.formatSeparator || ",";
|
|
6402
6402
|
}
|
|
6403
|
-
add(
|
|
6404
|
-
this.formats[
|
|
6403
|
+
add(name, fc) {
|
|
6404
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
6405
6405
|
}
|
|
6406
|
-
addCached(
|
|
6407
|
-
this.formats[
|
|
6406
|
+
addCached(name, fc) {
|
|
6407
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
6408
6408
|
}
|
|
6409
6409
|
format(value, format2, lng) {
|
|
6410
6410
|
let options2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -6440,9 +6440,9 @@ var Formatter = class {
|
|
|
6440
6440
|
return result;
|
|
6441
6441
|
}
|
|
6442
6442
|
};
|
|
6443
|
-
var removePending = (q3,
|
|
6444
|
-
if (q3.pending[
|
|
6445
|
-
delete q3.pending[
|
|
6443
|
+
var removePending = (q3, name) => {
|
|
6444
|
+
if (q3.pending[name] !== void 0) {
|
|
6445
|
+
delete q3.pending[name];
|
|
6446
6446
|
q3.pendingCount--;
|
|
6447
6447
|
}
|
|
6448
6448
|
};
|
|
@@ -6473,17 +6473,17 @@ var Connector = class extends EventEmitter {
|
|
|
6473
6473
|
languages.forEach((lng) => {
|
|
6474
6474
|
let hasAllNamespaces = true;
|
|
6475
6475
|
namespaces.forEach((ns) => {
|
|
6476
|
-
const
|
|
6476
|
+
const name = `${lng}|${ns}`;
|
|
6477
6477
|
if (!options2.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
6478
|
-
this.state[
|
|
6479
|
-
} else if (this.state[
|
|
6480
|
-
else if (this.state[
|
|
6481
|
-
if (pending[
|
|
6478
|
+
this.state[name] = 2;
|
|
6479
|
+
} else if (this.state[name] < 0) ;
|
|
6480
|
+
else if (this.state[name] === 1) {
|
|
6481
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
6482
6482
|
} else {
|
|
6483
|
-
this.state[
|
|
6483
|
+
this.state[name] = 1;
|
|
6484
6484
|
hasAllNamespaces = false;
|
|
6485
|
-
if (pending[
|
|
6486
|
-
if (toLoad[
|
|
6485
|
+
if (pending[name] === void 0) pending[name] = true;
|
|
6486
|
+
if (toLoad[name] === void 0) toLoad[name] = true;
|
|
6487
6487
|
if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true;
|
|
6488
6488
|
}
|
|
6489
6489
|
});
|
|
@@ -6505,8 +6505,8 @@ var Connector = class extends EventEmitter {
|
|
|
6505
6505
|
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
6506
6506
|
};
|
|
6507
6507
|
}
|
|
6508
|
-
loaded(
|
|
6509
|
-
const s4 =
|
|
6508
|
+
loaded(name, err, data) {
|
|
6509
|
+
const s4 = name.split("|");
|
|
6510
6510
|
const lng = s4[0];
|
|
6511
6511
|
const ns = s4[1];
|
|
6512
6512
|
if (err) this.emit("failedLoading", lng, ns, err);
|
|
@@ -6515,12 +6515,12 @@ var Connector = class extends EventEmitter {
|
|
|
6515
6515
|
skipCopy: true
|
|
6516
6516
|
});
|
|
6517
6517
|
}
|
|
6518
|
-
this.state[
|
|
6519
|
-
if (err && data) this.state[
|
|
6518
|
+
this.state[name] = err ? -1 : 2;
|
|
6519
|
+
if (err && data) this.state[name] = 0;
|
|
6520
6520
|
const loaded = {};
|
|
6521
6521
|
this.queue.forEach((q3) => {
|
|
6522
6522
|
pushPath(q3.loaded, [lng], ns);
|
|
6523
|
-
removePending(q3,
|
|
6523
|
+
removePending(q3, name);
|
|
6524
6524
|
if (err) q3.errors.push(err);
|
|
6525
6525
|
if (q3.pendingCount === 0 && !q3.done) {
|
|
6526
6526
|
Object.keys(q3.loaded).forEach((l2) => {
|
|
@@ -6604,8 +6604,8 @@ var Connector = class extends EventEmitter {
|
|
|
6604
6604
|
if (!toLoad.pending.length) callback();
|
|
6605
6605
|
return null;
|
|
6606
6606
|
}
|
|
6607
|
-
toLoad.toLoad.forEach((
|
|
6608
|
-
this.loadOne(
|
|
6607
|
+
toLoad.toLoad.forEach((name) => {
|
|
6608
|
+
this.loadOne(name);
|
|
6609
6609
|
});
|
|
6610
6610
|
}
|
|
6611
6611
|
load(languages, namespaces, callback) {
|
|
@@ -6616,15 +6616,15 @@ var Connector = class extends EventEmitter {
|
|
|
6616
6616
|
reload: true
|
|
6617
6617
|
}, callback);
|
|
6618
6618
|
}
|
|
6619
|
-
loadOne(
|
|
6619
|
+
loadOne(name) {
|
|
6620
6620
|
let prefix2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
6621
|
-
const s4 =
|
|
6621
|
+
const s4 = name.split("|");
|
|
6622
6622
|
const lng = s4[0];
|
|
6623
6623
|
const ns = s4[1];
|
|
6624
6624
|
this.read(lng, ns, "read", void 0, void 0, (err, data) => {
|
|
6625
6625
|
if (err) this.logger.warn(`${prefix2}loading namespace ${ns} for language ${lng} failed`, err);
|
|
6626
6626
|
if (!err && data) this.logger.log(`${prefix2}loaded namespace ${ns} for language ${lng}`, data);
|
|
6627
|
-
this.loaded(
|
|
6627
|
+
this.loaded(name, err, data);
|
|
6628
6628
|
});
|
|
6629
6629
|
}
|
|
6630
6630
|
saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
@@ -7274,13 +7274,13 @@ function hasXSS(input) {
|
|
|
7274
7274
|
return xssPatterns.some((pattern) => pattern.test(input));
|
|
7275
7275
|
}
|
|
7276
7276
|
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
7277
|
-
var serializeCookie = function(
|
|
7277
|
+
var serializeCookie = function(name, val) {
|
|
7278
7278
|
let options2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
7279
7279
|
path: "/"
|
|
7280
7280
|
};
|
|
7281
7281
|
const opt = options2;
|
|
7282
7282
|
const value = encodeURIComponent(val);
|
|
7283
|
-
let str = `${
|
|
7283
|
+
let str = `${name}=${value}`;
|
|
7284
7284
|
if (opt.maxAge > 0) {
|
|
7285
7285
|
const maxAge = opt.maxAge - 0;
|
|
7286
7286
|
if (Number.isNaN(maxAge)) throw new Error("maxAge should be a Number");
|
|
@@ -7329,7 +7329,7 @@ var serializeCookie = function(name2, val) {
|
|
|
7329
7329
|
return str;
|
|
7330
7330
|
};
|
|
7331
7331
|
var cookie = {
|
|
7332
|
-
create(
|
|
7332
|
+
create(name, value, minutes, domain) {
|
|
7333
7333
|
let cookieOptions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
7334
7334
|
path: "/",
|
|
7335
7335
|
sameSite: "strict"
|
|
@@ -7339,10 +7339,10 @@ var cookie = {
|
|
|
7339
7339
|
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1e3);
|
|
7340
7340
|
}
|
|
7341
7341
|
if (domain) cookieOptions.domain = domain;
|
|
7342
|
-
document.cookie = serializeCookie(
|
|
7342
|
+
document.cookie = serializeCookie(name, value, cookieOptions);
|
|
7343
7343
|
},
|
|
7344
|
-
read(
|
|
7345
|
-
const nameEQ = `${
|
|
7344
|
+
read(name) {
|
|
7345
|
+
const nameEQ = `${name}=`;
|
|
7346
7346
|
const ca = document.cookie.split(";");
|
|
7347
7347
|
for (let i3 = 0; i3 < ca.length; i3++) {
|
|
7348
7348
|
let c2 = ca[i3];
|
|
@@ -7351,8 +7351,8 @@ var cookie = {
|
|
|
7351
7351
|
}
|
|
7352
7352
|
return null;
|
|
7353
7353
|
},
|
|
7354
|
-
remove(
|
|
7355
|
-
this.create(
|
|
7354
|
+
remove(name, domain) {
|
|
7355
|
+
this.create(name, "", -1, domain);
|
|
7356
7356
|
}
|
|
7357
7357
|
};
|
|
7358
7358
|
var cookie$1 = {
|
|
@@ -9918,6 +9918,10 @@ var Row = (props) => {
|
|
|
9918
9918
|
isDisplayCheckbox && /* @__PURE__ */ jsx47(
|
|
9919
9919
|
"td",
|
|
9920
9920
|
{
|
|
9921
|
+
style: {
|
|
9922
|
+
width: "40px",
|
|
9923
|
+
maxWidth: "40px"
|
|
9924
|
+
},
|
|
9921
9925
|
className: `td-checkbox column w-max whitespace-nowrap p-3 border-b border-gray-200 text-sm font-normal text-gray-900`,
|
|
9922
9926
|
children: /* @__PURE__ */ jsx47(
|
|
9923
9927
|
"input",
|
|
@@ -10409,7 +10413,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10409
10413
|
let resetCount = 0;
|
|
10410
10414
|
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
10411
10415
|
const {
|
|
10412
|
-
name
|
|
10416
|
+
name,
|
|
10413
10417
|
fn
|
|
10414
10418
|
} = validMiddleware[i3];
|
|
10415
10419
|
const {
|
|
@@ -10435,8 +10439,8 @@ var computePosition = async (reference, floating, config) => {
|
|
|
10435
10439
|
y3 = nextY != null ? nextY : y3;
|
|
10436
10440
|
middlewareData = {
|
|
10437
10441
|
...middlewareData,
|
|
10438
|
-
[
|
|
10439
|
-
...middlewareData[
|
|
10442
|
+
[name]: {
|
|
10443
|
+
...middlewareData[name],
|
|
10440
10444
|
...data
|
|
10441
10445
|
}
|
|
10442
10446
|
};
|
|
@@ -12026,7 +12030,8 @@ var TableHead = (props) => {
|
|
|
12026
12030
|
{
|
|
12027
12031
|
style: {
|
|
12028
12032
|
width: "40px",
|
|
12029
|
-
maxWidth: "40px"
|
|
12033
|
+
maxWidth: "40px",
|
|
12034
|
+
overflow: "unset !important"
|
|
12030
12035
|
},
|
|
12031
12036
|
className: ` table-checkbox-row th-checkbox text-left font-medium uppercase text-gray-500 p-3`,
|
|
12032
12037
|
children: /* @__PURE__ */ jsx51(
|
|
@@ -12501,8 +12506,8 @@ var isNullOrUndefined = (value) => value == null;
|
|
|
12501
12506
|
var isObjectType = (value) => typeof value === "object";
|
|
12502
12507
|
var isObject2 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
12503
12508
|
var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
12504
|
-
var getNodeParentName = (
|
|
12505
|
-
var isNameInFieldArray = (names,
|
|
12509
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
12510
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
12506
12511
|
var isPlainObject = (tempObject) => {
|
|
12507
12512
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
12508
12513
|
return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
@@ -12606,7 +12611,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
12606
12611
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
12607
12612
|
function useFormState(props) {
|
|
12608
12613
|
const methods = useFormContext();
|
|
12609
|
-
const { control = methods.control, disabled, name
|
|
12614
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
12610
12615
|
const [formState, updateFormState] = React.useState(control._formState);
|
|
12611
12616
|
const _localProxyFormState = React.useRef({
|
|
12612
12617
|
isDirty: false,
|
|
@@ -12619,7 +12624,7 @@ function useFormState(props) {
|
|
|
12619
12624
|
errors: false
|
|
12620
12625
|
});
|
|
12621
12626
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12622
|
-
name
|
|
12627
|
+
name,
|
|
12623
12628
|
formState: _localProxyFormState.current,
|
|
12624
12629
|
exact,
|
|
12625
12630
|
callback: (formState2) => {
|
|
@@ -12628,7 +12633,7 @@ function useFormState(props) {
|
|
|
12628
12633
|
...formState2
|
|
12629
12634
|
});
|
|
12630
12635
|
}
|
|
12631
|
-
}), [
|
|
12636
|
+
}), [name, disabled, exact]);
|
|
12632
12637
|
React.useEffect(() => {
|
|
12633
12638
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
12634
12639
|
}, [control]);
|
|
@@ -12680,22 +12685,22 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
12680
12685
|
}
|
|
12681
12686
|
function useWatch(props) {
|
|
12682
12687
|
const methods = useFormContext();
|
|
12683
|
-
const { control = methods.control, name
|
|
12688
|
+
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
12684
12689
|
const _defaultValue = React.useRef(defaultValue);
|
|
12685
12690
|
const _compute = React.useRef(compute);
|
|
12686
12691
|
const _computeFormValues = React.useRef(void 0);
|
|
12687
12692
|
_compute.current = compute;
|
|
12688
|
-
const defaultValueMemo = React.useMemo(() => control._getWatch(
|
|
12693
|
+
const defaultValueMemo = React.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
12689
12694
|
const [value, updateValue] = React.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
12690
12695
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12691
|
-
name
|
|
12696
|
+
name,
|
|
12692
12697
|
formState: {
|
|
12693
12698
|
values: true
|
|
12694
12699
|
},
|
|
12695
12700
|
exact,
|
|
12696
12701
|
callback: (formState) => {
|
|
12697
12702
|
if (!disabled) {
|
|
12698
|
-
const formValues = generateWatchOutput(
|
|
12703
|
+
const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
|
|
12699
12704
|
if (_compute.current) {
|
|
12700
12705
|
const computedFormValues = _compute.current(formValues);
|
|
12701
12706
|
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
@@ -12707,28 +12712,28 @@ function useWatch(props) {
|
|
|
12707
12712
|
}
|
|
12708
12713
|
}
|
|
12709
12714
|
}
|
|
12710
|
-
}), [control, disabled,
|
|
12715
|
+
}), [control, disabled, name, exact]);
|
|
12711
12716
|
React.useEffect(() => control._removeUnmounted());
|
|
12712
12717
|
return value;
|
|
12713
12718
|
}
|
|
12714
12719
|
function useController(props) {
|
|
12715
12720
|
const methods = useFormContext();
|
|
12716
|
-
const { name
|
|
12717
|
-
const isArrayField = isNameInFieldArray(control._names.array,
|
|
12718
|
-
const defaultValueMemo = React.useMemo(() => get2(control._formValues,
|
|
12721
|
+
const { name, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
12722
|
+
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
12723
|
+
const defaultValueMemo = React.useMemo(() => get2(control._formValues, name, get2(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
12719
12724
|
const value = useWatch({
|
|
12720
12725
|
control,
|
|
12721
|
-
name
|
|
12726
|
+
name,
|
|
12722
12727
|
defaultValue: defaultValueMemo,
|
|
12723
12728
|
exact: true
|
|
12724
12729
|
});
|
|
12725
12730
|
const formState = useFormState({
|
|
12726
12731
|
control,
|
|
12727
|
-
name
|
|
12732
|
+
name,
|
|
12728
12733
|
exact: true
|
|
12729
12734
|
});
|
|
12730
12735
|
const _props = React.useRef(props);
|
|
12731
|
-
const _registerProps = React.useRef(control.register(
|
|
12736
|
+
const _registerProps = React.useRef(control.register(name, {
|
|
12732
12737
|
...props.rules,
|
|
12733
12738
|
value,
|
|
12734
12739
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
@@ -12737,41 +12742,41 @@ function useController(props) {
|
|
|
12737
12742
|
const fieldState = React.useMemo(() => Object.defineProperties({}, {
|
|
12738
12743
|
invalid: {
|
|
12739
12744
|
enumerable: true,
|
|
12740
|
-
get: () => !!get2(formState.errors,
|
|
12745
|
+
get: () => !!get2(formState.errors, name)
|
|
12741
12746
|
},
|
|
12742
12747
|
isDirty: {
|
|
12743
12748
|
enumerable: true,
|
|
12744
|
-
get: () => !!get2(formState.dirtyFields,
|
|
12749
|
+
get: () => !!get2(formState.dirtyFields, name)
|
|
12745
12750
|
},
|
|
12746
12751
|
isTouched: {
|
|
12747
12752
|
enumerable: true,
|
|
12748
|
-
get: () => !!get2(formState.touchedFields,
|
|
12753
|
+
get: () => !!get2(formState.touchedFields, name)
|
|
12749
12754
|
},
|
|
12750
12755
|
isValidating: {
|
|
12751
12756
|
enumerable: true,
|
|
12752
|
-
get: () => !!get2(formState.validatingFields,
|
|
12757
|
+
get: () => !!get2(formState.validatingFields, name)
|
|
12753
12758
|
},
|
|
12754
12759
|
error: {
|
|
12755
12760
|
enumerable: true,
|
|
12756
|
-
get: () => get2(formState.errors,
|
|
12761
|
+
get: () => get2(formState.errors, name)
|
|
12757
12762
|
}
|
|
12758
|
-
}), [formState,
|
|
12763
|
+
}), [formState, name]);
|
|
12759
12764
|
const onChange2 = React.useCallback((event) => _registerProps.current.onChange({
|
|
12760
12765
|
target: {
|
|
12761
12766
|
value: getEventValue(event),
|
|
12762
|
-
name
|
|
12767
|
+
name
|
|
12763
12768
|
},
|
|
12764
12769
|
type: EVENTS.CHANGE
|
|
12765
|
-
}), [
|
|
12770
|
+
}), [name]);
|
|
12766
12771
|
const onBlur = React.useCallback(() => _registerProps.current.onBlur({
|
|
12767
12772
|
target: {
|
|
12768
|
-
value: get2(control._formValues,
|
|
12769
|
-
name
|
|
12773
|
+
value: get2(control._formValues, name),
|
|
12774
|
+
name
|
|
12770
12775
|
},
|
|
12771
12776
|
type: EVENTS.BLUR
|
|
12772
|
-
}), [
|
|
12777
|
+
}), [name, control._formValues]);
|
|
12773
12778
|
const ref = React.useCallback((elm) => {
|
|
12774
|
-
const field2 = get2(control._fields,
|
|
12779
|
+
const field2 = get2(control._fields, name);
|
|
12775
12780
|
if (field2 && elm) {
|
|
12776
12781
|
field2._f.ref = {
|
|
12777
12782
|
focus: () => elm.focus && elm.focus(),
|
|
@@ -12780,46 +12785,46 @@ function useController(props) {
|
|
|
12780
12785
|
reportValidity: () => elm.reportValidity()
|
|
12781
12786
|
};
|
|
12782
12787
|
}
|
|
12783
|
-
}, [control._fields,
|
|
12788
|
+
}, [control._fields, name]);
|
|
12784
12789
|
const field = React.useMemo(() => ({
|
|
12785
|
-
name
|
|
12790
|
+
name,
|
|
12786
12791
|
value,
|
|
12787
12792
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
12788
12793
|
onChange: onChange2,
|
|
12789
12794
|
onBlur,
|
|
12790
12795
|
ref
|
|
12791
|
-
}), [
|
|
12796
|
+
}), [name, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
12792
12797
|
React.useEffect(() => {
|
|
12793
12798
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
12794
|
-
control.register(
|
|
12799
|
+
control.register(name, {
|
|
12795
12800
|
..._props.current.rules,
|
|
12796
12801
|
...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {}
|
|
12797
12802
|
});
|
|
12798
|
-
const updateMounted = (
|
|
12799
|
-
const field2 = get2(control._fields,
|
|
12803
|
+
const updateMounted = (name2, value2) => {
|
|
12804
|
+
const field2 = get2(control._fields, name2);
|
|
12800
12805
|
if (field2 && field2._f) {
|
|
12801
12806
|
field2._f.mount = value2;
|
|
12802
12807
|
}
|
|
12803
12808
|
};
|
|
12804
|
-
updateMounted(
|
|
12809
|
+
updateMounted(name, true);
|
|
12805
12810
|
if (_shouldUnregisterField) {
|
|
12806
|
-
const value2 = cloneObject(get2(control._options.defaultValues,
|
|
12807
|
-
set(control._defaultValues,
|
|
12808
|
-
if (isUndefined(get2(control._formValues,
|
|
12809
|
-
set(control._formValues,
|
|
12811
|
+
const value2 = cloneObject(get2(control._options.defaultValues, name));
|
|
12812
|
+
set(control._defaultValues, name, value2);
|
|
12813
|
+
if (isUndefined(get2(control._formValues, name))) {
|
|
12814
|
+
set(control._formValues, name, value2);
|
|
12810
12815
|
}
|
|
12811
12816
|
}
|
|
12812
|
-
!isArrayField && control.register(
|
|
12817
|
+
!isArrayField && control.register(name);
|
|
12813
12818
|
return () => {
|
|
12814
|
-
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(
|
|
12819
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
12815
12820
|
};
|
|
12816
|
-
}, [
|
|
12821
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
12817
12822
|
React.useEffect(() => {
|
|
12818
12823
|
control._setDisabledField({
|
|
12819
12824
|
disabled,
|
|
12820
|
-
name
|
|
12825
|
+
name
|
|
12821
12826
|
});
|
|
12822
|
-
}, [disabled,
|
|
12827
|
+
}, [disabled, name, control]);
|
|
12823
12828
|
return React.useMemo(() => ({
|
|
12824
12829
|
field,
|
|
12825
12830
|
formState,
|
|
@@ -12827,10 +12832,10 @@ function useController(props) {
|
|
|
12827
12832
|
}), [field, formState, fieldState]);
|
|
12828
12833
|
}
|
|
12829
12834
|
var Controller = (props) => props.render(useController(props));
|
|
12830
|
-
var appendErrors = (
|
|
12831
|
-
...errors[
|
|
12835
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message2) => validateAllFieldCriteria ? {
|
|
12836
|
+
...errors[name],
|
|
12832
12837
|
types: {
|
|
12833
|
-
...errors[
|
|
12838
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
12834
12839
|
[type]: message2 || true
|
|
12835
12840
|
}
|
|
12836
12841
|
} : {};
|
|
@@ -12990,9 +12995,9 @@ function getFieldValue(_f) {
|
|
|
12990
12995
|
}
|
|
12991
12996
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
12992
12997
|
const fields = {};
|
|
12993
|
-
for (const
|
|
12994
|
-
const field = get2(_fields,
|
|
12995
|
-
field && set(fields,
|
|
12998
|
+
for (const name of fieldsNames) {
|
|
12999
|
+
const field = get2(_fields, name);
|
|
13000
|
+
field && set(fields, name, field._f);
|
|
12996
13001
|
}
|
|
12997
13002
|
return {
|
|
12998
13003
|
criteriaMode,
|
|
@@ -13013,7 +13018,7 @@ var getValidationModes = (mode) => ({
|
|
|
13013
13018
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
13014
13019
|
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));
|
|
13015
13020
|
var hasValidation = (options2) => options2.mount && (options2.required || options2.min || options2.max || options2.maxLength || options2.minLength || options2.pattern || options2.validate);
|
|
13016
|
-
var isWatched = (
|
|
13021
|
+
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))));
|
|
13017
13022
|
var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
13018
13023
|
for (const key of fieldsNames || Object.keys(fields)) {
|
|
13019
13024
|
const field = get2(fields, key);
|
|
@@ -13038,21 +13043,21 @@ var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
13038
13043
|
}
|
|
13039
13044
|
return;
|
|
13040
13045
|
};
|
|
13041
|
-
function schemaErrorLookup(errors, _fields,
|
|
13042
|
-
const error2 = get2(errors,
|
|
13043
|
-
if (error2 || isKey(
|
|
13046
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
13047
|
+
const error2 = get2(errors, name);
|
|
13048
|
+
if (error2 || isKey(name)) {
|
|
13044
13049
|
return {
|
|
13045
13050
|
error: error2,
|
|
13046
|
-
name
|
|
13051
|
+
name
|
|
13047
13052
|
};
|
|
13048
13053
|
}
|
|
13049
|
-
const names =
|
|
13054
|
+
const names = name.split(".");
|
|
13050
13055
|
while (names.length) {
|
|
13051
13056
|
const fieldName = names.join(".");
|
|
13052
13057
|
const field = get2(_fields, fieldName);
|
|
13053
13058
|
const foundError = get2(errors, fieldName);
|
|
13054
|
-
if (field && !Array.isArray(field) &&
|
|
13055
|
-
return { name
|
|
13059
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
13060
|
+
return { name };
|
|
13056
13061
|
}
|
|
13057
13062
|
if (foundError && foundError.type) {
|
|
13058
13063
|
return {
|
|
@@ -13069,15 +13074,15 @@ function schemaErrorLookup(errors, _fields, name2) {
|
|
|
13069
13074
|
names.pop();
|
|
13070
13075
|
}
|
|
13071
13076
|
return {
|
|
13072
|
-
name
|
|
13077
|
+
name
|
|
13073
13078
|
};
|
|
13074
13079
|
}
|
|
13075
13080
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
13076
13081
|
updateFormState(formStateData);
|
|
13077
|
-
const { name
|
|
13082
|
+
const { name, ...formState } = formStateData;
|
|
13078
13083
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
13079
13084
|
};
|
|
13080
|
-
var shouldSubscribeByName = (
|
|
13085
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
13081
13086
|
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
13082
13087
|
if (mode.isOnAll) {
|
|
13083
13088
|
return false;
|
|
@@ -13090,11 +13095,11 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
13090
13095
|
}
|
|
13091
13096
|
return true;
|
|
13092
13097
|
};
|
|
13093
|
-
var unsetEmptyArray = (ref,
|
|
13094
|
-
var updateFieldArrayRootError = (errors, error2,
|
|
13095
|
-
const fieldArrayErrors = convertToArrayPayload(get2(errors,
|
|
13096
|
-
set(fieldArrayErrors, "root", error2[
|
|
13097
|
-
set(errors,
|
|
13098
|
+
var unsetEmptyArray = (ref, name) => !compact(get2(ref, name)).length && unset(ref, name);
|
|
13099
|
+
var updateFieldArrayRootError = (errors, error2, name) => {
|
|
13100
|
+
const fieldArrayErrors = convertToArrayPayload(get2(errors, name));
|
|
13101
|
+
set(fieldArrayErrors, "root", error2[name]);
|
|
13102
|
+
set(errors, name, fieldArrayErrors);
|
|
13098
13103
|
return errors;
|
|
13099
13104
|
};
|
|
13100
13105
|
var isMessage = (value) => isString3(value);
|
|
@@ -13112,9 +13117,9 @@ var getValueAndMessage = (validationData) => isObject2(validationData) && !isReg
|
|
|
13112
13117
|
message: ""
|
|
13113
13118
|
};
|
|
13114
13119
|
var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
13115
|
-
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name
|
|
13116
|
-
const inputValue = get2(formValues,
|
|
13117
|
-
if (!mount || disabledFieldNames.has(
|
|
13120
|
+
const { ref, refs, required, maxLength, minLength, min: min3, max: max3, pattern, validate, name, valueAsNumber, mount } = field._f;
|
|
13121
|
+
const inputValue = get2(formValues, name);
|
|
13122
|
+
if (!mount || disabledFieldNames.has(name)) {
|
|
13118
13123
|
return {};
|
|
13119
13124
|
}
|
|
13120
13125
|
const inputRef = refs ? refs[0] : ref;
|
|
@@ -13129,10 +13134,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13129
13134
|
const isCheckBox = isCheckBoxInput(ref);
|
|
13130
13135
|
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
13131
13136
|
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
13132
|
-
const appendErrorsCurry = appendErrors.bind(null,
|
|
13137
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
|
|
13133
13138
|
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
13134
13139
|
const message2 = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
13135
|
-
error2[
|
|
13140
|
+
error2[name] = {
|
|
13136
13141
|
type: exceedMax ? maxType : minType,
|
|
13137
13142
|
message: message2,
|
|
13138
13143
|
ref,
|
|
@@ -13142,7 +13147,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13142
13147
|
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
13143
13148
|
const { value, message: message2 } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
13144
13149
|
if (value) {
|
|
13145
|
-
error2[
|
|
13150
|
+
error2[name] = {
|
|
13146
13151
|
type: INPUT_VALIDATION_RULES.required,
|
|
13147
13152
|
message: message2,
|
|
13148
13153
|
ref: inputRef,
|
|
@@ -13182,7 +13187,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13182
13187
|
if (exceedMax || exceedMin) {
|
|
13183
13188
|
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
13184
13189
|
if (!validateAllFieldCriteria) {
|
|
13185
|
-
setCustomValidity(error2[
|
|
13190
|
+
setCustomValidity(error2[name].message);
|
|
13186
13191
|
return error2;
|
|
13187
13192
|
}
|
|
13188
13193
|
}
|
|
@@ -13195,7 +13200,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13195
13200
|
if (exceedMax || exceedMin) {
|
|
13196
13201
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
13197
13202
|
if (!validateAllFieldCriteria) {
|
|
13198
|
-
setCustomValidity(error2[
|
|
13203
|
+
setCustomValidity(error2[name].message);
|
|
13199
13204
|
return error2;
|
|
13200
13205
|
}
|
|
13201
13206
|
}
|
|
@@ -13203,7 +13208,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13203
13208
|
if (pattern && !isEmpty && isString3(inputValue)) {
|
|
13204
13209
|
const { value: patternValue, message: message2 } = getValueAndMessage(pattern);
|
|
13205
13210
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
13206
|
-
error2[
|
|
13211
|
+
error2[name] = {
|
|
13207
13212
|
type: INPUT_VALIDATION_RULES.pattern,
|
|
13208
13213
|
message: message2,
|
|
13209
13214
|
ref,
|
|
@@ -13220,7 +13225,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13220
13225
|
const result = await validate(inputValue, formValues);
|
|
13221
13226
|
const validateError = getValidateError(result, inputRef);
|
|
13222
13227
|
if (validateError) {
|
|
13223
|
-
error2[
|
|
13228
|
+
error2[name] = {
|
|
13224
13229
|
...validateError,
|
|
13225
13230
|
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
13226
13231
|
};
|
|
@@ -13243,12 +13248,12 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
13243
13248
|
};
|
|
13244
13249
|
setCustomValidity(validateError.message);
|
|
13245
13250
|
if (validateAllFieldCriteria) {
|
|
13246
|
-
error2[
|
|
13251
|
+
error2[name] = validationResult;
|
|
13247
13252
|
}
|
|
13248
13253
|
}
|
|
13249
13254
|
}
|
|
13250
13255
|
if (!isEmptyObject(validationResult)) {
|
|
13251
|
-
error2[
|
|
13256
|
+
error2[name] = {
|
|
13252
13257
|
ref: inputRef,
|
|
13253
13258
|
...validationResult
|
|
13254
13259
|
};
|
|
@@ -13337,9 +13342,9 @@ function createFormControl(props = {}) {
|
|
|
13337
13342
|
};
|
|
13338
13343
|
const _updateIsValidating = (names, isValidating) => {
|
|
13339
13344
|
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
13340
|
-
(names || Array.from(_names.mount)).forEach((
|
|
13341
|
-
if (
|
|
13342
|
-
isValidating ? set(_formState.validatingFields,
|
|
13345
|
+
(names || Array.from(_names.mount)).forEach((name) => {
|
|
13346
|
+
if (name) {
|
|
13347
|
+
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
13343
13348
|
}
|
|
13344
13349
|
});
|
|
13345
13350
|
_subjects.state.next({
|
|
@@ -13348,38 +13353,38 @@ function createFormControl(props = {}) {
|
|
|
13348
13353
|
});
|
|
13349
13354
|
}
|
|
13350
13355
|
};
|
|
13351
|
-
const _setFieldArray = (
|
|
13356
|
+
const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
13352
13357
|
if (args && method && !_options.disabled) {
|
|
13353
13358
|
_state.action = true;
|
|
13354
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields,
|
|
13355
|
-
const fieldValues = method(get2(_fields,
|
|
13356
|
-
shouldSetValues && set(_fields,
|
|
13359
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_fields, name))) {
|
|
13360
|
+
const fieldValues = method(get2(_fields, name), args.argA, args.argB);
|
|
13361
|
+
shouldSetValues && set(_fields, name, fieldValues);
|
|
13357
13362
|
}
|
|
13358
|
-
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors,
|
|
13359
|
-
const errors = method(get2(_formState.errors,
|
|
13360
|
-
shouldSetValues && set(_formState.errors,
|
|
13361
|
-
unsetEmptyArray(_formState.errors,
|
|
13363
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get2(_formState.errors, name))) {
|
|
13364
|
+
const errors = method(get2(_formState.errors, name), args.argA, args.argB);
|
|
13365
|
+
shouldSetValues && set(_formState.errors, name, errors);
|
|
13366
|
+
unsetEmptyArray(_formState.errors, name);
|
|
13362
13367
|
}
|
|
13363
|
-
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields,
|
|
13364
|
-
const touchedFields = method(get2(_formState.touchedFields,
|
|
13365
|
-
shouldSetValues && set(_formState.touchedFields,
|
|
13368
|
+
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get2(_formState.touchedFields, name))) {
|
|
13369
|
+
const touchedFields = method(get2(_formState.touchedFields, name), args.argA, args.argB);
|
|
13370
|
+
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
13366
13371
|
}
|
|
13367
13372
|
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
13368
13373
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
13369
13374
|
}
|
|
13370
13375
|
_subjects.state.next({
|
|
13371
|
-
name
|
|
13372
|
-
isDirty: _getDirty(
|
|
13376
|
+
name,
|
|
13377
|
+
isDirty: _getDirty(name, values),
|
|
13373
13378
|
dirtyFields: _formState.dirtyFields,
|
|
13374
13379
|
errors: _formState.errors,
|
|
13375
13380
|
isValid: _formState.isValid
|
|
13376
13381
|
});
|
|
13377
13382
|
} else {
|
|
13378
|
-
set(_formValues,
|
|
13383
|
+
set(_formValues, name, values);
|
|
13379
13384
|
}
|
|
13380
13385
|
};
|
|
13381
|
-
const updateErrors = (
|
|
13382
|
-
set(_formState.errors,
|
|
13386
|
+
const updateErrors = (name, error2) => {
|
|
13387
|
+
set(_formState.errors, name, error2);
|
|
13383
13388
|
_subjects.state.next({
|
|
13384
13389
|
errors: _formState.errors
|
|
13385
13390
|
});
|
|
@@ -13391,19 +13396,19 @@ function createFormControl(props = {}) {
|
|
|
13391
13396
|
isValid: false
|
|
13392
13397
|
});
|
|
13393
13398
|
};
|
|
13394
|
-
const updateValidAndValue = (
|
|
13395
|
-
const field = get2(_fields,
|
|
13399
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
13400
|
+
const field = get2(_fields, name);
|
|
13396
13401
|
if (field) {
|
|
13397
|
-
const defaultValue = get2(_formValues,
|
|
13398
|
-
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues,
|
|
13402
|
+
const defaultValue = get2(_formValues, name, isUndefined(value) ? get2(_defaultValues, name) : value);
|
|
13403
|
+
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
13399
13404
|
_state.mount && _setValid();
|
|
13400
13405
|
}
|
|
13401
13406
|
};
|
|
13402
|
-
const updateTouchAndDirty = (
|
|
13407
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
13403
13408
|
let shouldUpdateField = false;
|
|
13404
13409
|
let isPreviousDirty = false;
|
|
13405
13410
|
const output = {
|
|
13406
|
-
name
|
|
13411
|
+
name
|
|
13407
13412
|
};
|
|
13408
13413
|
if (!_options.disabled) {
|
|
13409
13414
|
if (!isBlurEvent || shouldDirty) {
|
|
@@ -13412,16 +13417,16 @@ function createFormControl(props = {}) {
|
|
|
13412
13417
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
13413
13418
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
13414
13419
|
}
|
|
13415
|
-
const isCurrentFieldPristine = deepEqual(get2(_defaultValues,
|
|
13416
|
-
isPreviousDirty = !!get2(_formState.dirtyFields,
|
|
13417
|
-
isCurrentFieldPristine ? unset(_formState.dirtyFields,
|
|
13420
|
+
const isCurrentFieldPristine = deepEqual(get2(_defaultValues, name), fieldValue);
|
|
13421
|
+
isPreviousDirty = !!get2(_formState.dirtyFields, name);
|
|
13422
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
13418
13423
|
output.dirtyFields = _formState.dirtyFields;
|
|
13419
13424
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
13420
13425
|
}
|
|
13421
13426
|
if (isBlurEvent) {
|
|
13422
|
-
const isPreviousFieldTouched = get2(_formState.touchedFields,
|
|
13427
|
+
const isPreviousFieldTouched = get2(_formState.touchedFields, name);
|
|
13423
13428
|
if (!isPreviousFieldTouched) {
|
|
13424
|
-
set(_formState.touchedFields,
|
|
13429
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
13425
13430
|
output.touchedFields = _formState.touchedFields;
|
|
13426
13431
|
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
13427
13432
|
}
|
|
@@ -13430,23 +13435,23 @@ function createFormControl(props = {}) {
|
|
|
13430
13435
|
}
|
|
13431
13436
|
return shouldUpdateField ? output : {};
|
|
13432
13437
|
};
|
|
13433
|
-
const shouldRenderByError = (
|
|
13434
|
-
const previousFieldError = get2(_formState.errors,
|
|
13438
|
+
const shouldRenderByError = (name, isValid3, error2, fieldState) => {
|
|
13439
|
+
const previousFieldError = get2(_formState.errors, name);
|
|
13435
13440
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid3) && _formState.isValid !== isValid3;
|
|
13436
13441
|
if (_options.delayError && error2) {
|
|
13437
|
-
delayErrorCallback = debounce(() => updateErrors(
|
|
13442
|
+
delayErrorCallback = debounce(() => updateErrors(name, error2));
|
|
13438
13443
|
delayErrorCallback(_options.delayError);
|
|
13439
13444
|
} else {
|
|
13440
13445
|
clearTimeout(timer);
|
|
13441
13446
|
delayErrorCallback = null;
|
|
13442
|
-
error2 ? set(_formState.errors,
|
|
13447
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
13443
13448
|
}
|
|
13444
13449
|
if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
13445
13450
|
const updatedFormState = {
|
|
13446
13451
|
...fieldState,
|
|
13447
13452
|
...shouldUpdateValid && isBoolean(isValid3) ? { isValid: isValid3 } : {},
|
|
13448
13453
|
errors: _formState.errors,
|
|
13449
|
-
name
|
|
13454
|
+
name
|
|
13450
13455
|
};
|
|
13451
13456
|
_formState = {
|
|
13452
13457
|
..._formState,
|
|
@@ -13455,18 +13460,18 @@ function createFormControl(props = {}) {
|
|
|
13455
13460
|
_subjects.state.next(updatedFormState);
|
|
13456
13461
|
}
|
|
13457
13462
|
};
|
|
13458
|
-
const _runSchema = async (
|
|
13459
|
-
_updateIsValidating(
|
|
13460
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(
|
|
13461
|
-
_updateIsValidating(
|
|
13463
|
+
const _runSchema = async (name) => {
|
|
13464
|
+
_updateIsValidating(name, true);
|
|
13465
|
+
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
13466
|
+
_updateIsValidating(name);
|
|
13462
13467
|
return result;
|
|
13463
13468
|
};
|
|
13464
13469
|
const executeSchemaAndUpdateState = async (names) => {
|
|
13465
13470
|
const { errors } = await _runSchema(names);
|
|
13466
13471
|
if (names) {
|
|
13467
|
-
for (const
|
|
13468
|
-
const error2 = get2(errors,
|
|
13469
|
-
error2 ? set(_formState.errors,
|
|
13472
|
+
for (const name of names) {
|
|
13473
|
+
const error2 = get2(errors, name);
|
|
13474
|
+
error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
|
|
13470
13475
|
}
|
|
13471
13476
|
} else {
|
|
13472
13477
|
_formState.errors = errors;
|
|
@@ -13476,19 +13481,19 @@ function createFormControl(props = {}) {
|
|
|
13476
13481
|
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
13477
13482
|
valid: true
|
|
13478
13483
|
}) => {
|
|
13479
|
-
for (const
|
|
13480
|
-
const field = fields[
|
|
13484
|
+
for (const name in fields) {
|
|
13485
|
+
const field = fields[name];
|
|
13481
13486
|
if (field) {
|
|
13482
13487
|
const { _f, ...fieldValue } = field;
|
|
13483
13488
|
if (_f) {
|
|
13484
13489
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
13485
13490
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
13486
13491
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13487
|
-
_updateIsValidating([
|
|
13492
|
+
_updateIsValidating([name], true);
|
|
13488
13493
|
}
|
|
13489
13494
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
13490
13495
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
13491
|
-
_updateIsValidating([
|
|
13496
|
+
_updateIsValidating([name]);
|
|
13492
13497
|
}
|
|
13493
13498
|
if (fieldError[_f.name]) {
|
|
13494
13499
|
context.valid = false;
|
|
@@ -13504,24 +13509,24 @@ function createFormControl(props = {}) {
|
|
|
13504
13509
|
return context.valid;
|
|
13505
13510
|
};
|
|
13506
13511
|
const _removeUnmounted = () => {
|
|
13507
|
-
for (const
|
|
13508
|
-
const field = get2(_fields,
|
|
13509
|
-
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(
|
|
13512
|
+
for (const name of _names.unMount) {
|
|
13513
|
+
const field = get2(_fields, name);
|
|
13514
|
+
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name);
|
|
13510
13515
|
}
|
|
13511
13516
|
_names.unMount = /* @__PURE__ */ new Set();
|
|
13512
13517
|
};
|
|
13513
|
-
const _getDirty = (
|
|
13518
|
+
const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
13514
13519
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
13515
13520
|
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString3(names) ? { [names]: defaultValue } : defaultValue
|
|
13516
13521
|
}, isGlobal, defaultValue);
|
|
13517
|
-
const _getFieldArray = (
|
|
13518
|
-
const setFieldValue = (
|
|
13519
|
-
const field = get2(_fields,
|
|
13522
|
+
const _getFieldArray = (name) => compact(get2(_state.mount ? _formValues : _defaultValues, name, _options.shouldUnregister ? get2(_defaultValues, name, []) : []));
|
|
13523
|
+
const setFieldValue = (name, value, options2 = {}) => {
|
|
13524
|
+
const field = get2(_fields, name);
|
|
13520
13525
|
let fieldValue = value;
|
|
13521
13526
|
if (field) {
|
|
13522
13527
|
const fieldReference = field._f;
|
|
13523
13528
|
if (fieldReference) {
|
|
13524
|
-
!fieldReference.disabled && set(_formValues,
|
|
13529
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
13525
13530
|
fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
13526
13531
|
if (isMultipleSelect(fieldReference.ref)) {
|
|
13527
13532
|
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
@@ -13545,61 +13550,61 @@ function createFormControl(props = {}) {
|
|
|
13545
13550
|
fieldReference.ref.value = fieldValue;
|
|
13546
13551
|
if (!fieldReference.ref.type) {
|
|
13547
13552
|
_subjects.state.next({
|
|
13548
|
-
name
|
|
13553
|
+
name,
|
|
13549
13554
|
values: cloneObject(_formValues)
|
|
13550
13555
|
});
|
|
13551
13556
|
}
|
|
13552
13557
|
}
|
|
13553
13558
|
}
|
|
13554
13559
|
}
|
|
13555
|
-
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(
|
|
13556
|
-
options2.shouldValidate && trigger(
|
|
13560
|
+
(options2.shouldDirty || options2.shouldTouch) && updateTouchAndDirty(name, fieldValue, options2.shouldTouch, options2.shouldDirty, true);
|
|
13561
|
+
options2.shouldValidate && trigger(name);
|
|
13557
13562
|
};
|
|
13558
|
-
const setValues = (
|
|
13563
|
+
const setValues = (name, value, options2) => {
|
|
13559
13564
|
for (const fieldKey in value) {
|
|
13560
13565
|
if (!value.hasOwnProperty(fieldKey)) {
|
|
13561
13566
|
return;
|
|
13562
13567
|
}
|
|
13563
13568
|
const fieldValue = value[fieldKey];
|
|
13564
|
-
const fieldName =
|
|
13569
|
+
const fieldName = name + "." + fieldKey;
|
|
13565
13570
|
const field = get2(_fields, fieldName);
|
|
13566
|
-
(_names.array.has(
|
|
13571
|
+
(_names.array.has(name) || isObject2(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options2) : setFieldValue(fieldName, fieldValue, options2);
|
|
13567
13572
|
}
|
|
13568
13573
|
};
|
|
13569
|
-
const setValue = (
|
|
13570
|
-
const field = get2(_fields,
|
|
13571
|
-
const isFieldArray = _names.array.has(
|
|
13574
|
+
const setValue = (name, value, options2 = {}) => {
|
|
13575
|
+
const field = get2(_fields, name);
|
|
13576
|
+
const isFieldArray = _names.array.has(name);
|
|
13572
13577
|
const cloneValue = cloneObject(value);
|
|
13573
|
-
set(_formValues,
|
|
13578
|
+
set(_formValues, name, cloneValue);
|
|
13574
13579
|
if (isFieldArray) {
|
|
13575
13580
|
_subjects.array.next({
|
|
13576
|
-
name
|
|
13581
|
+
name,
|
|
13577
13582
|
values: cloneObject(_formValues)
|
|
13578
13583
|
});
|
|
13579
13584
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options2.shouldDirty) {
|
|
13580
13585
|
_subjects.state.next({
|
|
13581
|
-
name
|
|
13586
|
+
name,
|
|
13582
13587
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
13583
|
-
isDirty: _getDirty(
|
|
13588
|
+
isDirty: _getDirty(name, cloneValue)
|
|
13584
13589
|
});
|
|
13585
13590
|
}
|
|
13586
13591
|
} else {
|
|
13587
|
-
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(
|
|
13592
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options2) : setFieldValue(name, cloneValue, options2);
|
|
13588
13593
|
}
|
|
13589
|
-
isWatched(
|
|
13594
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
|
|
13590
13595
|
_subjects.state.next({
|
|
13591
|
-
name: _state.mount ?
|
|
13596
|
+
name: _state.mount ? name : void 0,
|
|
13592
13597
|
values: cloneObject(_formValues)
|
|
13593
13598
|
});
|
|
13594
13599
|
};
|
|
13595
13600
|
const onChange2 = async (event) => {
|
|
13596
13601
|
_state.mount = true;
|
|
13597
13602
|
const target = event.target;
|
|
13598
|
-
let
|
|
13603
|
+
let name = target.name;
|
|
13599
13604
|
let isFieldValueUpdated = true;
|
|
13600
|
-
const field = get2(_fields,
|
|
13605
|
+
const field = get2(_fields, name);
|
|
13601
13606
|
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
13602
|
-
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues,
|
|
13607
|
+
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get2(_formValues, name, fieldValue));
|
|
13603
13608
|
};
|
|
13604
13609
|
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
13605
13610
|
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
@@ -13608,9 +13613,9 @@ function createFormControl(props = {}) {
|
|
|
13608
13613
|
let isValid3;
|
|
13609
13614
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
13610
13615
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
13611
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors,
|
|
13612
|
-
const watched = isWatched(
|
|
13613
|
-
set(_formValues,
|
|
13616
|
+
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get2(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get2(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
13617
|
+
const watched = isWatched(name, _names, isBlurEvent);
|
|
13618
|
+
set(_formValues, name, fieldValue);
|
|
13614
13619
|
if (isBlurEvent) {
|
|
13615
13620
|
if (!target || !target.readOnly) {
|
|
13616
13621
|
field._f.onBlur && field._f.onBlur(event);
|
|
@@ -13619,10 +13624,10 @@ function createFormControl(props = {}) {
|
|
|
13619
13624
|
} else if (field._f.onChange) {
|
|
13620
13625
|
field._f.onChange(event);
|
|
13621
13626
|
}
|
|
13622
|
-
const fieldState = updateTouchAndDirty(
|
|
13627
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
13623
13628
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
13624
13629
|
!isBlurEvent && _subjects.state.next({
|
|
13625
|
-
name
|
|
13630
|
+
name,
|
|
13626
13631
|
type: event.type,
|
|
13627
13632
|
values: cloneObject(_formValues)
|
|
13628
13633
|
});
|
|
@@ -13636,23 +13641,23 @@ function createFormControl(props = {}) {
|
|
|
13636
13641
|
_setValid();
|
|
13637
13642
|
}
|
|
13638
13643
|
}
|
|
13639
|
-
return shouldRender && _subjects.state.next({ name
|
|
13644
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
13640
13645
|
}
|
|
13641
13646
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
13642
13647
|
if (_options.resolver) {
|
|
13643
|
-
const { errors } = await _runSchema([
|
|
13648
|
+
const { errors } = await _runSchema([name]);
|
|
13644
13649
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13645
13650
|
if (isFieldValueUpdated) {
|
|
13646
|
-
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields,
|
|
13647
|
-
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name ||
|
|
13651
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
13652
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
13648
13653
|
error2 = errorLookupResult.error;
|
|
13649
|
-
|
|
13654
|
+
name = errorLookupResult.name;
|
|
13650
13655
|
isValid3 = isEmptyObject(errors);
|
|
13651
13656
|
}
|
|
13652
13657
|
} else {
|
|
13653
|
-
_updateIsValidating([
|
|
13654
|
-
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[
|
|
13655
|
-
_updateIsValidating([
|
|
13658
|
+
_updateIsValidating([name], true);
|
|
13659
|
+
error2 = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
13660
|
+
_updateIsValidating([name]);
|
|
13656
13661
|
_updateIsFieldValueUpdated(fieldValue);
|
|
13657
13662
|
if (isFieldValueUpdated) {
|
|
13658
13663
|
if (error2) {
|
|
@@ -13664,7 +13669,7 @@ function createFormControl(props = {}) {
|
|
|
13664
13669
|
}
|
|
13665
13670
|
if (isFieldValueUpdated) {
|
|
13666
13671
|
field._f.deps && trigger(field._f.deps);
|
|
13667
|
-
shouldRenderByError(
|
|
13672
|
+
shouldRenderByError(name, isValid3, error2, fieldState);
|
|
13668
13673
|
}
|
|
13669
13674
|
}
|
|
13670
13675
|
};
|
|
@@ -13675,15 +13680,15 @@ function createFormControl(props = {}) {
|
|
|
13675
13680
|
}
|
|
13676
13681
|
return;
|
|
13677
13682
|
};
|
|
13678
|
-
const trigger = async (
|
|
13683
|
+
const trigger = async (name, options2 = {}) => {
|
|
13679
13684
|
let isValid3;
|
|
13680
13685
|
let validationResult;
|
|
13681
|
-
const fieldNames = convertToArrayPayload(
|
|
13686
|
+
const fieldNames = convertToArrayPayload(name);
|
|
13682
13687
|
if (_options.resolver) {
|
|
13683
|
-
const errors = await executeSchemaAndUpdateState(isUndefined(
|
|
13688
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
13684
13689
|
isValid3 = isEmptyObject(errors);
|
|
13685
|
-
validationResult =
|
|
13686
|
-
} else if (
|
|
13690
|
+
validationResult = name ? !fieldNames.some((name2) => get2(errors, name2)) : isValid3;
|
|
13691
|
+
} else if (name) {
|
|
13687
13692
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
13688
13693
|
const field = get2(_fields, fieldName);
|
|
13689
13694
|
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
@@ -13693,51 +13698,51 @@ function createFormControl(props = {}) {
|
|
|
13693
13698
|
validationResult = isValid3 = await executeBuiltInValidation(_fields);
|
|
13694
13699
|
}
|
|
13695
13700
|
_subjects.state.next({
|
|
13696
|
-
...!isString3(
|
|
13697
|
-
..._options.resolver || !
|
|
13701
|
+
...!isString3(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid3 !== _formState.isValid ? {} : { name },
|
|
13702
|
+
..._options.resolver || !name ? { isValid: isValid3 } : {},
|
|
13698
13703
|
errors: _formState.errors
|
|
13699
13704
|
});
|
|
13700
|
-
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput,
|
|
13705
|
+
options2.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
13701
13706
|
return validationResult;
|
|
13702
13707
|
};
|
|
13703
13708
|
const getValues = (fieldNames) => {
|
|
13704
13709
|
const values = {
|
|
13705
13710
|
..._state.mount ? _formValues : _defaultValues
|
|
13706
13711
|
};
|
|
13707
|
-
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((
|
|
13712
|
+
return isUndefined(fieldNames) ? values : isString3(fieldNames) ? get2(values, fieldNames) : fieldNames.map((name) => get2(values, name));
|
|
13708
13713
|
};
|
|
13709
|
-
const getFieldState = (
|
|
13710
|
-
invalid: !!get2((formState || _formState).errors,
|
|
13711
|
-
isDirty: !!get2((formState || _formState).dirtyFields,
|
|
13712
|
-
error: get2((formState || _formState).errors,
|
|
13713
|
-
isValidating: !!get2(_formState.validatingFields,
|
|
13714
|
-
isTouched: !!get2((formState || _formState).touchedFields,
|
|
13714
|
+
const getFieldState = (name, formState) => ({
|
|
13715
|
+
invalid: !!get2((formState || _formState).errors, name),
|
|
13716
|
+
isDirty: !!get2((formState || _formState).dirtyFields, name),
|
|
13717
|
+
error: get2((formState || _formState).errors, name),
|
|
13718
|
+
isValidating: !!get2(_formState.validatingFields, name),
|
|
13719
|
+
isTouched: !!get2((formState || _formState).touchedFields, name)
|
|
13715
13720
|
});
|
|
13716
|
-
const clearErrors = (
|
|
13717
|
-
|
|
13721
|
+
const clearErrors = (name) => {
|
|
13722
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
13718
13723
|
_subjects.state.next({
|
|
13719
|
-
errors:
|
|
13724
|
+
errors: name ? _formState.errors : {}
|
|
13720
13725
|
});
|
|
13721
13726
|
};
|
|
13722
|
-
const setError = (
|
|
13723
|
-
const ref = (get2(_fields,
|
|
13724
|
-
const currentError = get2(_formState.errors,
|
|
13727
|
+
const setError = (name, error2, options2) => {
|
|
13728
|
+
const ref = (get2(_fields, name, { _f: {} })._f || {}).ref;
|
|
13729
|
+
const currentError = get2(_formState.errors, name) || {};
|
|
13725
13730
|
const { ref: currentRef, message: message2, type, ...restOfErrorTree } = currentError;
|
|
13726
|
-
set(_formState.errors,
|
|
13731
|
+
set(_formState.errors, name, {
|
|
13727
13732
|
...restOfErrorTree,
|
|
13728
13733
|
...error2,
|
|
13729
13734
|
ref
|
|
13730
13735
|
});
|
|
13731
13736
|
_subjects.state.next({
|
|
13732
|
-
name
|
|
13737
|
+
name,
|
|
13733
13738
|
errors: _formState.errors,
|
|
13734
13739
|
isValid: false
|
|
13735
13740
|
});
|
|
13736
13741
|
options2 && options2.shouldFocus && ref && ref.focus && ref.focus();
|
|
13737
13742
|
};
|
|
13738
|
-
const watch = (
|
|
13739
|
-
next: (payload) => "values" in payload &&
|
|
13740
|
-
}) : _getWatch(
|
|
13743
|
+
const watch = (name, defaultValue) => isFunction(name) ? _subjects.state.subscribe({
|
|
13744
|
+
next: (payload) => "values" in payload && name(_getWatch(void 0, defaultValue), payload)
|
|
13745
|
+
}) : _getWatch(name, defaultValue, true);
|
|
13741
13746
|
const _subscribe = (props2) => _subjects.state.subscribe({
|
|
13742
13747
|
next: (formState) => {
|
|
13743
13748
|
if (shouldSubscribeByName(props2.name, formState.name, props2.exact) && shouldRenderFormState(formState, props2.formState || _proxyFormState, _setFormState, props2.reRenderRoot)) {
|
|
@@ -13761,8 +13766,8 @@ function createFormControl(props = {}) {
|
|
|
13761
13766
|
formState: _proxySubscribeFormState
|
|
13762
13767
|
});
|
|
13763
13768
|
};
|
|
13764
|
-
const unregister = (
|
|
13765
|
-
for (const fieldName of
|
|
13769
|
+
const unregister = (name, options2 = {}) => {
|
|
13770
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
13766
13771
|
_names.mount.delete(fieldName);
|
|
13767
13772
|
_names.array.delete(fieldName);
|
|
13768
13773
|
if (!options2.keepValue) {
|
|
@@ -13784,31 +13789,31 @@ function createFormControl(props = {}) {
|
|
|
13784
13789
|
});
|
|
13785
13790
|
!options2.keepIsValid && _setValid();
|
|
13786
13791
|
};
|
|
13787
|
-
const _setDisabledField = ({ disabled, name
|
|
13788
|
-
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(
|
|
13789
|
-
disabled ? _names.disabled.add(
|
|
13792
|
+
const _setDisabledField = ({ disabled, name }) => {
|
|
13793
|
+
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) {
|
|
13794
|
+
disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
|
|
13790
13795
|
}
|
|
13791
13796
|
};
|
|
13792
|
-
const register = (
|
|
13793
|
-
let field = get2(_fields,
|
|
13797
|
+
const register = (name, options2 = {}) => {
|
|
13798
|
+
let field = get2(_fields, name);
|
|
13794
13799
|
const disabledIsDefined = isBoolean(options2.disabled) || isBoolean(_options.disabled);
|
|
13795
|
-
set(_fields,
|
|
13800
|
+
set(_fields, name, {
|
|
13796
13801
|
...field || {},
|
|
13797
13802
|
_f: {
|
|
13798
|
-
...field && field._f ? field._f : { ref: { name
|
|
13799
|
-
name
|
|
13803
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
13804
|
+
name,
|
|
13800
13805
|
mount: true,
|
|
13801
13806
|
...options2
|
|
13802
13807
|
}
|
|
13803
13808
|
});
|
|
13804
|
-
_names.mount.add(
|
|
13809
|
+
_names.mount.add(name);
|
|
13805
13810
|
if (field) {
|
|
13806
13811
|
_setDisabledField({
|
|
13807
13812
|
disabled: isBoolean(options2.disabled) ? options2.disabled : _options.disabled,
|
|
13808
|
-
name
|
|
13813
|
+
name
|
|
13809
13814
|
});
|
|
13810
13815
|
} else {
|
|
13811
|
-
updateValidAndValue(
|
|
13816
|
+
updateValidAndValue(name, true, options2.value);
|
|
13812
13817
|
}
|
|
13813
13818
|
return {
|
|
13814
13819
|
...disabledIsDefined ? { disabled: options2.disabled || _options.disabled } : {},
|
|
@@ -13820,39 +13825,39 @@ function createFormControl(props = {}) {
|
|
|
13820
13825
|
maxLength: getRuleValue(options2.maxLength),
|
|
13821
13826
|
pattern: getRuleValue(options2.pattern)
|
|
13822
13827
|
} : {},
|
|
13823
|
-
name
|
|
13828
|
+
name,
|
|
13824
13829
|
onChange: onChange2,
|
|
13825
13830
|
onBlur: onChange2,
|
|
13826
13831
|
ref: (ref) => {
|
|
13827
13832
|
if (ref) {
|
|
13828
|
-
register(
|
|
13829
|
-
field = get2(_fields,
|
|
13833
|
+
register(name, options2);
|
|
13834
|
+
field = get2(_fields, name);
|
|
13830
13835
|
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
13831
13836
|
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
13832
13837
|
const refs = field._f.refs || [];
|
|
13833
13838
|
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
13834
13839
|
return;
|
|
13835
13840
|
}
|
|
13836
|
-
set(_fields,
|
|
13841
|
+
set(_fields, name, {
|
|
13837
13842
|
_f: {
|
|
13838
13843
|
...field._f,
|
|
13839
13844
|
...radioOrCheckbox ? {
|
|
13840
13845
|
refs: [
|
|
13841
13846
|
...refs.filter(live),
|
|
13842
13847
|
fieldRef,
|
|
13843
|
-
...Array.isArray(get2(_defaultValues,
|
|
13848
|
+
...Array.isArray(get2(_defaultValues, name)) ? [{}] : []
|
|
13844
13849
|
],
|
|
13845
|
-
ref: { type: fieldRef.type, name
|
|
13850
|
+
ref: { type: fieldRef.type, name }
|
|
13846
13851
|
} : { ref: fieldRef }
|
|
13847
13852
|
}
|
|
13848
13853
|
});
|
|
13849
|
-
updateValidAndValue(
|
|
13854
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
13850
13855
|
} else {
|
|
13851
|
-
field = get2(_fields,
|
|
13856
|
+
field = get2(_fields, name, {});
|
|
13852
13857
|
if (field._f) {
|
|
13853
13858
|
field._f.mount = false;
|
|
13854
13859
|
}
|
|
13855
|
-
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array,
|
|
13860
|
+
(_options.shouldUnregister || options2.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
13856
13861
|
}
|
|
13857
13862
|
}
|
|
13858
13863
|
};
|
|
@@ -13861,8 +13866,8 @@ function createFormControl(props = {}) {
|
|
|
13861
13866
|
const _disableForm = (disabled) => {
|
|
13862
13867
|
if (isBoolean(disabled)) {
|
|
13863
13868
|
_subjects.state.next({ disabled });
|
|
13864
|
-
iterateFieldsByAction(_fields, (ref,
|
|
13865
|
-
const currentField = get2(_fields,
|
|
13869
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
13870
|
+
const currentField = get2(_fields, name);
|
|
13866
13871
|
if (currentField) {
|
|
13867
13872
|
ref.disabled = currentField._f.disabled || disabled;
|
|
13868
13873
|
if (Array.isArray(currentField._f.refs)) {
|
|
@@ -13892,8 +13897,8 @@ function createFormControl(props = {}) {
|
|
|
13892
13897
|
await executeBuiltInValidation(_fields);
|
|
13893
13898
|
}
|
|
13894
13899
|
if (_names.disabled.size) {
|
|
13895
|
-
for (const
|
|
13896
|
-
unset(fieldValues,
|
|
13900
|
+
for (const name of _names.disabled) {
|
|
13901
|
+
unset(fieldValues, name);
|
|
13897
13902
|
}
|
|
13898
13903
|
}
|
|
13899
13904
|
unset(_formState.errors, "root");
|
|
@@ -13924,23 +13929,23 @@ function createFormControl(props = {}) {
|
|
|
13924
13929
|
throw onValidError;
|
|
13925
13930
|
}
|
|
13926
13931
|
};
|
|
13927
|
-
const resetField = (
|
|
13928
|
-
if (get2(_fields,
|
|
13932
|
+
const resetField = (name, options2 = {}) => {
|
|
13933
|
+
if (get2(_fields, name)) {
|
|
13929
13934
|
if (isUndefined(options2.defaultValue)) {
|
|
13930
|
-
setValue(
|
|
13935
|
+
setValue(name, cloneObject(get2(_defaultValues, name)));
|
|
13931
13936
|
} else {
|
|
13932
|
-
setValue(
|
|
13933
|
-
set(_defaultValues,
|
|
13937
|
+
setValue(name, options2.defaultValue);
|
|
13938
|
+
set(_defaultValues, name, cloneObject(options2.defaultValue));
|
|
13934
13939
|
}
|
|
13935
13940
|
if (!options2.keepTouched) {
|
|
13936
|
-
unset(_formState.touchedFields,
|
|
13941
|
+
unset(_formState.touchedFields, name);
|
|
13937
13942
|
}
|
|
13938
13943
|
if (!options2.keepDirty) {
|
|
13939
|
-
unset(_formState.dirtyFields,
|
|
13940
|
-
_formState.isDirty = options2.defaultValue ? _getDirty(
|
|
13944
|
+
unset(_formState.dirtyFields, name);
|
|
13945
|
+
_formState.isDirty = options2.defaultValue ? _getDirty(name, cloneObject(get2(_defaultValues, name))) : _getDirty();
|
|
13941
13946
|
}
|
|
13942
13947
|
if (!options2.keepError) {
|
|
13943
|
-
unset(_formState.errors,
|
|
13948
|
+
unset(_formState.errors, name);
|
|
13944
13949
|
_proxyFormState.isValid && _setValid();
|
|
13945
13950
|
}
|
|
13946
13951
|
_subjects.state.next({ ..._formState });
|
|
@@ -13965,8 +13970,8 @@ function createFormControl(props = {}) {
|
|
|
13965
13970
|
}
|
|
13966
13971
|
} else {
|
|
13967
13972
|
if (isWeb && isUndefined(formValues)) {
|
|
13968
|
-
for (const
|
|
13969
|
-
const field = get2(_fields,
|
|
13973
|
+
for (const name of _names.mount) {
|
|
13974
|
+
const field = get2(_fields, name);
|
|
13970
13975
|
if (field && field._f) {
|
|
13971
13976
|
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
13972
13977
|
if (isHTMLElement2(fieldReference)) {
|
|
@@ -14019,8 +14024,8 @@ function createFormControl(props = {}) {
|
|
|
14019
14024
|
});
|
|
14020
14025
|
};
|
|
14021
14026
|
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
14022
|
-
const setFocus = (
|
|
14023
|
-
const field = get2(_fields,
|
|
14027
|
+
const setFocus = (name, options2 = {}) => {
|
|
14028
|
+
const field = get2(_fields, name);
|
|
14024
14029
|
const fieldReference = field && field._f;
|
|
14025
14030
|
if (fieldReference) {
|
|
14026
14031
|
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
@@ -14336,7 +14341,7 @@ function TextInput(props) {
|
|
|
14336
14341
|
inputWrapperClassName,
|
|
14337
14342
|
label,
|
|
14338
14343
|
placeholder,
|
|
14339
|
-
name
|
|
14344
|
+
name,
|
|
14340
14345
|
type = "text",
|
|
14341
14346
|
register,
|
|
14342
14347
|
errors,
|
|
@@ -14359,7 +14364,7 @@ function TextInput(props) {
|
|
|
14359
14364
|
className: "flex-1 outline-none placeholder:text-[14px] placeholder:text-[#ABACAE]",
|
|
14360
14365
|
placeholder,
|
|
14361
14366
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
14362
|
-
...register(
|
|
14367
|
+
...register(name)
|
|
14363
14368
|
}
|
|
14364
14369
|
),
|
|
14365
14370
|
type === "password" && /* @__PURE__ */ jsx55(
|
|
@@ -14373,11 +14378,11 @@ function TextInput(props) {
|
|
|
14373
14378
|
]
|
|
14374
14379
|
}
|
|
14375
14380
|
),
|
|
14376
|
-
errors?.[
|
|
14381
|
+
errors?.[name]?.message && /* @__PURE__ */ jsx55(
|
|
14377
14382
|
"p",
|
|
14378
14383
|
{
|
|
14379
|
-
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[
|
|
14380
|
-
children: errors?.[
|
|
14384
|
+
className: `text-[12px] origin-top transition-all text-red-500 ${errors?.[name] ? "h-4" : "h-0 -mt-1"}`,
|
|
14385
|
+
children: errors?.[name]?.message
|
|
14381
14386
|
}
|
|
14382
14387
|
)
|
|
14383
14388
|
] });
|
|
@@ -14784,10 +14789,10 @@ function useFileInfo(source, options2) {
|
|
|
14784
14789
|
let localUrl = null;
|
|
14785
14790
|
let fr = null;
|
|
14786
14791
|
let mediaEl = null;
|
|
14787
|
-
const makeExtension = (
|
|
14788
|
-
if (
|
|
14789
|
-
const idx =
|
|
14790
|
-
if (idx > -1) return
|
|
14792
|
+
const makeExtension = (name, type) => {
|
|
14793
|
+
if (name) {
|
|
14794
|
+
const idx = name.lastIndexOf(".");
|
|
14795
|
+
if (idx > -1) return name.slice(idx + 1).toLowerCase();
|
|
14791
14796
|
}
|
|
14792
14797
|
if (type) {
|
|
14793
14798
|
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
@@ -15396,7 +15401,7 @@ var ModalLayer = ({
|
|
|
15396
15401
|
// src/widgets/common/modal-confirm.tsx
|
|
15397
15402
|
import { jsx as jsx68, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
15398
15403
|
var ModalConfirm = ({
|
|
15399
|
-
name
|
|
15404
|
+
name,
|
|
15400
15405
|
isShowModal,
|
|
15401
15406
|
onClick,
|
|
15402
15407
|
onClose,
|
|
@@ -15405,8 +15410,8 @@ var ModalConfirm = ({
|
|
|
15405
15410
|
isLoading
|
|
15406
15411
|
}) => {
|
|
15407
15412
|
const { t: t3 } = useI18n();
|
|
15408
|
-
const renderButtonAction = (
|
|
15409
|
-
switch (
|
|
15413
|
+
const renderButtonAction = (name2) => {
|
|
15414
|
+
switch (name2) {
|
|
15410
15415
|
case "duplicate":
|
|
15411
15416
|
return /* @__PURE__ */ jsxs43(
|
|
15412
15417
|
"button",
|
|
@@ -15482,7 +15487,7 @@ var ModalConfirm = ({
|
|
|
15482
15487
|
children: t3("cancel")
|
|
15483
15488
|
}
|
|
15484
15489
|
),
|
|
15485
|
-
renderButtonAction(
|
|
15490
|
+
renderButtonAction(name)
|
|
15486
15491
|
] })
|
|
15487
15492
|
] }) });
|
|
15488
15493
|
};
|
|
@@ -16031,7 +16036,7 @@ import { useEffect as useEffect10, useState as useState10 } from "react";
|
|
|
16031
16036
|
import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
16032
16037
|
var BinaryField = (props) => {
|
|
16033
16038
|
const {
|
|
16034
|
-
name
|
|
16039
|
+
name,
|
|
16035
16040
|
methods,
|
|
16036
16041
|
readonly = false,
|
|
16037
16042
|
placeholder,
|
|
@@ -16070,7 +16075,7 @@ var BinaryField = (props) => {
|
|
|
16070
16075
|
try {
|
|
16071
16076
|
let type = "application/octet-stream";
|
|
16072
16077
|
let size4 = 0;
|
|
16073
|
-
let
|
|
16078
|
+
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16074
16079
|
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16075
16080
|
type = "image/*";
|
|
16076
16081
|
} else {
|
|
@@ -16083,7 +16088,7 @@ var BinaryField = (props) => {
|
|
|
16083
16088
|
}
|
|
16084
16089
|
}
|
|
16085
16090
|
setFileInfo({
|
|
16086
|
-
name:
|
|
16091
|
+
name: name2,
|
|
16087
16092
|
type,
|
|
16088
16093
|
url: initialFile,
|
|
16089
16094
|
size: size4,
|
|
@@ -16119,13 +16124,13 @@ var BinaryField = (props) => {
|
|
|
16119
16124
|
};
|
|
16120
16125
|
const renderPreview = (file) => {
|
|
16121
16126
|
if (!file) return /* @__PURE__ */ jsx75(PlaceHolderIcon, {});
|
|
16122
|
-
const { name:
|
|
16127
|
+
const { name: name2, type, url, size: size4 } = file;
|
|
16123
16128
|
if (type?.startsWith("image/") || checkIsImageLink2(url))
|
|
16124
16129
|
return /* @__PURE__ */ jsx75(
|
|
16125
16130
|
"img",
|
|
16126
16131
|
{
|
|
16127
16132
|
src: url,
|
|
16128
|
-
alt:
|
|
16133
|
+
alt: name2,
|
|
16129
16134
|
className: `w-full h-full rounded-lg object-contain ${isEditTable ? "max-h-10 max-w-10" : "max-w-32 max-h-32"}`,
|
|
16130
16135
|
style: {
|
|
16131
16136
|
maxWidth: isEditTable ? "40px" : "128px",
|
|
@@ -16165,7 +16170,7 @@ var BinaryField = (props) => {
|
|
|
16165
16170
|
maxWidth: "120px"
|
|
16166
16171
|
},
|
|
16167
16172
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16168
|
-
children:
|
|
16173
|
+
children: name2
|
|
16169
16174
|
}
|
|
16170
16175
|
),
|
|
16171
16176
|
isShowSize && /* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: formatFileSize(size4) })
|
|
@@ -16175,7 +16180,7 @@ var BinaryField = (props) => {
|
|
|
16175
16180
|
return /* @__PURE__ */ jsx75(
|
|
16176
16181
|
Controller,
|
|
16177
16182
|
{
|
|
16178
|
-
name:
|
|
16183
|
+
name: name ?? "",
|
|
16179
16184
|
control: methods?.control,
|
|
16180
16185
|
rules: {
|
|
16181
16186
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -16468,7 +16473,7 @@ import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-
|
|
|
16468
16473
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
16469
16474
|
var CharField = (props) => {
|
|
16470
16475
|
const {
|
|
16471
|
-
name
|
|
16476
|
+
name,
|
|
16472
16477
|
readonly,
|
|
16473
16478
|
placeholder,
|
|
16474
16479
|
required,
|
|
@@ -16499,7 +16504,7 @@ var CharField = (props) => {
|
|
|
16499
16504
|
return /* @__PURE__ */ jsx78(
|
|
16500
16505
|
Controller,
|
|
16501
16506
|
{
|
|
16502
|
-
name:
|
|
16507
|
+
name: name ?? "",
|
|
16503
16508
|
control: methods.control,
|
|
16504
16509
|
rules: {
|
|
16505
16510
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -16526,15 +16531,15 @@ var CharField = (props) => {
|
|
|
16526
16531
|
const { setError, clearErrors } = methods;
|
|
16527
16532
|
useEffect11(() => {
|
|
16528
16533
|
if (value2) {
|
|
16529
|
-
clearErrors(
|
|
16534
|
+
clearErrors(name);
|
|
16530
16535
|
}
|
|
16531
|
-
}, [value2, clearErrors,
|
|
16536
|
+
}, [value2, clearErrors, name]);
|
|
16532
16537
|
useEffect11(() => {
|
|
16533
16538
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
16534
16539
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
16535
|
-
const currentValue = methods?.getValues(
|
|
16540
|
+
const currentValue = methods?.getValues(name);
|
|
16536
16541
|
if (currentValue !== depValue) {
|
|
16537
|
-
methods?.setValue(
|
|
16542
|
+
methods?.setValue(name, depValue, { shouldValidate: true });
|
|
16538
16543
|
}
|
|
16539
16544
|
}, [widget, formValues]);
|
|
16540
16545
|
const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
|
|
@@ -16559,14 +16564,14 @@ var CharField = (props) => {
|
|
|
16559
16564
|
const inputValue = e3.target.value;
|
|
16560
16565
|
if (readonly) return;
|
|
16561
16566
|
fieldOnchange(inputValue);
|
|
16562
|
-
clearErrors(
|
|
16567
|
+
clearErrors(name);
|
|
16563
16568
|
},
|
|
16564
16569
|
onBlur: (e3) => {
|
|
16565
16570
|
if (readonly) return;
|
|
16566
16571
|
const inputValue = e3.target.value || "";
|
|
16567
16572
|
if (widget === "custom_passord") {
|
|
16568
16573
|
if (regex && !new RegExp(regex)?.test(inputValue)) {
|
|
16569
|
-
setError(
|
|
16574
|
+
setError(name, {
|
|
16570
16575
|
type: "pattern",
|
|
16571
16576
|
message: getPasswordMessage(
|
|
16572
16577
|
min3,
|
|
@@ -16581,7 +16586,7 @@ var CharField = (props) => {
|
|
|
16581
16586
|
} else if (widget === "text-only" || widget === "number-only" || widget === "email" || widget === "phone") {
|
|
16582
16587
|
const inputType = widget === "email" ? "email" : widget === "phone" ? "phone" : widget === "text-only" ? "text" : "number";
|
|
16583
16588
|
if (inputValue && !validateInput(inputValue, inputType)) {
|
|
16584
|
-
setError(
|
|
16589
|
+
setError(name, {
|
|
16585
16590
|
type: "pattern",
|
|
16586
16591
|
message: t3(
|
|
16587
16592
|
widget === "email" ? "email-only" : widget === "phone" ? "phone-only" : widget === "text-only" ? "text-only" : "number-only"
|
|
@@ -16591,14 +16596,14 @@ var CharField = (props) => {
|
|
|
16591
16596
|
}
|
|
16592
16597
|
}
|
|
16593
16598
|
fieldOnchange(inputValue);
|
|
16594
|
-
onChange2 && onChange2(
|
|
16599
|
+
onChange2 && onChange2(name ?? "", inputValue);
|
|
16595
16600
|
if (!inputValue && required && !invisible) {
|
|
16596
|
-
setError(
|
|
16601
|
+
setError(name, {
|
|
16597
16602
|
type: "required",
|
|
16598
16603
|
message: `${string} ${t3("must_required")}`
|
|
16599
16604
|
});
|
|
16600
16605
|
} else {
|
|
16601
|
-
clearErrors(
|
|
16606
|
+
clearErrors(name);
|
|
16602
16607
|
}
|
|
16603
16608
|
},
|
|
16604
16609
|
readOnly: readonly,
|
|
@@ -16652,14 +16657,14 @@ function EyeIconComponent({ open }) {
|
|
|
16652
16657
|
}
|
|
16653
16658
|
var SecureField = (props) => {
|
|
16654
16659
|
const {
|
|
16655
|
-
name
|
|
16660
|
+
name,
|
|
16656
16661
|
readonly,
|
|
16657
16662
|
placeholder,
|
|
16658
16663
|
required,
|
|
16659
16664
|
invisible,
|
|
16660
16665
|
methods,
|
|
16661
16666
|
onChange: onChange2,
|
|
16662
|
-
string =
|
|
16667
|
+
string = name,
|
|
16663
16668
|
widget,
|
|
16664
16669
|
min: min3,
|
|
16665
16670
|
max: max3,
|
|
@@ -16689,7 +16694,7 @@ var SecureField = (props) => {
|
|
|
16689
16694
|
return /* @__PURE__ */ jsx80(
|
|
16690
16695
|
Controller,
|
|
16691
16696
|
{
|
|
16692
|
-
name: String(
|
|
16697
|
+
name: String(name),
|
|
16693
16698
|
control: methods.control,
|
|
16694
16699
|
rules: {
|
|
16695
16700
|
...required && !invisible ? {
|
|
@@ -16723,8 +16728,8 @@ var SecureField = (props) => {
|
|
|
16723
16728
|
if (canToggle) setShowPlain(false);
|
|
16724
16729
|
}, [canToggle]);
|
|
16725
16730
|
useEffect12(() => {
|
|
16726
|
-
if (value2) clearErrors(
|
|
16727
|
-
}, [value2, clearErrors,
|
|
16731
|
+
if (value2) clearErrors(name);
|
|
16732
|
+
}, [value2, clearErrors, name]);
|
|
16728
16733
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
16729
16734
|
isCappedToken && shouldMask && /* @__PURE__ */ jsx80(
|
|
16730
16735
|
"div",
|
|
@@ -16742,20 +16747,20 @@ var SecureField = (props) => {
|
|
|
16742
16747
|
if (readonly) return;
|
|
16743
16748
|
const inputValue = e3.target.value ?? "";
|
|
16744
16749
|
fieldOnchange(inputValue);
|
|
16745
|
-
clearErrors(
|
|
16750
|
+
clearErrors(name);
|
|
16746
16751
|
},
|
|
16747
16752
|
onBlur: (e3) => {
|
|
16748
16753
|
if (readonly) return;
|
|
16749
16754
|
const inputValue = (e3.target.value ?? "").trim();
|
|
16750
16755
|
if (!inputValue && required && !invisible) {
|
|
16751
|
-
setError(
|
|
16756
|
+
setError(name, {
|
|
16752
16757
|
type: "required",
|
|
16753
16758
|
message: `${string} ${t3("must_required")}`
|
|
16754
16759
|
});
|
|
16755
16760
|
return;
|
|
16756
16761
|
}
|
|
16757
16762
|
if ((widget === "custom_password" || widget === "password") && regex && !new RegExp(regex).test(inputValue)) {
|
|
16758
|
-
setError(
|
|
16763
|
+
setError(name, {
|
|
16759
16764
|
type: "pattern",
|
|
16760
16765
|
message: getPasswordMessage2(
|
|
16761
16766
|
min3,
|
|
@@ -16768,8 +16773,8 @@ var SecureField = (props) => {
|
|
|
16768
16773
|
return;
|
|
16769
16774
|
}
|
|
16770
16775
|
fieldOnchange(inputValue);
|
|
16771
|
-
onChange2 && onChange2(String(
|
|
16772
|
-
clearErrors(
|
|
16776
|
+
onChange2 && onChange2(String(name), inputValue);
|
|
16777
|
+
clearErrors(name);
|
|
16773
16778
|
},
|
|
16774
16779
|
readOnly: readonly,
|
|
16775
16780
|
disabled: readonly,
|
|
@@ -16813,7 +16818,7 @@ var SecureField = (props) => {
|
|
|
16813
16818
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
16814
16819
|
var CheckboxField = (props) => {
|
|
16815
16820
|
const {
|
|
16816
|
-
name
|
|
16821
|
+
name,
|
|
16817
16822
|
readonly = false,
|
|
16818
16823
|
required = false,
|
|
16819
16824
|
invisible = false,
|
|
@@ -16824,7 +16829,7 @@ var CheckboxField = (props) => {
|
|
|
16824
16829
|
isEditTable = false
|
|
16825
16830
|
} = props;
|
|
16826
16831
|
if (!isForm) {
|
|
16827
|
-
if (
|
|
16832
|
+
if (name === "is_active" || name === "active") {
|
|
16828
16833
|
return /* @__PURE__ */ jsx81(ActiveBadgeField, { type: value });
|
|
16829
16834
|
} else {
|
|
16830
16835
|
return /* @__PURE__ */ jsx81(
|
|
@@ -16841,7 +16846,7 @@ var CheckboxField = (props) => {
|
|
|
16841
16846
|
return /* @__PURE__ */ jsx81(
|
|
16842
16847
|
Controller,
|
|
16843
16848
|
{
|
|
16844
|
-
name:
|
|
16849
|
+
name: name ?? "",
|
|
16845
16850
|
control: methods?.control,
|
|
16846
16851
|
render: ({ field }) => /* @__PURE__ */ jsx81(
|
|
16847
16852
|
"div",
|
|
@@ -16850,10 +16855,10 @@ var CheckboxField = (props) => {
|
|
|
16850
16855
|
onClick: () => {
|
|
16851
16856
|
const checked = !field.value;
|
|
16852
16857
|
if (!isEditTable && readonly) return;
|
|
16853
|
-
methods.setValue(
|
|
16858
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16854
16859
|
field.onChange(checked);
|
|
16855
16860
|
if (onChange2) {
|
|
16856
|
-
onChange2(
|
|
16861
|
+
onChange2(name ?? "", checked);
|
|
16857
16862
|
}
|
|
16858
16863
|
},
|
|
16859
16864
|
children: /* @__PURE__ */ jsx81(
|
|
@@ -16863,10 +16868,10 @@ var CheckboxField = (props) => {
|
|
|
16863
16868
|
onChange: (e3) => {
|
|
16864
16869
|
const checked = e3.target.checked;
|
|
16865
16870
|
if (!isEditTable && readonly) return;
|
|
16866
|
-
methods.setValue(
|
|
16871
|
+
methods.setValue(name, checked, { shouldDirty: true });
|
|
16867
16872
|
field.onChange(checked);
|
|
16868
16873
|
if (onChange2) {
|
|
16869
|
-
onChange2(
|
|
16874
|
+
onChange2(name ?? "", checked);
|
|
16870
16875
|
}
|
|
16871
16876
|
},
|
|
16872
16877
|
type: "checkbox",
|
|
@@ -16960,19 +16965,19 @@ var ColorWrapper = (props) => {
|
|
|
16960
16965
|
// src/widgets/basic/color-field/color.tsx
|
|
16961
16966
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
16962
16967
|
var ColorField = (props) => {
|
|
16963
|
-
const { value, isForm, name
|
|
16968
|
+
const { value, isForm, name, methods, onChange: onChange2, savePickColor } = props;
|
|
16964
16969
|
if (!isForm) {
|
|
16965
16970
|
return /* @__PURE__ */ jsx83(ColorWrapper, { savePickColor, defaultColor: value, colors: COLORS });
|
|
16966
16971
|
}
|
|
16967
16972
|
return /* @__PURE__ */ jsx83(
|
|
16968
16973
|
Controller,
|
|
16969
16974
|
{
|
|
16970
|
-
name:
|
|
16975
|
+
name: name ?? "",
|
|
16971
16976
|
control: methods?.control,
|
|
16972
16977
|
render: ({ field }) => {
|
|
16973
16978
|
const handlePickColorChange = (color) => {
|
|
16974
16979
|
field.onChange(color?.id);
|
|
16975
|
-
onChange2 && onChange2(
|
|
16980
|
+
onChange2 && onChange2(name ?? "", color?.id);
|
|
16976
16981
|
};
|
|
16977
16982
|
return /* @__PURE__ */ jsx83(
|
|
16978
16983
|
ColorWrapper,
|
|
@@ -16993,7 +16998,7 @@ import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
|
16993
16998
|
var CopyLinkButtonField = (props) => {
|
|
16994
16999
|
const {
|
|
16995
17000
|
isForm,
|
|
16996
|
-
name
|
|
17001
|
+
name,
|
|
16997
17002
|
methods,
|
|
16998
17003
|
onChange: onChange2,
|
|
16999
17004
|
readonly,
|
|
@@ -17015,7 +17020,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17015
17020
|
return /* @__PURE__ */ jsx84(
|
|
17016
17021
|
Controller,
|
|
17017
17022
|
{
|
|
17018
|
-
name:
|
|
17023
|
+
name: name ?? "",
|
|
17019
17024
|
control: methods.control,
|
|
17020
17025
|
rules: {
|
|
17021
17026
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -17027,7 +17032,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17027
17032
|
const { setError, clearErrors } = methods;
|
|
17028
17033
|
useEffect14(() => {
|
|
17029
17034
|
if (value) {
|
|
17030
|
-
clearErrors(
|
|
17035
|
+
clearErrors(name);
|
|
17031
17036
|
}
|
|
17032
17037
|
}, [value]);
|
|
17033
17038
|
return /* @__PURE__ */ jsxs54("div", { className: "widget copy-link-widget relative", children: [
|
|
@@ -17045,11 +17050,11 @@ var CopyLinkButtonField = (props) => {
|
|
|
17045
17050
|
if (readonly) return;
|
|
17046
17051
|
const newValue = e3.target.value || "";
|
|
17047
17052
|
fieldOnchange(newValue);
|
|
17048
|
-
onChange2 && onChange2(
|
|
17053
|
+
onChange2 && onChange2(name ?? "", newValue);
|
|
17049
17054
|
if (e3.target.value) {
|
|
17050
|
-
clearErrors(
|
|
17055
|
+
clearErrors(name);
|
|
17051
17056
|
} else if (required && !invisible) {
|
|
17052
|
-
setError(
|
|
17057
|
+
setError(name, {
|
|
17053
17058
|
type: "required",
|
|
17054
17059
|
message: `${string} ${t3("must_required")}`
|
|
17055
17060
|
});
|
|
@@ -17059,9 +17064,9 @@ var CopyLinkButtonField = (props) => {
|
|
|
17059
17064
|
if (!readonly) {
|
|
17060
17065
|
fieldOnchange(e3.target.value);
|
|
17061
17066
|
if (e3.target.value) {
|
|
17062
|
-
clearErrors(
|
|
17067
|
+
clearErrors(name);
|
|
17063
17068
|
} else if (required && !invisible) {
|
|
17064
|
-
setError(
|
|
17069
|
+
setError(name, {
|
|
17065
17070
|
type: "required",
|
|
17066
17071
|
message: `${string} ${t3("must_required")}`
|
|
17067
17072
|
});
|
|
@@ -26925,23 +26930,23 @@ var createCache = function createCache2(options2) {
|
|
|
26925
26930
|
};
|
|
26926
26931
|
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
26927
26932
|
var getRules3 = function getRules4(selector, serialized) {
|
|
26928
|
-
var
|
|
26929
|
-
if (serverStylisCache[
|
|
26930
|
-
serverStylisCache[
|
|
26933
|
+
var name = serialized.name;
|
|
26934
|
+
if (serverStylisCache[name] === void 0) {
|
|
26935
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
26931
26936
|
}
|
|
26932
|
-
return serverStylisCache[
|
|
26937
|
+
return serverStylisCache[name];
|
|
26933
26938
|
};
|
|
26934
26939
|
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
|
26935
|
-
var
|
|
26940
|
+
var name = serialized.name;
|
|
26936
26941
|
var rules = getRules3(selector, serialized);
|
|
26937
26942
|
if (cache.compat === void 0) {
|
|
26938
26943
|
if (shouldCache) {
|
|
26939
|
-
cache.inserted[
|
|
26944
|
+
cache.inserted[name] = true;
|
|
26940
26945
|
}
|
|
26941
26946
|
return rules;
|
|
26942
26947
|
} else {
|
|
26943
26948
|
if (shouldCache) {
|
|
26944
|
-
cache.inserted[
|
|
26949
|
+
cache.inserted[name] = rules;
|
|
26945
26950
|
} else {
|
|
26946
26951
|
return rules;
|
|
26947
26952
|
}
|
|
@@ -27264,9 +27269,9 @@ function serializeStyles(args, registered, mergedProps) {
|
|
|
27264
27269
|
while ((match3 = labelPattern.exec(styles)) !== null) {
|
|
27265
27270
|
identifierName += "-" + match3[1];
|
|
27266
27271
|
}
|
|
27267
|
-
var
|
|
27272
|
+
var name = murmur2(styles) + identifierName;
|
|
27268
27273
|
return {
|
|
27269
|
-
name
|
|
27274
|
+
name,
|
|
27270
27275
|
styles,
|
|
27271
27276
|
next: cursor
|
|
27272
27277
|
};
|
|
@@ -27416,10 +27421,10 @@ function css() {
|
|
|
27416
27421
|
}
|
|
27417
27422
|
function keyframes() {
|
|
27418
27423
|
var insertable = css.apply(void 0, arguments);
|
|
27419
|
-
var
|
|
27424
|
+
var name = "animation-" + insertable.name;
|
|
27420
27425
|
return {
|
|
27421
|
-
name
|
|
27422
|
-
styles: "@keyframes " +
|
|
27426
|
+
name,
|
|
27427
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
27423
27428
|
anim: 1,
|
|
27424
27429
|
toString: function toString() {
|
|
27425
27430
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
@@ -27451,13 +27456,13 @@ var index3 = isClient3 ? useLayoutEffect4 : noop6;
|
|
|
27451
27456
|
var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
27452
27457
|
var noop8 = function noop9() {
|
|
27453
27458
|
};
|
|
27454
|
-
function applyPrefixToName(prefix2,
|
|
27455
|
-
if (!
|
|
27459
|
+
function applyPrefixToName(prefix2, name) {
|
|
27460
|
+
if (!name) {
|
|
27456
27461
|
return prefix2;
|
|
27457
|
-
} else if (
|
|
27458
|
-
return prefix2 +
|
|
27462
|
+
} else if (name[0] === "-") {
|
|
27463
|
+
return prefix2 + name;
|
|
27459
27464
|
} else {
|
|
27460
|
-
return prefix2 + "__" +
|
|
27465
|
+
return prefix2 + "__" + name;
|
|
27461
27466
|
}
|
|
27462
27467
|
}
|
|
27463
27468
|
function classNames(prefix2, state) {
|
|
@@ -27501,11 +27506,11 @@ var cleanCommonProps = function cleanCommonProps2(props) {
|
|
|
27501
27506
|
var innerProps = _objectWithoutProperties(props, _excluded$4);
|
|
27502
27507
|
return _objectSpread2({}, innerProps);
|
|
27503
27508
|
};
|
|
27504
|
-
var getStyleProps = function getStyleProps2(props,
|
|
27509
|
+
var getStyleProps = function getStyleProps2(props, name, classNamesState) {
|
|
27505
27510
|
var cx = props.cx, getStyles = props.getStyles, getClassNames = props.getClassNames, className = props.className;
|
|
27506
27511
|
return {
|
|
27507
|
-
css: getStyles(
|
|
27508
|
-
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(
|
|
27512
|
+
css: getStyles(name, props),
|
|
27513
|
+
className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className)
|
|
27509
27514
|
};
|
|
27510
27515
|
};
|
|
27511
27516
|
function isDocumentElement(el) {
|
|
@@ -29254,10 +29259,10 @@ var _ref22 = process.env.NODE_ENV === "production" ? {
|
|
|
29254
29259
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
29255
29260
|
};
|
|
29256
29261
|
var RequiredInput = function RequiredInput2(_ref3) {
|
|
29257
|
-
var
|
|
29262
|
+
var name = _ref3.name, onFocus2 = _ref3.onFocus;
|
|
29258
29263
|
return jsx86("input", {
|
|
29259
29264
|
required: true,
|
|
29260
|
-
name
|
|
29265
|
+
name,
|
|
29261
29266
|
tabIndex: -1,
|
|
29262
29267
|
"aria-hidden": "true",
|
|
29263
29268
|
onFocus: onFocus2,
|
|
@@ -29583,8 +29588,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29583
29588
|
_this.focus = _this.focusInput;
|
|
29584
29589
|
_this.blur = _this.blurInput;
|
|
29585
29590
|
_this.onChange = function(newValue, actionMeta) {
|
|
29586
|
-
var _this$props = _this.props, onChange2 = _this$props.onChange,
|
|
29587
|
-
actionMeta.name =
|
|
29591
|
+
var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
|
|
29592
|
+
actionMeta.name = name;
|
|
29588
29593
|
_this.ariaOnChange(newValue, actionMeta);
|
|
29589
29594
|
onChange2(newValue, actionMeta);
|
|
29590
29595
|
};
|
|
@@ -29609,7 +29614,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29609
29614
|
});
|
|
29610
29615
|
};
|
|
29611
29616
|
_this.selectOption = function(newValue) {
|
|
29612
|
-
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti,
|
|
29617
|
+
var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name;
|
|
29613
29618
|
var selectValue = _this.state.selectValue;
|
|
29614
29619
|
var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
|
|
29615
29620
|
var isDisabled = _this.isOptionDisabled(newValue, selectValue);
|
|
@@ -29628,7 +29633,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
29628
29633
|
_this.ariaOnChange(singleValueAsValue(newValue), {
|
|
29629
29634
|
action: "select-option",
|
|
29630
29635
|
option: newValue,
|
|
29631
|
-
name
|
|
29636
|
+
name
|
|
29632
29637
|
});
|
|
29633
29638
|
return;
|
|
29634
29639
|
}
|
|
@@ -30682,22 +30687,22 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30682
30687
|
key: "renderFormField",
|
|
30683
30688
|
value: function renderFormField() {
|
|
30684
30689
|
var _this5 = this;
|
|
30685
|
-
var _this$props13 = this.props, delimiter2 = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti,
|
|
30690
|
+
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;
|
|
30686
30691
|
var selectValue = this.state.selectValue;
|
|
30687
30692
|
if (required && !this.hasValue() && !isDisabled) {
|
|
30688
30693
|
return /* @__PURE__ */ React14.createElement(RequiredInput$1, {
|
|
30689
|
-
name
|
|
30694
|
+
name,
|
|
30690
30695
|
onFocus: this.onValueInputFocus
|
|
30691
30696
|
});
|
|
30692
30697
|
}
|
|
30693
|
-
if (!
|
|
30698
|
+
if (!name || isDisabled) return;
|
|
30694
30699
|
if (isMulti) {
|
|
30695
30700
|
if (delimiter2) {
|
|
30696
30701
|
var value = selectValue.map(function(opt) {
|
|
30697
30702
|
return _this5.getOptionValue(opt);
|
|
30698
30703
|
}).join(delimiter2);
|
|
30699
30704
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30700
|
-
name
|
|
30705
|
+
name,
|
|
30701
30706
|
type: "hidden",
|
|
30702
30707
|
value
|
|
30703
30708
|
});
|
|
@@ -30705,12 +30710,12 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30705
30710
|
var input = selectValue.length > 0 ? selectValue.map(function(opt, i3) {
|
|
30706
30711
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30707
30712
|
key: "i-".concat(i3),
|
|
30708
|
-
name
|
|
30713
|
+
name,
|
|
30709
30714
|
type: "hidden",
|
|
30710
30715
|
value: _this5.getOptionValue(opt)
|
|
30711
30716
|
});
|
|
30712
30717
|
}) : /* @__PURE__ */ React14.createElement("input", {
|
|
30713
|
-
name
|
|
30718
|
+
name,
|
|
30714
30719
|
type: "hidden",
|
|
30715
30720
|
value: ""
|
|
30716
30721
|
});
|
|
@@ -30719,7 +30724,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
30719
30724
|
} else {
|
|
30720
30725
|
var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
|
|
30721
30726
|
return /* @__PURE__ */ React14.createElement("input", {
|
|
30722
|
-
name
|
|
30727
|
+
name,
|
|
30723
30728
|
type: "hidden",
|
|
30724
30729
|
value: _value
|
|
30725
30730
|
});
|
|
@@ -30848,7 +30853,7 @@ var import_moment2 = __toESM(require_moment());
|
|
|
30848
30853
|
import { Fragment as Fragment24, jsx as jsx88, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
30849
30854
|
var DateField = (props) => {
|
|
30850
30855
|
const {
|
|
30851
|
-
name
|
|
30856
|
+
name,
|
|
30852
30857
|
value,
|
|
30853
30858
|
readonly,
|
|
30854
30859
|
placeholder = "DD/MM/YYYY",
|
|
@@ -30898,7 +30903,7 @@ var DateField = (props) => {
|
|
|
30898
30903
|
return /* @__PURE__ */ jsx88(
|
|
30899
30904
|
Controller,
|
|
30900
30905
|
{
|
|
30901
|
-
name:
|
|
30906
|
+
name: name || "",
|
|
30902
30907
|
control: methods?.control,
|
|
30903
30908
|
defaultValue: (0, import_moment2.default)().subtract(1, "days").format("YYYY-MM-DD"),
|
|
30904
30909
|
rules: {
|
|
@@ -30913,9 +30918,9 @@ var DateField = (props) => {
|
|
|
30913
30918
|
const { setError, clearErrors } = methods;
|
|
30914
30919
|
useEffect18(() => {
|
|
30915
30920
|
if (value) {
|
|
30916
|
-
clearErrors(
|
|
30921
|
+
clearErrors(name);
|
|
30917
30922
|
}
|
|
30918
|
-
}, [value, clearErrors,
|
|
30923
|
+
}, [value, clearErrors, name]);
|
|
30919
30924
|
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;
|
|
30920
30925
|
return /* @__PURE__ */ jsxs56(Fragment24, { children: [
|
|
30921
30926
|
/* @__PURE__ */ jsx88(
|
|
@@ -30934,7 +30939,7 @@ var DateField = (props) => {
|
|
|
30934
30939
|
adjustedDate.toDate()
|
|
30935
30940
|
);
|
|
30936
30941
|
if (validateCustomResult && typeof validateCustomResult === "string") {
|
|
30937
|
-
setError(
|
|
30942
|
+
setError(name, {
|
|
30938
30943
|
type: "manual",
|
|
30939
30944
|
message: validateCustomResult
|
|
30940
30945
|
});
|
|
@@ -30942,20 +30947,20 @@ var DateField = (props) => {
|
|
|
30942
30947
|
}
|
|
30943
30948
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
30944
30949
|
field.onChange(adjustedDate.format(formatDateParse));
|
|
30945
|
-
handleOnchange && handleOnchange(
|
|
30946
|
-
clearErrors(
|
|
30950
|
+
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
30951
|
+
clearErrors(name);
|
|
30947
30952
|
} else {
|
|
30948
30953
|
field.onChange(null);
|
|
30949
|
-
handleOnchange && handleOnchange(
|
|
30954
|
+
handleOnchange && handleOnchange(name ?? "", null);
|
|
30950
30955
|
if (required && !invisible) {
|
|
30951
30956
|
if (!isEditTable) {
|
|
30952
|
-
setError(
|
|
30957
|
+
setError(name, {
|
|
30953
30958
|
type: "manual",
|
|
30954
30959
|
message: `${string} ${t3("must_required")}`
|
|
30955
30960
|
});
|
|
30956
30961
|
}
|
|
30957
30962
|
} else {
|
|
30958
|
-
clearErrors(
|
|
30963
|
+
clearErrors(name);
|
|
30959
30964
|
}
|
|
30960
30965
|
}
|
|
30961
30966
|
},
|
|
@@ -30976,7 +30981,7 @@ var DateField = (props) => {
|
|
|
30976
30981
|
}
|
|
30977
30982
|
),
|
|
30978
30983
|
timeInputLabel: textPlaceHolder,
|
|
30979
|
-
portalId:
|
|
30984
|
+
portalId: name,
|
|
30980
30985
|
renderCustomHeader: ({
|
|
30981
30986
|
date,
|
|
30982
30987
|
changeYear,
|
|
@@ -31315,7 +31320,7 @@ var RenderFile = ({
|
|
|
31315
31320
|
};
|
|
31316
31321
|
var FileUploadField = (props) => {
|
|
31317
31322
|
const {
|
|
31318
|
-
name
|
|
31323
|
+
name,
|
|
31319
31324
|
methods,
|
|
31320
31325
|
isForm,
|
|
31321
31326
|
model,
|
|
@@ -31346,7 +31351,7 @@ var FileUploadField = (props) => {
|
|
|
31346
31351
|
return /* @__PURE__ */ jsx93(
|
|
31347
31352
|
Controller,
|
|
31348
31353
|
{
|
|
31349
|
-
name:
|
|
31354
|
+
name: name || "",
|
|
31350
31355
|
control: methods?.control,
|
|
31351
31356
|
rules: {
|
|
31352
31357
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31412,7 +31417,7 @@ import { useEffect as useEffect20, useRef as useRef15, useState as useState19 }
|
|
|
31412
31417
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
31413
31418
|
var FloatField = (props) => {
|
|
31414
31419
|
const {
|
|
31415
|
-
name
|
|
31420
|
+
name,
|
|
31416
31421
|
value: propValue,
|
|
31417
31422
|
readonly,
|
|
31418
31423
|
placeholder,
|
|
@@ -31433,7 +31438,7 @@ var FloatField = (props) => {
|
|
|
31433
31438
|
return /* @__PURE__ */ jsx94(
|
|
31434
31439
|
Controller,
|
|
31435
31440
|
{
|
|
31436
|
-
name:
|
|
31441
|
+
name: name ?? "",
|
|
31437
31442
|
control: methods.control,
|
|
31438
31443
|
rules: {
|
|
31439
31444
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -31451,14 +31456,14 @@ var FloatField = (props) => {
|
|
|
31451
31456
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
31452
31457
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
31453
31458
|
setInputValue(formatFloatNumber(propValue));
|
|
31454
|
-
clearErrors(
|
|
31459
|
+
clearErrors(name);
|
|
31455
31460
|
} else if (value !== void 0 && value !== null && !Number.isNaN(value) && value !== numericInput) {
|
|
31456
31461
|
setInputValue(formatFloatNumber(value));
|
|
31457
|
-
clearErrors(
|
|
31462
|
+
clearErrors(name);
|
|
31458
31463
|
} else if (value === null || value === void 0) {
|
|
31459
31464
|
setInputValue("");
|
|
31460
31465
|
}
|
|
31461
|
-
}, [value,
|
|
31466
|
+
}, [value, name, clearErrors, propValue]);
|
|
31462
31467
|
const handleInputChange = (e3) => {
|
|
31463
31468
|
let newValue = e3.target.value;
|
|
31464
31469
|
if (!/^[0-9.,]*$/.test(newValue)) return;
|
|
@@ -31478,7 +31483,7 @@ var FloatField = (props) => {
|
|
|
31478
31483
|
);
|
|
31479
31484
|
if (!isNaN(parsedValue)) {
|
|
31480
31485
|
onChange2(parsedValue);
|
|
31481
|
-
clearErrors(
|
|
31486
|
+
clearErrors(name);
|
|
31482
31487
|
isDirtyRef.current = true;
|
|
31483
31488
|
} else {
|
|
31484
31489
|
onChange2(null);
|
|
@@ -31490,7 +31495,7 @@ var FloatField = (props) => {
|
|
|
31490
31495
|
const parsedValue = parseFloat(rawValue);
|
|
31491
31496
|
if (rawValue === "" || rawValue === ".") {
|
|
31492
31497
|
if (required) {
|
|
31493
|
-
setError(
|
|
31498
|
+
setError(name, {
|
|
31494
31499
|
type: "required",
|
|
31495
31500
|
message: `${string} ${t3("must_required")}`
|
|
31496
31501
|
});
|
|
@@ -31500,7 +31505,7 @@ var FloatField = (props) => {
|
|
|
31500
31505
|
lastCommittedValueRef.current = null;
|
|
31501
31506
|
} else if (!isNaN(parsedValue)) {
|
|
31502
31507
|
if (parsedValue < 0) {
|
|
31503
|
-
setError(
|
|
31508
|
+
setError(name, {
|
|
31504
31509
|
type: "validate",
|
|
31505
31510
|
message: t3("invalid_number")
|
|
31506
31511
|
});
|
|
@@ -31510,12 +31515,12 @@ var FloatField = (props) => {
|
|
|
31510
31515
|
const formattedValue = formatFloatNumber(parsedValue);
|
|
31511
31516
|
setInputValue(formattedValue);
|
|
31512
31517
|
onChange2(parsedValue);
|
|
31513
|
-
handleOnchange?.(
|
|
31514
|
-
clearErrors(
|
|
31518
|
+
handleOnchange?.(name ?? "", parsedValue);
|
|
31519
|
+
clearErrors(name);
|
|
31515
31520
|
lastCommittedValueRef.current = parsedValue;
|
|
31516
31521
|
}
|
|
31517
31522
|
} else {
|
|
31518
|
-
setError(
|
|
31523
|
+
setError(name, {
|
|
31519
31524
|
type: "validate",
|
|
31520
31525
|
message: t3("invalid_number")
|
|
31521
31526
|
});
|
|
@@ -31554,7 +31559,7 @@ import { useState as useState20 } from "react";
|
|
|
31554
31559
|
import { Fragment as Fragment27, jsx as jsx95, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
31555
31560
|
var FloatTimeField = (props) => {
|
|
31556
31561
|
const {
|
|
31557
|
-
name
|
|
31562
|
+
name,
|
|
31558
31563
|
methods,
|
|
31559
31564
|
defaultValue = 0,
|
|
31560
31565
|
isForm = true,
|
|
@@ -31572,7 +31577,7 @@ var FloatTimeField = (props) => {
|
|
|
31572
31577
|
return /* @__PURE__ */ jsx95(
|
|
31573
31578
|
Controller,
|
|
31574
31579
|
{
|
|
31575
|
-
name:
|
|
31580
|
+
name: name ?? "",
|
|
31576
31581
|
control: methods?.control,
|
|
31577
31582
|
defaultValue,
|
|
31578
31583
|
rules: {
|
|
@@ -31619,13 +31624,13 @@ var FloatTimeField = (props) => {
|
|
|
31619
31624
|
const floatVal = convertTimeToFloat(formattedTime);
|
|
31620
31625
|
fieldOnChange(floatVal);
|
|
31621
31626
|
if (onChange2) {
|
|
31622
|
-
onChange2(
|
|
31627
|
+
onChange2(name ?? "", floatVal);
|
|
31623
31628
|
}
|
|
31624
31629
|
} else {
|
|
31625
31630
|
setInput("00:00");
|
|
31626
31631
|
fieldOnChange(0);
|
|
31627
31632
|
if (onChange2) {
|
|
31628
|
-
onChange2(
|
|
31633
|
+
onChange2(name ?? "", 0);
|
|
31629
31634
|
}
|
|
31630
31635
|
setErrors("");
|
|
31631
31636
|
}
|
|
@@ -31676,7 +31681,7 @@ import { useEffect as useEffect21, useRef as useRef16 } from "react";
|
|
|
31676
31681
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
31677
31682
|
var HtmlField = (props) => {
|
|
31678
31683
|
const {
|
|
31679
|
-
name
|
|
31684
|
+
name,
|
|
31680
31685
|
methods,
|
|
31681
31686
|
readonly = false,
|
|
31682
31687
|
isForm = true,
|
|
@@ -31693,7 +31698,7 @@ var HtmlField = (props) => {
|
|
|
31693
31698
|
return /* @__PURE__ */ jsx96(
|
|
31694
31699
|
Controller,
|
|
31695
31700
|
{
|
|
31696
|
-
name:
|
|
31701
|
+
name: name ?? "",
|
|
31697
31702
|
control: methods?.control,
|
|
31698
31703
|
defaultValue,
|
|
31699
31704
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
@@ -31726,10 +31731,10 @@ var HtmlField = (props) => {
|
|
|
31726
31731
|
// src/widgets/basic/image-field/image.tsx
|
|
31727
31732
|
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
31728
31733
|
var ImageField = (props) => {
|
|
31729
|
-
const { value, type, name
|
|
31734
|
+
const { value, type, name, baseURL } = props;
|
|
31730
31735
|
if (!value) return null;
|
|
31731
31736
|
if (type === "url") {
|
|
31732
|
-
return /* @__PURE__ */ jsx97("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt:
|
|
31737
|
+
return /* @__PURE__ */ jsx97("img", { src: `${baseURL}${value}`, width: 48, height: 48, alt: name });
|
|
31733
31738
|
}
|
|
31734
31739
|
return /* @__PURE__ */ jsx97("div", { id: "qr-code", children: /* @__PURE__ */ jsx97("img", { src: `data:image/png;base64,${value}`, alt: "QR Code" }) });
|
|
31735
31740
|
};
|
|
@@ -31831,7 +31836,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31831
31836
|
const {
|
|
31832
31837
|
relation,
|
|
31833
31838
|
value,
|
|
31834
|
-
name
|
|
31839
|
+
name,
|
|
31835
31840
|
methods,
|
|
31836
31841
|
required,
|
|
31837
31842
|
invisible,
|
|
@@ -31872,7 +31877,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31872
31877
|
return /* @__PURE__ */ jsx99(
|
|
31873
31878
|
Controller,
|
|
31874
31879
|
{
|
|
31875
|
-
name:
|
|
31880
|
+
name: name ?? "",
|
|
31876
31881
|
control: methods.control,
|
|
31877
31882
|
rules: {
|
|
31878
31883
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -31881,7 +31886,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31881
31886
|
const { clearErrors } = methods;
|
|
31882
31887
|
useEffect22(() => {
|
|
31883
31888
|
if (field.value) {
|
|
31884
|
-
clearErrors(
|
|
31889
|
+
clearErrors(name);
|
|
31885
31890
|
}
|
|
31886
31891
|
}, [field.value]);
|
|
31887
31892
|
const filteredValue = useMemo11(() => {
|
|
@@ -31901,12 +31906,12 @@ var Many2ManyTagField = (props) => {
|
|
|
31901
31906
|
}, [field?.value, options2]);
|
|
31902
31907
|
const handleChange = (selectedOptions) => {
|
|
31903
31908
|
const newValue = transfer(selectedOptions);
|
|
31904
|
-
methods?.setValue(
|
|
31905
|
-
onChange2?.(
|
|
31906
|
-
clearErrors(
|
|
31909
|
+
methods?.setValue(name, newValue, { shouldDirty: true });
|
|
31910
|
+
onChange2?.(name ?? "", newValue);
|
|
31911
|
+
clearErrors(name);
|
|
31907
31912
|
newValue.forEach((item, index4) => {
|
|
31908
31913
|
Object.keys(item).forEach((key) => {
|
|
31909
|
-
methods.setValue(`${
|
|
31914
|
+
methods.setValue(`${name}[${index4}].${key}`, item[key], {
|
|
31910
31915
|
shouldDirty: true
|
|
31911
31916
|
});
|
|
31912
31917
|
});
|
|
@@ -32031,7 +32036,7 @@ import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx
|
|
|
32031
32036
|
var MonetaryField = (props) => {
|
|
32032
32037
|
const { t: t3 } = useI18n();
|
|
32033
32038
|
const {
|
|
32034
|
-
name
|
|
32039
|
+
name,
|
|
32035
32040
|
value,
|
|
32036
32041
|
readonly,
|
|
32037
32042
|
required,
|
|
@@ -32048,7 +32053,7 @@ var MonetaryField = (props) => {
|
|
|
32048
32053
|
symbol = "VND",
|
|
32049
32054
|
baseClassName
|
|
32050
32055
|
} = props;
|
|
32051
|
-
if (isForm &&
|
|
32056
|
+
if (isForm && name === "amount_residual") {
|
|
32052
32057
|
return /* @__PURE__ */ jsxs66("div", { className: "flex justify-end gap-x-4 gap-y-2 ml-auto mt-2 lg:mt-5", children: [
|
|
32053
32058
|
/* @__PURE__ */ jsxs66("span", { className: "font-semibold", children: [
|
|
32054
32059
|
string,
|
|
@@ -32065,7 +32070,7 @@ var MonetaryField = (props) => {
|
|
|
32065
32070
|
return /* @__PURE__ */ jsx100(
|
|
32066
32071
|
Controller,
|
|
32067
32072
|
{
|
|
32068
|
-
name:
|
|
32073
|
+
name: name ?? "",
|
|
32069
32074
|
control: methods.control,
|
|
32070
32075
|
rules: {
|
|
32071
32076
|
required: !invisible && required ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32078,7 +32083,7 @@ var MonetaryField = (props) => {
|
|
|
32078
32083
|
const { setError, clearErrors } = methods;
|
|
32079
32084
|
useEffect23(() => {
|
|
32080
32085
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32081
|
-
clearErrors(
|
|
32086
|
+
clearErrors(name);
|
|
32082
32087
|
}
|
|
32083
32088
|
}, [value2]);
|
|
32084
32089
|
return /* @__PURE__ */ jsxs66(Fragment29, { children: [
|
|
@@ -32089,18 +32094,18 @@ var MonetaryField = (props) => {
|
|
|
32089
32094
|
onBlur: () => {
|
|
32090
32095
|
if (!readonly && !isNaN(value2)) {
|
|
32091
32096
|
onBlur();
|
|
32092
|
-
handleOnchange && handleOnchange(
|
|
32093
|
-
clearErrors(
|
|
32097
|
+
handleOnchange && handleOnchange(name ?? "", value2);
|
|
32098
|
+
clearErrors(name);
|
|
32094
32099
|
}
|
|
32095
32100
|
},
|
|
32096
32101
|
onChange: (e3) => {
|
|
32097
32102
|
const parsedValue = parseFormattedNumber(e3.target.value);
|
|
32098
32103
|
if (!readonly && !isNaN(parseFloat(parsedValue))) {
|
|
32099
32104
|
onChange2(parsedValue);
|
|
32100
|
-
clearErrors(
|
|
32105
|
+
clearErrors(name);
|
|
32101
32106
|
} else {
|
|
32102
32107
|
if (required) {
|
|
32103
|
-
setError(
|
|
32108
|
+
setError(name, {
|
|
32104
32109
|
type: "required",
|
|
32105
32110
|
message: `${string} ${t3("must_required")}`
|
|
32106
32111
|
});
|
|
@@ -32215,9 +32220,11 @@ var PriorityField = (props) => {
|
|
|
32215
32220
|
onChange: onChange2,
|
|
32216
32221
|
id,
|
|
32217
32222
|
viewData,
|
|
32218
|
-
model
|
|
32223
|
+
model,
|
|
32224
|
+
name,
|
|
32225
|
+
string
|
|
32219
32226
|
} = props;
|
|
32220
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ??
|
|
32227
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? string;
|
|
32221
32228
|
const defaultPriority = parseInt(value) + 1;
|
|
32222
32229
|
if (!isForm) {
|
|
32223
32230
|
return /* @__PURE__ */ jsx103(
|
|
@@ -32261,7 +32268,7 @@ import { useEffect as useEffect25 } from "react";
|
|
|
32261
32268
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
32262
32269
|
var RadioGroupField = (props) => {
|
|
32263
32270
|
const {
|
|
32264
|
-
name
|
|
32271
|
+
name,
|
|
32265
32272
|
readonly,
|
|
32266
32273
|
required,
|
|
32267
32274
|
placeholder,
|
|
@@ -32273,14 +32280,14 @@ var RadioGroupField = (props) => {
|
|
|
32273
32280
|
} = props;
|
|
32274
32281
|
useEffect25(() => {
|
|
32275
32282
|
if (selection?.length > 0) {
|
|
32276
|
-
if (setValue) setValue(
|
|
32283
|
+
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32277
32284
|
}
|
|
32278
|
-
}, [selection,
|
|
32285
|
+
}, [selection, name, setValue]);
|
|
32279
32286
|
if (!methods) return null;
|
|
32280
32287
|
return /* @__PURE__ */ jsx104(
|
|
32281
32288
|
Controller,
|
|
32282
32289
|
{
|
|
32283
|
-
name:
|
|
32290
|
+
name: name ?? "",
|
|
32284
32291
|
control: methods.control,
|
|
32285
32292
|
render: ({ field }) => /* @__PURE__ */ jsx104("div", { className: "widget radio-group-widget flex items-center gap-[10px] pb-4", children: selection?.map((select) => /* @__PURE__ */ jsxs68("div", { className: "flex items-center gap-1", children: [
|
|
32286
32293
|
/* @__PURE__ */ jsx104(
|
|
@@ -32293,8 +32300,8 @@ var RadioGroupField = (props) => {
|
|
|
32293
32300
|
onChange: (e3) => {
|
|
32294
32301
|
if (readonly) return;
|
|
32295
32302
|
field.onChange(e3.target.value);
|
|
32296
|
-
methods.setValue(
|
|
32297
|
-
onChange2?.(
|
|
32303
|
+
methods.setValue(name, e3.target.value, { shouldDirty: true });
|
|
32304
|
+
onChange2?.(name ?? "", e3.target.value);
|
|
32298
32305
|
},
|
|
32299
32306
|
readOnly: readonly,
|
|
32300
32307
|
required: !invisible && required,
|
|
@@ -32346,7 +32353,7 @@ var SelectDropdownField = (props) => {
|
|
|
32346
32353
|
const { t: t3 } = useI18n();
|
|
32347
32354
|
const {
|
|
32348
32355
|
selection,
|
|
32349
|
-
name
|
|
32356
|
+
name,
|
|
32350
32357
|
methods,
|
|
32351
32358
|
value,
|
|
32352
32359
|
readonly,
|
|
@@ -32369,7 +32376,7 @@ var SelectDropdownField = (props) => {
|
|
|
32369
32376
|
return /* @__PURE__ */ jsx106(
|
|
32370
32377
|
Controller,
|
|
32371
32378
|
{
|
|
32372
|
-
name:
|
|
32379
|
+
name: name || "",
|
|
32373
32380
|
control: methods.control,
|
|
32374
32381
|
rules: {
|
|
32375
32382
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
@@ -32388,7 +32395,7 @@ var SelectDropdownField = (props) => {
|
|
|
32388
32395
|
menuPlacement: "auto",
|
|
32389
32396
|
onChange: (selectedOption) => {
|
|
32390
32397
|
field.onChange(selectedOption.value);
|
|
32391
|
-
onChange2 && onChange2(
|
|
32398
|
+
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
32392
32399
|
},
|
|
32393
32400
|
value: defaultValue || null,
|
|
32394
32401
|
required: !invisible && required
|
|
@@ -32469,7 +32476,7 @@ import { jsx as jsx107 } from "react/jsx-runtime";
|
|
|
32469
32476
|
var TextAreaField = (props) => {
|
|
32470
32477
|
const {
|
|
32471
32478
|
methods,
|
|
32472
|
-
name
|
|
32479
|
+
name,
|
|
32473
32480
|
readonly,
|
|
32474
32481
|
placeholder,
|
|
32475
32482
|
required,
|
|
@@ -32480,7 +32487,7 @@ var TextAreaField = (props) => {
|
|
|
32480
32487
|
onChange: onChange2,
|
|
32481
32488
|
baseClassName
|
|
32482
32489
|
} = props;
|
|
32483
|
-
const formProps = methods ? methods.register(
|
|
32490
|
+
const formProps = methods ? methods.register(name, {
|
|
32484
32491
|
onBlur: (e3) => {
|
|
32485
32492
|
const newValue = e3.target.value;
|
|
32486
32493
|
methods.setValue(e3.target.name, newValue, {
|
|
@@ -32502,7 +32509,7 @@ var TextAreaField = (props) => {
|
|
|
32502
32509
|
disabled: readonly,
|
|
32503
32510
|
placeholder,
|
|
32504
32511
|
required: !invisible && required,
|
|
32505
|
-
onChange: (e3) => onChange2 && onChange2(
|
|
32512
|
+
onChange: (e3) => onChange2 && onChange2(name ?? "", e3.target.value)
|
|
32506
32513
|
}
|
|
32507
32514
|
);
|
|
32508
32515
|
};
|
|
@@ -32511,7 +32518,7 @@ var TextAreaField = (props) => {
|
|
|
32511
32518
|
import { jsx as jsx108, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
32512
32519
|
var ToggleButtonField = (props) => {
|
|
32513
32520
|
const {
|
|
32514
|
-
name
|
|
32521
|
+
name,
|
|
32515
32522
|
readonly = false,
|
|
32516
32523
|
required = false,
|
|
32517
32524
|
invisible = false,
|
|
@@ -32521,7 +32528,7 @@ var ToggleButtonField = (props) => {
|
|
|
32521
32528
|
return /* @__PURE__ */ jsx108(
|
|
32522
32529
|
Controller,
|
|
32523
32530
|
{
|
|
32524
|
-
name:
|
|
32531
|
+
name: name ?? "",
|
|
32525
32532
|
control: methods?.control,
|
|
32526
32533
|
render: ({ field }) => /* @__PURE__ */ jsx108("div", { className: "widget toggle-widget inline-flex items-center", children: /* @__PURE__ */ jsxs71("label", { className: "relative inline-block w-8 h-5 cursor-pointer", children: [
|
|
32527
32534
|
/* @__PURE__ */ jsx108(
|
|
@@ -32531,10 +32538,10 @@ var ToggleButtonField = (props) => {
|
|
|
32531
32538
|
type: "checkbox",
|
|
32532
32539
|
onChange: (e3) => {
|
|
32533
32540
|
if (readonly) return;
|
|
32534
|
-
methods.setValue(
|
|
32541
|
+
methods.setValue(name, e3.target.checked, { shouldDirty: true });
|
|
32535
32542
|
field.onChange(e3.target.checked);
|
|
32536
32543
|
if (onChange2) {
|
|
32537
|
-
onChange2(
|
|
32544
|
+
onChange2(name ?? "", e3.target.checked);
|
|
32538
32545
|
}
|
|
32539
32546
|
},
|
|
32540
32547
|
disabled: readonly,
|
|
@@ -32581,7 +32588,7 @@ import { useEffect as useEffect26, useRef as useRef17, useState as useState22 }
|
|
|
32581
32588
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
32582
32589
|
var IntegerField = (props) => {
|
|
32583
32590
|
const {
|
|
32584
|
-
name
|
|
32591
|
+
name,
|
|
32585
32592
|
value,
|
|
32586
32593
|
readonly,
|
|
32587
32594
|
placeholder,
|
|
@@ -32603,7 +32610,7 @@ var IntegerField = (props) => {
|
|
|
32603
32610
|
return /* @__PURE__ */ jsx109(
|
|
32604
32611
|
Controller,
|
|
32605
32612
|
{
|
|
32606
|
-
name:
|
|
32613
|
+
name: name || "",
|
|
32607
32614
|
control: methods.control,
|
|
32608
32615
|
rules: {
|
|
32609
32616
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
@@ -32623,12 +32630,12 @@ var IntegerField = (props) => {
|
|
|
32623
32630
|
useEffect26(() => {
|
|
32624
32631
|
if (value2 !== void 0 && value2 !== null) {
|
|
32625
32632
|
setInputValue(String(value2));
|
|
32626
|
-
clearErrors(
|
|
32633
|
+
clearErrors(name);
|
|
32627
32634
|
}
|
|
32628
32635
|
}, [value2]);
|
|
32629
32636
|
const noticeError = () => {
|
|
32630
32637
|
if (required) {
|
|
32631
|
-
setError(
|
|
32638
|
+
setError(name, {
|
|
32632
32639
|
type: "required",
|
|
32633
32640
|
message: `${string} ${t3("must_required")}`
|
|
32634
32641
|
});
|
|
@@ -32646,7 +32653,7 @@ var IntegerField = (props) => {
|
|
|
32646
32653
|
if (!isNaN(parsed)) {
|
|
32647
32654
|
fieldOnChange(parsed);
|
|
32648
32655
|
isDirtyRef.current = true;
|
|
32649
|
-
clearErrors(
|
|
32656
|
+
clearErrors(name);
|
|
32650
32657
|
} else {
|
|
32651
32658
|
noticeError();
|
|
32652
32659
|
}
|
|
@@ -32672,11 +32679,11 @@ var IntegerField = (props) => {
|
|
|
32672
32679
|
return;
|
|
32673
32680
|
}
|
|
32674
32681
|
fieldOnChange(parsed);
|
|
32675
|
-
onChange2?.(
|
|
32682
|
+
onChange2?.(name ?? "", parsed);
|
|
32676
32683
|
lastCommittedValueRef.current = parsed;
|
|
32677
32684
|
isDirtyRef.current = false;
|
|
32678
32685
|
inputRef.current?.blur();
|
|
32679
|
-
clearErrors(
|
|
32686
|
+
clearErrors(name);
|
|
32680
32687
|
};
|
|
32681
32688
|
return /* @__PURE__ */ jsxs72(Fragment31, { children: [
|
|
32682
32689
|
/* @__PURE__ */ jsx109(
|
|
@@ -33085,7 +33092,7 @@ var Many2OneField = (props) => {
|
|
|
33085
33092
|
isForm,
|
|
33086
33093
|
isEditTable,
|
|
33087
33094
|
value: propValue,
|
|
33088
|
-
name
|
|
33095
|
+
name,
|
|
33089
33096
|
readonly,
|
|
33090
33097
|
methods,
|
|
33091
33098
|
required,
|
|
@@ -33112,7 +33119,7 @@ var Many2OneField = (props) => {
|
|
|
33112
33119
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
33113
33120
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33114
33121
|
allowShowDetail && renderDetail({
|
|
33115
|
-
idToolTip: String(
|
|
33122
|
+
idToolTip: String(name) + Number(index4),
|
|
33116
33123
|
model: options2?.model ?? relation,
|
|
33117
33124
|
context: contextObject,
|
|
33118
33125
|
idForm: id
|
|
@@ -33121,8 +33128,8 @@ var Many2OneField = (props) => {
|
|
|
33121
33128
|
"span",
|
|
33122
33129
|
{
|
|
33123
33130
|
className: "cursor-pointer",
|
|
33124
|
-
"data-tooltip-id": String(
|
|
33125
|
-
id:
|
|
33131
|
+
"data-tooltip-id": String(name) + index4,
|
|
33132
|
+
id: name,
|
|
33126
33133
|
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue?.id || propValue
|
|
33127
33134
|
}
|
|
33128
33135
|
)
|
|
@@ -33130,21 +33137,21 @@ var Many2OneField = (props) => {
|
|
|
33130
33137
|
}
|
|
33131
33138
|
return /* @__PURE__ */ jsxs75(Fragment32, { children: [
|
|
33132
33139
|
allowShowDetail && renderDetail({
|
|
33133
|
-
idToolTip: String(
|
|
33140
|
+
idToolTip: String(name),
|
|
33134
33141
|
model: options2?.model ?? relation,
|
|
33135
33142
|
context: contextObject,
|
|
33136
|
-
idForm: methods?.getValues(
|
|
33143
|
+
idForm: methods?.getValues(name)?.id || methods?.getValues(name)
|
|
33137
33144
|
}),
|
|
33138
33145
|
/* @__PURE__ */ jsx112(
|
|
33139
33146
|
"div",
|
|
33140
33147
|
{
|
|
33141
|
-
id:
|
|
33142
|
-
"data-tooltip-id":
|
|
33148
|
+
id: name,
|
|
33149
|
+
"data-tooltip-id": name,
|
|
33143
33150
|
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
33144
33151
|
children: /* @__PURE__ */ jsx112(
|
|
33145
33152
|
Controller,
|
|
33146
33153
|
{
|
|
33147
|
-
name:
|
|
33154
|
+
name: name ?? "",
|
|
33148
33155
|
control: methods?.control,
|
|
33149
33156
|
rules: {
|
|
33150
33157
|
required: required ? {
|
|
@@ -33165,7 +33172,7 @@ var Many2OneField = (props) => {
|
|
|
33165
33172
|
) ?? currentValue : currentValue ?? null;
|
|
33166
33173
|
useEffect28(() => {
|
|
33167
33174
|
if (error2 && selectedOption) {
|
|
33168
|
-
methods?.clearErrors(
|
|
33175
|
+
methods?.clearErrors(name);
|
|
33169
33176
|
}
|
|
33170
33177
|
}, [selectedOption]);
|
|
33171
33178
|
return /* @__PURE__ */ jsxs75(
|
|
@@ -33528,7 +33535,7 @@ var ICCheck = () => {
|
|
|
33528
33535
|
import { jsx as jsx115, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
33529
33536
|
var DateOptionField = (props) => {
|
|
33530
33537
|
const {
|
|
33531
|
-
name
|
|
33538
|
+
name,
|
|
33532
33539
|
readonly,
|
|
33533
33540
|
required,
|
|
33534
33541
|
invisible,
|
|
@@ -33539,7 +33546,7 @@ var DateOptionField = (props) => {
|
|
|
33539
33546
|
return /* @__PURE__ */ jsx115(
|
|
33540
33547
|
Controller,
|
|
33541
33548
|
{
|
|
33542
|
-
name:
|
|
33549
|
+
name: name ?? "",
|
|
33543
33550
|
control: methods?.control,
|
|
33544
33551
|
render: ({ field }) => /* @__PURE__ */ jsxs78(
|
|
33545
33552
|
"label",
|
|
@@ -33560,9 +33567,9 @@ var DateOptionField = (props) => {
|
|
|
33560
33567
|
onChange: (e3) => {
|
|
33561
33568
|
if (readonly) return;
|
|
33562
33569
|
const value = e3.target.checked;
|
|
33563
|
-
methods.setValue(
|
|
33570
|
+
methods.setValue(name, value, { shouldDirty: true });
|
|
33564
33571
|
field.onChange(value);
|
|
33565
|
-
onChange2?.(
|
|
33572
|
+
onChange2?.(name ?? "", value);
|
|
33566
33573
|
}
|
|
33567
33574
|
}
|
|
33568
33575
|
),
|