@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
@@ -13,11 +13,12 @@ import { uid } from '@formily/shared';
13
13
  import _ from 'lodash';
14
14
  import React from 'react';
15
15
  import { useTranslation } from 'react-i18next';
16
- import { useFilterByTk, useFormBlockContext } from '../../../block-provider';
16
+ import { useFormBlockContext } from '../../../block-provider';
17
17
  import { useCollection, useCollectionManager } from '../../../collection-manager';
18
18
  import { SchemaSettings, isPatternDisabled } from '../../../schema-settings';
19
- import { useCompile, useDesignable, useFieldComponentOptions } from '../../hooks';
19
+ import { useCompile, useDesignable, useFieldModeOptions } from '../../hooks';
20
20
  import { useOperatorList } from '../filter/useOperators';
21
+ import { isFileCollection } from './FormItem';
21
22
  export var findFilterOperators = function findFilterOperators(schema) {
22
23
  while (schema) {
23
24
  if (schema['x-filter-operators']) {
@@ -387,64 +388,39 @@ export var EditDefaultValue = function EditDefaultValue() {
387
388
  }) : null;
388
389
  };
389
390
  export var EditComponent = function EditComponent() {
391
+ var _field$componentProps;
390
392
  var _useCollectionManager4 = useCollectionManager(),
391
- getInterface = _useCollectionManager4.getInterface,
392
393
  getCollectionJoinField = _useCollectionManager4.getCollectionJoinField,
393
394
  getCollection = _useCollectionManager4.getCollection;
394
395
  var _useCollection4 = useCollection(),
395
- getField = _useCollection4.getField,
396
- template = _useCollection4.template;
397
- var tk = useFilterByTk();
398
- var _useFormBlockContext3 = useFormBlockContext(),
399
- form = _useFormBlockContext3.form;
396
+ getField = _useCollection4.getField;
400
397
  var field = useField();
401
398
  var fieldSchema = useFieldSchema();
402
399
  var _useTranslation7 = useTranslation(),
403
400
  t = _useTranslation7.t;
404
401
  var _useDesignable7 = useDesignable(),
405
- dn = _useDesignable7.dn,
406
- insertAdjacent = _useDesignable7.insertAdjacent;
402
+ dn = _useDesignable7.dn;
407
403
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
408
- var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
409
- var fieldComponentOptions = useFieldComponentOptions();
410
- var isSubFormAssociationField = field.address.segments.includes('__form_grid');
411
- return form && !isSubFormAssociationField && fieldComponentOptions ? /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
412
- title: t('Field component'),
413
- options: fieldComponentOptions,
414
- value: fieldSchema['x-component'],
415
- onChange: function onChange(type) {
416
- var _collectionField$uiSc4, _interfaceConfig$sche;
417
- var schema = {
418
- name: collectionField.name,
419
- type: 'void',
420
- required: fieldSchema['required'],
421
- description: fieldSchema['description'],
422
- default: fieldSchema['default'],
423
- 'x-decorator': 'FormItem',
424
- 'x-designer': 'FormItem.Designer',
425
- 'x-component': type,
426
- 'x-validator': fieldSchema['x-validator'],
427
- 'x-collection-field': fieldSchema['x-collection-field'],
428
- 'x-decorator-props': fieldSchema['x-decorator-props'],
429
- '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'])
430
- };
431
- interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
432
- field: collectionField,
433
- block: 'Form',
434
- readPretty: field.readPretty,
435
- action: tk ? 'get' : null,
436
- targetCollection: getCollection(collectionField.target)
437
- });
438
- insertAdjacent('beforeBegin', divWrap(schema), {
439
- onSuccess: function onSuccess() {
440
- dn.remove(null, {
441
- removeParentsIfNoChildren: true,
442
- breakRemoveOn: {
443
- 'x-component': 'Grid'
444
- }
445
- });
446
- }
404
+ var fieldModeOptions = useFieldModeOptions();
405
+ var isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.type);
406
+ var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
407
+ var isFileField = isFileCollection(targetCollection);
408
+ return isAssociationField && fieldModeOptions ? /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
409
+ key: "field-mode",
410
+ title: t('Field mode'),
411
+ options: fieldModeOptions,
412
+ value: (field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : _field$componentProps['mode']) || (isFileField ? 'FileManager' : 'Select'),
413
+ onChange: function onChange(mode) {
414
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
415
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
416
+ fieldSchema['x-component-props']['mode'] = mode;
417
+ schema['x-component-props'] = fieldSchema['x-component-props'];
418
+ field.componentProps = field.componentProps || {};
419
+ field.componentProps.mode = mode;
420
+ dn.emit('patch', {
421
+ schema: schema
447
422
  });
423
+ dn.refresh();
448
424
  }
449
425
  }) : null;
450
426
  };
@@ -453,8 +429,8 @@ export var EditPattern = function EditPattern() {
453
429
  getCollectionJoinField = _useCollectionManager5.getCollectionJoinField;
454
430
  var _useCollection5 = useCollection(),
455
431
  getField = _useCollection5.getField;
456
- var _useFormBlockContext4 = useFormBlockContext(),
457
- form = _useFormBlockContext4.form;
432
+ var _useFormBlockContext3 = useFormBlockContext(),
433
+ form = _useFormBlockContext3.form;
458
434
  var field = useField();
459
435
  var fieldSchema = useFieldSchema();
460
436
  var _useTranslation8 = useTranslation(),
@@ -545,7 +521,8 @@ export var EditOperator = function EditOperator() {
545
521
  dn = _useDesignable9.dn;
546
522
  var operatorList = useOperatorList();
547
523
  var _findFilterOperators2 = findFilterOperators(fieldSchema),
548
- storedOperators = _findFilterOperators2.operators,
524
+ _findFilterOperators3 = _findFilterOperators2.operators,
525
+ storedOperators = _findFilterOperators3 === void 0 ? {} : _findFilterOperators3,
549
526
  uid = _findFilterOperators2.uid;
550
527
  if (operatorList.length && !storedOperators[fieldSchema.name]) {
551
528
  storedOperators[fieldSchema.name] = operatorList[0].value;
@@ -556,9 +533,9 @@ export var EditOperator = function EditOperator() {
556
533
  value: storedOperators[fieldSchema.name],
557
534
  options: compile(operatorList),
558
535
  onChange: function onChange(v) {
559
- var _schema5;
536
+ var _schema6;
560
537
  storedOperators[fieldSchema.name] = v;
561
- var schema = (_schema5 = {}, _defineProperty(_schema5, 'x-uid', uid), _defineProperty(_schema5, 'x-filter-operators', storedOperators), _schema5);
538
+ var schema = (_schema6 = {}, _defineProperty(_schema6, 'x-uid', uid), _defineProperty(_schema6, 'x-filter-operators', storedOperators), _schema6);
562
539
  dn.emit('patch', {
563
540
  schema: schema
564
541
  });
@@ -567,7 +544,7 @@ export var EditOperator = function EditOperator() {
567
544
  }) : null;
568
545
  };
569
546
  export var EditTitleField = function EditTitleField() {
570
- var _getCollectionFields, _field$componentProps, _field$componentProps2;
547
+ var _getCollectionFields, _field$componentProps2, _field$componentProps3;
571
548
  var _useCollectionManager6 = useCollectionManager(),
572
549
  getCollectionFields = _useCollectionManager6.getCollectionFields,
573
550
  getCollectionJoinField = _useCollectionManager6.getCollectionJoinField;
@@ -595,16 +572,17 @@ export var EditTitleField = function EditTitleField() {
595
572
  key: "title-field",
596
573
  title: t('Title field'),
597
574
  options: options,
598
- 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,
575
+ value: field === null || field === void 0 ? void 0 : (_field$componentProps2 = field.componentProps) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.fieldNames) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.label,
599
576
  onChange: function onChange(label) {
600
- var _collectionField$uiSc5, _collectionField$uiSc6;
577
+ var _collectionField$uiSc4, _collectionField$uiSc5;
601
578
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
602
- 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), {}, {
579
+ 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), {}, {
603
580
  label: label
604
581
  });
605
582
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
606
583
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
607
584
  schema['x-component-props'] = fieldSchema['x-component-props'];
585
+ field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
608
586
  dn.emit('patch', {
609
587
  schema: schema
610
588
  });
@@ -4,10 +4,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
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
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
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 { last, cloneDeep } from 'lodash';
8
- import { conditionAnalyse } from '../../common/utils/uitls';
7
+ import { evaluators } from '@nocobase/evaluators/client';
8
+ import { cloneDeep, last } from 'lodash';
9
9
  import { ActionType } from '../../../schema-settings/LinkageRules/type';
10
- import evaluators from '@nocobase/evaluators/client';
10
+ import { conditionAnalyse } from '../../common/utils/uitls';
11
11
  export var linkageMergeAction = function linkageMergeAction(_ref, field, condition, values) {
12
12
  var _field$linkagePropert, _field$initProperty, _field$linkagePropert2, _field$initProperty2, _field$linkagePropert3, _field$initProperty3, _field$linkagePropert4, _field$initProperty4, _field$linkagePropert5, _field$linkagePropert6, _field$linkagePropert7;
13
13
  var operator = _ref.operator,
@@ -70,7 +70,9 @@ export var linkageMergeAction = function linkageMergeAction(_ref, field, conditi
70
70
  }
71
71
  }));
72
72
  valueResult.push(result);
73
- } catch (error) {}
73
+ } catch (error) {
74
+ console.log(error);
75
+ }
74
76
  } else if ((value === null || value === void 0 ? void 0 : value.mode) === 'constant') {
75
77
  valueResult.push((value === null || value === void 0 ? void 0 : value.value) || value);
76
78
  } else {
@@ -475,7 +475,7 @@ export var Gantt = function Gantt(props) {
475
475
  _context.next = 2;
476
476
  return resource.update({
477
477
  filterByTk: task.id,
478
- values: _objectSpread(_objectSpread({}, task), {}, _defineProperty({}, fieldNames.progress, task.progress / 100))
478
+ values: _defineProperty({}, fieldNames.progress, task.progress / 100)
479
479
  });
480
480
  case 2:
481
481
  message.success(t('Saved successfully'));
@@ -493,14 +493,14 @@ export var Gantt = function Gantt(props) {
493
493
  }();
494
494
  var handleTaskChange = /*#__PURE__*/function () {
495
495
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(task) {
496
- var _objectSpread3;
496
+ var _values2;
497
497
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
498
498
  while (1) switch (_context2.prev = _context2.next) {
499
499
  case 0:
500
500
  _context2.next = 2;
501
501
  return resource.update({
502
502
  filterByTk: task.id,
503
- values: _objectSpread(_objectSpread({}, task), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, fieldNames.start, task.start), _defineProperty(_objectSpread3, fieldNames.end, task.end), _objectSpread3))
503
+ values: (_values2 = {}, _defineProperty(_values2, fieldNames.start, task.start), _defineProperty(_values2, fieldNames.end, task.end), _values2)
504
504
  });
505
505
  case 2:
506
506
  message.success(t('Saved successfully'));
@@ -97,7 +97,7 @@ export var StandardTooltipContent = function StandardTooltipContent(_ref2) {
97
97
  }
98
98
  }, task.name, ": ", getYmd(task.start), " ~ ", getYmd(task.end)), task.end.getTime() - task.start.getTime() !== 0 && /*#__PURE__*/React.createElement("p", {
99
99
  className: cx(tooltipDefaultContainerParagraph)
100
- }, "Duration: ".concat(~~((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)), " day(s)")), /*#__PURE__*/React.createElement("p", {
100
+ }, "Duration: ".concat(Math.round((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24) * 10) / 10, " day(s)")), /*#__PURE__*/React.createElement("p", {
101
101
  className: cx(tooltipDefaultContainerParagraph)
102
102
  }, !!task.progress && "Progress: ".concat(task.progress, "%")));
