@nocobase/client 0.9.2-alpha.4 → 0.9.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/es/block-provider/DetailsBlockProvider.js +13 -1
  2. package/es/block-provider/FormBlockProvider.js +30 -13
  3. package/es/block-provider/hooks/index.d.ts +10 -0
  4. package/es/block-provider/hooks/index.js +498 -281
  5. package/es/collection-manager/Configuration/CollectionFields.js +1 -2
  6. package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
  7. package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  8. package/es/collection-manager/action-hooks.d.ts +1 -1
  9. package/es/collection-manager/action-hooks.js +18 -7
  10. package/es/collection-manager/interfaces/createdBy.js +1 -1
  11. package/es/collection-manager/interfaces/linkTo.js +3 -39
  12. package/es/collection-manager/interfaces/m2m.js +4 -38
  13. package/es/collection-manager/interfaces/m2o.js +4 -38
  14. package/es/collection-manager/interfaces/o2m.js +4 -68
  15. package/es/collection-manager/interfaces/o2o.js +25 -119
  16. package/es/collection-manager/interfaces/updatedBy.js +1 -1
  17. package/es/collection-manager/templates/tree.js +2 -2
  18. package/es/filter-provider/FilterProvider.js +3 -1
  19. package/es/locale/en_US.d.ts +3 -0
  20. package/es/locale/en_US.js +5 -2
  21. package/es/locale/ja_JP.d.ts +3 -0
  22. package/es/locale/ja_JP.js +3 -0
  23. package/es/locale/zh_CN.d.ts +4 -0
  24. package/es/locale/zh_CN.js +4 -0
  25. package/es/schema-component/antd/action/Action.Designer.js +4 -5
  26. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  27. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +19 -0
  28. package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  29. package/es/schema-component/antd/association-field/AssociationSelect.js +118 -0
  30. package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
  31. package/es/schema-component/antd/association-field/Editable.js +88 -0
  32. package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
  33. package/es/schema-component/antd/association-field/FileManager.js +243 -0
  34. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  35. package/es/schema-component/antd/association-field/InternalNester.js +28 -0
  36. package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  37. package/es/schema-component/antd/association-field/InternalPicker.js +267 -0
  38. package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  39. package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
  40. package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  41. package/es/schema-component/antd/association-field/InternalViewer.js +115 -0
  42. package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
  43. package/es/schema-component/antd/association-field/Nester.js +80 -0
  44. package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  45. package/es/schema-component/antd/association-field/ReadPretty.js +38 -0
  46. package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
  47. package/es/schema-component/antd/association-field/SubTable.js +25 -0
  48. package/es/schema-component/antd/association-field/context.d.ts +7 -0
  49. package/es/schema-component/antd/association-field/context.js +2 -0
  50. package/es/schema-component/antd/association-field/hooks.d.ts +8 -0
  51. package/es/schema-component/antd/association-field/hooks.js +96 -0
  52. package/es/schema-component/antd/association-field/index.d.ts +1 -0
  53. package/es/schema-component/antd/association-field/index.js +14 -0
  54. package/es/schema-component/antd/association-field/schema.d.ts +142 -0
  55. package/es/schema-component/antd/association-field/schema.js +141 -0
  56. package/es/schema-component/antd/association-field/util.d.ts +8 -0
  57. package/es/schema-component/antd/association-field/util.js +84 -0
  58. package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  59. package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
  60. package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  61. package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
  62. package/es/schema-component/antd/expand-action/index.d.ts +1 -0
  63. package/es/schema-component/antd/expand-action/index.js +5 -0
  64. package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  65. package/es/schema-component/antd/filter/FilterItem.js +1 -1
  66. package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
  67. package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
  68. package/es/schema-component/antd/form-item/FormItem.js +183 -52
  69. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
  70. package/es/schema-component/antd/form-v2/utils.js +3 -1
  71. package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  72. package/es/schema-component/antd/index.d.ts +3 -1
  73. package/es/schema-component/antd/index.js +3 -1
  74. package/es/schema-component/antd/menu/Menu.js +6 -3
  75. package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  76. package/es/schema-component/antd/record-picker/InputRecordPicker.js +32 -12
  77. package/es/schema-component/antd/remote-select/RemoteSelect.js +16 -18
  78. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  79. package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  80. package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
  81. package/es/schema-component/antd/table-v2/Table.js +9 -5
  82. package/es/schema-component/antd/table-v2/index.js +3 -1
  83. package/es/schema-component/antd/table-v2/utils.js +1 -1
  84. package/es/schema-component/antd/variable/Input.js +5 -5
  85. package/es/schema-component/antd/variable/TextArea.js +2 -5
  86. package/es/schema-component/common/dnd-context/index.js +3 -2
  87. package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
  88. package/es/schema-component/common/utils/uitls.js +1 -1
  89. package/es/schema-component/hooks/index.d.ts +1 -0
  90. package/es/schema-component/hooks/index.js +2 -1
  91. package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  92. package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
  93. package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  94. package/es/schema-initializer/components/CreateRecordAction.js +4 -3
  95. package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  96. package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
  97. package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  98. package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
  99. package/es/schema-initializer/items/index.d.ts +1 -0
  100. package/es/schema-initializer/items/index.js +2 -1
  101. package/es/schema-initializer/utils.js +20 -8
  102. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  103. package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
  104. package/es/schema-settings/LinkageRules/Variables.js +7 -4
  105. package/es/schema-settings/SchemaSettings.js +2 -2
  106. package/lib/block-provider/DetailsBlockProvider.js +13 -1
  107. package/lib/block-provider/FormBlockProvider.js +31 -15
  108. package/lib/block-provider/hooks/index.d.ts +10 -0
  109. package/lib/block-provider/hooks/index.js +509 -289
  110. package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
  111. package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
  112. package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  113. package/lib/collection-manager/action-hooks.d.ts +1 -1
  114. package/lib/collection-manager/action-hooks.js +18 -7
  115. package/lib/collection-manager/interfaces/createdBy.js +1 -1
  116. package/lib/collection-manager/interfaces/linkTo.js +2 -38
  117. package/lib/collection-manager/interfaces/m2m.js +3 -37
  118. package/lib/collection-manager/interfaces/m2o.js +3 -37
  119. package/lib/collection-manager/interfaces/o2m.js +6 -70
  120. package/lib/collection-manager/interfaces/o2o.js +30 -124
  121. package/lib/collection-manager/interfaces/updatedBy.js +1 -1
  122. package/lib/collection-manager/templates/tree.js +2 -2
  123. package/lib/filter-provider/FilterProvider.js +3 -1
  124. package/lib/locale/en_US.d.ts +3 -0
  125. package/lib/locale/en_US.js +5 -2
  126. package/lib/locale/ja_JP.d.ts +3 -0
  127. package/lib/locale/ja_JP.js +3 -0
  128. package/lib/locale/zh_CN.d.ts +4 -0
  129. package/lib/locale/zh_CN.js +4 -0
  130. package/lib/schema-component/antd/action/Action.Designer.js +4 -5
  131. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  132. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +28 -0
  133. package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  134. package/lib/schema-component/antd/association-field/AssociationSelect.js +129 -0
  135. package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
  136. package/lib/schema-component/antd/association-field/Editable.js +97 -0
  137. package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
  138. package/lib/schema-component/antd/association-field/FileManager.js +253 -0
  139. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  140. package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
  141. package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  142. package/lib/schema-component/antd/association-field/InternalPicker.js +277 -0
  143. package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  144. package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
  145. package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  146. package/lib/schema-component/antd/association-field/InternalViewer.js +126 -0
  147. package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
  148. package/lib/schema-component/antd/association-field/Nester.js +89 -0
  149. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  150. package/lib/schema-component/antd/association-field/ReadPretty.js +47 -0
  151. package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
  152. package/lib/schema-component/antd/association-field/SubTable.js +33 -0
  153. package/lib/schema-component/antd/association-field/context.d.ts +7 -0
  154. package/lib/schema-component/antd/association-field/context.js +9 -0
  155. package/lib/schema-component/antd/association-field/hooks.d.ts +8 -0
  156. package/lib/schema-component/antd/association-field/hooks.js +107 -0
  157. package/lib/schema-component/antd/association-field/index.d.ts +1 -0
  158. package/lib/schema-component/antd/association-field/index.js +21 -0
  159. package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
  160. package/lib/schema-component/antd/association-field/schema.js +148 -0
  161. package/lib/schema-component/antd/association-field/util.d.ts +8 -0
  162. package/lib/schema-component/antd/association-field/util.js +98 -0
  163. package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  164. package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
  165. package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  166. package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
  167. package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
  168. package/lib/schema-component/antd/expand-action/index.js +12 -0
  169. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  170. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  171. package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
  172. package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
  173. package/lib/schema-component/antd/form-item/FormItem.js +180 -48
  174. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
  175. package/lib/schema-component/antd/form-v2/utils.js +3 -1
  176. package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  177. package/lib/schema-component/antd/index.d.ts +3 -1
  178. package/lib/schema-component/antd/index.js +33 -11
  179. package/lib/schema-component/antd/menu/Menu.js +6 -3
  180. package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  181. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +34 -13
  182. package/lib/schema-component/antd/remote-select/RemoteSelect.js +15 -17
  183. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  184. package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  185. package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
  186. package/lib/schema-component/antd/table-v2/Table.js +9 -5
  187. package/lib/schema-component/antd/table-v2/index.js +3 -1
  188. package/lib/schema-component/antd/table-v2/utils.js +1 -1
  189. package/lib/schema-component/antd/variable/Input.js +5 -5
  190. package/lib/schema-component/antd/variable/TextArea.js +2 -5
  191. package/lib/schema-component/common/dnd-context/index.js +3 -2
  192. package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
  193. package/lib/schema-component/common/utils/uitls.js +1 -1
  194. package/lib/schema-component/hooks/index.d.ts +1 -0
  195. package/lib/schema-component/hooks/index.js +11 -0
  196. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  197. package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
  198. package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  199. package/lib/schema-initializer/components/CreateRecordAction.js +4 -3
  200. package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  201. package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
  202. package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  203. package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
  204. package/lib/schema-initializer/items/index.d.ts +1 -0
  205. package/lib/schema-initializer/items/index.js +11 -0
  206. package/lib/schema-initializer/utils.js +20 -8
  207. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  208. package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
  209. package/lib/schema-settings/LinkageRules/Variables.js +7 -4
  210. package/lib/schema-settings/SchemaSettings.js +3 -3
  211. package/package.json +5 -6
