@nocobase/client 0.9.2-alpha.3 → 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 (237) hide show
  1. package/es/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
  2. package/es/api-client/hooks/useRequest.d.ts +1 -14
  3. package/es/api-client/hooks/useRequest.js +48 -53
  4. package/es/block-provider/DetailsBlockProvider.js +13 -1
  5. package/es/block-provider/FormBlockProvider.js +30 -13
  6. package/es/block-provider/hooks/index.d.ts +11 -1
  7. package/es/block-provider/hooks/index.js +527 -301
  8. package/es/collection-manager/Configuration/CollectionFields.js +1 -2
  9. package/es/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
  10. package/es/collection-manager/action-hooks.d.ts +4 -43
  11. package/es/collection-manager/action-hooks.js +18 -7
  12. package/es/collection-manager/interfaces/createdBy.js +1 -1
  13. package/es/collection-manager/interfaces/linkTo.js +5 -40
  14. package/es/collection-manager/interfaces/m2m.js +6 -39
  15. package/es/collection-manager/interfaces/m2o.js +6 -39
  16. package/es/collection-manager/interfaces/o2m.js +6 -69
  17. package/es/collection-manager/interfaces/o2o.js +31 -122
  18. package/es/collection-manager/interfaces/types.d.ts +2 -0
  19. package/es/collection-manager/interfaces/updatedBy.js +1 -1
  20. package/es/collection-manager/sub-table.d.ts +1 -14
  21. package/es/collection-manager/templates/tree.js +2 -2
  22. package/es/filter-provider/FilterProvider.js +3 -1
  23. package/es/locale/en_US.d.ts +4 -1
  24. package/es/locale/en_US.js +6 -3
  25. package/es/locale/ja_JP.d.ts +4 -1
  26. package/es/locale/ja_JP.js +4 -1
  27. package/es/locale/pt_BR.d.ts +1 -1
  28. package/es/locale/pt_BR.js +1 -1
  29. package/es/locale/zh_CN.d.ts +5 -1
  30. package/es/locale/zh_CN.js +5 -1
  31. package/es/schema-component/antd/action/Action.Designer.js +4 -5
  32. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  33. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +19 -0
  34. package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  35. package/es/schema-component/antd/association-field/AssociationSelect.js +118 -0
  36. package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
  37. package/es/schema-component/antd/association-field/Editable.js +88 -0
  38. package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
  39. package/es/schema-component/antd/association-field/FileManager.js +243 -0
  40. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  41. package/es/schema-component/antd/association-field/InternalNester.js +28 -0
  42. package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  43. package/es/schema-component/antd/association-field/InternalPicker.js +267 -0
  44. package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  45. package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
  46. package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  47. package/es/schema-component/antd/association-field/InternalViewer.js +115 -0
  48. package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
  49. package/es/schema-component/antd/association-field/Nester.js +80 -0
  50. package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  51. package/es/schema-component/antd/association-field/ReadPretty.js +38 -0
  52. package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
  53. package/es/schema-component/antd/association-field/SubTable.js +25 -0
  54. package/es/schema-component/antd/association-field/context.d.ts +7 -0
  55. package/es/schema-component/antd/association-field/context.js +2 -0
  56. package/es/schema-component/antd/association-field/hooks.d.ts +8 -0
  57. package/es/schema-component/antd/association-field/hooks.js +96 -0
  58. package/es/schema-component/antd/association-field/index.d.ts +1 -0
  59. package/es/schema-component/antd/association-field/index.js +14 -0
  60. package/es/schema-component/antd/association-field/schema.d.ts +142 -0
  61. package/es/schema-component/antd/association-field/schema.js +141 -0
  62. package/es/schema-component/antd/association-field/util.d.ts +8 -0
  63. package/es/schema-component/antd/association-field/util.js +84 -0
  64. package/es/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
  65. package/es/schema-component/antd/association-select/AssociationSelect.js +11 -2
  66. package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  67. package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
  68. package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  69. package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
  70. package/es/schema-component/antd/expand-action/index.d.ts +1 -0
  71. package/es/schema-component/antd/expand-action/index.js +5 -0
  72. package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  73. package/es/schema-component/antd/filter/FilterItem.js +1 -1
  74. package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
  75. package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
  76. package/es/schema-component/antd/form-item/FormItem.js +206 -58
  77. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
  78. package/es/schema-component/antd/form-v2/utils.js +6 -4
  79. package/es/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
  80. package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  81. package/es/schema-component/antd/index.d.ts +3 -1
  82. package/es/schema-component/antd/index.js +3 -1
  83. package/es/schema-component/antd/menu/Menu.js +6 -3
  84. package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  85. package/es/schema-component/antd/record-picker/InputRecordPicker.js +40 -17
  86. package/es/schema-component/antd/remote-select/RemoteSelect.js +16 -18
  87. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  88. package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  89. package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
  90. package/es/schema-component/antd/table-v2/Table.js +9 -5
  91. package/es/schema-component/antd/table-v2/index.js +3 -1
  92. package/es/schema-component/antd/table-v2/utils.js +1 -1
  93. package/es/schema-component/antd/variable/Input.js +15 -16
  94. package/es/schema-component/antd/variable/TextArea.js +2 -5
  95. package/es/schema-component/antd/variable/Variable.d.ts +2 -0
  96. package/es/schema-component/antd/variable/Variable.js +5 -2
  97. package/es/schema-component/common/dnd-context/index.js +3 -2
  98. package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
  99. package/es/schema-component/common/utils/uitls.js +1 -1
  100. package/es/schema-component/hooks/index.d.ts +1 -0
  101. package/es/schema-component/hooks/index.js +2 -1
  102. package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  103. package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
  104. package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  105. package/es/schema-initializer/components/CreateRecordAction.js +4 -3
  106. package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  107. package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
  108. package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  109. package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
  110. package/es/schema-initializer/items/index.d.ts +1 -0
  111. package/es/schema-initializer/items/index.js +2 -1
  112. package/es/schema-initializer/utils.js +57 -43
  113. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  114. package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
  115. package/es/schema-settings/LinkageRules/Variables.js +7 -4
  116. package/es/schema-settings/SchemaSettings.js +3 -3
  117. package/es/schema-settings/VariableInput/VariableInput.d.ts +3 -2
  118. package/es/schema-settings/VariableInput/VariableInput.js +3 -1
  119. package/lib/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
  120. package/lib/api-client/hooks/useRequest.d.ts +1 -14
  121. package/lib/api-client/hooks/useRequest.js +48 -53
  122. package/lib/block-provider/DetailsBlockProvider.js +13 -1
  123. package/lib/block-provider/FormBlockProvider.js +31 -15
  124. package/lib/block-provider/hooks/index.d.ts +11 -1
  125. package/lib/block-provider/hooks/index.js +537 -308
  126. package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
  127. package/lib/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
  128. package/lib/collection-manager/action-hooks.d.ts +4 -43
  129. package/lib/collection-manager/action-hooks.js +18 -7
  130. package/lib/collection-manager/interfaces/createdBy.js +1 -1
  131. package/lib/collection-manager/interfaces/linkTo.js +4 -39
  132. package/lib/collection-manager/interfaces/m2m.js +5 -38
  133. package/lib/collection-manager/interfaces/m2o.js +5 -38
  134. package/lib/collection-manager/interfaces/o2m.js +8 -71
  135. package/lib/collection-manager/interfaces/o2o.js +36 -127
  136. package/lib/collection-manager/interfaces/types.d.ts +2 -0
  137. package/lib/collection-manager/interfaces/updatedBy.js +1 -1
  138. package/lib/collection-manager/sub-table.d.ts +1 -14
  139. package/lib/collection-manager/templates/tree.js +2 -2
  140. package/lib/filter-provider/FilterProvider.js +3 -1
  141. package/lib/locale/en_US.d.ts +4 -1
  142. package/lib/locale/en_US.js +6 -3
  143. package/lib/locale/ja_JP.d.ts +4 -1
  144. package/lib/locale/ja_JP.js +4 -1
  145. package/lib/locale/pt_BR.d.ts +1 -1
  146. package/lib/locale/pt_BR.js +1 -1
  147. package/lib/locale/zh_CN.d.ts +5 -1
  148. package/lib/locale/zh_CN.js +5 -1
  149. package/lib/schema-component/antd/action/Action.Designer.js +4 -5
  150. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  151. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +28 -0
  152. package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  153. package/lib/schema-component/antd/association-field/AssociationSelect.js +129 -0
  154. package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
  155. package/lib/schema-component/antd/association-field/Editable.js +97 -0
  156. package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
  157. package/lib/schema-component/antd/association-field/FileManager.js +253 -0
  158. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  159. package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
  160. package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  161. package/lib/schema-component/antd/association-field/InternalPicker.js +277 -0
  162. package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  163. package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
  164. package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  165. package/lib/schema-component/antd/association-field/InternalViewer.js +126 -0
  166. package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
  167. package/lib/schema-component/antd/association-field/Nester.js +89 -0
  168. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  169. package/lib/schema-component/antd/association-field/ReadPretty.js +47 -0
  170. package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
  171. package/lib/schema-component/antd/association-field/SubTable.js +33 -0
  172. package/lib/schema-component/antd/association-field/context.d.ts +7 -0
  173. package/lib/schema-component/antd/association-field/context.js +9 -0
  174. package/lib/schema-component/antd/association-field/hooks.d.ts +8 -0
  175. package/lib/schema-component/antd/association-field/hooks.js +107 -0
  176. package/lib/schema-component/antd/association-field/index.d.ts +1 -0
  177. package/lib/schema-component/antd/association-field/index.js +21 -0
  178. package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
  179. package/lib/schema-component/antd/association-field/schema.js +148 -0
  180. package/lib/schema-component/antd/association-field/util.d.ts +8 -0
  181. package/lib/schema-component/antd/association-field/util.js +98 -0
  182. package/lib/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
  183. package/lib/schema-component/antd/association-select/AssociationSelect.js +10 -1
  184. package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  185. package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
  186. package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  187. package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
  188. package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
  189. package/lib/schema-component/antd/expand-action/index.js +12 -0
  190. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  191. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  192. package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
  193. package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
  194. package/lib/schema-component/antd/form-item/FormItem.js +204 -55
  195. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
  196. package/lib/schema-component/antd/form-v2/utils.js +6 -5
  197. package/lib/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
  198. package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  199. package/lib/schema-component/antd/index.d.ts +3 -1
  200. package/lib/schema-component/antd/index.js +33 -11
  201. package/lib/schema-component/antd/menu/Menu.js +6 -3
  202. package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  203. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +42 -18
  204. package/lib/schema-component/antd/remote-select/RemoteSelect.js +15 -17
  205. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  206. package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  207. package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
  208. package/lib/schema-component/antd/table-v2/Table.js +9 -5
  209. package/lib/schema-component/antd/table-v2/index.js +3 -1
  210. package/lib/schema-component/antd/table-v2/utils.js +1 -1
  211. package/lib/schema-component/antd/variable/Input.js +15 -16
  212. package/lib/schema-component/antd/variable/TextArea.js +2 -5
  213. package/lib/schema-component/antd/variable/Variable.d.ts +2 -0
  214. package/lib/schema-component/antd/variable/Variable.js +6 -2
  215. package/lib/schema-component/common/dnd-context/index.js +3 -2
  216. package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
  217. package/lib/schema-component/common/utils/uitls.js +1 -1
  218. package/lib/schema-component/hooks/index.d.ts +1 -0
  219. package/lib/schema-component/hooks/index.js +11 -0
  220. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  221. package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
  222. package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  223. package/lib/schema-initializer/components/CreateRecordAction.js +4 -3
  224. package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  225. package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
  226. package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  227. package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
  228. package/lib/schema-initializer/items/index.d.ts +1 -0
  229. package/lib/schema-initializer/items/index.js +11 -0
  230. package/lib/schema-initializer/utils.js +56 -42
  231. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  232. package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
  233. package/lib/schema-settings/LinkageRules/Variables.js +7 -4
  234. package/lib/schema-settings/SchemaSettings.js +4 -4
  235. package/lib/schema-settings/VariableInput/VariableInput.d.ts +3 -2
  236. package/lib/schema-settings/VariableInput/VariableInput.js +3 -1
  237. package/package.json +5 -6