103
103
  };
@@ -1,4 +1,5 @@
1
1
  export * from './action';
2
+ export * from './association-field';
2
3
  export * from './association-select';
3
4
  export * from './block-item';
4
5
  export * from './calendar';
@@ -10,11 +11,13 @@ export * from './color-select';
10
11
  export * from './cron';
11
12
  export * from './date-picker';
12
13
  export * from './details';
14
+ export * from './expand-action';
13
15
  export * from './filter';
14
16
  export * from './form';
15
17
  export * from './form-item';
16
18
  export * from './form-v2';
17
19
  export * from './g2plot';
20
+ export * from './gantt';
18
21
  export * from './grid';
19
22
  export * from './icon-picker';
20
23
  export * from './input';
@@ -40,5 +43,4 @@ export * from './time-picker';
40
43
  export * from './tree-select';
41
44
  export * from './upload';
42
45
  export * from './variable';
43
- export * from './gantt';
44
46
  import './index.less';
@@ -1,4 +1,5 @@
1
1
  export * from './action';
2
+ export * from './association-field';
2
3
  export * from './association-select';
3
4
  export * from './block-item';
4
5
  export * from './calendar';
@@ -10,11 +11,13 @@ export * from './color-select';
10
11
  export * from './cron';
11
12
  export * from './date-picker';
