@nocobase/client 0.12.0-alpha.2 → 0.12.0-alpha.4

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 (161) hide show
  1. package/es/api-client/hooks/useRequest.js +16 -1
  2. package/es/block-provider/BlockProvider.js +2 -2
  3. package/es/block-provider/hooks/index.js +16 -18
  4. package/es/collection-manager/Configuration/AddCollectionAction.js +2 -2
  5. package/es/collection-manager/Configuration/AddFieldAction.js +2 -1
  6. package/es/collection-manager/Configuration/EditFieldAction.js +2 -1
  7. package/es/collection-manager/action-hooks.js +3 -1
  8. package/es/global-theme/AntdAppProvider.js +5 -1
  9. package/es/locale/en_US.d.ts +4 -0
  10. package/es/locale/en_US.js +4 -0
  11. package/es/locale/ja_JP.d.ts +1 -0
  12. package/es/locale/ja_JP.js +1 -0
  13. package/es/locale/zh_CN.d.ts +6 -0
  14. package/es/locale/zh_CN.js +7 -1
  15. package/es/pm/Card.js +6 -1
  16. package/es/schema-component/antd/action/Action.Designer.js +243 -54
  17. package/es/schema-component/antd/action/Action.Drawer.js +2 -2
  18. package/es/schema-component/antd/action/Action.Modal.js +1 -1
  19. package/es/schema-component/antd/action/Action.js +15 -19
  20. package/es/schema-component/antd/appends-tree-select/AppendsTreeSelect.d.ts +8 -2
  21. package/es/schema-component/antd/appends-tree-select/AppendsTreeSelect.js +67 -36
  22. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +3 -15
  23. package/es/schema-component/antd/association-field/Editable.js +2 -1
  24. package/es/schema-component/antd/association-field/FileManager.js +4 -3
  25. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -1
  26. package/es/schema-component/antd/association-field/InternalNester.js +6 -4
  27. package/es/schema-component/antd/association-field/InternalPicker.js +2 -1
  28. package/es/schema-component/antd/association-field/InternalPopoverNester.d.ts +2 -0
  29. package/es/schema-component/antd/association-field/InternalPopoverNester.js +95 -0
  30. package/es/schema-component/antd/association-field/InternalSubTable.js +2 -5
  31. package/es/schema-component/antd/association-field/InternalViewer.js +1 -1
  32. package/es/schema-component/antd/association-field/hooks.js +77 -5
  33. package/es/schema-component/antd/association-field/util.d.ts +4 -0
  34. package/es/schema-component/antd/association-field/util.js +32 -1
  35. package/es/schema-component/antd/color-picker/ReadPretty.js +1 -1
  36. package/es/schema-component/antd/form-item/FormItem.js +36 -112
  37. package/es/schema-component/antd/form-v2/Templates.js +12 -5
  38. package/es/schema-component/antd/grid-card/GridCard.Item.js +4 -4
  39. package/es/schema-component/antd/input/EllipsisWithTooltip.js +2 -1
  40. package/es/schema-component/antd/list/List.Item.js +3 -3
  41. package/es/schema-component/antd/markdown/Markdown.Void.js +6 -1
  42. package/es/schema-component/antd/markdown/Markdown.js +6 -1
  43. package/es/schema-component/antd/markdown/style.js +2 -4
  44. package/es/schema-component/antd/quick-edit/QuickEdit.js +5 -3
  45. package/es/schema-component/antd/remote-select/RemoteSelect.js +11 -79
  46. package/es/schema-component/antd/rich-text/RichText.js +7 -2
  47. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +45 -35
  48. package/es/schema-component/antd/table-v2/Table.js +12 -10
  49. package/es/schema-component/antd/table-v2/utils.d.ts +5 -0
  50. package/es/schema-component/antd/table-v2/utils.js +14 -1
  51. package/es/schema-component/antd/variable/Input.js +2 -1
  52. package/es/schema-component/antd/variable/TextArea.js +1 -1
  53. package/es/schema-component/common/utils/uitls.js +19 -2
  54. package/es/schema-component/hooks/useFieldModeOptions.d.ts +1 -1
  55. package/es/schema-component/hooks/useFieldModeOptions.js +23 -9
  56. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +75 -0
  57. package/es/schema-initializer/buttons/FormActionInitializers.js +39 -11
  58. package/es/schema-initializer/buttons/RecordBlockInitializers.js +12 -0
  59. package/es/schema-initializer/items/CreateActionInitializer.js +2 -1
  60. package/es/schema-initializer/items/CreateSubmitActionInitializer.js +3 -0
  61. package/es/schema-initializer/items/RecordAssociationGridCardBlockInitializer.d.ts +2 -0
  62. package/es/schema-initializer/items/RecordAssociationGridCardBlockInitializer.js +74 -0
  63. package/es/schema-initializer/items/RecordAssociationListBlockInitializer.d.ts +2 -0
  64. package/es/schema-initializer/items/RecordAssociationListBlockInitializer.js +74 -0
  65. package/es/schema-initializer/items/RecordFormBlockInitializer.js +3 -2
  66. package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +3 -2
  67. package/es/schema-initializer/items/UpdateSubmitActionInitializer.js +3 -0
  68. package/es/schema-initializer/items/index.d.ts +2 -0
  69. package/es/schema-initializer/items/index.js +2 -0
  70. package/es/schema-initializer/utils.js +6 -4
  71. package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -2
  72. package/es/schema-settings/DataTemplates/utils.js +1 -1
  73. package/es/schema-settings/LinkageRules/components/LinkageHeader.js +2 -2
  74. package/es/schema-settings/SchemaSettings.js +132 -19
  75. package/es/schema-settings/VariableInput/VariableInput.js +6 -3
  76. package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.d.ts +4 -1
  77. package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.js +22 -5
  78. package/es/schema-templates/SchemaTemplateManagerProvider.js +6 -1
  79. package/lib/api-client/hooks/useRequest.js +16 -1
  80. package/lib/block-provider/BlockProvider.js +2 -2
  81. package/lib/block-provider/hooks/index.js +21 -23
  82. package/lib/collection-manager/Configuration/AddCollectionAction.js +2 -2
  83. package/lib/collection-manager/Configuration/AddFieldAction.js +2 -1
  84. package/lib/collection-manager/Configuration/EditFieldAction.js +2 -1
  85. package/lib/collection-manager/action-hooks.js +3 -1
  86. package/lib/global-theme/AntdAppProvider.js +5 -1
  87. package/lib/locale/en_US.d.ts +4 -0
  88. package/lib/locale/en_US.js +4 -0
  89. package/lib/locale/ja_JP.d.ts +1 -0
  90. package/lib/locale/ja_JP.js +1 -0
  91. package/lib/locale/zh_CN.d.ts +6 -0
  92. package/lib/locale/zh_CN.js +7 -1
  93. package/lib/pm/Card.js +6 -1
  94. package/lib/schema-component/antd/action/Action.Designer.js +242 -53
  95. package/lib/schema-component/antd/action/Action.Drawer.js +2 -2
  96. package/lib/schema-component/antd/action/Action.Modal.js +1 -1
  97. package/lib/schema-component/antd/action/Action.js +15 -19
  98. package/lib/schema-component/antd/appends-tree-select/AppendsTreeSelect.d.ts +8 -2
  99. package/lib/schema-component/antd/appends-tree-select/AppendsTreeSelect.js +66 -35
  100. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +3 -15
  101. package/lib/schema-component/antd/association-field/Editable.js +2 -1
  102. package/lib/schema-component/antd/association-field/FileManager.js +4 -3
  103. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -1
  104. package/lib/schema-component/antd/association-field/InternalNester.js +5 -3
  105. package/lib/schema-component/antd/association-field/InternalPicker.js +2 -1
  106. package/lib/schema-component/antd/association-field/InternalPopoverNester.d.ts +2 -0
  107. package/lib/schema-component/antd/association-field/InternalPopoverNester.js +104 -0
  108. package/lib/schema-component/antd/association-field/InternalSubTable.js +1 -4
  109. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
  110. package/lib/schema-component/antd/association-field/hooks.js +76 -4
  111. package/lib/schema-component/antd/association-field/util.d.ts +4 -0
  112. package/lib/schema-component/antd/association-field/util.js +37 -2
  113. package/lib/schema-component/antd/color-picker/ReadPretty.js +1 -1
  114. package/lib/schema-component/antd/form-item/FormItem.js +34 -110
  115. package/lib/schema-component/antd/form-v2/Templates.js +12 -5
  116. package/lib/schema-component/antd/grid-card/GridCard.Item.js +3 -3
  117. package/lib/schema-component/antd/input/EllipsisWithTooltip.js +2 -1
  118. package/lib/schema-component/antd/list/List.Item.js +2 -2
  119. package/lib/schema-component/antd/markdown/Markdown.Void.js +6 -1
  120. package/lib/schema-component/antd/markdown/Markdown.js +6 -1
  121. package/lib/schema-component/antd/markdown/style.js +2 -4
  122. package/lib/schema-component/antd/quick-edit/QuickEdit.js +5 -3
  123. package/lib/schema-component/antd/remote-select/RemoteSelect.js +11 -79
  124. package/lib/schema-component/antd/rich-text/RichText.js +6 -1
  125. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +44 -34
  126. package/lib/schema-component/antd/table-v2/Table.js +11 -9
  127. package/lib/schema-component/antd/table-v2/utils.d.ts +5 -0
  128. package/lib/schema-component/antd/table-v2/utils.js +16 -2
  129. package/lib/schema-component/antd/variable/Input.js +2 -1
  130. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  131. package/lib/schema-component/common/utils/uitls.js +19 -2
  132. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +1 -1
  133. package/lib/schema-component/hooks/useFieldModeOptions.js +23 -9
  134. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +75 -0
  135. package/lib/schema-initializer/buttons/FormActionInitializers.js +39 -11
  136. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +12 -0
  137. package/lib/schema-initializer/items/CreateActionInitializer.js +2 -1
  138. package/lib/schema-initializer/items/CreateSubmitActionInitializer.js +3 -0
  139. package/lib/schema-initializer/items/RecordAssociationGridCardBlockInitializer.d.ts +2 -0
  140. package/lib/schema-initializer/items/RecordAssociationGridCardBlockInitializer.js +82 -0
  141. package/lib/schema-initializer/items/RecordAssociationListBlockInitializer.d.ts +2 -0
  142. package/lib/schema-initializer/items/RecordAssociationListBlockInitializer.js +82 -0
  143. package/lib/schema-initializer/items/RecordFormBlockInitializer.js +3 -2
  144. package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +3 -2
  145. package/lib/schema-initializer/items/UpdateSubmitActionInitializer.js +3 -0
  146. package/lib/schema-initializer/items/index.d.ts +2 -0
  147. package/lib/schema-initializer/items/index.js +22 -0
  148. package/lib/schema-initializer/utils.js +6 -4
  149. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -2
  150. package/lib/schema-settings/DataTemplates/utils.js +1 -1
  151. package/lib/schema-settings/LinkageRules/components/LinkageHeader.js +1 -1
  152. package/lib/schema-settings/SchemaSettings.js +131 -18
  153. package/lib/schema-settings/VariableInput/VariableInput.js +5 -2
  154. package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.d.ts +4 -1
  155. package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +24 -6
  156. package/lib/schema-templates/SchemaTemplateManagerProvider.js +6 -1
  157. package/package.json +5 -5
  158. package/es/schema-component/antd/remote-select/utils.d.ts +0 -4
  159. package/es/schema-component/antd/remote-select/utils.js +0 -31
  160. package/lib/schema-component/antd/remote-select/utils.d.ts +0 -4
  161. package/lib/schema-component/antd/remote-select/utils.js +0 -41