@@ -0,0 +1,141 @@
1
+ export default {
2
+ Nester: {
3
+ type: 'void',
4
+ 'x-component': 'AssociationField.Nester',
5
+ properties: {
6
+ grid: {
7
+ type: 'void',
8
+ 'x-component': 'Grid',
9
+ 'x-initializer': 'FormItemInitializers'
10
+ }
11
+ }
12
+ },
13
+ AddNewer: {
14
+ type: 'void',
15
+ 'x-component': 'AssociationField.AddNewer',
16
+ 'x-action': 'create',
17
+ title: '{{ t("Add record") }}',
18
+ 'x-component-props': {
19
+ className: 'nb-action-popup'
20
+ },
21
+ properties: {
22
+ tabs: {
23
+ type: 'void',
24
+ 'x-component': 'Tabs',
25
+ 'x-component-props': {},
26
+ 'x-initializer': 'TabPaneInitializersForCreateFormBlock',
27
+ properties: {
28
+ tab1: {
29
+ type: 'void',
30
+ title: '{{t("Add new")}}',
31
+ 'x-component': 'Tabs.TabPane',
32
+ 'x-designer': 'Tabs.Designer',
33
+ 'x-component-props': {},
34
+ properties: {
35
+ grid: {
36
+ type: 'void',
37
+ 'x-component': 'Grid',
38
+ 'x-initializer': 'CreateFormBlockInitializers',
39
+ properties: {}
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ },
47
+ Selector: {
48
+ type: 'void',
49
+ 'x-component': 'AssociationField.Selector',
50
+ title: '{{ t("Select record") }}',
51
+ 'x-component-props': {
52
+ className: 'nb-record-picker-selector'
53
+ },
54
+ properties: {
55
+ grid: {
56
+ type: 'void',
57
+ 'x-component': 'Grid',
58
+ 'x-initializer': 'TableSelectorInitializers',
59
+ properties: {}
60
+ },
61
+ footer: {
62
+ 'x-component': 'Action.Container.Footer',
63
+ 'x-component-props': {},
64
+ properties: {
65
+ actions: {
66
+ type: 'void',
67
+ 'x-component': 'ActionBar',
68
+ 'x-component-props': {},
69
+ properties: {
70
+ submit: {
71
+ title: '{{ t("Submit") }}',
72
+ 'x-action': 'submit',
73
+ 'x-component': 'Action',
74
+ 'x-designer': 'Action.Designer',
75
+ 'x-component-props': {
76
+ type: 'primary',
77
+ htmlType: 'submit',
78
+ useProps: '{{ usePickActionProps }}'
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ },
87
+ Viewer: {
88
+ type: 'void',
89
+ title: '{{ t("View record") }}',
90
+ 'x-component': 'AssociationField.Viewer',
91
+ 'x-component-props': {
92
+ className: 'nb-action-popup'
93
+ },
94
+ properties: {
95
+ tabs: {
96
+ type: 'void',
97
+ 'x-component': 'Tabs',
98
+ 'x-component-props': {},
99
+ 'x-initializer': 'TabPaneInitializers',
100
+ properties: {
101
+ tab1: {
102
+ type: 'void',
103
+ title: '{{t("Details")}}',
104
+ 'x-component': 'Tabs.TabPane',
105
+ 'x-designer': 'Tabs.Designer',
106
+ 'x-component-props': {},
107
+ properties: {
108
+ grid: {
109
+ type: 'void',
110
+ 'x-component': 'Grid',
111
+ 'x-initializer': 'RecordBlockInitializers',
112
+ properties: {}
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ },
120
+ SubTable: {
121
+ type: 'void',
122
+ 'x-component': 'AssociationField.SubTable',
123
+ 'x-initializer': 'TableColumnInitializers',
124
+ properties: {
125
+ indexCol: {
126
+ type: 'void',
127
+ 'x-component': 'TableV2.Column',
128
+ 'x-component-props': {
129
+ width: 80
130
+ },
131
+ properties: {
132
+ __index__: {
133
+ type: 'void',
134
+ 'x-component': 'TableV2.Index',
135
+ 'x-read-pretty': true
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+ };
@@ -0,0 +1,8 @@
1
+ import { ISchema } from '@formily/react';
2
+ import { CollectionFieldOptions } from '../../../collection-manager';
3
+ export declare const useLabelUiSchema: (collectionField: CollectionFieldOptions, label: string) => ISchema;
4
+ export declare const getDatePickerLabels: (props: any) => string;
5
+ export declare const getLabelFormatValue: (labelUiSchema: ISchema, value: any, isTag?: boolean) => any;
6
+ export declare function flatData(data: any): any[];
7
+ export declare function isShowFilePicker(labelUiSchema: any): boolean;
8
+ export declare const toValue: (value: any, placeholder: any) => any;
@@ -0,0 +1,84 @@
1
+ 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); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ 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."); }
4
+ 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); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
8
+ 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; }
9
+ 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; }
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ import { isArr } from '@formily/shared';
14
+ import { getDefaultFormat, str2moment } from '@nocobase/utils/client';
15
+ import { Tag } from 'antd';
16
+ import React from 'react';
17
+ import { useCollectionManager } from '../../../collection-manager';
18
+ export var useLabelUiSchema = function useLabelUiSchema(collectionField, label) {
19
+ var _useCollectionManager = useCollectionManager(),
20
+ getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
21
+ if (!collectionField) {
22
+ return;
23
+ }
24
+ var labelField = getCollectionJoinField("".concat(collectionField.target, ".").concat(label));
25
+ return labelField === null || labelField === void 0 ? void 0 : labelField.uiSchema;
26
+ };
27
+ export var getDatePickerLabels = function getDatePickerLabels(props) {
28
+ var format = getDefaultFormat(props);
29
+ var m = str2moment(props.value, props);
30
+ var labels = m && m.isValid() ? m.format(format) : props.value;
31
+ return isArr(labels) ? labels.join('~') : labels;
32
+ };
33
+ var toArr = function toArr(v) {
34
+ if (!v) {
35
+ return [];
36
+ }
37
+ return Array.isArray(v) ? v : [v];
38
+ };
39
+ export var getLabelFormatValue = function getLabelFormatValue(labelUiSchema, value) {
40
+ var isTag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
41
+ var options = labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema.enum;
42
+ if (Array.isArray(options) && value) {
43
+ var values = toArr(value).map(function (val) {
44
+ var opt = options.find(function (option) {
45
+ return option.value === val;
46
+ });
47
+ if (isTag) {
48
+ return /*#__PURE__*/React.createElement(Tag, {
49
+ color: opt === null || opt === void 0 ? void 0 : opt.color
50
+ }, opt === null || opt === void 0 ? void 0 : opt.label);
51
+ }
52
+ return opt === null || opt === void 0 ? void 0 : opt.label;
53
+ });
54
+ return isTag ? values : values.join(', ');
55
+ }
56
+ switch (labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component']) {
57
+ case 'DatePicker':
58
+ return getDatePickerLabels(_objectSpread(_objectSpread({}, labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component-props']), {}, {
59
+ value: value
60
+ }));
61
+ default:
62
+ return value;
63
+ }
64
+ };
65
+ export function flatData(data) {
66
+ var newArr = [];
67
+ for (var i = 0; i < data.length; i++) {
68
+ var children = data[i]['children'];
69
+ if (Array.isArray(children)) {
70
+ newArr.push.apply(newArr, _toConsumableArray(flatData(children)));
71
+ }
72
+ newArr.push(_objectSpread({}, data[i]));
73
+ }
74
+ return newArr;
75
+ }
76
+ export function isShowFilePicker(labelUiSchema) {
77
+ return (labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component']) === 'Preview';
78
+ }
79
+ export var toValue = function toValue(value, placeholder) {
80
+ if (value === null || value === undefined) {
81
+ return placeholder;
82
+ }
83
+ return value;
84
+ };
@@ -0,0 +1 @@
1
+ export declare const ExpandActionDesign: (props: any) => JSX.Element;
@@ -0,0 +1,112 @@
1
+ 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); }
2
+ 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; }
3
+ 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; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import React from 'react';
8
+ import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
9
+ import { useTranslation } from 'react-i18next';
10
+ import { useFieldSchema, useField } from '@formily/react';
11
+ import { useDesignable } from '../..';
12
+ export var ExpandActionDesign = function ExpandActionDesign(props) {
13
+ var _fieldSchema$xCompon, _fieldSchema$xCompon2;
14
+ var _useTranslation = useTranslation(),
15
+ t = _useTranslation.t;
16
+ var fieldSchema = useFieldSchema();
17
+ var field = useField();
18
+ var _useDesignable = useDesignable(),
19
+ dn = _useDesignable.dn;
20
+ var _ref = fieldSchema['x-component-props'] || {},
21
+ titleExpand = _ref.titleExpand,
22
+ titleCollapse = _ref.titleCollapse,
23
+ iconExpand = _ref.iconExpand,
24
+ iconCollapse = _ref.iconCollapse;
25
+ return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, _objectSpread(_objectSpread({}, props), {}, {
26
+ disableInitializer: true
27
+ }), /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
28
+ title: t('Edit button'),
29
+ schema: {
30
+ type: 'object',
31
+ title: t('Edit button'),
32
+ properties: {
33
+ titleExpand: {
34
+ 'x-decorator': 'FormItem',
35
+ 'x-component': 'Input',
36
+ title: "".concat(t('Button title'), " - ").concat(t('Expand all')),
37
+ default: titleExpand
38
+ },
39
+ titleCollapse: {
40
+ 'x-decorator': 'FormItem',
41
+ 'x-component': 'Input',
42
+ title: "".concat(t('Button title'), " - ").concat(t('Collapse all')),
43
+ default: titleCollapse
44
+ },
45
+ iconExpand: {
46
+ 'x-decorator': 'FormItem',
47
+ 'x-component': 'IconPicker',
48
+ title: "".concat(t('Button icon'), " - ").concat(t('Expand all')),
49
+ default: iconExpand
50
+ },
51
+ iconCollapse: {
52
+ 'x-decorator': 'FormItem',
53
+ 'x-component': 'IconPicker',
54
+ title: "".concat(t('Button icon'), " - ").concat(t('Collapse all')),
55
+ default: iconCollapse
56
+ },
57
+ type: {
58
+ 'x-decorator': 'FormItem',
59
+ 'x-component': 'Radio.Group',
60
+ title: t('Button background color'),
61
+ default: (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.danger) ? 'danger' : (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.type) === 'primary' ? 'primary' : 'default',
62
+ enum: [{
63
+ value: 'default',
64
+ label: '{{t("Default")}}'
65
+ }, {
66
+ value: 'primary',
67
+ label: '{{t("Highlight")}}'
68
+ }, {
69
+ value: 'danger',
70
+ label: '{{t("Danger red")}}'
71
+ }]
72
+ }
73
+ }
74
+ },
75
+ onSubmit: function onSubmit(_ref2) {
76
+ var titleExpand = _ref2.titleExpand,
77
+ titleCollapse = _ref2.titleCollapse,
78
+ iconExpand = _ref2.iconExpand,
79
+ iconCollapse = _ref2.iconCollapse,
80
+ type = _ref2.type;
81
+ fieldSchema.title = t('Expand/Collapse');
82
+ field.title = t('Expand/Collapse');
83
+ field.componentProps.icon = iconExpand;
84
+ field.componentProps.danger = type === 'danger';
85
+ field.componentProps.type = type;
86
+ fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema['x-component-props'] || {}), {}, {
87
+ titleExpand: titleExpand,
88
+ titleCollapse: titleCollapse,
89
+ iconExpand: iconExpand,
90
+ iconCollapse: iconCollapse,
91
+ type: type,
92
+ danger: type === 'danger'
93
+ });
94
+ dn.emit('patch', {
95
+ schema: {
96
+ 'x-uid': fieldSchema['x-uid'],
97
+ 'x-component-props': fieldSchema['x-component-props'],
98
+ title: fieldSchema.title
99
+ }
100
+ });
101
+ dn.refresh();
102
+ }
103
+ }), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Remove, {
104
+ removeParentsIfNoChildren: true,
105
+ breakRemoveOn: function breakRemoveOn(s) {
106
+ return s['x-component'] === 'Space' || s['x-component'].endsWith('ActionBar');
107
+ },
108
+ confirm: {
109
+ title: t('Delete action')
110
+ }
111
+ }));
112
+ };
@@ -0,0 +1 @@
1
+ export declare const ExpandAction: (props: any) => JSX.Element;
@@ -0,0 +1,40 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import React from 'react';
4
+ import { useFieldSchema } from '@formily/react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { useTableBlockContext, useTableSelectorContext } from '../../../block-provider';
7
+ import { Button } from 'antd';
8
+ import { css } from '@emotion/css';
9
+ import { Icon } from '../../../icon';
10
+ var actionDesignerCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(241, 139, 98, 0.06);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n"])));
11
+ export var ExpandAction = function ExpandAction(props) {
12
+ var _schema$parent, _schema$parent$parent;
13
+ var _useTranslation = useTranslation(),
14
+ t = _useTranslation.t;
15
+ var schema = useFieldSchema();
16
+ var ctxSelector = useTableSelectorContext();
17
+ var ctxBlock = useTableBlockContext();
18
+ var isTableSelector = ((_schema$parent = schema.parent) === null || _schema$parent === void 0 ? void 0 : (_schema$parent$parent = _schema$parent.parent) === null || _schema$parent$parent === void 0 ? void 0 : _schema$parent$parent['x-decorator']) === 'TableSelectorProvider';
19
+ var ctx = isTableSelector ? ctxSelector : ctxBlock;
20
+ var _ref = schema['x-component-props'] || {},
21
+ titleExpand = _ref.titleExpand,
22
+ titleCollapse = _ref.titleCollapse,
23
+ iconExpand = _ref.iconExpand,
24
+ iconCollapse = _ref.iconCollapse;
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ className: actionDesignerCss
27
+ }, (ctx === null || ctx === void 0 ? void 0 : ctx.params['tree']) && /*#__PURE__*/React.createElement(Button, {
28
+ onClick: function onClick() {
29
+ ctx === null || ctx === void 0 ? void 0 : ctx.setExpandFlag();
30
+ },
31
+ icon: /*#__PURE__*/React.createElement(Icon, {
32
+ type: (ctx === null || ctx === void 0 ? void 0 : ctx.expandFlag) ? iconCollapse : iconExpand
33
+ }),
34
+ type: props.type
35
+ }, props.children[1], /*#__PURE__*/React.createElement("span", {
36
+ style: {
37
+ marginLeft: 10
38
+ }
39
+ }, (ctx === null || ctx === void 0 ? void 0 : ctx.expandFlag) ? titleCollapse : titleExpand)));
40
+ };
@@ -0,0 +1 @@
1
+ export declare const Expand: any;
@@ -0,0 +1,5 @@
1
+ import { ExpandAction } from './Expand.Action';
2
+ import { ExpandActionDesign } from './Expand.Action.Design';
3
+ export var Expand = ExpandAction;
4
+ Expand.Action = ExpandAction;
5
+ Expand.Action.Design = ExpandActionDesign;
@@ -92,20 +92,18 @@ export var FilterActionDesigner = function FilterActionDesigner(props) {
92
92
  }
93
93
  },
94
94
  onSubmit: function onSubmit(_ref) {
95
+ var _schema2;
95
96
  var title = _ref.title,
96
97
  icon = _ref.icon;
97
- if (title) {
98
- var _schema2;
99
- fieldSchema.title = title;
100
- field.title = title;
101
- field.componentProps.icon = icon;
102
- fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
103
- fieldSchema['x-component-props'].icon = icon;
104
- dn.emit('patch', {
105
- schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, "title", title), _defineProperty(_schema2, 'x-component-props', _objectSpread({}, fieldSchema['x-component-props'])), _schema2)
106
- });
107
- dn.refresh();
108
- }
98
+ fieldSchema.title = title;
99
+ field.title = title;
100
+ field.componentProps.icon = icon;
101
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
102
+ fieldSchema['x-component-props'].icon = icon;
103
+ dn.emit('patch', {
104
+ schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, "title", title), _defineProperty(_schema2, 'x-component-props', _objectSpread({}, fieldSchema['x-component-props'])), _schema2)
105
+ });
106
+ dn.refresh();
109
107
  }
110
108
  }), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Remove, {
111
109
  removeParentsIfNoChildren: true,
@@ -52,7 +52,7 @@ export var FilterItem = observer(function (props) {
52
52
  },
53
53
  placeholder: t('Comparision')
54
54
  }), !(operator === null || operator === void 0 ? void 0 : operator.noValue) && /*#__PURE__*/React.createElement(DynamicComponent, {
55
- value: value,
55
+ value: value ? value : undefined,
56
56
  schema: schema,
57
57
  onChange: function onChange(value) {
58
58
  setValue(value);
@@ -2,4 +2,4 @@
2
2
  * 获取当前字段所支持的操作符列表
3
3
  * @returns
4
4
  */
5
- export declare const useOperatorList: () => any;
5
+ export declare const useOperatorList: () => any[];
@@ -1,4 +1,5 @@
1
1
  import { ISchema } from '@formily/react';
2
- import { CollectionFieldOptions } from '../../../collection-manager';
2
+ import { Collection, CollectionFieldOptions } from '../../../collection-manager';
3
3
  export declare const FormItem: any;
4
+ export declare function isFileCollection(collection: Collection): boolean;
4
5
  export declare function getFieldDefaultValue(fieldSchema: ISchema, collectionField: CollectionFieldOptions): any;