@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.2

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 (327) hide show
  1. package/es/acl/ACLProvider.js +7 -8
  2. package/es/api-client/APIClient.js +6 -0
  3. package/es/block-provider/BlockProvider.js +9 -6
  4. package/es/block-provider/FormBlockProvider.js +18 -9
  5. package/es/block-provider/KanbanBlockProvider.js +1 -1
  6. package/es/block-provider/SharedFilterProvider.js +9 -1
  7. package/es/block-provider/TableBlockProvider.js +1 -1
  8. package/es/block-provider/TableSelectorProvider.js +2 -2
  9. package/es/block-provider/hooks/index.js +22 -7
  10. package/es/collection-manager/CollectionManagerProvider.d.ts +1 -0
  11. package/es/collection-manager/CollectionManagerProvider.js +71 -9
  12. package/es/collection-manager/CollectionManagerShortcut.js +36 -23
  13. package/es/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  14. package/es/collection-manager/Configuration/AddCategoryAction.js +117 -0
  15. package/es/collection-manager/Configuration/AddCollectionAction.js +8 -3
  16. package/es/collection-manager/Configuration/AddFieldAction.js +1 -0
  17. package/es/collection-manager/Configuration/ConfigurationTable.js +33 -4
  18. package/es/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  19. package/es/collection-manager/Configuration/ConfigurationTabs.js +381 -0
  20. package/es/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  21. package/es/collection-manager/Configuration/EditCategoryAction.js +150 -0
  22. package/es/collection-manager/Configuration/EditCollectionAction.js +6 -2
  23. package/es/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  24. package/es/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  25. package/es/collection-manager/Configuration/components/CollectionCategory.js +13 -0
  26. package/es/collection-manager/Configuration/index.d.ts +3 -0
  27. package/es/collection-manager/Configuration/index.js +3 -0
  28. package/es/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  29. package/es/collection-manager/Configuration/schemas/collections.js +309 -176
  30. package/es/collection-manager/Configuration/templates.d.ts +1 -0
  31. package/es/collection-manager/Configuration/templates.js +1 -1
  32. package/es/collection-manager/action-hooks.d.ts +4 -0
  33. package/es/collection-manager/action-hooks.js +26 -12
  34. package/es/collection-manager/context.d.ts +4 -0
  35. package/es/collection-manager/context.js +5 -1
  36. package/es/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  37. package/es/collection-manager/hooks/useCollectionManager.js +52 -7
  38. package/es/collection-manager/interfaces/m2m.js +2 -2
  39. package/es/collection-manager/interfaces/properties/index.d.ts +0 -56
  40. package/es/collection-manager/interfaces/properties/index.js +1 -2
  41. package/es/collection-manager/templates/calendar.js +1 -1
  42. package/es/collection-manager/templates/general.js +1 -1
  43. package/es/collection-manager/templates/properties/index.d.ts +12 -1
  44. package/es/collection-manager/templates/properties/index.js +11 -0
  45. package/es/i18n/i18n.js +3 -1
  46. package/es/locale/en_US.d.ts +23 -0
  47. package/es/locale/en_US.js +23 -0
  48. package/es/locale/ja_JP.d.ts +23 -0
  49. package/es/locale/ja_JP.js +24 -1
  50. package/es/locale/ru_RU.d.ts +1 -0
  51. package/es/locale/ru_RU.js +1 -0
  52. package/es/locale/zh_CN.d.ts +43 -4
  53. package/es/locale/zh_CN.js +44 -5
  54. package/es/route-switch/antd/admin-layout/index.js +13 -33
  55. package/es/schema-component/antd/action/Action.Designer.js +28 -15
  56. package/es/schema-component/antd/action/Action.js +28 -5
  57. package/es/schema-component/antd/action/utils.d.ts +1 -0
  58. package/es/schema-component/antd/action/utils.js +49 -0
  59. package/es/schema-component/antd/association-filter/AssociationFilter.js +4 -4
  60. package/es/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  61. package/es/schema-component/antd/association-select/useServiceOptions.js +47 -6
  62. package/es/schema-component/antd/calendar/Calendar.Designer.js +17 -36
  63. package/es/schema-component/antd/checkbox/Checkbox.js +9 -8
  64. package/es/schema-component/antd/date-picker/util.d.ts +1 -1
  65. package/es/schema-component/antd/date-picker/util.js +1 -1
  66. package/es/schema-component/antd/filter/DynamicComponent.js +3 -1
  67. package/es/schema-component/antd/filter/Filter.js +2 -1
  68. package/es/schema-component/antd/filter/FilterGroup.js +7 -4
  69. package/es/schema-component/antd/filter/FilterItem.js +3 -2
  70. package/es/schema-component/antd/filter/context.d.ts +1 -0
  71. package/es/schema-component/antd/filter/useValues.js +14 -11
  72. package/es/schema-component/antd/form/Form.js +11 -5
  73. package/es/schema-component/antd/form-item/FormItem.js +17 -8
  74. package/es/schema-component/antd/form-v2/Form.Designer.js +2 -0
  75. package/es/schema-component/antd/form-v2/Form.js +94 -7
  76. package/es/schema-component/antd/form-v2/utils.d.ts +5 -0
  77. package/es/schema-component/antd/form-v2/utils.js +161 -0
  78. package/es/schema-component/antd/g2plot/G2Plot.js +3 -1
  79. package/es/schema-component/antd/grid/Grid.js +10 -5
  80. package/es/schema-component/antd/icon-picker/IconPicker.js +1 -0
  81. package/es/schema-component/antd/index.d.ts +1 -0
  82. package/es/schema-component/antd/index.js +1 -0
  83. package/es/schema-component/antd/input/Input.d.ts +2 -1
  84. package/es/schema-component/antd/input/Json.d.ts +5 -3
  85. package/es/schema-component/antd/input/Json.js +3 -2
  86. package/es/schema-component/antd/input/ReadPretty.js +1 -1
  87. package/es/schema-component/antd/input-number/InputNumber.js +3 -1
  88. package/es/schema-component/antd/page/FixedBlock.js +3 -1
  89. package/es/schema-component/antd/page/Page.js +11 -5
  90. package/es/schema-component/antd/page/PageTabDesigner.js +3 -3
  91. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  92. package/es/schema-component/antd/record-picker/RecordPicker.js +1 -2
  93. package/es/schema-component/antd/record-picker/util.js +7 -0
  94. package/es/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  95. package/es/schema-component/antd/remote-select/RemoteSelect.js +78 -36
  96. package/es/schema-component/antd/rich-text/RichText.js +4 -2
  97. package/es/schema-component/antd/select/Select.js +14 -4
  98. package/es/schema-component/antd/table/Table.Array.js +10 -3
  99. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  100. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  101. package/es/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  102. package/es/schema-component/antd/tabs/Tabs.js +1 -0
  103. package/es/schema-component/antd/time-picker/TimePicker.js +1 -1
  104. package/es/schema-component/antd/variable/Input.d.ts +2 -0
  105. package/es/schema-component/antd/variable/Input.js +244 -0
  106. package/es/schema-component/antd/variable/JSONInput.d.ts +2 -0
  107. package/es/schema-component/antd/variable/JSONInput.js +82 -0
  108. package/es/schema-component/antd/variable/TextArea.d.ts +2 -0
  109. package/es/schema-component/antd/variable/TextArea.js +322 -0
  110. package/es/schema-component/antd/variable/Variable.d.ts +8 -0
  111. package/es/schema-component/antd/variable/Variable.js +11 -0
  112. package/es/schema-component/antd/variable/index.d.ts +1 -0
  113. package/es/schema-component/antd/variable/index.js +1 -0
  114. package/es/schema-component/common/sortable-item/SortableItem.js +36 -6
  115. package/es/schema-component/common/utils/logic.js +523 -0
  116. package/es/schema-component/common/utils/uitls.d.ts +1 -0
  117. package/es/schema-component/common/utils/uitls.js +89 -0
  118. package/es/schema-initializer/SchemaInitializer.js +9 -4
  119. package/es/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
  120. package/es/schema-initializer/buttons/BlockInitializers.js +1 -102
  121. package/es/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
  122. package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  123. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
  124. package/es/schema-initializer/components/CreateRecordAction.d.ts +3 -0
  125. package/es/schema-initializer/components/CreateRecordAction.js +174 -0
  126. package/es/schema-initializer/components/index.d.ts +1 -0
  127. package/es/schema-initializer/components/index.js +2 -1
  128. package/es/schema-initializer/index.d.ts +2 -1
  129. package/es/schema-initializer/index.js +2 -1
  130. package/es/schema-initializer/items/CalendarBlockInitializer.js +24 -41
  131. package/es/schema-initializer/items/CreateActionInitializer.js +3 -3
  132. package/es/schema-initializer/items/RecordFormBlockInitializer.js +9 -9
  133. package/es/schema-initializer/items/index.d.ts +4 -4
  134. package/es/schema-initializer/items/index.js +6 -6
  135. package/es/schema-initializer/utils.js +22 -7
  136. package/es/schema-settings/EnableChildCollections/index.d.ts +2 -0
  137. package/es/schema-settings/EnableChildCollections/index.js +141 -0
  138. package/es/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  139. package/es/schema-settings/LinkageRules/DynamicComponent.js +113 -0
  140. package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  141. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +15 -0
  142. package/es/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  143. package/es/schema-settings/LinkageRules/LinkageRuleAction.js +162 -0
  144. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  145. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.js +71 -0
  146. package/es/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  147. package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +82 -0
  148. package/es/schema-settings/LinkageRules/Variables.d.ts +7 -0
  149. package/es/schema-settings/LinkageRules/Variables.js +115 -0
  150. package/es/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  151. package/es/schema-settings/LinkageRules/action-hooks.js +115 -0
  152. package/es/schema-settings/LinkageRules/context.d.ts +13 -0
  153. package/es/schema-settings/LinkageRules/context.js +4 -0
  154. package/es/schema-settings/LinkageRules/index.d.ts +2 -0
  155. package/es/schema-settings/LinkageRules/index.js +132 -0
  156. package/es/schema-settings/LinkageRules/type.d.ts +13 -0
  157. package/es/schema-settings/LinkageRules/type.js +15 -0
  158. package/es/schema-settings/LinkageRules/useValues.d.ts +1 -0
  159. package/es/schema-settings/LinkageRules/useValues.js +84 -0
  160. package/es/schema-settings/SchemaSettings.d.ts +4 -1
  161. package/es/schema-settings/SchemaSettings.js +219 -26
  162. package/es/schema-templates/BlockTemplate.js +9 -1
  163. package/es/system-settings/SystemSettingsShortcut.js +1 -1
  164. package/lib/acl/ACLProvider.js +7 -8
  165. package/lib/api-client/APIClient.js +6 -0
  166. package/lib/block-provider/BlockProvider.js +9 -6
  167. package/lib/block-provider/FormBlockProvider.js +17 -8
  168. package/lib/block-provider/KanbanBlockProvider.js +1 -1
  169. package/lib/block-provider/SharedFilterProvider.js +9 -3
  170. package/lib/block-provider/TableBlockProvider.js +1 -1
  171. package/lib/block-provider/TableSelectorProvider.js +2 -2
  172. package/lib/block-provider/hooks/index.js +23 -7
  173. package/lib/collection-manager/CollectionManagerProvider.d.ts +1 -0
  174. package/lib/collection-manager/CollectionManagerProvider.js +81 -16
  175. package/lib/collection-manager/CollectionManagerShortcut.js +36 -23
  176. package/lib/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  177. package/lib/collection-manager/Configuration/AddCategoryAction.js +145 -0
  178. package/lib/collection-manager/Configuration/AddCollectionAction.js +8 -3
  179. package/lib/collection-manager/Configuration/AddFieldAction.js +1 -0
  180. package/lib/collection-manager/Configuration/ConfigurationTable.js +34 -4
  181. package/lib/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  182. package/lib/collection-manager/Configuration/ConfigurationTabs.js +407 -0
  183. package/lib/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  184. package/lib/collection-manager/Configuration/EditCategoryAction.js +178 -0
  185. package/lib/collection-manager/Configuration/EditCollectionAction.js +6 -2
  186. package/lib/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  187. package/lib/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  188. package/lib/collection-manager/Configuration/components/CollectionCategory.js +27 -0
  189. package/lib/collection-manager/Configuration/index.d.ts +3 -0
  190. package/lib/collection-manager/Configuration/index.js +39 -0
  191. package/lib/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  192. package/lib/collection-manager/Configuration/schemas/collections.js +316 -178
  193. package/lib/collection-manager/Configuration/templates.d.ts +1 -0
  194. package/lib/collection-manager/Configuration/templates.js +2 -0
  195. package/lib/collection-manager/action-hooks.d.ts +4 -0
  196. package/lib/collection-manager/action-hooks.js +30 -13
  197. package/lib/collection-manager/context.d.ts +4 -0
  198. package/lib/collection-manager/context.js +7 -2
  199. package/lib/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  200. package/lib/collection-manager/hooks/useCollectionManager.js +52 -6
  201. package/lib/collection-manager/interfaces/m2m.js +2 -2
  202. package/lib/collection-manager/interfaces/properties/index.d.ts +0 -56
  203. package/lib/collection-manager/interfaces/properties/index.js +1 -2
  204. package/lib/collection-manager/templates/calendar.js +1 -1
  205. package/lib/collection-manager/templates/general.js +1 -1
  206. package/lib/collection-manager/templates/properties/index.d.ts +12 -1
  207. package/lib/collection-manager/templates/properties/index.js +11 -0
  208. package/lib/i18n/i18n.js +3 -1
  209. package/lib/locale/en_US.d.ts +23 -0
  210. package/lib/locale/en_US.js +23 -0
  211. package/lib/locale/ja_JP.d.ts +23 -0
  212. package/lib/locale/ja_JP.js +24 -1
  213. package/lib/locale/ru_RU.d.ts +1 -0
  214. package/lib/locale/ru_RU.js +1 -0
  215. package/lib/locale/zh_CN.d.ts +43 -4
  216. package/lib/locale/zh_CN.js +44 -5
  217. package/lib/route-switch/antd/admin-layout/index.js +13 -33
  218. package/lib/schema-component/antd/action/Action.Designer.js +30 -14
  219. package/lib/schema-component/antd/action/Action.js +29 -3
  220. package/lib/schema-component/antd/action/utils.d.ts +1 -0
  221. package/lib/schema-component/antd/action/utils.js +58 -2
  222. package/lib/schema-component/antd/association-filter/AssociationFilter.js +3 -3
  223. package/lib/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  224. package/lib/schema-component/antd/association-select/useServiceOptions.js +47 -4
  225. package/lib/schema-component/antd/calendar/Calendar.Designer.js +15 -33
  226. package/lib/schema-component/antd/checkbox/Checkbox.js +8 -7
  227. package/lib/schema-component/antd/date-picker/util.d.ts +1 -1
  228. package/lib/schema-component/antd/date-picker/util.js +1 -1
  229. package/lib/schema-component/antd/filter/DynamicComponent.js +3 -1
  230. package/lib/schema-component/antd/filter/Filter.js +2 -1
  231. package/lib/schema-component/antd/filter/FilterGroup.js +7 -4
  232. package/lib/schema-component/antd/filter/FilterItem.js +3 -2
  233. package/lib/schema-component/antd/filter/context.d.ts +1 -0
  234. package/lib/schema-component/antd/filter/useValues.js +15 -11
  235. package/lib/schema-component/antd/form/Form.js +9 -3
  236. package/lib/schema-component/antd/form-item/FormItem.js +21 -7
  237. package/lib/schema-component/antd/form-v2/Form.Designer.js +2 -0
  238. package/lib/schema-component/antd/form-v2/Form.js +93 -5
  239. package/lib/schema-component/antd/form-v2/utils.d.ts +5 -0
  240. package/lib/schema-component/antd/form-v2/utils.js +181 -0
  241. package/lib/schema-component/antd/g2plot/G2Plot.js +3 -1
  242. package/lib/schema-component/antd/grid/Grid.js +10 -5
  243. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -0
  244. package/lib/schema-component/antd/index.d.ts +1 -0
  245. package/lib/schema-component/antd/index.js +13 -0
  246. package/lib/schema-component/antd/input/Input.d.ts +2 -1
  247. package/lib/schema-component/antd/input/Json.d.ts +5 -3
  248. package/lib/schema-component/antd/input/Json.js +6 -3
  249. package/lib/schema-component/antd/input/ReadPretty.js +1 -1
  250. package/lib/schema-component/antd/input-number/InputNumber.js +2 -0
  251. package/lib/schema-component/antd/page/FixedBlock.js +3 -1
  252. package/lib/schema-component/antd/page/Page.js +14 -5
  253. package/lib/schema-component/antd/page/PageTabDesigner.js +1 -1
  254. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  255. package/lib/schema-component/antd/record-picker/RecordPicker.js +1 -2
  256. package/lib/schema-component/antd/record-picker/util.js +7 -0
  257. package/lib/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  258. package/lib/schema-component/antd/remote-select/RemoteSelect.js +78 -37
  259. package/lib/schema-component/antd/rich-text/RichText.js +4 -2
  260. package/lib/schema-component/antd/select/Select.js +14 -4
  261. package/lib/schema-component/antd/table/Table.Array.js +8 -1
  262. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  263. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  264. package/lib/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  265. package/lib/schema-component/antd/tabs/Tabs.js +1 -0
  266. package/lib/schema-component/antd/time-picker/TimePicker.js +1 -1
  267. package/lib/schema-component/antd/variable/Input.d.ts +2 -0
  268. package/lib/schema-component/antd/variable/Input.js +262 -0
  269. package/lib/schema-component/antd/variable/JSONInput.d.ts +2 -0
  270. package/lib/schema-component/antd/variable/JSONInput.js +100 -0
  271. package/lib/schema-component/antd/variable/TextArea.d.ts +2 -0
  272. package/lib/schema-component/antd/variable/TextArea.js +341 -0
  273. package/lib/schema-component/antd/variable/Variable.d.ts +8 -0
  274. package/lib/schema-component/antd/variable/Variable.js +25 -0
  275. package/lib/schema-component/antd/variable/index.d.ts +1 -0
  276. package/lib/schema-component/antd/variable/index.js +18 -0
  277. package/lib/schema-component/common/sortable-item/SortableItem.js +36 -6
  278. package/lib/schema-component/common/utils/logic.js +525 -0
  279. package/lib/schema-component/common/utils/uitls.d.ts +1 -0
  280. package/lib/schema-component/common/utils/uitls.js +103 -0
  281. package/lib/schema-initializer/SchemaInitializer.js +9 -4
  282. package/lib/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
  283. package/lib/schema-initializer/buttons/BlockInitializers.js +0 -108
  284. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
  285. package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  286. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
  287. package/lib/schema-initializer/components/CreateRecordAction.d.ts +3 -0
  288. package/lib/schema-initializer/components/CreateRecordAction.js +199 -0
  289. package/lib/schema-initializer/components/index.d.ts +1 -0
  290. package/lib/schema-initializer/components/index.js +13 -0
  291. package/lib/schema-initializer/index.d.ts +2 -1
  292. package/lib/schema-initializer/index.js +51 -2
  293. package/lib/schema-initializer/items/CalendarBlockInitializer.js +16 -33
  294. package/lib/schema-initializer/items/CreateActionInitializer.js +3 -3
  295. package/lib/schema-initializer/items/RecordFormBlockInitializer.js +3 -3
  296. package/lib/schema-initializer/items/index.d.ts +4 -4
  297. package/lib/schema-initializer/items/index.js +52 -52
  298. package/lib/schema-initializer/utils.js +22 -6
  299. package/lib/schema-settings/EnableChildCollections/index.d.ts +2 -0
  300. package/lib/schema-settings/EnableChildCollections/index.js +156 -0
  301. package/lib/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  302. package/lib/schema-settings/LinkageRules/DynamicComponent.js +139 -0
  303. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  304. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +27 -0
  305. package/lib/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  306. package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +190 -0
  307. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  308. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.js +90 -0
  309. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  310. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +104 -0
  311. package/lib/schema-settings/LinkageRules/Variables.d.ts +7 -0
  312. package/lib/schema-settings/LinkageRules/Variables.js +124 -0
  313. package/lib/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  314. package/lib/schema-settings/LinkageRules/action-hooks.js +127 -0
  315. package/lib/schema-settings/LinkageRules/context.d.ts +13 -0
  316. package/lib/schema-settings/LinkageRules/context.js +15 -0
  317. package/lib/schema-settings/LinkageRules/index.d.ts +2 -0
  318. package/lib/schema-settings/LinkageRules/index.js +149 -0
  319. package/lib/schema-settings/LinkageRules/type.d.ts +13 -0
  320. package/lib/schema-settings/LinkageRules/type.js +22 -0
  321. package/lib/schema-settings/LinkageRules/useValues.d.ts +1 -0
  322. package/lib/schema-settings/LinkageRules/useValues.js +95 -0
  323. package/lib/schema-settings/SchemaSettings.d.ts +4 -1
  324. package/lib/schema-settings/SchemaSettings.js +243 -48
  325. package/lib/schema-templates/BlockTemplate.js +9 -1
  326. package/lib/system-settings/SystemSettingsShortcut.js +1 -1
  327. package/package.json +4 -4
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -15,34 +13,26 @@ var _react2 = _interopRequireWildcard(require("react"));
15
13
 
