amis-core 6.11.0-beta.0 → 6.11.0-beta.2

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 (332) hide show
  1. package/esm/Root.d.ts +3 -0
  2. package/esm/Root.js +1 -1
  3. package/esm/RootRenderer.js +14 -8
  4. package/esm/SchemaRenderer.d.ts +2 -13
  5. package/esm/SchemaRenderer.js +36 -72
  6. package/esm/Scoped.js +1 -1
  7. package/esm/StatusScoped.js +1 -1
  8. package/esm/StyleManager.js +1 -1
  9. package/esm/WithRootStore.d.ts +1 -1
  10. package/esm/WithRootStore.js +1 -1
  11. package/esm/WithStore.js +1 -1
  12. package/esm/actions/Action.js +1 -1
  13. package/esm/actions/AjaxAction.js +1 -1
  14. package/esm/actions/BreakAction.js +1 -1
  15. package/esm/actions/BroadcastAction.js +1 -1
  16. package/esm/actions/CmptAction.js +6 -2
  17. package/esm/actions/ContinueAction.js +1 -1
  18. package/esm/actions/CopyAction.js +1 -1
  19. package/esm/actions/CustomAction.js +1 -1
  20. package/esm/actions/DialogAction.js +1 -1
  21. package/esm/actions/DrawerAction.js +1 -1
  22. package/esm/actions/EmailAction.js +1 -1
  23. package/esm/actions/EventAction.js +1 -1
  24. package/esm/actions/LinkAction.js +1 -1
  25. package/esm/actions/LoopAction.js +1 -1
  26. package/esm/actions/PageAction.js +1 -1
  27. package/esm/actions/ParallelAction.js +1 -1
  28. package/esm/actions/PrintAction.js +1 -1
  29. package/esm/actions/StatusAction.js +1 -1
  30. package/esm/actions/SwitchAction.js +1 -1
  31. package/esm/actions/ToastAction.js +1 -1
  32. package/esm/actions/WaitAction.js +1 -1
  33. package/esm/components/Animations.d.ts +8 -0
  34. package/esm/components/Animations.js +158 -0
  35. package/esm/components/CustomStyle.js +1 -1
  36. package/esm/components/ErrorBoundary.js +1 -1
  37. package/esm/components/LazyComponent.d.ts +1 -1
  38. package/esm/components/LazyComponent.js +1 -1
  39. package/esm/components/Overlay.js +1 -1
  40. package/esm/components/PopOver.d.ts +1 -1
  41. package/esm/components/PopOver.js +1 -1
  42. package/esm/env.d.ts +1 -1
  43. package/esm/env.js +1 -1
  44. package/esm/envOverwrite.js +1 -1
  45. package/esm/factory.d.ts +1 -0
  46. package/esm/factory.js +1 -1
  47. package/esm/globalVar.d.ts +173 -0
  48. package/esm/globalVar.js +122 -0
  49. package/esm/globalVarClientHandler.d.ts +1 -0
  50. package/esm/globalVarClientHandler.js +65 -0
  51. package/esm/globalVarDefaultValueHandler.d.ts +1 -0
  52. package/esm/globalVarDefaultValueHandler.js +28 -0
  53. package/esm/index.d.ts +3 -0
  54. package/esm/index.js +8 -5
  55. package/esm/locale.d.ts +1 -1
  56. package/esm/locale.js +1 -1
  57. package/esm/polyfills.js +1 -1
  58. package/esm/renderers/Form.d.ts +3 -1
  59. package/esm/renderers/Form.js +39 -24
  60. package/esm/renderers/Item.d.ts +11 -17
  61. package/esm/renderers/Item.js +17 -2
  62. package/esm/renderers/Options.js +1 -1
  63. package/esm/renderers/Placeholder.js +1 -1
  64. package/esm/renderers/builtin.js +1 -1
  65. package/esm/renderers/register.js +1 -1
  66. package/esm/renderers/wrapControl.d.ts +1 -1
  67. package/esm/renderers/wrapControl.js +1 -1
  68. package/esm/store/app.js +1 -1
  69. package/esm/store/combo.js +1 -1
  70. package/esm/store/crud.d.ts +8 -0
  71. package/esm/store/crud.js +24 -17
  72. package/esm/store/form.js +14 -5
  73. package/esm/store/formItem.js +1 -1
  74. package/esm/store/iRenderer.js +1 -1
  75. package/esm/store/index.js +1 -1
  76. package/esm/store/list.d.ts +14 -1
  77. package/esm/store/list.js +45 -17
  78. package/esm/store/manager.js +1 -1
  79. package/esm/store/modal.js +1 -1
  80. package/esm/store/node.js +1 -1
  81. package/esm/store/pagination.js +1 -1
  82. package/esm/store/root.d.ts +14 -0
  83. package/esm/store/root.js +483 -12
  84. package/esm/store/service.js +1 -1
  85. package/esm/store/status.js +1 -1
  86. package/esm/store/table.d.ts +16 -2
  87. package/esm/store/table.js +83 -26
  88. package/esm/store/table2.js +1 -1
  89. package/esm/theme.d.ts +1 -1
  90. package/esm/theme.js +1 -1
  91. package/esm/types.d.ts +3 -2
  92. package/esm/utils/Animation.js +1 -1
  93. package/esm/utils/ColorScale.js +1 -1
  94. package/esm/utils/DataSchema.js +1 -1
  95. package/esm/utils/DataScope.js +1 -1
  96. package/esm/utils/RootClose.js +1 -1
  97. package/esm/utils/SimpleMap.js +1 -1
  98. package/esm/utils/animations.d.ts +4 -0
  99. package/esm/utils/animations.js +1 -1
  100. package/esm/utils/api.d.ts +1 -0
  101. package/esm/utils/api.js +18 -6
  102. package/esm/utils/arraySlice.js +1 -1
  103. package/esm/utils/attachmentAdpator.js +1 -1
  104. package/esm/utils/autobind.js +1 -1
  105. package/esm/utils/browser.js +1 -1
  106. package/esm/utils/columnsSplit.js +1 -1
  107. package/esm/utils/concatData.js +1 -1
  108. package/esm/utils/dataMapping.js +1 -1
  109. package/esm/utils/date.js +1 -1
  110. package/esm/utils/debug.js +1 -1
  111. package/esm/utils/decodeEntity.js +1 -1
  112. package/esm/utils/dom.js +1 -1
  113. package/esm/utils/errors.js +1 -1
  114. package/esm/utils/escapeHtml.js +1 -1
  115. package/esm/utils/filter-schema.js +1 -1
  116. package/esm/utils/filter.js +1 -1
  117. package/esm/utils/formatDuration.js +1 -1
  118. package/esm/utils/formula.js +1 -1
  119. package/esm/utils/getVariable.js +1 -1
  120. package/esm/utils/grammar.js +1 -1
  121. package/esm/utils/handleAction.js +1 -1
  122. package/esm/utils/helper.d.ts +5 -0
  123. package/esm/utils/helper.js +6 -2
  124. package/esm/utils/highlight.js +1 -1
  125. package/esm/utils/icon.js +1 -1
  126. package/esm/utils/image.js +1 -1
  127. package/esm/utils/isPureVariable.js +1 -1
  128. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  129. package/esm/utils/keyToPath.js +1 -1
  130. package/esm/utils/labelToString.js +1 -1
  131. package/esm/utils/loopTooMuch.js +1 -1
  132. package/esm/utils/makeSorter.js +1 -1
  133. package/esm/utils/math.js +1 -1
  134. package/esm/utils/memoryParse.js +1 -1
  135. package/esm/utils/normalizeLink.js +1 -1
  136. package/esm/utils/normalizeOptions.js +1 -1
  137. package/esm/utils/object.js +1 -1
  138. package/esm/utils/offset.js +1 -1
  139. package/esm/utils/offsetParent.js +1 -1
  140. package/esm/utils/optionValueCompare.js +1 -1
  141. package/esm/utils/position.js +1 -1
  142. package/esm/utils/prettyBytes.js +1 -1
  143. package/esm/utils/printElement.js +1 -1
  144. package/esm/utils/renderer-event.js +1 -1
  145. package/esm/utils/replaceText.js +1 -1
  146. package/esm/utils/resize-sensor.js +1 -1
  147. package/esm/utils/resolveCondition.js +1 -1
  148. package/esm/utils/resolveVariable.js +1 -1
  149. package/esm/utils/resolveVariableAndFilter.js +1 -1
  150. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  151. package/esm/utils/scrollPosition.js +1 -1
  152. package/esm/utils/string2regExp.js +1 -1
  153. package/esm/utils/stripNumber.js +1 -1
  154. package/esm/utils/style-helper.js +1 -1
  155. package/esm/utils/style.js +1 -1
  156. package/esm/utils/toNumber.js +1 -1
  157. package/esm/utils/tokenize.js +1 -1
  158. package/esm/utils/tpl-builtin.js +1 -1
  159. package/esm/utils/tpl-lodash.js +1 -1
  160. package/esm/utils/tpl.js +1 -1
  161. package/esm/utils/uncontrollable.js +1 -1
  162. package/esm/utils/validateId.js +1 -1
  163. package/esm/utils/validations.js +1 -1
  164. package/esm/utils/visitedCache.js +1 -1
  165. package/lib/Root.d.ts +3 -0
  166. package/lib/Root.js +1 -1
  167. package/lib/RootRenderer.d.ts +1 -1
  168. package/lib/RootRenderer.js +13 -7
  169. package/lib/SchemaRenderer.d.ts +2 -13
  170. package/lib/SchemaRenderer.js +35 -71
  171. package/lib/Scoped.js +1 -1
  172. package/lib/StatusScoped.js +1 -1
  173. package/lib/StyleManager.js +1 -1
  174. package/lib/WithRootStore.d.ts +1 -1
  175. package/lib/WithRootStore.js +1 -1
  176. package/lib/WithStore.js +1 -1
  177. package/lib/actions/Action.js +1 -1
  178. package/lib/actions/AjaxAction.js +1 -1
  179. package/lib/actions/BreakAction.js +1 -1
  180. package/lib/actions/BroadcastAction.js +1 -1
  181. package/lib/actions/CmptAction.js +6 -2
  182. package/lib/actions/ContinueAction.js +1 -1
  183. package/lib/actions/CopyAction.js +1 -1
  184. package/lib/actions/CustomAction.js +1 -1
  185. package/lib/actions/DialogAction.js +1 -1
  186. package/lib/actions/DrawerAction.js +1 -1
  187. package/lib/actions/EmailAction.js +1 -1
  188. package/lib/actions/EventAction.js +1 -1
  189. package/lib/actions/LinkAction.js +1 -1
  190. package/lib/actions/LoopAction.js +1 -1
  191. package/lib/actions/PageAction.js +1 -1
  192. package/lib/actions/ParallelAction.js +1 -1
  193. package/lib/actions/PrintAction.js +1 -1
  194. package/lib/actions/StatusAction.js +1 -1
  195. package/lib/actions/SwitchAction.js +1 -1
  196. package/lib/actions/ToastAction.js +1 -1
  197. package/lib/actions/WaitAction.js +1 -1
  198. package/lib/components/Animations.d.ts +8 -0
  199. package/lib/components/Animations.js +172 -0
  200. package/lib/components/CustomStyle.js +1 -1
  201. package/lib/components/ErrorBoundary.js +1 -1
  202. package/lib/components/LazyComponent.d.ts +1 -1
  203. package/lib/components/LazyComponent.js +1 -1
  204. package/lib/components/Overlay.js +1 -1
  205. package/lib/components/PopOver.d.ts +1 -1
  206. package/lib/components/PopOver.js +1 -1
  207. package/lib/env.d.ts +1 -1
  208. package/lib/env.js +1 -1
  209. package/lib/envOverwrite.js +1 -1
  210. package/lib/factory.d.ts +1 -0
  211. package/lib/factory.js +1 -1
  212. package/lib/globalVar.d.ts +173 -0
  213. package/lib/globalVar.js +130 -0
  214. package/lib/globalVarClientHandler.d.ts +1 -0
  215. package/lib/globalVarClientHandler.js +67 -0
  216. package/lib/globalVarDefaultValueHandler.d.ts +1 -0
  217. package/lib/globalVarDefaultValueHandler.js +30 -0
  218. package/lib/index.d.ts +3 -0
  219. package/lib/index.js +13 -4
  220. package/lib/locale.d.ts +1 -1
  221. package/lib/locale.js +1 -1
  222. package/lib/polyfills.js +1 -1
  223. package/lib/renderers/Form.d.ts +3 -1
  224. package/lib/renderers/Form.js +37 -21
  225. package/lib/renderers/Item.d.ts +11 -17
  226. package/lib/renderers/Item.js +17 -2
  227. package/lib/renderers/Options.js +1 -1
  228. package/lib/renderers/Placeholder.js +1 -1
  229. package/lib/renderers/builtin.js +1 -1
  230. package/lib/renderers/register.js +1 -1
  231. package/lib/renderers/wrapControl.d.ts +1 -1
  232. package/lib/renderers/wrapControl.js +1 -1
  233. package/lib/store/app.js +1 -1
  234. package/lib/store/combo.d.ts +24 -25
  235. package/lib/store/combo.js +1 -1
  236. package/lib/store/crud.d.ts +8 -0
  237. package/lib/store/crud.js +23 -16
  238. package/lib/store/form.d.ts +10 -11
  239. package/lib/store/form.js +14 -5
  240. package/lib/store/formItem.js +1 -1
  241. package/lib/store/iRenderer.js +1 -1
  242. package/lib/store/index.js +1 -1
  243. package/lib/store/list.d.ts +14 -1
  244. package/lib/store/list.js +44 -16
  245. package/lib/store/manager.js +1 -1
  246. package/lib/store/modal.js +1 -1
  247. package/lib/store/node.js +1 -1
  248. package/lib/store/pagination.js +1 -1
  249. package/lib/store/root.d.ts +13 -0
  250. package/lib/store/root.js +487 -11
  251. package/lib/store/service.js +1 -1
  252. package/lib/store/status.js +1 -1
  253. package/lib/store/table.d.ts +36 -23
  254. package/lib/store/table.js +82 -25
  255. package/lib/store/table2.js +1 -1
  256. package/lib/theme.d.ts +1 -1
  257. package/lib/theme.js +1 -1
  258. package/lib/types.d.ts +3 -2
  259. package/lib/utils/Animation.js +1 -1
  260. package/lib/utils/ColorScale.js +1 -1
  261. package/lib/utils/DataSchema.js +1 -1
  262. package/lib/utils/DataScope.js +1 -1
  263. package/lib/utils/RootClose.js +1 -1
  264. package/lib/utils/SimpleMap.js +1 -1
  265. package/lib/utils/animations.d.ts +4 -0
  266. package/lib/utils/animations.js +1 -1
  267. package/lib/utils/api.d.ts +1 -0
  268. package/lib/utils/api.js +18 -5
  269. package/lib/utils/arraySlice.js +1 -1
  270. package/lib/utils/attachmentAdpator.js +1 -1
  271. package/lib/utils/autobind.js +1 -1
  272. package/lib/utils/browser.js +1 -1
  273. package/lib/utils/columnsSplit.js +1 -1
  274. package/lib/utils/concatData.js +1 -1
  275. package/lib/utils/dataMapping.js +1 -1
  276. package/lib/utils/date.js +1 -1
  277. package/lib/utils/debug.js +1 -1
  278. package/lib/utils/decodeEntity.js +1 -1
  279. package/lib/utils/dom.js +1 -1
  280. package/lib/utils/errors.js +1 -1
  281. package/lib/utils/escapeHtml.js +1 -1
  282. package/lib/utils/filter-schema.js +1 -1
  283. package/lib/utils/filter.js +1 -1
  284. package/lib/utils/formatDuration.js +1 -1
  285. package/lib/utils/formula.js +1 -1
  286. package/lib/utils/getVariable.js +1 -1
  287. package/lib/utils/grammar.js +1 -1
  288. package/lib/utils/handleAction.js +1 -1
  289. package/lib/utils/helper.d.ts +5 -0
  290. package/lib/utils/helper.js +6 -2
  291. package/lib/utils/highlight.js +1 -1
  292. package/lib/utils/icon.js +1 -1
  293. package/lib/utils/image.js +1 -1
  294. package/lib/utils/isPureVariable.js +1 -1
  295. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  296. package/lib/utils/keyToPath.js +1 -1
  297. package/lib/utils/labelToString.js +1 -1
  298. package/lib/utils/loopTooMuch.js +1 -1
  299. package/lib/utils/makeSorter.js +1 -1
  300. package/lib/utils/math.js +1 -1
  301. package/lib/utils/memoryParse.js +1 -1
  302. package/lib/utils/normalizeLink.js +1 -1
  303. package/lib/utils/normalizeOptions.js +1 -1
  304. package/lib/utils/object.js +1 -1
  305. package/lib/utils/offset.js +1 -1
  306. package/lib/utils/offsetParent.js +1 -1
  307. package/lib/utils/optionValueCompare.js +1 -1
  308. package/lib/utils/position.js +1 -1
  309. package/lib/utils/prettyBytes.js +1 -1
  310. package/lib/utils/printElement.js +1 -1
  311. package/lib/utils/renderer-event.js +1 -1
  312. package/lib/utils/replaceText.js +1 -1
  313. package/lib/utils/resize-sensor.js +1 -1
  314. package/lib/utils/resolveCondition.js +1 -1
  315. package/lib/utils/resolveVariable.js +1 -1
  316. package/lib/utils/resolveVariableAndFilter.js +1 -1
  317. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  318. package/lib/utils/scrollPosition.js +1 -1
  319. package/lib/utils/string2regExp.js +1 -1
  320. package/lib/utils/stripNumber.js +1 -1
  321. package/lib/utils/style-helper.js +1 -1
  322. package/lib/utils/style.js +1 -1
  323. package/lib/utils/toNumber.js +1 -1
  324. package/lib/utils/tokenize.js +1 -1
  325. package/lib/utils/tpl-builtin.js +1 -1
  326. package/lib/utils/tpl-lodash.js +1 -1
  327. package/lib/utils/tpl.js +1 -1
  328. package/lib/utils/uncontrollable.js +1 -1
  329. package/lib/utils/validateId.js +1 -1
  330. package/lib/utils/validations.js +1 -1
  331. package/lib/utils/visitedCache.js +1 -1
  332. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -17,7 +17,7 @@ import 'lodash/isPlainObject';
