amis-core 3.6.4 → 6.1.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 (316) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +3 -2
  3. package/esm/SchemaRenderer.js +4 -1
  4. package/esm/Scoped.d.ts +6 -0
  5. package/esm/Scoped.js +45 -7
  6. package/esm/StatusScoped.js +1 -1
  7. package/esm/WithRootStore.js +1 -1
  8. package/esm/WithStore.js +3 -5
  9. package/esm/actions/Action.js +31 -27
  10. package/esm/actions/AjaxAction.js +1 -1
  11. package/esm/actions/BreakAction.js +1 -1
  12. package/esm/actions/BroadcastAction.js +1 -1
  13. package/esm/actions/CmptAction.js +65 -26
  14. package/esm/actions/ContinueAction.js +1 -1
  15. package/esm/actions/CopyAction.js +1 -1
  16. package/esm/actions/CustomAction.js +4 -3
  17. package/esm/actions/DialogAction.js +1 -1
  18. package/esm/actions/DrawerAction.js +1 -1
  19. package/esm/actions/EmailAction.js +1 -1
  20. package/esm/actions/LinkAction.js +9 -4
  21. package/esm/actions/LoopAction.js +1 -1
  22. package/esm/actions/PageAction.js +1 -1
  23. package/esm/actions/ParallelAction.js +1 -1
  24. package/esm/actions/StatusAction.js +1 -1
  25. package/esm/actions/SwitchAction.js +1 -1
  26. package/esm/actions/ToastAction.js +1 -1
  27. package/esm/components/CustomStyle.d.ts +1 -2
  28. package/esm/components/CustomStyle.js +19 -6
  29. package/esm/components/ErrorBoundary.js +1 -1
  30. package/esm/components/LazyComponent.js +1 -1
  31. package/esm/components/Overlay.js +12 -9
  32. package/esm/components/PopOver.js +8 -5
  33. package/esm/env.d.ts +4 -0
  34. package/esm/env.js +1 -1
  35. package/esm/envOverwrite.js +1 -1
  36. package/esm/factory.js +14 -1
  37. package/esm/index.d.ts +2 -2
  38. package/esm/index.js +14 -7
  39. package/esm/locale.js +1 -1
  40. package/esm/polyfills.js +1 -1
  41. package/esm/renderers/Form.d.ts +4 -3
  42. package/esm/renderers/Form.js +216 -150
  43. package/esm/renderers/Item.d.ts +1 -0
  44. package/esm/renderers/Item.js +17 -17
  45. package/esm/renderers/Options.d.ts +5 -0
  46. package/esm/renderers/Options.js +188 -57
  47. package/esm/renderers/Placeholder.js +1 -1
  48. package/esm/renderers/builtin.js +1 -1
  49. package/esm/renderers/register.js +1 -1
  50. package/esm/renderers/wrapControl.js +39 -30
  51. package/esm/store/app.d.ts +2 -2
  52. package/esm/store/app.js +4 -3
  53. package/esm/store/combo.d.ts +79 -55
  54. package/esm/store/combo.js +1 -1
  55. package/esm/store/crud.d.ts +3 -2
  56. package/esm/store/crud.js +18 -4
  57. package/esm/store/form.d.ts +33 -23
  58. package/esm/store/form.js +5 -5
  59. package/esm/store/formItem.d.ts +2 -1
  60. package/esm/store/formItem.js +3 -2
  61. package/esm/store/iRenderer.d.ts +1 -1
  62. package/esm/store/iRenderer.js +10 -3
  63. package/esm/store/index.js +1 -1
  64. package/esm/store/list.d.ts +1 -1
  65. package/esm/store/list.js +18 -13
  66. package/esm/store/manager.js +1 -1
  67. package/esm/store/modal.d.ts +2 -2
  68. package/esm/store/modal.js +1 -1
  69. package/esm/store/node.js +1 -1
  70. package/esm/store/pagination.d.ts +2 -1
  71. package/esm/store/pagination.js +3 -2
  72. package/esm/store/root.d.ts +2 -2
  73. package/esm/store/root.js +4 -3
  74. package/esm/store/service.d.ts +2 -2
  75. package/esm/store/service.js +11 -7
  76. package/esm/store/status.js +1 -1
  77. package/esm/store/table.d.ts +69 -47
  78. package/esm/store/table.js +54 -25
  79. package/esm/store/table2.d.ts +14 -3
  80. package/esm/store/table2.js +22 -9
  81. package/esm/theme.js +1 -1
  82. package/esm/types.d.ts +7 -0
  83. package/esm/utils/Animation.js +1 -1
  84. package/esm/utils/ColorScale.js +1 -1
  85. package/esm/utils/DataSchema.js +1 -1
  86. package/esm/utils/DataScope.js +1 -1
  87. package/esm/utils/RootClose.js +1 -1
  88. package/esm/utils/SimpleMap.js +1 -1
  89. package/esm/utils/api.js +1 -1
  90. package/esm/utils/arraySlice.js +1 -1
  91. package/esm/utils/attachmentAdpator.js +1 -1
  92. package/esm/utils/autobind.js +1 -1
  93. package/esm/utils/browser.d.ts +1 -0
  94. package/esm/utils/browser.js +11 -0
  95. package/esm/utils/columnsSplit.js +1 -1
  96. package/esm/utils/concatData.d.ts +8 -0
  97. package/esm/utils/concatData.js +39 -0
  98. package/esm/utils/dataMapping.js +1 -1
  99. package/esm/utils/date.js +1 -1
  100. package/esm/utils/debug.js +1 -1
  101. package/esm/utils/decodeEntity.js +1 -1
  102. package/esm/utils/dom.js +1 -1
  103. package/esm/utils/errors.js +1 -1
  104. package/esm/utils/escapeHtml.js +1 -1
  105. package/esm/utils/filter-schema.js +1 -1
  106. package/esm/utils/filter.js +1 -1
  107. package/esm/utils/formatDuration.js +1 -1
  108. package/esm/utils/formula.js +1 -1
  109. package/esm/utils/getVariable.js +1 -1
  110. package/esm/utils/grammar.js +1 -1
  111. package/esm/utils/handleAction.js +1 -1
  112. package/esm/utils/helper.d.ts +14 -2
  113. package/esm/utils/helper.js +49 -14
  114. package/esm/utils/highlight.js +3 -2
  115. package/esm/utils/icon.js +1 -1
  116. package/esm/utils/image.js +1 -1
  117. package/esm/utils/index.d.ts +3 -0
  118. package/esm/utils/isPureVariable.js +1 -1
  119. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  120. package/esm/utils/keyToPath.js +1 -1
  121. package/esm/utils/labelToString.d.ts +1 -0
  122. package/esm/utils/labelToString.js +38 -0
  123. package/esm/utils/makeSorter.js +1 -1
  124. package/esm/utils/math.js +1 -1
  125. package/esm/utils/memoryParse.js +1 -1
  126. package/esm/utils/normalizeLink.js +1 -1
  127. package/esm/utils/normalizeOptions.js +1 -1
  128. package/esm/utils/object.js +1 -1
  129. package/esm/utils/offset.js +1 -1
  130. package/esm/utils/offsetParent.js +1 -1
  131. package/esm/utils/optionValueCompare.js +1 -1
  132. package/esm/utils/position.js +1 -1
  133. package/esm/utils/prettyBytes.js +1 -1
  134. package/esm/utils/renderer-event.js +19 -3
  135. package/esm/utils/replaceText.js +9 -11
  136. package/esm/utils/resize-sensor.js +1 -1
  137. package/esm/utils/resolveCondition.js +1 -1
  138. package/esm/utils/resolveVariable.js +1 -1
  139. package/esm/utils/resolveVariableAndFilter.js +1 -1
  140. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  141. package/esm/utils/scrollPosition.js +1 -1
  142. package/esm/utils/string2regExp.d.ts +1 -1
  143. package/esm/utils/string2regExp.js +4 -3
  144. package/esm/utils/stripNumber.js +1 -1
  145. package/esm/utils/style-helper.d.ts +24 -5
  146. package/esm/utils/style-helper.js +49 -21
  147. package/esm/utils/style.js +1 -1
  148. package/esm/utils/toNumber.js +1 -1
  149. package/esm/utils/tokenize.d.ts +1 -0
  150. package/esm/utils/tokenize.js +10 -3
  151. package/esm/utils/tpl-builtin.js +1 -1
  152. package/esm/utils/tpl-lodash.js +1 -1
  153. package/esm/utils/tpl.js +6 -8
  154. package/esm/utils/uncontrollable.js +1 -1
  155. package/esm/utils/validateId.d.ts +16 -0
  156. package/esm/utils/validateId.js +154 -0
  157. package/esm/utils/validations.js +16 -8
  158. package/lib/Root.js +1 -1
  159. package/lib/RootRenderer.js +3 -2
  160. package/lib/SchemaRenderer.js +4 -1
  161. package/lib/Scoped.d.ts +6 -0
  162. package/lib/Scoped.js +45 -6
  163. package/lib/StatusScoped.js +1 -1
  164. package/lib/WithRootStore.js +1 -1
  165. package/lib/WithStore.js +3 -5
  166. package/lib/actions/Action.js +31 -27
  167. package/lib/actions/AjaxAction.js +1 -1
  168. package/lib/actions/BreakAction.js +1 -1
  169. package/lib/actions/BroadcastAction.js +1 -1
  170. package/lib/actions/CmptAction.js +65 -26
  171. package/lib/actions/ContinueAction.js +1 -1
  172. package/lib/actions/CopyAction.js +1 -1
  173. package/lib/actions/CustomAction.js +4 -3
  174. package/lib/actions/DialogAction.js +1 -1
  175. package/lib/actions/DrawerAction.js +1 -1
  176. package/lib/actions/EmailAction.js +1 -1
  177. package/lib/actions/LinkAction.js +9 -4
  178. package/lib/actions/LoopAction.js +1 -1
  179. package/lib/actions/PageAction.js +1 -1
  180. package/lib/actions/ParallelAction.js +1 -1
  181. package/lib/actions/StatusAction.js +1 -1
  182. package/lib/actions/SwitchAction.js +1 -1
  183. package/lib/actions/ToastAction.js +1 -1
  184. package/lib/components/CustomStyle.d.ts +1 -2
  185. package/lib/components/CustomStyle.js +19 -6
  186. package/lib/components/ErrorBoundary.js +1 -1
  187. package/lib/components/LazyComponent.js +1 -1
  188. package/lib/components/Overlay.js +11 -8
  189. package/lib/components/PopOver.js +8 -5
  190. package/lib/env.d.ts +4 -0
  191. package/lib/env.js +1 -1
  192. package/lib/envOverwrite.js +1 -1
  193. package/lib/factory.js +14 -1
  194. package/lib/index.d.ts +2 -2
  195. package/lib/index.js +19 -4
  196. package/lib/locale.js +1 -1
  197. package/lib/polyfills.js +1 -1
  198. package/lib/renderers/Form.d.ts +4 -3
  199. package/lib/renderers/Form.js +216 -150
  200. package/lib/renderers/Item.d.ts +1 -0
  201. package/lib/renderers/Item.js +17 -17
  202. package/lib/renderers/Options.d.ts +5 -0
  203. package/lib/renderers/Options.js +188 -57
  204. package/lib/renderers/Placeholder.js +1 -1
  205. package/lib/renderers/builtin.js +1 -1
  206. package/lib/renderers/register.js +1 -1
  207. package/lib/renderers/wrapControl.js +38 -29
  208. package/lib/store/app.d.ts +2 -2
  209. package/lib/store/app.js +4 -3
  210. package/lib/store/combo.d.ts +55 -31
  211. package/lib/store/combo.js +1 -1
  212. package/lib/store/crud.d.ts +3 -2
  213. package/lib/store/crud.js +18 -4
  214. package/lib/store/form.d.ts +23 -13
  215. package/lib/store/form.js +5 -5
  216. package/lib/store/formItem.d.ts +2 -1
  217. package/lib/store/formItem.js +3 -2
  218. package/lib/store/iRenderer.d.ts +1 -1
  219. package/lib/store/iRenderer.js +10 -3
  220. package/lib/store/index.js +1 -1
  221. package/lib/store/list.d.ts +1 -1
  222. package/lib/store/list.js +18 -14
  223. package/lib/store/manager.js +1 -1
  224. package/lib/store/modal.d.ts +2 -2
  225. package/lib/store/modal.js +1 -1
  226. package/lib/store/node.js +1 -1
  227. package/lib/store/pagination.d.ts +2 -1
  228. package/lib/store/pagination.js +3 -2
  229. package/lib/store/root.d.ts +2 -2
  230. package/lib/store/root.js +4 -3
  231. package/lib/store/service.d.ts +2 -2
  232. package/lib/store/service.js +11 -7
  233. package/lib/store/status.js +1 -1
  234. package/lib/store/table.d.ts +49 -27
  235. package/lib/store/table.js +54 -26
  236. package/lib/store/table2.d.ts +14 -3
  237. package/lib/store/table2.js +22 -9
  238. package/lib/theme.js +1 -1
  239. package/lib/types.d.ts +7 -0
  240. package/lib/utils/Animation.js +1 -1
  241. package/lib/utils/ColorScale.js +1 -1
  242. package/lib/utils/DataSchema.js +1 -1
  243. package/lib/utils/DataScope.js +1 -1
  244. package/lib/utils/RootClose.js +1 -1
  245. package/lib/utils/SimpleMap.js +1 -1
  246. package/lib/utils/api.js +1 -1
  247. package/lib/utils/arraySlice.js +1 -1
  248. package/lib/utils/attachmentAdpator.js +1 -1
  249. package/lib/utils/autobind.js +1 -1
  250. package/lib/utils/browser.d.ts +1 -0
  251. package/lib/utils/browser.js +15 -0
  252. package/lib/utils/columnsSplit.js +1 -1
  253. package/lib/utils/concatData.d.ts +8 -0
  254. package/lib/utils/concatData.js +43 -0
  255. package/lib/utils/dataMapping.js +1 -1
  256. package/lib/utils/date.js +1 -1
  257. package/lib/utils/debug.js +1 -1
  258. package/lib/utils/decodeEntity.js +1 -1
  259. package/lib/utils/dom.js +1 -1
  260. package/lib/utils/errors.js +1 -1
  261. package/lib/utils/escapeHtml.js +1 -1
  262. package/lib/utils/filter-schema.js +1 -1
  263. package/lib/utils/filter.js +1 -1
  264. package/lib/utils/formatDuration.js +1 -1
  265. package/lib/utils/formula.js +1 -1
  266. package/lib/utils/getVariable.js +1 -1
  267. package/lib/utils/grammar.js +1 -1
  268. package/lib/utils/handleAction.js +1 -1
  269. package/lib/utils/helper.d.ts +14 -2
  270. package/lib/utils/helper.js +50 -12
  271. package/lib/utils/highlight.js +3 -2
  272. package/lib/utils/icon.js +1 -1
  273. package/lib/utils/image.js +1 -1
  274. package/lib/utils/index.d.ts +3 -0
  275. package/lib/utils/isPureVariable.js +1 -1
  276. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  277. package/lib/utils/keyToPath.js +1 -1
  278. package/lib/utils/labelToString.d.ts +1 -0
  279. package/lib/utils/labelToString.js +46 -0
  280. package/lib/utils/makeSorter.js +1 -1
  281. package/lib/utils/math.js +1 -1
  282. package/lib/utils/memoryParse.js +1 -1
  283. package/lib/utils/normalizeLink.js +1 -1
  284. package/lib/utils/normalizeOptions.js +1 -1
  285. package/lib/utils/object.js +1 -1
  286. package/lib/utils/offset.js +1 -1
  287. package/lib/utils/offsetParent.js +1 -1
  288. package/lib/utils/optionValueCompare.js +1 -1
  289. package/lib/utils/position.js +1 -1
  290. package/lib/utils/prettyBytes.js +1 -1
  291. package/lib/utils/renderer-event.js +19 -3
  292. package/lib/utils/replaceText.js +8 -14
  293. package/lib/utils/resize-sensor.js +1 -1
  294. package/lib/utils/resolveCondition.js +1 -1
  295. package/lib/utils/resolveVariable.js +1 -1
  296. package/lib/utils/resolveVariableAndFilter.js +1 -1
  297. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  298. package/lib/utils/scrollPosition.js +1 -1
  299. package/lib/utils/string2regExp.d.ts +1 -1
  300. package/lib/utils/string2regExp.js +4 -3
  301. package/lib/utils/stripNumber.js +1 -1
  302. package/lib/utils/style-helper.d.ts +24 -5
  303. package/lib/utils/style-helper.js +49 -21
  304. package/lib/utils/style.js +1 -1
  305. package/lib/utils/toNumber.js +1 -1
  306. package/lib/utils/tokenize.d.ts +1 -0
  307. package/lib/utils/tokenize.js +10 -2
  308. package/lib/utils/tpl-builtin.js +1 -1
  309. package/lib/utils/tpl-lodash.js +1 -1
  310. package/lib/utils/tpl.js +5 -7
  311. package/lib/utils/uncontrollable.js +1 -1
  312. package/lib/utils/validateId.d.ts +16 -0
  313. package/lib/utils/validateId.js +160 -0
  314. package/lib/utils/validations.js +16 -8
  315. package/package.json +4 -3
  316. package/LICENSE +0 -201
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -0,0 +1 @@
1
+ export declare function labelToString(label: any): string;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ var tslib = require('tslib');
11
+ var isPlainObject = require('lodash/isPlainObject');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject);
16
+
17
+ function labelToString(label) {
18
+ var e_1, _a;
19
+ var type = typeof label;
20
+ if (type === 'string') {
21
+ return label;
22
+ }
23
+ else if (type === 'number') {
24
+ return "".concat(label);
25
+ }
26
+ if (isPlainObject__default["default"](label)) {
27
+ try {
28
+ for (var _b = tslib.__values(['__title', 'label', Object.keys(label)[0]]), _c = _b.next(); !_c.done; _c = _b.next()) {
29
+ var key = _c.value;
30
+ if (typeof label[key] === 'string') {
31
+ return label[key];
32
+ }
33
+ }
34
+ }
35
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
36
+ finally {
37
+ try {
38
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
39
+ }
40
+ finally { if (e_1) throw e_1.error; }
41
+ }
42
+ }
43
+ return 'invalid label';
44
+ }
45
+
46
+ exports.labelToString = labelToString;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/lib/utils/math.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -19,7 +19,7 @@ var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
19
19
  var rendererEventListeners = [];