@@ -17,21 +17,23 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
17
17
  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; }
18
18
  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; } }
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- import { connect, mapProps, useField, useFieldSchema, useForm } from '@formily/react';
20
+ import { ArrayTable } from '@formily/antd-v5';
21
+ import { onFieldValueChange } from '@formily/core';
22
+ import { connect, mapProps, useField, useFieldSchema, useForm, useFormEffects } from '@formily/react';
21
23
  import { isValid, uid } from '@formily/shared';
22
- import { Tree as AntdTree } from 'antd';
24
+ import { Alert, Tree as AntdTree } from 'antd';
23
25
  import { cloneDeep } from 'lodash';
24
- import React, { useEffect, useState, useMemo, useCallback } from 'react';
26
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
25
27
  import { useTranslation } from 'react-i18next';
26
- import { useDesignable } from '../..';
28
+ import { RemoteSelect, useCompile, useDesignable } from '../..';
27
29
  import { useCollection, useCollectionManager } from '../../../collection-manager';
30
+ import { useRecord } from '../../../record-provider';
28
31
  import { OpenModeSchemaItems } from '../../../schema-items';
29
32
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
30
33
  import { useCollectionState } from '../../../schema-settings/DataTemplates/hooks/useCollectionState';
34
+ import { useSyncFromForm } from '../../../schema-settings/DataTemplates/utils';
31
35
  import { useLinkageAction } from './hooks';
