@nocobase/client 0.20.0-alpha.1 → 0.20.0-alpha.11

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.
Files changed (107) hide show
  1. package/.dumirc.ts +1 -5
  2. package/es/application/Application.d.ts +6 -2
  3. package/es/application/PluginSettingsManager.d.ts +1 -0
  4. package/es/application/RouterManager.d.ts +1 -0
  5. package/es/application/WebSocketClient.d.ts +4 -1
  6. package/es/application/schema-initializer/CompatibleSchemaInitializer.d.ts +27 -0
  7. package/es/application/schema-initializer/context/index.d.ts +1 -1
  8. package/es/application/schema-initializer/index.d.ts +1 -0
  9. package/es/block-provider/DetailsBlockProvider.d.ts +3 -0
  10. package/es/block-provider/FormBlockProvider.d.ts +29 -2
  11. package/es/collection-manager/action-hooks.d.ts +3 -3
  12. package/es/collection-manager/index.d.ts +1 -0
  13. package/es/collection-manager/interfaces/index.d.ts +3 -0
  14. package/es/collection-manager/interfaces/nanoid.d.ts +69 -0
  15. package/es/collection-manager/interfaces/unixTimestamp.d.ts +71 -0
  16. package/es/collection-manager/interfaces/uuid.d.ts +56 -0
  17. package/es/collection-manager/utils.d.ts +2 -0
  18. package/es/data-source/data-block/DataBlockProvider.d.ts +1 -0
  19. package/es/data-source/data-source/DataSourceManager.d.ts +5 -2
  20. package/es/filter-provider/FilterProvider.d.ts +7 -0
  21. package/es/index.d.ts +1 -0
  22. package/es/index.mjs +9155 -6349
  23. package/es/modules/actions/add-new/createFormBlockInitializers.d.ts +6 -2
  24. package/es/modules/actions/add-record/customizeCreateFormBlockInitializers.d.ts +6 -2
  25. package/es/modules/actions/view-edit-popup/RecordFormBlockInitializers.d.ts +3 -0
  26. package/es/modules/blocks/data-blocks/details-multi/DetailsActionInitializers.d.ts +7 -2
  27. package/es/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.d.ts +19 -1
  28. package/es/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.d.ts +7 -0
  29. package/es/modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers.d.ts +7 -2
  30. package/es/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.d.ts +6 -2
  31. package/es/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.d.ts +4 -0
  32. package/es/modules/blocks/data-blocks/form/FormBlockInitializer.d.ts +18 -1
  33. package/es/modules/blocks/data-blocks/form/RecordFormBlockInitializer.d.ts +7 -0
  34. package/es/modules/blocks/data-blocks/form/createFormActionInitializers.d.ts +6 -2
  35. package/es/modules/blocks/data-blocks/form/formActionInitializers.d.ts +4 -2
  36. package/es/modules/blocks/data-blocks/form/formItemInitializers.d.ts +7 -2
  37. package/es/modules/blocks/data-blocks/form/updateFormActionInitializers.d.ts +6 -2
  38. package/es/modules/blocks/data-blocks/grid-card/GridCardActionInitializers.d.ts +6 -2
  39. package/es/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.d.ts +18 -1
  40. package/es/modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers.d.ts +6 -2
  41. package/es/modules/blocks/data-blocks/list/ListActionInitializers.d.ts +7 -2
  42. package/es/modules/blocks/data-blocks/list/ListBlockInitializer.d.ts +18 -1
  43. package/es/modules/blocks/data-blocks/list/listItemActionInitializers.d.ts +6 -2
  44. package/es/modules/blocks/data-blocks/table/TableActionColumnInitializers.d.ts +6 -2
  45. package/es/modules/blocks/data-blocks/table/TableActionInitializers.d.ts +7 -2
  46. package/es/modules/blocks/data-blocks/table/TableBlockInitializer.d.ts +14 -1
  47. package/es/modules/blocks/data-blocks/table/TableColumnInitializers.d.ts +6 -2
  48. package/es/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.d.ts +7 -3
  49. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemInitializer.d.ts +6 -1
  50. package/es/modules/blocks/filter-blocks/form/FilterFormActionInitializers.d.ts +7 -2
  51. package/es/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.d.ts +7 -3
  52. package/es/modules/blocks/filter-blocks/form/filterFormItemInitializers.d.ts +6 -2
  53. package/es/modules/fields/component/Picker/TableSelectorInitializers.d.ts +6 -2
  54. package/es/modules/fields/component/UnixTimestamp/unixTimestampComponentFieldSettings.d.ts +2 -0
  55. package/es/modules/menu/menuItemInitializer.d.ts +4 -0
  56. package/es/modules/page/BlockInitializers.d.ts +6 -2
  57. package/es/schema-component/antd/action/Action.Designer.d.ts +3 -0
  58. package/es/schema-component/antd/appends-tree-select/AppendsTreeSelect.d.ts +1 -1
  59. package/es/schema-component/antd/association-field/hooks.d.ts +7 -2
  60. package/es/schema-component/antd/association-field/util.d.ts +2 -2
  61. package/es/schema-component/antd/association-filter/ActionBarAssociationFilterAction.d.ts +5 -0
  62. package/es/schema-component/antd/association-filter/AssociationFilter.Initializer.d.ts +3 -0
  63. package/es/schema-component/antd/collection-select/CollectionSelect.d.ts +7 -0
  64. package/es/schema-component/antd/details/Details.d.ts +2 -7
  65. package/es/schema-component/antd/filter/useFilterActionProps.d.ts +4 -4
  66. package/es/schema-component/antd/form/Form.Settings.d.ts +3 -0
  67. package/es/schema-component/antd/form-item/FormItem.Settings.d.ts +3 -0
  68. package/es/schema-component/antd/form-v2/Form.Settings.d.ts +9 -0
  69. package/es/schema-component/antd/index.d.ts +2 -0
  70. package/es/schema-component/antd/nanoIDInput/NanoIDInput.d.ts +6 -0
  71. package/es/schema-component/antd/nanoIDInput/index.d.ts +1 -0
  72. package/es/schema-component/antd/page/Page.Settings.d.ts +3 -0
  73. package/es/schema-component/antd/page/PageTab.Settings.d.ts +3 -0
  74. package/es/schema-component/antd/table-v2/Table.Column.ActionBar.d.ts +4 -1
  75. package/es/schema-component/antd/unixTimestamp/UnixTimestamp.d.ts +2 -0
  76. package/es/schema-component/antd/unixTimestamp/index.d.ts +1 -0
  77. package/es/schema-initializer/buttons/CustomFormItemInitializers.d.ts +6 -2
  78. package/es/schema-initializer/buttons/RecordBlockInitializers.d.ts +7 -2
  79. package/es/schema-initializer/buttons/SubTableActionInitializers.d.ts +7 -2
  80. package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +10 -1
  81. package/es/schema-initializer/index.d.ts +1 -1
  82. package/es/schema-initializer/items/DataBlockInitializer.d.ts +17 -4
  83. package/es/schema-initializer/items/RecordAssociationBlockInitializer.d.ts +6 -0
  84. package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.d.ts +3 -0
  85. package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.d.ts +7 -0
  86. package/es/schema-initializer/items/RecordAssociationGridCardBlockInitializer.d.ts +6 -0
  87. package/es/schema-initializer/items/RecordAssociationListBlockInitializer.d.ts +3 -0
  88. package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.d.ts +7 -0
  89. package/es/schema-initializer/utils.d.ts +22 -3
  90. package/es/schema-settings/SchemaSettings.d.ts +1 -1
  91. package/es/schema-settings/VariableInput/VariableInput.d.ts +0 -4
  92. package/es/schema-settings/VariableInput/hooks/useFormVariable.d.ts +1 -1
  93. package/es/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +2 -3
  94. package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +1 -5
  95. package/lib/index.js +126 -122
  96. package/lib/locale/en_US.js +13 -2
  97. package/lib/locale/es_ES.js +9 -1
  98. package/lib/locale/fr_FR.js +9 -1
  99. package/lib/locale/ja_JP.js +9 -1
  100. package/lib/locale/ko_KR.js +10 -2
  101. package/lib/locale/pt_BR.js +9 -1
  102. package/lib/locale/ru_RU.js +9 -1
  103. package/lib/locale/tr_TR.js +9 -1
  104. package/lib/locale/uk_UA.js +9 -1
  105. package/lib/locale/zh-CN.js +22 -4
  106. package/lib/locale/zh-TW.js +10 -2
  107. package/package.json +5 -5