@@ -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;
@@ -1,34 +1,39 @@
1
- var _templateObject;
2
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
+ var _templateObject, _templateObject2;
3
3
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
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
5
  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; }
6
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
7
6
  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; }
8
7
  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; }
9
8
  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; }
10
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
10
  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); }
11
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
12
  import { css } from '@emotion/css';
13
- import { ArrayCollapse, FormLayout, FormItem as Item } from '@formily/antd';
13
+ import { ArrayCollapse, FormLayout, FormItem as Item, ArrayItems } from '@formily/antd';
14
14
  import { observer, useField, useFieldSchema } from '@formily/react';
15
15
  import { uid } from '@formily/shared';
16
16
  import _ from 'lodash';
17
+ import moment from 'moment';
17
18
  import React, { useContext, useEffect } from 'react';
18
19
  import { useTranslation } from 'react-i18next';
19
20
  import { ACLCollectionFieldProvider } from '../../../acl/ACLProvider';
20
21
  import { BlockRequestContext, useFilterByTk, useFormBlockContext } from '../../../block-provider';
21
- import { useCollection, useCollectionManager } from '../../../collection-manager';
22
+ import { useCollection, useCollectionManager, useSortFields, useCollectionFilterOptions } from '../../../collection-manager';
22
23
  import { isTitleField } from '../../../collection-manager/Configuration/CollectionFields';
