iglooform 2.5.44 → 2.5.46
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/es/form/element/index.js +16 -2
- package/es/form/element/style/index.less +8 -0
- package/es/form/hsteps/index.js +61 -26
- package/es/form/index.js +56 -11
- package/es/form/steps/index.js +62 -24
- package/es/form-context.d.ts +1 -0
- package/es/free-form/element/index.js +16 -2
- package/es/free-form/element/style/index.less +8 -0
- package/es/free-form/index.js +62 -13
- package/es/free-form/step/index.d.ts +1 -0
- package/es/free-form/step/index.js +60 -23
- package/es/types.d.ts +3 -0
- package/es/utils/form-utils.d.ts +1 -0
- package/es/utils/form-utils.js +75 -3
- package/lib/form/element/index.js +17 -2
- package/lib/form/element/style/index.less +8 -0
- package/lib/form/hsteps/index.js +60 -25
- package/lib/form/index.js +57 -10
- package/lib/form/steps/index.js +62 -23
- package/lib/form-context.d.ts +1 -0
- package/lib/free-form/element/index.js +17 -2
- package/lib/free-form/element/style/index.less +8 -0
- package/lib/free-form/index.js +64 -12
- package/lib/free-form/step/index.d.ts +1 -0
- package/lib/free-form/step/index.js +60 -22
- package/lib/types.d.ts +3 -0
- package/lib/utils/form-utils.d.ts +1 -0
- package/lib/utils/form-utils.js +79 -4
- package/package.json +1 -1
package/lib/utils/form-utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.testAssert = exports.calcShouldRender = exports.calcSelectValue = exports.calcNamePath = exports.calcFormItemProps = exports.calcDisabled = exports.calcCopyValue = void 0;
|
|
6
|
+
exports.testAssert = exports.getRuleValidation = exports.calcShouldRender = exports.calcSelectValue = exports.calcNamePath = exports.calcFormItemProps = exports.calcDisabled = exports.calcCopyValue = void 0;
|
|
7
7
|
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
|
|
@@ -15,11 +15,15 @@ var _formattedMessage = _interopRequireDefault(require("../locale/formatted-mess
|
|
|
15
15
|
|
|
16
16
|
var _moment = _interopRequireDefault(require("moment"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["type", "name", "required", "requiredAsserts", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater", "antdDependencies", "dateLimitationType", "absoluteRangeEnd", "absoluteRangeStart", "relativeRangeStart", "relativeRangeEnd", "
|
|
18
|
+
var _excluded = ["type", "name", "required", "requiredAsserts", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater", "antdDependencies", "dateLimitationType", "absoluteRangeEnd", "absoluteRangeStart", "relativeRangeStart", "relativeRangeEnd", "validationCode"],
|
|
19
19
|
_excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
|
|
20
20
|
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
|
|
23
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
24
|
+
|
|
25
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
26
|
+
|
|
23
27
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
24
28
|
|
|
25
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -176,7 +180,6 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
|
|
|
176
180
|
absoluteRangeStart = config.absoluteRangeStart,
|
|
177
181
|
relativeRangeStart = config.relativeRangeStart,
|
|
178
182
|
relativeRangeEnd = config.relativeRangeEnd,
|
|
179
|
-
dependField = config.dependField,
|
|
180
183
|
_config$validationCod = config.validationCode,
|
|
181
184
|
validationCode = _config$validationCod === void 0 ? [] : _config$validationCod,
|
|
182
185
|
rest = _objectWithoutProperties(config, _excluded);
|
|
@@ -544,4 +547,76 @@ var calcShouldRender = function calcShouldRender() {
|
|
|
544
547
|
return true;
|
|
545
548
|
};
|
|
546
549
|
|
|
547
|
-
exports.calcShouldRender = calcShouldRender;
|
|
550
|
+
exports.calcShouldRender = calcShouldRender;
|
|
551
|
+
|
|
552
|
+
var getRuleValidation = /*#__PURE__*/function () {
|
|
553
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, rule, values, lang) {
|
|
554
|
+
var _lang, _lang$split;
|
|
555
|
+
|
|
556
|
+
var res, json, _ref4, conclusion, details;
|
|
557
|
+
|
|
558
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
559
|
+
while (1) {
|
|
560
|
+
switch (_context.prev = _context.next) {
|
|
561
|
+
case 0:
|
|
562
|
+
lang = ((_lang = lang) === null || _lang === void 0 ? void 0 : (_lang$split = _lang.split('-')) === null || _lang$split === void 0 ? void 0 : _lang$split[0]) || 'en';
|
|
563
|
+
_context.next = 3;
|
|
564
|
+
return fetch("".concat(url, "?lang=").concat(lang), {
|
|
565
|
+
method: 'post',
|
|
566
|
+
headers: {
|
|
567
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
568
|
+
},
|
|
569
|
+
body: JSON.stringify({
|
|
570
|
+
form: values || {},
|
|
571
|
+
rules: Array.isArray(rule) ? rule : [rule]
|
|
572
|
+
})
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
case 3:
|
|
576
|
+
res = _context.sent;
|
|
577
|
+
_context.next = 6;
|
|
578
|
+
return res.json();
|
|
579
|
+
|
|
580
|
+
case 6:
|
|
581
|
+
json = _context.sent;
|
|
582
|
+
_ref4 = json || {}, conclusion = _ref4.conclusion, details = _ref4.details;
|
|
583
|
+
|
|
584
|
+
if (!conclusion) {
|
|
585
|
+
_context.next = 10;
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return _context.abrupt("return");
|
|
590
|
+
|
|
591
|
+
case 10:
|
|
592
|
+
if (!(conclusion === false)) {
|
|
593
|
+
_context.next = 12;
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
return _context.abrupt("return", details === null || details === void 0 ? void 0 : details.map(function (_ref5) {
|
|
598
|
+
var err_message = _ref5.err_message,
|
|
599
|
+
path = _ref5.path;
|
|
600
|
+
return {
|
|
601
|
+
name: path.split('.'),
|
|
602
|
+
errors: [err_message]
|
|
603
|
+
};
|
|
604
|
+
}));
|
|
605
|
+
|
|
606
|
+
case 12:
|
|
607
|
+
return _context.abrupt("return", Promise.reject(json.message));
|
|
608
|
+
|
|
609
|
+
case 13:
|
|
610
|
+
case "end":
|
|
611
|
+
return _context.stop();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}, _callee);
|
|
615
|
+
}));
|
|
616
|
+
|
|
617
|
+
return function getRuleValidation(_x, _x2, _x3, _x4) {
|
|
618
|
+
return _ref3.apply(this, arguments);
|
|
619
|
+
};
|
|
620
|
+
}();
|
|
621
|
+
|
|
622
|
+
exports.getRuleValidation = getRuleValidation;
|