16
14
  var _apiClient = require("../../../api-client");
17
15
 
16
+ var _SharedFilterProvider = require("../../../block-provider/SharedFilterProvider");
17
+
18
18
  var _hooks = require("../../hooks");
19
19
 
20
20
  var _select = require("../select");
21
21
 
22
22
  var _ReadPretty = require("./ReadPretty");
23
23
 
24
- var _excluded = ["fieldNames", "service", "wait"];
24
+ var _excluded = ["fieldNames", "service", "wait", "value", "objectValue", "manual"];
25
25
 
26
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
27
 
28
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
29
 
30
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
31
+
30
32
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
31
33
 
32
34
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
33
35
 
34
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
35
-
36
- 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."); }
37
-
38
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39
-
40
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
41
-
42
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
43
-
44
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
45
-
46
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
47
37
 
48
38
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -54,7 +44,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
54
44
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
55
45
 
56
46
  var InternalRemoteSelect = (0, _react.connect)(function (props) {
57
- var _service$params, _service$params2;
47
+ var _service$params;
58
48
 
59
49
  var _props$fieldNames = props.fieldNames,
60
50
  fieldNames = _props$fieldNames === void 0 ? {} : _props$fieldNames,
@@ -62,9 +52,14 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
62
52
  service = _props$service === void 0 ? {} : _props$service,
63
53
  _props$wait = props.wait,
64
54
  wait = _props$wait === void 0 ? 300 : _props$wait,
55
+ value = props.value,
56
+ objectValue = props.objectValue,
57
+ _props$manual = props.manual,
58
+ manual = _props$manual === void 0 ? true : _props$manual,
65
59
  others = _objectWithoutProperties(props, _excluded);
66
60
 
67
61
  var compile = (0, _hooks.useCompile)();
62
+ var firstRun = (0, _react2.useRef)(false);
68
63
 
69
64
  var _useRequest = (0, _apiClient.useRequest)(_objectSpread(_objectSpread({
70
65
  action: 'list'
@@ -72,33 +67,43 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
72
67
  params: _objectSpread(_objectSpread({
73
68
  pageSize: 200
74
69
  }, service === null || service === void 0 ? void 0 : service.params), {}, {
75
- fields: [fieldNames.label, fieldNames.value].concat(_toConsumableArray((service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.fields) || [])),
70
+ // fields: [fieldNames.label, fieldNames.value, ...(service?.params?.fields || [])],
76
71
  // search needs
77
- filter: {
78
- $and: [service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter].filter(Boolean)
79
- }
72
+ filter: (0, _SharedFilterProvider.mergeFilter)([service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter])
80
73
  })
81
74
  }), {
82
- debounceWait: wait,
83
- refreshDeps: [service, fieldNames.label, fieldNames.value]
75
+ manual: manual,
76
+ debounceWait: wait
84
77
  }),
85
78
  data = _useRequest.data,
86
- run = _useRequest.run;
79
+ run = _useRequest.run,
80
+ loading = _useRequest.loading;
81
+
82
+ var runDep = (0, _react2.useMemo)(function () {
83
+ return JSON.stringify({
84
+ service: service,
85
+ fieldNames: fieldNames
86
+ });
87
+ }, [service, fieldNames]);
88
+ (0, _react2.useEffect)(function () {
89
+ // Lazy load
90
+ if (firstRun.current) {
91
+ run();
92
+ }
93
+ }, [runDep]);
87
94
 
88
95
  var onSearch = /*#__PURE__*/function () {
89
96
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(search) {
90
- var _service$params3;
97
+ var _service$params2;
91
98
 
92
99
  return regeneratorRuntime.wrap(function _callee$(_context) {
93
100
  while (1) {
94
101
  switch (_context.prev = _context.next) {
95
102
  case 0:
96
103
  run({
97
- filter: {
98
- $and: [_defineProperty({}, fieldNames.label, {
99
- $includes: search
100
- }), service === null || service === void 0 ? void 0 : (_service$params3 = service.params) === null || _service$params3 === void 0 ? void 0 : _service$params3.filter].filter(Boolean)
101
- }
104
+ filter: (0, _SharedFilterProvider.mergeFilter)([_defineProperty({}, fieldNames.label, {
105
+ $includes: search
106
+ }), service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter])
102
107
  });
103
108
 
104
109
  case 1:
@@ -114,25 +119,61 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
114
119
  };
115
120
  }();
116
121
 
122
+ var getOptionsByFieldNames = (0, _react2.useCallback)(function (item) {
123
+ return Object.keys(fieldNames).reduce(function (obj, key) {
124
+ var value = item[fieldNames[key]];
125
+
126
+ if (value) {
127
+ // support hidden, disabled, etc.
128
+ obj[['label', 'value', 'options'].includes(key) ? fieldNames[key] : key] = key === 'label' ? compile(value) : value;
129
+ }
130
+
131
+ return obj;
132
+ }, {});
133
+ }, [fieldNames]);
134
+ var normalizeOptions = (0, _react2.useCallback)(function (obj) {
135
+ var _ref3;
136
+
137
+ if (objectValue || _typeof(obj) === 'object') {
138
+ return getOptionsByFieldNames(obj);
139
+ }
140
+
141
+ return _ref3 = {}, _defineProperty(_ref3, fieldNames.value, obj), _defineProperty(_ref3, fieldNames.label, obj), _ref3;
142
+ }, [objectValue, getOptionsByFieldNames]);
117
143
  var options = (0, _react2.useMemo)(function () {
118
- var _data$data;
144
+ var _data$data, _data$data2;
145
+
146
+ if (!(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.length)) {
147
+ return value !== undefined && value !== null ? Array.isArray(value) ? value.map(normalizeOptions) : [normalizeOptions(value)] : [];
148
+ }
149
+
150
+ return (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.map(getOptionsByFieldNames)) || [];
151
+ }, [data === null || data === void 0 ? void 0 : data.data, getOptionsByFieldNames, normalizeOptions, value]);
152
+
153
+ var onDropdownVisibleChange = function onDropdownVisibleChange() {
154
+ if (firstRun.current) {
155
+ return;
156
+ }
157
+
158
+ run();
159
+ firstRun.current = true;
160
+ };
119
161
 
120
- return (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.map(function (item) {
121
- return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, fieldNames.label, compile(item[fieldNames.label])));
122
- })) || [];
123
- }, [data, fieldNames.label]);
124
162
  return /*#__PURE__*/_react2.default.createElement(_select.Select, _objectSpread(_objectSpread({
125
163
  autoClearSearchValue: true,
126
164
  filterOption: false,
127
165
  filterSort: null,
128
166
  fieldNames: fieldNames,
129
- onSearch: onSearch
167
+ onSearch: onSearch,
168
+ onDropdownVisibleChange: onDropdownVisibleChange,
169
+ objectValue: objectValue,
170
+ value: value
130
171
  }, others), {}, {
172
+ loading: loading,
131
173
  options: options
132
174
  }));
133
175
  }, (0, _react.mapProps)({
134
- dataSource: 'options',
135
- loading: true
176
+ dataSource: 'options'
136
177
  }, function (props, field) {
137
178
  return _objectSpread(_objectSpread({}, props), {}, {
138
179
  fieldNames: _objectSpread(_objectSpread(_objectSpread({}, _select.defaultFieldNames), props.fieldNames), field.componentProps.fieldNames),
@@ -33,12 +33,14 @@ var RichText = (0, _react.connect)(function (props) {
33
33
  };
34
34
  var formats = ['header', 'bold', 'italic', 'underline', 'strike', 'blockquote', 'list', 'bullet', 'indent', 'link', 'image'];
35
35
  var value = props.value,
36
- onChange = props.onChange;
36
+ onChange = props.onChange,
37
+ disabled = props.disabled;
37
38
  return /*#__PURE__*/_react2.default.createElement(_reactQuill.default, {
38
39
  modules: modules,
39
40
  formats: formats,
40
41
  value: typeof value === 'string' ? value : '',
41
- onChange: onChange
42
+ onChange: onChange,
43
+ readOnly: disabled
42
44
  });
43
45
  }, (0, _react.mapReadPretty)(function (props) {
44
46
  return /*#__PURE__*/_react2.default.createElement(_input.ReadPretty.Html, _objectSpread({}, props));
@@ -20,7 +20,7 @@ var _ReadPretty = require("./ReadPretty");
20
20
  var _shared2 = require("./shared");
21
21
 
22
22
  var _excluded = ["value", "options", "onChange", "fieldNames", "mode"],
23
- _excluded2 = ["objectValue"];
23
+ _excluded2 = ["objectValue", "value"];
24
24
 
25
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
26
 
@@ -114,12 +114,22 @@ var filterOption = function filterOption(input, option) {
114
114
 
115
115
  var InternalSelect = (0, _react.connect)(function (props) {
116
116
  var objectValue = props.objectValue,
117
+ value = props.value,
117
118
  others = _objectWithoutProperties(props, _excluded2);
118
119
 
119
120
  var mode = props.mode || props.multiple ? 'multiple' : undefined;
120
121
 
122
+ var toValue = function toValue(v) {
123
+ if (['multiple', 'tags'].includes(mode)) {
124
+ return v || [];
125
+ }
126
+
127
+ return v;
128
+ };
129
+
121
130
  if (objectValue) {
122
131
  return /*#__PURE__*/_react2.default.createElement(ObjectSelect, _objectSpread(_objectSpread({}, others), {}, {
132
+ value: toValue(value),
123
133
  mode: mode
124
134
  }));
125
135
  }
@@ -127,7 +137,8 @@ var InternalSelect = (0, _react.connect)(function (props) {
127
137
  return /*#__PURE__*/_react2.default.createElement(_antd.Select, _objectSpread(_objectSpread({
128
138
  showSearch: true,
129
139
  filterOption: filterOption,
130
- allowClear: true
140
+ allowClear: true,
141
+ value: toValue(value)
131
142
  }, others), {}, {
132
143
  onChange: function onChange(changed) {
133
144
  var _props$onChange;
@@ -137,8 +148,7 @@ var InternalSelect = (0, _react.connect)(function (props) {
137
148
  mode: mode
138
149
  }));
139
150
  }, (0, _react.mapProps)({
140
- dataSource: 'options',
141
- loading: true
151
+ dataSource: 'options'
142
152
  }, function (props, field) {
143
153
  return _objectSpread(_objectSpread({}, props), {}, {
144
154
  fieldNames: _objectSpread(_objectSpread({}, _shared2.defaultFieldNames), props.fieldNames),
@@ -69,6 +69,11 @@ var isColumnComponent = function isColumnComponent(schema) {
69
69
  return ((_schema$xComponent = schema['x-component']) === null || _schema$xComponent === void 0 ? void 0 : _schema$xComponent.endsWith('.Column')) > -1;
70
70
  };
71
71
 
72
+ var useScope = function useScope(key) {
73
+ var scope = (0, _react2.useContext)(_react.SchemaExpressionScopeContext);
74
+ return scope[key] !== false;
75
+ };
76
+
72
77
  var useTableColumns = function useTableColumns() {
73
78
  var start = Date.now();
74
79
  var field = (0, _react.useField)();
@@ -79,9 +84,11 @@ var useTableColumns = function useTableColumns() {
79
84
  render = _useSchemaInitializer.render;
80
85
 
81
86
  var columns = schema.reduceProperties(function (buf, s) {
82
- if (isColumnComponent(s)) {
87
+ if (isColumnComponent(s) && useScope(s['x-visible'])) {
83
88
  return buf.concat([s]);
84
89
  }
90
+
91
+ return buf;
85
92
  }, []).map(function (s) {
86
93
  return {
87
94
  title: /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
@@ -51,7 +51,7 @@ var useLabelFields = function useLabelFields(collectionName) {
51
51
  };
52
52
 
53
53
  var TableColumnDesigner = function TableColumnDesigner(props) {
54
- var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$uiSc, _columnSchema$xCompo;
54
+ var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$targ, _collectionField$uiSc, _columnSchema$xCompo;
55
55
 
56
56
  var uiSchema = props.uiSchema,
57
57
  fieldSchema = props.fieldSchema,
@@ -71,7 +71,7 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
71
71
  dn = _useDesignable.dn;
72
72
 
73
73
  var fieldNames = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['fieldNames']) || (uiSchema === null || uiSchema === void 0 ? void 0 : (_uiSchema$xComponent = uiSchema['x-component-props']) === null || _uiSchema$xComponent === void 0 ? void 0 : _uiSchema$xComponent['fieldNames']);
74
- var options = useLabelFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
74
+ var options = useLabelFields((_collectionField$targ = collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) !== null && _collectionField$targ !== void 0 ? _collectionField$targ : collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection);
75
75
  var intefaceCfg = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
76
76
  return /*#__PURE__*/_react2.default.createElement(_schemaSettings.GeneralSchemaDesigner, {
77
77
  disableInitializer: true
@@ -50,7 +50,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
50
50
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
51
51
 
52
52
  var TableBlockDesigner = function TableBlockDesigner() {
53
- var _fieldSchema$xDecora, _fieldSchema$xDecora$, _fieldSchema$xDecora2, _fieldSchema$xDecora3, _fieldSchema$xDecora4, _field$decoratorProps, _field$decoratorProps2;
53
+ var _fieldSchema$xDecora, _fieldSchema$xDecora$, _fieldSchema$xDecora2, _fieldSchema$xDecora3, _fieldSchema$xDecora4, _fieldSchema$xDecora5, _field$decoratorProps, _field$decoratorProps2;
54
54
 
55
55
  var _useCollection = (0, _collectionManager.useCollection)(),
56
56
  name = _useCollection.name,
@@ -75,6 +75,7 @@ var TableBlockDesigner = function TableBlockDesigner() {
75
75
  var defaultFilter = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : (_fieldSchema$xDecora$ = _fieldSchema$xDecora.params) === null || _fieldSchema$xDecora$ === void 0 ? void 0 : _fieldSchema$xDecora$.filter) || {};
76
76
  var defaultSort = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora2 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora2 === void 0 ? void 0 : (_fieldSchema$xDecora3 = _fieldSchema$xDecora2.params) === null || _fieldSchema$xDecora3 === void 0 ? void 0 : _fieldSchema$xDecora3.sort) || [];
77
77
  var defaultResource = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora4 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora4 === void 0 ? void 0 : _fieldSchema$xDecora4.resource;
78
+ var supportTemplate = !(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora5 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora5 === void 0 ? void 0 : _fieldSchema$xDecora5.disableTemplate);
78
79
  var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
79
80
  return item.startsWith('-') ? {
80
81
  field: item.substring(1),
@@ -262,7 +263,7 @@ var TableBlockDesigner = function TableBlockDesigner() {
262
263
  schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-decorator-props', fieldSchema['x-decorator-props']), _schema4)
263
264
  });
264
265
  }
265
- }), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Divider, null), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Template, {
266
+ }), supportTemplate && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Divider, null), supportTemplate && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Template, {
266
267
  componentName: 'Table',
267
268
  collectionName: name,
268
269
  resourceName: defaultResource
@@ -32,6 +32,7 @@ var TabsDesigner = function TabsDesigner() {
32
32
  return /*#__PURE__*/_react2.default.createElement(_2.GeneralSchemaDesigner, {
33
33
  disableInitializer: true
34
34
  }, /*#__PURE__*/_react2.default.createElement(_2.SchemaSettings.ModalItem, {
35
+ key: "edit",
35
36
  title: t('Edit'),
36
37
  schema: {
37
38
  type: 'object',
@@ -38,6 +38,7 @@ var Tabs = (0, _react.observer)(function (props) {
38
38
  render = _useSchemaInitializer.render;
39
39
 
40
40
  return /*#__PURE__*/_react2.default.createElement(_common.DndContext, null, /*#__PURE__*/_react2.default.createElement(_antd.Tabs, {
41
+ style: props.style,
41
42
  tabBarExtraContent: {
42
43
  right: render()
43
44
  }
@@ -20,7 +20,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
20
20
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
 
22
22
  var mapTimeFormat = function mapTimeFormat() {
23
- return function (props) {
23
+ return function (props, field) {
24
24
  var format = props['format'] || 'HH:mm:ss';
25
25
  var _onChange = props.onChange;
26
26
  return _objectSpread(_objectSpread({}, props), {}, {
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function Input(props: any): JSX.Element;
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Input = Input;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _react2 = require("@formily/react");
11
+
12
+ var _antd = require("antd");
13
+
14
+ var _icons = require("@ant-design/icons");
15
+
16
+ var _css = require("@emotion/css");
17
+
18
+ var _reactI18next = require("react-i18next");
19
+
20
+ var _moment = _interopRequireDefault(require("moment"));
21
+
22
+ var _ = require("../..");
23
+
24
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
29
+
30
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
31
+
32
+ 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."); }
33
+
34
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
+
36
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
37
+
38
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
39
+
40
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
41
+
42
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
43
+
44
+ var JT_VALUE_RE = /^\s*{{\s*([^{}]+)\s*}}\s*$/;
45
+
46
+ function parseValue(value) {
47
+ if (value == null) {
48
+ return 'null';
49
+ }
50
+
51
+ var type = _typeof(value);
52
+
53
+ if (type === 'string') {
54
+ var matched = value.match(JT_VALUE_RE);
55
+
56
+ if (matched) {
57
+ return matched[1].split('.');
58
+ } // const ts = Date.parse(value);
59
+ // if (value.match(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d{0,3})Z$/) && !Number.isNaN(Date.parse(value))) {
60
+ // return {
61
+ // type: 'date',
62
+ // };
63
+ // }
64
+
65
+ }
66
+
67
+ return type === 'object' && value instanceof Date ? 'date' : type;
68
+ }
69
+
70
+ var ConstantTypes = {
71
+ string: {
72
+ label: "{{t(\"String\")}}",
73
+ value: 'string',
74
+ component: function component(_ref) {
75
+ var _onChange = _ref.onChange,
76
+ value = _ref.value;
77
+ return /*#__PURE__*/_react.default.createElement(_antd.Input, {
78
+ value: value,
79
+ onChange: function onChange(ev) {
80
+ return _onChange(ev.target.value);
81
+ }
82
+ });
83
+ },
84
+ default: ''
85
+ },
86
+ number: {
87
+ label: '{{t("Number")}}',
88
+ value: 'number',
89
+ component: function component(_ref2) {
90
+ var onChange = _ref2.onChange,
91
+ value = _ref2.value;
92
+ return /*#__PURE__*/_react.default.createElement(_antd.InputNumber, {
93
+ value: value,
94
+ onChange: onChange
95
+ });
96
+ },
97
+ default: 0
98
+ },
99
+ boolean: {
100
+ label: "{{t(\"Boolean\")}}",
101
+ value: 'boolean',
102
+ component: function component(_ref3) {
103
+ var onChange = _ref3.onChange,
104
+ value = _ref3.value;
105
+
106
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
107
+ t = _useTranslation.t;
108
+
109
+ return /*#__PURE__*/_react.default.createElement(_antd.Select, {
110
+ value: value,
111
+ onChange: onChange,
112
+ placeholder: t('Select'),
113
+ options: [{
114
+ value: true,
115
+ label: t('True')
116
+ }, {
117
+ value: false,
118
+ label: t('False')
119
+ }]
120
+ });
121
+ },
122
+ default: false
123
+ },
124
+ date: {
125
+ label: '{{t("Date")}}',
126
+ value: 'date',
127
+ component: function component(_ref4) {
128
+ var _onChange2 = _ref4.onChange,
129
+ value = _ref4.value;
130
+ return /*#__PURE__*/_react.default.createElement(_antd.DatePicker, {
131
+ value: (0, _moment.default)(value),
132
+ onChange: function onChange(d) {
133
+ return d ? _onChange2(d.toDate()) : null;
134
+ },
135
+ allowClear: false,
136
+ showTime: true
137
+ });
138
+ },
139
+ default: function () {
140
+ var now = new Date();
141
+ return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
142
+ }()
143
+ },
144
+ null: {
145
+ label: "{{t(\"Null\")}}",
146
+ value: 'null',
147
+ component: function component() {
148
+ var _useTranslation2 = (0, _reactI18next.useTranslation)(),
149
+ t = _useTranslation2.t;
150
+
151
+ return /*#__PURE__*/_react.default.createElement(_antd.Input, {
152
+ readOnly: true,
153
+ placeholder: t('Null'),
154
+ className: "null-value"
155
+ });
156
+ },
157
+ default: null
158
+ }
159
+ };
160
+
161
+ function Input(props) {
162
+ var _ConstantTypes$type;
163
+
164
+ var _props$value = props.value,
165
+ value = _props$value === void 0 ? '' : _props$value,
166
+ scope = props.scope,
167
+ onChange = props.onChange,
168
+ children = props.children,
169
+ button = props.button;
170
+ var parsed = parseValue(value);
171
+ var isConstant = typeof parsed === 'string';
172
+ var type = isConstant ? parsed : '';
173
+ var variable = isConstant ? null : parsed;
174
+ var ConstantComponent = (_ConstantTypes$type = ConstantTypes[type]) === null || _ConstantTypes$type === void 0 ? void 0 : _ConstantTypes$type.component;
175
+ var constantOptions = Object.values(ConstantTypes);
176
+ var compile = (0, _.useCompile)();
177
+
178
+ var _useTranslation3 = (0, _reactI18next.useTranslation)(),
179
+ t = _useTranslation3.t;
180
+
181
+ var options = compile([{
182
+ value: '',
183
+ label: t('Constant'),
184
+ children: children ? null : constantOptions
185
+ }].concat(_toConsumableArray(typeof scope === 'function' ? scope() : scope !== null && scope !== void 0 ? scope : [])));
186
+ var form = (0, _react2.useForm)();
187
+
188
+ function onSwitch(next) {
189
+ if (next[0] === '') {
190
+ if (next[1]) {
191
+ if (next[1] !== type) {
192
+ var _ConstantTypes$next$, _ConstantTypes$next$2;
193
+
194
+ onChange((_ConstantTypes$next$ = (_ConstantTypes$next$2 = ConstantTypes[next[1]]) === null || _ConstantTypes$next$2 === void 0 ? void 0 : _ConstantTypes$next$2.default) !== null && _ConstantTypes$next$ !== void 0 ? _ConstantTypes$next$ : null);
195
+ }
196
+ } else {
197
+ if (variable) {
198
+ onChange(null);
199
+ }
200
+ }
201
+
202
+ return;
203
+ }
204
+
205
+ onChange("{{".concat(next.join('.'), "}}"));
206
+ }
207
+
208
+ var variableText = variable === null || variable === void 0 ? void 0 : variable.reduce(function (opts, key, i) {
209
+ var _ref5;
210
+
211
+ var option = (_ref5 = i ? opts[i - 1].children : options) === null || _ref5 === void 0 ? void 0 : _ref5.find(function (item) {
212
+ return item.value === key;
213
+ });
214
+ return option ? opts.concat(option) : opts;
215
+ }, []).map(function (item) {
216
+ return item.label;
217
+ }).join(' / ');
218
+ var disabled = props.disabled || form.disabled;
219
+ return /*#__PURE__*/_react.default.createElement(_antd.Input.Group, {
220
+ compact: true,
221
+ className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: auto;\n display: flex !important;\n .ant-input-disabled {\n .ant-tag {\n color: #bfbfbf;\n border-color: #d9d9d9;\n }\n }\n .ant-input.null-value {\n width: 4em;\n min-width: 4em;\n }\n "])))
222
+ }, variable ? /*#__PURE__*/_react.default.createElement("div", {
223
+ className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n line-height: 0;\n\n &:hover {\n .ant-select-clear {\n opacity: 0.8;\n }\n }\n\n .ant-input {\n overflow: auto;\n white-space: nowrap;\n ", "\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0;\n padding: 2px 7px;\n border-radius: 10px;\n }\n }\n "])), disabled ? '' : 'padding-right: 28px;')
224
+ }, /*#__PURE__*/_react.default.createElement("div", {
225
+ onInput: function onInput(e) {
226
+ return e.preventDefault();
227
+ },
228
+ onKeyDown: function onKeyDown(e) {
229
+ if (e.key !== 'Backspace') {
230
+ e.preventDefault();
231
+ return;
232
+ }
233
+
234
+ onChange(null);
235
+ },
236
+ className: (0, _css.cx)('ant-input', {
237
+ 'ant-input-disabled': disabled
238
+ }),
239
+ contentEditable: !disabled,
240
+ suppressContentEditableWarning: true
241
+ }, /*#__PURE__*/_react.default.createElement(_antd.Tag, {
242
+ contentEditable: false,
243
+ color: "blue"
244
+ }, variableText)), !disabled ? /*#__PURE__*/_react.default.createElement("span", {
245
+ className: (0, _css.cx)('ant-select-clear', (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n user-select: 'none';\n "])))),
246
+ unselectable: "on",
247
+ "aria-hidden": true,
248
+ onClick: function onClick() {
249
+ return onChange(null);
250
+ }
251
+ }, /*#__PURE__*/_react.default.createElement(_icons.CloseCircleFilled, null)) : null) : children !== null && children !== void 0 ? children : /*#__PURE__*/_react.default.createElement(ConstantComponent, {
252
+ value: value,
253
+ onChange: onChange
254
+ }), options.length > 1 ? /*#__PURE__*/_react.default.createElement(_antd.Cascader, {
255
+ value: variable !== null && variable !== void 0 ? variable : [''].concat(_toConsumableArray(children ? [] : [type])),
256
+ options: options,
257
+ onChange: onSwitch
258
+ }, button !== null && button !== void 0 ? button : /*#__PURE__*/_react.default.createElement(_antd.Button, {
259
+ type: variable ? 'primary' : 'default',
260
+ className: (0, _css.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-style: italic;\n font-family: 'New York', 'Times New Roman', Times, serif;\n "])))
261
+ }, "x")) : null);
262
+ }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function JSONInput(props: any): JSX.Element;