23
24
  import { GeneralSchemaDesigner, SchemaSettings, isPatternDisabled, isShowDefaultValue } from '../../../schema-settings';
24
25
  import { VariableInput } from '../../../schema-settings/VariableInput/VariableInput';
26
+ import { FilterDynamicComponent } from '../table-v2/FilterDynamicComponent';
25
27
  import { isVariable, parseVariables, useVariablesCtx } from '../../common/utils/uitls';
26
28
  import { SchemaComponent } from '../../core';
27
- import { useCompile, useDesignable, useFieldComponentOptions } from '../../hooks';
29
+ import { removeNullCondition } from '../filter';
30
+ import { useCompile, useDesignable, useFieldModeOptions } from '../../hooks';
28
31
  import { BlockItem } from '../block-item';
29
32
  import { HTMLEncode } from '../input/shared';
33
+ import { isInvariable } from '../variable';
30
34
  import { FilterFormDesigner } from './FormItem.FilterFormDesigner';
31
35
  import { useEnsureOperatorsValid } from './SchemaSettingOptions';
36
+ var defaultInputStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & > .nb-form-item {\n flex: 1;\n }\n"])));
32
37
  var divWrap = function divWrap(schema) {
33
38
  return {
34
39
  type: 'void',
@@ -60,7 +65,7 @@ export var FormItem = observer(function (props) {
60
65
  return /*#__PURE__*/React.createElement(ACLCollectionFieldProvider, null, /*#__PURE__*/React.createElement(BlockItem, {
61
66
  className: 'nb-form-item'
62
67
  }, /*#__PURE__*/React.createElement(Item, _objectSpread(_objectSpread({
63
- className: "".concat(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]))))
68
+ className: "".concat(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]))))
64
69
  }, props), {}, {
65
70
  extra: typeof field.description === 'string' ? /*#__PURE__*/React.createElement("div", {
66
71
  dangerouslySetInnerHTML: {
@@ -70,7 +75,7 @@ export var FormItem = observer(function (props) {
70
75
  }))));
71
76
  });
