@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.
- package/es/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
- package/es/api-client/hooks/useRequest.d.ts +1 -14
- package/es/api-client/hooks/useRequest.js +48 -53
- package/es/block-provider/DetailsBlockProvider.js +13 -1
- package/es/block-provider/FormBlockProvider.js +30 -13
- package/es/block-provider/hooks/index.d.ts +11 -1
- package/es/block-provider/hooks/index.js +527 -301
- package/es/collection-manager/Configuration/CollectionFields.js +1 -2
- package/es/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
- package/es/collection-manager/action-hooks.d.ts +4 -43
- package/es/collection-manager/action-hooks.js +18 -7
- package/es/collection-manager/interfaces/createdBy.js +1 -1
- package/es/collection-manager/interfaces/linkTo.js +5 -40
- package/es/collection-manager/interfaces/m2m.js +6 -39
- package/es/collection-manager/interfaces/m2o.js +6 -39
- package/es/collection-manager/interfaces/o2m.js +6 -69
- package/es/collection-manager/interfaces/o2o.js +31 -122
- package/es/collection-manager/interfaces/types.d.ts +2 -0
- package/es/collection-manager/interfaces/updatedBy.js +1 -1
- package/es/collection-manager/sub-table.d.ts +1 -14
- package/es/collection-manager/templates/tree.js +2 -2
- package/es/filter-provider/FilterProvider.js +3 -1
- package/es/locale/en_US.d.ts +4 -1
- package/es/locale/en_US.js +6 -3
- package/es/locale/ja_JP.d.ts +4 -1
- package/es/locale/ja_JP.js +4 -1
- package/es/locale/pt_BR.d.ts +1 -1
- package/es/locale/pt_BR.js +1 -1
- package/es/locale/zh_CN.d.ts +5 -1
- package/es/locale/zh_CN.js +5 -1
- package/es/schema-component/antd/action/Action.Designer.js +4 -5
- package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
- package/es/schema-component/antd/association-field/AssociationFieldProvider.js +19 -0
- package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
- package/es/schema-component/antd/association-field/AssociationSelect.js +118 -0
- package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
- package/es/schema-component/antd/association-field/Editable.js +88 -0
- package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
- package/es/schema-component/antd/association-field/FileManager.js +243 -0
- package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
- package/es/schema-component/antd/association-field/InternalNester.js +28 -0
- package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
- package/es/schema-component/antd/association-field/InternalPicker.js +267 -0
- package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
- package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
- package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
- package/es/schema-component/antd/association-field/InternalViewer.js +115 -0
- package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
- package/es/schema-component/antd/association-field/Nester.js +80 -0
- package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
- package/es/schema-component/antd/association-field/ReadPretty.js +38 -0
- package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
- package/es/schema-component/antd/association-field/SubTable.js +25 -0
- package/es/schema-component/antd/association-field/context.d.ts +7 -0
- package/es/schema-component/antd/association-field/context.js +2 -0
- package/es/schema-component/antd/association-field/hooks.d.ts +8 -0
- package/es/schema-component/antd/association-field/hooks.js +96 -0
- package/es/schema-component/antd/association-field/index.d.ts +1 -0
- package/es/schema-component/antd/association-field/index.js +14 -0
- package/es/schema-component/antd/association-field/schema.d.ts +142 -0
- package/es/schema-component/antd/association-field/schema.js +141 -0
- package/es/schema-component/antd/association-field/util.d.ts +8 -0
- package/es/schema-component/antd/association-field/util.js +84 -0
- package/es/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
- package/es/schema-component/antd/association-select/AssociationSelect.js +11 -2
- package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
- package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
- package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
- package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
- package/es/schema-component/antd/expand-action/index.d.ts +1 -0
- package/es/schema-component/antd/expand-action/index.js +5 -0
- package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
- package/es/schema-component/antd/filter/FilterItem.js +1 -1
- package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
- package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
- package/es/schema-component/antd/form-item/FormItem.js +206 -58
- package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
- package/es/schema-component/antd/form-v2/utils.js +6 -4
- package/es/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
- package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
- package/es/schema-component/antd/index.d.ts +3 -1
- package/es/schema-component/antd/index.js +3 -1
- package/es/schema-component/antd/menu/Menu.js +6 -3
- package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +40 -17
- package/es/schema-component/antd/remote-select/RemoteSelect.js +16 -18
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
- package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
- package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
- package/es/schema-component/antd/table-v2/Table.js +9 -5
- package/es/schema-component/antd/table-v2/index.js +3 -1
- package/es/schema-component/antd/table-v2/utils.js +1 -1
- package/es/schema-component/antd/variable/Input.js +15 -16
- package/es/schema-component/antd/variable/TextArea.js +2 -5
- package/es/schema-component/antd/variable/Variable.d.ts +2 -0
- package/es/schema-component/antd/variable/Variable.js +5 -2
- package/es/schema-component/common/dnd-context/index.js +3 -2
- package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
- package/es/schema-component/common/utils/uitls.js +1 -1
- package/es/schema-component/hooks/index.d.ts +1 -0
- package/es/schema-component/hooks/index.js +2 -1
- package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
- package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
- package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -1
- package/es/schema-initializer/components/CreateRecordAction.js +4 -3
- package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
- package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
- package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
- package/es/schema-initializer/items/index.d.ts +1 -0
- package/es/schema-initializer/items/index.js +2 -1
- package/es/schema-initializer/utils.js +57 -43
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
- package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
- package/es/schema-settings/LinkageRules/Variables.js +7 -4
- package/es/schema-settings/SchemaSettings.js +3 -3
- package/es/schema-settings/VariableInput/VariableInput.d.ts +3 -2
- package/es/schema-settings/VariableInput/VariableInput.js +3 -1
- package/lib/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
- package/lib/api-client/hooks/useRequest.d.ts +1 -14
- package/lib/api-client/hooks/useRequest.js +48 -53
- package/lib/block-provider/DetailsBlockProvider.js +13 -1
- package/lib/block-provider/FormBlockProvider.js +31 -15
- package/lib/block-provider/hooks/index.d.ts +11 -1
- package/lib/block-provider/hooks/index.js +537 -308
- package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
- package/lib/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
- package/lib/collection-manager/action-hooks.d.ts +4 -43
- package/lib/collection-manager/action-hooks.js +18 -7
- package/lib/collection-manager/interfaces/createdBy.js +1 -1
- package/lib/collection-manager/interfaces/linkTo.js +4 -39
- package/lib/collection-manager/interfaces/m2m.js +5 -38
- package/lib/collection-manager/interfaces/m2o.js +5 -38
- package/lib/collection-manager/interfaces/o2m.js +8 -71
- package/lib/collection-manager/interfaces/o2o.js +36 -127
- package/lib/collection-manager/interfaces/types.d.ts +2 -0
- package/lib/collection-manager/interfaces/updatedBy.js +1 -1
- package/lib/collection-manager/sub-table.d.ts +1 -14
- package/lib/collection-manager/templates/tree.js +2 -2
- package/lib/filter-provider/FilterProvider.js +3 -1
- package/lib/locale/en_US.d.ts +4 -1
- package/lib/locale/en_US.js +6 -3
- package/lib/locale/ja_JP.d.ts +4 -1
- package/lib/locale/ja_JP.js +4 -1
- package/lib/locale/pt_BR.d.ts +1 -1
- package/lib/locale/pt_BR.js +1 -1
- package/lib/locale/zh_CN.d.ts +5 -1
- package/lib/locale/zh_CN.js +5 -1
- package/lib/schema-component/antd/action/Action.Designer.js +4 -5
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +28 -0
- package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
- package/lib/schema-component/antd/association-field/AssociationSelect.js +129 -0
- package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
- package/lib/schema-component/antd/association-field/Editable.js +97 -0
- package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
- package/lib/schema-component/antd/association-field/FileManager.js +253 -0
- package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
- package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
- package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
- package/lib/schema-component/antd/association-field/InternalPicker.js +277 -0
- package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
- package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
- package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
- package/lib/schema-component/antd/association-field/InternalViewer.js +126 -0
- package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
- package/lib/schema-component/antd/association-field/Nester.js +89 -0
- package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
- package/lib/schema-component/antd/association-field/ReadPretty.js +47 -0
- package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
- package/lib/schema-component/antd/association-field/SubTable.js +33 -0
- package/lib/schema-component/antd/association-field/context.d.ts +7 -0
- package/lib/schema-component/antd/association-field/context.js +9 -0
- package/lib/schema-component/antd/association-field/hooks.d.ts +8 -0
- package/lib/schema-component/antd/association-field/hooks.js +107 -0
- package/lib/schema-component/antd/association-field/index.d.ts +1 -0
- package/lib/schema-component/antd/association-field/index.js +21 -0
- package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
- package/lib/schema-component/antd/association-field/schema.js +148 -0
- package/lib/schema-component/antd/association-field/util.d.ts +8 -0
- package/lib/schema-component/antd/association-field/util.js +98 -0
- package/lib/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
- package/lib/schema-component/antd/association-select/AssociationSelect.js +10 -1
- package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
- package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/index.js +12 -0
- package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
- package/lib/schema-component/antd/filter/FilterItem.js +1 -1
- package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
- package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
- package/lib/schema-component/antd/form-item/FormItem.js +204 -55
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
- package/lib/schema-component/antd/form-v2/utils.js +6 -5
- package/lib/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
- package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
- package/lib/schema-component/antd/index.d.ts +3 -1
- package/lib/schema-component/antd/index.js +33 -11
- package/lib/schema-component/antd/menu/Menu.js +6 -3
- package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +42 -18
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +15 -17
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
- package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
- package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
- package/lib/schema-component/antd/table-v2/Table.js +9 -5
- package/lib/schema-component/antd/table-v2/index.js +3 -1
- package/lib/schema-component/antd/table-v2/utils.js +1 -1
- package/lib/schema-component/antd/variable/Input.js +15 -16
- package/lib/schema-component/antd/variable/TextArea.js +2 -5
- package/lib/schema-component/antd/variable/Variable.d.ts +2 -0
- package/lib/schema-component/antd/variable/Variable.js +6 -2
- package/lib/schema-component/common/dnd-context/index.js +3 -2
- package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
- package/lib/schema-component/common/utils/uitls.js +1 -1
- package/lib/schema-component/hooks/index.d.ts +1 -0
- package/lib/schema-component/hooks/index.js +11 -0
- package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
- package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
- package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -1
- package/lib/schema-initializer/components/CreateRecordAction.js +4 -3
- package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
- package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
- package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
- package/lib/schema-initializer/items/index.d.ts +1 -0
- package/lib/schema-initializer/items/index.js +11 -0
- package/lib/schema-initializer/utils.js +56 -42
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
- package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
- package/lib/schema-settings/LinkageRules/Variables.js +7 -4
- package/lib/schema-settings/SchemaSettings.js +4 -4
- package/lib/schema-settings/VariableInput/VariableInput.d.ts +3 -2
- package/lib/schema-settings/VariableInput/VariableInput.js +3 -1
- package/package.json +5 -6
|
@@ -35,9 +35,13 @@ import { DndContext, useDesignable, useTableSize } from '../..';
|
|
|
35
35
|
import { RecordIndexProvider, RecordProvider, useSchemaInitializer, useTableBlockContext, useTableSelectorContext } from '../../../';
|
|
36
36
|
import { useACLFieldWhitelist } from '../../../acl/ACLProvider';
|
|
37
37
|
import { extractIndex, getIdsWithChildren, isCollectionFieldComponent, isColumnComponent } from './utils';
|
|
38
|
-
var
|
|
39
|
-
var _schema$reducePropert;
|
|
38
|
+
var useArrayField = function useArrayField(props) {
|
|
40
39
|
var field = useField();
|
|
40
|
+
return props.field || field;
|
|
41
|
+
};
|
|
42
|
+
var useTableColumns = function useTableColumns(props) {
|
|
43
|
+
var _schema$reducePropert;
|
|
44
|
+
var field = useArrayField(props);
|
|
41
45
|
var schema = useFieldSchema();
|
|
42
46
|
var _useACLFieldWhitelist = useACLFieldWhitelist(),
|
|
43
47
|
schemaInWhitelist = _useACLFieldWhitelist.schemaInWhitelist;
|
|
@@ -78,8 +82,8 @@ var useTableColumns = function useTableColumns() {
|
|
|
78
82
|
}, /*#__PURE__*/React.createElement(RecordProvider, {
|
|
79
83
|
record: record
|
|
80
84
|
}, /*#__PURE__*/React.createElement(RecursionField, {
|
|
85
|
+
basePath: field.address.concat(record.__index || index),
|
|
81
86
|
schema: s,
|
|
82
|
-
name: record.__index || index,
|
|
83
87
|
onlyRenderProperties: true
|
|
84
88
|
})));
|
|
85
89
|
}
|
|
@@ -179,8 +183,6 @@ var useValidator = function useValidator(validator) {
|
|
|
179
183
|
};
|
|
180
184
|
export var Table = observer(function (props) {
|
|
181
185
|
var _schema$parent, _schema$parent2, _field$data, _fieldSchema$parent, _fieldSchema$parent$x, _field$value4, _field$value4$slice;
|
|
182
|
-
var field = useField();
|
|
183
|
-
var columns = useTableColumns();
|
|
184
186
|
var pagination1 = props.pagination,
|
|
185
187
|
useProps = props.useProps,
|
|
186
188
|
onChange = props.onChange,
|
|
@@ -201,6 +203,8 @@ export var Table = observer(function (props) {
|
|
|
201
203
|
required = _others1$others.required,
|
|
202
204
|
_onExpand = _others1$others.onExpand,
|
|
203
205
|
others = _objectWithoutProperties(_others1$others, _excluded3);
|
|
206
|
+
var field = useArrayField(others);
|
|
207
|
+
var columns = useTableColumns(others);
|
|
204
208
|
var schema = useFieldSchema();
|
|
205
209
|
var isTableSelector = (schema === null || schema === void 0 ? void 0 : (_schema$parent = schema.parent) === null || _schema$parent === void 0 ? void 0 : _schema$parent['x-decorator']) === 'TableSelectorProvider';
|
|
206
210
|
var ctx = isTableSelector ? useTableSelectorContext() : useTableBlockContext();
|
|
@@ -4,6 +4,7 @@ import { TableColumn } from './Table.Column';
|
|
|
4
4
|
import { TableColumnActionBar } from './Table.Column.ActionBar';
|
|
5
5
|
import { TableColumnDecorator } from './Table.Column.Decorator';
|
|
6
6
|
import { TableColumnDesigner } from './Table.Column.Designer';
|
|
7
|
+
import { TableIndex } from './Table.Index';
|
|
7
8
|
import { TableSelector } from './TableSelector';
|
|
8
9
|
export * from './TableBlockDesigner';
|
|
9
10
|
export * from './TableField';
|
|
@@ -14,4 +15,5 @@ TableV2.Column.ActionBar = TableColumnActionBar;
|
|
|
14
15
|
TableV2.Column.Decorator = TableColumnDecorator;
|
|
15
16
|
TableV2.Column.Designer = TableColumnDesigner;
|
|
16
17
|
TableV2.ActionColumnDesigner = TableActionColumnDesigner;
|
|
17
|
-
TableV2.Selector = TableSelector;
|
|
18
|
+
TableV2.Selector = TableSelector;
|
|
19
|
+
TableV2.Index = TableIndex;
|
|
@@ -31,7 +31,7 @@ export function getIdsWithChildren(nodes) {
|
|
|
31
31
|
var node = _step.value;
|
|
32
32
|
if (node.children && node.children.length > 0) {
|
|
33
33
|
ids.push(node.id);
|
|
34
|
-
ids.push.apply(ids, _toConsumableArray(getIdsWithChildren(node.children)));
|
|
34
|
+
ids.push.apply(ids, _toConsumableArray(getIdsWithChildren(node === null || node === void 0 ? void 0 : node.children)));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
} catch (err) {
|
|
@@ -17,6 +17,7 @@ import { Input as AntInput, Cascader, DatePicker, InputNumber, Select, Tag } fro
|
|
|
17
17
|
import moment from 'moment';
|
|
18
18
|
import React from 'react';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
|
+
import classNames from 'classnames';
|
|
20
21
|
import { useCompile } from '../..';
|
|
21
22
|
import { XButton } from './XButton';
|
|
22
23
|
var JT_VALUE_RE = /^\s*{{\s*([^{}]+)\s*}}\s*$/;
|
|
@@ -44,7 +45,7 @@ var ConstantTypes = {
|
|
|
44
45
|
string: {
|
|
45
46
|
label: "{{t(\"String\")}}",
|
|
46
47
|
value: 'string',
|
|
47
|
-
component: function
|
|
48
|
+
component: function StringComponent(_ref) {
|
|
48
49
|
var _onChange = _ref.onChange,
|
|
49
50
|
value = _ref.value;
|
|
50
51
|
return /*#__PURE__*/React.createElement(AntInput, {
|
|
@@ -59,7 +60,7 @@ var ConstantTypes = {
|
|
|
59
60
|
number: {
|
|
60
61
|
label: '{{t("Number")}}',
|
|
61
62
|
value: 'number',
|
|
62
|
-
component: function
|
|
63
|
+
component: function NumberComponent(_ref2) {
|
|
63
64
|
var onChange = _ref2.onChange,
|
|
64
65
|
value = _ref2.value;
|
|
65
66
|
return /*#__PURE__*/React.createElement(InputNumber, {
|
|
@@ -72,7 +73,7 @@ var ConstantTypes = {
|
|
|
72
73
|
boolean: {
|
|
73
74
|
label: "{{t(\"Boolean\")}}",
|
|
74
75
|
value: 'boolean',
|
|
75
|
-
component: function
|
|
76
|
+
component: function BooleanComponent(_ref3) {
|
|
76
77
|
var onChange = _ref3.onChange,
|
|
77
78
|
value = _ref3.value;
|
|
78
79
|
var _useTranslation = useTranslation(),
|
|
@@ -95,7 +96,7 @@ var ConstantTypes = {
|
|
|
95
96
|
date: {
|
|
96
97
|
label: '{{t("Date")}}',
|
|
97
98
|
value: 'date',
|
|
98
|
-
component: function
|
|
99
|
+
component: function DateComponent(_ref4) {
|
|
99
100
|
var _onChange2 = _ref4.onChange,
|
|
100
101
|
value = _ref4.value;
|
|
101
102
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
@@ -115,7 +116,7 @@ var ConstantTypes = {
|
|
|
115
116
|
null: {
|
|
116
117
|
label: "{{t(\"Null\")}}",
|
|
117
118
|
value: 'null',
|
|
118
|
-
component: function
|
|
119
|
+
component: function NullComponent() {
|
|
119
120
|
var _useTranslation2 = useTranslation(),
|
|
120
121
|
t = _useTranslation2.t;
|
|
121
122
|
return /*#__PURE__*/React.createElement(AntInput, {
|
|
@@ -147,12 +148,13 @@ export function Input(props) {
|
|
|
147
148
|
children = props.children,
|
|
148
149
|
button = props.button,
|
|
149
150
|
useTypedConstant = props.useTypedConstant,
|
|
150
|
-
style = props.style
|
|
151
|
+
style = props.style,
|
|
152
|
+
className = props.className;
|
|
151
153
|
var parsed = parseValue(value);
|
|
152
154
|
var isConstant = typeof parsed === 'string';
|
|
153
155
|
var type = isConstant ? parsed : '';
|
|
154
156
|
var variable = isConstant ? null : parsed;
|
|
155
|
-
var
|
|
157
|
+
var variableOptions = typeof scope === 'function' ? scope() : scope !== null && scope !== void 0 ? scope : [];
|
|
156
158
|
var _ref5 = children ? {
|
|
157
159
|
value: '',
|
|
158
160
|
label: '{{t("Constant")}}'
|
|
@@ -163,7 +165,7 @@ export function Input(props) {
|
|
|
163
165
|
},
|
|
164
166
|
ConstantComponent = _ref5.component,
|
|
165
167
|
constantOption = _objectWithoutProperties(_ref5, _excluded);
|
|
166
|
-
var options = compile([constantOption].concat(_toConsumableArray(
|
|
168
|
+
var options = compile([constantOption].concat(_toConsumableArray(variableOptions)));
|
|
167
169
|
function onSwitch(next) {
|
|
168
170
|
if (next[0] === '') {
|
|
169
171
|
if (next[1]) {
|
|
@@ -193,13 +195,9 @@ export function Input(props) {
|
|
|
193
195
|
return /*#__PURE__*/React.createElement(AntInput.Group, {
|
|
194
196
|
compact: true,
|
|
195
197
|
style: style,
|
|
196
|
-
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
197
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
198
|
-
style: {
|
|
199
|
-
flex: 1
|
|
200
|
-
}
|
|
198
|
+
className: classNames(className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: auto;\n display: flex !important;\n .ant-input-disabled {\n .ant-tag {\n color: #bfbfbf;\n border-color: #d9d9d9;\n }\n }\n .ant-input.null-value {\n width: 4em;\n min-width: 4em;\n }\n "]))))
|
|
201
199
|
}, variable ? /*#__PURE__*/React.createElement("div", {
|
|
202
|
-
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n
|
|
200
|
+
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n line-height: 0;\n\n &:hover {\n .ant-select-clear {\n opacity: 0.8;\n }\n }\n\n .ant-input {\n overflow: auto;\n white-space: nowrap;\n ", "\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0;\n padding: 2px 7px;\n border-radius: 10px;\n }\n }\n "])), disabled ? '' : 'padding-right: 28px;')
|
|
203
201
|
}, /*#__PURE__*/React.createElement("div", {
|
|
204
202
|
onInput: function onInput(e) {
|
|
205
203
|
return e.preventDefault();
|
|
@@ -220,7 +218,8 @@ export function Input(props) {
|
|
|
220
218
|
contentEditable: false,
|
|
221
219
|
color: "blue"
|
|
222
220
|
}, variableText)), !disabled ? /*#__PURE__*/React.createElement("span", {
|
|
223
|
-
className: cx('ant-select-clear', css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n
|
|
221
|
+
className: cx('ant-select-clear', css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n user-select: 'none';\n "])))),
|
|
222
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
224
223
|
unselectable: "on",
|
|
225
224
|
"aria-hidden": true,
|
|
226
225
|
onClick: function onClick() {
|
|
@@ -229,7 +228,7 @@ export function Input(props) {
|
|
|
229
228
|
}, /*#__PURE__*/React.createElement(CloseCircleFilled, null)) : null) : children !== null && children !== void 0 ? children : /*#__PURE__*/React.createElement(ConstantComponent, {
|
|
230
229
|
value: value,
|
|
231
230
|
onChange: onChange
|
|
232
|
-
})
|
|
231
|
+
}), options.length > 1 ? /*#__PURE__*/React.createElement(Cascader, {
|
|
233
232
|
options: options,
|
|
234
233
|
value: variable !== null && variable !== void 0 ? variable : [''].concat(_toConsumableArray(children || !((_constantOption$child = constantOption.children) === null || _constantOption$child === void 0 ? void 0 : _constantOption$child.length) ? [] : [type])),
|
|
235
234
|
onChange: onSwitch,
|
|
@@ -15,7 +15,6 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
|
15
15
|
import { Input } from 'antd';
|
|
16
16
|
import { useForm } from '@formily/react';
|
|
17
17
|
import { cx, css } from '@emotion/css';
|
|
18
|
-
import { useTranslation } from 'react-i18next';
|
|
19
18
|
import * as sanitizeHTML from 'sanitize-html';
|
|
20
19
|
import { EllipsisWithTooltip, useCompile } from '../..';
|
|
21
20
|
import { VariableSelect } from './VariableSelect';
|
|
@@ -215,8 +214,6 @@ export function TextArea(props) {
|
|
|
215
214
|
_props$multiline = props.multiline,
|
|
216
215
|
multiline = _props$multiline === void 0 ? true : _props$multiline;
|
|
217
216
|
var compile = useCompile();
|
|
218
|
-
var _useTranslation = useTranslation(),
|
|
219
|
-
t = _useTranslation.t;
|
|
220
217
|
var inputRef = useRef(null);
|
|
221
218
|
var options = compile((_ref2 = typeof scope === 'function' ? scope() : scope) !== null && _ref2 !== void 0 ? _ref2 : []);
|
|
222
219
|
var form = useForm();
|
|
@@ -334,7 +331,7 @@ export function TextArea(props) {
|
|
|
334
331
|
if (ev.key === 'Enter') {
|
|
335
332
|
ev.preventDefault();
|
|
336
333
|
}
|
|
337
|
-
setIME(ev.keyCode === 229);
|
|
334
|
+
setIME(ev.keyCode === 229 && ![' ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'Enter'].includes(ev.key));
|
|
338
335
|
// if (ev.key === 'Control') {
|
|
339
336
|
// console.debug(getSelection().getRangeAt(0));
|
|
340
337
|
// }
|
|
@@ -392,7 +389,7 @@ export function TextArea(props) {
|
|
|
392
389
|
onInsert: onInsert
|
|
393
390
|
}) : null);
|
|
394
391
|
}
|
|
395
|
-
TextArea.ReadPretty = function (props) {
|
|
392
|
+
TextArea.ReadPretty = function ReadPretty(props) {
|
|
396
393
|
var _ref5;
|
|
397
394
|
var value = props.value,
|
|
398
395
|
_props$multiline2 = props.multiline,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { IField } from '../../../collection-manager';
|
|
2
3
|
export declare function Variable(): any;
|
|
3
4
|
export declare namespace Variable {
|
|
4
5
|
var Input: import("react").ForwardRefExoticComponent<Pick<Partial<any>, string | number | symbol> & import("react").RefAttributes<unknown>>;
|
|
@@ -6,3 +7,4 @@ export declare namespace Variable {
|
|
|
6
7
|
var JSON: import("react").ForwardRefExoticComponent<Pick<Partial<any>, string | number | symbol> & import("react").RefAttributes<unknown>>;
|
|
7
8
|
}
|
|
8
9
|
export default Variable;
|
|
10
|
+
export declare function isInvariable(value: IField): boolean;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { connect, mapReadPretty } from '@formily/react';
|
|
2
2
|
import { Input } from './Input';
|
|
3
|
-
import { TextArea } from './TextArea';
|
|
4
3
|
import { JSONInput } from './JSONInput';
|
|
4
|
+
import { TextArea } from './TextArea';
|
|
5
5
|
export function Variable() {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
8
|
Variable.Input = connect(Input);
|
|
9
9
|
Variable.TextArea = connect(TextArea, mapReadPretty(TextArea.ReadPretty));
|
|
10
10
|
Variable.JSON = connect(JSONInput);
|
|
11
|
-
export default Variable;
|
|
11
|
+
export default Variable;
|
|
12
|
+
export function isInvariable(value) {
|
|
13
|
+
return !!(value === null || value === void 0 ? void 0 : value.invariable);
|
|
14
|
+
}
|
|
@@ -23,7 +23,7 @@ var useDragEnd = function useDragEnd(props) {
|
|
|
23
23
|
var _useTranslation = useTranslation(),
|
|
24
24
|
t = _useTranslation.t;
|
|
25
25
|
return function (event) {
|
|
26
|
-
var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current, _over$data5, _over$data5$current;
|
|
26
|
+
var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current, _over$data5, _over$data5$current, _over$data$current$re;
|
|
27
27
|
var active = event.active,
|
|
28
28
|
over = event.over;
|
|
29
29
|
var activeSchema = active === null || active === void 0 ? void 0 : (_active$data = active.data) === null || _active$data === void 0 ? void 0 : (_active$data$current = _active$data.current) === null || _active$data$current === void 0 ? void 0 : _active$data$current.schema;
|
|
@@ -32,6 +32,7 @@ var useDragEnd = function useDragEnd(props) {
|
|
|
32
32
|
var breakRemoveOn = over === null || over === void 0 ? void 0 : (_over$data3 = over.data) === null || _over$data3 === void 0 ? void 0 : (_over$data3$current = _over$data3.current) === null || _over$data3$current === void 0 ? void 0 : _over$data3$current.breakRemoveOn;
|
|
33
33
|
var wrapSchema = over === null || over === void 0 ? void 0 : (_over$data4 = over.data) === null || _over$data4 === void 0 ? void 0 : (_over$data4$current = _over$data4.current) === null || _over$data4$current === void 0 ? void 0 : _over$data4$current.wrapSchema;
|
|
34
34
|
var onSuccess = over === null || over === void 0 ? void 0 : (_over$data5 = over.data) === null || _over$data5 === void 0 ? void 0 : (_over$data5$current = _over$data5.current) === null || _over$data5$current === void 0 ? void 0 : _over$data5$current.onSuccess;
|
|
35
|
+
var removeParentsIfNoChildren = (_over$data$current$re = over.data.current.removeParentsIfNoChildren) !== null && _over$data$current$re !== void 0 ? _over$data$current$re : true;
|
|
35
36
|
if (!activeSchema || !overSchema) {
|
|
36
37
|
var _props$onDragEnd;
|
|
37
38
|
props === null || props === void 0 ? void 0 : (_props$onDragEnd = props.onDragEnd) === null || _props$onDragEnd === void 0 ? void 0 : _props$onDragEnd.call(props, event);
|
|
@@ -60,7 +61,7 @@ var useDragEnd = function useDragEnd(props) {
|
|
|
60
61
|
dn.insertAdjacent(insertAdjacent, activeSchema, {
|
|
61
62
|
wrap: wrapSchema,
|
|
62
63
|
breakRemoveOn: breakRemoveOn,
|
|
63
|
-
removeParentsIfNoChildren:
|
|
64
|
+
removeParentsIfNoChildren: removeParentsIfNoChildren,
|
|
64
65
|
onSuccess: onSuccess
|
|
65
66
|
});
|
|
66
67
|
props === null || props === void 0 ? void 0 : (_props$onDragEnd4 = props.onDragEnd) === null || _props$onDragEnd4 === void 0 ? void 0 : _props$onDragEnd4.call(props, event);
|
|
@@ -72,15 +72,18 @@ var useSortableItemId = function useSortableItemId(props) {
|
|
|
72
72
|
return field.address.toString();
|
|
73
73
|
};
|
|
74
74
|
export var SortableItem = observer(function (props) {
|
|
75
|
+
var _others$removeParents;
|
|
75
76
|
var _useSortableItemProps = useSortableItemProps(props),
|
|
76
77
|
schema = _useSortableItemProps.schema,
|
|
77
78
|
id = _useSortableItemProps.id,
|
|
78
79
|
others = _objectWithoutProperties(_useSortableItemProps, _excluded2);
|
|
80
|
+
var removeParentsIfNoChildren = (_others$removeParents = others.removeParentsIfNoChildren) !== null && _others$removeParents !== void 0 ? _others$removeParents : true;
|
|
79
81
|
return /*#__PURE__*/React.createElement(SortableProvider, {
|
|
80
82
|
id: id,
|
|
81
83
|
data: {
|
|
82
84
|
insertAdjacent: 'afterEnd',
|
|
83
|
-
schema: schema
|
|
85
|
+
schema: schema,
|
|
86
|
+
removeParentsIfNoChildren: removeParentsIfNoChildren
|
|
84
87
|
}
|
|
85
88
|
}, /*#__PURE__*/React.createElement(Sortable, _objectSpread({}, others), props.children));
|
|
86
89
|
});
|
|
@@ -62,7 +62,7 @@ var getValue = function getValue(str, values) {
|
|
|
62
62
|
var regex = /{{(.*?)}}/;
|
|
63
63
|
var matches = str === null || str === void 0 ? void 0 : (_str$match3 = str.match) === null || _str$match3 === void 0 ? void 0 : _str$match3.call(str, regex);
|
|
64
64
|
if (matches) {
|
|
65
|
-
return getVariableValue(str, values);
|
|
65
|
+
return getVariableValue(str, flat(values));
|
|
66
66
|
} else {
|
|
67
67
|
return str;
|
|
68
68
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useFieldSchema, useField } from '@formily/react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useCollection, useCollectionManager } from '../../collection-manager';
|
|
5
|
+
export var useFieldModeOptions = function useFieldModeOptions() {
|
|
6
|
+
var _fieldSchema$xCompon;
|
|
7
|
+
var _useCollectionManager = useCollectionManager(),
|
|
8
|
+
getCollectionJoinField = _useCollectionManager.getCollectionJoinField,
|
|
9
|
+
getCollection = _useCollectionManager.getCollection;
|
|
10
|
+
var fieldSchema = useFieldSchema();
|
|
11
|
+
var field = useField();
|
|
12
|
+
var isReadPretty = field.readPretty;
|
|
13
|
+
var _useCollection = useCollection(),
|
|
14
|
+
getField = _useCollection.getField;
|
|
15
|
+
var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
16
|
+
var _useTranslation = useTranslation(),
|
|
17
|
+
t = _useTranslation.t;
|
|
18
|
+
var _ref = ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.fieldNames) || {},
|
|
19
|
+
label = _ref.label;
|
|
20
|
+
var fieldModeOptions = useMemo(function () {
|
|
21
|
+
if (!collectionField || !(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!['o2o', 'oho', 'obo', 'o2m', 'linkTo', 'm2o', 'm2m'].includes(collectionField.interface)) return;
|
|
25
|
+
var collection = getCollection(collectionField.target);
|
|
26
|
+
if ((collection === null || collection === void 0 ? void 0 : collection.template) === 'file') {
|
|
27
|
+
return isReadPretty ? [{
|
|
28
|
+
label: t('Title'),
|
|
29
|
+
value: 'Select'
|
|
30
|
+
}, {
|
|
31
|
+
label: t('File manager'),
|
|
32
|
+
value: 'FileManager'
|
|
33
|
+
}] : [{
|
|
34
|
+
label: t('File manager'),
|
|
35
|
+
value: 'FileManager'
|
|
36
|
+
}, {
|
|
37
|
+
label: t('Record picker'),
|
|
38
|
+
value: 'Picker'
|
|
39
|
+
}, {
|
|
40
|
+
label: t('Select'),
|
|
41
|
+
value: 'Select'
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
44
|
+
switch (collectionField.interface) {
|
|
45
|
+
case 'o2m':
|
|
46
|
+
return isReadPretty ? [{
|
|
47
|
+
label: t('Title'),
|
|
48
|
+
value: 'Select'
|
|
49
|
+
},
|
|
50
|
+
// { label: t('Subtable'), value: 'SubTable' },
|
|
51
|
+
{
|
|
52
|
+
label: t('Sub-details'),
|
|
53
|
+
value: 'Nester'
|
|
54
|
+
}] : [{
|
|
55
|
+
label: t('Record picker'),
|
|
56
|
+
value: 'Picker'
|
|
57
|
+
},
|
|
58
|
+
// { label: t('Subtable'), value: 'SubTable' },
|
|
59
|
+
{
|
|
60
|
+
label: t('Select'),
|
|
61
|
+
value: 'Select'
|
|
62
|
+
}, {
|
|
63
|
+
label: t('Subform'),
|
|
64
|
+
value: 'Nester'
|
|
65
|
+
}];
|
|
66
|
+
case 'm2o':
|
|
67
|
+
case 'm2m':
|
|
68
|
+
case 'linkTo':
|
|
69
|
+
return isReadPretty ? [{
|
|
70
|
+
label: t('Title'),
|
|
71
|
+
value: 'Select'
|
|
72
|
+
}, {
|
|
73
|
+
label: t('Sub-details'),
|
|
74
|
+
value: 'Nester'
|
|
75
|
+
}] : [{
|
|
76
|
+
label: t('Record picker'),
|
|
77
|
+
value: 'Picker'
|
|
78
|
+
}, {
|
|
79
|
+
label: t('Select'),
|
|
80
|
+
value: 'Select'
|
|
81
|
+
}, {
|
|
82
|
+
label: t('Subform'),
|
|
83
|
+
value: 'Nester'
|
|
84
|
+
}];
|
|
85
|
+
default:
|
|
86
|
+
return isReadPretty ? [{
|
|
87
|
+
label: t('Title'),
|
|
88
|
+
value: 'Select'
|
|
89
|
+
}, {
|
|
90
|
+
label: t('Sub-details'),
|
|
91
|
+
value: 'Nester'
|
|
92
|
+
}] : [{
|
|
93
|
+
label: t('Record picker'),
|
|
94
|
+
value: 'Picker'
|
|
95
|
+
}, {
|
|
96
|
+
label: t('Select'),
|
|
97
|
+
value: 'Select'
|
|
98
|
+
}, {
|
|
99
|
+
label: t('Subform'),
|
|
100
|
+
value: 'Nester'
|
|
101
|
+
}];
|
|
102
|
+
}
|
|
103
|
+
}, [t, collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface, label]);
|
|
104
|
+
return fieldModeOptions;
|
|
105
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const actionDesignerCss: string;
|
|
3
|
-
export declare const CreateRecordAction: React.MemoExoticComponent<React.FunctionComponent<
|
|
3
|
+
export declare const CreateRecordAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
@@ -108,6 +108,7 @@ export var CreateRecordAction = observer(function (props) {
|
|
|
108
108
|
var compile = useCompile();
|
|
109
109
|
var _useDesignable = useDesignable(),
|
|
110
110
|
designable = _useDesignable.designable;
|
|
111
|
+
var icon = props.icon || /*#__PURE__*/React.createElement(PlusOutlined, null);
|
|
111
112
|
var menu = /*#__PURE__*/React.createElement(Menu, null, inheritsCollections.map(function (option) {
|
|
112
113
|
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
113
114
|
key: option.name,
|
|
@@ -151,16 +152,16 @@ export var CreateRecordAction = observer(function (props) {
|
|
|
151
152
|
setVisible(true);
|
|
152
153
|
setCurrentCollection(collection.name);
|
|
153
154
|
}
|
|
154
|
-
},
|
|
155
|
+
}, icon, props.children) : /*#__PURE__*/React.createElement(Dropdown, {
|
|
155
156
|
overlay: menu
|
|
156
157
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
157
|
-
icon:
|
|
158
|
+
icon: icon,
|
|
158
159
|
type: 'primary'
|
|
159
160
|
}, props.children, " ", /*#__PURE__*/React.createElement(DownOutlined, null))) : /*#__PURE__*/React.createElement(Button, {
|
|
160
161
|
type: componentType,
|
|
161
162
|
disabled: field.disabled,
|
|
162
163
|
danger: componentType === 'danger',
|
|
163
|
-
icon:
|
|
164
|
+
icon: icon,
|
|
164
165
|
onClick: function onClick(info) {
|
|
165
166
|
setVisible(true);
|
|
166
167
|
setCurrentCollection(collection.name);
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
var _templateObject;
|
|
2
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
4
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
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; }
|
|
7
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
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); }
|
|
9
7
|
import React from 'react';
|
|
10
|
-
import { Button } from 'antd';
|
|
11
|
-
import { css } from '@emotion/css';
|
|
12
|
-
import { useTranslation } from 'react-i18next';
|
|
13
|
-
import { useFieldSchema } from '@formily/react';
|
|
14
8
|
import { ActionInitializer } from './ActionInitializer';
|
|
15
|
-
import {
|
|
16
|
-
import { NodeCollapseOutlined, NodeExpandOutlined } from '@ant-design/icons';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
17
10
|
export var ExpandActionInitializer = function ExpandActionInitializer(props) {
|
|
11
|
+
var _useTranslation = useTranslation(),
|
|
12
|
+
t = _useTranslation.t;
|
|
18
13
|
var schema = {
|
|
19
14
|
'x-action': 'expandAll',
|
|
20
15
|
'x-component': 'Action',
|
|
21
|
-
'x-designer': 'Action.
|
|
16
|
+
'x-designer': 'Expand.Action.Design',
|
|
22
17
|
'x-component-props': {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
titleExpand: t("Expand all"),
|
|
19
|
+
titleCollapse: t("Collapse all"),
|
|
20
|
+
iconExpand: 'nodeexpandoutlined',
|
|
21
|
+
iconCollapse: 'nodecollapseoutlined',
|
|
22
|
+
component: 'Expand.Action',
|
|
26
23
|
useAction: function useAction() {
|
|
27
24
|
return {
|
|
28
25
|
run: function run() {}
|
|
@@ -33,26 +30,4 @@ export var ExpandActionInitializer = function ExpandActionInitializer(props) {
|
|
|
33
30
|
return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
34
31
|
schema: schema
|
|
35
32
|
}));
|
|
36
|
-
};
|
|
37
|
-
var actionDesignerCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(241, 139, 98, 0.06);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n"])));
|
|
38
|
-
export var ExpandActionComponent = function ExpandActionComponent(props) {
|
|
39
|
-
var _schema$parent, _schema$parent$parent;
|
|
40
|
-
var _useTranslation = useTranslation(),
|
|
41
|
-
t = _useTranslation.t;
|
|
42
|
-
var schema = useFieldSchema();
|
|
43
|
-
var isTableSelector = ((_schema$parent = schema.parent) === null || _schema$parent === void 0 ? void 0 : (_schema$parent$parent = _schema$parent.parent) === null || _schema$parent$parent === void 0 ? void 0 : _schema$parent$parent['x-decorator']) === 'TableSelectorProvider';
|
|
44
|
-
var ctx = isTableSelector ? useTableSelectorContext() : useTableBlockContext();
|
|
45
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
-
className: actionDesignerCss
|
|
47
|
-
}, ctx.params['tree'] && /*#__PURE__*/React.createElement(Button, {
|
|
48
|
-
onClick: function onClick() {
|
|
49
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.setExpandFlag();
|
|
50
|
-
},
|
|
51
|
-
icon: (ctx === null || ctx === void 0 ? void 0 : ctx.expandFlag) ? /*#__PURE__*/React.createElement(NodeCollapseOutlined, null) : /*#__PURE__*/React.createElement(NodeExpandOutlined, null),
|
|
52
|
-
type: props.type
|
|
53
|
-
}, props.children[1], /*#__PURE__*/React.createElement("span", {
|
|
54
|
-
style: {
|
|
55
|
-
marginLeft: 10
|
|
56
|
-
}
|
|
57
|
-
}, (ctx === null || ctx === void 0 ? void 0 : ctx.expandFlag) ? t('Collapse all') : t('Expand all'))));
|
|
58
33
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SelectActionInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { ActionInitializer } from './ActionInitializer';
|
|
9
|
+
export var SelectActionInitializer = function SelectActionInitializer(props) {
|
|
10
|
+
var schema = {
|
|
11
|
+
type: 'void',
|
|
12
|
+
title: '{{ t("Select") }}',
|
|
13
|
+
'x-action': 'update',
|
|
14
|
+
'x-designer': 'Action.Designer',
|
|
15
|
+
'x-component': 'Action',
|
|
16
|
+
'x-component-props': {
|
|
17
|
+
openMode: 'drawer'
|
|
18
|
+
},
|
|
19
|
+
properties: {
|
|
20
|
+
drawer: {
|
|
21
|
+
type: 'void',
|
|
22
|
+
'x-component': 'AssociationField.Selector',
|
|
23
|
+
title: '{{ t("Select record") }}',
|
|
24
|
+
'x-component-props': {
|
|
25
|
+
className: 'nb-record-picker-selector'
|
|
26
|
+
},
|
|
27
|
+
properties: {
|
|
28
|
+
grid: {
|
|
29
|
+
type: 'void',
|
|
30
|
+
'x-component': 'Grid',
|
|
31
|
+
'x-initializer': 'TableSelectorInitializers',
|
|
32
|
+
properties: {}
|
|
33
|
+
},
|
|
34
|
+
footer: {
|
|
35
|
+
'x-component': 'Action.Container.Footer',
|
|
36
|
+
'x-component-props': {},
|
|
37
|
+
properties: {
|
|
38
|
+
actions: {
|
|
39
|
+
type: 'void',
|
|
40
|
+
'x-component': 'ActionBar',
|
|
41
|
+
'x-component-props': {},
|
|
42
|
+
properties: {
|
|
43
|
+
submit: {
|
|
44
|
+
title: '{{ t("Submit") }}',
|
|
45
|
+
'x-action': 'submit',
|
|
46
|
+
'x-component': 'Action',
|
|
47
|
+
'x-designer': 'Action.Designer',
|
|
48
|
+
'x-component-props': {
|
|
49
|
+
type: 'primary',
|
|
50
|
+
htmlType: 'submit',
|
|
51
|
+
useProps: '{{ usePickActionProps }}'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
63
|
+
schema: schema
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
@@ -48,4 +48,5 @@ export * from './TableCollectionFieldInitializer';
|
|
|
48
48
|
export * from './TableSelectorInitializer';
|
|
49
49
|
export * from './UpdateActionInitializer';
|
|
50
50
|
export * from './UpdateSubmitActionInitializer';
|
|
51
|
-
export * from './ViewActionInitializer';
|
|
51
|
+
export * from './ViewActionInitializer';
|
|
52
|
+
export * from './SelectActionInitializer';
|