aldehyde 0.2.350 → 0.2.351
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 +6 -3
- package/lib/controls/direct-file-view/index.js.map +1 -1
- package/lib/controls/file-view/index.d.ts.map +1 -1
- package/lib/controls/file-view/index.js +4 -7
- package/lib/controls/file-view/index.js.map +1 -1
- package/lib/custom-page/custom-detail-modal-page.d.ts +18 -0
- package/lib/custom-page/custom-detail-modal-page.d.ts.map +1 -0
- package/lib/custom-page/custom-detail-modal-page.js +21 -0
- package/lib/custom-page/custom-detail-modal-page.js.map +1 -0
- package/lib/layout3/css/main.css +23 -0
- package/lib/layout4/css/main.css +24 -0
- package/lib/list/card-list/card-list-item.d.ts +13 -0
- package/lib/list/card-list/card-list-item.d.ts.map +1 -0
- package/lib/list/card-list/card-list-item.js +80 -0
- package/lib/list/card-list/card-list-item.js.map +1 -0
- package/lib/list/card-list/index.css +144 -0
- package/lib/list/card-list/index.d.ts +13 -0
- package/lib/list/card-list/index.d.ts.map +1 -0
- package/lib/list/card-list/index.js +21 -0
- package/lib/list/card-list/index.js.map +1 -0
- package/lib/routable/ltmpl-route.d.ts +1 -0
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +11 -5
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +9 -9
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.js +1 -1
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/query-table.d.ts +1 -0
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +22 -26
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +2 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/tmpl/interface.d.ts +27 -2
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/welcome/HCWelcome.js +3 -2
- package/lib/welcome/HCWelcome.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/direct-file-view/index.tsx +5 -3
- package/src/aldehyde/controls/file-view/index.tsx +30 -33
- package/src/aldehyde/custom-page/custom-detail-modal-page.tsx +52 -0
- package/src/aldehyde/layout3/css/main.css +23 -0
- package/src/aldehyde/layout4/css/main.css +24 -0
- package/src/aldehyde/list/card-list/card-list-item.tsx +111 -0
- package/src/aldehyde/list/card-list/index.css +144 -0
- package/src/aldehyde/list/card-list/index.tsx +37 -0
- package/src/aldehyde/routable/ltmpl-route.tsx +94 -97
- package/src/aldehyde/table/act-table.tsx +11 -7
- package/src/aldehyde/table/column/column-builder.tsx +1 -1
- package/src/aldehyde/table/query-table.tsx +138 -137
- package/src/aldehyde/tmpl/interface.tsx +29 -2
- package/src/aldehyde/welcome/HCWelcome.js +3 -2
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { useLocale } from "../../locale/useLocale";
|
|
3
|
+
import { Card, Row, Col, Empty } from "antd";
|
|
4
|
+
import ViewControl from "../../controls/view-control";
|
|
5
|
+
import { CardListConfig } from "../../tmpl/interface";
|
|
6
|
+
import CustomDetailModalPage from "../../custom-page/custom-detail-modal-page";
|
|
7
|
+
import "./index.css";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
cardListConfig?: CardListConfig;
|
|
11
|
+
item?: any;
|
|
12
|
+
renderOpt?: React.ReactNode;
|
|
13
|
+
serverKey?: string;
|
|
14
|
+
sourceId?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const dataKeys = ["primaryColumn", "primaryColumnLabel", "secondColumn", "secondColumnLabel", "cardShowCols", "labelColumn", "mainPicture", "mainPictureLabel"];
|
|
18
|
+
|
|
19
|
+
const Index = (props: Props) => {
|
|
20
|
+
const { cardListConfig, item, renderOpt, serverKey, sourceId } = props;
|
|
21
|
+
const { buttons, customViewPagePath, mainCode } = cardListConfig;
|
|
22
|
+
const { translate } = useLocale();
|
|
23
|
+
const [data, setData] = useState({});
|
|
24
|
+
const [detailOpen, setDetailOpen] = useState<boolean>(false);
|
|
25
|
+
|
|
26
|
+
const handleData = (type: string) => {
|
|
27
|
+
const itemConfig = cardListConfig[type];
|
|
28
|
+
if (!itemConfig) {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
if (type === "cardShowCols") {
|
|
32
|
+
return itemConfig.map(r => {
|
|
33
|
+
const value = item[r.id];
|
|
34
|
+
const element = <ViewControl serverKey={serverKey} holderType="table" value={value} fieldConfig={r} />;
|
|
35
|
+
const title = r.title;
|
|
36
|
+
return { element, value, title };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const value = item[itemConfig.id];
|
|
40
|
+
const element = <ViewControl serverKey={serverKey} holderType="table" value={value} fieldConfig={type === "mainPicture" ? { ...itemConfig, preview: false } : itemConfig} />;
|
|
41
|
+
const title = itemConfig.title;
|
|
42
|
+
return { element, value, title };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (cardListConfig && item) {
|
|
47
|
+
const temData = dataKeys.reduce((total, next) => {
|
|
48
|
+
total[next] = handleData(next);
|
|
49
|
+
return total;
|
|
50
|
+
}, {});
|
|
51
|
+
setData(temData);
|
|
52
|
+
}
|
|
53
|
+
}, [cardListConfig, item]);
|
|
54
|
+
|
|
55
|
+
const onClickDetail = () => {
|
|
56
|
+
if (!buttons.some(r => ["customDetail", "detail"].includes(r)) || !customViewPagePath) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
setDetailOpen(true);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Card className="card-list-item" styles={{ body: { height: "100%", padding: "0 12px 12px" } }} >
|
|
64
|
+
<div className="card-list-item-body">
|
|
65
|
+
<div className="card-list-item-content">
|
|
66
|
+
<div className="card-list-item-head">
|
|
67
|
+
<div className="card-list-item-head-title">
|
|
68
|
+
{data["primaryColumn"] ?
|
|
69
|
+
<div className="card-list-item-head-primary">
|
|
70
|
+
<div className="primary-column">{data["primaryColumn"]?.element}</div>
|
|
71
|
+
<div className="primary-column-label">{data["primaryColumnLabel"]?.element}</div>
|
|
72
|
+
</div>
|
|
73
|
+
: ""}
|
|
74
|
+
<div className="label-column">{data["labelColumn"]?.element}</div>
|
|
75
|
+
</div>
|
|
76
|
+
<div className="card-list-item-head-title">
|
|
77
|
+
{data["secondColumn"] ?
|
|
78
|
+
<div className="card-list-item-head-second">
|
|
79
|
+
<div className="second-column">{data["secondColumn"].value ? data["secondColumn"]?.element : "-"}</div>
|
|
80
|
+
<div className="second-column-label">{data["secondColumnLabel"]?.element}</div>
|
|
81
|
+
</div>
|
|
82
|
+
: ""}
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div className="card-list-item-main" onClick={onClickDetail}>
|
|
86
|
+
{data["mainPicture"] ? <div className="card-main-picture">
|
|
87
|
+
{data["mainPicture"].value ? data["mainPicture"].element : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无图片" />}
|
|
88
|
+
<div className="card-main-picture-label">{data["mainPictureLabel"].element}</div>
|
|
89
|
+
</div> : ""}
|
|
90
|
+
{data["cardShowCols"] ?
|
|
91
|
+
<div className="card-show-cols">
|
|
92
|
+
<Row gutter={6}>
|
|
93
|
+
{data["cardShowCols"].map((col, index) => // 卡片展示字段是两个,则右侧对齐
|
|
94
|
+
<Col className="card-show-col" span={12} key={index} style={data["cardShowCols"].length < 3 && index % 2 ? { justifyContent: "flex-end" } : {}}>
|
|
95
|
+
<div className="card-show-col-title">{translate("${" + col.title + "}")}:</div>
|
|
96
|
+
<div className="card-show-col-value">{col.value || col.value === 0 ? col.element : "-"}</div>
|
|
97
|
+
</Col>)
|
|
98
|
+
}
|
|
99
|
+
</Row>
|
|
100
|
+
</div> : ""}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
<div className="card-list-item-footer">
|
|
104
|
+
{renderOpt}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
{detailOpen ? <CustomDetailModalPage width={1000} minHeight="70vh" mainCode={mainCode} sourceId={sourceId} code={item.code} customPath={customViewPagePath} open={detailOpen} onCancel={() => { setDetailOpen(false) }} /> : ""}
|
|
108
|
+
</Card >);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default Index;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
.card-list {
|
|
2
|
+
margin-top: 6px;
|
|
3
|
+
|
|
4
|
+
.card-list-item {
|
|
5
|
+
height: calc(100% - 14px);
|
|
6
|
+
|
|
7
|
+
.card-list-item-body {
|
|
8
|
+
height: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
align-content: space-between;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.card-list-item-content {
|
|
16
|
+
width: 100%;
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
align-content: space-between;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.card-list-item-head {
|
|
26
|
+
width: 100%;
|
|
27
|
+
margin: 12px 0;
|
|
28
|
+
|
|
29
|
+
.card-list-item-head-title {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
align-items: center;
|
|
33
|
+
width: 100%;
|
|
34
|
+
|
|
35
|
+
.card-list-item-head-primary,
|
|
36
|
+
.card-list-item-head-second {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
position: relative;
|
|
40
|
+
max-width: 70%;
|
|
41
|
+
min-height: 32px;
|
|
42
|
+
|
|
43
|
+
.primary-column,
|
|
44
|
+
.second-column {
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
font-size: 20px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.second-column {
|
|
53
|
+
font-size: 16px;
|
|
54
|
+
font-weight: normal;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.primary-column-label,
|
|
58
|
+
.second-column-label {
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
right: -4px;
|
|
62
|
+
transform: translate(100%, -30%);
|
|
63
|
+
|
|
64
|
+
.ant-tag {
|
|
65
|
+
font-size: 10px;
|
|
66
|
+
padding: 0 4px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.second-column-label {
|
|
71
|
+
.ant-tag {
|
|
72
|
+
font-size: 8px;
|
|
73
|
+
padding: 3px;
|
|
74
|
+
line-height: normal;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.card-list-item-head-second {
|
|
80
|
+
margin-top: 6px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.card-list-item-main {
|
|
86
|
+
width: 100%;
|
|
87
|
+
min-height: 100px;
|
|
88
|
+
margin-bottom: 12px;
|
|
89
|
+
background-color: #f5f5f5;
|
|
90
|
+
flex-grow: 1;
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-wrap: wrap;
|
|
93
|
+
align-content: space-between;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
|
|
97
|
+
.card-main-picture {
|
|
98
|
+
width: 100%;
|
|
99
|
+
min-height: 200px;
|
|
100
|
+
display: flex;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
align-items: center;
|
|
103
|
+
position: relative;
|
|
104
|
+
flex-grow: 1;
|
|
105
|
+
|
|
106
|
+
.ant-image {
|
|
107
|
+
width: 100% !important;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.card-main-picture-label {
|
|
111
|
+
position: absolute;
|
|
112
|
+
top: 6px;
|
|
113
|
+
right: 12px;
|
|
114
|
+
color: var(--ant-color-primary);
|
|
115
|
+
font-size: 16px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.card-show-cols {
|
|
120
|
+
padding: 6px 12px;
|
|
121
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.card-show-col {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
|
|
128
|
+
.card-show-col-title {
|
|
129
|
+
margin-right: 6px;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.card-show-col-value {
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
white-space: nowrap;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.card-list-item-footer {
|
|
142
|
+
width: 100%;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Col, Row } from "antd";
|
|
3
|
+
import { CardListConfig } from "../../tmpl/interface";
|
|
4
|
+
import CardListItem from "./card-list-item";
|
|
5
|
+
import "./index.css";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
cardListConfig?: CardListConfig;
|
|
9
|
+
dataSource?: object[];
|
|
10
|
+
columns?: any[];
|
|
11
|
+
serverKey?: string;
|
|
12
|
+
sourceId?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Index = (props: Props) => {
|
|
16
|
+
const { cardListConfig, dataSource, columns, serverKey, sourceId } = props;
|
|
17
|
+
|
|
18
|
+
const renderOpt = (item: unknown) => {
|
|
19
|
+
const actionCol = columns.find(col => col["操作"] == 1);
|
|
20
|
+
return actionCol?.render(item, item);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const colFlex = useMemo(() => {
|
|
24
|
+
const rowCardCount = cardListConfig?.rowCardCount || 5;
|
|
25
|
+
const flex = Math.floor((100 / rowCardCount) * 100) / 100;
|
|
26
|
+
return `${flex}%`;
|
|
27
|
+
}, [cardListConfig]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="card-list">
|
|
31
|
+
<Row gutter={[12, 12]}>
|
|
32
|
+
{dataSource?.map((item, index) => <Col style={{ minWidth: 0 }} key={`col-${index}`} xl={{ flex: colFlex }} lg={{ flex: "25%" }} sm={{ flex: "50%" }}><CardListItem cardListConfig={cardListConfig} item={item} renderOpt={renderOpt(item)} serverKey={serverKey} sourceId={sourceId} /></Col>)}
|
|
33
|
+
</Row>
|
|
34
|
+
</div>);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default Index;
|