amis-core 3.1.1 → 3.2.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.d.ts +1 -1
- package/esm/RootRenderer.js +2 -2
- package/esm/SchemaRenderer.js +3 -2
- package/esm/Scoped.js +2 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.d.ts +4 -24
- package/esm/WithRootStore.js +12 -4
- package/esm/WithStore.js +23 -16
- package/esm/actions/Action.js +14 -14
- 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 +2 -2
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -1
- package/esm/actions/DialogAction.d.ts +2 -0
- package/esm/actions/DialogAction.js +40 -23
- package/esm/actions/DrawerAction.js +4 -4
- 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.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +2 -1
- package/esm/components/PopOver.js +2 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +6 -4
- package/esm/locale.js +1 -1
- package/esm/polyfills.d.ts +3 -0
- package/esm/polyfills.js +18 -0
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +17 -7
- package/esm/renderers/Item.d.ts +88 -59
- package/esm/renderers/Item.js +86 -40
- package/esm/renderers/Options.js +1 -1
- 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 +4 -24
- package/esm/renderers/wrapControl.js +51 -53
- package/esm/store/app.js +37 -3
- package/esm/store/combo.d.ts +168 -28
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +3 -2
- package/esm/store/crud.js +12 -5
- package/esm/store/form.d.ts +72 -12
- package/esm/store/form.js +4 -4
- package/esm/store/formItem.d.ts +2 -1
- package/esm/store/formItem.js +7 -2
- package/esm/store/iRenderer.js +2 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -0
- package/esm/store/list.js +8 -2
- 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 +1 -1
- package/esm/store/root.js +2 -1
- package/esm/store/service.js +14 -9
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +145 -24
- package/esm/store/table.js +8 -2
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +5 -2
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.d.ts +3 -2
- package/esm/utils/DataSchema.js +27 -7
- package/esm/utils/DataScope.d.ts +10 -3
- package/esm/utils/DataScope.js +50 -12
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +40 -32
- package/esm/utils/arraySlice.d.ts +1 -0
- package/esm/utils/arraySlice.js +76 -0
- 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 +26 -18
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +1 -1
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +4 -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 +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +8 -1
- package/esm/utils/helper.js +57 -10
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +1 -0
- 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/memoryParse.js +1 -1
- package/esm/utils/normalizeLink.js +18 -9
- 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 +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 +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
- 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.js +1 -1
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.js +1 -1
- 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.js +1 -1
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +2 -2
- package/lib/SchemaRenderer.js +3 -2
- package/lib/Scoped.js +2 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.d.ts +4 -24
- package/lib/WithRootStore.js +12 -4
- package/lib/WithStore.js +23 -16
- package/lib/actions/Action.js +14 -14
- 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 +2 -2
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +2 -1
- package/lib/actions/DialogAction.d.ts +2 -0
- package/lib/actions/DialogAction.js +40 -23
- package/lib/actions/DrawerAction.js +4 -4
- 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.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +2 -1
- package/lib/components/PopOver.js +2 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -2
- package/lib/locale.js +1 -1
- package/lib/polyfills.d.ts +3 -0
- package/lib/polyfills.js +20 -0
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +17 -7
- package/lib/renderers/Item.d.ts +88 -59
- package/lib/renderers/Item.js +86 -40
- package/lib/renderers/Options.js +1 -1
- 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 +4 -24
- package/lib/renderers/wrapControl.js +51 -53
- package/lib/store/app.js +36 -2
- package/lib/store/combo.d.ts +168 -28
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +3 -2
- package/lib/store/crud.js +12 -5
- package/lib/store/form.d.ts +72 -12
- package/lib/store/form.js +4 -4
- package/lib/store/formItem.d.ts +2 -1
- package/lib/store/formItem.js +7 -2
- package/lib/store/iRenderer.js +2 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -0
- package/lib/store/list.js +8 -2
- 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 +1 -1
- package/lib/store/root.js +2 -1
- package/lib/store/service.js +14 -9
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +145 -24
- package/lib/store/table.js +7 -1
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +5 -2
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.d.ts +3 -2
- package/lib/utils/DataSchema.js +27 -7
- package/lib/utils/DataScope.d.ts +10 -3
- package/lib/utils/DataScope.js +50 -11
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +39 -31
- package/lib/utils/arraySlice.d.ts +1 -0
- package/lib/utils/arraySlice.js +80 -0
- 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 +26 -18
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +1 -1
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +4 -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 +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +8 -1
- package/lib/utils/helper.js +57 -9
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- 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/memoryParse.js +1 -1
- package/lib/utils/normalizeLink.js +18 -9
- 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 +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 +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
- 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.js +1 -1
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.js +1 -1
- 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 +8 -3
package/lib/store/table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.2.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1032,6 +1032,11 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1032
1032
|
self.orderBy = key;
|
|
1033
1033
|
self.orderDir = key ? direction : '';
|
|
1034
1034
|
}
|
|
1035
|
+
function changeOrder(key, direction) {
|
|
1036
|
+
setOrderByInfo(key, direction);
|
|
1037
|
+
var dir = /desc/i.test(self.orderDir) ? -1 : 1;
|
|
1038
|
+
self.rows.replace(helper.sortArray(self.rows.concat(), self.orderBy, dir, function (item, field) { return item.data[field]; }));
|
|
1039
|
+
}
|
|
1035
1040
|
function reset() {
|
|
1036
1041
|
self.rows.forEach(function (item) { return item.reset(); });
|
|
1037
1042
|
var rows = self.rows.concat();
|
|
@@ -1148,6 +1153,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1148
1153
|
collapseAllAtDepth: collapseAllAtDepth,
|
|
1149
1154
|
clear: clear,
|
|
1150
1155
|
setOrderByInfo: setOrderByInfo,
|
|
1156
|
+
changeOrder: changeOrder,
|
|
1151
1157
|
reset: reset,
|
|
1152
1158
|
toggleDragging: toggleDragging,
|
|
1153
1159
|
stopDragging: stopDragging,
|
package/lib/store/table2.js
CHANGED
package/lib/theme.js
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export interface BaseApiObject {
|
|
|
137
137
|
autoRefresh?: boolean;
|
|
138
138
|
/**
|
|
139
139
|
* 当开启自动刷新的时候,默认是 api 的 url 来自动跟踪变量变化的。
|
|
140
|
-
* 如果你希望监控 url 外的变量,请配置
|
|
140
|
+
* 如果你希望监控 url 外的变量,请配置 trackExpression。
|
|
141
141
|
*/
|
|
142
142
|
trackExpression?: string;
|
|
143
143
|
/**
|
|
@@ -300,7 +300,10 @@ type RendererDataAlias = RendererData;
|
|
|
300
300
|
export type FunctionPropertyNames<T> = {
|
|
301
301
|
[K in keyof T]: T[K] extends Function ? K : never;
|
|
302
302
|
}[keyof T];
|
|
303
|
-
export type JSONSchema = JSONSchema7
|
|
303
|
+
export type JSONSchema = JSONSchema7 & {
|
|
304
|
+
group?: string;
|
|
305
|
+
typeLabel?: string;
|
|
306
|
+
};
|
|
304
307
|
/**
|
|
305
308
|
* 事件跟踪的定义
|
|
306
309
|
*/
|
package/lib/utils/Animation.js
CHANGED
package/lib/utils/ColorScale.js
CHANGED
|
@@ -13,13 +13,14 @@ export declare class DataSchema {
|
|
|
13
13
|
setSchema(schemas: Array<JSONSchema>): this;
|
|
14
14
|
addSchema(schema: JSONSchema): this;
|
|
15
15
|
removeSchema(id: string): this;
|
|
16
|
-
getSchemas():
|
|
16
|
+
getSchemas(): JSONSchema[];
|
|
17
17
|
addScope(schema?: JSONSchema | Array<JSONSchema>, id?: string): this;
|
|
18
18
|
removeScope(idOrScope: string | DataScope): this;
|
|
19
19
|
hasScope(idOrScope: string | DataScope): idOrScope is string | DataScope;
|
|
20
20
|
getScope(idOrScope: string | DataScope): DataScope;
|
|
21
21
|
switchToRoot(): this;
|
|
22
22
|
switchTo(idOrScope: string | DataScope): this;
|
|
23
|
+
pushVariable(current: DataScope, variables: any[]): void;
|
|
23
24
|
getDataPropsAsOptions(): any[];
|
|
24
|
-
getSchemaByPath(path: string):
|
|
25
|
+
getSchemaByPath(path: string): JSONSchema | null;
|
|
25
26
|
}
|
package/lib/utils/DataSchema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.2.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -83,18 +83,38 @@ var DataSchema = /** @class */ (function () {
|
|
|
83
83
|
this.current = scope;
|
|
84
84
|
return this;
|
|
85
85
|
};
|
|
86
|
+
DataSchema.prototype.pushVariable = function (current, variables) {
|
|
87
|
+
if (current.tag) {
|
|
88
|
+
variables.push({
|
|
89
|
+
label: current.tag,
|
|
90
|
+
children: current.getDataPropsAsOptions()
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
variables.push.apply(variables, tslib.__spreadArray([], tslib.__read(current.getDataPropsAsOptions()), false));
|
|
95
|
+
}
|
|
96
|
+
};
|
|
86
97
|
DataSchema.prototype.getDataPropsAsOptions = function () {
|
|
98
|
+
var _a;
|
|
87
99
|
var variables = [];
|
|
88
100
|
var current = this.current;
|
|
89
101
|
while (current) {
|
|
90
|
-
if (current.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
if (current.group) {
|
|
103
|
+
var subVars = [];
|
|
104
|
+
this.pushVariable(current, subVars);
|
|
105
|
+
var index = variables.findIndex(function (item) { return item.label === (current === null || current === void 0 ? void 0 : current.group); });
|
|
106
|
+
if (~index) {
|
|
107
|
+
(_a = variables[index].children).push.apply(_a, tslib.__spreadArray([], tslib.__read(subVars), false));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
variables.push({
|
|
111
|
+
label: current.group,
|
|
112
|
+
children: subVars
|
|
113
|
+
});
|
|
114
|
+
}
|
|
95
115
|
}
|
|
96
116
|
else {
|
|
97
|
-
|
|
117
|
+
this.pushVariable(current, variables);
|
|
98
118
|
}
|
|
99
119
|
current = current.parent;
|
|
100
120
|
}
|
package/lib/utils/DataScope.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { JSONSchema } from '../types';
|
|
2
|
+
export declare const DATASCHEMA_TYPE_MAP: {
|
|
3
|
+
[type: string]: string;
|
|
4
|
+
};
|
|
2
5
|
export declare class DataScope {
|
|
3
6
|
parent?: DataScope;
|
|
4
7
|
readonly children: Array<DataScope>;
|
|
@@ -6,6 +9,7 @@ export declare class DataScope {
|
|
|
6
9
|
ref?: string;
|
|
7
10
|
name?: string;
|
|
8
11
|
tag?: string;
|
|
12
|
+
group?: string;
|
|
9
13
|
description?: string;
|
|
10
14
|
readonly schemas: Array<JSONSchema>;
|
|
11
15
|
constructor(schemas: JSONSchema | Array<JSONSchema>, id: string);
|
|
@@ -17,8 +21,11 @@ export declare class DataScope {
|
|
|
17
21
|
contains(scope: DataScope): boolean;
|
|
18
22
|
assignSchema(target: any, schema: any): any;
|
|
19
23
|
getMergedSchema(): any;
|
|
20
|
-
protected buildOptions(options: Array<any>, schema: JSONSchema, path?:
|
|
24
|
+
protected buildOptions(options: Array<any>, schema: JSONSchema, path?: {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}, key?: string, isMember?: boolean): void;
|
|
21
28
|
getDataPropsAsOptions(): any;
|
|
22
|
-
getSchemaByPath(path: string):
|
|
23
|
-
getSchemaById(id: string):
|
|
29
|
+
getSchemaByPath(path: string): JSONSchema | null;
|
|
30
|
+
getSchemaById(id: string): JSONSchema | undefined;
|
|
24
31
|
}
|
package/lib/utils/DataScope.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.2.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -11,6 +11,14 @@ var tslib = require('tslib');
|
|
|
11
11
|
var helper = require('./helper.js');
|
|
12
12
|
var keyToPath = require('./keyToPath.js');
|
|
13
13
|
|
|
14
|
+
var DATASCHEMA_TYPE_MAP = {
|
|
15
|
+
boolean: '布尔',
|
|
16
|
+
integer: '整数',
|
|
17
|
+
number: '数字',
|
|
18
|
+
string: '文本',
|
|
19
|
+
array: '数组',
|
|
20
|
+
object: '对象'
|
|
21
|
+
};
|
|
14
22
|
var DataScope = /** @class */ (function () {
|
|
15
23
|
function DataScope(schemas, id) {
|
|
16
24
|
this.children = [];
|
|
@@ -171,31 +179,61 @@ var DataScope = /** @class */ (function () {
|
|
|
171
179
|
});
|
|
172
180
|
return mergedSchema;
|
|
173
181
|
};
|
|
174
|
-
DataScope.prototype.buildOptions = function (options, schema, path, key
|
|
182
|
+
DataScope.prototype.buildOptions = function (options, schema, path, key, isMember // 是否是数组成员
|
|
183
|
+
) {
|
|
175
184
|
var _this = this;
|
|
176
|
-
var _a;
|
|
177
|
-
if (path === void 0) { path = ''; }
|
|
185
|
+
var _a, _b, _c;
|
|
186
|
+
if (path === void 0) { path = { label: '', value: '' }; }
|
|
178
187
|
if (key === void 0) { key = ''; }
|
|
179
188
|
// todo 支持 oneOf, anyOf
|
|
180
189
|
var option = {
|
|
181
190
|
label: schema.title || key,
|
|
182
|
-
value: path,
|
|
191
|
+
value: schema.title === '成员' ? '' : path.value,
|
|
192
|
+
path: schema.title === '成员' ? '' : path.label,
|
|
183
193
|
type: schema.type,
|
|
184
|
-
tag: (_a = schema.
|
|
194
|
+
tag: (_b = (_a = schema.typeLabel) !== null && _a !== void 0 ? _a : DATASCHEMA_TYPE_MAP[schema.type]) !== null && _b !== void 0 ? _b : schema.type,
|
|
195
|
+
description: schema.description,
|
|
196
|
+
isMember: isMember,
|
|
197
|
+
disabled: schema.title === '成员'
|
|
185
198
|
};
|
|
186
|
-
|
|
199
|
+
// 处理option分组
|
|
200
|
+
if (schema.group) {
|
|
201
|
+
var index = options.findIndex(function (item) { return item.label === schema.group; });
|
|
202
|
+
if (~index) {
|
|
203
|
+
options[index].children.push(option);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
options.push({
|
|
207
|
+
label: schema.group,
|
|
208
|
+
value: '',
|
|
209
|
+
children: [option]
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
options.push(option);
|
|
215
|
+
}
|
|
187
216
|
if (schema.type === 'object' && schema.properties) {
|
|
188
217
|
option.children = [];
|
|
189
218
|
var keys = Object.keys(schema.properties);
|
|
190
219
|
keys.forEach(function (key) {
|
|
220
|
+
var _a;
|
|
191
221
|
var child = schema.properties[key];
|
|
192
|
-
_this.buildOptions(option.children, child,
|
|
222
|
+
_this.buildOptions(option.children, child, {
|
|
223
|
+
label: path.label + (path.label ? '.' : '') + ((_a = child.title) !== null && _a !== void 0 ? _a : key),
|
|
224
|
+
value: path.value + (path.value ? '.' : '') + key
|
|
225
|
+
}, key, schema.title === '成员');
|
|
193
226
|
});
|
|
194
227
|
}
|
|
195
|
-
else if (schema.type === 'array' && schema.items) {
|
|
228
|
+
else if (schema.type === 'array' && ((_c = schema.items) === null || _c === void 0 ? void 0 : _c.properties)) {
|
|
196
229
|
option.children = [];
|
|
197
|
-
this.buildOptions(option.children, tslib.__assign(tslib.__assign({ title: '成员' }, schema.items), { disabled: true }),
|
|
198
|
-
|
|
230
|
+
this.buildOptions(option.children, tslib.__assign(tslib.__assign({ title: '成员' }, schema.items), { disabled: true }), {
|
|
231
|
+
label: path.label,
|
|
232
|
+
value: path.value
|
|
233
|
+
}, 'items', schema.title === '成员');
|
|
234
|
+
option.children = helper.mapTree(option.children, function (item) { return (tslib.__assign({}, item
|
|
235
|
+
// disabled: true
|
|
236
|
+
)); });
|
|
199
237
|
}
|
|
200
238
|
};
|
|
201
239
|
DataScope.prototype.getDataPropsAsOptions = function () {
|
|
@@ -236,4 +274,5 @@ var DataScope = /** @class */ (function () {
|
|
|
236
274
|
return DataScope;
|
|
237
275
|
}());
|
|
238
276
|
|
|
277
|
+
exports.DATASCHEMA_TYPE_MAP = DATASCHEMA_TYPE_MAP;
|
|
239
278
|
exports.DataScope = DataScope;
|
package/lib/utils/RootClose.js
CHANGED
package/lib/utils/SimpleMap.js
CHANGED
package/lib/utils/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.2.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -105,6 +105,23 @@ function buildApi(api, data, options) {
|
|
|
105
105
|
}
|
|
106
106
|
: undefined);
|
|
107
107
|
};
|
|
108
|
+
/** 追加data到请求的Query中 */
|
|
109
|
+
var attachDataToQuery = function (apiObject, ctx, merge) {
|
|
110
|
+
var idx = apiObject.url.indexOf('?');
|
|
111
|
+
if (~idx) {
|
|
112
|
+
var params = (apiObject.query = tslib.__assign(tslib.__assign(tslib.__assign({}, helper.qsparse(apiObject.url.substring(idx + 1))), apiObject.query), ctx));
|
|
113
|
+
apiObject.url =
|
|
114
|
+
apiObject.url.substring(0, idx) + '?' + queryStringify(params);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
apiObject.query = tslib.__assign(tslib.__assign({}, apiObject.query), ctx);
|
|
118
|
+
var query = queryStringify(merge ? apiObject.query : ctx);
|
|
119
|
+
if (query) {
|
|
120
|
+
apiObject.url = "".concat(apiObject.url, "?").concat(query);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return apiObject;
|
|
124
|
+
};
|
|
108
125
|
if (~idx) {
|
|
109
126
|
var hashIdx = url.indexOf('#');
|
|
110
127
|
var params = helper.qsparse(url.substring(idx + 1, ~hashIdx && hashIdx > idx ? hashIdx : undefined));
|
|
@@ -158,41 +175,19 @@ function buildApi(api, data, options) {
|
|
|
158
175
|
else if (api.attachDataToQuery === false &&
|
|
159
176
|
api.data &&
|
|
160
177
|
((!~raw.indexOf('$') && autoAppend) || api.forceAppendDataToQuery)) {
|
|
161
|
-
|
|
162
|
-
if (~idx_1) {
|
|
163
|
-
var params = (api.query = tslib.__assign(tslib.__assign(tslib.__assign({}, helper.qsparse(api.url.substring(idx_1 + 1))), api.query), data));
|
|
164
|
-
api.url = api.url.substring(0, idx_1) + '?' + queryStringify(params);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
api.query = tslib.__assign(tslib.__assign({}, api.query), data);
|
|
168
|
-
var query = queryStringify(data);
|
|
169
|
-
if (query) {
|
|
170
|
-
api.url = "".concat(api.url, "?").concat(query);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
178
|
+
api = attachDataToQuery(api, data, false);
|
|
173
179
|
}
|
|
174
180
|
if (api.data && api.attachDataToQuery !== false) {
|
|
175
|
-
|
|
176
|
-
if (~idx_2) {
|
|
177
|
-
var params = (api.query = tslib.__assign(tslib.__assign(tslib.__assign({}, helper.qsparse(api.url.substring(idx_2 + 1))), api.query), api.data));
|
|
178
|
-
api.url = api.url.substring(0, idx_2) + '?' + queryStringify(params);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
api.query = tslib.__assign(tslib.__assign({}, api.query), api.data);
|
|
182
|
-
var query = queryStringify(api.query);
|
|
183
|
-
if (query) {
|
|
184
|
-
api.url = "".concat(api.url, "?").concat(query);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
181
|
+
api = attachDataToQuery(api, api.data, true);
|
|
187
182
|
delete api.data;
|
|
188
183
|
}
|
|
189
184
|
}
|
|
190
185
|
// 非 get 类请求也可以携带参数到 url,只要 query 有值
|
|
191
186
|
else if (api.method) {
|
|
192
|
-
var
|
|
193
|
-
if (~
|
|
194
|
-
var params = (api.query = tslib.__assign(tslib.__assign({}, helper.qsparse(api.url.substring(
|
|
195
|
-
api.url = api.url.substring(0,
|
|
187
|
+
var idx_1 = api.url.indexOf('?');
|
|
188
|
+
if (~idx_1) {
|
|
189
|
+
var params = (api.query = tslib.__assign(tslib.__assign({}, helper.qsparse(api.url.substring(idx_1 + 1))), api.query));
|
|
190
|
+
api.url = api.url.substring(0, idx_1) + '?' + queryStringify(params);
|
|
196
191
|
}
|
|
197
192
|
else {
|
|
198
193
|
var query = queryStringify(api.query);
|
|
@@ -217,8 +212,21 @@ function buildApi(api, data, options) {
|
|
|
217
212
|
}
|
|
218
213
|
else if (api.jsonql) {
|
|
219
214
|
api.method = 'post';
|
|
220
|
-
api.jsonql = dataMapping.dataMapping(api.jsonql,
|
|
221
|
-
|
|
215
|
+
api.jsonql = dataMapping.dataMapping(api.jsonql,
|
|
216
|
+
/** 需要上层数据域的内容 */
|
|
217
|
+
object.extendObject(data, tslib.__assign(tslib.__assign({}, api.query), data), false), undefined, false, true);
|
|
218
|
+
/** 同时设置了JSONQL和data时走兼容场景 */
|
|
219
|
+
api.body = api.data =
|
|
220
|
+
api.data && api.jsonql
|
|
221
|
+
? {
|
|
222
|
+
data: api.data,
|
|
223
|
+
jsonql: api.jsonql
|
|
224
|
+
}
|
|
225
|
+
: api.jsonql;
|
|
226
|
+
/** JSONQL所有method需要追加data中的变量到query中 */
|
|
227
|
+
if (api.forceAppendDataToQuery) {
|
|
228
|
+
api = attachDataToQuery(api, data, true);
|
|
229
|
+
}
|
|
222
230
|
}
|
|
223
231
|
return api;
|
|
224
232
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function arraySlice(array: any[], slice: string): any[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v3.2.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var mobx = require('mobx');
|
|
12
|
+
|
|
13
|
+
function arraySlice(array, slice) {
|
|
14
|
+
var e_1, _a;
|
|
15
|
+
if (typeof slice !== 'string') {
|
|
16
|
+
return array;
|
|
17
|
+
}
|
|
18
|
+
if (mobx.isObservableArray(array)) {
|
|
19
|
+
array = mobx.toJS(array);
|
|
20
|
+
}
|
|
21
|
+
slice = slice.trim();
|
|
22
|
+
if (!slice || !Array.isArray(array)) {
|
|
23
|
+
return array;
|
|
24
|
+
}
|
|
25
|
+
var parts = slice.split(',');
|
|
26
|
+
var ret = [];
|
|
27
|
+
var arrayLength = array.length;
|
|
28
|
+
if (!arrayLength) {
|
|
29
|
+
return array;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
for (var parts_1 = tslib.__values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) {
|
|
33
|
+
var part = parts_1_1.value;
|
|
34
|
+
// 普通的场景
|
|
35
|
+
if (part.indexOf(':') === -1) {
|
|
36
|
+
var index = parseInt(part, 10);
|
|
37
|
+
if (!isNaN(index) && index < arrayLength) {
|
|
38
|
+
ret.push(array[index]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
var _b = tslib.__read(part.split(':'), 2), start = _b[0], end = _b[1];
|
|
43
|
+
var startIndex = parseInt(start || '0', 10);
|
|
44
|
+
if (isNaN(startIndex) || startIndex < 0) {
|
|
45
|
+
startIndex = 0;
|
|
46
|
+
}
|
|
47
|
+
// 大于就没意义了
|
|
48
|
+
if (startIndex >= arrayLength) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
var endIndex = parseInt(end, 10);
|
|
52
|
+
if (isNaN(endIndex)) {
|
|
53
|
+
endIndex = arrayLength;
|
|
54
|
+
}
|
|
55
|
+
// 负数就从后面开始取
|
|
56
|
+
if (endIndex < 0) {
|
|
57
|
+
endIndex = arrayLength + endIndex;
|
|
58
|
+
}
|
|
59
|
+
// 小于没有意义
|
|
60
|
+
if (endIndex < startIndex) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (endIndex > arrayLength) {
|
|
64
|
+
endIndex = arrayLength;
|
|
65
|
+
}
|
|
66
|
+
ret.push.apply(ret, tslib.__spreadArray([], tslib.__read(array.slice(startIndex, endIndex)), false));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
71
|
+
finally {
|
|
72
|
+
try {
|
|
73
|
+
if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1);
|
|
74
|
+
}
|
|
75
|
+
finally { if (e_1) throw e_1.error; }
|
|
76
|
+
}
|
|
77
|
+
return ret;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.arraySlice = arraySlice;
|
package/lib/utils/autobind.js
CHANGED
package/lib/utils/dataMapping.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.2.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -98,26 +98,27 @@ function dataMapping(to, from, ignoreFunction, convertKeyToPath, ignoreIfNotMatc
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
Object.keys(to)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
var objectKeys = Object.keys(to);
|
|
102
|
+
// 如果存在 '&' 作为 key,则特殊处理
|
|
103
|
+
// 就是无论这个 key 的位置在什么地方始终都是当放在最前面
|
|
104
|
+
var idx = objectKeys.indexOf('&');
|
|
105
|
+
if (~idx) {
|
|
106
|
+
var value_1 = to['&'];
|
|
107
|
+
objectKeys.splice(idx, 1);
|
|
108
|
+
if (value_1 === '$$') {
|
|
109
109
|
ret = tslib.__assign(tslib.__assign({}, ret), from);
|
|
110
110
|
}
|
|
111
|
-
else
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
else {
|
|
112
|
+
var keys_1;
|
|
113
|
+
var v = isPlainObject__default["default"](value_1) &&
|
|
114
|
+
(keys_1 = Object.keys(value_1)) &&
|
|
115
|
+
keys_1.length === 1 &&
|
|
116
|
+
from[keys_1[0].substring(1)] &&
|
|
117
|
+
Array.isArray(from[keys_1[0].substring(1)])
|
|
118
|
+
? from[keys_1[0].substring(1)].map(function (raw) {
|
|
119
|
+
return dataMapping(value_1[keys_1[0]], object.createObject(from, raw), ignoreFunction, convertKeyToPath, ignoreIfNotMatch);
|
|
119
120
|
})
|
|
120
|
-
: resolveMapping(
|
|
121
|
+
: resolveMapping(value_1, from, undefined, ignoreIfNotMatch);
|
|
121
122
|
if (Array.isArray(v) || typeof v === 'string') {
|
|
122
123
|
ret = v;
|
|
123
124
|
}
|
|
@@ -128,6 +129,13 @@ function dataMapping(to, from, ignoreFunction, convertKeyToPath, ignoreIfNotMatc
|
|
|
128
129
|
ret = tslib.__assign(tslib.__assign({}, ret), v);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
132
|
+
}
|
|
133
|
+
objectKeys.forEach(function (key) {
|
|
134
|
+
var value = to[key];
|
|
135
|
+
if (typeof ignoreFunction === 'function' && ignoreFunction(key, value)) {
|
|
136
|
+
// 如果被ignore,不做数据映射处理。
|
|
137
|
+
object.setVariable(ret, key, value, convertKeyToPath);
|
|
138
|
+
}
|
|
131
139
|
else if (value === '$$') {
|
|
132
140
|
object.setVariable(ret, key, from, convertKeyToPath);
|
|
133
141
|
}
|
package/lib/utils/date.js
CHANGED
package/lib/utils/debug.js
CHANGED
package/lib/utils/dom.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.2.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -219,6 +219,9 @@ function getStyleNumber(element, styleName) {
|
|
|
219
219
|
}
|
|
220
220
|
/** 根据关键字高亮显示文本内容 */
|
|
221
221
|
function renderTextByKeyword(rendererText, curKeyword) {
|
|
222
|
+
if (!rendererText || typeof rendererText !== 'string') {
|
|
223
|
+
return rendererText;
|
|
224
|
+
}
|
|
222
225
|
if (curKeyword && ~rendererText.indexOf(curKeyword)) {
|
|
223
226
|
var keywordStartIndex = rendererText.indexOf(curKeyword);
|
|
224
227
|
var keywordEndIndex = keywordStartIndex + curKeyword.length;
|
package/lib/utils/errors.js
CHANGED
package/lib/utils/escapeHtml.js
CHANGED
package/lib/utils/filter.js
CHANGED