@tachybase/client 1.0.18 → 1.0.25
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/application/Application.d.ts +2 -0
- package/es/application/Application.mjs +15 -0
- package/es/application/TrackingManager.d.ts +13 -0
- package/es/application/TrackingManager.mjs +30 -0
- package/es/application/components/SharePage.d.ts +4 -0
- package/es/application/components/SharePage.mjs +113 -0
- package/es/application/components/ShareSchemaComponent.d.ts +1 -0
- package/es/application/components/ShareSchemaComponent.mjs +10 -0
- package/es/application/components/index.d.ts +2 -0
- package/es/application/components/index.mjs +2 -0
- package/es/built-in/admin-layout/index.d.ts +1 -0
- package/es/built-in/admin-layout/index.mjs +1 -0
- package/es/collection-manager/interfaces/__tests__/json.mjs +2 -2
- package/es/collection-manager/interfaces/integer.d.ts +12 -0
- package/es/collection-manager/interfaces/integer.mjs +13 -1
- package/es/collection-manager/interfaces/number.d.ts +16 -0
- package/es/collection-manager/interfaces/number.mjs +22 -1
- package/es/collection-manager/interfaces/percent.d.ts +12 -0
- package/es/collection-manager/interfaces/percent.mjs +12 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.mjs +67 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.mjs +37 -0
- package/es/data-source/collection-fields-to-initializer-items/index.d.ts +1 -0
- package/es/data-source/collection-fields-to-initializer-items/index.mjs +1 -0
- package/es/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.mjs +59 -0
- package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.mjs +34 -0
- package/es/data-source/collection-fields-to-initializer-items/items/SelfFields.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/SelfFields.mjs +14 -0
- package/es/data-source/collection-fields-to-initializer-items/items/index.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/index.mjs +7 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.d.ts +5 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.mjs +91 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/index.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/index.mjs +3 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/type.d.ts +108 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/type.mjs +0 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.d.ts +21 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.mjs +31 -0
- package/es/data-source/index.d.ts +1 -0
- package/es/data-source/index.mjs +1 -0
- package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +0 -8
- package/es/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.d.ts +1 -3
- package/es/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.mjs +4 -1
- package/es/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.mjs +91 -0
- package/es/schema-component/antd/index.d.ts +2 -0
- package/es/schema-component/antd/index.mjs +2 -0
- package/es/schema-component/antd/page/Page.Settings.mjs +33 -0
- package/es/schema-component/antd/page/Page.mjs +113 -18
- package/es/schema-component/antd/page/hooks/index.d.ts +1 -0
- package/es/schema-component/antd/page/hooks/index.mjs +1 -0
- package/es/schema-component/antd/page/hooks/useShareActions.d.ts +7 -0
- package/es/schema-component/antd/page/hooks/useShareActions.mjs +245 -0
- package/es/schema-component/antd/page/index.d.ts +1 -0
- package/es/schema-component/antd/page/index.mjs +1 -0
- package/es/schema-component/antd/page/style.d.ts +5 -0
- package/es/schema-component/antd/page/style.mjs +59 -2
- package/es/schema-component/antd/slider/index.d.ts +1 -0
- package/es/schema-component/antd/slider/index.mjs +1 -0
- package/es/schema-component/antd/slider/slider.d.ts +3 -0
- package/es/schema-component/antd/slider/slider.mjs +11 -0
- package/es/schema-component/antd/tracking-link/index.d.ts +10 -0
- package/es/schema-component/antd/tracking-link/index.mjs +25 -0
- package/es/schema-initializer/utils.d.ts +1 -0
- package/es/schema-initializer/utils.mjs +1 -1
- package/lib/application/Application.js +15 -0
- package/lib/application/TrackingManager.js +66 -0
- package/lib/application/components/SharePage.js +150 -0
- package/lib/application/components/ShareSchemaComponent.js +44 -0
- package/lib/application/components/index.js +18 -0
- package/lib/block-provider/hooks/index.js +2 -2
- package/lib/built-in/admin-layout/index.js +9 -0
- package/lib/collection-manager/interfaces/__tests__/json.js +4 -4
- package/lib/collection-manager/interfaces/integer.js +13 -1
- package/lib/collection-manager/interfaces/number.js +22 -1
- package/lib/collection-manager/interfaces/percent.js +12 -0
- package/lib/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.js +102 -0
- package/lib/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.js +71 -0
- package/lib/data-source/collection-fields-to-initializer-items/index.js +65 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.js +93 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.js +68 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/SelfFields.js +48 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/index.js +40 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.js +127 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/index.js +83 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/type.js +19 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.js +65 -0
- package/lib/data-source/index.js +12 -3
- package/lib/locale/zh-CN.js +18 -0
- package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -8
- package/lib/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.js +4 -1
- package/lib/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.js +91 -0
- package/lib/schema-component/antd/index.js +161 -133
- package/lib/schema-component/antd/page/Page.Settings.js +33 -0
- package/lib/schema-component/antd/page/Page.js +113 -18
- package/lib/schema-component/antd/page/hooks/index.js +65 -0
- package/lib/schema-component/antd/page/hooks/useShareActions.js +293 -0
- package/lib/schema-component/antd/page/index.js +9 -0
- package/lib/schema-component/antd/page/style.js +60 -2
- package/lib/schema-component/antd/slider/index.js +65 -0
- package/lib/schema-component/antd/slider/slider.js +46 -0
- package/lib/schema-component/antd/tracking-link/index.js +59 -0
- package/lib/schema-initializer/utils.js +2 -1
- package/package.json +8 -7
package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_index_mjs__ from "../../../application/schema-initializer/index.mjs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__ from "../utils/index.mjs";
|
|
4
|
+
const ParentCollectionFields = (props)=>{
|
|
5
|
+
const context = (0, __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__.useCollectionFieldContext)();
|
|
6
|
+
const { collection, t, collectionManager } = context;
|
|
7
|
+
const parentCollectionNames = collection.getParentCollectionsName();
|
|
8
|
+
if (!parentCollectionNames.length) return null;
|
|
9
|
+
const children = parentCollectionNames.map((parentCollectionName)=>{
|
|
10
|
+
const parentCollectionFields = collection.getParentCollectionFields(parentCollectionName);
|
|
11
|
+
if (0 === parentCollectionFields.length) return null;
|
|
12
|
+
const parentCollection = collectionManager.getCollection(parentCollectionName);
|
|
13
|
+
return {
|
|
14
|
+
parentCollection,
|
|
15
|
+
parentCollectionFields
|
|
16
|
+
};
|
|
17
|
+
}).filter(Boolean).map((options)=>{
|
|
18
|
+
const { parentCollection, parentCollectionFields } = options;
|
|
19
|
+
const newContext = {
|
|
20
|
+
...context,
|
|
21
|
+
collection: parentCollection
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
type: 'itemGroup',
|
|
25
|
+
divider: true,
|
|
26
|
+
title: t("Parent collection fields") + '(' + context.compile(parentCollection.title) + ')',
|
|
27
|
+
children: (0, __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__.getInitializerItemsByFields)(props, parentCollectionFields, newContext)
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__application_schema_initializer_index_mjs__.SchemaInitializerChildren, {
|
|
31
|
+
children: children
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export { ParentCollectionFields };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_index_mjs__ from "../../../application/schema-initializer/index.mjs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__ from "../utils/index.mjs";
|
|
4
|
+
const SelfFields = (props)=>{
|
|
5
|
+
const callbackContext = (0, __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__.useCollectionFieldContext)();
|
|
6
|
+
const { t, collection } = callbackContext;
|
|
7
|
+
const fields = collection.getFields();
|
|
8
|
+
const children = (0, __WEBPACK_EXTERNAL_MODULE__utils_index_mjs__.getInitializerItemsByFields)(props, fields, callbackContext);
|
|
9
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__application_schema_initializer_index_mjs__.SchemaInitializerItemGroup, {
|
|
10
|
+
title: t('Display fields'),
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export { SelfFields };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__SelfFields_mjs__ from "./SelfFields.mjs";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__ParentCollectionFields_mjs__ from "./ParentCollectionFields.mjs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__AssociationCollectionFields_mjs__ from "./AssociationCollectionFields.mjs";
|
|
4
|
+
var __webpack_exports__AssociationCollectionFields = __WEBPACK_EXTERNAL_MODULE__AssociationCollectionFields_mjs__.AssociationCollectionFields;
|
|
5
|
+
var __webpack_exports__ParentCollectionFields = __WEBPACK_EXTERNAL_MODULE__ParentCollectionFields_mjs__.ParentCollectionFields;
|
|
6
|
+
var __webpack_exports__SelfFields = __WEBPACK_EXTERNAL_MODULE__SelfFields_mjs__.SelfFields;
|
|
7
|
+
export { __webpack_exports__AssociationCollectionFields as AssociationCollectionFields, __webpack_exports__ParentCollectionFields as ParentCollectionFields, __webpack_exports__SelfFields as SelfFields };
|
package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SchemaInitializerItemType } from '../../../application/schema-initializer';
|
|
2
|
+
import { CollectionFieldOptions } from '../../collection/Collection';
|
|
3
|
+
import { CommonCollectionFieldsProps } from './type';
|
|
4
|
+
import { CollectionFieldContext } from './useCollectionFieldContext';
|
|
5
|
+
export declare function getInitializerItemsByFields(props: CommonCollectionFieldsProps, fields: CollectionFieldOptions[], context: CollectionFieldContext): SchemaInitializerItemType[];
|
package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.mjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function getInitializerItemsByFields(props, fields, context) {
|
|
2
|
+
var _actionContext_fieldSchema;
|
|
3
|
+
const { block, isReadPretty = (param)=>{
|
|
4
|
+
let { form } = param;
|
|
5
|
+
return form.readPretty;
|
|
6
|
+
}, filter = ()=>true, getInitializerItem = ()=>({}), getSchema = ()=>({}) } = props;
|
|
7
|
+
const { collectionManager, collection, dataSourceManager, actionContext } = context;
|
|
8
|
+
const action = null === (_actionContext_fieldSchema = actionContext.fieldSchema) || void 0 === _actionContext_fieldSchema ? void 0 : _actionContext_fieldSchema['x-action'];
|
|
9
|
+
if (!collection) return [];
|
|
10
|
+
return fields.map((collectionField)=>{
|
|
11
|
+
const targetCollection = collectionManager.getCollection(collectionField.target);
|
|
12
|
+
const collectionFieldInterface = dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(collectionField.interface);
|
|
13
|
+
return {
|
|
14
|
+
collectionField,
|
|
15
|
+
context: {
|
|
16
|
+
...context,
|
|
17
|
+
targetCollection,
|
|
18
|
+
collectionFieldInterface
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}).filter((param)=>{
|
|
22
|
+
let { collectionField } = param;
|
|
23
|
+
return collectionField.interface;
|
|
24
|
+
}).filter((param)=>{
|
|
25
|
+
let { collectionField, context } = param;
|
|
26
|
+
return filter(collectionField, context);
|
|
27
|
+
}).map((param)=>{
|
|
28
|
+
let { collectionField, context } = param;
|
|
29
|
+
var _collectionField_uiSchema, _collectionField_uiSchema1;
|
|
30
|
+
const defaultSchema = {
|
|
31
|
+
type: 'string',
|
|
32
|
+
title: (null == collectionField ? void 0 : null === (_collectionField_uiSchema = collectionField.uiSchema) || void 0 === _collectionField_uiSchema ? void 0 : _collectionField_uiSchema.title) || collectionField.name,
|
|
33
|
+
name: collectionField.name,
|
|
34
|
+
'x-component': 'CollectionField',
|
|
35
|
+
'x-collection-field': "".concat(collection.name, ".").concat(collectionField.name),
|
|
36
|
+
'x-read-pretty': null == collectionField ? void 0 : null === (_collectionField_uiSchema1 = collectionField.uiSchema) || void 0 === _collectionField_uiSchema1 ? void 0 : _collectionField_uiSchema1['x-read-pretty']
|
|
37
|
+
};
|
|
38
|
+
const customSchema = getSchema(collectionField, {
|
|
39
|
+
...context,
|
|
40
|
+
defaultSchema: defaultSchema
|
|
41
|
+
});
|
|
42
|
+
const schema = {
|
|
43
|
+
...defaultSchema,
|
|
44
|
+
...customSchema || {}
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
collectionField,
|
|
48
|
+
schema,
|
|
49
|
+
context: {
|
|
50
|
+
...context,
|
|
51
|
+
schema
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}).map((param)=>{
|
|
55
|
+
let { collectionField, context } = param;
|
|
56
|
+
var _collectionField_uiSchema;
|
|
57
|
+
const defaultInitializerItem = {
|
|
58
|
+
type: 'item',
|
|
59
|
+
name: collectionField.name,
|
|
60
|
+
title: (null == collectionField ? void 0 : null === (_collectionField_uiSchema = collectionField.uiSchema) || void 0 === _collectionField_uiSchema ? void 0 : _collectionField_uiSchema.title) || collectionField.name,
|
|
61
|
+
Component: 'CollectionFieldInitializer',
|
|
62
|
+
schemaInitialize: (s)=>{
|
|
63
|
+
var _context_collectionFieldInterface_schemaInitialize, _context_collectionFieldInterface;
|
|
64
|
+
null === (_context_collectionFieldInterface = context.collectionFieldInterface) || void 0 === _context_collectionFieldInterface || null === (_context_collectionFieldInterface_schemaInitialize = _context_collectionFieldInterface.schemaInitialize) || void 0 === _context_collectionFieldInterface_schemaInitialize || _context_collectionFieldInterface_schemaInitialize.call(_context_collectionFieldInterface, s, {
|
|
65
|
+
field: collectionField,
|
|
66
|
+
block,
|
|
67
|
+
readPretty: null == isReadPretty ? void 0 : isReadPretty(context),
|
|
68
|
+
action,
|
|
69
|
+
targetCollection: context.targetCollection
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
schema: context.schema
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
collectionField,
|
|
76
|
+
context,
|
|
77
|
+
defaultInitializerItem
|
|
78
|
+
};
|
|
79
|
+
}).map((param)=>{
|
|
80
|
+
let { collectionField, defaultInitializerItem, context } = param;
|
|
81
|
+
const customInitializerItem = getInitializerItem(collectionField, {
|
|
82
|
+
...context,
|
|
83
|
+
defaultInitializerItem
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
...defaultInitializerItem,
|
|
87
|
+
...customInitializerItem || {}
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export { getInitializerItemsByFields };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ISchema, Schema } from '@tachybase/schema';
|
|
2
|
+
import { CollectionFieldInterface } from '../../collection-field-interface';
|
|
3
|
+
import { Collection, CollectionFieldOptions } from '../../collection/Collection';
|
|
4
|
+
import { CollectionFieldContext } from './useCollectionFieldContext';
|
|
5
|
+
export interface CollectionFieldDefaultSchema {
|
|
6
|
+
/**
|
|
7
|
+
* @default 'string'
|
|
8
|
+
*/
|
|
9
|
+
type: string;
|
|
10
|
+
/**
|
|
11
|
+
* @default collectionField.name
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* @default 'CollectionField'
|
|
16
|
+
*/
|
|
17
|
+
'x-component': string;
|
|
18
|
+
/**
|
|
19
|
+
* @default `${collection.name}.${collectionField.name}`
|
|
20
|
+
*/
|
|
21
|
+
'x-collection-field': string;
|
|
22
|
+
/**
|
|
23
|
+
* @default collectionField?.uiSchema?.['x-read-pretty']
|
|
24
|
+
*/
|
|
25
|
+
'x-read-pretty'?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @default collectionField?.uiSchema?.title || collectionField.name
|
|
28
|
+
*/
|
|
29
|
+
title: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CollectionFieldGetSchemaResult {
|
|
32
|
+
'x-toolbar'?: string;
|
|
33
|
+
'x-toolbar-props'?: any;
|
|
34
|
+
'x-settings'?: string;
|
|
35
|
+
'x-decorator'?: string;
|
|
36
|
+
'x-decorator-props'?: any;
|
|
37
|
+
'x-component-props'?: any;
|
|
38
|
+
'x-use-component-props'?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CollectionFieldDefaultInitializerItem {
|
|
41
|
+
/**
|
|
42
|
+
* @default 'item'
|
|
43
|
+
*/
|
|
44
|
+
type: string;
|
|
45
|
+
/**
|
|
46
|
+
* @default collectionField.name
|
|
47
|
+
*/
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* @default collectionField?.uiSchema?.title || collectionField.name
|
|
51
|
+
*/
|
|
52
|
+
title: string;
|
|
53
|
+
/**
|
|
54
|
+
* @default 'CollectionFieldInitializer'
|
|
55
|
+
*/
|
|
56
|
+
Component: string;
|
|
57
|
+
schemaInitialize: (s: ISchema) => void;
|
|
58
|
+
/**
|
|
59
|
+
* @default schema
|
|
60
|
+
*/
|
|
61
|
+
schema: ISchema;
|
|
62
|
+
}
|
|
63
|
+
export interface CollectionFieldGetInitializerItemResult {
|
|
64
|
+
find?: (schema: Schema, key: string, action: string, name?: string) => any;
|
|
65
|
+
remove?: (schema: Schema, cb: (schema: Schema, stopProps: Record<string, any>) => void) => void;
|
|
66
|
+
}
|
|
67
|
+
export interface CommonCollectionFieldsProps {
|
|
68
|
+
block: string;
|
|
69
|
+
getSchema: (collectionField: CollectionFieldOptions, context: CollectionFieldContext & {
|
|
70
|
+
defaultSchema: CollectionFieldDefaultSchema;
|
|
71
|
+
targetCollection?: Collection;
|
|
72
|
+
collectionFieldInterface?: CollectionFieldInterface;
|
|
73
|
+
}) => CollectionFieldGetSchemaResult;
|
|
74
|
+
isReadPretty?: (context: CollectionFieldContext) => boolean;
|
|
75
|
+
filter?: (collectionField: CollectionFieldOptions, context: CollectionFieldContext) => boolean;
|
|
76
|
+
getInitializerItem?: (collectionField: CollectionFieldOptions, context: CollectionFieldContext & {
|
|
77
|
+
schema: ISchema;
|
|
78
|
+
defaultInitializerItem: CollectionFieldDefaultInitializerItem;
|
|
79
|
+
targetCollection?: Collection;
|
|
80
|
+
collectionFieldInterface?: CollectionFieldInterface;
|
|
81
|
+
}) => CollectionFieldGetInitializerItemResult;
|
|
82
|
+
}
|
|
83
|
+
export interface SelfCollectionFieldsProps extends CommonCollectionFieldsProps {
|
|
84
|
+
context: Omit<CollectionFieldContext, 'collection'> & {
|
|
85
|
+
collection: Collection;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export interface ParentCollectionFieldsProps extends CommonCollectionFieldsProps {
|
|
89
|
+
context: Omit<CollectionFieldContext, 'collection'> & {
|
|
90
|
+
collection: Collection;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface AssociationCollectionFieldsProps extends Omit<CommonCollectionFieldsProps, 'filter'> {
|
|
94
|
+
filterSelfField?: CommonCollectionFieldsProps['filter'];
|
|
95
|
+
filterAssociationField?: CommonCollectionFieldsProps['filter'];
|
|
96
|
+
context: Omit<CollectionFieldContext, 'collection'> & {
|
|
97
|
+
collection: CollectionFieldContext['collection'];
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface CollectionFieldsProps {
|
|
101
|
+
/**
|
|
102
|
+
* Block name.
|
|
103
|
+
*/
|
|
104
|
+
block: string;
|
|
105
|
+
selfField: Omit<SelfCollectionFieldsProps, 'block' | 'context'>;
|
|
106
|
+
parentField?: Omit<ParentCollectionFieldsProps, 'block' | 'context'>;
|
|
107
|
+
associationField?: Omit<AssociationCollectionFieldsProps, 'block' | 'context'>;
|
|
108
|
+
}
|
|
File without changes
|
package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Form, ISchema } from '@tachybase/schema';
|
|
2
|
+
import { TFunction } from 'i18next';
|
|
3
|
+
import { InheritanceCollectionMixin } from '../../../collection-manager';
|
|
4
|
+
import { useActionContext } from '../../../schema-component/antd/action';
|
|
5
|
+
import { Collection } from '../../collection/Collection';
|
|
6
|
+
import { CollectionManager } from '../../collection/CollectionManager';
|
|
7
|
+
import { DataSource } from '../../data-source/DataSource';
|
|
8
|
+
import { DataSourceManager } from '../../data-source/DataSourceManager';
|
|
9
|
+
export interface CollectionFieldContext {
|
|
10
|
+
fieldSchema: ISchema;
|
|
11
|
+
collection?: InheritanceCollectionMixin & Collection;
|
|
12
|
+
dataSource: DataSource;
|
|
13
|
+
form: Form<any>;
|
|
14
|
+
actionContext: ReturnType<typeof useActionContext>;
|
|
15
|
+
t: TFunction<'translation', undefined>;
|
|
16
|
+
collectionManager: CollectionManager;
|
|
17
|
+
dataSourceManager: DataSourceManager;
|
|
18
|
+
compile: (source: any, ext?: any) => any;
|
|
19
|
+
targetCollection?: Collection;
|
|
20
|
+
}
|
|
21
|
+
export declare function useCollectionFieldContext(): CollectionFieldContext;
|
package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../schema-component/index.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_action_index_mjs__ from "../../../schema-component/antd/action/index.mjs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__collection_CollectionManagerProvider_mjs__ from "../../collection/CollectionManagerProvider.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__collection_CollectionProvider_mjs__ from "../../collection/CollectionProvider.mjs";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__data_source_DataSourceManagerProvider_mjs__ from "../../data-source/DataSourceManagerProvider.mjs";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__data_source_DataSourceProvider_mjs__ from "../../data-source/DataSourceProvider.mjs";
|
|
9
|
+
function useCollectionFieldContext() {
|
|
10
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
11
|
+
const collection = (0, __WEBPACK_EXTERNAL_MODULE__collection_CollectionProvider_mjs__.useCollection)();
|
|
12
|
+
const dataSourceManager = (0, __WEBPACK_EXTERNAL_MODULE__data_source_DataSourceManagerProvider_mjs__.useDataSourceManager)();
|
|
13
|
+
const actionContext = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_action_index_mjs__.useActionContext)();
|
|
14
|
+
const dataSource = (0, __WEBPACK_EXTERNAL_MODULE__data_source_DataSourceProvider_mjs__.useDataSource)();
|
|
15
|
+
const form = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useForm)();
|
|
16
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
17
|
+
const collectionManager = (0, __WEBPACK_EXTERNAL_MODULE__collection_CollectionManagerProvider_mjs__.useCollectionManager)();
|
|
18
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
19
|
+
return {
|
|
20
|
+
t,
|
|
21
|
+
compile,
|
|
22
|
+
actionContext,
|
|
23
|
+
fieldSchema,
|
|
24
|
+
collection,
|
|
25
|
+
dataSource,
|
|
26
|
+
form,
|
|
27
|
+
collectionManager,
|
|
28
|
+
dataSourceManager
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export { useCollectionFieldContext };
|
package/es/data-source/index.mjs
CHANGED
|
@@ -7,4 +7,5 @@ export * from "./data-block/index.mjs";
|
|
|
7
7
|
export * from "./data-source/index.mjs";
|
|
8
8
|
export * from "./collection-record/index.mjs";
|
|
9
9
|
export * from "./utils.mjs";
|
|
10
|
+
export * from "./collection-fields-to-initializer-items/index.mjs";
|
|
10
11
|
export * from "./commonsSettingsItem/index.mjs";
|
|
@@ -214,10 +214,6 @@ const fieldSettingsFormItem = new __WEBPACK_EXTERNAL_MODULE__application_schema_
|
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
name: 'setDefaultValue',
|
|
217
|
-
useVisible () {
|
|
218
|
-
const { isAllowToSetDefaultValue } = (0, __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.useIsAllowToSetDefaultValue)();
|
|
219
|
-
return isAllowToSetDefaultValue();
|
|
220
|
-
},
|
|
221
217
|
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsDefaultValue
|
|
222
218
|
},
|
|
223
219
|
{
|
|
@@ -479,10 +475,6 @@ const fieldSettingsFormItem = new __WEBPACK_EXTERNAL_MODULE__application_schema_
|
|
|
479
475
|
},
|
|
480
476
|
{
|
|
481
477
|
...__WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.fieldComponentSettingsItem
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
name: 'editDefaultValue',
|
|
485
|
-
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsDefaultValue
|
|
486
478
|
}
|
|
487
479
|
];
|
|
488
480
|
}
|
|
@@ -5,7 +5,10 @@ function useEditFormBlockDecoratorProps(props) {
|
|
|
5
5
|
let parentRecord;
|
|
6
6
|
if (props.association) parentRecord = (0, __WEBPACK_EXTERNAL_MODULE__details_single_hooks_useDetailsDecoratorProps_mjs__.useDetailsParentRecord)(props.association);
|
|
7
7
|
return {
|
|
8
|
-
params
|
|
8
|
+
params: {
|
|
9
|
+
...params,
|
|
10
|
+
...props.params
|
|
11
|
+
},
|
|
9
12
|
parentRecord
|
|
10
13
|
};
|
|
11
14
|
}
|
|
@@ -1,11 +1,102 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
2
4
|
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../../application/schema-settings/SchemaSettings.mjs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../../schema-component/index.mjs";
|
|
3
6
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__ from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
|
|
4
7
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_table_v2_Table_Column_Decorator_mjs__ from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
|
|
5
8
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsNumberFormat_mjs__ from "../../../../schema-settings/SchemaSettingsNumberFormat.mjs";
|
|
6
9
|
const inputNumberComponentFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
|
|
7
10
|
name: 'fieldSettings:component:InputNumber',
|
|
8
11
|
items: [
|
|
12
|
+
{
|
|
13
|
+
name: 'setSliderMAXNumber',
|
|
14
|
+
type: 'modal',
|
|
15
|
+
useVisible () {
|
|
16
|
+
var _fieldSchema_xcomponentprops;
|
|
17
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
18
|
+
return 'Slider' === fieldSchema['x-component'] || (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.component) === 'Slider';
|
|
19
|
+
},
|
|
20
|
+
useComponentProps () {
|
|
21
|
+
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
|
|
22
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
23
|
+
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
24
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
25
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
26
|
+
return {
|
|
27
|
+
title: t('MAX'),
|
|
28
|
+
value: null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.max,
|
|
29
|
+
schema: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
title: t('Edit Slider Max'),
|
|
32
|
+
properties: {
|
|
33
|
+
maxNumber: {
|
|
34
|
+
default: (null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.max) || 100,
|
|
35
|
+
'x-decorator': 'FormItem',
|
|
36
|
+
'x-component': 'Input',
|
|
37
|
+
'x-component-props': {}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
onSubmit (number) {
|
|
42
|
+
if (Number(number.maxNumber) > (field.componentProps['min'] || 0)) {
|
|
43
|
+
fieldSchema['x-component-props']['max'] = Number(number.maxNumber);
|
|
44
|
+
field.componentProps['max'] = Number(number.maxNumber);
|
|
45
|
+
dn.emit('patch', {
|
|
46
|
+
schema: {
|
|
47
|
+
'x-uid': fieldSchema['x-uid'],
|
|
48
|
+
'x-component-props': fieldSchema['x-component-props']
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
} else __WEBPACK_EXTERNAL_MODULE_antd__.message.warning(t('Cannot be less than or equal to the minimum value'));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'setSliderMinNumber',
|
|
58
|
+
type: 'modal',
|
|
59
|
+
useVisible () {
|
|
60
|
+
var _fieldSchema_xcomponentprops;
|
|
61
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
62
|
+
return 'Slider' === fieldSchema['x-component'] || (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.component) === 'Slider';
|
|
63
|
+
},
|
|
64
|
+
useComponentProps () {
|
|
65
|
+
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
|
|
66
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
67
|
+
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
68
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
69
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
70
|
+
return {
|
|
71
|
+
title: t('MIN'),
|
|
72
|
+
value: null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.min,
|
|
73
|
+
schema: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
title: t('Edit Slider Min'),
|
|
76
|
+
properties: {
|
|
77
|
+
minNumber: {
|
|
78
|
+
default: (null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.min) || 0,
|
|
79
|
+
'x-decorator': 'FormItem',
|
|
80
|
+
'x-component': 'Input',
|
|
81
|
+
'x-component-props': {}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
onSubmit (number) {
|
|
86
|
+
if (Number(number.minNumber) < (field.componentProps['max'] || 0)) {
|
|
87
|
+
fieldSchema['x-component-props']['min'] = Number(number.minNumber);
|
|
88
|
+
field.componentProps['min'] = Number(number.minNumber);
|
|
89
|
+
dn.emit('patch', {
|
|
90
|
+
schema: {
|
|
91
|
+
'x-uid': fieldSchema['x-uid'],
|
|
92
|
+
'x-component-props': fieldSchema['x-component-props']
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} else __WEBPACK_EXTERNAL_MODULE_antd__.message.warning(t('Cannot be greater than or equal to the maximum value'));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
},
|
|
9
100
|
{
|
|
10
101
|
name: 'displayFormat',
|
|
11
102
|
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsNumberFormat_mjs__.SchemaSettingsNumberFormat,
|
|
@@ -15,6 +15,7 @@ export * from './collection-select';
|
|
|
15
15
|
export * from './color-picker';
|
|
16
16
|
export * from './color-select';
|
|
17
17
|
export * from './cron';
|
|
18
|
+
export * from './slider';
|
|
18
19
|
export * from './custom-cascader';
|
|
19
20
|
export * from './date-picker';
|
|
20
21
|
export * from './details';
|
|
@@ -58,5 +59,6 @@ export * from './unixTimestamp';
|
|
|
58
59
|
export * from './upload';
|
|
59
60
|
export * from './variable';
|
|
60
61
|
export * from './media-card';
|
|
62
|
+
export * from './tracking-link';
|
|
61
63
|
export { PageHeader } from '@ant-design/pro-layout';
|
|
62
64
|
export { CodeMirror } from '@tachybase/components';
|
|
@@ -17,6 +17,7 @@ export * from "./collection-select/index.mjs";
|
|
|
17
17
|
export * from "./color-picker/index.mjs";
|
|
18
18
|
export * from "./color-select/index.mjs";
|
|
19
19
|
export * from "./cron/index.mjs";
|
|
20
|
+
export * from "./slider/index.mjs";
|
|
20
21
|
export * from "./custom-cascader/index.mjs";
|
|
21
22
|
export * from "./date-picker/index.mjs";
|
|
22
23
|
export * from "./details/index.mjs";
|
|
@@ -60,6 +61,7 @@ export * from "./unixTimestamp/index.mjs";
|
|
|
60
61
|
export * from "./upload/index.mjs";
|
|
61
62
|
export * from "./variable/index.mjs";
|
|
62
63
|
export * from "./media-card/index.mjs";
|
|
64
|
+
export * from "./tracking-link/index.mjs";
|
|
63
65
|
var __webpack_exports__CodeMirror = __WEBPACK_EXTERNAL_MODULE__tachybase_components__.CodeMirror;
|
|
64
66
|
var __webpack_exports__PageHeader = __WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader;
|
|
65
67
|
var __webpack_exports__genStyleHook = __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHook;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_router__ from "react-router";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "../../index.mjs";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_index_mjs__ from "../../../application/schema-settings/index.mjs";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__ from "../../../application/schema-toolbar/index.mjs";
|
|
@@ -36,6 +37,38 @@ const pageSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_
|
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
},
|
|
40
|
+
{
|
|
41
|
+
name: 'enablesharePage',
|
|
42
|
+
type: 'switch',
|
|
43
|
+
useVisible () {
|
|
44
|
+
const isShare = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useMatch)('/share/:name');
|
|
45
|
+
return !isShare;
|
|
46
|
+
},
|
|
47
|
+
useComponentProps () {
|
|
48
|
+
var _fieldSchema_xcomponentprops;
|
|
49
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useDesignable)();
|
|
50
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
51
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
52
|
+
const { title } = (0, __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__.useSchemaToolbar)();
|
|
53
|
+
return {
|
|
54
|
+
title: t('Enable Share page'),
|
|
55
|
+
checked: null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.enableSharePage,
|
|
56
|
+
onChange (v) {
|
|
57
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
58
|
+
fieldSchema['x-component-props']['enableSharePage'] = v;
|
|
59
|
+
if (!fieldSchema.title) fieldSchema.title = title;
|
|
60
|
+
dn.emit('patch', {
|
|
61
|
+
schema: {
|
|
62
|
+
['x-uid']: fieldSchema['x-uid'],
|
|
63
|
+
['x-component-props']: fieldSchema['x-component-props'],
|
|
64
|
+
title: fieldSchema.title
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
dn.refresh();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
},
|
|
39
72
|
{
|
|
40
73
|
name: 'divider',
|
|
41
74
|
type: 'divider',
|