@nocobase/client 0.5.0-alpha.31 → 0.5.0-alpha.35

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 (413) hide show
  1. package/lib/ConfigProvider.js +6 -6
  2. package/lib/ConfigProvider.js.map +1 -1
  3. package/lib/components/Sortable/index.js +19 -19
  4. package/lib/components/Sortable/index.js.map +1 -1
  5. package/lib/components/SwitchMenuItem.js +6 -6
  6. package/lib/components/SwitchMenuItem.js.map +1 -1
  7. package/lib/components/admin-layout/Auth.js +5 -5
  8. package/lib/components/admin-layout/Auth.js.map +1 -1
  9. package/lib/components/admin-layout/Collections/index.d.ts.map +1 -1
  10. package/lib/components/admin-layout/Collections/index.js +123 -113
  11. package/lib/components/admin-layout/Collections/index.js.map +1 -1
  12. package/lib/components/admin-layout/More.d.ts +0 -1
  13. package/lib/components/admin-layout/More.d.ts.map +1 -1
  14. package/lib/components/admin-layout/More.js +15 -8
  15. package/lib/components/admin-layout/More.js.map +1 -1
  16. package/lib/components/admin-layout/Permissions/ActionPermissionField.d.ts.map +1 -1
  17. package/lib/components/admin-layout/Permissions/ActionPermissionField.js +21 -22
  18. package/lib/components/admin-layout/Permissions/ActionPermissionField.js.map +1 -1
  19. package/lib/components/admin-layout/Permissions/MenuPermissionTable.d.ts.map +1 -1
  20. package/lib/components/admin-layout/Permissions/MenuPermissionTable.js +21 -21
  21. package/lib/components/admin-layout/Permissions/MenuPermissionTable.js.map +1 -1
  22. package/lib/components/admin-layout/Permissions/index.d.ts.map +1 -1
  23. package/lib/components/admin-layout/Permissions/index.js +48 -55
  24. package/lib/components/admin-layout/Permissions/index.js.map +1 -1
  25. package/lib/components/admin-layout/SiteTitle.d.ts.map +1 -1
  26. package/lib/components/admin-layout/SiteTitle.js +9 -9
  27. package/lib/components/admin-layout/SiteTitle.js.map +1 -1
  28. package/lib/components/admin-layout/UserInfo.d.ts +0 -1
  29. package/lib/components/admin-layout/UserInfo.d.ts.map +1 -1
  30. package/lib/components/admin-layout/UserInfo.js +55 -15
  31. package/lib/components/admin-layout/UserInfo.js.map +1 -1
  32. package/lib/components/admin-layout/datatable.d.ts +0 -1
  33. package/lib/components/admin-layout/datatable.d.ts.map +1 -1
  34. package/lib/components/admin-layout/datatable.js +4 -4
  35. package/lib/components/admin-layout/datatable.js.map +1 -1
  36. package/lib/components/admin-layout/index.d.ts.map +1 -1
  37. package/lib/components/admin-layout/index.js +41 -41
  38. package/lib/components/admin-layout/index.js.map +1 -1
  39. package/lib/components/auth-layout/index.js +2 -2
  40. package/lib/components/auth-layout/index.js.map +1 -1
  41. package/lib/components/drag-and-drop/index.js +80 -80
  42. package/lib/components/drag-and-drop/index.js.map +1 -1
  43. package/lib/components/icon-picker/index.js +1 -1
  44. package/lib/components/icon-picker/index.js.map +1 -1
  45. package/lib/components/route-schema-renderer/index.d.ts.map +1 -1
  46. package/lib/components/route-schema-renderer/index.js +24 -21
  47. package/lib/components/route-schema-renderer/index.js.map +1 -1
  48. package/lib/components/router-config/index.js +3 -3
  49. package/lib/components/router-config/index.js.map +1 -1
  50. package/lib/components/schema-renderer/index.d.ts +82 -82
  51. package/lib/components/schema-renderer/index.d.ts.map +1 -1
  52. package/lib/components/schema-renderer/index.js +123 -60
  53. package/lib/components/schema-renderer/index.js.map +1 -1
  54. package/lib/constate/Client.d.ts.map +1 -1
  55. package/lib/constate/Client.js +4 -4
  56. package/lib/constate/Client.js.map +1 -1
  57. package/lib/constate/Collections.d.ts.map +1 -1
  58. package/lib/constate/Collections.js +10 -10
  59. package/lib/constate/Collections.js.map +1 -1
  60. package/lib/constate/DesignableSwitch.js +8 -8
  61. package/lib/constate/DesignableSwitch.js.map +1 -1
  62. package/lib/constate/DisplayedMap.js +11 -11
  63. package/lib/constate/DisplayedMap.js.map +1 -1
  64. package/lib/constate/PageTitle.js +10 -10
  65. package/lib/constate/PageTitle.js.map +1 -1
  66. package/lib/context.js +2 -2
  67. package/lib/context.js.map +1 -1
  68. package/lib/hooks/useCompile.js +3 -3
  69. package/lib/hooks/useCompile.js.map +1 -1
  70. package/lib/hooks/useResource.js +4 -4
  71. package/lib/hooks/useResource.js.map +1 -1
  72. package/lib/index.d.ts +1 -0
  73. package/lib/index.d.ts.map +1 -1
  74. package/lib/index.js +2 -0
  75. package/lib/index.js.map +1 -1
  76. package/lib/index.less +3 -0
  77. package/lib/index.less.map +1 -0
  78. package/lib/locale/en_US.d.ts +4 -0
  79. package/lib/locale/en_US.d.ts.map +1 -1
  80. package/lib/locale/en_US.js +4 -0
  81. package/lib/locale/en_US.js.map +1 -1
  82. package/lib/locale/zh_CN.d.ts +4 -0
  83. package/lib/locale/zh_CN.d.ts.map +1 -1
  84. package/lib/locale/zh_CN.js +5 -1
  85. package/lib/locale/zh_CN.js.map +1 -1
  86. package/lib/resource.d.ts +4 -4
  87. package/lib/resource.d.ts.map +1 -1
  88. package/lib/resource.js +19 -19
  89. package/lib/resource.js.map +1 -1
  90. package/lib/schemas/action/ActionBar.js +39 -39
  91. package/lib/schemas/action/ActionBar.js.map +1 -1
  92. package/lib/schemas/action/index.js +109 -112
  93. package/lib/schemas/action/index.js.map +1 -1
  94. package/lib/schemas/action-logs/index.js +3 -3
  95. package/lib/schemas/action-logs/index.js.map +1 -1
  96. package/lib/schemas/add-new/index.js +129 -129
  97. package/lib/schemas/add-new/index.js.map +1 -1
  98. package/lib/schemas/array-table/index.d.ts.map +1 -1
  99. package/lib/schemas/array-table/index.js +30 -36
  100. package/lib/schemas/array-table/index.js.map +1 -1
  101. package/lib/schemas/block-item/index.js +12 -12
  102. package/lib/schemas/block-item/index.js.map +1 -1
  103. package/lib/schemas/calendar/Action.d.ts +0 -1
  104. package/lib/schemas/calendar/Action.d.ts.map +1 -1
  105. package/lib/schemas/calendar/Action.js +16 -16
  106. package/lib/schemas/calendar/Action.js.map +1 -1
  107. package/lib/schemas/calendar/ActionBar.js +39 -39
  108. package/lib/schemas/calendar/ActionBar.js.map +1 -1
  109. package/lib/schemas/calendar/DesignableBar.js +34 -34
  110. package/lib/schemas/calendar/DesignableBar.js.map +1 -1
  111. package/lib/schemas/calendar/index.d.ts.map +1 -1
  112. package/lib/schemas/calendar/index.js +98 -101
  113. package/lib/schemas/calendar/index.js.map +1 -1
  114. package/lib/schemas/card-item/index.js +3 -3
  115. package/lib/schemas/card-item/index.js.map +1 -1
  116. package/lib/schemas/cascader/index.js +10 -10
  117. package/lib/schemas/cascader/index.js.map +1 -1
  118. package/lib/schemas/chart/G2Plot.js +5 -5
  119. package/lib/schemas/chart/G2Plot.js.map +1 -1
  120. package/lib/schemas/chart/index.js +22 -22
  121. package/lib/schemas/chart/index.js.map +1 -1
  122. package/lib/schemas/checkbox/index.js +8 -8
  123. package/lib/schemas/checkbox/index.js.map +1 -1
  124. package/lib/schemas/color-select/index.js +5 -5
  125. package/lib/schemas/color-select/index.js.map +1 -1
  126. package/lib/schemas/database-field/index.d.ts.map +1 -1
  127. package/lib/schemas/database-field/index.js +62 -62
  128. package/lib/schemas/database-field/index.js.map +1 -1
  129. package/lib/schemas/database-field/interfaces/attachment.js +3 -3
  130. package/lib/schemas/database-field/interfaces/attachment.js.map +1 -1
  131. package/lib/schemas/database-field/interfaces/chinaRegion.js +3 -3
  132. package/lib/schemas/database-field/interfaces/chinaRegion.js.map +1 -1
  133. package/lib/schemas/database-field/interfaces/index.js +4 -4
  134. package/lib/schemas/database-field/interfaces/index.js.map +1 -1
  135. package/lib/schemas/database-field/interfaces/linkTo.d.ts.map +1 -1
  136. package/lib/schemas/database-field/interfaces/linkTo.js +8 -4
  137. package/lib/schemas/database-field/interfaces/linkTo.js.map +1 -1
  138. package/lib/schemas/database-field/interfaces/properties/index.d.ts +9 -4
  139. package/lib/schemas/database-field/interfaces/properties/index.d.ts.map +1 -1
  140. package/lib/schemas/database-field/interfaces/subTable.js +2 -2
  141. package/lib/schemas/database-field/interfaces/subTable.js.map +1 -1
  142. package/lib/schemas/date-picker/index.js +6 -6
  143. package/lib/schemas/date-picker/index.js.map +1 -1
  144. package/lib/schemas/display/index.d.ts +7 -4
  145. package/lib/schemas/display/index.d.ts.map +1 -1
  146. package/lib/schemas/display/index.js +117 -89
  147. package/lib/schemas/display/index.js.map +1 -1
  148. package/lib/schemas/display/index.less +9 -0
  149. package/lib/schemas/display/index.less.map +1 -0
  150. package/lib/schemas/drag-and-drop/index.js +2 -2
  151. package/lib/schemas/drag-and-drop/index.js.map +1 -1
  152. package/lib/schemas/filter/FilterItem.d.ts +0 -1
  153. package/lib/schemas/filter/FilterItem.d.ts.map +1 -1
  154. package/lib/schemas/filter/FilterItem.js +8 -8
  155. package/lib/schemas/filter/FilterItem.js.map +1 -1
  156. package/lib/schemas/filter/index.d.ts.map +1 -1
  157. package/lib/schemas/filter/index.js +40 -24
  158. package/lib/schemas/filter/index.js.map +1 -1
  159. package/lib/schemas/form/DesignableBar.js +24 -24
  160. package/lib/schemas/form/DesignableBar.js.map +1 -1
  161. package/lib/schemas/form/Field.DesignableBar.d.ts.map +1 -1
  162. package/lib/schemas/form/Field.DesignableBar.js +35 -33
  163. package/lib/schemas/form/Field.DesignableBar.js.map +1 -1
  164. package/lib/schemas/form/index.js +30 -31
  165. package/lib/schemas/form/index.js.map +1 -1
  166. package/lib/schemas/form-item/index.js +14 -14
  167. package/lib/schemas/form-item/index.js.map +1 -1
  168. package/lib/schemas/grid/DesignableBar.js +21 -21
  169. package/lib/schemas/grid/DesignableBar.js.map +1 -1
  170. package/lib/schemas/grid/index.js +46 -46
  171. package/lib/schemas/grid/index.js.map +1 -1
  172. package/lib/schemas/icon-picker/index.js +10 -10
  173. package/lib/schemas/icon-picker/index.js.map +1 -1
  174. package/lib/schemas/index.d.ts.map +1 -1
  175. package/lib/schemas/index.js +9 -10
  176. package/lib/schemas/index.js.map +1 -1
  177. package/lib/schemas/input/DesignableBar.d.ts +0 -1
  178. package/lib/schemas/input/DesignableBar.d.ts.map +1 -1
  179. package/lib/schemas/input/DesignableBar.js +5 -5
  180. package/lib/schemas/input/DesignableBar.js.map +1 -1
  181. package/lib/schemas/input/index.js +4 -4
  182. package/lib/schemas/input/index.js.map +1 -1
  183. package/lib/schemas/input-number/index.js +9 -9
  184. package/lib/schemas/input-number/index.js.map +1 -1
  185. package/lib/schemas/kanban/CardDesignableBar.js +28 -28
  186. package/lib/schemas/kanban/CardDesignableBar.js.map +1 -1
  187. package/lib/schemas/kanban/DesignableBar.js +28 -28
  188. package/lib/schemas/kanban/DesignableBar.js.map +1 -1
  189. package/lib/schemas/kanban/FieldDesignableBar.js +22 -22
  190. package/lib/schemas/kanban/FieldDesignableBar.js.map +1 -1
  191. package/lib/schemas/kanban/index.d.ts.map +1 -1
  192. package/lib/schemas/kanban/index.js +108 -108
  193. package/lib/schemas/kanban/index.js.map +1 -1
  194. package/lib/schemas/markdown/index.d.ts +1 -0
  195. package/lib/schemas/markdown/index.d.ts.map +1 -1
  196. package/lib/schemas/markdown/index.js +45 -36
  197. package/lib/schemas/markdown/index.js.map +1 -1
  198. package/lib/schemas/menu/defaultSchemas.js +2 -2
  199. package/lib/schemas/menu/defaultSchemas.js.map +1 -1
  200. package/lib/schemas/menu/index.d.ts.map +1 -1
  201. package/lib/schemas/menu/index.js +130 -155
  202. package/lib/schemas/menu/index.js.map +1 -1
  203. package/lib/schemas/page/index.js +5 -5
  204. package/lib/schemas/page/index.js.map +1 -1
  205. package/lib/schemas/password/PasswordStrength.js +1 -1
  206. package/lib/schemas/password/PasswordStrength.js.map +1 -1
  207. package/lib/schemas/password/index.js +3 -3
  208. package/lib/schemas/password/index.js.map +1 -1
  209. package/lib/schemas/radio/index.js +5 -5
  210. package/lib/schemas/radio/index.js.map +1 -1
  211. package/lib/schemas/select/index.d.ts.map +1 -1
  212. package/lib/schemas/select/index.js +117 -102
  213. package/lib/schemas/select/index.js.map +1 -1
  214. package/lib/schemas/table/Actions.d.ts +1 -0
  215. package/lib/schemas/table/Actions.d.ts.map +1 -0
  216. package/lib/schemas/table/Actions.js +76 -0
  217. package/lib/schemas/table/Actions.js.map +1 -0
  218. package/lib/schemas/table/AddActionButton.d.ts +1 -0
  219. package/lib/schemas/table/AddActionButton.d.ts.map +1 -0
  220. package/lib/schemas/table/AddActionButton.js +202 -0
  221. package/lib/schemas/table/AddActionButton.js.map +1 -0
  222. package/lib/schemas/table/AddColumn.d.ts +2 -0
  223. package/lib/schemas/table/AddColumn.d.ts.map +1 -0
  224. package/lib/schemas/table/AddColumn.js +368 -0
  225. package/lib/schemas/table/AddColumn.js.map +1 -0
  226. package/lib/schemas/table/SimpleDesignableBar.d.ts.map +1 -1
  227. package/lib/schemas/table/SimpleDesignableBar.js +24 -26
  228. package/lib/schemas/table/SimpleDesignableBar.js.map +1 -1
  229. package/lib/schemas/table/Sortable.d.ts.map +1 -1
  230. package/lib/schemas/table/Sortable.js +59 -63
  231. package/lib/schemas/table/Sortable.js.map +1 -1
  232. package/lib/schemas/table/Table.d.ts +1 -0
  233. package/lib/schemas/table/Table.d.ts.map +1 -0
  234. package/lib/schemas/table/Table.js +163 -0
  235. package/lib/schemas/table/Table.js.map +1 -0
  236. package/lib/schemas/table/TableActionBar.d.ts +2 -0
  237. package/lib/schemas/table/TableActionBar.d.ts.map +1 -0
  238. package/lib/schemas/table/TableActionBar.js +229 -0
  239. package/lib/schemas/table/TableActionBar.js.map +1 -0
  240. package/lib/schemas/table/TableActionDesignableBar.d.ts +1 -0
  241. package/lib/schemas/table/TableActionDesignableBar.d.ts.map +1 -0
  242. package/lib/schemas/table/TableActionDesignableBar.js +254 -0
  243. package/lib/schemas/table/TableActionDesignableBar.js.map +1 -0
  244. package/lib/schemas/table/TableCell.d.ts +2 -0
  245. package/lib/schemas/table/TableCell.d.ts.map +1 -0
  246. package/lib/schemas/table/TableCell.js +106 -0
  247. package/lib/schemas/table/TableCell.js.map +1 -0
  248. package/lib/schemas/table/TableColumn.d.ts +2 -0
  249. package/lib/schemas/table/TableColumn.d.ts.map +1 -0
  250. package/lib/schemas/table/TableColumn.js +84 -0
  251. package/lib/schemas/table/TableColumn.js.map +1 -0
  252. package/lib/schemas/table/TableColumnDesignableBar.d.ts +1 -0
  253. package/lib/schemas/table/TableColumnDesignableBar.d.ts.map +1 -0
  254. package/lib/schemas/table/TableColumnDesignableBar.js +286 -0
  255. package/lib/schemas/table/TableColumnDesignableBar.js.map +1 -0
  256. package/lib/schemas/table/TableDesignableBar.d.ts +2 -0
  257. package/lib/schemas/table/TableDesignableBar.d.ts.map +1 -0
  258. package/lib/schemas/table/TableDesignableBar.js +396 -0
  259. package/lib/schemas/table/TableDesignableBar.js.map +1 -0
  260. package/lib/schemas/table/TableExportActionDesignableBar.d.ts +1 -0
  261. package/lib/schemas/table/TableExportActionDesignableBar.d.ts.map +1 -0
  262. package/lib/schemas/table/TableExportActionDesignableBar.js +264 -0
  263. package/lib/schemas/table/TableExportActionDesignableBar.js.map +1 -0
  264. package/lib/schemas/table/TableFilter.d.ts +2 -0
  265. package/lib/schemas/table/TableFilter.d.ts.map +1 -0
  266. package/lib/schemas/table/TableFilter.js +181 -0
  267. package/lib/schemas/table/TableFilter.js.map +1 -0
  268. package/lib/schemas/table/TableFilterDesignableBar.d.ts +1 -0
  269. package/lib/schemas/table/TableFilterDesignableBar.d.ts.map +1 -0
  270. package/lib/schemas/table/TableFilterDesignableBar.js +271 -0
  271. package/lib/schemas/table/TableFilterDesignableBar.js.map +1 -0
  272. package/lib/schemas/table/TableIndex.d.ts +2 -0
  273. package/lib/schemas/table/TableIndex.d.ts.map +1 -0
  274. package/lib/schemas/table/TableIndex.js +38 -0
  275. package/lib/schemas/table/TableIndex.js.map +1 -0
  276. package/lib/schemas/table/TableMain.d.ts +1 -0
  277. package/lib/schemas/table/TableMain.d.ts.map +1 -0
  278. package/lib/schemas/table/TableMain.js +243 -0
  279. package/lib/schemas/table/TableMain.js.map +1 -0
  280. package/lib/schemas/table/TableOperation.d.ts +2 -0
  281. package/lib/schemas/table/TableOperation.d.ts.map +1 -0
  282. package/lib/schemas/table/TableOperation.js +50 -0
  283. package/lib/schemas/table/TableOperation.js.map +1 -0
  284. package/lib/schemas/table/TableOperationCell.d.ts +2 -0
  285. package/lib/schemas/table/TableOperationCell.d.ts.map +1 -0
  286. package/lib/schemas/table/TableOperationCell.js +69 -0
  287. package/lib/schemas/table/TableOperationCell.js.map +1 -0
  288. package/lib/schemas/table/TableOperationDesignableBar.d.ts +1 -0
  289. package/lib/schemas/table/TableOperationDesignableBar.d.ts.map +1 -0
  290. package/lib/schemas/table/TableOperationDesignableBar.js +321 -0
  291. package/lib/schemas/table/TableOperationDesignableBar.js.map +1 -0
  292. package/lib/schemas/table/TablePagination.d.ts +2 -0
  293. package/lib/schemas/table/TablePagination.d.ts.map +1 -0
  294. package/lib/schemas/table/TablePagination.js +68 -0
  295. package/lib/schemas/table/TablePagination.js.map +1 -0
  296. package/lib/schemas/table/TableProvider.d.ts +1 -0
  297. package/lib/schemas/table/TableProvider.d.ts.map +1 -0
  298. package/lib/schemas/table/TableProvider.js +232 -0
  299. package/lib/schemas/table/TableProvider.js.map +1 -0
  300. package/lib/schemas/table/TableSortHandle.d.ts +2 -0
  301. package/lib/schemas/table/TableSortHandle.d.ts.map +1 -0
  302. package/lib/schemas/table/TableSortHandle.js +35 -0
  303. package/lib/schemas/table/TableSortHandle.js.map +1 -0
  304. package/lib/schemas/table/context.d.ts +5 -0
  305. package/lib/schemas/table/context.d.ts.map +1 -0
  306. package/lib/schemas/table/context.js +25 -0
  307. package/lib/schemas/table/context.js.map +1 -0
  308. package/lib/schemas/table/hooks/useActionLogDetailsResource.d.ts +20 -0
  309. package/lib/schemas/table/hooks/useActionLogDetailsResource.d.ts.map +1 -0
  310. package/lib/schemas/table/hooks/useActionLogDetailsResource.js +91 -0
  311. package/lib/schemas/table/hooks/useActionLogDetailsResource.js.map +1 -0
  312. package/lib/schemas/table/hooks/useActionLogsResource.d.ts +3 -0
  313. package/lib/schemas/table/hooks/useActionLogsResource.d.ts.map +1 -0
  314. package/lib/schemas/table/hooks/useActionLogsResource.js +74 -0
  315. package/lib/schemas/table/hooks/useActionLogsResource.js.map +1 -0
  316. package/lib/schemas/table/hooks/useCollectionFields.d.ts +2 -0
  317. package/lib/schemas/table/hooks/useCollectionFields.d.ts.map +1 -0
  318. package/lib/schemas/table/hooks/useCollectionFields.js +45 -0
  319. package/lib/schemas/table/hooks/useCollectionFields.js.map +1 -0
  320. package/lib/schemas/table/hooks/useDataSource.d.ts +1 -0
  321. package/lib/schemas/table/hooks/useDataSource.d.ts.map +1 -0
  322. package/lib/schemas/table/hooks/useDataSource.js +35 -0
  323. package/lib/schemas/table/hooks/useDataSource.js.map +1 -0
  324. package/lib/schemas/table/hooks/useDefaultRowSelection.d.ts +3 -0
  325. package/lib/schemas/table/hooks/useDefaultRowSelection.d.ts.map +1 -0
  326. package/lib/schemas/table/hooks/useDefaultRowSelection.js +27 -0
  327. package/lib/schemas/table/hooks/useDefaultRowSelection.js.map +1 -0
  328. package/lib/schemas/table/hooks/useDefaultSelectedRowKeys.d.ts +4 -0
  329. package/lib/schemas/table/hooks/useDefaultSelectedRowKeys.d.ts.map +1 -0
  330. package/lib/schemas/table/hooks/useDefaultSelectedRowKeys.js +47 -0
  331. package/lib/schemas/table/hooks/useDefaultSelectedRowKeys.js.map +1 -0
  332. package/lib/schemas/table/hooks/usePagination.d.ts +1 -0
  333. package/lib/schemas/table/hooks/usePagination.d.ts.map +1 -0
  334. package/lib/schemas/table/hooks/usePagination.js +33 -0
  335. package/lib/schemas/table/hooks/usePagination.js.map +1 -0
  336. package/lib/schemas/table/hooks/useResource.d.ts +21 -0
  337. package/lib/schemas/table/hooks/useResource.d.ts.map +1 -0
  338. package/lib/schemas/table/hooks/useResource.js +97 -0
  339. package/lib/schemas/table/hooks/useResource.js.map +1 -0
  340. package/lib/schemas/table/hooks/useTable.d.ts +1 -0
  341. package/lib/schemas/table/hooks/useTable.d.ts.map +1 -0
  342. package/lib/schemas/table/hooks/useTable.js +29 -0
  343. package/lib/schemas/table/hooks/useTable.js.map +1 -0
  344. package/lib/schemas/table/hooks/useTableActionBars.d.ts +1 -0
  345. package/lib/schemas/table/hooks/useTableActionBars.d.ts.map +1 -0
  346. package/lib/schemas/table/hooks/useTableActionBars.js +39 -0
  347. package/lib/schemas/table/hooks/useTableActionBars.js.map +1 -0
  348. package/lib/schemas/table/hooks/useTableColumns.d.ts +1 -0
  349. package/lib/schemas/table/hooks/useTableColumns.d.ts.map +1 -0
  350. package/lib/schemas/table/hooks/useTableColumns.js +122 -0
  351. package/lib/schemas/table/hooks/useTableColumns.js.map +1 -0
  352. package/lib/schemas/table/hooks/useTableCreateAction.d.ts +3 -0
  353. package/lib/schemas/table/hooks/useTableCreateAction.d.ts.map +1 -0
  354. package/lib/schemas/table/hooks/useTableCreateAction.js +84 -0
  355. package/lib/schemas/table/hooks/useTableCreateAction.js.map +1 -0
  356. package/lib/schemas/table/hooks/useTableDestroyAction.d.ts +3 -0
  357. package/lib/schemas/table/hooks/useTableDestroyAction.d.ts.map +1 -0
  358. package/lib/schemas/table/hooks/useTableDestroyAction.js +134 -0
  359. package/lib/schemas/table/hooks/useTableDestroyAction.js.map +1 -0
  360. package/lib/schemas/table/hooks/useTableExportAction.d.ts +3 -0
  361. package/lib/schemas/table/hooks/useTableExportAction.d.ts.map +1 -0
  362. package/lib/schemas/table/hooks/useTableExportAction.js +128 -0
  363. package/lib/schemas/table/hooks/useTableExportAction.js.map +1 -0
  364. package/lib/schemas/table/hooks/useTableFilterAction.d.ts +3 -0
  365. package/lib/schemas/table/hooks/useTableFilterAction.d.ts.map +1 -0
  366. package/lib/schemas/table/hooks/useTableFilterAction.js +79 -0
  367. package/lib/schemas/table/hooks/useTableFilterAction.js.map +1 -0
  368. package/lib/schemas/table/hooks/useTableIndex.d.ts +1 -0
  369. package/lib/schemas/table/hooks/useTableIndex.d.ts.map +1 -0
  370. package/lib/schemas/table/hooks/useTableIndex.js +52 -0
  371. package/lib/schemas/table/hooks/useTableIndex.js.map +1 -0
  372. package/lib/schemas/table/hooks/useTableRow.d.ts +1 -0
  373. package/lib/schemas/table/hooks/useTableRow.d.ts.map +1 -0
  374. package/lib/schemas/table/hooks/useTableRow.js +29 -0
  375. package/lib/schemas/table/hooks/useTableRow.js.map +1 -0
  376. package/lib/schemas/table/hooks/useTableRowRecord.d.ts +1 -0
  377. package/lib/schemas/table/hooks/useTableRowRecord.d.ts.map +1 -0
  378. package/lib/schemas/table/hooks/useTableRowRecord.js +30 -0
  379. package/lib/schemas/table/hooks/useTableRowRecord.js.map +1 -0
  380. package/lib/schemas/table/hooks/useTableUpdateAction.d.ts +3 -0
  381. package/lib/schemas/table/hooks/useTableUpdateAction.d.ts.map +1 -0
  382. package/lib/schemas/table/hooks/useTableUpdateAction.js +102 -0
  383. package/lib/schemas/table/hooks/useTableUpdateAction.js.map +1 -0
  384. package/lib/schemas/table/hooks/useTotal.d.ts +1 -0
  385. package/lib/schemas/table/hooks/useTotal.d.ts.map +1 -0
  386. package/lib/schemas/table/hooks/useTotal.js +34 -0
  387. package/lib/schemas/table/hooks/useTotal.js.map +1 -0
  388. package/lib/schemas/table/index.d.ts +3 -28
  389. package/lib/schemas/table/index.d.ts.map +1 -1
  390. package/lib/schemas/table/index.js +5 -2812
  391. package/lib/schemas/table/index.js.map +1 -1
  392. package/lib/schemas/table/style.less +1 -3
  393. package/lib/schemas/table/style.less.map +1 -1
  394. package/lib/schemas/table/types.d.ts +20 -0
  395. package/lib/schemas/table/types.d.ts.map +1 -0
  396. package/lib/schemas/table/types.js +18 -0
  397. package/lib/schemas/table/types.js.map +1 -0
  398. package/lib/schemas/table/utils.d.ts +8 -0
  399. package/lib/schemas/table/utils.d.ts.map +1 -0
  400. package/lib/schemas/table/utils.js +202 -0
  401. package/lib/schemas/table/utils.js.map +1 -0
  402. package/lib/schemas/tabs/index.js +70 -70
  403. package/lib/schemas/tabs/index.js.map +1 -1
  404. package/lib/schemas/time-picker/index.js +4 -4
  405. package/lib/schemas/time-picker/index.js.map +1 -1
  406. package/lib/schemas/tree-select/index.d.ts +1 -1
  407. package/lib/schemas/tree-select/index.d.ts.map +1 -1
  408. package/lib/schemas/tree-select/index.js +2 -2
  409. package/lib/schemas/tree-select/index.js.map +1 -1
  410. package/lib/schemas/upload/index.d.ts.map +1 -1
  411. package/lib/schemas/upload/index.js +51 -51
  412. package/lib/schemas/upload/index.js.map +1 -1
  413. package/package.json +8 -7