17
17
  import '../utils/filter.js';
18
18
  import isEqual from 'lodash/isEqual';
19
19
  import sortBy from 'lodash/sortBy';
20
- import { immutableExtends, flattenTree, findTree, eachTree, guid, isVisible, hasVisibleExpression, isBreakpoint, difference, sortArray } from '../utils/helper.js';
20
+ import { immutableExtends, flattenTree, findTree, eachTree, findTreeIndex, guid, isVisible, hasVisibleExpression, isBreakpoint, difference, sortArray } from '../utils/helper.js';
21
21
  import { evalExpression } from '../utils/tpl.js';
22
22
  import { getStoreById } from './manager.js';
23
23
 
@@ -230,14 +230,9 @@ var Row = types
230
230
  }
231
231
  var table = getParent(self, self.depth * 2);
232
232
  var parent = getParent(self, 2);
233
- return createObject(extendObject(getParent(self, self.depth * 2).data, {
234
- index: self.index,
233
+ return createObject(extendObject(getParent(self, self.depth * 2).data, __assign({ index: self.index, path: self.path,
235
234
  // todo 以后再支持多层,目前先一层
236
- parent: parent.storeType === Row.name ? parent.data : undefined,
237
- // 只有table时,也可以获取选中行
238
- selectedItems: table.selectedRows.map(function (item) { return item.data; }),
239
- unSelectedItems: table.unSelectedRows.map(function (item) { return item.data; })
240
- }), children
235
+ parent: parent.storeType === Row.name ? parent.data : undefined }, table.eventContext)), children
241
236
  ? __assign(__assign({}, self.data), { children: children }) : self.data);
242
237
  },