72
77
  FormItem.Designer = function Designer() {
73
- var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _field$componentProps, _field$componentProps2;
78
+ var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _field$componentProps, _field$componentProps2, _field$componentProps3, _field$componentProps4, _field$componentProps5, _field$componentProps6, _field$componentProps7, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps8, _field$componentProps9;
74
79
  var _useCollectionManager = useCollectionManager(),
75
80
  getCollectionFields = _useCollectionManager.getCollectionFields,
76
81
  getInterface = _useCollectionManager.getInterface,
@@ -97,8 +102,10 @@ FormItem.Designer = function Designer() {
97
102
  var validateSchema = interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$vali = interfaceConfig['validateSchema']) === null || _interfaceConfig$vali === void 0 ? void 0 : _interfaceConfig$vali.call(interfaceConfig, fieldSchema);
98
103
  var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title;
99
104
  var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) : (_getCollectionFields = getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection)) !== null && _getCollectionFields !== void 0 ? _getCollectionFields : [];
100
- var fieldComponentOptions = useFieldComponentOptions();
101
- var isSubFormAssociationField = field.address.segments.includes('__form_grid');
105
+ var fieldModeOptions = useFieldModeOptions();
106
+ var isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.type);
107
+ var isTableField = fieldSchema['x-component'] === 'TableField';
108
+ var isFileField = isFileCollection(targetCollection);
102
109
  var initialValue = {
103
110
  title: field.title === originalTitle ? undefined : field.title
104
111
  };
@@ -121,6 +128,21 @@ FormItem.Designer = function Designer() {
121
128
  if (fieldSchema['x-read-pretty'] === true) {
122
129
  readOnlyMode = 'read-pretty';
123
130
  }
131
+ var dataSource = useCollectionFilterOptions(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
132
+ var defaultFilter = ((_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.service) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.params) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.filter) || {};
133
+ var sortFields = useSortFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
134
+ var defaultSort = ((_field$componentProps4 = field.componentProps) === null || _field$componentProps4 === void 0 ? void 0 : (_field$componentProps5 = _field$componentProps4.service) === null || _field$componentProps5 === void 0 ? void 0 : (_field$componentProps6 = _field$componentProps5.params) === null || _field$componentProps6 === void 0 ? void 0 : _field$componentProps6.sort) || [];
135
+ var fieldMode = (field === null || field === void 0 ? void 0 : (_field$componentProps7 = field.componentProps) === null || _field$componentProps7 === void 0 ? void 0 : _field$componentProps7['mode']) || (isFileField ? 'FileManager' : 'Select');
136
+ var isSelectFieldMode = fieldMode === 'Select';
137
+ var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
138
+ return item.startsWith('-') ? {
139
+ field: item.substring(1),
140
+ direction: 'desc'
141
+ } : {
142
+ field: item,
143
+ direction: 'asc'
144
+ };
145
+ });
124
146
  return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, null, collectionField && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
125
147
  key: "edit-field-title",
126
148
  title: t('Edit field title'),
@@ -222,10 +244,10 @@ FormItem.Designer = function Designer() {
222
244
  });
223
245
  refresh();
224
246
  }
225
- }), !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileCollection(targetCollection) ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
247
+ }), !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
226
248
  key: "quick-upload",
227
249
  title: t('Quick upload'),
228
- checked: (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.quickUpload,
250
+ checked: ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.quickUpload) !== false,
229
251
  onChange: function onChange(value) {
230
252
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
231
253
  field.componentProps.quickUpload = value;
@@ -237,10 +259,10 @@ FormItem.Designer = function Designer() {
237
259
  });
238
260
  refresh();
239
261
  }
240
- }) : null, !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileCollection(targetCollection) ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
262
+ }) : null, !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
241
263
  key: "select-file",
242
264
  title: t('Select file'),
243
- checked: (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.selectFile,
265
+ checked: ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.selectFile) !== false,
244
266
  onChange: function onChange(value) {
245
267
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
246
268
  field.componentProps.selectFile = value;
@@ -399,27 +421,35 @@ FormItem.Designer = function Designer() {
399
421
  type: 'object',
400
422
  title: t('Set default value'),
401
423
  properties: {
402
- // 关系字段不支持设置变量
403
- default: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
424
+ default: isInvariable(interfaceConfig) ? _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
404
425
  'x-decorator': 'FormItem',
405
426
  'x-component-props': _objectSpread(_objectSpread({}, fieldSchema['x-component-props']), {}, {
406
427
  component: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) && collectionField.interface !== 'chinaRegion' ? 'AssociationSelect' : undefined,
407
428
  service: {
408
429
  resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
430
+ },
431
+ style: {
432
+ width: '100%',
433
+ verticalAlign: 'top'
409
434
  }
410
435
  }),
411
436
  name: 'default',
412
437
  title: t('Default value'),
413
- default: getFieldDefaultValue(fieldSchema, collectionField)
438
+ default: getFieldDefaultValue(fieldSchema, collectionField),
439
+ 'x-read-pretty': false,
440
+ 'x-disabled': false
414
441
  }) : _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
415
442
  'x-decorator': 'FormItem',
416
443
  'x-component': 'VariableInput',
