@tachybase/client 1.3.24 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/api-client/APIClient.mjs +21 -4
- package/es/application/components/AppComponent.mjs +3 -1
- package/es/application/utils/globalDeps.mjs +1 -0
- package/es/built-in/acl/ACLProvider.mjs +3 -1
- package/es/built-in/index.mjs +2 -2
- package/es/built-in/pm/PluginManager.mjs +51 -8
- package/es/built-in/system-version/SystemVersion.provider.mjs +52 -5
- package/es/collection-manager/Configuration/AddFieldAction.mjs +1 -1
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.mjs +0 -1
- package/es/common/appInfo/CurrentAppInfoProvider.d.ts +4 -1
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +2 -1
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +9 -0
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +35 -2
- package/es/schema-component/antd/action/Action.Area.mjs +2 -2
- package/es/schema-component/antd/action/Action.Area.style.d.ts +1 -0
- package/es/schema-component/antd/action/Action.Area.style.mjs +12 -1
- package/es/schema-component/antd/action/types.d.ts +1 -0
- package/es/schema-component/antd/association-field/InternalNester.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalSubTable.mjs +2 -2
- package/es/schema-component/antd/association-field/SubTable.mjs +24 -3
- package/es/schema-component/antd/association-field/hooks.mjs +6 -2
- package/es/schema-component/antd/icon-picker/IconFilterInput.mjs +3 -2
- package/es/schema-component/antd/icon-picker/index.d.ts +2 -0
- package/es/schema-component/antd/icon-picker/index.mjs +2 -0
- package/es/schema-component/antd/menu/Menu.mjs +1 -1
- package/es/schema-component/antd/page/Page.mjs +1 -1
- package/es/schema-component/antd/page/Page.style.mjs +3 -3
- package/es/schema-component/antd/page/components/AddTabForm.d.ts +1 -0
- package/es/schema-component/antd/page/components/AddTabForm.mjs +35 -0
- package/es/schema-component/antd/table-v2/Table.mjs +3 -2
- package/es/schema-component/antd/table-v2/Table.styles.mjs +1 -1
- package/es/schema-component/common/sortable-item/DragHandlePageTab.mjs +11 -46
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +1 -1
- package/es/schema-component/hooks/useDesignable.d.ts +5 -5
- package/es/schema-component/hooks/useDesignable.mjs +18 -18
- package/es/user/CurrentUser.mjs +11 -3
- package/lib/api-client/APIClient.js +21 -4
- package/lib/application/components/AppComponent.js +3 -1
- package/lib/application/utils/globalDeps.js +2 -1
- package/lib/block-provider/hooks/index.js +2 -2
- package/lib/built-in/acl/ACLProvider.js +3 -1
- package/lib/built-in/index.js +11 -11
- package/lib/built-in/pm/PluginManager.js +51 -8
- package/lib/built-in/system-version/SystemVersion.provider.js +52 -5
- package/lib/collection-manager/Configuration/AddFieldAction.js +1 -1
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.js +0 -1
- package/lib/locale/en_US.js +9 -0
- package/lib/locale/es_ES.js +4 -0
- package/lib/locale/fr_FR.js +4 -0
- package/lib/locale/ja_JP.js +4 -0
- package/lib/locale/ko_KR.js +4 -0
- package/lib/locale/pt_BR.js +4 -0
- package/lib/locale/ru_RU.js +4 -0
- package/lib/locale/tr_TR.js +4 -0
- package/lib/locale/uk_UA.js +4 -0
- package/lib/locale/zh-CN.js +10 -1
- package/lib/locale/zh-TW.js +4 -0
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +2 -1
- package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +39 -3
- package/lib/schema-component/antd/action/Action.Area.js +2 -2
- package/lib/schema-component/antd/action/Action.Area.style.js +12 -1
- package/lib/schema-component/antd/association-field/InternalNester.js +2 -2
- package/lib/schema-component/antd/association-field/InternalSubTable.js +2 -2
- package/lib/schema-component/antd/association-field/SubTable.js +22 -1
- package/lib/schema-component/antd/association-field/hooks.js +6 -2
- package/lib/schema-component/antd/icon-picker/IconFilterInput.js +3 -2
- package/lib/schema-component/antd/icon-picker/index.js +18 -0
- package/lib/schema-component/antd/menu/Menu.js +1 -1
- package/lib/schema-component/antd/page/Page.js +1 -1
- package/lib/schema-component/antd/page/Page.style.js +3 -3
- package/lib/schema-component/antd/page/components/AddTabForm.js +69 -0
- package/lib/schema-component/antd/table-v2/Table.js +3 -2
- package/lib/schema-component/antd/table-v2/Table.styles.js +1 -1
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.js +10 -45
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +1 -1
- package/lib/schema-component/hooks/useDesignable.js +18 -18
- package/lib/user/CurrentUser.js +11 -3
- package/package.json +7 -7
|
@@ -9,7 +9,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
9
9
|
}
|
|
10
10
|
function _templateObject() {
|
|
11
11
|
const data = _tagged_template_literal([
|
|
12
|
-
"\n .ant-tabs-nav-wrap.ant-tabs-nav-wrap {\n flex: none;\n }\n .ant-tabs-tab.ant-tabs-tab {\n border: none;\n background-color: #ffffff;\n }\n\n .ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active {\n border-radius: 8px 8px 0 0;\n box-shadow: none;\n text-shadow: none;\n background-color: var(--tb-box-bg);\n }\n .ant-tabs-extra-content {\n flex: 1;\n }\n "
|
|
12
|
+
"\n .ant-tabs-nav-wrap.ant-tabs-nav-wrap {\n flex: none;\n }\n .ant-tabs-tab.ant-tabs-tab.ant-tabs-tab {\n padding: 0;\n border: none;\n background-color: #ffffff;\n }\n\n .ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active {\n border-radius: 8px 8px 0 0;\n box-shadow: none;\n text-shadow: none;\n background-color: var(--tb-box-bg);\n }\n .ant-tabs-extra-content {\n flex: 1;\n }\n "
|
|
13
13
|
]);
|
|
14
14
|
_templateObject = function() {
|
|
15
15
|
return data;
|
|
@@ -18,7 +18,7 @@ function _templateObject() {
|
|
|
18
18
|
}
|
|
19
19
|
function _templateObject1() {
|
|
20
20
|
const data = _tagged_template_literal([
|
|
21
|
-
"\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n
|
|
21
|
+
"\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n &.designable {\n justify-content: space-between;\n }\n .add-tab-btn {\n border-radius: 8px 8px 0 0;\n }\n\n .scroll-area-extra-content {\n align-self: flex-end;\n }\n "
|
|
22
22
|
]);
|
|
23
23
|
_templateObject1 = function() {
|
|
24
24
|
return data;
|
|
@@ -27,7 +27,7 @@ function _templateObject1() {
|
|
|
27
27
|
}
|
|
28
28
|
function _templateObject2() {
|
|
29
29
|
const data = _tagged_template_literal([
|
|
30
|
-
"\n position: relative;\n &:hover {\n .tab-designer-wrapper {\n display: block;\n }\n }\n .tab-designer-wrapper {\n display: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 0 2px;\n border-radius: 3px;\n color: #000000;\n background-color: #ffffff;\n\n &:hover {\n color: #ffffff;\n background-color: var(--colorSettings);\n }\n }\n "
|
|
30
|
+
"\n position: relative;\n border-radius: 8px 8px 0 0;\n &:hover {\n .tab-designer-wrapper {\n display: block;\n }\n }\n .tab-designer-wrapper {\n display: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 0 2px;\n border-radius: 3px;\n color: #000000;\n background-color: #ffffff;\n\n &:hover {\n color: #ffffff;\n background-color: var(--colorSettings);\n }\n }\n "
|
|
31
31
|
]);
|
|
32
32
|
_templateObject2 = function() {
|
|
33
33
|
return data;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AddTabForm: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FormLayout } from "@tego/client";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { SchemaComponent, SchemaComponentOptions } from "../../../core/index.mjs";
|
|
5
|
+
const AddTabForm = (props)=>{
|
|
6
|
+
const { options } = props;
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
return /*#__PURE__*/ jsx(SchemaComponentOptions, {
|
|
9
|
+
scope: options.scope,
|
|
10
|
+
components: {
|
|
11
|
+
...options.components
|
|
12
|
+
},
|
|
13
|
+
children: /*#__PURE__*/ jsx(FormLayout, {
|
|
14
|
+
layout: 'vertical',
|
|
15
|
+
children: /*#__PURE__*/ jsx(SchemaComponent, {
|
|
16
|
+
schema: {
|
|
17
|
+
properties: {
|
|
18
|
+
title: {
|
|
19
|
+
title: t('Tab name'),
|
|
20
|
+
'x-component': 'Input',
|
|
21
|
+
'x-decorator': 'FormItem',
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
icon: {
|
|
25
|
+
title: t('Icon'),
|
|
26
|
+
'x-component': 'IconPicker',
|
|
27
|
+
'x-decorator': 'FormItem'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export { AddTabForm };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import react, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { RecursionField, action, observer, spliceArrayState, uid, useField, useFieldSchema } from "@tachybase/schema";
|
|
4
|
+
import { isPortalInBody } from "@tego/client";
|
|
4
5
|
import { CopyOutlined, DeleteOutlined, MenuOutlined } from "@ant-design/icons";
|
|
5
6
|
import { SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
6
|
-
import { isPortalInBody } from "@tego/client";
|
|
7
7
|
import { useMemoizedFn } from "ahooks";
|
|
8
8
|
import { Table } from "antd";
|
|
9
9
|
import classnames from "classnames";
|
|
@@ -237,7 +237,7 @@ const Table_Table = withDynamicSchemaProps(observer((props)=>{
|
|
|
237
237
|
const { styles } = useStyles();
|
|
238
238
|
const { pagination: pagination1, useProps, ...others1 } = props;
|
|
239
239
|
const { pagination: pagination2, ...others2 } = (null == useProps ? void 0 : useProps()) || {};
|
|
240
|
-
const { dragSort
|
|
240
|
+
const { dragSort: tableDragSort, showIndex = true, onRowSelectionChange, onChange: onTableChange, rowSelection, rowKey, required, onExpand, onClickRow, ...others } = {
|
|
241
241
|
...others1,
|
|
242
242
|
...others2
|
|
243
243
|
};
|
|
@@ -255,6 +255,7 @@ const Table_Table = withDynamicSchemaProps(observer((props)=>{
|
|
|
255
255
|
const [selectedRow, setSelectedRow] = useState([]);
|
|
256
256
|
const dataSource = (null == field ? void 0 : null == (_field_value = field.value) ? void 0 : null == (_field_value_slice1 = _field_value.slice) ? void 0 : null == (_field_value_slice = _field_value_slice1.call(_field_value)) ? void 0 : null == (_field_value_slice_filter = _field_value_slice.filter) ? void 0 : _field_value_slice_filter.call(_field_value_slice, Boolean)) || [];
|
|
257
257
|
const isRowSelect = (null == rowSelection ? void 0 : rowSelection.type) !== 'none';
|
|
258
|
+
const dragSort = tableDragSort || field.componentProps.dragSort || false;
|
|
258
259
|
const defaultRowKeyMap = useRef(new Map());
|
|
259
260
|
let onRow = null, highlightRow = '';
|
|
260
261
|
if (onClickRow) {
|
|
@@ -72,7 +72,7 @@ function _templateObject5() {
|
|
|
72
72
|
}
|
|
73
73
|
function _templateObject6() {
|
|
74
74
|
const data = _tagged_template_literal([
|
|
75
|
-
"\n max-width: 300px;\n white-space: nowrap;\n .
|
|
75
|
+
"\n max-width: 300px;\n white-space: nowrap;\n .ant-color-picker-trigger {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n }\n "
|
|
76
76
|
]);
|
|
77
77
|
_templateObject6 = function() {
|
|
78
78
|
return data;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
3
4
|
import { cx } from "antd-style";
|
|
4
5
|
import { useDesignable } from "../../hooks/index.mjs";
|
|
5
6
|
import { useStyles } from "./DragHandlePageTab.style.mjs";
|
|
@@ -8,46 +9,16 @@ const DragHandlePageTab = (props)=>{
|
|
|
8
9
|
const { isSubMenu, children, className: overStyle, isAdminMenu } = props;
|
|
9
10
|
const { draggable } = useContext(SortableContext);
|
|
10
11
|
const { designable } = useDesignable();
|
|
11
|
-
const { attributes, listeners, setNodeRef, transform,
|
|
12
|
+
const { attributes, listeners, setNodeRef, isDragging, transform, transition } = draggable;
|
|
12
13
|
const { styles } = useStyles();
|
|
13
|
-
const ref = useRef(null);
|
|
14
|
-
const [dimensions, setDimensions] = useState({
|
|
15
|
-
width: 0,
|
|
16
|
-
height: 0
|
|
17
|
-
});
|
|
18
|
-
const [initialPosition, setInitialPosition] = useState({
|
|
19
|
-
x: 0,
|
|
20
|
-
y: 0
|
|
21
|
-
});
|
|
22
|
-
const style = {
|
|
23
|
-
position: isDragging ? 'fixed' : 'static',
|
|
24
|
-
top: isDragging ? initialPosition.y - 5 * dimensions.height : 0,
|
|
25
|
-
left: isDragging ? initialPosition.x - dimensions.width : 0,
|
|
26
|
-
width: isDragging ? 'max-content' : '100%',
|
|
27
|
-
height: isDragging ? 'max-content' : '100%',
|
|
28
|
-
zIndex: isDragging ? 999 : 'auto',
|
|
29
|
-
pointerEvents: isDragging ? 'none' : 'auto',
|
|
30
|
-
transform: transform ? "translate3d(".concat(transform.x, "px, ").concat(transform.y, "px, 0) scale(").concat(isDragging ? 1.05 : 1, ")") : void 0,
|
|
31
|
-
boxShadow: isDragging ? '0 8px 24px 4px rgba(0,0,0,0.18)' : 'none',
|
|
32
|
-
WebkitTransform: transform ? "translate3d(".concat(transform.x, "px, ").concat(transform.y, "px, 0) scale(").concat(isDragging ? 1.05 : 1, ")") : void 0,
|
|
33
|
-
WebkitPerspective: isDragging ? 1000 : void 0,
|
|
34
|
-
isolation: isDragging ? 'isolate' : void 0
|
|
35
|
-
};
|
|
36
|
-
const handleMouseDown = (event)=>{
|
|
37
|
-
if (ref.current) {
|
|
38
|
-
const { width, height } = ref.current.getBoundingClientRect();
|
|
39
|
-
const { clientX, clientY } = event;
|
|
40
|
-
setDimensions({
|
|
41
|
-
width,
|
|
42
|
-
height
|
|
43
|
-
});
|
|
44
|
-
setInitialPosition({
|
|
45
|
-
x: clientX,
|
|
46
|
-
y: clientY
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
14
|
if (!designable) return children;
|
|
15
|
+
({
|
|
16
|
+
...props.style,
|
|
17
|
+
transform: CSS.Translate.toString(transform),
|
|
18
|
+
transition,
|
|
19
|
+
cursor: 'move',
|
|
20
|
+
zIndex: isDragging ? 999 : 'auto'
|
|
21
|
+
});
|
|
51
22
|
return /*#__PURE__*/ jsx("div", {
|
|
52
23
|
ref: setNodeRef,
|
|
53
24
|
className: cx(styles.dragHandleMenu, {
|
|
@@ -55,16 +26,10 @@ const DragHandlePageTab = (props)=>{
|
|
|
55
26
|
leftBorder: isSubMenu && isDragging,
|
|
56
27
|
adminMenu: isAdminMenu && isDragging
|
|
57
28
|
}, overStyle),
|
|
58
|
-
style: style,
|
|
59
29
|
...listeners,
|
|
60
30
|
...attributes,
|
|
61
31
|
role: "none",
|
|
62
|
-
|
|
63
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
64
|
-
ref: ref,
|
|
65
|
-
className: 'wrapper',
|
|
66
|
-
children: children
|
|
67
|
-
})
|
|
32
|
+
children: children
|
|
68
33
|
});
|
|
69
34
|
};
|
|
70
35
|
export { DragHandlePageTab };
|
|
@@ -9,7 +9,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
9
9
|
}
|
|
10
10
|
function _templateObject() {
|
|
11
11
|
const data = _tagged_template_literal([
|
|
12
|
-
"\n position: relative;\n width: 100%;\n height: 100%;\n
|
|
12
|
+
"\n position: relative;\n width: 100%;\n height: 100%;\n padding: 6px 16px;\n border-radius: 8px 8px 0 0;\n &.draggable {\n cursor: move;\n padding: 0 10px;\n border-radius: 5px;\n background: #f0f0f0;\n }\n "
|
|
13
13
|
]);
|
|
14
14
|
_templateObject = function() {
|
|
15
15
|
return data;
|
|
@@ -47,22 +47,22 @@ export declare class Designable {
|
|
|
47
47
|
getSchemaAttribute(key: string | string[], defaultValue?: any): any;
|
|
48
48
|
shallowMerge(schema: ISchema): void;
|
|
49
49
|
updateModel(key: any, value: any): void;
|
|
50
|
-
insertAdjacent(position: Position, schema: ISchema, options?: InsertAdjacentOptions):
|
|
50
|
+
insertAdjacent(position: Position, schema: ISchema, options?: InsertAdjacentOptions): Promise<any>;
|
|
51
51
|
recursiveRemoveIfNoChildren(schema?: Schema, options?: RecursiveRemoveOptions): Schema<any, any, any, any, any, any, any, any, any>;
|
|
52
52
|
remove(schema?: Schema, options?: RemoveOptions): Promise<any>;
|
|
53
53
|
removeWithoutEmit(schema?: Schema, options?: RemoveOptions): Schema<any, any, any, any, any, any, any, any, any>;
|
|
54
|
-
insertBeforeBeginOrAfterEnd(schema: ISchema, options?: InsertAdjacentOptions): void
|
|
54
|
+
insertBeforeBeginOrAfterEnd(schema: ISchema, options?: InsertAdjacentOptions): Promise<void>;
|
|
55
55
|
/**
|
|
56
56
|
* Before the current schema itself.
|
|
57
57
|
*/
|
|
58
|
-
insertBeforeBegin(schema: ISchema, options?: InsertAdjacentOptions): void
|
|
58
|
+
insertBeforeBegin(schema: ISchema, options?: InsertAdjacentOptions): Promise<void>;
|
|
59
59
|
/**
|
|
60
60
|
* Just inside the current schema, before its first child.
|
|
61
61
|
*
|
|
62
62
|
* @param schema
|
|
63
63
|
* @returns
|
|
64
64
|
*/
|
|
65
|
-
insertAfterBegin(schema: ISchema, options?: InsertAdjacentOptions): void
|
|
65
|
+
insertAfterBegin(schema: ISchema, options?: InsertAdjacentOptions): Promise<void>;
|
|
66
66
|
/**
|
|
67
67
|
* Just inside the targetElement, after its last child.
|
|
68
68
|
*
|
|
@@ -73,7 +73,7 @@ export declare class Designable {
|
|
|
73
73
|
/**
|
|
74
74
|
* After the current schema itself.
|
|
75
75
|
*/
|
|
76
|
-
insertAfterEnd(schema: ISchema, options?: InsertAdjacentOptions): void
|
|
76
|
+
insertAfterEnd(schema: ISchema, options?: InsertAdjacentOptions): Promise<void>;
|
|
77
77
|
}
|
|
78
78
|
export declare function useFindComponent(): (component: string | ComponentType) => any;
|
|
79
79
|
export declare function useDesignable(): {
|
|
@@ -276,17 +276,17 @@ class Designable {
|
|
|
276
276
|
if (this.model) update(this.model);
|
|
277
277
|
if (this.query) this.query.take(update);
|
|
278
278
|
}
|
|
279
|
-
insertAdjacent(position, schema) {
|
|
279
|
+
async insertAdjacent(position, schema) {
|
|
280
280
|
let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
|
|
281
281
|
switch(position){
|
|
282
282
|
case 'beforeBegin':
|
|
283
|
-
return this.insertBeforeBegin(schema, options);
|
|
283
|
+
return await this.insertBeforeBegin(schema, options);
|
|
284
284
|
case 'afterBegin':
|
|
285
|
-
return this.insertAfterBegin(schema, options);
|
|
285
|
+
return await this.insertAfterBegin(schema, options);
|
|
286
286
|
case 'beforeEnd':
|
|
287
|
-
return this.insertBeforeEnd(schema, options);
|
|
287
|
+
return await this.insertBeforeEnd(schema, options);
|
|
288
288
|
case 'afterEnd':
|
|
289
|
-
return this.insertAfterEnd(schema, options);
|
|
289
|
+
return await this.insertAfterEnd(schema, options);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
recursiveRemoveIfNoChildren(schema, options) {
|
|
@@ -305,7 +305,7 @@ class Designable {
|
|
|
305
305
|
}
|
|
306
306
|
return removed;
|
|
307
307
|
}
|
|
308
|
-
remove(schema) {
|
|
308
|
+
async remove(schema) {
|
|
309
309
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
310
310
|
const { breakRemoveOn, removeParentsIfNoChildren } = options;
|
|
311
311
|
const s = schema || this.current;
|
|
@@ -316,7 +316,7 @@ class Designable {
|
|
|
316
316
|
});
|
|
317
317
|
if (parent) removed = parent;
|
|
318
318
|
}
|
|
319
|
-
return this.emit('remove', {
|
|
319
|
+
return await this.emit('remove', {
|
|
320
320
|
removed
|
|
321
321
|
});
|
|
322
322
|
}
|
|
@@ -333,7 +333,7 @@ class Designable {
|
|
|
333
333
|
}
|
|
334
334
|
return removed;
|
|
335
335
|
}
|
|
336
|
-
insertBeforeBeginOrAfterEnd(schema) {
|
|
336
|
+
async insertBeforeBeginOrAfterEnd(schema) {
|
|
337
337
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
338
338
|
if (!Schema.isSchemaInstance(this.current)) return;
|
|
339
339
|
if (!Schema.isSchemaInstance(schema)) return;
|
|
@@ -344,9 +344,9 @@ class Designable {
|
|
|
344
344
|
if (this.current.name === key) toIndex = index;
|
|
345
345
|
if (schema.name === key) fromIndex = index;
|
|
346
346
|
});
|
|
347
|
-
return fromIndex > toIndex ? this.insertBeforeBegin(schema, options) : this.insertAfterEnd(schema, options);
|
|
347
|
+
return fromIndex > toIndex ? await this.insertBeforeBegin(schema, options) : await this.insertAfterEnd(schema, options);
|
|
348
348
|
}
|
|
349
|
-
insertBeforeBegin(schema) {
|
|
349
|
+
async insertBeforeBegin(schema) {
|
|
350
350
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
351
351
|
if (!Schema.isSchemaInstance(this.current)) return;
|
|
352
352
|
const opts = {
|
|
@@ -387,7 +387,7 @@ class Designable {
|
|
|
387
387
|
s.parent = this.current.parent;
|
|
388
388
|
this.current.parent.setProperties(properties);
|
|
389
389
|
const [schema1, schema2] = splitWrapSchema(s, schema);
|
|
390
|
-
this.emit('insertAdjacent', {
|
|
390
|
+
await this.emit('insertAdjacent', {
|
|
391
391
|
position: 'beforeBegin',
|
|
392
392
|
schema: schema2,
|
|
393
393
|
wrapped,
|
|
@@ -395,7 +395,7 @@ class Designable {
|
|
|
395
395
|
...opts
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
|
-
insertAfterBegin(schema) {
|
|
398
|
+
async insertAfterBegin(schema) {
|
|
399
399
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
400
400
|
if (!Schema.isSchemaInstance(this.current)) return;
|
|
401
401
|
const opts = {
|
|
@@ -427,7 +427,7 @@ class Designable {
|
|
|
427
427
|
s.parent = this.current;
|
|
428
428
|
this.current.setProperties(properties);
|
|
429
429
|
const [schema1, schema2] = splitWrapSchema(s, schema);
|
|
430
|
-
this.emit('insertAdjacent', {
|
|
430
|
+
await this.emit('insertAdjacent', {
|
|
431
431
|
position: 'afterBegin',
|
|
432
432
|
schema: schema2,
|
|
433
433
|
wrap: schema1,
|
|
@@ -435,7 +435,7 @@ class Designable {
|
|
|
435
435
|
...opts
|
|
436
436
|
});
|
|
437
437
|
}
|
|
438
|
-
insertBeforeEnd(schema) {
|
|
438
|
+
async insertBeforeEnd(schema) {
|
|
439
439
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
440
440
|
if (!Schema.isSchemaInstance(this.current)) return;
|
|
441
441
|
delete schema['x-index'];
|
|
@@ -444,7 +444,7 @@ class Designable {
|
|
|
444
444
|
};
|
|
445
445
|
const { wrap = defaultWrap, breakRemoveOn, removeParentsIfNoChildren } = options;
|
|
446
446
|
if (Schema.isSchemaInstance(schema)) {
|
|
447
|
-
if (this.parentsIn(schema)) return void this.emit('error', {
|
|
447
|
+
if (this.parentsIn(schema)) return void await this.emit('error', {
|
|
448
448
|
code: 'parent_is_not_allowed',
|
|
449
449
|
schema
|
|
450
450
|
});
|
|
@@ -458,7 +458,7 @@ class Designable {
|
|
|
458
458
|
const s = this.current.addProperty(wrapped.name || uid(), wrapped);
|
|
459
459
|
s.parent = this.current;
|
|
460
460
|
const [schema1, schema2] = splitWrapSchema(s, schema);
|
|
461
|
-
return this.emit('insertAdjacent', {
|
|
461
|
+
return await this.emit('insertAdjacent', {
|
|
462
462
|
position: 'beforeEnd',
|
|
463
463
|
schema: schema2,
|
|
464
464
|
wrap: schema1,
|
|
@@ -466,7 +466,7 @@ class Designable {
|
|
|
466
466
|
...opts
|
|
467
467
|
});
|
|
468
468
|
}
|
|
469
|
-
insertAfterEnd(schema) {
|
|
469
|
+
async insertAfterEnd(schema) {
|
|
470
470
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
471
471
|
if (!Schema.isSchemaInstance(this.current)) return;
|
|
472
472
|
const opts = {
|
|
@@ -508,7 +508,7 @@ class Designable {
|
|
|
508
508
|
s['x-index'] = newOrder;
|
|
509
509
|
this.current.parent.setProperties(properties);
|
|
510
510
|
const [schema1, schema2] = splitWrapSchema(s, schema);
|
|
511
|
-
this.emit('insertAdjacent', {
|
|
511
|
+
await this.emit('insertAdjacent', {
|
|
512
512
|
position: 'afterEnd',
|
|
513
513
|
schema: schema2,
|
|
514
514
|
wrap: schema1,
|
package/es/user/CurrentUser.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useCallback, useMemo, useState } from "react";
|
|
3
|
-
import { UserOutlined } from "@ant-design/icons";
|
|
4
3
|
import { error } from "@tego/client";
|
|
4
|
+
import { UserOutlined } from "@ant-design/icons";
|
|
5
5
|
import { App, Dropdown, Menu } from "antd";
|
|
6
6
|
import { createStyles } from "antd-style";
|
|
7
7
|
import { useTranslation } from "react-i18next";
|
|
@@ -157,8 +157,16 @@ const SettingsMenu = (props)=>{
|
|
|
157
157
|
key: 'signout',
|
|
158
158
|
label: t('Sign out'),
|
|
159
159
|
onClick: async ()=>{
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
try {
|
|
161
|
+
var _loginMethods_data;
|
|
162
|
+
const loginMethods = await api.resource('authenticators').publicList();
|
|
163
|
+
const methods = (null == loginMethods ? void 0 : null == (_loginMethods_data = loginMethods.data) ? void 0 : _loginMethods_data.data) || [];
|
|
164
|
+
await api.auth.signOut();
|
|
165
|
+
if (1 === methods.length && 'mainApp' === methods[0].authType) window.location.href = '/';
|
|
166
|
+
else navigate("/signin?redirect=".concat(encodeURIComponent(redirectUrl)));
|
|
167
|
+
} catch (err) {
|
|
168
|
+
console.error('Sign out error:', err);
|
|
169
|
+
}
|
|
162
170
|
}
|
|
163
171
|
}
|
|
164
172
|
];
|
|
@@ -39,6 +39,7 @@ const external_react_namespaceObject = require("react");
|
|
|
39
39
|
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
40
40
|
const client_namespaceObject = require("@tego/client");
|
|
41
41
|
const external_antd_namespaceObject = require("antd");
|
|
42
|
+
const external_index_js_namespaceObject = require("../index.js");
|
|
42
43
|
function _define_property(obj, key, value) {
|
|
43
44
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
44
45
|
value: value,
|
|
@@ -49,13 +50,29 @@ function _define_property(obj, key, value) {
|
|
|
49
50
|
else obj[key] = value;
|
|
50
51
|
return obj;
|
|
51
52
|
}
|
|
53
|
+
const TECH_PATTERNS = [
|
|
54
|
+
/\bat\s+\S+\s+\(.+\)/i,
|
|
55
|
+
/(TypeError|ReferenceError|SyntaxError|RangeError)\b/i,
|
|
56
|
+
/(ENOENT|ECONNREFUSED|ECONNRESET|EPIPE|EAI_AGAIN)\b/i,
|
|
57
|
+
/(node_modules|webpack|react(-dom)?\.development\.js)/i,
|
|
58
|
+
/[/\\]\w+\.(js|ts|tsx|jsx):\d+:\d+/i,
|
|
59
|
+
/https?:\/\/\S+/i
|
|
60
|
+
];
|
|
52
61
|
function notify(type, messages, instance) {
|
|
53
|
-
var _messages_map;
|
|
54
62
|
if (!(null == messages ? void 0 : messages.length)) return;
|
|
63
|
+
const translatedMessages = messages.map((item)=>{
|
|
64
|
+
const msg = 'string' == typeof item ? item : item.message;
|
|
65
|
+
const translated = external_index_js_namespaceObject.i18n.t(msg);
|
|
66
|
+
if (TECH_PATTERNS.some((r)=>r.test(msg))) {
|
|
67
|
+
console.error('[TechError]', msg);
|
|
68
|
+
return external_index_js_namespaceObject.i18n.t('The current operation was not successful. You can wait a moment or contact technical support.');
|
|
69
|
+
}
|
|
70
|
+
return translated;
|
|
71
|
+
});
|
|
55
72
|
instance[type]({
|
|
56
|
-
message:
|
|
57
|
-
key: "".concat(index, "_").concat(
|
|
58
|
-
},
|
|
73
|
+
message: translatedMessages.map((msg, index)=>external_react_default().createElement('div', {
|
|
74
|
+
key: "".concat(index, "_").concat(msg)
|
|
75
|
+
}, msg))
|
|
59
76
|
});
|
|
60
77
|
}
|
|
61
78
|
const handleErrorMessage = (error, notification)=>{
|
|
@@ -74,7 +74,9 @@ const AppComponent = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
74
74
|
app.renderComponent('AppMain')
|
|
75
75
|
]
|
|
76
76
|
}),
|
|
77
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_click_to_react_component_namespaceObject.ClickToComponent, {
|
|
77
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_click_to_react_component_namespaceObject.ClickToComponent, {
|
|
78
|
+
editor: process.env.REACT_APP_CLICK_TO_COMPONENT_EDITOR || 'vscode'
|
|
79
|
+
})
|
|
78
80
|
]
|
|
79
81
|
});
|
|
80
82
|
}, {
|
|
@@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
38
|
const external_react_namespaceObject = require("react");
|
|
39
39
|
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
40
40
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
41
|
+
const client_namespaceObject = require("@tego/client");
|
|
41
42
|
const cssinjs_namespaceObject = require("@ant-design/cssinjs");
|
|
42
43
|
const icons_namespaceObject = require("@ant-design/icons");
|
|
43
44
|
const accessibility_namespaceObject = require("@dnd-kit/accessibility");
|
|
@@ -47,7 +48,6 @@ const sortable_namespaceObject = require("@dnd-kit/sortable");
|
|
|
47
48
|
const utilities_namespaceObject = require("@dnd-kit/utilities");
|
|
48
49
|
const css_namespaceObject = require("@emotion/css");
|
|
49
50
|
const react_namespaceObject = require("@floating-ui/react");
|
|
50
|
-
const client_namespaceObject = require("@tego/client");
|
|
51
51
|
const external_ahooks_namespaceObject = require("ahooks");
|
|
52
52
|
const external_antd_namespaceObject = require("antd");
|
|
53
53
|
const external_antd_style_namespaceObject = require("antd-style");
|
|
@@ -81,6 +81,7 @@ function defineGlobalDeps(requirejs) {
|
|
|
81
81
|
requirejs.define('@tego/client', ()=>client_namespaceObject);
|
|
82
82
|
requirejs.define('@tachybase/client', ()=>external_index_js_namespaceObject);
|
|
83
83
|
requirejs.define('@tachybase/schema', ()=>schema_namespaceObject);
|
|
84
|
+
requirejs.define('@tachybase/utils/client', ()=>client_namespaceObject);
|
|
84
85
|
requirejs.define('@dnd-kit/accessibility', ()=>accessibility_namespaceObject);
|
|
85
86
|
requirejs.define('@dnd-kit/core', ()=>core_namespaceObject);
|
|
86
87
|
requirejs.define('@dnd-kit/modifiers', ()=>modifiers_namespaceObject);
|
|
@@ -15,7 +15,7 @@ var __webpack_modules__ = {
|
|
|
15
15
|
"../../filter-provider/utils": function(module) {
|
|
16
16
|
module.exports = require("../../filter-provider/utils.js");
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"../..": function(module) {
|
|
19
19
|
module.exports = require("../../index.js");
|
|
20
20
|
},
|
|
21
21
|
"../../record-provider": function(module) {
|
|
@@ -182,7 +182,7 @@ var __webpack_exports__ = {};
|
|
|
182
182
|
var react_i18next__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("react-i18next");
|
|
183
183
|
var react_router_dom__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("react-router-dom");
|
|
184
184
|
var react_to_print__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("react-to-print");
|
|
185
|
-
var ___WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("
|
|
185
|
+
var ___WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("../..");
|
|
186
186
|
var _api_client__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("../../api-client");
|
|
187
187
|
var _built_in_dynamic_page_utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("../../built-in/dynamic-page/utils");
|
|
188
188
|
var _collection_manager__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("../../collection-manager");
|
|
@@ -212,7 +212,9 @@ const ACLCollectionProvider = (props)=>{
|
|
|
212
212
|
const [_, actionName] = actionPath.split(':');
|
|
213
213
|
params.actionName = actionName;
|
|
214
214
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ACLActionParamsContext.Provider, {
|
|
215
|
-
value:
|
|
215
|
+
value: {
|
|
216
|
+
params
|
|
217
|
+
},
|
|
216
218
|
children: props.children
|
|
217
219
|
});
|
|
218
220
|
};
|
package/lib/built-in/index.js
CHANGED
|
@@ -184,10 +184,10 @@ var __webpack_exports__ = {};
|
|
|
184
184
|
});
|
|
185
185
|
var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react/jsx-runtime");
|
|
186
186
|
var _tachybase_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@tachybase/schema");
|
|
187
|
-
var
|
|
188
|
-
var
|
|
189
|
-
var
|
|
190
|
-
var
|
|
187
|
+
var _tego_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@tego/client");
|
|
188
|
+
var _ant_design_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("@ant-design/icons");
|
|
189
|
+
var _emotion_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("@emotion/css");
|
|
190
|
+
var _lottiefiles_dotlottie_react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("@lottiefiles/dotlottie-react");
|
|
191
191
|
var antd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("antd");
|
|
192
192
|
var antd_style__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("antd-style");
|
|
193
193
|
var react_i18next__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("react-i18next");
|
|
@@ -280,8 +280,8 @@ var __webpack_exports__ = {};
|
|
|
280
280
|
return data;
|
|
281
281
|
}
|
|
282
282
|
const AppSpin = ()=>/*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
|
|
283
|
-
className: (0,
|
|
284
|
-
children: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(
|
|
283
|
+
className: (0, _emotion_css__WEBPACK_IMPORTED_MODULE_4__.css)(_templateObject()),
|
|
284
|
+
children: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_lottiefiles_dotlottie_react__WEBPACK_IMPORTED_MODULE_5__.DotLottieReact, {
|
|
285
285
|
style: {
|
|
286
286
|
width: '100%',
|
|
287
287
|
maxWidth: '640px'
|
|
@@ -302,7 +302,7 @@ var __webpack_exports__ = {};
|
|
|
302
302
|
const api = (0, _api_client__WEBPACK_IMPORTED_MODULE_10__.useAPIClient)();
|
|
303
303
|
if (!error) return {};
|
|
304
304
|
const err = (null == error ? void 0 : null == (_error_response = error.response) ? void 0 : null == (_error_response_data = _error_response.data) ? void 0 : null == (_error_response_data_errors = _error_response_data.errors) ? void 0 : _error_response_data_errors[0]) || error;
|
|
305
|
-
const subApp = (0,
|
|
305
|
+
const subApp = (0, _tego_client__WEBPACK_IMPORTED_MODULE_2__.getSubAppName)(app.getPublicPath());
|
|
306
306
|
switch(err.code){
|
|
307
307
|
case 'USER_HAS_NO_ROLES_ERR':
|
|
308
308
|
return {
|
|
@@ -353,7 +353,7 @@ var __webpack_exports__ = {};
|
|
|
353
353
|
const getProps = (app)=>{
|
|
354
354
|
if (app.ws.serverDown) return {
|
|
355
355
|
status: 'error',
|
|
356
|
-
icon: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(
|
|
356
|
+
icon: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_3__.DisconnectOutlined, {}),
|
|
357
357
|
title: "You're offline",
|
|
358
358
|
subTitle: 'Please check the server status or network connection status'
|
|
359
359
|
};
|
|
@@ -370,7 +370,7 @@ var __webpack_exports__ = {};
|
|
|
370
370
|
var _app_error1;
|
|
371
371
|
return {
|
|
372
372
|
status: 'info',
|
|
373
|
-
icon: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(
|
|
373
|
+
icon: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_3__.LoadingOutlined, {}),
|
|
374
374
|
title: 'App initializing',
|
|
375
375
|
subTitle: null == (_app_error1 = app.error) ? void 0 : _app_error1.message
|
|
376
376
|
};
|
|
@@ -411,7 +411,7 @@ var __webpack_exports__ = {};
|
|
|
411
411
|
var _app_error_command, _app_error6, _app_error7, _app_error_command1, _app_error8;
|
|
412
412
|
const props = {
|
|
413
413
|
status: 'info',
|
|
414
|
-
icon: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(
|
|
414
|
+
icon: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_3__.LoadingOutlined, {}),
|
|
415
415
|
title: null == (_app_error6 = app.error) ? void 0 : null == (_app_error_command = _app_error6.command) ? void 0 : _app_error_command.name,
|
|
416
416
|
subTitle: null == (_app_error7 = app.error) ? void 0 : _app_error7.message
|
|
417
417
|
};
|
|
@@ -523,7 +523,7 @@ var __webpack_exports__ = {};
|
|
|
523
523
|
sort: -40
|
|
524
524
|
});
|
|
525
525
|
this.app.systemSettingsManager.add('business-components', {
|
|
526
|
-
title: this.t('Business
|
|
526
|
+
title: this.t('Business Features'),
|
|
527
527
|
icon: 'BlockOutlined',
|
|
528
528
|
sort: -30
|
|
529
529
|
});
|