package/.dumirc.ts CHANGED
@@ -179,12 +179,8 @@ export default defineConfig({
179
179
  title: 'DataBlock',
180
180
  type: 'group',
181
181
  children: [
182
- // {
183
- // title: '临时',
184
- // link: '/core/data-block/tmp',
185
- // },
186
182
  {
187
- title: 'Record',
183
+ title: 'CollectionRecord',
188
184
  link: '/core/data-block/collection-record',
189
185
  },
190
186
  {
@@ -1,14 +1,14 @@
1
1
  import { APIClientOptions } from '@nocobase/sdk';
2
2
  import { i18n as i18next } from 'i18next';
3
3
  import React, { ComponentType, ReactElement } from 'react';
4
+ import { APIClient } from '../api-client';
4
5
  import { PluginManager, PluginType } from './PluginManager';
5
6
  import { PluginSettingOptions, PluginSettingsManager } from './PluginSettingsManager';
6
7
  import { ComponentTypeAndString, RouterManager, RouterOptions } from './RouterManager';
7
8
  import { WebSocketClient, WebSocketClientOptions } from './WebSocketClient';
8
- import { APIClient } from '../api-client';
9
9
  import { SchemaInitializer, SchemaInitializerManager } from './schema-initializer';
10
10
  import { SchemaSettings, SchemaSettingsManager } from './schema-settings';
11
- import { type DataSourceManagerOptions, DataSourceManager } from '../data-source/data-source/DataSourceManager';
11
+ import { DataSourceManager, type DataSourceManagerOptions } from '../data-source/data-source/DataSourceManager';
12
12
  import type { Plugin } from './Plugin';
13
13
  import type { RequireJS } from './utils/requirejs';
14
14
  declare global {
@@ -22,6 +22,7 @@ export type DevDynamicImport = (packageName: string) => Promise<{
22
22
  export type ComponentAndProps<T = any> = [ComponentType, T];
23
23
  export interface ApplicationOptions {
24
24
  name?: string;
25
+ publicPath?: string;
25
26
  apiClient?: APIClientOptions | APIClient;
26
27
  ws?: WebSocketClientOptions | boolean;
27
28
  i18n?: i18next;
@@ -66,6 +67,9 @@ export declare class Application {
66
67
  private addDefaultProviders;
67
68
  private addReactRouterComponents;
68
69
  private addRoutes;
70
+ getOptions(): ApplicationOptions;
71
+ getPublicPath(): string;
72
+ getRouteUrl(pathname: string): string;
69
73
  getCollectionManager(dataSource?: string): import("..").CollectionManager;
70
74
  getComposeProviders(): React.FC;
71
75
  use<T = any>(component: ComponentType, props?: T): number;
@@ -37,6 +37,7 @@ export declare class PluginSettingsManager {
37
37
  protected settings: Record<string, PluginSettingOptions>;
38
38
  protected aclSnippets: string[];
39
39
  app: Application;
40
+ private cachedList;
40
41
  constructor(_pluginSettings: Record<string, PluginSettingOptions>, app: Application);
41
42
  setAclSnippets(aclSnippets: string[]): void;
42
43
  getAclSnippet(name: string): string;
@@ -26,6 +26,7 @@ export declare class RouterManager {
26
26
  getRoutesTree(): RouteObject[];
27
27
  getRoutes(): Record<string, RouteType>;
28
28
  setType(type: RouterOptions['type']): void;
29
+ getBasename(): string;
29
30
  setBasename(basename: string): void;
30
31
  getRouterComponent(): React.FC<{
31
32
  BaseLayout?: ComponentType;
@@ -1,9 +1,10 @@
1
- export declare const getWebSocketURL: () => string;
1
+ import { Application } from './Application';
2
2
  export type WebSocketClientOptions = {
3
3
  reconnectInterval?: number;
4
4
  reconnectAttempts?: number;
5
5
  pingInterval?: number;
6
6
  url?: string;
7
+ basename?: string;
7
8
  protocols?: string | string[];
8
9
  onServerDown?: any;
9
10
  };
@@ -12,11 +13,13 @@ export declare class WebSocketClient {
12
13
  protected _reconnectTimes: number;
13
14
  protected events: any[];
14
15
  protected options: WebSocketClientOptions;
16
+ app: Application;
15
17
  enabled: boolean;
16
18
  connected: boolean;
17
19
  serverDown: boolean;
18
20
  lastMessage: {};
19
21
  constructor(options: WebSocketClientOptions | boolean);
22
+ getURL(): string;
20
23
  get reconnectAttempts(): number;
21
24
  get reconnectInterval(): number;
22
25
  get pingInterval(): number;
@@ -0,0 +1,27 @@
1
+ import { SchemaInitializer } from './SchemaInitializer';
2
+ /**
3
+ * @internal
4
+ *
5
+ * 因为需要把 SchemaInitializer 的 name 统一为一致的命名风格,统一之后新创建的 Schema 将
6
+ * 使用新的命名风格,而旧的 Schema 仍然使用旧的命名风格,这样会导致一些问题。所以需要有一个方法
7
+ * 可以确保旧版的 name 也可以正常工作,直到旧的 Schema 被移除。该类就是用来兼容旧 name 的:
8
+ *
9
+ * 1. 在新版实例中通过接收旧版 name 的实例,在新版实例变更后,同步变更旧版实例;
10
+ * 2. 在旧版实例中也接收新版 name 的实例,当旧版实例变更后,同步变更新版实例,这样可以保证在插件中即使不把旧版改成新版也能正常运行;
11
+ */
12
+ export declare class CompatibleSchemaInitializer extends SchemaInitializer {
13
+ /**
14
+ * 需要同步变更的另一个实例
15
+ */
16
+ otherInstance: CompatibleSchemaInitializer;
17
+ constructor(options: any, otherInstance?: CompatibleSchemaInitializer);
18
+ add(name: string, item: any): void;
19
+ remove(nestedName: string): void;
20
+ }
21
+ /**
22
+ * 由于旧版的 schema 的 x-initializer 的值是旧的命名风格,当其与新的命名比较时就存在问题,
23
+ * 这里通过将新版命名转换为旧版命名再进行比较,已解决这个问题。
24
+ * @param oldOrNewName x-initializer 的值
25
+ * @param newName 新的命名
26
+ */
27
+ export declare function isInitializersSame(oldOrNewName: string, newName: string): boolean;
@@ -12,5 +12,5 @@ export declare const useSchemaInitializer: () => {
12
12
  visible: boolean;
13
13
  setVisible: (v: boolean) => void;
14
14
  };
15
- export declare const SchemaInitializerItemContext: React.Context<Omit<SchemaInitializerItemType, "sort" | "type" | "component" | "Component" | "componentProps" | "useVisible" | "useChildren" | "hideIfNoChildren">>;
15
+ export declare const SchemaInitializerItemContext: React.Context<Omit<SchemaInitializerItemType, "type" | "sort" | "component" | "Component" | "componentProps" | "useVisible" | "useChildren" | "hideIfNoChildren">>;
16
16
  export declare const useSchemaInitializerItem: <T = any>() => T;
@@ -4,4 +4,5 @@ export * from './types';
4
4
  export * from './context';
5
5
  export * from './components';
6
6
  export * from './SchemaInitializer';
7
+ export * from './CompatibleSchemaInitializer';
7
8
  export * from './SchemaInitializerManager';
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  export declare const DetailsBlockContext: React.Context<any>;
3
3
  export declare const DetailsBlockProvider: (props: any) => React.JSX.Element;
4
+ /**
5
+ * @deprecated
6
+ */
4
7
  export declare const useDetailsBlockContext: () => any;
5
8
  export declare const useDetailsBlockProps: () => {
6
9
  form: any;
@@ -1,6 +1,20 @@
1
1
  import { Schema } from '@formily/react';
2
2
  import React from 'react';
3
- export declare const FormBlockContext: React.Context<any>;
3
+ import { CollectionRecord } from '../data-source';
4
+ export declare const FormBlockContext: React.Context<{
5
+ [key: string]: any;
6
+ form?: any;
7
+ type?: 'update' | 'create';
8
+ action?: string;
9
+ field?: any;
10
+ service?: any;
11
+ resource?: any;
12
+ updateAssociationValues?: any;
13
+ formBlockRef?: any;
14
+ collectionName?: string;
15
+ params?: any;
16
+ formRecord?: CollectionRecord;
17
+ }>;
4
18
  /**
5
19
  * 获取表单区块的类型:update 表示是表单编辑区块,create 表示是表单新增区块
6
20
  * @returns
@@ -10,7 +24,20 @@ export declare const useFormBlockType: () => {
10
24
  };
11
25
  export declare const useIsDetailBlock: () => boolean;
12
26
  export declare const FormBlockProvider: (props: any) => React.JSX.Element;
13
- export declare const useFormBlockContext: () => any;
27
+ export declare const useFormBlockContext: () => {
28
+ [key: string]: any;
29
+ form?: any;
30
+ type?: 'update' | 'create';
31
+ action?: string;
32
+ field?: any;
33
+ service?: any;
34
+ resource?: any;
35
+ updateAssociationValues?: any;
36
+ formBlockRef?: any;
37
+ collectionName?: string;
38
+ params?: any;
39
+ formRecord?: CollectionRecord;
40
+ };
14
41
  export declare const useFormBlockProps: () => {
15
42
  form: any;
16
43
  };
@@ -29,7 +29,7 @@ export declare const useSelfAndChildrenCollections: (collectionName: string) =>
29
29
  value: any;
30
30
  label: any;
31
31
  }[];
32
- export declare const useCollectionFilterOptions: (collection: any) => any[];
32
+ export declare const useCollectionFilterOptions: (collection: any, dataSource?: string) => any[];
33
33
  export declare const useCollectionFilterOptionsV2: (collection: any) => {
34
34
  getFields: () => any[];
35
35
  };
@@ -77,6 +77,6 @@ export declare const useBulkDestroyActionAndRefreshCM: () => {
77
77
  };
78
78
  export declare const useFilterActionProps: () => {
79
79
  options: any;
80
- onSubmit(values: any): void;
81
- onReset(): void;
80
+ onSubmit(values: any): any;
81
+ onReset(): any;
82
82
  };
@@ -18,3 +18,4 @@ export * from './collectionPlugin';
18
18
  export * from './mixins/InheritanceCollectionMixin';
19
19
  export * from './sub-table';
20
20
  export * from './CollectionHistoryProvider';
21
+ export * from './utils';
@@ -34,3 +34,6 @@ export * from './updatedAt';
34
34
  export * from './updatedBy';
35
35
  export * from './url';
36
36
  export * from './sort';
37
+ export * from './uuid';
38
+ export * from './nanoid';
39
+ export * from './unixTimestamp';
@@ -0,0 +1,69 @@
1
+ import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
2
+ export declare class NanoidFieldInterface extends CollectionFieldInterface {
3
+ name: string;
4
+ type: string;
5
+ group: string;
6
+ order: number;
7
+ title: string;
8
+ hidden: boolean;
9
+ sortable: boolean;
10
+ default: {
11
+ type: string;
12
+ uiSchema: {
13
+ type: string;
14
+ 'x-component': string;
15
+ };
16
+ };
17
+ availableTypes: string[];
18
+ properties: {
19
+ 'uiSchema.title': {
20
+ type: string;
21
+ title: string;
22
+ required: boolean;
23
+ 'x-decorator': string;
24
+ 'x-component': string;
25
+ };
26
+ name: {
27
+ type: string;
28
+ title: string;
29
+ required: boolean;
30
+ 'x-disabled': boolean;
31
+ 'x-decorator': string;
32
+ 'x-component': string;
33
+ description: string;
34
+ };
35
+ customAlphabet: {
36
+ type: string;
37
+ title: string;
38
+ default: string;
39
+ 'x-decorator': string;
40
+ 'x-component': string;
41
+ };
42
+ size: {
43
+ type: string;
44
+ title: string;
45
+ default: number;
46
+ 'x-decorator': string;
47
+ 'x-component': string;
48
+ };
49
+ };
50
+ filterable: {
51
+ operators: ({
52
+ label: string;
53
+ value: string;
54
+ selected: boolean;
55
+ noValue?: undefined;
56
+ } | {
57
+ label: string;
58
+ value: string;
59
+ selected?: undefined;
60
+ noValue?: undefined;
61
+ } | {
62
+ label: string;
63
+ value: string;
64
+ noValue: boolean;
65
+ selected?: undefined;
66
+ })[];
67
+ };
68
+ titleUsable: boolean;
69
+ }
@@ -0,0 +1,71 @@
1
+ import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
2
+ export declare class UnixTimestampFieldInterface extends CollectionFieldInterface {
3
+ name: string;
4
+ type: string;
5
+ group: string;
6
+ order: number;
7
+ title: string;
8
+ sortable: boolean;
9
+ default: {
10
+ type: string;
11
+ uiSchema: {
12
+ type: string;
13
+ 'x-component': string;
14
+ 'x-component-props': {
15
+ accuracy: string;
16
+ showTime: boolean;
17
+ };
18
+ };
19
+ };
20
+ availableTypes: string[];
21
+ hasDefaultValue: boolean;
22
+ properties: {
23
+ 'uiSchema.x-component-props.accuracy': {
24
+ type: string;
25
+ title: string;
26
+ 'x-component': string;
27
+ 'x-decorator': string;
28
+ default: string;
29
+ enum: {
30
+ value: string;
31
+ label: string;
32
+ }[];
33
+ };
34
+ 'uiSchema.title': {
35
+ type: string;
36
+ title: string;
37
+ required: boolean;
38
+ 'x-decorator': string;
39
+ 'x-component': string;
40
+ };
41
+ name: {
42
+ type: string;
43
+ title: string;
44
+ required: boolean;
45
+ 'x-disabled': string;
46
+ 'x-decorator': string;
47
+ 'x-component': string;
48
+ 'x-validator': string;
49
+ description: string;
50
+ };
51
+ };
52
+ filterable: {
53
+ operators: ({
54
+ label: string;
55
+ value: string;
56
+ selected: boolean;
57
+ noValue?: undefined;
58
+ } | {
59
+ label: string;
60
+ value: string;
61
+ selected?: undefined;
62
+ noValue?: undefined;
63
+ } | {
64
+ label: string;
65
+ value: string;
66
+ noValue: boolean;
67
+ selected?: undefined;
68
+ })[];
69
+ };
70
+ titleUsable: boolean;
71
+ }
@@ -0,0 +1,56 @@
1
+ import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
2
+ export declare class UUIDFieldInterface extends CollectionFieldInterface {
3
+ name: string;
4
+ type: string;
5
+ group: string;
6
+ order: number;
7
+ title: string;
8
+ hidden: boolean;
9
+ sortable: boolean;
10
+ default: {
11
+ type: string;
12
+ uiSchema: {
13
+ type: string;
14
+ 'x-component': string;
15
+ 'x-validator': string;
16
+ };
17
+ };
18
+ availableTypes: string[];
19
+ properties: {
20
+ 'uiSchema.title': {
21
+ type: string;
22
+ title: string;
23
+ required: boolean;
24
+ 'x-decorator': string;
25
+ 'x-component': string;
26
+ };
27
+ name: {
28
+ type: string;
29
+ title: string;
30
+ required: boolean;
31
+ 'x-disabled': boolean;
32
+ 'x-decorator': string;
33
+ 'x-component': string;
34
+ description: string;
35
+ };
36
+ };
37
+ filterable: {
38
+ operators: ({
39
+ label: string;
40
+ value: string;
41
+ selected: boolean;
42
+ noValue?: undefined;
43
+ } | {
44
+ label: string;
45
+ value: string;
46
+ selected?: undefined;
47
+ noValue?: undefined;
48
+ } | {
49
+ label: string;
50
+ value: string;
51
+ noValue: boolean;
52
+ selected?: undefined;
53
+ })[];
54
+ };
55
+ titleUsable: boolean;
56
+ }
@@ -0,0 +1,2 @@
1
+ export declare function parseCollectionName(collection: string): string[];
2
+ export declare function joinCollectionName(dataSourceName: string, collectionName: string): string;
@@ -18,6 +18,7 @@ export interface AllDataBlockProps {
18
18
  parentRecord?: CollectionRecord;
19
19
  requestService?: UseRequestService<any>;
20
20
  requestOptions?: UseRequestOptions;
21
+ dataLoadingMode?: 'auto' | 'manual';
21
22
  [index: string]: any;
22
23
  }
23
24
  type CollectionCreateProps = Pick<AllDataBlockProps, 'collection' | 'dataSource'>;
@@ -26,12 +26,15 @@ export declare class DataSourceManager {
26
26
  collectionFieldInterfaceManager: CollectionFieldInterfaceManager;
27
27
  constructor(options: DataSourceManagerOptions, app: Application);
28
28
  addCollectionMixins(mixins?: (typeof Collection)[]): void;
29
- getDataSources(): DataSource[];
29
+ getDataSources(filterCollection?: (dataSource: DataSource) => boolean): DataSource[];
30
30
  getDataSource(key?: string): DataSource;
31
31
  removeDataSources(keys: string[]): void;
32
32
  addDataSource(DataSource: DataSourceFactory, options: DataSourceOptions): DataSource;
33
33
  addDataSources(request: () => Promise<DataSourceOptions[]>, DataSource: DataSourceFactory): Promise<void>;
34
- getAllCollections(predicate?: (collection: Collection) => boolean): (DataSourceOptions & {
34
+ getAllCollections(options?: {
35
+ filterCollection?: (collection: Collection) => boolean;
36
+ filterDataSource?: (dataSource: DataSource) => boolean;
37
+ }): (DataSourceOptions & {
35
38
  collections: Collection[];
36
39
  })[];
37
40
  addFieldInterfaceGroups(options: Record<string, {
@@ -29,6 +29,8 @@ export interface DataBlock {
29
29
  doFilter: (params: any, params2?: any) => Promise<void>;
30
30
  /** 清除筛选区块设置的筛选参数 */
31
31
  clearFilter: (uid: string) => void;
32
+ /** 将数据区块的数据置为空 */
33
+ clearData: () => void;
32
34
  /** 数据区块表中所有的关系字段 */
33
35
  associatedFields?: CollectionFieldOptions_deprecated[];
34
36
  /** 数据区块表中所有的外键字段 */
@@ -39,6 +41,11 @@ export interface DataBlock {
39
41
  service?: any;
40
42
  /** 数据区块所的 DOM 容器 */
41
43
  dom: HTMLElement;
44
+ /**
45
+ * auto: 数据区块会在初始渲染时请求数据
46
+ * manual: 只有当点击了筛选按钮,才会请求数据
47
+ */
48
+ dataLoadingMode?: 'auto' | 'manual';
42
49
  }
43
50
  /**
44
51
  * 主要用于记录当前页面中的数据区块的信息,用于在过滤区块中使用
package/es/index.d.ts CHANGED
@@ -51,3 +51,4 @@ export * from './modules/blocks/BlockSchemaToolbar';
51
51
  export * from './modules/blocks/data-blocks/table';
52
52
  export * from './modules/blocks/data-blocks/form';
53
53
  export * from './modules/blocks/data-blocks/table-selector';
54
+ export * from './modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem';