amis-core 6.0.0 → 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 (293) hide show
  1. package/esm/Root.js +2 -2
  2. package/esm/RootRenderer.js +4 -3
  3. package/esm/SchemaRenderer.js +5 -2
  4. package/esm/Scoped.d.ts +6 -0
  5. package/esm/Scoped.js +45 -8
  6. package/esm/StatusScoped.js +2 -2
  7. package/esm/WithRootStore.js +2 -2
  8. package/esm/WithStore.js +4 -6
  9. package/esm/actions/Action.js +2 -2
  10. package/esm/actions/AjaxAction.js +2 -2
  11. package/esm/actions/BreakAction.js +2 -2
  12. package/esm/actions/BroadcastAction.js +2 -2
  13. package/esm/actions/CmptAction.js +2 -2
  14. package/esm/actions/ContinueAction.js +2 -2
  15. package/esm/actions/CopyAction.js +2 -2
  16. package/esm/actions/CustomAction.js +3 -3
  17. package/esm/actions/DialogAction.js +2 -2
  18. package/esm/actions/DrawerAction.js +2 -2
  19. package/esm/actions/EmailAction.js +2 -2
  20. package/esm/actions/LinkAction.js +10 -5
  21. package/esm/actions/LoopAction.js +2 -2
  22. package/esm/actions/PageAction.js +2 -2
  23. package/esm/actions/ParallelAction.js +2 -2
  24. package/esm/actions/StatusAction.js +2 -2
  25. package/esm/actions/SwitchAction.js +2 -2
  26. package/esm/actions/ToastAction.js +2 -2
  27. package/esm/components/CustomStyle.d.ts +1 -2
  28. package/esm/components/CustomStyle.js +20 -7
  29. package/esm/components/ErrorBoundary.js +2 -2
  30. package/esm/components/LazyComponent.js +2 -2
  31. package/esm/components/Overlay.js +11 -9
  32. package/esm/components/PopOver.js +7 -5
  33. package/esm/env.d.ts +4 -0
  34. package/esm/env.js +2 -2
  35. package/esm/envOverwrite.js +2 -2
  36. package/esm/factory.js +15 -2
  37. package/esm/index.d.ts +2 -2
  38. package/esm/index.js +13 -8
  39. package/esm/locale.js +2 -2
  40. package/esm/polyfills.js +2 -2
  41. package/esm/renderers/Form.d.ts +4 -3
  42. package/esm/renderers/Form.js +94 -42
  43. package/esm/renderers/Item.d.ts +1 -0
  44. package/esm/renderers/Item.js +15 -16
  45. package/esm/renderers/Options.d.ts +5 -0
  46. package/esm/renderers/Options.js +27 -10
  47. package/esm/renderers/Placeholder.js +2 -2
  48. package/esm/renderers/builtin.js +2 -2
  49. package/esm/renderers/register.js +2 -2
  50. package/esm/renderers/wrapControl.js +37 -29
  51. package/esm/store/app.js +3 -3
  52. package/esm/store/combo.d.ts +48 -24
  53. package/esm/store/combo.js +2 -2
  54. package/esm/store/crud.js +2 -2
  55. package/esm/store/form.d.ts +20 -10
  56. package/esm/store/form.js +2 -2
  57. package/esm/store/formItem.d.ts +2 -1
  58. package/esm/store/formItem.js +4 -3
  59. package/esm/store/iRenderer.js +5 -3
  60. package/esm/store/index.js +2 -2
  61. package/esm/store/list.js +2 -2
  62. package/esm/store/manager.js +2 -2
  63. package/esm/store/modal.js +2 -2
  64. package/esm/store/node.js +2 -2
  65. package/esm/store/pagination.js +2 -2
  66. package/esm/store/root.js +3 -3
  67. package/esm/store/service.js +2 -2
  68. package/esm/store/status.js +2 -2
  69. package/esm/store/table.d.ts +42 -20
  70. package/esm/store/table.js +33 -19
  71. package/esm/store/table2.js +2 -2
  72. package/esm/theme.js +2 -2
  73. package/esm/utils/Animation.js +2 -2
  74. package/esm/utils/ColorScale.js +2 -2
  75. package/esm/utils/DataSchema.js +2 -2
  76. package/esm/utils/DataScope.js +2 -2
  77. package/esm/utils/RootClose.js +2 -2
  78. package/esm/utils/SimpleMap.js +2 -2
  79. package/esm/utils/api.js +2 -2
  80. package/esm/utils/arraySlice.js +2 -2
  81. package/esm/utils/attachmentAdpator.js +2 -2
  82. package/esm/utils/autobind.js +2 -2
  83. package/esm/utils/browser.js +2 -2
  84. package/esm/utils/columnsSplit.js +2 -2
  85. package/esm/utils/concatData.js +2 -2
  86. package/esm/utils/dataMapping.js +2 -2
  87. package/esm/utils/date.js +2 -2
  88. package/esm/utils/debug.js +2 -2
  89. package/esm/utils/decodeEntity.js +2 -2
  90. package/esm/utils/dom.js +2 -2
  91. package/esm/utils/errors.js +2 -2
  92. package/esm/utils/escapeHtml.js +2 -2
  93. package/esm/utils/filter-schema.js +2 -2
  94. package/esm/utils/filter.js +2 -2
  95. package/esm/utils/formatDuration.js +2 -2
  96. package/esm/utils/formula.js +2 -2
  97. package/esm/utils/getVariable.js +2 -2
  98. package/esm/utils/grammar.js +2 -2
  99. package/esm/utils/handleAction.js +2 -2
  100. package/esm/utils/helper.d.ts +8 -1
  101. package/esm/utils/helper.js +28 -10
  102. package/esm/utils/highlight.js +4 -3
  103. package/esm/utils/icon.js +2 -2
  104. package/esm/utils/image.js +2 -2
  105. package/esm/utils/index.d.ts +1 -0
  106. package/esm/utils/isPureVariable.js +2 -2
  107. package/esm/utils/json-schema-2-amis-schema.js +2 -2
  108. package/esm/utils/keyToPath.js +2 -2
  109. package/esm/utils/labelToString.d.ts +1 -0
  110. package/esm/utils/labelToString.js +38 -0
  111. package/esm/utils/makeSorter.js +2 -2
  112. package/esm/utils/math.js +2 -2
  113. package/esm/utils/memoryParse.js +2 -2
  114. package/esm/utils/normalizeLink.js +2 -2
  115. package/esm/utils/normalizeOptions.js +2 -2
  116. package/esm/utils/object.js +2 -2
  117. package/esm/utils/offset.js +2 -2
  118. package/esm/utils/offsetParent.js +2 -2
  119. package/esm/utils/optionValueCompare.js +2 -2
  120. package/esm/utils/position.js +2 -2
  121. package/esm/utils/prettyBytes.js +2 -2
  122. package/esm/utils/renderer-event.js +2 -2
  123. package/esm/utils/replaceText.js +10 -12
  124. package/esm/utils/resize-sensor.js +2 -2
  125. package/esm/utils/resolveCondition.js +2 -2
  126. package/esm/utils/resolveVariable.js +2 -2
  127. package/esm/utils/resolveVariableAndFilter.js +2 -2
  128. package/esm/utils/resolveVariableAndFilterForAsync.js +2 -2
  129. package/esm/utils/scrollPosition.js +2 -2
  130. package/esm/utils/string2regExp.d.ts +1 -1
  131. package/esm/utils/string2regExp.js +5 -4
  132. package/esm/utils/stripNumber.js +2 -2
  133. package/esm/utils/style-helper.d.ts +24 -5
  134. package/esm/utils/style-helper.js +47 -17
  135. package/esm/utils/style.js +2 -2
  136. package/esm/utils/toNumber.js +2 -2
  137. package/esm/utils/tokenize.d.ts +1 -0
  138. package/esm/utils/tokenize.js +11 -4
  139. package/esm/utils/tpl-builtin.js +2 -2
  140. package/esm/utils/tpl-lodash.js +2 -2
  141. package/esm/utils/tpl.js +7 -9
  142. package/esm/utils/uncontrollable.js +2 -2
  143. package/esm/utils/validateId.d.ts +16 -0
  144. package/esm/utils/validateId.js +154 -0
  145. package/esm/utils/validations.js +17 -9
  146. package/lib/Root.js +2 -2
  147. package/lib/RootRenderer.d.ts +1 -1
  148. package/lib/RootRenderer.js +4 -3
  149. package/lib/SchemaRenderer.js +5 -2
  150. package/lib/Scoped.d.ts +6 -0
  151. package/lib/Scoped.js +45 -7
  152. package/lib/StatusScoped.js +2 -2
  153. package/lib/WithRootStore.js +2 -2
  154. package/lib/WithStore.js +4 -6
  155. package/lib/actions/Action.js +2 -2
  156. package/lib/actions/AjaxAction.js +2 -2
  157. package/lib/actions/BreakAction.js +2 -2
  158. package/lib/actions/BroadcastAction.js +2 -2
  159. package/lib/actions/CmptAction.js +2 -2
  160. package/lib/actions/ContinueAction.js +2 -2
  161. package/lib/actions/CopyAction.js +2 -2
  162. package/lib/actions/CustomAction.js +3 -3
  163. package/lib/actions/DialogAction.js +2 -2
  164. package/lib/actions/DrawerAction.js +2 -2
  165. package/lib/actions/EmailAction.js +2 -2
  166. package/lib/actions/LinkAction.js +10 -5
  167. package/lib/actions/LoopAction.js +2 -2
  168. package/lib/actions/PageAction.js +2 -2
  169. package/lib/actions/ParallelAction.js +2 -2
  170. package/lib/actions/StatusAction.js +2 -2
  171. package/lib/actions/SwitchAction.js +2 -2
  172. package/lib/actions/ToastAction.js +2 -2
  173. package/lib/components/CustomStyle.d.ts +1 -2
  174. package/lib/components/CustomStyle.js +20 -7
  175. package/lib/components/ErrorBoundary.js +2 -2
  176. package/lib/components/LazyComponent.js +2 -2
  177. package/lib/components/Overlay.js +10 -8
  178. package/lib/components/PopOver.js +7 -5
  179. package/lib/env.d.ts +4 -0
  180. package/lib/env.js +2 -2
  181. package/lib/envOverwrite.js +2 -2
  182. package/lib/factory.js +15 -2
  183. package/lib/index.d.ts +2 -2
  184. package/lib/index.js +16 -5
  185. package/lib/locale.js +2 -2
  186. package/lib/polyfills.js +2 -2
  187. package/lib/renderers/Form.d.ts +4 -3
  188. package/lib/renderers/Form.js +94 -42
  189. package/lib/renderers/Item.d.ts +1 -0
  190. package/lib/renderers/Item.js +15 -16
  191. package/lib/renderers/Options.d.ts +5 -0
  192. package/lib/renderers/Options.js +27 -10
  193. package/lib/renderers/Placeholder.js +2 -2
  194. package/lib/renderers/builtin.js +2 -2
  195. package/lib/renderers/register.js +2 -2
  196. package/lib/renderers/wrapControl.js +36 -28
  197. package/lib/store/app.js +3 -3
  198. package/lib/store/combo.d.ts +72 -49
  199. package/lib/store/combo.js +2 -2
  200. package/lib/store/crud.js +2 -2
  201. package/lib/store/form.d.ts +30 -21
  202. package/lib/store/form.js +2 -2
  203. package/lib/store/formItem.d.ts +2 -1
  204. package/lib/store/formItem.js +4 -3
  205. package/lib/store/iRenderer.js +5 -3
  206. package/lib/store/index.js +2 -2
  207. package/lib/store/list.js +2 -2
  208. package/lib/store/manager.js +2 -2
  209. package/lib/store/modal.js +2 -2
  210. package/lib/store/node.js +2 -2
  211. package/lib/store/pagination.js +2 -2
  212. package/lib/store/root.js +3 -3
  213. package/lib/store/service.js +2 -2
  214. package/lib/store/status.js +2 -2
  215. package/lib/store/table.d.ts +62 -41
  216. package/lib/store/table.js +33 -19
  217. package/lib/store/table2.js +2 -2
  218. package/lib/theme.js +2 -2
  219. package/lib/utils/Animation.js +2 -2
  220. package/lib/utils/ColorScale.js +2 -2
  221. package/lib/utils/DataSchema.js +2 -2
  222. package/lib/utils/DataScope.js +2 -2
  223. package/lib/utils/RootClose.js +2 -2
  224. package/lib/utils/SimpleMap.js +2 -2
  225. package/lib/utils/api.js +2 -2
  226. package/lib/utils/arraySlice.js +2 -2
  227. package/lib/utils/attachmentAdpator.js +2 -2
  228. package/lib/utils/autobind.js +2 -2
  229. package/lib/utils/browser.js +2 -2
  230. package/lib/utils/columnsSplit.js +2 -2
  231. package/lib/utils/concatData.js +2 -2
  232. package/lib/utils/dataMapping.js +2 -2
  233. package/lib/utils/date.js +2 -2
  234. package/lib/utils/debug.js +2 -2
  235. package/lib/utils/decodeEntity.js +2 -2
  236. package/lib/utils/dom.js +2 -2
  237. package/lib/utils/errors.js +2 -2
  238. package/lib/utils/escapeHtml.js +2 -2
  239. package/lib/utils/filter-schema.js +2 -2
  240. package/lib/utils/filter.js +2 -2
  241. package/lib/utils/formatDuration.js +2 -2
  242. package/lib/utils/formula.js +2 -2
  243. package/lib/utils/getVariable.js +2 -2
  244. package/lib/utils/grammar.js +2 -2
  245. package/lib/utils/handleAction.js +2 -2
  246. package/lib/utils/helper.d.ts +8 -1
  247. package/lib/utils/helper.js +29 -8
  248. package/lib/utils/highlight.js +4 -3
  249. package/lib/utils/icon.js +2 -2
  250. package/lib/utils/image.js +2 -2
  251. package/lib/utils/index.d.ts +1 -0
  252. package/lib/utils/isPureVariable.js +2 -2
  253. package/lib/utils/json-schema-2-amis-schema.js +2 -2
  254. package/lib/utils/keyToPath.js +2 -2
  255. package/lib/utils/labelToString.d.ts +1 -0
  256. package/lib/utils/labelToString.js +46 -0
  257. package/lib/utils/makeSorter.js +2 -2
  258. package/lib/utils/math.js +2 -2
  259. package/lib/utils/memoryParse.js +2 -2
  260. package/lib/utils/normalizeLink.js +2 -2
  261. package/lib/utils/normalizeOptions.js +2 -2
  262. package/lib/utils/object.js +2 -2
  263. package/lib/utils/offset.js +2 -2
  264. package/lib/utils/offsetParent.js +2 -2
  265. package/lib/utils/optionValueCompare.js +2 -2
  266. package/lib/utils/position.js +2 -2
  267. package/lib/utils/prettyBytes.js +2 -2
  268. package/lib/utils/renderer-event.js +2 -2
  269. package/lib/utils/replaceText.js +9 -15
  270. package/lib/utils/resize-sensor.js +2 -2
  271. package/lib/utils/resolveCondition.js +2 -2
  272. package/lib/utils/resolveVariable.js +2 -2
  273. package/lib/utils/resolveVariableAndFilter.js +2 -2
  274. package/lib/utils/resolveVariableAndFilterForAsync.js +2 -2
  275. package/lib/utils/scrollPosition.js +2 -2
  276. package/lib/utils/string2regExp.d.ts +1 -1
  277. package/lib/utils/string2regExp.js +5 -4
  278. package/lib/utils/stripNumber.js +2 -2
  279. package/lib/utils/style-helper.d.ts +24 -5
  280. package/lib/utils/style-helper.js +47 -17
  281. package/lib/utils/style.js +2 -2
  282. package/lib/utils/toNumber.js +2 -2
  283. package/lib/utils/tokenize.d.ts +1 -0
  284. package/lib/utils/tokenize.js +11 -3
  285. package/lib/utils/tpl-builtin.js +2 -2
  286. package/lib/utils/tpl-lodash.js +2 -2
  287. package/lib/utils/tpl.js +6 -8
  288. package/lib/utils/uncontrollable.js +2 -2
  289. package/lib/utils/validateId.d.ts +16 -0
  290. package/lib/utils/validateId.js +160 -0
  291. package/lib/utils/validations.js +17 -9
  292. package/package.json +3 -3
  293. package/LICENSE +0 -201
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -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,18 +1,19 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
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,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -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,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -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,6 +167,7 @@ function formatStyle(themeCss, classNames, id, defaultData) {
163
167
  var styles = [];
164
168
  var fn = function (key, value) {
165
169
  key = valueMap[key] || key;
170
+ value = resolveVariableAndFilter.resolveVariableAndFilter(value, data, '| raw') || value;
166
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) {
@@ -235,13 +240,18 @@ function formatStyle(themeCss, classNames, id, defaultData) {
235
240
  origin: res
236
241
  };
237
242
  }
238
- 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;
239
245
  if (!themeCss) {
240
246
  return;
241
247
  }
242
- var value = formatStyle(themeCss, classNames, id, defaultData).value;
248
+ var value = formatStyle(themeCss, classNames, id, defaultData, data).value;
243
249
  value = customStyleClassPrefix ? "".concat(customStyleClassPrefix, " ").concat(value) : value;
244
- 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);
245
255
  }
246
256
  /**
247
257
  * 根据路径获取默认值
@@ -284,38 +294,53 @@ function traverseStyle(style, path, result) {
284
294
  /**
285
295
  * 设置源码编辑自定义样式
286
296
  */
287
- function insertEditCustomStyle(customStyle, id, doc) {
297
+ function insertEditCustomStyle(params) {
298
+ var customStyle = params.customStyle, id = params.id, doc = params.doc, data = params.data;
288
299
  var styles = {};
289
300
  traverseStyle(customStyle, '', styles);
290
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
+ }
291
306
  if (!isEmpty__default["default"](styles)) {
292
- 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);
293
308
  Object.keys(styles).forEach(function (key) {
294
309
  if (!isObject__default["default"](styles[key])) {
295
- 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}");
296
311
  }
297
312
  else if (key === 'root') {
298
- 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
+ });
299
316
  content += "\n.".concat(className_1, " {\n ").concat(res.join('\n '), "\n}");
300
317
  }
301
318
  else if (/^root:/.test(key)) {
302
- 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
+ });
303
322
  var nowKey = key.replace('root', '');
304
323
  content += "\n.".concat(className_1, " ").concat(nowKey, " {\n ").concat(res.join('\n '), "\n}");
305
324
  }
306
325
  else {
307
- 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
+ });
308
329
  content += "\n.".concat(className_1, " ").concat(key, " {\n ").concat(res.join('\n '), "\n}");
