iglooform 3.2.2 → 3.2.4
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/.dumi/tmp/core/defineApp.ts +1 -1
- package/.dumi/tmp/core/helmet.ts +1 -1
- package/.dumi/tmp/core/history.ts +1 -1
- package/.dumi/tmp/core/historyIntelli.ts +1 -1
- package/.dumi/tmp/core/plugin.ts +2 -2
- package/.dumi/tmp/core/polyfill.ts +197 -197
- package/.dumi/tmp/core/route.tsx +33 -33
- package/.dumi/tmp/dumi/exports.ts +1 -1
- package/.dumi/tmp/dumi/locales/runtime.tsx +2 -2
- package/.dumi/tmp/dumi/meta/index.ts +33 -33
- package/.dumi/tmp/dumi/meta/runtime.ts +1 -1
- package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +2 -2
- package/.dumi/tmp/dumi/theme/builtins/API.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Badge.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Container.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Previewer.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/SourceCode.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Table.ts +1 -1
- package/.dumi/tmp/dumi/theme/builtins/Tree.ts +1 -1
- package/.dumi/tmp/dumi/theme/layouts/DocLayout.ts +1 -1
- package/.dumi/tmp/dumi/theme/loading.tsx +1 -1
- package/.dumi/tmp/dumi/theme/slots/ColorSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Content.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentFooter.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/ContentTabs.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Features.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Footer.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Header.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeaderExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Hero.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/HeroTitle.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/LangSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Logo.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Navbar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NavbarExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/NotFound.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActions.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/PreviewerActionsExtra.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/RtlSwitch.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SearchBar.ts +2 -2
- package/.dumi/tmp/dumi/theme/slots/SearchResult.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Sidebar.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/SocialIcon.ts +1 -1
- package/.dumi/tmp/dumi/theme/slots/Toc.ts +1 -1
- package/.dumi/tmp/exports.ts +5 -5
- package/.dumi/tmp/testBrowser.tsx +3 -3
- package/.dumi/tmp/umi.ts +4 -4
- package/es/date-picker/buddhist.d.ts +6 -0
- package/es/form/element/index.js +5 -3
- package/es/form/elements.d.ts +2 -1
- package/es/form/elements.js +33 -13
- package/es/free-form/element/index.js +4 -2
- package/es/hooks/useWrapperOnChangeForAutomaticCalc.d.ts +5 -0
- package/es/hooks/useWrapperOnChangeForAutomaticCalc.js +26 -0
- package/es/utils/form-utils.d.ts +1 -0
- package/es/utils/form-utils.js +31 -8
- package/lib/date-picker/buddhist.d.ts +6 -0
- package/lib/form/element/index.js +5 -3
- package/lib/form/elements.d.ts +2 -1
- package/lib/form/elements.js +32 -13
- package/lib/free-form/element/index.js +4 -2
- package/lib/hooks/useWrapperOnChangeForAutomaticCalc.d.ts +5 -0
- package/lib/hooks/useWrapperOnChangeForAutomaticCalc.js +34 -0
- package/lib/utils/form-utils.d.ts +1 -0
- package/lib/utils/form-utils.js +33 -9
- package/package.json +1 -1
- package/es/confirmation/style/index.d.ts +0 -1
- package/es/types.d.ts +0 -185
- package/lib/confirmation/style/index.d.ts +0 -1
- package/lib/types.d.ts +0 -185
package/lib/utils/form-utils.js
CHANGED
|
@@ -4,7 +4,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.testAssert = exports.getRuleValidation = exports.calcShouldRender = exports.calcSelectValue = exports.calcNamePath = exports.calcFormItemProps = exports.calcDisabled = exports.calcCopyValue = exports.calcAddableSectionAssertField = void 0;
|
|
7
|
+
exports.testAssert = exports.getRuleValidation = exports.calcShouldRender = exports.calcSelectValue = exports.calcNamePath = exports.calcFormItemProps = exports.calcDisabled = exports.calcCopyValue = exports.calcAutomaticCalculate = exports.calcAddableSectionAssertField = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
10
10
|
var _typography = _interopRequireDefault(require("../typography"));
|
|
@@ -12,7 +12,7 @@ var _formattedMessage = _interopRequireDefault(require("../locale/formatted-mess
|
|
|
12
12
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
13
13
|
var _lodash = require("lodash");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
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", "shouldRenderCode", "disabledCode"],
|
|
15
|
+
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", "shouldRenderCode", "disabledCode", "automaticCalcCode", "enableAutomaticCalc"],
|
|
16
16
|
_excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
@@ -181,6 +181,8 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
|
|
|
181
181
|
validationCode = _config$validationCod === void 0 ? [] : _config$validationCod,
|
|
182
182
|
shouldRenderCode = config.shouldRenderCode,
|
|
183
183
|
disabledCode = config.disabledCode,
|
|
184
|
+
automaticCalcCode = config.automaticCalcCode,
|
|
185
|
+
enableAutomaticCalc = config.enableAutomaticCalc,
|
|
184
186
|
rest = _objectWithoutProperties(config, _excluded);
|
|
185
187
|
(0, _invariant.default)(nameProp !== undefined || type === 'Divider' || type === 'Section' || type === 'Typography' || type === 'OCR' || !type, "name property is required for form item config (type: ".concat(type, ")"));
|
|
186
188
|
(0, _invariant.default)(!previewFormater || typeof previewFormater === 'function', 'previewFormater property should be a function');
|
|
@@ -232,7 +234,7 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
|
|
|
232
234
|
Object.keys(_objectSpread(_objectSpread({}, extraRest), rest)).forEach(function (key) {
|
|
233
235
|
elementProps[key.replace('element-', '')] = rest[key];
|
|
234
236
|
});
|
|
235
|
-
elementProps.disabled = calcDisabled(disabled, form, disabledCode, name, parentName) || copiedValue.disabled || selectedValue.disabled;
|
|
237
|
+
elementProps.disabled = enableAutomaticCalc || calcDisabled(disabled, form, disabledCode, name, parentName) || copiedValue.disabled || selectedValue.disabled;
|
|
236
238
|
if (dateLimitationType) {
|
|
237
239
|
var rangeStart;
|
|
238
240
|
var rangeEnd;
|
|
@@ -391,9 +393,9 @@ var calcDisabled = function calcDisabled(disabled, form, disabledCode, name, par
|
|
|
391
393
|
var fn = eval(disabledCode);
|
|
392
394
|
if (typeof fn === 'function') {
|
|
393
395
|
try {
|
|
394
|
-
var
|
|
396
|
+
var _value = form.getFieldValue(name);
|
|
395
397
|
var values = form.getFieldsValue(true);
|
|
396
|
-
return fn(
|
|
398
|
+
return fn(_value, values, {
|
|
397
399
|
moment: _dayjs.default,
|
|
398
400
|
get: _lodash.get
|
|
399
401
|
}, {
|
|
@@ -460,12 +462,12 @@ var calcSelectValue = function calcSelectValue(selectValue, form) {
|
|
|
460
462
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
461
463
|
var select = _step2.value;
|
|
462
464
|
var assert = select.assert,
|
|
463
|
-
|
|
465
|
+
_value2 = select.value,
|
|
464
466
|
disabled = select.disabled;
|
|
465
467
|
if (testAssert(form, assert)) {
|
|
466
468
|
return {
|
|
467
469
|
selected: true,
|
|
468
|
-
value:
|
|
470
|
+
value: _value2,
|
|
469
471
|
disabled: disabled
|
|
470
472
|
};
|
|
471
473
|
}
|
|
@@ -508,9 +510,9 @@ var calcShouldRender = function calcShouldRender(name, parentName) {
|
|
|
508
510
|
var fn = eval(shouldRenderCode);
|
|
509
511
|
if (typeof fn === 'function') {
|
|
510
512
|
try {
|
|
511
|
-
var
|
|
513
|
+
var _value3 = form.getFieldValue(name);
|
|
512
514
|
var values = form.getFieldsValue(true);
|
|
513
|
-
return fn(
|
|
515
|
+
return fn(_value3, values, {
|
|
514
516
|
moment: _dayjs.default,
|
|
515
517
|
get: _lodash.get
|
|
516
518
|
}, {
|
|
@@ -538,6 +540,28 @@ var calcShouldRender = function calcShouldRender(name, parentName) {
|
|
|
538
540
|
return true;
|
|
539
541
|
};
|
|
540
542
|
exports.calcShouldRender = calcShouldRender;
|
|
543
|
+
var calcAutomaticCalculate = function calcAutomaticCalculate(name, parentName, automaticCalcCode, form, onChange) {
|
|
544
|
+
if (!form) return undefined;
|
|
545
|
+
if (automaticCalcCode) {
|
|
546
|
+
var calcValue = undefined;
|
|
547
|
+
var fn = eval(automaticCalcCode);
|
|
548
|
+
if (typeof fn === 'function') {
|
|
549
|
+
try {
|
|
550
|
+
var _value4 = form.getFieldValue(name);
|
|
551
|
+
var values = form.getFieldsValue(true);
|
|
552
|
+
calcValue = fn(_value4, values, {
|
|
553
|
+
moment: _dayjs.default,
|
|
554
|
+
get: _lodash.get
|
|
555
|
+
}, {
|
|
556
|
+
name: name,
|
|
557
|
+
parentName: parentName
|
|
558
|
+
});
|
|
559
|
+
} catch (_unused4) {}
|
|
560
|
+
}
|
|
561
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(calcValue, true);
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
exports.calcAutomaticCalculate = calcAutomaticCalculate;
|
|
541
565
|
var getRuleValidation = /*#__PURE__*/function () {
|
|
542
566
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, rule, values) {
|
|
543
567
|
var lang,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
package/es/types.d.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/// <reference path="../typings.d.ts" />
|
|
2
|
-
import { FormItemProps, FormInstance } from 'antd/es/form';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import { NamePath } from 'rc-field-form/lib/interface';
|
|
5
|
-
import { CheckboxOptionType } from 'antd/es/checkbox';
|
|
6
|
-
import { SelectProps } from 'antd/es/select';
|
|
7
|
-
import { BlinkIdSingleSideRecognizerResult } from '@microblink/blinkid-in-browser-sdk';
|
|
8
|
-
export { Rule } from 'rc-field-form/lib/interface';
|
|
9
|
-
export interface OCRHooks {
|
|
10
|
-
microBlink?: {
|
|
11
|
-
initResult: {
|
|
12
|
-
error?: string;
|
|
13
|
-
failed: boolean;
|
|
14
|
-
};
|
|
15
|
-
recognize: ((file: File) => Promise<BlinkIdSingleSideRecognizerResult | null>) | null;
|
|
16
|
-
loading?: boolean;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface OCRConfig {
|
|
20
|
-
microBlink?: {
|
|
21
|
-
licenseKey: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export type FormItemName = NamePath;
|
|
25
|
-
export interface FormBasicConfig {
|
|
26
|
-
config: FormItemConfig;
|
|
27
|
-
className?: string;
|
|
28
|
-
style?: Object;
|
|
29
|
-
locales?: {
|
|
30
|
-
cancelText?: string;
|
|
31
|
-
submitText?: string;
|
|
32
|
-
previewText?: string;
|
|
33
|
-
nextText?: string;
|
|
34
|
-
continueText?: string;
|
|
35
|
-
validateMessages?: Object;
|
|
36
|
-
};
|
|
37
|
-
initialValues?: any;
|
|
38
|
-
form?: FormInstance;
|
|
39
|
-
onCancel?(): void;
|
|
40
|
-
onSubmit?(values: Object, allValues?: Object): any;
|
|
41
|
-
requiredMark?: boolean;
|
|
42
|
-
showSubmitButton?: boolean;
|
|
43
|
-
getScrollContainer?: () => HTMLElement | null;
|
|
44
|
-
onFirstModified?: () => any;
|
|
45
|
-
uploadApi?: string;
|
|
46
|
-
selectDatasourceApi?: string;
|
|
47
|
-
validationRule?: string;
|
|
48
|
-
getRuleValidationApi?: string;
|
|
49
|
-
stepDirection?: 'vertical' | 'horizontal';
|
|
50
|
-
customizeComponents?: {
|
|
51
|
-
[name: string]: FC;
|
|
52
|
-
};
|
|
53
|
-
ocr?: OCRConfig;
|
|
54
|
-
validationCodeExtraParams?: Record<string, any>;
|
|
55
|
-
}
|
|
56
|
-
export type FormItemAssert = {
|
|
57
|
-
field: NamePath;
|
|
58
|
-
value?: any;
|
|
59
|
-
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
|
|
60
|
-
};
|
|
61
|
-
export type FormItemCopyValue = {
|
|
62
|
-
assert: FormItemAssert;
|
|
63
|
-
copyFrom: NamePath;
|
|
64
|
-
disabled?: boolean;
|
|
65
|
-
};
|
|
66
|
-
export type FormItemSelectValue = {
|
|
67
|
-
assert: FormItemAssert;
|
|
68
|
-
value: any;
|
|
69
|
-
disabled?: boolean;
|
|
70
|
-
};
|
|
71
|
-
export interface FormItemExtraConfig extends FormItemProps {
|
|
72
|
-
elements?: FormItemConfig[];
|
|
73
|
-
required?: boolean;
|
|
74
|
-
requiredAsserts?: FormItemAssert[];
|
|
75
|
-
extraLabel?: any;
|
|
76
|
-
xl?: number;
|
|
77
|
-
md?: number;
|
|
78
|
-
xs?: number;
|
|
79
|
-
span?: number;
|
|
80
|
-
areaCode?: number | string | (number | string)[];
|
|
81
|
-
phoneNumber?: number | string;
|
|
82
|
-
mergeRules?: boolean;
|
|
83
|
-
dependencies?: NamePath[];
|
|
84
|
-
antdDependencies?: NamePath[];
|
|
85
|
-
asserts?: FormItemAssert[];
|
|
86
|
-
shouldRender?: (form?: FormInstance) => boolean;
|
|
87
|
-
ignore?: boolean;
|
|
88
|
-
copyValue?: FormItemCopyValue;
|
|
89
|
-
selectValue?: FormItemSelectValue[];
|
|
90
|
-
disabled?: boolean | FormItemAssert | FormItemAssert[];
|
|
91
|
-
halfRow?: boolean;
|
|
92
|
-
fullRow?: boolean;
|
|
93
|
-
limit?: number;
|
|
94
|
-
hideWhenPreview?: boolean;
|
|
95
|
-
hideWhenEdit?: boolean;
|
|
96
|
-
requiredMessage?: string | ReactNode;
|
|
97
|
-
showOptional?: boolean;
|
|
98
|
-
previewFormater?(value: any, form?: FormInstance): any;
|
|
99
|
-
handleNext?(values: any): any;
|
|
100
|
-
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
101
|
-
locales?: {
|
|
102
|
-
[key: string]: string;
|
|
103
|
-
};
|
|
104
|
-
options?: (CheckboxOptionType & {
|
|
105
|
-
extraInfo?: {
|
|
106
|
-
content: any;
|
|
107
|
-
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
108
|
-
};
|
|
109
|
-
})[] | SelectProps['options'];
|
|
110
|
-
sendOtp?: (value: any) => any;
|
|
111
|
-
dependField?: FormItemName;
|
|
112
|
-
countDownSeconds?: number;
|
|
113
|
-
getButtonDisabledState?: (form: FormInstance) => boolean;
|
|
114
|
-
getPreviousDisabledState?: (form: FormInstance) => boolean;
|
|
115
|
-
handleUpload?(file: File): PromiseLike<string>;
|
|
116
|
-
withoutForm?: boolean;
|
|
117
|
-
disableEditButton?: boolean;
|
|
118
|
-
hidePreviewDivider?: boolean;
|
|
119
|
-
valueFormater?: (value: any) => any;
|
|
120
|
-
currentStep?: number;
|
|
121
|
-
subscribedFields?: FormItemName[];
|
|
122
|
-
description?: string | React.ReactNode;
|
|
123
|
-
dateLimitationType?: 'relative' | 'absolute';
|
|
124
|
-
absoluteRangeStart?: number;
|
|
125
|
-
absoluteRangeEnd?: number;
|
|
126
|
-
relativeRangeStart?: {
|
|
127
|
-
type: 'day' | 'month' | 'year';
|
|
128
|
-
quantity: number;
|
|
129
|
-
pattern?: string;
|
|
130
|
-
dependField?: NamePath;
|
|
131
|
-
};
|
|
132
|
-
relativeRangeEnd?: {
|
|
133
|
-
type: 'day' | 'month' | 'year';
|
|
134
|
-
quantity: number;
|
|
135
|
-
pattern?: string;
|
|
136
|
-
dependField?: NamePath;
|
|
137
|
-
};
|
|
138
|
-
validationCode?: {
|
|
139
|
-
code: string;
|
|
140
|
-
errorMessage: string;
|
|
141
|
-
warningOnly?: boolean;
|
|
142
|
-
}[];
|
|
143
|
-
length?: number;
|
|
144
|
-
minLength?: number;
|
|
145
|
-
maxLength?: number;
|
|
146
|
-
idType?: 'KTP' | 'NIK';
|
|
147
|
-
validationRule?: string;
|
|
148
|
-
shouldRenderCode?: string;
|
|
149
|
-
disabledCode?: string;
|
|
150
|
-
[key: string]: any;
|
|
151
|
-
}
|
|
152
|
-
export interface FormItemConfig extends FormItemExtraConfig {
|
|
153
|
-
type?: string;
|
|
154
|
-
name?: NamePath;
|
|
155
|
-
label?: string | React.ReactNode;
|
|
156
|
-
previewLabel?: string | React.ReactNode;
|
|
157
|
-
labelProps?: any;
|
|
158
|
-
contentProps?: any;
|
|
159
|
-
ocr?: {
|
|
160
|
-
vender: string;
|
|
161
|
-
outputMap: {
|
|
162
|
-
field: string[];
|
|
163
|
-
source: string[];
|
|
164
|
-
}[];
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
|
|
168
|
-
export interface FC<P = {}> extends React.FunctionComponent<P> {
|
|
169
|
-
formItemPropsHandler?: FormItemPropsHandler;
|
|
170
|
-
isPreviewSupport?: boolean;
|
|
171
|
-
}
|
|
172
|
-
export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
|
|
173
|
-
useForm: () => FormInstance;
|
|
174
|
-
}
|
|
175
|
-
export interface IglooComponentProps {
|
|
176
|
-
validateField?: (nameList?: NamePath[]) => Promise<any>;
|
|
177
|
-
containerRef?: React.RefObject<any>;
|
|
178
|
-
setFieldError?(errorMsg?: string): void;
|
|
179
|
-
setFieldValue?(value?: any): void;
|
|
180
|
-
setShowStepButton?: (showButton: boolean) => void;
|
|
181
|
-
getFormInstance?: () => FormInstance;
|
|
182
|
-
locales?: {
|
|
183
|
-
[key: string]: string;
|
|
184
|
-
};
|
|
185
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
package/lib/types.d.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/// <reference path="../typings.d.ts" />
|
|
2
|
-
import { FormItemProps, FormInstance } from 'antd/es/form';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import { NamePath } from 'rc-field-form/lib/interface';
|
|
5
|
-
import { CheckboxOptionType } from 'antd/es/checkbox';
|
|
6
|
-
import { SelectProps } from 'antd/es/select';
|
|
7
|
-
import { BlinkIdSingleSideRecognizerResult } from '@microblink/blinkid-in-browser-sdk';
|
|
8
|
-
export { Rule } from 'rc-field-form/lib/interface';
|
|
9
|
-
export interface OCRHooks {
|
|
10
|
-
microBlink?: {
|
|
11
|
-
initResult: {
|
|
12
|
-
error?: string;
|
|
13
|
-
failed: boolean;
|
|
14
|
-
};
|
|
15
|
-
recognize: ((file: File) => Promise<BlinkIdSingleSideRecognizerResult | null>) | null;
|
|
16
|
-
loading?: boolean;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface OCRConfig {
|
|
20
|
-
microBlink?: {
|
|
21
|
-
licenseKey: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export type FormItemName = NamePath;
|
|
25
|
-
export interface FormBasicConfig {
|
|
26
|
-
config: FormItemConfig;
|
|
27
|
-
className?: string;
|
|
28
|
-
style?: Object;
|
|
29
|
-
locales?: {
|
|
30
|
-
cancelText?: string;
|
|
31
|
-
submitText?: string;
|
|
32
|
-
previewText?: string;
|
|
33
|
-
nextText?: string;
|
|
34
|
-
continueText?: string;
|
|
35
|
-
validateMessages?: Object;
|
|
36
|
-
};
|
|
37
|
-
initialValues?: any;
|
|
38
|
-
form?: FormInstance;
|
|
39
|
-
onCancel?(): void;
|
|
40
|
-
onSubmit?(values: Object, allValues?: Object): any;
|
|
41
|
-
requiredMark?: boolean;
|
|
42
|
-
showSubmitButton?: boolean;
|
|
43
|
-
getScrollContainer?: () => HTMLElement | null;
|
|
44
|
-
onFirstModified?: () => any;
|
|
45
|
-
uploadApi?: string;
|
|
46
|
-
selectDatasourceApi?: string;
|
|
47
|
-
validationRule?: string;
|
|
48
|
-
getRuleValidationApi?: string;
|
|
49
|
-
stepDirection?: 'vertical' | 'horizontal';
|
|
50
|
-
customizeComponents?: {
|
|
51
|
-
[name: string]: FC;
|
|
52
|
-
};
|
|
53
|
-
ocr?: OCRConfig;
|
|
54
|
-
validationCodeExtraParams?: Record<string, any>;
|
|
55
|
-
}
|
|
56
|
-
export type FormItemAssert = {
|
|
57
|
-
field: NamePath;
|
|
58
|
-
value?: any;
|
|
59
|
-
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
|
|
60
|
-
};
|
|
61
|
-
export type FormItemCopyValue = {
|
|
62
|
-
assert: FormItemAssert;
|
|
63
|
-
copyFrom: NamePath;
|
|
64
|
-
disabled?: boolean;
|
|
65
|
-
};
|
|
66
|
-
export type FormItemSelectValue = {
|
|
67
|
-
assert: FormItemAssert;
|
|
68
|
-
value: any;
|
|
69
|
-
disabled?: boolean;
|
|
70
|
-
};
|
|
71
|
-
export interface FormItemExtraConfig extends FormItemProps {
|
|
72
|
-
elements?: FormItemConfig[];
|
|
73
|
-
required?: boolean;
|
|
74
|
-
requiredAsserts?: FormItemAssert[];
|
|
75
|
-
extraLabel?: any;
|
|
76
|
-
xl?: number;
|
|
77
|
-
md?: number;
|
|
78
|
-
xs?: number;
|
|
79
|
-
span?: number;
|
|
80
|
-
areaCode?: number | string | (number | string)[];
|
|
81
|
-
phoneNumber?: number | string;
|
|
82
|
-
mergeRules?: boolean;
|
|
83
|
-
dependencies?: NamePath[];
|
|
84
|
-
antdDependencies?: NamePath[];
|
|
85
|
-
asserts?: FormItemAssert[];
|
|
86
|
-
shouldRender?: (form?: FormInstance) => boolean;
|
|
87
|
-
ignore?: boolean;
|
|
88
|
-
copyValue?: FormItemCopyValue;
|
|
89
|
-
selectValue?: FormItemSelectValue[];
|
|
90
|
-
disabled?: boolean | FormItemAssert | FormItemAssert[];
|
|
91
|
-
halfRow?: boolean;
|
|
92
|
-
fullRow?: boolean;
|
|
93
|
-
limit?: number;
|
|
94
|
-
hideWhenPreview?: boolean;
|
|
95
|
-
hideWhenEdit?: boolean;
|
|
96
|
-
requiredMessage?: string | ReactNode;
|
|
97
|
-
showOptional?: boolean;
|
|
98
|
-
previewFormater?(value: any, form?: FormInstance): any;
|
|
99
|
-
handleNext?(values: any): any;
|
|
100
|
-
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
101
|
-
locales?: {
|
|
102
|
-
[key: string]: string;
|
|
103
|
-
};
|
|
104
|
-
options?: (CheckboxOptionType & {
|
|
105
|
-
extraInfo?: {
|
|
106
|
-
content: any;
|
|
107
|
-
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
108
|
-
};
|
|
109
|
-
})[] | SelectProps['options'];
|
|
110
|
-
sendOtp?: (value: any) => any;
|
|
111
|
-
dependField?: FormItemName;
|
|
112
|
-
countDownSeconds?: number;
|
|
113
|
-
getButtonDisabledState?: (form: FormInstance) => boolean;
|
|
114
|
-
getPreviousDisabledState?: (form: FormInstance) => boolean;
|
|
115
|
-
handleUpload?(file: File): PromiseLike<string>;
|
|
116
|
-
withoutForm?: boolean;
|
|
117
|
-
disableEditButton?: boolean;
|
|
118
|
-
hidePreviewDivider?: boolean;
|
|
119
|
-
valueFormater?: (value: any) => any;
|
|
120
|
-
currentStep?: number;
|
|
121
|
-
subscribedFields?: FormItemName[];
|
|
122
|
-
description?: string | React.ReactNode;
|
|
123
|
-
dateLimitationType?: 'relative' | 'absolute';
|
|
124
|
-
absoluteRangeStart?: number;
|
|
125
|
-
absoluteRangeEnd?: number;
|
|
126
|
-
relativeRangeStart?: {
|
|
127
|
-
type: 'day' | 'month' | 'year';
|
|
128
|
-
quantity: number;
|
|
129
|
-
pattern?: string;
|
|
130
|
-
dependField?: NamePath;
|
|
131
|
-
};
|
|
132
|
-
relativeRangeEnd?: {
|
|
133
|
-
type: 'day' | 'month' | 'year';
|
|
134
|
-
quantity: number;
|
|
135
|
-
pattern?: string;
|
|
136
|
-
dependField?: NamePath;
|
|
137
|
-
};
|
|
138
|
-
validationCode?: {
|
|
139
|
-
code: string;
|
|
140
|
-
errorMessage: string;
|
|
141
|
-
warningOnly?: boolean;
|
|
142
|
-
}[];
|
|
143
|
-
length?: number;
|
|
144
|
-
minLength?: number;
|
|
145
|
-
maxLength?: number;
|
|
146
|
-
idType?: 'KTP' | 'NIK';
|
|
147
|
-
validationRule?: string;
|
|
148
|
-
shouldRenderCode?: string;
|
|
149
|
-
disabledCode?: string;
|
|
150
|
-
[key: string]: any;
|
|
151
|
-
}
|
|
152
|
-
export interface FormItemConfig extends FormItemExtraConfig {
|
|
153
|
-
type?: string;
|
|
154
|
-
name?: NamePath;
|
|
155
|
-
label?: string | React.ReactNode;
|
|
156
|
-
previewLabel?: string | React.ReactNode;
|
|
157
|
-
labelProps?: any;
|
|
158
|
-
contentProps?: any;
|
|
159
|
-
ocr?: {
|
|
160
|
-
vender: string;
|
|
161
|
-
outputMap: {
|
|
162
|
-
field: string[];
|
|
163
|
-
source: string[];
|
|
164
|
-
}[];
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
export type FormItemPropsHandler = (config: FormItemConfig) => FormItemConfig;
|
|
168
|
-
export interface FC<P = {}> extends React.FunctionComponent<P> {
|
|
169
|
-
formItemPropsHandler?: FormItemPropsHandler;
|
|
170
|
-
isPreviewSupport?: boolean;
|
|
171
|
-
}
|
|
172
|
-
export interface Form extends React.ForwardRefExoticComponent<FormBasicConfig & React.RefAttributes<any>> {
|
|
173
|
-
useForm: () => FormInstance;
|
|
174
|
-
}
|
|
175
|
-
export interface IglooComponentProps {
|
|
176
|
-
validateField?: (nameList?: NamePath[]) => Promise<any>;
|
|
177
|
-
containerRef?: React.RefObject<any>;
|
|
178
|
-
setFieldError?(errorMsg?: string): void;
|
|
179
|
-
setFieldValue?(value?: any): void;
|
|
180
|
-
setShowStepButton?: (showButton: boolean) => void;
|
|
181
|
-
getFormInstance?: () => FormInstance;
|
|
182
|
-
locales?: {
|
|
183
|
-
[key: string]: string;
|
|
184
|
-
};
|
|
185
|
-
}
|