@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/acl/ACLProvider.js +4 -7
- package/es/api-client/APIClient.js +6 -0
- package/es/block-provider/BlockProvider.js +9 -6
- package/es/block-provider/FormBlockProvider.js +3 -1
- package/es/block-provider/KanbanBlockProvider.js +1 -1
- package/es/block-provider/SharedFilterProvider.js +9 -1
- package/es/block-provider/TableBlockProvider.js +1 -1
- package/es/block-provider/TableSelectorProvider.js +2 -2
- package/es/block-provider/hooks/index.js +22 -7
- package/es/collection-manager/CollectionManagerProvider.d.ts +1 -0
- package/es/collection-manager/CollectionManagerProvider.js +71 -9
- package/es/collection-manager/CollectionManagerShortcut.js +36 -23
- package/es/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
- package/es/collection-manager/Configuration/AddCategoryAction.js +117 -0
- package/es/collection-manager/Configuration/AddCollectionAction.js +8 -3
- package/es/collection-manager/Configuration/AddFieldAction.js +1 -0
- package/es/collection-manager/Configuration/ConfigurationTable.js +33 -4
- package/es/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
- package/es/collection-manager/Configuration/ConfigurationTabs.js +381 -0
- package/es/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
- package/es/collection-manager/Configuration/EditCategoryAction.js +150 -0
- package/es/collection-manager/Configuration/EditCollectionAction.js +6 -2
- package/es/collection-manager/Configuration/OverridingCollectionField.js +17 -8
- package/es/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
- package/es/collection-manager/Configuration/components/CollectionCategory.js +13 -0
- package/es/collection-manager/Configuration/index.d.ts +3 -0
- package/es/collection-manager/Configuration/index.js +3 -0
- package/es/collection-manager/Configuration/schemas/collections.d.ts +3 -0
- package/es/collection-manager/Configuration/schemas/collections.js +309 -176
- package/es/collection-manager/Configuration/templates.d.ts +1 -0
- package/es/collection-manager/Configuration/templates.js +1 -1
- package/es/collection-manager/action-hooks.js +3 -1
- package/es/collection-manager/context.d.ts +4 -0
- package/es/collection-manager/context.js +5 -1
- package/es/collection-manager/hooks/useCollectionManager.d.ts +7 -0
- package/es/collection-manager/hooks/useCollectionManager.js +51 -6
- package/es/collection-manager/interfaces/m2m.js +2 -2
- package/es/collection-manager/interfaces/properties/index.d.ts +0 -56
- package/es/collection-manager/interfaces/properties/index.js +1 -2
- package/es/collection-manager/templates/calendar.js +1 -1
- package/es/collection-manager/templates/general.js +1 -1
- package/es/collection-manager/templates/properties/index.d.ts +12 -1
- package/es/collection-manager/templates/properties/index.js +11 -0
- package/es/i18n/i18n.js +3 -1
- package/es/locale/en_US.d.ts +23 -0
- package/es/locale/en_US.js +23 -0
- package/es/locale/ja_JP.d.ts +23 -0
- package/es/locale/ja_JP.js +24 -1
- package/es/locale/ru_RU.d.ts +1 -0
- package/es/locale/ru_RU.js +1 -0
- package/es/locale/zh_CN.d.ts +43 -4
- package/es/locale/zh_CN.js +44 -5
- package/es/route-switch/antd/admin-layout/index.js +13 -33
- package/es/schema-component/antd/action/Action.Designer.js +22 -15
- package/es/schema-component/antd/action/Action.js +25 -3
- package/es/schema-component/antd/action/utils.d.ts +1 -0
- package/es/schema-component/antd/action/utils.js +49 -0
- package/es/schema-component/antd/association-filter/AssociationFilter.js +4 -4
- package/es/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
- package/es/schema-component/antd/association-select/useServiceOptions.js +47 -6
- package/es/schema-component/antd/calendar/Calendar.Designer.js +17 -36
- package/es/schema-component/antd/checkbox/Checkbox.js +9 -8
- package/es/schema-component/antd/date-picker/util.d.ts +1 -1
- package/es/schema-component/antd/date-picker/util.js +1 -1
- package/es/schema-component/antd/filter/DynamicComponent.js +3 -1
- package/es/schema-component/antd/filter/Filter.js +2 -1
- package/es/schema-component/antd/filter/FilterGroup.js +7 -4
- package/es/schema-component/antd/filter/FilterItem.js +3 -2
- package/es/schema-component/antd/filter/context.d.ts +1 -0
- package/es/schema-component/antd/filter/useValues.js +14 -11
- package/es/schema-component/antd/form/Form.js +11 -5
- package/es/schema-component/antd/form-item/FormItem.js +17 -8
- package/es/schema-component/antd/form-v2/Form.Designer.js +2 -0
- package/es/schema-component/antd/form-v2/Form.js +90 -7
- package/es/schema-component/antd/form-v2/utils.d.ts +5 -0
- package/es/schema-component/antd/form-v2/utils.js +161 -0
- package/es/schema-component/antd/grid/Grid.js +10 -5
- package/es/schema-component/antd/icon-picker/IconPicker.js +1 -0
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.js +1 -0
- package/es/schema-component/antd/input/Input.d.ts +2 -1
- package/es/schema-component/antd/input/Json.d.ts +5 -3
- package/es/schema-component/antd/input/Json.js +3 -2
- package/es/schema-component/antd/input-number/InputNumber.js +3 -1
- package/es/schema-component/antd/page/FixedBlock.js +3 -1
- package/es/schema-component/antd/page/Page.js +11 -5
- package/es/schema-component/antd/page/PageTabDesigner.js +3 -3
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
- package/es/schema-component/antd/record-picker/RecordPicker.js +1 -2
- package/es/schema-component/antd/record-picker/util.js +7 -0
- package/es/schema-component/antd/remote-select/RemoteSelect.js +76 -36
- package/es/schema-component/antd/rich-text/RichText.js +4 -2
- package/es/schema-component/antd/select/Select.js +14 -4
- package/es/schema-component/antd/table/Table.Array.js +10 -3
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
- package/es/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
- package/es/schema-component/antd/tabs/Tabs.Designer.js +1 -0
- package/es/schema-component/antd/time-picker/TimePicker.js +1 -1
- package/es/schema-component/antd/variable/Input.d.ts +2 -0
- package/es/schema-component/antd/variable/Input.js +244 -0
- package/es/schema-component/antd/variable/JSONInput.d.ts +2 -0
- package/es/schema-component/antd/variable/JSONInput.js +82 -0
- package/es/schema-component/antd/variable/TextArea.d.ts +2 -0
- package/es/schema-component/antd/variable/TextArea.js +322 -0
- package/es/schema-component/antd/variable/Variable.d.ts +8 -0
- package/es/schema-component/antd/variable/Variable.js +11 -0
- package/es/schema-component/antd/variable/index.d.ts +1 -0
- package/es/schema-component/antd/variable/index.js +1 -0
- package/es/schema-component/common/sortable-item/SortableItem.js +36 -6
- package/es/schema-component/common/utils/logic.js +523 -0
- package/es/schema-component/common/utils/uitls.d.ts +1 -0
- package/es/schema-component/common/utils/uitls.js +89 -0
- package/es/schema-initializer/SchemaInitializer.js +0 -1
- package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
- package/es/schema-initializer/index.d.ts +2 -1
- package/es/schema-initializer/index.js +2 -1
- package/es/schema-initializer/items/CalendarBlockInitializer.js +24 -41
- package/es/schema-initializer/utils.js +22 -7
- package/es/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
- package/es/schema-settings/LinkageRules/DynamicComponent.js +113 -0
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +15 -0
- package/es/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
- package/es/schema-settings/LinkageRules/LinkageRuleAction.js +162 -0
- package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
- package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.js +71 -0
- package/es/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
- package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +82 -0
- package/es/schema-settings/LinkageRules/Variables.d.ts +7 -0
- package/es/schema-settings/LinkageRules/Variables.js +115 -0
- package/es/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
- package/es/schema-settings/LinkageRules/action-hooks.js +115 -0
- package/es/schema-settings/LinkageRules/context.d.ts +13 -0
- package/es/schema-settings/LinkageRules/context.js +4 -0
- package/es/schema-settings/LinkageRules/index.d.ts +2 -0
- package/es/schema-settings/LinkageRules/index.js +132 -0
- package/es/schema-settings/LinkageRules/type.d.ts +13 -0
- package/es/schema-settings/LinkageRules/type.js +15 -0
- package/es/schema-settings/LinkageRules/useValues.d.ts +1 -0
- package/es/schema-settings/LinkageRules/useValues.js +84 -0
- package/es/schema-settings/SchemaSettings.d.ts +4 -1
- package/es/schema-settings/SchemaSettings.js +153 -26
- package/es/schema-templates/BlockTemplate.js +9 -1
- package/es/system-settings/SystemSettingsShortcut.js +1 -1
- package/lib/acl/ACLProvider.js +4 -7
- package/lib/api-client/APIClient.js +6 -0
- package/lib/block-provider/BlockProvider.js +9 -6
- package/lib/block-provider/FormBlockProvider.js +3 -1
- package/lib/block-provider/KanbanBlockProvider.js +1 -1
- package/lib/block-provider/SharedFilterProvider.js +9 -3
- package/lib/block-provider/TableBlockProvider.js +1 -1
- package/lib/block-provider/TableSelectorProvider.js +2 -2
- package/lib/block-provider/hooks/index.js +23 -7
- package/lib/collection-manager/CollectionManagerProvider.d.ts +1 -0
- package/lib/collection-manager/CollectionManagerProvider.js +81 -16
- package/lib/collection-manager/CollectionManagerShortcut.js +36 -23
- package/lib/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
- package/lib/collection-manager/Configuration/AddCategoryAction.js +145 -0
- package/lib/collection-manager/Configuration/AddCollectionAction.js +8 -3
- package/lib/collection-manager/Configuration/AddFieldAction.js +1 -0
- package/lib/collection-manager/Configuration/ConfigurationTable.js +34 -4
- package/lib/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +407 -0
- package/lib/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
- package/lib/collection-manager/Configuration/EditCategoryAction.js +178 -0
- package/lib/collection-manager/Configuration/EditCollectionAction.js +6 -2
- package/lib/collection-manager/Configuration/OverridingCollectionField.js +17 -8
- package/lib/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
- package/lib/collection-manager/Configuration/components/CollectionCategory.js +27 -0
- package/lib/collection-manager/Configuration/index.d.ts +3 -0
- package/lib/collection-manager/Configuration/index.js +39 -0
- package/lib/collection-manager/Configuration/schemas/collections.d.ts +3 -0
- package/lib/collection-manager/Configuration/schemas/collections.js +316 -178
- package/lib/collection-manager/Configuration/templates.d.ts +1 -0
- package/lib/collection-manager/Configuration/templates.js +2 -0
- package/lib/collection-manager/action-hooks.js +3 -1
- package/lib/collection-manager/context.d.ts +4 -0
- package/lib/collection-manager/context.js +7 -2
- package/lib/collection-manager/hooks/useCollectionManager.d.ts +7 -0
- package/lib/collection-manager/hooks/useCollectionManager.js +52 -6
- package/lib/collection-manager/interfaces/m2m.js +2 -2
- package/lib/collection-manager/interfaces/properties/index.d.ts +0 -56
- package/lib/collection-manager/interfaces/properties/index.js +1 -2
- package/lib/collection-manager/templates/calendar.js +1 -1
- package/lib/collection-manager/templates/general.js +1 -1
- package/lib/collection-manager/templates/properties/index.d.ts +12 -1
- package/lib/collection-manager/templates/properties/index.js +11 -0
- package/lib/i18n/i18n.js +3 -1
- package/lib/locale/en_US.d.ts +23 -0
- package/lib/locale/en_US.js +23 -0
- package/lib/locale/ja_JP.d.ts +23 -0
- package/lib/locale/ja_JP.js +24 -1
- package/lib/locale/ru_RU.d.ts +1 -0
- package/lib/locale/ru_RU.js +1 -0
- package/lib/locale/zh_CN.d.ts +43 -4
- package/lib/locale/zh_CN.js +44 -5
- package/lib/route-switch/antd/admin-layout/index.js +13 -33
- package/lib/schema-component/antd/action/Action.Designer.js +24 -14
- package/lib/schema-component/antd/action/Action.js +27 -2
- package/lib/schema-component/antd/action/utils.d.ts +1 -0
- package/lib/schema-component/antd/action/utils.js +58 -2
- package/lib/schema-component/antd/association-filter/AssociationFilter.js +3 -3
- package/lib/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
- package/lib/schema-component/antd/association-select/useServiceOptions.js +47 -4
- package/lib/schema-component/antd/calendar/Calendar.Designer.js +15 -33
- package/lib/schema-component/antd/checkbox/Checkbox.js +8 -7
- package/lib/schema-component/antd/date-picker/util.d.ts +1 -1
- package/lib/schema-component/antd/date-picker/util.js +1 -1
- package/lib/schema-component/antd/filter/DynamicComponent.js +3 -1
- package/lib/schema-component/antd/filter/Filter.js +2 -1
- package/lib/schema-component/antd/filter/FilterGroup.js +7 -4
- package/lib/schema-component/antd/filter/FilterItem.js +3 -2
- package/lib/schema-component/antd/filter/context.d.ts +1 -0
- package/lib/schema-component/antd/filter/useValues.js +15 -11
- package/lib/schema-component/antd/form/Form.js +9 -3
- package/lib/schema-component/antd/form-item/FormItem.js +21 -7
- package/lib/schema-component/antd/form-v2/Form.Designer.js +2 -0
- package/lib/schema-component/antd/form-v2/Form.js +89 -5
- package/lib/schema-component/antd/form-v2/utils.d.ts +5 -0
- package/lib/schema-component/antd/form-v2/utils.js +181 -0
- package/lib/schema-component/antd/grid/Grid.js +10 -5
- package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -0
- package/lib/schema-component/antd/index.d.ts +1 -0
- package/lib/schema-component/antd/index.js +13 -0
- package/lib/schema-component/antd/input/Input.d.ts +2 -1
- package/lib/schema-component/antd/input/Json.d.ts +5 -3
- package/lib/schema-component/antd/input/Json.js +6 -3
- package/lib/schema-component/antd/input-number/InputNumber.js +2 -0
- package/lib/schema-component/antd/page/FixedBlock.js +3 -1
- package/lib/schema-component/antd/page/Page.js +14 -5
- package/lib/schema-component/antd/page/PageTabDesigner.js +1 -1
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
- package/lib/schema-component/antd/record-picker/RecordPicker.js +1 -2
- package/lib/schema-component/antd/record-picker/util.js +7 -0
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +76 -37
- package/lib/schema-component/antd/rich-text/RichText.js +4 -2
- package/lib/schema-component/antd/select/Select.js +14 -4
- package/lib/schema-component/antd/table/Table.Array.js +8 -1
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
- package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
- package/lib/schema-component/antd/tabs/Tabs.Designer.js +1 -0
- package/lib/schema-component/antd/time-picker/TimePicker.js +1 -1
- package/lib/schema-component/antd/variable/Input.d.ts +2 -0
- package/lib/schema-component/antd/variable/Input.js +262 -0
- package/lib/schema-component/antd/variable/JSONInput.d.ts +2 -0
- package/lib/schema-component/antd/variable/JSONInput.js +100 -0
- package/lib/schema-component/antd/variable/TextArea.d.ts +2 -0
- package/lib/schema-component/antd/variable/TextArea.js +341 -0
- package/lib/schema-component/antd/variable/Variable.d.ts +8 -0
- package/lib/schema-component/antd/variable/Variable.js +25 -0
- package/lib/schema-component/antd/variable/index.d.ts +1 -0
- package/lib/schema-component/antd/variable/index.js +18 -0
- package/lib/schema-component/common/sortable-item/SortableItem.js +36 -6
- package/lib/schema-component/common/utils/logic.js +525 -0
- package/lib/schema-component/common/utils/uitls.d.ts +1 -0
- package/lib/schema-component/common/utils/uitls.js +103 -0
- package/lib/schema-initializer/SchemaInitializer.js +0 -1
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
- package/lib/schema-initializer/index.d.ts +2 -1
- package/lib/schema-initializer/index.js +51 -2
- package/lib/schema-initializer/items/CalendarBlockInitializer.js +16 -33
- package/lib/schema-initializer/utils.js +22 -6
- package/lib/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/DynamicComponent.js +139 -0
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +27 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +190 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.js +90 -0
- package/lib/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +104 -0
- package/lib/schema-settings/LinkageRules/Variables.d.ts +7 -0
- package/lib/schema-settings/LinkageRules/Variables.js +124 -0
- package/lib/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/action-hooks.js +127 -0
- package/lib/schema-settings/LinkageRules/context.d.ts +13 -0
- package/lib/schema-settings/LinkageRules/context.js +15 -0
- package/lib/schema-settings/LinkageRules/index.d.ts +2 -0
- package/lib/schema-settings/LinkageRules/index.js +149 -0
- package/lib/schema-settings/LinkageRules/type.d.ts +13 -0
- package/lib/schema-settings/LinkageRules/type.js +22 -0
- package/lib/schema-settings/LinkageRules/useValues.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/useValues.js +95 -0
- package/lib/schema-settings/SchemaSettings.d.ts +4 -1
- package/lib/schema-settings/SchemaSettings.js +176 -48
- package/lib/schema-templates/BlockTemplate.js +9 -1
- package/lib/system-settings/SystemSettingsShortcut.js +1 -1
- package/package.json +4 -4
|
@@ -5,20 +5,55 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
gridRowColWrap: true,
|
|
8
|
-
useRecordCollectionDataSourceItems: true
|
|
8
|
+
useRecordCollectionDataSourceItems: true,
|
|
9
|
+
createTableBlockSchema: true,
|
|
10
|
+
useAssociatedTableColumnInitializerFields: true,
|
|
11
|
+
useInheritsTableColumnInitializerFields: true,
|
|
12
|
+
useTableColumnInitializerFields: true,
|
|
13
|
+
itemsMerge: true
|
|
9
14
|
};
|
|
15
|
+
Object.defineProperty(exports, "createTableBlockSchema", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function get() {
|
|
18
|
+
return _utils.createTableBlockSchema;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
10
21
|
Object.defineProperty(exports, "gridRowColWrap", {
|
|
11
22
|
enumerable: true,
|
|
12
23
|
get: function get() {
|
|
13
24
|
return _utils.gridRowColWrap;
|
|
14
25
|
}
|
|
15
26
|
});
|
|
27
|
+
Object.defineProperty(exports, "itemsMerge", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function get() {
|
|
30
|
+
return _utils.itemsMerge;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "useAssociatedTableColumnInitializerFields", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function get() {
|
|
36
|
+
return _utils.useAssociatedTableColumnInitializerFields;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "useInheritsTableColumnInitializerFields", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function get() {
|
|
42
|
+
return _utils.useInheritsTableColumnInitializerFields;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
16
45
|
Object.defineProperty(exports, "useRecordCollectionDataSourceItems", {
|
|
17
46
|
enumerable: true,
|
|
18
47
|
get: function get() {
|
|
19
48
|
return _utils.useRecordCollectionDataSourceItems;
|
|
20
49
|
}
|
|
21
50
|
});
|
|
51
|
+
Object.defineProperty(exports, "useTableColumnInitializerFields", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _utils.useTableColumnInitializerFields;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
22
57
|
|
|
23
58
|
var _SchemaInitializer = require("./SchemaInitializer");
|
|
24
59
|
|
|
@@ -76,4 +111,18 @@ Object.keys(_items).forEach(function (key) {
|
|
|
76
111
|
});
|
|
77
112
|
});
|
|
78
113
|
|
|
79
|
-
var _utils = require("./utils");
|
|
114
|
+
var _utils = require("./utils");
|
|
115
|
+
|
|
116
|
+
var _buttons = require("./buttons");
|
|
117
|
+
|
|
118
|
+
Object.keys(_buttons).forEach(function (key) {
|
|
119
|
+
if (key === "default" || key === "__esModule") return;
|
|
120
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
121
|
+
if (key in exports && exports[key] === _buttons[key]) return;
|
|
122
|
+
Object.defineProperty(exports, key, {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function get() {
|
|
125
|
+
return _buttons[key];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -46,44 +46,27 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
46
46
|
t = _useTranslation.t;
|
|
47
47
|
|
|
48
48
|
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
49
|
-
|
|
49
|
+
getCollectionField = _useCollectionManager.getCollectionField,
|
|
50
|
+
getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
|
|
50
51
|
|
|
52
|
+
_collectionManager.useCollectionManager;
|
|
51
53
|
var options = (0, _react.useContext)(_react2.SchemaOptionsContext);
|
|
52
54
|
return /*#__PURE__*/_react.default.createElement(_DataBlockInitializer.DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
53
55
|
componentType: 'Calendar',
|
|
54
56
|
icon: /*#__PURE__*/_react.default.createElement(_icons.FormOutlined, null),
|
|
55
57
|
onCreateBlockSchema: function () {
|
|
56
58
|
var _onCreateBlockSchema = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
var item, collectionFields, stringFields, dateFields, values;
|
|
59
|
+
var item, stringFieldsOptions, dateFieldsOptions, values;
|
|
60
60
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
61
61
|
while (1) {
|
|
62
62
|
switch (_context.prev = _context.next) {
|
|
63
63
|
case 0:
|
|
64
64
|
item = _ref.item;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})) === null || _collectionFields$fil === void 0 ? void 0 : _collectionFields$fil.map(function (field) {
|
|
69
|
-
var _field$uiSchema;
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
label: field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title,
|
|
73
|
-
value: field.name
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
dateFields = collectionFields === null || collectionFields === void 0 ? void 0 : (_collectionFields$fil2 = collectionFields.filter(function (field) {
|
|
77
|
-
return field.type === 'date';
|
|
78
|
-
})) === null || _collectionFields$fil2 === void 0 ? void 0 : _collectionFields$fil2.map(function (field) {
|
|
79
|
-
var _field$uiSchema2;
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
label: field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title,
|
|
83
|
-
value: field.name
|
|
84
|
-
};
|
|
65
|
+
stringFieldsOptions = getCollectionFieldsOptions(item.name, 'string');
|
|
66
|
+
dateFieldsOptions = getCollectionFieldsOptions(item.name, 'date', {
|
|
67
|
+
association: ['o2o', 'obo', 'oho', 'm2o']
|
|
85
68
|
});
|
|
86
|
-
_context.next =
|
|
69
|
+
_context.next = 5;
|
|
87
70
|
return (0, _antd.FormDialog)(t('Create calendar block'), function () {
|
|
88
71
|
return /*#__PURE__*/_react.default.createElement(_schemaComponent.SchemaComponentOptions, {
|
|
89
72
|
scope: options.scope,
|
|
@@ -95,23 +78,23 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
95
78
|
properties: {
|
|
96
79
|
title: {
|
|
97
80
|
title: t('Title field'),
|
|
98
|
-
enum:
|
|
81
|
+
enum: stringFieldsOptions,
|
|
99
82
|
required: true,
|
|
100
83
|
'x-component': 'Select',
|
|
101
84
|
'x-decorator': 'FormItem'
|
|
102
85
|
},
|
|
103
86
|
start: {
|
|
104
87
|
title: t('Start date field'),
|
|
105
|
-
enum:
|
|
88
|
+
enum: dateFieldsOptions,
|
|
106
89
|
required: true,
|
|
107
|
-
default: 'createdAt',
|
|
108
|
-
'x-component': '
|
|
90
|
+
default: getCollectionField("".concat(item.name, ".createdAt")) ? 'createdAt' : null,
|
|
91
|
+
'x-component': 'Cascader',
|
|
109
92
|
'x-decorator': 'FormItem'
|
|
110
93
|
},
|
|
111
94
|
end: {
|
|
112
95
|
title: t('End date field'),
|
|
113
|
-
enum:
|
|
114
|
-
'x-component': '
|
|
96
|
+
enum: dateFieldsOptions,
|
|
97
|
+
'x-component': 'Cascader',
|
|
115
98
|
'x-decorator': 'FormItem'
|
|
116
99
|
}
|
|
117
100
|
}
|
|
@@ -121,14 +104,14 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
121
104
|
initialValues: {}
|
|
122
105
|
});
|
|
123
106
|
|
|
124
|
-
case
|
|
107
|
+
case 5:
|
|
125
108
|
values = _context.sent;
|
|
126
109
|
insert((0, _utils.createCalendarBlockSchema)({
|
|
127
110
|
collection: item.name,
|
|
128
111
|
fieldNames: _objectSpread({}, values)
|
|
129
112
|
}));
|
|
130
113
|
|
|
131
|
-
case
|
|
114
|
+
case 7:
|
|
132
115
|
case "end":
|
|
133
116
|
return _context.stop();
|
|
134
117
|
}
|
|
@@ -15,6 +15,8 @@ var _react2 = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _reactI18next = require("react-i18next");
|
|
17
17
|
|
|
18
|
+
var _ = require("../");
|
|
19
|
+
|
|
18
20
|
var _collectionManager = require("../collection-manager");
|
|
19
21
|
|
|
20
22
|
var _schemaComponent = require("../schema-component");
|
|
@@ -26,7 +28,7 @@ var _SelectCollection = require("./SelectCollection");
|
|
|
26
28
|
var _excluded = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
|
|
27
29
|
_excluded2 = ["formItemInitializers", "actionInitializers", "collection", "resource", "association", "action", "template"],
|
|
28
30
|
_excluded3 = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
|
|
29
|
-
_excluded4 = ["collection", "resource", "rowKey"],
|
|
31
|
+
_excluded4 = ["collection", "resource", "rowKey", "tableActionInitializers", "tableColumnInitializers", "tableActionColumnInitializers", "tableBlockProvider", "disableTemplate"],
|
|
30
32
|
_excluded5 = ["collection", "resource", "rowKey"],
|
|
31
33
|
_excluded6 = ["collection", "resource", "fieldNames"],
|
|
32
34
|
_excluded7 = ["collection", "resource", "groupField"];
|
|
@@ -669,10 +671,18 @@ var useCurrentSchema = function useCurrentSchema(action, key) {
|
|
|
669
671
|
_remove = _useDesignable.remove;
|
|
670
672
|
|
|
671
673
|
var schema = find(fieldSchema, key, action);
|
|
674
|
+
var ctx = (0, _react2.useContext)(_.BlockRequestContext);
|
|
675
|
+
var exists = !!schema;
|
|
672
676
|
return {
|
|
673
677
|
schema: schema,
|
|
674
678
|
exists: !!schema,
|
|
675
679
|
remove: function remove() {
|
|
680
|
+
if (ctx.field) {
|
|
681
|
+
ctx.field.data = ctx.field.data || {};
|
|
682
|
+
ctx.field.data.activeFields = ctx.field.data.activeFields || new Set();
|
|
683
|
+
ctx.field.data.activeFields.delete(schema.name);
|
|
684
|
+
}
|
|
685
|
+
|
|
676
686
|
schema && rm(schema, _remove);
|
|
677
687
|
}
|
|
678
688
|
};
|
|
@@ -1059,11 +1069,16 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
1059
1069
|
var collection = options.collection,
|
|
1060
1070
|
resource = options.resource,
|
|
1061
1071
|
rowKey = options.rowKey,
|
|
1072
|
+
tableActionInitializers = options.tableActionInitializers,
|
|
1073
|
+
tableColumnInitializers = options.tableColumnInitializers,
|
|
1074
|
+
tableActionColumnInitializers = options.tableActionColumnInitializers,
|
|
1075
|
+
tableBlockProvider = options.tableBlockProvider,
|
|
1076
|
+
disableTemplate = options.disableTemplate,
|
|
1062
1077
|
others = _objectWithoutProperties(options, _excluded4);
|
|
1063
1078
|
|
|
1064
1079
|
var schema = {
|
|
1065
1080
|
type: 'void',
|
|
1066
|
-
'x-decorator': 'TableBlockProvider',
|
|
1081
|
+
'x-decorator': tableBlockProvider !== null && tableBlockProvider !== void 0 ? tableBlockProvider : 'TableBlockProvider',
|
|
1067
1082
|
'x-acl-action': "".concat(resource || collection, ":list"),
|
|
1068
1083
|
'x-decorator-props': _objectSpread({
|
|
1069
1084
|
collection: collection,
|
|
@@ -1074,14 +1089,15 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
1074
1089
|
},
|
|
1075
1090
|
rowKey: rowKey,
|
|
1076
1091
|
showIndex: true,
|
|
1077
|
-
dragSort: false
|
|
1092
|
+
dragSort: false,
|
|
1093
|
+
disableTemplate: disableTemplate !== null && disableTemplate !== void 0 ? disableTemplate : false
|
|
1078
1094
|
}, others),
|
|
1079
1095
|
'x-designer': 'TableBlockDesigner',
|
|
1080
1096
|
'x-component': 'CardItem',
|
|
1081
1097
|
properties: _defineProperty({
|
|
1082
1098
|
actions: {
|
|
1083
1099
|
type: 'void',
|
|
1084
|
-
'x-initializer': 'TableActionInitializers',
|
|
1100
|
+
'x-initializer': tableActionInitializers !== null && tableActionInitializers !== void 0 ? tableActionInitializers : 'TableActionInitializers',
|
|
1085
1101
|
'x-component': 'ActionBar',
|
|
1086
1102
|
'x-component-props': {
|
|
1087
1103
|
style: {
|
|
@@ -1092,7 +1108,7 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
1092
1108
|
}
|
|
1093
1109
|
}, (0, _shared.uid)(), {
|
|
1094
1110
|
type: 'array',
|
|
1095
|
-
'x-initializer': 'TableColumnInitializers',
|
|
1111
|
+
'x-initializer': tableColumnInitializers !== null && tableColumnInitializers !== void 0 ? tableColumnInitializers : 'TableColumnInitializers',
|
|
1096
1112
|
'x-component': 'TableV2',
|
|
1097
1113
|
'x-component-props': {
|
|
1098
1114
|
rowKey: 'id',
|
|
@@ -1109,7 +1125,7 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
1109
1125
|
'x-decorator': 'TableV2.Column.ActionBar',
|
|
1110
1126
|
'x-component': 'TableV2.Column',
|
|
1111
1127
|
'x-designer': 'TableV2.ActionColumnDesigner',
|
|
1112
|
-
'x-initializer': 'TableActionColumnInitializers',
|
|
1128
|
+
'x-initializer': tableActionColumnInitializers !== null && tableActionColumnInitializers !== void 0 ? tableActionColumnInitializers : 'TableActionColumnInitializers',
|
|
1113
1129
|
properties: {
|
|
1114
1130
|
actions: {
|
|
1115
1131
|
type: 'void',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DynamicComponent: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DynamicComponent = void 0;
|
|
9
|
+
|
|
10
|
+
var _css = require("@emotion/css");
|
|
11
|
+
|
|
12
|
+
var _core = require("@formily/core");
|
|
13
|
+
|
|
14
|
+
var _react = require("@formily/react");
|
|
15
|
+
|
|
16
|
+
var _shared = require("@formily/shared");
|
|
17
|
+
|
|
18
|
+
var _antd = require("antd");
|
|
19
|
+
|
|
20
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _core2 = require("../../schema-component/core");
|
|
23
|
+
|
|
24
|
+
var _hooks = require("../../schema-component/hooks");
|
|
25
|
+
|
|
26
|
+
var _context = require("./context");
|
|
27
|
+
|
|
28
|
+
var _useFilterActionProps = require("../../schema-component/antd/filter/useFilterActionProps");
|
|
29
|
+
|
|
30
|
+
var _templateObject;
|
|
31
|
+
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
43
|
+
|
|
44
|
+
var VariableCascader = (0, _react.connect)(function (props) {
|
|
45
|
+
var fields = (0, _useFilterActionProps.useFilterOptions)('users');
|
|
46
|
+
var compile = (0, _hooks.useCompile)();
|
|
47
|
+
var value = props.value,
|
|
48
|
+
_onChange = props.onChange;
|
|
49
|
+
return /*#__PURE__*/_react2.default.createElement(_antd.Cascader, {
|
|
50
|
+
className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 160px;\n "]))),
|
|
51
|
+
value: value ? value.split('.') : [],
|
|
52
|
+
fieldNames: {
|
|
53
|
+
label: 'title',
|
|
54
|
+
value: 'name',
|
|
55
|
+
children: 'children'
|
|
56
|
+
},
|
|
57
|
+
onChange: function onChange(value) {
|
|
58
|
+
_onChange(value ? value.join('.') : null);
|
|
59
|
+
},
|
|
60
|
+
options: compile([{
|
|
61
|
+
title: '{{t("Current user")}}',
|
|
62
|
+
name: 'currentUser',
|
|
63
|
+
children: fields.filter(function (field) {
|
|
64
|
+
if (!field.target) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return field.type === 'belongsTo';
|
|
69
|
+
}).map(function (field) {
|
|
70
|
+
if (field.children) {
|
|
71
|
+
field.children = field.children.filter(function (child) {
|
|
72
|
+
return !child.target;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return field;
|
|
77
|
+
})
|
|
78
|
+
}])
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
var DynamicComponent = function DynamicComponent(props) {
|
|
83
|
+
var _ref = (0, _react2.useContext)(_context.FilterContext) || {},
|
|
84
|
+
dynamicComponent = _ref.dynamicComponent,
|
|
85
|
+
disabled = _ref.disabled;
|
|
86
|
+
|
|
87
|
+
var component = (0, _hooks.useComponent)(dynamicComponent);
|
|
88
|
+
var form = (0, _react2.useMemo)(function () {
|
|
89
|
+
return (0, _core.createForm)({
|
|
90
|
+
values: {
|
|
91
|
+
value: props.value
|
|
92
|
+
},
|
|
93
|
+
disabled: disabled,
|
|
94
|
+
effects: function effects() {
|
|
95
|
+
(0, _core.onFieldValueChange)('value', function (field) {
|
|
96
|
+
var _props$onChange;
|
|
97
|
+
|
|
98
|
+
props === null || props === void 0 ? void 0 : (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, field.value);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}, [JSON.stringify(props.schema), JSON.stringify(props.value)]);
|
|
103
|
+
|
|
104
|
+
var renderSchemaComponent = function renderSchemaComponent() {
|
|
105
|
+
var _props$schema;
|
|
106
|
+
|
|
107
|
+
return /*#__PURE__*/_react2.default.createElement(_react.FieldContext.Provider, {
|
|
108
|
+
value: null
|
|
109
|
+
}, /*#__PURE__*/_react2.default.createElement(_core2.SchemaComponent, {
|
|
110
|
+
schema: _objectSpread(_objectSpread({
|
|
111
|
+
'x-component': 'Input'
|
|
112
|
+
}, props.schema), {}, {
|
|
113
|
+
'x-component-props': (0, _shared.merge)((props === null || props === void 0 ? void 0 : (_props$schema = props.schema) === null || _props$schema === void 0 ? void 0 : _props$schema['x-component-props']) || {}, {
|
|
114
|
+
style: {
|
|
115
|
+
minWidth: 150,
|
|
116
|
+
width: '100%'
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
name: 'value',
|
|
120
|
+
'x-read-pretty': false,
|
|
121
|
+
'x-validator': undefined,
|
|
122
|
+
'x-decorator': undefined
|
|
123
|
+
}),
|
|
124
|
+
components: {
|
|
125
|
+
VariableCascader: VariableCascader
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return /*#__PURE__*/_react2.default.createElement(_react.FormContext.Provider, {
|
|
131
|
+
value: form
|
|
132
|
+
}, component ? /*#__PURE__*/_react2.default.createElement(component, {
|
|
133
|
+
value: props.value,
|
|
134
|
+
onChange: props === null || props === void 0 ? void 0 : props.onChange,
|
|
135
|
+
renderSchemaComponent: renderSchemaComponent
|
|
136
|
+
}) : renderSchemaComponent());
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
exports.DynamicComponent = DynamicComponent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FilterDynamicComponent = FilterDynamicComponent;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _schemaComponent = require("../../schema-component");
|
|
11
|
+
|
|
12
|
+
var _Variables = require("./Variables");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function FilterDynamicComponent(props) {
|
|
17
|
+
var value = props.value,
|
|
18
|
+
onChange = props.onChange,
|
|
19
|
+
renderSchemaComponent = props.renderSchemaComponent,
|
|
20
|
+
collectionName = props.collectionName;
|
|
21
|
+
var scope = (0, _Variables.useVariableOptions)(collectionName);
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_schemaComponent.Variable.Input, {
|
|
23
|
+
value: value,
|
|
24
|
+
onChange: onChange,
|
|
25
|
+
scope: scope
|
|
26
|
+
}, renderSchemaComponent());
|
|
27
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const FormFieldLinkageRuleAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
3
|
+
export declare const FormButtonLinkageRuleAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.FormFieldLinkageRuleAction = exports.FormButtonLinkageRuleAction = void 0;
|
|
9
|
+
|
|
10
|
+
var _icons = require("@ant-design/icons");
|
|
11
|
+
|
|
12
|
+
var _css = require("@emotion/css");
|
|
13
|
+
|
|
14
|
+
var _react = require("@formily/react");
|
|
15
|
+
|
|
16
|
+
var _antd = require("@formily/antd");
|
|
17
|
+
|
|
18
|
+
var _antd2 = require("antd");
|
|
19
|
+
|
|
20
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _reactI18next = require("react-i18next");
|
|
23
|
+
|
|
24
|
+
var _ = require("../..");
|
|
25
|
+
|
|
26
|
+
var _context = require("./context");
|
|
27
|
+
|
|
28
|
+
var _DynamicComponent = require("./DynamicComponent");
|
|
29
|
+
|
|
30
|
+
var _useValues3 = require("./useValues");
|
|
31
|
+
|
|
32
|
+
var _type = require("./type");
|
|
33
|
+
|
|
34
|
+
var _ValueDynamicComponent = require("./ValueDynamicComponent");
|
|
35
|
+
|
|
36
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
37
|
+
|
|
38
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
|
+
|
|
40
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
|
+
|
|
42
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
|
+
|
|
44
|
+
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."); }
|
|
45
|
+
|
|
46
|
+
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); }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
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; }
|
|
51
|
+
|
|
52
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
53
|
+
|
|
54
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
55
|
+
|
|
56
|
+
var FormFieldLinkageRuleAction = (0, _react.observer)(function (props) {
|
|
57
|
+
var value = props.value,
|
|
58
|
+
options = props.options,
|
|
59
|
+
collectionName = props.collectionName;
|
|
60
|
+
|
|
61
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
62
|
+
t = _useTranslation.t;
|
|
63
|
+
|
|
64
|
+
var compile = (0, _.useCompile)();
|
|
65
|
+
var remove = (0, _react2.useContext)(_context.RemoveActionContext);
|
|
66
|
+
|
|
67
|
+
var _useValues = (0, _useValues3.useValues)(options),
|
|
68
|
+
schema = _useValues.schema,
|
|
69
|
+
fields = _useValues.fields,
|
|
70
|
+
operator = _useValues.operator,
|
|
71
|
+
setDataIndex = _useValues.setDataIndex,
|
|
72
|
+
setOperator = _useValues.setOperator,
|
|
73
|
+
setValue = _useValues.setValue,
|
|
74
|
+
fieldValue = _useValues.value,
|
|
75
|
+
operators = _useValues.operators;
|
|
76
|
+
|
|
77
|
+
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
78
|
+
style: {
|
|
79
|
+
marginBottom: 8
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/_react2.default.createElement(_antd2.Space, {
|
|
82
|
+
className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-space-item {\n max-width: 95%;\n }\n "])))
|
|
83
|
+
}, /*#__PURE__*/_react2.default.createElement(_antd.TreeSelect, {
|
|
84
|
+
className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 160px;\n "]))),
|
|
85
|
+
fieldNames: {
|
|
86
|
+
label: 'title',
|
|
87
|
+
value: 'name',
|
|
88
|
+
children: 'children'
|
|
89
|
+
},
|
|
90
|
+
treeCheckable: true,
|
|
91
|
+
value: value === null || value === void 0 ? void 0 : value.targetFields,
|
|
92
|
+
multiple: true,
|
|
93
|
+
allowClear: true,
|
|
94
|
+
treeData: compile(fields),
|
|
95
|
+
onChange: function onChange(value) {
|
|
96
|
+
console.log(value);
|
|
97
|
+
setDataIndex(value);
|
|
98
|
+
},
|
|
99
|
+
placeholder: t('Select Field')
|
|
100
|
+
}), /*#__PURE__*/_react2.default.createElement(_antd2.Select, {
|
|
101
|
+
value: operator,
|
|
102
|
+
className: (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 120px;\n "]))),
|
|
103
|
+
options: compile(operators),
|
|
104
|
+
onChange: function onChange(value) {
|
|
105
|
+
setOperator(value);
|
|
106
|
+
},
|
|
107
|
+
placeholder: t('action')
|
|
108
|
+
}), [_type.ActionType.Value].includes(operator) && /*#__PURE__*/_react2.default.createElement(_ValueDynamicComponent.ValueDynamicComponent, {
|
|
109
|
+
fieldValue: fieldValue,
|
|
110
|
+
schema: schema,
|
|
111
|
+
setValue: setValue,
|
|
112
|
+
collectionName: collectionName
|
|
113
|
+
}), !props.disabled && /*#__PURE__*/_react2.default.createElement("a", null, /*#__PURE__*/_react2.default.createElement(_icons.CloseCircleOutlined, {
|
|
114
|
+
onClick: function onClick() {
|
|
115
|
+
return remove();
|
|
116
|
+
},
|
|
117
|
+
style: {
|
|
118
|
+
color: '#bfbfbf'
|
|
119
|
+
}
|
|
120
|
+
}))));
|
|
121
|
+
});
|
|
122
|
+
exports.FormFieldLinkageRuleAction = FormFieldLinkageRuleAction;
|
|
123
|
+
var FormButtonLinkageRuleAction = (0, _react.observer)(function (props) {
|
|
124
|
+
var value = props.value,
|
|
125
|
+
options = props.options;
|
|
126
|
+
|
|
127
|
+
var _useTranslation2 = (0, _reactI18next.useTranslation)(),
|
|
128
|
+
t = _useTranslation2.t;
|
|
129
|
+
|
|
130
|
+
var compile = (0, _.useCompile)();
|
|
131
|
+
|
|
132
|
+
var _useState = (0, _react2.useState)(false),
|
|
133
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
134
|
+
editFalg = _useState2[0],
|
|
135
|
+
setEditFlag = _useState2[1];
|
|
136
|
+
|
|
137
|
+
var remove = (0, _react2.useContext)(_context.RemoveActionContext);
|
|
138
|
+
|
|
139
|
+
var _useValues2 = (0, _useValues3.useValues)(options),
|
|
140
|
+
schema = _useValues2.schema,
|
|
141
|
+
operator = _useValues2.operator,
|
|
142
|
+
setOperator = _useValues2.setOperator,
|
|
143
|
+
setValue = _useValues2.setValue;
|
|
144
|
+
|
|
145
|
+
var operators = [{
|
|
146
|
+
label: t('Visible'),
|
|
147
|
+
value: _type.ActionType.Visible,
|
|
148
|
+
schema: {}
|
|
149
|
+
}, {
|
|
150
|
+
label: t('Hidden'),
|
|
151
|
+
value: _type.ActionType.Hidden,
|
|
152
|
+
schema: {}
|
|
153
|
+
}, {
|
|
154
|
+
label: t('Disabled'),
|
|
155
|
+
value: _type.ActionType.Disabled,
|
|
156
|
+
schema: {}
|
|
157
|
+
}, {
|
|
158
|
+
label: t('Enabled'),
|
|
159
|
+
value: _type.ActionType.Active,
|
|
160
|
+
schema: {}
|
|
161
|
+
}];
|
|
162
|
+
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
163
|
+
style: {
|
|
164
|
+
marginBottom: 8
|
|
165
|
+
}
|
|
166
|
+
}, /*#__PURE__*/_react2.default.createElement(_antd2.Space, null, /*#__PURE__*/_react2.default.createElement(_antd2.Select, {
|
|
167
|
+
value: operator,
|
|
168
|
+
options: compile(operators),
|
|
169
|
+
onChange: function onChange(value) {
|
|
170
|
+
var flag = [_type.ActionType.Value].includes(value);
|
|
171
|
+
setEditFlag(flag);
|
|
172
|
+
setOperator(value);
|
|
173
|
+
},
|
|
174
|
+
placeholder: t('action')
|
|
175
|
+
}), editFalg && /*#__PURE__*/_react2.default.createElement(_DynamicComponent.DynamicComponent, {
|
|
176
|
+
value: value,
|
|
177
|
+
schema: schema,
|
|
178
|
+
onChange: function onChange(value) {
|
|
179
|
+
setValue(value);
|
|
180
|
+
}
|
|
181
|
+
}), !props.disabled && /*#__PURE__*/_react2.default.createElement("a", null, /*#__PURE__*/_react2.default.createElement(_icons.CloseCircleOutlined, {
|
|
182
|
+
onClick: function onClick() {
|
|
183
|
+
return remove();
|
|
184
|
+
},
|
|
185
|
+
style: {
|
|
186
|
+
color: '#bfbfbf'
|
|
187
|
+
}
|
|
188
|
+
}))));
|
|
189
|
+
});
|
|
190
|
+
exports.FormButtonLinkageRuleAction = FormButtonLinkageRuleAction;
|