243
238
  get checkable() {
@@ -287,8 +282,12 @@ var Row = types
287
282
  var table = self.table;
288
283
  var row = self;
289
284
  table.toggle(row, checked);
290
- table.toggleAncestors(row);
291
- table.toggleDescendants(row, checked);
285
+ // 多选才需要处理祖先和后代
286
+ // 单选只处理自己就行了
287
+ if (table.multiple) {
288
+ table.toggleAncestors(row);
289
+ table.toggleDescendants(row, checked);
290
+ }
292
291
  },
293
292
  toggleExpanded: function () {
294
293
  getParent(self, self.depth * 2).toggleExpanded(self);
@@ -297,8 +296,16 @@ var Row = types
297
296
  getParent(self, self.depth * 2).setExpanded(self, expanded);
298
297
  },
299
298
  change: function (values, savePristine) {
300
- self.data = immutableExtends(self.data, values);
301
- savePristine && (self.pristine = self.data);
299
+ var data = immutableExtends(self.data, values);
300
+ Object.isExtensible(data) &&
301
+ Object.defineProperty(data, '__pristine', {
302
+ value: savePristine ? data : self.pristine,
303
+ enumerable: false,
304
+ configurable: false,
305
+ writable: false
306
+ });
307
+ self.data = data;
308
+ savePristine && (self.pristine = data);
302
309
  },
