@tachybase/client 0.23.48 → 1.0.6
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/api-client/APIClient.d.ts +5 -2
- package/es/api-client/APIClient.mjs +93 -49
- package/es/api-client/hooks/useRequest.d.ts +2 -0
- package/es/application/Application.d.ts +6 -0
- package/es/application/Application.mjs +19 -0
- package/es/application/CustomRouterContextProvider.d.ts +54 -0
- package/es/application/CustomRouterContextProvider.mjs +209 -0
- package/es/application/RouterManager.d.ts +8 -3
- package/es/application/RouterManager.mjs +48 -15
- package/es/application/hooks/index.d.ts +1 -0
- package/es/application/hooks/index.mjs +1 -0
- package/es/application/hooks/useGlobalVariable.d.ts +1 -0
- package/es/application/hooks/useGlobalVariable.mjs +18 -0
- package/es/application/schema-initializer/context/index.d.ts +1 -1
- package/es/application/schema-settings/hooks/index.d.ts +1 -1
- package/es/application/schema-settings/hooks/index.mjs +6 -8
- package/es/block-provider/hooks/index.d.ts +2 -0
- package/es/block-provider/hooks/index.mjs +29 -22
- package/es/built-in/context-menu/ContextMenu.provider.mjs +6 -6
- package/es/built-in/context-menu/ContextMenuItemsProps.d.ts +4 -4
- package/es/built-in/context-menu/ContextMenuItemsProps.mjs +6 -6
- package/es/built-in/context-menu/index.mjs +1 -1
- package/es/built-in/context-menu/useContextMenu.d.ts +2 -2
- package/es/built-in/index.mjs +8 -0
- package/es/built-in/locale/LocalePlugin.mjs +5 -1
- package/es/built-in/page-style/PageStyle.provider.mjs +2 -2
- package/es/built-in/system-settings/SystemSettingsProvider.d.ts +2 -3
- package/es/built-in/system-settings/SystemSettingsProvider.mjs +4 -3
- package/es/built-in/system-settings/SystemSettingsShortcut.mjs +11 -8
- package/es/collection-manager/Configuration/AddCollectionAction.mjs +12 -2
- package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.d.ts +2 -0
- package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.mjs +255 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.d.ts +89 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.mjs +96 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.d.ts +3 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.mjs +47 -0
- package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.d.ts +3 -0
- package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.mjs +44 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.mjs +380 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.d.ts +8 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.mjs +4 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.mjs +187 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.mjs +30 -0
- package/es/collection-manager/collectionPlugin.mjs +3 -1
- package/es/collection-manager/templates/import.mjs +1 -1
- package/es/collection-manager/templates/sql.d.ts +1 -1
- package/es/collection-manager/templates/view.d.ts +1 -1
- package/es/collection-manager/templates/xlsx.d.ts +11 -0
- package/es/collection-manager/templates/xlsx.mjs +19 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterface.d.ts +1 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +18 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.d.ts +8 -1
- package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.mjs +20 -0
- package/es/data-source/commonsSettingsItem/fieldComponent.mjs +3 -1
- package/es/data-source/data-source/DataSource.d.ts +1 -1
- package/es/filter-provider/utils.mjs +6 -0
- package/es/i18n/i18n.mjs +7 -12
- package/es/modules/actions/delete/deleteActionSettings.mjs +10 -0
- package/es/modules/blocks/data-blocks/form/FilterItemCustomSettings.mjs +1 -1
- package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +9 -4
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +6 -4
- package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +4 -0
- package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +44 -0
- package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +4 -0
- package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +9 -0
- package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +0 -4
- package/es/modules/fields/component/SubTable/secondLevelSelect.d.ts +11 -0
- package/es/modules/fields/component/SubTable/secondLevelSelect.mjs +102 -0
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +79 -41
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +103 -100
- package/es/powered-by/index.mjs +4 -7
- package/es/schema-component/antd/action/Action.Designer.mjs +43 -5
- package/es/schema-component/antd/action/Action.Modal.mjs +19 -31
- package/es/schema-component/antd/action/Action.Modal.style.d.ts +4 -0
- package/es/schema-component/antd/action/Action.Modal.style.mjs +35 -0
- package/es/schema-component/antd/action/Action.mjs +1 -3
- package/es/schema-component/antd/action/utils.d.ts +1 -1
- package/es/schema-component/antd/action/utils.mjs +70 -70
- package/es/schema-component/antd/association-field/SubTabs/InternalCollapse.mjs +2 -1
- package/es/schema-component/antd/checkbox/Checkbox.mjs +9 -2
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.mjs +1 -0
- package/es/schema-component/antd/media-card/MediaCard.d.ts +11 -0
- package/es/schema-component/antd/media-card/MediaCard.mjs +35 -0
- package/es/schema-component/antd/media-card/index.d.ts +1 -0
- package/es/schema-component/antd/media-card/index.mjs +1 -0
- package/es/schema-component/antd/media-card/style.d.ts +3 -0
- package/es/schema-component/antd/media-card/style.mjs +25 -0
- package/es/schema-component/antd/page/Page.d.ts +1 -5
- package/es/schema-component/antd/page/Page.mjs +235 -144
- package/es/schema-component/antd/page/Page.style.d.ts +5 -0
- package/es/schema-component/antd/page/Page.style.mjs +45 -0
- package/es/schema-component/antd/page/PageDesigner.d.ts +3 -0
- package/es/schema-component/antd/page/PageDesigner.mjs +28 -0
- package/es/schema-component/antd/page/PageTabDesigner.d.ts +0 -3
- package/es/schema-component/antd/page/PageTabDesigner.mjs +3 -50
- package/es/schema-component/antd/page/style.d.ts +1 -1
- package/es/schema-component/antd/page/style.mjs +3 -13
- package/es/schema-component/antd/password/Password.d.ts +1 -1
- package/es/schema-component/antd/password/utils.d.ts +1 -1
- package/es/schema-component/antd/scroll-area/ScrollArea.d.ts +1 -1
- package/es/schema-component/antd/scroll-area/ScrollArea.mjs +2 -1
- package/es/schema-component/antd/variable/TextArea.mjs +1 -1
- package/es/schema-component/antd/variable/TextAreaWithGlobalScope.d.ts +13 -0
- package/es/schema-component/antd/variable/TextAreaWithGlobalScope.mjs +59 -0
- package/es/schema-component/antd/variable/index.d.ts +1 -0
- package/es/schema-component/antd/variable/index.mjs +3 -0
- package/es/schema-component/common/dnd-context/index.mjs +1 -7
- package/es/schema-component/common/sortable-item/DragHandlePageTab.d.ts +1 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.mjs +71 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.d.ts +3 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +25 -0
- package/es/schema-items/GeneralSettings.mjs +5 -0
- package/es/schema-settings/EditCustomDefaultValue.mjs +1 -1
- package/es/schema-settings/SchemaSettings.mjs +1 -1
- package/es/schema-settings/SchemaSettingsDefaultValue.mjs +2 -0
- package/es/schema-settings/utils/createModalSettingsItem.d.ts +26 -0
- package/es/schema-settings/utils/createModalSettingsItem.mjs +46 -0
- package/es/schema-settings/utils/createSelectSettingsItem.d.ts +25 -0
- package/es/schema-settings/utils/createSelectSettingsItem.mjs +40 -0
- package/es/schema-settings/utils/createSwitchSettingsItem.d.ts +21 -0
- package/es/schema-settings/utils/createSwitchSettingsItem.mjs +38 -0
- package/es/schema-settings/utils/createTextSettingsItem.d.ts +9 -0
- package/es/schema-settings/utils/createTextSettingsItem.mjs +21 -0
- package/es/schema-settings/utils/index.d.ts +4 -0
- package/es/schema-settings/utils/index.mjs +4 -0
- package/es/schema-settings/utils/util.d.ts +12 -0
- package/es/schema-settings/utils/util.mjs +24 -0
- package/es/user/CurrentUserProvider.mjs +6 -3
- package/lib/api-client/APIClient.js +93 -49
- package/lib/application/Application.js +19 -0
- package/lib/application/CustomRouterContextProvider.js +276 -0
- package/lib/application/RouterManager.js +49 -15
- package/lib/application/hooks/index.js +9 -0
- package/lib/application/hooks/useGlobalVariable.js +52 -0
- package/lib/application/schema-initializer/hooks/index.js +2 -2
- package/lib/application/schema-settings/hooks/index.js +6 -8
- package/lib/block-provider/hooks/index.js +80 -59
- package/lib/built-in/context-menu/ContextMenu.provider.js +6 -6
- package/lib/built-in/context-menu/ContextMenuItemsProps.js +6 -6
- package/lib/built-in/context-menu/index.js +1 -1
- package/lib/built-in/index.js +8 -0
- package/lib/built-in/locale/LocalePlugin.js +5 -1
- package/lib/built-in/page-style/PageStyle.provider.js +2 -2
- package/lib/built-in/system-settings/SystemSettingsProvider.js +4 -3
- package/lib/built-in/system-settings/SystemSettingsShortcut.js +11 -8
- package/lib/collection-manager/Configuration/AddCollectionAction.js +12 -2
- package/lib/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.js +304 -0
- package/lib/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.js +130 -0
- package/lib/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.js +81 -0
- package/lib/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.js +78 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.js +414 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.js +53 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxImportAction.js +235 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.js +64 -0
- package/lib/collection-manager/collectionPlugin.js +3 -1
- package/lib/collection-manager/templates/import.js +1 -1
- package/lib/collection-manager/templates/xlsx.js +53 -0
- package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +18 -0
- package/lib/data-source/collection-field-interface/CollectionFieldInterfaceManager.js +20 -0
- package/lib/data-source/commonsSettingsItem/fieldComponent.js +3 -1
- package/lib/filter-provider/utils.js +6 -0
- package/lib/i18n/i18n.js +7 -12
- package/lib/locale/en_US.js +1 -0
- package/lib/locale/zh-CN.js +14 -2
- package/lib/modules/actions/delete/deleteActionSettings.js +10 -0
- package/lib/modules/blocks/data-blocks/form/FilterItemCustomSettings.js +1 -1
- package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +9 -4
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +6 -4
- package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +4 -0
- package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +44 -0
- package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +4 -0
- package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +9 -0
- package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +0 -4
- package/lib/modules/fields/component/SubTable/secondLevelSelect.js +136 -0
- package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +104 -103
- package/lib/powered-by/index.js +4 -7
- package/lib/schema-component/antd/action/Action.Designer.js +43 -5
- package/lib/schema-component/antd/action/Action.Modal.js +19 -31
- package/lib/schema-component/antd/action/Action.Modal.style.js +69 -0
- package/lib/schema-component/antd/action/Action.js +1 -3
- package/lib/schema-component/antd/action/utils.js +70 -70
- package/lib/schema-component/antd/association-field/SubTabs/InternalCollapse.js +2 -1
- package/lib/schema-component/antd/checkbox/Checkbox.js +9 -2
- package/lib/schema-component/antd/index.js +18 -4
- package/lib/schema-component/antd/media-card/MediaCard.js +69 -0
- package/lib/schema-component/antd/media-card/index.js +65 -0
- package/lib/schema-component/antd/media-card/style.js +59 -0
- package/lib/schema-component/antd/page/Page.js +235 -144
- package/lib/schema-component/antd/page/Page.style.js +79 -0
- package/lib/schema-component/antd/page/PageDesigner.js +62 -0
- package/lib/schema-component/antd/page/PageTabDesigner.js +2 -50
- package/lib/schema-component/antd/page/style.js +3 -13
- package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -1
- package/lib/schema-component/antd/variable/TextArea.js +1 -1
- package/lib/schema-component/antd/variable/TextAreaWithGlobalScope.js +94 -0
- package/lib/schema-component/antd/variable/index.js +13 -1
- package/lib/schema-component/common/dnd-context/index.js +1 -7
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.js +105 -0
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +59 -0
- package/lib/schema-items/GeneralSettings.js +5 -0
- package/lib/schema-settings/EditCustomDefaultValue.js +1 -1
- package/lib/schema-settings/SchemaSettings.js +1 -1
- package/lib/schema-settings/SchemaSettingsDefaultValue.js +2 -0
- package/lib/schema-settings/utils/createModalSettingsItem.js +94 -0
- package/lib/schema-settings/utils/createSelectSettingsItem.js +88 -0
- package/lib/schema-settings/utils/createSwitchSettingsItem.js +86 -0
- package/lib/schema-settings/utils/createTextSettingsItem.js +55 -0
- package/lib/schema-settings/utils/index.js +92 -0
- package/lib/schema-settings/utils/util.js +74 -0
- package/lib/user/CurrentUserProvider.js +6 -3
- package/package.json +7 -7
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CollectionTemplate } from '../../data-source/collection-template/CollectionTemplate';
|
|
2
|
+
export declare class ImportXlsxTemplate extends CollectionTemplate {
|
|
3
|
+
name: string;
|
|
4
|
+
title: string;
|
|
5
|
+
order: number;
|
|
6
|
+
color: string;
|
|
7
|
+
divider: boolean;
|
|
8
|
+
default: {
|
|
9
|
+
fields: any[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__data_source_collection_template_CollectionTemplate_mjs__ from "../../data-source/collection-template/CollectionTemplate.mjs";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
else obj[key] = value;
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
class ImportXlsxTemplate extends __WEBPACK_EXTERNAL_MODULE__data_source_collection_template_CollectionTemplate_mjs__.CollectionTemplate {
|
|
13
|
+
constructor(...args){
|
|
14
|
+
super(...args), _define_property(this, "name", 'importXlsx'), _define_property(this, "title", '{{t("Import xlsx collection")}}'), _define_property(this, "order", 6), _define_property(this, "color", 'blue'), _define_property(this, "divider", false), _define_property(this, "default", {
|
|
15
|
+
fields: []
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export { ImportXlsxTemplate };
|
|
@@ -48,4 +48,5 @@ export declare abstract class CollectionFieldInterface {
|
|
|
48
48
|
validateSchema?(fieldSchema: ISchema): Record<string, ISchema>;
|
|
49
49
|
usePathOptions?(field: CollectionFieldOptions): any;
|
|
50
50
|
schemaInitialize?(schema: ISchema, data: any): void;
|
|
51
|
+
addComponentOption(componentOption: CollectionFieldInterfaceComponentOption): void;
|
|
51
52
|
}
|
|
@@ -9,6 +9,24 @@ function _define_property(obj, key, value) {
|
|
|
9
9
|
return obj;
|
|
10
10
|
}
|
|
11
11
|
class CollectionFieldInterface {
|
|
12
|
+
addComponentOption(componentOption) {
|
|
13
|
+
if (!this.componentOptions) {
|
|
14
|
+
var _this_default_uiSchema, _this_default, _this_default_uiSchema1, _this_default1;
|
|
15
|
+
this.componentOptions = [];
|
|
16
|
+
const xComponent = null === (_this_default = this.default) || void 0 === _this_default ? void 0 : null === (_this_default_uiSchema = _this_default.uiSchema) || void 0 === _this_default_uiSchema ? void 0 : _this_default_uiSchema['x-component'];
|
|
17
|
+
const componentProps = null === (_this_default1 = this.default) || void 0 === _this_default1 ? void 0 : null === (_this_default_uiSchema1 = _this_default1.uiSchema) || void 0 === _this_default_uiSchema1 ? void 0 : _this_default_uiSchema1['x-component-props'];
|
|
18
|
+
if (xComponent) this.componentOptions = [
|
|
19
|
+
{
|
|
20
|
+
label: xComponent.split('.').pop(),
|
|
21
|
+
value: xComponent,
|
|
22
|
+
useProps () {
|
|
23
|
+
return componentProps || {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
this.componentOptions.push(componentOption);
|
|
29
|
+
}
|
|
12
30
|
constructor(collectionFieldInterfaceManager){
|
|
13
31
|
_define_property(this, "collectionFieldInterfaceManager", void 0);
|
|
14
32
|
_define_property(this, "name", void 0);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { DataSourceManager } from '../data-source';
|
|
2
|
-
import type { CollectionFieldInterface, CollectionFieldInterfaceFactory } from './CollectionFieldInterface';
|
|
2
|
+
import type { CollectionFieldInterface, CollectionFieldInterfaceComponentOption, CollectionFieldInterfaceFactory } from './CollectionFieldInterface';
|
|
3
|
+
interface ActionType {
|
|
4
|
+
type: 'addComponentOption';
|
|
5
|
+
data: any;
|
|
6
|
+
}
|
|
3
7
|
export declare class CollectionFieldInterfaceManager {
|
|
4
8
|
dataSourceManager: DataSourceManager;
|
|
5
9
|
protected collectionFieldInterfaceInstances: Record<string, CollectionFieldInterface>;
|
|
@@ -7,6 +11,7 @@ export declare class CollectionFieldInterfaceManager {
|
|
|
7
11
|
label: string;
|
|
8
12
|
order?: number;
|
|
9
13
|
}>;
|
|
14
|
+
protected actionList: Record<string, ActionType[]>;
|
|
10
15
|
constructor(fieldInterfaceClasses: CollectionFieldInterfaceFactory[], fieldInterfaceGroups: Record<string, {
|
|
11
16
|
label: string;
|
|
12
17
|
order?: number;
|
|
@@ -26,4 +31,6 @@ export declare class CollectionFieldInterfaceManager {
|
|
|
26
31
|
label: string;
|
|
27
32
|
order?: number;
|
|
28
33
|
};
|
|
34
|
+
addFieldInterfaceComponentOption(interfaceName: string, componentOption: CollectionFieldInterfaceComponentOption): void;
|
|
29
35
|
}
|
|
36
|
+
export {};
|
|
@@ -14,6 +14,12 @@ class CollectionFieldInterfaceManager {
|
|
|
14
14
|
const newCollectionFieldInterfaces = fieldInterfaceClasses.reduce((acc, Interface)=>{
|
|
15
15
|
const instance = new Interface(this);
|
|
16
16
|
acc[instance.name] = instance;
|
|
17
|
+
if (Array.isArray(this.actionList[instance.name])) {
|
|
18
|
+
this.actionList[instance.name].forEach((item)=>{
|
|
19
|
+
instance[item.type](item.data);
|
|
20
|
+
});
|
|
21
|
+
this.actionList[instance.name] = void 0;
|
|
22
|
+
}
|
|
17
23
|
return acc;
|
|
18
24
|
}, {});
|
|
19
25
|
Object.assign(this.collectionFieldInterfaceInstances, newCollectionFieldInterfaces);
|
|
@@ -45,13 +51,27 @@ class CollectionFieldInterfaceManager {
|
|
|
45
51
|
getFieldInterfaceGroup(name) {
|
|
46
52
|
return this.collectionFieldGroups[name];
|
|
47
53
|
}
|
|
54
|
+
addFieldInterfaceComponentOption(interfaceName, componentOption) {
|
|
55
|
+
const fieldInterface = this.getFieldInterface(interfaceName);
|
|
56
|
+
if (!fieldInterface) {
|
|
57
|
+
if (!this.actionList[interfaceName]) this.actionList[interfaceName] = [];
|
|
58
|
+
this.actionList[interfaceName].push({
|
|
59
|
+
type: 'addComponentOption',
|
|
60
|
+
data: componentOption
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
fieldInterface.addComponentOption(componentOption);
|
|
65
|
+
}
|
|
48
66
|
constructor(fieldInterfaceClasses, fieldInterfaceGroups, dataSourceManager){
|
|
49
67
|
_define_property(this, "dataSourceManager", void 0);
|
|
50
68
|
_define_property(this, "collectionFieldInterfaceInstances", void 0);
|
|
51
69
|
_define_property(this, "collectionFieldGroups", void 0);
|
|
70
|
+
_define_property(this, "actionList", void 0);
|
|
52
71
|
this.dataSourceManager = dataSourceManager;
|
|
53
72
|
this.collectionFieldInterfaceInstances = {};
|
|
54
73
|
this.collectionFieldGroups = {};
|
|
74
|
+
this.actionList = {};
|
|
55
75
|
this.addFieldInterfaces(fieldInterfaceClasses);
|
|
56
76
|
this.addFieldInterfaceGroups(fieldInterfaceGroups);
|
|
57
77
|
}
|
|
@@ -42,14 +42,16 @@ const fieldComponentSettingsItem = {
|
|
|
42
42
|
component,
|
|
43
43
|
...(null == componentOptions ? void 0 : null === (_componentOptions_useProps = componentOptions.useProps) || void 0 === _componentOptions_useProps ? void 0 : _componentOptions_useProps.call(componentOptions)) || {}
|
|
44
44
|
};
|
|
45
|
-
__WEBPACK_EXTERNAL_MODULE_lodash__["default"].set(fieldSchema, 'x-component-props', componentProps);
|
|
46
45
|
field.componentProps = componentProps;
|
|
46
|
+
field.component = component;
|
|
47
|
+
__WEBPACK_EXTERNAL_MODULE_lodash__["default"].set(fieldSchema, 'x-component-props', componentProps);
|
|
47
48
|
dn.emit('patch', {
|
|
48
49
|
schema: {
|
|
49
50
|
['x-uid']: fieldSchema['x-uid'],
|
|
50
51
|
'x-component-props': componentProps
|
|
51
52
|
}
|
|
52
53
|
});
|
|
54
|
+
dn.refresh();
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
}
|
|
@@ -22,7 +22,7 @@ export declare abstract class DataSource {
|
|
|
22
22
|
get app(): import("../..").Application;
|
|
23
23
|
get key(): string;
|
|
24
24
|
get displayName(): string;
|
|
25
|
-
get status(): "
|
|
25
|
+
get status(): "loaded" | "loading-failed" | "loading" | "reloading";
|
|
26
26
|
get errorMessage(): string;
|
|
27
27
|
get collections(): import("..").Collection[];
|
|
28
28
|
getOptions(): DataSourceOptions;
|
|
@@ -90,6 +90,12 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
|
|
|
90
90
|
$isFalsy: true
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
+
} else if ('$dateBetween' === operators[key]) {
|
|
94
|
+
if (Array.isArray(value)) for(const index in value){
|
|
95
|
+
if (!!value[index]) {
|
|
96
|
+
if ('string' != typeof value[index] && !(value[index] instanceof Date)) value[index] = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_utils_client__.dayjs)(value[index]).toISOString();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
return {
|
|
95
101
|
[key]: {
|
package/es/i18n/i18n.mjs
CHANGED
|
@@ -10,16 +10,11 @@ const resources = {};
|
|
|
10
10
|
Object.keys(__WEBPACK_EXTERNAL_MODULE__locale_index_mjs__["default"]).forEach((lang)=>{
|
|
11
11
|
resources[lang] = __WEBPACK_EXTERNAL_MODULE__locale_index_mjs__["default"][lang].resources;
|
|
12
12
|
});
|
|
13
|
-
if ('undefined' != typeof localStorage) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
i18n.on('languageChanged', (lng)=>{
|
|
22
|
-
localStorage.setItem('TACHYBASE_LOCALE', lng);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
13
|
+
if ('undefined' != typeof localStorage) i18n.use(__WEBPACK_EXTERNAL_MODULE_react_i18next__.initReactI18next).init({
|
|
14
|
+
lng: localStorage.getItem('TACHYBASE_LOCALE') || 'en-US',
|
|
15
|
+
defaultNS: 'core',
|
|
16
|
+
resources: {},
|
|
17
|
+
keySeparator: false,
|
|
18
|
+
nsSeparator: false
|
|
19
|
+
});
|
|
25
20
|
export { i18n, tval };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
1
2
|
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../application/index.mjs";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../application/schema-settings/SchemaSettings.mjs";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../../../collection-manager/index.mjs";
|
|
@@ -30,6 +31,15 @@ const deleteActionSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_s
|
|
|
30
31
|
name: 'secondConFirm',
|
|
31
32
|
Component: __WEBPACK_EXTERNAL_MODULE__schema_component_antd_action_Action_Designer_mjs__.SecondConFirm
|
|
32
33
|
},
|
|
34
|
+
{
|
|
35
|
+
name: 'workflowConfig',
|
|
36
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_component_antd_action_Action_Designer_mjs__.WorkflowConfig,
|
|
37
|
+
useVisible () {
|
|
38
|
+
var _fieldSchema_xactionsettings;
|
|
39
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
40
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.isValid)(null == fieldSchema ? void 0 : null === (_fieldSchema_xactionsettings = fieldSchema['x-action-settings']) || void 0 === _fieldSchema_xactionsettings ? void 0 : _fieldSchema_xactionsettings.triggerWorkflows);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
33
43
|
{
|
|
34
44
|
name: 'delete',
|
|
35
45
|
type: 'remove'
|
|
@@ -250,7 +250,7 @@ const FilterItemCustomSettings = new __WEBPACK_EXTERNAL_MODULE__application_sche
|
|
|
250
250
|
}
|
|
251
251
|
},
|
|
252
252
|
onSubmit (param) {
|
|
253
|
-
let { default: { value } } = param;
|
|
253
|
+
let { default: { value = null } } = param;
|
|
254
254
|
field.setValue(value);
|
|
255
255
|
fieldSchema['default'] = value;
|
|
256
256
|
fieldSchema['x-component-props']['defaultValue'] = value;
|
|
@@ -12,9 +12,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../
|
|
|
12
12
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__ from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_v2_utils_mjs__ from "../../../../schema-component/antd/form-v2/utils.mjs";
|
|
14
14
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__ from "../../../../schema-settings/index.mjs";
|
|
15
|
-
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_hooks_useIsAllowToSetDefaultValue_mjs__ from "../../../../schema-settings/hooks/useIsAllowToSetDefaultValue.mjs";
|
|
16
15
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_LinkageRules_type_mjs__ from "../../../../schema-settings/LinkageRules/type.mjs";
|
|
17
|
-
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsDefaultValue_mjs__ from "../../../../schema-settings/SchemaSettingsDefaultValue.mjs";
|
|
18
16
|
const fieldSettingsFormItem = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
|
|
19
17
|
name: 'fieldSettings:FormItem',
|
|
20
18
|
items: [
|
|
@@ -217,10 +215,10 @@ const fieldSettingsFormItem = new __WEBPACK_EXTERNAL_MODULE__application_schema_
|
|
|
217
215
|
{
|
|
218
216
|
name: 'setDefaultValue',
|
|
219
217
|
useVisible () {
|
|
220
|
-
const { isAllowToSetDefaultValue } = (0,
|
|
218
|
+
const { isAllowToSetDefaultValue } = (0, __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.useIsAllowToSetDefaultValue)();
|
|
221
219
|
return isAllowToSetDefaultValue();
|
|
222
220
|
},
|
|
223
|
-
Component:
|
|
221
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsDefaultValue
|
|
224
222
|
},
|
|
225
223
|
{
|
|
226
224
|
name: 'layoutDirection',
|
|
@@ -478,6 +476,13 @@ const fieldSettingsFormItem = new __WEBPACK_EXTERNAL_MODULE__application_schema_
|
|
|
478
476
|
const validateSchema = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useValidateSchema)();
|
|
479
477
|
return form && !isFormReadPretty && validateSchema;
|
|
480
478
|
}
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
...__WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.fieldComponentSettingsItem
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: 'editDefaultValue',
|
|
485
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsDefaultValue
|
|
481
486
|
}
|
|
482
487
|
];
|
|
483
488
|
}
|
|
@@ -7,11 +7,11 @@ import * as __WEBPACK_EXTERNAL_MODULE__filter_provider_FilterProvider_mjs__ from
|
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__filter_provider_utils_mjs__ from "../../../../../filter-provider/utils.mjs";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../../../schema-component/index.mjs";
|
|
9
9
|
const useTableBlockProps = ()=>{
|
|
10
|
-
var _fieldSchema_parent_xdecoratorprops, _fieldSchema_parent, _ctx_service, _ctx_service1, _ctx_field_data, _ctx_field, _ctx_service2, _ctx_service3, _fieldSchema_xcomponentprops;
|
|
10
|
+
var _fieldSchema_parent_xdecoratorprops, _fieldSchema_parent, _fieldSchema_parent_xdecoratorprops1, _fieldSchema_parent1, _ctx_service, _ctx_service1, _ctx_field_data, _ctx_field, _ctx_service2, _ctx_service3, _fieldSchema_xcomponentprops;
|
|
11
11
|
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
12
12
|
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
13
13
|
const ctx = (0, __WEBPACK_EXTERNAL_MODULE__block_provider_TableBlockProvider_mjs__.useTableBlockContext)();
|
|
14
|
-
const globalSort = null === (_fieldSchema_parent = fieldSchema.parent) || void 0 === _fieldSchema_parent ? void 0 : null === (_fieldSchema_parent_xdecoratorprops = _fieldSchema_parent['x-decorator-props']) || void 0 === _fieldSchema_parent_xdecoratorprops ? void 0 : _fieldSchema_parent_xdecoratorprops['dragSortBy'];
|
|
14
|
+
const globalSort = (null === (_fieldSchema_parent = fieldSchema.parent) || void 0 === _fieldSchema_parent ? void 0 : null === (_fieldSchema_parent_xdecoratorprops = _fieldSchema_parent['x-decorator-props']) || void 0 === _fieldSchema_parent_xdecoratorprops ? void 0 : _fieldSchema_parent_xdecoratorprops['dragSort']) === true ? null === (_fieldSchema_parent1 = fieldSchema.parent) || void 0 === _fieldSchema_parent1 ? void 0 : null === (_fieldSchema_parent_xdecoratorprops1 = _fieldSchema_parent1['x-decorator-props']) || void 0 === _fieldSchema_parent_xdecoratorprops1 ? void 0 : _fieldSchema_parent_xdecoratorprops1['dragSortBy'] : void 0;
|
|
15
15
|
const { getDataBlocks } = (0, __WEBPACK_EXTERNAL_MODULE__filter_provider_FilterProvider_mjs__.useFilterBlock)();
|
|
16
16
|
const isLoading = null == ctx ? void 0 : null === (_ctx_service = ctx.service) || void 0 === _ctx_service ? void 0 : _ctx_service.loading;
|
|
17
17
|
null == ctx || null === (_ctx_service1 = ctx.service) || void 0 === _ctx_service1 || _ctx_service1.params;
|
|
@@ -63,7 +63,7 @@ const useTableBlockProps = ()=>{
|
|
|
63
63
|
},
|
|
64
64
|
onChange (param, filters, sorter) {
|
|
65
65
|
let { current, pageSize } = param;
|
|
66
|
-
var _fieldSchema_parent_xdecoratorprops_params, _fieldSchema_parent_xdecoratorprops, _fieldSchema_parent,
|
|
66
|
+
var _fieldSchema_parent_xdecoratorprops_params, _fieldSchema_parent_xdecoratorprops, _fieldSchema_parent, _ctx_service_params_;
|
|
67
67
|
const parentSort = null === (_fieldSchema_parent = fieldSchema.parent) || void 0 === _fieldSchema_parent ? void 0 : null === (_fieldSchema_parent_xdecoratorprops = _fieldSchema_parent['x-decorator-props']) || void 0 === _fieldSchema_parent_xdecoratorprops ? void 0 : null === (_fieldSchema_parent_xdecoratorprops_params = _fieldSchema_parent_xdecoratorprops['params']) || void 0 === _fieldSchema_parent_xdecoratorprops_params ? void 0 : _fieldSchema_parent_xdecoratorprops_params.sort;
|
|
68
68
|
const sortParams = ctx.params.sort || [];
|
|
69
69
|
const parentSortReal = [
|
|
@@ -78,10 +78,12 @@ const useTableBlockProps = ()=>{
|
|
|
78
78
|
"-".concat(sorter.field)
|
|
79
79
|
] : parentSortReal;
|
|
80
80
|
ctx.service.run({
|
|
81
|
-
...
|
|
81
|
+
...ctx.service.params[0],
|
|
82
82
|
page: current,
|
|
83
83
|
pageSize,
|
|
84
84
|
sort
|
|
85
|
+
}, {
|
|
86
|
+
filters: null === (_ctx_service_params_ = ctx.service.params[1]) || void 0 === _ctx_service_params_ ? void 0 : _ctx_service_params_.filters
|
|
85
87
|
});
|
|
86
88
|
},
|
|
87
89
|
onClickRow (record, setSelectedRow, selectedRow) {
|
|
@@ -91,6 +91,10 @@ const tableBlockSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_set
|
|
|
91
91
|
const sortBy = null == data ? void 0 : null === (_data_data = data.data) || void 0 === _data_data ? void 0 : null === (_data_data_ = _data_data[0]) || void 0 === _data_data_ ? void 0 : _data_data_.sortBy;
|
|
92
92
|
fieldSchema['x-decorator-props'].dragSortBy = sortBy;
|
|
93
93
|
}
|
|
94
|
+
if (!dragSort) {
|
|
95
|
+
fieldSchema['x-decorator-props'].dragSortBy = null;
|
|
96
|
+
field.decoratorProps.dragSortBy = null;
|
|
97
|
+
}
|
|
94
98
|
field.decoratorProps.dragSort = dragSort;
|
|
95
99
|
fieldSchema['x-decorator-props'].dragSort = dragSort;
|
|
96
100
|
service.run({
|
|
@@ -108,6 +108,50 @@ const tableColumnSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_se
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
+
{
|
|
112
|
+
name: 'columnAlign',
|
|
113
|
+
type: 'select',
|
|
114
|
+
useComponentProps () {
|
|
115
|
+
var _fieldSchema_xcomponentprops;
|
|
116
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
117
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
118
|
+
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
119
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
120
|
+
return {
|
|
121
|
+
key: 'align',
|
|
122
|
+
title: t('Align'),
|
|
123
|
+
options: [
|
|
124
|
+
{
|
|
125
|
+
label: t('Left'),
|
|
126
|
+
value: 'left'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: t('Center'),
|
|
130
|
+
value: 'center'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
label: t('Right'),
|
|
134
|
+
value: 'right'
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
value: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.align) || 'left',
|
|
138
|
+
onChange: (align)=>{
|
|
139
|
+
const props = fieldSchema['x-component-props'] || {};
|
|
140
|
+
props['align'] = align;
|
|
141
|
+
const schema = {
|
|
142
|
+
['x-uid']: fieldSchema['x-uid']
|
|
143
|
+
};
|
|
144
|
+
schema['x-component-props'] = props;
|
|
145
|
+
fieldSchema['x-component-props'] = props;
|
|
146
|
+
field.componentProps.align = align;
|
|
147
|
+
dn.emit('patch', {
|
|
148
|
+
schema
|
|
149
|
+
});
|
|
150
|
+
dn.refresh();
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
},
|
|
111
155
|
{
|
|
112
156
|
name: 'sortable',
|
|
113
157
|
type: 'switch',
|
|
@@ -4,6 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../../application/schema-settings/SchemaSettings.mjs";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE__block_provider_index_mjs__ from "../../../../block-provider/index.mjs";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../../../../collection-manager/index.mjs";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__ from "../../../../data-source/index.mjs";
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../../schema-component/index.mjs";
|
|
8
9
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__ from "../../../../schema-settings/index.mjs";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsDataScope_mjs__ from "../../../../schema-settings/SchemaSettingsDataScope.mjs";
|
|
@@ -183,6 +184,9 @@ const filterCollapseItemFieldSettings = new __WEBPACK_EXTERNAL_MODULE__applicati
|
|
|
183
184
|
onChange: onTitleFieldChange
|
|
184
185
|
};
|
|
185
186
|
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
...__WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.fieldComponentSettingsItem
|
|
186
190
|
}
|
|
187
191
|
];
|
|
188
192
|
}
|
|
@@ -6,7 +6,9 @@ import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../..
|
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../../application/schema-settings/SchemaSettings.mjs";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../../../../collection-manager/index.mjs";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__common_useFieldComponentName_mjs__ from "../../../../common/useFieldComponentName.mjs";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__ from "../../../../data-source/index.mjs";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../../schema-component/index.mjs";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__ from "../../../../schema-settings/index.mjs";
|
|
10
12
|
const filterFormItemFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
|
|
11
13
|
name: 'fieldSettings:FilterFormItem',
|
|
12
14
|
items: [
|
|
@@ -308,6 +310,13 @@ const filterFormItemFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_s
|
|
|
308
310
|
{
|
|
309
311
|
name: 'operator',
|
|
310
312
|
Component: __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.EditOperator
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
...__WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.fieldComponentSettingsItem
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'editDefaultValue',
|
|
319
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsDefaultValue
|
|
311
320
|
}
|
|
312
321
|
];
|
|
313
322
|
}
|
|
@@ -24,10 +24,6 @@ const radioComponentFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_s
|
|
|
24
24
|
{
|
|
25
25
|
label: t('Radio group'),
|
|
26
26
|
value: 'Radio group'
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: t('Select'),
|
|
30
|
-
value: 'Select'
|
|
31
27
|
}
|
|
32
28
|
];
|
|
33
29
|
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SelectProps } from 'antd';
|
|
2
|
+
import { FieldNames } from '../../../../schema-component';
|
|
3
|
+
export declare const SecondLevelSelect: import("react").ForwardRefExoticComponent<SelectProps<any, any> & {
|
|
4
|
+
objectValue?: boolean;
|
|
5
|
+
onChange?: (v: any) => void;
|
|
6
|
+
multiple: boolean;
|
|
7
|
+
rawOptions: any[];
|
|
8
|
+
fieldNames: FieldNames;
|
|
9
|
+
firstLevelValue: string;
|
|
10
|
+
collectionField: string;
|
|
11
|
+
} & import("react").RefAttributes<never>>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__ from "../../../../data-source/index.mjs";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../../schema-component/index.mjs";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_select_ReadPretty_mjs__ from "../../../../schema-component/antd/select/ReadPretty.mjs";
|
|
10
|
+
const filterOption = (input, option)=>{
|
|
11
|
+
var _option_label;
|
|
12
|
+
return (null !== (_option_label = null == option ? void 0 : option.label) && void 0 !== _option_label ? _option_label : '').toLowerCase().includes((input || '').toLowerCase());
|
|
13
|
+
};
|
|
14
|
+
const SecondLevelSelect = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((props)=>{
|
|
15
|
+
const { objectValue, loading, value, rawOptions, defaultValue, firstLevelValue, collectionField, ...others } = props;
|
|
16
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
17
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
18
|
+
const cm = (0, __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.useCollectionManager)();
|
|
19
|
+
let mode = props.multiple ? 'multiple' : props.mode;
|
|
20
|
+
if (mode && ![
|
|
21
|
+
'multiple',
|
|
22
|
+
'tags'
|
|
23
|
+
].includes(mode)) mode = void 0;
|
|
24
|
+
const toValue = (v)=>{
|
|
25
|
+
if ([
|
|
26
|
+
'tags',
|
|
27
|
+
'multiple'
|
|
28
|
+
].includes(props.mode) || props.multiple) {
|
|
29
|
+
if (v) return (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.toArr)(v);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
return v;
|
|
33
|
+
};
|
|
34
|
+
const Parentoptions = cm.getCollectionFields("".concat(collectionField, ".").concat(firstLevelValue));
|
|
35
|
+
const fieldParentTabsOptions = Parentoptions.map((item)=>{
|
|
36
|
+
if ('m2o' === item.interface) return {
|
|
37
|
+
...item,
|
|
38
|
+
label: compile(item.uiSchema.title),
|
|
39
|
+
value: item.name
|
|
40
|
+
};
|
|
41
|
+
}).filter(Boolean);
|
|
42
|
+
fieldParentTabsOptions.unshift({
|
|
43
|
+
label: t('none'),
|
|
44
|
+
value: 'none'
|
|
45
|
+
});
|
|
46
|
+
const matchedOption = fieldParentTabsOptions.find((option)=>option.value === value);
|
|
47
|
+
const newValue = matchedOption ? value : 'none';
|
|
48
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
49
|
+
if (!matchedOption) {
|
|
50
|
+
var _props_onChange;
|
|
51
|
+
null === (_props_onChange = props.onChange) || void 0 === _props_onChange || _props_onChange.call(props, 'none');
|
|
52
|
+
}
|
|
53
|
+
}, [
|
|
54
|
+
value,
|
|
55
|
+
fieldParentTabsOptions
|
|
56
|
+
]);
|
|
57
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Select, {
|
|
58
|
+
role: "button",
|
|
59
|
+
"data-testid": "select-".concat(mode || 'single'),
|
|
60
|
+
showSearch: true,
|
|
61
|
+
filterOption: filterOption,
|
|
62
|
+
allowClear: {
|
|
63
|
+
clearIcon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.CloseCircleFilled, {
|
|
64
|
+
role: "button",
|
|
65
|
+
"aria-label": "icon-close-select"
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
popupMatchSelectWidth: false,
|
|
69
|
+
notFoundContent: loading ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Spin, {}) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Empty, {
|
|
70
|
+
image: __WEBPACK_EXTERNAL_MODULE_antd__.Empty.PRESENTED_IMAGE_SIMPLE
|
|
71
|
+
}),
|
|
72
|
+
value: toValue(newValue),
|
|
73
|
+
defaultValue: toValue(defaultValue),
|
|
74
|
+
tagRender: (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tag, {
|
|
75
|
+
role: "button",
|
|
76
|
+
"aria-label": props.label,
|
|
77
|
+
closeIcon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.CloseOutlined, {
|
|
78
|
+
role: "button",
|
|
79
|
+
"aria-label": "icon-close-tag"
|
|
80
|
+
}),
|
|
81
|
+
...props,
|
|
82
|
+
children: props.label
|
|
83
|
+
}),
|
|
84
|
+
options: fieldParentTabsOptions,
|
|
85
|
+
...others,
|
|
86
|
+
onChange: (changed)=>{
|
|
87
|
+
var _props_onChange;
|
|
88
|
+
null === (_props_onChange = props.onChange) || void 0 === _props_onChange || _props_onChange.call(props, void 0 === changed ? null : changed);
|
|
89
|
+
},
|
|
90
|
+
mode: mode
|
|
91
|
+
});
|
|
92
|
+
}, (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapProps)({
|
|
93
|
+
dataSource: 'options'
|
|
94
|
+
}, (props, field)=>({
|
|
95
|
+
...props,
|
|
96
|
+
fieldNames: {
|
|
97
|
+
...__WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.defaultFieldNames,
|
|
98
|
+
...props.fieldNames
|
|
99
|
+
},
|
|
100
|
+
suffixIcon: (null == field ? void 0 : field['loading']) || (null == field ? void 0 : field['validating']) ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.LoadingOutlined, {}) : props.suffixIcon
|
|
101
|
+
})), (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapReadPretty)(__WEBPACK_EXTERNAL_MODULE__schema_component_antd_select_ReadPretty_mjs__.ReadPretty));
|
|
102
|
+
export { SecondLevelSelect };
|