amis-core 2.6.0 → 2.7.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 (451) hide show
  1. package/package.json +2 -2
  2. package/esm/Root.d.ts +0 -46
  3. package/esm/Root.js +0 -89
  4. package/esm/RootRenderer.d.ts +0 -27
  5. package/esm/RootRenderer.js +0 -279
  6. package/esm/SchemaRenderer.d.ts +0 -37
  7. package/esm/SchemaRenderer.js +0 -332
  8. package/esm/Scoped.d.ts +0 -38
  9. package/esm/Scoped.js +0 -262
  10. package/esm/WithRootStore.d.ts +0 -719
  11. package/esm/WithRootStore.js +0 -34
  12. package/esm/WithStore.d.ts +0 -5
  13. package/esm/WithStore.js +0 -181
  14. package/esm/actions/Action.d.ts +0 -40
  15. package/esm/actions/Action.js +0 -186
  16. package/esm/actions/AjaxAction.d.ts +0 -27
  17. package/esm/actions/AjaxAction.js +0 -96
  18. package/esm/actions/BreakAction.d.ts +0 -15
  19. package/esm/actions/BreakAction.js +0 -31
  20. package/esm/actions/BroadcastAction.d.ts +0 -19
  21. package/esm/actions/BroadcastAction.js +0 -46
  22. package/esm/actions/CmptAction.d.ts +0 -21
  23. package/esm/actions/CmptAction.js +0 -66
  24. package/esm/actions/ContinueAction.d.ts +0 -15
  25. package/esm/actions/ContinueAction.js +0 -31
  26. package/esm/actions/CopyAction.d.ts +0 -20
  27. package/esm/actions/CopyAction.js +0 -39
  28. package/esm/actions/CustomAction.d.ts +0 -22
  29. package/esm/actions/CustomAction.js +0 -74
  30. package/esm/actions/DialogAction.d.ts +0 -60
  31. package/esm/actions/DialogAction.js +0 -101
  32. package/esm/actions/DrawerAction.d.ts +0 -33
  33. package/esm/actions/DrawerAction.js +0 -65
  34. package/esm/actions/EmailAction.d.ts +0 -23
  35. package/esm/actions/EmailAction.js +0 -39
  36. package/esm/actions/LinkAction.d.ts +0 -24
  37. package/esm/actions/LinkAction.js +0 -43
  38. package/esm/actions/LoopAction.d.ts +0 -19
  39. package/esm/actions/LoopAction.js +0 -103
  40. package/esm/actions/PageAction.d.ts +0 -39
  41. package/esm/actions/PageAction.js +0 -74
  42. package/esm/actions/ParallelAction.d.ts +0 -8
  43. package/esm/actions/ParallelAction.js +0 -36
  44. package/esm/actions/SwitchAction.d.ts +0 -11
  45. package/esm/actions/SwitchAction.js +0 -48
  46. package/esm/actions/ToastAction.d.ts +0 -19
  47. package/esm/actions/ToastAction.js +0 -31
  48. package/esm/actions/index.d.ts +0 -20
  49. package/esm/components/LazyComponent.d.ts +0 -32
  50. package/esm/components/LazyComponent.js +0 -90
  51. package/esm/components/Overlay.d.ts +0 -44
  52. package/esm/components/Overlay.js +0 -255
  53. package/esm/components/PopOver.d.ts +0 -90
  54. package/esm/components/PopOver.js +0 -120
  55. package/esm/env.d.ts +0 -176
  56. package/esm/env.js +0 -12
  57. package/esm/envOverwrite.d.ts +0 -4
  58. package/esm/envOverwrite.js +0 -39
  59. package/esm/factory.d.ts +0 -85
  60. package/esm/factory.js +0 -301
  61. package/esm/index.d.ts +0 -44
  62. package/esm/index.js +0 -174
  63. package/esm/locale.d.ts +0 -84
  64. package/esm/locale.js +0 -117
  65. package/esm/renderers/Form.d.ts +0 -389
  66. package/esm/renderers/Form.js +0 -1221
  67. package/esm/renderers/Item.d.ts +0 -906
  68. package/esm/renderers/Item.js +0 -863
  69. package/esm/renderers/Options.d.ts +0 -158
  70. package/esm/renderers/Options.js +0 -908
  71. package/esm/renderers/Placeholder.d.ts +0 -6
  72. package/esm/renderers/Placeholder.js +0 -23
  73. package/esm/renderers/builtin.d.ts +0 -1
  74. package/esm/renderers/builtin.js +0 -25
  75. package/esm/renderers/register.d.ts +0 -6
  76. package/esm/renderers/register.js +0 -79
  77. package/esm/renderers/wrapControl.d.ts +0 -437
  78. package/esm/renderers/wrapControl.js +0 -509
  79. package/esm/store/app.d.ts +0 -92
  80. package/esm/store/app.js +0 -189
  81. package/esm/store/combo.d.ts +0 -10223
  82. package/esm/store/combo.js +0 -149
  83. package/esm/store/crud.d.ts +0 -128
  84. package/esm/store/crud.js +0 -447
  85. package/esm/store/form.d.ts +0 -4252
  86. package/esm/store/form.js +0 -650
  87. package/esm/store/formItem.d.ts +0 -133
  88. package/esm/store/formItem.js +0 -847
  89. package/esm/store/iRenderer.d.ts +0 -46
  90. package/esm/store/iRenderer.js +0 -185
  91. package/esm/store/index.d.ts +0 -125
  92. package/esm/store/index.js +0 -90
  93. package/esm/store/list.d.ts +0 -272
  94. package/esm/store/list.js +0 -246
  95. package/esm/store/manager.d.ts +0 -115
  96. package/esm/store/manager.js +0 -49
  97. package/esm/store/modal.d.ts +0 -84
  98. package/esm/store/modal.js +0 -50
  99. package/esm/store/node.d.ts +0 -22
  100. package/esm/store/node.js +0 -89
  101. package/esm/store/pagination.d.ts +0 -58
  102. package/esm/store/pagination.js +0 -56
  103. package/esm/store/root.d.ts +0 -85
  104. package/esm/store/root.js +0 -53
  105. package/esm/store/service.d.ts +0 -71
  106. package/esm/store/service.js +0 -411
  107. package/esm/store/table.d.ts +0 -10085
  108. package/esm/store/table.js +0 -1136
  109. package/esm/store/table2.d.ts +0 -474
  110. package/esm/store/table2.js +0 -560
  111. package/esm/theme.d.ts +0 -89
  112. package/esm/theme.js +0 -127
  113. package/esm/types.d.ts +0 -489
  114. package/esm/utils/Animation.d.ts +0 -22
  115. package/esm/utils/Animation.js +0 -285
  116. package/esm/utils/ColorScale.d.ts +0 -19
  117. package/esm/utils/ColorScale.js +0 -100
  118. package/esm/utils/DataSchema.d.ts +0 -25
  119. package/esm/utils/DataSchema.js +0 -112
  120. package/esm/utils/DataScope.d.ts +0 -26
  121. package/esm/utils/DataScope.js +0 -158
  122. package/esm/utils/RootClose.d.ts +0 -4
  123. package/esm/utils/RootClose.js +0 -22
  124. package/esm/utils/SimpleMap.d.ts +0 -8
  125. package/esm/utils/SimpleMap.js +0 -37
  126. package/esm/utils/api.d.ts +0 -34
  127. package/esm/utils/api.js +0 -595
  128. package/esm/utils/attachmentAdpator.d.ts +0 -8
  129. package/esm/utils/attachmentAdpator.js +0 -86
  130. package/esm/utils/autobind.d.ts +0 -7
  131. package/esm/utils/autobind.js +0 -89
  132. package/esm/utils/columnsSplit.d.ts +0 -1
  133. package/esm/utils/columnsSplit.js +0 -42
  134. package/esm/utils/dataMapping.d.ts +0 -9
  135. package/esm/utils/dataMapping.js +0 -141
  136. package/esm/utils/date.d.ts +0 -4
  137. package/esm/utils/date.js +0 -80
  138. package/esm/utils/debug.d.ts +0 -29
  139. package/esm/utils/debug.js +0 -379
  140. package/esm/utils/decodeEntity.d.ts +0 -5
  141. package/esm/utils/decodeEntity.js +0 -16
  142. package/esm/utils/dom.d.ts +0 -13
  143. package/esm/utils/dom.js +0 -188
  144. package/esm/utils/errors.d.ts +0 -6
  145. package/esm/utils/errors.js +0 -19
  146. package/esm/utils/escapeHtml.d.ts +0 -1
  147. package/esm/utils/escapeHtml.js +0 -20
  148. package/esm/utils/filter-schema.d.ts +0 -13
  149. package/esm/utils/filter-schema.js +0 -68
  150. package/esm/utils/filter.d.ts +0 -1
  151. package/esm/utils/filter.js +0 -493
  152. package/esm/utils/formatDuration.d.ts +0 -1
  153. package/esm/utils/formatDuration.js +0 -23
  154. package/esm/utils/formula.d.ts +0 -16
  155. package/esm/utils/formula.js +0 -219
  156. package/esm/utils/getVariable.d.ts +0 -3
  157. package/esm/utils/getVariable.js +0 -25
  158. package/esm/utils/grammar.d.ts +0 -4
  159. package/esm/utils/grammar.js +0 -50
  160. package/esm/utils/handleAction.d.ts +0 -7
  161. package/esm/utils/handleAction.js +0 -34
  162. package/esm/utils/helper.d.ts +0 -323
  163. package/esm/utils/helper.js +0 -1261
  164. package/esm/utils/highlight.d.ts +0 -1
  165. package/esm/utils/highlight.js +0 -44
  166. package/esm/utils/icon.d.ts +0 -16
  167. package/esm/utils/icon.js +0 -35
  168. package/esm/utils/image.d.ts +0 -18
  169. package/esm/utils/image.js +0 -47
  170. package/esm/utils/index.d.ts +0 -55
  171. package/esm/utils/isPureVariable.d.ts +0 -1
  172. package/esm/utils/isPureVariable.js +0 -22
  173. package/esm/utils/json-schema-2-amis-schema.d.ts +0 -6
  174. package/esm/utils/json-schema-2-amis-schema.js +0 -56
  175. package/esm/utils/keyToPath.d.ts +0 -6
  176. package/esm/utils/keyToPath.js +0 -30
  177. package/esm/utils/makeSorter.d.ts +0 -1
  178. package/esm/utils/makeSorter.js +0 -26
  179. package/esm/utils/normalizeLink.d.ts +0 -1
  180. package/esm/utils/normalizeLink.js +0 -43
  181. package/esm/utils/normalizeOptions.d.ts +0 -7
  182. package/esm/utils/normalizeOptions.js +0 -84
  183. package/esm/utils/object.d.ts +0 -15
  184. package/esm/utils/object.js +0 -142
  185. package/esm/utils/offset.d.ts +0 -15
  186. package/esm/utils/offset.js +0 -32
  187. package/esm/utils/offsetParent.d.ts +0 -5
  188. package/esm/utils/offsetParent.js +0 -23
  189. package/esm/utils/optionValueCompare.d.ts +0 -3
  190. package/esm/utils/optionValueCompare.js +0 -25
  191. package/esm/utils/position.d.ts +0 -26
  192. package/esm/utils/position.js +0 -54
  193. package/esm/utils/prettyBytes.d.ts +0 -1
  194. package/esm/utils/prettyBytes.js +0 -25
  195. package/esm/utils/renderer-event.d.ts +0 -62
  196. package/esm/utils/renderer-event.js +0 -206
  197. package/esm/utils/replaceText.d.ts +0 -3
  198. package/esm/utils/replaceText.js +0 -38
  199. package/esm/utils/resize-sensor.d.ts +0 -6
  200. package/esm/utils/resize-sensor.js +0 -172
  201. package/esm/utils/resolveVariable.d.ts +0 -1
  202. package/esm/utils/resolveVariable.js +0 -35
  203. package/esm/utils/resolveVariableAndFilter.d.ts +0 -1
  204. package/esm/utils/resolveVariableAndFilter.js +0 -33
  205. package/esm/utils/scrollPosition.d.ts +0 -16
  206. package/esm/utils/scrollPosition.js +0 -33
  207. package/esm/utils/string2regExp.d.ts +0 -1
  208. package/esm/utils/string2regExp.js +0 -14
  209. package/esm/utils/stripNumber.d.ts +0 -1
  210. package/esm/utils/stripNumber.js +0 -16
  211. package/esm/utils/style.d.ts +0 -10
  212. package/esm/utils/style.js +0 -58
  213. package/esm/utils/toNumber.d.ts +0 -7
  214. package/esm/utils/toNumber.js +0 -18
  215. package/esm/utils/tokenize.d.ts +0 -1
  216. package/esm/utils/tokenize.js +0 -29
  217. package/esm/utils/tpl-builtin.d.ts +0 -18
  218. package/esm/utils/tpl-builtin.js +0 -59
  219. package/esm/utils/tpl-lodash.d.ts +0 -4
  220. package/esm/utils/tpl-lodash.js +0 -62
  221. package/esm/utils/tpl.d.ts +0 -11
  222. package/esm/utils/tpl.js +0 -131
  223. package/esm/utils/uncontrollable.d.ts +0 -4
  224. package/esm/utils/uncontrollable.js +0 -14
  225. package/esm/utils/validations.d.ts +0 -39
  226. package/esm/utils/validations.js +0 -440
  227. package/lib/Root.d.ts +0 -46
  228. package/lib/Root.js +0 -102
  229. package/lib/RootRenderer.d.ts +0 -27
  230. package/lib/RootRenderer.js +0 -290
  231. package/lib/SchemaRenderer.d.ts +0 -37
  232. package/lib/SchemaRenderer.js +0 -342
  233. package/lib/Scoped.d.ts +0 -38
  234. package/lib/Scoped.js +0 -274
  235. package/lib/WithRootStore.d.ts +0 -719
  236. package/lib/WithRootStore.js +0 -44
  237. package/lib/WithStore.d.ts +0 -5
  238. package/lib/WithStore.js +0 -190
  239. package/lib/actions/Action.d.ts +0 -40
  240. package/lib/actions/Action.js +0 -197
  241. package/lib/actions/AjaxAction.d.ts +0 -27
  242. package/lib/actions/AjaxAction.js +0 -100
  243. package/lib/actions/BreakAction.d.ts +0 -15
  244. package/lib/actions/BreakAction.js +0 -35
  245. package/lib/actions/BroadcastAction.d.ts +0 -19
  246. package/lib/actions/BroadcastAction.js +0 -50
  247. package/lib/actions/CmptAction.d.ts +0 -21
  248. package/lib/actions/CmptAction.js +0 -70
  249. package/lib/actions/ContinueAction.d.ts +0 -15
  250. package/lib/actions/ContinueAction.js +0 -35
  251. package/lib/actions/CopyAction.d.ts +0 -20
  252. package/lib/actions/CopyAction.js +0 -43
  253. package/lib/actions/CustomAction.d.ts +0 -22
  254. package/lib/actions/CustomAction.js +0 -78
  255. package/lib/actions/DialogAction.d.ts +0 -60
  256. package/lib/actions/DialogAction.js +0 -108
  257. package/lib/actions/DrawerAction.d.ts +0 -33
  258. package/lib/actions/DrawerAction.js +0 -70
  259. package/lib/actions/EmailAction.d.ts +0 -23
  260. package/lib/actions/EmailAction.js +0 -48
  261. package/lib/actions/LinkAction.d.ts +0 -24
  262. package/lib/actions/LinkAction.js +0 -47
  263. package/lib/actions/LoopAction.d.ts +0 -19
  264. package/lib/actions/LoopAction.js +0 -107
  265. package/lib/actions/PageAction.d.ts +0 -39
  266. package/lib/actions/PageAction.js +0 -80
  267. package/lib/actions/ParallelAction.d.ts +0 -8
  268. package/lib/actions/ParallelAction.js +0 -40
  269. package/lib/actions/SwitchAction.d.ts +0 -11
  270. package/lib/actions/SwitchAction.js +0 -52
  271. package/lib/actions/ToastAction.d.ts +0 -19
  272. package/lib/actions/ToastAction.js +0 -35
  273. package/lib/actions/index.d.ts +0 -20
  274. package/lib/components/LazyComponent.d.ts +0 -32
  275. package/lib/components/LazyComponent.js +0 -99
  276. package/lib/components/Overlay.d.ts +0 -44
  277. package/lib/components/Overlay.js +0 -266
  278. package/lib/components/PopOver.d.ts +0 -90
  279. package/lib/components/PopOver.js +0 -129
  280. package/lib/env.d.ts +0 -176
  281. package/lib/env.js +0 -20
  282. package/lib/envOverwrite.d.ts +0 -4
  283. package/lib/envOverwrite.js +0 -43
  284. package/lib/factory.d.ts +0 -85
  285. package/lib/factory.js +0 -324
  286. package/lib/index.d.ts +0 -44
  287. package/lib/index.js +0 -460
  288. package/lib/locale.d.ts +0 -84
  289. package/lib/locale.js +0 -133
  290. package/lib/renderers/Form.d.ts +0 -389
  291. package/lib/renderers/Form.js +0 -1234
  292. package/lib/renderers/Item.d.ts +0 -906
  293. package/lib/renderers/Item.js +0 -879
  294. package/lib/renderers/Options.d.ts +0 -158
  295. package/lib/renderers/Options.js +0 -920
  296. package/lib/renderers/Placeholder.d.ts +0 -6
  297. package/lib/renderers/Placeholder.js +0 -31
  298. package/lib/renderers/builtin.d.ts +0 -1
  299. package/lib/renderers/builtin.js +0 -27
  300. package/lib/renderers/register.d.ts +0 -6
  301. package/lib/renderers/register.js +0 -83
  302. package/lib/renderers/wrapControl.d.ts +0 -437
  303. package/lib/renderers/wrapControl.js +0 -520
  304. package/lib/store/app.d.ts +0 -92
  305. package/lib/store/app.js +0 -193
  306. package/lib/store/combo.d.ts +0 -10223
  307. package/lib/store/combo.js +0 -154
  308. package/lib/store/crud.d.ts +0 -128
  309. package/lib/store/crud.js +0 -455
  310. package/lib/store/form.d.ts +0 -4252
  311. package/lib/store/form.js +0 -664
  312. package/lib/store/formItem.d.ts +0 -133
  313. package/lib/store/formItem.js +0 -858
  314. package/lib/store/iRenderer.d.ts +0 -46
  315. package/lib/store/iRenderer.js +0 -189
  316. package/lib/store/index.d.ts +0 -125
  317. package/lib/store/index.js +0 -101
  318. package/lib/store/list.d.ts +0 -272
  319. package/lib/store/list.js +0 -256
  320. package/lib/store/manager.d.ts +0 -115
  321. package/lib/store/manager.js +0 -56
  322. package/lib/store/modal.d.ts +0 -84
  323. package/lib/store/modal.js +0 -54
  324. package/lib/store/node.d.ts +0 -22
  325. package/lib/store/node.js +0 -93
  326. package/lib/store/pagination.d.ts +0 -58
  327. package/lib/store/pagination.js +0 -60
  328. package/lib/store/root.d.ts +0 -85
  329. package/lib/store/root.js +0 -57
  330. package/lib/store/service.d.ts +0 -71
  331. package/lib/store/service.js +0 -415
  332. package/lib/store/table.d.ts +0 -10085
  333. package/lib/store/table.js +0 -1148
  334. package/lib/store/table2.d.ts +0 -474
  335. package/lib/store/table2.js +0 -571
  336. package/lib/theme.d.ts +0 -89
  337. package/lib/theme.js +0 -145
  338. package/lib/types.d.ts +0 -489
  339. package/lib/utils/Animation.d.ts +0 -22
  340. package/lib/utils/Animation.js +0 -290
  341. package/lib/utils/ColorScale.d.ts +0 -19
  342. package/lib/utils/ColorScale.js +0 -105
  343. package/lib/utils/DataSchema.d.ts +0 -25
  344. package/lib/utils/DataSchema.js +0 -116
  345. package/lib/utils/DataScope.d.ts +0 -26
  346. package/lib/utils/DataScope.js +0 -162
  347. package/lib/utils/RootClose.d.ts +0 -4
  348. package/lib/utils/RootClose.js +0 -30
  349. package/lib/utils/SimpleMap.d.ts +0 -8
  350. package/lib/utils/SimpleMap.js +0 -46
  351. package/lib/utils/api.d.ts +0 -34
  352. package/lib/utils/api.js +0 -621
  353. package/lib/utils/attachmentAdpator.d.ts +0 -8
  354. package/lib/utils/attachmentAdpator.js +0 -91
  355. package/lib/utils/autobind.d.ts +0 -7
  356. package/lib/utils/autobind.js +0 -94
  357. package/lib/utils/columnsSplit.d.ts +0 -1
  358. package/lib/utils/columnsSplit.js +0 -51
  359. package/lib/utils/dataMapping.d.ts +0 -9
  360. package/lib/utils/dataMapping.js +0 -151
  361. package/lib/utils/date.d.ts +0 -4
  362. package/lib/utils/date.js +0 -90
  363. package/lib/utils/debug.d.ts +0 -29
  364. package/lib/utils/debug.js +0 -392
  365. package/lib/utils/decodeEntity.d.ts +0 -5
  366. package/lib/utils/decodeEntity.js +0 -20
  367. package/lib/utils/dom.d.ts +0 -13
  368. package/lib/utils/dom.js +0 -199
  369. package/lib/utils/errors.d.ts +0 -6
  370. package/lib/utils/errors.js +0 -23
  371. package/lib/utils/escapeHtml.d.ts +0 -1
  372. package/lib/utils/escapeHtml.js +0 -24
  373. package/lib/utils/filter-schema.d.ts +0 -13
  374. package/lib/utils/filter-schema.js +0 -78
  375. package/lib/utils/filter.d.ts +0 -1
  376. package/lib/utils/filter.js +0 -503
  377. package/lib/utils/formatDuration.d.ts +0 -1
  378. package/lib/utils/formatDuration.js +0 -27
  379. package/lib/utils/formula.d.ts +0 -16
  380. package/lib/utils/formula.js +0 -234
  381. package/lib/utils/getVariable.d.ts +0 -3
  382. package/lib/utils/getVariable.js +0 -29
  383. package/lib/utils/grammar.d.ts +0 -4
  384. package/lib/utils/grammar.js +0 -54
  385. package/lib/utils/handleAction.d.ts +0 -7
  386. package/lib/utils/handleAction.js +0 -39
  387. package/lib/utils/helper.d.ts +0 -323
  388. package/lib/utils/helper.js +0 -1361
  389. package/lib/utils/highlight.d.ts +0 -1
  390. package/lib/utils/highlight.js +0 -52
  391. package/lib/utils/icon.d.ts +0 -16
  392. package/lib/utils/icon.js +0 -43
  393. package/lib/utils/image.d.ts +0 -18
  394. package/lib/utils/image.js +0 -56
  395. package/lib/utils/index.d.ts +0 -55
  396. package/lib/utils/isPureVariable.d.ts +0 -1
  397. package/lib/utils/isPureVariable.js +0 -26
  398. package/lib/utils/json-schema-2-amis-schema.d.ts +0 -6
  399. package/lib/utils/json-schema-2-amis-schema.js +0 -60
  400. package/lib/utils/keyToPath.d.ts +0 -6
  401. package/lib/utils/keyToPath.js +0 -34
  402. package/lib/utils/makeSorter.d.ts +0 -1
  403. package/lib/utils/makeSorter.js +0 -30
  404. package/lib/utils/normalizeLink.d.ts +0 -1
  405. package/lib/utils/normalizeLink.js +0 -47
  406. package/lib/utils/normalizeOptions.d.ts +0 -7
  407. package/lib/utils/normalizeOptions.js +0 -92
  408. package/lib/utils/object.d.ts +0 -15
  409. package/lib/utils/object.js +0 -156
  410. package/lib/utils/offset.d.ts +0 -15
  411. package/lib/utils/offset.js +0 -37
  412. package/lib/utils/offsetParent.d.ts +0 -5
  413. package/lib/utils/offsetParent.js +0 -28
  414. package/lib/utils/optionValueCompare.d.ts +0 -3
  415. package/lib/utils/optionValueCompare.js +0 -30
  416. package/lib/utils/position.d.ts +0 -26
  417. package/lib/utils/position.js +0 -59
  418. package/lib/utils/prettyBytes.d.ts +0 -1
  419. package/lib/utils/prettyBytes.js +0 -29
  420. package/lib/utils/renderer-event.d.ts +0 -62
  421. package/lib/utils/renderer-event.js +0 -218
  422. package/lib/utils/replaceText.d.ts +0 -3
  423. package/lib/utils/replaceText.js +0 -46
  424. package/lib/utils/resize-sensor.d.ts +0 -6
  425. package/lib/utils/resize-sensor.js +0 -177
  426. package/lib/utils/resolveVariable.d.ts +0 -1
  427. package/lib/utils/resolveVariable.js +0 -39
  428. package/lib/utils/resolveVariableAndFilter.d.ts +0 -1
  429. package/lib/utils/resolveVariableAndFilter.js +0 -37
  430. package/lib/utils/scrollPosition.d.ts +0 -16
  431. package/lib/utils/scrollPosition.js +0 -37
  432. package/lib/utils/string2regExp.d.ts +0 -1
  433. package/lib/utils/string2regExp.js +0 -18
  434. package/lib/utils/stripNumber.d.ts +0 -1
  435. package/lib/utils/stripNumber.js +0 -20
  436. package/lib/utils/style.d.ts +0 -10
  437. package/lib/utils/style.js +0 -67
  438. package/lib/utils/toNumber.d.ts +0 -7
  439. package/lib/utils/toNumber.js +0 -22
  440. package/lib/utils/tokenize.d.ts +0 -1
  441. package/lib/utils/tokenize.js +0 -33
  442. package/lib/utils/tpl-builtin.d.ts +0 -18
  443. package/lib/utils/tpl-builtin.js +0 -75
  444. package/lib/utils/tpl-lodash.d.ts +0 -4
  445. package/lib/utils/tpl-lodash.js +0 -71
  446. package/lib/utils/tpl.d.ts +0 -11
  447. package/lib/utils/tpl.js +0 -140
  448. package/lib/utils/uncontrollable.d.ts +0 -4
  449. package/lib/utils/uncontrollable.js +0 -22
  450. package/lib/utils/validations.d.ts +0 -39
  451. package/lib/utils/validations.js +0 -455
