@nocobase/client 0.9.2-alpha.4 → 0.9.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/block-provider/DetailsBlockProvider.js +13 -1
- package/es/block-provider/FormBlockProvider.js +30 -13
- package/es/block-provider/hooks/index.d.ts +10 -0
- package/es/block-provider/hooks/index.js +498 -281
- package/es/collection-manager/Configuration/CollectionFields.js +1 -2
- package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
- package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
- package/es/collection-manager/action-hooks.d.ts +1 -1
- 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 +3 -39
- package/es/collection-manager/interfaces/m2m.js +4 -38
- package/es/collection-manager/interfaces/m2o.js +4 -38
- package/es/collection-manager/interfaces/o2m.js +4 -68
- package/es/collection-manager/interfaces/o2o.js +25 -119
- package/es/collection-manager/interfaces/updatedBy.js +1 -1
- package/es/collection-manager/templates/tree.js +2 -2
- package/es/filter-provider/FilterProvider.js +3 -1
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +5 -2
- package/es/locale/ja_JP.d.ts +3 -0
- package/es/locale/ja_JP.js +3 -0
- package/es/locale/zh_CN.d.ts +4 -0
- package/es/locale/zh_CN.js +4 -0
- 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/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 +183 -52
- package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
- package/es/schema-component/antd/form-v2/utils.js +3 -1
- 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 +32 -12
- 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 +5 -5
- package/es/schema-component/antd/variable/TextArea.js +2 -5
- 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 +20 -8
- 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 +2 -2
- package/lib/block-provider/DetailsBlockProvider.js +13 -1
- package/lib/block-provider/FormBlockProvider.js +31 -15
- package/lib/block-provider/hooks/index.d.ts +10 -0
- package/lib/block-provider/hooks/index.js +509 -289
- package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
- package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
- package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
- package/lib/collection-manager/action-hooks.d.ts +1 -1
- 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 +2 -38
- package/lib/collection-manager/interfaces/m2m.js +3 -37
- package/lib/collection-manager/interfaces/m2o.js +3 -37
- package/lib/collection-manager/interfaces/o2m.js +6 -70
- package/lib/collection-manager/interfaces/o2o.js +30 -124
- package/lib/collection-manager/interfaces/updatedBy.js +1 -1
- package/lib/collection-manager/templates/tree.js +2 -2
- package/lib/filter-provider/FilterProvider.js +3 -1
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.js +5 -2
- package/lib/locale/ja_JP.d.ts +3 -0
- package/lib/locale/ja_JP.js +3 -0
- package/lib/locale/zh_CN.d.ts +4 -0
- package/lib/locale/zh_CN.js +4 -0
- 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/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 +180 -48
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
- package/lib/schema-component/antd/form-v2/utils.js +3 -1
- 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 +34 -13
- 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 +5 -5
- package/lib/schema-component/antd/variable/TextArea.js +2 -5
- 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 +20 -8
- 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 +3 -3
- package/package.json +5 -6
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { RecursionField, observer, useField, useFieldSchema } from '@formily/react';
|
|
8
|
+
import { toArr } from '@formily/shared';
|
|
9
|
+
import React, { Fragment, useRef, useState } from 'react';
|
|
10
|
+
import { BlockAssociationContext, WithoutTableFieldResource } from '../../../block-provider';
|
|
11
|
+
import { CollectionProvider, useCollection, useCollectionManager } from '../../../collection-manager';
|
|
12
|
+
import { RecordProvider, useRecord } from '../../../record-provider';
|
|
13
|
+
import { FormProvider } from '../../core';
|
|
14
|
+
import { useCompile } from '../../hooks';
|
|
15
|
+
import { ActionContext, useActionContext } from '../action';
|
|
16
|
+
import { EllipsisWithTooltip } from '../input/EllipsisWithTooltip';
|
|
17
|
+
import { useFieldNames, useInsertSchema } from './hooks';
|
|
18
|
+
import schema from './schema';
|
|
19
|
+
import { getLabelFormatValue, useLabelUiSchema } from './util';
|
|
20
|
+
var toValue = function toValue(value, placeholder) {
|
|
21
|
+
if (value === null || value === undefined) {
|
|
22
|
+
return placeholder;
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
export var ReadPrettyInternalViewer = observer(function (props) {
|
|
27
|
+
var _collectionField$targ;
|
|
28
|
+
var fieldSchema = useFieldSchema();
|
|
29
|
+
var recordCtx = useRecord();
|
|
30
|
+
var enableLink = fieldSchema['x-component-props'].enableLink;
|
|
31
|
+
var _useCollectionManager = useCollectionManager(),
|
|
32
|
+
getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
|
|
33
|
+
// value 做了转换,但 props.value 和原来 useField().value 的值不一致
|
|
34
|
+
var field = useField();
|
|
35
|
+
var fieldNames = useFieldNames(props);
|
|
36
|
+
var _useState = useState(false),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
visible = _useState2[0],
|
|
39
|
+
setVisible = _useState2[1];
|
|
40
|
+
var insertViewer = useInsertSchema('Viewer');
|
|
41
|
+
var _useCollection = useCollection(),
|
|
42
|
+
getField = _useCollection.getField;
|
|
43
|
+
var collectionField = getField(fieldSchema.name) || getCollectionJoinField(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-collection-field']);
|
|
44
|
+
var _useState3 = useState({}),
|
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
+
record = _useState4[0],
|
|
47
|
+
setRecord = _useState4[1];
|
|
48
|
+
var compile = useCompile();
|
|
49
|
+
var labelUiSchema = useLabelUiSchema(collectionField, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label');
|
|
50
|
+
var _useActionContext = useActionContext(),
|
|
51
|
+
snapshot = _useActionContext.snapshot;
|
|
52
|
+
var ellipsisWithTooltipRef = useRef();
|
|
53
|
+
var renderRecords = function renderRecords() {
|
|
54
|
+
return toArr(props.value).map(function (record, index, arr) {
|
|
55
|
+
var val = toValue(compile(record === null || record === void 0 ? void 0 : record[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label']), 'N/A');
|
|
56
|
+
var text = getLabelFormatValue(compile(labelUiSchema), val, true);
|
|
57
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
58
|
+
key: "".concat(record.id, "_").concat(index)
|
|
59
|
+
}, /*#__PURE__*/React.createElement("span", null, snapshot ? text : enableLink !== false ? /*#__PURE__*/React.createElement("a", {
|
|
60
|
+
onClick: function onClick(e) {
|
|
61
|
+
var _ellipsisWithTooltipR;
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
insertViewer(schema.Viewer);
|
|
65
|
+
setVisible(true);
|
|
66
|
+
setRecord(record);
|
|
67
|
+
ellipsisWithTooltipRef === null || ellipsisWithTooltipRef === void 0 ? void 0 : (_ellipsisWithTooltipR = ellipsisWithTooltipRef.current) === null || _ellipsisWithTooltipR === void 0 ? void 0 : _ellipsisWithTooltipR.setPopoverVisible(false);
|
|
68
|
+
}
|
|
69
|
+
}, text) : text), index < arr.length - 1 ? /*#__PURE__*/React.createElement("span", {
|
|
70
|
+
style: {
|
|
71
|
+
marginRight: 4,
|
|
72
|
+
color: '#aaa'
|
|
73
|
+
}
|
|
74
|
+
}, ",") : null);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
var renderWithoutTableFieldResourceProvider = function renderWithoutTableFieldResourceProvider() {
|
|
78
|
+
return /*#__PURE__*/React.createElement(WithoutTableFieldResource.Provider, {
|
|
79
|
+
value: true
|
|
80
|
+
}, /*#__PURE__*/React.createElement(FormProvider, null, /*#__PURE__*/React.createElement(RecursionField, {
|
|
81
|
+
schema: fieldSchema,
|
|
82
|
+
onlyRenderProperties: true,
|
|
83
|
+
basePath: field.address,
|
|
84
|
+
filterProperties: function filterProperties(s) {
|
|
85
|
+
return s['x-component'] === 'AssociationField.Viewer';
|
|
86
|
+
}
|
|
87
|
+
})));
|
|
88
|
+
};
|
|
89
|
+
var renderRecordProvider = function renderRecordProvider() {
|
|
90
|
+
var _fieldSchema$xCollec;
|
|
91
|
+
var collectionFieldNames = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCollec = fieldSchema['x-collection-field']) === null || _fieldSchema$xCollec === void 0 ? void 0 : _fieldSchema$xCollec.split('.');
|
|
92
|
+
return collectionFieldNames && collectionFieldNames.length > 2 ? /*#__PURE__*/React.createElement(RecordProvider, {
|
|
93
|
+
record: recordCtx[collectionFieldNames[1]]
|
|
94
|
+
}, /*#__PURE__*/React.createElement(RecordProvider, {
|
|
95
|
+
record: record
|
|
96
|
+
}, renderWithoutTableFieldResourceProvider())) : /*#__PURE__*/React.createElement(RecordProvider, {
|
|
97
|
+
record: record
|
|
98
|
+
}, renderWithoutTableFieldResourceProvider());
|
|
99
|
+
};
|
|
100
|
+
return collectionField ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BlockAssociationContext.Provider, {
|
|
101
|
+
value: "".concat(collectionField.collectionName, ".").concat(collectionField.name)
|
|
102
|
+
}, /*#__PURE__*/React.createElement(CollectionProvider, {
|
|
103
|
+
name: (_collectionField$targ = collectionField.target) !== null && _collectionField$targ !== void 0 ? _collectionField$targ : collectionField.targetCollection
|
|
104
|
+
}, /*#__PURE__*/React.createElement(EllipsisWithTooltip, {
|
|
105
|
+
ellipsis: true,
|
|
106
|
+
ref: ellipsisWithTooltipRef
|
|
107
|
+
}, renderRecords()), /*#__PURE__*/React.createElement(ActionContext.Provider, {
|
|
108
|
+
value: {
|
|
109
|
+
visible: visible,
|
|
110
|
+
setVisible: setVisible,
|
|
111
|
+
openMode: 'drawer',
|
|
112
|
+
snapshot: collectionField.interface === 'snapshot'
|
|
113
|
+
}
|
|
114
|
+
}, renderRecordProvider())))) : null;
|
|
115
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Nester: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { RecursionField, observer, useFieldSchema } from '@formily/react';
|
|
8
|
+
import { Button, Card, Divider } from 'antd';
|
|
9
|
+
import { CloseCircleOutlined } from '@ant-design/icons';
|
|
10
|
+
import React, { useContext } from 'react';
|
|
11
|
+
import { AssociationFieldContext } from './context';
|
|
12
|
+
import { useAssociationFieldContext } from './hooks';
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
// import { useRemoveActionProps } from '../../../block-provider/hooks';
|
|
15
|
+
export var Nester = function Nester(props) {
|
|
16
|
+
var _useContext = useContext(AssociationFieldContext),
|
|
17
|
+
options = _useContext.options;
|
|
18
|
+
if (['hasOne', 'belongsTo'].includes(options.type)) {
|
|
19
|
+
return /*#__PURE__*/React.createElement(ToOneNester, _objectSpread({}, props));
|
|
20
|
+
}
|
|
21
|
+
if (['hasMany', 'belongsToMany'].includes(options.type)) {
|
|
22
|
+
return /*#__PURE__*/React.createElement(ToManyNester, _objectSpread({}, props));
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
var ToOneNester = function ToOneNester(props) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
28
|
+
bordered: true
|
|
29
|
+
}, props.children);
|
|
30
|
+
};
|
|
31
|
+
var toArr = function toArr(value) {
|
|
32
|
+
if (!value) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
return [value];
|
|
39
|
+
};
|
|
40
|
+
var ToManyNester = observer(function (props) {
|
|
41
|
+
var fieldSchema = useFieldSchema();
|
|
42
|
+
var _useAssociationFieldC = useAssociationFieldContext(),
|
|
43
|
+
field = _useAssociationFieldC.field;
|
|
44
|
+
var values = toArr(field.value);
|
|
45
|
+
var _useTranslation = useTranslation(),
|
|
46
|
+
t = _useTranslation.t;
|
|
47
|
+
// const { onClick } = useRemoveActionProps(`${collectionField.collectionName}.${collectionField.target}`);
|
|
48
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
49
|
+
bordered: true,
|
|
50
|
+
style: {
|
|
51
|
+
position: 'relative'
|
|
52
|
+
}
|
|
53
|
+
}, values.map(function (value, index) {
|
|
54
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !field.readPretty && /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
style: {
|
|
56
|
+
textAlign: 'right'
|
|
57
|
+
}
|
|
58
|
+
}, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
|
|
59
|
+
style: {
|
|
60
|
+
zIndex: 1000,
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
color: '#a8a3a3'
|
|
63
|
+
},
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
field.value.splice(index, 1);
|
|
66
|
+
}
|
|
67
|
+
})), /*#__PURE__*/React.createElement(RecursionField, {
|
|
68
|
+
onlyRenderProperties: true,
|
|
69
|
+
basePath: field.address.concat(index),
|
|
70
|
+
schema: fieldSchema
|
|
71
|
+
}), /*#__PURE__*/React.createElement(Divider, null));
|
|
72
|
+
}), field.editable && /*#__PURE__*/React.createElement(Button, {
|
|
73
|
+
type: 'dashed',
|
|
74
|
+
block: true,
|
|
75
|
+
onClick: function onClick() {
|
|
76
|
+
field.value = field.value || [];
|
|
77
|
+
field.value.push({});
|
|
78
|
+
}
|
|
79
|
+
}, t('Add new')));
|
|
80
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useEffect, useState } from 'react';
|
|
14
|
+
import { useField, observer } from '@formily/react';
|
|
15
|
+
import { AssociationFieldProvider } from './AssociationFieldProvider';
|
|
16
|
+
import { InternalNester } from './InternalNester';
|
|
17
|
+
import { ReadPrettyInternalViewer } from './InternalViewer';
|
|
18
|
+
import { useCollection, useCollectionManager } from '../../../collection-manager';
|
|
19
|
+
import { InternalSubTable } from './InternalSubTable';
|
|
20
|
+
import { FileManageReadPretty } from './FileManager';
|
|
21
|
+
export var ReadPretty = observer(function (props) {
|
|
22
|
+
var _getCollection;
|
|
23
|
+
var field = useField();
|
|
24
|
+
var _useCollection = useCollection(),
|
|
25
|
+
getField = _useCollection.getField;
|
|
26
|
+
var _useCollectionManager = useCollectionManager(),
|
|
27
|
+
getCollection = _useCollectionManager.getCollection;
|
|
28
|
+
var collectionField = getField(field.props.name);
|
|
29
|
+
var isFileCollection = ((_getCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target)) === null || _getCollection === void 0 ? void 0 : _getCollection.template) === 'file';
|
|
30
|
+
var _useState = useState(props.mode || (isFileCollection ? 'FileManager' : 'Select')),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
currentMode = _useState2[0],
|
|
33
|
+
setCurrentMode = _useState2[1];
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
props.mode && setCurrentMode(props.mode);
|
|
36
|
+
}, [props.mode]);
|
|
37
|
+
return /*#__PURE__*/React.createElement(AssociationFieldProvider, null, ['Select', 'Picker'].includes(currentMode) && /*#__PURE__*/React.createElement(ReadPrettyInternalViewer, _objectSpread({}, props)), currentMode === 'Nester' && /*#__PURE__*/React.createElement(InternalNester, _objectSpread({}, props)), currentMode === 'SubTable' && /*#__PURE__*/React.createElement(InternalSubTable, _objectSpread({}, props)), currentMode === 'FileManager' && /*#__PURE__*/React.createElement(FileManageReadPretty, _objectSpread({}, props)));
|
|
38
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SubTable: any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { observer } from '@formily/react';
|
|
2
|
+
import { Button } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Table } from '../table-v2/Table';
|
|
5
|
+
import { useAssociationFieldContext } from './hooks';
|
|
6
|
+
export var SubTable = observer(function (props) {
|
|
7
|
+
var _useAssociationFieldC = useAssociationFieldContext(),
|
|
8
|
+
field = _useAssociationFieldC.field;
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, {
|
|
10
|
+
size: 'small',
|
|
11
|
+
showIndex: true,
|
|
12
|
+
field: field,
|
|
13
|
+
pagination: false
|
|
14
|
+
}), field.editable && /*#__PURE__*/React.createElement(Button, {
|
|
15
|
+
type: 'dashed',
|
|
16
|
+
block: true,
|
|
17
|
+
style: {
|
|
18
|
+
marginTop: 12
|
|
19
|
+
},
|
|
20
|
+
onClick: function onClick() {
|
|
21
|
+
field.value = field.value || [];
|
|
22
|
+
field.value.push({});
|
|
23
|
+
}
|
|
24
|
+
}, "Add new"));
|
|
25
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GeneralField } from '@formily/core';
|
|
3
|
+
export interface AssociationFieldContextProps {
|
|
4
|
+
options: any;
|
|
5
|
+
field: GeneralField;
|
|
6
|
+
}
|
|
7
|
+
export declare const AssociationFieldContext: import("react").Context<AssociationFieldContextProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GeneralField } from '@formily/core';
|
|
2
|
+
export declare const useInsertSchema: (component: any) => (ss: any) => void;
|
|
3
|
+
export declare function useAssociationFieldContext<F extends GeneralField>(): {
|
|
4
|
+
options: any;
|
|
5
|
+
field: F;
|
|
6
|
+
};
|
|
7
|
+
export default function useServiceOptions(props: any): any;
|
|
8
|
+
export declare const useFieldNames: (props: any) => any;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
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); }
|
|
6
|
+
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); }
|
|
7
|
+
import { useFieldSchema } from '@formily/react';
|
|
8
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
9
|
+
import { useCallback, useContext, useMemo } from 'react';
|
|
10
|
+
import { useDesignable } from '../../hooks';
|
|
11
|
+
import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
|
|
12
|
+
import { AssociationFieldContext } from './context';
|
|
13
|
+
import { useRecord } from '../../../record-provider';
|
|
14
|
+
import { isInFilterFormBlock } from '../../../filter-provider';
|
|
15
|
+
import { useCollection, useCollectionManager } from '../../../collection-manager';
|
|
16
|
+
export var useInsertSchema = function useInsertSchema(component) {
|
|
17
|
+
var fieldSchema = useFieldSchema();
|
|
18
|
+
var _useDesignable = useDesignable(),
|
|
19
|
+
insertAfterBegin = _useDesignable.insertAfterBegin;
|
|
20
|
+
var insert = useCallback(function (ss) {
|
|
21
|
+
var schema = fieldSchema.reduceProperties(function (buf, s) {
|
|
22
|
+
if (s['x-component'] === 'AssociationField.' + component) {
|
|
23
|
+
return s;
|
|
24
|
+
}
|
|
25
|
+
return buf;
|
|
26
|
+
}, null);
|
|
27
|
+
if (!schema) {
|
|
28
|
+
insertAfterBegin(cloneDeep(ss));
|
|
29
|
+
}
|
|
30
|
+
}, [component]);
|
|
31
|
+
return insert;
|
|
32
|
+
};
|
|
33
|
+
export function useAssociationFieldContext() {
|
|
34
|
+
return useContext(AssociationFieldContext);
|
|
35
|
+
}
|
|
36
|
+
export default function useServiceOptions(props) {
|
|
37
|
+
var _props$action = props.action,
|
|
38
|
+
action = _props$action === void 0 ? 'list' : _props$action,
|
|
39
|
+
service = props.service,
|
|
40
|
+
fieldNames = props.fieldNames;
|
|
41
|
+
var params = (service === null || service === void 0 ? void 0 : service.params) || {};
|
|
42
|
+
var fieldSchema = useFieldSchema();
|
|
43
|
+
var _useCollection = useCollection(),
|
|
44
|
+
getField = _useCollection.getField,
|
|
45
|
+
fields = _useCollection.fields;
|
|
46
|
+
var _useCollectionManager = useCollectionManager(),
|
|
47
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
48
|
+
var record = useRecord();
|
|
49
|
+
var normalizeValues = useCallback(function (obj) {
|
|
50
|
+
if (obj && _typeof(obj) === 'object') {
|
|
51
|
+
return obj[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value];
|
|
52
|
+
}
|
|
53
|
+
return obj;
|
|
54
|
+
}, [fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value]);
|
|
55
|
+
var value = useMemo(function () {
|
|
56
|
+
if (props.value === undefined || props.value === null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(props.value)) {
|
|
60
|
+
return props.value.map(normalizeValues);
|
|
61
|
+
} else {
|
|
62
|
+
return [normalizeValues(props.value)];
|
|
63
|
+
}
|
|
64
|
+
}, [props.value, normalizeValues]);
|
|
65
|
+
var collectionField = useMemo(function () {
|
|
66
|
+
return getField(fieldSchema.name);
|
|
67
|
+
}, [fieldSchema.name]);
|
|
68
|
+
var sourceValue = record === null || record === void 0 ? void 0 : record[collectionField === null || collectionField === void 0 ? void 0 : collectionField.sourceKey];
|
|
69
|
+
var filter = useMemo(function () {
|
|
70
|
+
var isOToAny = ['oho', 'o2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
|
|
71
|
+
return mergeFilter([mergeFilter([isOToAny && !isInFilterFormBlock(fieldSchema) ? _defineProperty({}, collectionField.foreignKey, {
|
|
72
|
+
$is: null
|
|
73
|
+
}) : null, params === null || params === void 0 ? void 0 : params.filter]), isOToAny && sourceValue !== undefined && sourceValue !== null && !isInFilterFormBlock(fieldSchema) ? _defineProperty({}, collectionField.foreignKey, {
|
|
74
|
+
$eq: sourceValue
|
|
75
|
+
}) : null, (params === null || params === void 0 ? void 0 : params.filter) && value ? _defineProperty({}, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value, _defineProperty({}, '$in', value)) : null], '$or');
|
|
76
|
+
}, [params === null || params === void 0 ? void 0 : params.filter, getCollectionFields, collectionField, sourceValue, value, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value]);
|
|
77
|
+
return useMemo(function () {
|
|
78
|
+
return _objectSpread(_objectSpread({
|
|
79
|
+
resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
|
|
80
|
+
action: action
|
|
81
|
+
}, service), {}, {
|
|
82
|
+
params: _objectSpread(_objectSpread({}, service === null || service === void 0 ? void 0 : service.params), {}, {
|
|
83
|
+
filter: filter
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
}, [collectionField === null || collectionField === void 0 ? void 0 : collectionField.target, action, filter, service]);
|
|
87
|
+
}
|
|
88
|
+
export var useFieldNames = function useFieldNames(props) {
|
|
89
|
+
var _fieldSchema$xCompon, _fieldSchema$xCompon$, _fieldSchema$xCompon$2, _fieldSchema$xCompon$3, _fieldSchema$xCompon2;
|
|
90
|
+
var fieldSchema = useFieldSchema();
|
|
91
|
+
var fieldNames = ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : (_fieldSchema$xCompon$ = _fieldSchema$xCompon['field']) === null || _fieldSchema$xCompon$ === void 0 ? void 0 : (_fieldSchema$xCompon$2 = _fieldSchema$xCompon$['uiSchema']) === null || _fieldSchema$xCompon$2 === void 0 ? void 0 : (_fieldSchema$xCompon$3 = _fieldSchema$xCompon$2['x-component-props']) === null || _fieldSchema$xCompon$3 === void 0 ? void 0 : _fieldSchema$xCompon$3['fieldNames']) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2['fieldNames']) || props.fieldNames;
|
|
92
|
+
return _objectSpread({
|
|
93
|
+
label: 'label',
|
|
94
|
+
value: 'value'
|
|
95
|
+
}, fieldNames);
|
|
96
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AssociationField: any;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { connect, mapReadPretty } from '@formily/react';
|
|
2
|
+
import { Action } from '../action';
|
|
3
|
+
import { Editable } from './Editable';
|
|
4
|
+
import { InternalPicker } from './InternalPicker';
|
|
5
|
+
import { Nester } from './Nester';
|
|
6
|
+
import { ReadPretty } from './ReadPretty';
|
|
7
|
+
import { SubTable } from './SubTable';
|
|
8
|
+
export var AssociationField = connect(Editable, mapReadPretty(ReadPretty));
|
|
9
|
+
AssociationField.SubTable = SubTable;
|
|
10
|
+
AssociationField.Nester = Nester;
|
|
11
|
+
AssociationField.AddNewer = Action.Container;
|
|
12
|
+
AssociationField.Selector = Action.Container;
|
|
13
|
+
AssociationField.Viewer = Action.Container;
|
|
14
|
+
AssociationField.InternalSelect = InternalPicker;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Nester: {
|
|
3
|
+
type: string;
|
|
4
|
+
'x-component': string;
|
|
5
|
+
properties: {
|
|
6
|
+
grid: {
|
|
7
|
+
type: string;
|
|
8
|
+
'x-component': string;
|
|
9
|
+
'x-initializer': string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
AddNewer: {
|
|
14
|
+
type: string;
|
|
15
|
+
'x-component': string;
|
|
16
|
+
'x-action': string;
|
|
17
|
+
title: string;
|
|
18
|
+
'x-component-props': {
|
|
19
|
+
className: string;
|
|
20
|
+
};
|
|
21
|
+
properties: {
|
|
22
|
+
tabs: {
|
|
23
|
+
type: string;
|
|
24
|
+
'x-component': string;
|
|
25
|
+
'x-component-props': {};
|
|
26
|
+
'x-initializer': string;
|
|
27
|
+
properties: {
|
|
28
|
+
tab1: {
|
|
29
|
+
type: string;
|
|
30
|
+
title: string;
|
|
31
|
+
'x-component': string;
|
|
32
|
+
'x-designer': string;
|
|
33
|
+
'x-component-props': {};
|
|
34
|
+
properties: {
|
|
35
|
+
grid: {
|
|
36
|
+
type: string;
|
|
37
|
+
'x-component': string;
|
|
38
|
+
'x-initializer': string;
|
|
39
|
+
properties: {};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
Selector: {
|
|
48
|
+
type: string;
|
|
49
|
+
'x-component': string;
|
|
50
|
+
title: string;
|
|
51
|
+
'x-component-props': {
|
|
52
|
+
className: string;
|
|
53
|
+
};
|
|
54
|
+
properties: {
|
|
55
|
+
grid: {
|
|
56
|
+
type: string;
|
|
57
|
+
'x-component': string;
|
|
58
|
+
'x-initializer': string;
|
|
59
|
+
properties: {};
|
|
60
|
+
};
|
|
61
|
+
footer: {
|
|
62
|
+
'x-component': string;
|
|
63
|
+
'x-component-props': {};
|
|
64
|
+
properties: {
|
|
65
|
+
actions: {
|
|
66
|
+
type: string;
|
|
67
|
+
'x-component': string;
|
|
68
|
+
'x-component-props': {};
|
|
69
|
+
properties: {
|
|
70
|
+
submit: {
|
|
71
|
+
title: string;
|
|
72
|
+
'x-action': string;
|
|
73
|
+
'x-component': string;
|
|
74
|
+
'x-designer': string;
|
|
75
|
+
'x-component-props': {
|
|
76
|
+
type: string;
|
|
77
|
+
htmlType: string;
|
|
78
|
+
useProps: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
Viewer: {
|
|
88
|
+
type: string;
|
|
89
|
+
title: string;
|
|
90
|
+
'x-component': string;
|
|
91
|
+
'x-component-props': {
|
|
92
|
+
className: string;
|
|
93
|
+
};
|
|
94
|
+
properties: {
|
|
95
|
+
tabs: {
|
|
96
|
+
type: string;
|
|
97
|
+
'x-component': string;
|
|
98
|
+
'x-component-props': {};
|
|
99
|
+
'x-initializer': string;
|
|
100
|
+
properties: {
|
|
101
|
+
tab1: {
|
|
102
|
+
type: string;
|
|
103
|
+
title: string;
|
|
104
|
+
'x-component': string;
|
|
105
|
+
'x-designer': string;
|
|
106
|
+
'x-component-props': {};
|
|
107
|
+
properties: {
|
|
108
|
+
grid: {
|
|
109
|
+
type: string;
|
|
110
|
+
'x-component': string;
|
|
111
|
+
'x-initializer': string;
|
|
112
|
+
properties: {};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
SubTable: {
|
|
121
|
+
type: string;
|
|
122
|
+
'x-component': string;
|
|
123
|
+
'x-initializer': string;
|
|
124
|
+
properties: {
|
|
125
|
+
indexCol: {
|
|
126
|
+
type: string;
|
|
127
|
+
'x-component': string;
|
|
128
|
+
'x-component-props': {
|
|
129
|
+
width: number;
|
|
130
|
+
};
|
|
131
|
+
properties: {
|
|
132
|
+
__index__: {
|
|
133
|
+
type: string;
|
|
134
|
+
'x-component': string;
|
|
135
|
+
'x-read-pretty': boolean;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export default _default;
|