@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { APIClient } from "@tego/client";
|
|
3
3
|
import { notification as external_antd_notification } from "antd";
|
|
4
|
+
import { i18n } from "../index.mjs";
|
|
4
5
|
function _define_property(obj, key, value) {
|
|
5
6
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
6
7
|
value: value,
|
|
@@ -11,13 +12,29 @@ function _define_property(obj, key, value) {
|
|
|
11
12
|
else obj[key] = value;
|
|
12
13
|
return obj;
|
|
13
14
|
}
|
|
15
|
+
const TECH_PATTERNS = [
|
|
16
|
+
/\bat\s+\S+\s+\(.+\)/i,
|
|
17
|
+
/(TypeError|ReferenceError|SyntaxError|RangeError)\b/i,
|
|
18
|
+
/(ENOENT|ECONNREFUSED|ECONNRESET|EPIPE|EAI_AGAIN)\b/i,
|
|
19
|
+
/(node_modules|webpack|react(-dom)?\.development\.js)/i,
|
|
20
|
+
/[/\\]\w+\.(js|ts|tsx|jsx):\d+:\d+/i,
|
|
21
|
+
/https?:\/\/\S+/i
|
|
22
|
+
];
|
|
14
23
|
function notify(type, messages, instance) {
|
|
15
|
-
var _messages_map;
|
|
16
24
|
if (!(null == messages ? void 0 : messages.length)) return;
|
|
25
|
+
const translatedMessages = messages.map((item)=>{
|
|
26
|
+
const msg = 'string' == typeof item ? item : item.message;
|
|
27
|
+
const translated = i18n.t(msg);
|
|
28
|
+
if (TECH_PATTERNS.some((r)=>r.test(msg))) {
|
|
29
|
+
console.error('[TechError]', msg);
|
|
30
|
+
return i18n.t('The current operation was not successful. You can wait a moment or contact technical support.');
|
|
31
|
+
}
|
|
32
|
+
return translated;
|
|
33
|
+
});
|
|
17
34
|
instance[type]({
|
|
18
|
-
message:
|
|
19
|
-
key: "".concat(index, "_").concat(
|
|
20
|
-
},
|
|
35
|
+
message: translatedMessages.map((msg, index)=>react.createElement('div', {
|
|
36
|
+
key: "".concat(index, "_").concat(msg)
|
|
37
|
+
}, msg))
|
|
21
38
|
});
|
|
22
39
|
}
|
|
23
40
|
const handleErrorMessage = (error, notification)=>{
|
|
@@ -46,7 +46,9 @@ const AppComponent = observer((props)=>{
|
|
|
46
46
|
app.renderComponent('AppMain')
|
|
47
47
|
]
|
|
48
48
|
}),
|
|
49
|
-
/*#__PURE__*/ jsx(ClickToComponent, {
|
|
49
|
+
/*#__PURE__*/ jsx(ClickToComponent, {
|
|
50
|
+
editor: process.env.REACT_APP_CLICK_TO_COMPONENT_EDITOR || 'vscode'
|
|
51
|
+
})
|
|
50
52
|
]
|
|
51
53
|
});
|
|
52
54
|
}, {
|
|
@@ -38,6 +38,7 @@ function defineGlobalDeps(requirejs) {
|
|
|
38
38
|
requirejs.define('@tego/client', ()=>__WEBPACK_EXTERNAL_MODULE__tego_client_7f3175c1__);
|
|
39
39
|
requirejs.define('@tachybase/client', ()=>__WEBPACK_EXTERNAL_MODULE__index_mjs_52ce5380__);
|
|
40
40
|
requirejs.define('@tachybase/schema', ()=>__WEBPACK_EXTERNAL_MODULE__tachybase_schema_532e17e1__);
|
|
41
|
+
requirejs.define('@tachybase/utils/client', ()=>__WEBPACK_EXTERNAL_MODULE__tego_client_7f3175c1__);
|
|
41
42
|
requirejs.define('@dnd-kit/accessibility', ()=>__WEBPACK_EXTERNAL_MODULE__dnd_kit_accessibility_682092eb__);
|
|
42
43
|
requirejs.define('@dnd-kit/core', ()=>__WEBPACK_EXTERNAL_MODULE__dnd_kit_core_a545325d__);
|
|
43
44
|
requirejs.define('@dnd-kit/modifiers', ()=>__WEBPACK_EXTERNAL_MODULE__dnd_kit_modifiers_69ce91a8__);
|
|
@@ -170,7 +170,9 @@ const ACLCollectionProvider = (props)=>{
|
|
|
170
170
|
const [_, actionName] = actionPath.split(':');
|
|
171
171
|
params.actionName = actionName;
|
|
172
172
|
return /*#__PURE__*/ jsx(ACLActionParamsContext.Provider, {
|
|
173
|
-
value:
|
|
173
|
+
value: {
|
|
174
|
+
params
|
|
175
|
+
},
|
|
174
176
|
children: props.children
|
|
175
177
|
});
|
|
176
178
|
};
|
package/es/built-in/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { observer } from "@tachybase/schema";
|
|
3
|
+
import { getSubAppName } from "@tego/client";
|
|
3
4
|
import { DisconnectOutlined, LoadingOutlined } from "@ant-design/icons";
|
|
4
5
|
import { css as css_css } from "@emotion/css";
|
|
5
6
|
import { DotLottieReact } from "@lottiefiles/dotlottie-react";
|
|
6
|
-
import { getSubAppName } from "@tego/client";
|
|
7
7
|
import { Button, Result } from "antd";
|
|
8
8
|
import { createStyles } from "antd-style";
|
|
9
9
|
import { useTranslation } from "react-i18next";
|
|
@@ -311,7 +311,7 @@ class BuiltInPlugin extends Plugin {
|
|
|
311
311
|
sort: -40
|
|
312
312
|
});
|
|
313
313
|
this.app.systemSettingsManager.add('business-components', {
|
|
314
|
-
title: this.t('Business
|
|
314
|
+
title: this.t('Business Features'),
|
|
315
315
|
icon: 'BlockOutlined',
|
|
316
316
|
sort: -30
|
|
317
317
|
});
|
|
@@ -49,6 +49,16 @@ const LocalPlugins = ()=>{
|
|
|
49
49
|
const [enabled, setEnabled] = useState('all');
|
|
50
50
|
const [keywords, setKeywords] = useState([]);
|
|
51
51
|
const columns = useMemo(()=>[
|
|
52
|
+
{
|
|
53
|
+
title: t('Index'),
|
|
54
|
+
dataIndex: 'index',
|
|
55
|
+
key: 'index',
|
|
56
|
+
render: (_, __, index)=>/*#__PURE__*/ jsx("span", {
|
|
57
|
+
children: index + 1
|
|
58
|
+
}),
|
|
59
|
+
width: 80,
|
|
60
|
+
align: 'center'
|
|
61
|
+
},
|
|
52
62
|
{
|
|
53
63
|
title: t('Name'),
|
|
54
64
|
dataIndex: 'name',
|
|
@@ -60,6 +70,28 @@ const LocalPlugins = ()=>{
|
|
|
60
70
|
});
|
|
61
71
|
}
|
|
62
72
|
},
|
|
73
|
+
{
|
|
74
|
+
title: t('PackageName'),
|
|
75
|
+
dataIndex: 'packageName',
|
|
76
|
+
key: 'packageName',
|
|
77
|
+
render: (_, param)=>{
|
|
78
|
+
let { packageName } = param;
|
|
79
|
+
return /*#__PURE__*/ jsx("span", {
|
|
80
|
+
children: packageName
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
title: t('Version'),
|
|
86
|
+
dataIndex: 'version',
|
|
87
|
+
key: 'version',
|
|
88
|
+
render: (_, param)=>{
|
|
89
|
+
let { version } = param;
|
|
90
|
+
return /*#__PURE__*/ jsx("span", {
|
|
91
|
+
children: version
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
63
95
|
{
|
|
64
96
|
title: t('Keywords'),
|
|
65
97
|
dataIndex: 'keywords',
|
|
@@ -93,13 +125,21 @@ const LocalPlugins = ()=>{
|
|
|
93
125
|
})
|
|
94
126
|
}
|
|
95
127
|
], []);
|
|
96
|
-
const filteredList = ((null == data ? void 0 : data.data) || []).filter((data)=>{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
128
|
+
const filteredList = useMemo(()=>((null == data ? void 0 : data.data) || []).filter((data)=>{
|
|
129
|
+
var _data_description;
|
|
130
|
+
return fuzzysearch(searchValue, data.name) || fuzzysearch(searchValue, data.packageName) || fuzzysearch(searchValue, null != (_data_description = data.description) ? _data_description : '') || fuzzysearch(searchValue, data.displayName);
|
|
131
|
+
}).filter((data)=>'all' === enabled || 'enabled' === enabled && data.enabled || 'disabled' === enabled && !data.enabled).filter((data)=>0 === keywords.length || keywords.some((keyword)=>{
|
|
132
|
+
var _data_keywords;
|
|
133
|
+
return null == (_data_keywords = data.keywords) ? void 0 : _data_keywords.includes(keyword);
|
|
134
|
+
})).sort((a, b)=>{
|
|
135
|
+
if (a.builtIn === b.builtIn) return a.id - b.id;
|
|
136
|
+
return a.builtIn ? -1 : 1;
|
|
137
|
+
}), [
|
|
138
|
+
null == data ? void 0 : data.data,
|
|
139
|
+
enabled,
|
|
140
|
+
keywords,
|
|
141
|
+
searchValue
|
|
142
|
+
]);
|
|
103
143
|
const filterList = useMemo(()=>{
|
|
104
144
|
let list = (null == data ? void 0 : data.data) || [];
|
|
105
145
|
list = list.reverse();
|
|
@@ -226,7 +266,7 @@ const LocalPlugins = ()=>{
|
|
|
226
266
|
children: /*#__PURE__*/ jsx(Select, {
|
|
227
267
|
mode: "multiple",
|
|
228
268
|
style: {
|
|
229
|
-
minWidth: '
|
|
269
|
+
minWidth: '10em'
|
|
230
270
|
},
|
|
231
271
|
allowClear: true,
|
|
232
272
|
value: keywords,
|
|
@@ -241,6 +281,9 @@ const LocalPlugins = ()=>{
|
|
|
241
281
|
/*#__PURE__*/ jsx(Form.Item, {
|
|
242
282
|
label: t('Search'),
|
|
243
283
|
children: /*#__PURE__*/ jsx(Input, {
|
|
284
|
+
style: {
|
|
285
|
+
minWidth: '20em'
|
|
286
|
+
},
|
|
244
287
|
value: searchValue,
|
|
245
288
|
placeholder: t("Name or descriptions"),
|
|
246
289
|
onChange: (e)=>setSearchValue(e.target.value)
|
|
@@ -3,14 +3,55 @@ import { useEffect } from "react";
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import { useCurrentAppInfo } from "../../common/appInfo/CurrentAppInfoProvider.mjs";
|
|
5
5
|
import { useCurrentUserSettingsMenu } from "../../user/CurrentUserSettingsMenuProvider.mjs";
|
|
6
|
-
const
|
|
6
|
+
const CORE_REPO_URL = 'https://github.com/tegojs/tego';
|
|
7
|
+
const APP_REPO_URL = 'https://github.com/tegojs/tego-standard';
|
|
8
|
+
function getVersionUrl(version, repoUrl) {
|
|
9
|
+
if (!version) return null;
|
|
10
|
+
const hashMatch = version.match(/^\d+\.\d+\.\d+-([0-9a-f]{7})(?:@.+)?$/i);
|
|
11
|
+
if (hashMatch) {
|
|
12
|
+
const hash = hashMatch[1];
|
|
13
|
+
return "".concat(repoUrl, "/commit/").concat(hash);
|
|
14
|
+
}
|
|
15
|
+
{
|
|
16
|
+
const tag = version.startsWith('v') ? version : "v".concat(version);
|
|
17
|
+
return "".concat(repoUrl, "/releases/tag/").concat(tag);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const CoreVersion = ()=>{
|
|
21
|
+
var _info_data_version, _info_data;
|
|
7
22
|
const info = useCurrentAppInfo();
|
|
8
23
|
const { t } = useTranslation();
|
|
24
|
+
const version = null == info ? void 0 : null == (_info_data = info.data) ? void 0 : null == (_info_data_version = _info_data.version) ? void 0 : _info_data_version.core;
|
|
25
|
+
const url = getVersionUrl(version, CORE_REPO_URL);
|
|
26
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
27
|
+
children: [
|
|
28
|
+
t('Core Version'),
|
|
29
|
+
" -",
|
|
30
|
+
' ',
|
|
31
|
+
url ? /*#__PURE__*/ jsx("a", {
|
|
32
|
+
href: url,
|
|
33
|
+
target: "_blank",
|
|
34
|
+
children: version
|
|
35
|
+
}) : version
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const AppVersion = ()=>{
|
|
40
|
+
var _info_data_version, _info_data;
|
|
41
|
+
const info = useCurrentAppInfo();
|
|
42
|
+
const { t } = useTranslation();
|
|
43
|
+
const version = null == info ? void 0 : null == (_info_data = info.data) ? void 0 : null == (_info_data_version = _info_data.version) ? void 0 : _info_data_version.app;
|
|
44
|
+
const url = getVersionUrl(version, APP_REPO_URL);
|
|
9
45
|
return /*#__PURE__*/ jsxs("span", {
|
|
10
46
|
children: [
|
|
11
47
|
t('App Version'),
|
|
12
|
-
" -
|
|
13
|
-
|
|
48
|
+
" -",
|
|
49
|
+
' ',
|
|
50
|
+
url ? /*#__PURE__*/ jsx("a", {
|
|
51
|
+
href: url,
|
|
52
|
+
target: "_blank",
|
|
53
|
+
children: version
|
|
54
|
+
}) : version
|
|
14
55
|
]
|
|
15
56
|
});
|
|
16
57
|
};
|
|
@@ -19,8 +60,14 @@ const SystemVersionProvider = (param)=>{
|
|
|
19
60
|
const { addMenuItem } = useCurrentUserSettingsMenu();
|
|
20
61
|
useEffect(()=>{
|
|
21
62
|
addMenuItem({
|
|
22
|
-
key: 'system-version',
|
|
23
|
-
label: /*#__PURE__*/ jsx(
|
|
63
|
+
key: 'system-version-app',
|
|
64
|
+
label: /*#__PURE__*/ jsx(AppVersion, {})
|
|
65
|
+
}, {
|
|
66
|
+
before: 'divider_1'
|
|
67
|
+
});
|
|
68
|
+
addMenuItem({
|
|
69
|
+
key: 'system-version-core',
|
|
70
|
+
label: /*#__PURE__*/ jsx(CoreVersion, {})
|
|
24
71
|
}, {
|
|
25
72
|
before: 'divider_1'
|
|
26
73
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useMemo, useState } from "react";
|
|
3
3
|
import { uid, useField, useForm } from "@tachybase/schema";
|
|
4
|
-
import { PlusOutlined } from "@ant-design/icons";
|
|
5
4
|
import { ArrayTable } from "@tego/client";
|
|
5
|
+
import { PlusOutlined } from "@ant-design/icons";
|
|
6
6
|
import { Button, Dropdown } from "antd";
|
|
7
7
|
import { cloneDeep } from "lodash";
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
@@ -325,7 +325,6 @@ const xlsxFieldsConfigure = observer((props)=>{
|
|
|
325
325
|
useEffect(()=>{
|
|
326
326
|
form.setValuesIn('fields', formValue);
|
|
327
327
|
form.setValuesIn('collectionData', filedata.data);
|
|
328
|
-
console.log("%c Line:294 \uD83C\uDF54 filedata.data", 'font-size:18px;color:#42b983;background:#3f7cff', filedata.data);
|
|
329
328
|
}, [
|
|
330
329
|
formValue
|
|
331
330
|
]);
|
|
@@ -6,7 +6,10 @@ export declare const useCurrentAppInfo: () => {
|
|
|
6
6
|
dialect: string;
|
|
7
7
|
};
|
|
8
8
|
lang: string;
|
|
9
|
-
version:
|
|
9
|
+
version: {
|
|
10
|
+
core: string;
|
|
11
|
+
app: string;
|
|
12
|
+
};
|
|
10
13
|
};
|
|
11
14
|
};
|
|
12
15
|
export declare const CurrentAppInfoProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -133,7 +133,8 @@ const useTableBlockProps = ()=>{
|
|
|
133
133
|
const prevFlatItems = flat(prevMergedFilter);
|
|
134
134
|
Object.entries(prevFlatItems).forEach((param)=>{
|
|
135
135
|
let [key, prevItem] = param;
|
|
136
|
-
if (key.split('.').includes(target.field)) delete prevFlatItems[key];
|
|
136
|
+
if (key.split('.').includes(target.field) || key.includes(target.field)) delete prevFlatItems[key];
|
|
137
|
+
if (!prevFlatItems[key]) delete prevFlatItems[key];
|
|
137
138
|
});
|
|
138
139
|
prevMergedFilter = flat.unflatten(prevFlatItems);
|
|
139
140
|
}
|
|
@@ -115,4 +115,13 @@ export declare const clickToSelect: {
|
|
|
115
115
|
}) => Promise<void>;
|
|
116
116
|
};
|
|
117
117
|
};
|
|
118
|
+
export declare const tablePagination: {
|
|
119
|
+
name: string;
|
|
120
|
+
type: string;
|
|
121
|
+
useComponentProps(): {
|
|
122
|
+
title: string;
|
|
123
|
+
checked: any;
|
|
124
|
+
onChange(v: any): void;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
118
127
|
export declare const subTablePopoverComponentFieldSettings: SchemaSettings<{}>;
|
|
@@ -395,6 +395,38 @@ const clickToSelect = {
|
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
397
|
};
|
|
398
|
+
const tablePagination = {
|
|
399
|
+
name: 'tablePagination',
|
|
400
|
+
type: 'switch',
|
|
401
|
+
useComponentProps () {
|
|
402
|
+
var _fieldSchema_xcomponentprops;
|
|
403
|
+
const { dn } = useDesignable();
|
|
404
|
+
const fieldSchema = useFieldSchema();
|
|
405
|
+
const { t } = useTranslation();
|
|
406
|
+
const field = useField();
|
|
407
|
+
return {
|
|
408
|
+
title: t('Pagination'),
|
|
409
|
+
checked: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.pagination) || false,
|
|
410
|
+
onChange (v) {
|
|
411
|
+
if (!fieldSchema['x-component-props'].pagination) fieldSchema['x-component-props'] = {
|
|
412
|
+
...fieldSchema['x-component-props'],
|
|
413
|
+
pagination: false
|
|
414
|
+
};
|
|
415
|
+
fieldSchema['x-component-props'].pagination = v;
|
|
416
|
+
field.componentProps['pagination'] = v;
|
|
417
|
+
dn.emit('patch', {
|
|
418
|
+
schema: {
|
|
419
|
+
'x-uid': fieldSchema['x-uid'],
|
|
420
|
+
'x-component-props': {
|
|
421
|
+
...null == fieldSchema ? void 0 : fieldSchema['x-component-props']
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
dn.refresh();
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
};
|
|
398
430
|
const subTablePopoverComponentFieldSettings = new SchemaSettings({
|
|
399
431
|
name: 'fieldSettings:component:SubTable',
|
|
400
432
|
items: [
|
|
@@ -402,7 +434,8 @@ const subTablePopoverComponentFieldSettings = new SchemaSettings({
|
|
|
402
434
|
allowAddNewData,
|
|
403
435
|
allowSelectExistingRecord,
|
|
404
436
|
setDefaultSortingRules,
|
|
405
|
-
clickToSelect
|
|
437
|
+
clickToSelect,
|
|
438
|
+
tablePagination
|
|
406
439
|
]
|
|
407
440
|
});
|
|
408
|
-
export { allowAddNewData, clickToSelect, setDefaultSortingRules, subTablePopoverComponentFieldSettings };
|
|
441
|
+
export { allowAddNewData, clickToSelect, setDefaultSortingRules, subTablePopoverComponentFieldSettings, tablePagination };
|
|
@@ -47,14 +47,14 @@ const ActionAreaPlayer = (param)=>{
|
|
|
47
47
|
return visible && ref.current ? /*#__PURE__*/ createPortal(children, ref.current) : null;
|
|
48
48
|
};
|
|
49
49
|
const ActionArea = observer((props)=>{
|
|
50
|
-
const { footerNodeName = 'ActionArea.Footer' } = props;
|
|
50
|
+
const { footerNodeName = 'ActionArea.Footer', stickyFooter = false } = props;
|
|
51
51
|
const schema = useFieldSchema();
|
|
52
52
|
const field = useField();
|
|
53
53
|
const { styles } = useStyles();
|
|
54
54
|
const Current = ()=>/*#__PURE__*/ jsxs(Fragment, {
|
|
55
55
|
children: [
|
|
56
56
|
/*#__PURE__*/ jsxs("div", {
|
|
57
|
-
className: styles.footer,
|
|
57
|
+
className: "".concat(styles.footer, " ").concat(stickyFooter ? styles.stickyFooter : ''),
|
|
58
58
|
children: [
|
|
59
59
|
/*#__PURE__*/ jsx("div", {
|
|
60
60
|
className: "title",
|
|
@@ -30,11 +30,22 @@ function _templateObject1() {
|
|
|
30
30
|
};
|
|
31
31
|
return data;
|
|
32
32
|
}
|
|
33
|
+
function _templateObject2() {
|
|
34
|
+
const data = _tagged_template_literal([
|
|
35
|
+
"\n position: sticky !important;\n top: 0 !important;\n z-index: 100 !important;\n background: #fff !important;\n background-color: #fff !important;\n padding: ",
|
|
36
|
+
"px 0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n border-bottom: 1px solid rgba(5, 5, 5, 0.06);\n margin: 0 -16px;\n padding-left: 16px;\n padding-right: 16px;\n\n /* \u786E\u4FDD\u5B8C\u5168\u906E\u6321 */\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100vw;\n right: -100vw;\n bottom: 0;\n background: #fff;\n z-index: -1;\n }\n "
|
|
37
|
+
]);
|
|
38
|
+
_templateObject2 = function() {
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
33
43
|
const useStyles = createStyles((param)=>{
|
|
34
44
|
let { css, token } = param;
|
|
35
45
|
return {
|
|
36
46
|
container: css(_templateObject(), token.padding),
|
|
37
|
-
footer: css(_templateObject1(), token.padding, token.margin, token.fontSizeHeading3, token.lineHeightHeading3)
|
|
47
|
+
footer: css(_templateObject1(), token.padding, token.margin, token.fontSizeHeading3, token.lineHeightHeading3),
|
|
48
|
+
stickyFooter: css(_templateObject2(), token.padding)
|
|
38
49
|
};
|
|
39
50
|
});
|
|
40
51
|
export { useStyles };
|
|
@@ -49,7 +49,7 @@ const InternalNester = observer(()=>{
|
|
|
49
49
|
const { options: collectionField } = useAssociationFieldContext();
|
|
50
50
|
var _fieldSchema_xdecoratorprops_showTitle;
|
|
51
51
|
const showTitle = null != (_fieldSchema_xdecoratorprops_showTitle = null == (_fieldSchema_xdecoratorprops = fieldSchema['x-decorator-props']) ? void 0 : _fieldSchema_xdecoratorprops.showTitle) ? _fieldSchema_xdecoratorprops_showTitle : true;
|
|
52
|
-
const {
|
|
52
|
+
const { params } = useACLActionParamsContext();
|
|
53
53
|
const { styles } = useStyles();
|
|
54
54
|
useEffect(()=>{
|
|
55
55
|
insertNester(schema.Nester);
|
|
@@ -57,7 +57,7 @@ const InternalNester = observer(()=>{
|
|
|
57
57
|
return /*#__PURE__*/ jsx(CollectionProvider_deprecated, {
|
|
58
58
|
name: collectionField.target,
|
|
59
59
|
children: /*#__PURE__*/ jsx(ACLCollectionProvider, {
|
|
60
|
-
actionPath: "".concat(collectionField.target, ":").concat(actionName),
|
|
60
|
+
actionPath: "".concat(collectionField.target, ":").concat(null == params ? void 0 : params.actionName),
|
|
61
61
|
children: /*#__PURE__*/ jsx(FormLayout, {
|
|
62
62
|
layout: 'vertical',
|
|
63
63
|
children: /*#__PURE__*/ jsx("div", {
|
|
@@ -40,7 +40,7 @@ const InternalSubTable = observer(()=>{
|
|
|
40
40
|
const insert = useInsertSchema('SubTable');
|
|
41
41
|
const insertSelector = useInsertSchema('Selector');
|
|
42
42
|
const { options } = useAssociationFieldContext();
|
|
43
|
-
const { actionName } = useACLActionParamsContext();
|
|
43
|
+
const { params, actionName } = useACLActionParamsContext();
|
|
44
44
|
useEffect(()=>{
|
|
45
45
|
insert(schema.SubTable);
|
|
46
46
|
field.required = fieldSchema['required'];
|
|
@@ -65,7 +65,7 @@ const InternalSubTable = observer(()=>{
|
|
|
65
65
|
return /*#__PURE__*/ jsx(CollectionProvider_deprecated, {
|
|
66
66
|
name: options.target,
|
|
67
67
|
children: /*#__PURE__*/ jsx(ACLCollectionProvider, {
|
|
68
|
-
actionPath: "".concat(options.target, ":").concat(actionName || 'view'),
|
|
68
|
+
actionPath: "".concat(options.target, ":").concat(actionName || (null == params ? void 0 : params.actionName) || 'view'),
|
|
69
69
|
children: /*#__PURE__*/ jsx(FormLayout, {
|
|
70
70
|
className: styles.container,
|
|
71
71
|
layout: 'vertical',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useMemo, useState } from "react";
|
|
3
|
-
import { RecursionField, action, exchangeArrayState, isArr, observer, useFieldSchema } from "@tachybase/schema";
|
|
3
|
+
import { RecursionField, action, exchangeArrayState, isArr, observer, useField, useFieldSchema } from "@tachybase/schema";
|
|
4
4
|
import { Button } from "antd";
|
|
5
5
|
import { createStyles } from "antd-style";
|
|
6
6
|
import { unionBy, uniqBy } from "lodash";
|
|
@@ -13,7 +13,7 @@ import { CollectionProvider_deprecated } from "../../../collection-manager/index
|
|
|
13
13
|
import { CollectionRecordProvider, useCollectionRecord } from "../../../data-source/index.mjs";
|
|
14
14
|
import { markRecordAsNew } from "../../../data-source/collection-record/isNewRecord.mjs";
|
|
15
15
|
import { FlagProvider } from "../../../flag-provider/index.mjs";
|
|
16
|
-
import { useCompile } from "../../hooks/index.mjs";
|
|
16
|
+
import { useCompile, useDesignable } from "../../hooks/index.mjs";
|
|
17
17
|
import { ActionContextProvider } from "../action/index.mjs";
|
|
18
18
|
import { Table } from "../table-v2/Table.mjs";
|
|
19
19
|
import { useAssociationFieldContext, useFieldNames } from "./hooks.mjs";
|
|
@@ -84,9 +84,11 @@ const useStyles = createStyles((param)=>{
|
|
|
84
84
|
};
|
|
85
85
|
});
|
|
86
86
|
const SubTable = observer((props)=>{
|
|
87
|
+
var _subTableField_componentProps_pagination, _subTableField_componentProps, _subTableField_componentProps_pagination1, _subTableField_componentProps1, _field_value;
|
|
87
88
|
const { openSize } = props;
|
|
88
89
|
const { styles } = useStyles();
|
|
89
90
|
const { field, options: collectionField } = useAssociationFieldContext();
|
|
91
|
+
const subTableField = useField();
|
|
90
92
|
const { t } = useTranslation();
|
|
91
93
|
const [visibleSelector, setVisibleSelector] = useState(false);
|
|
92
94
|
const [selectedRows, setSelectedRows] = useState([]);
|
|
@@ -111,6 +113,7 @@ const SubTable = observer((props)=>{
|
|
|
111
113
|
return field.onInput(field.value);
|
|
112
114
|
});
|
|
113
115
|
};
|
|
116
|
+
const { dn } = useDesignable();
|
|
114
117
|
field.move = move;
|
|
115
118
|
const options = useMemo(()=>{
|
|
116
119
|
if (field.value && Object.keys(field.value).length > 0) {
|
|
@@ -173,6 +176,23 @@ const SubTable = observer((props)=>{
|
|
|
173
176
|
fieldValue,
|
|
174
177
|
setFieldValue
|
|
175
178
|
};
|
|
179
|
+
const paginationProps = {
|
|
180
|
+
pageSize: (null == (_subTableField_componentProps = subTableField.componentProps) ? void 0 : null == (_subTableField_componentProps_pagination = _subTableField_componentProps.pagination) ? void 0 : _subTableField_componentProps_pagination.pageSize) || 5,
|
|
181
|
+
current: (null == (_subTableField_componentProps1 = subTableField.componentProps) ? void 0 : null == (_subTableField_componentProps_pagination1 = _subTableField_componentProps1.pagination) ? void 0 : _subTableField_componentProps_pagination1.current) || 1,
|
|
182
|
+
total: (null == (_field_value = field.value) ? void 0 : _field_value.length) || 0
|
|
183
|
+
};
|
|
184
|
+
const onChange = (props)=>{
|
|
185
|
+
if (subTableField && fieldSchema) {
|
|
186
|
+
subTableField['componentProps'] = {
|
|
187
|
+
...subTableField.componentProps,
|
|
188
|
+
pagination: props
|
|
189
|
+
};
|
|
190
|
+
fieldSchema['x-component-props'] = {
|
|
191
|
+
...fieldSchema['x-component-props'],
|
|
192
|
+
pagination: props
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
};
|
|
176
196
|
return /*#__PURE__*/ jsxs("div", {
|
|
177
197
|
className: styles.container,
|
|
178
198
|
children: [
|
|
@@ -190,13 +210,14 @@ const SubTable = observer((props)=>{
|
|
|
190
210
|
/*#__PURE__*/ jsx(Table, {
|
|
191
211
|
className: styles.table,
|
|
192
212
|
bordered: true,
|
|
213
|
+
onChange: onChange,
|
|
193
214
|
size: 'small',
|
|
194
215
|
field: field,
|
|
195
216
|
showIndex: true,
|
|
196
217
|
dragSort: field.editable,
|
|
197
218
|
showDel: field.editable,
|
|
198
219
|
setFieldValue: setFieldValue,
|
|
199
|
-
pagination:
|
|
220
|
+
pagination: field.componentProps.pagination ? paginationProps : false,
|
|
200
221
|
rowSelection: {
|
|
201
222
|
type: 'none',
|
|
202
223
|
hideSelectAll: true
|
|
@@ -149,11 +149,15 @@ const useSubFormValue = ()=>{
|
|
|
149
149
|
};
|
|
150
150
|
const useCustomTitle = (record, schema, fieldNames)=>{
|
|
151
151
|
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
152
|
+
if (schema) return {
|
|
153
|
+
formulaRecord: {},
|
|
154
|
+
fieldNames
|
|
155
|
+
};
|
|
152
156
|
if ((null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : _schema_xcomponentprops.mode) === 'CustomTitle' && (null == (_schema_xcomponentprops1 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops1.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula)) {
|
|
153
|
-
if (Array.isArray(record[schema['name']])) record[schema['name']].forEach((recordItem)=>{
|
|
157
|
+
if (Array.isArray(record[null == schema ? void 0 : schema['name']])) record[null == schema ? void 0 : schema['name']].forEach((recordItem)=>{
|
|
154
158
|
recordItem['customLabel'] = getCustomLabel(recordItem, schema);
|
|
155
159
|
});
|
|
156
|
-
else record[schema['name']]['customLabel'] = getCustomLabel(record[schema['name']], schema);
|
|
160
|
+
else record[null == schema ? void 0 : schema['name']]['customLabel'] = getCustomLabel(record[null == schema ? void 0 : schema['name']], schema);
|
|
157
161
|
return {
|
|
158
162
|
formulaRecord: record,
|
|
159
163
|
fieldNames: {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
2
|
import { Input } from "antd";
|
|
4
3
|
import lodash from "lodash";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
5
|
const IconFilterInput = (props)=>{
|
|
6
6
|
const { changeFilterKey } = props;
|
|
7
|
+
const { t } = useTranslation();
|
|
7
8
|
const onChange = lodash.debounce((e)=>{
|
|
8
9
|
const inputValue = e.target.value;
|
|
9
10
|
changeFilterKey(inputValue);
|
|
10
11
|
}, 100);
|
|
11
12
|
return /*#__PURE__*/ jsx(Input, {
|
|
12
13
|
allowClear: true,
|
|
13
|
-
placeholder: '
|
|
14
|
+
placeholder: t("The key in Antd, such as 'ApiOutlined', ignoring case"),
|
|
14
15
|
onChange: onChange
|
|
15
16
|
});
|
|
16
17
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { FieldContext, RecursionField, SchemaContext, SchemaExpressionScopeContext, observer, uid, useField, useFieldSchema } from "@tachybase/schema";
|
|
4
|
-
import { PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
5
4
|
import { error } from "@tego/client";
|
|
5
|
+
import { PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
6
6
|
import { Button, Menu, Popover } from "antd";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
8
|
import { DndContext, SortableItem, createDesignable, useDesignable, useDesigner } from "../../index.mjs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { Schema, SchemaOptionsContext, useFieldSchema } from "@tachybase/schema";
|
|
4
|
+
import { FormLayout } from "@tego/client";
|
|
4
5
|
import { PlusOutlined } from "@ant-design/icons";
|
|
5
6
|
import { PageHeader } from "@ant-design/pro-layout";
|
|
6
7
|
import { PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
7
|
-
import { FormLayout } from "@tego/client";
|
|
8
8
|
import { Button, Tabs } from "antd";
|
|
9
9
|
import { cx } from "antd-style";
|
|
10
10
|
import classnames from "classnames";
|