303
310
  reset: function () {
304
311
  self.newIndex = self.index;
@@ -360,9 +367,17 @@ var Row = types
360
367
  },
361
368
  updateData: function (_a) {
362
369
  var children = _a.children, rest = __rest(_a, ["children"]);
363
- self.data = __assign(__assign({}, self.data), rest);
370
+ var data = __assign(__assign({}, self.data), rest);
371
+ Object.isExtensible(data) &&
372
+ Object.defineProperty(data, '__pristine', {
373
+ value: self.data.__pristine || self.pristine,
374
+ enumerable: false,
375
+ configurable: false,
376
+ writable: false
377
+ });
378
+ self.data = data;
364
379
  if (Array.isArray(children)) {
365
- this.replaceChildren(initChildren(children, self.depth, self.index, self.id, self.path));
380
+ this.replaceChildren(initChildren(children, self.depth, self.index, self.id, "".concat(self.path, ".")));
366
381
  }
367
382
  }
368
383
  }); });
@@ -371,6 +386,11 @@ var TableStore = iRendererStore
371
386
  .props({
372
387
  columns: types.array(Column),
373
388
  rows: types.array(Row),
389
+ // 记录原始列表和原始选中的列表
390
+ // 因为如果是前端分页,上层 crud 或者 input-table 下发到这层的
391
+ // 是某个页区间的数据,这个时候 items 和 selectedItems 会少很多条
392
+ fullItems: types.optional(types.array(types.frozen()), []),
393
+ fullSelectedItems: types.optional(types.array(types.frozen()), []),
374
394
  selectedRows: types.array(types.reference(Row)),
375
395
  expandedRows: types.array(types.string),
376
396
  primaryField: 'id',
@@ -381,6 +401,7 @@ var TableStore = iRendererStore
381
401
  draggable: false,
382
402
  dragging: false,
383
403
  selectable: false,
404
+ showIndex: false,
384
405
  multiple: true,
385
406
  footable: types.frozen(),
386
407
  expandConfig: types.frozen(),
@@ -504,13 +525,6 @@ var TableStore = iRendererStore
504
525
  function getUnSelectedRows() {
505
526
  return flattenTree(self.rows).filter(function (item) { return !item.checked; });
506
527
  }
507
- function getData(superData) {
508
- return createObject(superData, {
509
- items: self.rows.map(function (item) { return item.data; }),
510
- selectedItems: self.selectedRows.map(function (item) { return item.data; }),
511
- unSelectedItems: getUnSelectedRows().map(function (item) { return item.data; })
512
- });
513
- }
514
528
  function hasColumnHidden() {
515
529
  return self.columns.findIndex(function (column) { return !column.toggled; }) !== -1;
516
530
  }
@@ -684,7 +698,9 @@ var TableStore = iRendererStore
684
698
  get firstToggledColumnIndex() {
685
699
  return getFirstToggledColumnIndex();
686
700
  },
687
- getData: getData,
701
+ getData: function (superData) {
702
+ return createObject(superData, this.eventContext);
703
+ },
688
704
  get columnGroup() {
689
705
  return getColumnGroup();
690
706
  },
@@ -777,6 +793,37 @@ var TableStore = iRendererStore
777
793
  column.realWidth + 'px';
778
794
  });
