form-render-v3 3.0.0-alpha.1

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 (369) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +126 -0
  3. package/es/derivative/SearchForm/ActionView.d.ts +3 -0
  4. package/es/derivative/SearchForm/ActionView.js +72 -0
  5. package/es/derivative/SearchForm/index.css +31 -0
  6. package/es/derivative/SearchForm/index.d.ts +5 -0
  7. package/es/derivative/SearchForm/index.js +294 -0
  8. package/es/derivative/SlimRender/index.d.ts +3 -0
  9. package/es/derivative/SlimRender/index.js +6 -0
  10. package/es/form-core/connectForm.d.ts +3 -0
  11. package/es/form-core/connectForm.js +12 -0
  12. package/es/form-core/index.css +19 -0
  13. package/es/form-core/index.d.ts +5 -0
  14. package/es/form-core/index.js +305 -0
  15. package/es/index.d.ts +10 -0
  16. package/es/index.js +10 -0
  17. package/es/locales/en_US.d.ts +28 -0
  18. package/es/locales/en_US.js +27 -0
  19. package/es/locales/index.d.ts +57 -0
  20. package/es/locales/index.js +6 -0
  21. package/es/locales/zh_CN.d.ts +28 -0
  22. package/es/locales/zh_CN.js +27 -0
  23. package/es/models/bindValues.d.ts +2 -0
  24. package/es/models/bindValues.js +172 -0
  25. package/es/models/context.d.ts +3 -0
  26. package/es/models/context.js +3 -0
  27. package/es/models/expression.d.ts +7 -0
  28. package/es/models/expression.js +135 -0
  29. package/es/models/fieldShouldUpdate.d.ts +2 -0
  30. package/es/models/fieldShouldUpdate.js +70 -0
  31. package/es/models/filterValuesHidden.d.ts +5 -0
  32. package/es/models/filterValuesHidden.js +61 -0
  33. package/es/models/filterValuesUndefined.d.ts +2 -0
  34. package/es/models/filterValuesUndefined.js +47 -0
  35. package/es/models/flattenSchema.d.ts +3 -0
  36. package/es/models/flattenSchema.js +91 -0
  37. package/es/models/formCoreUtils.d.ts +8 -0
  38. package/es/models/formCoreUtils.js +190 -0
  39. package/es/models/formDataSkeleton.d.ts +1 -0
  40. package/es/models/formDataSkeleton.js +31 -0
  41. package/es/models/layout.d.ts +4 -0
  42. package/es/models/layout.js +88 -0
  43. package/es/models/mapping.d.ts +89 -0
  44. package/es/models/mapping.js +119 -0
  45. package/es/models/sortProperties.d.ts +2 -0
  46. package/es/models/sortProperties.js +41 -0
  47. package/es/models/store.d.ts +10 -0
  48. package/es/models/store.js +22 -0
  49. package/es/models/transformProps.d.ts +34 -0
  50. package/es/models/transformProps.js +80 -0
  51. package/es/models/useForm.d.ts +3 -0
  52. package/es/models/useForm.js +322 -0
  53. package/es/models/validateMessage.d.ts +93 -0
  54. package/es/models/validateMessage.js +95 -0
  55. package/es/models/validates.d.ts +3 -0
  56. package/es/models/validates.js +201 -0
  57. package/es/render-core/FieldItem/field.d.ts +3 -0
  58. package/es/render-core/FieldItem/field.js +81 -0
  59. package/es/render-core/FieldItem/index.d.ts +3 -0
  60. package/es/render-core/FieldItem/index.js +54 -0
  61. package/es/render-core/FieldItem/main.d.ts +3 -0
  62. package/es/render-core/FieldItem/main.js +228 -0
  63. package/es/render-core/FieldItem/module.d.ts +18 -0
  64. package/es/render-core/FieldItem/module.js +337 -0
  65. package/es/render-core/FieldList/field.d.ts +3 -0
  66. package/es/render-core/FieldList/field.js +300 -0
  67. package/es/render-core/FieldList/index.d.ts +3 -0
  68. package/es/render-core/FieldList/index.js +44 -0
  69. package/es/render-core/FieldList/main.d.ts +3 -0
  70. package/es/render-core/FieldList/main.js +99 -0
  71. package/es/render-core/FieldList/modules.d.ts +7 -0
  72. package/es/render-core/FieldList/modules.js +108 -0
  73. package/es/render-core/index.css +29 -0
  74. package/es/render-core/index.d.ts +9 -0
  75. package/es/render-core/index.js +85 -0
  76. package/es/type.d.ts +405 -0
  77. package/es/type.js +1 -0
  78. package/es/utils/index.d.ts +75 -0
  79. package/es/utils/index.js +120 -0
  80. package/es/widgets/ErrorSchema/index.d.ts +3 -0
  81. package/es/widgets/ErrorSchema/index.js +14 -0
  82. package/es/widgets/boxCollapse/index.css +53 -0
  83. package/es/widgets/boxCollapse/index.d.ts +18 -0
  84. package/es/widgets/boxCollapse/index.js +70 -0
  85. package/es/widgets/boxLineTitle/index.css +18 -0
  86. package/es/widgets/boxLineTitle/index.d.ts +8 -0
  87. package/es/widgets/boxLineTitle/index.js +23 -0
  88. package/es/widgets/boxSubInline/index.css +11 -0
  89. package/es/widgets/boxSubInline/index.d.ts +4 -0
  90. package/es/widgets/boxSubInline/index.js +56 -0
  91. package/es/widgets/boxcard/index.css +17 -0
  92. package/es/widgets/boxcard/index.d.ts +8 -0
  93. package/es/widgets/boxcard/index.js +20 -0
  94. package/es/widgets/components/DatePicker/index.d.ts +3 -0
  95. package/es/widgets/components/DatePicker/index.js +15 -0
  96. package/es/widgets/components/FButton/index.d.ts +3 -0
  97. package/es/widgets/components/FButton/index.js +24 -0
  98. package/es/widgets/components/HeaderTitle/index.css +0 -0
  99. package/es/widgets/components/HeaderTitle/index.d.ts +4 -0
  100. package/es/widgets/components/HeaderTitle/index.js +14 -0
  101. package/es/widgets/components/PanelView/index.css +6 -0
  102. package/es/widgets/components/PanelView/index.d.ts +4 -0
  103. package/es/widgets/components/PanelView/index.js +13 -0
  104. package/es/widgets/components/TimePicker/index.d.ts +2 -0
  105. package/es/widgets/components/TimePicker/index.js +18 -0
  106. package/es/widgets/fields/checkbox/index.d.ts +3 -0
  107. package/es/widgets/fields/checkbox/index.js +15 -0
  108. package/es/widgets/fields/checkboxes/index.d.ts +3 -0
  109. package/es/widgets/fields/checkboxes/index.js +31 -0
  110. package/es/widgets/fields/date/index.d.ts +3 -0
  111. package/es/widgets/fields/date/index.js +45 -0
  112. package/es/widgets/fields/dateRange/index.d.ts +7 -0
  113. package/es/widgets/fields/dateRange/index.js +64 -0
  114. package/es/widgets/fields/html/index.d.ts +2 -0
  115. package/es/widgets/fields/html/index.js +53 -0
  116. package/es/widgets/fields/imageInput/index.css +7 -0
  117. package/es/widgets/fields/imageInput/index.d.ts +4 -0
  118. package/es/widgets/fields/imageInput/index.js +38 -0
  119. package/es/widgets/fields/input/index.d.ts +2 -0
  120. package/es/widgets/fields/input/index.js +4 -0
  121. package/es/widgets/fields/number/index.d.ts +2 -0
  122. package/es/widgets/fields/number/index.js +4 -0
  123. package/es/widgets/fields/percentSlider/index.d.ts +17 -0
  124. package/es/widgets/fields/percentSlider/index.js +82 -0
  125. package/es/widgets/fields/radio/index.d.ts +3 -0
  126. package/es/widgets/fields/radio/index.js +31 -0
  127. package/es/widgets/fields/rate/index.d.ts +2 -0
  128. package/es/widgets/fields/rate/index.js +4 -0
  129. package/es/widgets/fields/select/index.d.ts +2 -0
  130. package/es/widgets/fields/select/index.js +4 -0
  131. package/es/widgets/fields/slider/index.css +5 -0
  132. package/es/widgets/fields/slider/index.d.ts +7 -0
  133. package/es/widgets/fields/slider/index.js +58 -0
  134. package/es/widgets/fields/switch/index.d.ts +2 -0
  135. package/es/widgets/fields/switch/index.js +4 -0
  136. package/es/widgets/fields/textArea/index.d.ts +3 -0
  137. package/es/widgets/fields/textArea/index.js +14 -0
  138. package/es/widgets/fields/time/index.d.ts +3 -0
  139. package/es/widgets/fields/time/index.js +29 -0
  140. package/es/widgets/fields/timeRange/index.d.ts +9 -0
  141. package/es/widgets/fields/timeRange/index.js +48 -0
  142. package/es/widgets/fields/treeSelect/index.d.ts +2 -0
  143. package/es/widgets/fields/treeSelect/index.js +4 -0
  144. package/es/widgets/fields/upload/index.css +28 -0
  145. package/es/widgets/fields/upload/index.d.ts +13 -0
  146. package/es/widgets/fields/upload/index.js +57 -0
  147. package/es/widgets/fields/urlInput/index.d.ts +3 -0
  148. package/es/widgets/fields/urlInput/index.js +63 -0
  149. package/es/widgets/index.d.ts +33 -0
  150. package/es/widgets/index.js +33 -0
  151. package/es/widgets/listCard/index.css +20 -0
  152. package/es/widgets/listCard/index.d.ts +4 -0
  153. package/es/widgets/listCard/index.js +141 -0
  154. package/es/widgets/listDrawer/drawerForm.d.ts +3 -0
  155. package/es/widgets/listDrawer/drawerForm.js +40 -0
  156. package/es/widgets/listDrawer/index.css +16 -0
  157. package/es/widgets/listDrawer/index.d.ts +12 -0
  158. package/es/widgets/listDrawer/index.js +288 -0
  159. package/es/widgets/listSimple/index.css +27 -0
  160. package/es/widgets/listSimple/index.d.ts +4 -0
  161. package/es/widgets/listSimple/index.js +124 -0
  162. package/es/widgets/listTab/index.css +0 -0
  163. package/es/widgets/listTab/index.d.ts +13 -0
  164. package/es/widgets/listTab/index.js +113 -0
  165. package/es/widgets/listTable/index.css +28 -0
  166. package/es/widgets/listTable/index.d.ts +14 -0
  167. package/es/widgets/listTable/index.js +227 -0
  168. package/es/widgets/listTable/tableCell.d.ts +3 -0
  169. package/es/widgets/listTable/tableCell.js +62 -0
  170. package/es/widgets/listVirtual/index.css +28 -0
  171. package/es/widgets/listVirtual/index.d.ts +14 -0
  172. package/es/widgets/listVirtual/index.js +213 -0
  173. package/es/widgets/listVirtual/virtualCell.d.ts +3 -0
  174. package/es/widgets/listVirtual/virtualCell.js +61 -0
  175. package/es/widgets/utils/hooks.d.ts +2 -0
  176. package/es/widgets/utils/hooks.js +14 -0
  177. package/es/widgets/utils/index.d.ts +4 -0
  178. package/es/widgets/utils/index.js +80 -0
  179. package/es/widgets/utils/withFieldWrap.d.ts +3 -0
  180. package/es/widgets/utils/withFieldWrap.js +17 -0
  181. package/es/widgets/voidTitle/index.css +7 -0
  182. package/es/widgets/voidTitle/index.d.ts +6 -0
  183. package/es/widgets/voidTitle/index.js +13 -0
  184. package/es/withProvider.d.ts +3 -0
  185. package/es/withProvider.js +70 -0
  186. package/lib/derivative/SearchForm/ActionView.d.ts +3 -0
  187. package/lib/derivative/SearchForm/ActionView.js +81 -0
  188. package/lib/derivative/SearchForm/index.css +31 -0
  189. package/lib/derivative/SearchForm/index.d.ts +5 -0
  190. package/lib/derivative/SearchForm/index.js +302 -0
  191. package/lib/derivative/SlimRender/index.d.ts +3 -0
  192. package/lib/derivative/SlimRender/index.js +13 -0
  193. package/lib/form-core/connectForm.d.ts +3 -0
  194. package/lib/form-core/connectForm.js +21 -0
  195. package/lib/form-core/index.css +19 -0
  196. package/lib/form-core/index.d.ts +5 -0
  197. package/lib/form-core/index.js +313 -0
  198. package/lib/index.d.ts +10 -0
  199. package/lib/index.js +66 -0
  200. package/lib/locales/en_US.d.ts +28 -0
  201. package/lib/locales/en_US.js +33 -0
  202. package/lib/locales/index.d.ts +57 -0
  203. package/lib/locales/index.js +13 -0
  204. package/lib/locales/zh_CN.d.ts +28 -0
  205. package/lib/locales/zh_CN.js +33 -0
  206. package/lib/models/bindValues.d.ts +2 -0
  207. package/lib/models/bindValues.js +178 -0
  208. package/lib/models/context.d.ts +3 -0
  209. package/lib/models/context.js +9 -0
  210. package/lib/models/expression.d.ts +7 -0
  211. package/lib/models/expression.js +141 -0
  212. package/lib/models/fieldShouldUpdate.d.ts +2 -0
  213. package/lib/models/fieldShouldUpdate.js +76 -0
  214. package/lib/models/filterValuesHidden.d.ts +5 -0
  215. package/lib/models/filterValuesHidden.js +67 -0
  216. package/lib/models/filterValuesUndefined.d.ts +2 -0
  217. package/lib/models/filterValuesUndefined.js +53 -0
  218. package/lib/models/flattenSchema.d.ts +3 -0
  219. package/lib/models/flattenSchema.js +100 -0
  220. package/lib/models/formCoreUtils.d.ts +8 -0
  221. package/lib/models/formCoreUtils.js +199 -0
  222. package/lib/models/formDataSkeleton.d.ts +1 -0
  223. package/lib/models/formDataSkeleton.js +36 -0
  224. package/lib/models/layout.d.ts +4 -0
  225. package/lib/models/layout.js +94 -0
  226. package/lib/models/mapping.d.ts +89 -0
  227. package/lib/models/mapping.js +127 -0
  228. package/lib/models/sortProperties.d.ts +2 -0
  229. package/lib/models/sortProperties.js +47 -0
  230. package/lib/models/store.d.ts +10 -0
  231. package/lib/models/store.js +28 -0
  232. package/lib/models/transformProps.d.ts +34 -0
  233. package/lib/models/transformProps.js +86 -0
  234. package/lib/models/useForm.d.ts +3 -0
  235. package/lib/models/useForm.js +329 -0
  236. package/lib/models/validateMessage.d.ts +93 -0
  237. package/lib/models/validateMessage.js +101 -0
  238. package/lib/models/validates.d.ts +3 -0
  239. package/lib/models/validates.js +208 -0
  240. package/lib/render-core/FieldItem/field.d.ts +3 -0
  241. package/lib/render-core/FieldItem/field.js +90 -0
  242. package/lib/render-core/FieldItem/index.d.ts +3 -0
  243. package/lib/render-core/FieldItem/index.js +63 -0
  244. package/lib/render-core/FieldItem/main.d.ts +3 -0
  245. package/lib/render-core/FieldItem/main.js +236 -0
  246. package/lib/render-core/FieldItem/module.d.ts +18 -0
  247. package/lib/render-core/FieldItem/module.js +343 -0
  248. package/lib/render-core/FieldList/field.d.ts +3 -0
  249. package/lib/render-core/FieldList/field.js +309 -0
  250. package/lib/render-core/FieldList/index.d.ts +3 -0
  251. package/lib/render-core/FieldList/index.js +53 -0
  252. package/lib/render-core/FieldList/main.d.ts +3 -0
  253. package/lib/render-core/FieldList/main.js +108 -0
  254. package/lib/render-core/FieldList/modules.d.ts +7 -0
  255. package/lib/render-core/FieldList/modules.js +115 -0
  256. package/lib/render-core/index.css +29 -0
  257. package/lib/render-core/index.d.ts +9 -0
  258. package/lib/render-core/index.js +92 -0
  259. package/lib/type.d.ts +405 -0
  260. package/lib/type.js +7 -0
  261. package/lib/utils/index.d.ts +75 -0
  262. package/lib/utils/index.js +142 -0
  263. package/lib/widgets/ErrorSchema/index.d.ts +3 -0
  264. package/lib/widgets/ErrorSchema/index.js +23 -0
  265. package/lib/widgets/boxCollapse/index.css +53 -0
  266. package/lib/widgets/boxCollapse/index.d.ts +18 -0
  267. package/lib/widgets/boxCollapse/index.js +79 -0
  268. package/lib/widgets/boxLineTitle/index.css +18 -0
  269. package/lib/widgets/boxLineTitle/index.d.ts +8 -0
  270. package/lib/widgets/boxLineTitle/index.js +30 -0
  271. package/lib/widgets/boxSubInline/index.css +11 -0
  272. package/lib/widgets/boxSubInline/index.d.ts +4 -0
  273. package/lib/widgets/boxSubInline/index.js +63 -0
  274. package/lib/widgets/boxcard/index.css +17 -0
  275. package/lib/widgets/boxcard/index.d.ts +8 -0
  276. package/lib/widgets/boxcard/index.js +27 -0
  277. package/lib/widgets/components/DatePicker/index.d.ts +3 -0
  278. package/lib/widgets/components/DatePicker/index.js +22 -0
  279. package/lib/widgets/components/FButton/index.d.ts +3 -0
  280. package/lib/widgets/components/FButton/index.js +31 -0
  281. package/lib/widgets/components/HeaderTitle/index.css +0 -0
  282. package/lib/widgets/components/HeaderTitle/index.d.ts +4 -0
  283. package/lib/widgets/components/HeaderTitle/index.js +21 -0
  284. package/lib/widgets/components/PanelView/index.css +6 -0
  285. package/lib/widgets/components/PanelView/index.d.ts +4 -0
  286. package/lib/widgets/components/PanelView/index.js +20 -0
  287. package/lib/widgets/components/TimePicker/index.d.ts +2 -0
  288. package/lib/widgets/components/TimePicker/index.js +27 -0
  289. package/lib/widgets/fields/checkbox/index.d.ts +3 -0
  290. package/lib/widgets/fields/checkbox/index.js +22 -0
  291. package/lib/widgets/fields/checkboxes/index.d.ts +3 -0
  292. package/lib/widgets/fields/checkboxes/index.js +38 -0
  293. package/lib/widgets/fields/date/index.d.ts +3 -0
  294. package/lib/widgets/fields/date/index.js +54 -0
  295. package/lib/widgets/fields/dateRange/index.d.ts +7 -0
  296. package/lib/widgets/fields/dateRange/index.js +74 -0
  297. package/lib/widgets/fields/html/index.d.ts +2 -0
  298. package/lib/widgets/fields/html/index.js +60 -0
  299. package/lib/widgets/fields/imageInput/index.css +7 -0
  300. package/lib/widgets/fields/imageInput/index.d.ts +4 -0
  301. package/lib/widgets/fields/imageInput/index.js +47 -0
  302. package/lib/widgets/fields/input/index.d.ts +2 -0
  303. package/lib/widgets/fields/input/index.js +11 -0
  304. package/lib/widgets/fields/number/index.d.ts +2 -0
  305. package/lib/widgets/fields/number/index.js +11 -0
  306. package/lib/widgets/fields/percentSlider/index.d.ts +17 -0
  307. package/lib/widgets/fields/percentSlider/index.js +91 -0
  308. package/lib/widgets/fields/radio/index.d.ts +3 -0
  309. package/lib/widgets/fields/radio/index.js +38 -0
  310. package/lib/widgets/fields/rate/index.d.ts +2 -0
  311. package/lib/widgets/fields/rate/index.js +11 -0
  312. package/lib/widgets/fields/select/index.d.ts +2 -0
  313. package/lib/widgets/fields/select/index.js +11 -0
  314. package/lib/widgets/fields/slider/index.css +5 -0
  315. package/lib/widgets/fields/slider/index.d.ts +7 -0
  316. package/lib/widgets/fields/slider/index.js +66 -0
  317. package/lib/widgets/fields/switch/index.d.ts +2 -0
  318. package/lib/widgets/fields/switch/index.js +11 -0
  319. package/lib/widgets/fields/textArea/index.d.ts +3 -0
  320. package/lib/widgets/fields/textArea/index.js +21 -0
  321. package/lib/widgets/fields/time/index.d.ts +3 -0
  322. package/lib/widgets/fields/time/index.js +36 -0
  323. package/lib/widgets/fields/timeRange/index.d.ts +9 -0
  324. package/lib/widgets/fields/timeRange/index.js +54 -0
  325. package/lib/widgets/fields/treeSelect/index.d.ts +2 -0
  326. package/lib/widgets/fields/treeSelect/index.js +11 -0
  327. package/lib/widgets/fields/upload/index.css +28 -0
  328. package/lib/widgets/fields/upload/index.d.ts +13 -0
  329. package/lib/widgets/fields/upload/index.js +66 -0
  330. package/lib/widgets/fields/urlInput/index.d.ts +3 -0
  331. package/lib/widgets/fields/urlInput/index.js +72 -0
  332. package/lib/widgets/index.d.ts +33 -0
  333. package/lib/widgets/index.js +236 -0
  334. package/lib/widgets/listCard/index.css +20 -0
  335. package/lib/widgets/listCard/index.d.ts +4 -0
  336. package/lib/widgets/listCard/index.js +148 -0
  337. package/lib/widgets/listDrawer/drawerForm.d.ts +3 -0
  338. package/lib/widgets/listDrawer/drawerForm.js +49 -0
  339. package/lib/widgets/listDrawer/index.css +16 -0
  340. package/lib/widgets/listDrawer/index.d.ts +12 -0
  341. package/lib/widgets/listDrawer/index.js +296 -0
  342. package/lib/widgets/listSimple/index.css +27 -0
  343. package/lib/widgets/listSimple/index.d.ts +4 -0
  344. package/lib/widgets/listSimple/index.js +131 -0
  345. package/lib/widgets/listTab/index.css +0 -0
  346. package/lib/widgets/listTab/index.d.ts +13 -0
  347. package/lib/widgets/listTab/index.js +122 -0
  348. package/lib/widgets/listTable/index.css +28 -0
  349. package/lib/widgets/listTable/index.d.ts +14 -0
  350. package/lib/widgets/listTable/index.js +234 -0
  351. package/lib/widgets/listTable/tableCell.d.ts +3 -0
  352. package/lib/widgets/listTable/tableCell.js +71 -0
  353. package/lib/widgets/listVirtual/index.css +28 -0
  354. package/lib/widgets/listVirtual/index.d.ts +14 -0
  355. package/lib/widgets/listVirtual/index.js +220 -0
  356. package/lib/widgets/listVirtual/virtualCell.d.ts +3 -0
  357. package/lib/widgets/listVirtual/virtualCell.js +70 -0
  358. package/lib/widgets/utils/hooks.d.ts +2 -0
  359. package/lib/widgets/utils/hooks.js +21 -0
  360. package/lib/widgets/utils/index.d.ts +4 -0
  361. package/lib/widgets/utils/index.js +89 -0
  362. package/lib/widgets/utils/withFieldWrap.d.ts +3 -0
  363. package/lib/widgets/utils/withFieldWrap.js +24 -0
  364. package/lib/widgets/voidTitle/index.css +7 -0
  365. package/lib/widgets/voidTitle/index.d.ts +6 -0
  366. package/lib/widgets/voidTitle/index.js +20 -0
  367. package/lib/withProvider.d.ts +3 -0
  368. package/lib/withProvider.js +79 -0
  369. package/package.json +64 -0