309
330
  }
310
331
  });
311
332
  }
312
- 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);
313
334
  }
314
335
  /**
315
336
  * 移除自定义样式
316
337
  */
317
- function removeCustomStyle(type, id, doc) {
318
- 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);
319
344
  if (style) {
320
345
  style.remove();
321
346
  }
@@ -334,14 +359,19 @@ function formatInputThemeCss(themeCss) {
334
359
  });
335
360
  return inputFontThemeCss;
336
361
  }
337
- 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;
338
364
  if (!id || !themeCss) {
339
365
  return '';
340
366
  }
341
367
  if (name !== 'wrapperCustomStyle' && !themeCss[name]) {
342
368
  return '';
343
369
  }
344
- 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;
345
375
  }
346
376
 
347
377
  exports.addStyle = addStyle;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -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,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -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,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
package/lib/utils/tpl.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -12,6 +12,7 @@ var tplBuiltin = require('./tpl-builtin.js');
12
12
  var tplLodash = require('./tpl-lodash.js');
13
13
  var amisFormula = require('amis-formula');
14
14
  var resolveCondition = require('./resolveCondition.js');
15
+ var tokenize = require('./tokenize.js');
15
16
 
16
17
  var enginers = {};
17
18
  function registerTplEnginer(name, enginer) {
@@ -124,13 +125,10 @@ function evalExpressionWithConditionBuilder(expression, data, defaultResult) {
124
125
  });
