@tachybase/client 1.6.34 → 1.6.36
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/utils/globalDeps.mjs +2 -2
- package/es/modules/actions/add-new/createFormBlockInitializers.mjs +4 -0
- package/es/modules/blocks/data-blocks/form/FormBlockInitializer.d.ts +3 -2
- package/es/modules/blocks/data-blocks/form/FormBlockInitializer.mjs +4 -4
- package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +9 -3
- package/lib/locale/en_US.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/modules/actions/add-new/createFormBlockInitializers.js +4 -0
- package/lib/modules/blocks/data-blocks/form/FormBlockInitializer.js +4 -4
- package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +9 -3
- package/package.json +4 -4
|
@@ -8,10 +8,10 @@ import { getTachybaseClientExports } from "./clientModuleRegistry.mjs";
|
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next_05dede28__ from "react-i18next";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__tego_client_7f3175c1__ from "@tego/client";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
11
|
-
import * as __WEBPACK_EXTERNAL_MODULE_ahooks__ from "ahooks";
|
|
12
11
|
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema_532e17e1__ from "@tachybase/schema";
|
|
13
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__ from "react-router-dom";
|
|
14
12
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_style_1dcbd21e__ from "antd-style";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__ from "react-router-dom";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE_ahooks__ from "ahooks";
|
|
15
15
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons_a8184985__ from "@ant-design/icons";
|
|
16
16
|
import * as __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__ from "@emotion/css";
|
|
17
17
|
import * as __WEBPACK_EXTERNAL_MODULE_i18next__ from "i18next";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTranslation } from "react-i18next";
|
|
2
2
|
import { SchemaInitializer } from "../../../application/schema-initializer/SchemaInitializer.mjs";
|
|
3
3
|
import { useCollection } from "../../../data-source/collection/CollectionProvider.mjs";
|
|
4
|
+
import { useActionContext } from "../../../schema-component/index.mjs";
|
|
4
5
|
import { gridRowColWrap } from "../../../schema-initializer/utils.mjs";
|
|
5
6
|
const createFormBlockInitializers = new SchemaInitializer({
|
|
6
7
|
name: 'popup:addNew:addBlock',
|
|
@@ -13,8 +14,10 @@ const createFormBlockInitializers = new SchemaInitializer({
|
|
|
13
14
|
title: '{{t("Data blocks")}}',
|
|
14
15
|
name: 'dataBlocks',
|
|
15
16
|
useChildren () {
|
|
17
|
+
var _action_fieldSchema_xcomponentprops, _action_fieldSchema;
|
|
16
18
|
const currentCollection = useCollection();
|
|
17
19
|
const { t } = useTranslation();
|
|
20
|
+
const action = useActionContext();
|
|
18
21
|
return [
|
|
19
22
|
{
|
|
20
23
|
name: 'form',
|
|
@@ -28,6 +31,7 @@ const createFormBlockInitializers = new SchemaInitializer({
|
|
|
28
31
|
if (associationField) return false;
|
|
29
32
|
if (collection.name === currentCollection.name) return true;
|
|
30
33
|
},
|
|
34
|
+
newRecord: null == (_action_fieldSchema = action.fieldSchema) ? void 0 : null == (_action_fieldSchema_xcomponentprops = _action_fieldSchema['x-component-props']) ? void 0 : _action_fieldSchema_xcomponentprops.newRecord,
|
|
31
35
|
showAssociationFields: true,
|
|
32
36
|
onlyCurrentDataSource: true,
|
|
33
37
|
hideSearch: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection';
|
|
2
|
-
export declare const FormBlockInitializer: ({ filterCollections, onlyCurrentDataSource, hideSearch, createBlockSchema, componentType, templateWrap: customizeTemplateWrap, showAssociationFields, hideChildrenIfSingleCollection, hideOtherRecordsInPopup, currentText, otherText, }: {
|
|
2
|
+
export declare const FormBlockInitializer: ({ filterCollections, onlyCurrentDataSource, hideSearch, createBlockSchema, componentType, templateWrap: customizeTemplateWrap, showAssociationFields, hideChildrenIfSingleCollection, hideOtherRecordsInPopup, currentText, otherText, newRecord, }: {
|
|
3
3
|
filterCollections: (options: {
|
|
4
4
|
collection?: Collection;
|
|
5
5
|
associationField?: CollectionFieldOptions;
|
|
@@ -24,8 +24,9 @@ export declare const FormBlockInitializer: ({ filterCollections, onlyCurrentData
|
|
|
24
24
|
currentText?: string;
|
|
25
25
|
/** 用于更改 Other records 的文案 */
|
|
26
26
|
otherText?: string;
|
|
27
|
+
newRecord?: boolean;
|
|
27
28
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export declare const useCreateFormBlock: () => {
|
|
29
|
+
export declare const useCreateFormBlock: (newRecord?: boolean) => {
|
|
29
30
|
createFormBlock: ({ item, fromOthersInPopup }: {
|
|
30
31
|
item: any;
|
|
31
32
|
fromOthersInPopup: any;
|
|
@@ -6,9 +6,9 @@ import { useAssociationName } from "../../../../data-source/collection/Associati
|
|
|
6
6
|
import { DataBlockInitializer } from "../../../../schema-initializer/items/DataBlockInitializer.mjs";
|
|
7
7
|
import { createCreateFormBlockUISchema } from "./createCreateFormBlockUISchema.mjs";
|
|
8
8
|
const FormBlockInitializer = (param)=>{
|
|
9
|
-
let { filterCollections, onlyCurrentDataSource, hideSearch, createBlockSchema, componentType = 'FormItem', templateWrap: customizeTemplateWrap, showAssociationFields, hideChildrenIfSingleCollection, hideOtherRecordsInPopup, currentText, otherText } = param;
|
|
9
|
+
let { filterCollections, onlyCurrentDataSource, hideSearch, createBlockSchema, componentType = 'FormItem', templateWrap: customizeTemplateWrap, showAssociationFields, hideChildrenIfSingleCollection, hideOtherRecordsInPopup, currentText, otherText, newRecord } = param;
|
|
10
10
|
const itemConfig = useSchemaInitializerItem();
|
|
11
|
-
const { createFormBlock, templateWrap } = useCreateFormBlock();
|
|
11
|
+
const { createFormBlock, templateWrap } = useCreateFormBlock(newRecord);
|
|
12
12
|
const onCreateFormBlockSchema = useCallback((options)=>{
|
|
13
13
|
if (createBlockSchema) return createBlockSchema(options);
|
|
14
14
|
createFormBlock(options);
|
|
@@ -35,9 +35,9 @@ const FormBlockInitializer = (param)=>{
|
|
|
35
35
|
otherText: otherText
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
const useCreateFormBlock = ()=>{
|
|
38
|
+
const useCreateFormBlock = (newRecord)=>{
|
|
39
39
|
const { insert } = useSchemaInitializer();
|
|
40
|
-
const association = useAssociationName();
|
|
40
|
+
const association = newRecord ? void 0 : useAssociationName();
|
|
41
41
|
const { isCusomeizeCreate: isCustomizeCreate } = useSchemaInitializerItem();
|
|
42
42
|
const createFormBlock = useCallback((param)=>{
|
|
43
43
|
let { item, fromOthersInPopup } = param;
|
|
@@ -172,11 +172,15 @@ const quickCreate = {
|
|
|
172
172
|
{
|
|
173
173
|
label: t('Pop-up'),
|
|
174
174
|
value: 'modalAdd'
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: t('Pop-up(without context)'),
|
|
178
|
+
value: 'modalAdd(without context)'
|
|
175
179
|
}
|
|
176
180
|
],
|
|
177
181
|
value: (null == (_field_componentProps = field.componentProps) ? void 0 : _field_componentProps.addMode) || 'none',
|
|
178
182
|
onChange (mode) {
|
|
179
|
-
if ('modalAdd' === mode) {
|
|
183
|
+
if ('modalAdd' === mode || 'modalAdd(without context)' === mode) {
|
|
180
184
|
const hasAddNew = fieldSchema.reduceProperties((buf, schema)=>{
|
|
181
185
|
if ('Action' === schema['x-component']) return schema;
|
|
182
186
|
return buf;
|
|
@@ -193,7 +197,8 @@ const quickCreate = {
|
|
|
193
197
|
'x-component-props': {
|
|
194
198
|
openMode: 'drawer',
|
|
195
199
|
type: 'default',
|
|
196
|
-
component: 'CreateRecordAction'
|
|
200
|
+
component: 'CreateRecordAction',
|
|
201
|
+
newRecord: 'modalAdd(without context)' === mode
|
|
197
202
|
}
|
|
198
203
|
};
|
|
199
204
|
insertAdjacent('afterBegin', addNewActionschema);
|
|
@@ -203,7 +208,8 @@ const quickCreate = {
|
|
|
203
208
|
['x-uid']: fieldSchema['x-uid']
|
|
204
209
|
};
|
|
205
210
|
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
206
|
-
fieldSchema['x-component-props']['addMode'] = mode;
|
|
211
|
+
fieldSchema['x-component-props']['addMode'] = 'modalAdd(without context)' === mode ? 'modalAdd' : mode;
|
|
212
|
+
fieldSchema['x-component-props']['newRecord'] = 'modalAdd(without context)' === mode;
|
|
207
213
|
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
208
214
|
field.componentProps = field.componentProps || {};
|
|
209
215
|
field.componentProps.addMode = mode;
|
package/lib/locale/en_US.js
CHANGED
|
@@ -617,6 +617,7 @@ module.exports = {
|
|
|
617
617
|
"Plugin stopping...": "Plugin stopping...",
|
|
618
618
|
"Plugin tab name": "Plugin tab name",
|
|
619
619
|
"Plugin's version": "Plugin's version",
|
|
620
|
+
"Pop-up(without context)": "Pop-up(without context)",
|
|
620
621
|
Popup: "Popup",
|
|
621
622
|
"Popup close method": "Popup close method",
|
|
622
623
|
"Popup form": "Popup form",
|
package/lib/locale/zh-CN.js
CHANGED
|
@@ -730,6 +730,7 @@ module.exports = {
|
|
|
730
730
|
"Plugin tab name": "\u63D2\u4EF6\u6807\u7B7E\u9875",
|
|
731
731
|
"Plugin's version": "\u63D2\u4EF6\u7684\u7248\u672C",
|
|
732
732
|
"Pop-up": "\u5F39\u7A97",
|
|
733
|
+
"Pop-up(without context)": "\u5F39\u7A97\uFF08\u65E0\u4E0A\u4E0B\u6587\uFF09",
|
|
733
734
|
Popup: "\u6253\u5F00\u5F39\u7A97",
|
|
734
735
|
"Popup close method": "\u5F39\u7A97\u5173\u95ED\u65B9\u5F0F",
|
|
735
736
|
"Popup form": "Popup form",
|
|
@@ -29,6 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
30
30
|
const SchemaInitializer_js_namespaceObject = require("../../../application/schema-initializer/SchemaInitializer.js");
|
|
31
31
|
const CollectionProvider_js_namespaceObject = require("../../../data-source/collection/CollectionProvider.js");
|
|
32
|
+
const index_js_namespaceObject = require("../../../schema-component/index.js");
|
|
32
33
|
const utils_js_namespaceObject = require("../../../schema-initializer/utils.js");
|
|
33
34
|
const createFormBlockInitializers = new SchemaInitializer_js_namespaceObject.SchemaInitializer({
|
|
34
35
|
name: 'popup:addNew:addBlock',
|
|
@@ -41,8 +42,10 @@ const createFormBlockInitializers = new SchemaInitializer_js_namespaceObject.Sch
|
|
|
41
42
|
title: '{{t("Data blocks")}}',
|
|
42
43
|
name: 'dataBlocks',
|
|
43
44
|
useChildren () {
|
|
45
|
+
var _action_fieldSchema_xcomponentprops, _action_fieldSchema;
|
|
44
46
|
const currentCollection = (0, CollectionProvider_js_namespaceObject.useCollection)();
|
|
45
47
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
48
|
+
const action = (0, index_js_namespaceObject.useActionContext)();
|
|
46
49
|
return [
|
|
47
50
|
{
|
|
48
51
|
name: 'form',
|
|
@@ -56,6 +59,7 @@ const createFormBlockInitializers = new SchemaInitializer_js_namespaceObject.Sch
|
|
|
56
59
|
if (associationField) return false;
|
|
57
60
|
if (collection.name === currentCollection.name) return true;
|
|
58
61
|
},
|
|
62
|
+
newRecord: null == (_action_fieldSchema = action.fieldSchema) ? void 0 : null == (_action_fieldSchema_xcomponentprops = _action_fieldSchema['x-component-props']) ? void 0 : _action_fieldSchema_xcomponentprops.newRecord,
|
|
59
63
|
showAssociationFields: true,
|
|
60
64
|
onlyCurrentDataSource: true,
|
|
61
65
|
hideSearch: true,
|
|
@@ -35,9 +35,9 @@ const AssociationProvider_js_namespaceObject = require("../../../../data-source/
|
|
|
35
35
|
const DataBlockInitializer_js_namespaceObject = require("../../../../schema-initializer/items/DataBlockInitializer.js");
|
|
36
36
|
const external_createCreateFormBlockUISchema_js_namespaceObject = require("./createCreateFormBlockUISchema.js");
|
|
37
37
|
const FormBlockInitializer = (param)=>{
|
|
38
|
-
let { filterCollections, onlyCurrentDataSource, hideSearch, createBlockSchema, componentType = 'FormItem', templateWrap: customizeTemplateWrap, showAssociationFields, hideChildrenIfSingleCollection, hideOtherRecordsInPopup, currentText, otherText } = param;
|
|
38
|
+
let { filterCollections, onlyCurrentDataSource, hideSearch, createBlockSchema, componentType = 'FormItem', templateWrap: customizeTemplateWrap, showAssociationFields, hideChildrenIfSingleCollection, hideOtherRecordsInPopup, currentText, otherText, newRecord } = param;
|
|
39
39
|
const itemConfig = (0, index_js_namespaceObject.useSchemaInitializerItem)();
|
|
40
|
-
const { createFormBlock, templateWrap } = useCreateFormBlock();
|
|
40
|
+
const { createFormBlock, templateWrap } = useCreateFormBlock(newRecord);
|
|
41
41
|
const onCreateFormBlockSchema = (0, external_react_namespaceObject.useCallback)((options)=>{
|
|
42
42
|
if (createBlockSchema) return createBlockSchema(options);
|
|
43
43
|
createFormBlock(options);
|
|
@@ -64,9 +64,9 @@ const FormBlockInitializer = (param)=>{
|
|
|
64
64
|
otherText: otherText
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
const useCreateFormBlock = ()=>{
|
|
67
|
+
const useCreateFormBlock = (newRecord)=>{
|
|
68
68
|
const { insert } = (0, index_js_namespaceObject.useSchemaInitializer)();
|
|
69
|
-
const association = (0, AssociationProvider_js_namespaceObject.useAssociationName)();
|
|
69
|
+
const association = newRecord ? void 0 : (0, AssociationProvider_js_namespaceObject.useAssociationName)();
|
|
70
70
|
const { isCusomeizeCreate: isCustomizeCreate } = (0, index_js_namespaceObject.useSchemaInitializerItem)();
|
|
71
71
|
const createFormBlock = (0, external_react_namespaceObject.useCallback)((param)=>{
|
|
72
72
|
let { item, fromOthersInPopup } = param;
|
|
@@ -218,11 +218,15 @@ const quickCreate = {
|
|
|
218
218
|
{
|
|
219
219
|
label: t('Pop-up'),
|
|
220
220
|
value: 'modalAdd'
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: t('Pop-up(without context)'),
|
|
224
|
+
value: 'modalAdd(without context)'
|
|
221
225
|
}
|
|
222
226
|
],
|
|
223
227
|
value: (null == (_field_componentProps = field.componentProps) ? void 0 : _field_componentProps.addMode) || 'none',
|
|
224
228
|
onChange (mode) {
|
|
225
|
-
if ('modalAdd' === mode) {
|
|
229
|
+
if ('modalAdd' === mode || 'modalAdd(without context)' === mode) {
|
|
226
230
|
const hasAddNew = fieldSchema.reduceProperties((buf, schema)=>{
|
|
227
231
|
if ('Action' === schema['x-component']) return schema;
|
|
228
232
|
return buf;
|
|
@@ -239,7 +243,8 @@ const quickCreate = {
|
|
|
239
243
|
'x-component-props': {
|
|
240
244
|
openMode: 'drawer',
|
|
241
245
|
type: 'default',
|
|
242
|
-
component: 'CreateRecordAction'
|
|
246
|
+
component: 'CreateRecordAction',
|
|
247
|
+
newRecord: 'modalAdd(without context)' === mode
|
|
243
248
|
}
|
|
244
249
|
};
|
|
245
250
|
insertAdjacent('afterBegin', addNewActionschema);
|
|
@@ -249,7 +254,8 @@ const quickCreate = {
|
|
|
249
254
|
['x-uid']: fieldSchema['x-uid']
|
|
250
255
|
};
|
|
251
256
|
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
252
|
-
fieldSchema['x-component-props']['addMode'] = mode;
|
|
257
|
+
fieldSchema['x-component-props']['addMode'] = 'modalAdd(without context)' === mode ? 'modalAdd' : mode;
|
|
258
|
+
fieldSchema['x-component-props']['newRecord'] = 'modalAdd(without context)' === mode;
|
|
253
259
|
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
254
260
|
field.componentProps = field.componentProps || {};
|
|
255
261
|
field.componentProps.addMode = mode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/client",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.36",
|
|
4
4
|
"homepage": "https://github.com/tegojs/tego-standard#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/tegojs/tego-standard/issues"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@floating-ui/react": "0.26.28",
|
|
31
31
|
"@js-preview/excel": "^1.7.14",
|
|
32
32
|
"@lottiefiles/dotlottie-react": "^0.9.3",
|
|
33
|
-
"@tachybase/schema": "1.6.
|
|
34
|
-
"@tachybase/utils": "1.6.
|
|
35
|
-
"@tego/client": "1.6.
|
|
33
|
+
"@tachybase/schema": "1.6.18",
|
|
34
|
+
"@tachybase/utils": "1.6.18",
|
|
35
|
+
"@tego/client": "1.6.18",
|
|
36
36
|
"ahooks": "^3.9.0",
|
|
37
37
|
"antd": "5.22.5",
|
|
38
38
|
"antd-style": "3.7.1",
|