20
20
  // 创建渲染器事件对象
21
21
  function createRendererEvent(type, context) {
22
- var rendererEvent = {
22
+ var rendererEvent = Object.defineProperties({
23
23
  context: object.extendObject({ pristineData: context.data }, context),
24
24
  type: type,
25
25
  prevented: false,
@@ -39,7 +39,23 @@ function createRendererEvent(type, context) {
39
39
  setData: function (data) {
40
40
  rendererEvent.context.data = data;
41
41
  }
42
- };
42
+ }, {
43
+ context: {
44
+ enumerable: false
45
+ },
46
+ pristineData: {
47
+ enumerable: false
48
+ },
49
+ preventDefault: {
50
+ enumerable: false
51
+ },
52
+ stopPropagation: {
53
+ enumerable: false
54
+ },
55
+ setData: {
56
+ enumerable: false
57
+ }
58
+ });
43
59
  return rendererEvent;
44
60
  }
45
61
  // 绑定事件
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -8,19 +8,16 @@
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  var tslib = require('tslib');
11
- var cloneDeep = require('lodash/cloneDeep');
12
11
  var helper = require('./helper.js');
13
12
  var object = require('./object.js');
14
13
 
15
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
-
17
- var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
18
-
19
14
  function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
20
15
  // 进行文本替换
21
16
  if (replaceText && object.isObject(replaceText)) {
22
- var replicaSchema = cloneDeep__default["default"](schema);
23
17
  var replaceKeys_1 = Object.keys(replaceText);
18
+ if (!replaceKeys_1.length) {
19
+ return schema;
20
+ }
24
21
  replaceKeys_1.sort(function (a, b) { return b.length - a.length; }); // 避免用户将短的放前面
25
22
  var IgnoreKeys_1 = new Set(Array.isArray(replaceTextIgnoreKeys) ? replaceTextIgnoreKeys : []);
26
23
  var ignore_1 = typeof replaceTextIgnoreKeys === 'function'
@@ -28,17 +25,14 @@ function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
28
25
  : function (key) {
29
26
  return IgnoreKeys_1.has(key);
30
27
  };
31
- helper.JSONTraverse(replicaSchema, function (value, key, object) {
28
+ return helper.JSONValueMap(schema, function (value, key, object) {
32
29
  var e_1, _a;
33
- var descriptor = Object.getOwnPropertyDescriptor(object, key);
34
- if (typeof value === 'string' &&
35
- (descriptor === null || descriptor === void 0 ? void 0 : descriptor.writable) &&
36
- !ignore_1(key, value, object)) {
30
+ if (typeof value === 'string' && !ignore_1(key, value, object)) {
37
31
  try {
38
32
  for (var replaceKeys_2 = tslib.__values(replaceKeys_1), replaceKeys_2_1 = replaceKeys_2.next(); !replaceKeys_2_1.done; replaceKeys_2_1 = replaceKeys_2.next()) {
39
33
  var replaceKey = replaceKeys_2_1.value;
40
34
  if (~value.indexOf(replaceKey)) {
41
- value = object[key] = value.replaceAll(replaceKey, replaceText[replaceKey]);
35
+ return value.replaceAll(replaceKey, replaceText[replaceKey]);
42
36
  }
43
37
  }
44
38
  }
@@ -50,8 +44,8 @@ function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
50
44
  finally { if (e_1) throw e_1.error; }
51
45
  }
52
46
  }
47
+ return value;
53
48
  });
54
- return replicaSchema;
55
49
  }
56
50
  return schema;
57
51
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1 +1 @@
1
- export declare function string2regExp(value: string, caseSensitive?: boolean): RegExp;
1
+ export declare function string2regExp(value: string, caseSensitive?: boolean, globalSearch?: boolean): RegExp;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -7,12 +7,13 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
- function string2regExp(value, caseSensitive) {
10
+ function string2regExp(value, caseSensitive, globalSearch) {
11
11
  if (caseSensitive === void 0) { caseSensitive = false; }
12
+ if (globalSearch === void 0) { globalSearch = false; }
12
13
  if (typeof value !== 'string') {
13
14
  throw new TypeError('Expected a string');
14
15
  }
15
- return new RegExp(value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'), !caseSensitive ? 'i' : '');
16
+ return new RegExp(value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'), "".concat(!caseSensitive ? 'i' : '').concat(globalSearch ? 'g' : ''));
16
17
  }
17
18
 
18
19
  exports.string2regExp = string2regExp;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -10,7 +10,7 @@ interface extra {
10
10
  export declare function findOrCreateStyle(id: string, doc?: Document): HTMLElement;
11
11
  export declare function insertStyle(style: string, id: string, doc?: Document): void;
12
12
  export declare function addStyle(style: string, id: string): void;
13
- export declare function formatStyle(themeCss: any, classNames?: CustomStyleClassName[], id?: string, defaultData?: any): {
13
+ export declare function formatStyle(themeCss: any, classNames?: CustomStyleClassName[], id?: string, defaultData?: any, data?: any): {
14
14
  value: string;
15
15
  origin: {
16
16
  className: string;
@@ -26,7 +26,15 @@ export interface CustomStyleClassName {
26
26
  disabled?: extra;
27
27
  };
28
28
  }
29
- export declare function insertCustomStyle(themeCss: any, classNames: CustomStyleClassName[], id: string, defaultData?: any, customStyleClassPrefix?: string, doc?: Document): void;
29
+ export declare function insertCustomStyle(prams: {
30
+ themeCss: any;
31
+ classNames: CustomStyleClassName[];
32
+ id: string;
33
+ defaultData?: any;
34
+ customStyleClassPrefix?: string;
35
+ doc?: Document;
36
+ [propName: string]: any;
37
+ }): void;
30
38
  /**
31
39
  * 根据路径获取默认值
32
40
  */
@@ -34,7 +42,12 @@ export declare function getValueByPath(path: string, data: any): any;
34
42
  /**
35
43
  * 设置源码编辑自定义样式
36
44
  */
37
- export declare function insertEditCustomStyle(customStyle: any, id?: string, doc?: Document): void;
45
+ export declare function insertEditCustomStyle(params: {
46
+ customStyle: any;
47
+ id?: string;
48
+ doc?: Document;
49
+ [propName: string]: any;
50
+ }): void;
38
51
  export interface InsertCustomStyle {
39
52
  themeCss: any;
40
53
  classNames: CustomStyleClassName[];
@@ -46,7 +59,13 @@ export interface InsertCustomStyle {
46
59
  /**
47
60
  * 移除自定义样式
48
61
  */
49
- export declare function removeCustomStyle(type: string, id: string, doc?: Document): void;
62
+ export declare function removeCustomStyle(type: string, id: string, doc?: Document, data?: any): void;
50
63
  export declare function formatInputThemeCss(themeCss: any): any;
51
- export declare function setThemeClassName(name: string, id?: string, themeCss?: any, extra?: string): string;
64
+ export declare function setThemeClassName(params: {
65
+ name: string;
66
+ id?: string;
67
+ themeCss: any;
68
+ extra?: string;
69
+ [propName: string]: any;
70
+ }): string;
52
71
  export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -14,6 +14,7 @@ var isObject = require('lodash/isObject');
14
14
  var map = require('lodash/map');
15
15
  var isEmpty = require('lodash/isEmpty');
16
16
  var kebabCase = require('lodash/kebabCase');
17
+ var resolveVariableAndFilter = require('./resolveVariableAndFilter.js');
17
18
 
18
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
20
 
@@ -112,7 +113,7 @@ function handleInheritData(statusMap, data) {
112
113
  });
113
114
  });
114
115
  }
115
- function formatStyle(themeCss, classNames, id, defaultData) {
116
+ function formatStyle(themeCss, classNames, id, defaultData, data) {
116
117
  var e_1, _a;
117
118
  // 没有具体的样式,或者没有对应的classname
118
119
  if (!themeCss || !classNames) {
@@ -132,6 +133,9 @@ function formatStyle(themeCss, classNames, id, defaultData) {
132
133
  }
133
134
  var className = item.key + '-' + (id === null || id === void 0 ? void 0 : id.replace('u:', ''));
134
135
  var weightsList = item.weights || {};
136
+ if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
137
+ className += "-".concat(data.index);
138
+ }
135
139
  var statusMap = {
136
140
  default: {},
137
141
  hover: {},
@@ -163,7 +167,8 @@ function formatStyle(themeCss, classNames, id, defaultData) {
163
167
  var styles = [];
164
168
  var fn = function (key, value) {
165
169
  key = valueMap[key] || key;
166
- styles.push("".concat(kebabCase__default["default"](key), ": ").concat(value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''), ";"));
170
+ value = resolveVariableAndFilter.resolveVariableAndFilter(value, data, '| raw') || value;
171
+ styles.push("".concat(key.startsWith('--') ? key : kebabCase__default["default"](key), ": ").concat(value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''), ";"));
167
172
  };
168
173
  Object.keys(statusMap[status]).forEach(function (key) {
169
174
  if (key !== '$$id') {
@@ -175,16 +180,14 @@ function formatStyle(themeCss, classNames, id, defaultData) {
175
180
  style_1['top-left-border-radius'] || 0,
176
181
  style_1['top-right-border-radius'] || 0,
177
182
  style_1['bottom-right-border-radius'] || 0,
178
- style_1['bottom-left-border-radius'] || 0,
179
- (weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''
183
+ style_1['bottom-left-border-radius'] || 0
180
184
  ].join(' '));
181
185
  }
182
186
  else {
183
187
  Object.keys(style_1).forEach(function (k) {
184
188
  if (k !== '$$id') {
185
189
  var value = style_1[k];
186
- value &&
187
- fn(k, value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
190
+ value && fn(k, value);
188
191
  }
189
192
  });
190
193
  }
@@ -237,13 +240,18 @@ function formatStyle(themeCss, classNames, id, defaultData) {
237
240
  origin: res
238
241
  };
239
242
  }
240
- function insertCustomStyle(themeCss, classNames, id, defaultData, customStyleClassPrefix, doc) {
243
+ function insertCustomStyle(prams) {
244
+ var themeCss = prams.themeCss, classNames = prams.classNames, id = prams.id, defaultData = prams.defaultData, customStyleClassPrefix = prams.customStyleClassPrefix, doc = prams.doc, data = prams.data;
241
245
  if (!themeCss) {
242
246
  return;
243
247
  }
244
- var value = formatStyle(themeCss, classNames, id, defaultData).value;
248
+ var value = formatStyle(themeCss, classNames, id, defaultData, data).value;
245
249
  value = customStyleClassPrefix ? "".concat(customStyleClassPrefix, " ").concat(value) : value;
246
- insertStyle(value, id.replace('u:', ''), doc);
250
+ var classId = id.replace('u:', '');
251
+ if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
252
+ classId += "-".concat(data.index);
253
+ }
254
+ insertStyle(value, classId, doc);
247
255
  }
248
256
  /**
249
257
  * 根据路径获取默认值
@@ -286,38 +294,53 @@ function traverseStyle(style, path, result) {
286
294
  /**
287
295
  * 设置源码编辑自定义样式
288
296
  */
289
- function insertEditCustomStyle(customStyle, id, doc) {
297
+ function insertEditCustomStyle(params) {
298
+ var customStyle = params.customStyle, id = params.id, doc = params.doc, data = params.data;
290
299
  var styles = {};
291
300
  traverseStyle(customStyle, '', styles);
292
301
  var content = '';
302
+ var index = '';
303
+ if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
304
+ index = "-".concat(data.index);
305
+ }
293
306
  if (!isEmpty__default["default"](styles)) {
294
- var className_1 = "wrapperCustomStyle-".concat(id === null || id === void 0 ? void 0 : id.replace('u:', ''));
307
+ var className_1 = "wrapperCustomStyle-".concat(id === null || id === void 0 ? void 0 : id.replace('u:', '')).concat(index);
295
308
  Object.keys(styles).forEach(function (key) {
296
309
  if (!isObject__default["default"](styles[key])) {
297
- content += "\n.".concat(className_1, " {\n ").concat(key, ": ").concat(styles[key], "\n}");
310
+ content += "\n.".concat(className_1, " {\n ").concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(styles[key].replace(/['|"]/g, ''), data, '| raw') || styles[key], "\n}");
298
311
  }
299
312
  else if (key === 'root') {
300
- var res = map__default["default"](styles[key], function (value, key) { return "".concat(key, ": ").concat(value, ";"); });
313
+ var res = map__default["default"](styles[key], function (value, key) {
314
+ return "".concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(value.replace(/['|"]/g, ''), data, '| raw') || value, ";");
315
+ });
301
316
  content += "\n.".concat(className_1, " {\n ").concat(res.join('\n '), "\n}");
302
317
  }
303
318
  else if (/^root:/.test(key)) {
304
- var res = map__default["default"](styles[key], function (value, key) { return "".concat(key, ": ").concat(value, ";"); });
319
+ var res = map__default["default"](styles[key], function (value, key) {
320
+ return "".concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(value.replace(/['|"]/g, ''), data, '| raw') || value, ";");
321
+ });
305
322
  var nowKey = key.replace('root', '');
306
323
  content += "\n.".concat(className_1, " ").concat(nowKey, " {\n ").concat(res.join('\n '), "\n}");
307
324
  }
308
325
  else {
309
- var res = map__default["default"](styles[key], function (value, key) { return "".concat(key, ": ").concat(value, ";"); });
326
+ var res = map__default["default"](styles[key], function (value, key) {
327
+ return "".concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(value.replace(/['|"]/g, ''), data, '| raw') || value, ";");
328
+ });
310
329
  content += "\n.".concat(className_1, " ").concat(key, " {\n ").concat(res.join('\n '), "\n}");
311
330
  }
312
331
  });
313
332
  }
314
- insertStyle(content, 'wrapperCustomStyle-' + ((id === null || id === void 0 ? void 0 : id.replace('u:', '')) || helper.uuid()), doc);
333
+ insertStyle(content, 'wrapperCustomStyle-' + ((id === null || id === void 0 ? void 0 : id.replace('u:', '')) || helper.uuid()) + index, doc);
315
334
  }
316
335
  /**
317
336
  * 移除自定义样式
318
337
  */
319
- function removeCustomStyle(type, id, doc) {
320
- var style = (doc || document).getElementById('amis-' + (type ? type + '-' : '') + id.replace('u:', ''));
338
+ function removeCustomStyle(type, id, doc, data) {
339
+ var styleId = 'amis-' + (type ? type + '-' : '') + id.replace('u:', '');
340
+ if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
341
+ styleId += "-".concat(data.index);
342
+ }
343
+ var style = (doc || document).getElementById(styleId);
321
344
  if (style) {
322
345
  style.remove();
323
346
  }
@@ -336,14 +359,19 @@ function formatInputThemeCss(themeCss) {
336
359
  });
337
360
  return inputFontThemeCss;
338
361
  }
339
- function setThemeClassName(name, id, themeCss, extra) {
362
+ function setThemeClassName(params) {
363
+ var name = params.name, id = params.id, themeCss = params.themeCss, extra = params.extra, data = params.data;
340
364
  if (!id || !themeCss) {
341
365
  return '';
342
366
  }
343
367
  if (name !== 'wrapperCustomStyle' && !themeCss[name]) {
344
368
  return '';
345
369
  }
346
- return "".concat(name, "-").concat(id.replace('u:', '')) + (extra ? "-".concat(extra) : '');
370
+ var index = '';
371
+ if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
372
+ index = "-".concat(data.index);
373
+ }
374
+ return "".concat(name, "-").concat(id.replace('u:', '')) + (extra ? "-".concat(extra) : '') + index;
347
375
  }
348
376
 
349
377
  exports.addStyle = addStyle;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1 +1,2 @@
1
+ export declare function memoParse(str: string, options?: any): any;
1
2
  export declare const tokenize: (str: string, data: object, defaultFilter?: string) => string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -9,13 +9,20 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  var amisFormula = require('amis-formula');
11
11
 
12
+ var AST_CACHE = {};
13
+ function memoParse(str, options) {
14
+ var key = "".concat(str).concat((options === null || options === void 0 ? void 0 : options.evalMode) ? '-eval' : '').concat((options === null || options === void 0 ? void 0 : options.allowFilter) ? '-filter' : '').concat((options === null || options === void 0 ? void 0 : options.variableMode) ? '-variable' : '');
15
+ var ast = AST_CACHE[key] || amisFormula.parse(str, options);
16
+ AST_CACHE[key] = ast;
17
+ return ast;
18
+ }
12
19
  var tokenize = function (str, data, defaultFilter) {
13
20
  if (defaultFilter === void 0) { defaultFilter = '| html'; }
14
21
  if (!str || typeof str !== 'string') {
15
22
  return str;
16
23
  }
17
24
  try {
18
- var ast = amisFormula.parse(str, {
25
+ var ast = memoParse(str, {
19
26
  evalMode: false,
20
27
  allowFilter: true
21
28
  });
@@ -30,4 +37,5 @@ var tokenize = function (str, data, defaultFilter) {
30
37
  }
31
38
  };
32
39
 
40
+ exports.memoParse = memoParse;
33
41
  exports.tokenize = tokenize;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.4
2
+ * amis-core v6.1.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5