amis-core 6.0.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/Root.js +2 -2
- package/esm/RootRenderer.js +4 -3
- package/esm/SchemaRenderer.js +5 -2
- package/esm/Scoped.d.ts +6 -0
- package/esm/Scoped.js +47 -8
- package/esm/StatusScoped.js +2 -2
- package/esm/WithRootStore.js +2 -2
- package/esm/WithStore.js +4 -6
- package/esm/actions/Action.js +2 -2
- package/esm/actions/AjaxAction.js +2 -2
- package/esm/actions/BreakAction.js +2 -2
- package/esm/actions/BroadcastAction.js +2 -2
- package/esm/actions/CmptAction.js +2 -2
- package/esm/actions/ContinueAction.js +2 -2
- package/esm/actions/CopyAction.js +2 -2
- package/esm/actions/CustomAction.js +3 -3
- package/esm/actions/DialogAction.js +2 -2
- package/esm/actions/DrawerAction.js +2 -2
- package/esm/actions/EmailAction.js +2 -2
- package/esm/actions/LinkAction.js +10 -5
- package/esm/actions/LoopAction.js +2 -2
- package/esm/actions/PageAction.js +2 -2
- package/esm/actions/ParallelAction.js +2 -2
- package/esm/actions/PrintAction.d.ts +19 -0
- package/esm/actions/PrintAction.js +49 -0
- package/esm/actions/StatusAction.js +2 -2
- package/esm/actions/SwitchAction.js +2 -2
- package/esm/actions/ToastAction.js +2 -2
- package/esm/actions/index.d.ts +1 -0
- package/esm/components/CustomStyle.d.ts +1 -2
- package/esm/components/CustomStyle.js +20 -7
- package/esm/components/ErrorBoundary.js +2 -2
- package/esm/components/LazyComponent.js +2 -2
- package/esm/components/Overlay.js +11 -9
- package/esm/components/PopOver.js +7 -5
- package/esm/env.d.ts +4 -0
- package/esm/env.js +2 -2
- package/esm/envOverwrite.js +2 -2
- package/esm/factory.js +15 -2
- package/esm/index.d.ts +3 -2
- package/esm/index.js +16 -9
- package/esm/locale.js +2 -2
- package/esm/polyfills.js +2 -2
- package/esm/renderers/Form.d.ts +4 -3
- package/esm/renderers/Form.js +97 -45
- package/esm/renderers/Item.d.ts +1 -0
- package/esm/renderers/Item.js +15 -16
- package/esm/renderers/Options.d.ts +5 -0
- package/esm/renderers/Options.js +27 -10
- package/esm/renderers/Placeholder.js +2 -2
- package/esm/renderers/builtin.js +2 -2
- package/esm/renderers/register.js +2 -2
- package/esm/renderers/wrapControl.js +37 -29
- package/esm/store/app.js +3 -3
- package/esm/store/combo.d.ts +48 -24
- package/esm/store/combo.js +2 -2
- package/esm/store/crud.js +2 -2
- package/esm/store/form.d.ts +20 -10
- package/esm/store/form.js +2 -2
- package/esm/store/formItem.d.ts +2 -1
- package/esm/store/formItem.js +4 -3
- package/esm/store/iRenderer.js +5 -3
- package/esm/store/index.js +2 -2
- package/esm/store/list.d.ts +11 -0
- package/esm/store/list.js +9 -2
- package/esm/store/manager.js +2 -2
- package/esm/store/modal.js +2 -2
- package/esm/store/node.js +2 -2
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.js +3 -3
- package/esm/store/service.js +6 -3
- package/esm/store/status.js +2 -2
- package/esm/store/table.d.ts +70 -47
- package/esm/store/table.js +40 -24
- package/esm/store/table2.js +2 -2
- package/esm/theme.js +2 -2
- package/esm/utils/Animation.js +2 -2
- package/esm/utils/ColorScale.js +2 -2
- package/esm/utils/DataSchema.js +2 -2
- package/esm/utils/DataScope.js +2 -2
- package/esm/utils/RootClose.js +2 -2
- package/esm/utils/SimpleMap.js +2 -2
- package/esm/utils/api.js +4 -3
- package/esm/utils/arraySlice.js +2 -2
- package/esm/utils/attachmentAdpator.js +4 -3
- package/esm/utils/autobind.js +2 -2
- package/esm/utils/browser.d.ts +1 -0
- package/esm/utils/browser.js +8 -3
- package/esm/utils/columnsSplit.js +2 -2
- package/esm/utils/concatData.js +2 -2
- package/esm/utils/dataMapping.js +2 -2
- package/esm/utils/date.js +2 -2
- package/esm/utils/debug.js +2 -2
- package/esm/utils/decodeEntity.js +2 -2
- package/esm/utils/dom.js +8 -3
- package/esm/utils/errors.js +2 -2
- package/esm/utils/escapeHtml.js +2 -2
- package/esm/utils/filter-schema.js +2 -2
- package/esm/utils/filter.js +2 -2
- package/esm/utils/formatDuration.js +2 -2
- package/esm/utils/formula.js +2 -2
- package/esm/utils/getVariable.js +2 -2
- package/esm/utils/grammar.js +2 -2
- package/esm/utils/handleAction.js +2 -2
- package/esm/utils/helper.d.ts +8 -1
- package/esm/utils/helper.js +28 -10
- package/esm/utils/highlight.js +4 -3
- package/esm/utils/icon.js +2 -2
- package/esm/utils/image.js +2 -2
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/isPureVariable.js +2 -2
- package/esm/utils/json-schema-2-amis-schema.js +2 -2
- package/esm/utils/keyToPath.js +2 -2
- package/esm/utils/labelToString.d.ts +1 -0
- package/esm/utils/labelToString.js +38 -0
- package/esm/utils/makeSorter.js +2 -2
- package/esm/utils/math.js +2 -2
- package/esm/utils/memoryParse.js +2 -2
- package/esm/utils/normalizeLink.js +2 -2
- package/esm/utils/normalizeOptions.js +2 -2
- package/esm/utils/object.js +2 -2
- package/esm/utils/offset.js +2 -2
- package/esm/utils/offsetParent.js +2 -2
- package/esm/utils/optionValueCompare.js +2 -2
- package/esm/utils/position.js +2 -2
- package/esm/utils/prettyBytes.js +2 -2
- package/esm/utils/printElement.d.ts +6 -0
- package/esm/utils/printElement.js +71 -0
- package/esm/utils/renderer-event.js +2 -2
- package/esm/utils/replaceText.js +10 -12
- package/esm/utils/resize-sensor.js +2 -2
- package/esm/utils/resolveCondition.js +2 -2
- package/esm/utils/resolveVariable.js +2 -2
- package/esm/utils/resolveVariableAndFilter.js +2 -2
- package/esm/utils/resolveVariableAndFilterForAsync.js +2 -2
- package/esm/utils/scrollPosition.js +2 -2
- package/esm/utils/string2regExp.d.ts +1 -1
- package/esm/utils/string2regExp.js +5 -4
- package/esm/utils/stripNumber.js +2 -2
- package/esm/utils/style-helper.d.ts +24 -5
- package/esm/utils/style-helper.js +47 -17
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +2 -2
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +11 -4
- package/esm/utils/tpl-builtin.js +2 -2
- package/esm/utils/tpl-lodash.js +2 -2
- package/esm/utils/tpl.js +7 -9
- package/esm/utils/uncontrollable.js +2 -2
- package/esm/utils/validateId.d.ts +16 -0
- package/esm/utils/validateId.js +154 -0
- package/esm/utils/validations.js +17 -9
- package/lib/Root.js +2 -2
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +4 -3
- package/lib/SchemaRenderer.js +5 -2
- package/lib/Scoped.d.ts +6 -0
- package/lib/Scoped.js +47 -7
- package/lib/StatusScoped.js +2 -2
- package/lib/WithRootStore.js +2 -2
- package/lib/WithStore.js +4 -6
- package/lib/actions/Action.js +2 -2
- package/lib/actions/AjaxAction.js +2 -2
- package/lib/actions/BreakAction.js +2 -2
- package/lib/actions/BroadcastAction.js +2 -2
- package/lib/actions/CmptAction.js +2 -2
- package/lib/actions/ContinueAction.js +2 -2
- package/lib/actions/CopyAction.js +2 -2
- package/lib/actions/CustomAction.js +3 -3
- package/lib/actions/DialogAction.js +2 -2
- package/lib/actions/DrawerAction.js +2 -2
- package/lib/actions/EmailAction.js +2 -2
- package/lib/actions/LinkAction.js +10 -5
- package/lib/actions/LoopAction.js +2 -2
- package/lib/actions/PageAction.js +2 -2
- package/lib/actions/ParallelAction.js +2 -2
- package/lib/actions/PrintAction.d.ts +19 -0
- package/lib/actions/PrintAction.js +53 -0
- package/lib/actions/StatusAction.js +2 -2
- package/lib/actions/SwitchAction.js +2 -2
- package/lib/actions/ToastAction.js +2 -2
- package/lib/actions/index.d.ts +1 -0
- package/lib/components/CustomStyle.d.ts +1 -2
- package/lib/components/CustomStyle.js +20 -7
- package/lib/components/ErrorBoundary.js +2 -2
- package/lib/components/LazyComponent.js +2 -2
- package/lib/components/Overlay.js +10 -8
- package/lib/components/PopOver.js +7 -5
- package/lib/env.d.ts +4 -0
- package/lib/env.js +2 -2
- package/lib/envOverwrite.js +2 -2
- package/lib/factory.js +15 -2
- package/lib/index.d.ts +3 -2
- package/lib/index.js +19 -5
- package/lib/locale.js +2 -2
- package/lib/polyfills.js +2 -2
- package/lib/renderers/Form.d.ts +4 -3
- package/lib/renderers/Form.js +96 -44
- package/lib/renderers/Item.d.ts +1 -0
- package/lib/renderers/Item.js +15 -16
- package/lib/renderers/Options.d.ts +5 -0
- package/lib/renderers/Options.js +27 -10
- package/lib/renderers/Placeholder.js +2 -2
- package/lib/renderers/builtin.js +2 -2
- package/lib/renderers/register.js +2 -2
- package/lib/renderers/wrapControl.js +36 -28
- package/lib/store/app.js +3 -3
- package/lib/store/combo.d.ts +72 -48
- package/lib/store/combo.js +2 -2
- package/lib/store/crud.js +2 -2
- package/lib/store/form.d.ts +30 -20
- package/lib/store/form.js +2 -2
- package/lib/store/formItem.d.ts +2 -1
- package/lib/store/formItem.js +4 -3
- package/lib/store/iRenderer.js +5 -3
- package/lib/store/index.js +2 -2
- package/lib/store/list.d.ts +11 -0
- package/lib/store/list.js +9 -2
- package/lib/store/manager.js +2 -2
- package/lib/store/modal.js +2 -2
- package/lib/store/node.js +2 -2
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.js +3 -3
- package/lib/store/service.js +6 -3
- package/lib/store/status.js +2 -2
- package/lib/store/table.d.ts +90 -68
- package/lib/store/table.js +40 -24
- package/lib/store/table2.js +2 -2
- package/lib/theme.js +2 -2
- package/lib/utils/Animation.js +2 -2
- package/lib/utils/ColorScale.js +2 -2
- package/lib/utils/DataSchema.js +2 -2
- package/lib/utils/DataScope.js +2 -2
- package/lib/utils/RootClose.js +2 -2
- package/lib/utils/SimpleMap.js +2 -2
- package/lib/utils/api.js +4 -3
- package/lib/utils/arraySlice.js +2 -2
- package/lib/utils/attachmentAdpator.js +4 -3
- package/lib/utils/autobind.js +2 -2
- package/lib/utils/browser.d.ts +1 -0
- package/lib/utils/browser.js +8 -2
- package/lib/utils/columnsSplit.js +2 -2
- package/lib/utils/concatData.js +2 -2
- package/lib/utils/dataMapping.js +2 -2
- package/lib/utils/date.js +2 -2
- package/lib/utils/debug.js +2 -2
- package/lib/utils/decodeEntity.js +2 -2
- package/lib/utils/dom.js +8 -3
- package/lib/utils/errors.js +2 -2
- package/lib/utils/escapeHtml.js +2 -2
- package/lib/utils/filter-schema.js +2 -2
- package/lib/utils/filter.js +2 -2
- package/lib/utils/formatDuration.js +2 -2
- package/lib/utils/formula.js +2 -2
- package/lib/utils/getVariable.js +2 -2
- package/lib/utils/grammar.js +2 -2
- package/lib/utils/handleAction.js +2 -2
- package/lib/utils/helper.d.ts +8 -1
- package/lib/utils/helper.js +29 -8
- package/lib/utils/highlight.js +4 -3
- package/lib/utils/icon.js +2 -2
- package/lib/utils/image.js +2 -2
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/isPureVariable.js +2 -2
- package/lib/utils/json-schema-2-amis-schema.js +2 -2
- package/lib/utils/keyToPath.js +2 -2
- package/lib/utils/labelToString.d.ts +1 -0
- package/lib/utils/labelToString.js +46 -0
- package/lib/utils/makeSorter.js +2 -2
- package/lib/utils/math.js +2 -2
- package/lib/utils/memoryParse.js +2 -2
- package/lib/utils/normalizeLink.js +2 -2
- package/lib/utils/normalizeOptions.js +2 -2
- package/lib/utils/object.js +2 -2
- package/lib/utils/offset.js +2 -2
- package/lib/utils/offsetParent.js +2 -2
- package/lib/utils/optionValueCompare.js +2 -2
- package/lib/utils/position.js +2 -2
- package/lib/utils/prettyBytes.js +2 -2
- package/lib/utils/printElement.d.ts +6 -0
- package/lib/utils/printElement.js +75 -0
- package/lib/utils/renderer-event.js +2 -2
- package/lib/utils/replaceText.js +9 -15
- package/lib/utils/resize-sensor.js +2 -2
- package/lib/utils/resolveCondition.js +2 -2
- package/lib/utils/resolveVariable.js +2 -2
- package/lib/utils/resolveVariableAndFilter.js +2 -2
- package/lib/utils/resolveVariableAndFilterForAsync.js +2 -2
- package/lib/utils/scrollPosition.js +2 -2
- package/lib/utils/string2regExp.d.ts +1 -1
- package/lib/utils/string2regExp.js +5 -4
- package/lib/utils/stripNumber.js +2 -2
- package/lib/utils/style-helper.d.ts +24 -5
- package/lib/utils/style-helper.js +47 -17
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +2 -2
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +11 -3
- package/lib/utils/tpl-builtin.js +2 -2
- package/lib/utils/tpl-lodash.js +2 -2
- package/lib/utils/tpl.js +6 -8
- package/lib/utils/uncontrollable.js +2 -2
- package/lib/utils/validateId.d.ts +16 -0
- package/lib/utils/validateId.js +160 -0
- package/lib/utils/validations.js +17 -9
- package/package.json +4 -9
- package/LICENSE +0 -201
package/lib/store/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.2.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -262,11 +262,9 @@ var Row = mobxStateTree.types
|
|
|
262
262
|
get isCheckAvaiableOnClick() {
|
|
263
263
|
var _a;
|
|
264
264
|
var table = mobxStateTree.getParent(self, self.depth * 2);
|
|
265
|
-
var
|
|
266
|
-
var selectionUpperLimit = table === null || table === void 0 ? void 0 : table.maxKeepItemSelectionLength;
|
|
265
|
+
var selectionUpperLimit = table.getSelectionUpperLimit();
|
|
267
266
|
// 如果未做配置,或者配置不合法直接通过检查
|
|
268
|
-
if (!
|
|
269
|
-
!Number.isInteger(selectionUpperLimit) ||
|
|
267
|
+
if (!Number.isInteger(selectionUpperLimit) ||
|
|
270
268
|
selectionUpperLimit === Infinity) {
|
|
271
269
|
return true;
|
|
272
270
|
}
|
|
@@ -360,7 +358,7 @@ var Row = mobxStateTree.types
|
|
|
360
358
|
self.error = '';
|
|
361
359
|
self.loaded = false;
|
|
362
360
|
},
|
|
363
|
-
|
|
361
|
+
updateData: function (_a) {
|
|
364
362
|
var children = _a.children, rest = tslib.__rest(_a, ["children"]);
|
|
365
363
|
self.data = tslib.__assign(tslib.__assign({}, self.data), rest);
|
|
366
364
|
if (Array.isArray(children)) {
|
|
@@ -372,6 +370,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
372
370
|
.named('TableStore')
|
|
373
371
|
.props({
|
|
374
372
|
columns: mobxStateTree.types.array(Column),
|
|
373
|
+
columnsKey: '',
|
|
375
374
|
rows: mobxStateTree.types.array(Row),
|
|
376
375
|
selectedRows: mobxStateTree.types.array(mobxStateTree.types.reference(Row)),
|
|
377
376
|
expandedRows: mobxStateTree.types.array(mobxStateTree.types.string),
|
|
@@ -396,6 +395,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
396
395
|
formsRef: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.frozen()), []),
|
|
397
396
|
maxKeepItemSelectionLength: Infinity,
|
|
398
397
|
keepItemSelectionOnPageChange: false,
|
|
398
|
+
maxItemSelectionLength: Infinity,
|
|
399
399
|
// 导出 Excel 按钮的 loading 状态
|
|
400
400
|
exportExcelLoading: false,
|
|
401
401
|
searchFormExpanded: false,
|
|
@@ -581,7 +581,17 @@ var TableStore = iRenderer.iRendererStore
|
|
|
581
581
|
function getSearchableColumns() {
|
|
582
582
|
return self.columns.filter(function (column) { return column.searchable; });
|
|
583
583
|
}
|
|
584
|
+
function getSelectionUpperLimit() {
|
|
585
|
+
var keep = self.keepItemSelectionOnPageChange;
|
|
586
|
+
var selectionUpperLimit = keep
|
|
587
|
+
? self.maxKeepItemSelectionLength !== Infinity
|
|
588
|
+
? self.maxKeepItemSelectionLength
|
|
589
|
+
: self.maxItemSelectionLength
|
|
590
|
+
: self.maxItemSelectionLength;
|
|
591
|
+
return selectionUpperLimit;
|
|
592
|
+
}
|
|
584
593
|
return {
|
|
594
|
+
getSelectionUpperLimit: getSelectionUpperLimit,
|
|
585
595
|
get columnsData() {
|
|
586
596
|
return getColumnsExceptBuiltinTypes();
|
|
587
597
|
},
|
|
@@ -614,6 +624,10 @@ var TableStore = iRenderer.iRendererStore
|
|
|
614
624
|
return !!self.selectedRows.length;
|
|
615
625
|
},
|
|
616
626
|
get allChecked() {
|
|
627
|
+
var selectionUpperLimit = getSelectionUpperLimit();
|
|
628
|
+
if (selectionUpperLimit !== Infinity) {
|
|
629
|
+
return self.isSelectionThresholdReached;
|
|
630
|
+
}
|
|
617
631
|
// 只要selectedRows中包含checkableRows中的全部数据,就认为是全选
|
|
618
632
|
return self.checkableRows.every(function (item) {
|
|
619
633
|
return self.selectedRows.includes(item);
|
|
@@ -659,8 +673,8 @@ var TableStore = iRenderer.iRendererStore
|
|
|
659
673
|
get isSelectionThresholdReached() {
|
|
660
674
|
var _a, _b;
|
|
661
675
|
var selectedLength = (_b = (_a = self.data) === null || _a === void 0 ? void 0 : _a.selectedItems) === null || _b === void 0 ? void 0 : _b.length;
|
|
662
|
-
var maxLength =
|
|
663
|
-
if (!self.data ||
|
|
676
|
+
var maxLength = getSelectionUpperLimit();
|
|
677
|
+
if (!self.data || maxLength === Infinity) {
|
|
664
678
|
return false;
|
|
665
679
|
}
|
|
666
680
|
return maxLength <= selectedLength;
|
|
@@ -807,6 +821,8 @@ var TableStore = iRenderer.iRendererStore
|
|
|
807
821
|
config.keepItemSelectionOnPageChange !== undefined &&
|
|
808
822
|
(self.keepItemSelectionOnPageChange =
|
|
809
823
|
config.keepItemSelectionOnPageChange);
|
|
824
|
+
config.maxItemSelectionLength !== undefined &&
|
|
825
|
+
(self.maxItemSelectionLength = config.maxItemSelectionLength);
|
|
810
826
|
config.exportExcelLoading !== undefined &&
|
|
811
827
|
(self.exportExcelLoading = config.exportExcelLoading);
|
|
812
828
|
config.loading !== undefined && (self.loading = config.loading);
|
|
@@ -817,6 +833,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
817
833
|
typeof config.tableLayout === 'string' &&
|
|
818
834
|
(self.tableLayout = config.tableLayout);
|
|
819
835
|
if (config.columns && Array.isArray(config.columns)) {
|
|
836
|
+
self.columnsKey = getPersistDataKey(config.columns);
|
|
820
837
|
var columns = config.columns
|
|
821
838
|
.map(function (column) {
|
|
822
839
|
if ((options === null || options === void 0 ? void 0 : options.resolveDefinitions) &&
|
|
@@ -828,7 +845,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
828
845
|
})
|
|
829
846
|
.filter(function (column) { return column; });
|
|
830
847
|
// 更新列顺序,afterCreate生命周期中更新columns不会触发组件的render
|
|
831
|
-
var key =
|
|
848
|
+
var key = self.columnsKey;
|
|
832
849
|
var data = localStorage.getItem(key);
|
|
833
850
|
var tableMetaData = null;
|
|
834
851
|
if (data) {
|
|
@@ -932,7 +949,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
932
949
|
th.style.cssText += "".concat(typeof column.pristine.width === 'number'
|
|
933
950
|
? "width: ".concat(column.pristine.width, "px;")
|
|
934
951
|
: column.pristine.width
|
|
935
|
-
? "width: ".concat(column.pristine.width, ";")
|
|
952
|
+
? "width: ".concat(column.pristine.width, ";min-width: ").concat(column.pristine.width, ";")
|
|
936
953
|
: '' // todo 可能需要让修改过列宽的保持相应宽度,目前这样相当于重置了
|
|
937
954
|
);
|
|
938
955
|
});
|
|
@@ -1127,10 +1144,10 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1127
1144
|
function updateSelected(selected, valueField) {
|
|
1128
1145
|
self.selectedRows.clear();
|
|
1129
1146
|
selected.forEach(function (item) {
|
|
1130
|
-
var resolved = self.rows
|
|
1147
|
+
var resolved = helper.findTree(self.rows, function (a) { return a.pristine === item; });
|
|
1131
1148
|
// 先严格比较,
|
|
1132
1149
|
if (!resolved) {
|
|
1133
|
-
resolved = self.rows
|
|
1150
|
+
resolved = helper.findTree(self.rows, function (a) {
|
|
1134
1151
|
var selectValue = item[valueField || 'value'];
|
|
1135
1152
|
var itemValue = a.pristine[valueField || 'value'];
|
|
1136
1153
|
return selectValue === itemValue;
|
|
@@ -1138,7 +1155,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1138
1155
|
}
|
|
1139
1156
|
// 再宽松比较
|
|
1140
1157
|
if (!resolved) {
|
|
1141
|
-
resolved = self.rows
|
|
1158
|
+
resolved = helper.findTree(self.rows, function (a) {
|
|
1142
1159
|
var selectValue = item[valueField || 'value'];
|
|
1143
1160
|
var itemValue = a.pristine[valueField || 'value'];
|
|
1144
1161
|
return selectValue == itemValue;
|
|
@@ -1150,11 +1167,9 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1150
1167
|
}
|
|
1151
1168
|
function getSelectedRows() {
|
|
1152
1169
|
var _a;
|
|
1153
|
-
var maxLength = self.
|
|
1154
|
-
var keep = self.keepItemSelectionOnPageChange;
|
|
1170
|
+
var maxLength = self.getSelectionUpperLimit();
|
|
1155
1171
|
var selectedItems = (_a = self.data) === null || _a === void 0 ? void 0 : _a.selectedItems;
|
|
1156
|
-
if (
|
|
1157
|
-
maxLength &&
|
|
1172
|
+
if (maxLength !== Infinity &&
|
|
1158
1173
|
selectedItems &&
|
|
1159
1174
|
maxLength >= selectedItems.length) {
|
|
1160
1175
|
var restCheckableRows = self.checkableRows.filter(function (item) { return !item.checked; });
|
|
@@ -1269,10 +1284,10 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1269
1284
|
if (!self.data) {
|
|
1270
1285
|
return;
|
|
1271
1286
|
}
|
|
1272
|
-
var maxLength = self.
|
|
1287
|
+
var maxLength = self.getSelectionUpperLimit();
|
|
1273
1288
|
var selectedItems = self.data.selectedItems;
|
|
1274
1289
|
self.selectedRows.map(function (item) { return item.setCheckdisable(false); });
|
|
1275
|
-
if (maxLength && maxLength <= selectedItems.length) {
|
|
1290
|
+
if (maxLength !== Infinity && maxLength <= selectedItems.length) {
|
|
1276
1291
|
self.unSelectedRows.map(function (item) { return !item.checked && item.setCheckdisable(true); });
|
|
1277
1292
|
}
|
|
1278
1293
|
else {
|
|
@@ -1367,7 +1382,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1367
1382
|
* 前端持久化记录列排序,查询字段,显示列信息
|
|
1368
1383
|
*/
|
|
1369
1384
|
function persistSaveToggledColumns() {
|
|
1370
|
-
var key =
|
|
1385
|
+
var key = self.columnsKey;
|
|
1371
1386
|
localStorage.setItem(key, JSON.stringify({
|
|
1372
1387
|
// 可显示列index
|
|
1373
1388
|
toggledColumnIndex: self.activeToggaleColumns.map(function (item) { return item.index; }),
|
|
@@ -1411,10 +1426,11 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1411
1426
|
}
|
|
1412
1427
|
function getPersistDataKey(columns) {
|
|
1413
1428
|
// 这里的columns使用除了__开头的所有列
|
|
1414
|
-
// sort保证存储和读取的key值保持一致
|
|
1415
1429
|
return (location.pathname +
|
|
1416
1430
|
self.path +
|
|
1417
|
-
|
|
1431
|
+
// 不能 sort 因为原始列的顺序设计器是可能改变的,此时如果缓存了打开会失效
|
|
1432
|
+
// 还是缓存的顺序,不符合用户调整列顺序的预期
|
|
1433
|
+
columns.map(function (item, index) { return item.name || item.label || index; }).join('-'));
|
|
1418
1434
|
}
|
|
1419
1435
|
function setSearchFormExpanded(value) {
|
|
1420
1436
|
self.searchFormExpanded = !!value;
|
|
@@ -1460,7 +1476,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1460
1476
|
if (!mobxStateTree.isAlive(self)) {
|
|
1461
1477
|
return;
|
|
1462
1478
|
}
|
|
1463
|
-
var key =
|
|
1479
|
+
var key = self.columnsKey;
|
|
1464
1480
|
var data = localStorage.getItem(key);
|
|
1465
1481
|
if (data) {
|
|
1466
1482
|
var tableMetaData_1 = JSON.parse(data);
|
package/lib/store/table2.js
CHANGED
package/lib/theme.js
CHANGED
package/lib/utils/Animation.js
CHANGED
package/lib/utils/ColorScale.js
CHANGED
package/lib/utils/DataSchema.js
CHANGED
package/lib/utils/DataScope.js
CHANGED
package/lib/utils/RootClose.js
CHANGED
package/lib/utils/SimpleMap.js
CHANGED
package/lib/utils/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.2.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -278,6 +278,7 @@ function callStrFunction(fn, argNames) {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
function responseAdaptor(ret, api) {
|
|
281
|
+
var _a;
|
|
281
282
|
var data = ret.data;
|
|
282
283
|
var hasStatusField = true;
|
|
283
284
|
if (!data) {
|
|
@@ -285,7 +286,7 @@ function responseAdaptor(ret, api) {
|
|
|
285
286
|
}
|
|
286
287
|
// 返回内容是 string,说明 content-type 不是 json,这时可能是返回了纯文本或 html
|
|
287
288
|
if (typeof data === 'string') {
|
|
288
|
-
var contentType = ret.headers['content-type'] || '';
|
|
289
|
+
var contentType = ((_a = ret.headers) === null || _a === void 0 ? void 0 : _a['content-type']) || '';
|
|
289
290
|
// 如果是文本类型就尝试解析一下
|
|
290
291
|
if (ret.headers &&
|
|
291
292
|
contentType.startsWith('text/') &&
|
package/lib/utils/arraySlice.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.2.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -16,6 +16,7 @@ var tslib = require('tslib');
|
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
18
|
function attachmentAdpator(response, __, api) {
|
|
19
|
+
var _a;
|
|
19
20
|
if (response && response.headers && response.headers['content-disposition']) {
|
|
20
21
|
var disposition = response.headers['content-disposition'];
|
|
21
22
|
var filename = '';
|
|
@@ -39,7 +40,7 @@ function attachmentAdpator(response, __, api) {
|
|
|
39
40
|
filename = filename.replace(/\+/g, ' ');
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
var type = response.headers['content-type'];
|
|
43
|
+
var type = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['content-type'];
|
|
43
44
|
var blob = response.data.toString() === '[object Blob]'
|
|
44
45
|
? response.data
|
|
45
46
|
: new Blob([response.data], { type: type });
|
package/lib/utils/autobind.js
CHANGED
package/lib/utils/browser.d.ts
CHANGED
package/lib/utils/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.2.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -11,5 +11,11 @@ var chromeVersion = (function getChromeVersion() {
|
|
|
11
11
|
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
|
12
12
|
return raw ? parseInt(raw[2], 10) : false;
|
|
13
13
|
})();
|
|
14
|
+
var isSafari = navigator.vendor &&
|
|
15
|
+
navigator.vendor.indexOf('Apple') > -1 &&
|
|
16
|
+
navigator.userAgent &&
|
|
17
|
+
navigator.userAgent.indexOf('CriOS') == -1 &&
|
|
18
|
+
navigator.userAgent.indexOf('FxiOS') == -1;
|
|
14
19
|
|
|
15
20
|
exports.chromeVersion = chromeVersion;
|
|
21
|
+
exports.isSafari = isSafari;
|
package/lib/utils/concatData.js
CHANGED
package/lib/utils/dataMapping.js
CHANGED
package/lib/utils/date.js
CHANGED
package/lib/utils/debug.js
CHANGED
package/lib/utils/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.2.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -134,7 +134,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
134
134
|
? overlayHeight
|
|
135
135
|
: overlayHeight / 2;
|
|
136
136
|
// 如果还有其他可选项,则做位置判断,是否在可视区域,不完全在则继续看其他定位情况。
|
|
137
|
-
if (tests.length) {
|
|
137
|
+
if (tests.length || isAuto) {
|
|
138
138
|
var transformed = {
|
|
139
139
|
x: clip.x + positionLeft / scaleX,
|
|
140
140
|
y: clip.y + positionTop / scaleY,
|
|
@@ -158,6 +158,11 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
158
158
|
if (visibleX && visibleY) {
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
161
|
+
else if (isAuto && tests.length === 0) {
|
|
162
|
+
// 如果是 auto 模式,且最后一个方向都不可见,则直接平移到可见区域
|
|
163
|
+
visibleY || (positionTop = window.innerHeight - transformed.height);
|
|
164
|
+
visibleX || (positionLeft = window.innerWidth - transformed.width);
|
|
165
|
+
}
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
// todo arrow 位置支持
|
package/lib/utils/errors.js
CHANGED
package/lib/utils/escapeHtml.js
CHANGED
package/lib/utils/filter.js
CHANGED
package/lib/utils/formula.js
CHANGED
package/lib/utils/getVariable.js
CHANGED
package/lib/utils/grammar.js
CHANGED
package/lib/utils/helper.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ type Mutable<T> = {
|
|
|
41
41
|
};
|
|
42
42
|
export declare function changedEffect<T extends Record<string, any>>(attrs: string | Array<string>, origin: T, data: T, effect: (changes: Partial<Mutable<T>>) => void, strictMode?: boolean): void;
|
|
43
43
|
export declare function rmUndefined(obj: PlainObject): PlainObject;
|
|
44
|
-
export declare function isObjectShallowModified(prev: any, next: any, strictModeOrFunc?: boolean | ((lhs: any, rhs: any) => boolean), ignoreUndefined?: boolean, stack?: Array<any
|
|
44
|
+
export declare function isObjectShallowModified(prev: any, next: any, strictModeOrFunc?: boolean | ((lhs: any, rhs: any) => boolean), ignoreUndefined?: boolean, stack?: Array<any>, maxDepth?: number): boolean;
|
|
45
45
|
export declare function isArrayChildrenModified(prev: Array<any>, next: Array<any>, strictMode?: boolean): boolean;
|
|
46
46
|
export declare function immutableExtends(to: any, from: any, deep?: boolean): any;
|
|
47
47
|
export declare function makeColumnClassBuild(steps: number, classNameTpl?: string): (schema: Schema) => any;
|
|
@@ -383,3 +383,10 @@ export declare function buildTrackExpression(schema: any): string;
|
|
|
383
383
|
export declare function evalTrackExpression(expression: string, data: Record<string, any>): string;
|
|
384
384
|
export declare function importLazyComponent(mod: any): any;
|
|
385
385
|
export declare function replaceUrlParams(path: string, params: Record<string, any>): string;
|
|
386
|
+
export declare const TEST_ID_KEY: 'data-testid';
|
|
387
|
+
export declare function buildTestId(testid?: string, data?: PlainObject): {
|
|
388
|
+
"data-testid"?: undefined;
|
|
389
|
+
} | {
|
|
390
|
+
"data-testid": string;
|
|
391
|
+
};
|
|
392
|
+
export declare function getTestId(testid?: string, data?: PlainObject): string | undefined;
|