amis-core 3.6.4 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.js +3 -2
- package/esm/SchemaRenderer.js +4 -1
- package/esm/Scoped.d.ts +6 -0
- package/esm/Scoped.js +45 -7
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +3 -5
- package/esm/actions/Action.js +31 -27
- 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 +65 -26
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +4 -3
- 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 +9 -4
- 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.d.ts +1 -2
- package/esm/components/CustomStyle.js +19 -6
- package/esm/components/ErrorBoundary.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +12 -9
- package/esm/components/PopOver.js +8 -5
- package/esm/env.d.ts +4 -0
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +14 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +14 -7
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +4 -3
- package/esm/renderers/Form.js +216 -150
- package/esm/renderers/Item.d.ts +1 -0
- package/esm/renderers/Item.js +17 -17
- package/esm/renderers/Options.d.ts +5 -0
- package/esm/renderers/Options.js +188 -57
- 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 +39 -30
- package/esm/store/app.d.ts +2 -2
- package/esm/store/app.js +4 -3
- package/esm/store/combo.d.ts +79 -55
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +3 -2
- package/esm/store/crud.js +18 -4
- package/esm/store/form.d.ts +33 -23
- package/esm/store/form.js +5 -5
- package/esm/store/formItem.d.ts +2 -1
- package/esm/store/formItem.js +3 -2
- package/esm/store/iRenderer.d.ts +1 -1
- package/esm/store/iRenderer.js +10 -3
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -1
- package/esm/store/list.js +18 -13
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +2 -2
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +2 -1
- package/esm/store/pagination.js +3 -2
- package/esm/store/root.d.ts +2 -2
- package/esm/store/root.js +4 -3
- package/esm/store/service.d.ts +2 -2
- package/esm/store/service.js +11 -7
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +69 -47
- package/esm/store/table.js +54 -25
- package/esm/store/table2.d.ts +14 -3
- package/esm/store/table2.js +22 -9
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +7 -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 +1 -1
- 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.d.ts +1 -0
- package/esm/utils/browser.js +11 -0
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/concatData.d.ts +8 -0
- package/esm/utils/concatData.js +39 -0
- package/esm/utils/dataMapping.js +1 -1
- 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 +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 +14 -2
- package/esm/utils/helper.js +49 -14
- package/esm/utils/highlight.js +3 -2
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +3 -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/labelToString.d.ts +1 -0
- package/esm/utils/labelToString.js +38 -0
- 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 +19 -3
- package/esm/utils/replaceText.js +9 -11
- 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.d.ts +1 -1
- package/esm/utils/string2regExp.js +4 -3
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style-helper.d.ts +24 -5
- package/esm/utils/style-helper.js +49 -21
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +10 -3
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +6 -8
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validateId.d.ts +16 -0
- package/esm/utils/validateId.js +154 -0
- package/esm/utils/validations.js +16 -8
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.js +3 -2
- package/lib/SchemaRenderer.js +4 -1
- package/lib/Scoped.d.ts +6 -0
- package/lib/Scoped.js +45 -6
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +3 -5
- package/lib/actions/Action.js +31 -27
- 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 +65 -26
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +4 -3
- 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 +9 -4
- 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.d.ts +1 -2
- package/lib/components/CustomStyle.js +19 -6
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +11 -8
- package/lib/components/PopOver.js +8 -5
- package/lib/env.d.ts +4 -0
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +14 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +19 -4
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +4 -3
- package/lib/renderers/Form.js +216 -150
- package/lib/renderers/Item.d.ts +1 -0
- package/lib/renderers/Item.js +17 -17
- package/lib/renderers/Options.d.ts +5 -0
- package/lib/renderers/Options.js +188 -57
- 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 +38 -29
- package/lib/store/app.d.ts +2 -2
- package/lib/store/app.js +4 -3
- package/lib/store/combo.d.ts +55 -31
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +3 -2
- package/lib/store/crud.js +18 -4
- package/lib/store/form.d.ts +23 -13
- package/lib/store/form.js +5 -5
- package/lib/store/formItem.d.ts +2 -1
- package/lib/store/formItem.js +3 -2
- package/lib/store/iRenderer.d.ts +1 -1
- package/lib/store/iRenderer.js +10 -3
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -1
- package/lib/store/list.js +18 -14
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +2 -2
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +2 -1
- package/lib/store/pagination.js +3 -2
- package/lib/store/root.d.ts +2 -2
- package/lib/store/root.js +4 -3
- package/lib/store/service.d.ts +2 -2
- package/lib/store/service.js +11 -7
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +49 -27
- package/lib/store/table.js +54 -26
- package/lib/store/table2.d.ts +14 -3
- package/lib/store/table2.js +22 -9
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +7 -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 +1 -1
- 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.d.ts +1 -0
- package/lib/utils/browser.js +15 -0
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/concatData.d.ts +8 -0
- package/lib/utils/concatData.js +43 -0
- package/lib/utils/dataMapping.js +1 -1
- 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 +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 +14 -2
- package/lib/utils/helper.js +50 -12
- package/lib/utils/highlight.js +3 -2
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +3 -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/labelToString.d.ts +1 -0
- package/lib/utils/labelToString.js +46 -0
- 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 +19 -3
- package/lib/utils/replaceText.js +8 -14
- 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.d.ts +1 -1
- package/lib/utils/string2regExp.js +4 -3
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style-helper.d.ts +24 -5
- package/lib/utils/style-helper.js +49 -21
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +10 -2
- package/lib/utils/tpl-builtin.js +1 -1
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +5 -7
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validateId.d.ts +16 -0
- package/lib/utils/validateId.js +160 -0
- package/lib/utils/validations.js +16 -8
- package/package.json +4 -3
- package/LICENSE +0 -201
package/esm/store/table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.1.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -14,7 +14,6 @@ import { resolveVariableAndFilter } from '../utils/resolveVariableAndFilter.js';
|
|
|
14
14
|
import 'lodash/isPlainObject';
|
|
15
15
|
import '../utils/filter.js';
|
|
16
16
|
import isEqual from 'lodash/isEqual';
|
|
17
|
-
import find from 'lodash/find';
|
|
18
17
|
import sortBy from 'lodash/sortBy';
|
|
19
18
|
import { immutableExtends, flattenTree, findTree, eachTree, guid, isVisible, hasVisibleExpression, isBreakpoint, difference, sortArray } from '../utils/helper.js';
|
|
20
19
|
import { evalExpression } from '../utils/tpl.js';
|
|
@@ -254,11 +253,9 @@ var Row = types
|
|
|
254
253
|
get isCheckAvaiableOnClick() {
|
|
255
254
|
var _a;
|
|
256
255
|
var table = getParent(self, self.depth * 2);
|
|
257
|
-
var
|
|
258
|
-
var selectionUpperLimit = table === null || table === void 0 ? void 0 : table.maxKeepItemSelectionLength;
|
|
256
|
+
var selectionUpperLimit = table.getSelectionUpperLimit();
|
|
259
257
|
// 如果未做配置,或者配置不合法直接通过检查
|
|
260
|
-
if (!
|
|
261
|
-
!Number.isInteger(selectionUpperLimit) ||
|
|
258
|
+
if (!Number.isInteger(selectionUpperLimit) ||
|
|
262
259
|
selectionUpperLimit === Infinity) {
|
|
263
260
|
return true;
|
|
264
261
|
}
|
|
@@ -388,6 +385,7 @@ var TableStore = iRendererStore
|
|
|
388
385
|
formsRef: types.optional(types.array(types.frozen()), []),
|
|
389
386
|
maxKeepItemSelectionLength: Infinity,
|
|
390
387
|
keepItemSelectionOnPageChange: false,
|
|
388
|
+
maxItemSelectionLength: Infinity,
|
|
391
389
|
// 导出 Excel 按钮的 loading 状态
|
|
392
390
|
exportExcelLoading: false,
|
|
393
391
|
searchFormExpanded: false,
|
|
@@ -573,7 +571,17 @@ var TableStore = iRendererStore
|
|
|
573
571
|
function getSearchableColumns() {
|
|
574
572
|
return self.columns.filter(function (column) { return column.searchable; });
|
|
575
573
|
}
|
|
574
|
+
function getSelectionUpperLimit() {
|
|
575
|
+
var keep = self.keepItemSelectionOnPageChange;
|
|
576
|
+
var selectionUpperLimit = keep
|
|
577
|
+
? self.maxKeepItemSelectionLength !== Infinity
|
|
578
|
+
? self.maxKeepItemSelectionLength
|
|
579
|
+
: self.maxItemSelectionLength
|
|
580
|
+
: self.maxItemSelectionLength;
|
|
581
|
+
return selectionUpperLimit;
|
|
582
|
+
}
|
|
576
583
|
return {
|
|
584
|
+
getSelectionUpperLimit: getSelectionUpperLimit,
|
|
577
585
|
get columnsData() {
|
|
578
586
|
return getColumnsExceptBuiltinTypes();
|
|
579
587
|
},
|
|
@@ -606,6 +614,10 @@ var TableStore = iRendererStore
|
|
|
606
614
|
return !!self.selectedRows.length;
|
|
607
615
|
},
|
|
608
616
|
get allChecked() {
|
|
617
|
+
var selectionUpperLimit = getSelectionUpperLimit();
|
|
618
|
+
if (selectionUpperLimit !== Infinity) {
|
|
619
|
+
return self.isSelectionThresholdReached;
|
|
620
|
+
}
|
|
609
621
|
// 只要selectedRows中包含checkableRows中的全部数据,就认为是全选
|
|
610
622
|
return self.checkableRows.every(function (item) {
|
|
611
623
|
return self.selectedRows.includes(item);
|
|
@@ -651,8 +663,8 @@ var TableStore = iRendererStore
|
|
|
651
663
|
get isSelectionThresholdReached() {
|
|
652
664
|
var _a, _b;
|
|
653
665
|
var selectedLength = (_b = (_a = self.data) === null || _a === void 0 ? void 0 : _a.selectedItems) === null || _b === void 0 ? void 0 : _b.length;
|
|
654
|
-
var maxLength =
|
|
655
|
-
if (!self.data ||
|
|
666
|
+
var maxLength = getSelectionUpperLimit();
|
|
667
|
+
if (!self.data || maxLength === Infinity) {
|
|
656
668
|
return false;
|
|
657
669
|
}
|
|
658
670
|
return maxLength <= selectedLength;
|
|
@@ -799,6 +811,8 @@ var TableStore = iRendererStore
|
|
|
799
811
|
config.keepItemSelectionOnPageChange !== undefined &&
|
|
800
812
|
(self.keepItemSelectionOnPageChange =
|
|
801
813
|
config.keepItemSelectionOnPageChange);
|
|
814
|
+
config.maxItemSelectionLength !== undefined &&
|
|
815
|
+
(self.maxItemSelectionLength = config.maxItemSelectionLength);
|
|
802
816
|
config.exportExcelLoading !== undefined &&
|
|
803
817
|
(self.exportExcelLoading = config.exportExcelLoading);
|
|
804
818
|
config.loading !== undefined && (self.loading = config.loading);
|
|
@@ -864,11 +878,18 @@ var TableStore = iRendererStore
|
|
|
864
878
|
className: 'Table-dragCell'
|
|
865
879
|
});
|
|
866
880
|
var originColumns_1 = self.columns.concat();
|
|
881
|
+
var ids_1 = [];
|
|
867
882
|
columns = columns.map(function (item, index) {
|
|
868
883
|
var origin = item.id
|
|
869
884
|
? originColumns_1.find(function (column) { return column.pristine.id === item.id; })
|
|
870
885
|
: originColumns_1[index];
|
|
871
|
-
|
|
886
|
+
var id = (origin === null || origin === void 0 ? void 0 : origin.id) || guid();
|
|
887
|
+
// 还不知道为何会出现这个,先用这种方式避免 id 重复
|
|
888
|
+
if (ids_1.includes(id)) {
|
|
889
|
+
id = guid();
|
|
890
|
+
}
|
|
891
|
+
ids_1.push(id);
|
|
892
|
+
return __assign(__assign({}, item), { id: id, index: index, width: (origin === null || origin === void 0 ? void 0 : origin.width) || 0, minWidth: (origin === null || origin === void 0 ? void 0 : origin.minWidth) || 0, realWidth: (origin === null || origin === void 0 ? void 0 : origin.realWidth) || 0, rawIndex: index - PARTITION_INDEX, type: item.type || 'plain', pristine: item.pristine || item, toggled: item.toggled !== false, breakpoint: item.breakpoint, isPrimary: index === PARTITION_INDEX });
|
|
872
893
|
});
|
|
873
894
|
self.columns.replace(columns);
|
|
874
895
|
}
|
|
@@ -1111,26 +1132,33 @@ var TableStore = iRendererStore
|
|
|
1111
1132
|
}
|
|
1112
1133
|
function updateSelected(selected, valueField) {
|
|
1113
1134
|
self.selectedRows.clear();
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1135
|
+
selected.forEach(function (item) {
|
|
1136
|
+
var resolved = findTree(self.rows, function (a) { return a.pristine === item; });
|
|
1137
|
+
// 先严格比较,
|
|
1138
|
+
if (!resolved) {
|
|
1139
|
+
resolved = findTree(self.rows, function (a) {
|
|
1140
|
+
var selectValue = item[valueField || 'value'];
|
|
1141
|
+
var itemValue = a.pristine[valueField || 'value'];
|
|
1142
|
+
return selectValue === itemValue;
|
|
1143
|
+
});
|
|
1117
1144
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1145
|
+
// 再宽松比较
|
|
1146
|
+
if (!resolved) {
|
|
1147
|
+
resolved = findTree(self.rows, function (a) {
|
|
1148
|
+
var selectValue = item[valueField || 'value'];
|
|
1149
|
+
var itemValue = a.pristine[valueField || 'value'];
|
|
1150
|
+
return selectValue == itemValue;
|
|
1151
|
+
});
|
|
1123
1152
|
}
|
|
1153
|
+
resolved && self.selectedRows.push(resolved);
|
|
1124
1154
|
});
|
|
1125
1155
|
updateCheckDisable();
|
|
1126
1156
|
}
|
|
1127
1157
|
function getSelectedRows() {
|
|
1128
1158
|
var _a;
|
|
1129
|
-
var maxLength = self.
|
|
1130
|
-
var keep = self.keepItemSelectionOnPageChange;
|
|
1159
|
+
var maxLength = self.getSelectionUpperLimit();
|
|
1131
1160
|
var selectedItems = (_a = self.data) === null || _a === void 0 ? void 0 : _a.selectedItems;
|
|
1132
|
-
if (
|
|
1133
|
-
maxLength &&
|
|
1161
|
+
if (maxLength !== Infinity &&
|
|
1134
1162
|
selectedItems &&
|
|
1135
1163
|
maxLength >= selectedItems.length) {
|
|
1136
1164
|
var restCheckableRows = self.checkableRows.filter(function (item) { return !item.checked; });
|
|
@@ -1245,10 +1273,10 @@ var TableStore = iRendererStore
|
|
|
1245
1273
|
if (!self.data) {
|
|
1246
1274
|
return;
|
|
1247
1275
|
}
|
|
1248
|
-
var maxLength = self.
|
|
1276
|
+
var maxLength = self.getSelectionUpperLimit();
|
|
1249
1277
|
var selectedItems = self.data.selectedItems;
|
|
1250
1278
|
self.selectedRows.map(function (item) { return item.setCheckdisable(false); });
|
|
1251
|
-
if (maxLength && maxLength <= selectedItems.length) {
|
|
1279
|
+
if (maxLength !== Infinity && maxLength <= selectedItems.length) {
|
|
1252
1280
|
self.unSelectedRows.map(function (item) { return !item.checked && item.setCheckdisable(true); });
|
|
1253
1281
|
}
|
|
1254
1282
|
else {
|
|
@@ -1387,10 +1415,11 @@ var TableStore = iRendererStore
|
|
|
1387
1415
|
}
|
|
1388
1416
|
function getPersistDataKey(columns) {
|
|
1389
1417
|
// 这里的columns使用除了__开头的所有列
|
|
1390
|
-
// sort保证存储和读取的key值保持一致
|
|
1391
1418
|
return (location.pathname +
|
|
1392
1419
|
self.path +
|
|
1393
|
-
|
|
1420
|
+
// 不能 sort 因为原始列的顺序设计器是可能改变的,此时如果缓存了打开会失效
|
|
1421
|
+
// 还是缓存的顺序,不符合用户调整列顺序的预期
|
|
1422
|
+
columns.map(function (item, index) { return item.name || item.label || index; }).join('-'));
|
|
1394
1423
|
}
|
|
1395
1424
|
function setSearchFormExpanded(value) {
|
|
1396
1425
|
self.searchFormExpanded = !!value;
|
package/esm/store/table2.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Api, fetchOptions } from '../types';
|
|
|
3
3
|
import { IFormStore } from './form';
|
|
4
4
|
export declare const Column: import("mobx-state-tree").IModelType<{
|
|
5
5
|
title: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
6
|
+
label: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
6
7
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
7
8
|
toggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
8
9
|
breakpoint: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
@@ -73,6 +74,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
73
74
|
} & {
|
|
74
75
|
columns: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
75
76
|
title: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
77
|
+
label: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
76
78
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
77
79
|
toggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
78
80
|
breakpoint: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
@@ -142,6 +144,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
142
144
|
dragging: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
143
145
|
rowSelectionKeyField: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
144
146
|
formsRef: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<any, any, any>>, [undefined]>;
|
|
147
|
+
canAccessSuperData: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
145
148
|
}, {
|
|
146
149
|
readonly parentStore: any;
|
|
147
150
|
readonly __: any;
|
|
@@ -160,7 +163,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
160
163
|
setTopStore(value: any): void;
|
|
161
164
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
162
165
|
reset(): void;
|
|
163
|
-
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
166
|
+
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined, concatFields?: string | string[] | undefined): void;
|
|
164
167
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
165
168
|
setCurrentAction(action: object): void;
|
|
166
169
|
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
@@ -177,7 +180,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
177
180
|
markBusying: (busying?: boolean) => void;
|
|
178
181
|
fetchInitData: (api: Api, data?: object | undefined, options?: fetchOptions | undefined) => Promise<any>;
|
|
179
182
|
fetchData: (api: Api, data?: object | undefined, options?: fetchOptions | undefined) => Promise<any>;
|
|
180
|
-
reInitData: (data: object | undefined, replace?: boolean) => void;
|
|
183
|
+
reInitData: (data: object | undefined, replace?: boolean, concatFields?: string | string[] | undefined) => void;
|
|
181
184
|
updateMessage: (msg?: string | undefined, error?: boolean) => void;
|
|
182
185
|
clearMessage: () => void;
|
|
183
186
|
setHasRemoteData: () => void;
|
|
@@ -188,6 +191,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
188
191
|
readonly toggable: boolean;
|
|
189
192
|
readonly columnsData: import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IModelType<{
|
|
190
193
|
title: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
194
|
+
label: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
191
195
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
192
196
|
toggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
193
197
|
breakpoint: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
@@ -201,6 +205,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
201
205
|
setToggled(value: boolean): void;
|
|
202
206
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
203
207
|
title: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
208
|
+
label: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
204
209
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
205
210
|
toggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
206
211
|
breakpoint: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
@@ -215,6 +220,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
215
220
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>;
|
|
216
221
|
readonly toggableColumns: ({
|
|
217
222
|
title: any;
|
|
223
|
+
label: any;
|
|
218
224
|
name: string;
|
|
219
225
|
toggled: boolean;
|
|
220
226
|
breakpoint: any;
|
|
@@ -228,6 +234,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
228
234
|
setToggled(value: boolean): void;
|
|
229
235
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
230
236
|
title: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
237
|
+
label: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
231
238
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
232
239
|
toggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
233
240
|
breakpoint: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
@@ -243,6 +250,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
243
250
|
readonly filteredColumns: any[];
|
|
244
251
|
readonly activeToggaleColumns: ({
|
|
245
252
|
title: any;
|
|
253
|
+
label: any;
|
|
246
254
|
name: string;
|
|
247
255
|
toggled: boolean;
|
|
248
256
|
breakpoint: any;
|
|
@@ -256,6 +264,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
256
264
|
setToggled(value: boolean): void;
|
|
257
265
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
258
266
|
title: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
267
|
+
label: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
259
268
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
260
269
|
toggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
261
270
|
breakpoint: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
@@ -507,7 +516,9 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
507
516
|
reset(): void;
|
|
508
517
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
|
|
509
518
|
} & {
|
|
510
|
-
update: (config: Partial<STableStore2
|
|
519
|
+
update: (config: Partial<STableStore2>, options?: {
|
|
520
|
+
resolveDefinitions?: ((ref: string) => any) | undefined;
|
|
521
|
+
} | undefined) => void;
|
|
511
522
|
persistSaveToggledColumns: () => void;
|
|
512
523
|
setOrderByInfo: (key: string, direction: 'asc' | 'desc') => void;
|
|
513
524
|
updateQuery: (values: object, updater?: Function, pageNoField?: string, pageSizeField?: string, replace?: boolean) => void;
|
package/esm/store/table2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.1.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -24,6 +24,7 @@ var ServerError = /** @class */ (function (_super) {
|
|
|
24
24
|
var Column = types
|
|
25
25
|
.model('Column', {
|
|
26
26
|
title: types.optional(types.frozen(), undefined),
|
|
27
|
+
label: types.optional(types.frozen(), undefined),
|
|
27
28
|
name: '',
|
|
28
29
|
toggled: false,
|
|
29
30
|
breakpoint: types.optional(types.frozen(), undefined),
|
|
@@ -150,12 +151,13 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
150
151
|
pageSize: 10,
|
|
151
152
|
dragging: false,
|
|
152
153
|
rowSelectionKeyField: 'id',
|
|
153
|
-
formsRef: types.optional(types.array(types.frozen()), [])
|
|
154
|
+
formsRef: types.optional(types.array(types.frozen()), []),
|
|
155
|
+
canAccessSuperData: false
|
|
154
156
|
})
|
|
155
157
|
.views(function (self) {
|
|
156
158
|
function getToggable() {
|
|
157
159
|
if (self.columnsTogglable === 'auto') {
|
|
158
|
-
return self.columns.filter.length >
|
|
160
|
+
return self.columns.filter(function (item) { return !/^__/.test(item.type); }).length > 5;
|
|
159
161
|
}
|
|
160
162
|
return !!self.columnsTogglable;
|
|
161
163
|
}
|
|
@@ -248,7 +250,9 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
248
250
|
return getActiveToggableColumns();
|
|
249
251
|
},
|
|
250
252
|
get dataSource() {
|
|
251
|
-
return self.rows.map(function (item) {
|
|
253
|
+
return self.rows.map(function (item) {
|
|
254
|
+
return self.canAccessSuperData ? item.locals : item.data;
|
|
255
|
+
});
|
|
252
256
|
},
|
|
253
257
|
get currentSelectedRowKeys() {
|
|
254
258
|
if (self.data && self.data.selectedItems) {
|
|
@@ -290,17 +294,26 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
290
294
|
};
|
|
291
295
|
})
|
|
292
296
|
.actions(function (self) {
|
|
293
|
-
function updateColumns(columns) {
|
|
297
|
+
function updateColumns(columns, options) {
|
|
294
298
|
if (columns && Array.isArray(columns)) {
|
|
295
299
|
var cols = columns.filter(function (column) { return column; }).concat();
|
|
296
|
-
cols = cols.map(function (item, index) {
|
|
300
|
+
cols = cols.map(function (item, index) {
|
|
301
|
+
if ((options === null || options === void 0 ? void 0 : options.resolveDefinitions) &&
|
|
302
|
+
typeof (item === null || item === void 0 ? void 0 : item.$ref) == 'string' &&
|
|
303
|
+
item.$ref) {
|
|
304
|
+
item = __assign(__assign({}, options.resolveDefinitions(item.$ref)), item);
|
|
305
|
+
}
|
|
306
|
+
return __assign(__assign({}, item), { index: index, type: item.type || 'plain', pristine: item, toggled: item.toggled !== false, breakpoint: item.breakpoint, children: item.children ? updateColumns(item.children, options) : [] });
|
|
307
|
+
});
|
|
297
308
|
return cols;
|
|
298
309
|
}
|
|
299
310
|
return;
|
|
300
311
|
}
|
|
301
|
-
function update(config) {
|
|
312
|
+
function update(config, options) {
|
|
302
313
|
config.columnsTogglable !== void 0 &&
|
|
303
314
|
(self.columnsTogglable = config.columnsTogglable);
|
|
315
|
+
config.canAccessSuperData !== undefined &&
|
|
316
|
+
(self.canAccessSuperData = !!config.canAccessSuperData);
|
|
304
317
|
if (typeof config.orderBy === 'string') {
|
|
305
318
|
setOrderByInfo(config.orderBy, config.order === 'desc' ? 'desc' : 'asc');
|
|
306
319
|
}
|
|
@@ -308,7 +321,7 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
308
321
|
self.rowSelectionKeyField = config.rowSelectionKeyField;
|
|
309
322
|
}
|
|
310
323
|
if (config.columns && Array.isArray(config.columns)) {
|
|
311
|
-
self.columns.replace(updateColumns(config.columns));
|
|
324
|
+
self.columns.replace(updateColumns(config.columns, options));
|
|
312
325
|
}
|
|
313
326
|
}
|
|
314
327
|
function exchange(fromIndex, toIndex, item) {
|
|
@@ -500,7 +513,7 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
500
513
|
if (!isEmpty(json.data) || json.ok) {
|
|
501
514
|
self.updateData(normalizeApiResponseData(json.data), {
|
|
502
515
|
__saved: Date.now()
|
|
503
|
-
}, !!api && api.replaceData);
|
|
516
|
+
}, !!api && api.replaceData, api === null || api === void 0 ? void 0 : api.concatDataFields);
|
|
504
517
|
self.updatedAt = Date.now();
|
|
505
518
|
}
|
|
506
519
|
if (!json.ok) {
|
package/esm/theme.js
CHANGED
package/esm/types.d.ts
CHANGED
|
@@ -129,6 +129,13 @@ export interface BaseApiObject {
|
|
|
129
129
|
* 默认都是追加模式,如果想完全替换把这个配置成 true
|
|
130
130
|
*/
|
|
131
131
|
replaceData?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* 是否将两次返回的数据字段,做一个合并。配置返回对象中的字段名,支持配置多个。
|
|
134
|
+
*
|
|
135
|
+
* 比如:同时返回 log 字段,第一次返回 {log: '1'},第二次返回 {log: '2'},合并后的结果是 {log: ['1', '2']]}
|
|
136
|
+
* 再比如:同时返回 items 字段,第一次返回 {items: [1, 2]},第二次返回 {items: [3, 4]},合并后的结果是 {items: [1, 2, 3, 4]}
|
|
137
|
+
*/
|
|
138
|
+
concatDataFields?: string | Array<string>;
|
|
132
139
|
/**
|
|
133
140
|
* 是否自动刷新,当 url 中的取值结果变化时,自动刷新数据。
|
|
134
141
|
*
|
package/esm/utils/Animation.js
CHANGED
package/esm/utils/ColorScale.js
CHANGED
package/esm/utils/DataSchema.js
CHANGED
package/esm/utils/DataScope.js
CHANGED
package/esm/utils/RootClose.js
CHANGED
package/esm/utils/SimpleMap.js
CHANGED
package/esm/utils/api.js
CHANGED
package/esm/utils/arraySlice.js
CHANGED
package/esm/utils/autobind.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chromeVersion: number | boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
var chromeVersion = (function getChromeVersion() {
|
|
7
|
+
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
|
8
|
+
return raw ? parseInt(raw[2], 10) : false;
|
|
9
|
+
})();
|
|
10
|
+
|
|
11
|
+
export { chromeVersion };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { __assign } from 'tslib';
|
|
7
|
+
import { getVariable } from './getVariable.js';
|
|
8
|
+
import { setVariable } from './object.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 合并两次数据,满足轮训时总合并数据的需求,比如日志接口,每次返回一部分,但是前端组件需要全部展示。
|
|
12
|
+
*
|
|
13
|
+
* @param data
|
|
14
|
+
* @param origin
|
|
15
|
+
* @param keys
|
|
16
|
+
*/
|
|
17
|
+
function concatData(data, origin, keys) {
|
|
18
|
+
keys = Array.isArray(keys)
|
|
19
|
+
? keys
|
|
20
|
+
: keys
|
|
21
|
+
.split(',')
|
|
22
|
+
.map(function (item) { return item.trim(); })
|
|
23
|
+
.filter(function (item) { return item; });
|
|
24
|
+
var newData = __assign({}, data);
|
|
25
|
+
var modified = false;
|
|
26
|
+
origin &&
|
|
27
|
+
keys.forEach(function (key) {
|
|
28
|
+
var prev = getVariable(origin, key);
|
|
29
|
+
var next = getVariable(data, key);
|
|
30
|
+
var args = [];
|
|
31
|
+
typeof prev !== 'undefined' && args.push(prev);
|
|
32
|
+
typeof next !== 'undefined' && args.push(next);
|
|
33
|
+
modified = true;
|
|
34
|
+
setVariable(newData, key, [].concat.apply([], args));
|
|
35
|
+
});
|
|
36
|
+
return modified ? newData : data;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { concatData };
|
package/esm/utils/dataMapping.js
CHANGED
package/esm/utils/date.js
CHANGED
package/esm/utils/debug.js
CHANGED
package/esm/utils/dom.js
CHANGED
package/esm/utils/errors.js
CHANGED
package/esm/utils/escapeHtml.js
CHANGED
package/esm/utils/filter.js
CHANGED
package/esm/utils/formula.js
CHANGED
package/esm/utils/getVariable.js
CHANGED
package/esm/utils/grammar.js
CHANGED