779
795
  return style;
796
+ },
797
+ /**
798
+ * 构建事件的上下文数据
799
+ * @param buildChain
800
+ * @returns
801
+ */
802
+ get eventContext() {
803
+ var context = {
804
+ selectedItems: self.selectedRows.map(function (item) { return item.data; }),
805
+ selectedIndexes: self.selectedRows.map(function (item) { return item.path; }),
806
+ items: self.rows.map(function (item) { return item.data; }),
807
+ unSelectedItems: this.unSelectedRows.map(function (item) { return item.data; })
808
+ };
809
+ // 如果是前端分页情况,需要根据全量数据计算
810
+ // 如果不是前端分页,数据都没有返回,那种就没办法支持全量数据信息了
811
+ if (self.fullItems.length > self.rows.length) {
812
+ // todo 这里的选择顺序会一直变,这个有影响吗?
813
+ var selectedItems_1 = self.fullSelectedItems
814
+ .filter(function (item) {
815
+ return !self.rows.find(function (row) { return row.pristine === (item.__pristine || item); });
816
+ })
817
+ .concat(context.selectedItems);
818
+ context.selectedItems = selectedItems_1;
819
+ context.items = self.fullItems.concat();
820
+ context.unSelectedItems = self.fullItems.filter(function (item) { return !selectedItems_1.includes(item); });
821
+ context.selectedIndexes = selectedItems_1.map(function (item) {
822
+ var _a;
823
+ return ((_a = findTreeIndex(self.fullItems, function (i) { return (item.__pristine || item) === (i.__pristine || i); })) === null || _a === void 0 ? void 0 : _a.join('.')) || '-1';
824
+ });
825
+ }
826
+ return context;
780
827
  }
