@nocobase/client 1.2.21-alpha → 1.2.23-alpha

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 (35) hide show
  1. package/.dumirc.ts +4 -0
  2. package/es/block-provider/hooks/index.d.ts +3 -0
  3. package/es/collection-manager/interfaces/markdown.d.ts +12 -0
  4. package/es/collection-manager/interfaces/properties/operators.d.ts +5 -2
  5. package/es/collection-manager/interfaces/richText.d.ts +4 -1
  6. package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.d.ts +14 -0
  7. package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.d.ts +11 -0
  8. package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToTableInitializerItems.d.ts +10 -0
  9. package/es/data-source/collection-fields-to-initializer-items/index.d.ts +11 -0
  10. package/es/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.d.ts +3 -0
  11. package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.d.ts +3 -0
  12. package/es/data-source/collection-fields-to-initializer-items/items/SelfFields.d.ts +3 -0
  13. package/es/data-source/collection-fields-to-initializer-items/items/index.d.ts +3 -0
  14. package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.d.ts +13 -0
  15. package/es/data-source/collection-fields-to-initializer-items/utils/index.d.ts +3 -0
  16. package/es/data-source/collection-fields-to-initializer-items/utils/type.d.ts +116 -0
  17. package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.d.ts +30 -0
  18. package/es/data-source/index.d.ts +1 -0
  19. package/es/index.d.ts +1 -1
  20. package/es/index.mjs +1430 -1041
  21. package/es/modules/actions/link/{useURLAndParamsSchema.d.ts → useURLAndHTMLSchema.d.ts} +42 -1
  22. package/es/schema-initializer/utils.d.ts +1 -0
  23. package/lib/index.js +109 -106
  24. package/lib/locale/en_US.js +2 -1
  25. package/lib/locale/es_ES.js +2 -1
  26. package/lib/locale/fr_FR.js +2 -1
  27. package/lib/locale/ja_JP.js +2 -1
  28. package/lib/locale/ko_KR.js +2 -1
  29. package/lib/locale/pt_BR.js +2 -1
  30. package/lib/locale/ru_RU.js +2 -1
  31. package/lib/locale/tr_TR.js +2 -1
  32. package/lib/locale/uk_UA.js +2 -1
  33. package/lib/locale/zh-CN.js +2 -1
  34. package/lib/locale/zh-TW.js +2 -1
  35. package/package.json +5 -5
package/.dumirc.ts CHANGED
@@ -186,6 +186,10 @@ export default defineConfig({
186
186
  title: 'ExtendCollectionsProvider',
187
187
  link: '/core/data-source/extend-collections-provider',
188
188
  },
189
+ {
190
+ title: 'Collection Fields To Initializer Items',
191
+ link: '/core/data-source/collection-fields-to-initializer-items',
192
+ },
189
193
  ]
190
194
  },
