@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
|
@@ -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';
|
|
@@ -263,12 +263,15 @@ export var useFormItemInitializerFields = function useFormItemInitializerFields(
|
|
|
263
263
|
var _field$uiSchema3, _field$uiSchema4;
|
|
264
264
|
var interfaceConfig = getInterface(field.interface);
|
|
265
265
|
var targetCollection = getCollection(field.target);
|
|
266
|
-
|
|
266
|
+
// const component =
|
|
267
|
+
// field.interface === 'o2m' && targetCollection?.template !== 'file' && !snapshot
|
|
268
|
+
// ? 'TableField'
|
|
269
|
+
// : 'CollectionField';
|
|
267
270
|
var schema = {
|
|
268
271
|
type: 'string',
|
|
269
272
|
name: field.name,
|
|
270
273
|
'x-designer': 'FormItem.Designer',
|
|
271
|
-
'x-component':
|
|
274
|
+
'x-component': 'CollectionField',
|
|
272
275
|
'x-decorator': 'FormItem',
|
|
273
276
|
'x-collection-field': "".concat(name, ".").concat(field.name),
|
|
274
277
|
'x-component-props': {},
|
|
@@ -327,13 +330,16 @@ export var useFilterFormItemInitializerFields = function useFilterFormItemInitia
|
|
|
327
330
|
var _field$uiSchema6;
|
|
328
331
|
var interfaceConfig = getInterface(field.interface);
|
|
329
332
|
var targetCollection = getCollection(field.target);
|
|
330
|
-
|
|
333
|
+
// const component =
|
|
334
|
+
// field.interface === 'o2m' && targetCollection?.template !== 'file' && !snapshot
|
|
335
|
+
// ? 'TableField'
|
|
336
|
+
// : 'CollectionField';
|
|
331
337
|
var schema = {
|
|
332
338
|
type: 'string',
|
|
333
339
|
name: field.name,
|
|
334
340
|
required: false,
|
|
335
341
|
'x-designer': 'FormItem.FilterFormDesigner',
|
|
336
|
-
'x-component':
|
|
342
|
+
'x-component': 'CollectionField',
|
|
337
343
|
'x-decorator': 'FormItem',
|
|
338
344
|
'x-collection-field': "".concat(name, ".").concat(field.name),
|
|
339
345
|
'x-component-props': {}
|
|
@@ -518,13 +524,16 @@ export var useInheritsFormItemInitializerFields = function useInheritsFormItemIn
|
|
|
518
524
|
var _field$uiSchema10, _field$uiSchema11, _field$uiSchema12;
|
|
519
525
|
var interfaceConfig = getInterface(field.interface);
|
|
520
526
|
var targetCollection = getCollection(field.target);
|
|
521
|
-
|
|
527
|
+
// const component =
|
|
528
|
+
// field.interface === 'o2m' && targetCollection?.template !== 'file' && !snapshot
|
|
529
|
+
// ? 'TableField'
|
|
530
|
+
// : 'CollectionField';
|
|
522
531
|
var schema = {
|
|
523
532
|
type: 'string',
|
|
524
533
|
name: field.name,
|
|
525
534
|
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema10 = field.uiSchema) === null || _field$uiSchema10 === void 0 ? void 0 : _field$uiSchema10.title) || field.name,
|
|
526
535
|
'x-designer': 'FormItem.Designer',
|
|
527
|
-
'x-component':
|
|
536
|
+
'x-component': 'CollectionField',
|
|
528
537
|
'x-decorator': 'FormItem',
|
|
529
538
|
'x-collection-field': "".concat(name, ".").concat(field.name),
|
|
530
539
|
'x-component-props': {},
|
|
@@ -578,14 +587,17 @@ export var useFilterInheritsFormItemInitializerFields = function useFilterInheri
|
|
|
578
587
|
var _field$uiSchema13, _field$uiSchema14, _field$uiSchema15;
|
|
579
588
|
var interfaceConfig = getInterface(field.interface);
|
|
580
589
|
var targetCollection = getCollection(field.target);
|
|
581
|
-
|
|
590
|
+
// const component =
|
|
591
|
+
// field.interface === 'o2m' && targetCollection?.template !== 'file' && !snapshot
|
|
592
|
+
// ? 'TableField'
|
|
593
|
+
// : 'CollectionField';
|
|
582
594
|
var schema = {
|
|
583
595
|
type: 'string',
|
|
584
596
|
name: field.name,
|
|
585
597
|
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema13 = field.uiSchema) === null || _field$uiSchema13 === void 0 ? void 0 : _field$uiSchema13.title) || field.name,
|
|
586
598
|
required: false,
|
|
587
599
|
'x-designer': 'FormItem.FilterFormDesigner',
|
|
588
|
-
'x-component':
|
|
600
|
+
'x-component': 'CollectionField',
|
|
589
601
|
'x-decorator': 'FormItem',
|
|
590
602
|
'x-collection-field': "".concat(name, ".").concat(field.name),
|
|
591
603
|
'x-component-props': {},
|
|
@@ -6,7 +6,7 @@ export function FilterDynamicComponent(props) {
|
|
|
6
6
|
onChange = props.onChange,
|
|
7
7
|
renderSchemaComponent = props.renderSchemaComponent,
|
|
8
8
|
collectionName = props.collectionName;
|
|
9
|
-
var scope = useVariableOptions(collectionName);
|
|
9
|
+
var scope = useVariableOptions(collectionName, ['o2m', 'm2m']);
|
|
10
10
|
return /*#__PURE__*/React.createElement(Variable.Input, {
|
|
11
11
|
value: value,
|
|
12
12
|
onChange: onChange,
|
|
@@ -6,8 +6,9 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
6
6
|
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; }
|
|
7
7
|
import { useCompile } from '../../schema-component';
|
|
8
8
|
import { useCollectionManager } from '../../collection-manager';
|
|
9
|
-
var supportsType = ['checkbox', 'number', 'percent', 'integer', 'input', 'textarea', 'email', 'phone', 'datetime', 'createdAt', 'updatedAt', 'radioGroup', 'checkboxGroup', 'select', 'multipleSelect', 'formula', 'oho', 'obo', 'm2o', 'o2m', 'm2m'];
|
|
9
|
+
var supportsType = ['id', 'checkbox', 'number', 'percent', 'integer', 'input', 'textarea', 'email', 'phone', 'datetime', 'createdAt', 'updatedAt', 'radioGroup', 'checkboxGroup', 'select', 'multipleSelect', 'formula', 'oho', 'obo', 'm2o', 'o2m', 'm2m'];
|
|
10
10
|
var useVariableTypes = function useVariableTypes(currentCollection) {
|
|
11
|
+
var excludes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
11
12
|
var _useCollectionManager = useCollectionManager(),
|
|
12
13
|
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
13
14
|
getInterface = _useCollectionManager.getInterface,
|
|
@@ -20,7 +21,9 @@ var useVariableTypes = function useVariableTypes(currentCollection) {
|
|
|
20
21
|
options: function options() {
|
|
21
22
|
var field2option = function field2option(field, depth) {
|
|
22
23
|
var _field$uiSchema;
|
|
23
|
-
if (!field.interface || !supportsType.
|
|
24
|
+
if (!field.interface || !supportsType.filter(function (v) {
|
|
25
|
+
return !excludes.includes(v);
|
|
26
|
+
}).includes(field.interface)) {
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
29
|
var fieldInterface = getInterface(field.interface);
|
|
@@ -76,9 +79,9 @@ var useVariableTypes = function useVariableTypes(currentCollection) {
|
|
|
76
79
|
}]
|
|
77
80
|
}];
|
|
78
81
|
};
|
|
79
|
-
export function useVariableOptions(collectionName) {
|
|
82
|
+
export function useVariableOptions(collectionName, excludes) {
|
|
80
83
|
var compile = useCompile();
|
|
81
|
-
var options = useVariableTypes(collectionName).map(function (item) {
|
|
84
|
+
var options = useVariableTypes(collectionName, excludes).map(function (item) {
|
|
82
85
|
var options = typeof item.options === 'function' ? item.options() : item.options;
|
|
83
86
|
return {
|
|
84
87
|
label: compile(item.title),
|
|
@@ -50,6 +50,7 @@ import { useBlockTemplateContext } from '../schema-templates/BlockTemplate';
|
|
|
50
50
|
import { FormDataTemplates } from './DataTemplates';
|
|
51
51
|
import { FormLinkageRules } from './LinkageRules';
|
|
52
52
|
import { useLinkageCollectionFieldOptions } from './LinkageRules/action-hooks';
|
|
53
|
+
import { EnableChildCollections } from './EnableChildCollections';
|
|
53
54
|
var SchemaSettingsContext = /*#__PURE__*/createContext(null);
|
|
54
55
|
export var useSchemaSettings = function useSchemaSettings() {
|
|
55
56
|
return useContext(SchemaSettingsContext);
|
|
@@ -1200,7 +1201,7 @@ SchemaSettings.DataTemplates = function DataTemplates(props) {
|
|
|
1200
1201
|
}
|
|
1201
1202
|
});
|
|
1202
1203
|
};
|
|
1203
|
-
SchemaSettings.EnableChildCollections = function
|
|
1204
|
+
SchemaSettings.EnableChildCollections = function EnableChildCollectionsItem(props) {
|
|
1204
1205
|
var collectionName = props.collectionName;
|
|
1205
1206
|
var fieldSchema = useFieldSchema();
|
|
1206
1207
|
var _useDesignable5 = useDesignable(),
|
|
@@ -1240,7 +1241,6 @@ SchemaSettings.EnableChildCollections = function EnableChildCollections(props) {
|
|
|
1240
1241
|
}
|
|
1241
1242
|
},
|
|
1242
1243
|
onSubmit: function onSubmit(v) {
|
|
1243
|
-
console.log(v);
|
|
1244
1244
|
var enableChildren = [];
|
|
1245
1245
|
var _iterator2 = _createForOfIteratorHelper(v.enableChildren.childrenCollections),
|
|
1246
1246
|
_step2;
|
|
@@ -10,6 +10,7 @@ var _antd = require("antd");
|
|
|
10
10
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _recordProvider = require("../record-provider");
|
|
12
12
|
var _BlockProvider = require("./BlockProvider");
|
|
13
|
+
var _hooks = require("./hooks");
|
|
13
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
16
|
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); }
|
|
@@ -50,7 +51,18 @@ var InternalDetailsBlockProvider = function InternalDetailsBlockProvider(props)
|
|
|
50
51
|
}, props.children));
|
|
51
52
|
};
|
|
52
53
|
var DetailsBlockProvider = function DetailsBlockProvider(props) {
|
|
53
|
-
|
|
54
|
+
var params = _objectSpread({}, props.params);
|
|
55
|
+
var collection = props.collection;
|
|
56
|
+
var _useAssociationNames = (0, _hooks.useAssociationNames)(collection),
|
|
57
|
+
appends = _useAssociationNames.appends;
|
|
58
|
+
if (!Object.keys(params).includes('appends')) {
|
|
59
|
+
params['appends'] = appends;
|
|
60
|
+
}
|
|
61
|
+
return /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
62
|
+
params: params
|
|
63
|
+
}), /*#__PURE__*/_react2.default.createElement(InternalDetailsBlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
64
|
+
params: params
|
|
65
|
+
})));
|
|
54
66
|
};
|
|
55
67
|
exports.DetailsBlockProvider = DetailsBlockProvider;
|
|
56
68
|
var useDetailsBlockContext = function useDetailsBlockContext() {
|
|
@@ -6,17 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useIsEmptyRecord = exports.useFormBlockProps = exports.useFormBlockContext = exports.findFormBlock = exports.FormBlockProvider = exports.FormBlockContext = void 0;
|
|
7
7
|
var _core = require("@formily/core");
|
|
8
8
|
var _react = require("@formily/react");
|
|
9
|
-
var
|
|
10
|
-
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
|
+
var _lodash = require("lodash");
|
|
11
10
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _collectionManager = require("../collection-manager");
|
|
13
12
|
var _recordProvider = require("../record-provider");
|
|
14
13
|
var _schemaComponent = require("../schema-component");
|
|
15
14
|
var _Templates = require("../schema-component/antd/form-v2/Templates");
|
|
16
15
|
var _BlockProvider = require("./BlockProvider");
|
|
16
|
+
var _hooks = require("./hooks");
|
|
17
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
19
|
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); }
|
|
21
20
|
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; }
|
|
22
21
|
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; }
|
|
@@ -28,7 +27,9 @@ exports.FormBlockContext = FormBlockContext;
|
|
|
28
27
|
var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
|
|
29
28
|
var _service$data;
|
|
30
29
|
var action = props.action,
|
|
31
|
-
readPretty = props.readPretty
|
|
30
|
+
readPretty = props.readPretty,
|
|
31
|
+
params = props.params,
|
|
32
|
+
updateAssociationValues = props.updateAssociationValues;
|
|
32
33
|
var field = (0, _react.useField)();
|
|
33
34
|
var form = (0, _react2.useMemo)(function () {
|
|
34
35
|
return (0, _core.createForm)({
|
|
@@ -40,21 +41,22 @@ var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
|
|
|
40
41
|
service = _useBlockRequestConte.service;
|
|
41
42
|
var formBlockRef = (0, _react2.useRef)();
|
|
42
43
|
var record = (0, _recordProvider.useRecord)();
|
|
43
|
-
if (service.loading) {
|
|
44
|
-
|
|
45
|
-
}
|
|
44
|
+
// if (service.loading) {
|
|
45
|
+
// return <Spin />;
|
|
46
|
+
// }
|
|
46
47
|
return /*#__PURE__*/_react2.default.createElement(FormBlockContext.Provider, {
|
|
47
48
|
value: {
|
|
49
|
+
params: params,
|
|
48
50
|
action: action,
|
|
49
51
|
form: form,
|
|
50
52
|
field: field,
|
|
51
53
|
service: service,
|
|
52
54
|
resource: resource,
|
|
53
|
-
updateAssociationValues:
|
|
55
|
+
updateAssociationValues: updateAssociationValues,
|
|
54
56
|
formBlockRef: formBlockRef
|
|
55
57
|
}
|
|
56
58
|
}, readPretty ? /*#__PURE__*/_react2.default.createElement(_recordProvider.RecordProvider, {
|
|
57
|
-
parent: (0,
|
|
59
|
+
parent: (0, _lodash.isEmpty)(record === null || record === void 0 ? void 0 : record.__parent) ? record : record === null || record === void 0 ? void 0 : record.__parent,
|
|
58
60
|
record: service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.data
|
|
59
61
|
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
60
62
|
ref: formBlockRef
|
|
@@ -79,10 +81,17 @@ var FormBlockProvider = function FormBlockProvider(props) {
|
|
|
79
81
|
var record = (0, _recordProvider.useRecord)();
|
|
80
82
|
var collection = props.collection;
|
|
81
83
|
var __collection = record.__collection;
|
|
84
|
+
var params = _objectSpread({}, props.params);
|
|
82
85
|
var currentCollection = (0, _collectionManager.useCollection)();
|
|
83
86
|
var _useDesignable = (0, _schemaComponent.useDesignable)(),
|
|
84
87
|
designable = _useDesignable.designable;
|
|
85
88
|
var isEmptyRecord = useIsEmptyRecord();
|
|
89
|
+
var _useAssociationNames = (0, _hooks.useAssociationNames)(collection),
|
|
90
|
+
appends = _useAssociationNames.appends,
|
|
91
|
+
updateAssociationValues = _useAssociationNames.updateAssociationValues;
|
|
92
|
+
if (!Object.keys(params).includes('appends')) {
|
|
93
|
+
params['appends'] = appends;
|
|
94
|
+
}
|
|
86
95
|
var detailFlag = false;
|
|
87
96
|
if (isEmptyRecord) {
|
|
88
97
|
detailFlag = true;
|
|
@@ -92,8 +101,12 @@ var FormBlockProvider = function FormBlockProvider(props) {
|
|
|
92
101
|
}
|
|
93
102
|
var createFlag = currentCollection.name === ((collection === null || collection === void 0 ? void 0 : collection.name) || collection) && !isEmptyRecord || !currentCollection.name;
|
|
94
103
|
return (detailFlag || createFlag) && /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
95
|
-
block: 'form'
|
|
96
|
-
|
|
104
|
+
block: 'form',
|
|
105
|
+
params: params
|
|
106
|
+
}), /*#__PURE__*/_react2.default.createElement(InternalFormBlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
107
|
+
params: params,
|
|
108
|
+
updateAssociationValues: updateAssociationValues
|
|
109
|
+
})));
|
|
97
110
|
};
|
|
98
111
|
exports.FormBlockProvider = FormBlockProvider;
|
|
99
112
|
var useFormBlockContext = function useFormBlockContext() {
|
|
@@ -101,7 +114,7 @@ var useFormBlockContext = function useFormBlockContext() {
|
|
|
101
114
|
};
|
|
102
115
|
exports.useFormBlockContext = useFormBlockContext;
|
|
103
116
|
var useFormBlockProps = function useFormBlockProps() {
|
|
104
|
-
var _fieldSchema$xCompon;
|
|
117
|
+
var _fieldSchema$xCompon, _ctx$service3;
|
|
105
118
|
var ctx = useFormBlockContext();
|
|
106
119
|
var record = (0, _recordProvider.useRecord)();
|
|
107
120
|
var _useActionContext = (0, _schemaComponent.useActionContext)(),
|
|
@@ -117,9 +130,12 @@ var useFormBlockProps = function useFormBlockProps() {
|
|
|
117
130
|
}
|
|
118
131
|
});
|
|
119
132
|
(0, _react2.useEffect)(function () {
|
|
120
|
-
var _ctx$
|
|
121
|
-
(
|
|
122
|
-
|
|
133
|
+
var _ctx$service;
|
|
134
|
+
if (!(ctx === null || ctx === void 0 ? void 0 : (_ctx$service = ctx.service) === null || _ctx$service === void 0 ? void 0 : _ctx$service.loading)) {
|
|
135
|
+
var _ctx$form2, _ctx$service2, _ctx$service2$data;
|
|
136
|
+
(_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setInitialValues((_ctx$service2 = ctx.service) === null || _ctx$service2 === void 0 ? void 0 : (_ctx$service2$data = _ctx$service2.data) === null || _ctx$service2$data === void 0 ? void 0 : _ctx$service2$data.data);
|
|
137
|
+
}
|
|
138
|
+
}, [ctx === null || ctx === void 0 ? void 0 : (_ctx$service3 = ctx.service) === null || _ctx$service3 === void 0 ? void 0 : _ctx$service3.loading]);
|
|
123
139
|
return {
|
|
124
140
|
form: ctx.form
|
|
125
141
|
};
|
|
@@ -5,6 +5,9 @@ export declare const usePickActionProps: () => {
|
|
|
5
5
|
export declare const useCreateActionProps: () => {
|
|
6
6
|
onClick(): Promise<void>;
|
|
7
7
|
};
|
|
8
|
+
export declare const useAssociationCreateActionProps: () => {
|
|
9
|
+
onClick(): Promise<void>;
|
|
10
|
+
};
|
|
8
11
|
export interface FilterTarget {
|
|
9
12
|
targets?: {
|
|
10
13
|
/** field uid */
|
|
@@ -40,6 +43,9 @@ export declare const useUpdateActionProps: () => {
|
|
|
40
43
|
export declare const useDestroyActionProps: () => {
|
|
41
44
|
onClick(): Promise<void>;
|
|
42
45
|
};
|
|
46
|
+
export declare const useRemoveActionProps: (associationName: any) => {
|
|
47
|
+
onClick(value: any): Promise<void>;
|
|
48
|
+
};
|
|
43
49
|
export declare const useDetailPrintActionProps: () => {
|
|
44
50
|
onClick(): Promise<void>;
|
|
45
51
|
};
|
|
@@ -80,3 +86,7 @@ export declare const useAssociationFilterBlockProps: () => {
|
|
|
80
86
|
valueKey: any;
|
|
81
87
|
labelKey: any;
|
|
82
88
|
};
|
|
89
|
+
export declare const useAssociationNames: (collection: any) => {
|
|
90
|
+
appends: any[];
|
|
91
|
+
updateAssociationValues: any[];
|
|
92
|
+
};
|