781
828
  };
782
829
  })
@@ -835,6 +882,7 @@ var TableStore = iRendererStore
835
882
  (self.lazyRenderAfter = config.lazyRenderAfter);
836
883
  typeof config.tableLayout === 'string' &&
837
884
  (self.tableLayout = config.tableLayout);
885
+ config.showIndex !== undefined && (self.showIndex = config.showIndex);
838
886
  if (config.columns && Array.isArray(config.columns)) {
839
887
  var columns = config.columns
840
888
  .map(function (column) {
@@ -876,6 +924,12 @@ var TableStore = iRendererStore
876
924
  label: '空'
877
925
  });
878
926
  }
927
+ if (self.showIndex) {
928
+ columns.unshift({
929
+ type: '__index',
930
+ width: 50
931
+ });
932
+ }
879
933
  columns.unshift({
880
934
  type: '__expandme',
881
935
  toggable: false,
@@ -1052,7 +1106,7 @@ var TableStore = iRendererStore
1052
1106
  }
1053
1107
  return combineCell(arr, keys);
1054
1108
  }
1055
- function initRows(rows, getEntryId, reUseRow) {
1109
+ function initRows(rows, getEntryId, reUseRow, fullItems, fullSelectedItems) {
1056
1110
  self.selectedRows.clear();
1057
1111
  // self.expandedRows.clear();
1058
1112
  /* 避免输入内容为非数组挂掉 */
@@ -1072,7 +1126,7 @@ var TableStore = iRendererStore
1072
1126
  depth: 1,
1073
1127
  index: index,
1074
1128
  newIndex: index,
1075
- pristine: item,
1129
+ pristine: item.__pristine || item,
1076
1130
  path: "".concat(index),
1077
1131
  data: item,
1078
1132
  rowSpans: {},
@@ -1111,6 +1165,9 @@ var TableStore = iRendererStore
1111
1165
  }
1112
1166
  }