12
13
  export * from './details';
14
+ export * from './expand-action';
13
15
  export * from './filter';
14
16
  export * from './form';
15
17
  export * from './form-item';
16
18
  export * from './form-v2';
17
19
  export * from './g2plot';
20
+ export * from './gantt';
18
21
  export * from './grid';
19
22
  export * from './icon-picker';
20
23
  export * from './input';
@@ -40,5 +43,4 @@ export * from './time-picker';
40
43
  export * from './tree-select';
41
44
  export * from './upload';
42
45
  export * from './variable';
43
- export * from './gantt';
44
46
  import './index.less';
@@ -232,7 +232,8 @@ Menu.Item = observer(function (props) {
232
232
  eventKey: schema.name,
233
233
  schema: schema
234
234
  }), /*#__PURE__*/React.createElement(SortableItem, {
235
- className: designerCss
235
+ className: designerCss,
236
+ removeParentsIfNoChildren: false
236
237
  }, /*#__PURE__*/React.createElement(Icon, {
237
238
  type: icon
238
239
  }), /*#__PURE__*/React.createElement("span", {
@@ -254,7 +255,8 @@ Menu.URL = observer(function (props) {
254
255
  window.open(props.href, '_blank');
255
256
  }
256
257
  }), /*#__PURE__*/React.createElement(SortableItem, {
257
- className: designerCss
258
+ className: designerCss,
259
+ removeParentsIfNoChildren: false
258
260
  }, /*#__PURE__*/React.createElement(Icon, {
259
261
  type: icon
260
262
  }), /*#__PURE__*/React.createElement("span", {
@@ -276,7 +278,8 @@ Menu.SubMenu = observer(function (props) {
276
278
  key: schema.name,
277
279
  eventKey: schema.name,
278
280
  title: /*#__PURE__*/React.createElement(SortableItem, {
279
- className: subMenuDesignerCss
281
+ className: subMenuDesignerCss,
282
+ removeParentsIfNoChildren: false
280
283
  }, /*#__PURE__*/React.createElement(Icon, {
281
284
  type: icon
282
285
  }), field.title, /*#__PURE__*/React.createElement(Designer, null))
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  export declare const RecordPickerContext: React.Context<any>;
3
3
  export declare const InputRecordPicker: React.FC<any>;
4
+ export declare const RecordPickerProvider: (props: any) => JSX.Element;
4
5
  export declare function isShowFilePicker(labelUiSchema: any): boolean;
@@ -1,6 +1,7 @@
1
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
2
  var _excluded = ["onRowSelectionChange", "rowKey"],
3
- _excluded2 = ["value", "multiple", "onChange", "quickUpload", "selectFile"];
3
+ _excluded2 = ["value", "multiple", "onChange", "quickUpload", "selectFile"],
4
+ _excluded3 = ["multiple", "onChange", "selectedRows", "setSelectedRows", "options", "collectionField"];
4
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
6
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
7
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
@@ -63,7 +64,7 @@ var useTableSelectorProps = function useTableSelectorProps() {
63
64
  rowKey: rowKey,
64
65
  rowSelection: {
65
66
  type: multiple ? 'checkbox' : 'radio',
66
- selectedRowKeys: rcSelectRows.filter(function (item) {
67
+ selectedRowKeys: rcSelectRows === null || rcSelectRows === void 0 ? void 0 : rcSelectRows.filter(function (item) {
67
68
  return options.every(function (row) {
68
69
  return row[rowKey] !== item[rowKey];
69
70
  });
@@ -208,12 +209,16 @@ export var InputRecordPicker = function InputRecordPicker(props) {
208
209
  allowClear: true,
209
210
  onChange: function onChange(changed) {
210
211
  if (!changed) {
211
- _onChange([]);
212
- setSelectedRows([]);
213
- } else if (!(changed === null || changed === void 0 ? void 0 : changed.length)) {
214
- _onChange([]);
215
- setSelectedRows([]);
212
+ var _value = multiple ? [] : null;
213
+ _onChange(_value);
214
+ setSelectedRows(_value);
215
+ setOptions([]);
216
216
  } else if (Array.isArray(changed)) {
217
+ if (!changed.length) {
218
+ _onChange([]);
219
+ setSelectedRows([]);
220
+ return;
221
+ }
217
222
  var values = options === null || options === void 0 ? void 0 : options.filter(function (option) {
218
223
  return changed.includes(option[fieldNames.value]);
219
224
  });
@@ -236,6 +241,25 @@ export var InputRecordPicker = function InputRecordPicker(props) {
236
241
  options: options
237
242
  }));
238
243
  };
244
+ export var RecordPickerProvider = function RecordPickerProvider(props) {
245
+ var multiple = props.multiple,
246
+ onChange = props.onChange,
247
+ selectedRows = props.selectedRows,
248
+ setSelectedRows = props.setSelectedRows,
249
+ options = props.options,
250
+ collectionField = props.collectionField,
251
+ other = _objectWithoutProperties(props, _excluded3);
252
+ return /*#__PURE__*/React.createElement(RecordPickerContext.Provider, {
253
+ value: _objectSpread({
254
+ multiple: multiple,
255
+ onChange: onChange,
256
+ selectedRows: selectedRows,
257
+ setSelectedRows: setSelectedRows,
258
+ options: options,
259
+ collectionField: collectionField
260
+ }, other)
261
+ }, props.children);
262
+ };
239
263
  var Drawer = function Drawer(_ref) {
240
264
  var multiple = _ref.multiple,
241
265
  onChange = _ref.onChange,
@@ -256,16 +280,15 @@ var Drawer = function Drawer(_ref) {
256
280
  } : {};
257
281
  return filter;
258
282
  };
259
- return /*#__PURE__*/React.createElement(RecordPickerContext.Provider, {
260
- value: {
261
- multiple: multiple,
262
- onChange: onChange,
263
- selectedRows: selectedRows,
264
- setSelectedRows: setSelectedRows,
265
- options: options,
266
- collectionField: collectionField
267
- }
268
- }, /*#__PURE__*/React.createElement(CollectionProvider, {
283
+ var recordPickerProps = {
284
+ multiple: multiple,
285
+ onChange: onChange,
286
+ selectedRows: selectedRows,
287
+ setSelectedRows: setSelectedRows,
288
+ options: options,
289
+ collectionField: collectionField
290
+ };
291
+ return /*#__PURE__*/React.createElement(RecordPickerProvider, _objectSpread({}, recordPickerProps), /*#__PURE__*/React.createElement(CollectionProvider, {
269
292
  allowNull: true,
270
293
  name: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
271
294
  }, /*#__PURE__*/React.createElement(ActionContext.Provider, {
@@ -11,9 +11,10 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
11
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12
12
  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; }
13
13
  import { LoadingOutlined } from '@ant-design/icons';
14
- import { connect, mapProps, mapReadPretty, useFieldSchema } from '@formily/react';
14
+ import { connect, mapProps, mapReadPretty, useFieldSchema, useField } from '@formily/react';
15
15
  import { Tag } from 'antd';
16
16
  import moment from 'moment';
17
+ import { uniqBy } from 'lodash';
17
18
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
18
19
  import { useRequest } from '../../../api-client';
19
20
  import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
@@ -22,7 +23,7 @@ import { useCompile } from '../../hooks';
22
23
  import { Select, defaultFieldNames } from '../select';
23
24
  import { ReadPretty } from './ReadPretty';
24
25
  var InternalRemoteSelect = connect(function (props) {
25
- var _service$params;
26
+ var _field$componentProps, _field$componentProps2, _field$componentProps3, _service$params;
26
27
  var _props$fieldNames = props.fieldNames,
27
28
  fieldNames = _props$fieldNames === void 0 ? {} : _props$fieldNames,
28
29
  _props$service = props.service,
@@ -39,6 +40,7 @@ var InternalRemoteSelect = connect(function (props) {
39
40
  var compile = useCompile();
40
41
  var firstRun = useRef(false);
41
42
  var fieldSchema = useFieldSchema();
43
+ var field = useField();
42
44
  var _useCollection = useCollection(),
43
45
  getField = _useCollection.getField;
44
46
  var _useCollectionManager = useCollectionManager(),
@@ -56,7 +58,7 @@ var InternalRemoteSelect = connect(function (props) {
56
58
  var mapOptionsToTags = useCallback(function (options) {
57
59
  try {
58
60
  return options.map(function (option) {
59
- var _targetField$uiSchema, _ref;
61
+ var _targetField$uiSchema, _objectSpread2;
60
62
  var label = option[fieldNames.label];
61
63
  if (targetField === null || targetField === void 0 ? void 0 : (_targetField$uiSchema = targetField.uiSchema) === null || _targetField$uiSchema === void 0 ? void 0 : _targetField$uiSchema.enum) {
62
64
  if (Array.isArray(label)) {
@@ -94,7 +96,7 @@ var InternalRemoteSelect = connect(function (props) {
94
96
  var _mapOptions;
95
97
  return mapOptions((_mapOptions = {}, _defineProperty(_mapOptions, fieldNames.label, label), _defineProperty(_mapOptions, fieldNames.value, option[fieldNames.value]), _mapOptions));
96
98
  }
97
- return _ref = {}, _defineProperty(_ref, fieldNames.label, label || option[fieldNames.value]), _defineProperty(_ref, fieldNames.value, option[fieldNames.value]), _ref;
99
+ return _objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, fieldNames.label, label || option[fieldNames.value]), _defineProperty(_objectSpread2, fieldNames.value, option[fieldNames.value]), _objectSpread2));
98
100
  });
99
101
  } catch (err) {
100
102
  console.error(err);
@@ -109,7 +111,7 @@ var InternalRemoteSelect = connect(function (props) {
109
111
  }, service === null || service === void 0 ? void 0 : service.params), {}, {
110
112
  // fields: [fieldNames.label, fieldNames.value, ...(service?.params?.fields || [])],
111
113
  // search needs
112
- filter: mergeFilter([service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter])
114
+ filter: mergeFilter([((_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) || (service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter)])
113
115
  })
114
116
  }), {
115
117
  manual: manual,
@@ -131,13 +133,13 @@ var InternalRemoteSelect = connect(function (props) {
131
133
  }
132
134
  }, [runDep]);
133
135
  var onSearch = /*#__PURE__*/function () {
134
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
135
- var _service$params2;
136
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
137
+ var _field$componentProps4, _field$componentProps5, _field$componentProps6, _service$params2;
136
138
  return _regeneratorRuntime().wrap(function _callee$(_context) {
137
139
  while (1) switch (_context.prev = _context.next) {
138
140
  case 0:
139
141
  run({
140
- filter: mergeFilter([_defineProperty({}, fieldNames.label, _defineProperty({}, operator, search)), service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter])
142
+ filter: mergeFilter([_defineProperty({}, fieldNames.label, _defineProperty({}, operator, search)), ((_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.filter) || (service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter)])
141
143
  });
142
144
  case 1:
143
145
  case "end":
@@ -146,32 +148,28 @@ var InternalRemoteSelect = connect(function (props) {
146
148
  }, _callee);
147
149
  }));
148
150
  return function onSearch(_x) {
149
- return _ref2.apply(this, arguments);
151
+ return _ref.apply(this, arguments);
150
152
  };
151
153
  }();
152
154
  var getOptionsByFieldNames = useCallback(function (item) {
153
155
  return Object.keys(fieldNames).reduce(function (obj, key) {
154
- var value = item[fieldNames[key]];
155
- if (value) {
156
- // support hidden, disabled, etc.
157
- obj[['label', 'value', 'options'].includes(key) ? fieldNames[key] : key] = key === 'label' ? compile(value) : value;
158
- }
159
156
  return obj;
160
157
  }, {});
161
158
  }, [fieldNames]);
162
159
  var normalizeOptions = useCallback(function (obj) {
163
- var _ref4;
160
+ var _ref3;
164
161
  if (objectValue || _typeof(obj) === 'object') {
165
162
  return getOptionsByFieldNames(obj);
166
163
  }
167
- return _ref4 = {}, _defineProperty(_ref4, fieldNames.value, obj), _defineProperty(_ref4, fieldNames.label, obj), _ref4;
164
+ return _ref3 = {}, _defineProperty(_ref3, fieldNames.value, obj), _defineProperty(_ref3, fieldNames.label, obj), _ref3;
168
165
  }, [objectValue, getOptionsByFieldNames]);
169
166
  var options = useMemo(function () {
170
167
  var _data$data, _data$data2;
171
168
  if (!(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.length)) {
172
- return value !== undefined && value !== null ? Array.isArray(value) ? value.map(normalizeOptions) : [normalizeOptions(value)] : [];
169
+ return value !== undefined && value !== null ? Array.isArray(value) ? value : [value] : [];
173
170
  }
174
- return (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.map(getOptionsByFieldNames)) || [];
171
+ var valueOptions = value !== undefined && value !== null && (Array.isArray(value) ? value : [value]) || [];
172
+ return uniqBy((data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.concat(valueOptions)) || [], fieldNames.value);
175
173
  }, [data === null || data === void 0 ? void 0 : data.data, getOptionsByFieldNames, normalizeOptions, value]);
176
174
  var onDropdownVisibleChange = function onDropdownVisibleChange() {
177
175
  if (firstRun.current) {
@@ -31,12 +31,13 @@ var useLabelFields = function useLabelFields(collectionName) {
31
31
  });
32
32
  };
33
33
  export var TableColumnDesigner = function TableColumnDesigner(props) {
34
- var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$targ, _collectionField$uiSc, _columnSchema$xCompo, _fieldSchema$xCompon2, _fieldSchema$xCompon3;
34
+ var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$targ, _collectionField$uiSc, _columnSchema$xCompo, _fieldSchema$xCompon2;
35
35
  var uiSchema = props.uiSchema,
36
36
  fieldSchema = props.fieldSchema,
37
37
  collectionField = props.collectionField;
38
38
  var _useCollectionManager2 = useCollectionManager(),
39
- getInterface = _useCollectionManager2.getInterface;
39
+ getInterface = _useCollectionManager2.getInterface,
40
+ getCollection = _useCollectionManager2.getCollection;
40
41
  var field = useField();
41
42
  var _useTranslation = useTranslation(),
42
43
  t = _useTranslation.t;
@@ -46,6 +47,8 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
46
47
  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']);
47
48
  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);
48
49
  var intefaceCfg = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
50
+ var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
51
+ var isFileField = isFileCollection(targetCollection);
49
52
  return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, {
50
53
  disableInitializer: true
51
54
  }, /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
@@ -120,17 +123,20 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
120
123
  });
121
124
  dn.refresh();
122
125
  }
123
- }), ['linkTo', 'm2m', 'm2o', 'o2m', 'obo', 'oho', 'snapshot', 'createdBy', 'updatedBy'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
126
+ }), ['linkTo', 'm2m', 'm2o', 'o2m', 'obo', 'oho', 'snapshot', 'createdBy', 'updatedBy'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && !isFileField && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
124
127
  title: t('Enable link'),
125
- checked: ((_fieldSchema$xCompon2 = (_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.mode) !== null && _fieldSchema$xCompon2 !== void 0 ? _fieldSchema$xCompon2 : 'links') === 'links',
128
+ checked: ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.enableLink) !== false,
126
129
  onChange: function onChange(flag) {
127
130
  fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
128
- mode: flag ? 'links' : 'tags'
131
+ enableLink: flag
132
+ });
133
+ field.componentProps = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
134
+ enableLink: flag
129
135
  });
130
136
  dn.emit('patch', {
131
137
  schema: {
132
138
  'x-uid': fieldSchema['x-uid'],
133
- 'x-component-props': _objectSpread({}, fieldSchema['x-component-props'])
139
+ 'x-component-props': _objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props'])
134
140
  }
135
141
  });
136
142
  dn.refresh();
@@ -140,8 +146,8 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
140
146
  options: options,
141
147
  value: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames['label'],
142
148
  onChange: function onChange(label) {
143
- var _collectionField$uiSc2, _fieldSchema$xCompon4;
144
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2['x-component-props']['fieldNames']), fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4['fieldNames']), {}, {
149
+ var _collectionField$uiSc2, _fieldSchema$xCompon3;
150
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2['x-component-props']['fieldNames']), fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3['fieldNames']), {}, {
145
151
  label: label
146
152
  });
147
153
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
@@ -165,4 +171,7 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
165
171
  title: t('Delete table column')
166
172
  }
167
173
  }));
168
- };
174
+ };
175
+ function isFileCollection(collection) {
176
+ return (collection === null || collection === void 0 ? void 0 : collection.template) === 'file';
177
+ }
@@ -0,0 +1 @@
1
+ export declare const TableIndex: (props: any) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { useRecordIndex } from '../../../record-provider';
3
+ export var TableIndex = function TableIndex(props) {
4
+ var recordIndex = useRecordIndex();
5
+ return /*#__PURE__*/React.createElement("div", null, recordIndex + 1);
6
+ };