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,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/lib/utils/icon.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,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
 
@@ -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
 
@@ -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
 
@@ -10,6 +10,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
  var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
11
11
  var prettyBytes = function (num, step) {
12
12
  if (step === void 0) { step = 1000; }
13
+ if (num && typeof num === 'string') {
14
+ // 说明已经转过了
15
+ if (num.endsWith('B')) {
16
+ return num;
17
+ }
18
+ num = parseFloat(num);
19
+ }
13
20
  if (!Number.isFinite(num)) {
14
21
  throw new TypeError("Expected a finite number, got ".concat(typeof num, ": ").concat(num));
15
22
  }
@@ -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
 
@@ -41,7 +41,8 @@ function createRendererEvent(type, context) {
41
41
  }
42
42
  // 绑定事件
43
43
  var bindEvent = function (renderer) {
44
- var _a, _b;
44
+ var e_1, _a;
45
+ var _b, _c;
45
46
  if (!renderer) {
46
47
  return undefined;
47
48
  }
@@ -52,7 +53,7 @@ var bindEvent = function (renderer) {
52
53
  return item.renderer === renderer && item.type === key;
53
54
  });
54
55
  if (listener === null || listener === void 0 ? void 0 : listener.executing) {
55
- (_b = (_a = listener === null || listener === void 0 ? void 0 : listener.debounceInstance) === null || _a === void 0 ? void 0 : _a.cancel) === null || _b === void 0 ? void 0 : _b.call(_a);
56
+ (_c = (_b = listener === null || listener === void 0 ? void 0 : listener.debounceInstance) === null || _b === void 0 ? void 0 : _b.cancel) === null || _c === void 0 ? void 0 : _c.call(_b);
56
57
  rendererEventListeners = rendererEventListeners.filter(function (item) {
57
58
  return !(item.renderer === listener.renderer && item.type === listener.type);
58
59
  });
@@ -74,10 +75,19 @@ var bindEvent = function (renderer) {
74
75
  });
75
76
  }
76
77
  };