1113
1167
  self.dragging = false;
1168
+ Array.isArray(fullItems) && self.fullItems.replace(fullItems);
1169
+ Array.isArray(fullSelectedItems) &&
1170
+ self.fullSelectedItems.replace(fullSelectedItems);
1114
1171
  }
1115
1172
  // 获取所有层级的子节点id
1116
1173
  function getExpandAllRows(arr) {
@@ -1306,7 +1363,7 @@ var TableStore = iRendererStore
1306
1363
  return;
1307
1364
  }
1308
1365
  var maxLength = self.getSelectionUpperLimit();
1309
- var selectedItems = self.data.selectedItems;
1366
+ var selectedItems = self.selectedRows.map(function (item) { return item.data; });
1310
1367
  self.selectedRows.map(function (item) { return item.setCheckdisable(false); });
1311
1368
  if (maxLength !== Infinity && maxLength <= selectedItems.length) {
1312
1369
  self.unSelectedRows.map(function (item) { return !item.checked && item.setCheckdisable(true); });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/esm/theme.d.ts CHANGED
@@ -67,7 +67,7 @@ export declare function themeable<T extends React.ComponentType<React.ComponentP
67
67
  componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
68
68
  UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
69
69
  };
70
- displayName: any;
70
+ displayName: string;
71
71
  contextType: React.Context<string>;
72
72
  ComposedComponent: React.ComponentType<T>;
