amis-core 2.9.0 → 3.1.0
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/esm/Root.d.ts +89 -4
- package/esm/Root.js +15 -4
- package/esm/RootRenderer.d.ts +3 -1
- package/esm/RootRenderer.js +9 -3
- package/esm/SchemaRenderer.d.ts +4 -2
- package/esm/SchemaRenderer.js +32 -24
- package/esm/Scoped.d.ts +8 -0
- package/esm/Scoped.js +20 -5
- package/esm/StatusScoped.d.ts +58 -0
- package/esm/StatusScoped.js +54 -0
- package/esm/WithRootStore.d.ts +2 -2
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +6 -2
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +19 -5
- package/esm/actions/AjaxAction.js +1 -1
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +8 -7
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +4 -4
- package/esm/actions/DialogAction.d.ts +16 -2
- package/esm/actions/DialogAction.js +23 -7
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.d.ts +13 -0
- package/esm/components/CustomStyle.js +18 -0
- package/esm/components/LazyComponent.d.ts +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +3 -3
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.d.ts +2 -2
- package/esm/components/PopOver.js +1 -1
- package/esm/env.d.ts +10 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -5
- package/esm/factory.d.ts +5 -3
- package/esm/factory.js +3 -3
- package/esm/index.d.ts +11 -4
- package/esm/index.js +55 -33
- package/esm/locale.d.ts +2 -2
- package/esm/locale.js +10 -3
- package/esm/renderers/Form.d.ts +3 -2
- package/esm/renderers/Form.js +216 -180
- package/esm/renderers/Item.d.ts +55 -41
- package/esm/renderers/Item.js +30 -19
- package/esm/renderers/Options.js +11 -4
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/register.js +1 -1
- package/esm/renderers/wrapControl.d.ts +2 -2
- package/esm/renderers/wrapControl.js +13 -16
- package/esm/store/app.d.ts +1 -0
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +3 -0
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +2 -0
- package/esm/store/crud.js +31 -9
- package/esm/store/form.d.ts +1 -0
- package/esm/store/form.js +10 -4
- package/esm/store/formItem.js +2 -2
- package/esm/store/iRenderer.d.ts +1 -0
- package/esm/store/iRenderer.js +54 -13
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -0
- package/esm/store/list.js +7 -3
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +1 -0
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +1 -0
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.d.ts +4 -6
- package/esm/store/root.js +53 -24
- package/esm/store/service.d.ts +1 -0
- package/esm/store/service.js +1 -1
- package/esm/store/status.d.ts +12 -0
- package/esm/store/status.js +38 -0
- package/esm/store/table.d.ts +28 -23
- package/esm/store/table.js +26 -5
- package/esm/store/table2.d.ts +7 -6
- package/esm/store/table2.js +27 -23
- package/esm/theme.d.ts +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +7 -1
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.js +1 -1
- package/esm/utils/DataScope.d.ts +3 -5
- package/esm/utils/DataScope.js +88 -31
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +14 -5
- package/esm/utils/attachmentAdpator.js +2 -2
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.d.ts +7 -0
- package/esm/utils/date.js +34 -2
- package/esm/utils/debug.js +4 -4
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +3 -0
- package/esm/utils/dom.js +47 -10
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.js +2 -2
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +3 -3
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +9 -2
- package/esm/utils/helper.js +52 -20
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +6 -1
- package/esm/utils/icon.js +6 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/isPureVariable.js +3 -3
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/memoryParse.d.ts +17 -0
- package/esm/utils/memoryParse.js +26 -0
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +4 -2
- package/esm/utils/object.d.ts +2 -0
- package/esm/utils/object.js +27 -2
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +35 -32
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.d.ts +1 -0
- package/esm/utils/resolveCondition.js +19 -4
- package/esm/utils/resolveVariable.js +4 -3
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +23 -5
- package/esm/utils/scrollPosition.js +1 -1
- package/esm/utils/string2regExp.js +1 -1
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style-helper.d.ts +12 -4
- package/esm/utils/style-helper.js +96 -19
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.d.ts +2 -1
- package/esm/utils/tpl-builtin.js +19 -2
- package/esm/utils/tpl-lodash.js +3 -2
- package/esm/utils/tpl.d.ts +2 -0
- package/esm/utils/tpl.js +24 -2
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.d.ts +4 -1
- package/esm/utils/validations.js +27 -12
- package/lib/Root.d.ts +89 -4
- package/lib/Root.js +15 -4
- package/lib/RootRenderer.d.ts +3 -1
- package/lib/RootRenderer.js +8 -2
- package/lib/SchemaRenderer.d.ts +4 -2
- package/lib/SchemaRenderer.js +32 -23
- package/lib/Scoped.d.ts +8 -0
- package/lib/Scoped.js +20 -4
- package/lib/StatusScoped.d.ts +58 -0
- package/lib/StatusScoped.js +63 -0
- package/lib/WithRootStore.d.ts +2 -2
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +6 -2
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +19 -5
- package/lib/actions/AjaxAction.js +1 -1
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +8 -7
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +4 -4
- package/lib/actions/DialogAction.d.ts +16 -2
- package/lib/actions/DialogAction.js +23 -7
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.d.ts +13 -0
- package/lib/components/CustomStyle.js +22 -0
- package/lib/components/LazyComponent.d.ts +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +3 -3
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.d.ts +2 -2
- package/lib/components/PopOver.js +1 -1
- package/lib/env.d.ts +10 -2
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -5
- package/lib/factory.d.ts +5 -3
- package/lib/factory.js +3 -3
- package/lib/index.d.ts +11 -4
- package/lib/index.js +61 -23
- package/lib/locale.d.ts +2 -2
- package/lib/locale.js +10 -3
- package/lib/renderers/Form.d.ts +3 -2
- package/lib/renderers/Form.js +215 -179
- package/lib/renderers/Item.d.ts +55 -41
- package/lib/renderers/Item.js +30 -19
- package/lib/renderers/Options.js +11 -4
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/register.js +1 -1
- package/lib/renderers/wrapControl.d.ts +2 -2
- package/lib/renderers/wrapControl.js +12 -15
- package/lib/store/app.d.ts +1 -0
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +3 -0
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +2 -0
- package/lib/store/crud.js +31 -9
- package/lib/store/form.d.ts +1 -0
- package/lib/store/form.js +10 -4
- package/lib/store/formItem.js +2 -2
- package/lib/store/iRenderer.d.ts +1 -0
- package/lib/store/iRenderer.js +53 -12
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -0
- package/lib/store/list.js +7 -3
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +1 -0
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +1 -0
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.d.ts +4 -6
- package/lib/store/root.js +52 -23
- package/lib/store/service.d.ts +1 -0
- package/lib/store/service.js +1 -1
- package/lib/store/status.d.ts +12 -0
- package/lib/store/status.js +42 -0
- package/lib/store/table.d.ts +28 -23
- package/lib/store/table.js +26 -5
- package/lib/store/table2.d.ts +7 -6
- package/lib/store/table2.js +27 -23
- package/lib/theme.d.ts +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +7 -1
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.js +1 -1
- package/lib/utils/DataScope.d.ts +3 -5
- package/lib/utils/DataScope.js +86 -29
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +13 -4
- package/lib/utils/attachmentAdpator.js +2 -2
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.d.ts +7 -0
- package/lib/utils/date.js +34 -1
- package/lib/utils/debug.js +4 -4
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +3 -0
- package/lib/utils/dom.js +48 -9
- package/lib/utils/errors.js +1 -1
- package/lib/utils/escapeHtml.js +1 -1
- package/lib/utils/filter-schema.js +1 -1
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.js +2 -2
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +3 -3
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +9 -2
- package/lib/utils/helper.js +53 -19
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.d.ts +6 -1
- package/lib/utils/icon.js +6 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/isPureVariable.js +3 -3
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/memoryParse.d.ts +17 -0
- package/lib/utils/memoryParse.js +30 -0
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +4 -2
- package/lib/utils/object.d.ts +2 -0
- package/lib/utils/object.js +28 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +35 -32
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.d.ts +1 -0
- package/lib/utils/resolveCondition.js +19 -3
- package/lib/utils/resolveVariable.js +3 -2
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +22 -3
- package/lib/utils/scrollPosition.js +1 -1
- package/lib/utils/string2regExp.js +1 -1
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style-helper.d.ts +12 -4
- package/lib/utils/style-helper.js +101 -18
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.d.ts +2 -1
- package/lib/utils/tpl-builtin.js +19 -2
- package/lib/utils/tpl-lodash.js +3 -2
- package/lib/utils/tpl.d.ts +2 -0
- package/lib/utils/tpl.js +24 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.d.ts +4 -1
- package/lib/utils/validations.js +27 -12
- package/package.json +3 -3
package/lib/utils/validations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -358,12 +358,16 @@ var validateMessages = {
|
|
|
358
358
|
isVariableName: 'validate.isVariableName'
|
|
359
359
|
};
|
|
360
360
|
function validate(value, values, rules, messages, __) {
|
|
361
|
+
var _a;
|
|
361
362
|
if (__ === void 0) { __ = function (str) { return str; }; }
|
|
362
363
|
var errors = [];
|
|
363
|
-
rules
|
|
364
|
-
Object.keys(rules)
|
|
364
|
+
if (rules) {
|
|
365
|
+
var ruleNames = Object.keys(rules);
|
|
366
|
+
var length_1 = ruleNames.length;
|
|
367
|
+
for (var index = 0; index < length_1; index++) {
|
|
368
|
+
var ruleName = ruleNames[index];
|
|
365
369
|
if (!rules[ruleName] && rules[ruleName] !== 0) {
|
|
366
|
-
|
|
370
|
+
continue;
|
|
367
371
|
}
|
|
368
372
|
else if (typeof validations[ruleName] !== 'function') {
|
|
369
373
|
throw new Error('Validation `' + ruleName + '` not exists!');
|
|
@@ -375,19 +379,30 @@ function validate(value, values, rules, messages, __) {
|
|
|
375
379
|
}
|
|
376
380
|
return item;
|
|
377
381
|
});
|
|
378
|
-
|
|
382
|
+
var validateRes = fn.apply(void 0, tslib.__spreadArray([values, value], tslib.__read(args), false));
|
|
383
|
+
// addRule 允许返回
|
|
384
|
+
// {error: true, msg: '错误提示'}
|
|
385
|
+
// 格式的信息来灵活展示错误
|
|
386
|
+
var fnResErrorMsg = '';
|
|
387
|
+
if (typeof validateRes === 'object' &&
|
|
388
|
+
validateRes.error === true) {
|
|
389
|
+
fnResErrorMsg = (_a = validateRes === null || validateRes === void 0 ? void 0 : validateRes.msg) !== null && _a !== void 0 ? _a : '';
|
|
390
|
+
}
|
|
391
|
+
if (!validateRes || fnResErrorMsg) {
|
|
379
392
|
var msgRuleName = ruleName;
|
|
380
393
|
if (Array.isArray(value)) {
|
|
381
394
|
msgRuleName = "".concat(ruleName, "Array");
|
|
382
395
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
396
|
+
return [{
|
|
397
|
+
rule: ruleName,
|
|
398
|
+
msg: tpl.filter(__((messages && messages[ruleName]) ||
|
|
399
|
+
fnResErrorMsg ||
|
|
400
|
+
validateMessages[msgRuleName] ||
|
|
401
|
+
validateMessages[ruleName]), tslib.__assign({}, [''].concat(args)))
|
|
402
|
+
}];
|
|
389
403
|
}
|
|
390
|
-
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
391
406
|
return errors;
|
|
392
407
|
}
|
|
393
408
|
function validateObject(values, rules, messages, __) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amis-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "amis-core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"esm"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"amis-formula": "^
|
|
48
|
+
"amis-formula": "^3.1.0",
|
|
49
49
|
"classnames": "2.3.1",
|
|
50
50
|
"file-saver": "^2.0.2",
|
|
51
51
|
"hoist-non-react-statics": "^3.3.2",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"/.rollup.cache/"
|
|
102
102
|
]
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "020b12d0be43215664e0c0e53cd33486c43fde86"
|
|
105
105
|
}
|