@@ -1,1261 +0,0 @@
1
- /**
2
- * amis-core v2.6.0
3
- * Copyright 2018-2022 fex
4
- */
5
-
6
- import { __extends, __assign, __spreadArray, __awaiter, __generator } from 'tslib';
7
- import isPlainObject from 'lodash/isPlainObject';
8
- import isEqual from 'lodash/isEqual';
9
- import isNaN from 'lodash/isNaN';
10
- import uniq from 'lodash/uniq';
11
- import last from 'lodash/last';
12
- import merge from 'lodash/merge';
13
- import { evalExpression } from './tpl.js';
14
- import qs from 'qs';
15
- import { autobindMethod } from './autobind.js';
16
- import 'amis-formula';
17
- import 'moment';
18
- import { isObject } from './object.js';
19
- export { cloneObject, createObject, deleteVariable, extendObject, isObject, setVariable } from './object.js';
20
- import { isPureVariable } from './isPureVariable.js';
21
- import { resolveVariable } from './resolveVariable.js';
22
- import { resolveVariableAndFilter } from './resolveVariableAndFilter.js';
23
- import './filter.js';
24
- import { isObservable, isObservableArray } from 'mobx';
25
- export { string2regExp } from './string2regExp.js';
26
- export { getVariable } from './getVariable.js';
27
- import { keyToPath } from './keyToPath.js';
28
- export { keyToPath } from './keyToPath.js';
29
-
30
- function preventDefault(event) {
31
- if (typeof event.cancelable !== 'boolean' || event.cancelable) {
32
- event.preventDefault();
33
- }
34
- }
35
- function isMobile() {
36
- var _a, _b;
37
- return (_b = (_a = window).matchMedia) === null || _b === void 0 ? void 0 : _b.call(_a, '(max-width: 768px)').matches;
38
- }
39
- function range(num, min, max) {
40
- return Math.min(Math.max(num, min), max);
41
- }
42
- /**
43
- * 给目标对象添加其他属性,可读取但是不会被遍历。
44
- * @param target
45
- * @param props
46
- */
47
- function injectPropsToObject(target, props) {
48
- var sup = Object.create(target.__super || null);
49
- Object.keys(props).forEach(function (key) { return (sup[key] = props[key]); });
50
- var result = Object.create(sup);
51
- Object.keys(target).forEach(function (key) { return (result[key] = target[key]); });
52
- return result;
53
- }
54
- function isSuperDataModified(data, prevData, store) {
55
- var keys = [];
56
- if (store && store.storeType === 'FormStore') {
57
- keys = uniq(store.items
58
- .map(function (item) { return "".concat(item.name).replace(/\..*$/, ''); })
59
- .concat(Object.keys(store.data)));
60
- }
61
- else {
62
- keys = Object.keys(store.data);
63
- }
64
- if (Array.isArray(keys) && keys.length) {
65
- return keys.some(function (key) { return data[key] !== prevData[key]; });
66
- }
67
- return false;
68
- }
69
- function syncDataFromSuper(data, superObject, prevSuperObject, store, force) {
70
- var obj = __assign({}, data);
71
- var keys = [];
72
- // 如果是 form store,则从父级同步 formItem 种东西。
73
- if (store && store.storeType === 'FormStore') {
74
- keys = uniq(store.items
75
- .map(function (item) { return "".concat(item.name).replace(/\..*$/, ''); })
76
- .concat(Object.keys(obj)));
77
- }
78
- else if (force) {
79
- keys = Object.keys(obj);
80
- }
81
- if (superObject || prevSuperObject) {
82
- keys.forEach(function (key) {
83
- if (!key) {
84
- return;
85
- }
86
- if (((superObject && typeof superObject[key] !== 'undefined') ||
87
- (prevSuperObject && typeof prevSuperObject[key] !== 'undefined')) &&
88
- ((prevSuperObject && !superObject) ||
89
- (!prevSuperObject && superObject) ||
90
- prevSuperObject[key] !== superObject[key])) {
91
- obj[key] = superObject[key];
92
- }
93
- });
94
- }
95
- return obj;
96
- }
97
- /**
98
- * 生成 8 位随机数字。
99
- *
100
- * @return {string} 8位随机数字
101
- */
102
- function guid() {
103
- function s4() {
104
- return Math.floor((1 + Math.random()) * 0x10000)
105
- .toString(16)
106
- .substring(1);
107
- }
108
- return s4() + s4() + s4();
109
- }
110
- function findIndex(arr, detect) {
111
- for (var i = 0, len = arr.length; i < len; i++) {
112
- if (detect(arr[i], i)) {
113
- return i;
114
- }
115
- }
116
- return -1;
117
- }
118
- function hasOwnPropertyInPath(data, key) {
119
- var parts = keyToPath(key);
120
- while (parts.length) {
121
- var key_1 = parts.shift();
122
- if (!isObject(data) || !data.hasOwnProperty(key_1)) {
123
- return false;
124
- }
125
- data = data[key_1];
126
- }
127
- return true;
128
- }
129
- function noop() { }
130
- function anyChanged(attrs, from, to, strictMode) {
131
- if (strictMode === void 0) { strictMode = true; }
132
- return (typeof attrs === 'string' ? attrs.split(/\s*,\s*/) : attrs).some(function (key) { return (strictMode ? from[key] !== to[key] : from[key] != to[key]); });
133
- }
134
- function rmUndefined(obj) {
135
- var newObj = {};
136
- if (typeof obj !== 'object') {
137
- return obj;
138
- }
139
- var keys = Object.keys(obj);
140
- keys.forEach(function (key) {
141
- if (obj[key] !== undefined) {
142
- newObj[key] = obj[key];
143
- }
144
- });
145
- return newObj;
146
- }
147
- function isObjectShallowModified(prev, next, strictMode, ignoreUndefined, statck) {
148
- if (strictMode === void 0) { strictMode = true; }
149
- if (ignoreUndefined === void 0) { ignoreUndefined = false; }
150
- if (statck === void 0) { statck = []; }
151
- if (Array.isArray(prev) && Array.isArray(next)) {
152
- return prev.length !== next.length
153
- ? true
154
- : prev.some(function (prev, index) {
155
- return isObjectShallowModified(prev, next[index], strictMode, ignoreUndefined, statck);
156
- });
157
- }
158
- else if (isNaN(prev) && isNaN(next)) {
159
- return false;
160
- }
161
- else if (null == prev ||
162
- null == next ||
163
- !isObject(prev) ||
164
- !isObject(next) ||
165
- isObservable(prev) ||
166
- isObservable(next)) {
167
- return strictMode ? prev !== next : prev != next;
168
- }
169
- if (ignoreUndefined) {
170
- prev = rmUndefined(prev);
171
- next = rmUndefined(next);
172
- }
173
- var keys = Object.keys(prev);
174
- var nextKeys = Object.keys(next);
175
- if (keys.length !== nextKeys.length ||
176
- keys.sort().join(',') !== nextKeys.sort().join(',')) {
177
- return true;
178
- }
179
- // 避免循环引用死循环。
180
- if (~statck.indexOf(prev)) {
181
- return false;
182
- }
183
- statck.push(prev);
184
- for (var i = keys.length - 1; i >= 0; i--) {
185
- var key = keys[i];
186
- if (isObjectShallowModified(prev[key], next[key], strictMode, ignoreUndefined, statck)) {
187
- return true;
188
- }
189
- }
190
- return false;
191
- }
192
- function isArrayChildrenModified(prev, next, strictMode) {
193
- if (strictMode === void 0) { strictMode = true; }
194
- if (!Array.isArray(prev) || !Array.isArray(next)) {
195
- return strictMode ? prev !== next : prev != next;
196
- }
197
- if (prev.length !== next.length) {
198
- return true;
199
- }
200
- for (var i = prev.length - 1; i >= 0; i--) {
201
- if (strictMode
202
- ? prev[i] !== next[i]
203
- : prev[i] != next[i] ||
204
- isArrayChildrenModified(prev[i].children, next[i].children, strictMode)) {
205
- return true;
206
- }
207
- }
208
- return false;
209
- }
210
- function immutableExtends(to, from, deep) {
211
- // 不是对象,不可以merge
212
- if (!isObject(to) || !isObject(from)) {
213
- return to;
214
- }
215
- var ret = to;
216
- Object.keys(from).forEach(function (key) {
217
- var origin = to[key];
218
- var value = from[key];
219
- // todo 支持深度merge
220
- if (origin !== value) {
221
- // 一旦有修改,就创建个新对象。
222
- ret = ret !== to ? ret : __assign({}, to);
223
- ret[key] = value;
224
- }
225
- });
226
- return ret;
227
- }
228
- // 即将抛弃
229
- function makeColumnClassBuild(steps, classNameTpl) {
230
- if (classNameTpl === void 0) { classNameTpl = 'col-sm-$value'; }
231
- var count = 12;
232
- var step = Math.floor(count / steps);
233
- return function (schema) {
234
- if (schema.columnClassName &&
235
- /\bcol-(?:xs|sm|md|lg)-(\d+)\b/.test(schema.columnClassName)) {
236
- var flex = parseInt(RegExp.$1, 10);
237
- count -= flex;
238
- steps--;
239
- step = Math.floor(count / steps);
240
- return schema.columnClassName;
241
- }
242
- else if (schema.columnClassName) {
243
- count -= step;
244
- steps--;
245
- return schema.columnClassName;
246
- }
247
- count -= step;
248
- steps--;
249
- return classNameTpl.replace('$value', '' + step);
250
- };
251
- }
252
- function hasVisibleExpression(schema) {
253
- return (schema === null || schema === void 0 ? void 0 : schema.visibleOn) || (schema === null || schema === void 0 ? void 0 : schema.hiddenOn);
254
- }
255
- function isVisible(schema, data) {
256
- return !(schema.hidden ||
257
- schema.visible === false ||
258
- (schema.hiddenOn && evalExpression(schema.hiddenOn, data) === true) ||
259
- (schema.visibleOn && evalExpression(schema.visibleOn, data) === false));
260
- }
261
- function isUnfolded(node, config) {
262
- var foldedField = config.foldedField, unfoldedField = config.unfoldedField;
263
- unfoldedField = unfoldedField || 'unfolded';
264
- foldedField = foldedField || 'folded';
265
- var ret = false;
266
- if (unfoldedField && typeof node[unfoldedField] !== 'undefined') {
267
- ret = !!node[unfoldedField];
268
- }
269
- else if (foldedField && typeof node[foldedField] !== 'undefined') {
270
- ret = !node[foldedField];
271
- }
272
- return ret;
273
- }
274
- /**
275
- * 过滤掉被隐藏的数组元素
276
- */
277
- function visibilityFilter(items, data) {
278
- return items.filter(function (item) {
279
- return isVisible(item, data);
280
- });
281
- }
282
- function isDisabled(schema, data) {
283
- return (schema.disabled ||
284
- (schema.disabledOn && evalExpression(schema.disabledOn, data)));
285
- }
286
- function hasAbility(schema, ability, data, defaultValue) {
287
- if (defaultValue === void 0) { defaultValue = true; }
288
- return schema.hasOwnProperty(ability)
289
- ? schema[ability]
290
- : schema.hasOwnProperty("".concat(ability, "On"))
291
- ? evalExpression(schema["".concat(ability, "On")], data || schema)
292
- : defaultValue;
293
- }
294
- function makeHorizontalDeeper(horizontal, count) {
295
- if (count > 1 && /\bcol-(xs|sm|md|lg)-(\d+)\b/.test(horizontal.left)) {
296
- var flex = parseInt(RegExp.$2, 10) * count;
297
- return {
298
- leftFixed: horizontal.leftFixed,
299
- left: flex,
300
- right: 12 - flex,
301
- offset: flex
302
- };
303
- }
304
- else if (count > 1 && typeof horizontal.left === 'number') {
305
- var flex = horizontal.left * count;
306
- return {
307
- leftFixed: horizontal.leftFixed,
308
- left: flex,
309
- right: 12 - flex,
310
- offset: flex
311
- };
312
- }
313
- return horizontal;
314
- }
315
- function promisify(fn) {
316
- // 避免重复处理
317
- if (fn._promisified) {
318
- return fn;
319
- }
320
- var promisified = function () {
321
- try {
322
- var ret_1 = fn.apply(null, arguments);
323
- if (ret_1 && ret_1.then) {
324
- return ret_1;
325
- }
326
- else if (typeof ret_1 === 'function') {
327
- // thunk support
328
- return new Promise(function (resolve, reject) {
329
- return ret_1(function (error, value) {
330
- return error ? reject(error) : resolve(value);
331
- });
332
- });
333
- }
334
- return Promise.resolve(ret_1);
335
- }
336
- catch (e) {
337
- return Promise.reject(e);
338
- }
339
- };
340
- promisified.raw = fn;
341
- promisified._promisified = true;
342
- return promisified;
343
- }
344
- /**
345
- *
346
- * @param node 当前元素
347
- * @param compute 自定义计算,找到的父元素是否满足特殊场景
348
- * @returns 返回控制当前元素滚动的父元素
349
- */
350
- function getScrollParent(node, compute) {
351
- if (compute === void 0) { compute = function () { return true; }; }
352
- if (node == null) {
353
- return null;
354
- }
355
- var style = getComputedStyle(node);
356
- if (!style) {
357
- return null;
358
- }
359
- var text = style.getPropertyValue('overflow') +
360
- style.getPropertyValue('overflow-x') +
361
- style.getPropertyValue('overflow-y');
362
- if (node.nodeName === 'BODY' || (/auto|scroll/.test(text) && compute(node))) {
363
- return node;
364
- }
365
- return getScrollParent(node.parentNode, compute);
366
- }
367
- /**
368
- * Deep diff between two object, using lodash
369
- * @param {Object} object Object compared
370
- * @param {Object} base Object to compare with
371
- * @return {Object} Return a new object who represent the diff
372
- */
373
- function difference(object, base, keepProps) {
374
- function changes(object, base) {
375
- if (isObject(object) && isObject(base)) {
376
- var keys = uniq(Object.keys(object).concat(Object.keys(base)));
377
- var result_1 = {};
378
- keys.forEach(function (key) {
379
- var a = object[key];
380
- var b = base[key];
381
- if (keepProps && ~keepProps.indexOf(key)) {
382
- result_1[key] = a;
383
- }
384
- if (isEqual(a, b)) {
385
- return;
386
- }
387
- if (!object.hasOwnProperty(key)) {
388
- result_1[key] = undefined;
389
- }
390
- else if (Array.isArray(a) && Array.isArray(b)) {
391
- result_1[key] = a;
392
- }
393
- else {
394
- result_1[key] = changes(a, b);
395
- }
396
- });
397
- return result_1;
398
- }
399
- else {
400
- return object;
401
- }
402
- }
403
- return changes(object, base);
404
- }
405
- var padArr = function (arr, size, fillUndefined) {
406
- if (size === void 0) { size = 4; }
407
- if (fillUndefined === void 0) { fillUndefined = false; }
408
- var ret = [[]];
409
- var pool = arr.concat();
410
- var from = 0;
411
- while (pool.length || (fillUndefined && ret[ret.length - 1].length < size)) {
412
- var host = ret[from] || (ret[from] = []);
413
- if (host.length >= size) {
414
- from += 1;
415
- continue;
416
- }
417
- host.push(pool.shift());
418
- }
419
- return ret;
420
- };
421
- function __uri(id) {
422
- return id;
423
- }
424
- // xs < 768px
425
- // sm >= 768px
426
- // md >= 992px
427
- // lg >= 1200px
428
- function isBreakpoint(str) {
429
- if (typeof str !== 'string') {
430
- return !!str;
431
- }
432
- var breaks = str.split(/\s*,\s*|\s+/);
433
- if (window.matchMedia) {
434
- return breaks.some(function (item) {
435
- return item === '*' ||
436
- (item === 'xs' &&
437
- matchMedia("screen and (max-width: 767px)").matches) ||
438
- (item === 'sm' &&
439
- matchMedia("screen and (min-width: 768px) and (max-width: 991px)")
440
- .matches) ||
441
- (item === 'md' &&
442
- matchMedia("screen and (min-width: 992px) and (max-width: 1199px)")
443
- .matches) ||
444
- (item === 'lg' && matchMedia("screen and (min-width: 1200px)").matches);
445
- });
446
- }
447
- else {
448
- var width_1 = window.innerWidth;
449
- return breaks.some(function (item) {
450
- return item === '*' ||
451
- (item === 'xs' && width_1 < 768) ||
452
- (item === 'sm' && width_1 >= 768 && width_1 < 992) ||
453
- (item === 'md' && width_1 >= 992 && width_1 < 1200) ||
454
- (item === 'lg' && width_1 >= 1200);
455
- });
456
- }
457
- }
458
- function until(fn, when, getCanceler, interval) {
459
- var _this = this;
460
- if (interval === void 0) { interval = 5000; }
461
- var timer;
462
- var stoped = false;
463
- return new Promise(function (resolve, reject) {
464
- var cancel = function () {
465
- clearTimeout(timer);
466
- stoped = true;
467
- };
468
- var check = function () { return __awaiter(_this, void 0, void 0, function () {
469
- var ret, e_1;
470
- return __generator(this, function (_a) {
471
- switch (_a.label) {
472
- case 0:
473
- _a.trys.push([0, 2, , 3]);
474
- return [4 /*yield*/, fn()];
475
- case 1:
476
- ret = _a.sent();
477
- if (stoped) {
478
- return [2 /*return*/];
479
- }
480
- else if (when(ret)) {
481
- stoped = true;
482
- resolve(ret);
483
- }
484
- else {
485
- timer = setTimeout(check, interval);
486
- }
487
- return [3 /*break*/, 3];
488
- case 2:
489
- e_1 = _a.sent();
490
- reject(e_1);
491
- return [3 /*break*/, 3];
492
- case 3: return [2 /*return*/];
493
- }
494
- });
495
- }); };
496
- check();
497
- getCanceler && getCanceler(cancel);
498
- });
499
- }
500
- function omitControls(controls, omitItems) {
501
- return controls.filter(function (control) { return !~omitItems.indexOf(control.name || control._name); });
502
- }
503
- function isEmpty(thing) {
504
- if (isObject(thing) && Object.keys(thing).length) {
505
- return false;
506
- }
507
- return true;
508
- }
509
- /**
510
- * 基于时间戳的 uuid
511
- *
512
- * @returns uniqueId
513
- */
514
- var uuid = function () {
515
- return (+new Date()).toString(36);
516
- };
517
- // 参考 https://github.com/streamich/v4-uuid
518
- var str = function () {
519
- return ('00000000000000000' + (Math.random() * 0xffffffffffffffff).toString(16)).slice(-16);
520
- };
521
- var uuidv4 = function () {
522
- var a = str();
523
- var b = str();
524
- return (a.slice(0, 8) +
525
- '-' +
526
- a.slice(8, 12) +
527
- '-4' +
528
- a.slice(13) +
529
- '-a' +
530
- b.slice(1, 4) +
531
- '-' +
532
- b.slice(4));
533
- };
534
- /**
535
- * 类似于 arr.map 方法,此方法主要针对类似下面示例的树形结构。
536
- * [
537
- * {
538
- * children: []
539
- * },
540
- * // 其他成员
541
- * ]
542
- *
543
- * @param {Tree} tree 树形数据
544
- * @param {Function} iterator 处理函数,返回的数据会被替换成新的。
545
- * @return {Tree} 返回处理过的 tree
546
- */
547
- function mapTree(tree, iterator, level, depthFirst, paths) {
548
- if (level === void 0) { level = 1; }
549
- if (depthFirst === void 0) { depthFirst = false; }
550
- if (paths === void 0) { paths = []; }
551
- return tree.map(function (item, index) {
552
- if (depthFirst) {
553
- var children = item.children
554
- ? mapTree(item.children, iterator, level + 1, depthFirst, paths.concat(item))
555
- : undefined;
556
- children && (item = __assign(__assign({}, item), { children: children }));
557
- item = iterator(item, index, level, paths) || __assign({}, item);
558
- return item;
559
- }
560
- item = iterator(item, index, level, paths) || __assign({}, item);
561
- if (item.children && item.children.splice) {
562
- item.children = mapTree(item.children, iterator, level + 1, depthFirst, paths.concat(item));
563
- }
564
- return item;
565
- });
566
- }
567
- /**
568
- * 遍历树
569
- * @param tree
570
- * @param iterator
571
- */
572
- function eachTree(tree, iterator, level, paths) {
573
- if (level === void 0) { level = 1; }
574
- if (paths === void 0) { paths = []; }
575
- tree.map(function (item, index) {
576
- var _a;
577
- var currentPath = paths.concat(item);
578
- iterator(item, index, level, currentPath);
579
- if ((_a = item.children) === null || _a === void 0 ? void 0 : _a.splice) {
580
- eachTree(item.children, iterator, level + 1, currentPath);
581
- }
582
- });
583
- }
584
- /**
585
- * 在树中查找节点。
586
- * @param tree
587
- * @param iterator
588
- */
589
- function findTree(tree, iterator) {
590
- var result = null;
591
- everyTree(tree, function (item, key, level, paths) {
592
- if (iterator(item, key, level, paths)) {
593
- result = item;
594
- return false;
595
- }
596
- return true;
597
- });
598
- return result;
599
- }
600
- /**
601
- * 在树中查找节点, 返回下标数组。
602
- * @param tree
603
- * @param iterator
604
- */
605
- function findTreeIndex(tree, iterator) {
606
- var idx = [];
607
- findTree(tree, function (item, index, level, paths) {
608
- if (iterator(item, index, level, paths)) {
609
- idx = [index];
610
- paths = paths.concat();
611
- paths.unshift({
612
- children: tree
613
- });
614
- for (var i = paths.length - 1; i > 0; i--) {
615
- var prev = paths[i - 1];
616
- var current = paths[i];
617
- idx.unshift(prev.children.indexOf(current));
618
- }
619
- return true;
620
- }
621
- return false;
622
- });
623
- return idx.length ? idx : undefined;
624
- }
625
- function getTree(tree, idx) {
626
- var indexes = Array.isArray(idx) ? idx.concat() : [idx];
627
- var lastIndex = indexes.pop();
628
- var list = tree;
629
- for (var i = 0, len = indexes.length; i < len; i++) {
630
- var index = indexes[i];
631
- if (!list[index]) {
632
- list = null;
633
- break;
634
- }
635
- list = list[index].children;
636
- }
637
- return list ? list[lastIndex] : undefined;
638
- }
639
- /**
640
- * 过滤树节点
641
- *
642
- * @param tree
643
- * @param iterator
644
- */
645
- function filterTree(tree, iterator, level, depthFirst) {
646
- if (level === void 0) { level = 1; }
647
- if (depthFirst === void 0) { depthFirst = false; }
648
- if (depthFirst) {
649
- return tree
650
- .map(function (item) {
651
- var children = item.children
652
- ? filterTree(item.children, iterator, level + 1, depthFirst)
653
- : undefined;
654
- if (Array.isArray(children) && Array.isArray(item.children)) {
655
- item = __assign(__assign({}, item), { children: children });
656
- }
657
- return item;
658
- })
659
- .filter(function (item, index) { return iterator(item, index, level); });
660
- }
661
- return tree
662
- .filter(function (item, index) { return iterator(item, index, level); })
663
- .map(function (item) {
664
- var _a;
665
- if ((_a = item.children) === null || _a === void 0 ? void 0 : _a.splice) {
666
- var children = filterTree(item.children, iterator, level + 1, depthFirst);
667
- if (Array.isArray(children) && Array.isArray(item.children)) {
668
- item = __assign(__assign({}, item), { children: children });
669
- }
670
- }
671
- return item;
672
- });
673
- }
674
- /**
675
- * 判断树中每个节点是否满足某个条件。
676
- * @param tree
677
- * @param iterator
678
- */
679
- function everyTree(tree, iterator, level, paths, indexes) {
680
- if (level === void 0) { level = 1; }
681
- if (paths === void 0) { paths = []; }
682
- if (indexes === void 0) { indexes = []; }
683
- if (!Array.isArray(tree) && !isObservableArray(tree)) {
684
- return false;
685
- }
686
- return tree.every(function (item, index) {
687
- var _a;
688
- var value = iterator(item, index, level, paths, indexes);
689
- if (value && ((_a = item.children) === null || _a === void 0 ? void 0 : _a.splice)) {
690
- return everyTree(item.children, iterator, level + 1, paths.concat(item), indexes.concat(index));
691
- }
692
- return value;
693
- });
694
- }
695
- /**
696
- * 判断树中是否有某些节点满足某个条件。
697
- * @param tree
698
- * @param iterator
699
- */
700
- function someTree(tree, iterator) {
701
- var result = false;
702
- everyTree(tree, function (item, key, level, paths) {
703
- if (iterator(item, key, level, paths)) {
704
- result = true;
705
- return false;
706
- }
707
- return true;
708
- });
709
- return result;
710
- }
711
- function flattenTree(tree, mapper) {
712
- var flattened = [];
713
- eachTree(tree, function (item, index, level, paths) {
714
- return flattened.push(mapper ? mapper(item, index, level, paths) : item);
715
- });
716
- return flattened;
717
- }
718
- function flattenTreeWithLeafNodes(tree, mapper) {
719
- var flattened = [];
720
- eachTree(tree, function (item, index) {
721
- if (!item.hasOwnProperty('children')) {
722
- flattened.push(mapper ? mapper(item, index) : item);
723
- }
724
- });
725
- return flattened;
726
- }
727
- /**
728
- * 操作树,遵循 imutable, 每次返回一个新的树。
729
- * 类似数组的 splice 不同的地方这个方法不修改原始数据,
730
- * 同时第二个参数不是下标,而是下标数组,分别代表每一层的下标。
731
- *
732
- * 至于如何获取下标数组,请查看 findTreeIndex
733
- *
734
- * @param tree
735
- * @param idx
736
- * @param deleteCount
737
- * @param ...items
738
- */
739
- function spliceTree(tree, idx, deleteCount) {
740
- if (deleteCount === void 0) { deleteCount = 0; }
741
- var items = [];
742
- for (var _i = 3; _i < arguments.length; _i++) {
743
- items[_i - 3] = arguments[_i];
744
- }
745
- var list = tree.concat();
746
- if (typeof idx === 'number') {
747
- list.splice.apply(list, __spreadArray([idx, deleteCount], items, false));
748
- }
749
- else if (Array.isArray(idx) && idx.length) {
750
- idx = idx.concat();
751
- var lastIdx = idx.pop();
752
- var host = idx.reduce(function (list, idx) {
753
- var child = __assign(__assign({}, list[idx]), { children: list[idx].children ? list[idx].children.concat() : [] });
754
- list[idx] = child;
755
- return child.children;
756
- }, list);
757
- host.splice.apply(host, __spreadArray([lastIdx, deleteCount], items, false));
758
- }
759
- return list;
760
- }
761
- /**
762
- * 计算树的深度
763
- * @param tree
764
- */
765
- function getTreeDepth(tree) {
766
- return Math.max.apply(Math, tree.map(function (item) {
767
- if (Array.isArray(item.children)) {
768
- return 1 + getTreeDepth(item.children);
769
- }
770
- return 1;
771
- }));
772
- }
773
- /**
774
- * 从树中获取某个值的所有祖先
775
- * @param tree
776
- * @param value
777
- */
778
- function getTreeAncestors(tree, value, includeSelf) {
779
- if (includeSelf === void 0) { includeSelf = false; }
780
- var ancestors = null;
781
- findTree(tree, function (item, index, level, paths) {
782
- if (item === value) {
783
- ancestors = paths;
784
- if (includeSelf) {
785
- ancestors.push(item);
786
- }
787
- return true;
788
- }
789
- return false;
790
- });
791
- return ancestors;
792
- }
793
- /**
794
- * 从树中获取某个值的上级
795
- * @param tree
796
- * @param value
797
- */
798
- function getTreeParent(tree, value) {
799
- var ancestors = getTreeAncestors(tree, value);
800
- return (ancestors === null || ancestors === void 0 ? void 0 : ancestors.length) ? ancestors[ancestors.length - 1] : null;
801
- }
802
- function ucFirst(str) {
803
- return typeof str === 'string'
804
- ? str.substring(0, 1).toUpperCase() + str.substring(1)
805
- : str;
806
- }
807
- function lcFirst(str) {
808
- return str ? str.substring(0, 1).toLowerCase() + str.substring(1) : '';
809
- }
810
- function camel(str) {
811
- return str
812
- ? str
813
- .split(/[\s_\-]/)
814
- .map(function (item, index) { return (index === 0 ? lcFirst(item) : ucFirst(item)); })
815
- .join('')
816
- : '';
817
- }
818
- function getWidthRate(value, strictMode) {
819
- if (strictMode === void 0) { strictMode = false; }
820
- if (typeof value === 'string' && /\bcol\-\w+\-(\d+)\b/.test(value)) {
821
- return parseInt(RegExp.$1, 10);
822
- }
823
- return strictMode ? 0 : value || 0;
824
- }
825
- function getLevelFromClassName(value, defaultValue) {
826
- if (defaultValue === void 0) { defaultValue = 'default'; }
827
- if (/\b(?:btn|text)-(link|primary|secondary|info|success|warning|danger|light|dark)\b/.test(value)) {
828
- return RegExp.$1;
829
- }
830
- return defaultValue;
831
- }
832
- function pickEventsProps(props) {
833
- var ret = {};
834
- props &&
835
- Object.keys(props).forEach(function (key) { return /^on/.test(key) && (ret[key] = props[key]); });
836
- return ret;
837
- }
838
- var autobind = autobindMethod;
839
- var bulkBindFunctions = function (context, funNames) {
840
- funNames.forEach(function (key) { return (context[key] = context[key].bind(context)); });
841
- };
842
- function sortArray(items, field, dir) {
843
- return items.sort(function (a, b) {
844
- var ret;
845
- var a1 = a[field];
846
- var b1 = b[field];
847
- if (typeof a1 === 'number' && typeof b1 === 'number') {
848
- ret = a1 < b1 ? -1 : a1 === b1 ? 0 : 1;
849
- }
850
- else {
851
- ret = String(a1).localeCompare(String(b1));
852
- }
853
- return ret * dir;
854
- });
855
- }
856
- // 只判断一层, 如果层级很深,form-data 也不好表达。
857
- function hasFile(object) {
858
- return Object.keys(object).some(function (key) {
859
- var value = object[key];
860
- return (value instanceof File ||
861
- (Array.isArray(value) && value.length && value[0] instanceof File));
862
- });
863
- }
864
- function qsstringify(data, options, keepEmptyArray) {
865
- if (options === void 0) { options = {
866
- arrayFormat: 'indices',
867
- encodeValuesOnly: true
868
- }; }
869
- // qs会保留空字符串。fix: Combo模式的空数组,无法清空。改为存为空字符串;只转换一层
870
- keepEmptyArray &&
871
- Object.keys(data).forEach(function (key) {
872
- Array.isArray(data[key]) && !data[key].length && (data[key] = '');
873
- });
874
- return qs.stringify(data, options);
875
- }
876
- function qsparse(data, options) {
877
- if (options === void 0) { options = {
878
- arrayFormat: 'indices',
879
- encodeValuesOnly: true,
880
- depth: 1000,
881
- arrayLimit: 1000 /** array元素数量超出限制,会被自动转化为object格式,默认值1000 */
882
- }; }
883
- return qs.parse(data, options);
884
- }
885
- function object2formData(data, options, fd) {
886
- if (options === void 0) { options = {
887
- arrayFormat: 'indices',
888
- encodeValuesOnly: true
889
- }; }
890
- if (fd === void 0) { fd = new FormData(); }
891
- var fileObjects = [];
892
- var others = {};
893
- Object.keys(data).forEach(function (key) {
894
- var value = data[key];
895
- if (value instanceof File) {
896
- fileObjects.push([key, value]);
897
- }
898
- else if (Array.isArray(value) &&
899
- value.length &&
900
- value[0] instanceof File) {
901
- value.forEach(function (value) { return fileObjects.push(["".concat(key, "[]"), value]); });
902
- }
903
- else {
904
- others[key] = value;
905
- }
906
- });
907
- // 因为 key 的格式太多了,偷个懒,用 qs 来处理吧。
908
- qsstringify(others, options)
909
- .split('&')
910
- .forEach(function (item) {
911
- var parts = item.split('=');
912
- // form-data/multipart 是不需要 encode 值的。
913
- parts[0] && fd.append(parts[0], decodeURIComponent(parts[1]));
914
- });
915
- // Note: File类型字段放在后面,可以支持第三方云存储鉴权
916
- fileObjects.forEach(function (fileObject) {
917
- return fd.append(fileObject[0], fileObject[1], fileObject[1].name);
918
- });
919
- return fd;
920
- }
921
- function chainFunctions() {
922
- var fns = [];
923
- for (var _i = 0; _i < arguments.length; _i++) {
924
- fns[_i] = arguments[_i];
925
- }
926
- return function () {
927
- var args = [];
928
- for (var _i = 0; _i < arguments.length; _i++) {
929
- args[_i] = arguments[_i];
930
- }
931
- return fns.reduce(function (ret, fn) {
932
- return ret === false
933
- ? false
934
- : typeof fn == 'function'
935
- ? fn.apply(void 0, args) : undefined;
936
- }, undefined);
937
- };
938
- }
939
- function chainEvents(props, schema) {
940
- var ret = {};
941
- Object.keys(props).forEach(function (key) {
942
- if (key.substr(0, 2) === 'on' &&
943
- typeof props[key] === 'function' &&
944
- typeof schema[key] === 'function' &&
945
- schema[key] !== props[key]) {
946
- // 表单项里面的 onChange 很特殊,这个不要处理。
947
- if (props.formStore && key === 'onChange') {
948
- ret[key] = props[key];
949
- }
950
- else {
951
- ret[key] = chainFunctions(schema[key], props[key]);
952
- }
953
- }
954
- else {
955
- ret[key] = props[key];
956
- }
957
- });
958
- return ret;
959
- }
960
- function mapObject(value, fn, skipFn) {
961
- // 如果value值满足skipFn条件则不做map操作
962
- skipFn =
963
- skipFn && typeof skipFn === 'function'
964
- ? skipFn
965
- : function (value) {
966
- // File类型处理之后会变成plain object
967
- if (value instanceof File) {
968
- return true;
969
- }
970
- return false;
971
- };
972
- if (!!skipFn(value)) {
973
- return value;
974
- }
975
- if (Array.isArray(value)) {
976
- return value.map(function (item) { return mapObject(item, fn); });
977
- }
978
- if (isObject(value)) {
979
- var tmpValue_1 = __assign({}, value);
980
- Object.keys(tmpValue_1).forEach(function (key) {
981
- tmpValue_1[key] = mapObject(tmpValue_1[key], fn);
982
- });
983
- return tmpValue_1;
984
- }
985
- return fn(value);
986
- }
987
- function loadScript(src) {
988
- return new Promise(function (ok, fail) {
989
- var script = document.createElement('script');
990
- script.onerror = function (reason) { return fail(reason); };
991
- if (~src.indexOf('{{callback}}')) {
992
- var callbackFn_1 = "loadscriptcallback_".concat(uuid());
993
- window[callbackFn_1] = function () {
994
- ok();
995
- delete window[callbackFn_1];
996
- };
997
- src = src.replace('{{callback}}', callbackFn_1);
998
- }
999
- else {
1000
- script.onload = function () { return ok(); };
1001
- }
1002
- script.src = src;
1003
- document.head.appendChild(script);
1004
- });
1005
- }
1006
- var SkipOperation = /** @class */ (function (_super) {
1007
- __extends(SkipOperation, _super);
1008
- function SkipOperation() {
1009
- return _super !== null && _super.apply(this, arguments) || this;
1010
- }
1011
- return SkipOperation;
1012
- }(Error));
1013
- /**
1014
- * 检查对象是否有循环引用,来自 https://stackoverflow.com/a/34909127
1015
- * @param obj
1016
- */
1017
- function isCyclic(obj) {
1018
- var seenObjects = [];
1019
- function detect(obj) {
1020
- if (obj && typeof obj === 'object') {
1021
- if (seenObjects.indexOf(obj) !== -1) {
1022
- return true;
1023
- }
1024
- seenObjects.push(obj);
1025
- for (var key in obj) {
1026
- if (obj.hasOwnProperty(key) && detect(obj[key])) {
1027
- return true;
1028
- }
1029
- }
1030
- }
1031
- return false;
1032
- }
1033
- return detect(obj);
1034
- }
1035
- function internalFindObjectsWithKey(obj, key) {
1036
- var objects = [];
1037
- for (var k in obj) {
1038
- if (!obj.hasOwnProperty(k))
1039
- continue;
1040
- if (k === key) {
1041
- objects.push(obj);
1042
- }
1043
- else if (typeof obj[k] === 'object') {
1044
- objects = objects.concat(internalFindObjectsWithKey(obj[k], key));
1045
- }
1046
- }
1047
- return objects;
1048
- }
1049
- /**
1050
- * 深度查找具有某个 key 名字段的对象,实际实现是 internalFindObjectsWithKey,这里包一层是为了做循环引用检测
1051
- * @param obj
1052
- * @param key
1053
- */
1054
- function findObjectsWithKey(obj, key) {
1055
- // 避免循环引用导致死循环
1056
- if (isCyclic(obj)) {
1057
- return [];
1058
- }
1059
- return internalFindObjectsWithKey(obj, key);
1060
- }
1061
- var scrollbarWidth;
1062
- /**
1063
- * 获取浏览器滚动条宽度 https://stackoverflow.com/a/13382873
1064
- */
1065
- function getScrollbarWidth() {
1066
- if (typeof scrollbarWidth !== 'undefined') {
1067
- return scrollbarWidth;
1068
- }
1069
- // Creating invisible container
1070
- var outer = document.createElement('div');
1071
- outer.style.visibility = 'hidden';
1072
- outer.style.overflow = 'scroll'; // forcing scrollbar to appear
1073
- // @ts-ignore
1074
- outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps
1075
- document.body.appendChild(outer);
1076
- // Creating inner element and placing it in the container
1077
- var inner = document.createElement('div');
1078
- outer.appendChild(inner);
1079
- // Calculating difference between container's full width and the child width
1080
- scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
1081
- // Removing temporary elements from the DOM
1082
- // @ts-ignore
1083
- outer.parentNode.removeChild(outer);
1084
- return scrollbarWidth;
1085
- }
1086
- // 后续改用 FormulaExec['formula']
1087
- function resolveValueByName(data, name, canAccessSuper) {
1088
- return isPureVariable(name)
1089
- ? resolveVariableAndFilter(name, data)
1090
- : resolveVariable(name, data, canAccessSuper);
1091
- }
1092
- // 统一的获取 value 值方法
1093
- function getPropValue(props, getter, canAccessSuper) {
1094
- var _a, _b;
1095
- var name = props.name, value = props.value, data = props.data, defaultValue = props.defaultValue;
1096
- return ((_b = (_a = value !== null && value !== void 0 ? value : getter === null || getter === void 0 ? void 0 : getter(props)) !== null && _a !== void 0 ? _a : resolveValueByName(data, name, canAccessSuper)) !== null && _b !== void 0 ? _b : defaultValue);
1097
- }
1098
- // 检测 value 是否有变化,有变化就执行 onChange
1099
- function detectPropValueChanged(props, prevProps, onChange, getter) {
1100
- var nextValue;
1101
- if (typeof props.value !== 'undefined') {
1102
- props.value !== prevProps.value && onChange(props.value);
1103
- }
1104
- else if ((nextValue = getter === null || getter === void 0 ? void 0 : getter(props)) !== undefined) {
1105
- nextValue !== getter(prevProps) && onChange(nextValue);
1106
- }
1107
- else if (typeof props.name === 'string' &&
1108
- (nextValue = resolveValueByName(props.data, props.name)) !== undefined) {
1109
- nextValue !== resolveValueByName(prevProps.data, prevProps.name) &&
1110
- onChange(nextValue);
1111
- }
1112
- else if (props.defaultValue !== prevProps.defaultValue) {
1113
- onChange(props.defaultValue);
1114
- }
1115
- }
1116
- // 去掉字符串中的 html 标签,不完全准确但效率比较高
1117
- function removeHTMLTag(str) {
1118
- return typeof str === 'string' ? str.replace(/<\/?[^>]+(>|$)/g, '') : str;
1119
- }
1120
- /**
1121
- * 将路径格式的value转换成普通格式的value值
1122
- *
1123
- * @example
1124
- *
1125
- * 'a/b/c' => 'c';
1126
- * {label: 'A/B/C', value: 'a/b/c'} => {label: 'C', value: 'c'};
1127
- * 'a/b/c,a/d' => 'c,d';
1128
- * ['a/b/c', 'a/d'] => ['c', 'd'];
1129
- * [{label: 'A/B/C', value: 'a/b/c'},{label: 'A/D', value: 'a/d'}] => [{label: 'C', value: 'c'},{label: 'D', value: 'd'}]
1130
- */
1131
- function normalizeNodePath(value, enableNodePath, labelField, valueField, pathSeparator, delimiter) {
1132
- var _a;
1133
- if (labelField === void 0) { labelField = 'label'; }
1134
- if (valueField === void 0) { valueField = 'value'; }
1135
- if (pathSeparator === void 0) { pathSeparator = '/'; }
1136
- if (delimiter === void 0) { delimiter = ','; }
1137
- var nodeValueArray = [];
1138
- var nodePathArray = [];
1139
- var getLastNodeFromPath = function (path) {
1140
- return last(path ? path.toString().split(pathSeparator) : []);
1141
- };
1142
- if (typeof value === 'undefined' || !enableNodePath) {
1143
- return { nodeValueArray: nodeValueArray, nodePathArray: nodePathArray };
1144
- }
1145
- // 尾节点为当前options中value值
1146
- if (Array.isArray(value)) {
1147
- value.forEach(function (nodePath) {
1148
- var _a;
1149
- if (nodePath && nodePath.hasOwnProperty(valueField)) {
1150
- nodeValueArray.push(__assign(__assign({}, nodePath), (_a = {}, _a[labelField] = getLastNodeFromPath(nodePath[labelField]), _a[valueField] = getLastNodeFromPath(nodePath[valueField]), _a)));
1151
- nodePathArray.push(nodePath[valueField]);
1152
- }
1153
- else {
1154
- nodeValueArray.push(getLastNodeFromPath(nodePath));
1155
- nodePathArray.push(nodePath);
1156
- }
1157
- });
1158
- }
1159
- else if (typeof value === 'string') {
1160
- value
1161
- .toString()
1162
- .split(delimiter)
1163
- .forEach(function (path) {
1164
- nodeValueArray.push(getLastNodeFromPath(path));
1165
- nodePathArray.push(path);
1166
- });
1167
- }
1168
- else {
1169
- nodeValueArray.push(__assign(__assign({}, value), (_a = {}, _a[labelField] = getLastNodeFromPath(value[labelField]), _a[valueField || 'value'] = getLastNodeFromPath(value[valueField]), _a)));
1170
- nodePathArray.push(value[valueField]);
1171
- }
1172
- return { nodeValueArray: nodeValueArray, nodePathArray: nodePathArray };
1173
- }
1174
- // 主要用于排除点击输入框和链接等情况
1175
- function isClickOnInput(e) {
1176
- var target = e.target;
1177
- var formItem;
1178
- if (!e.currentTarget.contains(target) ||
1179
- ~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
1180
- ((formItem = target.closest("button, a, [data-role=\"form-item\"]")) &&
1181
- e.currentTarget.contains(formItem))) {
1182
- return true;
1183
- }
1184
- return false;
1185
- }
1186
- // 计算字符串 hash
1187
- function hashCode(s) {
1188
- return s.split('').reduce(function (a, b) {
1189
- a = (a << 5) - a + b.charCodeAt(0);
1190
- return a & a;
1191
- }, 0);
1192
- }
1193
- /**
1194
- * 遍历 schema
1195
- * @param json
1196
- * @param mapper
1197
- */
1198
- function JSONTraverse(json, mapper) {
1199
- Object.keys(json).forEach(function (key) {
1200
- var value = json[key];
1201
- if (!isObservable(value)) {
1202
- if (isPlainObject(value) || Array.isArray(value)) {
1203
- JSONTraverse(value, mapper);
1204
- }
1205
- else {
1206
- mapper(value, key, json);
1207
- }
1208
- }
1209
- });
1210
- }
1211
- function convertArrayValueToMoment(value, types, mom) {
1212
- if (value.length === 0)
1213
- return mom;
1214
- for (var i = 0; i < types.length; i++) {
1215
- var type = types[i];
1216
- // @ts-ignore
1217
- mom.set(type, value[i]);
1218
- }
1219
- return mom;
1220
- }
1221
- function getRange(min, max, step) {
1222
- if (step === void 0) { step = 1; }
1223
- var arr = [];
1224
- for (var i = min; i <= max; i += step) {
1225
- arr.push(i);
1226
- }
1227
- return arr;
1228
- }
1229
- function repeatCount(count, iterator) {
1230
- var result = [];
1231
- var index = 0;
1232
- while (count--) {
1233
- result.push(iterator(index++));
1234
- }
1235
- return result;
1236
- }
1237
- function isNumeric(value) {
1238
- if (typeof value === 'number') {
1239
- return true;
1240
- }
1241
- return /^[-+]?(?:\d*[.])?\d+$/.test(value);
1242
- }
1243
- /**
1244
- * 获取URL链接中的query参数(包含hash mode)
1245
- *
1246
- * @param location Location对象,或者类Location结构的对象
1247
- */
1248
- function parseQuery(location) {
1249
- var _a, _b;
1250
- var query = (location && !(location instanceof Location) && (location === null || location === void 0 ? void 0 : location.query)) ||
1251
- (location && (location === null || location === void 0 ? void 0 : location.search) && qsparse(location.search.substring(1))) ||
1252
- (window.location.search && qsparse(window.location.search.substring(1)));
1253
- /* 处理hash中的query */
1254
- var hashQuery = ((_a = window.location) === null || _a === void 0 ? void 0 : _a.hash) && typeof ((_b = window.location) === null || _b === void 0 ? void 0 : _b.hash) === 'string'
1255
- ? qsparse(window.location.hash.replace(/^#.*\?/gi, ''))
1256
- : {};
1257
- var normalizedQuery = isPlainObject(query) ? query : {};
1258
- return merge(normalizedQuery, hashQuery);
1259
- }
1260
-
1261
- export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter };