amis-core 3.0.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 +3 -2
- package/esm/SchemaRenderer.js +26 -20
- 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 +12 -4
- 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 +19 -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 +1 -1
- 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 +3 -2
- package/esm/factory.js +1 -1
- package/esm/index.d.ts +4 -2
- package/esm/index.js +49 -28
- package/esm/locale.d.ts +2 -2
- package/esm/locale.js +10 -3
- package/esm/renderers/Form.d.ts +2 -1
- package/esm/renderers/Form.js +216 -180
- package/esm/renderers/Item.d.ts +55 -41
- package/esm/renderers/Item.js +24 -16
- package/esm/renderers/Options.js +9 -2
- 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 +12 -4
- package/esm/store/form.d.ts +1 -0
- package/esm/store/form.js +10 -4
- package/esm/store/formItem.js +1 -1
- 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 +1 -1
- 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 +4 -0
- package/esm/store/table.js +10 -2
- package/esm/store/table2.d.ts +2 -1
- package/esm/store/table2.js +6 -6
- package/esm/theme.d.ts +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +1 -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 +6 -4
- 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 +1 -1
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +2 -1
- package/esm/utils/dom.js +1 -1
- 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 +1 -1
- 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 +2 -2
- package/esm/utils/helper.js +25 -18
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +1 -1
- package/esm/utils/icon.js +1 -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 +1 -1
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.js +1 -1
- package/esm/utils/resolveVariable.js +4 -3
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +5 -4
- 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 +5 -2
- package/esm/utils/style-helper.js +18 -6
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.d.ts +0 -1
- package/esm/utils/tokenize.js +3 -34
- package/esm/utils/tpl-builtin.js +5 -3
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +1 -1
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- 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 +3 -2
- package/lib/SchemaRenderer.js +26 -20
- 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 +12 -4
- 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 +19 -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 +1 -1
- 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 +3 -2
- package/lib/factory.js +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +50 -24
- package/lib/locale.d.ts +2 -2
- package/lib/locale.js +10 -3
- package/lib/renderers/Form.d.ts +2 -1
- package/lib/renderers/Form.js +215 -179
- package/lib/renderers/Item.d.ts +55 -41
- package/lib/renderers/Item.js +24 -16
- package/lib/renderers/Options.js +9 -2
- 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 +12 -4
- package/lib/store/form.d.ts +1 -0
- package/lib/store/form.js +10 -4
- package/lib/store/formItem.js +1 -1
- 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 +1 -1
- 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 +4 -0
- package/lib/store/table.js +10 -2
- package/lib/store/table2.d.ts +2 -1
- package/lib/store/table2.js +6 -6
- package/lib/theme.d.ts +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +1 -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 +5 -3
- 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 +1 -1
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +2 -1
- package/lib/utils/dom.js +1 -1
- 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 +1 -1
- 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 +2 -2
- package/lib/utils/helper.js +25 -18
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.d.ts +1 -1
- package/lib/utils/icon.js +1 -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 +1 -1
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.js +1 -1
- package/lib/utils/resolveVariable.js +3 -2
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +4 -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 +5 -2
- package/lib/utils/style-helper.js +18 -6
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.d.ts +0 -1
- package/lib/utils/tokenize.js +1 -33
- package/lib/utils/tpl-builtin.js +4 -2
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +1 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +3 -3
package/esm/utils/keyToPath.js
CHANGED
package/esm/utils/makeSorter.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function memoryParse(input: string, options?: {
|
|
2
|
+
/**
|
|
3
|
+
* 直接是运算表达式?还是从模板开始 ${} 里面才算运算表达式
|
|
4
|
+
*/
|
|
5
|
+
evalMode?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* 只支持取变量。
|
|
8
|
+
*/
|
|
9
|
+
variableMode?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 是否允许 filter 语法,比如:
|
|
12
|
+
*
|
|
13
|
+
* ${abc | html}
|
|
14
|
+
*/
|
|
15
|
+
allowFilter?: boolean;
|
|
16
|
+
variableNamespaces?: Array<string>;
|
|
17
|
+
}): any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v3.1.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { parse } from 'amis-formula';
|
|
7
|
+
|
|
8
|
+
var cache = {};
|
|
9
|
+
function memoryParse(input, options) {
|
|
10
|
+
if (options === void 0) { options = {
|
|
11
|
+
evalMode: false
|
|
12
|
+
}; }
|
|
13
|
+
// @todo 优化内存缓存释放,比如只缓存最高频的模版
|
|
14
|
+
if (typeof input !== 'string') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var key = input + JSON.stringify(options);
|
|
18
|
+
if (cache[key]) {
|
|
19
|
+
return cache[key];
|
|
20
|
+
}
|
|
21
|
+
var ast = parse(input, options);
|
|
22
|
+
cache[key] = ast;
|
|
23
|
+
return ast;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { memoryParse };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -50,7 +50,9 @@ function normalizeOptions(options, share, valueField) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
else if (Array.isArray(options)) {
|
|
53
|
-
return options
|
|
53
|
+
return options
|
|
54
|
+
.filter(function (item) { return item !== null && item !== undefined; })
|
|
55
|
+
.map(function (item) {
|
|
54
56
|
var _a;
|
|
55
57
|
var value = item && item[valueField];
|
|
56
58
|
var idx = value !== undefined && !item.children
|
package/esm/utils/object.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare function createObject(superProps?: {
|
|
|
3
3
|
}, props?: {
|
|
4
4
|
[propName: string]: any;
|
|
5
5
|
}, properties?: any): object;
|
|
6
|
+
export declare function extractObjectChain(value: any): object[];
|
|
7
|
+
export declare function createObjectFromChain(chain: Array<object>): object;
|
|
6
8
|
export declare function cloneObject(target: any, persistOwnProps?: boolean): any;
|
|
7
9
|
export declare function extendObject(target: any, src?: any, persistOwnProps?: boolean): any;
|
|
8
10
|
export declare function isObject(obj: any): any;
|
package/esm/utils/object.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -25,6 +25,31 @@ function createObject(superProps, props, properties) {
|
|
|
25
25
|
Object.keys(props).forEach(function (key) { return (obj[key] = props[key]); });
|
|
26
26
|
return obj;
|
|
27
27
|
}
|
|
28
|
+
function extractObjectChain(value) {
|
|
29
|
+
var result = value ? [value] : [];
|
|
30
|
+
while (value === null || value === void 0 ? void 0 : value.__super) {
|
|
31
|
+
result.unshift(value.__super);
|
|
32
|
+
value = value.__super;
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
function createObjectFromChain(chain) {
|
|
37
|
+
return chain
|
|
38
|
+
.filter(function (item) { return item; })
|
|
39
|
+
.reduce(function (proto, value) {
|
|
40
|
+
proto = proto || Object.prototype;
|
|
41
|
+
if (Object.isFrozen(proto)) {
|
|
42
|
+
proto = cloneObject(proto);
|
|
43
|
+
}
|
|
44
|
+
return Object.assign(Object.create(proto, {
|
|
45
|
+
__super: {
|
|
46
|
+
value: proto,
|
|
47
|
+
writable: false,
|
|
48
|
+
enumerable: false
|
|
49
|
+
}
|
|
50
|
+
}), value);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
28
53
|
function cloneObject(target, persistOwnProps) {
|
|
29
54
|
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
30
55
|
var obj = target && target.__super
|
|
@@ -139,4 +164,4 @@ function pickValues(names, data) {
|
|
|
139
164
|
return ret;
|
|
140
165
|
}
|
|
141
166
|
|
|
142
|
-
export { cloneObject, createObject, deleteVariable, extendObject, isObject, pickValues, setVariable };
|
|
167
|
+
export { cloneObject, createObject, createObjectFromChain, deleteVariable, extendObject, extractObjectChain, isObject, pickValues, setVariable };
|
package/esm/utils/offset.js
CHANGED
package/esm/utils/position.js
CHANGED
package/esm/utils/prettyBytes.js
CHANGED
package/esm/utils/replaceText.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Evaluator
|
|
6
|
+
import { Evaluator } from 'amis-formula';
|
|
7
7
|
import { getVariable } from './getVariable.js';
|
|
8
|
+
import { memoryParse } from './memoryParse.js';
|
|
8
9
|
|
|
9
10
|
function resolveVariable(path, data, canAccessSuper) {
|
|
10
11
|
if (data === void 0) { data = {}; }
|
|
@@ -22,7 +23,7 @@ function resolveVariable(path, data, canAccessSuper) {
|
|
|
22
23
|
// 带 namespace 的用公式
|
|
23
24
|
// 主要是用公式会严格点,不能出现奇怪的变量名
|
|
24
25
|
try {
|
|
25
|
-
return new Evaluator(data).evalute(
|
|
26
|
+
return new Evaluator(data).evalute(memoryParse(path, {
|
|
26
27
|
variableMode: true,
|
|
27
28
|
allowFilter: false
|
|
28
29
|
}));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __awaiter, __generator } from 'tslib';
|
|
7
|
-
import {
|
|
7
|
+
import { AsyncEvaluator } from 'amis-formula';
|
|
8
|
+
import { memoryParse } from './memoryParse.js';
|
|
8
9
|
|
|
9
10
|
var formulaEvalErrorHandler;
|
|
10
11
|
/**
|
|
@@ -30,7 +31,7 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
|
|
|
30
31
|
_a.label = 1;
|
|
31
32
|
case 1:
|
|
32
33
|
_a.trys.push([1, 3, , 4]);
|
|
33
|
-
ast =
|
|
34
|
+
ast = memoryParse(path, {
|
|
34
35
|
evalMode: false,
|
|
35
36
|
allowFilter: true
|
|
36
37
|
});
|
|
@@ -44,7 +45,6 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
|
|
|
44
45
|
: ret];
|
|
45
46
|
case 3:
|
|
46
47
|
e_1 = _a.sent();
|
|
47
|
-
console.warn(e_1);
|
|
48
48
|
if (e_1.name === 'FormulaEvalError') {
|
|
49
49
|
if (!skipFormulaEvalErrorHandler) {
|
|
50
50
|
// 无法解析时,执行handler自定义解析逻辑
|
|
@@ -53,6 +53,7 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
|
|
|
53
53
|
// 跳过自定义解析逻辑,则直接抛异常
|
|
54
54
|
throw e_1;
|
|
55
55
|
}
|
|
56
|
+
console.warn(e_1);
|
|
56
57
|
return [2 /*return*/, undefined];
|
|
57
58
|
case 4: return [2 /*return*/];
|
|
58
59
|
}
|
package/esm/utils/stripNumber.js
CHANGED
|
@@ -2,6 +2,8 @@ import { PlainObject } from '../types';
|
|
|
2
2
|
export declare const valueMap: PlainObject;
|
|
3
3
|
export declare const inheritValueMap: PlainObject;
|
|
4
4
|
interface extra {
|
|
5
|
+
important?: boolean;
|
|
6
|
+
inner?: string;
|
|
5
7
|
pre?: string;
|
|
6
8
|
suf?: string;
|
|
7
9
|
}
|
|
@@ -24,7 +26,7 @@ export declare function formatStyle(themeCss: any, classNames: {
|
|
|
24
26
|
content: string;
|
|
25
27
|
}[];
|
|
26
28
|
};
|
|
27
|
-
export
|
|
29
|
+
export interface CustomStyleClassName {
|
|
28
30
|
key: string;
|
|
29
31
|
value?: string;
|
|
30
32
|
weights?: {
|
|
@@ -33,7 +35,8 @@ export declare function insertCustomStyle(themeCss: any, classNames: {
|
|
|
33
35
|
active?: extra;
|
|
34
36
|
disabled?: extra;
|
|
35
37
|
};
|
|
36
|
-
}
|
|
38
|
+
}
|
|
39
|
+
export declare function insertCustomStyle(themeCss: any, classNames: CustomStyleClassName[], id?: string, defaultData?: any, customStyleClassPrefix?: string): void;
|
|
37
40
|
/**
|
|
38
41
|
* 根据路径获取默认值
|
|
39
42
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -115,7 +115,7 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
115
115
|
}
|
|
116
116
|
list === null || list === void 0 ? void 0 : list.forEach(function (n) {
|
|
117
117
|
if (/(\S*[C|c]lassName-\S*)/.test(n) &&
|
|
118
|
-
!!~n.indexOf((id === null || id === void 0 ? void 0 : id.replace('u:', '').replace('-label', '').replace('-description', '').replace('-addOn', '').replace('-icon', '')) || '')) {
|
|
118
|
+
!!~n.indexOf((id === null || id === void 0 ? void 0 : id.replace('u:', '').replace('-label', '').replace('-description', '').replace('-addOn', '').replace('-icon', '').replace('-inner', '')) || '')) {
|
|
119
119
|
classNameList.push(n);
|
|
120
120
|
}
|
|
121
121
|
});
|
|
@@ -185,14 +185,23 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
185
185
|
}
|
|
186
186
|
else {
|
|
187
187
|
var value = style;
|
|
188
|
-
|
|
188
|
+
if (key === 'iconSize') {
|
|
189
|
+
fn('width', value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
|
|
190
|
+
fn('height', value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
|
|
191
|
+
fn('font-size', value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
value &&
|
|
195
|
+
fn(key, value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
|
|
196
|
+
}
|
|
189
197
|
}
|
|
190
198
|
}
|
|
191
199
|
if (styles.length > 0) {
|
|
192
200
|
var cx = ((weights === null || weights === void 0 ? void 0 : weights.pre) || '') + className + ((weights === null || weights === void 0 ? void 0 : weights.suf) || '');
|
|
201
|
+
var inner = (weights === null || weights === void 0 ? void 0 : weights.inner) || '';
|
|
193
202
|
res.push({
|
|
194
|
-
className: cx + status2string[status_1],
|
|
195
|
-
content: ".".concat(cx + status2string[status_1], " {\n ").concat(styles.join('\n '), "\n}")
|
|
203
|
+
className: cx + status2string[status_1] + inner,
|
|
204
|
+
content: ".".concat(cx + status2string[status_1], " ").concat(inner, "{\n ").concat(styles.join('\n '), "\n}")
|
|
196
205
|
});
|
|
197
206
|
// TODO:切换状态暂时先不改变组件的样式
|
|
198
207
|
// if (['hover', 'active', 'disabled'].includes(status)) {
|
|
@@ -234,12 +243,15 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
234
243
|
origin: res
|
|
235
244
|
};
|
|
236
245
|
}
|
|
237
|
-
function insertCustomStyle(themeCss, classNames, id, defaultData) {
|
|
246
|
+
function insertCustomStyle(themeCss, classNames, id, defaultData, customStyleClassPrefix) {
|
|
238
247
|
if (!themeCss) {
|
|
239
248
|
return;
|
|
240
249
|
}
|
|
241
250
|
var value = formatStyle(themeCss, classNames, id, defaultData).value;
|
|
242
251
|
if (value) {
|
|
252
|
+
value = customStyleClassPrefix
|
|
253
|
+
? "".concat(customStyleClassPrefix, " ").concat(value)
|
|
254
|
+
: value;
|
|
243
255
|
insertStyle(value, (id === null || id === void 0 ? void 0 : id.replace('u:', '')) || uuid());
|
|
244
256
|
}
|
|
245
257
|
}
|
package/esm/utils/style.js
CHANGED
package/esm/utils/toNumber.js
CHANGED
package/esm/utils/tokenize.d.ts
CHANGED
package/esm/utils/tokenize.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { parse, Evaluator, evaluateForAsync } from 'amis-formula';
|
|
6
|
+
import { parse, Evaluator } from 'amis-formula';
|
|
8
7
|
|
|
9
8
|
var tokenize = function (str, data, defaultFilter) {
|
|
10
9
|
if (defaultFilter === void 0) { defaultFilter = '| html'; }
|
|
@@ -26,35 +25,5 @@ var tokenize = function (str, data, defaultFilter) {
|
|
|
26
25
|
return str;
|
|
27
26
|
}
|
|
28
27
|
};
|
|
29
|
-
var asyncTokenize = function (str, data, defaultFilter) {
|
|
30
|
-
if (defaultFilter === void 0) { defaultFilter = '| html'; }
|
|
31
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
32
|
-
var ast, result, e_1;
|
|
33
|
-
return __generator(this, function (_a) {
|
|
34
|
-
switch (_a.label) {
|
|
35
|
-
case 0:
|
|
36
|
-
if (!str || typeof str !== 'string') {
|
|
37
|
-
return [2 /*return*/, str];
|
|
38
|
-
}
|
|
39
|
-
_a.label = 1;
|
|
40
|
-
case 1:
|
|
41
|
-
_a.trys.push([1, 3, , 4]);
|
|
42
|
-
ast = parse(str, {
|
|
43
|
-
evalMode: false,
|
|
44
|
-
allowFilter: true
|
|
45
|
-
});
|
|
46
|
-
return [4 /*yield*/, evaluateForAsync(ast, data, { defaultFilter: defaultFilter })];
|
|
47
|
-
case 2:
|
|
48
|
-
result = _a.sent();
|
|
49
|
-
return [2 /*return*/, "".concat(result == null ? '' : result)];
|
|
50
|
-
case 3:
|
|
51
|
-
e_1 = _a.sent();
|
|
52
|
-
console.warn(e_1);
|
|
53
|
-
return [2 /*return*/, str];
|
|
54
|
-
case 4: return [2 /*return*/];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
28
|
|
|
60
|
-
export {
|
|
29
|
+
export { tokenize };
|
package/esm/utils/tpl-builtin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,8 +7,10 @@ import { __awaiter, __generator } from 'tslib';
|
|
|
7
7
|
export { getFilters, registerFilter, registerFunction } from 'amis-formula';
|
|
8
8
|
import 'moment';
|
|
9
9
|
import 'lodash/isPlainObject';
|
|
10
|
-
import { tokenize
|
|
10
|
+
import { tokenize } from './tokenize.js';
|
|
11
11
|
export { tokenize } from './tokenize.js';
|
|
12
|
+
import { resolveVariableAndFilterForAsync } from './resolveVariableAndFilterForAsync.js';
|
|
13
|
+
export { resolveVariableAndFilterForAsync } from './resolveVariableAndFilterForAsync.js';
|
|
12
14
|
import './filter.js';
|
|
13
15
|
|
|
14
16
|
function matchSynatax(str) {
|
|
@@ -59,7 +61,7 @@ function register() {
|
|
|
59
61
|
return __awaiter(_this, void 0, void 0, function () {
|
|
60
62
|
return __generator(this, function (_a) {
|
|
61
63
|
try {
|
|
62
|
-
return [2 /*return*/,
|
|
64
|
+
return [2 /*return*/, resolveVariableAndFilterForAsync(str, data, defaultFilter)];
|
|
63
65
|
}
|
|
64
66
|
catch (e) {
|
|
65
67
|
return [2 /*return*/, "error: ".concat(e.message)];
|
package/esm/utils/tpl-lodash.js
CHANGED
package/esm/utils/tpl.js
CHANGED
package/esm/utils/validations.js
CHANGED
package/lib/Root.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
/// <reference types="hoist-non-react-statics" />
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { RendererEnv } from './env';
|
|
3
4
|
import { RendererProps } from './factory';
|
|
4
5
|
import { TranslateFn } from './locale';
|
|
5
6
|
import { IRendererStore } from './store';
|
|
6
7
|
import { SchemaNode } from './types';
|
|
8
|
+
import { StatusScopedProps } from './StatusScoped';
|
|
7
9
|
export interface RootRenderProps {
|
|
8
10
|
location?: Location;
|
|
9
11
|
theme?: string;
|
|
12
|
+
data?: Record<string, any>;
|
|
13
|
+
locale?: string;
|
|
10
14
|
[propName: string]: any;
|
|
11
15
|
}
|
|
12
|
-
export interface RootProps {
|
|
16
|
+
export interface RootProps extends StatusScopedProps {
|
|
13
17
|
schema: SchemaNode;
|
|
14
18
|
rootStore: IRendererStore;
|
|
15
19
|
env: RendererEnv;
|
|
@@ -25,22 +29,103 @@ export interface RootWrapperProps {
|
|
|
25
29
|
schema: SchemaNode;
|
|
26
30
|
rootStore: IRendererStore;
|
|
27
31
|
theme: string;
|
|
32
|
+
data?: Record<string, any>;
|
|
33
|
+
context?: Record<string, any>;
|
|
28
34
|
[propName: string]: any;
|
|
29
35
|
}
|
|
30
36
|
export declare function addRootWrapper(fn: (props: RootWrapperProps) => React.ReactNode): void;
|
|
31
37
|
export declare class Root extends React.Component<RootProps> {
|
|
32
38
|
resolveDefinitions(name: string): {} | undefined;
|
|
33
|
-
render(): JSX.Element;
|
|
39
|
+
render(): React.JSX.Element;
|
|
34
40
|
}
|
|
35
|
-
export interface renderChildProps extends Partial<RendererProps
|
|
41
|
+
export interface renderChildProps extends Partial<Omit<RendererProps, 'statusStore'>>, StatusScopedProps {
|
|
36
42
|
env: RendererEnv;
|
|
37
43
|
}
|
|
38
44
|
export type ReactElement = React.ReactNode[] | JSX.Element | null | false;
|
|
39
45
|
export declare function renderChildren(prefix: string, node: SchemaNode, props: renderChildProps): ReactElement;
|
|
40
46
|
export declare function renderChild(prefix: string, node: SchemaNode, props: renderChildProps): ReactElement;
|
|
41
|
-
declare const _default:
|
|
47
|
+
declare const _default: {
|
|
48
|
+
new (props: Omit<RootProps & {
|
|
49
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
50
|
+
}, "statusStore">): {
|
|
51
|
+
store?: ({
|
|
52
|
+
visibleState: any;
|
|
53
|
+
disableState: any;
|
|
54
|
+
staticState: any;
|
|
55
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
56
|
+
setVisible(key: string, value?: boolean | undefined): void;
|
|
57
|
+
setDisable(key: string, value?: boolean | undefined): void;
|
|
58
|
+
setStatic(key: string, value?: boolean | undefined): void;
|
|
59
|
+
resetAll(): void;
|
|
60
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
61
|
+
visibleState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
62
|
+
disableState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
63
|
+
staticState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
64
|
+
}, {
|
|
65
|
+
setVisible(key: string, value?: boolean | undefined): void;
|
|
66
|
+
setDisable(key: string, value?: boolean | undefined): void;
|
|
67
|
+
setStatic(key: string, value?: boolean | undefined): void;
|
|
68
|
+
resetAll(): void;
|
|
69
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined;
|
|
70
|
+
ref: any;
|
|
71
|
+
childRef(ref: any): void;
|
|
72
|
+
getWrappedInstance(): any;
|
|
73
|
+
componentWillUnmount(): void;
|
|
74
|
+
render(): React.JSX.Element;
|
|
75
|
+
context: unknown;
|
|
76
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<RootProps & {
|
|
77
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
78
|
+
}, "statusStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
79
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
80
|
+
readonly props: Readonly<Omit<RootProps & {
|
|
81
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
82
|
+
}, "statusStore">>;
|
|
83
|
+
state: Readonly<{}>;
|
|
84
|
+
refs: {
|
|
85
|
+
[key: string]: React.ReactInstance;
|
|
86
|
+
};
|
|
87
|
+
componentDidMount?(): void;
|
|
88
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<RootProps & {
|
|
89
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
90
|
+
}, "statusStore">>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
91
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
92
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<RootProps & {
|
|
93
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
94
|
+
}, "statusStore">>, prevState: Readonly<{}>): any;
|
|
95
|
+
componentDidUpdate?(prevProps: Readonly<Omit<RootProps & {
|
|
96
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
97
|
+
}, "statusStore">>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
98
|
+
componentWillMount?(): void;
|
|
99
|
+
UNSAFE_componentWillMount?(): void;
|
|
100
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<RootProps & {
|
|
101
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
102
|
+
}, "statusStore">>, nextContext: any): void;
|
|
103
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<RootProps & {
|
|
104
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
105
|
+
}, "statusStore">>, nextContext: any): void;
|
|
106
|
+
componentWillUpdate?(nextProps: Readonly<Omit<RootProps & {
|
|
107
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
108
|
+
}, "statusStore">>, nextState: Readonly<{}>, nextContext: any): void;
|
|
109
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<RootProps & {
|
|
110
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
111
|
+
}, "statusStore">>, nextState: Readonly<{}>, nextContext: any): void;
|
|
112
|
+
};
|
|
113
|
+
displayName: string;
|
|
114
|
+
ComposedComponent: React.ComponentType<React.ComponentType<RootProps & {
|
|
115
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
116
|
+
}> & {
|
|
117
|
+
ComposedComponent: React.ComponentType<RootProps>;
|
|
118
|
+
}>;
|
|
119
|
+
contextType?: React.Context<any> | undefined;
|
|
120
|
+
} & import("hoist-non-react-statics").NonReactStatics<React.ComponentType<RootProps & {
|
|
42
121
|
scopeRef?: ((ref: any) => void) | undefined;
|
|
43
122
|
}> & {
|
|
44
123
|
ComposedComponent: React.ComponentType<RootProps>;
|
|
124
|
+
}, {}> & {
|
|
125
|
+
ComposedComponent: React.ComponentType<RootProps & {
|
|
126
|
+
scopeRef?: ((ref: any) => void) | undefined;
|
|
127
|
+
}> & {
|
|
128
|
+
ComposedComponent: React.ComponentType<RootProps>;
|
|
129
|
+
};
|
|
45
130
|
};
|
|
46
131
|
export default _default;
|