@nocobase/client 0.7.4-alpha.7 → 0.7.5-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/TableBlockProvider.js +3 -3
- package/es/collection-manager/Configuration/AddFieldAction.js +38 -41
- package/es/collection-manager/Configuration/EditFieldAction.js +64 -41
- package/es/collection-manager/interfaces/email.js +4 -2
- package/es/collection-manager/interfaces/formula.js +1 -1
- package/es/collection-manager/interfaces/index.d.ts +1 -0
- package/es/collection-manager/interfaces/index.js +1 -0
- package/es/collection-manager/interfaces/input.js +4 -2
- package/es/collection-manager/interfaces/integer.js +4 -2
- package/es/collection-manager/interfaces/m2m.js +2 -2
- package/es/collection-manager/interfaces/m2o.js +7 -3
- package/es/collection-manager/interfaces/number.js +3 -2
- package/es/collection-manager/interfaces/o2m.js +8 -4
- package/es/collection-manager/interfaces/o2o.js +19 -6
- package/es/collection-manager/interfaces/password.js +4 -2
- package/es/collection-manager/interfaces/percent.js +2 -1
- package/es/collection-manager/interfaces/phone.js +4 -2
- package/es/collection-manager/interfaces/properties/index.d.ts +7 -0
- package/es/collection-manager/interfaces/properties/index.js +91 -0
- package/es/collection-manager/interfaces/sequence.d.ts +2 -0
- package/es/collection-manager/interfaces/sequence.js +431 -0
- package/es/locale/en_US.d.ts +1 -0
- package/es/locale/en_US.js +2 -1
- package/es/locale/index.js +24 -0
- package/es/locale/ja_JP.d.ts +590 -0
- package/es/locale/ja_JP.js +591 -0
- package/es/locale/ru_RU.d.ts +560 -0
- package/es/locale/ru_RU.js +559 -0
- package/es/locale/zh_CN.d.ts +27 -0
- package/es/locale/zh_CN.js +30 -3
- package/es/route-switch/antd/admin-layout/index.js +19 -4
- package/es/schema-component/antd/action/Action.js +3 -1
- package/es/schema-component/antd/action/ActionBar.js +8 -1
- package/es/schema-component/antd/cron/Cron.d.ts +6 -0
- package/es/schema-component/antd/cron/Cron.js +49 -0
- package/es/schema-component/antd/cron/index.d.ts +1 -0
- package/es/schema-component/antd/cron/index.js +1 -0
- package/es/schema-component/antd/cron/locale/zh-CN.d.ts +34 -0
- package/es/schema-component/antd/cron/locale/zh-CN.js +37 -0
- package/es/schema-component/antd/filter/Filter.Action.Designer.js +1 -0
- package/es/schema-component/antd/formula-input/Compute.js +1 -1
- package/es/schema-component/antd/grid/Grid.js +134 -25
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.js +1 -0
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +4 -2
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -2
- package/es/schema-component/antd/record-picker/util.d.ts +5 -0
- package/es/schema-component/antd/record-picker/util.js +37 -0
- package/es/schema-component/antd/upload/shared.js +6 -2
- package/es/schema-component/common/dnd-context/index.js +30 -4
- package/es/schema-component/hooks/useDesignable.d.ts +2 -2
- package/es/schema-component/hooks/useDesignable.js +130 -26
- package/es/schema-initializer/SchemaInitializer.d.ts +1 -0
- package/es/schema-initializer/SchemaInitializer.js +6 -2
- package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +2 -1
- package/es/schema-initializer/buttons/TabPaneInitializers.js +9 -3
- package/es/schema-initializer/items/ActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/ActionInitializer.js +13 -0
- package/es/schema-initializer/items/BlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/BlockInitializer.js +18 -0
- package/es/schema-initializer/items/BulkDestroyActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/BulkDestroyActionInitializer.js +27 -0
- package/es/schema-initializer/items/CalendarBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CalendarBlockInitializer.js +124 -0
- package/es/schema-initializer/items/CollectionFieldInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CollectionFieldInitializer.js +15 -0
- package/es/schema-initializer/items/CreateActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CreateActionInitializer.js +60 -0
- package/es/schema-initializer/items/CreateFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CreateFormBlockInitializer.js +102 -0
- package/es/schema-initializer/items/CreateSubmitActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CreateSubmitActionInitializer.js +24 -0
- package/es/schema-initializer/items/CustomizeActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CustomizeActionInitializer.js +11 -0
- package/es/schema-initializer/items/DataBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/DataBlockInitializer.js +88 -0
- package/es/schema-initializer/items/DestroyActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/DestroyActionInitializer.js +27 -0
- package/es/schema-initializer/items/DetailsBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/DetailsBlockInitializer.js +55 -0
- package/es/schema-initializer/items/FilterActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/FilterActionInitializer.js +24 -0
- package/es/schema-initializer/items/FormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/FormBlockInitializer.js +30 -0
- package/es/schema-initializer/items/G2PlotInitializer.d.ts +1 -0
- package/es/schema-initializer/items/G2PlotInitializer.js +25 -0
- package/es/schema-initializer/items/InitializerWithSwitch.d.ts +1 -0
- package/es/schema-initializer/items/InitializerWithSwitch.js +32 -0
- package/es/schema-initializer/items/KanbanBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/KanbanBlockInitializer.js +138 -0
- package/es/schema-initializer/items/MarkdownBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/MarkdownBlockInitializer.js +32 -0
- package/es/schema-initializer/items/PrintActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/PrintActionInitializer.js +23 -0
- package/es/schema-initializer/items/RecordAssociationBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationBlockInitializer.js +90 -0
- package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +160 -0
- package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +90 -0
- package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.js +112 -0
- package/es/schema-initializer/items/RecordFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordFormBlockInitializer.js +109 -0
- package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +116 -0
- package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +114 -0
- package/es/schema-initializer/items/RefreshActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RefreshActionInitializer.js +23 -0
- package/es/schema-initializer/items/SubmitActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/SubmitActionInitializer.js +24 -0
- package/es/schema-initializer/items/TableActionColumnInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableActionColumnInitializer.js +34 -0
- package/es/schema-initializer/items/TableBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableBlockInitializer.js +55 -0
- package/es/schema-initializer/items/TableCollectionFieldInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableCollectionFieldInitializer.js +15 -0
- package/es/schema-initializer/items/TableSelectorInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableSelectorInitializer.js +67 -0
- package/es/schema-initializer/items/UpdateActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/UpdateActionInitializer.js +59 -0
- package/es/schema-initializer/items/UpdateSubmitActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/UpdateSubmitActionInitializer.js +24 -0
- package/es/schema-initializer/items/ViewActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/ViewActionInitializer.js +58 -0
- package/es/schema-initializer/items/index.d.ts +35 -35
- package/es/schema-initializer/items/index.js +35 -1589
- package/es/schema-initializer/style.less +4 -0
- package/es/schema-templates/SchemaTemplateManagerProvider.js +2 -5
- package/es/system-settings/SystemSettingsShortcut.js +7 -0
- package/es/user/SigninPage.d.ts +11 -2
- package/es/user/SigninPage.js +140 -33
- package/es/user/SignupPage.d.ts +7 -1
- package/es/user/SignupPage.js +54 -10
- package/es/user/VerificationCode.d.ts +7 -0
- package/es/user/VerificationCode.js +129 -0
- package/lib/block-provider/TableBlockProvider.js +3 -3
- package/lib/collection-manager/Configuration/AddFieldAction.js +38 -40
- package/lib/collection-manager/Configuration/EditFieldAction.js +65 -40
- package/lib/collection-manager/interfaces/email.js +3 -1
- package/lib/collection-manager/interfaces/formula.js +1 -1
- package/lib/collection-manager/interfaces/index.d.ts +1 -0
- package/lib/collection-manager/interfaces/index.js +13 -0
- package/lib/collection-manager/interfaces/input.js +3 -1
- package/lib/collection-manager/interfaces/integer.js +3 -1
- package/lib/collection-manager/interfaces/m2m.js +1 -1
- package/lib/collection-manager/interfaces/m2o.js +6 -2
- package/lib/collection-manager/interfaces/number.js +4 -3
- package/lib/collection-manager/interfaces/o2m.js +7 -3
- package/lib/collection-manager/interfaces/o2o.js +18 -5
- package/lib/collection-manager/interfaces/password.js +3 -1
- package/lib/collection-manager/interfaces/percent.js +1 -0
- package/lib/collection-manager/interfaces/phone.js +3 -1
- package/lib/collection-manager/interfaces/properties/index.d.ts +7 -0
- package/lib/collection-manager/interfaces/properties/index.js +94 -1
- package/lib/collection-manager/interfaces/sequence.d.ts +2 -0
- package/lib/collection-manager/interfaces/sequence.js +455 -0
- package/lib/locale/en_US.d.ts +1 -0
- package/lib/locale/en_US.js +2 -1
- package/lib/locale/index.js +28 -0
- package/lib/locale/ja_JP.d.ts +590 -0
- package/lib/locale/ja_JP.js +598 -0
- package/lib/locale/ru_RU.d.ts +560 -0
- package/lib/locale/ru_RU.js +566 -0
- package/lib/locale/zh_CN.d.ts +27 -0
- package/lib/locale/zh_CN.js +30 -3
- package/lib/route-switch/antd/admin-layout/index.js +19 -4
- package/lib/schema-component/antd/action/Action.js +2 -0
- package/lib/schema-component/antd/action/ActionBar.js +9 -1
- package/lib/schema-component/antd/cron/Cron.d.ts +6 -0
- package/lib/schema-component/antd/cron/Cron.js +67 -0
- package/lib/schema-component/antd/cron/index.d.ts +1 -0
- package/lib/schema-component/antd/cron/index.js +18 -0
- package/lib/schema-component/antd/cron/locale/zh-CN.d.ts +34 -0
- package/lib/schema-component/antd/cron/locale/zh-CN.js +44 -0
- package/lib/schema-component/antd/filter/Filter.Action.Designer.js +1 -0
- package/lib/schema-component/antd/formula-input/Compute.js +1 -1
- package/lib/schema-component/antd/grid/Grid.js +132 -23
- package/lib/schema-component/antd/index.d.ts +1 -0
- package/lib/schema-component/antd/index.js +13 -0
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +5 -2
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +6 -2
- package/lib/schema-component/antd/record-picker/util.d.ts +5 -0
- package/lib/schema-component/antd/record-picker/util.js +55 -0
- package/lib/schema-component/antd/upload/shared.js +5 -1
- package/lib/schema-component/common/dnd-context/index.js +35 -5
- package/lib/schema-component/hooks/useDesignable.d.ts +2 -2
- package/lib/schema-component/hooks/useDesignable.js +132 -28
- package/lib/schema-initializer/SchemaInitializer.d.ts +1 -0
- package/lib/schema-initializer/SchemaInitializer.js +7 -2
- package/lib/schema-initializer/buttons/TabPaneInitializers.d.ts +2 -1
- package/lib/schema-initializer/buttons/TabPaneInitializers.js +13 -4
- package/lib/schema-initializer/items/ActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/ActionInitializer.js +26 -0
- package/lib/schema-initializer/items/BlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/BlockInitializer.js +31 -0
- package/lib/schema-initializer/items/BulkDestroyActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/BulkDestroyActionInitializer.js +40 -0
- package/lib/schema-initializer/items/CalendarBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CalendarBlockInitializer.js +148 -0
- package/lib/schema-initializer/items/CollectionFieldInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CollectionFieldInitializer.js +28 -0
- package/lib/schema-initializer/items/CreateActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CreateActionInitializer.js +73 -0
- package/lib/schema-initializer/items/CreateFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CreateFormBlockInitializer.js +120 -0
- package/lib/schema-initializer/items/CreateSubmitActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CreateSubmitActionInitializer.js +37 -0
- package/lib/schema-initializer/items/CustomizeActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CustomizeActionInitializer.js +24 -0
- package/lib/schema-initializer/items/DataBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/DataBlockInitializer.js +104 -0
- package/lib/schema-initializer/items/DestroyActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/DestroyActionInitializer.js +40 -0
- package/lib/schema-initializer/items/DetailsBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/DetailsBlockInitializer.js +71 -0
- package/lib/schema-initializer/items/FilterActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/FilterActionInitializer.js +37 -0
- package/lib/schema-initializer/items/FormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/FormBlockInitializer.js +45 -0
- package/lib/schema-initializer/items/G2PlotInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/G2PlotInitializer.js +38 -0
- package/lib/schema-initializer/items/InitializerWithSwitch.d.ts +1 -0
- package/lib/schema-initializer/items/InitializerWithSwitch.js +47 -0
- package/lib/schema-initializer/items/KanbanBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/KanbanBlockInitializer.js +163 -0
- package/lib/schema-initializer/items/MarkdownBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/MarkdownBlockInitializer.js +47 -0
- package/lib/schema-initializer/items/PrintActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/PrintActionInitializer.js +36 -0
- package/lib/schema-initializer/items/RecordAssociationBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationBlockInitializer.js +107 -0
- package/lib/schema-initializer/items/RecordAssociationCalendarBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +185 -0
- package/lib/schema-initializer/items/RecordAssociationDetailsBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +107 -0
- package/lib/schema-initializer/items/RecordAssociationFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationFormBlockInitializer.js +128 -0
- package/lib/schema-initializer/items/RecordFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordFormBlockInitializer.js +127 -0
- package/lib/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +133 -0
- package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +132 -0
- package/lib/schema-initializer/items/RefreshActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RefreshActionInitializer.js +36 -0
- package/lib/schema-initializer/items/SubmitActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/SubmitActionInitializer.js +37 -0
- package/lib/schema-initializer/items/TableActionColumnInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableActionColumnInitializer.js +47 -0
- package/lib/schema-initializer/items/TableBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableBlockInitializer.js +71 -0
- package/lib/schema-initializer/items/TableCollectionFieldInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableCollectionFieldInitializer.js +28 -0
- package/lib/schema-initializer/items/TableSelectorInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableSelectorInitializer.js +84 -0
- package/lib/schema-initializer/items/UpdateActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/UpdateActionInitializer.js +72 -0
- package/lib/schema-initializer/items/UpdateSubmitActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/UpdateSubmitActionInitializer.js +37 -0
- package/lib/schema-initializer/items/ViewActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/ViewActionInitializer.js +71 -0
- package/lib/schema-initializer/items/index.d.ts +35 -35
- package/lib/schema-initializer/items/index.js +400 -1659
- package/lib/schema-initializer/style.less +4 -0
- package/lib/schema-templates/SchemaTemplateManagerProvider.js +2 -5
- package/lib/system-settings/SystemSettingsShortcut.js +7 -0
- package/lib/user/SigninPage.d.ts +11 -2
- package/lib/user/SigninPage.js +150 -34
- package/lib/user/SignupPage.d.ts +7 -1
- package/lib/user/SignupPage.js +56 -10
- package/lib/user/VerificationCode.d.ts +7 -0
- package/lib/user/VerificationCode.js +148 -0
- package/package.json +6 -4
|
@@ -21,6 +21,7 @@ import { useCompile } from '../../hooks';
|
|
|
21
21
|
import { ActionContext } from '../action';
|
|
22
22
|
import { EllipsisWithTooltip } from '../input/EllipsisWithTooltip';
|
|
23
23
|
import { useFieldNames } from './useFieldNames';
|
|
24
|
+
import { getLabelFormatValue, useLabelUiSchema } from './util';
|
|
24
25
|
export var ReadPrettyRecordPicker = observer(function (props) {
|
|
25
26
|
var ellipsis = props.ellipsis;
|
|
26
27
|
var fieldSchema = useFieldSchema();
|
|
@@ -53,10 +54,12 @@ export var ReadPrettyRecordPicker = observer(function (props) {
|
|
|
53
54
|
setRecord = _useState6[1];
|
|
54
55
|
|
|
55
56
|
var compile = useCompile();
|
|
57
|
+
var labelUiSchema = useLabelUiSchema(collectionField, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label');
|
|
56
58
|
var ellipsisWithTooltipRef = useRef();
|
|
57
59
|
|
|
58
60
|
var renderRecords = function renderRecords() {
|
|
59
61
|
return toArr(field.value).map(function (record, index, arr) {
|
|
62
|
+
var val = compile(record === null || record === void 0 ? void 0 : record[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label']) || (record === null || record === void 0 ? void 0 : record[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value']) || (record === null || record === void 0 ? void 0 : record.id);
|
|
60
63
|
return /*#__PURE__*/React.createElement(Fragment, {
|
|
61
64
|
key: "".concat(record.id, "_").concat(index)
|
|
62
65
|
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("a", {
|
|
@@ -69,12 +72,12 @@ export var ReadPrettyRecordPicker = observer(function (props) {
|
|
|
69
72
|
setRecord(record);
|
|
70
73
|
ellipsisWithTooltipRef === null || ellipsisWithTooltipRef === void 0 ? void 0 : (_ellipsisWithTooltipR = ellipsisWithTooltipRef.current) === null || _ellipsisWithTooltipR === void 0 ? void 0 : _ellipsisWithTooltipR.setPopoverVisible(false);
|
|
71
74
|
}
|
|
72
|
-
},
|
|
75
|
+
}, getLabelFormatValue(labelUiSchema, val))), index < arr.length - 1 ? /*#__PURE__*/React.createElement("span", {
|
|
73
76
|
style: {
|
|
74
77
|
marginRight: 4,
|
|
75
78
|
color: '#aaa'
|
|
76
79
|
}
|
|
77
|
-
}, ",
|
|
80
|
+
}, ",") : null);
|
|
78
81
|
});
|
|
79
82
|
};
|
|
80
83
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ISchema } from '@formily/react';
|
|
2
|
+
import { CollectionFieldOptions } from '../../../collection-manager';
|
|
3
|
+
export declare const useLabelUiSchema: (collectionField: CollectionFieldOptions, label: string) => ISchema;
|
|
4
|
+
export declare const getDatePickerLabels: (props: any) => string;
|
|
5
|
+
export declare const getLabelFormatValue: (labelUiSchema: ISchema, value: any) => string;
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import { isArr } from '@formily/shared';
|
|
8
|
+
import { getDefaultFormat, str2moment } from '@nocobase/utils/client';
|
|
9
|
+
import { useCollectionManager } from '../../../collection-manager';
|
|
10
|
+
export var useLabelUiSchema = function useLabelUiSchema(collectionField, label) {
|
|
11
|
+
var _useCollectionManager = useCollectionManager(),
|
|
12
|
+
getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
|
|
13
|
+
|
|
14
|
+
if (!collectionField) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var labelField = getCollectionJoinField("".concat(collectionField.target, ".").concat(label));
|
|
19
|
+
return labelField === null || labelField === void 0 ? void 0 : labelField.uiSchema;
|
|
20
|
+
};
|
|
21
|
+
export var getDatePickerLabels = function getDatePickerLabels(props) {
|
|
22
|
+
var format = getDefaultFormat(props);
|
|
23
|
+
var m = str2moment(props.value, props);
|
|
24
|
+
var labels = m && m.isValid() ? m.format(format) : props.value;
|
|
25
|
+
return isArr(labels) ? labels.join('~') : labels;
|
|
26
|
+
};
|
|
27
|
+
export var getLabelFormatValue = function getLabelFormatValue(labelUiSchema, value) {
|
|
28
|
+
switch (labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component']) {
|
|
29
|
+
case 'DatePicker':
|
|
30
|
+
return getDatePickerLabels(_objectSpread(_objectSpread({}, labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component-props']), {}, {
|
|
31
|
+
value: value
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
default:
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
@@ -24,7 +24,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
24
24
|
|
|
25
25
|
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); }
|
|
26
26
|
|
|
27
|
-
import { useField } from '@formily/react';
|
|
27
|
+
import { useField, useForm } from '@formily/react';
|
|
28
28
|
import { reaction } from '@formily/reactive';
|
|
29
29
|
import { isArr, isValid, toArr as toArray } from '@formily/shared';
|
|
30
30
|
import { useEffect } from 'react';
|
|
@@ -197,6 +197,7 @@ export function useUploadProps(_ref) {
|
|
|
197
197
|
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, normalizeFileList(_toConsumableArray(param.fileList)));
|
|
198
198
|
};
|
|
199
199
|
|
|
200
|
+
var form = useForm();
|
|
200
201
|
var api = useAPIClient();
|
|
201
202
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
202
203
|
customRequest: function customRequest(_ref2) {
|
|
@@ -218,6 +219,7 @@ export function useUploadProps(_ref) {
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
formData.append(filename, file);
|
|
222
|
+
form.disabled = true;
|
|
221
223
|
api.axios.post(action, formData, {
|
|
222
224
|
withCredentials: withCredentials,
|
|
223
225
|
headers: headers,
|
|
@@ -231,7 +233,9 @@ export function useUploadProps(_ref) {
|
|
|
231
233
|
}).then(function (_ref4) {
|
|
232
234
|
var data = _ref4.data;
|
|
233
235
|
onSuccess(data, file);
|
|
234
|
-
}).catch(onError)
|
|
236
|
+
}).catch(onError).finally(function () {
|
|
237
|
+
form.disabled = false;
|
|
238
|
+
});
|
|
235
239
|
return {
|
|
236
240
|
abort: function abort() {
|
|
237
241
|
console.log('upload progress is aborted.');
|
|
@@ -4,9 +4,21 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
9
|
+
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."); }
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
7
19
|
import { DndContext as DndKitContext, DragOverlay, rectIntersection } from '@dnd-kit/core';
|
|
8
20
|
import { observer } from '@formily/react';
|
|
9
|
-
import React from 'react';
|
|
21
|
+
import React, { useState } from 'react';
|
|
10
22
|
import { useTranslation } from 'react-i18next';
|
|
11
23
|
import { useAPIClient } from '../../../';
|
|
12
24
|
import { createDesignable, useDesignable } from '../../hooks';
|
|
@@ -21,7 +33,7 @@ var useDragEnd = function useDragEnd(props) {
|
|
|
21
33
|
t = _useTranslation.t;
|
|
22
34
|
|
|
23
35
|
return function (event) {
|
|
24
|
-
var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current;
|
|
36
|
+
var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current, _over$data5, _over$data5$current;
|
|
25
37
|
|
|
26
38
|
var active = event.active,
|
|
27
39
|
over = event.over;
|
|
@@ -30,6 +42,7 @@ var useDragEnd = function useDragEnd(props) {
|
|
|
30
42
|
var insertAdjacent = over === null || over === void 0 ? void 0 : (_over$data2 = over.data) === null || _over$data2 === void 0 ? void 0 : (_over$data2$current = _over$data2.current) === null || _over$data2$current === void 0 ? void 0 : _over$data2$current.insertAdjacent;
|
|
31
43
|
var breakRemoveOn = over === null || over === void 0 ? void 0 : (_over$data3 = over.data) === null || _over$data3 === void 0 ? void 0 : (_over$data3$current = _over$data3.current) === null || _over$data3$current === void 0 ? void 0 : _over$data3$current.breakRemoveOn;
|
|
32
44
|
var wrapSchema = over === null || over === void 0 ? void 0 : (_over$data4 = over.data) === null || _over$data4 === void 0 ? void 0 : (_over$data4$current = _over$data4.current) === null || _over$data4$current === void 0 ? void 0 : _over$data4$current.wrapSchema;
|
|
45
|
+
var onSuccess = over === null || over === void 0 ? void 0 : (_over$data5 = over.data) === null || _over$data5 === void 0 ? void 0 : (_over$data5$current = _over$data5.current) === null || _over$data5$current === void 0 ? void 0 : _over$data5$current.onSuccess;
|
|
33
46
|
|
|
34
47
|
if (!activeSchema || !overSchema) {
|
|
35
48
|
var _props$onDragEnd;
|
|
@@ -67,7 +80,8 @@ var useDragEnd = function useDragEnd(props) {
|
|
|
67
80
|
dn.insertAdjacent(insertAdjacent, activeSchema, {
|
|
68
81
|
wrap: wrapSchema,
|
|
69
82
|
breakRemoveOn: breakRemoveOn,
|
|
70
|
-
removeParentsIfNoChildren: true
|
|
83
|
+
removeParentsIfNoChildren: true,
|
|
84
|
+
onSuccess: onSuccess
|
|
71
85
|
});
|
|
72
86
|
props === null || props === void 0 ? void 0 : (_props$onDragEnd4 = props.onDragEnd) === null || _props$onDragEnd4 === void 0 ? void 0 : _props$onDragEnd4.call(props, event);
|
|
73
87
|
return;
|
|
@@ -79,16 +93,28 @@ export var DndContext = observer(function (props) {
|
|
|
79
93
|
var _useTranslation2 = useTranslation(),
|
|
80
94
|
t = _useTranslation2.t;
|
|
81
95
|
|
|
96
|
+
var _useState = useState(true),
|
|
97
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
98
|
+
visible = _useState2[0],
|
|
99
|
+
setVisible = _useState2[1];
|
|
100
|
+
|
|
82
101
|
return /*#__PURE__*/React.createElement(DndKitContext, _objectSpread(_objectSpread({
|
|
83
102
|
collisionDetection: rectIntersection
|
|
84
103
|
}, props), {}, {
|
|
104
|
+
onDragStart: function onDragStart(event) {
|
|
105
|
+
var _active$data2, _active$data2$current;
|
|
106
|
+
|
|
107
|
+
var active = event.active;
|
|
108
|
+
var activeSchema = active === null || active === void 0 ? void 0 : (_active$data2 = active.data) === null || _active$data2 === void 0 ? void 0 : (_active$data2$current = _active$data2.current) === null || _active$data2$current === void 0 ? void 0 : _active$data2$current.schema;
|
|
109
|
+
setVisible(!!activeSchema);
|
|
110
|
+
},
|
|
85
111
|
onDragEnd: useDragEnd(props)
|
|
86
112
|
}), /*#__PURE__*/React.createElement(DragOverlay, {
|
|
87
113
|
dropAnimation: {
|
|
88
114
|
duration: 10,
|
|
89
115
|
easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)'
|
|
90
116
|
}
|
|
91
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
117
|
+
}, visible && /*#__PURE__*/React.createElement("span", {
|
|
92
118
|
style: {
|
|
93
119
|
whiteSpace: 'nowrap'
|
|
94
120
|
}
|
|
@@ -35,8 +35,8 @@ export declare class Designable {
|
|
|
35
35
|
constructor(options: CreateDesignableProps);
|
|
36
36
|
loadAPIClientEvents(): void;
|
|
37
37
|
prepareProperty(schema: ISchema): void;
|
|
38
|
-
on(name: 'insertAdjacent' | 'remove' | 'error' | 'patch', listener: any): void;
|
|
39
|
-
emit(name: 'insertAdjacent' | 'remove' | 'error' | 'patch', ...args: any[]): void;
|
|
38
|
+
on(name: 'insertAdjacent' | 'remove' | 'error' | 'patch' | 'batchPatch', listener: any): void;
|
|
39
|
+
emit(name: 'insertAdjacent' | 'remove' | 'error' | 'patch' | 'batchPatch', ...args: any[]): void;
|
|
40
40
|
parentsIn(schema: Schema): boolean;
|
|
41
41
|
refresh(): void;
|
|
42
42
|
insertAdjacent(position: Position, schema: ISchema, options?: InsertAdjacentOptions): void;
|
|
@@ -141,25 +141,61 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
var updateColumnSize = function updateColumnSize(parent) {
|
|
145
|
+
if (!parent) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var len = Object.values(parent.properties).length;
|
|
150
|
+
var schemas = [];
|
|
151
|
+
parent.mapProperties(function (s) {
|
|
152
|
+
s['x-component-props'] = s['x-component-props'] || {};
|
|
153
|
+
s['x-component-props']['width'] = 100 / len;
|
|
154
|
+
|
|
155
|
+
if (s['x-uid']) {
|
|
156
|
+
schemas.push({
|
|
157
|
+
'x-uid': s['x-uid'],
|
|
158
|
+
'x-component-props': s['x-component-props']
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
if (parent['x-uid'] && schemas.length) {
|
|
164
|
+
return schemas;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return [];
|
|
168
|
+
};
|
|
169
|
+
|
|
144
170
|
this.on('insertAdjacent', /*#__PURE__*/function () {
|
|
145
171
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
146
|
-
var onSuccess, current, position, schema, wrap, removed;
|
|
172
|
+
var onSuccess, current, position, schema, wrap, wrapped, removed, schemas;
|
|
147
173
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
148
174
|
while (1) {
|
|
149
175
|
switch (_context.prev = _context.next) {
|
|
150
176
|
case 0:
|
|
151
|
-
onSuccess = _ref.onSuccess, current = _ref.current, position = _ref.position, schema = _ref.schema, wrap = _ref.wrap, removed = _ref.removed;
|
|
177
|
+
onSuccess = _ref.onSuccess, current = _ref.current, position = _ref.position, schema = _ref.schema, wrap = _ref.wrap, wrapped = _ref.wrapped, removed = _ref.removed;
|
|
178
|
+
schemas = [];
|
|
179
|
+
|
|
180
|
+
if ((wrapped === null || wrapped === void 0 ? void 0 : wrapped['x-component']) === 'Grid.Col') {
|
|
181
|
+
schemas = updateColumnSize(wrapped.parent);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if ((removed === null || removed === void 0 ? void 0 : removed['x-component']) === 'Grid.Col') {
|
|
185
|
+
schemas = updateColumnSize(removed.parent);
|
|
186
|
+
}
|
|
187
|
+
|
|
152
188
|
refresh();
|
|
153
189
|
|
|
154
190
|
if (current['x-uid']) {
|
|
155
|
-
_context.next =
|
|
191
|
+
_context.next = 7;
|
|
156
192
|
break;
|
|
157
193
|
}
|
|
158
194
|
|
|
159
195
|
return _context.abrupt("return");
|
|
160
196
|
|
|
161
|
-
case
|
|
162
|
-
_context.next =
|
|
197
|
+
case 7:
|
|
198
|
+
_context.next = 9;
|
|
163
199
|
return api.request({
|
|
164
200
|
url: "/uiSchemas:insertAdjacent/".concat(current['x-uid'], "?position=").concat(position),
|
|
165
201
|
method: 'post',
|
|
@@ -169,23 +205,36 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
169
205
|
}
|
|
170
206
|
});
|
|
171
207
|
|
|
172
|
-
case
|
|
208
|
+
case 9:
|
|
209
|
+
if (!schemas.length) {
|
|
210
|
+
_context.next = 12;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
_context.next = 12;
|
|
215
|
+
return api.request({
|
|
216
|
+
url: "/uiSchemas:batchPatch",
|
|
217
|
+
method: 'post',
|
|
218
|
+
data: schemas
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
case 12:
|
|
173
222
|
if (!(removed === null || removed === void 0 ? void 0 : removed['x-uid'])) {
|
|
174
|
-
_context.next =
|
|
223
|
+
_context.next = 15;
|
|
175
224
|
break;
|
|
176
225
|
}
|
|
177
226
|
|
|
178
|
-
_context.next =
|
|
227
|
+
_context.next = 15;
|
|
179
228
|
return api.request({
|
|
180
229
|
url: "/uiSchemas:remove/".concat(removed['x-uid']),
|
|
181
230
|
method: 'post'
|
|
182
231
|
});
|
|
183
232
|
|
|
184
|
-
case
|
|
233
|
+
case 15:
|
|
185
234
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
186
235
|
message.success(t('Saved successfully'), 0.2);
|
|
187
236
|
|
|
188
|
-
case
|
|
237
|
+
case 17:
|
|
189
238
|
case "end":
|
|
190
239
|
return _context.stop();
|
|
191
240
|
}
|
|
@@ -237,43 +286,93 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
237
286
|
return _ref4.apply(this, arguments);
|
|
238
287
|
};
|
|
239
288
|
}());
|
|
240
|
-
this.on('
|
|
289
|
+
this.on('batchPatch', /*#__PURE__*/function () {
|
|
241
290
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref5) {
|
|
242
|
-
var
|
|
291
|
+
var schemas;
|
|
243
292
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
244
293
|
while (1) {
|
|
245
294
|
switch (_context3.prev = _context3.next) {
|
|
246
295
|
case 0:
|
|
247
|
-
|
|
296
|
+
schemas = _ref5.schemas;
|
|
297
|
+
refresh();
|
|
298
|
+
_context3.next = 4;
|
|
299
|
+
return api.request({
|
|
300
|
+
url: "/uiSchemas:batchPatch",
|
|
301
|
+
method: 'post',
|
|
302
|
+
data: schemas
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
case 4:
|
|
306
|
+
message.success(t('Saved successfully'), 0.2);
|
|
307
|
+
|
|
308
|
+
case 5:
|
|
309
|
+
case "end":
|
|
310
|
+
return _context3.stop();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}, _callee3);
|
|
314
|
+
}));
|
|
315
|
+
|
|
316
|
+
return function (_x3) {
|
|
317
|
+
return _ref6.apply(this, arguments);
|
|
318
|
+
};
|
|
319
|
+
}());
|
|
320
|
+
this.on('remove', /*#__PURE__*/function () {
|
|
321
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref7) {
|
|
322
|
+
var removed, schemas;
|
|
323
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
324
|
+
while (1) {
|
|
325
|
+
switch (_context4.prev = _context4.next) {
|
|
326
|
+
case 0:
|
|
327
|
+
removed = _ref7.removed;
|
|
328
|
+
schemas = [];
|
|
329
|
+
|
|
330
|
+
if ((removed === null || removed === void 0 ? void 0 : removed['x-component']) === 'Grid.Col') {
|
|
331
|
+
schemas = updateColumnSize(removed.parent);
|
|
332
|
+
}
|
|
333
|
+
|
|
248
334
|
refresh();
|
|
249
335
|
|
|
250
336
|
if (removed === null || removed === void 0 ? void 0 : removed['x-uid']) {
|
|
251
|
-
|
|
337
|
+
_context4.next = 6;
|
|
252
338
|
break;
|
|
253
339
|
}
|
|
254
340
|
|
|
255
|
-
return
|
|
341
|
+
return _context4.abrupt("return");
|
|
256
342
|
|
|
257
|
-
case
|
|
258
|
-
|
|
343
|
+
case 6:
|
|
344
|
+
_context4.next = 8;
|
|
259
345
|
return api.request({
|
|
260
346
|
url: "/uiSchemas:remove/".concat(removed['x-uid']),
|
|
261
347
|
method: 'post'
|
|
262
348
|
});
|
|
263
349
|
|
|
264
|
-
case
|
|
350
|
+
case 8:
|
|
351
|
+
if (!schemas.length) {
|
|
352
|
+
_context4.next = 11;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
_context4.next = 11;
|
|
357
|
+
return api.request({
|
|
358
|
+
url: "/uiSchemas:batchPatch",
|
|
359
|
+
method: 'post',
|
|
360
|
+
data: schemas
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
case 11:
|
|
265
364
|
message.success(t('Saved successfully'), 0.2);
|
|
266
365
|
|
|
267
|
-
case
|
|
366
|
+
case 12:
|
|
268
367
|
case "end":
|
|
269
|
-
return
|
|
368
|
+
return _context4.stop();
|
|
270
369
|
}
|
|
271
370
|
}
|
|
272
|
-
},
|
|
371
|
+
}, _callee4);
|
|
273
372
|
}));
|
|
274
373
|
|
|
275
|
-
return function (
|
|
276
|
-
return
|
|
374
|
+
return function (_x4) {
|
|
375
|
+
return _ref8.apply(this, arguments);
|
|
277
376
|
};
|
|
278
377
|
}());
|
|
279
378
|
}
|
|
@@ -569,6 +668,7 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
569
668
|
this.emit('insertAdjacent', _objectSpread({
|
|
570
669
|
position: 'beforeBegin',
|
|
571
670
|
schema: schema2,
|
|
671
|
+
wrapped: wrapped,
|
|
572
672
|
wrap: schema1
|
|
573
673
|
}, opts));
|
|
574
674
|
}
|
|
@@ -639,7 +739,8 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
639
739
|
this.emit('insertAdjacent', _objectSpread({
|
|
640
740
|
position: 'afterBegin',
|
|
641
741
|
schema: schema2,
|
|
642
|
-
wrap: schema1
|
|
742
|
+
wrap: schema1,
|
|
743
|
+
wrapped: wrapped
|
|
643
744
|
}, opts));
|
|
644
745
|
}
|
|
645
746
|
/**
|
|
@@ -658,6 +759,7 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
658
759
|
return;
|
|
659
760
|
}
|
|
660
761
|
|
|
762
|
+
delete schema['x-index'];
|
|
661
763
|
var opts = {
|
|
662
764
|
onSuccess: options.onSuccess
|
|
663
765
|
};
|
|
@@ -699,7 +801,8 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
699
801
|
this.emit('insertAdjacent', _objectSpread({
|
|
700
802
|
position: 'beforeEnd',
|
|
701
803
|
schema: schema2,
|
|
702
|
-
wrap: schema1
|
|
804
|
+
wrap: schema1,
|
|
805
|
+
wrapped: wrapped
|
|
703
806
|
}, opts));
|
|
704
807
|
}
|
|
705
808
|
/**
|
|
@@ -783,7 +886,8 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
783
886
|
this.emit('insertAdjacent', _objectSpread({
|
|
784
887
|
position: 'afterEnd',
|
|
785
888
|
schema: schema2,
|
|
786
|
-
wrap: schema1
|
|
889
|
+
wrap: schema1,
|
|
890
|
+
wrapped: wrapped
|
|
787
891
|
}, opts));
|
|
788
892
|
}
|
|
789
893
|
}]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import './style.less';
|
|
2
3
|
import { SchemaInitializerButtonProps, SchemaInitializerItemComponent, SchemaInitializerItemProps } from './types';
|
|
3
4
|
export declare const SchemaInitializerItemContext: React.Context<any>;
|
|
4
5
|
export declare const SchemaInitializer: {
|
|
@@ -34,6 +34,7 @@ import classNames from 'classnames';
|
|
|
34
34
|
import React, { createContext, useContext, useState } from 'react';
|
|
35
35
|
import { Icon } from '../icon';
|
|
36
36
|
import { useCompile, useDesignable } from '../schema-component/hooks';
|
|
37
|
+
import './style.less';
|
|
37
38
|
|
|
38
39
|
var defaultWrap = function defaultWrap(s) {
|
|
39
40
|
return s;
|
|
@@ -43,6 +44,7 @@ export var SchemaInitializerItemContext = /*#__PURE__*/createContext(null);
|
|
|
43
44
|
export var SchemaInitializer = function SchemaInitializer() {
|
|
44
45
|
return null;
|
|
45
46
|
};
|
|
47
|
+
var menuItemGroupCss = 'nb-menu-item-group';
|
|
46
48
|
SchemaInitializer.Button = observer(function (props) {
|
|
47
49
|
var title = props.title,
|
|
48
50
|
insert = props.insert,
|
|
@@ -121,7 +123,8 @@ SchemaInitializer.Button = observer(function (props) {
|
|
|
121
123
|
|
|
122
124
|
return !!((_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length) && /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
|
123
125
|
key: item.key || "item-group-".concat(indexA),
|
|
124
|
-
title: compile(item.title)
|
|
126
|
+
title: compile(item.title),
|
|
127
|
+
popupClassName: menuItemGroupCss
|
|
125
128
|
}, renderItems(item.children));
|
|
126
129
|
}
|
|
127
130
|
});
|
|
@@ -191,7 +194,8 @@ SchemaInitializer.Item = function (props) {
|
|
|
191
194
|
// @ts-ignore
|
|
192
195
|
eventKey: item.key || "item-group-".concat(indexA),
|
|
193
196
|
key: item.key || "item-group-".concat(indexA),
|
|
194
|
-
title: compile(item.title)
|
|
197
|
+
title: compile(item.title),
|
|
198
|
+
className: menuItemGroupCss
|
|
195
199
|
}, renderMenuItem(item.children));
|
|
196
200
|
}
|
|
197
201
|
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const TabPaneInitializers: () => JSX.Element;
|
|
1
|
+
export declare const TabPaneInitializers: (props?: any) => JSX.Element;
|
|
2
|
+
export declare const TabPaneInitializersForCreateFormBlock: () => JSX.Element;
|
|
@@ -4,8 +4,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
4
4
|
|
|
5
5
|
import { useForm } from '@formily/react';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import { SchemaComponent, useActionContext, useDesignable } from '../..';
|
|
8
|
-
export var TabPaneInitializers = function TabPaneInitializers() {
|
|
7
|
+
import { SchemaComponent, useActionContext, useDesignable, useRecordIndex } from '../..';
|
|
8
|
+
export var TabPaneInitializers = function TabPaneInitializers(props) {
|
|
9
9
|
var _useDesignable = useDesignable(),
|
|
10
10
|
designable = _useDesignable.designable,
|
|
11
11
|
insertBeforeEnd = _useDesignable.insertBeforeEnd;
|
|
@@ -17,6 +17,7 @@ export var TabPaneInitializers = function TabPaneInitializers() {
|
|
|
17
17
|
var useSubmitAction = function useSubmitAction() {
|
|
18
18
|
var form = useForm();
|
|
19
19
|
var ctx = useActionContext();
|
|
20
|
+
var index = useRecordIndex();
|
|
20
21
|
return {
|
|
21
22
|
run: function run() {
|
|
22
23
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
@@ -43,7 +44,7 @@ export var TabPaneInitializers = function TabPaneInitializers() {
|
|
|
43
44
|
grid: {
|
|
44
45
|
type: 'void',
|
|
45
46
|
'x-component': 'Grid',
|
|
46
|
-
'x-initializer': 'RecordBlockInitializers',
|
|
47
|
+
'x-initializer': props.isCreate || index === null ? 'CreateFormBlockInitializers' : 'RecordBlockInitializers',
|
|
47
48
|
properties: {}
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -150,4 +151,9 @@ export var TabPaneInitializers = function TabPaneInitializers() {
|
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
});
|
|
154
|
+
};
|
|
155
|
+
export var TabPaneInitializersForCreateFormBlock = function TabPaneInitializersForCreateFormBlock() {
|
|
156
|
+
return /*#__PURE__*/React.createElement(TabPaneInitializers, {
|
|
157
|
+
isCreate: true
|
|
158
|
+
});
|
|
153
159
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ActionInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { InitializerWithSwitch } from './InitializerWithSwitch';
|
|
9
|
+
export var ActionInitializer = function ActionInitializer(props) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
|
|
11
|
+
type: 'x-action'
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BlockInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { SchemaInitializer } from ".."; // Block
|
|
9
|
+
|
|
10
|
+
export var BlockInitializer = function BlockInitializer(props) {
|
|
11
|
+
var item = props.item,
|
|
12
|
+
insert = props.insert;
|
|
13
|
+
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, {
|
|
14
|
+
onClick: function onClick() {
|
|
15
|
+
insert(_objectSpread({}, item.schema));
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BulkDestroyActionInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { ActionInitializer } from "./ActionInitializer";
|
|
9
|
+
export var BulkDestroyActionInitializer = function BulkDestroyActionInitializer(props) {
|
|
10
|
+
var schema = {
|
|
11
|
+
title: '{{ t("Delete") }}',
|
|
12
|
+
'x-action': 'destroy',
|
|
13
|
+
'x-component': 'Action',
|
|
14
|
+
'x-designer': 'Action.Designer',
|
|
15
|
+
'x-component-props': {
|
|
16
|
+
icon: 'DeleteOutlined',
|
|
17
|
+
confirm: {
|
|
18
|
+
title: "{{t('Delete record')}}",
|
|
19
|
+
content: "{{t('Are you sure you want to delete it?')}}"
|
|
20
|
+
},
|
|
21
|
+
useProps: '{{ useBulkDestroyActionProps }}'
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
25
|
+
schema: schema
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CalendarBlockInitializer: (props: any) => JSX.Element;
|