73
73
  } & hoistNonReactStatic.NonReactStatics<T, {}> & {
package/esm/theme.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/esm/types.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import type { JSONSchema7 } from 'json-schema';
3
3
  import { ListenerAction } from './actions/Action';
4
4
  import { debounceConfig, trackConfig } from './utils/renderer-event';
5
- import type { TestIdBuilder } from './utils/helper';
5
+ import type { TestIdBuilder, ValidateError } from './utils/helper';
6
6
  import { AnimationsProps } from './utils/animations';
7
7
  export interface Option {
8
8
  /**
@@ -281,7 +281,7 @@ export interface Definitions {
281
281
  [propName: string]: SchemaNode;
282
282
  }
283
283
  export interface ActionObject extends ButtonObject {
284
- actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'confirmDialog' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'select' | 'selectAll' | 'clearAll' | 'changeTabKey' | 'clearSearch' | 'submitQuickEdit' | 'initDrag' | 'cancelDrag' | 'toggleExpanded' | 'setExpanded';
284
+ actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'confirmDialog' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'select' | 'selectAll' | 'clearAll' | 'changeTabKey' | 'clearSearch' | 'submitQuickEdit' | 'initDrag' | 'cancelDrag' | 'toggleExpanded' | 'setExpanded' | 'clearError';
285
285
  api?: BaseApiObject | string;
286
286
  asyncApi?: BaseApiObject | string;
287
287
  payload?: any;
@@ -390,6 +390,7 @@ export type ToastConf = {
390
390
  className?: string;
391
391
  items?: Array<any>;
392
392
  useMobileUI?: boolean;
393
+ validateError?: ValidateError;
393
394
  };
394
395
  export interface OptionProps {
395
396
  className?: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -3,6 +3,8 @@ export interface AnimationsProps {
3
3
  type: string;
4
4
  duration?: number;
5
5
  delay?: number;
6
+ repeat?: boolean;
7
+ inView?: boolean;
6
8
  };
7
9
  attention?: {
8
10
  type: string;
@@ -14,6 +16,8 @@ export interface AnimationsProps {
14
16
  type: string;
15
17
  duration?: number;
16
18
  delay?: number;
19
+ repeat?: boolean;
20
+ outView?: boolean;
17
21
  };
18
22
  }
19
23
  export declare function createAnimationStyle(id: string, animationsConfig: AnimationsProps): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -48,6 +48,7 @@ export declare function isApiOutdatedWithData(prevApi: Api | undefined, nextApi:
48
48
  export declare function isApiOutdated(prevApi: Api | undefined, nextApi: Api | undefined, prevData: any, nextData: any): nextApi is Api;
49
49
  export declare function isValidApi(api: string): boolean;
50
50
  export declare function isEffectiveApi(api?: Api, data?: any, initFetch?: boolean, initFetchOn?: string): api is Api;
51
+ export declare function shouldBlockedBySendOnApi(api?: Api, data?: any): boolean;
51
52
  export declare function isSameApi(apiA: ApiObject | ApiCacheConfig, apiB: ApiObject | ApiCacheConfig): boolean;
52
53
  export declare function getApiCache(api: ApiObject): ApiCacheConfig | undefined;
53
54
  export declare function setApiCache(api: ApiObject, promise: Promise<any>): Promise<any>;
package/esm/utils/api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -158,9 +158,13 @@ function buildApi(api, data, options) {
158
158
  }
159
159
  return apiObject;
160
160
  };
161
+ var queryMapped = false;
161
162
  if (~idx) {
162
163
  var hashIdx = url.indexOf('#');
163
164
  var params = qsparse(url.substring(idx + 1, ~hashIdx && hashIdx > idx ? hashIdx : undefined));
165
+ // 合并 api.query 的配置
166
+ params = dataMapping(Object.assign(params, api.query), data, undefined, api.convertKeyToPath);
167
+ queryMapped = true;
164
168
  // 将里面的表达式运算完
165
169
  JSONTraverse(params, function (value, key, host) {
166
170
  var _a;
@@ -172,13 +176,12 @@ function buildApi(api, data, options) {
172
176
  host[key] = replaceExpression(host[key], 'raw', '');
173
177
  }
174
178
  });
179
+ api.query = params;
175
180
  var left = replaceExpression(url.substring(0, idx), 'raw', '');
176
- // 追加
177
- Object.assign(params, api.query);
178
181
  api.url =
179
182
  left +
180
183
  (~left.indexOf('?') ? '&' : '?') +
181
- queryStringify((api.query = dataMapping(params, data, undefined, api.convertKeyToPath))) +
184
+ queryStringify(api.query) +
182
185
  (~hashIdx && hashIdx > idx
183
186
  ? replaceExpression(url.substring(hashIdx))
184
187
  : '');
@@ -199,7 +202,7 @@ function buildApi(api, data, options) {
199
202
  api.body = api.data = data;
200
203
  }
201
204
  // 给 query 做数据映射
202
- if (api.query) {
205
+ if (api.query && !queryMapped) {
203
206
  api.query = dataMapping(api.query, data, undefined, api.convertKeyToPath);
204
207
  }
205
208
  // get 类请求,把 data 附带到 url 上。
@@ -767,6 +770,15 @@ function isEffectiveApi(api, data, initFetch, initFetchOn) {
767
770
  }
768
771
  return false;
769
772
  }
773
+ // 判断api是否存在,且SendOn为不发送
774
+ function shouldBlockedBySendOnApi(api, data) {
775
+ if (isObject(api) && api.url) {
776
+ if (api.sendOn && data) {
777
+ return !evalExpression(api.sendOn, data);
778
+ }
779
+ }
780
+ return false;
781
+ }
770
782
  function isSameApi(apiA, apiB) {
771
783
  return (apiA.method === apiB.method &&
772
784
  apiA.url === apiB.url &&
@@ -812,4 +824,4 @@ function normalizeApiResponseData(data) {
812
824
  }
813
825
  // window.apiCaches = apiCaches;
814
826
 
815
- export { addApiRequestAdaptor, addApiResponseAdaptor, addApiResponseAdator, buildApi, callStrFunction, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, removeApiRequestAdaptor, removeApiResponseAdaptor, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher };
827
+ export { addApiRequestAdaptor, addApiResponseAdaptor, addApiResponseAdator, buildApi, callStrFunction, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, removeApiRequestAdaptor, removeApiResponseAdaptor, responseAdaptor, setApiCache, shouldBlockedBySendOnApi, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/esm/utils/date.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/esm/utils/dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -293,8 +293,13 @@ export declare class ValidateError extends Error {
293
293
  detail: {
294
294
  [propName: string]: Array<string> | string;
295
295
  };
296
+ rawError?: {
297
+ [propName: string]: any;
298
+ };
296
299
  constructor(message: string, error: {
297
300
  [propName: string]: Array<string> | string;
301
+ }, rawError?: {
302
+ [propName: string]: any;
298
303
  });
299
304
  }
300
305
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1218,11 +1218,12 @@ var SkipOperation = /** @class */ (function (_super) {
1218
1218
  }(Error));
1219
1219
  var ValidateError = /** @class */ (function (_super) {
1220
1220
  __extends(ValidateError, _super);
1221
- function ValidateError(message, error) {
1221
+ function ValidateError(message, error, rawError) {
1222
1222
  var _this = _super.call(this) || this;
1223
1223
  _this.name = 'ValidateError';
1224
1224
  _this.message = message;
1225
1225
  _this.detail = error;
1226
+ _this.rawError = rawError;
1226
1227
  return _this;
1227
1228
  }
1228
1229
  return ValidateError;
@@ -1731,6 +1732,9 @@ function supportsMjs() {
1731
1732
  }
1732
1733
  }
1733
1734
  function formateId(id) {
1735
+ if (!id) {
1736
+ return guid();
1737
+ }
1734
1738
  // 将className非法字符替换为短横线
1735
1739
  id = id.replace(/[^a-zA-Z0-9-]/g, '-');
1736
1740
  // 将连续的-替换为单个-
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/esm/utils/icon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.11.0-beta.0
2
+ * amis-core v6.11.0-beta.2
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5