@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,140 @@
|
|
|
1
|
+
.doubao-template-info-section {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
border-top: var(--doubao-template-info-section-border-top, .5px solid var(--neutral-transparent-1));
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: 12px;
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.doubao-template-info-section__info {
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
width: 100%;
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.doubao-template-info-section__info-row {
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
width: 100%;
|
|
19
|
+
display: flex;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.doubao-template-info-section__info-row + .doubao-template-info-section__info-row {
|
|
23
|
+
margin-top: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.doubao-template-info-section__info-label-wrap {
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
flex: 1 1 0;
|
|
29
|
+
align-items: center;
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.doubao-template-info-section__info-label, .doubao-template-info-section__info-value, .doubao-template-info-section__fee, .doubao-template-info-section__total-label, .doubao-template-info-section__total-price {
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
white-space: nowrap;
|
|
36
|
+
font-family: PingFang SC, sans-serif;
|
|
37
|
+
font-style: normal;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.doubao-template-info-section__info-label {
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
color: var(--doubao-template-info-section-label-text, var(--neutral-100));
|
|
44
|
+
font-size: var(--doubao-template-info-section-label-font-size, 13px);
|
|
45
|
+
font-weight: var(--doubao-template-info-section-label-font-weight, 400);
|
|
46
|
+
line-height: var(--doubao-template-info-section-label-line-height, 20px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.doubao-template-info-section__info-value-wrap {
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
flex: 1 1 0;
|
|
52
|
+
justify-content: flex-end;
|
|
53
|
+
align-items: center;
|
|
54
|
+
min-width: 0;
|
|
55
|
+
display: flex;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.doubao-template-info-section__info-value {
|
|
60
|
+
min-width: 0;
|
|
61
|
+
margin-left: var(--doubao-template-info-section-value-gap, 6px);
|
|
62
|
+
color: var(--doubao-template-info-section-value-text, var(--neutral-50));
|
|
63
|
+
font-size: var(--doubao-template-info-section-value-font-size, 13px);
|
|
64
|
+
font-weight: var(--doubao-template-info-section-value-font-weight, 400);
|
|
65
|
+
line-height: var(--doubao-template-info-section-value-line-height, 20px);
|
|
66
|
+
text-align: right;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.doubao-template-info-section__info-value:first-child {
|
|
70
|
+
margin-left: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.doubao-template-info-section--value-column .doubao-template-info-section__info-value-wrap {
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
align-items: flex-end;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.doubao-template-info-section--value-column .doubao-template-info-section__info-value {
|
|
79
|
+
max-width: 100%;
|
|
80
|
+
margin-left: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.doubao-template-info-section__summary {
|
|
84
|
+
flex-direction: row;
|
|
85
|
+
justify-content: flex-end;
|
|
86
|
+
width: 100%;
|
|
87
|
+
margin-top: 8px;
|
|
88
|
+
display: flex;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.doubao-template-info-section__summary-content {
|
|
92
|
+
flex-direction: row;
|
|
93
|
+
justify-content: flex-end;
|
|
94
|
+
align-items: center;
|
|
95
|
+
max-width: 100%;
|
|
96
|
+
display: flex;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.doubao-template-info-section__fee {
|
|
101
|
+
flex-shrink: var(--doubao-template-info-section-fee-shrink, 1);
|
|
102
|
+
min-width: 0;
|
|
103
|
+
margin-left: var(--doubao-template-info-section-fee-gap, 6px);
|
|
104
|
+
color: var(--doubao-template-info-section-fee-text, var(--neutral-50));
|
|
105
|
+
font-size: var(--doubao-template-info-section-fee-font-size, 13px);
|
|
106
|
+
font-weight: var(--doubao-template-info-section-fee-font-weight, 400);
|
|
107
|
+
line-height: var(--doubao-template-info-section-fee-line-height, 20px);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.doubao-template-info-section__fee:first-child {
|
|
111
|
+
margin-left: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.doubao-template-info-section__total {
|
|
115
|
+
margin-left: var(--doubao-template-info-section-total-gap, 6px);
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
flex-shrink: 0;
|
|
118
|
+
align-items: center;
|
|
119
|
+
display: flex;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.doubao-template-info-section__total:first-child {
|
|
123
|
+
margin-left: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.doubao-template-info-section__total-label {
|
|
127
|
+
color: var(--doubao-template-info-section-total-label-text, var(--neutral-100));
|
|
128
|
+
font-size: var(--doubao-template-info-section-total-label-font-size, 13px);
|
|
129
|
+
font-weight: var(--doubao-template-info-section-total-label-font-weight, 500);
|
|
130
|
+
line-height: var(--doubao-template-info-section-total-label-line-height, 20px);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.doubao-template-info-section__total-price {
|
|
134
|
+
color: var(--doubao-template-info-section-total-price-text, var(--neutral-100));
|
|
135
|
+
font-size: var(--doubao-template-info-section-total-price-font-size, 15px);
|
|
136
|
+
font-weight: var(--doubao-template-info-section-total-price-font-weight, 500);
|
|
137
|
+
line-height: var(--doubao-template-info-section-total-price-line-height, 22px);
|
|
138
|
+
margin-left: 2px;
|
|
139
|
+
}
|
|
140
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TouchEvent } from '@lynx-js/types';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import type { TemplateText } from '../../types.js';
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
export interface TemplateProductSummaryProps {
|
|
6
|
+
/** 商品标题。 */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** 商品规格说明。 */
|
|
9
|
+
spec?: string;
|
|
10
|
+
/** 商品图片地址。 */
|
|
11
|
+
imageSrc?: string;
|
|
12
|
+
/** 商品自定义图片节点;优先级高于 imageSrc。 */
|
|
13
|
+
image?: ReactNode;
|
|
14
|
+
/** 商品价格前缀文案,例如「券后」。 */
|
|
15
|
+
pricePrefix?: string;
|
|
16
|
+
/** 商品价格。 */
|
|
17
|
+
price?: TemplateText;
|
|
18
|
+
/** 商品数量。 */
|
|
19
|
+
quantity?: TemplateText;
|
|
20
|
+
/** 点击商品摘要时触发。 */
|
|
21
|
+
onClick?: (event: TouchEvent) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function TemplateProductSummary(props: TemplateProductSummaryProps): ReactElement | null;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "./styles.css";
|
|
2
|
+
function isTemplateProductSummaryTextEmpty(content) {
|
|
3
|
+
return null == content || '' === content;
|
|
4
|
+
}
|
|
5
|
+
function TemplateProductSummaryImage(props) {
|
|
6
|
+
const { image: image1, imageSrc } = props;
|
|
7
|
+
if (null != image1) return <view className="doubao-template-product-summary__image">{image1}</view>;
|
|
8
|
+
if (null != imageSrc && imageSrc.length > 0) return <image className="doubao-template-product-summary__image" src={imageSrc} mode="aspectFill"/>;
|
|
9
|
+
return <view className="doubao-template-product-summary__image"/>;
|
|
10
|
+
}
|
|
11
|
+
function TemplateProductSummary(props) {
|
|
12
|
+
const { title, spec, imageSrc, image: image1, pricePrefix, price, quantity, onClick } = props;
|
|
13
|
+
const hasImage = null != image1 || null != imageSrc && imageSrc.length > 0;
|
|
14
|
+
const hasTitle = null != title && title.length > 0;
|
|
15
|
+
const hasPrice = null != pricePrefix && pricePrefix.length > 0 || !isTemplateProductSummaryTextEmpty(price);
|
|
16
|
+
const hasMainLine = hasTitle || hasPrice;
|
|
17
|
+
const hasSpec = null != spec && spec.length > 0;
|
|
18
|
+
const hasQuantity = !isTemplateProductSummaryTextEmpty(quantity);
|
|
19
|
+
const hasSecondaryLine = hasSpec || hasQuantity;
|
|
20
|
+
if (!hasImage && !hasMainLine && !hasSecondaryLine) return null;
|
|
21
|
+
return <view className="doubao-template-product-summary" catchtap={onClick}>
|
|
22
|
+
{hasImage ? <TemplateProductSummaryImage image={image1} imageSrc={imageSrc}/> : null}
|
|
23
|
+
<view className={hasImage ? 'doubao-template-product-summary__content doubao-template-product-summary__content--with-image' : 'doubao-template-product-summary__content'}>
|
|
24
|
+
{hasMainLine ? <view className="doubao-template-product-summary__line-main">
|
|
25
|
+
{hasTitle ? <view className="doubao-template-product-summary__title-wrap">
|
|
26
|
+
<text className="doubao-template-product-summary__title" text-maxline="1">
|
|
27
|
+
{title}
|
|
28
|
+
</text>
|
|
29
|
+
<view className="doubao-template-product-summary__chevron"/>
|
|
30
|
+
</view> : null}
|
|
31
|
+
{hasPrice ? <view className="doubao-template-product-summary__price">
|
|
32
|
+
{null != pricePrefix && pricePrefix.length > 0 ? <text className="doubao-template-product-summary__price-prefix" text-maxline="1">
|
|
33
|
+
{pricePrefix}
|
|
34
|
+
</text> : null}
|
|
35
|
+
{!isTemplateProductSummaryTextEmpty(price) ? <text className="doubao-template-product-summary__price-value" text-maxline="1">
|
|
36
|
+
{price}
|
|
37
|
+
</text> : null}
|
|
38
|
+
</view> : null}
|
|
39
|
+
</view> : null}
|
|
40
|
+
{hasSecondaryLine ? <view className="doubao-template-product-summary__line-secondary">
|
|
41
|
+
{hasSpec ? <text className="doubao-template-product-summary__spec" text-maxline="1">
|
|
42
|
+
{spec}
|
|
43
|
+
</text> : null}
|
|
44
|
+
{hasQuantity ? <text className="doubao-template-product-summary__quantity" text-maxline="1">
|
|
45
|
+
×{quantity}
|
|
46
|
+
</text> : null}
|
|
47
|
+
</view> : null}
|
|
48
|
+
</view>
|
|
49
|
+
</view>;
|
|
50
|
+
}
|
|
51
|
+
export { TemplateProductSummary };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
.doubao-template-product-summary {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
background-color: var(--doubao-template-product-summary-bg, var(--bg-base-1));
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
align-items: center;
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding: 12px;
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.doubao-template-product-summary__image {
|
|
12
|
+
width: var(--doubao-template-product-summary-image-size, 80px);
|
|
13
|
+
height: var(--doubao-template-product-summary-image-size, 80px);
|
|
14
|
+
background-color: var(--doubao-template-product-summary-image-bg, var(--bg-base-1-overlay));
|
|
15
|
+
border-radius: var(--doubao-template-product-summary-image-radius, 5px);
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.doubao-template-product-summary__content {
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
flex: 1 1 0;
|
|
23
|
+
min-width: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.doubao-template-product-summary__content--with-image {
|
|
28
|
+
margin-left: 12px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.doubao-template-product-summary__line-main, .doubao-template-product-summary__line-secondary {
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
align-items: center;
|
|
34
|
+
width: 100%;
|
|
35
|
+
min-width: 0;
|
|
36
|
+
display: flex;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.doubao-template-product-summary__line-main {
|
|
40
|
+
height: var(--doubao-template-product-summary-main-height, 24px);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.doubao-template-product-summary__line-secondary {
|
|
44
|
+
height: var(--doubao-template-product-summary-secondary-height, 20px);
|
|
45
|
+
margin-top: var(--doubao-template-product-summary-secondary-margin-top, 2px);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.doubao-template-product-summary__title-wrap {
|
|
49
|
+
min-width: 0;
|
|
50
|
+
margin-right: var(--doubao-template-product-summary-title-margin-right, 8px);
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
flex: 1 1 0;
|
|
53
|
+
align-items: center;
|
|
54
|
+
display: flex;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.doubao-template-product-summary__title, .doubao-template-product-summary__price-prefix, .doubao-template-product-summary__price-value, .doubao-template-product-summary__spec, .doubao-template-product-summary__quantity {
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
font-family: PingFang SC, sans-serif;
|
|
61
|
+
font-style: normal;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.doubao-template-product-summary__title {
|
|
66
|
+
min-width: 0;
|
|
67
|
+
color: var(--doubao-template-product-summary-title-text, var(--neutral-100));
|
|
68
|
+
font-size: var(--doubao-template-product-summary-title-font-size, 16px);
|
|
69
|
+
font-weight: var(--doubao-template-product-summary-title-font-weight, 500);
|
|
70
|
+
line-height: var(--doubao-template-product-summary-title-line-height, 24px);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.doubao-template-product-summary__chevron {
|
|
74
|
+
width: var(--doubao-template-product-summary-chevron-size, 7px);
|
|
75
|
+
height: var(--doubao-template-product-summary-chevron-size, 7px);
|
|
76
|
+
margin-left: var(--doubao-template-product-summary-chevron-margin-left, 5px);
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
border-top: var(--doubao-template-product-summary-chevron-stroke, 1.5px) solid var(--doubao-template-product-summary-chevron-color, var(--neutral-30));
|
|
79
|
+
border-right: var(--doubao-template-product-summary-chevron-stroke, 1.5px) solid var(--doubao-template-product-summary-chevron-color, var(--neutral-30));
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
transform: rotate(45deg);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.doubao-template-product-summary__price {
|
|
85
|
+
color: var(--doubao-template-product-summary-price-text, var(--neutral-100));
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
flex-direction: row;
|
|
88
|
+
flex-shrink: 0;
|
|
89
|
+
align-items: flex-end;
|
|
90
|
+
font-family: PingFang SC, sans-serif;
|
|
91
|
+
font-style: normal;
|
|
92
|
+
font-weight: 500;
|
|
93
|
+
display: flex;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.doubao-template-product-summary__price-prefix {
|
|
97
|
+
width: var(--doubao-template-product-summary-price-prefix-width, 22px);
|
|
98
|
+
font-size: var(--doubao-template-product-summary-price-prefix-font-size, 11px);
|
|
99
|
+
line-height: var(--doubao-template-product-summary-price-prefix-line-height, 17px);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.doubao-template-product-summary__price-value {
|
|
103
|
+
margin-left: var(--doubao-template-product-summary-price-gap, 2px);
|
|
104
|
+
font-size: var(--doubao-template-product-summary-price-font-size, 13px);
|
|
105
|
+
line-height: var(--doubao-template-product-summary-price-line-height, 19px);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.doubao-template-product-summary__spec {
|
|
109
|
+
min-width: 0;
|
|
110
|
+
color: var(--doubao-template-product-summary-secondary-text, var(--neutral-50));
|
|
111
|
+
font-size: var(--doubao-template-product-summary-spec-font-size, 12px);
|
|
112
|
+
font-weight: var(--doubao-template-product-summary-spec-font-weight, 400);
|
|
113
|
+
line-height: var(--doubao-template-product-summary-spec-line-height, 18px);
|
|
114
|
+
flex: 1 1 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.doubao-template-product-summary__quantity {
|
|
118
|
+
margin-left: var(--doubao-template-product-summary-quantity-margin-left, 8px);
|
|
119
|
+
color: var(--doubao-template-product-summary-secondary-text, var(--neutral-50));
|
|
120
|
+
font-size: var(--doubao-template-product-summary-quantity-font-size, 13px);
|
|
121
|
+
font-weight: var(--doubao-template-product-summary-quantity-font-weight, 400);
|
|
122
|
+
line-height: var(--doubao-template-product-summary-quantity-line-height, 20px);
|
|
123
|
+
flex-shrink: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TouchEvent } from '@lynx-js/types';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { TemplateKey, TemplateText } from '../../types.js';
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
export interface TemplateRouteSectionProps {
|
|
6
|
+
/** 航程信息列表。 */
|
|
7
|
+
items?: TemplateRouteSectionItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface TemplateRouteSectionItem {
|
|
10
|
+
/** 航程项唯一标识;不传时使用数组下标。 */
|
|
11
|
+
key?: TemplateKey;
|
|
12
|
+
/** 航程标题,例如「出发地 - 到达地」。 */
|
|
13
|
+
title?: TemplateText;
|
|
14
|
+
/** 航程描述,例如「6月1日 周六 20:50-23:50 CZ0000 经济舱」。 */
|
|
15
|
+
description?: TemplateText;
|
|
16
|
+
/** 是否展示标题右侧箭头。 */
|
|
17
|
+
showChevron?: boolean;
|
|
18
|
+
/** 点击航程项时触发。 */
|
|
19
|
+
onClick?: (event: TouchEvent) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function hasTemplateRouteSectionItems(items?: TemplateRouteSectionItem[]): boolean;
|
|
22
|
+
export declare function TemplateRouteSection(props: TemplateRouteSectionProps): ReactElement | null;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import "./styles.css";
|
|
2
|
+
function isTemplateRouteSectionTextEmpty(content) {
|
|
3
|
+
return null == content || '' === content;
|
|
4
|
+
}
|
|
5
|
+
function renderTemplateRouteSectionTextField(textContent, textClassName) {
|
|
6
|
+
if (isTemplateRouteSectionTextEmpty(textContent)) return null;
|
|
7
|
+
return <text className={textClassName} text-maxline="1">
|
|
8
|
+
{textContent}
|
|
9
|
+
</text>;
|
|
10
|
+
}
|
|
11
|
+
function hasTemplateRouteSectionItemContent(item) {
|
|
12
|
+
return !isTemplateRouteSectionTextEmpty(item.title) || !isTemplateRouteSectionTextEmpty(item.description);
|
|
13
|
+
}
|
|
14
|
+
function hasTemplateRouteSectionItems(items) {
|
|
15
|
+
return items?.some(hasTemplateRouteSectionItemContent) ?? false;
|
|
16
|
+
}
|
|
17
|
+
function renderTemplateRouteSectionItem(item, index) {
|
|
18
|
+
if (!hasTemplateRouteSectionItemContent(item)) return null;
|
|
19
|
+
const titleNode = renderTemplateRouteSectionTextField(item.title, 'doubao-template-route-section__title-text');
|
|
20
|
+
const descriptionNode = renderTemplateRouteSectionTextField(item.description, "doubao-template-route-section__description");
|
|
21
|
+
const showChevron = false !== item.showChevron && null != titleNode;
|
|
22
|
+
return <view className="doubao-template-route-section__item" key={item.key ?? index} {...null != item.onClick ? {
|
|
23
|
+
catchtap: item.onClick
|
|
24
|
+
} : {}}>
|
|
25
|
+
{null != titleNode ? <view className="doubao-template-route-section__title">
|
|
26
|
+
{titleNode}
|
|
27
|
+
{showChevron ? <view className="doubao-template-route-section__chevron"/> : null}
|
|
28
|
+
</view> : null}
|
|
29
|
+
{descriptionNode}
|
|
30
|
+
</view>;
|
|
31
|
+
}
|
|
32
|
+
function TemplateRouteSection(props) {
|
|
33
|
+
const { items = [] } = props;
|
|
34
|
+
const routeNodes = items.map(renderTemplateRouteSectionItem).filter((node)=>null != node);
|
|
35
|
+
if (0 === routeNodes.length) return null;
|
|
36
|
+
return <view className="doubao-template-route-section">{routeNodes}</view>;
|
|
37
|
+
}
|
|
38
|
+
export { TemplateRouteSection, hasTemplateRouteSectionItems };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.doubao-template-route-section {
|
|
2
|
+
flex-direction: column;
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.doubao-template-route-section__item {
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 12px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.doubao-template-route-section__title {
|
|
13
|
+
width: 100%;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
height: var(--doubao-template-route-section-title-height, 24px);
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
align-items: center;
|
|
18
|
+
display: flex;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.doubao-template-route-section__title-text, .doubao-template-route-section__description {
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
font-family: PingFang SC, sans-serif;
|
|
26
|
+
font-style: normal;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.doubao-template-route-section__title-text {
|
|
31
|
+
min-width: 0;
|
|
32
|
+
color: var(--doubao-template-route-section-title-text, var(--neutral-100));
|
|
33
|
+
font-size: var(--doubao-template-route-section-title-font-size, 16px);
|
|
34
|
+
font-weight: var(--doubao-template-route-section-title-font-weight, 500);
|
|
35
|
+
line-height: var(--doubao-template-route-section-title-line-height, 24px);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.doubao-template-route-section__chevron {
|
|
39
|
+
width: var(--doubao-template-route-section-chevron-size, 7px);
|
|
40
|
+
height: var(--doubao-template-route-section-chevron-size, 7px);
|
|
41
|
+
margin-left: var(--doubao-template-route-section-chevron-margin-left, 5px);
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
border-top: var(--doubao-template-route-section-chevron-stroke, 1.5px) solid var(--doubao-template-route-section-chevron-color, var(--neutral-30));
|
|
44
|
+
border-right: var(--doubao-template-route-section-chevron-stroke, 1.5px) solid var(--doubao-template-route-section-chevron-color, var(--neutral-30));
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
transform: rotate(45deg);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.doubao-template-route-section__description {
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: var(--doubao-template-route-section-description-height, 20px);
|
|
52
|
+
margin-top: var(--doubao-template-route-section-description-margin-top, 2px);
|
|
53
|
+
color: var(--doubao-template-route-section-description-text, var(--neutral-50));
|
|
54
|
+
font-size: var(--doubao-template-route-section-description-font-size, 13px);
|
|
55
|
+
font-weight: var(--doubao-template-route-section-description-font-weight, 400);
|
|
56
|
+
line-height: var(--doubao-template-route-section-description-line-height, 20px);
|
|
57
|
+
}
|
|
58
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TouchEvent } from '@lynx-js/types';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import './styles.scss';
|
|
4
|
+
export interface TemplateTitleBarProps {
|
|
5
|
+
moreText?: string;
|
|
6
|
+
showMore?: boolean;
|
|
7
|
+
reserveMore?: boolean;
|
|
8
|
+
onMoreClick?: (event: TouchEvent) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function TemplateTitleBar(props: TemplateTitleBarProps): ReactElement;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getAppInfo } from "../../utils/app-info.js";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
function TemplateTitleBarIcon({ appIconSrc }) {
|
|
4
|
+
if (null != appIconSrc && appIconSrc.length > 0) return <image className="doubao-template-title-bar__app-icon" src={appIconSrc} mode="aspectFill"/>;
|
|
5
|
+
return <view className="doubao-template-title-bar__app-icon"/>;
|
|
6
|
+
}
|
|
7
|
+
function TemplateTitleBar(props) {
|
|
8
|
+
const { moreText, showMore = true, reserveMore = false, onMoreClick } = props;
|
|
9
|
+
const appInfo = getAppInfo();
|
|
10
|
+
const hasMore = showMore && null != moreText && moreText.length > 0;
|
|
11
|
+
return <view className="doubao-template-title-bar">
|
|
12
|
+
<view className="doubao-template-title-bar__app">
|
|
13
|
+
<TemplateTitleBarIcon appIconSrc={appInfo.appIconSrc}/>
|
|
14
|
+
<text className="doubao-template-title-bar__app-name" text-maxline="1">
|
|
15
|
+
{appInfo.appName}
|
|
16
|
+
</text>
|
|
17
|
+
</view>
|
|
18
|
+
{hasMore ? <view className="doubao-template-title-bar__more" catchtap={onMoreClick}>
|
|
19
|
+
<text className="doubao-template-title-bar__more-text" text-maxline="1">
|
|
20
|
+
{moreText}
|
|
21
|
+
</text>
|
|
22
|
+
<view className="doubao-template-title-bar__more-chevron"/>
|
|
23
|
+
</view> : null}
|
|
24
|
+
{!hasMore && reserveMore ? <view className="doubao-template-title-bar__more-placeholder">
|
|
25
|
+
<text className="doubao-template-title-bar__more-text" text-maxline="1">
|
|
26
|
+
更多
|
|
27
|
+
</text>
|
|
28
|
+
<view className="doubao-template-title-bar__more-chevron"/>
|
|
29
|
+
</view> : null}
|
|
30
|
+
</view>;
|
|
31
|
+
}
|
|
32
|
+
export { TemplateTitleBar };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.doubao-template-title-bar {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
border-bottom: .5px solid var(--neutral-transparent-1);
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 40px;
|
|
9
|
+
padding: 12px;
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.doubao-template-title-bar__app {
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
align-items: center;
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.doubao-template-title-bar__app-icon {
|
|
20
|
+
border-radius: 4px;
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
width: 16px;
|
|
23
|
+
height: 16px;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.doubao-template-title-bar__app-name, .doubao-template-title-bar__more-text {
|
|
28
|
+
color: var(--neutral-50);
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
font-family: PingFang SC, sans-serif;
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
font-style: normal;
|
|
34
|
+
line-height: 18px;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.doubao-template-title-bar__app-name {
|
|
39
|
+
margin-left: 6px;
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.doubao-template-title-bar__more, .doubao-template-title-bar__more-placeholder {
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
justify-content: flex-end;
|
|
47
|
+
align-items: center;
|
|
48
|
+
min-width: 62.5px;
|
|
49
|
+
display: flex;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.doubao-template-title-bar__more-placeholder {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.doubao-template-title-bar__more-text {
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.doubao-template-title-bar__more-chevron {
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
border-top: 1px solid var(--neutral-50);
|
|
63
|
+
border-right: 1px solid var(--neutral-50);
|
|
64
|
+
width: 7px;
|
|
65
|
+
height: 7px;
|
|
66
|
+
margin-left: 2px;
|
|
67
|
+
transform: rotate(45deg);
|
|
68
|
+
}
|
|
69
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { TemplateText } from '../../types.js';
|
|
3
|
+
import './styles.scss';
|
|
4
|
+
export interface TemplateTransportSummaryProps {
|
|
5
|
+
/** 行程标题块内容。 */
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/** 出发点主信息文案。 */
|
|
8
|
+
departureMain?: TemplateText;
|
|
9
|
+
/** 出发点补充信息文案。 */
|
|
10
|
+
departureSub?: TemplateText;
|
|
11
|
+
/** 中转区域整体块内容;优先级高于 transferTop、showTransferDot 和 transferBottom。 */
|
|
12
|
+
transfer?: ReactNode;
|
|
13
|
+
/** 中转区域上方文案。 */
|
|
14
|
+
transferTop?: TemplateText;
|
|
15
|
+
/** 是否展示中转箭头中间圆点。 */
|
|
16
|
+
showTransferDot?: boolean;
|
|
17
|
+
/** 中转区域下方文案。 */
|
|
18
|
+
transferBottom?: TemplateText;
|
|
19
|
+
/** 到达点主信息文案。 */
|
|
20
|
+
arrivalMain?: TemplateText;
|
|
21
|
+
/** 到达点日期偏移文案,例如 '+1'。 */
|
|
22
|
+
arrivalDayOffset?: TemplateText;
|
|
23
|
+
/** 到达点补充信息文案。 */
|
|
24
|
+
arrivalSub?: TemplateText;
|
|
25
|
+
/** 价格块内容。 */
|
|
26
|
+
price?: ReactNode;
|
|
27
|
+
/** 根节点自定义类名。 */
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function TemplateTransportSummary(props: TemplateTransportSummaryProps): ReactElement | null;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|