amis-core 2.7.2 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +4 -4
  3. package/esm/SchemaRenderer.js +23 -12
  4. package/esm/Scoped.js +49 -30
  5. package/esm/WithRootStore.js +1 -1
  6. package/esm/WithStore.js +1 -1
  7. package/esm/actions/Action.js +32 -17
  8. package/esm/actions/AjaxAction.js +1 -1
  9. package/esm/actions/BreakAction.js +1 -1
  10. package/esm/actions/BroadcastAction.js +1 -1
  11. package/esm/actions/CmptAction.js +1 -1
  12. package/esm/actions/ContinueAction.js +1 -1
  13. package/esm/actions/CopyAction.js +1 -1
  14. package/esm/actions/CustomAction.js +1 -1
  15. package/esm/actions/DialogAction.js +1 -1
  16. package/esm/actions/DrawerAction.js +1 -1
  17. package/esm/actions/EmailAction.js +1 -1
  18. package/esm/actions/LinkAction.js +1 -1
  19. package/esm/actions/LoopAction.js +63 -34
  20. package/esm/actions/PageAction.js +1 -1
  21. package/esm/actions/ParallelAction.js +1 -1
  22. package/esm/actions/SwitchAction.js +25 -12
  23. package/esm/actions/ToastAction.js +1 -1
  24. package/esm/components/LazyComponent.js +1 -1
  25. package/esm/components/Overlay.js +1 -1
  26. package/esm/components/PopOver.js +1 -1
  27. package/esm/env.js +1 -1
  28. package/esm/envOverwrite.js +29 -9
  29. package/esm/factory.js +1 -1
  30. package/esm/index.js +2 -2
  31. package/esm/locale.js +3 -3
  32. package/esm/renderers/Form.js +5 -36
  33. package/esm/renderers/Item.js +4 -4
  34. package/esm/renderers/Options.js +4 -4
  35. package/esm/renderers/Placeholder.js +1 -1
  36. package/esm/renderers/builtin.js +1 -1
  37. package/esm/renderers/register.js +3 -6
  38. package/esm/renderers/wrapControl.js +8 -4
  39. package/esm/store/app.js +1 -1
  40. package/esm/store/combo.d.ts +2335 -239
  41. package/esm/store/combo.js +1 -1
  42. package/esm/store/crud.js +54 -35
  43. package/esm/store/form.d.ts +1033 -16
  44. package/esm/store/form.js +27 -7
  45. package/esm/store/formItem.d.ts +9 -1
  46. package/esm/store/formItem.js +83 -45
  47. package/esm/store/iRenderer.js +1 -1
  48. package/esm/store/index.js +1 -1
  49. package/esm/store/list.js +1 -1
  50. package/esm/store/manager.js +1 -1
  51. package/esm/store/modal.js +1 -1
  52. package/esm/store/node.js +1 -1
  53. package/esm/store/pagination.js +1 -1
  54. package/esm/store/root.js +1 -1
  55. package/esm/store/service.js +1 -1
  56. package/esm/store/table.d.ts +2180 -148
  57. package/esm/store/table.js +27 -17
  58. package/esm/store/table2.js +1 -1
  59. package/esm/theme.js +3 -3
  60. package/esm/utils/Animation.js +1 -1
  61. package/esm/utils/ColorScale.js +4 -3
  62. package/esm/utils/DataSchema.js +4 -3
  63. package/esm/utils/DataScope.js +36 -16
  64. package/esm/utils/RootClose.js +3 -3
  65. package/esm/utils/SimpleMap.js +1 -1
  66. package/esm/utils/api.js +4 -4
  67. package/esm/utils/attachmentAdpator.js +1 -1
  68. package/esm/utils/autobind.js +1 -1
  69. package/esm/utils/columnsSplit.js +3 -5
  70. package/esm/utils/dataMapping.js +16 -6
  71. package/esm/utils/date.js +1 -1
  72. package/esm/utils/debug.js +28 -18
  73. package/esm/utils/decodeEntity.js +1 -1
  74. package/esm/utils/dom.js +4 -3
  75. package/esm/utils/errors.js +1 -1
  76. package/esm/utils/escapeHtml.js +1 -1
  77. package/esm/utils/filter-schema.js +1 -1
  78. package/esm/utils/filter.js +5 -7
  79. package/esm/utils/formatDuration.js +1 -1
  80. package/esm/utils/formula.js +1 -1
  81. package/esm/utils/getVariable.js +1 -1
  82. package/esm/utils/grammar.js +1 -1
  83. package/esm/utils/handleAction.js +1 -1
  84. package/esm/utils/helper.js +7 -7
  85. package/esm/utils/highlight.js +1 -1
  86. package/esm/utils/icon.js +1 -1
  87. package/esm/utils/image.js +1 -1
  88. package/esm/utils/isPureVariable.js +1 -1
  89. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  90. package/esm/utils/keyToPath.js +1 -1
  91. package/esm/utils/makeSorter.js +1 -1
  92. package/esm/utils/normalizeLink.js +1 -1
  93. package/esm/utils/normalizeOptions.js +1 -1
  94. package/esm/utils/object.js +1 -1
  95. package/esm/utils/offset.js +1 -1
  96. package/esm/utils/offsetParent.js +1 -1
  97. package/esm/utils/optionValueCompare.js +1 -1
  98. package/esm/utils/position.js +1 -1
  99. package/esm/utils/prettyBytes.js +8 -1
  100. package/esm/utils/renderer-event.js +54 -29
  101. package/esm/utils/replaceText.js +16 -8
  102. package/esm/utils/resize-sensor.js +4 -2
  103. package/esm/utils/resolveVariable.js +1 -1
  104. package/esm/utils/resolveVariableAndFilter.js +1 -1
  105. package/esm/utils/scrollPosition.js +1 -1
  106. package/esm/utils/string2regExp.js +1 -1
  107. package/esm/utils/stripNumber.js +1 -1
  108. package/esm/utils/style-helper.js +96 -75
  109. package/esm/utils/style.js +1 -1
  110. package/esm/utils/toNumber.js +1 -1
  111. package/esm/utils/tokenize.js +1 -1
  112. package/esm/utils/tpl-builtin.js +1 -1
  113. package/esm/utils/tpl-lodash.js +1 -1
  114. package/esm/utils/tpl.js +3 -3
  115. package/esm/utils/uncontrollable.js +1 -1
  116. package/esm/utils/validations.js +4 -4
  117. package/lib/Root.js +1 -1
  118. package/lib/RootRenderer.js +3 -3
  119. package/lib/SchemaRenderer.js +22 -11
  120. package/lib/Scoped.js +48 -29
  121. package/lib/WithRootStore.js +1 -1
  122. package/lib/WithStore.js +1 -1
  123. package/lib/actions/Action.js +31 -16
  124. package/lib/actions/AjaxAction.js +1 -1
  125. package/lib/actions/BreakAction.js +1 -1
  126. package/lib/actions/BroadcastAction.js +1 -1
  127. package/lib/actions/CmptAction.js +1 -1
  128. package/lib/actions/ContinueAction.js +1 -1
  129. package/lib/actions/CopyAction.js +1 -1
  130. package/lib/actions/CustomAction.js +1 -1
  131. package/lib/actions/DialogAction.js +1 -1
  132. package/lib/actions/DrawerAction.js +1 -1
  133. package/lib/actions/EmailAction.js +1 -1
  134. package/lib/actions/LinkAction.js +1 -1
  135. package/lib/actions/LoopAction.js +62 -33
  136. package/lib/actions/PageAction.js +1 -1
  137. package/lib/actions/ParallelAction.js +1 -1
  138. package/lib/actions/SwitchAction.js +24 -11
  139. package/lib/actions/ToastAction.js +1 -1
  140. package/lib/components/LazyComponent.js +1 -1
  141. package/lib/components/Overlay.js +1 -1
  142. package/lib/components/PopOver.js +1 -1
  143. package/lib/env.js +1 -1
  144. package/lib/envOverwrite.js +29 -9
  145. package/lib/factory.js +1 -1
  146. package/lib/index.js +2 -2
  147. package/lib/locale.js +2 -2
  148. package/lib/renderers/Form.js +5 -36
  149. package/lib/renderers/Item.js +3 -3
  150. package/lib/renderers/Options.js +3 -3
  151. package/lib/renderers/Placeholder.js +1 -1
  152. package/lib/renderers/builtin.js +1 -1
  153. package/lib/renderers/register.js +3 -6
  154. package/lib/renderers/wrapControl.js +8 -4
  155. package/lib/store/app.js +1 -1
  156. package/lib/store/combo.d.ts +2335 -239
  157. package/lib/store/combo.js +1 -1
  158. package/lib/store/crud.js +53 -34
  159. package/lib/store/form.d.ts +1033 -16
  160. package/lib/store/form.js +26 -6
  161. package/lib/store/formItem.d.ts +9 -1
  162. package/lib/store/formItem.js +81 -43
  163. package/lib/store/iRenderer.js +1 -1
  164. package/lib/store/index.js +1 -1
  165. package/lib/store/list.js +1 -1
  166. package/lib/store/manager.js +1 -1
  167. package/lib/store/modal.js +1 -1
  168. package/lib/store/node.js +1 -1
  169. package/lib/store/pagination.js +1 -1
  170. package/lib/store/root.js +1 -1
  171. package/lib/store/service.js +1 -1
  172. package/lib/store/table.d.ts +2180 -148
  173. package/lib/store/table.js +26 -16
  174. package/lib/store/table2.js +1 -1
  175. package/lib/theme.js +2 -2
  176. package/lib/utils/Animation.js +1 -1
  177. package/lib/utils/ColorScale.js +4 -3
  178. package/lib/utils/DataSchema.js +4 -3
  179. package/lib/utils/DataScope.js +35 -15
  180. package/lib/utils/RootClose.js +2 -2
  181. package/lib/utils/SimpleMap.js +1 -1
  182. package/lib/utils/api.js +3 -3
  183. package/lib/utils/attachmentAdpator.js +1 -1
  184. package/lib/utils/autobind.js +1 -1
  185. package/lib/utils/columnsSplit.js +3 -5
  186. package/lib/utils/dataMapping.js +15 -5
  187. package/lib/utils/date.js +1 -1
  188. package/lib/utils/debug.js +27 -17
  189. package/lib/utils/decodeEntity.js +1 -1
  190. package/lib/utils/dom.js +4 -3
  191. package/lib/utils/errors.js +1 -1
  192. package/lib/utils/escapeHtml.js +1 -1
  193. package/lib/utils/filter-schema.js +1 -1
  194. package/lib/utils/filter.js +4 -6
  195. package/lib/utils/formatDuration.js +1 -1
  196. package/lib/utils/formula.js +1 -1
  197. package/lib/utils/getVariable.js +1 -1
  198. package/lib/utils/grammar.js +1 -1
  199. package/lib/utils/handleAction.js +1 -1
  200. package/lib/utils/helper.js +6 -6
  201. package/lib/utils/highlight.js +1 -1
  202. package/lib/utils/icon.js +1 -1
  203. package/lib/utils/image.js +1 -1
  204. package/lib/utils/isPureVariable.js +1 -1
  205. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  206. package/lib/utils/keyToPath.js +1 -1
  207. package/lib/utils/makeSorter.js +1 -1
  208. package/lib/utils/normalizeLink.js +1 -1
  209. package/lib/utils/normalizeOptions.js +1 -1
  210. package/lib/utils/object.js +1 -1
  211. package/lib/utils/offset.js +1 -1
  212. package/lib/utils/offsetParent.js +1 -1
  213. package/lib/utils/optionValueCompare.js +1 -1
  214. package/lib/utils/position.js +1 -1
  215. package/lib/utils/prettyBytes.js +8 -1
  216. package/lib/utils/renderer-event.js +53 -28
  217. package/lib/utils/replaceText.js +16 -8
  218. package/lib/utils/resize-sensor.js +4 -2
  219. package/lib/utils/resolveVariable.js +1 -1
  220. package/lib/utils/resolveVariableAndFilter.js +1 -1
  221. package/lib/utils/scrollPosition.js +1 -1
  222. package/lib/utils/string2regExp.js +1 -1
  223. package/lib/utils/stripNumber.js +1 -1
  224. package/lib/utils/style-helper.js +96 -75
  225. package/lib/utils/style.js +1 -1
  226. package/lib/utils/toNumber.js +1 -1
  227. package/lib/utils/tokenize.js +1 -1
  228. package/lib/utils/tpl-builtin.js +1 -1
  229. package/lib/utils/tpl-lodash.js +1 -1
  230. package/lib/utils/tpl.js +2 -2
  231. package/lib/utils/uncontrollable.js +1 -1
  232. package/lib/utils/validations.js +3 -3
  233. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __assign, __spreadArray } from 'tslib';
