amis-core 6.11.0-beta.1 → 6.11.0-beta.3
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 +3 -0
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.js +14 -8
- package/esm/SchemaRenderer.d.ts +2 -0
- package/esm/SchemaRenderer.js +32 -9
- package/esm/Scoped.js +1 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/StyleManager.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- 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.js +6 -2
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +1 -1
- package/esm/actions/DialogAction.js +1 -1
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/EventAction.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/PrintAction.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/actions/WaitAction.js +1 -1
- package/esm/components/Animations.js +1 -1
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/ErrorBoundary.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.js +1 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +1 -0
- package/esm/factory.js +1 -1
- package/esm/globalVar.d.ts +173 -0
- package/esm/globalVar.js +122 -0
- package/esm/globalVarClientHandler.d.ts +1 -0
- package/esm/globalVarClientHandler.js +65 -0
- package/esm/globalVarDefaultValueHandler.d.ts +1 -0
- package/esm/globalVarDefaultValueHandler.js +28 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +8 -5
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +3 -1
- package/esm/renderers/Form.js +39 -24
- package/esm/renderers/Item.d.ts +11 -19
- package/esm/renderers/Item.js +17 -2
- 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.js +1 -1
- package/esm/store/app.js +1 -1
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +8 -0
- package/esm/store/crud.js +24 -17
- package/esm/store/form.js +14 -5
- package/esm/store/formItem.js +1 -1
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +14 -1
- package/esm/store/list.js +45 -17
- 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.d.ts +14 -0
- package/esm/store/root.js +483 -12
- package/esm/store/service.js +1 -1
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +16 -2
- package/esm/store/table.js +83 -26
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +3 -2
- 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/animations.js +1 -1
- package/esm/utils/api.d.ts +1 -0
- package/esm/utils/api.js +18 -6
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/browser.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/concatData.js +1 -1
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +3 -2
- 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.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 +5 -0
- package/esm/utils/helper.js +3 -2
- 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/labelToString.js +1 -1
- package/esm/utils/loopTooMuch.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/printElement.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/validateId.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/esm/utils/visitedCache.js +1 -1
- package/lib/Root.d.ts +3 -0
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +13 -7
- package/lib/SchemaRenderer.d.ts +2 -0
- package/lib/SchemaRenderer.js +32 -9
- package/lib/Scoped.js +1 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/StyleManager.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- 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.js +6 -2
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +1 -1
- package/lib/actions/DialogAction.js +1 -1
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/EventAction.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/PrintAction.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/actions/WaitAction.js +1 -1
- package/lib/components/Animations.js +1 -1
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.js +1 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +1 -0
- package/lib/factory.js +1 -1
- package/lib/globalVar.d.ts +173 -0
- package/lib/globalVar.js +130 -0
- package/lib/globalVarClientHandler.d.ts +1 -0
- package/lib/globalVarClientHandler.js +67 -0
- package/lib/globalVarDefaultValueHandler.d.ts +1 -0
- package/lib/globalVarDefaultValueHandler.js +30 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +13 -4
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +3 -1
- package/lib/renderers/Form.js +37 -21
- package/lib/renderers/Item.d.ts +11 -19
- package/lib/renderers/Item.js +17 -2
- 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.js +1 -1
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +25 -24
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +8 -0
- package/lib/store/crud.js +23 -16
- package/lib/store/form.d.ts +10 -10
- package/lib/store/form.js +14 -5
- package/lib/store/formItem.js +1 -1
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +14 -1
- package/lib/store/list.js +44 -16
- 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.d.ts +13 -0
- package/lib/store/root.js +487 -11
- package/lib/store/service.js +1 -1
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +36 -22
- package/lib/store/table.js +82 -25
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +3 -2
- 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/animations.js +1 -1
- package/lib/utils/api.d.ts +1 -0
- package/lib/utils/api.js +18 -5
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/browser.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/concatData.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +3 -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.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 +5 -0
- package/lib/utils/helper.js +3 -2
- 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/labelToString.js +1 -1
- package/lib/utils/loopTooMuch.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/printElement.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/validateId.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/lib/utils/visitedCache.js +1 -1
- package/package.json +2 -2
package/lib/store/crud.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.11.0-beta.
|
|
2
|
+
* amis-core v6.11.0-beta.3
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -69,14 +69,10 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
69
69
|
// 包两层,主要是为了处理以下 case
|
|
70
70
|
// 里面放了个 form,form 提交过来的时候不希望把 items 这些发送过来。
|
|
71
71
|
// 因为会把数据呈现在地址栏上。
|
|
72
|
-
return object.createObject(object.createObject(self.data, {
|
|
73
|
-
items: self.items.concat(),
|
|
74
|
-
selectedItems: self.selectedItems.concat(),
|
|
75
|
-
unSelectedItems: self.unSelectedItems.concat()
|
|
76
|
-
}), tslib.__assign({}, self.query));
|
|
72
|
+
return object.createObject(object.createObject(self.data, this.eventContext), tslib.__assign({}, self.query));
|
|
77
73
|
},
|
|
78
74
|
get mergedData() {
|
|
79
|
-
return object.extendObject(self.data, tslib.__assign(tslib.__assign(tslib.__assign({}, self.query),
|
|
75
|
+
return object.extendObject(self.data, tslib.__assign(tslib.__assign(tslib.__assign({}, self.query), this.eventContext), self.data));
|
|
80
76
|
},
|
|
81
77
|
get hasModalOpened() {
|
|
82
78
|
return self.dialogOpen || self.drawerOpen || self.hasInnerModalOpen;
|
|
@@ -84,9 +80,24 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
84
80
|
get selectedItemsAsArray() {
|
|
85
81
|
return self.selectedItems.concat();
|
|
86
82
|
},
|
|
83
|
+
get itemsAsArray() {
|
|
84
|
+
return self.items.concat();
|
|
85
|
+
},
|
|
87
86
|
fetchCtxOf: function (data, options) {
|
|
88
87
|
var _a;
|
|
89
88
|
return object.createObject(data, tslib.__assign(tslib.__assign(tslib.__assign({}, self.query), (_a = {}, _a[options.pageField || 'page'] = self.page, _a[options.perPageField || 'perPage'] = self.perPage, _a)), data));
|
|
89
|
+
},
|
|
90
|
+
get eventContext() {
|
|
91
|
+
var context = {
|
|
92
|
+
items: self.items.concat(),
|
|
93
|
+
selectedItems: self.selectedItems.concat(),
|
|
94
|
+
unSelectedItems: self.unSelectedItems.concat(),
|
|
95
|
+
selectedIndexes: self.selectedItems.map(function (item) {
|
|
96
|
+
var _a;
|
|
97
|
+
return ((_a = helper.findTreeIndex(self.items, function (i) { return (item.__pristine || item) === (i.__pristine || i); })) === null || _a === void 0 ? void 0 : _a.join('.')) || '-1';
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
return context;
|
|
90
101
|
}
|
|
91
102
|
}); })
|
|
92
103
|
.actions(function (self) {
|
|
@@ -502,14 +513,7 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
502
513
|
});
|
|
503
514
|
};
|
|
504
515
|
var getData = function (superData) {
|
|
505
|
-
return object.createObject(superData, {
|
|
506
|
-
total: self.total,
|
|
507
|
-
page: self.page,
|
|
508
|
-
perPage: self.perPage,
|
|
509
|
-
items: self.items.concat(),
|
|
510
|
-
selectedItems: self.selectedItems.concat(),
|
|
511
|
-
unSelectedItems: self.unSelectedItems.concat()
|
|
512
|
-
});
|
|
516
|
+
return object.createObject(superData, tslib.__assign({ total: self.total, page: self.page, perPage: self.perPage }, self.eventContext));
|
|
513
517
|
};
|
|
514
518
|
var updateColumns = function (columns) {
|
|
515
519
|
self.columns = columns;
|
|
@@ -548,7 +552,10 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
548
552
|
exportAsCSV: exportAsCSV,
|
|
549
553
|
updateColumns: updateColumns,
|
|
550
554
|
updateTotal: updateTotal,
|
|
551
|
-
resetSelection: resetSelection
|
|
555
|
+
resetSelection: resetSelection,
|
|
556
|
+
replaceItems: function (items) {
|
|
557
|
+
self.items.replace(items);
|
|
558
|
+
}
|
|
552
559
|
};
|
|
553
560
|
});
|
|
554
561
|
|
package/lib/store/form.d.ts
CHANGED
|
@@ -252,7 +252,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
252
252
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
253
253
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
254
254
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
255
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
255
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
256
256
|
changeEmitedValue: (value: any) => void;
|
|
257
257
|
addSubFormItem: (item: {
|
|
258
258
|
id: string;
|
|
@@ -787,7 +787,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
787
787
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
788
788
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
789
789
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
790
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
790
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
791
791
|
changeEmitedValue: (value: any) => void;
|
|
792
792
|
addSubFormItem: (item: {
|
|
793
793
|
id: string;
|
|
@@ -1327,7 +1327,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1327
1327
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
1328
1328
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
1329
1329
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
1330
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
1330
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
1331
1331
|
changeEmitedValue: (value: any) => void;
|
|
1332
1332
|
addSubFormItem: (item: {
|
|
1333
1333
|
id: string;
|
|
@@ -1862,7 +1862,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
1862
1862
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
1863
1863
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
1864
1864
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
1865
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
1865
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
1866
1866
|
changeEmitedValue: (value: any) => void;
|
|
1867
1867
|
addSubFormItem: (item: {
|
|
1868
1868
|
id: string;
|
|
@@ -2406,7 +2406,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2406
2406
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
2407
2407
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
2408
2408
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
2409
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
2409
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
2410
2410
|
changeEmitedValue: (value: any) => void;
|
|
2411
2411
|
addSubFormItem: (item: {
|
|
2412
2412
|
id: string;
|
|
@@ -2941,7 +2941,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
2941
2941
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
2942
2942
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
2943
2943
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
2944
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
2944
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
2945
2945
|
changeEmitedValue: (value: any) => void;
|
|
2946
2946
|
addSubFormItem: (item: {
|
|
2947
2947
|
id: string;
|
|
@@ -3480,7 +3480,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
3480
3480
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
3481
3481
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
3482
3482
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
3483
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
3483
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
3484
3484
|
changeEmitedValue: (value: any) => void;
|
|
3485
3485
|
addSubFormItem: (item: {
|
|
3486
3486
|
id: string;
|
|
@@ -4015,7 +4015,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4015
4015
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
4016
4016
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
4017
4017
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
4018
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
4018
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
4019
4019
|
changeEmitedValue: (value: any) => void;
|
|
4020
4020
|
addSubFormItem: (item: {
|
|
4021
4021
|
id: string;
|
|
@@ -4554,7 +4554,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
4554
4554
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
4555
4555
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
4556
4556
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
4557
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
4557
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
4558
4558
|
changeEmitedValue: (value: any) => void;
|
|
4559
4559
|
addSubFormItem: (item: {
|
|
4560
4560
|
id: string;
|
|
@@ -5089,7 +5089,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
5089
5089
|
closeDialog: (confirmed?: any, result?: any) => void;
|
|
5090
5090
|
openPopOver: (schema: any, ctx: any, callback?: ((confirmed?: any, value?: any) => void) | undefined) => void;
|
|
5091
5091
|
closePopOver: (confirmed?: any, result?: any) => void;
|
|
5092
|
-
changeTmpValue: (value: any, changeReason?: "input" | "
|
|
5092
|
+
changeTmpValue: (value: any, changeReason?: "input" | "formInited" | "defaultValue" | "initialValue" | "dataChanged" | "formulaChanged" | "controlled" | undefined) => void;
|
|
5093
5093
|
changeEmitedValue: (value: any) => void;
|
|
5094
5094
|
addSubFormItem: (item: {
|
|
5095
5095
|
id: string;
|
package/lib/store/form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.11.0-beta.
|
|
2
|
+
* amis-core v6.11.0-beta.3
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -453,9 +453,11 @@ var FormStore = service.ServiceStore.named('FormStore')
|
|
|
453
453
|
}, [self]);
|
|
454
454
|
};
|
|
455
455
|
// 10s 内不要重复弹同一个错误
|
|
456
|
-
var toastValidateError = throttle__default["default"](function (msg) {
|
|
456
|
+
var toastValidateError = throttle__default["default"](function (msg, validateError) {
|
|
457
457
|
var env = mobxStateTree.getEnv(self);
|
|
458
|
-
env.notify('error', msg
|
|
458
|
+
env.notify('error', msg, {
|
|
459
|
+
validateError: validateError
|
|
460
|
+
});
|
|
459
461
|
}, 10000, {
|
|
460
462
|
trailing: false,
|
|
461
463
|
leading: true
|
|
@@ -492,7 +494,7 @@ var FormStore = service.ServiceStore.named('FormStore')
|
|
|
492
494
|
});
|
|
493
495
|
});
|
|
494
496
|
var validate = mobxStateTree.flow(function validate(hooks, forceValidate, throwErrors, failedMessage, validateErrCb) {
|
|
495
|
-
var items, i, len, item, i, len, msg, e_2, msg, dispatcher;
|
|
497
|
+
var items, i, len, item, i, len, msg, e_2, msg, dispatcher, validateError;
|
|
496
498
|
return tslib.__generator(this, function (_a) {
|
|
497
499
|
switch (_a.label) {
|
|
498
500
|
case 0:
|
|
@@ -581,7 +583,14 @@ var FormStore = service.ServiceStore.named('FormStore')
|
|
|
581
583
|
_a.label = 12;
|
|
582
584
|
case 12:
|
|
583
585
|
if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented)) {
|
|
584
|
-
|
|
586
|
+
validateError = new helper.ValidateError(failedMessage || self.__('Form.validateFailed'), self.errors, {
|
|
587
|
+
items: self.items,
|
|
588
|
+
msg: {
|
|
589
|
+
customMsg: failedMessage,
|
|
590
|
+
defaultMsg: self.__('Form.validateFailed')
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
msg && toastValidateError(msg, validateError);
|
|
585
594
|
}
|
|
586
595
|
_a.label = 13;
|
|
587
596
|
case 13:
|
package/lib/store/formItem.js
CHANGED
package/lib/store/iRenderer.js
CHANGED
package/lib/store/index.js
CHANGED
package/lib/store/list.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ export declare const ListStore: import("mobx-state-tree").IModelType<{
|
|
|
62
62
|
reset(): void;
|
|
63
63
|
updateData({ children, ...rest }: any): void;
|
|
64
64
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
65
|
+
fullItems: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<any, any, any>>, [undefined]>;
|
|
66
|
+
fullSelectedItems: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<any, any, any>>, [undefined]>;
|
|
65
67
|
selectedItems: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IModelType<{
|
|
66
68
|
storeType: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
67
69
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -282,10 +284,21 @@ export declare const ListStore: import("mobx-state-tree").IModelType<{
|
|
|
282
284
|
reset(): void;
|
|
283
285
|
updateData({ children, ...rest }: any): void;
|
|
284
286
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
|
|
287
|
+
/**
|
|
288
|
+
* 构建事件的上下文数据
|
|
289
|
+
* @param buildChain
|
|
290
|
+
* @returns
|
|
291
|
+
*/
|
|
292
|
+
readonly eventContext: {
|
|
293
|
+
selectedItems: any[];
|
|
294
|
+
selectedIndexes: number[];
|
|
295
|
+
items: any[];
|
|
296
|
+
unSelectedItems: any[];
|
|
297
|
+
};
|
|
285
298
|
} & {
|
|
286
299
|
getData: (superData: any) => any;
|
|
287
300
|
update: (config: Partial<SListStore>) => void;
|
|
288
|
-
initItems: (items: Array<object>) => void;
|
|
301
|
+
initItems: (items: Array<object>, fullItems?: Array<any>, fullSelectedItems?: Array<any>) => void;
|
|
289
302
|
updateSelected: (selected: Array<any>, valueField?: string) => void;
|
|
290
303
|
toggleAll: () => void;
|
|
291
304
|
clearAll: () => void;
|
package/lib/store/list.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.11.0-beta.
|
|
2
|
+
* amis-core v6.11.0-beta.3
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -43,12 +43,7 @@ var Item = mobxStateTree.types
|
|
|
43
43
|
},
|
|
44
44
|
get locals() {
|
|
45
45
|
var listStore = mobxStateTree.getParent(self, 2);
|
|
46
|
-
return object.createObject(object.extendObject(listStore.data, {
|
|
47
|
-
index: self.index,
|
|
48
|
-
// 只有table时,也可以获取选中行
|
|
49
|
-
selectedItems: listStore.selectedItems.map(function (item) { return item.data; }),
|
|
50
|
-
unSelectedItems: listStore.unSelectedItems.map(function (item) { return item.data; })
|
|
51
|
-
}), self.data);
|
|
46
|
+
return object.createObject(object.extendObject(listStore.data, tslib.__assign({ index: self.index }, listStore.eventContext)), self.data);
|
|
52
47
|
},
|
|
53
48
|
get checkable() {
|
|
54
49
|
var table = mobxStateTree.getParent(self, 2);
|
|
@@ -86,6 +81,11 @@ var ListStore = iRenderer.iRendererStore
|
|
|
86
81
|
.named('ListStore')
|
|
87
82
|
.props({
|
|
88
83
|
items: mobxStateTree.types.array(Item),
|
|
84
|
+
// 记录原始列表和原始选中的列表
|
|
85
|
+
// 因为如果是前端分页,上层 crud 或者 input-table 下发到这层的
|
|
86
|
+
// 是某个页区间的数据,这个时候 items 和 selectedItems 会少很多条
|
|
87
|
+
fullItems: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.frozen()), []),
|
|
88
|
+
fullSelectedItems: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.frozen()), []),
|
|
89
89
|
selectedItems: mobxStateTree.types.array(mobxStateTree.types.reference(Item)),
|
|
90
90
|
primaryField: 'id',
|
|
91
91
|
orderBy: '',
|
|
@@ -139,6 +139,36 @@ var ListStore = iRenderer.iRendererStore
|
|
|
139
139
|
},
|
|
140
140
|
get movedItems() {
|
|
141
141
|
return getMovedItems();
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* 构建事件的上下文数据
|
|
145
|
+
* @param buildChain
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
get eventContext() {
|
|
149
|
+
var context = {
|
|
150
|
+
selectedItems: self.selectedItems.map(function (item) { return item.data; }),
|
|
151
|
+
selectedIndexes: self.selectedItems.map(function (item) { return item.index; }),
|
|
152
|
+
items: self.items.map(function (item) { return item.data; }),
|
|
153
|
+
unSelectedItems: this.unSelectedItems.map(function (item) { return item.data; })
|
|
154
|
+
};
|
|
155
|
+
// 如果是前端分页情况,需要根据全量数据计算
|
|
156
|
+
// 如果不是前端分页,数据都没有返回,那种就没办法支持全量数据信息了
|
|
157
|
+
if (self.fullItems.length > self.items.length) {
|
|
158
|
+
// todo 这里的选择顺序会一直变,这个有影响吗?
|
|
159
|
+
var selectedItems_1 = self.fullSelectedItems
|
|
160
|
+
.filter(function (item) {
|
|
161
|
+
return !self.items.find(function (row) { return row.pristine === (item.__pristine || item); });
|
|
162
|
+
})
|
|
163
|
+
.concat(context.selectedItems);
|
|
164
|
+
context.selectedItems = selectedItems_1;
|
|
165
|
+
context.items = self.fullItems.concat();
|
|
166
|
+
context.unSelectedItems = self.fullItems.filter(function (item) { return !selectedItems_1.includes(item); });
|
|
167
|
+
context.selectedIndexes = selectedItems_1.map(function (item) {
|
|
168
|
+
return self.fullItems.indexOf(item.__pristine || item);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return context;
|
|
142
172
|
}
|
|
143
173
|
};
|
|
144
174
|
})
|
|
@@ -158,7 +188,7 @@ var ListStore = iRenderer.iRendererStore
|
|
|
158
188
|
config.itemDraggableOn === void 0 ||
|
|
159
189
|
(self.itemDraggableOn = config.itemDraggableOn);
|
|
160
190
|
}
|
|
161
|
-
function initItems(items) {
|
|
191
|
+
function initItems(items, fullItems, fullSelectedItems) {
|
|
162
192
|
var arr = items.map(function (item, key) {
|
|
163
193
|
item = object.isObject(item)
|
|
164
194
|
? item
|
|
@@ -170,14 +200,16 @@ var ListStore = iRenderer.iRendererStore
|
|
|
170
200
|
id: helper.guid(),
|
|
171
201
|
index: key,
|
|
172
202
|
newIndex: key,
|
|
173
|
-
pristine: item,
|
|
174
|
-
data: item
|
|
175
|
-
modified: false
|
|
203
|
+
pristine: item.__pristine || item,
|
|
204
|
+
data: item
|
|
176
205
|
};
|
|
177
206
|
});
|
|
178
207
|
self.selectedItems.clear();
|
|
179
208
|
self.items.replace(arr);
|
|
180
209
|
self.dragging = false;
|
|
210
|
+
Array.isArray(fullItems) && self.fullItems.replace(fullItems);
|
|
211
|
+
Array.isArray(fullSelectedItems) &&
|
|
212
|
+
self.fullSelectedItems.replace(fullSelectedItems);
|
|
181
213
|
}
|
|
182
214
|
function updateSelected(selected, valueField) {
|
|
183
215
|
self.selectedItems.clear();
|
|
@@ -261,11 +293,7 @@ var ListStore = iRenderer.iRendererStore
|
|
|
261
293
|
self.items.replace(newItems);
|
|
262
294
|
}
|
|
263
295
|
function getData(superData) {
|
|
264
|
-
return object.createObject(superData, {
|
|
265
|
-
items: self.items.map(function (item) { return item.data; }),
|
|
266
|
-
selectedItems: self.selectedItems.map(function (item) { return item.data; }),
|
|
267
|
-
unSelectedItems: self.unSelectedItems.map(function (item) { return item.data; })
|
|
268
|
-
});
|
|
296
|
+
return object.createObject(superData, tslib.__assign({}, self.eventContext));
|
|
269
297
|
}
|
|
270
298
|
return {
|
|
271
299
|
getData: getData,
|
package/lib/store/manager.js
CHANGED
package/lib/store/modal.js
CHANGED
package/lib/store/node.js
CHANGED
package/lib/store/pagination.js
CHANGED
package/lib/store/root.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Instance } from 'mobx-state-tree';
|
|
2
|
+
import { GlobalVariableItem, GlobalVariableState, GlobalVariableItemFull } from '../globalVar';
|
|
2
3
|
export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
3
4
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
4
5
|
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -34,6 +35,7 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
34
35
|
runtimeErrorStack: import("mobx-state-tree").IType<any, any, any>;
|
|
35
36
|
query: import("mobx-state-tree").IType<any, any, any>;
|
|
36
37
|
ready: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
38
|
+
globalVarStates: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IMapType<import("mobx-state-tree").IType<GlobalVariableState, GlobalVariableState, GlobalVariableState>>, [undefined]>;
|
|
37
39
|
}, {
|
|
38
40
|
readonly parentStore: any;
|
|
39
41
|
readonly __: any;
|
|
@@ -79,12 +81,23 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
79
81
|
checkRemote: (api: import("..").Api, data?: object | undefined, options?: import("..").fetchOptions | undefined) => Promise<any>;
|
|
80
82
|
} & {
|
|
81
83
|
context: {};
|
|
84
|
+
globalVars: GlobalVariableItemFull[];
|
|
85
|
+
globalData: any;
|
|
82
86
|
} & {
|
|
83
87
|
readonly downStream: any;
|
|
84
88
|
} & {
|
|
85
89
|
updateContext(context: any): void;
|
|
90
|
+
updateGlobalVarState(key: string, state: Partial<GlobalVariableState>): void;
|
|
91
|
+
setGlobalVars: (vars?: Array<GlobalVariableItem>) => Promise<any>;
|
|
92
|
+
updateGlobalVarValue: (key: string, value: any) => void;
|
|
93
|
+
modifyGlobalVarValue: (key: string, options: {
|
|
94
|
+
op: 'set' | 'merge' | 'push' | 'unshift' | 'remove' | 'toggle' | 'empty' | 'sort' | 'reverse' | 'refresh';
|
|
95
|
+
value: any;
|
|
96
|
+
}) => void;
|
|
97
|
+
saveGlobalVarValues: import("lodash").DebouncedFunc<(key?: string) => Promise<void>>;
|
|
86
98
|
setRuntimeError(error: any, errorStack: any): void;
|
|
87
99
|
updateLocation(location?: any, parseFn?: Function): void;
|
|
88
100
|
init: (schema: any) => Promise<any>;
|
|
101
|
+
afterDestroy(): void;
|
|
89
102
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
90
103
|
export type IRootStore = Instance<typeof RootStore>;
|