191
195
  {
@@ -7,6 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { ChangeEvent } from 'react';
10
+ import { NavigateFunction } from 'react-router-dom';
10
11
  import { VariableOption, VariablesContextType } from '../../variables/types';
11
12
  export * from './useBlockHeightProps';
12
13
  export * from './useDataBlockParentRecord';
@@ -157,3 +158,5 @@ export declare function parseVariablesAndChangeParamsToQueryString({ searchParam
157
158
  * 2. 去除 value 是一个字符串长度超过 100 个字符的 key
158
159
  */
159
160
  export declare function reduceValueSize(value: any): any;
161
+ export declare function completeURL(url: string, origin?: string): string;
162
+ export declare function navigateWithinSelf(link: string, navigate: NavigateFunction, origin?: string): void;
@@ -80,16 +80,28 @@ export declare class MarkdownFieldInterface extends CollectionFieldInterface {
80
80
  label: string;
81
81
  value: string;
82
82
  selected: boolean;
83
+ schema: {
84
+ type: string;
85
+ 'x-component': string;
86
+ };
83
87
  noValue?: undefined;
84
88
  } | {
85
89
  label: string;
86
90
  value: string;
91
+ schema: {
92
+ type: string;
93
+ 'x-component': string;
94
+ };
87
95
  selected?: undefined;
88
96
  noValue?: undefined;
89
97
  } | {
90
98
  label: string;
91
99
  value: string;
92
100
  noValue: boolean;
101
+ schema: {
102
+ type: string;
103
+ 'x-component': string;
104
+ };
93
105
  selected?: undefined;
94
106
  })[];
95
107
  };
@@ -228,7 +228,7 @@ export declare const collection: ({
228
228
  selected?: undefined;
229
229
  schema?: undefined;
230
230
  })[];
231
- export declare const richText: ({
231
+ export declare const bigField: ({
232
232
  label: string;
233
233
  value: string;
234
234
  selected: boolean;
@@ -250,6 +250,9 @@ export declare const richText: ({
250
250
  label: string;
251
251
  value: string;
252
252
  noValue: boolean;
253
+ schema: {
254
+ type: string;
255
+ 'x-component': string;
256
+ };
253
257
  selected?: undefined;
254
- schema?: undefined;
255
258
  })[];
@@ -100,8 +100,11 @@ export declare class RichTextFieldInterface extends CollectionFieldInterface {
100
100
  label: string;
101
101
  value: string;
102
102
  noValue: boolean;
103
+ schema: {
104
+ type: string;
105
+ 'x-component': string;
106
+ };
103
107
  selected?: undefined;
104
- schema?: undefined;
105
108
  })[];
106
109
  };
107
110
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { FC } from 'react';
10
+ import { Schema } from '@formily/json-schema';
11
+ export declare const findKanbanFormItem: (schema: Schema, key: string, action: string) => any;
12
+ export declare const CollectionFieldsToFormInitializerItems: FC<{
13
+ block?: string;
14
+ }>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { FC } from 'react';
10
+ import { CollectionFieldsProps } from './utils';
11
+ export declare const CollectionFieldsToInitializerItems: FC<CollectionFieldsProps>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { FC } from 'react';
10
+ export declare const CollectionFieldsToTableInitializerItems: FC;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export * from './CollectionFieldsToInitializerItems';
10
+ export * from './CollectionFieldsToFormInitializerItems';
11
+ export * from './CollectionFieldsToTableInitializerItems';
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { AssociationCollectionFieldsProps } from '../utils';
3
+ export declare const AssociationCollectionFields: FC<AssociationCollectionFieldsProps>;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ParentCollectionFieldsProps } from '../utils';
3
+ export declare const ParentCollectionFields: FC<ParentCollectionFieldsProps>;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { SelfCollectionFieldsProps } from '../utils';
3
+ export declare const SelfFields: FC<SelfCollectionFieldsProps>;
@@ -0,0 +1,3 @@
1
+ export { SelfFields } from './SelfFields';
2
+ export { ParentCollectionFields } from './ParentCollectionFields';
3
+ export { AssociationCollectionFields } from './AssociationCollectionFields';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { CommonCollectionFieldsProps } from './type';
10
+ import { CollectionFieldOptions } from '../../collection/Collection';
11
+ import { CollectionFieldContext } from './useCollectionFieldContext';
12
+ import { SchemaInitializerItemType } from '../../../application/schema-initializer';
13
+ export declare function getInitializerItemsByFields(props: CommonCollectionFieldsProps, fields: CollectionFieldOptions[], context: CollectionFieldContext): SchemaInitializerItemType[];
@@ -0,0 +1,3 @@
1
+ export * from './type';
2
+ export * from './getInitializerItemsByFields';
3
+ export * from './useCollectionFieldContext';
@@ -0,0 +1,116 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { ISchema, Schema } from '@formily/json-schema';
10
+ import { CollectionFieldContext } from './useCollectionFieldContext';
11
+ import { CollectionFieldInterface } from '../../collection-field-interface';
12
+ import { Collection, CollectionFieldOptions } from '../../collection/Collection';
13
+ export interface CollectionFieldDefaultSchema {
14
+ /**
15
+ * @default 'string'
16
+ */
17
+ type: string;
18
+ /**
19
+ * @default collectionField.name
20
+ */
21
+ name: string;
22
+ /**
23
+ * @default 'CollectionField'
24
+ */
25
+ 'x-component': string;
26
+ /**
27
+ * @default `${collection.name}.${collectionField.name}`
28
+ */
29
+ 'x-collection-field': string;
30
+ /**
31
+ * @default collectionField?.uiSchema?.['x-read-pretty']
32
+ */
33
+ 'x-read-pretty'?: boolean;
34
+ /**
35
+ * @default collectionField?.uiSchema?.title || collectionField.name
36
+ */
37
+ title: string;
38
+ }
39
+ export interface CollectionFieldGetSchemaResult {
40
+ 'x-toolbar'?: string;
41
+ 'x-toolbar-props'?: any;
42
+ 'x-settings'?: string;
43
+ 'x-decorator'?: string;
44
+ 'x-decorator-props'?: any;
45
+ 'x-component-props'?: any;
46
+ 'x-use-component-props'?: string;
47
+ }
48
+ export interface CollectionFieldDefaultInitializerItem {
49
+ /**
50
+ * @default 'item'
51
+ */
52
+ type: string;
53
+ /**
54
+ * @default collectionField.name
55
+ */
56
+ name: string;
57
+ /**
58
+ * @default collectionField?.uiSchema?.title || collectionField.name
59
+ */
60
+ title: string;
61
+ /**
62
+ * @default 'CollectionFieldInitializer'
63
+ */
64
+ Component: string;
65
+ schemaInitialize: (s: ISchema) => void;
66
+ /**
67
+ * @default schema
68
+ */
69
+ schema: ISchema;
70
+ }
71
+ export interface CollectionFieldGetInitializerItemResult {
72
+ find?: (schema: Schema, key: string, action: string) => any;
73
+ remove?: (schema: Schema, cb: (schema: Schema, stopProps: Record<string, any>) => void) => void;
74
+ }
75
+ export interface CommonCollectionFieldsProps {
76
+ block: string;
77
+ getSchema: (collectionField: CollectionFieldOptions, context: CollectionFieldContext & {
78
+ defaultSchema: CollectionFieldDefaultSchema;
79
+ targetCollection?: Collection;
80
+ collectionFieldInterface?: CollectionFieldInterface;
81
+ }) => CollectionFieldGetSchemaResult;
82
+ isReadPretty?: (context: CollectionFieldContext) => boolean;
83
+ filter?: (collectionField: CollectionFieldOptions, context: CollectionFieldContext) => boolean;
84
+ getInitializerItem?: (collectionField: CollectionFieldOptions, context: CollectionFieldContext & {
85
+ schema: ISchema;
86
+ defaultInitializerItem: CollectionFieldDefaultInitializerItem;
87
+ targetCollection?: Collection;
88
+ collectionFieldInterface?: CollectionFieldInterface;
89
+ }) => CollectionFieldGetInitializerItemResult;
90
+ }
91
+ export interface SelfCollectionFieldsProps extends CommonCollectionFieldsProps {
92
+ context: Omit<CollectionFieldContext, 'collection'> & {
93
+ collection: Collection;
94
+ };
95
+ }
96
+ export interface ParentCollectionFieldsProps extends CommonCollectionFieldsProps {
97
+ context: Omit<CollectionFieldContext, 'collection'> & {
98
+ collection: Collection;
99
+ };
100
+ }
101
+ export interface AssociationCollectionFieldsProps extends Omit<CommonCollectionFieldsProps, 'filter'> {
102
+ filterSelfField?: CommonCollectionFieldsProps['filter'];
103
+ filterAssociationField?: CommonCollectionFieldsProps['filter'];
104
+ context: Omit<CollectionFieldContext, 'collection'> & {
105
+ collection: CollectionFieldContext['collection'];
106
+ };
107
+ }
108
+ export interface CollectionFieldsProps {
109
+ /**
110
+ * Block name.
111
+ */
112
+ block: string;
113
+ selfField: Omit<SelfCollectionFieldsProps, 'block' | 'context'>;
114
+ parentField?: Omit<ParentCollectionFieldsProps, 'block' | 'context'>;
115
+ associationField?: Omit<AssociationCollectionFieldsProps, 'block' | 'context'>;
116
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Form } from '@formily/core';
10
+ import { ISchema } from '@formily/json-schema';
11
+ import { TFunction } from 'react-i18next';
12
+ import { DataSource } from '../../data-source/DataSource';
13
+ import { CollectionManager } from '../../collection/CollectionManager';
14
+ import { DataSourceManager } from '../../data-source/DataSourceManager';
15
+ import { useActionContext } from '../../../schema-component/antd/action';
16
+ import { Collection } from '../../collection/Collection';
17
+ import { InheritanceCollectionMixin } from '../../../collection-manager';
18
+ export interface CollectionFieldContext {
19
+ fieldSchema: ISchema;
20
+ collection?: InheritanceCollectionMixin & Collection;
21
+ dataSource: DataSource;
22
+ form: Form<any>;
23
+ actionContext: ReturnType<typeof useActionContext>;
24
+ t: TFunction<'translation', undefined>;
25
+ collectionManager: CollectionManager;
26
+ dataSourceManager: DataSourceManager;
27
+ compile: (source: any, ext?: any) => any;
28
+ targetCollection?: Collection;
29
+ }
30
+ export declare function useCollectionFieldContext(): CollectionFieldContext;
@@ -15,3 +15,4 @@ export * from './data-block';
15
15
  export * from './data-source';
16
16
  export * from './collection-record';
17
17
  export * from './utils';
18
+ export * from './collection-fields-to-initializer-items';
package/es/index.d.ts CHANGED
@@ -55,7 +55,7 @@ export * from './user';
55
55
  export * from './variables';
56
56
  export { withDynamicSchemaProps } from './hoc/withDynamicSchemaProps';
57
57
  export { SchemaSettingsActionLinkItem } from './modules/actions/link/customizeLinkActionSettings';
58
- export { useURLAndParamsSchema } from './modules/actions/link/useURLAndParamsSchema';
58
+ export { useURLAndHTMLSchema } from './modules/actions/link/useURLAndHTMLSchema';
59
59
  export * from './modules/blocks/BlockSchemaToolbar';
60
60
  export * from './modules/blocks/data-blocks/form';
61
61
  export * from './modules/blocks/data-blocks/table';