aldehyde 0.2.481 → 0.2.483
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/lib/controls/direct-file-view/index.d.ts.map +1 -1
- package/lib/controls/direct-file-view/index.js +4 -4
- package/lib/controls/direct-file-view/index.js.map +1 -1
- package/lib/controls/direct-upload/index.d.ts.map +1 -1
- package/lib/controls/direct-upload/index.js +3 -3
- package/lib/controls/direct-upload/index.js.map +1 -1
- package/lib/controls/entry-control.d.ts +2 -1
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +10 -0
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/select/index.d.ts +8 -2
- package/lib/controls/select/index.d.ts.map +1 -1
- package/lib/controls/select/index.js +35 -13
- package/lib/controls/select/index.js.map +1 -1
- package/lib/controls/upload-read-excel/index.d.ts +10 -0
- package/lib/controls/upload-read-excel/index.d.ts.map +1 -0
- package/lib/controls/upload-read-excel/index.js +30 -0
- package/lib/controls/upload-read-excel/index.js.map +1 -0
- package/lib/detail/dtmpl.css +5 -0
- package/lib/detail/view/dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/dtmpl-view.js +12 -2
- package/lib/detail/view/dtmpl-view.js.map +1 -1
- package/lib/draw-canvas-edit/components/asset-bar/index.less +2 -2
- package/lib/draw-canvas-edit/components/main-header/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/main-header/index.js +32 -2
- package/lib/draw-canvas-edit/components/main-header/index.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/components/index.less +61 -0
- package/lib/draw-canvas-edit/components/render/components/workstation-component.d.ts +7 -0
- package/lib/draw-canvas-edit/components/render/components/workstation-component.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/components/workstation-component.js +122 -15
- package/lib/draw-canvas-edit/components/render/components/workstation-component.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/selection-handlers.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/handlers/selection-handlers.js +19 -5
- package/lib/draw-canvas-edit/components/render/handlers/selection-handlers.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/index.js +15 -4
- package/lib/draw-canvas-edit/components/render/index.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/asset-tool.d.ts +2 -0
- package/lib/draw-canvas-edit/components/render/tools/asset-tool.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/asset-tool.js +22 -11
- package/lib/draw-canvas-edit/components/render/tools/asset-tool.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/component-factory.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/import-export-tool.d.ts +1 -0
- package/lib/draw-canvas-edit/components/render/tools/import-export-tool.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/tools/import-export-tool.js +35 -22
- package/lib/draw-canvas-edit/components/render/tools/import-export-tool.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/types.d.ts +3 -0
- package/lib/draw-canvas-edit/components/render/types.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/types.js.map +1 -1
- package/lib/draw-canvas-edit/components/setting-form/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/setting-form/index.js +10 -0
- package/lib/draw-canvas-edit/components/setting-form/index.js.map +1 -1
- package/lib/draw-canvas-edit/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/index.js +5 -2
- package/lib/draw-canvas-edit/index.js.map +1 -1
- package/lib/draw-canvas-view/index.less +7 -0
- package/lib/draw-canvas-view/view.d.ts.map +1 -1
- package/lib/draw-canvas-view/view.js +16 -21
- package/lib/draw-canvas-view/view.js.map +1 -1
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/dtmpl-form.js +11 -2
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/form/field-group-form.d.ts.map +1 -1
- package/lib/form/field-group-form.js +1 -1
- package/lib/form/field-group-form.js.map +1 -1
- package/lib/form/form-Item-group.d.ts +2 -1
- package/lib/form/form-Item-group.d.ts.map +1 -1
- package/lib/form/form-Item-group.js +2 -2
- package/lib/form/form-Item-group.js.map +1 -1
- package/lib/list/card-list/card-list-item.d.ts.map +1 -1
- package/lib/list/card-list/card-list-item.js +3 -2
- package/lib/list/card-list/card-list-item.js.map +1 -1
- package/lib/list/card-list/index.less +1 -1
- package/lib/lowcode-components/carousel/index.js +3 -3
- package/lib/lowcode-components/carousel/index.js.map +1 -1
- package/lib/module/ltmpl-table.d.ts +1 -0
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/module/ltmpl-table.js +2 -2
- package/lib/module/ltmpl-table.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +21 -20
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +26 -16
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/column/index.less +22 -0
- package/lib/table/query-table.d.ts +5 -0
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +17 -5
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +1 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +5 -24
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts +1 -0
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +9 -0
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/interface.d.ts +5 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/package.json +2 -1
- package/src/aldehyde/controls/direct-file-view/index.tsx +5 -4
- package/src/aldehyde/controls/direct-upload/index.tsx +4 -3
- package/src/aldehyde/controls/entry-control.tsx +11 -1
- package/src/aldehyde/controls/select/index.tsx +25 -14
- package/src/aldehyde/controls/upload-read-excel/index.tsx +44 -0
- package/src/aldehyde/detail/dtmpl.css +5 -0
- package/src/aldehyde/detail/view/dtmpl-view.tsx +22 -2
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.less +2 -2
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.tsx +33 -2
- package/src/aldehyde/draw-canvas-edit/components/render/components/index.less +61 -0
- package/src/aldehyde/draw-canvas-edit/components/render/components/workstation-component.tsx +131 -15
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/selection-handlers.ts +17 -5
- package/src/aldehyde/draw-canvas-edit/components/render/index.ts +16 -3
- package/src/aldehyde/draw-canvas-edit/components/render/tools/asset-tool.ts +21 -7
- package/src/aldehyde/draw-canvas-edit/components/render/tools/component-factory.ts +1 -1
- package/src/aldehyde/draw-canvas-edit/components/render/tools/import-export-tool.ts +34 -22
- package/src/aldehyde/draw-canvas-edit/components/render/types.ts +3 -0
- package/src/aldehyde/draw-canvas-edit/components/setting-form/index.tsx +12 -0
- package/src/aldehyde/draw-canvas-edit/index.tsx +5 -2
- package/src/aldehyde/draw-canvas-view/index.less +7 -0
- package/src/aldehyde/draw-canvas-view/view.tsx +18 -21
- package/src/aldehyde/form/dtmpl-form.tsx +20 -1
- package/src/aldehyde/form/field-group-form.tsx +6 -5
- package/src/aldehyde/form/form-Item-group.tsx +5 -4
- package/src/aldehyde/list/card-list/card-list-item.tsx +3 -2
- package/src/aldehyde/list/card-list/index.less +1 -1
- package/src/aldehyde/lowcode-components/carousel/index.tsx +3 -3
- package/src/aldehyde/lowcode-components/data.d.ts +1 -0
- package/src/aldehyde/module/ltmpl-table.tsx +3 -2
- package/src/aldehyde/table/act-table.tsx +13 -14
- package/src/aldehyde/table/column/column-builder.tsx +29 -17
- package/src/aldehyde/table/column/index.less +22 -0
- package/src/aldehyde/table/query-table.tsx +15 -5
- package/src/aldehyde/table/relation-table.tsx +6 -21
- package/src/aldehyde/tmpl/hc-data-source.tsx +8 -0
- package/src/aldehyde/tmpl/interface.tsx +5 -0
|
@@ -9,6 +9,7 @@ import MainHeader from './components/main-header';
|
|
|
9
9
|
import AssetBar from './components/asset-bar';
|
|
10
10
|
import SettingForm from "./components/setting-form";
|
|
11
11
|
import type Konva from 'konva';
|
|
12
|
+
import { useLocale } from "../index";
|
|
12
13
|
import './index.less';
|
|
13
14
|
|
|
14
15
|
interface Props {
|
|
@@ -33,6 +34,7 @@ const Index = (props: Props) => {
|
|
|
33
34
|
const assetCurrentRef = useRef<Konva.Node>(null); // 当前选中组件Ref
|
|
34
35
|
const [loading, setLoading] = useState<boolean>(false);
|
|
35
36
|
const { token: themeToken } = theme.useToken();
|
|
37
|
+
const { getLocale } = useLocale();
|
|
36
38
|
|
|
37
39
|
// 获取视图数据
|
|
38
40
|
const getViewData = async () => {
|
|
@@ -48,10 +50,10 @@ const Index = (props: Props) => {
|
|
|
48
50
|
const decompressedBuffer = gunzipSync(temByteArray);
|
|
49
51
|
// 2. 将 Uint8Array 转换回普通字符串
|
|
50
52
|
const originalData = strFromU8(decompressedBuffer);
|
|
51
|
-
setLoading(false);
|
|
52
53
|
// 重置画面数据
|
|
53
54
|
await renderRef.current.importExportTool.restore(originalData as string);
|
|
54
55
|
await renderRef.current.positionTool.positionFit(); // 画布默认自适应居中
|
|
56
|
+
setLoading(false);
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
useEffect(() => {
|
|
@@ -63,12 +65,13 @@ const Index = (props: Props) => {
|
|
|
63
65
|
// 初始化渲染器
|
|
64
66
|
const initRender = useCallback((width: number, height: number) => {
|
|
65
67
|
if (renderRef.current || !stageRef.current) return;
|
|
68
|
+
const locale = getLocale();
|
|
66
69
|
const render = new Render(stageRef.current, {
|
|
67
70
|
width, height,
|
|
68
71
|
showBg: true, showRuler: true, showRefLine: true,
|
|
69
72
|
showPreview: false, showContextmenu: true,
|
|
70
73
|
attractResize: true, attractBg: true, attractNode: true,
|
|
71
|
-
themeToken
|
|
74
|
+
themeToken, locale
|
|
72
75
|
});
|
|
73
76
|
renderRef.current = render;
|
|
74
77
|
// 初始化设置
|
|
@@ -33,9 +33,16 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
.ant-spin,
|
|
37
|
+
.ant-spin-container {
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
// 画布区域
|
|
37
43
|
.draw-viewer-content {
|
|
38
44
|
width: 100%;
|
|
45
|
+
height: 100%;
|
|
39
46
|
flex-grow: 1;
|
|
40
47
|
background-color: var(--ant-layout-body-bg);
|
|
41
48
|
position: relative;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useCallback } from 'react';
|
|
2
|
-
import { Space, Button } from "antd";
|
|
1
|
+
import React, { useEffect, useRef, useCallback, useState } from 'react';
|
|
2
|
+
import { Space, Button, Spin } from "antd";
|
|
3
3
|
import { ExpandOutlined } from '@ant-design/icons';
|
|
4
4
|
import chunk from "lodash/chunk";
|
|
5
5
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
6
6
|
import WebSocket from "../tmpl/web-socket";
|
|
7
7
|
import { Render } from '../draw-canvas-edit/components/render';
|
|
8
|
-
import {
|
|
8
|
+
import { useLocale } from "../index";
|
|
9
9
|
import './index.less';
|
|
10
10
|
|
|
11
11
|
// 数据源请求结果
|
|
@@ -35,12 +35,14 @@ const Index = (props: ViewerProps) => {
|
|
|
35
35
|
const observerRef = useRef<ResizeObserver | null>(null);
|
|
36
36
|
const wsRef = useRef(undefined); // 实时数据websocket连接
|
|
37
37
|
const subscribeRef = useRef(undefined); // 实时数据订阅
|
|
38
|
-
const
|
|
38
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
39
|
+
const { getLocale } = useLocale();
|
|
39
40
|
|
|
40
41
|
// 初始化渲染器(只读模式)
|
|
41
42
|
const initRender = useCallback(
|
|
42
43
|
(width: number, height: number) => {
|
|
43
44
|
if (renderRef.current || !stageRef.current) return;
|
|
45
|
+
const locale = getLocale();
|
|
44
46
|
const render = new Render(stageRef.current, {
|
|
45
47
|
width,
|
|
46
48
|
height,
|
|
@@ -49,7 +51,8 @@ const Index = (props: ViewerProps) => {
|
|
|
49
51
|
showPreview: false, // 不需要预览框
|
|
50
52
|
showContextmenu: false, // 不需要右键菜单
|
|
51
53
|
showBg: true,
|
|
52
|
-
readonly: true //
|
|
54
|
+
readonly: true, // 只读模式
|
|
55
|
+
locale
|
|
53
56
|
});
|
|
54
57
|
renderRef.current = render;
|
|
55
58
|
// 如果有数据,恢复画布
|
|
@@ -61,7 +64,7 @@ const Index = (props: ViewerProps) => {
|
|
|
61
64
|
);
|
|
62
65
|
|
|
63
66
|
// 更新指定组件设置
|
|
64
|
-
const updateComponentSetting = (node: { [key: string]: any }, data: DataSource, pageId: string
|
|
67
|
+
const updateComponentSetting = (node: { [key: string]: any }, data: DataSource, pageId: string) => {
|
|
65
68
|
const { componentType, id, settings } = node;
|
|
66
69
|
let temSetting;
|
|
67
70
|
switch (componentType) {
|
|
@@ -73,23 +76,13 @@ const Index = (props: ViewerProps) => {
|
|
|
73
76
|
default:
|
|
74
77
|
break;
|
|
75
78
|
}
|
|
76
|
-
temSetting && renderRef.current.updateAssetById(id, { ...temSetting, pageId
|
|
79
|
+
temSetting && renderRef.current.updateAssetById(id, { ...temSetting, pageId });
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
// 查询关联页面配置
|
|
80
|
-
const getDataPageConfig = async (sourceId: string) => {
|
|
81
|
-
if (!sourceId) return null;
|
|
82
|
-
if (dataPageConfigRef.current[sourceId]) return dataPageConfigRef.current[sourceId];
|
|
83
|
-
let ltmplConfigRes: LtmplConfigRes = await HcserviceV3.requestLtmplConfig(null, sourceId);
|
|
84
|
-
dataPageConfigRef.current = { ...dataPageConfigRef.current, [sourceId]: ltmplConfigRes.ltmplConfig };
|
|
85
|
-
return ltmplConfigRes.ltmplConfig;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
82
|
// 更新组件数据->更新画面
|
|
89
83
|
const updateAssetSettings = async (nodes: { [key: string]: any }[], data: DataSource) => {
|
|
90
84
|
if (!renderRef.current || !nodes?.length || !data) return;
|
|
91
|
-
|
|
92
|
-
nodes.forEach(node => updateComponentSetting(node, data, data.config?.pageId, pageConfig));
|
|
85
|
+
nodes.forEach(node => updateComponentSetting(node, data, data.config?.pageId));
|
|
93
86
|
};
|
|
94
87
|
|
|
95
88
|
// 整理组件数据源
|
|
@@ -163,6 +156,7 @@ const Index = (props: ViewerProps) => {
|
|
|
163
156
|
|
|
164
157
|
// 加载画布数据
|
|
165
158
|
const loadData = useCallback(async (render: Render, jsonData: string) => {
|
|
159
|
+
setLoading(true);
|
|
166
160
|
try {
|
|
167
161
|
await render.importExportTool.restore(jsonData);
|
|
168
162
|
// 数据加载完成后自适应居中
|
|
@@ -171,6 +165,7 @@ const Index = (props: ViewerProps) => {
|
|
|
171
165
|
} catch (e) {
|
|
172
166
|
console.error('Failed to load canvas data:', e);
|
|
173
167
|
}
|
|
168
|
+
setLoading(false);
|
|
174
169
|
}, []);
|
|
175
170
|
|
|
176
171
|
// 监听容器尺寸变化
|
|
@@ -230,9 +225,11 @@ const Index = (props: ViewerProps) => {
|
|
|
230
225
|
</Space>
|
|
231
226
|
</div>
|
|
232
227
|
{/* 画布区域 */}
|
|
233
|
-
<
|
|
234
|
-
<div ref={
|
|
235
|
-
|
|
228
|
+
<Spin spinning={loading}>
|
|
229
|
+
<div className="draw-viewer-content" ref={boardRef}>
|
|
230
|
+
<div ref={stageRef} />
|
|
231
|
+
</div>
|
|
232
|
+
</Spin>
|
|
236
233
|
</div>
|
|
237
234
|
);
|
|
238
235
|
};
|
|
@@ -286,7 +286,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
286
286
|
if (dtmplConfig) {
|
|
287
287
|
groups = dtmplConfig.groups;
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
const groupElements = groups.map((item) => {
|
|
290
290
|
if (item.type == "embed") {
|
|
291
291
|
let codeSource = undefined;
|
|
292
292
|
//code 从来源字段里面拿
|
|
@@ -430,11 +430,30 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
430
430
|
dataCode={dtmplData ? dtmplData.code : undefined}
|
|
431
431
|
valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
432
432
|
valueFieldMap={valueFieldMap}
|
|
433
|
+
editStatus={dtmplData?.code ? "changed" : "new"} // 新增或修改状态
|
|
433
434
|
/>}
|
|
434
435
|
</CollapseCard>
|
|
435
436
|
);
|
|
436
437
|
}
|
|
437
438
|
});
|
|
439
|
+
|
|
440
|
+
if (dtmplConfig?.editRactions?.length) { // 关系操作
|
|
441
|
+
const viewRactions = dtmplConfig.editRactions.map(item => {
|
|
442
|
+
return <CollapseCard
|
|
443
|
+
title={item.title}
|
|
444
|
+
key={item.id}
|
|
445
|
+
id={item.id}
|
|
446
|
+
className="hoverable"
|
|
447
|
+
styles={{ header: { background: "#f2f4f5" } }}
|
|
448
|
+
loading={loading}
|
|
449
|
+
>
|
|
450
|
+
<LtmplTable funcMode="common" serverKey={serverKey} sourceId={item.id} mainCode={dtmplData?.code} />
|
|
451
|
+
</CollapseCard>;
|
|
452
|
+
});
|
|
453
|
+
groupElements.push(...viewRactions);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return groupElements;
|
|
438
457
|
};
|
|
439
458
|
|
|
440
459
|
onValuesChange = (changedValues, allValues) => {
|
|
@@ -16,7 +16,7 @@ export interface FieldGroupFormProps {
|
|
|
16
16
|
onFinish: (value: DtmplData) => void;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
interface FieldGroupFormStat {}
|
|
19
|
+
interface FieldGroupFormStat { }
|
|
20
20
|
|
|
21
21
|
export default class Form extends React.PureComponent<
|
|
22
22
|
FieldGroupFormProps,
|
|
@@ -29,7 +29,7 @@ export default class Form extends React.PureComponent<
|
|
|
29
29
|
static defaultProps = {
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
async componentDidMount() {}
|
|
32
|
+
async componentDidMount() { }
|
|
33
33
|
|
|
34
34
|
onSubmit = (values: any) => {
|
|
35
35
|
const { dtmplData, fieldGroupConfig } = this.props;
|
|
@@ -87,14 +87,15 @@ export default class Form extends React.PureComponent<
|
|
|
87
87
|
>
|
|
88
88
|
{this.selectRelation()}
|
|
89
89
|
<FormItemGroup
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
maxColsOnRow={fieldGroupConfig && fieldGroupConfig.addOrEditType == "doubleCol" ? 2 : 1}
|
|
91
|
+
dataCode={dtmplData ? dtmplData.code : undefined}
|
|
92
92
|
serverKey={serverKey}
|
|
93
93
|
formRef={formRef}
|
|
94
94
|
nameAttr={"id"}
|
|
95
95
|
fields={fieldGroupConfig ? fieldGroupConfig.fields : undefined}
|
|
96
96
|
valueMap={dtmplData ? dtmplData.fieldMap : {}}
|
|
97
|
-
|
|
97
|
+
editStatus={dtmplData ? dtmplData.editStatus : "new"}
|
|
98
|
+
/>
|
|
98
99
|
</AntdForm>
|
|
99
100
|
</>
|
|
100
101
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { RefObject, useState, useMemo } from "react";
|
|
2
2
|
import { Col, Form, Row, Popconfirm } from "antd";
|
|
3
|
-
import { FieldConfig } from "../tmpl/interface";
|
|
3
|
+
import { FieldConfig, EditStatus } from "../tmpl/interface";
|
|
4
4
|
import EntryControl from "../controls/entry-control";
|
|
5
5
|
import Units from "../units";
|
|
6
6
|
import { FormInstance } from "antd/lib/form/hooks/useForm";
|
|
@@ -12,11 +12,11 @@ const FormItem = Form.Item;
|
|
|
12
12
|
|
|
13
13
|
// 渲染表单项,如果有关联项,则在更改值时弹出确认框,否则直接更改值
|
|
14
14
|
const RenderEntryControl = ({ fieldValue, item, props, translate, getMainCode, ...otherProps }) => {
|
|
15
|
-
const { mainCode, serverKey, dataCode, valueFieldMap } = props;
|
|
15
|
+
const { mainCode, serverKey, dataCode, valueFieldMap, editStatus } = props;
|
|
16
16
|
const { onChange } = otherProps;
|
|
17
17
|
const [isUpdateItem, setIsUpdateItem] = useState<boolean>(false);
|
|
18
18
|
const [value, setValue] = useState<any>(fieldValue);
|
|
19
|
-
const controlProps = { dataCode, serverKey, mainCode: getMainCode(item, mainCode), value: fieldValue, fieldConfig: item, ...otherProps };
|
|
19
|
+
const controlProps = { dataCode, serverKey, mainCode: getMainCode(item, mainCode), value: fieldValue, fieldConfig: item, editStatus, ...otherProps };
|
|
20
20
|
|
|
21
21
|
const popconfirm = useMemo(() => {
|
|
22
22
|
if (!valueFieldMap) {
|
|
@@ -65,7 +65,8 @@ export interface FieldGroupProps {
|
|
|
65
65
|
formRef?: RefObject<FormInstance>;
|
|
66
66
|
dataCode?: string,
|
|
67
67
|
layout?: "horizontal" | "vertical";
|
|
68
|
-
valueFieldMap?: { [key: string]: any } // 表单关联项配置
|
|
68
|
+
valueFieldMap?: { [key: string]: any }; // 表单关联项配置
|
|
69
|
+
editStatus?: EditStatus
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
interface FieldGroupState {
|
|
@@ -19,6 +19,7 @@ const dataKeys = ["primaryColumn", "primaryColumnLabel", "secondColumn", "second
|
|
|
19
19
|
const Index = (props: Props) => {
|
|
20
20
|
const { cardListConfig, item, renderOpt, serverKey, sourceId } = props;
|
|
21
21
|
const { buttons, customViewPagePath, mainCode } = cardListConfig;
|
|
22
|
+
const cardColSpan = Math.trunc(24 / (cardListConfig.colNumOnRow || 2));
|
|
22
23
|
const { translate } = useLocale();
|
|
23
24
|
const [data, setData] = useState({});
|
|
24
25
|
const [detailOpen, setDetailOpen] = useState<boolean>(false);
|
|
@@ -91,8 +92,8 @@ const Index = (props: Props) => {
|
|
|
91
92
|
<div className="card-show-cols">
|
|
92
93
|
<Row gutter={6}>
|
|
93
94
|
{data["cardShowCols"].map((col, index) => // 卡片展示字段是两个,则右侧对齐
|
|
94
|
-
<Col className="card-show-col" span={
|
|
95
|
-
<div className="card-show-col-title">{translate("${" + col.title + "}")}:</div>
|
|
95
|
+
<Col className="card-show-col" span={cardColSpan} key={index} style={data["cardShowCols"].length < 3 && index % 2 ? { justifyContent: "flex-end" } : {}}>
|
|
96
|
+
{cardListConfig?.notDisplayFieldName ? "" : <div className="card-show-col-title">{translate("${" + col.title + "}")}:</div>}
|
|
96
97
|
<div className="card-show-col-value">{col.value || col.value === 0 ? col.element : "-"}</div>
|
|
97
98
|
</Col>)
|
|
98
99
|
}
|
|
@@ -54,7 +54,7 @@ const handleValue = (val: string, ossConfig: OssConfig,) => {
|
|
|
54
54
|
if (!ossConfig) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
return
|
|
57
|
+
return `${ossConfig.protocol || "http"}://${ossConfig.bucket}.${ossConfig.endpoint}/${val}`;
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
@@ -104,8 +104,8 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
104
104
|
const { translate } = useLocale();
|
|
105
105
|
|
|
106
106
|
const getOssConfig = (serverKey: string) => {
|
|
107
|
-
const { accessKeyId, accessKeySecret, bucket, endpoint } = ProgramConfig.getExtendServers(serverKey) || {};
|
|
108
|
-
const temObj = { accessKeyId, accessKeySecret, bucket, endpoint }
|
|
107
|
+
const { accessKeyId, accessKeySecret, bucket, endpoint, protocol } = ProgramConfig.getExtendServers(serverKey) || {};
|
|
108
|
+
const temObj = { accessKeyId, accessKeySecret, bucket, endpoint, protocol }
|
|
109
109
|
return temObj;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -38,6 +38,7 @@ export interface LtmplTableProps {
|
|
|
38
38
|
showAggregates?: boolean; // 是否显示统计卡片数据
|
|
39
39
|
deleteCallback?: (val: object) => void; // 删除回调
|
|
40
40
|
loadDataCallback?: (val: object[]) => void; // 请求数据回调函数
|
|
41
|
+
defRowCardCount?: number; // 卡片展示模式-默认行卡片数量
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export interface LtmplTableState {
|
|
@@ -263,7 +264,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
263
264
|
tip, title, collapsible,
|
|
264
265
|
initCollapse, doCustomEdit, doCustomCreate,
|
|
265
266
|
serverKey, rowOperatable, readOnly, defShowType, showPagination, showAggregates, deleteCallback,
|
|
266
|
-
loadDataCallback
|
|
267
|
+
loadDataCallback, defRowCardCount
|
|
267
268
|
} = this.props;
|
|
268
269
|
const { translate } = this.context;
|
|
269
270
|
|
|
@@ -286,7 +287,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
286
287
|
criteriaData={criteriaData}
|
|
287
288
|
customEditable={doCustomEdit ? true : false}
|
|
288
289
|
customCreatable={doCustomCreate ? true : false}
|
|
289
|
-
ltmplConfig={ltmplConfigRes.ltmplConfig}
|
|
290
|
+
ltmplConfig={defRowCardCount ? { ...ltmplConfigRes.ltmplConfig, rowCardCount: defRowCardCount } : ltmplConfigRes.ltmplConfig}
|
|
290
291
|
defShowType={defShowType}
|
|
291
292
|
showPagination={showPagination}
|
|
292
293
|
showAggregates={showAggregates}
|
|
@@ -647,7 +647,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
647
647
|
changeViewModel = (viewModels) => {
|
|
648
648
|
const { setUserPageConfig } = this.props;
|
|
649
649
|
const { hiddenColIds, hiddenRowCodes, sortedColConfigs, viewModels: oldViewModels } = this.state;
|
|
650
|
-
setUserPageConfig({ viewModels });
|
|
650
|
+
setUserPageConfig && setUserPageConfig({ viewModels });
|
|
651
651
|
this.setState({ viewModels }, () => {
|
|
652
652
|
if (viewModels.length && viewModels.includes("ganttChart") !== oldViewModels.includes("ganttChart")) {
|
|
653
653
|
this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs); // 前后选择是否存在甘特图,刷新数据
|
|
@@ -658,7 +658,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
658
658
|
changeHiddenColumns = (hiddenColIds: string[]) => {
|
|
659
659
|
const { setUserPageConfig } = this.props;
|
|
660
660
|
this.setState({ showL2Chart: false, hiddenColIds });
|
|
661
|
-
setUserPageConfig({ hiddenColIds });
|
|
661
|
+
setUserPageConfig && setUserPageConfig({ hiddenColIds });
|
|
662
662
|
};
|
|
663
663
|
|
|
664
664
|
doSelectedAction = async (actionId: string, codes, params: object) => {
|
|
@@ -933,14 +933,14 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
933
933
|
const { setUserPageConfig } = this.props;
|
|
934
934
|
this.setState({ sortedColConfigs });
|
|
935
935
|
const sortedColIds = sortedColConfigs.map(r => r.id);
|
|
936
|
-
setUserPageConfig({ sortedColIds });
|
|
936
|
+
setUserPageConfig && setUserPageConfig({ sortedColIds });
|
|
937
937
|
};
|
|
938
938
|
|
|
939
939
|
// 更新本地缓存列宽度
|
|
940
940
|
onChangeResize = (colResize: { [key: string]: number }) => {
|
|
941
941
|
const { setUserPageConfig, userPageConfig } = this.props;
|
|
942
942
|
const oldColResize = userPageConfig?.colResize || {};
|
|
943
|
-
setUserPageConfig({ colResize: { ...oldColResize, ...colResize } });
|
|
943
|
+
setUserPageConfig && setUserPageConfig({ colResize: { ...oldColResize, ...colResize } });
|
|
944
944
|
}
|
|
945
945
|
|
|
946
946
|
getAddTmplButton = (classAddConfigs: ClassAddConfig[]) => {
|
|
@@ -1546,7 +1546,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1546
1546
|
);
|
|
1547
1547
|
|
|
1548
1548
|
let { buttons, extDisplayConfig, rowCardCount, customViewPagePath, splitTabShowType } = ltmplConfig;
|
|
1549
|
-
let { primaryColumn, primaryColumnLabel, secondColumn, secondColumnLabel, mainPicture, mainPictureLabel, labelColumn, cardShowCols } = extDisplayConfig;
|
|
1549
|
+
let { primaryColumn, primaryColumnLabel, secondColumn, secondColumnLabel, mainPicture, mainPictureLabel, labelColumn, cardShowCols, notDisplayFieldName, colNumOnRow } = extDisplayConfig;
|
|
1550
1550
|
let displayCriteriaCard: boolean = false;
|
|
1551
1551
|
if (funcMode == "simple" || funcMode == "common") {
|
|
1552
1552
|
displayCriteriaCard = false;
|
|
@@ -1607,7 +1607,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1607
1607
|
groupIColumns={ltmplConfig.groupIColumns}
|
|
1608
1608
|
doSearch={this.actTableDoSearch}
|
|
1609
1609
|
sortColumnData={sortColumnData}
|
|
1610
|
-
cardListConfig={{ primaryColumn, primaryColumnLabel, secondColumn, secondColumnLabel, mainPicture, mainPictureLabel, labelColumn, cardShowCols, rowCardCount, buttons, customViewPagePath, mainCode }}
|
|
1610
|
+
cardListConfig={{ primaryColumn, primaryColumnLabel, secondColumn, secondColumnLabel, mainPicture, mainPictureLabel, labelColumn, cardShowCols, rowCardCount, buttons, customViewPagePath, mainCode, notDisplayFieldName, colNumOnRow }}
|
|
1611
1611
|
ltmplConfig={ltmplConfig}
|
|
1612
1612
|
showView={showView}
|
|
1613
1613
|
showPagination={showPagination}
|
|
@@ -1644,10 +1644,10 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1644
1644
|
""
|
|
1645
1645
|
)}
|
|
1646
1646
|
<div className="actTable">
|
|
1647
|
-
|
|
1648
|
-
<
|
|
1649
|
-
{
|
|
1650
|
-
collapsible ? null : (
|
|
1647
|
+
{["complete", "common"].includes(funcMode) ?
|
|
1648
|
+
<Row>
|
|
1649
|
+
<Col span={24}>
|
|
1650
|
+
{collapsible ? null : (
|
|
1651
1651
|
<span>
|
|
1652
1652
|
{ltmplConfig.header ? (
|
|
1653
1653
|
<div
|
|
@@ -1667,10 +1667,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1667
1667
|
<p className="fr" style={{ marginBottom: "4px" }}>{this.renderHeaderButtons()}</p>
|
|
1668
1668
|
</>}
|
|
1669
1669
|
</span>
|
|
1670
|
-
)
|
|
1671
|
-
|
|
1672
|
-
</
|
|
1673
|
-
</Row>
|
|
1670
|
+
)}
|
|
1671
|
+
</Col>
|
|
1672
|
+
</Row> : null}
|
|
1674
1673
|
{(<Row><Col span={24}><Layout hasSider style={{ backgroundColor: "#fff" }}>
|
|
1675
1674
|
<Sider
|
|
1676
1675
|
width={ltreeEntitySelect ? 260 : 0}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ActionRenderProps, ColumnConfig, DtmplData, LtmplConfig, FieldConfig, CustomButton, CQueryConfig } from "../../tmpl/interface";
|
|
3
3
|
import TableUnits from "../table-util";
|
|
4
4
|
import SupportInputTypes from "../../tmpl/control-type-supportor";
|
|
5
|
-
import { Button, Popconfirm, Popover, Space, Tooltip, Form as AntdForm } from "antd";
|
|
5
|
+
import { Button, Popconfirm, Popover, Space, Tooltip, Form as AntdForm, theme } from "antd";
|
|
6
6
|
import { SortableHandle } from "react-sortable-hoc";
|
|
7
7
|
import {
|
|
8
8
|
AlignLeftOutlined, CopyOutlined, DeleteOutlined,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
FormOutlined,
|
|
13
13
|
KeyOutlined,
|
|
14
14
|
MenuOutlined, QuestionCircleOutlined, PlaySquareOutlined,
|
|
15
|
-
SettingOutlined
|
|
15
|
+
SettingOutlined, UpSquareFilled, DownSquareFilled
|
|
16
16
|
} from "@ant-design/icons";
|
|
17
17
|
import ActionUtils from "../../controls/action/utils";
|
|
18
18
|
import ViewButton from "../../detail/button/view-button";
|
|
@@ -31,20 +31,11 @@ import "./index.less";
|
|
|
31
31
|
|
|
32
32
|
const FormItem = AntdForm.Item;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
let type = item.rowEditType;
|
|
40
|
-
if (type === "editable" || (type === "editonly" && !isNew) || (type === "addonly" && isNew)) {
|
|
41
|
-
return false;
|
|
42
|
-
} else if (type === "readonly") {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
|
|
34
|
+
// 负责提取 token
|
|
35
|
+
const ThemeToken = (props) => {
|
|
36
|
+
const { token } = theme.useToken();
|
|
37
|
+
return props.children(token); // 使用 render props 模式
|
|
38
|
+
};
|
|
48
39
|
|
|
49
40
|
interface ColumnBuilderProps extends ActionRenderProps {
|
|
50
41
|
ltmplConfig: LtmplConfig,
|
|
@@ -127,6 +118,26 @@ export default {
|
|
|
127
118
|
const order = this.handleColumnOrder(column["dataIndex"], sortColumns);
|
|
128
119
|
if (item.sortable) {
|
|
129
120
|
TableUnits.sort(column, itemType, order);
|
|
121
|
+
} else if (item.pageSortable) {
|
|
122
|
+
column["sorter"] = (a, b) => {
|
|
123
|
+
let aVal = a[column["dataIndex"]];
|
|
124
|
+
let bVal = b[column["dataIndex"]];
|
|
125
|
+
if (aVal?.includes["@R@"]) aVal = aVal.split("@R@")[1];
|
|
126
|
+
if (bVal?.includes["@R@"]) bVal = bVal.split("@R@")[1];
|
|
127
|
+
// 判断是否为字符串数字
|
|
128
|
+
const numA = Number(aVal);
|
|
129
|
+
const numB = Number(bVal);
|
|
130
|
+
const isNumeric = aVal && bVal && !isNaN(numA) && !isNaN(numB);
|
|
131
|
+
return isNumeric ? numA - numB : aVal.localeCompare(bVal);
|
|
132
|
+
};
|
|
133
|
+
column["showSorterTooltip"] = false;
|
|
134
|
+
column["sortIcon"] = ({ sortOrder }) =>
|
|
135
|
+
<ThemeToken>
|
|
136
|
+
{(token) => <span className="pageSortable" >
|
|
137
|
+
<UpSquareFilled className="ascend" style={sortOrder === 'ascend' ? { color: token.colorPrimary } : {}} />
|
|
138
|
+
<DownSquareFilled className="descend" style={sortOrder === 'descend' ? { color: token.colorPrimary } : {}} />
|
|
139
|
+
</span>}
|
|
140
|
+
</ThemeToken>
|
|
130
141
|
}
|
|
131
142
|
}
|
|
132
143
|
}
|
|
@@ -228,8 +239,9 @@ export default {
|
|
|
228
239
|
initialValue={record[item.id]}>
|
|
229
240
|
<EntryControl
|
|
230
241
|
serverKey={serverKey}
|
|
231
|
-
fieldConfig={{ ...item
|
|
242
|
+
fieldConfig={{ ...item }}
|
|
232
243
|
value={record[item.id]}
|
|
244
|
+
editStatus={record.editStatus}
|
|
233
245
|
/>
|
|
234
246
|
</FormItem> :
|
|
235
247
|
<div className={record['dataType'] ? record['dataType'] === "小计" ? "xiaoji" : 'heji' : ""}>
|
|
@@ -61,4 +61,26 @@
|
|
|
61
61
|
.column-action {
|
|
62
62
|
display: block;
|
|
63
63
|
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.pageSortable {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
margin-left: 4;
|
|
70
|
+
|
|
71
|
+
.ascend,
|
|
72
|
+
.descend {
|
|
73
|
+
font-size: var(--ant-font-size-icon);
|
|
74
|
+
color: var(--ant-table-header-icon-color);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ant-table-column-sorters:hover {
|
|
79
|
+
.pageSortable {
|
|
80
|
+
|
|
81
|
+
.ascend,
|
|
82
|
+
.descend {
|
|
83
|
+
color: var(--ant-table-header-icon-hover-color);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
64
86
|
}
|
|
@@ -43,6 +43,7 @@ interface QueryTableStat {
|
|
|
43
43
|
aggregateVO?: AggregateVO;
|
|
44
44
|
beforeSelectedRows?: number;
|
|
45
45
|
errorText?: string;
|
|
46
|
+
localSorter?: { field: string, order: string };
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
@@ -77,7 +78,8 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
77
78
|
touchEnd: undefined,
|
|
78
79
|
aggregateVO: undefined,
|
|
79
80
|
beforeSelectedRows: undefined,
|
|
80
|
-
errorText: undefined
|
|
81
|
+
errorText: undefined,
|
|
82
|
+
localSorter: undefined
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
static contextType = LocaleContext;
|
|
@@ -354,8 +356,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
354
356
|
sort_serial_number = new Date().getTime();
|
|
355
357
|
|
|
356
358
|
onChange(pagination, filters, sorter, extra) {
|
|
357
|
-
|
|
358
|
-
if (extra.action === "sort") {
|
|
359
|
+
if (extra.action === "sort" && typeof sorter.column?.sorter !== "function") { // 非函数排序处理
|
|
359
360
|
let new_sort_serial_number = new Date().getTime();
|
|
360
361
|
if (new_sort_serial_number - this.sort_serial_number < 2000) {
|
|
361
362
|
const { translate } = this.context;
|
|
@@ -383,6 +384,8 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
383
384
|
});
|
|
384
385
|
}
|
|
385
386
|
this.props.doSearch(extParams);
|
|
387
|
+
} else if (typeof sorter.column?.sorter === "function") {
|
|
388
|
+
this.setState({ localSorter: sorter ? { field: sorter.field, order: sorter.order } : undefined });
|
|
386
389
|
}
|
|
387
390
|
}
|
|
388
391
|
|
|
@@ -446,7 +449,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
446
449
|
showEmpty
|
|
447
450
|
} = this.props;
|
|
448
451
|
//debugger
|
|
449
|
-
const { touchEnd, aggregateVO, loading, virtualEndPageNo, dataSource, errorText } = this.state;
|
|
452
|
+
const { touchEnd, aggregateVO, loading, virtualEndPageNo, dataSource, errorText, localSorter } = this.state;
|
|
450
453
|
const isProSumarryTable = Boolean(subtotalXColumn);
|
|
451
454
|
// 是否是树形表格(存在甘特图视图展示且存在展开关系)
|
|
452
455
|
const isTreeTable = viewModels.includes("ganttChart") && ltmplConfig.gttSubOpenRatmplId;
|
|
@@ -457,7 +460,14 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
457
460
|
} = SummaryBuilder.handleProSummaryTable({ subtotalXColumn, columns, data: this.getUnHidenDataSource(), translate, groupIColumns });
|
|
458
461
|
let current_cols = isProSumarryTable ? proSummaryTableColumns : columns ? columns : [];
|
|
459
462
|
let table_x = 20;
|
|
460
|
-
current_cols.forEach((c) => {
|
|
463
|
+
current_cols.forEach((c) => {
|
|
464
|
+
if (localSorter && localSorter.field === c["dataIndex"]) { // 存在本地排序
|
|
465
|
+
c["sortOrder"] = localSorter.order; // 设置页内排序
|
|
466
|
+
} else if (typeof c["sorter"] === "function") { // 其他页内排序清除
|
|
467
|
+
c["sortOrder"] = null;
|
|
468
|
+
}
|
|
469
|
+
table_x = table_x + (c.width ? c.width : 140);
|
|
470
|
+
});
|
|
461
471
|
let dat = this.getUnHidenDataSource();
|
|
462
472
|
const originData = isProSumarryTable ? proSummaryTableData : dat;
|
|
463
473
|
|