@@ -40,13 +40,13 @@ const constate_1 = require("./constate");
40
40
  const use_request_1 = __importDefault(require("@ahooksjs/use-request"));
41
41
 
42
42
  function AntdProvider(props) {
43
- const _react_i18next_1$useT = react_i18next_1.useTranslation(),
44
- i18n = _react_i18next_1$useT.i18n;
43
+ const _ref = (0, react_i18next_1.useTranslation)(),
44
+ i18n = _ref.i18n;
45
45
 
46
- const _constate_1$useClient = constate_1.useClient(),
47
- client = _constate_1$useClient.client;
46
+ const _ref2 = (0, constate_1.useClient)(),
47
+ client = _ref2.client;
48
48
 
49
- const _use_request_1$defaul = use_request_1.default(() => client.request('app:getLang'), {
49
+ const _ref3 = (0, use_request_1.default)(() => client.request('app:getLang'), {
50
50
  onSuccess(data) {
51
51
  const locale = localStorage.getItem('locale');
52
52
 
@@ -59,7 +59,7 @@ function AntdProvider(props) {
59
59
  refreshDeps: [i18n.language],
60
60
  formatResult: data => data === null || data === void 0 ? void 0 : data.data
61
61
  }),
62
- loading = _use_request_1$defaul.loading;
62
+ loading = _ref3.loading;
63
63
 
64
64
  if (loading) {
65
65
  return react_1.default.createElement(antd_1.Spin, null);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ConfigProvider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,iDAAgE;AAChE,iCAA8B;AAC9B,+BAAkE;AAClE,kEAAyC;AACzC,kEAAyC;AACzC,yCAAuD;AACvD,wEAA+C;AAE/C,SAAS,YAAY,CAAC,KAAK;IACzB,MAAM,EAAE,IAAI,EAAE,GAAG,8BAAc,EAAE,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,oBAAS,EAAE,CAAC;IAC/B,MAAM,EAAE,OAAO,EAAE,GAAG,qBAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAClE,SAAS,CAAC,IAAI;YACZ,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAChC;QACH,CAAC;QACD,WAAW,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC5B,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI;KACnC,CAAC,CAAC;IACH,IAAI,OAAO,EAAE;QACX,OAAO,8BAAC,WAAI,OAAG,CAAC;KACjB;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,8BAAC,qBAAkB,IAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAI,CAAC,CAAC,CAAC,eAAI,IAAG,KAAK,CAAC,QAAQ,CAAsB,CAAC;AACpH,CAAC;AAED,SAAgB,cAAc,CAAC,KAAU;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,OAAO,CACL,8BAAC,yBAAc,IAAC,MAAM,EAAE,MAAM;QAC5B,8BAAC,+BAAe,IAAC,IAAI,EAAE,WAAI;YACzB,8BAAC,YAAY,QAAE,KAAK,CAAC,QAAQ,CAAgB,CAC7B,CACH,CAClB,CAAC;AACJ,CAAC;AATD,wCASC","file":"ConfigProvider.js","sourcesContent":["import React, { createContext } from 'react';\nimport { I18nextProvider, useTranslation } from 'react-i18next';\nimport { i18n } from './i18n';\nimport { ConfigProvider as AntdConfigProvider, Spin } from 'antd';\nimport enUS from 'antd/lib/locale/en_US';\nimport zhCN from 'antd/lib/locale/zh_CN';\nimport { ClientProvider, useClient } from './constate';\nimport useRequest from '@ahooksjs/use-request';\n\nfunction AntdProvider(props) {\n const { i18n } = useTranslation();\n const { client } = useClient();\n const { loading } = useRequest(() => client.request('app:getLang'), {\n onSuccess(data) {\n const locale = localStorage.getItem('locale');\n if (locale !== data.lang) {\n console.log('changeLanguage', data.lang);\n i18n.changeLanguage(data.lang);\n }\n },\n refreshDeps: [i18n.language],\n formatResult: (data) => data?.data,\n });\n if (loading) {\n return <Spin />;\n }\n console.log('i18n.language', i18n.language);\n return <AntdConfigProvider locale={i18n.language === 'zh-CN' ? zhCN : enUS}>{props.children}</AntdConfigProvider>;\n}\n\nexport function ConfigProvider(props: any) {\n const { client } = props;\n return (\n <ClientProvider client={client}>\n <I18nextProvider i18n={i18n}>\n <AntdProvider>{props.children}</AntdProvider>\n </I18nextProvider>\n </ClientProvider>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/ConfigProvider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,iDAAgE;AAChE,iCAA8B;AAC9B,+BAAkE;AAClE,kEAAyC;AACzC,kEAAyC;AACzC,yCAAuD;AACvD,wEAA+C;AAE/C,SAAS,YAAY,CAAC,KAAK;IACzB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,oBAAS,GAAE,CAAC;IAC/B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAU,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAClE,SAAS,CAAC,IAAI;YACZ,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAChC;QACH,CAAC;QACD,WAAW,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC5B,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI;KACnC,CAAC,CAAC;IACH,IAAI,OAAO,EAAE;QACX,OAAO,8BAAC,WAAI,OAAG,CAAC;KACjB;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,8BAAC,qBAAkB,IAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAI,CAAC,CAAC,CAAC,eAAI,IAAG,KAAK,CAAC,QAAQ,CAAsB,CAAC;AACpH,CAAC;AAED,SAAgB,cAAc,CAAC,KAAU;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,OAAO,CACL,8BAAC,yBAAc,IAAC,MAAM,EAAE,MAAM;QAC5B,8BAAC,+BAAe,IAAC,IAAI,EAAE,WAAI;YACzB,8BAAC,YAAY,QAAE,KAAK,CAAC,QAAQ,CAAgB,CAC7B,CACH,CAClB,CAAC;AACJ,CAAC;AATD,wCASC","file":"ConfigProvider.js","sourcesContent":["import React, { createContext } from 'react';\nimport { I18nextProvider, useTranslation } from 'react-i18next';\nimport { i18n } from './i18n';\nimport { ConfigProvider as AntdConfigProvider, Spin } from 'antd';\nimport enUS from 'antd/lib/locale/en_US';\nimport zhCN from 'antd/lib/locale/zh_CN';\nimport { ClientProvider, useClient } from './constate';\nimport useRequest from '@ahooksjs/use-request';\n\nfunction AntdProvider(props) {\n const { i18n } = useTranslation();\n const { client } = useClient();\n const { loading } = useRequest(() => client.request('app:getLang'), {\n onSuccess(data) {\n const locale = localStorage.getItem('locale');\n if (locale !== data.lang) {\n console.log('changeLanguage', data.lang);\n i18n.changeLanguage(data.lang);\n }\n },\n refreshDeps: [i18n.language],\n formatResult: (data) => data?.data,\n });\n if (loading) {\n return <Spin />;\n }\n console.log('i18n.language', i18n.language);\n return <AntdConfigProvider locale={i18n.language === 'zh-CN' ? zhCN : enUS}>{props.children}</AntdConfigProvider>;\n}\n\nexport function ConfigProvider(props: any) {\n const { client } = props;\n return (\n <ClientProvider client={client}>\n <I18nextProvider i18n={i18n}>\n <AntdProvider>{props.children}</AntdProvider>\n </I18nextProvider>\n </ClientProvider>\n );\n}\n"]}
@@ -38,8 +38,8 @@ const react_1 = __importDefault(require("react"));
38
38
 
39
39
  const react_2 = require("react");
40
40
 
41
- const RowSyntheticListenerMapContext = react_2.createContext(null);
42
- const CellContext = react_2.createContext(null);
41
+ const RowSyntheticListenerMapContext = (0, react_2.createContext)(null);
42
+ const CellContext = (0, react_2.createContext)(null);
43
43
 
44
44
  const classnames_1 = __importDefault(require("classnames"));
45
45
 
@@ -51,12 +51,12 @@ const icons_1 = require("@ant-design/icons");
51
51
 
52
52
  const react_4 = require("react");
53
53
 
54
- const Div = react_3.forwardRef((props, ref) => {
54
+ const Div = (0, react_3.forwardRef)((props, ref) => {
55
55
  return react_1.default.createElement("div", Object.assign({
56
56
  ref: ref
57
57
  }, props));
58
58
  });
59
- exports.SortableItemContext = react_2.createContext({});
59
+ exports.SortableItemContext = (0, react_2.createContext)({});
60
60
 
61
61
  function DragHandle(props) {
62
62
  const component = props.component,
@@ -84,16 +84,16 @@ function Droppable(props) {
84
84
  children = props.children,
85
85
  others = __rest(props, ["id", "data", "className", "component", "children"]);
86
86
 
87
- const _core_1$useDroppable = core_1.useDroppable({
87
+ const _ref = (0, core_1.useDroppable)({
88
88
  id: `droppable-${id}`,
89
89
  data: Object.assign({}, data)
90
90
  }),
91
- isOver = _core_1$useDroppable.isOver,
92
- setDroppableNodeRef = _core_1$useDroppable.setNodeRef;
91
+ isOver = _ref.isOver,
92
+ setDroppableNodeRef = _ref.setNodeRef;
93
93
 
94
94
  const Component = component || Div;
95
95
  return react_1.default.createElement(Component, Object.assign({}, others, {
96
- className: classnames_1.default(className, `droppable droppable-${id}`, {
96
+ className: (0, classnames_1.default)(className, `droppable droppable-${id}`, {
97
97
  isOver
98
98
  }),
99
99
  ref: el => {
@@ -115,30 +115,30 @@ function SortableItem(props) {
115
115
  disabled = props.disabled,
116
116
  others = __rest(props, ["id", "data", "draggable", "className", "component", "children", "disabled"]);
117
117
 
118
- const previewRef = react_4.useRef();
118
+ const previewRef = (0, react_4.useRef)();
119
119
 
120
- const _core_1$useDroppable2 = core_1.useDroppable({
120
+ const _ref2 = (0, core_1.useDroppable)({
121
121
  id: `droppable-${id}`,
122
122
  data: Object.assign(Object.assign({}, data), {
123
123
  previewRef
124
124
  }),
125
125
  disabled
126
126
  }),
127
- isOver = _core_1$useDroppable2.isOver,
128
- setDroppableNodeRef = _core_1$useDroppable2.setNodeRef;
127
+ isOver = _ref2.isOver,
128
+ setDroppableNodeRef = _ref2.setNodeRef;
129
129
 
130
- const _core_1$useDraggable = core_1.useDraggable({
130
+ const _ref3 = (0, core_1.useDraggable)({
131
131
  id: `draggable-${id}`,
132
132
  disabled,
133
133
  data: Object.assign(Object.assign({}, data), {
134
134
  previewRef
135
135
  })
136
136
  }),
137
- isDragging = _core_1$useDraggable.isDragging,
138
- attributes = _core_1$useDraggable.attributes,
139
- listeners = _core_1$useDraggable.listeners,
140
- setDraggableNodeRef = _core_1$useDraggable.setNodeRef,
141
- transform = _core_1$useDraggable.transform;
137
+ isDragging = _ref3.isDragging,
138
+ attributes = _ref3.attributes,
139
+ listeners = _ref3.listeners,
140
+ setDraggableNodeRef = _ref3.setNodeRef,
141
+ transform = _ref3.transform;
142
142
 
143
143
  if (draggable) {
144
144
  Object.assign(others, listeners);
@@ -146,7 +146,7 @@ function SortableItem(props) {
146
146
 
147
147
  const Component = component || Div;
148
148
  return react_1.default.createElement(Component, Object.assign({}, others, {
149
- className: classnames_1.default(className, `droppable droppable-${id}`, {
149
+ className: (0, classnames_1.default)(className, `droppable droppable-${id}`, {
150
150
  isOver,
151
151
  isDragging
152
152
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Sortable/index.tsx"],"names":[],"mappings":"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","file":"index.js","sourcesContent":["import React, { useState } from 'react';\nimport {\n SortableContext,\n useSortable,\n horizontalListSortingStrategy,\n verticalListSortingStrategy,\n sortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { Menu, Table, Tabs } from 'antd';\nimport { createContext } from 'react';\nimport { useContext } from 'react';\nimport { range } from 'lodash';\nconst RowSyntheticListenerMapContext = createContext(null);\nconst CellContext = createContext(null);\nimport cls from 'classnames';\n\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n useDraggable,\n useDroppable,\n} from '@dnd-kit/core';\nimport { forwardRef } from 'react';\nimport { DragOutlined } from '@ant-design/icons';\nimport { useRef } from 'react';\n\nconst Div = forwardRef<HTMLDivElement>((props, ref) => {\n return <div ref={ref} {...props} />;\n});\n\nexport interface SortableItemProps {}\n\nexport const SortableItemContext = createContext<any>({});\n\nexport function DragHandle(props) {\n const { component, ...others } = props;\n const Icon = component || DragOutlined;\n return (\n <SortableItemContext.Consumer>\n {({ draggable, setDraggableNodeRef, attributes, listeners }) =>\n setDraggableNodeRef && (\n <Icon\n ref={setDraggableNodeRef}\n {...others}\n // {...attributes}\n {...listeners}\n />\n )\n }\n </SortableItemContext.Consumer>\n );\n}\n\nexport interface DroppableProps {\n id: any;\n data?: any;\n component?: any;\n [key: string]: any;\n}\n\nexport function Droppable(props: DroppableProps) {\n const { id, data = {}, className, component, children, ...others } = props;\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n },\n });\n const Component = component || Div;\n return (\n <Component\n {...others}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n })}\n ref={(el: HTMLElement) => {\n setDroppableNodeRef(el);\n }}\n >\n {children}\n </Component>\n );\n}\n\nexport interface SortableItemProps {\n id: any;\n data?: any;\n component?: any;\n draggable?: boolean;\n [key: string]: any;\n}\n\nexport function SortableItem(props: SortableItemProps) {\n const {\n id,\n data = {},\n draggable,\n className,\n component,\n children,\n disabled,\n ...others\n } = props;\n const previewRef = useRef<HTMLElement>();\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n previewRef,\n },\n disabled,\n });\n const {\n isDragging,\n attributes,\n listeners,\n setNodeRef: setDraggableNodeRef,\n transform,\n } = useDraggable({\n id: `draggable-${id}`,\n disabled,\n data: {\n ...data,\n previewRef,\n },\n });\n if (draggable) {\n Object.assign(others, listeners);\n }\n const Component = component || Div;\n return (\n <Component\n {...others}\n // {...attributes}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n isDragging,\n })}\n ref={(el: HTMLElement) => {\n previewRef.current = el;\n setDroppableNodeRef(el);\n // if (draggable) {\n // setDraggableNodeRef(el);\n // }\n }}\n >\n <SortableItemContext.Provider\n value={{ draggable, setDraggableNodeRef, attributes, listeners }}\n >\n {children}\n </SortableItemContext.Provider>\n </Component>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/Sortable/index.tsx"],"names":[],"mappings":"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","file":"index.js","sourcesContent":["import React, { useState } from 'react';\nimport {\n SortableContext,\n useSortable,\n horizontalListSortingStrategy,\n verticalListSortingStrategy,\n sortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { Menu, Table, Tabs } from 'antd';\nimport { createContext } from 'react';\nimport { useContext } from 'react';\nimport { range } from 'lodash';\nconst RowSyntheticListenerMapContext = createContext(null);\nconst CellContext = createContext(null);\nimport cls from 'classnames';\n\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n useDraggable,\n useDroppable,\n} from '@dnd-kit/core';\nimport { forwardRef } from 'react';\nimport { DragOutlined } from '@ant-design/icons';\nimport { useRef } from 'react';\n\nconst Div = forwardRef<HTMLDivElement>((props, ref) => {\n return <div ref={ref} {...props} />;\n});\n\nexport interface SortableItemProps {}\n\nexport const SortableItemContext = createContext<any>({});\n\nexport function DragHandle(props) {\n const { component, ...others } = props;\n const Icon = component || DragOutlined;\n return (\n <SortableItemContext.Consumer>\n {({ draggable, setDraggableNodeRef, attributes, listeners }) =>\n setDraggableNodeRef && (\n <Icon\n ref={setDraggableNodeRef}\n {...others}\n // {...attributes}\n {...listeners}\n />\n )\n }\n </SortableItemContext.Consumer>\n );\n}\n\nexport interface DroppableProps {\n id: any;\n data?: any;\n component?: any;\n [key: string]: any;\n}\n\nexport function Droppable(props: DroppableProps) {\n const { id, data = {}, className, component, children, ...others } = props;\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n },\n });\n const Component = component || Div;\n return (\n <Component\n {...others}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n })}\n ref={(el: HTMLElement) => {\n setDroppableNodeRef(el);\n }}\n >\n {children}\n </Component>\n );\n}\n\nexport interface SortableItemProps {\n id: any;\n data?: any;\n component?: any;\n draggable?: boolean;\n [key: string]: any;\n}\n\nexport function SortableItem(props: SortableItemProps) {\n const {\n id,\n data = {},\n draggable,\n className,\n component,\n children,\n disabled,\n ...others\n } = props;\n const previewRef = useRef<HTMLElement>();\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n previewRef,\n },\n disabled,\n });\n const {\n isDragging,\n attributes,\n listeners,\n setNodeRef: setDraggableNodeRef,\n transform,\n } = useDraggable({\n id: `draggable-${id}`,\n disabled,\n data: {\n ...data,\n previewRef,\n },\n });\n if (draggable) {\n Object.assign(others, listeners);\n }\n const Component = component || Div;\n return (\n <Component\n {...others}\n // {...attributes}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n isDragging,\n })}\n ref={(el: HTMLElement) => {\n previewRef.current = el;\n setDroppableNodeRef(el);\n // if (draggable) {\n // setDraggableNodeRef(el);\n // }\n }}\n >\n <SortableItemContext.Provider\n value={{ draggable, setDraggableNodeRef, attributes, listeners }}\n >\n {children}\n </SortableItemContext.Provider>\n </Component>\n );\n}\n"]}
@@ -101,14 +101,14 @@ const useCompile_1 = require("../hooks/useCompile");
101
101
 
102
102
  function SwitchMenuItem(props) {
103
103
  const onChange = props.onChange;
104
- const compile = useCompile_1.useCompile();
104
+ const compile = (0, useCompile_1.useCompile)();
105
105
 
106
- const _react_1$useState = react_1.useState(props.checked),
107
- _react_1$useState2 = _slicedToArray(_react_1$useState, 2),
108
- checked = _react_1$useState2[0],
109
- setChecked = _react_1$useState2[1];
106
+ const _ref = (0, react_1.useState)(props.checked),
107
+ _ref2 = _slicedToArray(_ref, 2),
108
+ checked = _ref2[0],
109
+ setChecked = _ref2[1];
110
110
 
111
- react_1.useEffect(() => {
111
+ (0, react_1.useEffect)(() => {
112
112
  setChecked(props.checked);
113
113
  }, [props.checked]);
114
114
  return react_1.default.createElement(antd_1.Menu.Item, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/SwitchMenuItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmD;AACnD,+BAAoC;AACpC,oDAAiD;AAQjD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,MAAM,OAAO,GAAG,uBAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,gBAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtD,iBAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACpB,OAAO,CACL,8BAAC,WAAI,CAAC,IAAI,IACR,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,OAAO,EAAE,GAAS,EAAE;YAClB,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE;gBACrB,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;gBACnB,OAAO,CAAC,OAAO,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAA;QAED,uCACE,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,QAAQ;gBACpB,cAAc,EAAE,eAAe;aAChC;YAED,4CAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAQ;YACnC,8BAAC,aAAM,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,CACvC,CACI,CACb,CAAC;AACJ,CAAC;AA7BD,wCA6BC;AAED,kBAAe,cAAc,CAAC","file":"SwitchMenuItem.js","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Menu, Switch } from 'antd';\nimport { useCompile } from '../hooks/useCompile';\n\nexport interface SwitchMenuItemProps {\n onChange?: any;\n title?: any;\n checked?: boolean;\n}\n\nexport function SwitchMenuItem(props: SwitchMenuItemProps) {\n const { onChange } = props;\n const compile = useCompile();\n const [checked, setChecked] = useState(props.checked);\n useEffect(() => {\n setChecked(props.checked);\n }, [props.checked]);\n return (\n <Menu.Item\n style={{ minWidth: 150 }}\n onClick={async () => {\n setChecked((checked) => {\n onChange(!checked);\n return !checked;\n });\n }}\n >\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>{compile(props.title)}</span>\n <Switch checked={checked} size={'small'} />\n </div>\n </Menu.Item>\n );\n}\n\nexport default SwitchMenuItem;\n"]}
1
+ {"version":3,"sources":["../src/components/SwitchMenuItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmD;AACnD,+BAAoC;AACpC,oDAAiD;AAQjD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAA,uBAAU,GAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACpB,OAAO,CACL,8BAAC,WAAI,CAAC,IAAI,IACR,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,OAAO,EAAE,GAAS,EAAE;YAClB,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE;gBACrB,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;gBACnB,OAAO,CAAC,OAAO,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAA;QAED,uCACE,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,QAAQ;gBACpB,cAAc,EAAE,eAAe;aAChC;YAED,4CAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAQ;YACnC,8BAAC,aAAM,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAI,CACvC,CACI,CACb,CAAC;AACJ,CAAC;AA7BD,wCA6BC;AAED,kBAAe,cAAc,CAAC","file":"SwitchMenuItem.js","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Menu, Switch } from 'antd';\nimport { useCompile } from '../hooks/useCompile';\n\nexport interface SwitchMenuItemProps {\n onChange?: any;\n title?: any;\n checked?: boolean;\n}\n\nexport function SwitchMenuItem(props: SwitchMenuItemProps) {\n const { onChange } = props;\n const compile = useCompile();\n const [checked, setChecked] = useState(props.checked);\n useEffect(() => {\n setChecked(props.checked);\n }, [props.checked]);\n return (\n <Menu.Item\n style={{ minWidth: 150 }}\n onClick={async () => {\n setChecked((checked) => {\n onChange(!checked);\n return !checked;\n });\n }}\n >\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>{compile(props.title)}</span>\n <Switch checked={checked} size={'small'} />\n </div>\n </Menu.Item>\n );\n}\n\nexport default SwitchMenuItem;\n"]}
@@ -61,11 +61,11 @@ const react_router_1 = require("react-router");
61
61
 
62
62
  const react_router_dom_1 = require("react-router-dom");
63
63
 
64
- exports.AuthContext = react_1.createContext(null);
64
+ exports.AuthContext = (0, react_1.createContext)(null);
65
65
 
66
66
  const useCurrentUser = () => {
67
- const _react_2$useContext = react_2.useContext(exports.AuthContext),
68
- currentUser = _react_2$useContext.currentUser;
67
+ const _ref = (0, react_2.useContext)(exports.AuthContext),
68
+ currentUser = _ref.currentUser;
69
69
 
70
70
  return currentUser;
71
71
  };
@@ -73,10 +73,10 @@ const useCurrentUser = () => {
73
73
  exports.useCurrentUser = useCurrentUser;
74
74
 
75
75
  function AuthProvider(props) {
76
- const service = ahooks_1.useRequest('users:check', {
76
+ const service = (0, ahooks_1.useRequest)('users:check', {
77
77
  formatResult: result => result === null || result === void 0 ? void 0 : result.data
78
78
  });
79
- const location = react_router_dom_1.useLocation();
79
+ const location = (0, react_router_dom_1.useLocation)();
80
80
  const pathname = location.pathname,
81
81
  search = location.search;
82
82
  let redirect = `?redirect=${pathname}${search}`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/admin-layout/Auth.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAoC;AACpC,+BAA4B;AAC5B,+CAA6C;AAC7C,iCAAmC;AACnC,+CAAwC;AACxC,uDAA+C;AAQlC,QAAA,WAAW,GAAG,qBAAa,CAAmB,IAAI,CAAC,CAAC;AAE1D,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,EAAE,WAAW,EAAE,GAAG,kBAAU,CAAC,mBAAW,CAAC,CAAC;IAChD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF,SAAgB,YAAY,CAAC,KAAK;IAChC,MAAM,OAAO,GAAG,mBAAU,CAAC,aAAa,EAAE;QACxC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI;KACvC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,8BAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IACtC,IAAI,QAAQ,GAAG,aAAa,QAAQ,GAAG,MAAM,EAAE,CAAC;IAChD,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,OAAO,8BAAC,uBAAQ,IAAC,EAAE,EAAE,SAAS,GAAG,QAAQ,GAAI,CAAC;KAC/C;IACD,OAAO,CACL,8BAAC,mBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,IAChE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CACjB,8BAAC,WAAI,IAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,GAAI,CACrD,CAAC,CAAC,CAAC,CACF,KAAK,CAAC,QAAQ,CACf,CACoB,CACxB,CAAC;AACJ,CAAC;AAnBD,oCAmBC","file":"Auth.js","sourcesContent":["import { useRequest } from 'ahooks';\nimport { Spin } from 'antd';\nimport React, { createContext } from 'react';\nimport { useContext } from 'react';\nimport { Redirect } from 'react-router';\nimport { useLocation } from 'react-router-dom';\nimport { BaseResult } from '@ahooksjs/use-request/lib/types';\n\nexport interface AuthContextProps {\n currentUser?: any;\n service: BaseResult<any, any>;\n}\n\nexport const AuthContext = createContext<AuthContextProps>(null);\n\nexport const useCurrentUser = () => {\n const { currentUser } = useContext(AuthContext);\n return currentUser;\n};\n\nexport function AuthProvider(props) {\n const service = useRequest('users:check', {\n formatResult: (result) => result?.data,\n });\n const location = useLocation();\n const { pathname, search } = location;\n let redirect = `?redirect=${pathname}${search}`;\n if (service.error) {\n return <Redirect to={'/signin' + redirect} />;\n }\n return (\n <AuthContext.Provider value={{ service, currentUser: service.data }}>\n {service.loading ? (\n <Spin size={'large'} className={'nb-spin-center'} />\n ) : (\n props.children\n )}\n </AuthContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/admin-layout/Auth.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAoC;AACpC,+BAA4B;AAC5B,+CAA6C;AAC7C,iCAAmC;AACnC,+CAAwC;AACxC,uDAA+C;AAQlC,QAAA,WAAW,GAAG,IAAA,qBAAa,EAAmB,IAAI,CAAC,CAAC;AAE1D,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,EAAC,mBAAW,CAAC,CAAC;IAChD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF,SAAgB,YAAY,CAAC,KAAK;IAChC,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,aAAa,EAAE;QACxC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI;KACvC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,IAAA,8BAAW,GAAE,CAAC;IAC/B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IACtC,IAAI,QAAQ,GAAG,aAAa,QAAQ,GAAG,MAAM,EAAE,CAAC;IAChD,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,OAAO,8BAAC,uBAAQ,IAAC,EAAE,EAAE,SAAS,GAAG,QAAQ,GAAI,CAAC;KAC/C;IACD,OAAO,CACL,8BAAC,mBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,IAChE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CACjB,8BAAC,WAAI,IAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,GAAI,CACrD,CAAC,CAAC,CAAC,CACF,KAAK,CAAC,QAAQ,CACf,CACoB,CACxB,CAAC;AACJ,CAAC;AAnBD,oCAmBC","file":"Auth.js","sourcesContent":["import { useRequest } from 'ahooks';\nimport { Spin } from 'antd';\nimport React, { createContext } from 'react';\nimport { useContext } from 'react';\nimport { Redirect } from 'react-router';\nimport { useLocation } from 'react-router-dom';\nimport { BaseResult } from '@ahooksjs/use-request/lib/types';\n\nexport interface AuthContextProps {\n currentUser?: any;\n service: BaseResult<any, any>;\n}\n\nexport const AuthContext = createContext<AuthContextProps>(null);\n\nexport const useCurrentUser = () => {\n const { currentUser } = useContext(AuthContext);\n return currentUser;\n};\n\nexport function AuthProvider(props) {\n const service = useRequest('users:check', {\n formatResult: (result) => result?.data,\n });\n const location = useLocation();\n const { pathname, search } = location;\n let redirect = `?redirect=${pathname}${search}`;\n if (service.error) {\n return <Redirect to={'/signin' + redirect} />;\n }\n return (\n <AuthContext.Provider value={{ service, currentUser: service.data }}>\n {service.loading ? (\n <Spin size={'large'} className={'nb-spin-center'} />\n ) : (\n props.children\n )}\n </AuthContext.Provider>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/admin-layout/Collections/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAC;AA6BxE,eAAO,MAAM,WAAW,oBAAsB,CAAC;AAqvB/C,eAAO,MAAM,WAAW,mBAWvB,CAAC;AAEF,eAAe,WAAW,CAAC","file":"index.d.ts","sourcesContent":["import { SchemaRenderer } from '../../../';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { FormItem } from '@formily/antd';\nimport { action } from '@formily/reactive';\nimport {\n useCollectionContext,\n useCollectionsContext,\n} from '../../../constate/Collections';\nimport { Button, Drawer, Menu, Dropdown, Space } from 'antd';\nimport { PlusOutlined, DownOutlined } from '@ant-design/icons';\nimport cls from 'classnames';\nimport { uid, isValid, clone } from '@formily/shared';\nimport { Resource } from '../../../resource';\nimport { TableRowContext, useTable } from '../../../schemas/table';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../../context';\nimport { connect, FormProvider, observer, useForm } from '@formily/react';\nimport { DescriptionsContext } from '../../../schemas/form';\nimport { createContext } from 'react';\nimport { ISchema } from '../../../';\nimport { createForm, Field } from '@formily/core';\nimport { SchemaField } from '../../../schemas';\nimport {\n interfaces,\n options,\n} from '../../../schemas/database-field/interfaces';\nimport { useResourceRequest } from '../../../constate';\nimport { useTranslation } from 'react-i18next';\nimport { useCompile } from '../../../hooks/useCompile';\n\nexport const RoleContext = createContext(null);\n\nfunction VisibleProvider(props) {\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n return (\n <VisibleContext.Provider value={[visible, setVisible]}>\n {props.children}\n </VisibleContext.Provider>\n );\n}\n\nconst useResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nconst useCollectionsResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nclass ActionPermissionResource extends Resource {\n save(options?: any) {\n console.log('ActionPermissionResource.save');\n return Promise.resolve({});\n }\n}\n\nconst useActionPermissionSubmit = () => {\n const form = useForm();\n const role = useContext(RoleContext);\n const resource = useResourceRequest({\n resourceName: 'roles',\n resourceKey: role.name,\n });\n return {\n async run() {\n await resource.save(form.values);\n console.log('useActionPermissionSubmit', form.values?.actionPermissions);\n },\n };\n};\n\nconst useActionPermissionResource = ({ onSuccess }) => {\n const role = useContext(RoleContext);\n console.log('RoleContext', role);\n // const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest(\n {\n resourceName: 'action_permissions',\n },\n ActionPermissionResource,\n );\n const service = useRequest(\n (params?: any) => {\n return resource.list({\n ...params,\n filter: {\n role_name: role.name,\n collection_name: ctx.record.name,\n },\n appends: ['fields'],\n });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess(data) {\n console.log('actionPermissions', data);\n onSuccess({\n actionPermissions: data.map((permission) => {\n const item: any = {};\n Object.keys(permission).forEach((key) => {\n if (isValid(permission[key])) {\n item[key] = permission[key];\n }\n });\n item.fields = permission?.fields.map((field) => field.key) || [];\n return item;\n }),\n });\n },\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useDetailsResource = ({ onSuccess }) => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'collections',\n resourceKey: ctx.record[props.rowKey],\n });\n const service = useRequest(\n (params?: any) => {\n return resource.get({ ...params });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess,\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useFieldsResource = () => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n class FieldResource extends Resource {\n list(options) {\n return super.list({\n ...options,\n filter: { state: 1, collection_name: ctx.record[props.rowKey] },\n });\n }\n }\n const resource = useResourceRequest('fields', FieldResource);\n return {\n resource,\n };\n};\n\nconst fieldInterfaces = [];\nfor (const [key, schema] of interfaces) {\n fieldInterfaces.push({\n value: key,\n label: schema.title,\n disabled: schema.disabled,\n });\n}\n\nconst collectionSchema: ISchema = {\n type: 'array',\n 'x-decorator': 'VisibleProvider',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'key',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n defaultAppends: ['uiSchema'],\n useResource: useFieldsResource,\n collectionName: 'fields',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: \"{{t('Delete')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Add new')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'CreateFieldButton',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: \"{{t('Field display name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n 'uiSchema.title': {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: \"{{t('Field name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column3: {\n type: 'void',\n title: \"{{t('Field type')}}\",\n 'x-component': 'Table.Column',\n properties: {\n interface: {\n type: 'string',\n 'x-component': 'Select',\n 'x-read-pretty': true,\n // @ts-ignore\n enum: fieldInterfaces,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Actions')}}\",\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: \"{{t('Edit')}}\",\n 'x-component': 'EditFieldButton',\n 'x-component-props': {\n type: 'link',\n useAction() {\n return {\n async run() {\n alert('abc');\n },\n };\n },\n },\n 'x-action-type': 'update',\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Delete')}}\",\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction FieldConfigTitle() {\n const ctx = useContext(TableRowContext);\n const { t } = useTranslation();\n const compile = useCompile();\n return <>{t('Configure fields of {{title}}', { title: compile(ctx.record.title) })}</>;\n}\n\nfunction useCollectionResource({ onSuccess }) {\n const visible = useContext(VisibleContext);\n const resource = useResourceRequest('collections');\n useEffect(() => {\n visible && onSuccess({ name: `t_${uid()}` });\n }, [visible]);\n return { resource };\n}\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action',\n 'x-component': 'Action',\n 'x-component-props': {\n tooltip: \"{{ t('Collections & Fields') }}\",\n className: 'nb-database-config',\n icon: 'DatabaseOutlined',\n type: 'primary',\n },\n properties: {\n modal1: {\n type: 'void',\n title: \"{{t('Collections & Fields')}}\",\n 'x-component': 'Action.Drawer',\n properties: {\n table: {\n type: 'array',\n // 'x-decorator': 'CardItem',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'name',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n useResource,\n collectionName: 'collections',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: \"{{t('Delete')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Create collection')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n properties: {\n modal: {\n type: 'void',\n title: \"{{t('Create collection')}}\",\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useCollectionResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableCreateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: \"{{t('Collection display name')}}\",\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n name: {\n type: 'string',\n title: \"{{t('Collection name')}}\",\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n description:\n \"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}\",\n },\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: \"{{t('Collection display name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: \"{{t('Collection name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Actions')}}\",\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: \"{{t('Configure fields')}}\",\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'view',\n properties: {\n [uid()]: {\n type: 'void',\n title: <FieldConfigTitle />,\n // 'x-decorator': 'RoleProvider',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {},\n properties: {\n [uid()]: collectionSchema,\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Edit')}}\",\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'update',\n properties: {\n [uid()]: {\n type: 'void',\n title: \"{{t('Edit collection')}}\",\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useDetailsResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableUpdateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: \"{{t('Collection display name')}}\",\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Delete')}}\",\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction CreateFieldButton() {\n const { t } = useTranslation();\n const compile = useCompile();\n const { refresh } = useCollectionsContext();\n const ctx = useContext(TableRowContext);\n const { service } = useTable();\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const [properties, setProperties] = useState({});\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n\n const menu = (\n <Menu\n onClick={(info) => {\n console.log('click', info.key);\n const schema = interfaces.get(info.key);\n form.setValues({\n ...clone(schema.default),\n collection_name: ctx.record.name,\n key: uid(),\n name: `f_${uid()}`,\n interface: info.key,\n });\n setProperties(clone(schema.properties));\n setVisible(true);\n }}\n >\n {options.map(\n (option, groupIndex) =>\n option.children.length > 0 && (\n <Menu.SubMenu key={groupIndex} title={compile(option.label)}>\n {option.children.map((item) => (\n <Menu.Item\n disabled={item.disabled}\n style={{ minWidth: 120 }}\n key={item.name}\n >\n {compile(item.title)}\n </Menu.Item>\n ))}\n </Menu.SubMenu>\n ),\n )}\n </Menu>\n );\n return (\n <>\n <Dropdown overlay={menu} overlayClassName={'all-fields'}>\n <Button type={'primary'} icon={<PlusOutlined />}>\n {t('Add new')} <DownOutlined />\n </Button>\n </Dropdown>\n <Drawer\n title={t('Add field')}\n width={'50%'}\n visible={visible}\n onClose={() => {\n setVisible(false);\n form.reset();\n }}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={async () => {\n setVisible(false);\n await form.reset();\n }}\n >\n {t('Cancel')}\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values);\n setVisible(false);\n await form.reset();\n await service.refresh();\n await refresh();\n }}\n >\n {t('Submit')}\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties,\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nfunction EditFieldButton() {\n const { t } = useTranslation();\n const { refresh, findCollection } = useCollectionsContext();\n const { service } = useTable();\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const schema = interfaces.get(ctx.record.interface);\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n return (\n <>\n <Button\n type={'link'}\n onClick={() => {\n setVisible(true);\n const collection = findCollection(ctx.record.collection_name);\n const values = collection?.generalFields?.find(\n (field) => field.key === ctx.record.key,\n );\n form.setValues(clone(values || {}));\n }}\n >\n {t('Edit')}\n </Button>\n <Drawer\n title={t('Edit field')}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n {t('Cancel')}\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values, {\n resourceKey: ctx.record.key,\n });\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n {t('Submit')}\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties: clone(schema.properties),\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nexport const Collections = () => {\n return (\n <SchemaRenderer\n components={{\n VisibleProvider,\n CreateFieldButton,\n EditFieldButton,\n }}\n schema={schema}\n />\n );\n};\n\nexport default Collections;\n"]}
1
+ {"version":3,"sources":["../src/components/admin-layout/Collections/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAC;AA6BxE,eAAO,MAAM,WAAW,oBAAsB,CAAC;AA2vB/C,eAAO,MAAM,WAAW,mBAWvB,CAAC;AAEF,eAAe,WAAW,CAAC","file":"index.d.ts","sourcesContent":["import { SchemaRenderer } from '../../../';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { FormItem } from '@formily/antd';\nimport { action } from '@formily/reactive';\nimport {\n useCollectionContext,\n useCollectionsContext,\n} from '../../../constate/Collections';\nimport { Button, Drawer, Menu, Dropdown, Space } from 'antd';\nimport { PlusOutlined, DownOutlined } from '@ant-design/icons';\nimport cls from 'classnames';\nimport { uid, isValid, clone } from '@formily/shared';\nimport { Resource } from '../../../resource';\nimport { TableRowContext, useTable } from '../../../schemas/table';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../../context';\nimport { connect, FormProvider, observer, useForm } from '@formily/react';\nimport { DescriptionsContext } from '../../../schemas/form';\nimport { createContext } from 'react';\nimport { ISchema } from '../../../';\nimport { createForm, Field } from '@formily/core';\nimport { SchemaField } from '../../../schemas';\nimport {\n interfaces,\n options,\n} from '../../../schemas/database-field/interfaces';\nimport { useResourceRequest } from '../../../constate';\nimport { useTranslation } from 'react-i18next';\nimport { useCompile } from '../../../hooks/useCompile';\n\nexport const RoleContext = createContext(null);\n\nfunction VisibleProvider(props) {\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n return (\n <VisibleContext.Provider value={[visible, setVisible]}>\n {props.children}\n </VisibleContext.Provider>\n );\n}\n\nconst useResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nconst useCollectionsResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nclass ActionPermissionResource extends Resource {\n save(options?: any) {\n console.log('ActionPermissionResource.save');\n return Promise.resolve({});\n }\n}\n\nconst useActionPermissionSubmit = () => {\n const form = useForm();\n const role = useContext(RoleContext);\n const resource = useResourceRequest({\n resourceName: 'roles',\n resourceIndex: role.name,\n });\n return {\n async run() {\n await resource.save(form.values);\n console.log('useActionPermissionSubmit', form.values?.actionPermissions);\n },\n };\n};\n\nconst useActionPermissionResource = ({ onSuccess }) => {\n const role = useContext(RoleContext);\n console.log('RoleContext', role);\n // const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest(\n {\n resourceName: 'action_permissions',\n },\n ActionPermissionResource,\n );\n const service = useRequest(\n (params?: any) => {\n return resource.list({\n ...params,\n filter: {\n role_name: role.name,\n collection_name: ctx.record.name,\n },\n appends: ['fields'],\n });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess(data) {\n console.log('actionPermissions', data);\n onSuccess({\n actionPermissions: data.map((permission) => {\n const item: any = {};\n Object.keys(permission).forEach((key) => {\n if (isValid(permission[key])) {\n item[key] = permission[key];\n }\n });\n item.fields = permission?.fields.map((field) => field.key) || [];\n return item;\n }),\n });\n },\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useDetailsResource = ({ onSuccess }) => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'collections',\n resourceIndex: ctx.record[props.rowKey],\n });\n const service = useRequest(\n (params?: any) => {\n return resource.get({ ...params });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess,\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useFieldsResource = () => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n class FieldResource extends Resource {\n list(options) {\n return super.list({\n ...options,\n filter: { state: 1, collection_name: ctx.record[props.rowKey] },\n });\n }\n }\n const resource = useResourceRequest('fields', FieldResource);\n return {\n resource,\n };\n};\n\nconst fieldInterfaces = [];\nfor (const [key, schema] of interfaces) {\n fieldInterfaces.push({\n value: key,\n label: schema.title,\n disabled: schema.disabled,\n });\n}\n\nconst collectionSchema: ISchema = {\n type: 'array',\n 'x-decorator': 'VisibleProvider',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'key',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n defaultAppends: ['uiSchema'],\n useResource: useFieldsResource,\n collectionName: 'fields',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: \"{{t('Delete')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Add new')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'CreateFieldButton',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: \"{{t('Field display name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n 'uiSchema.title': {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: \"{{t('Field name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column3: {\n type: 'void',\n title: \"{{t('Field type')}}\",\n 'x-component': 'Table.Column',\n properties: {\n interface: {\n type: 'string',\n 'x-component': 'Select',\n 'x-read-pretty': true,\n // @ts-ignore\n enum: fieldInterfaces,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Actions')}}\",\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: \"{{t('Edit')}}\",\n 'x-component': 'EditFieldButton',\n 'x-component-props': {\n type: 'link',\n useAction() {\n return {\n async run() {\n alert('abc');\n },\n };\n },\n },\n 'x-action-type': 'update',\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Delete')}}\",\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction FieldConfigTitle() {\n const ctx = useContext(TableRowContext);\n const { t } = useTranslation();\n const compile = useCompile();\n return <>{t('Configure fields of {{title}}', { title: compile(ctx.record.title) })}</>;\n}\n\nfunction useCollectionResource({ onSuccess }) {\n const visible = useContext(VisibleContext);\n const resource = useResourceRequest('collections');\n useEffect(() => {\n visible && onSuccess({ name: `t_${uid()}` });\n }, [visible]);\n return { resource };\n}\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action',\n 'x-component': 'Action',\n 'x-component-props': {\n tooltip: \"{{ t('Collections & Fields') }}\",\n className: 'nb-database-config',\n icon: 'DatabaseOutlined',\n type: 'primary',\n },\n properties: {\n modal1: {\n type: 'void',\n title: \"{{t('Collections & Fields')}}\",\n 'x-component': 'Action.Drawer',\n properties: {\n table: {\n type: 'array',\n // 'x-decorator': 'CardItem',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'name',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n useResource,\n collectionName: 'collections',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: \"{{t('Delete')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Create collection')}}\",\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n properties: {\n modal: {\n type: 'void',\n title: \"{{t('Create collection')}}\",\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useCollectionResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableCreateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: \"{{t('Collection display name')}}\",\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n name: {\n type: 'string',\n title: \"{{t('Collection name')}}\",\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n description:\n \"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}\",\n },\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: \"{{t('Collection display name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: \"{{t('Collection name')}}\",\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Actions')}}\",\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: \"{{t('Configure fields')}}\",\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'view',\n properties: {\n [uid()]: {\n type: 'void',\n title: <FieldConfigTitle />,\n // 'x-decorator': 'RoleProvider',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {},\n properties: {\n [uid()]: collectionSchema,\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Edit')}}\",\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'update',\n properties: {\n [uid()]: {\n type: 'void',\n title: \"{{t('Edit collection')}}\",\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useDetailsResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableUpdateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: \"{{t('Collection display name')}}\",\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: \"{{t('Delete')}}\",\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction CreateFieldButton() {\n const { t } = useTranslation();\n const compile = useCompile();\n const { refresh } = useCollectionsContext();\n const ctx = useContext(TableRowContext);\n const { service } = useTable();\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const [properties, setProperties] = useState({});\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n\n const menu = (\n <Menu\n onClick={(info) => {\n console.log('click', info.key);\n const schema = interfaces.get(info.key);\n form.setValues({\n ...clone(schema.default),\n collection_name: ctx.record.name,\n key: uid(),\n name: `f_${uid()}`,\n interface: info.key,\n }, 'overwrite');\n setProperties(clone(schema.properties));\n setVisible(true);\n }}\n >\n {options.map(\n (option, groupIndex) =>\n option.children.length > 0 && (\n <Menu.SubMenu key={groupIndex} title={compile(option.label)}>\n {option.children.map((item) => (\n <Menu.Item\n disabled={item.disabled}\n style={{ minWidth: 120 }}\n key={item.name}\n >\n {compile(item.title)}\n </Menu.Item>\n ))}\n </Menu.SubMenu>\n ),\n )}\n </Menu>\n );\n return (\n <>\n <Dropdown overlay={menu} overlayClassName={'all-fields'}>\n <Button type={'primary'} icon={<PlusOutlined />}>\n {t('Add new')} <DownOutlined />\n </Button>\n </Dropdown>\n <Drawer\n title={t('Add field')}\n width={'50%'}\n visible={visible}\n onClose={async () => {\n await form.clearFormGraph();\n setVisible(false);\n }}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={async () => {\n console.log('form.values', form.values);\n await form.clearFormGraph();\n setVisible(false);\n }}\n >\n {t('Cancel')}\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n const fieldInterface = interfaces.get(form.values?.interface);\n fieldInterface?.initialize && fieldInterface?.initialize(form.values);\n console.log('form.values', form.values);\n await resource.save(form.values);\n setVisible(false);\n await form.reset();\n await service.refresh();\n await refresh();\n }}\n >\n {t('Submit')}\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties,\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nfunction EditFieldButton() {\n const { t } = useTranslation();\n const { refresh, findCollection } = useCollectionsContext();\n const { service } = useTable();\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const schema = interfaces.get(ctx.record.interface);\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n return (\n <>\n <Button\n type={'link'}\n onClick={() => {\n setVisible(true);\n const collection = findCollection(ctx.record.collection_name);\n const values = collection?.generalFields?.find(\n (field) => field.key === ctx.record.key,\n );\n form.setValues(clone(values || {}));\n }}\n >\n {t('Edit')}\n </Button>\n <Drawer\n title={t('Edit field')}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n {t('Cancel')}\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n const fieldInterface = interfaces.get(form.values?.interface);\n fieldInterface?.initialize && fieldInterface?.initialize(form.values);\n await resource.save(form.values, {\n resourceIndex: ctx.record.key,\n });\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n {t('Submit')}\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties: clone(schema?.properties),\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nexport const Collections = () => {\n return (\n <SchemaRenderer\n components={{\n VisibleProvider,\n CreateFieldButton,\n EditFieldButton,\n }}\n schema={schema}\n />\n );\n};\n\nexport default Collections;\n"]}