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
package/lib/utils/tpl.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
 
@@ -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,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,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,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
 
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amis-core",
3
- "version": "3.6.4",
3
+ "version": "6.1.0",
4
4
  "description": "amis-core",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -25,6 +25,7 @@
25
25
  "moment-timezone": "^0.5.34",
26
26
  "react": "^18.2.0",
27
27
  "react-dom": "^18.2.0",
28
+ "resize-observer-polyfill": "^1.5.1",
28
29
  "rimraf": "^3.0.2",
29
30
  "rollup": "^2.79.1",
30
31
  "rollup-plugin-auto-external": "^2.0.0",
@@ -46,7 +47,7 @@
46
47
  "esm"
47
48
  ],
48
49
  "dependencies": {
49
- "amis-formula": "^3.6.4",
50
+ "amis-formula": "^6.1.0",
50
51
  "classnames": "2.3.2",
51
52
  "file-saver": "^2.0.2",
52
53
  "hoist-non-react-statics": "^3.3.2",
@@ -107,5 +108,5 @@
107
108
  "/.rollup.cache/"
108
109
  ]
109
110
  },
110
- "gitHead": "3bb6b70254792093b876683463a91b9622f6132a"
111
+ "gitHead": "37d23b4a8eb1c663bc38e8dd9040889ea1526ec4"
111
112
  }
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2023 Baidu
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.