amis-core 2.9.0 → 3.0.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.js +1 -1
- package/esm/RootRenderer.js +1 -1
- package/esm/SchemaRenderer.d.ts +1 -0
- package/esm/SchemaRenderer.js +7 -5
- package/esm/Scoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.js +8 -2
- 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 +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +1 -1
- package/esm/actions/DialogAction.js +5 -1
- 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/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +2 -2
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.js +1 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +2 -1
- package/esm/factory.js +3 -3
- package/esm/index.d.ts +8 -3
- package/esm/index.js +10 -9
- package/esm/locale.js +1 -1
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +1 -1
- package/esm/renderers/Item.js +10 -7
- package/esm/renderers/Options.js +3 -3
- 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.js +1 -1
- package/esm/store/app.js +1 -1
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +22 -8
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.js +2 -2
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.js +1 -1
- package/esm/store/service.js +1 -1
- package/esm/store/table.d.ts +24 -23
- package/esm/store/table.js +17 -4
- package/esm/store/table2.d.ts +5 -5
- package/esm/store/table2.js +23 -19
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +6 -0
- 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.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +9 -2
- package/esm/utils/attachmentAdpator.js +1 -1
- 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.js +1 -1
- package/esm/utils/debug.js +4 -4
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +2 -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 +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +7 -0
- package/esm/utils/helper.js +28 -3
- 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 +1 -1
- 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/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.js +1 -1
- 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 +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +20 -3
- 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 +9 -4
- package/esm/utils/style-helper.js +81 -16
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +34 -3
- package/esm/utils/tpl-builtin.d.ts +2 -1
- package/esm/utils/tpl-builtin.js +18 -3
- 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.js +1 -1
- package/lib/RootRenderer.js +1 -1
- package/lib/SchemaRenderer.d.ts +1 -0
- package/lib/SchemaRenderer.js +7 -4
- package/lib/Scoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.js +8 -2
- 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 +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +1 -1
- package/lib/actions/DialogAction.js +5 -1
- 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/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +2 -2
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.js +1 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +2 -1
- package/lib/factory.js +3 -3
- package/lib/index.d.ts +8 -3
- package/lib/index.js +14 -2
- package/lib/locale.js +1 -1
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +1 -1
- package/lib/renderers/Item.js +10 -7
- package/lib/renderers/Options.js +3 -3
- 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.js +1 -1
- package/lib/store/app.js +1 -1
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +22 -8
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.js +2 -2
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.js +1 -1
- package/lib/store/service.js +1 -1
- package/lib/store/table.d.ts +24 -23
- package/lib/store/table.js +17 -4
- package/lib/store/table2.d.ts +5 -5
- package/lib/store/table2.js +23 -19
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +6 -0
- 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.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +9 -2
- package/lib/utils/attachmentAdpator.js +1 -1
- 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.js +1 -1
- package/lib/utils/debug.js +4 -4
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +2 -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 +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +7 -0
- package/lib/utils/helper.js +29 -2
- 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 +1 -1
- 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/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.js +1 -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 +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +20 -2
- 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 +9 -4
- package/lib/utils/style-helper.js +86 -15
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +33 -1
- package/lib/utils/tpl-builtin.d.ts +2 -1
- package/lib/utils/tpl-builtin.js +17 -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/esm/utils/tpl-builtin.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { __awaiter, __generator } from 'tslib';
|
|
6
7
|
export { getFilters, registerFilter, registerFunction } from 'amis-formula';
|
|
7
8
|
import 'moment';
|
|
8
|
-
import 'tslib';
|
|
9
9
|
import 'lodash/isPlainObject';
|
|
10
|
-
import { tokenize } from './tokenize.js';
|
|
10
|
+
import { tokenize, asyncTokenize } from './tokenize.js';
|
|
11
11
|
export { tokenize } from './tokenize.js';
|
|
12
12
|
import './filter.js';
|
|
13
13
|
|
|
@@ -38,6 +38,7 @@ function matchSynatax(str) {
|
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
function register() {
|
|
41
|
+
var _this = this;
|
|
41
42
|
return {
|
|
42
43
|
name: 'builtin',
|
|
43
44
|
test: function (str) { return typeof str === 'string' && matchSynatax(str); },
|
|
@@ -52,6 +53,20 @@ function register() {
|
|
|
52
53
|
catch (e) {
|
|
53
54
|
return "error: ".concat(e.message);
|
|
54
55
|
}
|
|
56
|
+
},
|
|
57
|
+
asyncCompile: function (str, data, defaultFilter) {
|
|
58
|
+
if (defaultFilter === void 0) { defaultFilter = '| html'; }
|
|
59
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
try {
|
|
62
|
+
return [2 /*return*/, asyncTokenize(str, data, defaultFilter)];
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
return [2 /*return*/, "error: ".concat(e.message)];
|
|
66
|
+
}
|
|
67
|
+
return [2 /*return*/];
|
|
68
|
+
});
|
|
69
|
+
});
|
|
55
70
|
}
|
|
56
71
|
};
|
|
57
72
|
}
|
package/esm/utils/tpl-lodash.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -55,7 +55,8 @@ function register() {
|
|
|
55
55
|
return {
|
|
56
56
|
name: 'lodash',
|
|
57
57
|
test: function (str) { return !!~str.indexOf('<%'); },
|
|
58
|
-
compile: function (str, data) { return lodashCompile(str, data); }
|
|
58
|
+
compile: function (str, data) { return lodashCompile(str, data); },
|
|
59
|
+
asyncCompile: function (str, data) { return lodashCompile(str, data); }
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
|
package/esm/utils/tpl.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ export interface Enginer {
|
|
|
2
2
|
test: (tpl: string) => boolean;
|
|
3
3
|
removeEscapeToken?: (tpl: string) => string;
|
|
4
4
|
compile: (tpl: string, data: object, ...rest: Array<any>) => string;
|
|
5
|
+
asyncCompile: (tpl: string, data: object, ...rest: Array<any>) => Promise<string>;
|
|
5
6
|
}
|
|
6
7
|
export declare function registerTplEnginer(name: string, enginer: Enginer): void;
|
|
7
8
|
export declare function filter(tpl?: any, data?: object, ...rest: Array<any>): string;
|
|
9
|
+
export declare function asyncFilter(tpl?: any, data?: object, ...rest: Array<any>): Promise<string>;
|
|
8
10
|
export declare function setCustomEvalExpression(fn: (expression: string, data?: any) => boolean): void;
|
|
9
11
|
export declare function evalExpression(expression: string, data?: object): boolean;
|
|
10
12
|
/**
|
package/esm/utils/tpl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -34,6 +34,27 @@ function filter(tpl, data) {
|
|
|
34
34
|
}
|
|
35
35
|
return tpl;
|
|
36
36
|
}
|
|
37
|
+
function asyncFilter(tpl, data) {
|
|
38
|
+
if (data === void 0) { data = {}; }
|
|
39
|
+
var rest = [];
|
|
40
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
41
|
+
rest[_i - 2] = arguments[_i];
|
|
42
|
+
}
|
|
43
|
+
if (!tpl || typeof tpl !== 'string') {
|
|
44
|
+
return Promise.resolve('');
|
|
45
|
+
}
|
|
46
|
+
var keys = Object.keys(enginers);
|
|
47
|
+
for (var i = 0, len = keys.length; i < len; i++) {
|
|
48
|
+
var enginer = enginers[keys[i]];
|
|
49
|
+
if (enginer.test(tpl)) {
|
|
50
|
+
return enginer.asyncCompile.apply(enginer, __spreadArray([tpl, data], __read(rest), false));
|
|
51
|
+
}
|
|
52
|
+
else if (enginer.removeEscapeToken) {
|
|
53
|
+
tpl = enginer.removeEscapeToken(tpl);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return tpl;
|
|
57
|
+
}
|
|
37
58
|
// 缓存一下提升性能
|
|
38
59
|
var EVAL_CACHE = {};
|
|
39
60
|
var customEvalExpressionFn;
|
|
@@ -144,8 +165,9 @@ function evalJS(js, data) {
|
|
|
144
165
|
registerTplEnginer(info.name, {
|
|
145
166
|
test: info.test,
|
|
146
167
|
compile: info.compile,
|
|
168
|
+
asyncCompile: info.asyncCompile,
|
|
147
169
|
removeEscapeToken: info.removeEscapeToken
|
|
148
170
|
});
|
|
149
171
|
});
|
|
150
172
|
|
|
151
|
-
export { evalExpression, evalExpressionWithConditionBuilder, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs };
|
|
173
|
+
export { asyncFilter, evalExpression, evalExpressionWithConditionBuilder, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export interface ValidateFn {
|
|
2
2
|
(values: {
|
|
3
3
|
[propsName: string]: any;
|
|
4
|
-
}, value: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): boolean
|
|
4
|
+
}, value: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): boolean | {
|
|
5
|
+
error: boolean;
|
|
6
|
+
msg?: string;
|
|
7
|
+
};
|
|
5
8
|
}
|
|
6
9
|
export declare const validations: {
|
|
7
10
|
[propsName: string]: ValidateFn;
|
package/esm/utils/validations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -348,12 +348,16 @@ var validateMessages = {
|
|
|
348
348
|
isVariableName: 'validate.isVariableName'
|
|
349
349
|
};
|
|
350
350
|
function validate(value, values, rules, messages, __) {
|
|
351
|
+
var _a;
|
|
351
352
|
if (__ === void 0) { __ = function (str) { return str; }; }
|
|
352
353
|
var errors = [];
|
|
353
|
-
rules
|
|
354
|
-
Object.keys(rules)
|
|
354
|
+
if (rules) {
|
|
355
|
+
var ruleNames = Object.keys(rules);
|
|
356
|
+
var length_1 = ruleNames.length;
|
|
357
|
+
for (var index = 0; index < length_1; index++) {
|
|
358
|
+
var ruleName = ruleNames[index];
|
|
355
359
|
if (!rules[ruleName] && rules[ruleName] !== 0) {
|
|
356
|
-
|
|
360
|
+
continue;
|
|
357
361
|
}
|
|
358
362
|
else if (typeof validations[ruleName] !== 'function') {
|
|
359
363
|
throw new Error('Validation `' + ruleName + '` not exists!');
|
|
@@ -365,19 +369,30 @@ function validate(value, values, rules, messages, __) {
|
|
|
365
369
|
}
|
|
366
370
|
return item;
|
|
367
371
|
});
|
|
368
|
-
|
|
372
|
+
var validateRes = fn.apply(void 0, __spreadArray([values, value], __read(args), false));
|
|
373
|
+
// addRule 允许返回
|
|
374
|
+
// {error: true, msg: '错误提示'}
|
|
375
|
+
// 格式的信息来灵活展示错误
|
|
376
|
+
var fnResErrorMsg = '';
|
|
377
|
+
if (typeof validateRes === 'object' &&
|
|
378
|
+
validateRes.error === true) {
|
|
379
|
+
fnResErrorMsg = (_a = validateRes === null || validateRes === void 0 ? void 0 : validateRes.msg) !== null && _a !== void 0 ? _a : '';
|
|
380
|
+
}
|
|
381
|
+
if (!validateRes || fnResErrorMsg) {
|
|
369
382
|
var msgRuleName = ruleName;
|
|
370
383
|
if (Array.isArray(value)) {
|
|
371
384
|
msgRuleName = "".concat(ruleName, "Array");
|
|
372
385
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
386
|
+
return [{
|
|
387
|
+
rule: ruleName,
|
|
388
|
+
msg: filter(__((messages && messages[ruleName]) ||
|
|
389
|
+
fnResErrorMsg ||
|
|
390
|
+
validateMessages[msgRuleName] ||
|
|
391
|
+
validateMessages[ruleName]), __assign({}, [''].concat(args)))
|
|
392
|
+
}];
|
|
379
393
|
}
|
|
380
|
-
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
381
396
|
return errors;
|
|
382
397
|
}
|
|
383
398
|
function validateObject(values, rules, messages, __) {
|
package/lib/Root.js
CHANGED
package/lib/RootRenderer.js
CHANGED
package/lib/SchemaRenderer.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface SchemaRendererProps extends Partial<RendererProps> {
|
|
|
8
8
|
$path: string;
|
|
9
9
|
env: RendererEnv;
|
|
10
10
|
}
|
|
11
|
+
export declare const RENDERER_TRANSMISSION_OMIT_PROPS: string[];
|
|
11
12
|
export declare class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
12
13
|
static displayName: string;
|
|
13
14
|
static contextType: React.Context<IScopedContext>;
|
package/lib/SchemaRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -35,7 +35,7 @@ var difference__default = /*#__PURE__*/_interopDefaultLegacy(difference);
|
|
|
35
35
|
var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
|
|
36
36
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var RENDERER_TRANSMISSION_OMIT_PROPS = [
|
|
39
39
|
'type',
|
|
40
40
|
'name',
|
|
41
41
|
'$ref',
|
|
@@ -60,7 +60,9 @@ var defaultOmitList = [
|
|
|
60
60
|
'mode',
|
|
61
61
|
'body',
|
|
62
62
|
'id',
|
|
63
|
-
'inputOnly'
|
|
63
|
+
'inputOnly',
|
|
64
|
+
'label',
|
|
65
|
+
'renderLabel'
|
|
64
66
|
];
|
|
65
67
|
var componentCache = new SimpleMap.SimpleMap();
|
|
66
68
|
var SchemaRenderer = /** @class */ (function (_super) {
|
|
@@ -178,7 +180,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
178
180
|
if (subProps === void 0) { subProps = {}; }
|
|
179
181
|
var _a = this.props; _a.schema; _a.$path; var env = _a.env, render = _a.render, rest = tslib.__rest(_a, ["schema", "$path", "env", "render"]);
|
|
180
182
|
var $path = this.resolveRenderer(this.props).path;
|
|
181
|
-
var omitList =
|
|
183
|
+
var omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
|
|
182
184
|
if (this.renderer) {
|
|
183
185
|
var Component = this.renderer.component;
|
|
184
186
|
Component.propsList &&
|
|
@@ -351,4 +353,5 @@ var PlaceholderComponent = /** @class */ (function (_super) {
|
|
|
351
353
|
return PlaceholderComponent;
|
|
352
354
|
}(React__default["default"].Component));
|
|
353
355
|
|
|
356
|
+
exports.RENDERER_TRANSMISSION_OMIT_PROPS = RENDERER_TRANSMISSION_OMIT_PROPS;
|
|
354
357
|
exports.SchemaRenderer = SchemaRenderer;
|
package/lib/Scoped.js
CHANGED
package/lib/WithRootStore.js
CHANGED
package/lib/WithStore.js
CHANGED
package/lib/actions/Action.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -206,7 +206,13 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
206
206
|
_d.label = 6;
|
|
207
207
|
case 6:
|
|
208
208
|
args = dataMapping.dataMapping(actionConfig.args, mergeData, function (key) {
|
|
209
|
-
return [
|
|
209
|
+
return [
|
|
210
|
+
'adaptor',
|
|
211
|
+
'responseAdaptor',
|
|
212
|
+
'requestAdaptor',
|
|
213
|
+
'responseData',
|
|
214
|
+
'condition'
|
|
215
|
+
].includes(key);
|
|
210
216
|
});
|
|
211
217
|
afterMappingData = dataMapping.dataMapping(actionConfig.data, mergeData);
|
|
212
218
|
actionData = args && Object.keys(args).length
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -24,6 +24,10 @@ var DialogAction = /** @class */ (function () {
|
|
|
24
24
|
var _a, _b, _c;
|
|
25
25
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
26
26
|
return tslib.__generator(this, function (_d) {
|
|
27
|
+
// 防止editor preview模式下执行
|
|
28
|
+
if (action.$$id !== undefined) {
|
|
29
|
+
return [2 /*return*/];
|
|
30
|
+
}
|
|
27
31
|
(_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, {
|
|
28
32
|
actionType: 'dialog',
|
|
29
33
|
dialog: ((_c = action.args) === null || _c === void 0 ? void 0 : _c.dialog) || action.dialog,
|
|
@@ -13,9 +13,9 @@ interface OverlayProps {
|
|
|
13
13
|
shouldUpdatePosition?: boolean;
|
|
14
14
|
rootClose?: boolean;
|
|
15
15
|
onHide?(props: any, ...args: any[]): any;
|
|
16
|
-
container?: HTMLElement | (() => HTMLElement | null | undefined);
|
|
16
|
+
container?: HTMLElement | React.ReactNode | (() => HTMLElement | React.ReactNode | null | undefined);
|
|
17
17
|
containerSelector?: string;
|
|
18
|
-
target?: React.ReactNode | Function;
|
|
18
|
+
target?: React.ReactNode | HTMLElement | Function;
|
|
19
19
|
watchTargetSizeChange?: boolean;
|
|
20
20
|
offset?: [number, number];
|
|
21
21
|
onEnter?(node: HTMLElement): any;
|
package/lib/env.js
CHANGED
package/lib/envOverwrite.js
CHANGED
package/lib/factory.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { fetcherResult, SchemaNode, Schema, PlainObject } from './types';
|
|
|
4
4
|
import { ThemeProps } from './theme';
|
|
5
5
|
import { LocaleProps } from './locale';
|
|
6
6
|
import type { RendererEnv } from './env';
|
|
7
|
-
import { OnEventProps } from './utils/renderer-event';
|
|
7
|
+
import { OnEventProps, RendererEvent } from './utils/renderer-event';
|
|
8
8
|
export interface TestFunc {
|
|
9
9
|
(path: string, schema?: Schema, resolveRenderer?: (path: string, schema?: Schema, props?: any) => null | RendererConfig): boolean;
|
|
10
10
|
}
|
|
@@ -35,6 +35,7 @@ export interface RendererProps extends ThemeProps, LocaleProps, OnEventProps {
|
|
|
35
35
|
style?: {
|
|
36
36
|
[propName: string]: any;
|
|
37
37
|
};
|
|
38
|
+
onBroadcast?: (type: string, rawEvent: RendererEvent<any>, ctx: any) => any;
|
|
38
39
|
[propName: string]: any;
|
|
39
40
|
}
|
|
40
41
|
export type RendererComponent = React.ComponentType<RendererProps> & {
|
package/lib/factory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -147,11 +147,11 @@ var defaultOptions = {
|
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
isCancel: function () {
|
|
150
|
-
console.error('Please implement isCancel. see https://baidu.
|
|
150
|
+
console.error('Please implement isCancel. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
|
|
151
151
|
return false;
|
|
152
152
|
},
|
|
153
153
|
updateLocation: function () {
|
|
154
|
-
console.error('Please implement updateLocation. see https://baidu.
|
|
154
|
+
console.error('Please implement updateLocation. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
|
|
155
155
|
},
|
|
156
156
|
jumpTo: function (to, action) {
|
|
157
157
|
if (to === 'goBack') {
|
package/lib/index.d.ts
CHANGED
|
@@ -14,10 +14,11 @@ export * from './types';
|
|
|
14
14
|
export * from './store';
|
|
15
15
|
import * as utils from './utils/helper';
|
|
16
16
|
import { RegisterStore } from './store';
|
|
17
|
+
import type { IColumn, IColumn2, IRow, IRow2 } from './store';
|
|
17
18
|
import { setDefaultLocale, getDefaultLocale, makeTranslator, register as registerLocale, extendLocale, removeLocaleData, localeable } from './locale';
|
|
18
19
|
import type { LocaleProps, TranslateFn } from './locale';
|
|
19
20
|
import Scoped, { ScopedContext } from './Scoped';
|
|
20
|
-
import type { IScopedContext } from './Scoped';
|
|
21
|
+
import type { ScopedComponentType, IScopedContext } from './Scoped';
|
|
21
22
|
import { classnames, getClassPrefix, setDefaultTheme, theme, getTheme, themeable, makeClassnames } from './theme';
|
|
22
23
|
import type { ClassNamesFn, ThemeProps } from './theme';
|
|
23
24
|
declare const classPrefix: string | undefined;
|
|
@@ -37,7 +38,11 @@ import LazyComponent from './components/LazyComponent';
|
|
|
37
38
|
import Overlay from './components/Overlay';
|
|
38
39
|
import PopOver from './components/PopOver';
|
|
39
40
|
import { FormRenderer } from './renderers/Form';
|
|
40
|
-
import type { FormHorizontal } from './renderers/Form';
|
|
41
|
+
import type { FormHorizontal, FormSchemaBase } from './renderers/Form';
|
|
42
|
+
import type { OnEventProps } from './utils/index';
|
|
43
|
+
import { valueMap as styleMap } from './utils/style-helper';
|
|
44
|
+
import { RENDERER_TRANSMISSION_OMIT_PROPS } from './SchemaRenderer';
|
|
45
|
+
import type { IItem } from './store/list';
|
|
41
46
|
export declare const version = "__buildVersion";
|
|
42
|
-
export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, AsyncEvaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, evaluateForAsync, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig };
|
|
47
|
+
export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, AsyncEvaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, evaluateForAsync, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig, styleMap, RENDERER_TRANSMISSION_OMIT_PROPS, ScopedComponentType, IItem, IColumn, IRow, IColumn2, IRow2, OnEventProps, FormSchemaBase };
|
|
43
48
|
export declare function render(schema: Schema, props?: RootRenderProps, options?: RenderOptions, pathPrefix?: string): JSX.Element;
|