32
36
  import { requestSettingsSchema } from './utils';
33
- import { useRecord } from '../../../record-provider';
34
- import { useSyncFromForm } from '../../../schema-settings/DataTemplates/utils';
35
37
  var Tree = connect(AntdTree, mapProps(function (props, field) {
36
38
  var _useState = useState(props.defaultCheckedKeys || []),
37
39
  _useState2 = _slicedToArray(_useState, 2),
@@ -48,22 +50,18 @@ var Tree = connect(AntdTree, mapProps(function (props, field) {
48
50
  });
49
51
  }));
50
52
  var MenuGroup = function MenuGroup(props) {
53
+ var _fieldSchema$xAction;
51
54
  var fieldSchema = useFieldSchema();
52
- var actionType = fieldSchema['x-action'] || '';
53
55
  var _useTranslation = useTranslation(),
54
56
  t = _useTranslation.t;
55
- var actionTitles = {
56
- 'customize:popup': t('Popup'),
57
- 'customize:update': t('Update record'),
58
- 'customize:save': t('Save record'),
59
- 'customize:table:request': t('Custom request'),
60
- 'customize:form:request': t('Custom request')
61
- };
62
- if (!['customize:popup', 'customize:update', 'customize:save', 'customize:table:request', 'customize:form:request'].includes(actionType)) {
63
- return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
57
+ var compile = useCompile();
58
+ var actionTitle = fieldSchema.title ? compile(fieldSchema.title) : '';
59
+ var actionType = (_fieldSchema$xAction = fieldSchema['x-action']) !== null && _fieldSchema$xAction !== void 0 ? _fieldSchema$xAction : '';
60
+ if (!actionType.startsWith('customize:') || !actionTitle) {
61
+ return props.children;
64
62
  }
65
63
  return /*#__PURE__*/React.createElement(SchemaSettings.ItemGroup, {
66
- title: "".concat(t('Customize'), " > ").concat(actionTitles[actionType])
64
+ title: "".concat(t('Customize'), " > ").concat(actionTitle)
67
65
  }, props.children);
68
66
  };
69
67
  function ButtonEditor() {
@@ -169,22 +167,22 @@ function SaveMode() {
169
167
  saveMode: {
170
168
  'x-decorator': 'FormItem',
171
169
  'x-component': 'Radio.Group',
172
- title: t('Save mode'),
170
+ // title: t('Save mode'),
173
171
  default: field.componentProps.saveMode || 'create',
174
172
  enum: [{
175
173
  value: 'create',
176
- label: '{{t("Create")}}'
174
+ label: '{{t("Insert")}}'
177
175
  }, {
178
176
  value: 'firstOrCreate',
179
- label: '{{t("First or create")}}'
177
+ label: '{{t("Insert if not exists")}}'
180
178
  }, {
181
179
  value: 'updateOrCreate',
182
- label: '{{t("Update or create")}}'
180
+ label: '{{t("Insert if not exists, or update")}}'
183
181
  }]
184
182
  },
185
183
  filterKeys: {
186
184
  type: 'array',
187
- title: '{{ t("Find by the following fields") }}',
185
+ title: '{{ t("Determine whether a record exists by the following fields") }}',
188
186
  required: true,
189
187
  default: field.componentProps.filterKeys,
190
188
  'x-decorator': 'FormItem',
@@ -472,7 +470,7 @@ function DuplicationMode() {
472
470
  });
473
471
  }
474
472
  function UpdateMode() {
475
- var _fieldSchema$xAction;
473
+ var _fieldSchema$xAction2;
476
474
  var _useDesignable4 = useDesignable(),
477
475
  dn = _useDesignable4.dn;
478
476
  var _useTranslation5 = useTranslation(),
@@ -487,7 +485,7 @@ function UpdateMode() {
487
485
  label: t('All'),
488
486
  value: 'all'
489
487
  }],
490
- value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction === void 0 ? void 0 : _fieldSchema$xAction['updateMode'],
488
+ value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction2 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction2 === void 0 ? void 0 : _fieldSchema$xAction2['updateMode'],
491
489
  onChange: function onChange(value) {
492
490
  fieldSchema['x-action-settings']['updateMode'] = value;
493
491
  dn.emit('patch', {
@@ -501,7 +499,7 @@ function UpdateMode() {
501
499
  });
502
500
  }
503
501
  function AssignedFieldValues() {
504
- var _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4;
502
+ var _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5;
505
503
  var _useDesignable5 = useDesignable(),
506
504
  dn = _useDesignable5.dn;
507
505
  var _useTranslation6 = useTranslation(),
@@ -526,13 +524,13 @@ function AssignedFieldValues() {
526
524
  'customize:update': t('After clicking the custom button, the following fields of the current record will be saved according to the following form.'),
527
525
  'customize:save': t('After clicking the custom button, the following fields of the current record will be saved according to the following form.')
528
526
  };
529
- var actionType = (_fieldSchema$xAction2 = fieldSchema['x-action']) !== null && _fieldSchema$xAction2 !== void 0 ? _fieldSchema$xAction2 : '';
527
+ var actionType = (_fieldSchema$xAction3 = fieldSchema['x-action']) !== null && _fieldSchema$xAction3 !== void 0 ? _fieldSchema$xAction3 : '';
530
528
  return /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
531
529
  title: t('Assign field values'),
532
530
  initialSchema: initialSchema,
533
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction3 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction3 === void 0 ? void 0 : _fieldSchema$xAction3.assignedValues,
531
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.assignedValues,
534
532
  modalTip: tips[actionType],
535
- uid: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.schemaUid,
533
+ uid: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.schemaUid,
536
534
  onSubmit: function onSubmit(assignedValues) {
537
535
  var _schema4;
538
536
  fieldSchema['x-action-settings']['assignedValues'] = assignedValues;
@@ -544,7 +542,7 @@ function AssignedFieldValues() {
544
542
  });
545
543
  }
546
544
  function RequestSettings() {
547
- var _fieldSchema$xAction5;
545
+ var _fieldSchema$xAction6;
548
546
  var _useDesignable6 = useDesignable(),
549
547
  dn = _useDesignable6.dn;
550
548
  var _useTranslation7 = useTranslation(),
@@ -553,7 +551,7 @@ function RequestSettings() {
553
551
  return /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
554
552
  title: t('Request settings'),
555
553
  schema: requestSettingsSchema,
556
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.requestSettings,
554
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction6 === void 0 ? void 0 : _fieldSchema$xAction6.requestSettings,
557
555
  onSubmit: function onSubmit(requestSettings) {
558
556
  var _schema5;
559
557
  fieldSchema['x-action-settings']['requestSettings'] = requestSettings;
@@ -565,7 +563,7 @@ function RequestSettings() {
565
563
  });
566
564
  }
567
565
  function SkipValidation() {
568
- var _fieldSchema$xAction6;
566
+ var _fieldSchema$xAction7;
569
567
  var _useDesignable7 = useDesignable(),
570
568
  dn = _useDesignable7.dn;
571
569
  var _useTranslation8 = useTranslation(),
@@ -573,7 +571,7 @@ function SkipValidation() {
573
571
  var fieldSchema = useFieldSchema();
574
572
  return /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
575
573
  title: t('Skip required validation'),
576
- checked: !!(fieldSchema !== null && fieldSchema !== void 0 && (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) !== null && _fieldSchema$xAction6 !== void 0 && _fieldSchema$xAction6.skipValidator),
574
+ checked: !!(fieldSchema !== null && fieldSchema !== void 0 && (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) !== null && _fieldSchema$xAction7 !== void 0 && _fieldSchema$xAction7.skipValidator),
577
575
  onChange: function onChange(value) {
578
576
  var _schema6;
579
577
  fieldSchema['x-action-settings'].skipValidator = value;
@@ -584,31 +582,18 @@ function SkipValidation() {
584
582
  });
585
583
  }
586
584
  function AfterSuccess() {
587
- var _fieldSchema$xAction7, _fieldSchema$xAction8;
585
+ var _fieldSchema$xAction8;
588
586
  var _useDesignable8 = useDesignable(),
589
587
  dn = _useDesignable8.dn;
590
588
  var _useTranslation9 = useTranslation(),
591
589
  t = _useTranslation9.t;
592
590
  var fieldSchema = useFieldSchema();
593
- var actionType = (_fieldSchema$xAction7 = fieldSchema['x-action']) !== null && _fieldSchema$xAction7 !== void 0 ? _fieldSchema$xAction7 : '';
594
591
  return /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
595
- title: {
596
- 'customize:save': t('After successful save'),
597
- 'customize:update': t('After successful update'),
598
- 'customize:table:request': t('After successful request'),
599
- 'customize:form:request': t('After successful request'),
600
- 'customize:bulkUpdate': t('After successful bulk update')
601
- }[actionType],
592
+ title: t('After successful submission'),
602
593
  initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction8 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction8 === void 0 ? void 0 : _fieldSchema$xAction8['onSuccess'],
603
594
  schema: {
604
595
  type: 'object',
605
- title: {
606
- 'customize:save': t('After successful save'),
607
- 'customize:update': t('After successful update'),
608
- 'customize:table:request': t('After successful request'),
609
- 'customize:form:request': t('After successful request'),
610
- 'customize:bulkUpdate': t('After successful bulk update')
611
- }[actionType],
596
+ title: t('After successful submission'),
612
597
  properties: {
613
598
  successMessage: {
614
599
  title: t('Popup message'),
@@ -684,16 +669,220 @@ function RemoveButton() {
684
669
  }
685
670
  }));
686
671
  }
672
+ function FormWorkflowSelect(props) {
673
+ var index = ArrayTable.useIndex();
674
+ var _useForm = useForm(),
675
+ setValuesIn = _useForm.setValuesIn;
676
+ var baseCollection = useCollection();
677
+ var _useCollectionManager = useCollectionManager(),
678
+ getCollection = _useCollectionManager.getCollection;
679
+ var _useState5 = useState(baseCollection.name),
680
+ _useState6 = _slicedToArray(_useState5, 2),
681
+ workflowCollection = _useState6[0],
682
+ setWorkflowCollection = _useState6[1];
683
+ useFormEffects(function () {
684
+ onFieldValueChange("group[".concat(index, "].context"), function (field) {
685
+ var collection = baseCollection;
686
+ if (field.value) {
687
+ var paths = field.value.split('.');
688
+ var _loop = function _loop() {
689
+ var path = paths[i];
690
+ var associationField = collection.fields.find(function (f) {
691
+ return f.name === path;
692
+ });
693
+ if (associationField) {
694
+ collection = getCollection(associationField.target);
695
+ }
696
+ };
697
+ for (var i = 0; i < paths.length && collection; i++) {
698
+ _loop();
699
+ }
700
+ }
701
+ setWorkflowCollection(collection.name);
702
+ setValuesIn("group[".concat(index, "].workflowKey"), null);
703
+ });
704
+ });
705
+ return /*#__PURE__*/React.createElement(RemoteSelect, _objectSpread(_objectSpread({}, props), {}, {
706
+ service: {
707
+ resource: 'workflows',
708
+ action: 'list',
709
+ params: {
710
+ filter: {
711
+ type: 'form',
712
+ enabled: true,
713
+ 'config.collection': workflowCollection
714
+ }
715
+ }
716
+ }
717
+ }));
718
+ }
719
+ function WorkflowConfig() {
720
+ var _fieldSchema$xAction9;
721
+ var _useDesignable9 = useDesignable(),
722
+ dn = _useDesignable9.dn;
723
+ var _useTranslation11 = useTranslation(),
724
+ t = _useTranslation11.t;
725
+ var fieldSchema = useFieldSchema();
726
+ var _useCollection3 = useCollection(),
727
+ collection = _useCollection3.name;
728
+ var description = {
729
+ submit: t('Workflow will be triggered after submitting succeeded.', {
730
+ ns: 'workflow'
731
+ }),
732
+ 'customize:save': t('Workflow will be triggered after saving succeeded.', {
733
+ ns: 'workflow'
734
+ }),
735
+ 'customize:triggerWorkflows': t('Workflow will be triggered directly once the button clicked.', {
736
+ ns: 'workflow'
737
+ })
738
+ }[fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-action']];
739
+ return /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
740
+ title: t('Bind workflows', {
741
+ ns: 'workflow'
742
+ }),
743
+ scope: {
744
+ fieldFilter: function fieldFilter(field) {
745
+ return ['belongsTo', 'hasOne'].includes(field.type);
746
+ }
747
+ },
748
+ components: {
749
+ Alert: Alert,
750
+ ArrayTable: ArrayTable,
751
+ FormWorkflowSelect: FormWorkflowSelect
752
+ },
753
+ schema: {
754
+ type: 'void',
755
+ title: t('Bind workflows', {
756
+ ns: 'workflow'
757
+ }),
758
+ properties: {
759
+ description: description && {
760
+ type: 'void',
761
+ 'x-component': 'Alert',
762
+ 'x-component-props': {
763
+ message: description,
764
+ style: {
765
+ marginBottom: '1em'
766
+ }
767
+ }
768
+ },
769
+ group: {
770
+ type: 'array',
771
+ 'x-component': 'ArrayTable',
772
+ 'x-decorator': 'FormItem',
773
+ items: {
774
+ type: 'object',
775
+ properties: {
776
+ context: {
777
+ type: 'void',
778
+ 'x-component': 'ArrayTable.Column',
779
+ 'x-component-props': {
780
+ title: t('Trigger data context', {
781
+ ns: 'workflow'
782
+ }),
783
+ width: 200
784
+ },
785
+ properties: {
786
+ context: {
787
+ type: 'string',
788
+ 'x-decorator': 'FormItem',
789
+ 'x-component': 'AppendsTreeSelect',
790
+ 'x-component-props': {
791
+ placeholder: t('Select context', {
792
+ ns: 'workflow'
793
+ }),
794
+ popupMatchSelectWidth: false,
795
+ collection: collection,
796
+ filter: '{{ fieldFilter }}',
797
+ rootOption: {
798
+ label: t('Full form data', {
799
+ ns: 'workflow'
800
+ }),
801
+ value: ''
802
+ },
803
+ allowClear: false
804
+ },
805
+ default: ''
806
+ }
807
+ }
808
+ },
809
+ workflowKey: {
810
+ type: 'void',
811
+ 'x-component': 'ArrayTable.Column',
812
+ 'x-component-props': {
813
+ title: t('Workflow', {
814
+ ns: 'workflow'
815
+ })
816
+ },
817
+ properties: {
818
+ workflowKey: {
819
+ type: 'number',
820
+ 'x-decorator': 'FormItem',
821
+ 'x-component': 'FormWorkflowSelect',
822
+ 'x-component-props': {
823
+ placeholder: t('Select workflow', {
824
+ ns: 'workflow'
825
+ }),
826
+ fieldNames: {
827
+ label: 'title',
828
+ value: 'key'
829
+ }
830
+ },
831
+ required: true
832
+ }
833
+ }
834
+ },
835
+ operations: {
836
+ type: 'void',
837
+ 'x-component': 'ArrayTable.Column',
838
+ 'x-component-props': {
839
+ width: 32
840
+ },
841
+ properties: {
842
+ remove: {
843
+ type: 'void',
844
+ 'x-decorator': 'FormItem',
845
+ 'x-component': 'ArrayTable.Remove'
846
+ }
847
+ }
848
+ }
849
+ }
850
+ },
851
+ properties: {
852
+ add: {
853
+ type: 'void',
854
+ title: t('Add workflow', {
855
+ ns: 'workflow'
856
+ }),
857
+ 'x-component': 'ArrayTable.Addition'
858
+ }
859
+ }
860
+ }
861
+ }
862
+ },
863
+ initialValues: {
864
+ group: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9.triggerWorkflows
865
+ },
866
+ onSubmit: function onSubmit(_ref4) {
867
+ var _schema8;
868
+ var group = _ref4.group;
869
+ fieldSchema['x-action-settings']['triggerWorkflows'] = group;
870
+ dn.emit('patch', {
871
+ schema: (_schema8 = {}, _defineProperty(_schema8, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema8, 'x-action-settings', fieldSchema['x-action-settings']), _schema8)
872
+ });
873
+ }
874
+ });
875
+ }
687
876
  export var ActionDesigner = function ActionDesigner(props) {
688
- var _fieldSchema$parent, _fieldSchema$xAction9, _fieldSchema$xAction10, _fieldSchema$xAction11, _fieldSchema$xAction12;
877
+ var _fieldSchema$parent, _fieldSchema$xAction10, _fieldSchema$xAction11, _fieldSchema$xAction12, _fieldSchema$xAction13, _fieldSchema$xAction14;
689
878
  var modalTip = props.modalTip,
690
879
  linkageAction = props.linkageAction,
691
880
  restProps = _objectWithoutProperties(props, _excluded2);
692
881
  var fieldSchema = useFieldSchema();
693
- var _useCollection3 = useCollection(),
694
- name = _useCollection3.name;
695
- var _useCollectionManager = useCollectionManager(),
696
- getChildrenCollections = _useCollectionManager.getChildrenCollections;
882
+ var _useCollection4 = useCollection(),
883
+ name = _useCollection4.name;
884
+ var _useCollectionManager2 = useCollectionManager(),
885
+ getChildrenCollections = _useCollectionManager2.getChildrenCollections;
697
886
  var isAction = useLinkageAction();
698
887
  var isPopupAction = ['create', 'update', 'view', 'customize:popup', 'duplicate', 'customize:create'].includes(fieldSchema['x-action'] || '');
699
888
  var isUpdateModePopupAction = ['customize:bulkUpdate', 'customize:bulkEdit'].includes(fieldSchema['x-action']);
@@ -709,7 +898,7 @@ export var ActionDesigner = function ActionDesigner(props) {
709
898
  }), isDuplicateAction && /*#__PURE__*/React.createElement(DuplicationMode, null), /*#__PURE__*/React.createElement(OpenModeSchemaItems, {
710
899
  openMode: isPopupAction,
711
900
  openSize: isPopupAction
712
- }), isUpdateModePopupAction && /*#__PURE__*/React.createElement(UpdateMode, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9.assignedValues) && /*#__PURE__*/React.createElement(AssignedFieldValues, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction10 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction10 === void 0 ? void 0 : _fieldSchema$xAction10.requestSettings) && /*#__PURE__*/React.createElement(RequestSettings, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction11 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction11 === void 0 ? void 0 : _fieldSchema$xAction11.skipValidator) && /*#__PURE__*/React.createElement(SkipValidation, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction12 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction12 === void 0 ? void 0 : _fieldSchema$xAction12['onSuccess']) && /*#__PURE__*/React.createElement(AfterSuccess, null), isChildCollectionAction && /*#__PURE__*/React.createElement(SchemaSettings.EnableChildCollections, {
901
+ }), isUpdateModePopupAction && /*#__PURE__*/React.createElement(UpdateMode, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction10 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction10 === void 0 ? void 0 : _fieldSchema$xAction10.assignedValues) && /*#__PURE__*/React.createElement(AssignedFieldValues, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction11 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction11 === void 0 ? void 0 : _fieldSchema$xAction11.requestSettings) && /*#__PURE__*/React.createElement(RequestSettings, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction12 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction12 === void 0 ? void 0 : _fieldSchema$xAction12.skipValidator) && /*#__PURE__*/React.createElement(SkipValidation, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction13 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction13 === void 0 ? void 0 : _fieldSchema$xAction13['onSuccess']) && /*#__PURE__*/React.createElement(AfterSuccess, null), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction14 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction14 === void 0 ? void 0 : _fieldSchema$xAction14.triggerWorkflows) && /*#__PURE__*/React.createElement(WorkflowConfig, null), isChildCollectionAction && /*#__PURE__*/React.createElement(SchemaSettings.EnableChildCollections, {
713
902
  collectionName: name
714
903
  }), /*#__PURE__*/React.createElement(RemoveButton, null)));
715
904
  };
@@ -36,10 +36,10 @@ export var ActionDrawer = observer(function (props) {
36
36
  }
37
37
  return buf;
38
38
  });