6
+ import { __assign, __spreadArray, __read, __values } from 'tslib';
7
7
  import { types, getParent, isAlive } from 'mobx-state-tree';
8
8
  import { iRendererStore } from './iRenderer.js';
9
9
  import 'amis-formula';
@@ -871,7 +871,7 @@ var TableStore = iRendererStore
871
871
  maxLength >= selectedItems.length) {
872
872
  var restCheckableRows = self.checkableRows.filter(function (item) { return !item.checked; });
873
873
  var checkableRows = restCheckableRows.filter(function (item, i) { return i < maxLength - selectedItems.length; });
874
- return __spreadArray(__spreadArray([], self.selectedRows, true), checkableRows, true);
874
+ return __spreadArray(__spreadArray([], __read(self.selectedRows), false), __read(checkableRows), false);
875
875
  }
876
876
  else {
877
877
  return self.checkableRows;
@@ -904,6 +904,7 @@ var TableStore = iRendererStore
904
904
  }
905
905
  // 按住 shift 的时候点击选项
906
906
  function toggleShift(row) {
907
+ var e_1, _a;
907
908
  // 如果是同一个或非 multiple 模式下就和不用 shift 一样
908
909
  if (!lastCheckedRow || row === lastCheckedRow || !self.multiple) {
909
910
  toggle(row);
@@ -917,27 +918,36 @@ var TableStore = iRendererStore
917
918
  var maxIndex = lastCheckedRowIndex > rowIndex ? lastCheckedRowIndex : rowIndex;
918
919
  var rows = checkableRows.slice(minIndex, maxIndex);
919
920
  rows.push(row); // 将当前行也加入进行判断
920
- for (var _i = 0, rows_1 = rows; _i < rows_1.length; _i++) {
921
- var rowItem = rows_1[_i];
922
- var idx = self.selectedRows.indexOf(rowItem);
923
- if (idx === -1) {
924
- // 如果上一个是选中状态,则将之间的所有 check 都变成可选
925
- if (lastCheckedRow.checked) {
926
- if (maxLength) {
927
- if (self.selectedRows.length < maxLength) {
921
+ try {
922
+ for (var rows_1 = __values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
923
+ var rowItem = rows_1_1.value;
924
+ var idx = self.selectedRows.indexOf(rowItem);
925
+ if (idx === -1) {
926
+ // 如果上一个是选中状态,则将之间的所有 check 都变成可选
927
+ if (lastCheckedRow.checked) {
928
+ if (maxLength) {
929
+ if (self.selectedRows.length < maxLength) {
930
+ self.selectedRows.push(rowItem);
931
+ }
932
+ }
933
+ else {
928
934
  self.selectedRows.push(rowItem);
929
935
  }
930
936
  }
931
- else {
932
- self.selectedRows.push(rowItem);
937
+ }
938
+ else {
939
+ if (!lastCheckedRow.checked) {
940
+ self.selectedRows.splice(idx, 1);
933
941
  }
934
942
  }
935
943
  }
936
- else {
937
- if (!lastCheckedRow.checked) {
938
- self.selectedRows.splice(idx, 1);
939
- }
944
+ }
945
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
946
+ finally {
947
+ try {
948
+ if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
940
949
  }
950
+ finally { if (e_1) throw e_1.error; }
941
951
  }
942
952
  lastCheckedRow = row;
943
953
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/theme.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __assign, __extends } from 'tslib';
6
+ import { __assign, __extends, __spreadArray, __read } from 'tslib';
7
7
  import cx from 'classnames';
8
8
  import React from 'react';
9
9
  import hoistNonReactStatic from 'hoist-non-react-statics';
@@ -27,7 +27,7 @@ function makeClassnames(ns) {
27
27
  for (var _i = 0; _i < arguments.length; _i++) {
28
28
  classes[_i] = arguments[_i];
29
29
  }
30
- var str = cx.apply(void 0, classes);
30
+ var str = cx.apply(void 0, __spreadArray([], __read(classes), false));
31
31
  return str && ns
32
32
  ? str
33
33
  .replace(/(^|\s)([A-Z])/g, '$1' + ns + '$2')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,10 +1,11 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
+ import { __read } from 'tslib';
7
+
6
8
  // 代码修改自 https://github.com/dalisc/color-scales-js
7
- // 主要是将校验功能改成修正而不是报错,比如 min 和 max 相等的时候自动给 max + 1
8
9
  var Color = /** @class */ (function () {
9
10
  function Color(r, g, b, a) {
10
11
  if (a === void 0) { a = 1; }
@@ -69,7 +70,7 @@ var ColorScale = /** @class */ (function () {
69
70
  this.max = this.min + 1;
70
71
  }
71
72
  if (this.max < this.min) {
72
- _a = [this.min, this.max], this.max = _a[0], this.min = _a[1];
73
+ _a = __read([this.min, this.max], 2), this.max = _a[0], this.min = _a[1];
73
74
  }
74
75
  if (colorStops.length < 2) {
75
76
  colorStops = ['#FFEF9C', '#FF7127'];
@@ -1,8 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
+ import { __spreadArray, __read } from 'tslib';
6
7
  import { DataScope } from './DataScope.js';
7
8
  import { guid } from './helper.js';
8
9
 
@@ -33,7 +34,7 @@ var DataSchema = /** @class */ (function () {
33
34
  var schemas = [];
34
35
  var current = this.current;
35
36
  while (current) {
36
- schemas.push.apply(schemas, current.schemas);
37
+ schemas.push.apply(schemas, __spreadArray([], __read(current.schemas), false));
37
38
  current = current.parent;
38
39
  }
39
40
  return schemas;
@@ -89,7 +90,7 @@ var DataSchema = /** @class */ (function () {
89
90
  });
90
91
  }
91
92
  else {
92
- variables.push.apply(variables, current.getDataPropsAsOptions());
93
+ variables.push.apply(variables, __spreadArray([], __read(current.getDataPropsAsOptions()), false));
93
94
  }
94
95
  current = current.parent;
95
96
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __assign } from 'tslib';
6
+ import { __values, __assign } from 'tslib';
7
7
  import { guid } from './helper.js';
8
8
  import { keyToPath } from './keyToPath.js';
9
9
 
@@ -34,13 +34,23 @@ var DataScope = /** @class */ (function () {
34
34
  }
35
35
  };
36
36
  DataScope.prototype.setSchemas = function (schemas) {
37
+ var e_1, _a;
37
38
  this.schemas.splice(0, this.schemas.length);
38
- for (var _i = 0, schemas_1 = schemas; _i < schemas_1.length; _i++) {
39
- var schema = schemas_1[_i];
40
- if (schema.type !== 'object') {
41
- throw new TypeError('data scope accept only object');
39
+ try {
40
+ for (var schemas_1 = __values(schemas), schemas_1_1 = schemas_1.next(); !schemas_1_1.done; schemas_1_1 = schemas_1.next()) {
41
+ var schema = schemas_1_1.value;
42
+ if (schema.type !== 'object') {
43
+ throw new TypeError('data scope accept only object');
44
+ }
45
+ this.schemas.push(__assign({ $id: guid() }, schema));
46
+ }
47
+ }
48
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
49
+ finally {
50
+ try {
51
+ if (schemas_1_1 && !schemas_1_1.done && (_a = schemas_1.return)) _a.call(schemas_1);
42
52
  }
43
- this.schemas.push(__assign({ $id: guid() }, schema));
53
+ finally { if (e_1) throw e_1.error; }
44
54
  }
45
55
  return this;
46
56
  };
@@ -137,19 +147,29 @@ var DataScope = /** @class */ (function () {
137
147
  return variables[0].children;
138
148
  };
139
149
  DataScope.prototype.getSchemaByPath = function (path) {
150
+ var e_2, _a;
140
151
  var parts = keyToPath(path);
141
- for (var _i = 0, _a = this.schemas; _i < _a.length; _i++) {
142
- var schema = _a[_i];
143
- var result = parts.reduce(function (schema, key) {
144
- if (schema && schema.type === 'object' && schema.properties) {
145
- return schema.properties[key];
152
+ try {
153
+ for (var _b = __values(this.schemas), _c = _b.next(); !_c.done; _c = _b.next()) {
154
+ var schema = _c.value;
155
+ var result = parts.reduce(function (schema, key) {
156
+ if (schema && schema.type === 'object' && schema.properties) {
157
+ return schema.properties[key];
158
+ }
159
+ return null;
160
+ }, schema);
161
+ if (result) {
162
+ return result;
146
163
  }
147
- return null;
148
- }, schema);
149
- if (result) {
150
- return result;
151
164
  }
152
165
  }
166
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
167
+ finally {
168
+ try {
169
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
170
+ }
171
+ finally { if (e_2) throw e_2.error; }
172
+ }
153
173
  return null;
154
174
  };
155
175
  return DataScope;
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __rest } from 'tslib';
6
+ import { __rest, __read } from 'tslib';
7
7
  import { useState } from 'react';
8
8
  import useRootClose from 'react-overlays/useRootClose';
9
9
  import { findDOMNode } from 'react-dom';
@@ -13,7 +13,7 @@ import { findDOMNode } from 'react-dom';
13
13
  */
14
14
  var RootClose = function (_a) {
15
15
  var children = _a.children, onRootClose = _a.onRootClose, props = __rest(_a, ["children", "onRootClose"]);
16
- var _b = useState(null), rootComponent = _b[0], attachRef = _b[1];
16
+ var _b = __read(useState(null), 2), rootComponent = _b[0], attachRef = _b[1];
17
17
  var rootElement = findDOMNode(rootComponent);
18
18
  useRootClose(rootElement, onRootClose, props);
19
19
  return typeof children === 'function' ? children(attachRef) : children;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/utils/api.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __awaiter, __generator, __assign, __rest, __spreadArray } from 'tslib';
6
+ import { __awaiter, __generator, __assign, __rest, __spreadArray, __read } from 'tslib';
7
7
  import omit from 'lodash/omit';
8
8
  import { parse, evaluate } from 'amis-formula';
9
9
  import { escapeHtml } from './escapeHtml.js';
@@ -218,7 +218,7 @@ function str2function(contents) {
218
218
  args[_i - 1] = arguments[_i];
219
219
  }
220
220
  try {
221
- var fn = new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], args, false), [contents], false)))();
221
+ var fn = new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(args), false), [contents], false)))();
222
222
  return fn;
223
223
  }
224
224
  catch (e) {
@@ -237,7 +237,7 @@ function str2AsyncFunction(contents) {
237
237
  args[_i - 1] = arguments[_i];
238
238
  }
239
239
  try {
240
- var fn = new (AsyncFunction.bind.apply(AsyncFunction, __spreadArray(__spreadArray([void 0], args, false), [contents], false)))();
240
+ var fn = new (AsyncFunction.bind.apply(AsyncFunction, __spreadArray(__spreadArray([void 0], __read(args), false), [contents], false)))();
241
241
  return fn;
242
242
  }
243
243
  catch (e) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,19 +1,17 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
+ import { __spreadArray, __read } from 'tslib';
6
7
  import React from 'react';
7
8
  import chunk from 'lodash/chunk';
8
9
 
9
- /**
10
- * columnsCount 支持数字和数组两种格式
11
- */
12
10
  function columnsSplit(body, cx, columnsCount) {
13
11
  if (Array.isArray(columnsCount) && columnsCount.length) {
14
12
  var bodyIndex_1 = 0;
15
13
  var bodyList_1 = [];
16
- var maxSize = Math.max(Math.round(12 / Math.max.apply(Math, columnsCount)), 1);
14
+ var maxSize = Math.max(Math.round(12 / Math.max.apply(Math, __spreadArray([], __read(columnsCount), false))), 1);
17
15
  var cellClassName_1 = "Grid-col--sm".concat(maxSize);
18
16
  columnsCount.forEach(function (columnSize, groupIndex) {
19
17
  if (columnSize) {
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __assign } from 'tslib';
6
+ import { __values, __assign } from 'tslib';
7
7
  import { isPureVariable } from './isPureVariable.js';
8
8
  import { resolveVariableAndFilter } from './resolveVariableAndFilter.js';
9
9
  import { tokenize } from './tokenize.js';
@@ -29,11 +29,21 @@ function resolveMapping(value, data, defaultFilter, ignoreIfNotMatch) {
29
29
  * @param data 数据上下文
30
30
  */
31
31
  function resolveMappingObject(value, data) {
32
- for (var _i = 0, _a = Object.keys(value); _i < _a.length; _i++) {
33
- var key = _a[_i];
34
- if (typeof value[key] === 'string') {
35
- value[key] = resolveMapping(value[key], data);
32
+ var e_1, _a;
33
+ try {
34
+ for (var _b = __values(Object.keys(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
35
+ var key = _c.value;
36
+ if (typeof value[key] === 'string') {
37
+ value[key] = resolveMapping(value[key], data);
38
+ }
39
+ }
40
+ }
41
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
42
+ finally {
43
+ try {
44
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
36
45
  }
46
+ finally { if (e_1) throw e_1.error; }
37
47
  }
38
48
  return value;
39
49
  }
package/esm/utils/date.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __decorate, __metadata, __extends } from 'tslib';
6
+ import { __decorate, __metadata, __values, __read, __extends } from 'tslib';
7
7
  import React, { useRef, useState, useEffect, Component } from 'react';
8
8
  import cx from 'classnames';
9
9
  import { findDOMNode, render } from 'react-dom';
@@ -117,12 +117,13 @@ var LogView = observer(function (_a) {
117
117
  })));
118
118
  });
119
119
  var AMISDebug = observer(function (_a) {
120
- var _b, _c;
120
+ var e_1, _b;
121
+ var _c, _d;
121
122
  var store = _a.store;
122
123
  var activeId = store.activeId;
123
124
  var activeComponentInspect = ComponentInfo[activeId];
124
125
  // 收集数据域里的数据
125
- var start = ((_c = (_b = activeComponentInspect === null || activeComponentInspect === void 0 ? void 0 : activeComponentInspect.component) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.data) || {};
126
+ var start = ((_d = (_c = activeComponentInspect === null || activeComponentInspect === void 0 ? void 0 : activeComponentInspect.component) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.data) || {};
126
127
  var stacks = [start];
127
128
  while (Object.getPrototypeOf(start) !== Object.prototype) {
128
129
  var superData = Object.getPrototypeOf(start);
@@ -135,20 +136,29 @@ var AMISDebug = observer(function (_a) {
135
136
  var stackDataView = [];
136
137
  if (Object.keys(stacks[0]).length || stacks.length > 1) {
137
138
  var level = 0;
138
- for (var _i = 0, stacks_1 = stacks; _i < stacks_1.length; _i++) {
139
- var stack = stacks_1[_i];
140
- stackDataView.push(React.createElement("div", { key: "data-".concat(level) },
141
- React.createElement("h3", null,
142
- "Data Level-",
143
- level),
144
- React.createElement(JsonView, { key: "dataview-".concat(stack), name: null, theme: "monokai", src: stack, collapsed: level === 0 ? false : true, enableClipboard: false, displayDataTypes: false, iconStyle: "square" })));
145
- level += 1;
139
+ try {
140
+ for (var stacks_1 = __values(stacks), stacks_1_1 = stacks_1.next(); !stacks_1_1.done; stacks_1_1 = stacks_1.next()) {
141
+ var stack = stacks_1_1.value;
142
+ stackDataView.push(React.createElement("div", { key: "data-".concat(level) },
143
+ React.createElement("h3", null,
144
+ "Data Level-",
145
+ level),
146
+ React.createElement(JsonView, { key: "dataview-".concat(stack), name: null, theme: "monokai", src: stack, collapsed: level === 0 ? false : true, enableClipboard: false, displayDataTypes: false, iconStyle: "square" })));
147
+ level += 1;
148
+ }
149
+ }
150
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
151
+ finally {
152
+ try {
153
+ if (stacks_1_1 && !stacks_1_1.done && (_b = stacks_1.return)) _b.call(stacks_1);
154
+ }
155
+ finally { if (e_1) throw e_1.error; }
146
156
  }
147
157
  }
148
158
  var panelRef = useRef(null);
149
- var _d = useState(false), isResizing = _d[0], setResizing = _d[1];
150
- var _e = useState(0), startX = _e[0], setStartX = _e[1];
151
- var _f = useState(0), panelWidth = _f[0], setPanelWidth = _f[1];
159
+ var _e = __read(useState(false), 2), isResizing = _e[0], setResizing = _e[1];
160
+ var _f = __read(useState(0), 2), startX = _f[0], setStartX = _f[1];
161
+ var _g = __read(useState(0), 2), panelWidth = _g[0], setPanelWidth = _g[1];
152
162
  useEffect(function () {
153
163
  var handleMouseUp = function () {
154
164
  setResizing(false);
@@ -341,6 +351,9 @@ var DebugWrapper = /** @class */ (function (_super) {
341
351
  * @param ext 扩展信息
342
352
  */
343
353
  function debug(cat, msg, ext) {
354
+ console.groupCollapsed('[amis debug]', msg);
355
+ console.debug(ext);
356
+ console.groupEnd();
344
357
  if (!isEnabled) {
345
358
  return;
346
359
  }
@@ -350,9 +363,6 @@ function debug(cat, msg, ext) {
350
363
  msg: msg,
351
364
  ext: JSON.stringify(ext)
352
365
  };
353
- console.groupCollapsed('amis debug', msg);
354
- console.trace(log);
355
- console.groupEnd();
356
366
  store.logs.push(log);
357
367
  }
358
368
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/utils/dom.js CHANGED
@@ -1,8 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
+ import { __read } from 'tslib';
6
7
  import ReactDOM from 'react-dom';
7
8
  import { offset } from './offset.js';
8
9
  import { position } from './position.js';
@@ -86,7 +87,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
86
87
  var tests = placement.split(/\s+/);
87
88
  while (tests.length) {
88
89
  var current = (activePlacement = tests.shift());
89
- var _b = current.split('-'), atX = _b[0], atY = _b[1], myX = _b[2], myY = _b[3];
90
+ var _b = __read(current.split('-'), 4), atX = _b[0], atY = _b[1], myX = _b[2], myY = _b[3];
90
91
  myX = myX || atX;
91
92
  myY = myY || atY;
92
93
  positionLeft =
@@ -166,7 +167,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
166
167
  else {
167
168
  throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
168
169
  }
169
- var _c = customOffset[0], offSetX = _c === void 0 ? 0 : _c, _d = customOffset[1], offSetY = _d === void 0 ? 0 : _d;
170
+ var _c = __read(customOffset, 2), _d = _c[0], offSetX = _d === void 0 ? 0 : _d, _e = _c[1], offSetY = _e === void 0 ? 0 : _e;
170
171
  return {
171
172
  positionLeft: (positionLeft + offSetX) / scaleX,
172
173
  positionTop: (positionTop + offSetY) / scaleY,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __spreadArray } from 'tslib';
6
+ import { __spreadArray, __read } from 'tslib';
7
7
  import { extendsFilters, filters } from 'amis-formula';
8
8
  import moment from 'moment';
9
9
  import { makeSorter } from './makeSorter.js';
@@ -88,7 +88,7 @@ extendsFilters({
88
88
  return Array.isArray(input) && filters[fn]
89
89
  ? input.map(function (item) {
90
90
  var _a;
91
- return (_a = filters[fn]).call.apply(_a, __spreadArray([_this, item], arg, false));
91
+ return (_a = filters[fn]).call.apply(_a, __spreadArray([_this, item], __read(arg), false));
92
92
  })
93
93
  : input;
94
94
  },
@@ -169,9 +169,7 @@ extendsFilters({
169
169
  bytes: function (input, step) {
170
170
  var _a;
171
171
  if (step === void 0) { step = 1000; }
172
- return input
173
- ? prettyBytes(parseFloat(input), (_a = parseInt(step, 10)) !== null && _a !== void 0 ? _a : 1000)
174
- : input;
172
+ return input ? prettyBytes(input, (_a = parseInt(step, 10)) !== null && _a !== void 0 ? _a : 1000) : input;
175
173
  },
176
174
  round: function (input, decimals) {
177
175
  var _a;
@@ -365,7 +363,7 @@ extendsFilters({
365
363
  args[_i - 1] = arguments[_i];
366
364
  }
367
365
  return Array.isArray(input)
368
- ? input.concat.apply(input, args.map(function (arg, index) { var _a; return getStrOrVariable(arg, _this.data, (_a = _this.filter) === null || _a === void 0 ? void 0 : _a.args[index]); })) : input;
366
+ ? input.concat.apply(input, __spreadArray([], __read(args.map(function (arg, index) { var _a; return getStrOrVariable(arg, _this.data, (_a = _this.filter) === null || _a === void 0 ? void 0 : _a.args[index]); })), false)) : input;
369
367
  },
370
368
  filter: function (input, keys, expOrDirective, arg1) {
371
369
  var _a, _b, _c, _d;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.7.2
2
+ * amis-core v2.8.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5