amis-core 3.4.2 → 3.5.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 +12 -2
- package/esm/SchemaRenderer.js +1 -1
- package/esm/Scoped.js +2 -2
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +8 -4
- package/esm/actions/Action.js +1 -1
- 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.d.ts +1 -0
- package/esm/actions/CmptAction.js +23 -23
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -2
- package/esm/actions/DialogAction.js +1 -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/StatusAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.js +9 -9
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +2 -1
- package/esm/components/PopOver.js +2 -2
- package/esm/env.d.ts +11 -3
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +1 -3
- package/esm/index.d.ts +1 -0
- package/esm/index.js +4 -4
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.js +10 -4
- package/esm/renderers/Item.d.ts +2 -6
- package/esm/renderers/Item.js +11 -17
- package/esm/renderers/Options.js +2 -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.js +41 -22
- package/esm/store/app.js +7 -5
- package/esm/store/combo.d.ts +120 -0
- package/esm/store/combo.js +3 -2
- package/esm/store/crud.d.ts +13 -2
- package/esm/store/crud.js +88 -23
- package/esm/store/form.d.ts +50 -0
- package/esm/store/form.js +5 -2
- package/esm/store/formItem.d.ts +1 -0
- package/esm/store/formItem.js +18 -6
- package/esm/store/iRenderer.js +2 -2
- 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 +1 -1
- package/esm/store/root.js +2 -2
- package/esm/store/service.js +1 -1
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +454 -83
- package/esm/store/table.js +114 -74
- package/esm/store/table2.d.ts +1 -1
- package/esm/store/table2.js +5 -4
- 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 +2 -1
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.d.ts +2 -1
- package/esm/utils/attachmentAdpator.js +17 -11
- 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.d.ts +1 -1
- package/esm/utils/debug.js +5 -3
- package/esm/utils/decodeEntity.js +1 -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.d.ts +8 -0
- package/esm/utils/filter-schema.js +32 -14
- 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 +2 -1
- package/esm/utils/helper.d.ts +15 -1
- package/esm/utils/helper.js +59 -12
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -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/math.js +1 -1
- package/esm/utils/memoryParse.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 +1 -1
- package/esm/utils/replaceText.d.ts +1 -1
- package/esm/utils/replaceText.js +9 -4
- 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 +5 -4
- 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.js +12 -2
- package/lib/SchemaRenderer.js +1 -1
- package/lib/Scoped.js +2 -2
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +8 -4
- package/lib/actions/Action.js +1 -1
- 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.d.ts +1 -0
- package/lib/actions/CmptAction.js +23 -23
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +2 -2
- package/lib/actions/DialogAction.js +1 -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/StatusAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.js +9 -9
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +2 -1
- package/lib/components/PopOver.js +2 -2
- package/lib/env.d.ts +11 -3
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +1 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -2
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.js +10 -4
- package/lib/renderers/Item.d.ts +2 -6
- package/lib/renderers/Item.js +11 -17
- package/lib/renderers/Options.js +2 -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.js +41 -22
- package/lib/store/app.js +6 -4
- package/lib/store/combo.d.ts +144 -25
- package/lib/store/combo.js +3 -2
- package/lib/store/crud.d.ts +13 -2
- package/lib/store/crud.js +88 -23
- package/lib/store/form.d.ts +60 -11
- package/lib/store/form.js +5 -2
- package/lib/store/formItem.d.ts +1 -0
- package/lib/store/formItem.js +16 -4
- package/lib/store/iRenderer.js +2 -2
- 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 +1 -1
- package/lib/store/root.js +2 -2
- package/lib/store/service.js +1 -1
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +474 -104
- package/lib/store/table.js +112 -72
- package/lib/store/table2.d.ts +1 -1
- package/lib/store/table2.js +5 -4
- 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 +2 -1
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.d.ts +2 -1
- package/lib/utils/attachmentAdpator.js +17 -11
- 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.d.ts +1 -1
- package/lib/utils/debug.js +4 -2
- package/lib/utils/decodeEntity.js +1 -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.d.ts +8 -0
- package/lib/utils/filter-schema.js +31 -13
- 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 +2 -1
- package/lib/utils/helper.d.ts +15 -1
- package/lib/utils/helper.js +62 -11
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -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/math.js +1 -1
- package/lib/utils/memoryParse.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 +1 -1
- package/lib/utils/replaceText.d.ts +1 -1
- package/lib/utils/replaceText.js +9 -4
- 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 +6 -4
- 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 +4 -3
package/esm/store/combo.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.5.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { types } from 'mobx-state-tree';
|
|
7
7
|
import { iRendererStore } from './iRenderer.js';
|
|
8
8
|
import { getStoreById } from './manager.js';
|
|
9
|
+
import { countTree } from '../utils/helper.js';
|
|
9
10
|
|
|
10
11
|
var UniqueGroup = types
|
|
11
12
|
.model('UniqueGroup', {
|
|
@@ -54,7 +55,7 @@ var ComboStore = iRendererStore
|
|
|
54
55
|
if (isFull_1 || !item.items.length) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
var total = item.items[0].options.
|
|
58
|
+
var total = countTree(item.items[0].options, function (item) { return typeof item.value !== 'undefined'; });
|
|
58
59
|
var current = item.items.reduce(function (total, item) {
|
|
59
60
|
return total + item.selectedOptions.length;
|
|
60
61
|
}, 0);
|
package/esm/store/crud.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { Instance } from 'mobx-state-tree';
|
|
2
2
|
import { Api, fetchOptions, ActionObject } from '../types';
|
|
3
|
+
interface MatchFunc {
|
|
4
|
+
(items: any, itemsRaw: any,
|
|
5
|
+
/** 相关配置 */
|
|
6
|
+
options?: {
|
|
7
|
+
query: Record<string, any>;
|
|
8
|
+
columns: any;
|
|
9
|
+
}): any;
|
|
10
|
+
}
|
|
3
11
|
export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
4
12
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
5
13
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -106,7 +114,6 @@ export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
|
106
114
|
fetchInitData: (api: Api, data?: object, options?: fetchOptions & {
|
|
107
115
|
forceReload?: boolean;
|
|
108
116
|
loadDataOnce?: boolean;
|
|
109
|
-
loadDataOnceFetchOnFilter?: boolean;
|
|
110
117
|
source?: string;
|
|
111
118
|
loadDataMode?: boolean;
|
|
112
119
|
syncResponse2Query?: boolean;
|
|
@@ -122,7 +129,10 @@ export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
|
122
129
|
setSelectedItems: (items: Array<any>) => void;
|
|
123
130
|
setUnSelectedItems: (items: Array<any>) => void;
|
|
124
131
|
setInnerModalOpened: (value: boolean) => void;
|
|
125
|
-
initFromScope: (scope: any, source: string
|
|
132
|
+
initFromScope: (scope: any, source: string, options: {
|
|
133
|
+
columns?: any[] | undefined;
|
|
134
|
+
matchFunc?: MatchFunc | null | undefined;
|
|
135
|
+
}) => void;
|
|
126
136
|
exportAsCSV: (options?: {
|
|
127
137
|
loadDataOnce?: boolean | undefined;
|
|
128
138
|
api?: Api | undefined;
|
|
@@ -133,3 +143,4 @@ export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
|
133
143
|
updateTotal: (total: number) => void;
|
|
134
144
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
135
145
|
export type ICRUDStore = Instance<typeof CRUDStore>;
|
|
146
|
+
export {};
|
package/esm/store/crud.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.5.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -59,7 +59,11 @@ var CRUDStore = ServiceStore.named('CRUDStore')
|
|
|
59
59
|
// 包两层,主要是为了处理以下 case
|
|
60
60
|
// 里面放了个 form,form 提交过来的时候不希望把 items 这些发送过来。
|
|
61
61
|
// 因为会把数据呈现在地址栏上。
|
|
62
|
-
return createObject(createObject(self.data,
|
|
62
|
+
return createObject(createObject(self.data, {
|
|
63
|
+
items: self.items.concat(),
|
|
64
|
+
selectedItems: self.selectedItems.concat(),
|
|
65
|
+
unSelectedItems: self.unSelectedItems.concat()
|
|
66
|
+
}), __assign({}, self.query));
|
|
63
67
|
},
|
|
64
68
|
get mergedData() {
|
|
65
69
|
return extendObject(self.data, __assign(__assign(__assign({}, self.query), self.data), { selectedItems: self.selectedItems, unSelectedItems: self.unSelectedItems }));
|
|
@@ -99,7 +103,7 @@ var CRUDStore = ServiceStore.named('CRUDStore')
|
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
var fetchInitData = flow(function getInitData(api, data, options) {
|
|
102
|
-
var items_1, dir, data_1, ctx, json, result, total, count, page, hasNext, oItems, oRows, columns, rest, items, _a, _b, key, rowsData, data_2, filteredItems_1, dir, e_1, env;
|
|
106
|
+
var matchFunc, items_1, dir, data_1, ctx, json, result, total, count, page, hasNext, oItems, oRows, columns, rest, items, _a, _b, key, rowsData, data_2, filteredItems_1, dir, e_1, env;
|
|
103
107
|
var _c, e_2, _d;
|
|
104
108
|
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
105
109
|
if (options === void 0) { options = {}; }
|
|
@@ -108,27 +112,37 @@ var CRUDStore = ServiceStore.named('CRUDStore')
|
|
|
108
112
|
case 0:
|
|
109
113
|
_q.trys.push([0, 2, , 3]);
|
|
110
114
|
if (!options.forceReload && options.loadDataOnce && self.total) {
|
|
115
|
+
matchFunc = options.matchFunc;
|
|
111
116
|
items_1 = options.source
|
|
112
117
|
? resolveVariableAndFilter(options.source, createObject(self.mergedData, {
|
|
113
118
|
items: self.data.itemsRaw,
|
|
114
119
|
rows: self.data.itemsRaw
|
|
115
120
|
}), '| raw')
|
|
116
121
|
: self.items.concat();
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
/** 字段的格式类型无法穷举,所以支持使用函数过滤 */
|
|
123
|
+
if (matchFunc && typeof matchFunc === 'function') {
|
|
124
|
+
items_1 = matchFunc(items_1, self.data.itemsRaw, {
|
|
125
|
+
query: self.query,
|
|
126
|
+
columns: options.columns
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
if (Array.isArray(options.columns)) {
|
|
131
|
+
options.columns.forEach(function (column) {
|
|
132
|
+
var value = typeof column.name === 'string'
|
|
133
|
+
? getVariable(self.query, column.name)
|
|
134
|
+
: undefined;
|
|
135
|
+
var key = column.name;
|
|
136
|
+
if (value != null && key) {
|
|
137
|
+
// value可能为null、undefined、''、0
|
|
125
138
|
if (Array.isArray(value)) {
|
|
126
139
|
if (value.length > 0) {
|
|
127
140
|
var arr_1 = __spreadArray([], __read(items_1), false);
|
|
128
141
|
var arrItems_1 = [];
|
|
129
142
|
value.forEach(function (item) {
|
|
130
143
|
arrItems_1 = __spreadArray(__spreadArray([], __read(arrItems_1), false), __read(matchSorter(arr_1, item, {
|
|
131
|
-
keys: [key]
|
|
144
|
+
keys: [key],
|
|
145
|
+
threshold: matchSorter.rankings.CONTAINS
|
|
132
146
|
})), false);
|
|
133
147
|
});
|
|
134
148
|
items_1 = items_1.filter(function (item) {
|
|
@@ -138,12 +152,13 @@ var CRUDStore = ServiceStore.named('CRUDStore')
|
|
|
138
152
|
}
|
|
139
153
|
else {
|
|
140
154
|
items_1 = matchSorter(items_1, value, {
|
|
141
|
-
keys: [key]
|
|
155
|
+
keys: [key],
|
|
156
|
+
threshold: matchSorter.rankings.CONTAINS
|
|
142
157
|
});
|
|
143
158
|
}
|
|
144
159
|
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
147
162
|
}
|
|
148
163
|
if (self.query.orderBy) {
|
|
149
164
|
dir = /desc/i.test(self.query.orderDir) ? -1 : 1;
|
|
@@ -250,7 +265,8 @@ var CRUDStore = ServiceStore.named('CRUDStore')
|
|
|
250
265
|
var arrItems_2 = [];
|
|
251
266
|
value.forEach(function (item) {
|
|
252
267
|
arrItems_2 = __spreadArray(__spreadArray([], __read(arrItems_2), false), __read(matchSorter(arr_2, item, {
|
|
253
|
-
keys: [key]
|
|
268
|
+
keys: [key],
|
|
269
|
+
threshold: matchSorter.rankings.CONTAINS
|
|
254
270
|
})), false);
|
|
255
271
|
});
|
|
256
272
|
filteredItems_1 = filteredItems_1.filter(function (item) {
|
|
@@ -260,7 +276,8 @@ var CRUDStore = ServiceStore.named('CRUDStore')
|
|
|
260
276
|
}
|
|
261
277
|
else {
|
|
262
278
|
filteredItems_1 = matchSorter(filteredItems_1, value, {
|
|
263
|
-
keys: [key]
|
|
279
|
+
keys: [key],
|
|
280
|
+
threshold: matchSorter.rankings.CONTAINS
|
|
264
281
|
});
|
|
265
282
|
}
|
|
266
283
|
}
|
|
@@ -407,14 +424,62 @@ var CRUDStore = ServiceStore.named('CRUDStore')
|
|
|
407
424
|
var setInnerModalOpened = function (value) {
|
|
408
425
|
self.hasInnerModalOpen = value;
|
|
409
426
|
};
|
|
410
|
-
var initFromScope = function (scope, source) {
|
|
411
|
-
var
|
|
412
|
-
|
|
427
|
+
var initFromScope = function (scope, source, options) {
|
|
428
|
+
var _a;
|
|
429
|
+
var matchFunc = options.matchFunc;
|
|
430
|
+
var items = resolveVariableAndFilter(source, scope, '| raw');
|
|
431
|
+
if (!Array.isArray(items) && !self.items.length) {
|
|
413
432
|
return;
|
|
414
433
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
434
|
+
items = Array.isArray(items) ? items : [];
|
|
435
|
+
/** 字段的格式类型无法穷举,所以支持使用函数过滤 */
|
|
436
|
+
if (matchFunc && typeof matchFunc === 'function') {
|
|
437
|
+
items = matchFunc(items, items.concat(), {
|
|
438
|
+
query: self.query,
|
|
439
|
+
columns: options.columns
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
if (Array.isArray(options.columns)) {
|
|
444
|
+
options.columns.forEach(function (column) {
|
|
445
|
+
var value = typeof column.name === 'string'
|
|
446
|
+
? getVariable(self.query, column.name)
|
|
447
|
+
: undefined;
|
|
448
|
+
var key = column.name;
|
|
449
|
+
if (value != null && key) {
|
|
450
|
+
// value可能为null、undefined、''、0
|
|
451
|
+
if (Array.isArray(value)) {
|
|
452
|
+
if (value.length > 0) {
|
|
453
|
+
var arr_3 = __spreadArray([], __read(items), false);
|
|
454
|
+
var arrItems_3 = [];
|
|
455
|
+
value.forEach(function (item) {
|
|
456
|
+
arrItems_3 = __spreadArray(__spreadArray([], __read(arrItems_3), false), __read(matchSorter(arr_3, item, {
|
|
457
|
+
keys: [key],
|
|
458
|
+
threshold: matchSorter.rankings.CONTAINS
|
|
459
|
+
})), false);
|
|
460
|
+
});
|
|
461
|
+
items = items.filter(function (item) {
|
|
462
|
+
return arrItems_3.find(function (a) { return a === item; });
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
items = matchSorter(items, value, {
|
|
468
|
+
keys: [key],
|
|
469
|
+
threshold: matchSorter.rankings.CONTAINS
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (self.query.orderBy) {
|
|
477
|
+
var dir = /desc/i.test(self.query.orderDir) ? -1 : 1;
|
|
478
|
+
items = sortArray(items, self.query.orderBy, dir);
|
|
479
|
+
}
|
|
480
|
+
var data = __assign(__assign({}, self.pristine), { items: items.slice((self.page - 1) * self.perPage, self.page * self.perPage), count: items.length, total: items.length });
|
|
481
|
+
self.total = parseInt((_a = data.total) !== null && _a !== void 0 ? _a : data.count, 10) || 0;
|
|
482
|
+
self.items.replace(items);
|
|
418
483
|
self.reInitData(data);
|
|
419
484
|
};
|
|
420
485
|
var exportAsCSV = function (options) {
|
package/esm/store/form.d.ts
CHANGED
|
@@ -163,6 +163,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
163
163
|
readonly lastSelectValue: string;
|
|
164
164
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
165
165
|
splitExtraValue(value: any): any[];
|
|
166
|
+
getMergedData(data: any): any;
|
|
166
167
|
} & {
|
|
167
168
|
focus: () => void;
|
|
168
169
|
blur: () => void;
|
|
@@ -306,6 +307,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
306
307
|
readonly lastSelectValue: string;
|
|
307
308
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
308
309
|
splitExtraValue(value: any): any[];
|
|
310
|
+
getMergedData(data: any): any;
|
|
309
311
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
310
312
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
311
313
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -383,6 +385,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
383
385
|
readonly lastSelectValue: string;
|
|
384
386
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
385
387
|
splitExtraValue(value: any): any[];
|
|
388
|
+
getMergedData(data: any): any;
|
|
386
389
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
387
390
|
removeSubFormItem: (item: {
|
|
388
391
|
id: string;
|
|
@@ -464,6 +467,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
464
467
|
readonly lastSelectValue: string;
|
|
465
468
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
466
469
|
splitExtraValue(value: any): any[];
|
|
470
|
+
getMergedData(data: any): any;
|
|
467
471
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
468
472
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
469
473
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -541,6 +545,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
541
545
|
readonly lastSelectValue: string;
|
|
542
546
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
543
547
|
splitExtraValue(value: any): any[];
|
|
548
|
+
getMergedData(data: any): any;
|
|
544
549
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
545
550
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
546
551
|
setIsControlled: (value: any) => void;
|
|
@@ -621,6 +626,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
621
626
|
readonly lastSelectValue: string;
|
|
622
627
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
623
628
|
splitExtraValue(value: any): any[];
|
|
629
|
+
getMergedData(data: any): any;
|
|
624
630
|
} & {
|
|
625
631
|
focus: () => void;
|
|
626
632
|
blur: () => void;
|
|
@@ -764,6 +770,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
764
770
|
readonly lastSelectValue: string;
|
|
765
771
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
766
772
|
splitExtraValue(value: any): any[];
|
|
773
|
+
getMergedData(data: any): any;
|
|
767
774
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
768
775
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
769
776
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -841,6 +848,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
841
848
|
readonly lastSelectValue: string;
|
|
842
849
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
843
850
|
splitExtraValue(value: any): any[];
|
|
851
|
+
getMergedData(data: any): any;
|
|
844
852
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
845
853
|
removeSubFormItem: (item: {
|
|
846
854
|
id: string;
|
|
@@ -922,6 +930,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
922
930
|
readonly lastSelectValue: string;
|
|
923
931
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
924
932
|
splitExtraValue(value: any): any[];
|
|
933
|
+
getMergedData(data: any): any;
|
|
925
934
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
926
935
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
927
936
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -999,6 +1008,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
999
1008
|
readonly lastSelectValue: string;
|
|
1000
1009
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1001
1010
|
splitExtraValue(value: any): any[];
|
|
1011
|
+
getMergedData(data: any): any;
|
|
1002
1012
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
1003
1013
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
1004
1014
|
setIsControlled: (value: any) => void;
|
|
@@ -1084,6 +1094,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1084
1094
|
readonly lastSelectValue: string;
|
|
1085
1095
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1086
1096
|
splitExtraValue(value: any): any[];
|
|
1097
|
+
getMergedData(data: any): any;
|
|
1087
1098
|
} & {
|
|
1088
1099
|
focus: () => void;
|
|
1089
1100
|
blur: () => void;
|
|
@@ -1227,6 +1238,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1227
1238
|
readonly lastSelectValue: string;
|
|
1228
1239
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1229
1240
|
splitExtraValue(value: any): any[];
|
|
1241
|
+
getMergedData(data: any): any;
|
|
1230
1242
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
1231
1243
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
1232
1244
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -1304,6 +1316,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1304
1316
|
readonly lastSelectValue: string;
|
|
1305
1317
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1306
1318
|
splitExtraValue(value: any): any[];
|
|
1319
|
+
getMergedData(data: any): any;
|
|
1307
1320
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
1308
1321
|
removeSubFormItem: (item: {
|
|
1309
1322
|
id: string;
|
|
@@ -1385,6 +1398,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1385
1398
|
readonly lastSelectValue: string;
|
|
1386
1399
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1387
1400
|
splitExtraValue(value: any): any[];
|
|
1401
|
+
getMergedData(data: any): any;
|
|
1388
1402
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
1389
1403
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
1390
1404
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -1462,6 +1476,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1462
1476
|
readonly lastSelectValue: string;
|
|
1463
1477
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1464
1478
|
splitExtraValue(value: any): any[];
|
|
1479
|
+
getMergedData(data: any): any;
|
|
1465
1480
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
1466
1481
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
1467
1482
|
setIsControlled: (value: any) => void;
|
|
@@ -1542,6 +1557,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1542
1557
|
readonly lastSelectValue: string;
|
|
1543
1558
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1544
1559
|
splitExtraValue(value: any): any[];
|
|
1560
|
+
getMergedData(data: any): any;
|
|
1545
1561
|
} & {
|
|
1546
1562
|
focus: () => void;
|
|
1547
1563
|
blur: () => void;
|
|
@@ -1685,6 +1701,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1685
1701
|
readonly lastSelectValue: string;
|
|
1686
1702
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1687
1703
|
splitExtraValue(value: any): any[];
|
|
1704
|
+
getMergedData(data: any): any;
|
|
1688
1705
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
1689
1706
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
1690
1707
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -1762,6 +1779,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1762
1779
|
readonly lastSelectValue: string;
|
|
1763
1780
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1764
1781
|
splitExtraValue(value: any): any[];
|
|
1782
|
+
getMergedData(data: any): any;
|
|
1765
1783
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
1766
1784
|
removeSubFormItem: (item: {
|
|
1767
1785
|
id: string;
|
|
@@ -1843,6 +1861,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1843
1861
|
readonly lastSelectValue: string;
|
|
1844
1862
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1845
1863
|
splitExtraValue(value: any): any[];
|
|
1864
|
+
getMergedData(data: any): any;
|
|
1846
1865
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
1847
1866
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
1848
1867
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -1920,6 +1939,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1920
1939
|
readonly lastSelectValue: string;
|
|
1921
1940
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
1922
1941
|
splitExtraValue(value: any): any[];
|
|
1942
|
+
getMergedData(data: any): any;
|
|
1923
1943
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
1924
1944
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
1925
1945
|
setIsControlled: (value: any) => void;
|
|
@@ -2009,6 +2029,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2009
2029
|
readonly lastSelectValue: string;
|
|
2010
2030
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2011
2031
|
splitExtraValue(value: any): any[];
|
|
2032
|
+
getMergedData(data: any): any;
|
|
2012
2033
|
} & {
|
|
2013
2034
|
focus: () => void;
|
|
2014
2035
|
blur: () => void;
|
|
@@ -2152,6 +2173,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2152
2173
|
readonly lastSelectValue: string;
|
|
2153
2174
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2154
2175
|
splitExtraValue(value: any): any[];
|
|
2176
|
+
getMergedData(data: any): any;
|
|
2155
2177
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
2156
2178
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
2157
2179
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -2229,6 +2251,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2229
2251
|
readonly lastSelectValue: string;
|
|
2230
2252
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2231
2253
|
splitExtraValue(value: any): any[];
|
|
2254
|
+
getMergedData(data: any): any;
|
|
2232
2255
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
2233
2256
|
removeSubFormItem: (item: {
|
|
2234
2257
|
id: string;
|
|
@@ -2310,6 +2333,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2310
2333
|
readonly lastSelectValue: string;
|
|
2311
2334
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2312
2335
|
splitExtraValue(value: any): any[];
|
|
2336
|
+
getMergedData(data: any): any;
|
|
2313
2337
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
2314
2338
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
2315
2339
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -2387,6 +2411,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2387
2411
|
readonly lastSelectValue: string;
|
|
2388
2412
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2389
2413
|
splitExtraValue(value: any): any[];
|
|
2414
|
+
getMergedData(data: any): any;
|
|
2390
2415
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
2391
2416
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
2392
2417
|
setIsControlled: (value: any) => void;
|
|
@@ -2467,6 +2492,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2467
2492
|
readonly lastSelectValue: string;
|
|
2468
2493
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2469
2494
|
splitExtraValue(value: any): any[];
|
|
2495
|
+
getMergedData(data: any): any;
|
|
2470
2496
|
} & {
|
|
2471
2497
|
focus: () => void;
|
|
2472
2498
|
blur: () => void;
|
|
@@ -2610,6 +2636,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2610
2636
|
readonly lastSelectValue: string;
|
|
2611
2637
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2612
2638
|
splitExtraValue(value: any): any[];
|
|
2639
|
+
getMergedData(data: any): any;
|
|
2613
2640
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
2614
2641
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
2615
2642
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -2687,6 +2714,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2687
2714
|
readonly lastSelectValue: string;
|
|
2688
2715
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2689
2716
|
splitExtraValue(value: any): any[];
|
|
2717
|
+
getMergedData(data: any): any;
|
|
2690
2718
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
2691
2719
|
removeSubFormItem: (item: {
|
|
2692
2720
|
id: string;
|
|
@@ -2768,6 +2796,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2768
2796
|
readonly lastSelectValue: string;
|
|
2769
2797
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2770
2798
|
splitExtraValue(value: any): any[];
|
|
2799
|
+
getMergedData(data: any): any;
|
|
2771
2800
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
2772
2801
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
2773
2802
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -2845,6 +2874,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2845
2874
|
readonly lastSelectValue: string;
|
|
2846
2875
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2847
2876
|
splitExtraValue(value: any): any[];
|
|
2877
|
+
getMergedData(data: any): any;
|
|
2848
2878
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
2849
2879
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
2850
2880
|
setIsControlled: (value: any) => void;
|
|
@@ -2929,6 +2959,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2929
2959
|
readonly lastSelectValue: string;
|
|
2930
2960
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
2931
2961
|
splitExtraValue(value: any): any[];
|
|
2962
|
+
getMergedData(data: any): any;
|
|
2932
2963
|
} & {
|
|
2933
2964
|
focus: () => void;
|
|
2934
2965
|
blur: () => void;
|
|
@@ -3072,6 +3103,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3072
3103
|
readonly lastSelectValue: string;
|
|
3073
3104
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3074
3105
|
splitExtraValue(value: any): any[];
|
|
3106
|
+
getMergedData(data: any): any;
|
|
3075
3107
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
3076
3108
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
3077
3109
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -3149,6 +3181,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3149
3181
|
readonly lastSelectValue: string;
|
|
3150
3182
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3151
3183
|
splitExtraValue(value: any): any[];
|
|
3184
|
+
getMergedData(data: any): any;
|
|
3152
3185
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
3153
3186
|
removeSubFormItem: (item: {
|
|
3154
3187
|
id: string;
|
|
@@ -3230,6 +3263,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3230
3263
|
readonly lastSelectValue: string;
|
|
3231
3264
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3232
3265
|
splitExtraValue(value: any): any[];
|
|
3266
|
+
getMergedData(data: any): any;
|
|
3233
3267
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
3234
3268
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
3235
3269
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -3307,6 +3341,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3307
3341
|
readonly lastSelectValue: string;
|
|
3308
3342
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3309
3343
|
splitExtraValue(value: any): any[];
|
|
3344
|
+
getMergedData(data: any): any;
|
|
3310
3345
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
3311
3346
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
3312
3347
|
setIsControlled: (value: any) => void;
|
|
@@ -3387,6 +3422,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3387
3422
|
readonly lastSelectValue: string;
|
|
3388
3423
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3389
3424
|
splitExtraValue(value: any): any[];
|
|
3425
|
+
getMergedData(data: any): any;
|
|
3390
3426
|
} & {
|
|
3391
3427
|
focus: () => void;
|
|
3392
3428
|
blur: () => void;
|
|
@@ -3530,6 +3566,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3530
3566
|
readonly lastSelectValue: string;
|
|
3531
3567
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3532
3568
|
splitExtraValue(value: any): any[];
|
|
3569
|
+
getMergedData(data: any): any;
|
|
3533
3570
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
3534
3571
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
3535
3572
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -3607,6 +3644,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3607
3644
|
readonly lastSelectValue: string;
|
|
3608
3645
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3609
3646
|
splitExtraValue(value: any): any[];
|
|
3647
|
+
getMergedData(data: any): any;
|
|
3610
3648
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
3611
3649
|
removeSubFormItem: (item: {
|
|
3612
3650
|
id: string;
|
|
@@ -3688,6 +3726,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3688
3726
|
readonly lastSelectValue: string;
|
|
3689
3727
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3690
3728
|
splitExtraValue(value: any): any[];
|
|
3729
|
+
getMergedData(data: any): any;
|
|
3691
3730
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
3692
3731
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
3693
3732
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -3765,6 +3804,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3765
3804
|
readonly lastSelectValue: string;
|
|
3766
3805
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3767
3806
|
splitExtraValue(value: any): any[];
|
|
3807
|
+
getMergedData(data: any): any;
|
|
3768
3808
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
3769
3809
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
3770
3810
|
setIsControlled: (value: any) => void;
|
|
@@ -3849,6 +3889,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3849
3889
|
readonly lastSelectValue: string;
|
|
3850
3890
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3851
3891
|
splitExtraValue(value: any): any[];
|
|
3892
|
+
getMergedData(data: any): any;
|
|
3852
3893
|
} & {
|
|
3853
3894
|
focus: () => void;
|
|
3854
3895
|
blur: () => void;
|
|
@@ -3992,6 +4033,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3992
4033
|
readonly lastSelectValue: string;
|
|
3993
4034
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
3994
4035
|
splitExtraValue(value: any): any[];
|
|
4036
|
+
getMergedData(data: any): any;
|
|
3995
4037
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
3996
4038
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
3997
4039
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -4069,6 +4111,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4069
4111
|
readonly lastSelectValue: string;
|
|
4070
4112
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4071
4113
|
splitExtraValue(value: any): any[];
|
|
4114
|
+
getMergedData(data: any): any;
|
|
4072
4115
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
4073
4116
|
removeSubFormItem: (item: {
|
|
4074
4117
|
id: string;
|
|
@@ -4150,6 +4193,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4150
4193
|
readonly lastSelectValue: string;
|
|
4151
4194
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4152
4195
|
splitExtraValue(value: any): any[];
|
|
4196
|
+
getMergedData(data: any): any;
|
|
4153
4197
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
4154
4198
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
4155
4199
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -4227,6 +4271,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4227
4271
|
readonly lastSelectValue: string;
|
|
4228
4272
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4229
4273
|
splitExtraValue(value: any): any[];
|
|
4274
|
+
getMergedData(data: any): any;
|
|
4230
4275
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
4231
4276
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
4232
4277
|
setIsControlled: (value: any) => void;
|
|
@@ -4307,6 +4352,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4307
4352
|
readonly lastSelectValue: string;
|
|
4308
4353
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4309
4354
|
splitExtraValue(value: any): any[];
|
|
4355
|
+
getMergedData(data: any): any;
|
|
4310
4356
|
} & {
|
|
4311
4357
|
focus: () => void;
|
|
4312
4358
|
blur: () => void;
|
|
@@ -4450,6 +4496,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4450
4496
|
readonly lastSelectValue: string;
|
|
4451
4497
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4452
4498
|
splitExtraValue(value: any): any[];
|
|
4499
|
+
getMergedData(data: any): any;
|
|
4453
4500
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
4454
4501
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
4455
4502
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -4527,6 +4574,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4527
4574
|
readonly lastSelectValue: string;
|
|
4528
4575
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4529
4576
|
splitExtraValue(value: any): any[];
|
|
4577
|
+
getMergedData(data: any): any;
|
|
4530
4578
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
4531
4579
|
removeSubFormItem: (item: {
|
|
4532
4580
|
id: string;
|
|
@@ -4608,6 +4656,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4608
4656
|
readonly lastSelectValue: string;
|
|
4609
4657
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4610
4658
|
splitExtraValue(value: any): any[];
|
|
4659
|
+
getMergedData(data: any): any;
|
|
4611
4660
|
} & any & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
4612
4661
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
4613
4662
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -4685,6 +4734,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4685
4734
|
readonly lastSelectValue: string;
|
|
4686
4735
|
getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any;
|
|
4687
4736
|
splitExtraValue(value: any): any[];
|
|
4737
|
+
getMergedData(data: any): any;
|
|
4688
4738
|
} & any, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) => void;
|
|
4689
4739
|
loadAutoUpdateData: (api: Api, data?: object | undefined, silent?: boolean | undefined) => Promise<Payload>;
|
|
4690
4740
|
setIsControlled: (value: any) => void;
|
package/esm/store/form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.5.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -155,7 +155,7 @@ var FormStore = ServiceStore.named('FormStore')
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
item.reset();
|
|
158
|
-
item.validateOnChange && item.validate(self.data);
|
|
158
|
+
self.inited && item.validateOnChange && item.validate(self.data);
|
|
159
159
|
});
|
|
160
160
|
// 同步 options
|
|
161
161
|
syncOptions();
|
|
@@ -604,6 +604,9 @@ var FormStore = ServiceStore.named('FormStore')
|
|
|
604
604
|
if (item.name && item.type !== 'hidden') {
|
|
605
605
|
setVariable(toClear, item.name, item.resetValue);
|
|
606
606
|
}
|
|
607
|
+
if (item.extraName && typeof item.extraName === 'string') {
|
|
608
|
+
setVariable(toClear, item.extraName, item.resetValue);
|
|
609
|
+
}
|
|
607
610
|
});
|
|
608
611
|
setValues(toClear);
|
|
609
612
|
self.validated = false;
|