39
- return /*#__PURE__*/React.createElement(Drawer, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
39
+ return /*#__PURE__*/React.createElement(Drawer, _objectSpread(_objectSpread(_objectSpread({
40
40
  width: openSizeWidthMap.get(openSize),
41
41
  title: field.title
42
- }, others), drawerProps), modalProps), {}, {
42
+ }, others), drawerProps), {}, {
43
43
  rootStyle: _objectSpread(_objectSpread({}, drawerProps === null || drawerProps === void 0 ? void 0 : drawerProps.style), others === null || others === void 0 ? void 0 : others.style),
44
44
  destroyOnClose: true,
45
45
  open: visible,
@@ -48,7 +48,7 @@ export var ActionModal = observer(function (props) {
48
48
  },
49
49
  className: classNames(others.className, modalProps === null || modalProps === void 0 ? void 0 : modalProps.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.nb-action-popup {\n .ant-modal-header {\n display: none;\n }\n\n .ant-modal-content {\n background: var(--nb-box-bg);\n }\n }\n "])))),
50
50
  footer: footerSchema ? /*#__PURE__*/React.createElement("div", {
51
- className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n width: 100%;\n\n .ant-btn {\n margin-right: 8px;\n }\n "])))
51
+ className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n width: 100%;\n "])))
52
52
  }, /*#__PURE__*/React.createElement(RecursionField, {
53
53
  basePath: field.address,
54
54
  schema: schema,
@@ -1,5 +1,5 @@
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
- var _excluded = ["popover", "confirm", "openMode", "containerRefKey", "component", "useAction", "className", "icon", "title"];
2
+ var _excluded = ["popover", "confirm", "openMode", "containerRefKey", "component", "useAction", "className", "icon", "title", "onClick"];
3
3
  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; }
4
4
  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; }
5
5
  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; }
@@ -38,25 +38,25 @@ import { useA } from './hooks';
38
38
  import { linkageAction } from './utils';
39
39
  export var Action = observer(function (props) {
40
40
  var _fieldSchema$xCompon, _fieldSchema$xCompon2;
41
- var popover = props.popover,
42
- confirm = props.confirm,
43
- om = props.openMode,
44
- containerRefKey = props.containerRefKey,
45
- component = props.component,
46
- _props$useAction = props.useAction,
47
- useAction = _props$useAction === void 0 ? useA : _props$useAction,
48
- className = props.className,
49
- icon = props.icon,
50
- title = props.title,
51
- others = _objectWithoutProperties(props, _excluded);
41
+ var _useProps = useProps(props),
42
+ popover = _useProps.popover,
43
+ confirm = _useProps.confirm,
44
+ om = _useProps.openMode,
45
+ containerRefKey = _useProps.containerRefKey,
46
+ component = _useProps.component,
47
+ _useProps$useAction = _useProps.useAction,
48
+ useAction = _useProps$useAction === void 0 ? useA : _useProps$useAction,
49
+ className = _useProps.className,
50
+ icon = _useProps.icon,
51
+ title = _useProps.title,
52
+ _onClick = _useProps.onClick,
53
+ others = _objectWithoutProperties(_useProps, _excluded);
52
54
  var _useStyles = useStyles(),
53
55
  wrapSSR = _useStyles.wrapSSR,
54
56
  componentCls = _useStyles.componentCls,
55
57
  hashId = _useStyles.hashId;
56
58
  var _useTranslation = useTranslation(),
57
59
  t = _useTranslation.t;
58
- var _useProps = useProps(props),
59
- _onClick = _useProps.onClick;
60
60
  var _useState = useState(false),
61
61
  _useState2 = _slicedToArray(_useState, 2),
62
62
  visible = _useState2[0],
@@ -148,11 +148,7 @@ export var Action = observer(function (props) {
148
148
  basePath: field.address,
149
149
  onlyRenderProperties: true,
150
150
  schema: fieldSchema
151
- }), !popover && renderButton(), !popover && /*#__PURE__*/React.createElement("div", {
152
- onClick: function onClick(e) {
153
- return e.stopPropagation();
154
- }
155
- }, props.children), element));
151
+ }), !popover && renderButton(), !popover && props.children, element));
156
152
  }, {
157
153
  displayName: 'Action'
158
154
  });
@@ -1,8 +1,14 @@
1
1
  import React from 'react';
2
2
  export type AppendsTreeSelectProps = {
3
- value: string[];
4
- onChange: (value: string[]) => void;
3
+ value: string[] | string;
4
+ onChange: (value: string[] | string) => void;
5
+ multiple?: boolean;
6
+ filter?(field: any): boolean;
5
7
  collection?: string;
6
8
  useCollection?(props: Pick<AppendsTreeSelectProps, 'collection'>): string;
9
+ rootOption?: {
10
+ label: string;
11
+ value: string;
12
+ };
7
13
  };
8
14
  export declare const AppendsTreeSelect: React.FC<AppendsTreeSelectProps>;