417
444
  'x-component-props': _objectSpread(_objectSpread({}, (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']) || {}), {}, {
418
445
  collectionName: collectionField === null || collectionField === void 0 ? void 0 : collectionField.collectionName,
419
446
  schema: collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema,
447
+ className: defaultInputStyle,
420
448
  renderSchemaComponent: function Com(props) {
421
449
  var s = _.cloneDeep(fieldSchema) || {};
422
450
  s.title = '';
451
+ s['x-read-pretty'] = false;
452
+ s['x-disabled'] = false;
423
453
  return /*#__PURE__*/React.createElement(SchemaComponent, {
424
454
  schema: _objectSpread(_objectSpread({}, s || {}), {}, {
425
455
  'x-component-props': _objectSpread(_objectSpread({}, s['x-component-props']), {}, {
@@ -427,7 +457,8 @@ FormItem.Designer = function Designer() {
427
457
  value: props.value,
428
458
  defaultValue: getFieldDefaultValue(s, collectionField),
429
459
  style: {
430
- width: '100%'
460
+ width: '100%',
461
+ verticalAlign: 'top'
431
462
  }
432
463
  })
433
464
  })
@@ -452,44 +483,154 @@ FormItem.Designer = function Designer() {
452
483
  });
453
484
  refresh();
454
485
  }
455
- }), form && !isSubFormAssociationField && fieldComponentOptions && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
456
- title: t('Field component'),
457
- options: fieldComponentOptions,
458
- value: fieldSchema['x-component'],
459
- onChange: function onChange(type) {
460
- var _collectionField$uiSc4, _interfaceConfig$sche;
461
- var schema = {
462
- name: collectionField === null || collectionField === void 0 ? void 0 : collectionField.name,
463
- type: 'void',
464
- required: fieldSchema['required'],
465
- description: fieldSchema['description'],
466
- default: fieldSchema['default'],
467
- 'x-decorator': 'FormItem',
468
- 'x-designer': 'FormItem.Designer',
469
- 'x-component': type,
470
- 'x-validator': fieldSchema['x-validator'],
471
- 'x-collection-field': fieldSchema['x-collection-field'],
472
- 'x-decorator-props': fieldSchema['x-decorator-props'],
473
- 'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['x-component-props']), fieldSchema['x-component-props'])
474
- };
475
- interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
476
- field: collectionField,
477
- block: 'Form',
478
- readPretty: field.readPretty,
479
- action: tk ? 'get' : null,
480
- targetCollection: targetCollection
486
+ }), isSelectFieldMode && !field.readPretty && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
487
+ title: t('Set the data scope'),
488
+ schema: {
489
+ type: 'object',
490
+ title: t('Set the data scope'),
491
+ properties: {
492
+ filter: {
493
+ default: defaultFilter,
494
+ // title: '数据范围',
495
+ enum: dataSource,
496
+ 'x-component': 'Filter',
497
+ 'x-component-props': {
498
+ dynamicComponent: function dynamicComponent(props) {
499
+ return FilterDynamicComponent(_objectSpread({}, props));
500
+ }
501
+ }
502
+ }
503
+ }
504
+ },
505
+ onSubmit: function onSubmit(_ref4) {
506
+ var _schema6;
507
+ var filter = _ref4.filter;
508
+ filter = removeNullCondition(filter);
509
+ _.set(field.componentProps, 'service.params.filter', filter);
510
+ fieldSchema['x-component-props'] = field.componentProps;
511
+ field.componentProps = field.componentProps;
512
+ dn.emit('patch', {
513
+ schema: (_schema6 = {}, _defineProperty(_schema6, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema6, 'x-component-props', field.componentProps), _schema6)
481
514
  });
482
- insertAdjacent('beforeBegin', divWrap(schema), {
483
- onSuccess: function onSuccess() {
484
- dn.remove(null, {
485
- removeParentsIfNoChildren: true,
486
- breakRemoveOn: {
487
- 'x-component': 'Grid'
515
+ }
516
+ }), isSelectFieldMode && !field.readPretty && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
517
+ title: t('Set default sorting rules'),
518
+ components: {
519
+ ArrayItems: ArrayItems
520
+ },
521
+ schema: {
522
+ type: 'object',
523
+ title: t('Set default sorting rules'),
524
+ properties: {
525
+ sort: {
526
+ type: 'array',
527
+ default: sort,
528
+ 'x-component': 'ArrayItems',
529
+ 'x-decorator': 'FormItem',
530
+ items: {
531
+ type: 'object',
532
+ properties: {
533
+ space: {
534
+ type: 'void',
535
+ 'x-component': 'Space',
536
+ properties: {
537
+ sort: {
538
+ type: 'void',
539
+ 'x-decorator': 'FormItem',
540
+ 'x-component': 'ArrayItems.SortHandle'
541
+ },
542
+ field: {
543
+ type: 'string',
544
+ enum: sortFields,
545
+ 'x-decorator': 'FormItem',
546
+ 'x-component': 'Select',
547
+ 'x-component-props': {
548
+ style: {
549
+ width: 260
550
+ }
551
+ }
552
+ },
553
+ direction: {
554
+ type: 'string',
555
+ 'x-decorator': 'FormItem',
556
+ 'x-component': 'Radio.Group',
557
+ 'x-component-props': {
558
+ optionType: 'button'
559
+ },
560
+ enum: [{
561
+ label: t('ASC'),
562
+ value: 'asc'
563
+ }, {
564
+ label: t('DESC'),
565
+ value: 'desc'
566
+ }]
567
+ },
568
+ remove: {
569
+ type: 'void',
570
+ 'x-decorator': 'FormItem',
571
+ 'x-component': 'ArrayItems.Remove'
572
+ }
573
+ }
574
+ }
575
+ }
576
+ },
577
+ properties: {
578
+ add: {
579
+ type: 'void',
580
+ title: t('Add sort field'),
581
+ 'x-component': 'ArrayItems.Addition'
488
582
  }
489
- });
583
+ }
490
584
  }
585
+ }
586
+ },
587
+ onSubmit: function onSubmit(_ref5) {
588
+ var _schema7;
589
+ var sort = _ref5.sort;
590
+ var sortArr = sort.map(function (item) {
591
+ return item.direction === 'desc' ? "-".concat(item.field) : item.field;
592
+ });
593
+ _.set(field.componentProps, 'service.params.sort', sortArr);
594
+ fieldSchema['x-component-props'] = field.componentProps;
595
+ dn.emit('patch', {
596
+ schema: (_schema7 = {}, _defineProperty(_schema7, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema7, 'x-component-props', field.componentProps), _schema7)
491
597
  });
492
598
  }
599
+ }), isAssociationField && fieldModeOptions && !isTableField && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
600
+ key: "field-mode",
601
+ title: t('Field mode'),
602
+ options: fieldModeOptions,
603
+ value: fieldMode,
604
+ onChange: function onChange(mode) {
605
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
606
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
607
+ fieldSchema['x-component-props']['mode'] = mode;
608
+ schema['x-component-props'] = fieldSchema['x-component-props'];
609
+ field.componentProps = field.componentProps || {};
610
+ field.componentProps.mode = mode;
611
+ if (mode === 'Nester') {
612
+ var initValue = ['o2m', 'm2m'].includes(collectionField.interface) ? [] : {};
613
+ field.value = field.value || initValue;
614
+ }
615
+ dn.emit('patch', {
616
+ schema: schema
617
+ });
618
+ dn.refresh();
619
+ }
620
+ }), !field.readPretty && isAssociationField && ['Select', 'Picker'].includes(fieldMode) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
621
+ key: "allowAddNew",
622
+ title: t('Allow add new data'),
623
+ checked: fieldSchema['x-add-new'],
624
+ onChange: function onChange(allowAddNew) {
625
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
626
+ field['x-add-new'] = allowAddNew;
627
+ fieldSchema['x-add-new'] = allowAddNew;
628
+ schema['x-add-new'] = allowAddNew;
629
+ dn.emit('patch', {
630
+ schema: schema
631
+ });
632
+ refresh();
633
+ }
493
634
  }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && ['o2m', 'm2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && fieldSchema['x-component'] !== 'TableField' && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
494
635
  key: "multiple",
495
636
  title: t('Multiple'),
@@ -506,13 +647,14 @@ FormItem.Designer = function Designer() {
506
647
  });