125
126
  });
126
127
  }
127
- var AST_CACHE = {};
128
128
  function evalFormula(expression, data) {
129
- var ast = AST_CACHE[expression] ||
130
- amisFormula.parse(expression, {
131
- evalMode: false
132
- });
133
- AST_CACHE[expression] = ast;
129
+ var ast = tokenize.memoParse(expression, {
130
+ evalMode: false
131
+ });
134
132
  return amisFormula.evaluate(ast, data, {
135
133
  defaultFilter: 'raw'
136
134
  });
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 身份证号码校验,(没有校验城市和区县)
3
+ *
4
+ * 身份证号码是由18位组成,分别表示:
5
+ * 第1、2位数字表示:所在省份的代码;
6
+ * 第3、4位数字表示:所在城市的代码;
7
+ * 第5、6位数字表示:所在区县的代码;
8
+ * 第7-14位数字表示:出生年、月、日(其中7、8、9、10位是年,11、12位是月,13、14位是日);
9
+ * 第15-17位数字表示:顺序编码,都是同一地址辖区内的,以及同年同月同日出生人的顺序码,同时 第17位兼具性别标识功能,男单女双;
10
+ * 第18位是校检码:可以是0-9的数字,有时也用X表示, X来代替10。
11
+ *
12
+ * 身份证15位时,次序为省(2位)市(2位)区县(2位)年(2位)月(2位)日(2位)顺序编码(3位),皆为数字,没有最后一位校验码
13
+ */
14
+ export declare function isId18(id: string): boolean;
15
+ export declare function isId15(id: string): boolean;
16
+ export declare function isId(id: string): boolean;
@@ -0,0 +1,160 @@
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
+
12
+ /**
13
+ * 身份证号码校验,(没有校验城市和区县)
14
+ *
15
+ * 身份证号码是由18位组成,分别表示:
16
+ * 第1、2位数字表示:所在省份的代码;
17
+ * 第3、4位数字表示:所在城市的代码;
18
+ * 第5、6位数字表示:所在区县的代码;
19
+ * 第7-14位数字表示:出生年、月、日(其中7、8、9、10位是年,11、12位是月,13、14位是日);
20
+ * 第15-17位数字表示:顺序编码,都是同一地址辖区内的,以及同年同月同日出生人的顺序码,同时 第17位兼具性别标识功能,男单女双;
21
+ * 第18位是校检码:可以是0-9的数字,有时也用X表示, X来代替10。
22
+ *
23
+ * 身份证15位时,次序为省(2位)市(2位)区县(2位)年(2位)月(2位)日(2位)顺序编码(3位),皆为数字,没有最后一位校验码
24
+ */
25
+ function isId18(id) {
26
+ if (!/^\d{17}(\d|X)$/.test(id)) {
27
+ return false;
28
+ }
29
+ var info = getInfoFromId(id);
30
+ if (!info) {
31
+ return false;
32
+ }
33
+ var province = info.province, city = info.city, country = info.country, birthday = info.birthday;
34
+ if (!verifyRegion(province, city, country) || !verifyBirthday(birthday)) {
35
+ return false;
36
+ }
37
+ return verifyCheckCode(id);
38
+ }
39
+ function isId15(id) {
40
+ if (!/^\d{15}$/.test(id)) {
41
+ return false;
42
+ }
43
+ var info = getInfoFromId(id);
44
+ if (!info) {
45
+ return false;
46
+ }
47
+ var province = info.province, city = info.city, country = info.country, birthday = info.birthday;
48
+ return verifyRegion(province, city, country) && verifyBirthday(birthday);
49
+ }
50
+ function isId(id) {
51
+ return isId18(id) || isId15(id);
52
+ }
53
+ function getProvInfo(prov) {
54
+ return {
55
+ 11: '北京市',
56
+ 12: '天津市',
57
+ 13: '河北省',
58
+ 14: '山西省',
59
+ 15: '内蒙古自治区',
60
+ 21: '辽宁省',
61
+ 22: '吉林省',
62
+ 23: '黑龙江省',
63
+ 31: '上海省',
64
+ 32: '江苏省',
65
+ 33: '浙江省',
66
+ 34: '安徽省',
67
+ 35: '福建省',
68
+ 36: '江西省',
69
+ 37: '山东省',
70
+ 41: '河南省',
71
+ 42: '湖北省',
72
+ 43: '湖南省',
73
+ 44: '广东省',
74
+ 45: '广西壮族自治区',
75
+ 46: '海南省',
76
+ 50: '重庆市',
77
+ 51: '四川省',
78
+ 52: '贵州省',
79
+ 53: '云南省',
80
+ 54: '西藏自治区',
81
+ 61: '陕西省',
82
+ 62: '甘肃省',
83
+ 63: '青海省',
84
+ 64: '宁夏回族自治区',
85
+ 65: '新疆维吾尔自治区',
86
+ 71: '台湾省',
87
+ 81: '香港',
88
+ 82: '澳门',
89
+ 91: '国外'
90
+ }[prov];
91
+ }
92
+ function getInfoFromId(id) {
93
+ if ((id.length === 18 && !/^\d{17}(\d|X)$/.test(id)) ||
94
+ (id.length === 15 && !/^\d{15}$/.test(id))) {
95
+ return;
96
+ }
97
+ var data;
98
+ if (id.length == 18) {
99
+ data = id.match(/^(\d{2})(\d{2})(\d{2})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
100
+ }
101
+ else if (id.length == 15) {
102
+ data = id.match(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{3})$/);
103
+ }
104
+ if (!data) {
105
+ return;
106
+ }
107
+ var _a = tslib.__read(data, 9); _a[0]; var province = _a[1], city = _a[2], country = _a[3], year = _a[4], month = _a[5], day = _a[6], sequenceCode = _a[7], checkCode = _a[8];
108
+ return {
109
+ province: province,
110
+ provinceName: getProvInfo(province),
111
+ city: city,
112
+ country: country,
113
+ year: year,
114
+ month: month,
115
+ day: day,
116
+ birthday: new Date(year + '/' + month + '/' + day),
117
+ sequenceCode: sequenceCode,
118
+ checkCode: checkCode,
119
+ isMale: +sequenceCode % 2 === 1,
120
+ isFemale: +sequenceCode % 2 === 0
121
+ };
122
+ }
123
+ function verifyRegion(province, city, country) {
124
+ if (!getProvInfo(province)) {
125
+ return false;
126
+ }
127
+ // 这里暂时不获取市和区的具体信息,因为调用CityDB会把校验函数传染为异步
128
+ // city位: 00表示省;01-20,51-70表示省直辖市;21-50表示地区(自治州、盟)
129
+ if (!/^(?:[0-6]\d|70)$/.test(city)) {
130
+ return false;
131
+ }
132
+ if (!/^\d\d$/.test(country)) {
133
+ return false;
134
+ }
135
+ return true;
136
+ }
137
+ function verifyBirthday(birthday) {
138
+ return !isNaN(+birthday);
139
+ }
140
+ /**
141
+ * 校验码计算方式
142
+ * 1、将前面的身份证号码17位数分别乘以不同的系数。从第一位到第十七位的系数分别为:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 ;
143
+ * 2、将这17位数字和系数相乘的结果相加;
144
+ * 3、用加出来和除以11,看余数是多少;
145
+ * 4、余数只可能有0 1 2 3 4 5 6 7 8 9 10这11个数字。其分别对应的最后一位身份证的号码为1 0 X 9 8 7 6 5 4 3 2;
146
+ * 5、通过上面得知如果余数是2,余数所对应的最后一位身份证号是X,就会在身份证的第18位数字上出现罗马数字的X。
147
+ */
148
+ function verifyCheckCode(id) {
149
+ var arrInt = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
150
+ var arrCh = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
151
+ var cardTemp = 0;
152
+ for (var i = 0; i < 17; i++) {
153
+ cardTemp += +id.slice(i, i + 1) * arrInt[i];
154
+ }
155
+ return arrCh[cardTemp % 11] === id.slice(17, 18);
156
+ }
157
+
158
+ exports.isId = isId;
159
+ exports.isId15 = isId15;
160
+ exports.isId18 = isId18;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -16,6 +16,7 @@ var isPureVariable = require('./isPureVariable.js');
16
16
  var resolveVariableAndFilter = require('./resolveVariableAndFilter.js');
17
17
  require('./filter.js');
18
18
  var memoize = require('lodash/memoize');
19
+ var validateId = require('./validateId.js');
19
20
 
20
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
22
 
@@ -226,9 +227,13 @@ var validations = {
226
227
  return !isExisty(value) || isEmpty(value) || /^\d{6}$/.test(value);
227
228
  },
228
229
  isId: function (values, value) {
229
- return (!isExisty(value) ||
230
- isEmpty(value) ||
231
- /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/.test(value));
230
+ return !isExisty(value) || isEmpty(value) || validateId.isId(String(value));
231
+ },
232
+ isId18: function (values, value) {
233
+ return !isExisty(value) || isEmpty(value) || validateId.isId18(String(value));
234
+ },
235
+ isId15: function (values, value) {
236
+ return !isExisty(value) || isEmpty(value) || validateId.isId15(String(value));
232
237
  },
233
238
  notEmptyString: function (values, value) {
234
239
  return !isExisty(value) || !(String(value) && String(value).trim() === '');
@@ -343,6 +348,8 @@ var validateMessages = {
343
348
  isTelNumber: 'validate.isTelNumber',
344
349
  isZipcode: 'validate.isZipcode',
345
350
  isId: 'validate.isId',
351
+ isId18: 'validate.isId',
352
+ isId15: 'validate.isId',
346
353
  isDateTimeSame: 'validate.isDateTimeSame',
347
354
  isDateTimeBefore: 'validate.isDateTimeBefore',
348
355
  isDateTimeAfter: 'validate.isDateTimeAfter',
@@ -384,8 +391,7 @@ function validate(value, values, rules, messages, __) {
384
391
  // {error: true, msg: '错误提示'}
385
392
  // 格式的信息来灵活展示错误
386
393
  var fnResErrorMsg = '';
387
- if (typeof validateRes === 'object' &&
388
- validateRes.error === true) {
394
+ if (typeof validateRes === 'object' && validateRes.error === true) {
389
395
  fnResErrorMsg = (_a = validateRes === null || validateRes === void 0 ? void 0 : validateRes.msg) !== null && _a !== void 0 ? _a : '';
390
396
  }
391
397
  if (!validateRes || fnResErrorMsg) {
@@ -393,13 +399,15 @@ function validate(value, values, rules, messages, __) {
393
399
  if (Array.isArray(value)) {
394
400
  msgRuleName = "".concat(ruleName, "Array");
395
401
  }
396
- return [{
402
+ return [
403
+ {
397
404
  rule: ruleName,
398
405
  msg: tpl.filter(__((messages && messages[ruleName]) ||
399
406
  fnResErrorMsg ||
400
407
  validateMessages[msgRuleName] ||
401
408
  validateMessages[ruleName]), tslib.__assign({}, [''].concat(args)))
402
- }];
409
+ }
410
+ ];
403
411
  }
404
412
  }
405
413
  }