@tachybase/client 1.6.20 → 1.6.22
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 +2 -1
- package/es/api-client/APIClient.mjs +6 -3
- package/es/application/Plugin.d.ts +2 -2
- package/es/application/hoc/withDynamicSchemaProps.mjs +1 -1
- package/es/application/schema-initializer/hooks/index.mjs +4 -1
- package/es/application/schema-settings/components/SchemaSettingsChildren.mjs +14 -14
- package/es/application/utils/clientModuleRegistry.d.ts +2 -0
- package/es/application/utils/clientModuleRegistry.mjs +9 -0
- package/es/application/utils/globalDeps.mjs +3 -3
- package/es/block-provider/BlockProvider.d.ts +1 -27
- package/es/block-provider/BlockProvider.mjs +1 -3
- package/es/block-provider/BlockRequestContext.d.ts +27 -0
- package/es/block-provider/BlockRequestContext.mjs +5 -0
- package/es/block-provider/FormBlockContext.d.ts +32 -0
- package/es/block-provider/FormBlockContext.mjs +5 -0
- package/es/block-provider/FormBlockProvider.d.ts +1 -33
- package/es/block-provider/FormBlockProvider.mjs +4 -5
- package/es/built-in/acl/ACLCollectionFieldProvider.d.ts +1 -0
- package/es/built-in/acl/ACLCollectionFieldProvider.mjs +42 -0
- package/es/built-in/acl/ACLContext.d.ts +9 -0
- package/es/built-in/acl/ACLContext.mjs +24 -0
- package/es/built-in/acl/ACLPlugin.mjs +2 -1
- package/es/built-in/acl/ACLProvider.d.ts +0 -11
- package/es/built-in/acl/ACLProvider.mjs +6 -51
- package/es/built-in/acl/index.d.ts +2 -0
- package/es/built-in/acl/index.mjs +2 -0
- package/es/collection-manager/hooks/useCollectionManager_deprecated.mjs +2 -1
- package/es/collection-manager/sub-table.d.ts +1 -1
- package/es/data-source/data-source/DataSourceManager.d.ts +1 -2
- package/es/data-source/data-source/DataSourceManager.mjs +1 -2
- package/es/data-source/data-source/constants.d.ts +2 -0
- package/es/data-source/data-source/constants.mjs +3 -0
- package/es/data-source/utils.d.ts +2 -2
- package/es/data-source/utils.mjs +1 -1
- package/es/exports.d.ts +46 -0
- package/es/exports.mjs +46 -0
- package/es/filter-provider/utils.d.ts +2 -14
- package/es/filter-provider/utils.mjs +2 -57
- package/es/index.d.ts +1 -46
- package/es/index.mjs +4 -46
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +2 -86
- package/es/record-provider/index.mjs +3 -3
- package/es/schema-component/antd/action/Action.mjs +7 -6
- package/es/schema-component/antd/action/hooks.mjs +3 -2
- package/es/schema-component/antd/association-field/AssociationSelect.mjs +4 -3
- package/es/schema-component/antd/association-field/hooks.mjs +18 -1
- package/es/schema-component/antd/cron/CronSet.mjs +9 -3
- package/es/schema-component/antd/date-picker/util.mjs +4 -0
- package/es/schema-component/antd/filter/conditionUtils.d.ts +2 -0
- package/es/schema-component/antd/filter/conditionUtils.mjs +133 -0
- package/es/schema-component/antd/filter/dateValueUtils.d.ts +13 -0
- package/es/schema-component/antd/filter/dateValueUtils.mjs +66 -0
- package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -4
- package/es/schema-component/antd/filter/useFilterActionProps.mjs +3 -181
- package/es/schema-component/antd/filter/useGetFilterOptions.d.ts +2 -0
- package/es/schema-component/antd/filter/useGetFilterOptions.mjs +54 -0
- package/es/schema-component/antd/form/Form.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.FilterFormDesigner.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.d.ts +1 -1
- package/es/schema-component/antd/form-item/FormItem.mjs +14 -12
- package/es/schema-component/antd/form-item/SchemaSettingOptions.d.ts +1 -14
- package/es/schema-component/antd/form-item/SchemaSettingOptions.mjs +1 -33
- package/es/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.mjs +4 -3
- package/es/schema-component/antd/form-item/hooks/useParseDefaultValue.mjs +5 -3
- package/es/schema-component/antd/form-item/operatorUtils.d.ts +14 -0
- package/es/schema-component/antd/form-item/operatorUtils.mjs +36 -0
- package/es/schema-component/antd/form-v2/Form.mjs +26 -167
- package/es/schema-component/antd/form-v2/FormLinkageRules.d.ts +9 -0
- package/es/schema-component/antd/form-v2/FormLinkageRules.mjs +191 -0
- package/es/schema-component/antd/form-v2/Templates.mjs +1 -1
- package/es/schema-component/antd/grid/Grid.mjs +6 -4
- package/es/schema-component/antd/grid-card/GridCard.Item.mjs +2 -2
- package/es/schema-component/antd/icon-picker/IconFilterInput.mjs +12 -4
- package/es/schema-component/antd/icon-picker/IconPicker.mjs +1 -1
- package/es/schema-component/antd/input/Json.d.ts +1 -4
- package/es/schema-component/antd/input/ReadPretty.mjs +2 -2
- package/es/schema-component/antd/input-number/ReadPretty.mjs +1 -1
- package/es/schema-component/antd/markdown/Markdown.Void.Designer.mjs +2 -1
- package/es/schema-component/antd/markdown/Markdown.Void.mjs +10 -2
- package/es/schema-component/antd/markdown/Markdown.mjs +1 -1
- package/es/schema-component/antd/markdown/util.mjs +5 -0
- package/es/schema-component/antd/rich-text/RichText.mjs +1 -1
- package/es/schema-component/antd/select/FormulaSelect.mjs +1 -2
- package/es/schema-component/antd/select/ReadPretty.mjs +2 -2
- package/es/schema-component/antd/select/Select.mjs +1 -2
- package/es/schema-component/antd/select/utils.d.ts +2 -1
- package/es/schema-component/antd/select/utils.mjs +2 -2
- package/es/schema-component/antd/time-picker/ReadPretty.mjs +1 -1
- package/es/schema-component/antd/upload/ReadPretty.mjs +5 -5
- package/es/schema-component/antd/upload/Upload.mjs +6 -5
- package/es/schema-component/antd/variable/Input.mjs +1 -1
- package/es/schema-component/antd/variable/TextArea.mjs +1 -1
- package/es/schema-component/hooks/useDesigner.mjs +9 -3
- package/es/schema-component/hooks/useOptionalNavigate.d.ts +1 -0
- package/es/schema-component/hooks/useOptionalNavigate.mjs +2 -0
- package/es/schema-settings/DataTemplates/components/Designer.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useBaseVariable.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useBlockCollection.mjs +1 -1
- package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useFormVariable.mjs +1 -1
- package/es/schema-settings/VariableInput/hooks/useRecordVariable.mjs +1 -1
- package/es/style/theme/AntdAppProvider.mjs +2 -2
- package/es/user/ChangePassword.d.ts +4 -1
- package/es/user/CurrentUserContext.d.ts +2 -0
- package/es/user/CurrentUserContext.mjs +5 -0
- package/es/user/CurrentUserProvider.d.ts +0 -3
- package/es/user/CurrentUserProvider.mjs +3 -5
- package/es/user/EditProfile.d.ts +4 -1
- package/es/user/LanguageSettings.d.ts +4 -1
- package/es/user/SwitchRole.d.ts +4 -1
- package/es/user/index.d.ts +1 -0
- package/es/user/index.mjs +1 -0
- package/es/variables/VariablesProvider.mjs +1 -1
- package/lib/api-client/APIClient.js +8 -5
- package/lib/application/hoc/withDynamicSchemaProps.js +3 -3
- package/lib/application/schema-initializer/hooks/index.js +4 -1
- package/lib/application/schema-settings/components/SchemaSettingsChildren.js +14 -14
- package/lib/application/utils/clientModuleRegistry.js +46 -0
- package/lib/application/utils/globalDeps.js +2 -2
- package/lib/block-provider/BlockProvider.js +6 -8
- package/lib/block-provider/BlockRequestContext.js +42 -0
- package/lib/block-provider/FormBlockContext.js +42 -0
- package/lib/block-provider/FormBlockProvider.js +13 -14
- package/lib/built-in/acl/ACLCollectionFieldProvider.js +76 -0
- package/lib/built-in/acl/ACLContext.js +70 -0
- package/lib/built-in/acl/ACLPlugin.js +2 -1
- package/lib/built-in/acl/ACLProvider.js +13 -76
- package/lib/built-in/acl/index.js +27 -9
- package/lib/collection-manager/hooks/useCollectionManager_deprecated.js +4 -3
- package/lib/data-source/data-source/DataSourceManager.js +6 -7
- package/lib/data-source/data-source/constants.js +40 -0
- package/lib/data-source/utils.js +2 -2
- package/lib/exports.js +769 -0
- package/lib/filter-provider/utils.js +7 -63
- package/lib/index.js +10 -714
- package/lib/record-provider/index.js +6 -6
- package/lib/schema-component/antd/action/Action.js +9 -8
- package/lib/schema-component/antd/action/hooks.js +3 -2
- package/lib/schema-component/antd/association-field/AssociationSelect.js +3 -2
- package/lib/schema-component/antd/association-field/hooks.js +18 -1
- package/lib/schema-component/antd/cron/CronSet.js +8 -2
- package/lib/schema-component/antd/date-picker/util.js +4 -0
- package/lib/schema-component/antd/filter/conditionUtils.js +180 -0
- package/lib/schema-component/antd/filter/dateValueUtils.js +116 -0
- package/lib/schema-component/antd/filter/useFilterActionProps.js +7 -186
- package/lib/schema-component/antd/filter/useGetFilterOptions.js +91 -0
- package/lib/schema-component/antd/form/Form.js +4 -4
- package/lib/schema-component/antd/form-item/FormItem.FilterFormDesigner.js +2 -2
- package/lib/schema-component/antd/form-item/FormItem.js +23 -20
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +6 -38
- package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js +9 -7
- package/lib/schema-component/antd/form-item/hooks/useParseDefaultValue.js +12 -8
- package/lib/schema-component/antd/form-item/operatorUtils.js +76 -0
- package/lib/schema-component/antd/form-v2/Form.js +204 -317
- package/lib/schema-component/antd/form-v2/FormLinkageRules.js +236 -0
- package/lib/schema-component/antd/form-v2/Templates.js +2 -2
- package/lib/schema-component/antd/grid/Grid.js +11 -9
- package/lib/schema-component/antd/grid-card/GridCard.Item.js +2 -2
- package/lib/schema-component/antd/icon-picker/IconFilterInput.js +12 -4
- package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -1
- package/lib/schema-component/antd/input/ReadPretty.js +10 -10
- package/lib/schema-component/antd/input-number/ReadPretty.js +1 -1
- package/lib/schema-component/antd/markdown/Markdown.Void.Designer.js +6 -5
- package/lib/schema-component/antd/markdown/Markdown.Void.js +138 -111
- package/lib/schema-component/antd/markdown/Markdown.js +2 -2
- package/lib/schema-component/antd/markdown/util.js +5 -0
- package/lib/schema-component/antd/rich-text/RichText.js +2 -2
- package/lib/schema-component/antd/select/FormulaSelect.js +1 -2
- package/lib/schema-component/antd/select/ReadPretty.js +2 -2
- package/lib/schema-component/antd/select/Select.js +1 -2
- package/lib/schema-component/antd/select/utils.js +6 -3
- package/lib/schema-component/antd/time-picker/ReadPretty.js +2 -2
- package/lib/schema-component/antd/upload/ReadPretty.js +5 -5
- package/lib/schema-component/antd/upload/Upload.js +6 -5
- package/lib/schema-component/antd/variable/Input.js +1 -1
- package/lib/schema-component/antd/variable/TextArea.js +1 -1
- package/lib/schema-component/hooks/useDesigner.js +57 -23
- package/lib/schema-component/hooks/useOptionalNavigate.js +36 -0
- package/lib/schema-settings/DataTemplates/components/Designer.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useBaseVariable.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useBlockCollection.js +2 -2
- package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +2 -2
- package/lib/schema-settings/VariableInput/hooks/useRecordVariable.js +2 -2
- package/lib/style/theme/AntdAppProvider.js +4 -4
- package/lib/user/CurrentUserContext.js +42 -0
- package/lib/user/CurrentUserProvider.js +6 -14
- package/lib/user/index.js +24 -12
- package/lib/variables/VariablesProvider.js +2 -2
- package/package.json +5 -4
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export declare const DataSourceContext_deprecated: React.Context<any>;
|
|
3
3
|
export declare const ds: {
|
|
4
4
|
useSelectedRowKeys: () => any[];
|
|
5
|
-
useDataSource_deprecated: (options: any) => import("../
|
|
5
|
+
useDataSource_deprecated: (options: any) => import("../").UseRequestResult<unknown>;
|
|
6
6
|
useCreateAction: () => {
|
|
7
7
|
run(): Promise<void>;
|
|
8
8
|
};
|
|
@@ -3,8 +3,7 @@ import type { Collection, CollectionOptions } from '../collection';
|
|
|
3
3
|
import { CollectionFieldInterfaceManager, type CollectionFieldInterfaceFactory } from '../collection-field-interface';
|
|
4
4
|
import { CollectionTemplateManager, type CollectionTemplateFactory } from '../collection-template';
|
|
5
5
|
import { DataSource, DataSourceFactory, type DataSourceOptions } from './DataSource';
|
|
6
|
-
export
|
|
7
|
-
export declare const DEFAULT_DATA_SOURCE_TITLE = "{{t(\"Main\")}}";
|
|
6
|
+
export { DEFAULT_DATA_SOURCE_KEY, DEFAULT_DATA_SOURCE_TITLE } from './constants';
|
|
8
7
|
export interface DataSourceManagerOptions {
|
|
9
8
|
collectionTemplates?: CollectionTemplateFactory[];
|
|
10
9
|
fieldInterfaces?: CollectionFieldInterfaceFactory[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import lodash from "lodash";
|
|
2
2
|
import { CollectionFieldInterfaceManager } from "../collection-field-interface/index.mjs";
|
|
3
3
|
import { CollectionTemplateManager } from "../collection-template/index.mjs";
|
|
4
|
+
import { DEFAULT_DATA_SOURCE_KEY, DEFAULT_DATA_SOURCE_TITLE } from "./constants.mjs";
|
|
4
5
|
import { LocalDataSource } from "./DataSource.mjs";
|
|
5
6
|
function _define_property(obj, key, value) {
|
|
6
7
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -12,8 +13,6 @@ function _define_property(obj, key, value) {
|
|
|
12
13
|
else obj[key] = value;
|
|
13
14
|
return obj;
|
|
14
15
|
}
|
|
15
|
-
const DEFAULT_DATA_SOURCE_KEY = 'main';
|
|
16
|
-
const DEFAULT_DATA_SOURCE_TITLE = '{{t("Main")}}';
|
|
17
16
|
class DataSourceManager {
|
|
18
17
|
addCollectionMixins() {
|
|
19
18
|
let mixins = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionFieldOptions } from './collection';
|
|
2
|
-
import { DataSourceManager } from './data-source/DataSourceManager';
|
|
1
|
+
import type { CollectionFieldOptions } from './collection/Collection';
|
|
2
|
+
import type { DataSourceManager } from './data-source/DataSourceManager';
|
|
3
3
|
export declare const isTitleField: (dm: DataSourceManager, field: CollectionFieldOptions) => boolean;
|
|
4
4
|
export declare const useDataSourceHeaders: (dataSource?: string) => any;
|
package/es/data-source/utils.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import { DEFAULT_DATA_SOURCE_KEY } from "./data-source/
|
|
2
|
+
import { DEFAULT_DATA_SOURCE_KEY } from "./data-source/constants.mjs";
|
|
3
3
|
const isTitleField = (dm, field)=>{
|
|
4
4
|
var _dm_collectionFieldInterfaceManager_getFieldInterface;
|
|
5
5
|
return !field.isForeignKey && (null == (_dm_collectionFieldInterfaceManager_getFieldInterface = dm.collectionFieldInterfaceManager.getFieldInterface(field.interface)) ? void 0 : _dm_collectionFieldInterfaceManager_getFieldInterface.titleUsable);
|
package/es/exports.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export * from './built-in/acl';
|
|
2
|
+
export * from './api-client';
|
|
3
|
+
export * from './application';
|
|
4
|
+
export * from './async-data-provider';
|
|
5
|
+
export * from './block-provider';
|
|
6
|
+
export * from './collection-manager';
|
|
7
|
+
export * from './common';
|
|
8
|
+
export * from './style/css-variable';
|
|
9
|
+
export * from './data-source';
|
|
10
|
+
export * from './built-in/document-title';
|
|
11
|
+
export * from './filter-provider';
|
|
12
|
+
export * from './flag-provider';
|
|
13
|
+
export * from './style/theme';
|
|
14
|
+
export * from './hooks';
|
|
15
|
+
export * from './i18n';
|
|
16
|
+
export * from './icon';
|
|
17
|
+
export { default as locale } from './locale';
|
|
18
|
+
export * from './built-in';
|
|
19
|
+
export * from './built-in/pinned-list';
|
|
20
|
+
export * from './built-in/pm';
|
|
21
|
+
export * from './powered-by';
|
|
22
|
+
export * from './record-provider';
|
|
23
|
+
export * from './route-switch';
|
|
24
|
+
export * from './schema-component';
|
|
25
|
+
export * from './schema-initializer';
|
|
26
|
+
export * from './schema-items';
|
|
27
|
+
export * from './schema-settings';
|
|
28
|
+
export * from './schema-templates';
|
|
29
|
+
export * from './style';
|
|
30
|
+
export type { CustomToken } from './style/theme';
|
|
31
|
+
export * from './built-in/system-settings';
|
|
32
|
+
export * from './testUtils';
|
|
33
|
+
export * from './user';
|
|
34
|
+
export * from './variables';
|
|
35
|
+
export { withDynamicSchemaProps } from './application/hoc/withDynamicSchemaProps';
|
|
36
|
+
export * from './modules/blocks/BlockSchemaToolbar';
|
|
37
|
+
export * from './modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem';
|
|
38
|
+
export * from './modules/blocks/data-blocks/form';
|
|
39
|
+
export * from './modules/blocks/data-blocks/table';
|
|
40
|
+
export * from './modules/blocks/data-blocks/table-selector';
|
|
41
|
+
export * from './modules/fields/component/SubTable/secondLevelSelect';
|
|
42
|
+
export { useTranslation } from 'react-i18next';
|
|
43
|
+
export * from 'react-i18next';
|
|
44
|
+
export { useHotkeys } from 'react-hotkeys-hook';
|
|
45
|
+
export * from './modules/blocks/useParentRecordCommon';
|
|
46
|
+
export { findSchema as findSchemaUtils, removeGridFormItem } from './schema-initializer/utils';
|
package/es/exports.mjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import locale from "./locale/index.mjs";
|
|
2
|
+
import { withDynamicSchemaProps } from "./application/hoc/withDynamicSchemaProps.mjs";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
5
|
+
import { findSchema, removeGridFormItem } from "./schema-initializer/utils.mjs";
|
|
6
|
+
export * from "./built-in/acl/index.mjs";
|
|
7
|
+
export * from "./api-client/index.mjs";
|
|
8
|
+
export * from "./application/index.mjs";
|
|
9
|
+
export * from "./async-data-provider/index.mjs";
|
|
10
|
+
export * from "./block-provider/index.mjs";
|
|
11
|
+
export * from "./collection-manager/index.mjs";
|
|
12
|
+
export * from "./common/index.mjs";
|
|
13
|
+
export * from "./style/css-variable/index.mjs";
|
|
14
|
+
export * from "./data-source/index.mjs";
|
|
15
|
+
export * from "./built-in/document-title/index.mjs";
|
|
16
|
+
export * from "./filter-provider/index.mjs";
|
|
17
|
+
export * from "./flag-provider/index.mjs";
|
|
18
|
+
export * from "./style/theme/index.mjs";
|
|
19
|
+
export * from "./hooks/index.mjs";
|
|
20
|
+
export * from "./i18n/index.mjs";
|
|
21
|
+
export * from "./icon/index.mjs";
|
|
22
|
+
export * from "./built-in/index.mjs";
|
|
23
|
+
export * from "./built-in/pinned-list/index.mjs";
|
|
24
|
+
export * from "./built-in/pm/index.mjs";
|
|
25
|
+
export * from "./powered-by/index.mjs";
|
|
26
|
+
export * from "./record-provider/index.mjs";
|
|
27
|
+
export * from "./route-switch/index.mjs";
|
|
28
|
+
export * from "./schema-component/index.mjs";
|
|
29
|
+
export * from "./schema-initializer/index.mjs";
|
|
30
|
+
export * from "./schema-items/index.mjs";
|
|
31
|
+
export * from "./schema-settings/index.mjs";
|
|
32
|
+
export * from "./schema-templates/index.mjs";
|
|
33
|
+
export * from "./style/index.mjs";
|
|
34
|
+
export * from "./built-in/system-settings/index.mjs";
|
|
35
|
+
export * from "./testUtils/index.mjs";
|
|
36
|
+
export * from "./user/index.mjs";
|
|
37
|
+
export * from "./variables/index.mjs";
|
|
38
|
+
export * from "./modules/blocks/BlockSchemaToolbar.mjs";
|
|
39
|
+
export * from "./modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.mjs";
|
|
40
|
+
export * from "./modules/blocks/data-blocks/form/index.mjs";
|
|
41
|
+
export * from "./modules/blocks/data-blocks/table/index.mjs";
|
|
42
|
+
export * from "./modules/blocks/data-blocks/table-selector/index.mjs";
|
|
43
|
+
export * from "./modules/fields/component/SubTable/secondLevelSelect.mjs";
|
|
44
|
+
export * from "react-i18next";
|
|
45
|
+
export * from "./modules/blocks/useParentRecordCommon.mjs";
|
|
46
|
+
export { findSchema as findSchemaUtils, locale, removeGridFormItem, useHotkeys, useTranslation, withDynamicSchemaProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from '@tachybase/schema';
|
|
2
2
|
import { FilterTarget } from '../block-provider/hooks';
|
|
3
3
|
import { Collection_deprecated, CollectionFieldOptions_deprecated, FieldOptions, useCollection_deprecated } from '../collection-manager';
|
|
4
|
-
import {
|
|
4
|
+
import { FILTER_OPERATORS_WITH_ARRAY_VALUES, normalizeDateBetweenValue, shouldUseDefaultDateBoundary } from '../schema-component/antd/filter/dateValueUtils';
|
|
5
5
|
import { DataBlock } from './FilterProvider';
|
|
6
6
|
export declare enum FilterBlockType {
|
|
7
7
|
FORM = 0,
|
|
@@ -10,10 +10,7 @@ export declare enum FilterBlockType {
|
|
|
10
10
|
COLLAPSE = 3
|
|
11
11
|
}
|
|
12
12
|
export declare const mergeFilter: (filters: any[], op?: string) => any;
|
|
13
|
-
|
|
14
|
-
* 筛选值为数组的操作符;与 transformToFilter 的 flatten breakOn、filterByCleanedFields 路径去重共用,避免两处列表漂移。
|
|
15
|
-
*/
|
|
16
|
-
export declare const FILTER_OPERATORS_WITH_ARRAY_VALUES: Set<string>;
|
|
13
|
+
export { FILTER_OPERATORS_WITH_ARRAY_VALUES, normalizeDateBetweenValue, shouldUseDefaultDateBoundary };
|
|
17
14
|
export declare const getSupportFieldsByAssociation: (inheritCollectionsChain: string[], block: DataBlock) => CollectionFieldOptions_deprecated[];
|
|
18
15
|
export declare const getSupportFieldsByForeignKey: (filterBlockCollection: ReturnType<typeof useCollection_deprecated>, block: DataBlock) => import("./FilterProvider").ForeignKeyField[];
|
|
19
16
|
/**
|
|
@@ -22,14 +19,6 @@ export declare const getSupportFieldsByForeignKey: (filterBlockCollection: Retur
|
|
|
22
19
|
* @returns
|
|
23
20
|
*/
|
|
24
21
|
export declare const useSupportedBlocks: (filterBlockType: FilterBlockType) => DataBlock[];
|
|
25
|
-
type NormalizeDateBetweenOptions = {
|
|
26
|
-
useDefaultDateBoundary?: boolean;
|
|
27
|
-
valueMode?: DatePickerRangeValueMode;
|
|
28
|
-
valueSource?: DatePickerRangeValueSource;
|
|
29
|
-
preferDateBoundaryFallback?: boolean;
|
|
30
|
-
};
|
|
31
|
-
export declare const normalizeDateBetweenValue: (value: any[], options?: NormalizeDateBetweenOptions) => any[];
|
|
32
|
-
export declare const shouldUseDefaultDateBoundary: (fieldSchema?: any) => boolean;
|
|
33
22
|
export declare const transformToFilter: (values: Record<string, any>, fieldSchema: Schema, getCollectionJoinField: (name: string) => CollectionFieldOptions_deprecated, collectionName: string, getOperatorList?: (path: string, options: {
|
|
34
23
|
fieldSchema?: Schema;
|
|
35
24
|
collectionField?: CollectionFieldOptions_deprecated;
|
|
@@ -58,4 +47,3 @@ export declare const useFilterAPI: () => {
|
|
|
58
47
|
doFilter: (value: any, field?: string | ((target: FilterTarget["targets"][0]) => string), operator?: string | ((target: FilterTarget["targets"][0]) => string)) => void;
|
|
59
48
|
};
|
|
60
49
|
export declare const isInFilterFormBlock: (fieldSchema: Schema) => boolean;
|
|
61
|
-
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { useFieldSchema } from "@tachybase/schema";
|
|
3
3
|
import { flatten, getValuesByPath } from "@tego/client";
|
|
4
|
-
import dayjs from "dayjs";
|
|
5
4
|
import lodash from "lodash";
|
|
6
5
|
import { findFilterTargets } from "../block-provider/hooks/index.mjs";
|
|
7
6
|
import { useCollectionManager_deprecated, useCollection_deprecated } from "../collection-manager/index.mjs";
|
|
8
7
|
import { removeNullCondition } from "../schema-component/index.mjs";
|
|
9
|
-
import {
|
|
8
|
+
import { resolveDatePickerRangeValueInfo } from "../schema-component/antd/date-picker/util.mjs";
|
|
9
|
+
import { FILTER_OPERATORS_WITH_ARRAY_VALUES, normalizeDateBetweenValue, shouldUseDefaultDateBoundary } from "../schema-component/antd/filter/dateValueUtils.mjs";
|
|
10
10
|
import { findFilterOperators, getDefaultFilterOperatorValue } from "../schema-component/antd/form-item/SchemaSettingOptions.mjs";
|
|
11
11
|
import { useFilterBlock } from "./FilterProvider.mjs";
|
|
12
12
|
import { getFilterSourceDefaultFilter } from "./incomingFilterFromSources.mjs";
|
|
@@ -28,17 +28,6 @@ const mergeFilter = function(filters) {
|
|
|
28
28
|
[op]: items
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
const FILTER_OPERATORS_WITH_ARRAY_VALUES = new Set([
|
|
32
|
-
'$match',
|
|
33
|
-
'$notMatch',
|
|
34
|
-
'$anyOf',
|
|
35
|
-
'$noneOf',
|
|
36
|
-
'$childIn',
|
|
37
|
-
'$childNotIn',
|
|
38
|
-
'$dateBetween',
|
|
39
|
-
'$in',
|
|
40
|
-
'$notIn'
|
|
41
|
-
]);
|
|
42
31
|
const getSupportFieldsByAssociation = (inheritCollectionsChain, block)=>{
|
|
43
32
|
var _block_associatedFields;
|
|
44
33
|
return null == (_block_associatedFields = block.associatedFields) ? void 0 : _block_associatedFields.filter((field)=>null == inheritCollectionsChain ? void 0 : inheritCollectionsChain.some((collectionName)=>collectionName === field.target));
|
|
@@ -101,50 +90,6 @@ const getDatePickerShowTime = (fieldSchema)=>{
|
|
|
101
90
|
var _fieldSchema_xcomponentprops;
|
|
102
91
|
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
|
|
103
92
|
};
|
|
104
|
-
const isDateOnlyString = (value)=>'string' == typeof value && /^\d{4}-\d{2}-\d{2}$/.test(value);
|
|
105
|
-
const hasExplicitTime = (value)=>'string' == typeof value && /[T\s]\d{2}:\d{2}/.test(value);
|
|
106
|
-
const normalizeLocalDateBoundaryInput = (value)=>{
|
|
107
|
-
if ('string' != typeof value) return value;
|
|
108
|
-
return value.replace(/Z$/, '').replace(/[+-]\d\d:\d\d$/, '');
|
|
109
|
-
};
|
|
110
|
-
const normalizeDateBetweenBoundary = function(value, boundary) {
|
|
111
|
-
let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
|
|
112
|
-
const m = dayjs(value);
|
|
113
|
-
if (!m.isValid()) return value;
|
|
114
|
-
if (isDateOnlyString(value)) return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
|
|
115
|
-
if ('date' === options.valueMode) {
|
|
116
|
-
if ('metadata' === options.valueSource || 'retained-local-date-boundary' === options.valueSource) return m.toISOString();
|
|
117
|
-
const localBoundary = dayjs(normalizeLocalDateBoundaryInput(value));
|
|
118
|
-
return ('start' === boundary ? localBoundary.startOf('day') : localBoundary.endOf('day')).toISOString();
|
|
119
|
-
}
|
|
120
|
-
if (hasExplicitTime(value)) return m.toISOString();
|
|
121
|
-
if (!options.useDefaultDateBoundary) return m.toISOString();
|
|
122
|
-
return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
|
|
123
|
-
};
|
|
124
|
-
const shouldApplyDefaultDateBoundary = function(start, end, value) {
|
|
125
|
-
let options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
|
|
126
|
-
if ('datetime' === options.valueMode) return false;
|
|
127
|
-
if ('date' === options.valueMode) return true;
|
|
128
|
-
if (!options.useDefaultDateBoundary) return false;
|
|
129
|
-
if (isDateOnlyString(start) || isDateOnlyString(end)) return true;
|
|
130
|
-
return options.preferDateBoundaryFallback && 'date' === options.valueMode && isDatePickerDefaultRangeBoundaryValue(start, 'start') && isDatePickerDefaultRangeBoundaryValue(end, 'end');
|
|
131
|
-
};
|
|
132
|
-
const normalizeDateBetweenValue = function(value) {
|
|
133
|
-
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
134
|
-
const normalized = value.filter(Boolean);
|
|
135
|
-
if (0 === normalized.length) return null;
|
|
136
|
-
const start = normalized[0];
|
|
137
|
-
const end = 1 === normalized.length ? normalized[0] : normalized[normalized.length - 1];
|
|
138
|
-
const boundaryOptions = {
|
|
139
|
-
...options,
|
|
140
|
-
useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, value, options)
|
|
141
|
-
};
|
|
142
|
-
return [
|
|
143
|
-
normalizeDateBetweenBoundary(start, 'start', boundaryOptions),
|
|
144
|
-
normalizeDateBetweenBoundary(end, 'end', boundaryOptions)
|
|
145
|
-
];
|
|
146
|
-
};
|
|
147
|
-
const shouldUseDefaultDateBoundary = (fieldSchema)=>'DatePicker.RangePicker' === getDatePickerComponent(fieldSchema);
|
|
148
93
|
const transformToFilter = (values, fieldSchema, getCollectionJoinField, collectionName, getOperatorList)=>{
|
|
149
94
|
const { operators } = findFilterOperators(fieldSchema);
|
|
150
95
|
values = flatten(values, {
|
package/es/index.d.ts
CHANGED
|
@@ -1,49 +1,4 @@
|
|
|
1
1
|
import 'antd/dist/reset.css';
|
|
2
2
|
import './global.less';
|
|
3
3
|
import './preload';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './api-client';
|
|
6
|
-
export * from './application';
|
|
7
|
-
export * from './async-data-provider';
|
|
8
|
-
export * from './block-provider';
|
|
9
|
-
export * from './collection-manager';
|
|
10
|
-
export * from './common';
|
|
11
|
-
export * from './style/css-variable';
|
|
12
|
-
export * from './data-source';
|
|
13
|
-
export * from './built-in/document-title';
|
|
14
|
-
export * from './filter-provider';
|
|
15
|
-
export * from './flag-provider';
|
|
16
|
-
export * from './style/theme';
|
|
17
|
-
export * from './hooks';
|
|
18
|
-
export * from './i18n';
|
|
19
|
-
export * from './icon';
|
|
20
|
-
export { default as locale } from './locale';
|
|
21
|
-
export * from './built-in';
|
|
22
|
-
export * from './built-in/pinned-list';
|
|
23
|
-
export * from './built-in/pm';
|
|
24
|
-
export * from './powered-by';
|
|
25
|
-
export * from './record-provider';
|
|
26
|
-
export * from './route-switch';
|
|
27
|
-
export * from './schema-component';
|
|
28
|
-
export * from './schema-initializer';
|
|
29
|
-
export * from './schema-items';
|
|
30
|
-
export * from './schema-settings';
|
|
31
|
-
export * from './schema-templates';
|
|
32
|
-
export * from './style';
|
|
33
|
-
export type { CustomToken } from './style/theme';
|
|
34
|
-
export * from './built-in/system-settings';
|
|
35
|
-
export * from './testUtils';
|
|
36
|
-
export * from './user';
|
|
37
|
-
export * from './variables';
|
|
38
|
-
export { withDynamicSchemaProps } from './application/hoc/withDynamicSchemaProps';
|
|
39
|
-
export * from './modules/blocks/BlockSchemaToolbar';
|
|
40
|
-
export * from './modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem';
|
|
41
|
-
export * from './modules/blocks/data-blocks/form';
|
|
42
|
-
export * from './modules/blocks/data-blocks/table';
|
|
43
|
-
export * from './modules/blocks/data-blocks/table-selector';
|
|
44
|
-
export * from './modules/fields/component/SubTable/secondLevelSelect';
|
|
45
|
-
export { useTranslation } from 'react-i18next';
|
|
46
|
-
export * from 'react-i18next';
|
|
47
|
-
export { useHotkeys } from 'react-hotkeys-hook';
|
|
48
|
-
export * from './modules/blocks/useParentRecordCommon';
|
|
49
|
-
export { findSchema as findSchemaUtils, removeGridFormItem } from './schema-initializer/utils';
|
|
4
|
+
export * from './exports';
|
package/es/index.mjs
CHANGED
|
@@ -1,49 +1,7 @@
|
|
|
1
1
|
import "antd/dist/reset.css";
|
|
2
2
|
import "./global.css";
|
|
3
3
|
import "./preload.mjs";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { findSchema, removeGridFormItem } from "./schema-initializer/utils.mjs";
|
|
9
|
-
export * from "./built-in/acl/index.mjs";
|
|
10
|
-
export * from "./api-client/index.mjs";
|
|
11
|
-
export * from "./application/index.mjs";
|
|
12
|
-
export * from "./async-data-provider/index.mjs";
|
|
13
|
-
export * from "./block-provider/index.mjs";
|
|
14
|
-
export * from "./collection-manager/index.mjs";
|
|
15
|
-
export * from "./common/index.mjs";
|
|
16
|
-
export * from "./style/css-variable/index.mjs";
|
|
17
|
-
export * from "./data-source/index.mjs";
|
|
18
|
-
export * from "./built-in/document-title/index.mjs";
|
|
19
|
-
export * from "./filter-provider/index.mjs";
|
|
20
|
-
export * from "./flag-provider/index.mjs";
|
|
21
|
-
export * from "./style/theme/index.mjs";
|
|
22
|
-
export * from "./hooks/index.mjs";
|
|
23
|
-
export * from "./i18n/index.mjs";
|
|
24
|
-
export * from "./icon/index.mjs";
|
|
25
|
-
export * from "./built-in/index.mjs";
|
|
26
|
-
export * from "./built-in/pinned-list/index.mjs";
|
|
27
|
-
export * from "./built-in/pm/index.mjs";
|
|
28
|
-
export * from "./powered-by/index.mjs";
|
|
29
|
-
export * from "./record-provider/index.mjs";
|
|
30
|
-
export * from "./route-switch/index.mjs";
|
|
31
|
-
export * from "./schema-component/index.mjs";
|
|
32
|
-
export * from "./schema-initializer/index.mjs";
|
|
33
|
-
export * from "./schema-items/index.mjs";
|
|
34
|
-
export * from "./schema-settings/index.mjs";
|
|
35
|
-
export * from "./schema-templates/index.mjs";
|
|
36
|
-
export * from "./style/index.mjs";
|
|
37
|
-
export * from "./built-in/system-settings/index.mjs";
|
|
38
|
-
export * from "./testUtils/index.mjs";
|
|
39
|
-
export * from "./user/index.mjs";
|
|
40
|
-
export * from "./variables/index.mjs";
|
|
41
|
-
export * from "./modules/blocks/BlockSchemaToolbar.mjs";
|
|
42
|
-
export * from "./modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.mjs";
|
|
43
|
-
export * from "./modules/blocks/data-blocks/form/index.mjs";
|
|
44
|
-
export * from "./modules/blocks/data-blocks/table/index.mjs";
|
|
45
|
-
export * from "./modules/blocks/data-blocks/table-selector/index.mjs";
|
|
46
|
-
export * from "./modules/fields/component/SubTable/secondLevelSelect.mjs";
|
|
47
|
-
export * from "react-i18next";
|
|
48
|
-
export * from "./modules/blocks/useParentRecordCommon.mjs";
|
|
49
|
-
export { findSchema as findSchemaUtils, locale, removeGridFormItem, useHotkeys, useTranslation, withDynamicSchemaProps };
|
|
4
|
+
import { registerTachybaseClientExports } from "./application/utils/clientModuleRegistry.mjs";
|
|
5
|
+
export * from "./exports.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__exports_mjs_ae3a2e60__ from "./exports.mjs";
|
|
7
|
+
registerTachybaseClientExports(__WEBPACK_EXTERNAL_MODULE__exports_mjs_ae3a2e60__);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISchema } from '@tachybase/schema';
|
|
2
2
|
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
|
3
|
-
import {
|
|
3
|
+
import type { SchemaSettingsItemType } from '../../../../application/schema-settings/types';
|
|
4
4
|
export declare const setDefaultSortingRules: {
|
|
5
5
|
name: string;
|
|
6
6
|
type: string;
|
|
@@ -30,91 +30,7 @@ export declare const allowAddNewData: {
|
|
|
30
30
|
onChange(value: any): void;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
export declare const clickToSelect:
|
|
34
|
-
name: string;
|
|
35
|
-
type: string;
|
|
36
|
-
useVisible(): boolean;
|
|
37
|
-
useComponentProps(): {
|
|
38
|
-
components: {
|
|
39
|
-
Switch: import("react").ForwardRefExoticComponent<Omit<import("antd").SwitchProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
40
|
-
SecondLevelSelect: import("react").ForwardRefExoticComponent<import("antd").SelectProps<any, any> & {
|
|
41
|
-
objectValue?: boolean;
|
|
42
|
-
onChange?: (v: any) => void;
|
|
43
|
-
multiple: boolean;
|
|
44
|
-
rawOptions: any[];
|
|
45
|
-
fieldNames: FieldNames;
|
|
46
|
-
firstLevelValue: string;
|
|
47
|
-
collectionField: string;
|
|
48
|
-
} & import("react").RefAttributes<never>>;
|
|
49
|
-
};
|
|
50
|
-
title: string;
|
|
51
|
-
schema: {
|
|
52
|
-
type: string;
|
|
53
|
-
title: string;
|
|
54
|
-
properties: {
|
|
55
|
-
isquickaddtabs: {
|
|
56
|
-
title: string;
|
|
57
|
-
type: string;
|
|
58
|
-
default: any;
|
|
59
|
-
'x-decorator': string;
|
|
60
|
-
'x-component': string;
|
|
61
|
-
'x-component-props': {};
|
|
62
|
-
};
|
|
63
|
-
firstLevelselection: {
|
|
64
|
-
title: string;
|
|
65
|
-
default: any;
|
|
66
|
-
'x-decorator': string;
|
|
67
|
-
'x-component': string;
|
|
68
|
-
enum: {
|
|
69
|
-
label: any;
|
|
70
|
-
value: any;
|
|
71
|
-
name?: any;
|
|
72
|
-
collectionName?: string;
|
|
73
|
-
sourceKey?: string;
|
|
74
|
-
uiSchema?: any;
|
|
75
|
-
target?: string;
|
|
76
|
-
}[];
|
|
77
|
-
'x-reactions': {
|
|
78
|
-
dependencies: string[];
|
|
79
|
-
fulfill: {
|
|
80
|
-
state: {
|
|
81
|
-
visible: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
}[];
|
|
85
|
-
'x-component-props': {
|
|
86
|
-
onChange(value: any): void;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
secondLevelselection: {
|
|
90
|
-
title: string;
|
|
91
|
-
default: any;
|
|
92
|
-
'x-decorator': string;
|
|
93
|
-
'x-component': string;
|
|
94
|
-
'x-reactions': {
|
|
95
|
-
dependencies: string[];
|
|
96
|
-
fulfill: {
|
|
97
|
-
state: {
|
|
98
|
-
visible: string;
|
|
99
|
-
};
|
|
100
|
-
schema: {
|
|
101
|
-
'x-component-props': {
|
|
102
|
-
firstLevelValue: string;
|
|
103
|
-
collectionField: any;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
}[];
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
onSubmit: ({ isquickaddtabs, firstLevelselection, secondLevelselection }: {
|
|
112
|
-
isquickaddtabs: any;
|
|
113
|
-
firstLevelselection: any;
|
|
114
|
-
secondLevelselection: any;
|
|
115
|
-
}) => Promise<void>;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
33
|
+
export declare const clickToSelect: SchemaSettingsItemType;
|
|
118
34
|
export declare const tablePagination: {
|
|
119
35
|
name: string;
|
|
120
36
|
type: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
|
-
import { useCollection_deprecated } from "../collection-manager/
|
|
4
|
-
import { CollectionRecordProvider } from "../data-source/
|
|
5
|
-
import { useCurrentUserContext } from "../user/
|
|
3
|
+
import { useCollection_deprecated } from "../collection-manager/hooks/useCollection_deprecated.mjs";
|
|
4
|
+
import { CollectionRecordProvider } from "../data-source/collection-record/CollectionRecordProvider.mjs";
|
|
5
|
+
import { useCurrentUserContext } from "../user/CurrentUserContext.mjs";
|
|
6
6
|
const RecordContext_deprecated = /*#__PURE__*/ createContext({});
|
|
7
7
|
RecordContext_deprecated.displayName = 'RecordContext_deprecated';
|
|
8
8
|
const RecordIndexContext = /*#__PURE__*/ createContext(null);
|
|
@@ -6,8 +6,6 @@ import { App, Button } from "antd";
|
|
|
6
6
|
import classnames from "classnames";
|
|
7
7
|
import lodash from "lodash";
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
|
-
import { useNavigate } from "react-router-dom";
|
|
10
|
-
import { StablePopover, useActionContext, useDesignable } from "../../index.mjs";
|
|
11
9
|
import { useApp } from "../../../application/index.mjs";
|
|
12
10
|
import { withDynamicSchemaProps } from "../../../application/hoc/withDynamicSchemaProps.mjs";
|
|
13
11
|
import { useACLActionParamsContext } from "../../../built-in/acl/index.mjs";
|
|
@@ -18,7 +16,10 @@ import { RecordProvider } from "../../../record-provider/index.mjs";
|
|
|
18
16
|
import { useLocalVariables, useVariables } from "../../../variables/index.mjs";
|
|
19
17
|
import { SortableItem } from "../../common/index.mjs";
|
|
20
18
|
import { useCompile, useComponent, useDesigner } from "../../hooks/index.mjs";
|
|
19
|
+
import { useDesignable } from "../../hooks/useDesignable.mjs";
|
|
20
|
+
import { useOptionalNavigate } from "../../hooks/useOptionalNavigate.mjs";
|
|
21
21
|
import { useProps } from "../../hooks/useProps.mjs";
|
|
22
|
+
import { StablePopover } from "../popover/Popover.mjs";
|
|
22
23
|
import { ActionArea } from "./Action.Area.mjs";
|
|
23
24
|
import Action_Container from "./Action.Container.mjs";
|
|
24
25
|
import { ActionDesigner } from "./Action.Designer.mjs";
|
|
@@ -28,15 +29,15 @@ import { ActionModal } from "./Action.Modal.mjs";
|
|
|
28
29
|
import { ActionPage } from "./Action.Page.mjs";
|
|
29
30
|
import Action_style from "./Action.style.mjs";
|
|
30
31
|
import { ActionContextProvider } from "./context.mjs";
|
|
31
|
-
import { useA } from "./hooks.mjs";
|
|
32
|
+
import { useA, useActionContext } from "./hooks.mjs";
|
|
32
33
|
import { useCompiledAction } from "./hooks/useCompiledAction.mjs";
|
|
33
34
|
import { useGetAriaLabelOfAction } from "./hooks/useGetAriaLabelOfAction.mjs";
|
|
34
35
|
import { linkageAction } from "./utils.mjs";
|
|
35
36
|
const Action = withDynamicSchemaProps(observer((props)=>{
|
|
36
|
-
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _field_data, _field_data1;
|
|
37
|
+
var _app_usePageMode, _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _field_data, _field_data1;
|
|
37
38
|
const { isShow = true, popover, confirm, openMode: om, containerRefKey, component, useAction = useA, className, icon, title, onClick, style, openSize: os, disabled: propsDisabled, actionCallback, addChild, ...others } = useProps(props);
|
|
38
39
|
const aclCtx = useACLActionParamsContext();
|
|
39
|
-
const navigate =
|
|
40
|
+
const navigate = useOptionalNavigate();
|
|
40
41
|
const { wrapSSR, componentCls, hashId } = Action_style();
|
|
41
42
|
const { t } = useTranslation();
|
|
42
43
|
const [visible, setVisible] = useState(false);
|
|
@@ -44,7 +45,7 @@ const Action = withDynamicSchemaProps(observer((props)=>{
|
|
|
44
45
|
const Designer = useDesigner();
|
|
45
46
|
const field = useField();
|
|
46
47
|
const app = useApp();
|
|
47
|
-
const pageMode = app.usePageMode();
|
|
48
|
+
const pageMode = null == (_app_usePageMode = app.usePageMode) ? void 0 : _app_usePageMode.call(app);
|
|
48
49
|
const fieldSchema = useFieldSchema();
|
|
49
50
|
const { run, element } = useCompiledAction(useAction, actionCallback);
|
|
50
51
|
const form = useForm();
|
|
@@ -2,7 +2,7 @@ import { useContext } from "react";
|
|
|
2
2
|
import { useFieldSchema, useForm } from "@tachybase/schema";
|
|
3
3
|
import { App } from "antd";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import {
|
|
5
|
+
import { useFormBlockContext } from "../../../block-provider/FormBlockContext.mjs";
|
|
6
6
|
import { ActionContext } from "./context.mjs";
|
|
7
7
|
const useA = ()=>({
|
|
8
8
|
async run () {}
|
|
@@ -48,7 +48,8 @@ const useCloseAction = ()=>{
|
|
|
48
48
|
};
|
|
49
49
|
const useLinkageAction = ()=>{
|
|
50
50
|
const fieldSchema = useFieldSchema();
|
|
51
|
-
const
|
|
51
|
+
const ctx = useFormBlockContext();
|
|
52
|
+
const isRecordAction = 'create' !== ctx.type && (null == fieldSchema ? void 0 : fieldSchema['x-acl-action']) !== 'create' && (null == fieldSchema ? void 0 : fieldSchema['x-action']) !== 'create';
|
|
52
53
|
const isAction = [
|
|
53
54
|
'Action.Link',
|
|
54
55
|
'Action'
|
|
@@ -9,7 +9,7 @@ import { RecordProvider, useAPIClient, useApp, useCollectionRecordData } from ".
|
|
|
9
9
|
import { isVariable } from "../../../variables/utils/isVariable.mjs";
|
|
10
10
|
import { getInnermostKeyAndValue } from "../../common/utils/uitls.mjs";
|
|
11
11
|
import { RemoteSelect } from "../remote-select/index.mjs";
|
|
12
|
-
import hooks, { useAssociationFieldContext } from "./hooks.mjs";
|
|
12
|
+
import hooks, { useAssociationFieldContext, useFieldNames } from "./hooks.mjs";
|
|
13
13
|
const filterAnalyses = (filters)=>{
|
|
14
14
|
if (!filters) return;
|
|
15
15
|
const type = Object.keys(filters)[0] || '$and';
|
|
@@ -41,6 +41,7 @@ const InternalAssociationSelect = observer((props)=>{
|
|
|
41
41
|
const isAllowAddNew = fieldSchema['x-add-new'];
|
|
42
42
|
const { t } = useTranslation();
|
|
43
43
|
const { multiple } = props;
|
|
44
|
+
const fieldNames = useFieldNames(props);
|
|
44
45
|
const form = useForm();
|
|
45
46
|
const api = useAPIClient();
|
|
46
47
|
const resource = api.resource(collectionField.target);
|
|
@@ -68,11 +69,10 @@ const InternalAssociationSelect = observer((props)=>{
|
|
|
68
69
|
};
|
|
69
70
|
}, []);
|
|
70
71
|
const handleCreateAction = async (props)=>{
|
|
71
|
-
var _field_componentProps_fieldNames, _field_componentProps;
|
|
72
72
|
const { search: value, callBack } = props;
|
|
73
73
|
const { data: { data } } = await resource.create({
|
|
74
74
|
values: {
|
|
75
|
-
[
|
|
75
|
+
[fieldNames.label || 'id']: value
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
if (data) {
|
|
@@ -121,6 +121,7 @@ const InternalAssociationSelect = observer((props)=>{
|
|
|
121
121
|
width: '100%'
|
|
122
122
|
},
|
|
123
123
|
...props,
|
|
124
|
+
fieldNames: fieldNames,
|
|
124
125
|
size: 'middle',
|
|
125
126
|
objectValue: objectValue,
|
|
126
127
|
value: value || innerValue,
|
|
@@ -130,12 +130,29 @@ function useServiceOptions(props) {
|
|
|
130
130
|
const useFieldNames = (props)=>{
|
|
131
131
|
var _fieldSchema_xcomponentprops_field_uiSchema_xcomponentprops, _fieldSchema_xcomponentprops_field_uiSchema, _fieldSchema_xcomponentprops_field, _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
|
|
132
132
|
const fieldSchema = useFieldSchema();
|
|
133
|
+
const { options: collectionField } = useAssociationFieldContext();
|
|
134
|
+
const { getCollection } = useCollectionManager_deprecated();
|
|
133
135
|
const fieldNames = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : null == (_fieldSchema_xcomponentprops_field = _fieldSchema_xcomponentprops['field']) ? void 0 : null == (_fieldSchema_xcomponentprops_field_uiSchema = _fieldSchema_xcomponentprops_field['uiSchema']) ? void 0 : null == (_fieldSchema_xcomponentprops_field_uiSchema_xcomponentprops = _fieldSchema_xcomponentprops_field_uiSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops_field_uiSchema_xcomponentprops['fieldNames']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['fieldNames']) || props.fieldNames;
|
|
134
|
-
return {
|
|
136
|
+
if (fieldNames) return {
|
|
135
137
|
label: 'label',
|
|
136
138
|
value: 'value',
|
|
137
139
|
...fieldNames
|
|
138
140
|
};
|
|
141
|
+
if (null == collectionField ? void 0 : collectionField.target) {
|
|
142
|
+
const targetCollection = getCollection(collectionField.target);
|
|
143
|
+
if (targetCollection) {
|
|
144
|
+
var _targetCollection_getPrimaryKey;
|
|
145
|
+
const pk = targetCollection.filterTargetKey || (null == (_targetCollection_getPrimaryKey = targetCollection.getPrimaryKey) ? void 0 : _targetCollection_getPrimaryKey.call(targetCollection)) || 'id';
|
|
146
|
+
return {
|
|
147
|
+
label: targetCollection.titleField || pk,
|
|
148
|
+
value: pk
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
label: 'label',
|
|
154
|
+
value: 'value'
|
|
155
|
+
};
|
|
139
156
|
};
|
|
140
157
|
const SubFormContext = createContext(null);
|
|
141
158
|
SubFormContext.displayName = 'SubFormContext';
|