@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const InitializerWithSwitch: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { merge } from '@formily/shared';
|
|
3
|
+
import { SchemaInitializer } from "..";
|
|
4
|
+
import { useCurrentSchema } from '../utils';
|
|
5
|
+
export var InitializerWithSwitch = function InitializerWithSwitch(props) {
|
|
6
|
+
var _item$schema;
|
|
7
|
+
|
|
8
|
+
var type = props.type,
|
|
9
|
+
schema = props.schema,
|
|
10
|
+
item = props.item,
|
|
11
|
+
insert = props.insert;
|
|
12
|
+
|
|
13
|
+
var _useCurrentSchema = useCurrentSchema((schema === null || schema === void 0 ? void 0 : schema[type]) || (item === null || item === void 0 ? void 0 : (_item$schema = item.schema) === null || _item$schema === void 0 ? void 0 : _item$schema[type]), type, item.find, item.remove),
|
|
14
|
+
exists = _useCurrentSchema.exists,
|
|
15
|
+
remove = _useCurrentSchema.remove;
|
|
16
|
+
|
|
17
|
+
return /*#__PURE__*/React.createElement(SchemaInitializer.SwitchItem, {
|
|
18
|
+
checked: exists,
|
|
19
|
+
title: item.title,
|
|
20
|
+
onClick: function onClick() {
|
|
21
|
+
var _item$schemaInitializ;
|
|
22
|
+
|
|
23
|
+
if (exists) {
|
|
24
|
+
return remove();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var s = merge(schema || {}, item.schema || {});
|
|
28
|
+
item === null || item === void 0 ? void 0 : (_item$schemaInitializ = item.schemaInitialize) === null || _item$schemaInitializ === void 0 ? void 0 : _item$schemaInitializ.call(item, s);
|
|
29
|
+
insert(s);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KanbanBlockInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
+
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
import React, { useContext } from "react";
|
|
12
|
+
import { FormDialog, FormLayout } from "@formily/antd";
|
|
13
|
+
import { FormOutlined } from '@ant-design/icons';
|
|
14
|
+
import { SchemaOptionsContext } from "@formily/react";
|
|
15
|
+
import { useTranslation } from "react-i18next";
|
|
16
|
+
import { useAPIClient } from "../../api-client";
|
|
17
|
+
import { useCollectionManager } from "../../collection-manager";
|
|
18
|
+
import { createKanbanBlockSchema } from "../utils";
|
|
19
|
+
import { DataBlockInitializer } from "./DataBlockInitializer";
|
|
20
|
+
import { SchemaComponent, SchemaComponentOptions } from "../../schema-component";
|
|
21
|
+
export var KanbanBlockInitializer = function KanbanBlockInitializer(props) {
|
|
22
|
+
var insert = props.insert;
|
|
23
|
+
|
|
24
|
+
var _useTranslation = useTranslation(),
|
|
25
|
+
t = _useTranslation.t;
|
|
26
|
+
|
|
27
|
+
var _useCollectionManager = useCollectionManager(),
|
|
28
|
+
getCollection = _useCollectionManager.getCollection;
|
|
29
|
+
|
|
30
|
+
var options = useContext(SchemaOptionsContext);
|
|
31
|
+
var api = useAPIClient();
|
|
32
|
+
return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
33
|
+
componentType: 'Kanban',
|
|
34
|
+
icon: /*#__PURE__*/React.createElement(FormOutlined, null),
|
|
35
|
+
onCreateBlockSchema: function () {
|
|
36
|
+
var _onCreateBlockSchema = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
37
|
+
var _collection$fields, _collection$fields$fi, _collection$fields2;
|
|
38
|
+
|
|
39
|
+
var item, collection, fields, values, sortName, exists;
|
|
40
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
41
|
+
while (1) {
|
|
42
|
+
switch (_context.prev = _context.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
item = _ref.item;
|
|
45
|
+
collection = getCollection(item.name);
|
|
46
|
+
fields = collection === null || collection === void 0 ? void 0 : (_collection$fields = collection.fields) === null || _collection$fields === void 0 ? void 0 : (_collection$fields$fi = _collection$fields.filter(function (field) {
|
|
47
|
+
return ['select', 'radioGroup'].includes(field.interface);
|
|
48
|
+
})) === null || _collection$fields$fi === void 0 ? void 0 : _collection$fields$fi.map(function (field) {
|
|
49
|
+
var _field$uiSchema;
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
label: field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title,
|
|
53
|
+
value: field.name,
|
|
54
|
+
uiSchema: _objectSpread(_objectSpread({}, field.uiSchema), {}, {
|
|
55
|
+
name: field.name
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
_context.next = 5;
|
|
60
|
+
return FormDialog(t('Create kanban block'), function () {
|
|
61
|
+
return /*#__PURE__*/React.createElement(SchemaComponentOptions, {
|
|
62
|
+
scope: options.scope,
|
|
63
|
+
components: _objectSpread({}, options.components)
|
|
64
|
+
}, /*#__PURE__*/React.createElement(FormLayout, {
|
|
65
|
+
layout: 'vertical'
|
|
66
|
+
}, /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
67
|
+
schema: {
|
|
68
|
+
properties: {
|
|
69
|
+
groupField: {
|
|
70
|
+
title: t('Grouping field'),
|
|
71
|
+
enum: fields,
|
|
72
|
+
required: true,
|
|
73
|
+
description: '{{t("Single select and radio fields can be used as the grouping field")}}',
|
|
74
|
+
'x-component': 'Select',
|
|
75
|
+
'x-component-props': {
|
|
76
|
+
objectValue: true,
|
|
77
|
+
fieldNames: {
|
|
78
|
+
label: 'label',
|
|
79
|
+
value: 'value'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
'x-decorator': 'FormItem'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})));
|
|
87
|
+
}).open({
|
|
88
|
+
initialValues: {}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
case 5:
|
|
92
|
+
values = _context.sent;
|
|
93
|
+
sortName = "".concat(values.groupField.value, "_sort");
|
|
94
|
+
exists = collection === null || collection === void 0 ? void 0 : (_collection$fields2 = collection.fields) === null || _collection$fields2 === void 0 ? void 0 : _collection$fields2.find(function (field) {
|
|
95
|
+
return field.name === sortName;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (exists) {
|
|
99
|
+
_context.next = 11;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
_context.next = 11;
|
|
104
|
+
return api.resource('collections.fields', item.name).create({
|
|
105
|
+
values: {
|
|
106
|
+
type: 'sort',
|
|
107
|
+
name: sortName,
|
|
108
|
+
hidden: true,
|
|
109
|
+
scopeKey: values.groupField.value
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
case 11:
|
|
114
|
+
insert(createKanbanBlockSchema({
|
|
115
|
+
groupField: values.groupField.value,
|
|
116
|
+
collection: item.name,
|
|
117
|
+
params: {
|
|
118
|
+
sort: [sortName],
|
|
119
|
+
paginate: false
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
case 12:
|
|
124
|
+
case "end":
|
|
125
|
+
return _context.stop();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, _callee);
|
|
129
|
+
}));
|
|
130
|
+
|
|
131
|
+
function onCreateBlockSchema(_x) {
|
|
132
|
+
return _onCreateBlockSchema.apply(this, arguments);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return onCreateBlockSchema;
|
|
136
|
+
}()
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MarkdownBlockInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { FormOutlined } from '@ant-design/icons';
|
|
9
|
+
import { useTranslation } from "react-i18next";
|
|
10
|
+
import { SchemaInitializer } from "../SchemaInitializer";
|
|
11
|
+
export var MarkdownBlockInitializer = function MarkdownBlockInitializer(props) {
|
|
12
|
+
var insert = props.insert;
|
|
13
|
+
|
|
14
|
+
var _useTranslation = useTranslation(),
|
|
15
|
+
t = _useTranslation.t;
|
|
16
|
+
|
|
17
|
+
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({}, props), {}, {
|
|
18
|
+
icon: /*#__PURE__*/React.createElement(FormOutlined, null),
|
|
19
|
+
onClick: function onClick() {
|
|
20
|
+
insert({
|
|
21
|
+
type: 'void',
|
|
22
|
+
'x-designer': 'Markdown.Void.Designer',
|
|
23
|
+
'x-decorator': 'CardItem',
|
|
24
|
+
'x-component': 'Markdown.Void',
|
|
25
|
+
'x-editable': false,
|
|
26
|
+
'x-component-props': {
|
|
27
|
+
content: t('This is a demo text, **supports Markdown syntax**.')
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PrintActionInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 PrintActionInitializer = function PrintActionInitializer(props) {
|
|
10
|
+
var schema = {
|
|
11
|
+
title: '{{ t("Print") }}',
|
|
12
|
+
'x-action': 'print',
|
|
13
|
+
'x-component': 'Action',
|
|
14
|
+
'x-designer': 'Action.Designer',
|
|
15
|
+
'x-component-props': {
|
|
16
|
+
icon: 'PrinterOutlined',
|
|
17
|
+
useProps: '{{ useDetailPrintActionProps }}'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
21
|
+
schema: schema
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RecordAssociationBlockInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var _excluded = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
|
|
2
|
+
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
|
+
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { TableOutlined } from '@ant-design/icons';
|
|
19
|
+
import { useCollectionManager } from "../../collection-manager";
|
|
20
|
+
import { useSchemaTemplateManager } from "../../schema-templates";
|
|
21
|
+
import { SchemaInitializer } from "../SchemaInitializer";
|
|
22
|
+
import { createTableBlockSchema, useRecordCollectionDataSourceItems } from "../utils";
|
|
23
|
+
export var RecordAssociationBlockInitializer = function RecordAssociationBlockInitializer(props) {
|
|
24
|
+
var item = props.item,
|
|
25
|
+
onCreateBlockSchema = props.onCreateBlockSchema,
|
|
26
|
+
componentType = props.componentType,
|
|
27
|
+
createBlockSchema = props.createBlockSchema,
|
|
28
|
+
insert = props.insert,
|
|
29
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
|
|
31
|
+
var _useSchemaTemplateMan = useSchemaTemplateManager(),
|
|
32
|
+
getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
|
|
33
|
+
|
|
34
|
+
var _useCollectionManager = useCollectionManager(),
|
|
35
|
+
getCollection = _useCollectionManager.getCollection;
|
|
36
|
+
|
|
37
|
+
var field = item.field;
|
|
38
|
+
var collection = getCollection(field.target);
|
|
39
|
+
var resource = "".concat(field.collectionName, ".").concat(field.name);
|
|
40
|
+
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
41
|
+
icon: /*#__PURE__*/React.createElement(TableOutlined, null)
|
|
42
|
+
}, others), {}, {
|
|
43
|
+
onClick: function () {
|
|
44
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
45
|
+
var item, s;
|
|
46
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
item = _ref.item;
|
|
51
|
+
|
|
52
|
+
if (!item.template) {
|
|
53
|
+
_context.next = 8;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_context.next = 4;
|
|
58
|
+
return getTemplateSchemaByMode(item);
|
|
59
|
+
|
|
60
|
+
case 4:
|
|
61
|
+
s = _context.sent;
|
|
62
|
+
insert(s);
|
|
63
|
+
_context.next = 9;
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
case 8:
|
|
67
|
+
insert(createTableBlockSchema({
|
|
68
|
+
rowKey: collection.filterTargetKey,
|
|
69
|
+
collection: field.target,
|
|
70
|
+
resource: resource,
|
|
71
|
+
association: resource
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
case 9:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, _callee);
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
function onClick(_x) {
|
|
83
|
+
return _onClick.apply(this, arguments);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return onClick;
|
|
87
|
+
}(),
|
|
88
|
+
items: useRecordCollectionDataSourceItems('Table', item, field.target, resource)
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RecordAssociationCalendarBlockInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
var _excluded = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
|
|
2
|
+
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
|
+
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
|
|
17
|
+
import React, { useContext } from "react";
|
|
18
|
+
import { FormDialog, FormLayout } from "@formily/antd";
|
|
19
|
+
import { SchemaOptionsContext } from "@formily/react";
|
|
20
|
+
import { useTranslation } from "react-i18next";
|
|
21
|
+
import { TableOutlined } from '@ant-design/icons';
|
|
22
|
+
import { useCollectionManager } from "../../collection-manager";
|
|
23
|
+
import { useSchemaTemplateManager } from "../../schema-templates";
|
|
24
|
+
import { SchemaInitializer } from "../SchemaInitializer";
|
|
25
|
+
import { createCalendarBlockSchema, useRecordCollectionDataSourceItems } from "../utils";
|
|
26
|
+
import { SchemaComponent, SchemaComponentOptions } from "../../schema-component";
|
|
27
|
+
export var RecordAssociationCalendarBlockInitializer = function RecordAssociationCalendarBlockInitializer(props) {
|
|
28
|
+
var item = props.item,
|
|
29
|
+
onCreateBlockSchema = props.onCreateBlockSchema,
|
|
30
|
+
componentType = props.componentType,
|
|
31
|
+
createBlockSchema = props.createBlockSchema,
|
|
32
|
+
insert = props.insert,
|
|
33
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
|
|
35
|
+
var _useSchemaTemplateMan = useSchemaTemplateManager(),
|
|
36
|
+
getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
|
|
37
|
+
|
|
38
|
+
var _useTranslation = useTranslation(),
|
|
39
|
+
t = _useTranslation.t;
|
|
40
|
+
|
|
41
|
+
var options = useContext(SchemaOptionsContext);
|
|
42
|
+
|
|
43
|
+
var _useCollectionManager = useCollectionManager(),
|
|
44
|
+
getCollection = _useCollectionManager.getCollection;
|
|
45
|
+
|
|
46
|
+
var field = item.field;
|
|
47
|
+
var collection = getCollection(field.target);
|
|
48
|
+
var resource = "".concat(field.collectionName, ".").concat(field.name);
|
|
49
|
+
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
50
|
+
icon: /*#__PURE__*/React.createElement(TableOutlined, null)
|
|
51
|
+
}, others), {}, {
|
|
52
|
+
onClick: function () {
|
|
53
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
54
|
+
var item, s, _collection$fields, _collection$fields$fi, _collection$fields2, _collection$fields2$f, stringFields, dateFields, values;
|
|
55
|
+
|
|
56
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57
|
+
while (1) {
|
|
58
|
+
switch (_context.prev = _context.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
item = _ref.item;
|
|
61
|
+
|
|
62
|
+
if (!item.template) {
|
|
63
|
+
_context.next = 8;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_context.next = 4;
|
|
68
|
+
return getTemplateSchemaByMode(item);
|
|
69
|
+
|
|
70
|
+
case 4:
|
|
71
|
+
s = _context.sent;
|
|
72
|
+
insert(s);
|
|
73
|
+
_context.next = 14;
|
|
74
|
+
break;
|
|
75
|
+
|
|
76
|
+
case 8:
|
|
77
|
+
stringFields = collection === null || collection === void 0 ? void 0 : (_collection$fields = collection.fields) === null || _collection$fields === void 0 ? void 0 : (_collection$fields$fi = _collection$fields.filter(function (field) {
|
|
78
|
+
return field.type === 'string';
|
|
79
|
+
})) === null || _collection$fields$fi === void 0 ? void 0 : _collection$fields$fi.map(function (field) {
|
|
80
|
+
var _field$uiSchema;
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
label: field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title,
|
|
84
|
+
value: field.name
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
dateFields = collection === null || collection === void 0 ? void 0 : (_collection$fields2 = collection.fields) === null || _collection$fields2 === void 0 ? void 0 : (_collection$fields2$f = _collection$fields2.filter(function (field) {
|
|
88
|
+
return field.type === 'date';
|
|
89
|
+
})) === null || _collection$fields2$f === void 0 ? void 0 : _collection$fields2$f.map(function (field) {
|
|
90
|
+
var _field$uiSchema2;
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
label: field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title,
|
|
94
|
+
value: field.name
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
_context.next = 12;
|
|
98
|
+
return FormDialog(t('Create calendar block'), function () {
|
|
99
|
+
return /*#__PURE__*/React.createElement(SchemaComponentOptions, {
|
|
100
|
+
scope: options.scope,
|
|
101
|
+
components: _objectSpread({}, options.components)
|
|
102
|
+
}, /*#__PURE__*/React.createElement(FormLayout, {
|
|
103
|
+
layout: 'vertical'
|
|
104
|
+
}, /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
105
|
+
schema: {
|
|
106
|
+
properties: {
|
|
107
|
+
title: {
|
|
108
|
+
title: t('Title field'),
|
|
109
|
+
enum: stringFields,
|
|
110
|
+
required: true,
|
|
111
|
+
'x-component': 'Select',
|
|
112
|
+
'x-decorator': 'FormItem'
|
|
113
|
+
},
|
|
114
|
+
start: {
|
|
115
|
+
title: t('Start date field'),
|
|
116
|
+
enum: dateFields,
|
|
117
|
+
required: true,
|
|
118
|
+
default: 'createdAt',
|
|
119
|
+
'x-component': 'Select',
|
|
120
|
+
'x-decorator': 'FormItem'
|
|
121
|
+
},
|
|
122
|
+
end: {
|
|
123
|
+
title: t('End date field'),
|
|
124
|
+
enum: dateFields,
|
|
125
|
+
'x-component': 'Select',
|
|
126
|
+
'x-decorator': 'FormItem'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
})));
|
|
131
|
+
}).open({
|
|
132
|
+
initialValues: {}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
case 12:
|
|
136
|
+
values = _context.sent;
|
|
137
|
+
insert(createCalendarBlockSchema({
|
|
138
|
+
collection: field.target,
|
|
139
|
+
resource: resource,
|
|
140
|
+
association: resource,
|
|
141
|
+
fieldNames: _objectSpread({}, values)
|
|
142
|
+
}));
|
|
143
|
+
|
|
144
|
+
case 14:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context.stop();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, _callee);
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
function onClick(_x) {
|
|
153
|
+
return _onClick.apply(this, arguments);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return onClick;
|
|
157
|
+
}(),
|
|
158
|
+
items: useRecordCollectionDataSourceItems('Calendar', item, field.target, resource)
|
|
159
|
+
}));
|
|
160
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RecordAssociationDetailsBlockInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var _excluded = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
|
|
2
|
+
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
|
+
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { FormOutlined } from '@ant-design/icons';
|
|
19
|
+
import { useCollectionManager } from "../../collection-manager";
|
|
20
|
+
import { useSchemaTemplateManager } from "../../schema-templates";
|
|
21
|
+
import { SchemaInitializer } from "../SchemaInitializer";
|
|
22
|
+
import { createDetailsBlockSchema, useRecordCollectionDataSourceItems } from "../utils";
|
|
23
|
+
export var RecordAssociationDetailsBlockInitializer = function RecordAssociationDetailsBlockInitializer(props) {
|
|
24
|
+
var item = props.item,
|
|
25
|
+
onCreateBlockSchema = props.onCreateBlockSchema,
|
|
26
|
+
componentType = props.componentType,
|
|
27
|
+
createBlockSchema = props.createBlockSchema,
|
|
28
|
+
insert = props.insert,
|
|
29
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
|
|
31
|
+
var _useSchemaTemplateMan = useSchemaTemplateManager(),
|
|
32
|
+
getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
|
|
33
|
+
|
|
34
|
+
var _useCollectionManager = useCollectionManager(),
|
|
35
|
+
getCollection = _useCollectionManager.getCollection;
|
|
36
|
+
|
|
37
|
+
var field = item.field;
|
|
38
|
+
var collection = getCollection(field.target);
|
|
39
|
+
var resource = "".concat(field.collectionName, ".").concat(field.name);
|
|
40
|
+
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
41
|
+
icon: /*#__PURE__*/React.createElement(FormOutlined, null)
|
|
42
|
+
}, others), {}, {
|
|
43
|
+
onClick: function () {
|
|
44
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
45
|
+
var item, s;
|
|
46
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
item = _ref.item;
|
|
51
|
+
|
|
52
|
+
if (!item.template) {
|
|
53
|
+
_context.next = 8;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_context.next = 4;
|
|
58
|
+
return getTemplateSchemaByMode(item);
|
|
59
|
+
|
|
60
|
+
case 4:
|
|
61
|
+
s = _context.sent;
|
|
62
|
+
insert(s);
|
|
63
|
+
_context.next = 9;
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
case 8:
|
|
67
|
+
insert(createDetailsBlockSchema({
|
|
68
|
+
collection: field.target,
|
|
69
|
+
resource: resource,
|
|
70
|
+
association: resource,
|
|
71
|
+
rowKey: collection.filterTargetKey || 'id'
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
case 9:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, _callee);
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
function onClick(_x) {
|
|
83
|
+
return _onClick.apply(this, arguments);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return onClick;
|
|
87
|
+
}(),
|
|
88
|
+
items: useRecordCollectionDataSourceItems('Details', item, field.target, resource)
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RecordAssociationFormBlockInitializer: (props: any) => JSX.Element;
|