507
648
  refresh();
508
649
  }
509
- }), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
650
+ }), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && !isFileField && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
510
651
  title: t('Enable link'),
511
- checked: ((_fieldSchema$xCompon4 = (_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : _fieldSchema$xCompon5.mode) !== null && _fieldSchema$xCompon4 !== void 0 ? _fieldSchema$xCompon4 : 'links') === 'links',
652
+ checked: ((_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.enableLink) !== false,
512
653
  onChange: function onChange(flag) {
513
654
  fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
514
- mode: flag ? 'links' : 'tags'
655
+ enableLink: flag
515
656
  });
657
+ field.componentProps['enableLink'] = flag;
516
658
  dn.emit('patch', {
517
659
  schema: {
518
660
  'x-uid': fieldSchema['x-uid'],
@@ -577,16 +719,17 @@ FormItem.Designer = function Designer() {
577
719
  key: "title-field",
578
720
  title: t('Title field'),
579
721
  options: options,
580
- value: field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.fieldNames) === null || _field$componentProps2 === void 0 ? void 0 : _field$componentProps2.label,
722
+ value: field === null || field === void 0 ? void 0 : (_field$componentProps8 = field.componentProps) === null || _field$componentProps8 === void 0 ? void 0 : (_field$componentProps9 = _field$componentProps8.fieldNames) === null || _field$componentProps9 === void 0 ? void 0 : _field$componentProps9.label,
581
723
  onChange: function onChange(label) {
582
- var _collectionField$uiSc5, _collectionField$uiSc6;
724
+ var _collectionField$uiSc4, _collectionField$uiSc5;
583
725
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
584
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
726
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : (_collectionField$uiSc5 = _collectionField$uiSc4['x-component-props']) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['fieldNames']), field.componentProps.fieldNames), {}, {
585
727
  label: label
586
728
  });
587
729
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
588
730
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
589
731
  schema['x-component-props'] = fieldSchema['x-component-props'];
732
+ field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
590
733
  dn.emit('patch', {
591
734
  schema: schema
592
735
  });
@@ -603,10 +746,15 @@ FormItem.Designer = function Designer() {
603
746
  }
604
747
  }));
605
748
  };
606
- function isFileCollection(collection) {
749
+ export function isFileCollection(collection) {
607
750
  return (collection === null || collection === void 0 ? void 0 : collection.template) === 'file';
608
751
  }
609
752
  FormItem.FilterFormDesigner = FilterFormDesigner;
610
753
  export function getFieldDefaultValue(fieldSchema, collectionField) {
611
- return (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default) || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue);
754
+ var _collectionField$uiSc6;
755
+ var result = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default) || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue);
756
+ if ((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc6 = collectionField.uiSchema) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['x-component']) === 'DatePicker' && result) {
757
+ return moment(result);
758
+ }
759
+ return result;
612
760
  }