@@ -0,0 +1,172 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
6
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
8
+ function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
12
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
13
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
14
+ import { get, set, unset } from 'lodash-es';
15
+ import { _cloneDeep, isArray, isObject, safeGet } from '../utils/index';
16
+ var isMultiBind = function isMultiBind(array) {
17
+ return isArray(array) && array.every(function (item) {
18
+ return typeof item === 'string';
19
+ });
20
+ };
21
+ // Need to consider list nested controls
22
+ var transformPath = function transformPath(path) {
23
+ var result = [];
24
+ var _recursion = function recursion(str) {
25
+ var index = str.indexOf('[]');
26
+ if (index === -1) {
27
+ result.push(str);
28
+ return;
29
+ }
30
+ result.push(str.substring(0, index));
31
+ _recursion(str.substring(index + 3));
32
+ };
33
+ _recursion(path);
34
+ if (result.length === 1) {
35
+ return result[0];
36
+ }
37
+ return result;
38
+ };
39
+ var transformValueToBind = function transformValueToBind(data, path, bind) {
40
+ if (bind === false) {
41
+ unset(data, path);
42
+ return;
43
+ }
44
+ if (typeof bind === 'string') {
45
+ var value = get(data, path);
46
+ var preValue = get(data, bind);
47
+ if (isObject(preValue)) {
48
+ value = Object.assign(Object.assign({}, preValue), value);
49
+ }
50
+ set(data, bind, value);
51
+ unset(data, path);
52
+ return;
53
+ }
54
+ // The array is converted to multiple fields.
55
+ if (isMultiBind(bind)) {
56
+ var _value = get(data, path);
57
+ unset(data, path);
58
+ if (Array.isArray(_value)) {
59
+ _value.forEach(function (item, index) {
60
+ var bindPath = bind[index];
61
+ bindPath && set(data, bindPath, item);
62
+ });
63
+ }
64
+ }
65
+ };
66
+ var transformBindToValue = function transformBindToValue(data, path, bind) {
67
+ if (typeof bind === 'string') {
68
+ var value = get(data, bind);
69
+ var preValue = get(data, path);
70
+ if (isObject(preValue)) {
71
+ value = Object.assign(Object.assign({}, preValue), value);
72
+ }
73
+ set(data, path, value);
74
+ unset(data, bind);
75
+ return;
76
+ }
77
+ // The array is converted to multiple fields.
78
+ if (isMultiBind(bind)) {
79
+ var _value2 = [];
80
+ bind.forEach(function (key) {
81
+ var bindValue = get(data, key);
82
+ // if (bindValue != undefined) {
83
+ // value.push(bindValue);
84
+ // }
85
+ _value2.push(bindValue);
86
+ unset(data, key);
87
+ });
88
+ if (_value2.length > 0) {
89
+ set(data, path, _value2);
90
+ }
91
+ }
92
+ };
93
+ export var parseValuesToBind = function parseValuesToBind(values, flatten) {
94
+ // No bind field exists, no processing
95
+ if (!JSON.stringify(flatten).includes('bind')) {
96
+ return values;
97
+ }
98
+ var data = _cloneDeep(values);
99
+ var _dealFieldList = function dealFieldList(obj, _ref, bind) {
100
+ var _ref2 = _toArray(_ref),
101
+ path = _ref2[0],
102
+ rest = _arrayLikeToArray(_ref2).slice(1);
103
+ if (rest.length === 1) {
104
+ var list = get(obj, path, []) || [];
105
+ list.forEach(function (item, index) {
106
+ var value = get(item, rest[0]);
107
+ if (bind === 'root') {
108
+ list[index] = value;
109
+ return;
110
+ }
111
+ transformValueToBind(item, rest[0], bind);
112
+ });
113
+ }
114
+ if (isArray(obj)) {
115
+ obj.forEach(function (item) {
116
+ return _dealFieldList(item, [path].concat(_toConsumableArray(rest)), bind);
117
+ });
118
+ } else if (isObject(obj)) {
119
+ var value = get(obj, path);
120
+ _dealFieldList(value, rest, bind);
121
+ }
122
+ };
123
+ Object.keys(flatten).forEach(function (key) {
124
+ var _a, _b;
125
+ var bind = (_b = (_a = flatten[key]) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b.bind;
126
+ if (bind === undefined) {
127
+ return;
128
+ }
129
+ var path = transformPath(key);
130
+ isArray(path) ? _dealFieldList(data, path, bind) : transformValueToBind(data, path, bind);
131
+ });
132
+ return data;
133
+ };
134
+ export var parseBindToValues = function parseBindToValues(values, flatten) {
135
+ if (!JSON.stringify(flatten).includes('bind')) {
136
+ return values;
137
+ }
138
+ var data = _cloneDeep(values);
139
+ var _dealFieldList2 = function dealFieldList(obj, _ref3, bind) {
140
+ var _ref4 = _toArray(_ref3),
141
+ path = _ref4[0],
142
+ rest = _arrayLikeToArray(_ref4).slice(1);
143
+ if (rest.length === 1) {
144
+ var list = safeGet(obj, path, []);
145
+ list.forEach(function (item, index) {
146
+ if (bind === 'root') {
147
+ list[index] = _defineProperty({}, rest[0], item);
148
+ return;
149
+ }
150
+ transformBindToValue(item, rest[0], bind);
151
+ });
152
+ }
153
+ if (isArray(obj)) {
154
+ obj.forEach(function (item) {
155
+ return _dealFieldList2(item, [path].concat(_toConsumableArray(rest)), bind);
156
+ });
157
+ } else if (isObject(obj)) {
158
+ var value = get(obj, path);
159
+ _dealFieldList2(value, rest, bind);
160
+ }
161
+ };
162
+ Object.keys(flatten).forEach(function (key) {
163
+ var _a, _b;
164
+ var bind = (_b = (_a = flatten[key]) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b.bind;
165
+ if (bind === undefined) {
166
+ return;
167
+ }
168
+ var path = transformPath(key);
169
+ isArray(path) ? _dealFieldList2(data, path, bind) : transformBindToValue(data, path, bind);
170
+ });
171
+ return data;
172
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const FRContext: import("react").Context<any>;
3
+ export declare const ConfigContext: import("react").Context<any>;
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+ export var FRContext = /*#__PURE__*/createContext(null);
3
+ export var ConfigContext = /*#__PURE__*/createContext(null);
@@ -0,0 +1,7 @@
1
+ export declare const isExpression: (str: string) => boolean;
2
+ export declare const isHasExpression: (schema: any) => boolean;
3
+ export declare const parseExpression: (func: any, formData: {}, parentPath: string | [
4
+ ]) => any;
5
+ export declare function getRealDataPath(path: any): string;
6
+ export declare function getValueByPath(formData: any, path: any): any;
7
+ export declare const parseAllExpression: (_schema: any, _formData: any, dataPath: string, formSchema?: any) => any;
@@ -0,0 +1,135 @@
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ import { get } from 'lodash-es';
8
+ import { isObject, _cloneDeep, isArray } from '../utils/index';
9
+ import { createDataSkeleton } from './formDataSkeleton';
10
+ export var isExpression = function isExpression(str) {
11
+ if (typeof str !== 'string') {
12
+ return false;
13
+ }
14
+ var pattern = /^{\s*{([^]+)}\s*}$/;
15
+ var reg1 = /^{\s*{function\(.+}\s*}$/;
16
+ return str.match(pattern) && !str.match(reg1);
17
+ };
18
+ var _isHasExpression = function isHasExpression(schema) {
19
+ var result = Object.keys(schema).some(function (key) {
20
+ var item = schema[key];
21
+ // 子协议不做递归确认
22
+ if (key === 'properties') {
23
+ return false;
24
+ }
25
+ var _recursionArray = function recursionArray(list) {
26
+ var result = list.some(function (ite) {
27
+ if (isArray(ite)) {
28
+ return _recursionArray(ite);
29
+ }
30
+ if (isObject(ite)) {
31
+ return _isHasExpression(ite);
32
+ }
33
+ return isExpression(ite);
34
+ });
35
+ return result;
36
+ };
37
+ if (isArray(item)) {
38
+ return _recursionArray(item);
39
+ }
40
+ if (isObject(item)) {
41
+ return _isHasExpression(item);
42
+ }
43
+ return isExpression(item);
44
+ });
45
+ return result;
46
+ };
47
+ export { _isHasExpression as isHasExpression };
48
+ var parseFunc = function parseFunc(funcBody) {
49
+ var funcBodyTemp = funcBody.replace(/(\.|\?\.)/g, '?.'); // 将. 和 ?. 统一替换为?.
50
+ var funcBodyStr = funcBodyTemp.replace(/(\d+)\?\.(\d+)/g, '$1.$2'); // 排除数字中的?.
51
+ var result = _toConsumableArray(funcBodyStr).reduce(function (acc, char, index) {
52
+ if (char === '[') {
53
+ if (index > 0 && funcBodyStr[index - 1] !== '\n') {
54
+ // 排除开头[]
55
+ return "".concat(acc, "?.").concat(char);
56
+ }
57
+ }
58
+ return "".concat(acc).concat(char);
59
+ }, '');
60
+ return result;
61
+ };
62
+ export var parseExpression = function parseExpression(func) {
63
+ var formData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
64
+ var parentPath = arguments.length > 2 ? arguments[2] : undefined;
65
+ var parentData = get(formData, parentPath) || {};
66
+ if (typeof func === 'string') {
67
+ var funcBody = func.replace(/^{\s*{/g, '').replace(/}\s*}$/g, '').trim();
68
+ var isHandleData = (funcBody === null || funcBody === void 0 ? void 0 : funcBody.startsWith('formData')) || (funcBody === null || funcBody === void 0 ? void 0 : funcBody.startsWith('rootValue'));
69
+ var funcBodyStr = isHandleData ? parseFunc(funcBody) : funcBody;
70
+ var funcStr = "\n return ".concat(funcBodyStr.replace(/formData/g, JSON.stringify(formData)).replace(/rootValue/g, JSON.stringify(parentData)), "\n ");
71
+ try {
72
+ var result = Function(funcStr)();
73
+ return result;
74
+ } catch (error) {
75
+ console.log(error, funcStr, parentPath);
76
+ return null; // 如果计算有错误,return null 最合适
77
+ }
78
+ }
79
+ return func;
80
+ };
81
+ export function getRealDataPath(path) {
82
+ if (typeof path !== 'string') {
83
+ throw Error("id ".concat(path, " is not a string!!! Something wrong here"));
84
+ }
85
+ if (path.match(/[$]void_[^.]+$/)) {
86
+ return undefined;
87
+ }
88
+ return path.replace(/[$]void_[^.]+./g, '');
89
+ }
90
+ export function getValueByPath(formData, path) {
91
+ if (path === '#' || !path) {
92
+ return formData || {};
93
+ } else if (typeof path === 'string') {
94
+ var realPath = getRealDataPath(path);
95
+ return realPath && get(formData, realPath);
96
+ } else {
97
+ console.error('path has to be a string');
98
+ }
99
+ }
100
+ var _parseAllExpression = function parseAllExpression(_schema, _formData, dataPath, formSchema) {
101
+ var schema = _cloneDeep(_schema);
102
+ var formData = _formData;
103
+ if (formSchema) {
104
+ formData = createDataSkeleton(formSchema, formData);
105
+ }
106
+ var _recursionArray2 = function recursionArray(list) {
107
+ var result = list.map(function (item) {
108
+ if (isArray(item)) {
109
+ return _recursionArray2(item);
110
+ }
111
+ if (isObject(item)) {
112
+ return _parseAllExpression(item, formData, dataPath);
113
+ }
114
+ if (isExpression(item)) {
115
+ return parseExpression(item, formData, dataPath);
116
+ }
117
+ return item;
118
+ });
119
+ return result;
120
+ };
121
+ Object.keys(schema).forEach(function (key) {
122
+ var _a;
123
+ var value = schema[key];
124
+ if (isArray(value)) {
125
+ schema[key] = _recursionArray2(value);
126
+ }
127
+ if (isObject(value) && ((_a = value.mustacheParse) !== null && _a !== void 0 ? _a : true)) {
128
+ schema[key] = _parseAllExpression(value, formData, dataPath);
129
+ } else if (isExpression(value)) {
130
+ schema[key] = parseExpression(value, formData, dataPath);
131
+ }
132
+ });
133
+ return schema;
134
+ };
135
+ export { _parseAllExpression as parseAllExpression };
@@ -0,0 +1,2 @@
1
+ declare const _default: (str: string, dataPath: string, dependencies: any[], shouldUpdateOpen: boolean) => (preValue: any, nextValue: any) => boolean;
2
+ export default _default;
@@ -0,0 +1,70 @@
1
+ import { parseExpression } from './expression';
2
+ // 提取 formData. 开头的字符串
3
+ var extractFormDataStrings = function extractFormDataStrings(list) {
4
+ var result = [];
5
+ list.forEach(function (str) {
6
+ // TODO: 为啥要拆开来获取?
7
+ // const regex = /formData.\w+(.\w+)*(\(.*\))?/g; // 匹配formData.后面跟着字母、数字、下划线间隔的组合
8
+ // const regex = /formData(\.\w+|\[\w+\])(\.\w+|\[\w+\])*/g; // 1.同时匹配两种格式
9
+ var regex = /formData(\.\w+|\[(['"])?\w+\2?\])*(\.\w+)?/g; // 1.支持formData.xx 格式 以及formData[]格式 []中变量名只能包含字母、数字、下划线(_)
10
+ var matches = str.match(regex);
11
+ if (matches) {
12
+ result = result.concat(matches);
13
+ }
14
+ });
15
+ return result;
16
+ };
17
+ // 提取 rootValue. 开头的字符串
18
+ var extractRootValueStrings = function extractRootValueStrings(list) {
19
+ var result = [];
20
+ list.forEach(function (str) {
21
+ // const regex = /rootValue.\w+(.\w+)*(\(.*\))?/g; // 匹配formData.后面跟着字母、数字、下划线间隔的组合
22
+ // const regex = /rootValue(\.\w+|\[\w+\])(\.\w+|\[\w+\])*/g; // 1.同时匹配两种格式
23
+ var regex = /rootValue(\.\w+|\[(['"])?\w+\2?\])*(\.\w+)?/g; // 1.支持rootValue.xx 格式 以及rootValue[]格式 []中变量名只能包含字母、数字、下划线(_)
24
+ var matches = str.match(regex);
25
+ if (matches) {
26
+ result = result.concat(matches);
27
+ }
28
+ });
29
+ return result;
30
+ };
31
+ // 提取 {{ }} 里面的内容
32
+ var findStrList = function findStrList(str, type) {
33
+ var regex = /{{(.*?)}}/g;
34
+ var matches = [];
35
+ var match;
36
+ while ((match = regex.exec(str)) !== null) {
37
+ matches.push(match[1]);
38
+ }
39
+ ;
40
+ if (type === 'formData') {
41
+ return extractFormDataStrings(matches);
42
+ }
43
+ if (type === 'rootValue') {
44
+ return extractRootValueStrings(matches);
45
+ }
46
+ return [];
47
+ };
48
+ var getListEveryResult = function getListEveryResult(list, preValue, nextValue, dataPath) {
49
+ return list.every(function (item) {
50
+ var pre = parseExpression(item, preValue, dataPath);
51
+ var curr = parseExpression(item, nextValue, dataPath);
52
+ return pre === curr;
53
+ });
54
+ };
55
+ export default (function (str, dataPath, dependencies, shouldUpdateOpen) {
56
+ return function (preValue, nextValue) {
57
+ // dependencies 先不处理
58
+ if (dependencies) {
59
+ return true;
60
+ }
61
+ var formDataList = findStrList(str, 'formData');
62
+ var rootValueList = findStrList(str, 'rootValue');
63
+ var formDataRes = getListEveryResult(formDataList, preValue, nextValue, dataPath);
64
+ var rootValueRes = getListEveryResult(rootValueList, preValue, nextValue, dataPath);
65
+ if (formDataRes && rootValueRes) {
66
+ return false;
67
+ }
68
+ return true;
69
+ };
70
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 过滤 field.schema.hidden = true,的值
3
+ */
4
+ declare const _default: (_values: any, flattenSchema: object) => any;
5
+ export default _default;
@@ -0,0 +1,61 @@
1
+ import { isObject, isArray } from '../utils';
2
+ var transformHidden = function transformHidden(str) {
3
+ var formData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4
+ var parentData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
5
+ if (typeof str !== 'string') {
6
+ return !!str;
7
+ }
8
+ var funcBody = str.replace(/^{\s*{/g, '').replace(/}\s*}$/g, '').trim();
9
+ var funcStr = "\n return ".concat(funcBody.replace(/formData/g, JSON.stringify(formData)).replace(/rootValue/g, JSON.stringify(parentData)), "\n ");
10
+ try {
11
+ var result = Function(funcStr)();
12
+ return result;
13
+ } catch (error) {
14
+ return false;
15
+ }
16
+ };
17
+ /**
18
+ * 过滤 field.schema.hidden = true,的值
19
+ */
20
+ export default (function (_values, flattenSchema) {
21
+ var recursiveArray = function recursiveArray(list, _path) {
22
+ return list.map(function (item) {
23
+ if (isObject(item)) {
24
+ return _recursiveObj(item, _path, item);
25
+ }
26
+ return item;
27
+ });
28
+ };
29
+ var _recursiveObj = function recursiveObj(obj, prePath, parentData) {
30
+ var _a, _b;
31
+ for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
32
+ var key = _Object$keys[_i];
33
+ var item = obj[key];
34
+ var path = prePath ? "".concat(prePath, ".").concat(key) : key;
35
+ var schema = (_a = flattenSchema[path]) === null || _a === void 0 ? void 0 : _a.schema;
36
+ if (isArray(item) && !schema) {
37
+ path = prePath ? "".concat(prePath, ".").concat(key, "[]") : "".concat(key, "[]");
38
+ schema = (_b = flattenSchema[path]) === null || _b === void 0 ? void 0 : _b.schema;
39
+ }
40
+ // 剔除隐藏数据
41
+ if (schema === null || schema === void 0 ? void 0 : schema.hidden) {
42
+ var hidden = transformHidden(schema.hidden, _values, parentData);
43
+ if (hidden) {
44
+ obj[key] = undefined;
45
+ continue;
46
+ }
47
+ }
48
+ if (isObject(item)) {
49
+ obj[key] = _recursiveObj(item, path, parentData);
50
+ continue;
51
+ }
52
+ if (isArray(item) && (schema === null || schema === void 0 ? void 0 : schema.items)) {
53
+ obj[key] = recursiveArray(item, path) || [];
54
+ continue;
55
+ }
56
+ obj[key] = item;
57
+ }
58
+ return obj;
59
+ };
60
+ return _recursiveObj(_values) || {};
61
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: (values: any, notFilter?: boolean) => any;
2
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { isUndefined, omitBy } from 'lodash-es';
2
+ import { isObject, isArray } from '../utils';
3
+ export default (function (values, notFilter) {
4
+ var _recursiveArray = function recursiveArray(list) {
5
+ var result = list.map(function (item) {
6
+ if (isObject(item)) {
7
+ return _recursiveObj(item, false);
8
+ }
9
+ if (isArray(item)) {
10
+ return _recursiveArray(item);
11
+ }
12
+ return item;
13
+ });
14
+ if (Object.keys(result).length === 0) {
15
+ return undefined;
16
+ }
17
+ return result;
18
+ };
19
+ var _recursiveObj = function recursiveObj(_obj) {
20
+ var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
21
+ if (_obj._isAMomentObject) {
22
+ return _obj;
23
+ }
24
+ var obj = omitBy(_obj, isUndefined);
25
+ Object.keys(obj).forEach(function (key) {
26
+ var item = obj[key];
27
+ if (isObject(item)) {
28
+ obj[key] = _recursiveObj(item);
29
+ }
30
+ if (isArray(item)) {
31
+ var data = _recursiveArray(item);
32
+ obj[key] = data;
33
+ if (!notFilter && data) {
34
+ obj[key] = data.filter(function (item) {
35
+ return item !== undefined;
36
+ });
37
+ }
38
+ }
39
+ });
40
+ obj = omitBy(obj, isUndefined);
41
+ if (Object.keys(obj).length === 0 && filter) {
42
+ return undefined;
43
+ }
44
+ return obj;
45
+ };
46
+ return _recursiveObj(values) || {};
47
+ });
@@ -0,0 +1,3 @@
1
+ export declare const getKeyFromPath: (path?: string) => string;
2
+ export declare function getSchemaFromFlatten(flatten: any, path?: string): any;
3
+ export declare function flattenSchema(_schema?: {}, name?: any, parent?: any, _result?: any): any;
@@ -0,0 +1,91 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import { _cloneDeep, isObjType, isListType } from '../utils/index';
8
+ import sortProperties from './sortProperties';
9
+ export var getKeyFromPath = function getKeyFromPath() {
10
+ var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#';
11
+ try {
12
+ var arr = path.split('.');
13
+ var last = arr.slice(-1)[0];
14
+ var result = last.replace('[]', '');
15
+ return result;
16
+ } catch (error) {
17
+ console.error(error, 'getKeyFromPath');
18
+ return '';
19
+ }
20
+ };
21
+ export function getSchemaFromFlatten(flatten) {
22
+ var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#';
23
+ var schema = {};
24
+ var item = _cloneDeep(flatten[path]);
25
+ if (!item) {
26
+ return schema;
27
+ }
28
+ schema = item.schema;
29
+ // schema.$id && delete schema.$id;
30
+ if (item.children.length > 0) {
31
+ item.children.forEach(function (child) {
32
+ if (!flatten[child]) return;
33
+ var key = getKeyFromPath(child);
34
+ if (isObjType(schema)) {
35
+ schema.properties[key] = getSchemaFromFlatten(flatten, child);
36
+ }
37
+ if (isListType(schema)) {
38
+ schema.items.properties[key] = getSchemaFromFlatten(flatten, child);
39
+ }
40
+ });
41
+ }
42
+ return schema;
43
+ }
44
+ // TODO: more tests to make sure weird & wrong schema won't crush
45
+ export function flattenSchema() {
46
+ var _schema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47
+ var name = arguments.length > 1 ? arguments[1] : undefined;
48
+ var parent = arguments.length > 2 ? arguments[2] : undefined;
49
+ var _result = arguments.length > 3 ? arguments[3] : undefined;
50
+ // 排序
51
+ // _schema = orderBy(_schema, item => item.order, ['asc']);
52
+ var result = _result || {};
53
+ var schema = _cloneDeep(_schema) || {};
54
+ var _name = name || '#';
55
+ if (!schema.$id) {
56
+ schema.$id = _name; // path as $id, for easy access to path in schema
57
+ }
58
+ var children = [];
59
+ if (isObjType(schema)) {
60
+ sortProperties(Object.entries(schema.properties)).forEach(function (_ref) {
61
+ var _ref2 = _slicedToArray(_ref, 2),
62
+ key = _ref2[0],
63
+ value = _ref2[1];
64
+ var _key = isListType(value) ? key + '[]' : key;
65
+ var uniqueName = _name === '#' ? _key : _name + '.' + _key;
66
+ children.push(uniqueName);
67
+ flattenSchema(value, uniqueName, _name, result);
68
+ });
69
+ schema.properties = {};
70
+ }
71
+ if (isListType(schema)) {
72
+ sortProperties(Object.entries(schema.items.properties)).forEach(function (_ref3) {
73
+ var _ref4 = _slicedToArray(_ref3, 2),
74
+ key = _ref4[0],
75
+ value = _ref4[1];
76
+ var _key = isListType(value) ? key + '[]' : key;
77
+ var uniqueName = _name === '#' ? _key : _name + '.' + _key;
78
+ children.push(uniqueName);
79
+ flattenSchema(value, uniqueName, _name, result);
80
+ });
81
+ schema.items.properties = {};
82
+ }
83
+ if (schema.type) {
84
+ result[_name] = {
85
+ parent: parent,
86
+ schema: schema,
87
+ children: children
88
+ };
89
+ }
90
+ return result;
91
+ }
@@ -0,0 +1,8 @@
1
+ export declare const valuesWatch: (changedValues: any, allValues: any, watch: any) => void;
2
+ export declare const transformFieldsData: (_fieldsError: any, getFieldName: any) => any;
3
+ export declare const immediateWatch: (watch: any, values: any) => void;
4
+ export declare const getSchemaFullPath: (path: string, schema: any) => string;
5
+ export declare function yymmdd(timeStamp: any): string;
6
+ export declare function msToTime(duration: any): string;
7
+ export declare const getSessionItem: (key: string) => number;
8
+ export declare const setSessionItem: (key: string, data: any) => void;