amis-core 3.4.0 → 3.4.1
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 +8 -8
- package/esm/SchemaRenderer.js +16 -12
- package/esm/Scoped.js +3 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +9 -8
- package/esm/actions/Action.js +1 -1
- package/esm/actions/AjaxAction.js +2 -2
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +3 -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/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/StatusAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.d.ts +4 -6
- package/esm/components/CustomStyle.js +29 -5
- package/esm/components/LazyComponent.d.ts +1 -2
- package/esm/components/LazyComponent.js +12 -8
- package/esm/components/Overlay.js +3 -1
- package/esm/components/PopOver.d.ts +12 -12
- package/esm/components/PopOver.js +3 -1
- package/esm/env.d.ts +2 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +7 -7
- package/esm/factory.js +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +5 -5
- package/esm/locale.d.ts +1 -1
- package/esm/locale.js +3 -3
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +10 -8
- package/esm/renderers/Item.d.ts +24 -56
- package/esm/renderers/Item.js +25 -31
- package/esm/renderers/Options.js +14 -12
- 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 +70 -80
- package/esm/store/app.js +3 -1
- package/esm/store/combo.d.ts +384 -0
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +31 -25
- package/esm/store/form.d.ts +160 -0
- package/esm/store/form.js +15 -13
- package/esm/store/formItem.d.ts +4 -0
- package/esm/store/formItem.js +42 -26
- package/esm/store/iRenderer.js +3 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.d.ts +1 -1
- package/esm/store/root.js +12 -5
- package/esm/store/service.js +38 -33
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +760 -21
- package/esm/store/table.js +155 -55
- package/esm/store/table2.js +11 -8
- package/esm/theme.d.ts +18 -31
- package/esm/theme.js +1 -1
- 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.d.ts +3 -3
- package/esm/utils/api.js +2 -2
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.d.ts +1 -0
- package/esm/utils/debug.js +24 -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 +13 -1
- package/esm/utils/helper.js +99 -5
- 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.d.ts +1 -1
- package/esm/utils/keyToPath.js +2 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.js +1 -1
- package/esm/utils/memoryParse.js +1 -1
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.js +1 -1
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +2 -2
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.d.ts +3 -1
- package/esm/utils/resize-sensor.js +34 -22
- 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.d.ts +22 -14
- package/esm/utils/style-helper.js +181 -120
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +1 -1
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.js +8 -8
- package/lib/SchemaRenderer.js +16 -12
- package/lib/Scoped.js +3 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +9 -8
- package/lib/actions/Action.js +1 -1
- package/lib/actions/AjaxAction.js +2 -2
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +3 -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/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/StatusAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.d.ts +4 -6
- package/lib/components/CustomStyle.js +28 -4
- package/lib/components/LazyComponent.d.ts +1 -2
- package/lib/components/LazyComponent.js +12 -9
- package/lib/components/Overlay.js +3 -1
- package/lib/components/PopOver.d.ts +12 -12
- package/lib/components/PopOver.js +3 -1
- package/lib/env.d.ts +2 -2
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +7 -7
- package/lib/factory.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -3
- package/lib/locale.d.ts +1 -1
- package/lib/locale.js +3 -3
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +10 -8
- package/lib/renderers/Item.d.ts +24 -56
- package/lib/renderers/Item.js +26 -31
- package/lib/renderers/Options.js +14 -12
- 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 +70 -79
- package/lib/store/app.js +3 -1
- package/lib/store/combo.d.ts +384 -0
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +31 -25
- package/lib/store/form.d.ts +160 -0
- package/lib/store/form.js +15 -13
- package/lib/store/formItem.d.ts +4 -0
- package/lib/store/formItem.js +41 -25
- package/lib/store/iRenderer.js +3 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.d.ts +1 -1
- package/lib/store/root.js +11 -4
- package/lib/store/service.js +38 -33
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +760 -21
- package/lib/store/table.js +155 -55
- package/lib/store/table2.js +11 -8
- package/lib/theme.d.ts +18 -31
- package/lib/theme.js +1 -1
- 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.d.ts +3 -3
- package/lib/utils/api.js +2 -2
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.d.ts +1 -0
- package/lib/utils/debug.js +24 -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 +13 -1
- package/lib/utils/helper.js +101 -4
- 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.d.ts +1 -1
- package/lib/utils/keyToPath.js +2 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.js +1 -1
- package/lib/utils/memoryParse.js +1 -1
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.js +1 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +2 -2
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.d.ts +3 -1
- package/lib/utils/resize-sensor.js +34 -22
- 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.d.ts +22 -14
- package/lib/utils/style-helper.js +188 -120
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.js +1 -1
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +1 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +5 -5
package/lib/store/table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -57,6 +57,7 @@ var Column = mobxStateTree.types
|
|
|
57
57
|
rawIndex: 0,
|
|
58
58
|
width: 0,
|
|
59
59
|
minWidth: 0,
|
|
60
|
+
realWidth: 0,
|
|
60
61
|
breakpoint: mobxStateTree.types.optional(mobxStateTree.types.frozen(), undefined),
|
|
61
62
|
pristine: mobxStateTree.types.optional(mobxStateTree.types.frozen(), undefined),
|
|
62
63
|
remark: mobxStateTree.types.optional(mobxStateTree.types.frozen(), undefined),
|
|
@@ -80,11 +81,14 @@ var Column = mobxStateTree.types
|
|
|
80
81
|
var table = mobxStateTree.getParent(self, 2);
|
|
81
82
|
table.persistSaveToggledColumns();
|
|
82
83
|
},
|
|
83
|
-
|
|
84
|
+
setMinWidth: function (value) {
|
|
85
|
+
self.minWidth = value;
|
|
86
|
+
},
|
|
87
|
+
setWidth: function (value) {
|
|
84
88
|
self.width = value;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
},
|
|
90
|
+
setRealWidth: function (value) {
|
|
91
|
+
self.realWidth = value;
|
|
88
92
|
}
|
|
89
93
|
}); });
|
|
90
94
|
var Row = mobxStateTree.types
|
|
@@ -98,12 +102,15 @@ var Row = mobxStateTree.types
|
|
|
98
102
|
rowSpans: mobxStateTree.types.frozen({}),
|
|
99
103
|
index: mobxStateTree.types.number,
|
|
100
104
|
newIndex: mobxStateTree.types.number,
|
|
105
|
+
nth: 0,
|
|
101
106
|
path: '',
|
|
102
107
|
expandable: false,
|
|
103
108
|
checkdisable: false,
|
|
104
109
|
isHover: false,
|
|
105
110
|
children: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.late(function () { return Row; })), []),
|
|
106
|
-
depth: mobxStateTree.types.number
|
|
111
|
+
depth: mobxStateTree.types.number,
|
|
112
|
+
appeared: true,
|
|
113
|
+
lazyRender: false
|
|
107
114
|
})
|
|
108
115
|
.views(function (self) { return ({
|
|
109
116
|
get checked() {
|
|
@@ -198,6 +205,11 @@ var Row = mobxStateTree.types
|
|
|
198
205
|
return false;
|
|
199
206
|
}
|
|
200
207
|
return true;
|
|
208
|
+
},
|
|
209
|
+
get indentStyle() {
|
|
210
|
+
return {
|
|
211
|
+
paddingLeft: "calc(".concat(self.depth - 1, " * var(--Table-tree-indent))")
|
|
212
|
+
};
|
|
201
213
|
}
|
|
202
214
|
}); })
|
|
203
215
|
.actions(function (self) { return ({
|
|
@@ -249,6 +261,9 @@ var Row = mobxStateTree.types
|
|
|
249
261
|
index++;
|
|
250
262
|
}
|
|
251
263
|
}
|
|
264
|
+
},
|
|
265
|
+
markAppeared: function (value) {
|
|
266
|
+
value && (self.appeared = !!value);
|
|
252
267
|
}
|
|
253
268
|
}); });
|
|
254
269
|
var TableStore = iRenderer.iRendererStore
|
|
@@ -261,6 +276,8 @@ var TableStore = iRenderer.iRendererStore
|
|
|
261
276
|
primaryField: 'id',
|
|
262
277
|
orderBy: '',
|
|
263
278
|
orderDir: mobxStateTree.types.optional(mobxStateTree.types.union(mobxStateTree.types.literal('asc'), mobxStateTree.types.literal('desc'), mobxStateTree.types.literal('')), 'asc'),
|
|
279
|
+
loading: false,
|
|
280
|
+
canAccessSuperData: false,
|
|
264
281
|
draggable: false,
|
|
265
282
|
dragging: false,
|
|
266
283
|
selectable: false,
|
|
@@ -279,7 +296,9 @@ var TableStore = iRenderer.iRendererStore
|
|
|
279
296
|
keepItemSelectionOnPageChange: false,
|
|
280
297
|
// 导出 Excel 按钮的 loading 状态
|
|
281
298
|
exportExcelLoading: false,
|
|
282
|
-
searchFormExpanded: false
|
|
299
|
+
searchFormExpanded: false,
|
|
300
|
+
lazyRenderAfter: 100,
|
|
301
|
+
tableLayout: 'auto'
|
|
283
302
|
})
|
|
284
303
|
.views(function (self) {
|
|
285
304
|
function getColumnsExceptBuiltinTypes() {
|
|
@@ -315,7 +334,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
315
334
|
: item.type === '__dragme'
|
|
316
335
|
? self.dragging
|
|
317
336
|
: item.type === '__expandme'
|
|
318
|
-
?
|
|
337
|
+
? getFootableColumns().length && !self.dragging
|
|
319
338
|
: (item.toggled || !item.toggable) &&
|
|
320
339
|
(!self.footable ||
|
|
321
340
|
!item.breakpoint ||
|
|
@@ -515,8 +534,11 @@ var TableStore = iRenderer.iRendererStore
|
|
|
515
534
|
get unSelectedRows() {
|
|
516
535
|
return getUnSelectedRows();
|
|
517
536
|
},
|
|
537
|
+
get falttenedRows() {
|
|
538
|
+
return helper.flattenTree(self.rows);
|
|
539
|
+
},
|
|
518
540
|
get checkableRows() {
|
|
519
|
-
return
|
|
541
|
+
return this.falttenedRows.filter(function (item) { return item.checkable; });
|
|
520
542
|
},
|
|
521
543
|
get expandableRows() {
|
|
522
544
|
return self.rows.filter(function (item) { return item.expandable; });
|
|
@@ -569,7 +591,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
569
591
|
return list;
|
|
570
592
|
},
|
|
571
593
|
get columnWidthReady() {
|
|
572
|
-
return getFilteredColumns().every(function (column) { return column.
|
|
594
|
+
return getFilteredColumns().every(function (column) { return column.realWidth; });
|
|
573
595
|
},
|
|
574
596
|
getStickyStyles: function (column, columns) {
|
|
575
597
|
var stickyClassName = '';
|
|
@@ -587,20 +609,24 @@ var TableStore = iRenderer.iRendererStore
|
|
|
587
609
|
})) {
|
|
588
610
|
stickyClassName += ' is-sticky-last-left';
|
|
589
611
|
}
|
|
590
|
-
var left =
|
|
612
|
+
var left = [];
|
|
591
613
|
while (index >= 0) {
|
|
592
614
|
var col = columns[index];
|
|
593
615
|
if ((col && col.fixed === 'left') ||
|
|
594
616
|
autoFixLeftColumns.includes(col.type)) {
|
|
595
|
-
left
|
|
617
|
+
left.push("var(--Table-column-".concat(col.index, "-width)"));
|
|
596
618
|
}
|
|
597
619
|
index--;
|
|
598
620
|
}
|
|
599
|
-
style.left = left
|
|
621
|
+
style.left = left.length
|
|
622
|
+
? left.length === 1
|
|
623
|
+
? left[0]
|
|
624
|
+
: "calc(".concat(left.join(' + '), ")")
|
|
625
|
+
: 0;
|
|
600
626
|
}
|
|
601
627
|
else if (column.fixed === 'right') {
|
|
602
628
|
stickyClassName = 'is-sticky is-sticky-right';
|
|
603
|
-
var right =
|
|
629
|
+
var right = [];
|
|
604
630
|
var index = columns.indexOf(column) + 1;
|
|
605
631
|
if (columns.slice(0, index - 1).every(function (col) { return col.fixed !== 'right'; })) {
|
|
606
632
|
stickyClassName += ' is-sticky-first-right';
|
|
@@ -609,13 +635,28 @@ var TableStore = iRenderer.iRendererStore
|
|
|
609
635
|
while (index < len) {
|
|
610
636
|
var col = columns[index];
|
|
611
637
|
if (col && col.fixed === 'right') {
|
|
612
|
-
right
|
|
638
|
+
right.push("var(--Table-column-".concat(col.index, "-width)"));
|
|
613
639
|
}
|
|
614
640
|
index++;
|
|
615
641
|
}
|
|
616
|
-
style.right = right
|
|
642
|
+
style.right = right.length
|
|
643
|
+
? right.length === 1
|
|
644
|
+
? right[0]
|
|
645
|
+
: "calc(".concat(right.join(' + '), ")")
|
|
646
|
+
: 0;
|
|
617
647
|
}
|
|
618
648
|
return [style, stickyClassName];
|
|
649
|
+
},
|
|
650
|
+
get items() {
|
|
651
|
+
return self.rows.concat();
|
|
652
|
+
},
|
|
653
|
+
buildStyles: function (style) {
|
|
654
|
+
style = tslib.__assign({}, style);
|
|
655
|
+
getFilteredColumns().forEach(function (column) {
|
|
656
|
+
style["--Table-column-".concat(column.index, "-width")] =
|
|
657
|
+
column.realWidth + 'px';
|
|
658
|
+
});
|
|
659
|
+
return style;
|
|
619
660
|
}
|
|
620
661
|
};
|
|
621
662
|
})
|
|
@@ -624,38 +665,54 @@ var TableStore = iRenderer.iRendererStore
|
|
|
624
665
|
function setTable(ref) {
|
|
625
666
|
tableRef = ref;
|
|
626
667
|
}
|
|
668
|
+
function getTable() {
|
|
669
|
+
return tableRef;
|
|
670
|
+
}
|
|
627
671
|
function update(config) {
|
|
628
|
-
|
|
672
|
+
var _a;
|
|
673
|
+
config.primaryField !== undefined &&
|
|
629
674
|
(self.primaryField = config.primaryField);
|
|
630
|
-
config.selectable !==
|
|
631
|
-
config.columnsTogglable !==
|
|
675
|
+
config.selectable !== undefined && (self.selectable = config.selectable);
|
|
676
|
+
config.columnsTogglable !== undefined &&
|
|
632
677
|
(self.columnsTogglable = config.columnsTogglable);
|
|
633
|
-
config.draggable !==
|
|
634
|
-
if (typeof config.orderBy === 'string'
|
|
635
|
-
|
|
678
|
+
config.draggable !== undefined && (self.draggable = config.draggable);
|
|
679
|
+
if (typeof config.orderBy === 'string' ||
|
|
680
|
+
typeof config.orderDir === 'string') {
|
|
681
|
+
setOrderByInfo((_a = config.orderBy) !== null && _a !== void 0 ? _a : self.orderBy, config.orderDir !== undefined
|
|
682
|
+
? config.orderDir === 'desc'
|
|
683
|
+
? 'desc'
|
|
684
|
+
: 'asc'
|
|
685
|
+
: self.orderDir);
|
|
636
686
|
}
|
|
637
|
-
config.multiple !==
|
|
638
|
-
config.footable !==
|
|
639
|
-
config.expandConfig !==
|
|
687
|
+
config.multiple !== undefined && (self.multiple = config.multiple);
|
|
688
|
+
config.footable !== undefined && (self.footable = config.footable);
|
|
689
|
+
config.expandConfig !== undefined &&
|
|
640
690
|
(self.expandConfig = config.expandConfig);
|
|
641
|
-
config.itemCheckableOn !==
|
|
691
|
+
config.itemCheckableOn !== undefined &&
|
|
642
692
|
(self.itemCheckableOn = config.itemCheckableOn);
|
|
643
|
-
config.itemDraggableOn !==
|
|
693
|
+
config.itemDraggableOn !== undefined &&
|
|
644
694
|
(self.itemDraggableOn = config.itemDraggableOn);
|
|
645
|
-
config.hideCheckToggler !==
|
|
695
|
+
config.hideCheckToggler !== undefined &&
|
|
646
696
|
(self.hideCheckToggler = !!config.hideCheckToggler);
|
|
647
|
-
config.combineNum !==
|
|
697
|
+
config.combineNum !== undefined &&
|
|
648
698
|
(self.combineNum = parseInt(config.combineNum, 10) || 0);
|
|
649
|
-
config.combineFromIndex !==
|
|
699
|
+
config.combineFromIndex !== undefined &&
|
|
650
700
|
(self.combineFromIndex =
|
|
651
701
|
parseInt(config.combineFromIndex, 10) || 0);
|
|
652
|
-
config.maxKeepItemSelectionLength !==
|
|
702
|
+
config.maxKeepItemSelectionLength !== undefined &&
|
|
653
703
|
(self.maxKeepItemSelectionLength = config.maxKeepItemSelectionLength);
|
|
654
|
-
config.keepItemSelectionOnPageChange !==
|
|
704
|
+
config.keepItemSelectionOnPageChange !== undefined &&
|
|
655
705
|
(self.keepItemSelectionOnPageChange =
|
|
656
706
|
config.keepItemSelectionOnPageChange);
|
|
657
707
|
config.exportExcelLoading !== undefined &&
|
|
658
708
|
(self.exportExcelLoading = config.exportExcelLoading);
|
|
709
|
+
config.loading !== undefined && (self.loading = config.loading);
|
|
710
|
+
config.canAccessSuperData !== undefined &&
|
|
711
|
+
(self.canAccessSuperData = !!config.canAccessSuperData);
|
|
712
|
+
typeof config.lazyRenderAfter === 'number' &&
|
|
713
|
+
(self.lazyRenderAfter = config.lazyRenderAfter);
|
|
714
|
+
typeof config.tableLayout === 'string' &&
|
|
715
|
+
(self.tableLayout = config.tableLayout);
|
|
659
716
|
if (config.columns && Array.isArray(config.columns)) {
|
|
660
717
|
var columns = config.columns
|
|
661
718
|
.filter(function (column) { return column; })
|
|
@@ -718,22 +775,41 @@ var TableStore = iRenderer.iRendererStore
|
|
|
718
775
|
self.columns.replace(columns);
|
|
719
776
|
}
|
|
720
777
|
}
|
|
721
|
-
function
|
|
778
|
+
function initTableWidth() {
|
|
722
779
|
var table = tableRef;
|
|
723
780
|
if (!table) {
|
|
724
781
|
return;
|
|
725
782
|
}
|
|
726
783
|
var tableWidth = table.parentElement.offsetWidth;
|
|
727
784
|
var thead = table.querySelector(':scope>thead');
|
|
728
|
-
var tbody =
|
|
785
|
+
var tbody = null;
|
|
786
|
+
var htmls = [];
|
|
787
|
+
var isFixed = self.tableLayout === 'fixed';
|
|
788
|
+
var someSettedWidth = self.columns.some(function (column) { return column.pristine.width; });
|
|
789
|
+
var minWidths = {};
|
|
790
|
+
// fixed 模式需要参考 auto 获得列最小宽度
|
|
791
|
+
if (isFixed) {
|
|
792
|
+
tbody = table.querySelector(':scope>tbody');
|
|
793
|
+
htmls.push("<table style=\"table-layout:auto!important;width:0!important;min-width:0!important;\" class=\"".concat(table.className, "\">").concat(thead.outerHTML, "</table>"));
|
|
794
|
+
}
|
|
795
|
+
if (someSettedWidth || isFixed) {
|
|
796
|
+
htmls.push("<table style=\"table-layout:auto!important;min-width:".concat(tableWidth, "px!important;width:").concat(tableWidth, "px!important;\" class=\"").concat(table.className.replace('is-layout-fixed', ''), "\">").concat(thead.outerHTML).concat(tbody ? "<tbody>".concat(tbody.innerHTML, "</tbody>") : '', "</table>"));
|
|
797
|
+
}
|
|
798
|
+
if (!htmls.length) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
729
801
|
var div = document.createElement('div');
|
|
730
802
|
div.className = 'amis-scope'; // jssdk 里面 css 会在这一层
|
|
731
803
|
div.style.cssText += "visibility: hidden!important;";
|
|
732
|
-
div.innerHTML =
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
804
|
+
div.innerHTML = htmls.join('');
|
|
805
|
+
var ths1 = [];
|
|
806
|
+
var ths2 = [];
|
|
807
|
+
if (isFixed) {
|
|
808
|
+
ths1 = [].slice.call(div.querySelectorAll(':scope>table:first-child>thead>tr>th[data-index]'));
|
|
809
|
+
}
|
|
810
|
+
if (someSettedWidth || isFixed) {
|
|
811
|
+
ths2 = [].slice.call(div.querySelectorAll(':scope>table:last-child>thead>tr>th[data-index]'));
|
|
812
|
+
}
|
|
737
813
|
ths1.forEach(function (th) {
|
|
738
814
|
th.style.cssText += 'width: 0';
|
|
739
815
|
});
|
|
@@ -744,24 +820,38 @@ var TableStore = iRenderer.iRendererStore
|
|
|
744
820
|
? "width: ".concat(column.pristine.width, "px;")
|
|
745
821
|
: column.pristine.width
|
|
746
822
|
? "width: ".concat(column.pristine.width, ";")
|
|
747
|
-
: ''
|
|
823
|
+
: '' // todo 可能需要让修改过列宽的保持相应宽度,目前这样相当于重置了
|
|
824
|
+
);
|
|
748
825
|
});
|
|
749
826
|
document.body.appendChild(div);
|
|
750
|
-
var minWidths = {};
|
|
751
827
|
ths1.forEach(function (th) {
|
|
752
|
-
|
|
828
|
+
var index = parseInt(th.getAttribute('data-index'), 10);
|
|
829
|
+
minWidths[index] = th.clientWidth;
|
|
830
|
+
var column = self.columns[index];
|
|
831
|
+
column.setMinWidth(minWidths[index]);
|
|
753
832
|
});
|
|
754
833
|
ths2.forEach(function (col) {
|
|
755
834
|
var index = parseInt(col.getAttribute('data-index'), 10);
|
|
756
835
|
var column = self.columns[index];
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
836
|
+
if (column.pristine.width || isFixed) {
|
|
837
|
+
column.setWidth(Math.max(typeof column.pristine.width === 'number'
|
|
838
|
+
? column.pristine.width
|
|
839
|
+
: col.clientWidth, minWidths[index] || 0));
|
|
840
|
+
}
|
|
760
841
|
});
|
|
761
842
|
document.body.removeChild(div);
|
|
762
843
|
}
|
|
763
|
-
function
|
|
764
|
-
|
|
844
|
+
function syncTableWidth() {
|
|
845
|
+
var table = tableRef;
|
|
846
|
+
if (!table) {
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
var cols = [].slice.call(table.querySelectorAll(':scope>colgroup>col[data-index]'));
|
|
850
|
+
cols.forEach(function (col) {
|
|
851
|
+
var index = parseInt(col.getAttribute('data-index'), 10);
|
|
852
|
+
var column = self.columns[index];
|
|
853
|
+
column.setRealWidth(col.clientWidth);
|
|
854
|
+
});
|
|
765
855
|
}
|
|
766
856
|
function combineCell(arr, keys) {
|
|
767
857
|
if (!keys.length || !arr.length) {
|
|
@@ -826,7 +916,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
826
916
|
}
|
|
827
917
|
return combineCell(arr, keys);
|
|
828
918
|
}
|
|
829
|
-
function initChildren(children, depth, pindex, parentId, path) {
|
|
919
|
+
function initChildren(children, depth, pindex, parentId, path, nThRef) {
|
|
830
920
|
if (path === void 0) { path = ''; }
|
|
831
921
|
depth += 1;
|
|
832
922
|
return children.map(function (item, index) {
|
|
@@ -845,12 +935,13 @@ var TableStore = iRenderer.iRendererStore
|
|
|
845
935
|
path: "".concat(path).concat(index),
|
|
846
936
|
depth: depth,
|
|
847
937
|
index: index,
|
|
938
|
+
nth: nThRef.index++,
|
|
848
939
|
newIndex: index,
|
|
849
940
|
pristine: item,
|
|
850
941
|
data: item,
|
|
851
942
|
rowSpans: {},
|
|
852
943
|
children: item && Array.isArray(item.children)
|
|
853
|
-
? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."))
|
|
944
|
+
? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."), nThRef)
|
|
854
945
|
: [],
|
|
855
946
|
expandable: !!((item && Array.isArray(item.children) && item.children.length) ||
|
|
856
947
|
(self.footable && self.footableColumns.length))
|
|
@@ -862,6 +953,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
862
953
|
// self.expandedRows.clear();
|
|
863
954
|
/* 避免输入内容为非数组挂掉 */
|
|
864
955
|
rows = !Array.isArray(rows) ? [] : rows;
|
|
956
|
+
var nThRef = { index: 0 };
|
|
865
957
|
var arr = rows.map(function (item, index) {
|
|
866
958
|
var _a;
|
|
867
959
|
if (!object.isObject(item)) {
|
|
@@ -876,13 +968,14 @@ var TableStore = iRenderer.iRendererStore
|
|
|
876
968
|
key: String("".concat(index, "-1-").concat(index)),
|
|
877
969
|
depth: 1,
|
|
878
970
|
index: index,
|
|
971
|
+
nth: nThRef.index++,
|
|
879
972
|
newIndex: index,
|
|
880
973
|
pristine: item,
|
|
881
974
|
path: "".concat(index),
|
|
882
975
|
data: item,
|
|
883
976
|
rowSpans: {},
|
|
884
977
|
children: item && Array.isArray(item.children)
|
|
885
|
-
? initChildren(item.children, 1, index, id, "".concat(index, "."))
|
|
978
|
+
? initChildren(item.children, 1, index, id, "".concat(index, "."), nThRef)
|
|
886
979
|
: [],
|
|
887
980
|
expandable: !!((item && Array.isArray(item.children) && item.children.length) ||
|
|
888
981
|
(self.footable && self.footableColumns.length))
|
|
@@ -893,6 +986,14 @@ var TableStore = iRenderer.iRendererStore
|
|
|
893
986
|
}
|
|
894
987
|
replaceRow(arr, reUseRow);
|
|
895
988
|
self.isNested = self.rows.some(function (item) { return item.children.length; });
|
|
989
|
+
// 前 20 个直接渲染,后面的按需渲染
|
|
990
|
+
if (self.lazyRenderAfter &&
|
|
991
|
+
self.falttenedRows.length > self.lazyRenderAfter) {
|
|
992
|
+
for (var i = self.lazyRenderAfter, len = self.falttenedRows.length; i < len; i++) {
|
|
993
|
+
self.falttenedRows[i].appeared = false;
|
|
994
|
+
self.falttenedRows[i].lazyRender = true;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
896
997
|
var expand = self.footable && self.footable.expand;
|
|
897
998
|
if (expand === 'first' ||
|
|
898
999
|
(self.expandConfig && self.expandConfig.expand === 'first')) {
|
|
@@ -1158,10 +1259,8 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1158
1259
|
function persistSaveToggledColumns() {
|
|
1159
1260
|
var key = getPersistDataKey(self.columnsData);
|
|
1160
1261
|
localStorage.setItem(key, JSON.stringify({
|
|
1161
|
-
// 可显示列index
|
|
1162
|
-
toggledColumnIndex: self.activeToggaleColumns
|
|
1163
|
-
.filter(function (item) { var _a; return !(((_a = item.pristine) === null || _a === void 0 ? void 0 : _a.toggled) === false); })
|
|
1164
|
-
.map(function (item) { return item.index; }),
|
|
1262
|
+
// 可显示列index
|
|
1263
|
+
toggledColumnIndex: self.activeToggaleColumns.map(function (item) { return item.index; }),
|
|
1165
1264
|
// 列排序,name,label可能不存在
|
|
1166
1265
|
columnOrder: self.columnsData.map(function (item) { return item.name || item.label || item.rawIndex; }),
|
|
1167
1266
|
// 已激活的可查询列
|
|
@@ -1215,10 +1314,11 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1215
1314
|
}
|
|
1216
1315
|
return {
|
|
1217
1316
|
setTable: setTable,
|
|
1317
|
+
getTable: getTable,
|
|
1218
1318
|
update: update,
|
|
1219
1319
|
updateColumns: updateColumns,
|
|
1320
|
+
initTableWidth: initTableWidth,
|
|
1220
1321
|
syncTableWidth: syncTableWidth,
|
|
1221
|
-
invalidTableColumnWidth: invalidTableColumnWidth,
|
|
1222
1322
|
initRows: initRows,
|
|
1223
1323
|
updateSelected: updateSelected,
|
|
1224
1324
|
toggleAll: toggleAll,
|
package/lib/store/table2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -516,12 +516,13 @@ var TableStore2 = service.ServiceStore.named('TableStore2')
|
|
|
516
516
|
}
|
|
517
517
|
if (!json.ok) {
|
|
518
518
|
self.updateMessage((_d = (_c = (_b = (_a = api$1 === null || api$1 === void 0 ? void 0 : api$1.messages) === null || _a === void 0 ? void 0 : _a.failed) !== null && _b !== void 0 ? _b : json.msg) !== null && _c !== void 0 ? _c : options.errorMessage) !== null && _d !== void 0 ? _d : self.__('saveFailed'), true);
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
519
|
+
!(api$1 === null || api$1 === void 0 ? void 0 : api$1.silent) &&
|
|
520
|
+
mobxStateTree.getEnv(self).notify('error', self.msg, json.msgTimeout !== undefined
|
|
521
|
+
? {
|
|
522
|
+
closeButton: true,
|
|
523
|
+
timeout: json.msgTimeout
|
|
524
|
+
}
|
|
525
|
+
: undefined);
|
|
525
526
|
throw new ServerError(self.msg);
|
|
526
527
|
}
|
|
527
528
|
else {
|
|
@@ -541,7 +542,9 @@ var TableStore2 = service.ServiceStore.named('TableStore2')
|
|
|
541
542
|
if (!mobxStateTree.isAlive(self) || self.disposed) {
|
|
542
543
|
return [2 /*return*/];
|
|
543
544
|
}
|
|
544
|
-
|
|
545
|
+
!(api$1 === null || api$1 === void 0 ? void 0 : api$1.silent) &&
|
|
546
|
+
e_1.type !== 'ServerError' &&
|
|
547
|
+
mobxStateTree.getEnv(self).notify('error', e_1.message);
|
|
545
548
|
throw e_1;
|
|
546
549
|
case 3: return [2 /*return*/];
|
|
547
550
|
}
|
package/lib/theme.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import hoistNonReactStatic from 'hoist-non-react-statics';
|
|
3
|
-
export type ClassValue =
|
|
4
|
-
interface ClassDictionary {
|
|
5
|
-
[id: string]: any;
|
|
6
|
-
}
|
|
7
|
-
interface ClassArray extends Array<ClassValue> {
|
|
8
|
-
}
|
|
3
|
+
export type ClassValue = ClassValue[] | Record<string, any> | string | number | boolean | null | undefined;
|
|
9
4
|
export type ClassNamesFn = (...classes: ClassValue[]) => string;
|
|
10
5
|
interface ThemeConfig {
|
|
11
6
|
classPrefix?: string;
|
|
@@ -15,70 +10,62 @@ interface ThemeConfig {
|
|
|
15
10
|
components?: {
|
|
16
11
|
[propName: string]: any;
|
|
17
12
|
};
|
|
18
|
-
[
|
|
13
|
+
[propName: string]: any;
|
|
19
14
|
}
|
|
20
15
|
export declare function theme(name: string, config: Partial<ThemeConfig>): void;
|
|
21
16
|
export declare function makeClassnames(ns?: string): (...classes: ClassValue[]) => string;
|
|
22
|
-
export
|
|
17
|
+
export interface ThemeInstance extends ThemeConfig {
|
|
23
18
|
getRendererConfig: (name?: string) => any;
|
|
24
19
|
getComponentConfig: (name?: string) => any;
|
|
25
20
|
classnames: ClassNamesFn;
|
|
26
|
-
}
|
|
21
|
+
}
|
|
27
22
|
export declare function hasTheme(theme: string): boolean;
|
|
28
23
|
export declare function setDefaultTheme(theme: string): void;
|
|
29
24
|
export declare function classnames(...classes: ClassValue[]): any;
|
|
30
25
|
export declare function getClassPrefix(): string | undefined;
|
|
31
26
|
export declare function getTheme(theme: string): ThemeInstance;
|
|
32
27
|
export interface ThemeProps {
|
|
33
|
-
className?: string;
|
|
34
|
-
style?: {
|
|
35
|
-
[propName: string]: any;
|
|
36
|
-
};
|
|
37
|
-
classPrefix: string;
|
|
38
28
|
classnames: ClassNamesFn;
|
|
39
|
-
|
|
40
|
-
mobileUI?: boolean;
|
|
41
|
-
}
|
|
42
|
-
export interface ThemeOutterProps {
|
|
43
|
-
theme?: string;
|
|
29
|
+
classPrefix: string;
|
|
44
30
|
className?: string;
|
|
31
|
+
theme?: string;
|
|
45
32
|
mobileUI?: boolean;
|
|
46
33
|
style?: {
|
|
47
34
|
[propName: string]: any;
|
|
48
35
|
};
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
}
|
|
37
|
+
export interface ThemeOuterProps extends Partial<ThemeProps> {
|
|
51
38
|
}
|
|
52
39
|
export declare let defaultTheme: string;
|
|
53
40
|
export declare const ThemeContext: React.Context<string>;
|
|
54
41
|
export declare function themeable<T extends React.ComponentType<React.ComponentProps<T> & ThemeProps> & {
|
|
55
42
|
themeKey?: string;
|
|
56
43
|
}>(ComposedComponent: T): {
|
|
57
|
-
new (props: JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
44
|
+
new (props: JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps): {
|
|
58
45
|
ref: any;
|
|
59
46
|
childRef(ref: any): void;
|
|
60
47
|
getWrappedInstance(): any;
|
|
61
48
|
render(): React.JSX.Element;
|
|
62
49
|
context: unknown;
|
|
63
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
50
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
64
51
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
65
|
-
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
52
|
+
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>;
|
|
66
53
|
state: Readonly<{}>;
|
|
67
54
|
refs: {
|
|
68
55
|
[key: string]: React.ReactInstance;
|
|
69
56
|
};
|
|
70
57
|
componentDidMount?(): void;
|
|
71
|
-
shouldComponentUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
58
|
+
shouldComponentUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
72
59
|
componentWillUnmount?(): void;
|
|
73
60
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
74
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
75
|
-
componentDidUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
61
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, prevState: Readonly<{}>): any;
|
|
62
|
+
componentDidUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
76
63
|
componentWillMount?(): void;
|
|
77
64
|
UNSAFE_componentWillMount?(): void;
|
|
78
|
-
componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
79
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
80
|
-
componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
81
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> &
|
|
65
|
+
componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextContext: any): void;
|
|
66
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextContext: any): void;
|
|
67
|
+
componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
68
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
82
69
|
};
|
|
83
70
|
displayName: string;
|
|
84
71
|
contextType: React.Context<string>;
|
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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Api, ApiObject, EventTrack, fetcherResult, Payload } from '../types';
|
|
2
|
-
import {
|
|
2
|
+
import { FetcherConfig } from '../factory';
|
|
3
3
|
interface ApiCacheConfig extends ApiObject {
|
|
4
4
|
cachedPromise: Promise<any>;
|
|
5
5
|
requestTime: number;
|
|
@@ -14,14 +14,14 @@ export declare function str2function(contents: string, ...args: Array<string>):
|
|
|
14
14
|
export declare function str2AsyncFunction(contents: string, ...args: Array<string>): Function | null;
|
|
15
15
|
export declare function callStrFunction(this: any, fn: string | Function, argNames: Array<string>, ...args: Array<any>): any;
|
|
16
16
|
export declare function responseAdaptor(ret: fetcherResult, api: ApiObject): Payload;
|
|
17
|
-
export declare function wrapFetcher(fn: (config:
|
|
17
|
+
export declare function wrapFetcher(fn: (config: FetcherConfig) => Promise<fetcherResult>, tracker?: (eventTrack: EventTrack, data: any) => void): any;
|
|
18
18
|
export declare function wrapAdaptor(promise: Promise<fetcherResult>, api: ApiObject, context: any): Promise<Payload>;
|
|
19
19
|
/**
|
|
20
20
|
* 请求远程 js 文件然后 new Function 执行,用于 schemaApi 支持 JavaScript
|
|
21
21
|
* @param api
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export declare function jsFetcher(fetcher: (config:
|
|
24
|
+
export declare function jsFetcher(fetcher: (config: FetcherConfig) => Promise<fetcherResult>, api: ApiObject): Promise<fetcherResult>;
|
|
25
25
|
export declare function jsonpFetcher(api: ApiObject): Promise<fetcherResult>;
|
|
26
26
|
export declare function isApiOutdatedWithData(prevApi: Api | undefined, nextApi: Api | undefined, prevData: any, nextData: any): nextApi is Api;
|
|
27
27
|
export declare function isApiOutdated(prevApi: Api | undefined, nextApi: Api | undefined, prevData: any, nextData: any): nextApi is Api;
|