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.
Files changed (287) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +8 -8
  3. package/esm/SchemaRenderer.js +16 -12
  4. package/esm/Scoped.js +3 -1
  5. package/esm/StatusScoped.js +1 -1
  6. package/esm/WithRootStore.js +1 -1
  7. package/esm/WithStore.js +9 -8
  8. package/esm/actions/Action.js +1 -1
  9. package/esm/actions/AjaxAction.js +2 -2
  10. package/esm/actions/BreakAction.js +1 -1
  11. package/esm/actions/BroadcastAction.js +1 -1
  12. package/esm/actions/CmptAction.js +1 -1
  13. package/esm/actions/ContinueAction.js +1 -1
  14. package/esm/actions/CopyAction.js +1 -1
  15. package/esm/actions/CustomAction.js +3 -1
  16. package/esm/actions/DialogAction.js +1 -1
  17. package/esm/actions/DrawerAction.js +1 -1
  18. package/esm/actions/EmailAction.js +1 -1
  19. package/esm/actions/LinkAction.js +1 -1
  20. package/esm/actions/LoopAction.js +1 -1
  21. package/esm/actions/PageAction.js +1 -1
  22. package/esm/actions/ParallelAction.js +1 -1
  23. package/esm/actions/StatusAction.js +1 -1
  24. package/esm/actions/SwitchAction.js +1 -1
  25. package/esm/actions/ToastAction.js +1 -1
  26. package/esm/components/CustomStyle.d.ts +4 -6
  27. package/esm/components/CustomStyle.js +29 -5
  28. package/esm/components/LazyComponent.d.ts +1 -2
  29. package/esm/components/LazyComponent.js +12 -8
  30. package/esm/components/Overlay.js +3 -1
  31. package/esm/components/PopOver.d.ts +12 -12
  32. package/esm/components/PopOver.js +3 -1
  33. package/esm/env.d.ts +2 -2
  34. package/esm/env.js +1 -1
  35. package/esm/envOverwrite.js +1 -1
  36. package/esm/factory.d.ts +7 -7
  37. package/esm/factory.js +1 -1
  38. package/esm/index.d.ts +1 -0
  39. package/esm/index.js +5 -5
  40. package/esm/locale.d.ts +1 -1
  41. package/esm/locale.js +3 -3
  42. package/esm/polyfills.js +1 -1
  43. package/esm/renderers/Form.d.ts +1 -1
  44. package/esm/renderers/Form.js +10 -8
  45. package/esm/renderers/Item.d.ts +24 -56
  46. package/esm/renderers/Item.js +25 -31
  47. package/esm/renderers/Options.js +14 -12
  48. package/esm/renderers/Placeholder.js +1 -1
  49. package/esm/renderers/builtin.js +1 -1
  50. package/esm/renderers/register.js +1 -1
  51. package/esm/renderers/wrapControl.js +70 -80
  52. package/esm/store/app.js +3 -1
  53. package/esm/store/combo.d.ts +384 -0
  54. package/esm/store/combo.js +1 -1
  55. package/esm/store/crud.js +31 -25
  56. package/esm/store/form.d.ts +160 -0
  57. package/esm/store/form.js +15 -13
  58. package/esm/store/formItem.d.ts +4 -0
  59. package/esm/store/formItem.js +42 -26
  60. package/esm/store/iRenderer.js +3 -1
  61. package/esm/store/index.js +1 -1
  62. package/esm/store/list.js +1 -1
  63. package/esm/store/manager.js +1 -1
  64. package/esm/store/modal.js +1 -1
  65. package/esm/store/node.js +1 -1
  66. package/esm/store/pagination.js +1 -1
  67. package/esm/store/root.d.ts +1 -1
  68. package/esm/store/root.js +12 -5
  69. package/esm/store/service.js +38 -33
  70. package/esm/store/status.js +1 -1
  71. package/esm/store/table.d.ts +760 -21
  72. package/esm/store/table.js +155 -55
  73. package/esm/store/table2.js +11 -8
  74. package/esm/theme.d.ts +18 -31
  75. package/esm/theme.js +1 -1
  76. package/esm/utils/Animation.js +1 -1
  77. package/esm/utils/ColorScale.js +1 -1
  78. package/esm/utils/DataSchema.js +1 -1
  79. package/esm/utils/DataScope.js +1 -1
  80. package/esm/utils/RootClose.js +1 -1
  81. package/esm/utils/SimpleMap.js +1 -1
  82. package/esm/utils/api.d.ts +3 -3
  83. package/esm/utils/api.js +2 -2
  84. package/esm/utils/arraySlice.js +1 -1
  85. package/esm/utils/attachmentAdpator.js +1 -1
  86. package/esm/utils/autobind.js +1 -1
  87. package/esm/utils/columnsSplit.js +1 -1
  88. package/esm/utils/dataMapping.js +1 -1
  89. package/esm/utils/date.js +1 -1
  90. package/esm/utils/debug.d.ts +1 -0
  91. package/esm/utils/debug.js +24 -2
  92. package/esm/utils/decodeEntity.js +1 -1
  93. package/esm/utils/dom.js +1 -1
  94. package/esm/utils/errors.js +1 -1
  95. package/esm/utils/escapeHtml.js +1 -1
  96. package/esm/utils/filter-schema.js +1 -1
  97. package/esm/utils/filter.js +1 -1
  98. package/esm/utils/formatDuration.js +1 -1
  99. package/esm/utils/formula.js +1 -1
  100. package/esm/utils/getVariable.js +1 -1
  101. package/esm/utils/grammar.js +1 -1
  102. package/esm/utils/handleAction.js +1 -1
  103. package/esm/utils/helper.d.ts +13 -1
  104. package/esm/utils/helper.js +99 -5
  105. package/esm/utils/highlight.js +1 -1
  106. package/esm/utils/icon.js +1 -1
  107. package/esm/utils/image.js +1 -1
  108. package/esm/utils/isPureVariable.js +1 -1
  109. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  110. package/esm/utils/keyToPath.d.ts +1 -1
  111. package/esm/utils/keyToPath.js +2 -1
  112. package/esm/utils/makeSorter.js +1 -1
  113. package/esm/utils/math.js +1 -1
  114. package/esm/utils/memoryParse.js +1 -1
  115. package/esm/utils/normalizeLink.js +1 -1
  116. package/esm/utils/normalizeOptions.js +1 -1
  117. package/esm/utils/object.js +1 -1
  118. package/esm/utils/offset.js +1 -1
  119. package/esm/utils/offsetParent.js +1 -1
  120. package/esm/utils/optionValueCompare.js +1 -1
  121. package/esm/utils/position.js +1 -1
  122. package/esm/utils/prettyBytes.js +1 -1
  123. package/esm/utils/renderer-event.js +2 -2
  124. package/esm/utils/replaceText.js +1 -1
  125. package/esm/utils/resize-sensor.d.ts +3 -1
  126. package/esm/utils/resize-sensor.js +34 -22
  127. package/esm/utils/resolveCondition.js +1 -1
  128. package/esm/utils/resolveVariable.js +1 -1
  129. package/esm/utils/resolveVariableAndFilter.js +1 -1
  130. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  131. package/esm/utils/scrollPosition.js +1 -1
  132. package/esm/utils/string2regExp.js +1 -1
  133. package/esm/utils/stripNumber.js +1 -1
  134. package/esm/utils/style-helper.d.ts +22 -14
  135. package/esm/utils/style-helper.js +181 -120
  136. package/esm/utils/style.js +1 -1
  137. package/esm/utils/toNumber.js +1 -1
  138. package/esm/utils/tokenize.js +1 -1
  139. package/esm/utils/tpl-builtin.js +1 -1
  140. package/esm/utils/tpl-lodash.js +1 -1
  141. package/esm/utils/tpl.js +1 -1
  142. package/esm/utils/uncontrollable.js +1 -1
  143. package/esm/utils/validations.js +1 -1
  144. package/lib/Root.js +1 -1
  145. package/lib/RootRenderer.js +8 -8
  146. package/lib/SchemaRenderer.js +16 -12
  147. package/lib/Scoped.js +3 -1
  148. package/lib/StatusScoped.js +1 -1
  149. package/lib/WithRootStore.js +1 -1
  150. package/lib/WithStore.js +9 -8
  151. package/lib/actions/Action.js +1 -1
  152. package/lib/actions/AjaxAction.js +2 -2
  153. package/lib/actions/BreakAction.js +1 -1
  154. package/lib/actions/BroadcastAction.js +1 -1
  155. package/lib/actions/CmptAction.js +1 -1
  156. package/lib/actions/ContinueAction.js +1 -1
  157. package/lib/actions/CopyAction.js +1 -1
  158. package/lib/actions/CustomAction.js +3 -1
  159. package/lib/actions/DialogAction.js +1 -1
  160. package/lib/actions/DrawerAction.js +1 -1
  161. package/lib/actions/EmailAction.js +1 -1
  162. package/lib/actions/LinkAction.js +1 -1
  163. package/lib/actions/LoopAction.js +1 -1
  164. package/lib/actions/PageAction.js +1 -1
  165. package/lib/actions/ParallelAction.js +1 -1
  166. package/lib/actions/StatusAction.js +1 -1
  167. package/lib/actions/SwitchAction.js +1 -1
  168. package/lib/actions/ToastAction.js +1 -1
  169. package/lib/components/CustomStyle.d.ts +4 -6
  170. package/lib/components/CustomStyle.js +28 -4
  171. package/lib/components/LazyComponent.d.ts +1 -2
  172. package/lib/components/LazyComponent.js +12 -9
  173. package/lib/components/Overlay.js +3 -1
  174. package/lib/components/PopOver.d.ts +12 -12
  175. package/lib/components/PopOver.js +3 -1
  176. package/lib/env.d.ts +2 -2
  177. package/lib/env.js +1 -1
  178. package/lib/envOverwrite.js +1 -1
  179. package/lib/factory.d.ts +7 -7
  180. package/lib/factory.js +1 -1
  181. package/lib/index.d.ts +1 -0
  182. package/lib/index.js +11 -3
  183. package/lib/locale.d.ts +1 -1
  184. package/lib/locale.js +3 -3
  185. package/lib/polyfills.js +1 -1
  186. package/lib/renderers/Form.d.ts +1 -1
  187. package/lib/renderers/Form.js +10 -8
  188. package/lib/renderers/Item.d.ts +24 -56
  189. package/lib/renderers/Item.js +26 -31
  190. package/lib/renderers/Options.js +14 -12
  191. package/lib/renderers/Placeholder.js +1 -1
  192. package/lib/renderers/builtin.js +1 -1
  193. package/lib/renderers/register.js +1 -1
  194. package/lib/renderers/wrapControl.js +70 -79
  195. package/lib/store/app.js +3 -1
  196. package/lib/store/combo.d.ts +384 -0
  197. package/lib/store/combo.js +1 -1
  198. package/lib/store/crud.js +31 -25
  199. package/lib/store/form.d.ts +160 -0
  200. package/lib/store/form.js +15 -13
  201. package/lib/store/formItem.d.ts +4 -0
  202. package/lib/store/formItem.js +41 -25
  203. package/lib/store/iRenderer.js +3 -1
  204. package/lib/store/index.js +1 -1
  205. package/lib/store/list.js +1 -1
  206. package/lib/store/manager.js +1 -1
  207. package/lib/store/modal.js +1 -1
  208. package/lib/store/node.js +1 -1
  209. package/lib/store/pagination.js +1 -1
  210. package/lib/store/root.d.ts +1 -1
  211. package/lib/store/root.js +11 -4
  212. package/lib/store/service.js +38 -33
  213. package/lib/store/status.js +1 -1
  214. package/lib/store/table.d.ts +760 -21
  215. package/lib/store/table.js +155 -55
  216. package/lib/store/table2.js +11 -8
  217. package/lib/theme.d.ts +18 -31
  218. package/lib/theme.js +1 -1
  219. package/lib/utils/Animation.js +1 -1
  220. package/lib/utils/ColorScale.js +1 -1
  221. package/lib/utils/DataSchema.js +1 -1
  222. package/lib/utils/DataScope.js +1 -1
  223. package/lib/utils/RootClose.js +1 -1
  224. package/lib/utils/SimpleMap.js +1 -1
  225. package/lib/utils/api.d.ts +3 -3
  226. package/lib/utils/api.js +2 -2
  227. package/lib/utils/arraySlice.js +1 -1
  228. package/lib/utils/attachmentAdpator.js +1 -1
  229. package/lib/utils/autobind.js +1 -1
  230. package/lib/utils/columnsSplit.js +1 -1
  231. package/lib/utils/dataMapping.js +1 -1
  232. package/lib/utils/date.js +1 -1
  233. package/lib/utils/debug.d.ts +1 -0
  234. package/lib/utils/debug.js +24 -1
  235. package/lib/utils/decodeEntity.js +1 -1
  236. package/lib/utils/dom.js +1 -1
  237. package/lib/utils/errors.js +1 -1
  238. package/lib/utils/escapeHtml.js +1 -1
  239. package/lib/utils/filter-schema.js +1 -1
  240. package/lib/utils/filter.js +1 -1
  241. package/lib/utils/formatDuration.js +1 -1
  242. package/lib/utils/formula.js +1 -1
  243. package/lib/utils/getVariable.js +1 -1
  244. package/lib/utils/grammar.js +1 -1
  245. package/lib/utils/handleAction.js +1 -1
  246. package/lib/utils/helper.d.ts +13 -1
  247. package/lib/utils/helper.js +101 -4
  248. package/lib/utils/highlight.js +1 -1
  249. package/lib/utils/icon.js +1 -1
  250. package/lib/utils/image.js +1 -1
  251. package/lib/utils/isPureVariable.js +1 -1
  252. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  253. package/lib/utils/keyToPath.d.ts +1 -1
  254. package/lib/utils/keyToPath.js +2 -1
  255. package/lib/utils/makeSorter.js +1 -1
  256. package/lib/utils/math.js +1 -1
  257. package/lib/utils/memoryParse.js +1 -1
  258. package/lib/utils/normalizeLink.js +1 -1
  259. package/lib/utils/normalizeOptions.js +1 -1
  260. package/lib/utils/object.js +1 -1
  261. package/lib/utils/offset.js +1 -1
  262. package/lib/utils/offsetParent.js +1 -1
  263. package/lib/utils/optionValueCompare.js +1 -1
  264. package/lib/utils/position.js +1 -1
  265. package/lib/utils/prettyBytes.js +1 -1
  266. package/lib/utils/renderer-event.js +2 -2
  267. package/lib/utils/replaceText.js +1 -1
  268. package/lib/utils/resize-sensor.d.ts +3 -1
  269. package/lib/utils/resize-sensor.js +34 -22
  270. package/lib/utils/resolveCondition.js +1 -1
  271. package/lib/utils/resolveVariable.js +1 -1
  272. package/lib/utils/resolveVariableAndFilter.js +1 -1
  273. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  274. package/lib/utils/scrollPosition.js +1 -1
  275. package/lib/utils/string2regExp.js +1 -1
  276. package/lib/utils/stripNumber.js +1 -1
  277. package/lib/utils/style-helper.d.ts +22 -14
  278. package/lib/utils/style-helper.js +188 -120
  279. package/lib/utils/style.js +1 -1
  280. package/lib/utils/toNumber.js +1 -1
  281. package/lib/utils/tokenize.js +1 -1
  282. package/lib/utils/tpl-builtin.js +1 -1
  283. package/lib/utils/tpl-lodash.js +1 -1
  284. package/lib/utils/tpl.js +1 -1
  285. package/lib/utils/uncontrollable.js +1 -1
  286. package/lib/utils/validations.js +1 -1
  287. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
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
- setWidth: function (value, minWidth) {
84
+ setMinWidth: function (value) {
85
+ self.minWidth = value;
86
+ },
87
+ setWidth: function (value) {
84
88
  self.width = value;
85
- if (typeof minWidth === 'number') {
86
- self.minWidth = minWidth;
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 // 当前children位于第几层,便于使用getParent获取最顶层TableStore
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 // 用来控制搜索框是否展开了,那个自动根据 searchable 生成的表单 autoGenerateFilter
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
- ? (getFootableColumns().length || self.isNested) && !self.dragging
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 helper.flattenTree(self.rows).filter(function (item) { return item.checkable; });
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.width; });
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 = 0;
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 += col.width;
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 = 0;
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 += col.width;
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
- config.primaryField !== void 0 &&
672
+ var _a;
673
+ config.primaryField !== undefined &&
629
674
  (self.primaryField = config.primaryField);
630
- config.selectable !== void 0 && (self.selectable = config.selectable);
631
- config.columnsTogglable !== void 0 &&
675
+ config.selectable !== undefined && (self.selectable = config.selectable);
676
+ config.columnsTogglable !== undefined &&
632
677
  (self.columnsTogglable = config.columnsTogglable);
633
- config.draggable !== void 0 && (self.draggable = config.draggable);
634
- if (typeof config.orderBy === 'string') {
635
- setOrderByInfo(config.orderBy, config.orderDir === 'desc' ? 'desc' : 'asc');
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 !== void 0 && (self.multiple = config.multiple);
638
- config.footable !== void 0 && (self.footable = config.footable);
639
- config.expandConfig !== void 0 &&
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 !== void 0 &&
691
+ config.itemCheckableOn !== undefined &&
642
692
  (self.itemCheckableOn = config.itemCheckableOn);
643
- config.itemDraggableOn !== void 0 &&
693
+ config.itemDraggableOn !== undefined &&
644
694
  (self.itemDraggableOn = config.itemDraggableOn);
645
- config.hideCheckToggler !== void 0 &&
695
+ config.hideCheckToggler !== undefined &&
646
696
  (self.hideCheckToggler = !!config.hideCheckToggler);
647
- config.combineNum !== void 0 &&
697
+ config.combineNum !== undefined &&
648
698
  (self.combineNum = parseInt(config.combineNum, 10) || 0);
649
- config.combineFromIndex !== void 0 &&
699
+ config.combineFromIndex !== undefined &&
650
700
  (self.combineFromIndex =
651
701
  parseInt(config.combineFromIndex, 10) || 0);
652
- config.maxKeepItemSelectionLength !== void 0 &&
702
+ config.maxKeepItemSelectionLength !== undefined &&
653
703
  (self.maxKeepItemSelectionLength = config.maxKeepItemSelectionLength);
654
- config.keepItemSelectionOnPageChange !== void 0 &&
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 syncTableWidth() {
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 = table.querySelector(':scope>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
- "<table style=\"table-layout:auto!important;width:0!important;min-width:0!important;\" class=\"".concat(table.className, "\">").concat(thead.outerHTML, "</table>") +
734
- "<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>");
735
- var ths1 = [].slice.call(div.querySelectorAll(':scope>table:first-child>thead>tr>th[data-index]'));
736
- var ths2 = [].slice.call(div.querySelectorAll(':scope>table:last-child>thead>tr>th[data-index]'));
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
- minWidths[th.getAttribute('data-index')] = th.clientWidth;
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
- column.setWidth(Math.max(typeof column.pristine.width === 'number'
758
- ? column.pristine.width
759
- : col.clientWidth - 2, minWidths[index]), minWidths[index]);
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 invalidTableColumnWidth() {
764
- self.columns.forEach(function (column) { return column.setWidth(0); });
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, 原始配置中存在 toggled: false 的列不持久化
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,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
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
- mobxStateTree.getEnv(self).notify('error', self.msg, json.msgTimeout !== undefined
520
- ? {
521
- closeButton: true,
522
- timeout: json.msgTimeout
523
- }
524
- : undefined);
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
- e_1.type !== 'ServerError' && mobxStateTree.getEnv(self).notify('error', e_1.message);
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 = string | number | ClassDictionary | ClassArray | undefined | null | boolean;
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
- [propsName: string]: any;
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 type ThemeInstance = ThemeConfig & {
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
- theme?: string;
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
- classPrefix?: string;
50
- classnames?: ClassNamesFn;
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>> & ThemeOutterProps): {
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>> & ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
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>> & ThemeOutterProps>;
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>> & ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
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>> & ThemeOutterProps>, prevState: Readonly<{}>): any;
75
- componentDidUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
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>> & ThemeOutterProps>, nextContext: any): void;
79
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextContext: any): void;
80
- componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
81
- UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
2
+ * amis-core v3.4.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
2
+ * amis-core v3.4.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
2
+ * amis-core v3.4.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
2
+ * amis-core v3.4.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
2
+ * amis-core v3.4.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
2
+ * amis-core v3.4.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.4.0
2
+ * amis-core v3.4.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { Api, ApiObject, EventTrack, fetcherResult, Payload } from '../types';
2
- import { fetcherConfig } from '../factory';
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: fetcherConfig) => Promise<fetcherResult>, tracker?: (eventTrack: EventTrack, data: any) => void): any;
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: fetcherConfig) => Promise<fetcherResult>, api: ApiObject): Promise<fetcherResult>;
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;