77
- // 暂存
78
- for (var _i = 0, _c = Object.keys(listeners); _i < _c.length; _i++) {
79
- var key = _c[_i];
80
- _loop_1(key);
78
+ try {
79
+ // 暂存
80
+ for (var _d = tslib.__values(Object.keys(listeners)), _e = _d.next(); !_e.done; _e = _d.next()) {
81
+ var key = _e.value;
82
+ _loop_1(key);
83
+ }
84
+ }
85
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
86
+ finally {
87
+ try {
88
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
89
+ }
90
+ finally { if (e_1) throw e_1.error; }
81
91
  }
82
92
  return function () {
83
93
  rendererEventListeners = rendererEventListeners.filter(function (item) { return item.renderer !== renderer; });
@@ -89,10 +99,11 @@ var bindEvent = function (renderer) {
89
99
  function dispatchEvent(e, renderer, scoped, data, broadcast) {
90
100
  var _a, _b, _c, _d, _e, _f;
91
101
  return tslib.__awaiter(this, void 0, void 0, function () {
92
- var unbindEvent, eventName, eventConfig, rendererEvent, listeners, executedCount, checkExecuted, _loop_2, _i, listeners_1, listener, state_1;
102
+ var unbindEvent, eventName, eventConfig, rendererEvent, listeners, executedCount, checkExecuted, _loop_2, listeners_1, listeners_1_1, listener, state_1, e_2_1;
103
+ var e_2, _g;
93
104
  var _this = this;
94
- return tslib.__generator(this, function (_g) {
95
- switch (_g.label) {
105
+ return tslib.__generator(this, function (_h) {
106
+ switch (_h.label) {
96
107
  case 0:
97
108
  unbindEvent = null;
98
109
  eventName = typeof e === 'string' ? e : e.type;
@@ -132,11 +143,11 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
132
143
  }
133
144
  };
134
145
  _loop_2 = function (listener) {
135
- var _h, _j, wait, _k, trailing, _l, leading, _m, maxWait, debounced_1;
136
- return tslib.__generator(this, function (_o) {
137
- switch (_o.label) {
146
+ var _j, _k, wait, _l, trailing, _m, leading, _o, maxWait, debounced_1;
147
+ return tslib.__generator(this, function (_p) {
148
+ switch (_p.label) {
138
149
  case 0:
139
- _h = (listener === null || listener === void 0 ? void 0 : listener.debounce) || {}, _j = _h.wait, wait = _j === void 0 ? 100 : _j, _k = _h.trailing, trailing = _k === void 0 ? true : _k, _l = _h.leading, leading = _l === void 0 ? false : _l, _m = _h.maxWait, maxWait = _m === void 0 ? 10000 : _m;
150
+ _j = (listener === null || listener === void 0 ? void 0 : listener.debounce) || {}, _k = _j.wait, wait = _k === void 0 ? 100 : _k, _l = _j.trailing, trailing = _l === void 0 ? true : _l, _m = _j.leading, leading = _m === void 0 ? false : _m, _o = _j.maxWait, maxWait = _o === void 0 ? 10000 : _o;
140
151
  if (!(listener === null || listener === void 0 ? void 0 : listener.debounce)) return [3 /*break*/, 1];
141
152
  debounced_1 = debounce__default["default"](function () { return tslib.__awaiter(_this, void 0, void 0, function () {
142
153
  return tslib.__generator(this, function (_a) {
@@ -165,9 +176,9 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
165
176
  return [3 /*break*/, 3];
166
177
  case 1: return [4 /*yield*/, Action.runActions(listener.actions, listener.renderer, rendererEvent)];
167
178
  case 2:
168
- _o.sent();
179
+ _p.sent();
169
180
  checkExecuted();
170
- _o.label = 3;
181
+ _p.label = 3;
171
182
  case 3:
172
183
  // 停止后续监听器执行
173
184
  if (rendererEvent.stoped) {
@@ -177,21 +188,35 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
177
188
  }
178
189
  });
179
190
  };
180
- _i = 0, listeners_1 = listeners;
181
- _g.label = 1;
191
+ _h.label = 1;
182
192
  case 1:
183
- if (!(_i < listeners_1.length)) return [3 /*break*/, 4];
184
- listener = listeners_1[_i];
185
- return [5 /*yield**/, _loop_2(listener)];
193
+ _h.trys.push([1, 6, 7, 8]);
194
+ listeners_1 = tslib.__values(listeners), listeners_1_1 = listeners_1.next();
195
+ _h.label = 2;
186
196
  case 2:
187
- state_1 = _g.sent();
188
- if (state_1 === "break")
189
- return [3 /*break*/, 4];
190
- _g.label = 3;
197
+ if (!!listeners_1_1.done) return [3 /*break*/, 5];
198
+ listener = listeners_1_1.value;
199
+ return [5 /*yield**/, _loop_2(listener)];
191
200
  case 3:
192
- _i++;
193
- return [3 /*break*/, 1];
194
- case 4: return [2 /*return*/, Promise.resolve(rendererEvent)];
201
+ state_1 = _h.sent();
202
+ if (state_1 === "break")
203
+ return [3 /*break*/, 5];
204
+ _h.label = 4;
205
+ case 4:
206
+ listeners_1_1 = listeners_1.next();
207
+ return [3 /*break*/, 2];
208
+ case 5: return [3 /*break*/, 8];
209
+ case 6:
210
+ e_2_1 = _h.sent();
211
+ e_2 = { error: e_2_1 };
212
+ return [3 /*break*/, 8];
213
+ case 7:
214
+ try {
215
+ if (listeners_1_1 && !listeners_1_1.done && (_g = listeners_1.return)) _g.call(listeners_1);
216
+ }
217
+ finally { if (e_2) throw e_2.error; }
218
+ return [7 /*endfinally*/];
219
+ case 8: return [2 /*return*/, Promise.resolve(rendererEvent)];
195
220
  }
196
221
  });
197
222
  });
@@ -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
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
+ var tslib = require('tslib');
10
11
  var cloneDeep = require('lodash/cloneDeep');
11
12
  var helper = require('./helper.js');
12
13
  var object = require('./object.js');
@@ -15,9 +16,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
15
16
 
16
17
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
17
18
 
18
- /**
19
- * 对文本进行替换
20
- */
21
19
  function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
22
20
  // 进行文本替换
23
21
  if (replaceText && object.isObject(replaceText)) {
@@ -26,15 +24,25 @@ function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
26
24
  replaceKeys_1.sort(function (a, b) { return b.length - a.length; }); // 避免用户将短的放前面
27
25
  var IgnoreKeys_1 = new Set(replaceTextIgnoreKeys || []);
28
26
  helper.JSONTraverse(replicaSchema, function (value, key, object) {
27
+ var e_1, _a;
29
28
  var descriptor = Object.getOwnPropertyDescriptor(object, key);
30
29
  if (typeof value === 'string' &&
31
30
  !IgnoreKeys_1.has(key) &&
32
31
  (descriptor === null || descriptor === void 0 ? void 0 : descriptor.writable)) {
33
- for (var _i = 0, replaceKeys_2 = replaceKeys_1; _i < replaceKeys_2.length; _i++) {
34
- var replaceKey = replaceKeys_2[_i];
35
- if (~value.indexOf(replaceKey)) {
36
- value = object[key] = value.replaceAll(replaceKey, replaceText[replaceKey]);
32
+ try {
33
+ for (var replaceKeys_2 = tslib.__values(replaceKeys_1), replaceKeys_2_1 = replaceKeys_2.next(); !replaceKeys_2_1.done; replaceKeys_2_1 = replaceKeys_2.next()) {
34
+ var replaceKey = replaceKeys_2_1.value;
35
+ if (~value.indexOf(replaceKey)) {
36
+ value = object[key] = value.replaceAll(replaceKey, replaceText[replaceKey]);
37
+ }
38
+ }
39
+ }
40
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
41
+ finally {
42
+ try {
43
+ if (replaceKeys_2_1 && !replaceKeys_2_1.done && (_a = replaceKeys_2.return)) _a.call(replaceKeys_2);
37
44
  }
45
+ finally { if (e_1) throw e_1.error; }
38
46
  }
39
47
  }
40
48
  });
@@ -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
 
@@ -7,6 +7,8 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
+ var tslib = require('tslib');
11
+
10
12
  /**
11
13
  * @file resize-sensor.js.
12
14
  * @author fex
@@ -24,7 +26,7 @@ var EventQueue = /** @class */ (function () {
24
26
  args[_i] = arguments[_i];
25
27
  }
26
28
  this.q.forEach(function (fn) {
27
- fn.apply(void 0, args);
29
+ fn.apply(void 0, tslib.__spreadArray([], tslib.__read(args), false));
28
30
  });
29
31
  };
30
32
  return EventQueue;
@@ -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
 
@@ -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
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
+ var tslib = require('tslib');
10
11
  var helper = require('./helper.js');
11
12
 
12
13
  var valueMap = {
@@ -54,7 +55,8 @@ function addStyle(style, id) {
54
55
  varStyleTag.innerHTML += style;
55
56
  }
56
57
  function formatStyle(css, classNames, id) {
57
- var _a;
58
+ var e_1, _a;
59
+ var _b;
58
60
  if (!css) {
59
61
  return { value: '', origin: [] };
60
62
  }
@@ -66,8 +68,9 @@ function formatStyle(css, classNames, id) {
66
68
  disabled: '.is-disabled'
67
69
  };
68
70
  var _loop_1 = function (item) {
71
+ var e_2, _c;
69
72
  var body = css[item.key];
70
- var list = (_a = item.value) === null || _a === void 0 ? void 0 : _a.split(' ');
73
+ var list = (_b = item.value) === null || _b === void 0 ? void 0 : _b.split(' ');
71
74
  var classNameList = [];
72
75
  if (!body) {
73
76
  return "continue";
@@ -79,94 +82,112 @@ function formatStyle(css, classNames, id) {
79
82
  }
80
83
  });
81
84
  var weightsList = item.weights || {};
82
- for (var _b = 0, classNameList_1 = classNameList; _b < classNameList_1.length; _b++) {
83
- var className = classNameList_1[_b];
84
- // 没有具体的样式,或者没有对应的classname
85
- var statusMap = {
86
- default: {},
87
- hover: {},
88
- active: {},
89
- disabled: {}
90
- };
91
- for (var key in body) {
92
- if (key === '$$id') {
93
- continue;
94
- }
95
- if (!!~key.indexOf(':default')) {
96
- statusMap.default[key.replace(':default', '')] = body[key];
97
- }
98
- else if (!!~key.indexOf(':hover')) {
99
- statusMap.hover[key.replace(':hover', '')] = body[key];
100
- }
101
- else if (!!~key.indexOf(':active')) {
102
- statusMap.active[key.replace(':active', '')] = body[key];
103
- }
104
- else if (!!~key.indexOf(':disabled')) {
105
- statusMap.disabled[key.replace(':disabled', '')] = body[key];
106
- }
107
- else {
108
- statusMap.default[key] = body[key];
109
- }
110
- }
111
- var _loop_2 = function (status_1) {
112
- var weights = weightsList[status_1];
113
- var styles = [];
114
- var fn = function (key, value) {
115
- key = valueMap[key] || key;
116
- styles.push("".concat(key, ": ").concat(value, ";"));
85
+ try {
86
+ for (var classNameList_1 = (e_2 = void 0, tslib.__values(classNameList)), classNameList_1_1 = classNameList_1.next(); !classNameList_1_1.done; classNameList_1_1 = classNameList_1.next()) {
87
+ var className = classNameList_1_1.value;
88
+ // 没有具体的样式,或者没有对应的classname
89
+ var statusMap = {
90
+ default: {},
91
+ hover: {},
92
+ active: {},
93
+ disabled: {}
117
94
  };
118
- for (var key in statusMap[status_1]) {
95
+ for (var key in body) {
119
96
  if (key === '$$id') {
120
97
  continue;
121
98
  }
122
- var style = statusMap[status_1][key];
123
- if (typeof style === 'object') {
124
- // 圆角特殊处理
125
- if (key === 'radius') {
126
- fn('border-radius', [
127
- style['top-left-border-radius'],
128
- style['top-right-border-radius'],
129
- style['bottom-right-border-radius'],
130
- style['bottom-left-border-radius']
131
- ].join(' '));
99
+ if (!!~key.indexOf(':default')) {
100
+ statusMap.default[key.replace(':default', '')] = body[key];
101
+ }
102
+ else if (!!~key.indexOf(':hover')) {
103
+ statusMap.hover[key.replace(':hover', '')] = body[key];
104
+ }
105
+ else if (!!~key.indexOf(':active')) {
106
+ statusMap.active[key.replace(':active', '')] = body[key];
107
+ }
108
+ else if (!!~key.indexOf(':disabled')) {
109
+ statusMap.disabled[key.replace(':disabled', '')] = body[key];
110
+ }
111
+ else {
112
+ statusMap.default[key] = body[key];
113
+ }
114
+ }
115
+ var _loop_2 = function (status_1) {
116
+ var weights = weightsList[status_1];
117
+ var styles = [];
118
+ var fn = function (key, value) {
119
+ key = valueMap[key] || key;
120
+ styles.push("".concat(key, ": ").concat(value, ";"));
121
+ };
122
+ for (var key in statusMap[status_1]) {
123
+ if (key === '$$id') {
124
+ continue;
132
125
  }
133
- else {
134
- for (var k in style) {
135
- if (k === '$$id') {
136
- continue;
126
+ var style = statusMap[status_1][key];
127
+ if (typeof style === 'object') {
128
+ // 圆角特殊处理
129
+ if (key === 'radius') {
130
+ fn('border-radius', [
131
+ style['top-left-border-radius'],
132
+ style['top-right-border-radius'],
133
+ style['bottom-right-border-radius'],
134
+ style['bottom-left-border-radius']
135
+ ].join(' '));
136
+ }
137
+ else {
138
+ for (var k in style) {
139
+ if (k === '$$id') {
140
+ continue;
141
+ }
142
+ var value = style[k];
143
+ value && fn(k, value);
137
144
  }
138
- var value = style[k];
139
- value && fn(k, value);
140
145
  }
141
146
  }
147
+ else {
148
+ var value = style;
149
+ value && fn(key, value);
150
+ }
142
151
  }
143
- else {
144
- var value = style;
145
- value && fn(key, value);
146
- }
147
- }
148
- if (styles.length > 0) {
149
- var cx = ((weights === null || weights === void 0 ? void 0 : weights.pre) || '') + className + ((weights === null || weights === void 0 ? void 0 : weights.suf) || '');
150
- res.push({
151
- className: cx + status2string[status_1],
152
- content: ".".concat(cx + status2string[status_1], " {\n ").concat(styles.join('\n '), "\n}")
153
- });
154
- if (['hover', 'active', 'disabled'].includes(status_1)) {
152
+ if (styles.length > 0) {
153
+ var cx = ((weights === null || weights === void 0 ? void 0 : weights.pre) || '') + className + ((weights === null || weights === void 0 ? void 0 : weights.suf) || '');
155
154
  res.push({
156
- className: cx + '.' + status_1,
157
- content: ".".concat(cx, ".").concat(status_1, " {\n ").concat(styles.join('\n '), "\n}")
155
+ className: cx + status2string[status_1],
156
+ content: ".".concat(cx + status2string[status_1], " {\n ").concat(styles.join('\n '), "\n}")
158
157
  });
158
+ if (['hover', 'active', 'disabled'].includes(status_1)) {
159
+ res.push({
160
+ className: cx + '.' + status_1,
161
+ content: ".".concat(cx, ".").concat(status_1, " {\n ").concat(styles.join('\n '), "\n}")
162
+ });
163
+ }
159
164
  }
165
+ };
166
+ for (var status_1 in statusMap) {
167
+ _loop_2(status_1);
160
168
  }
161
- };
162
- for (var status_1 in statusMap) {
163
- _loop_2(status_1);
164
169
  }
165
170
  }
171
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
172
+ finally {
173
+ try {
174
+ if (classNameList_1_1 && !classNameList_1_1.done && (_c = classNameList_1.return)) _c.call(classNameList_1);
175
+ }
176
+ finally { if (e_2) throw e_2.error; }
177
+ }
166
178
  };
167
- for (var _i = 0, classNames_1 = classNames; _i < classNames_1.length; _i++) {
168
- var item = classNames_1[_i];
169
- _loop_1(item);
179
+ try {
180
+ for (var classNames_1 = tslib.__values(classNames), classNames_1_1 = classNames_1.next(); !classNames_1_1.done; classNames_1_1 = classNames_1.next()) {
181
+ var item = classNames_1_1.value;
182
+ _loop_1(item);
183
+ }
184
+ }
185
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
186
+ finally {
187
+ try {
188
+ if (classNames_1_1 && !classNames_1_1.done && (_a = classNames_1.return)) _a.call(classNames_1);
189
+ }
190
+ finally { if (e_1) throw e_1.error; }
170
191
  }
171
192
  return {
172
193
  value: res.map(function (n) { return n.content; }).join('\n'),
@@ -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