@doubao-apps/template 0.0.31 → 0.0.32
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/README.md +231 -109
- package/assets/order-card.png +0 -0
- package/assets/product-action-card.png +0 -0
- package/assets/ticket-order-card.png +0 -0
- package/assets/transport-card.png +0 -0
- package/assets/transport-list-card.png +0 -0
- package/dist/components/action-bar/index.d.ts +19 -0
- package/dist/components/action-bar/index.js +15 -0
- package/dist/components/action-bar/styles.css +30 -0
- package/dist/components/info-section/index.d.ts +47 -0
- package/dist/components/info-section/index.js +93 -0
- package/dist/components/info-section/styles.css +140 -0
- package/dist/components/product-summary/index.d.ts +24 -0
- package/dist/components/product-summary/index.js +51 -0
- package/dist/components/product-summary/styles.css +125 -0
- package/dist/components/route-section/index.d.ts +23 -0
- package/dist/components/route-section/index.js +38 -0
- package/dist/components/route-section/styles.css +58 -0
- package/dist/components/title-bar/index.d.ts +11 -0
- package/dist/components/title-bar/index.js +32 -0
- package/dist/components/title-bar/styles.css +69 -0
- package/dist/components/transport-summary/index.d.ts +31 -0
- package/dist/components/transport-summary/index.js +104 -0
- package/dist/components/transport-summary/styles.css +182 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/invalid-card/index.js +2 -20
- package/dist/invalid-card/styles.css +1 -65
- package/dist/list-card/index.d.ts +3 -2
- package/dist/list-card/index.js +2 -20
- package/dist/list-card/styles.css +0 -72
- package/dist/order-card/index.d.ts +7 -6
- package/dist/order-card/index.js +9 -106
- package/dist/order-card/styles.css +6 -368
- package/dist/product-action-card/index.d.ts +40 -0
- package/dist/product-action-card/index.js +17 -0
- package/dist/product-action-card/styles.css +20 -0
- package/dist/ticket-order-card/index.d.ts +78 -0
- package/dist/ticket-order-card/index.js +27 -0
- package/dist/ticket-order-card/styles.css +18 -0
- package/dist/transport-card/index.d.ts +36 -0
- package/dist/transport-card/index.js +15 -0
- package/dist/transport-card/styles.css +21 -0
- package/dist/transport-list-card/index.d.ts +56 -0
- package/dist/transport-list-card/index.js +32 -0
- package/dist/transport-list-card/styles.css +60 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +0 -0
- package/dist/utils/app-info.js +1 -2
- package/package.json +2 -6
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
const TRANSPORT_SUMMARY_ARROW_SVG_CONTENT = `<svg width="40" height="7" viewBox="0 0 40 7" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path opacity="0.3" d="M39.3024 3.12395C39.4852 3.22251 39.4152 3.5 39.2075 3.5H0.2C0.0895431 3.5 0 3.41046 0 3.3V2.6667C0 2.55624 0.0895431 2.4667 0.2 2.4667H34.4344V0.835011C34.4344 0.683637 34.5961 0.587134 34.7293 0.658959L39.3024 3.12395Z" fill="#999999"/>
|
|
5
|
+
</svg>`;
|
|
6
|
+
const TRANSPORT_SUMMARY_DOT_ARROW_SVG_CONTENT = `<svg width="40" height="7" viewBox="0 0 40 7" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
|
+
<path opacity="0.3" d="M39.3024 3.12395C39.4852 3.22251 39.4152 3.5 39.2075 3.5H0.2C0.0895431 3.5 0 3.41046 0 3.3V2.6667C0 2.55624 0.0895431 2.4667 0.2 2.4667H34.4344V0.835011C34.4344 0.683637 34.5961 0.587134 34.7293 0.658959L39.3024 3.12395Z" fill="#999999"/>
|
|
8
|
+
<circle cx="19.5" cy="3" r="2.5" fill="#D9D9D9" stroke="white"/>
|
|
9
|
+
</svg>`;
|
|
10
|
+
function isTemplateTransportSummaryNodeEmpty(content) {
|
|
11
|
+
return null == content || 'boolean' == typeof content || '' === content;
|
|
12
|
+
}
|
|
13
|
+
function isTemplateTransportSummaryTextEmpty(content) {
|
|
14
|
+
return null == content || '' === content;
|
|
15
|
+
}
|
|
16
|
+
function renderTemplateTransportSummaryNodeField(content, wrapperClassName, textClassName) {
|
|
17
|
+
if (isTemplateTransportSummaryNodeEmpty(content)) return null;
|
|
18
|
+
return <view className={wrapperClassName}>
|
|
19
|
+
{'string' == typeof content || 'number' == typeof content ? <text className={textClassName} text-maxline="1">
|
|
20
|
+
{content}
|
|
21
|
+
</text> : content}
|
|
22
|
+
</view>;
|
|
23
|
+
}
|
|
24
|
+
function renderTemplateTransportSummaryTextField(content, wrapperClassName, textClassName) {
|
|
25
|
+
if (isTemplateTransportSummaryTextEmpty(content)) return null;
|
|
26
|
+
return <view className={wrapperClassName}>
|
|
27
|
+
<text className={textClassName} text-maxline="1">
|
|
28
|
+
{content}
|
|
29
|
+
</text>
|
|
30
|
+
</view>;
|
|
31
|
+
}
|
|
32
|
+
function TemplateTransportSummaryArrowIcon({ showDot }) {
|
|
33
|
+
return <svg className="doubao-template-transport-summary__transfer-arrow-icon" content={showDot ? TRANSPORT_SUMMARY_DOT_ARROW_SVG_CONTENT : TRANSPORT_SUMMARY_ARROW_SVG_CONTENT}/>;
|
|
34
|
+
}
|
|
35
|
+
function renderTemplateTransportSummaryPoint({ mainText, subText, isArrival }) {
|
|
36
|
+
if (isTemplateTransportSummaryTextEmpty(mainText) && isTemplateTransportSummaryTextEmpty(subText)) return null;
|
|
37
|
+
return <view className={clsx('doubao-template-transport-summary__route-point', isArrival && 'doubao-template-transport-summary__route-point--arrival')}>
|
|
38
|
+
{renderTemplateTransportSummaryTextField(mainText, 'doubao-template-transport-summary__route-point-main', 'doubao-template-transport-summary__route-point-main-text')}
|
|
39
|
+
{renderTemplateTransportSummaryTextField(subText, 'doubao-template-transport-summary__route-point-sub', 'doubao-template-transport-summary__route-point-sub-text')}
|
|
40
|
+
</view>;
|
|
41
|
+
}
|
|
42
|
+
function renderTemplateTransportSummaryArrivalDayOffset(content) {
|
|
43
|
+
if (isTemplateTransportSummaryTextEmpty(content)) return null;
|
|
44
|
+
return <text className="doubao-template-transport-summary__arrival-day-offset" text-maxline="1">
|
|
45
|
+
{content}
|
|
46
|
+
</text>;
|
|
47
|
+
}
|
|
48
|
+
function renderTemplateTransportSummaryTransfer({ content, topText, showDot, bottomText }) {
|
|
49
|
+
if (void 0 !== content) {
|
|
50
|
+
if (isTemplateTransportSummaryNodeEmpty(content)) return null;
|
|
51
|
+
if ('string' == typeof content || 'number' == typeof content) return renderTemplateTransportSummaryNodeField(content, 'doubao-template-transport-summary__transfer', 'doubao-template-transport-summary__transfer-label-text');
|
|
52
|
+
return content;
|
|
53
|
+
}
|
|
54
|
+
if (isTemplateTransportSummaryTextEmpty(topText) && !showDot && isTemplateTransportSummaryTextEmpty(bottomText)) return null;
|
|
55
|
+
return <view className="doubao-template-transport-summary__transfer">
|
|
56
|
+
<view className="doubao-template-transport-summary__transfer-inner">
|
|
57
|
+
{renderTemplateTransportSummaryTextField(topText, 'doubao-template-transport-summary__transfer-label', 'doubao-template-transport-summary__transfer-label-text')}
|
|
58
|
+
<view className="doubao-template-transport-summary__transfer-arrow">
|
|
59
|
+
<TemplateTransportSummaryArrowIcon showDot={showDot}/>
|
|
60
|
+
</view>
|
|
61
|
+
{renderTemplateTransportSummaryTextField(bottomText, 'doubao-template-transport-summary__transfer-label', 'doubao-template-transport-summary__transfer-label-text')}
|
|
62
|
+
</view>
|
|
63
|
+
</view>;
|
|
64
|
+
}
|
|
65
|
+
function TemplateTransportSummary(props) {
|
|
66
|
+
const { title, departureMain, departureSub, transfer, transferTop, showTransferDot, transferBottom, arrivalMain, arrivalDayOffset, arrivalSub, price, className } = props;
|
|
67
|
+
const departureNode = renderTemplateTransportSummaryPoint({
|
|
68
|
+
mainText: departureMain,
|
|
69
|
+
subText: departureSub
|
|
70
|
+
});
|
|
71
|
+
const transferNode = renderTemplateTransportSummaryTransfer({
|
|
72
|
+
content: transfer,
|
|
73
|
+
topText: transferTop,
|
|
74
|
+
showDot: showTransferDot,
|
|
75
|
+
bottomText: transferBottom
|
|
76
|
+
});
|
|
77
|
+
const arrivalPointNode = renderTemplateTransportSummaryPoint({
|
|
78
|
+
mainText: arrivalMain,
|
|
79
|
+
subText: arrivalSub,
|
|
80
|
+
isArrival: true
|
|
81
|
+
});
|
|
82
|
+
const arrivalDayOffsetNode = null == arrivalPointNode ? null : renderTemplateTransportSummaryArrivalDayOffset(arrivalDayOffset);
|
|
83
|
+
const arrivalNode = null == arrivalPointNode ? null : <view className="doubao-template-transport-summary__arrival">
|
|
84
|
+
{arrivalPointNode}
|
|
85
|
+
{arrivalDayOffsetNode}
|
|
86
|
+
</view>;
|
|
87
|
+
const titleNode = renderTemplateTransportSummaryNodeField(title, 'doubao-template-transport-summary__title', 'doubao-template-transport-summary__title-text');
|
|
88
|
+
const priceNode = renderTemplateTransportSummaryNodeField(price, 'doubao-template-transport-summary__price', 'doubao-template-transport-summary__price-text');
|
|
89
|
+
const hasRoute = Boolean(departureNode || transferNode || arrivalNode);
|
|
90
|
+
const hasRouteRow = Boolean(hasRoute || priceNode);
|
|
91
|
+
if (null == titleNode && !hasRouteRow) return null;
|
|
92
|
+
return <view className={clsx('doubao-template-transport-summary', className)}>
|
|
93
|
+
{titleNode}
|
|
94
|
+
{hasRouteRow ? <view className="doubao-template-transport-summary__route-row">
|
|
95
|
+
{hasRoute ? <view className="doubao-template-transport-summary__route">
|
|
96
|
+
{departureNode}
|
|
97
|
+
{transferNode}
|
|
98
|
+
{arrivalNode}
|
|
99
|
+
</view> : null}
|
|
100
|
+
{priceNode}
|
|
101
|
+
</view> : null}
|
|
102
|
+
</view>;
|
|
103
|
+
}
|
|
104
|
+
export { TemplateTransportSummary };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
.doubao-template-transport-summary {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: flex-start;
|
|
5
|
+
width: 100%;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
padding: 12px 12px 18px;
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.doubao-template-transport-summary__title, .doubao-template-transport-summary__route-point-main, .doubao-template-transport-summary__route-point-sub, .doubao-template-transport-summary__transfer-label, .doubao-template-transport-summary__price {
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
align-items: center;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
display: flex;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.doubao-template-transport-summary__title {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.doubao-template-transport-summary__title-text, .doubao-template-transport-summary__route-point-main-text, .doubao-template-transport-summary__arrival-day-offset, .doubao-template-transport-summary__route-point-sub-text, .doubao-template-transport-summary__transfer-label-text, .doubao-template-transport-summary__price-text {
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
font-family: PingFang SC, sans-serif;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.doubao-template-transport-summary__title-text {
|
|
34
|
+
color: var(--neutral-50);
|
|
35
|
+
font-size: 11px;
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
line-height: 16px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.doubao-template-transport-summary__route-row {
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
align-items: center;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: auto;
|
|
46
|
+
margin-top: 4px;
|
|
47
|
+
display: flex;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.doubao-template-transport-summary__route {
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
align-items: center;
|
|
53
|
+
width: 200px;
|
|
54
|
+
height: 36px;
|
|
55
|
+
display: flex;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.doubao-template-transport-summary__route-point {
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
width: 66px;
|
|
62
|
+
min-width: 0;
|
|
63
|
+
height: 100%;
|
|
64
|
+
display: flex;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.doubao-template-transport-summary__route-point--arrival {
|
|
68
|
+
align-items: flex-end;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.doubao-template-transport-summary__arrival {
|
|
72
|
+
flex-shrink: 0;
|
|
73
|
+
width: 66px;
|
|
74
|
+
min-width: 0;
|
|
75
|
+
height: 100%;
|
|
76
|
+
display: flex;
|
|
77
|
+
position: relative;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.doubao-template-transport-summary__arrival .doubao-template-transport-summary__route-point {
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.doubao-template-transport-summary__route-point-main, .doubao-template-transport-summary__route-point-sub {
|
|
86
|
+
width: 100%;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-main, .doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-sub {
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-main-text, .doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-sub-text {
|
|
94
|
+
text-align: right;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.doubao-template-transport-summary__route-point-main, .doubao-template-transport-summary__route-point-sub {
|
|
98
|
+
height: 20px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.doubao-template-transport-summary__route-point-main-text {
|
|
102
|
+
min-width: 0;
|
|
103
|
+
color: var(--neutral-100);
|
|
104
|
+
font-size: 18px;
|
|
105
|
+
font-weight: 700;
|
|
106
|
+
line-height: 22px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.doubao-template-transport-summary__arrival-day-offset {
|
|
110
|
+
color: var(--neutral-100);
|
|
111
|
+
margin-left: 2px;
|
|
112
|
+
font-size: 11px;
|
|
113
|
+
font-weight: 400;
|
|
114
|
+
line-height: 14px;
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: 0;
|
|
117
|
+
left: 100%;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.doubao-template-transport-summary__route-point-sub-text, .doubao-template-transport-summary__transfer-label-text {
|
|
121
|
+
color: var(--neutral-50);
|
|
122
|
+
font-size: 12px;
|
|
123
|
+
font-weight: 400;
|
|
124
|
+
line-height: 18px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.doubao-template-transport-summary__transfer {
|
|
128
|
+
box-sizing: border-box;
|
|
129
|
+
flex-direction: row;
|
|
130
|
+
flex: none;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;
|
|
133
|
+
width: 42px;
|
|
134
|
+
min-width: 0;
|
|
135
|
+
margin: auto 8px;
|
|
136
|
+
display: flex;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.doubao-template-transport-summary__transfer-inner {
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
align-items: center;
|
|
143
|
+
width: 52px;
|
|
144
|
+
min-width: 0;
|
|
145
|
+
height: 38px;
|
|
146
|
+
display: flex;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.doubao-template-transport-summary__transfer-label {
|
|
150
|
+
height: 14px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.doubao-template-transport-summary__transfer-arrow {
|
|
154
|
+
flex-direction: row;
|
|
155
|
+
flex-shrink: 0;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
align-items: center;
|
|
158
|
+
width: 40px;
|
|
159
|
+
height: 7px;
|
|
160
|
+
display: flex;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.doubao-template-transport-summary__transfer-arrow-icon {
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
width: 40px;
|
|
166
|
+
height: 7px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.doubao-template-transport-summary__price {
|
|
170
|
+
box-sizing: border-box;
|
|
171
|
+
justify-content: flex-end;
|
|
172
|
+
width: 80px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.doubao-template-transport-summary__price-text {
|
|
176
|
+
color: var(--primary-50);
|
|
177
|
+
text-align: right;
|
|
178
|
+
font-size: 17px;
|
|
179
|
+
font-weight: 700;
|
|
180
|
+
line-height: 17px;
|
|
181
|
+
}
|
|
182
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export { ListCard, type ListCardItem, type ListCardProps } from './list-card/index.js';
|
|
2
2
|
export { InvalidCard, type InvalidCardProps } from './invalid-card/index.js';
|
|
3
3
|
export { OrderCard, type OrderCardFeeItem, type OrderCardInfoItem, type OrderCardProps } from './order-card/index.js';
|
|
4
|
+
export { ProductActionCard, type ProductActionCardProps } from './product-action-card/index.js';
|
|
5
|
+
export { TransportListCard, type TransportListCardItem, type TransportListCardProps } from './transport-list-card/index.js';
|
|
6
|
+
export { TransportCard, type TransportCardProps } from './transport-card/index.js';
|
|
7
|
+
export type { TemplateKey, TemplateText } from './types.js';
|
|
8
|
+
export { TicketOrderCard, type TicketOrderCardFeeItem, type TicketOrderCardInfoItem, type TicketOrderCardProps, type TicketOrderCardRouteItem } from './ticket-order-card/index.js';
|
|
4
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { ListCard } from "./list-card/index.js";
|
|
2
2
|
export { InvalidCard } from "./invalid-card/index.js";
|
|
3
3
|
export { OrderCard } from "./order-card/index.js";
|
|
4
|
+
export { ProductActionCard } from "./product-action-card/index.js";
|
|
5
|
+
export { TransportListCard } from "./transport-list-card/index.js";
|
|
6
|
+
export { TransportCard } from "./transport-card/index.js";
|
|
7
|
+
export { TicketOrderCard } from "./ticket-order-card/index.js";
|
|
@@ -1,29 +1,11 @@
|
|
|
1
1
|
import { useThemeClassName } from "@byted-doubao-apps/components";
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
|
-
import {
|
|
3
|
+
import { TemplateTitleBar } from "../components/title-bar/index.js";
|
|
4
4
|
import "./styles.css";
|
|
5
|
-
function InvalidCardIcon({ appIconSrc }) {
|
|
6
|
-
if (null != appIconSrc && appIconSrc.length > 0) return <image className="doubao-invalid-card__app-icon" src={appIconSrc} mode="aspectFill"/>;
|
|
7
|
-
return <view className="doubao-invalid-card__app-icon"/>;
|
|
8
|
-
}
|
|
9
5
|
function InvalidCard(props) {
|
|
10
6
|
const { title = '任务状态已更新', className, style, onClick } = props;
|
|
11
|
-
const appInfo = getAppInfo();
|
|
12
7
|
return <view className={useThemeClassName(clsx('doubao-invalid-card', className))} style={style} bindtap={onClick} clip-radius="true">
|
|
13
|
-
<
|
|
14
|
-
<view className="doubao-invalid-card__app">
|
|
15
|
-
<InvalidCardIcon appIconSrc={appInfo.appIconSrc}/>
|
|
16
|
-
<text className="doubao-invalid-card__app-name" text-maxline="1">
|
|
17
|
-
{appInfo.appName}
|
|
18
|
-
</text>
|
|
19
|
-
</view>
|
|
20
|
-
<view className="doubao-invalid-card__more-placeholder">
|
|
21
|
-
<text className="doubao-invalid-card__more-text" text-maxline="1">
|
|
22
|
-
更多
|
|
23
|
-
</text>
|
|
24
|
-
<view className="doubao-invalid-card__more-chevron"/>
|
|
25
|
-
</view>
|
|
26
|
-
</view>
|
|
8
|
+
<TemplateTitleBar reserveMore/>
|
|
27
9
|
<view className="doubao-invalid-card__content">
|
|
28
10
|
<view className="doubao-invalid-card__title-wrap">
|
|
29
11
|
<text className="doubao-invalid-card__title" text-maxline="1">
|
|
@@ -10,77 +10,13 @@
|
|
|
10
10
|
overflow: hidden;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.doubao-invalid-
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
border-bottom: .5px solid var(--neutral-transparent-1);
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
justify-content: space-between;
|
|
18
|
-
align-items: center;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 40px;
|
|
21
|
-
padding: 0 16px;
|
|
22
|
-
display: flex;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.doubao-invalid-card__app {
|
|
26
|
-
flex-direction: row;
|
|
27
|
-
align-items: center;
|
|
28
|
-
min-width: 0;
|
|
29
|
-
display: flex;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.doubao-invalid-card__app-icon {
|
|
33
|
-
background-color: var(--neutral-30);
|
|
34
|
-
border-radius: 4px;
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
width: 16px;
|
|
37
|
-
height: 16px;
|
|
38
|
-
overflow: hidden;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.doubao-invalid-card__app-name, .doubao-invalid-card__more-text {
|
|
42
|
-
color: var(--neutral-50);
|
|
43
|
-
text-overflow: ellipsis;
|
|
44
|
-
white-space: nowrap;
|
|
45
|
-
font-family: PingFang SC, sans-serif;
|
|
46
|
-
font-size: 12px;
|
|
47
|
-
font-style: normal;
|
|
48
|
-
line-height: 18px;
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.doubao-invalid-card__app-name {
|
|
53
|
-
margin-left: 6px;
|
|
54
|
-
font-weight: 500;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.doubao-invalid-card__more-placeholder {
|
|
58
|
-
opacity: 0;
|
|
59
|
-
flex-direction: row;
|
|
60
|
-
flex-shrink: 0;
|
|
61
|
-
justify-content: flex-end;
|
|
62
|
-
align-items: center;
|
|
63
|
-
width: 62.5px;
|
|
64
|
-
display: flex;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.doubao-invalid-card__more-text {
|
|
68
|
-
font-weight: 400;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.doubao-invalid-card__more-chevron, .doubao-invalid-card__content-chevron {
|
|
13
|
+
.doubao-invalid-card__content-chevron {
|
|
72
14
|
box-sizing: border-box;
|
|
73
15
|
width: 7px;
|
|
74
16
|
height: 7px;
|
|
75
17
|
transform: rotate(45deg);
|
|
76
18
|
}
|
|
77
19
|
|
|
78
|
-
.doubao-invalid-card__more-chevron {
|
|
79
|
-
border-top: 1px solid var(--neutral-50);
|
|
80
|
-
border-right: 1px solid var(--neutral-50);
|
|
81
|
-
margin-left: 2px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
20
|
.doubao-invalid-card__content {
|
|
85
21
|
box-sizing: border-box;
|
|
86
22
|
background-color: var(--bg-base-1);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, TouchEvent } from '@lynx-js/types';
|
|
2
2
|
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import type { TemplateKey, TemplateText } from '../types.js';
|
|
3
4
|
import './styles.scss';
|
|
4
5
|
export interface ListCardProps {
|
|
5
6
|
/** 标题栏右侧「更多」入口的文案。 */
|
|
@@ -25,11 +26,11 @@ export interface ListCardProps {
|
|
|
25
26
|
}
|
|
26
27
|
export interface ListCardItem {
|
|
27
28
|
/** 列表项唯一标识;不传时使用数组下标。 */
|
|
28
|
-
key?:
|
|
29
|
+
key?: TemplateKey;
|
|
29
30
|
/** 列表项标题。 */
|
|
30
31
|
title?: string;
|
|
31
32
|
/** 列表项价格。 */
|
|
32
|
-
price?:
|
|
33
|
+
price?: TemplateText;
|
|
33
34
|
/** 列表项价格单位。 */
|
|
34
35
|
priceUnit?: string;
|
|
35
36
|
/** 列表项描述。 */
|
package/dist/list-card/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Button, useThemeClassName } from "@byted-doubao-apps/components";
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
|
-
import {
|
|
3
|
+
import { TemplateTitleBar } from "../components/title-bar/index.js";
|
|
4
4
|
import "./styles.css";
|
|
5
|
-
function ListCardIcon({ appIconSrc }) {
|
|
6
|
-
if (null != appIconSrc && appIconSrc.length > 0) return <image className="doubao-list-card__app-icon" src={appIconSrc} mode="aspectFill"/>;
|
|
7
|
-
return <view className="doubao-list-card__app-icon"/>;
|
|
8
|
-
}
|
|
9
5
|
function ListCardImage(props) {
|
|
10
6
|
const { image: image1, imageSrc } = props;
|
|
11
7
|
if (null != image1) return <view className="doubao-list-card__image">{image1}</view>;
|
|
@@ -47,25 +43,11 @@ function ListCardProductItem({ item, isLast }) {
|
|
|
47
43
|
}
|
|
48
44
|
function ListCard(props) {
|
|
49
45
|
const { moreText, showMore = true, items, viewMoreText = '查看更多', children, className, style, onClick, onMoreClick, onViewMoreClick } = props;
|
|
50
|
-
const appInfo = getAppInfo();
|
|
51
46
|
const contentItems = items ?? [];
|
|
52
47
|
const shouldShowViewMore = null == children && null != items && contentItems.length > 4;
|
|
53
48
|
const visibleItems = shouldShowViewMore ? contentItems.slice(0, 4) : contentItems;
|
|
54
49
|
return <view className={useThemeClassName(clsx('doubao-list-card', className))} style={style} bindtap={onClick} clip-radius="true">
|
|
55
|
-
<
|
|
56
|
-
<view className="doubao-list-card__app">
|
|
57
|
-
<ListCardIcon appIconSrc={appInfo.appIconSrc}/>
|
|
58
|
-
<text className="doubao-list-card__app-name" text-maxline="1">
|
|
59
|
-
{appInfo.appName}
|
|
60
|
-
</text>
|
|
61
|
-
</view>
|
|
62
|
-
{showMore && null != moreText && moreText.length > 0 ? <view className="doubao-list-card__more" catchtap={onMoreClick}>
|
|
63
|
-
<text className="doubao-list-card__more-text" text-maxline="1">
|
|
64
|
-
{moreText}
|
|
65
|
-
</text>
|
|
66
|
-
<view className="doubao-list-card__more-chevron"/>
|
|
67
|
-
</view> : null}
|
|
68
|
-
</view>
|
|
50
|
+
<TemplateTitleBar moreText={moreText} showMore={showMore} onMoreClick={onMoreClick}/>
|
|
69
51
|
<view className="doubao-list-card__body">
|
|
70
52
|
{children ?? visibleItems.map((item, index)=><ListCardProductItem key={item.key ?? index} item={item} isLast={index === visibleItems.length - 1}/>)}
|
|
71
53
|
{shouldShowViewMore ? <view className="doubao-list-card__view-more-wrap">
|
|
@@ -10,78 +10,6 @@
|
|
|
10
10
|
overflow: hidden;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.doubao-list-card__title-bar {
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
border-bottom: .5px solid var(--neutral-transparent-1);
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
justify-content: space-between;
|
|
18
|
-
align-items: center;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 40px;
|
|
21
|
-
padding: 0 16px;
|
|
22
|
-
display: flex;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.doubao-list-card__app {
|
|
26
|
-
flex-direction: row;
|
|
27
|
-
align-items: center;
|
|
28
|
-
min-width: 0;
|
|
29
|
-
display: flex;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.doubao-list-card__app-icon {
|
|
33
|
-
background-color: var(--neutral-30);
|
|
34
|
-
border-radius: 4px;
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
width: 16px;
|
|
37
|
-
height: 16px;
|
|
38
|
-
overflow: hidden;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.doubao-list-card__app-name {
|
|
42
|
-
color: var(--neutral-50);
|
|
43
|
-
text-overflow: ellipsis;
|
|
44
|
-
white-space: nowrap;
|
|
45
|
-
margin-left: 6px;
|
|
46
|
-
font-family: PingFang SC, sans-serif;
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
font-style: normal;
|
|
49
|
-
font-weight: 500;
|
|
50
|
-
line-height: 18px;
|
|
51
|
-
overflow: hidden;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.doubao-list-card__more {
|
|
55
|
-
flex-direction: row;
|
|
56
|
-
flex-shrink: 0;
|
|
57
|
-
justify-content: flex-end;
|
|
58
|
-
align-items: center;
|
|
59
|
-
min-width: 62.5px;
|
|
60
|
-
display: flex;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.doubao-list-card__more-text {
|
|
64
|
-
color: var(--neutral-50);
|
|
65
|
-
text-overflow: ellipsis;
|
|
66
|
-
white-space: nowrap;
|
|
67
|
-
font-family: PingFang SC, sans-serif;
|
|
68
|
-
font-size: 12px;
|
|
69
|
-
font-style: normal;
|
|
70
|
-
font-weight: 400;
|
|
71
|
-
line-height: 18px;
|
|
72
|
-
overflow: hidden;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.doubao-list-card__more-chevron {
|
|
76
|
-
box-sizing: border-box;
|
|
77
|
-
border-top: 1px solid var(--neutral-50);
|
|
78
|
-
border-right: 1px solid var(--neutral-50);
|
|
79
|
-
width: 7px;
|
|
80
|
-
height: 7px;
|
|
81
|
-
margin-left: 2px;
|
|
82
|
-
transform: rotate(45deg);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
13
|
.doubao-list-card__body {
|
|
86
14
|
box-sizing: border-box;
|
|
87
15
|
background-color: var(--bg-base-1);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, TouchEvent } from '@lynx-js/types';
|
|
2
2
|
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import type { TemplateKey, TemplateText } from '../types.js';
|
|
3
4
|
import './styles.scss';
|
|
4
5
|
export interface OrderCardProps {
|
|
5
6
|
/** 标题栏右侧「更多」入口的文案。 */
|
|
@@ -17,9 +18,9 @@ export interface OrderCardProps {
|
|
|
17
18
|
/** 商品价格前缀文案,例如「券后」。 */
|
|
18
19
|
productPricePrefix?: string;
|
|
19
20
|
/** 商品价格。 */
|
|
20
|
-
productPrice?:
|
|
21
|
+
productPrice?: TemplateText;
|
|
21
22
|
/** 商品数量。 */
|
|
22
|
-
productQuantity?:
|
|
23
|
+
productQuantity?: TemplateText;
|
|
23
24
|
/** 提单信息列表。 */
|
|
24
25
|
infoItems?: OrderCardInfoItem[];
|
|
25
26
|
/** 费用明细列表。 */
|
|
@@ -29,7 +30,7 @@ export interface OrderCardProps {
|
|
|
29
30
|
/** 合计价格前的标签文案。 */
|
|
30
31
|
totalLabel?: string;
|
|
31
32
|
/** 合计价格。 */
|
|
32
|
-
totalPrice?:
|
|
33
|
+
totalPrice?: TemplateText;
|
|
33
34
|
/** 主按钮文案。 */
|
|
34
35
|
primaryActionText?: string;
|
|
35
36
|
/** 次按钮文案。 */
|
|
@@ -51,7 +52,7 @@ export interface OrderCardProps {
|
|
|
51
52
|
}
|
|
52
53
|
export interface OrderCardInfoItem {
|
|
53
54
|
/** 信息项唯一标识;不传时使用数组下标。 */
|
|
54
|
-
key?:
|
|
55
|
+
key?: TemplateKey;
|
|
55
56
|
/** 信息项标签。 */
|
|
56
57
|
label: string;
|
|
57
58
|
/** 信息项主内容。 */
|
|
@@ -61,11 +62,11 @@ export interface OrderCardInfoItem {
|
|
|
61
62
|
}
|
|
62
63
|
export interface OrderCardFeeItem {
|
|
63
64
|
/** 费用项唯一标识;不传时使用数组下标。 */
|
|
64
|
-
key?:
|
|
65
|
+
key?: TemplateKey;
|
|
65
66
|
/** 费用项标签。 */
|
|
66
67
|
label: string;
|
|
67
68
|
/** 费用项金额或数值。 */
|
|
68
|
-
value:
|
|
69
|
+
value: TemplateText;
|
|
69
70
|
}
|
|
70
71
|
export declare function OrderCard(props: OrderCardProps): ReactElement;
|
|
71
72
|
//# sourceMappingURL=index.d.ts.map
|