km-card-layout-component-miniprogram 0.1.7 → 0.1.9
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/example/pages/home/index.js +107 -16
- package/miniprogram_dist/components/card-layout/elements/custom-element/index.js +27 -0
- package/miniprogram_dist/components/card-layout/elements/custom-element/index.json +3 -0
- package/miniprogram_dist/components/card-layout/elements/custom-element/index.wxml +5 -0
- package/miniprogram_dist/components/card-layout/elements/custom-element/index.wxss +14 -0
- package/miniprogram_dist/components/card-layout/elements/icon-element/index.js +39 -0
- package/miniprogram_dist/components/card-layout/elements/icon-element/index.json +3 -0
- package/miniprogram_dist/components/card-layout/elements/icon-element/index.wxml +5 -0
- package/miniprogram_dist/components/card-layout/elements/icon-element/index.wxss +37 -0
- package/miniprogram_dist/components/card-layout/elements/image-element/index.js +31 -0
- package/miniprogram_dist/components/card-layout/elements/image-element/index.json +3 -0
- package/miniprogram_dist/components/card-layout/elements/image-element/index.wxml +8 -0
- package/miniprogram_dist/components/card-layout/elements/image-element/index.wxss +10 -0
- package/miniprogram_dist/components/card-layout/elements/text-element/index.js +47 -0
- package/miniprogram_dist/components/card-layout/elements/text-element/index.json +3 -0
- package/miniprogram_dist/components/card-layout/elements/text-element/index.wxml +29 -0
- package/miniprogram_dist/components/card-layout/elements/text-element/index.wxss +59 -0
- package/miniprogram_dist/components/card-layout/index.js +16 -201
- package/miniprogram_dist/components/card-layout/index.json +7 -1
- package/miniprogram_dist/components/card-layout/index.wxml +15 -63
- package/miniprogram_dist/components/card-layout/index.wxss +0 -63
- package/miniprogram_dist/utils/card-schema.js +12 -3
- package/miniprogram_dist/vendor/km-card-layout-core/bindings.js +78 -0
- package/miniprogram_dist/vendor/km-card-layout-core/data.js +38 -0
- package/miniprogram_dist/vendor/km-card-layout-core/helpers.js +72 -0
- package/miniprogram_dist/vendor/km-card-layout-core/index.js +46 -367
- package/miniprogram_dist/vendor/km-card-layout-core/interface/index.js +1 -1
- package/miniprogram_dist/vendor/km-card-layout-core/layout.js +117 -0
- package/miniprogram_dist/vendor/km-card-layout-core/ops/changeBackground.js +142 -0
- package/miniprogram_dist/vendor/km-card-layout-core/render/helpers.js +133 -0
- package/miniprogram_dist/vendor/km-card-layout-core/render/tool.js +16 -0
- package/miniprogram_dist/vendor/km-card-layout-core/utils.js +23 -130
- package/package.json +1 -1
- package/script/sync-core.js +13 -2
- package/src/components/card-layout/elements/custom-element/index.json +3 -0
- package/src/components/card-layout/elements/custom-element/index.ts +30 -0
- package/src/components/card-layout/elements/custom-element/index.wxml +5 -0
- package/src/components/card-layout/elements/custom-element/index.wxss +14 -0
- package/src/components/card-layout/elements/icon-element/index.json +3 -0
- package/src/components/card-layout/elements/icon-element/index.ts +42 -0
- package/src/components/card-layout/elements/icon-element/index.wxml +5 -0
- package/src/components/card-layout/elements/icon-element/index.wxss +37 -0
- package/src/components/card-layout/elements/image-element/index.json +3 -0
- package/src/components/card-layout/elements/image-element/index.ts +35 -0
- package/src/components/card-layout/elements/image-element/index.wxml +8 -0
- package/src/components/card-layout/elements/image-element/index.wxss +10 -0
- package/src/components/card-layout/elements/text-element/index.json +3 -0
- package/src/components/card-layout/elements/text-element/index.ts +52 -0
- package/src/components/card-layout/elements/text-element/index.wxml +29 -0
- package/src/components/card-layout/elements/text-element/index.wxss +59 -0
- package/src/components/card-layout/index.json +7 -1
- package/src/components/card-layout/index.ts +30 -296
- package/src/components/card-layout/index.wxml +15 -63
- package/src/components/card-layout/index.wxss +0 -63
- package/src/utils/card-schema.ts +11 -4
- package/src/vendor/km-card-layout-core/bindings.ts +87 -0
- package/src/vendor/km-card-layout-core/data.ts +39 -0
- package/src/vendor/km-card-layout-core/helpers.ts +76 -0
- package/src/vendor/km-card-layout-core/index.ts +53 -460
- package/src/vendor/km-card-layout-core/interface/context.ts +6 -0
- package/src/vendor/km-card-layout-core/interface/data/payload.ts +1 -0
- package/src/vendor/km-card-layout-core/interface/index.ts +2 -2
- package/src/vendor/km-card-layout-core/layout.ts +129 -0
- package/src/vendor/km-card-layout-core/ops/changeBackground.ts +179 -0
- package/src/vendor/km-card-layout-core/render/helpers.ts +144 -0
- package/src/vendor/km-card-layout-core/render/tool.ts +21 -0
- package/src/vendor/km-card-layout-core/types.d.ts +166 -15
- package/src/vendor/km-card-layout-core/utils.ts +13 -141
- package/src/vendor/km-card-layout-core/interface/render.ts +0 -52
- /package/miniprogram_dist/vendor/km-card-layout-core/interface/{render.js → context.js} +0 -0
|
@@ -1,24 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const layouts = [
|
|
2
|
+
{
|
|
3
|
+
name: "内置布局-右侧logo",
|
|
4
|
+
container: { mode: "absolute" },
|
|
5
|
+
width: 343,
|
|
6
|
+
height: 210,
|
|
7
|
+
backgroundImage:
|
|
8
|
+
"https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/0a7331e2e1a9a4cbc828afe6c338aaae.png",
|
|
9
|
+
backgroundZIndex: 1,
|
|
10
|
+
fontColor: "#333333",
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
id: "f2dd3515-2147-460a-b788-3f58dd5f858b",
|
|
14
|
+
type: "custom",
|
|
15
|
+
style: { borderRadius: 0, backgroundColor: "currentColor" },
|
|
16
|
+
layout: { x: 20, y: 104, mode: "absolute", width: 12, height: 1, zIndex: 8 },
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "7fd4c8cd-6bea-42d0-9a80-b1ba27f4abd3",
|
|
20
|
+
type: "custom",
|
|
21
|
+
style: { borderRadius: 0, backgroundColor: "currentColor" },
|
|
22
|
+
layout: { x: 37, y: 104, mode: "absolute", width: 105, height: 1, zIndex: 9 },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "1",
|
|
26
|
+
key: "name",
|
|
27
|
+
type: "text",
|
|
28
|
+
style: { color: "", fontSize: 16, textAlign: "left", fontWeight: "bold", lineHeight: 22 },
|
|
29
|
+
layout: { x: 20, y: 45, mode: "absolute", width: 210, height: 22, zIndex: 1 },
|
|
30
|
+
binding: "user.name",
|
|
31
|
+
defaultValue: "名片君",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "2",
|
|
35
|
+
key: "company",
|
|
36
|
+
type: "text",
|
|
37
|
+
style: { color: "", fontSize: 11, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
|
|
38
|
+
layout: { x: 20, y: 74, mode: "absolute", width: 210, height: 15, zIndex: 3 },
|
|
39
|
+
binding: "user.company",
|
|
40
|
+
defaultValue: "合肥魅客网络有限公司",
|
|
41
|
+
icon: { name: "company" },
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "4",
|
|
45
|
+
key: "duty",
|
|
46
|
+
type: "text",
|
|
47
|
+
style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
|
|
48
|
+
layout: { x: 20, y: 21, mode: "absolute", width: 210, height: 15, zIndex: 2 },
|
|
49
|
+
binding: "user.duty",
|
|
50
|
+
defaultValue: "销售经理",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "3",
|
|
54
|
+
key: "mobile",
|
|
55
|
+
icon: { style: "fill", enable: true, name: "mobile" },
|
|
56
|
+
type: "text",
|
|
57
|
+
style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
|
|
58
|
+
layout: { x: 20, y: 123, mode: "absolute", width: 280, height: 15, zIndex: 5 },
|
|
59
|
+
binding: "user.mobile",
|
|
60
|
+
defaultValue: "18888888888",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "5",
|
|
64
|
+
key: "email",
|
|
65
|
+
icon: { style: "fill", enable: true, name: "email" },
|
|
66
|
+
type: "text",
|
|
67
|
+
style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
|
|
68
|
+
layout: { x: 20, y: 145, mode: "absolute", width: 280, height: 15, zIndex: 6 },
|
|
69
|
+
binding: "user.email",
|
|
70
|
+
defaultValue: "km@kuanmai.com",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "8",
|
|
74
|
+
key: "logo",
|
|
75
|
+
url: "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4c71811adfa51e1e3ab4181a88cebc87.png",
|
|
76
|
+
type: "image",
|
|
77
|
+
style: { color: "#000000", objectFit: "contain", borderRadius: 0 },
|
|
78
|
+
layout: { x: 263, y: 20, mode: "absolute", width: 60, height: 60, zIndex: 4 },
|
|
79
|
+
binding: "user.shareStyle.logo",
|
|
80
|
+
defaultValue:
|
|
81
|
+
"https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4c71811adfa51e1e3ab4181a88cebc87.png",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "9",
|
|
85
|
+
key: "address",
|
|
86
|
+
icon: { style: "fill", enable: true, name: "address" },
|
|
87
|
+
type: "text",
|
|
88
|
+
style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
|
|
89
|
+
layout: { x: 20, y: 167, mode: "absolute", width: 280, height: 33, zIndex: 7 },
|
|
90
|
+
binding: "user.addressName",
|
|
91
|
+
defaultValue: "安徽省合肥市包河区硅谷大厦",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
];
|
|
5
96
|
|
|
6
97
|
const cardData = {
|
|
7
98
|
user: {
|
|
8
|
-
company:
|
|
9
|
-
name:
|
|
10
|
-
duty:
|
|
11
|
-
phone:
|
|
12
|
-
email:
|
|
13
|
-
address:
|
|
14
|
-
avatar:
|
|
15
|
-
}
|
|
16
|
-
}
|
|
99
|
+
company: "Kuanmai Networks",
|
|
100
|
+
name: "Ada Lovelace",
|
|
101
|
+
duty: "Product Lead",
|
|
102
|
+
phone: "+86 188-0000-0000",
|
|
103
|
+
email: "ada@kuanmai.com",
|
|
104
|
+
address: "1 Infinite Loop, Shenzhen",
|
|
105
|
+
avatar: "https://picsum.photos/200/200?random=12",
|
|
106
|
+
},
|
|
107
|
+
};
|
|
17
108
|
|
|
18
109
|
Page({
|
|
19
110
|
data: {
|
|
20
111
|
layouts,
|
|
21
112
|
cardData,
|
|
22
|
-
description:
|
|
23
|
-
}
|
|
24
|
-
})
|
|
113
|
+
description: "CardLayoutInput + data.user binding with stacked cards.",
|
|
114
|
+
},
|
|
115
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("../../../../vendor/km-card-layout-core/index");
|
|
4
|
+
Component({
|
|
5
|
+
options: {
|
|
6
|
+
styleIsolation: 'apply-shared',
|
|
7
|
+
},
|
|
8
|
+
properties: {
|
|
9
|
+
element: {
|
|
10
|
+
type: Object,
|
|
11
|
+
value: {},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
data: {
|
|
15
|
+
wrapperStyle: '',
|
|
16
|
+
contentStyle: '',
|
|
17
|
+
},
|
|
18
|
+
observers: {
|
|
19
|
+
element(el) {
|
|
20
|
+
if (!el)
|
|
21
|
+
return;
|
|
22
|
+
const wrapperStyle = (0, index_1.styleObjectToString)((0, index_1.buildWrapperStyle)(el, 'rpx'), 'rpx');
|
|
23
|
+
const contentStyle = (0, index_1.styleObjectToString)((0, index_1.buildBaseContentStyle)(el), 'rpx');
|
|
24
|
+
this.setData({ wrapperStyle, contentStyle });
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("../../../../vendor/km-card-layout-core/index");
|
|
4
|
+
const icon_map_1 = require("../../icon-map");
|
|
5
|
+
const mapIconGlyph = (name, fallback) => {
|
|
6
|
+
if (!name)
|
|
7
|
+
return fallback;
|
|
8
|
+
const glyph = icon_map_1.ICON_CODE_MAP[name];
|
|
9
|
+
if (glyph)
|
|
10
|
+
return String.fromCharCode(parseInt(glyph, 16));
|
|
11
|
+
return fallback || name;
|
|
12
|
+
};
|
|
13
|
+
Component({
|
|
14
|
+
options: {
|
|
15
|
+
styleIsolation: 'apply-shared',
|
|
16
|
+
},
|
|
17
|
+
properties: {
|
|
18
|
+
element: {
|
|
19
|
+
type: Object,
|
|
20
|
+
value: {},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
data: {
|
|
24
|
+
wrapperStyle: '',
|
|
25
|
+
contentStyle: '',
|
|
26
|
+
iconText: '',
|
|
27
|
+
},
|
|
28
|
+
observers: {
|
|
29
|
+
element(el) {
|
|
30
|
+
if (!el)
|
|
31
|
+
return;
|
|
32
|
+
const wrapperStyle = (0, index_1.styleObjectToString)((0, index_1.buildWrapperStyle)(el, 'rpx'), 'rpx');
|
|
33
|
+
const contentStyle = (0, index_1.styleObjectToString)((0, index_1.buildBaseContentStyle)(el), 'rpx');
|
|
34
|
+
const name = (0, index_1.getIconName)(el);
|
|
35
|
+
const iconText = mapIconGlyph(name, name || '');
|
|
36
|
+
this.setData({ wrapperStyle, contentStyle, iconText });
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.km-node {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
color: inherit;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.km-node--icon {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.km-node__icon {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
font-family: 'km-icon', 'PingFang SC', 'Microsoft Yahei', sans-serif;
|
|
19
|
+
font-style: normal;
|
|
20
|
+
font-weight: normal;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: 'km-icon';
|
|
25
|
+
src: url('data:font/woff;charset=utf-8;base64,d09GRgABAAAAAEl4AA0AAAAAcmgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAABJXAAAABoAAAAcrMtJV0dERUYAAEk8AAAAHgAAAB4AKQByT1MvMgAAAaQAAABGAAAAYDw3SVljbWFwAAAC7AAAAM8AAAIW8XL3K2dhc3AAAEk0AAAACAAAAAj//wADZ2x5ZgAABJgAAEBZAABkZPJymXJoZWFkAAABMAAAADEAAAA2MtZiFmhoZWEAAAFkAAAAIAAAACQNagmCaG10eAAAAewAAAD/AAABqqs3Ii9sb2NhAAADvAAAANoAAADaKv0P7G1heHAAAAGEAAAAHwAAACABmQHEbmFtZQAARPQAAAFGAAACgl6CAQJwb3N0AABGPAAAAvUAAATh1g15W3jaY2BkYGAA4lqffPd4fpuvDNwsDCDwVIyfA0b///i/gXMWcyeQy8HABBIFAAVdCfwAAAB42mNgZGBgbvjfwBDDOfP/x///OWcxAEVQQCYAuxgH/XjaY2BkYGDIYdzBoMwAAkxAzAWEDAz/wXwGACjlAl8AeNpjYGFRYJzAwMrAwNTJdIaBgaEfQjO+ZjBi5ACKMrAyM2AFAWmuKQwHnjE+y2Ju+N/AwMB8h6ERKMyIpESBgREAenQNCwAAeNo90cErBGEYx/Hf1LMH7MVxoigHtS600pzWnMjBlt2dFAeiNuWgXLgokgslbpyE/Aduyl38J3ty4aCs7/vOk6lPv+d5531n3nfGVF5JIZlUx9fAbawnEfIFq14/YhddFPjFmynZ9n4TbYzg2tcMW6Epr4NQT3jSJ2lcW9ec1fSEAheMnVume7KKBbQwiMye+5/kEpqYwQoOY59pn1xGw3Lt8NwHS7UY35frivqbet2fNYZp+4j76vj+GpUhjZJreLfxODecay/eTzVPzmIj9uX7VLnUmfdb/2fN4trcv0kYv8Oxe/V5Rzhg7inZ8wzjN5b0f6z8PV2d/AHivi0JAHja3dBFUoVRDITR88PD3d3d3d3d3d33zQqYwwVGbIGk8qV6kK7qIN7vlIsCRdlBRT865iPsWOig318/PwOjbwYd+7mKSZAoSbIUqdKky5ApS7YcufLkK1CoSLESpcqCZ4VKVarVqFWnXoNGTZq1aNWmXYdOXbr16NWn34BBQ4aNGDVm3IRJU6bNmDVn3oJFS5atWLVm3YZNW7bt2LVn34FDR46dOHXm3IVLV67duHXn3oNHT8Hv2YtXbyFaot9HfMeMC4jztyL/vr4AXx4eawAAAAAAAAAAAACwAPIDSgQ8BLIFUgWUBcIF/gY8BpIHCgdAB3wHoAgOCHAIxgk+CV4JzAnqCkQKrgtUC8QMEAxsDNQNFA1SDegONg6qDyQPgg/CEAIQxBEwEaQSHBLYE14T4hRcFPIVTBYMFkwWqBckGGAYxhmYGegaEBpeGuIbXhvwHPQd5B62Hygf6CBeILog9CFUIbgiBCJ0ItQjbCQSJGgkuCVsJcImKib0J44ocijOKSApUCo2KmQqtituK34sJixkLMgtdC3WLpgvPC+QMBww/DGCMagyMgAA') format('woff');
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
font-style: normal;
|
|
28
|
+
font-display: swap;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.icon {
|
|
32
|
+
font-family: 'km-icon' !important;
|
|
33
|
+
font-size: 16px;
|
|
34
|
+
font-style: normal;
|
|
35
|
+
-webkit-font-smoothing: antialiased;
|
|
36
|
+
-moz-osx-font-smoothing: grayscale;
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("../../../../vendor/km-card-layout-core/index");
|
|
4
|
+
Component({
|
|
5
|
+
options: {
|
|
6
|
+
styleIsolation: 'apply-shared',
|
|
7
|
+
},
|
|
8
|
+
properties: {
|
|
9
|
+
element: {
|
|
10
|
+
type: Object,
|
|
11
|
+
value: {},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
data: {
|
|
15
|
+
wrapperStyle: '',
|
|
16
|
+
contentStyle: '',
|
|
17
|
+
imageSrc: '',
|
|
18
|
+
mode: 'aspectFill',
|
|
19
|
+
},
|
|
20
|
+
observers: {
|
|
21
|
+
element(el) {
|
|
22
|
+
if (!el)
|
|
23
|
+
return;
|
|
24
|
+
const wrapperStyle = (0, index_1.styleObjectToString)((0, index_1.buildWrapperStyle)(el, 'rpx'), 'rpx');
|
|
25
|
+
const contentStyle = (0, index_1.styleObjectToString)((0, index_1.buildImageContentStyle)(el), 'rpx');
|
|
26
|
+
const imageSrc = (0, index_1.getImageSrc)(el);
|
|
27
|
+
const mode = el.fit === 'contain' ? 'aspectFit' : 'aspectFill';
|
|
28
|
+
this.setData({ wrapperStyle, contentStyle, imageSrc, mode });
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("../../../../vendor/km-card-layout-core/index");
|
|
4
|
+
const icon_map_1 = require("../../icon-map");
|
|
5
|
+
const mapIconGlyph = (name, fallback) => {
|
|
6
|
+
if (!name)
|
|
7
|
+
return fallback;
|
|
8
|
+
const glyph = icon_map_1.ICON_CODE_MAP[name];
|
|
9
|
+
if (glyph)
|
|
10
|
+
return String.fromCharCode(parseInt(glyph, 16));
|
|
11
|
+
return fallback || name;
|
|
12
|
+
};
|
|
13
|
+
Component({
|
|
14
|
+
options: {
|
|
15
|
+
styleIsolation: 'apply-shared',
|
|
16
|
+
},
|
|
17
|
+
properties: {
|
|
18
|
+
element: {
|
|
19
|
+
type: Object,
|
|
20
|
+
value: {},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
data: {
|
|
24
|
+
wrapperStyle: '',
|
|
25
|
+
contentStyle: '',
|
|
26
|
+
textValue: '',
|
|
27
|
+
iconMeta: null,
|
|
28
|
+
},
|
|
29
|
+
observers: {
|
|
30
|
+
element(el) {
|
|
31
|
+
if (!el)
|
|
32
|
+
return;
|
|
33
|
+
const wrapperStyle = (0, index_1.styleObjectToString)((0, index_1.buildWrapperStyle)(el, 'rpx'), 'rpx');
|
|
34
|
+
const contentStyle = (0, index_1.styleObjectToString)((0, index_1.buildTextContentStyle)(el, 'rpx'), 'rpx');
|
|
35
|
+
const textValue = (0, index_1.getTextValue)(el);
|
|
36
|
+
const iconRaw = (0, index_1.buildTextIconMeta)(el, 'rpx');
|
|
37
|
+
const iconMeta = iconRaw && iconRaw.name
|
|
38
|
+
? {
|
|
39
|
+
...iconRaw,
|
|
40
|
+
text: mapIconGlyph(iconRaw.name, iconRaw.name),
|
|
41
|
+
wrapperStyle: (0, index_1.styleObjectToString)(iconRaw.wrapperStyle, 'rpx'),
|
|
42
|
+
}
|
|
43
|
+
: iconRaw;
|
|
44
|
+
this.setData({ wrapperStyle, contentStyle, textValue, iconMeta });
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<view class="km-node km-node--text" style="{{wrapperStyle}}">
|
|
2
|
+
<view class="km-node__text" style="{{contentStyle}}">
|
|
3
|
+
<block wx:if="{{iconMeta && iconMeta.name}}">
|
|
4
|
+
<view class="km-node__text-content">
|
|
5
|
+
<block wx:if="{{iconMeta.align === 'right'}}">
|
|
6
|
+
<text class="km-node__text-value">{{textValue || ''}}</text>
|
|
7
|
+
<view style="{{iconMeta.wrapperStyle}}" class="km-node__text-icon--wrapper" >
|
|
8
|
+
<text
|
|
9
|
+
class="km-node__text-icon icon"
|
|
10
|
+
style="font-size: {{iconMeta.size || '16px'}}; color: {{iconMeta.color || ''}}; margin-right: {{iconMeta.gap || ''}};"
|
|
11
|
+
>{{iconMeta.text || iconMeta.name || ''}}</text>
|
|
12
|
+
</view>
|
|
13
|
+
</block>
|
|
14
|
+
<block wx:else>
|
|
15
|
+
<view style="{{iconMeta.wrapperStyle}}" class="km-node__text-icon--wrapper">
|
|
16
|
+
<text
|
|
17
|
+
class="km-node__text-icon icon"
|
|
18
|
+
style="font-size: {{iconMeta.size || '16px'}}; color: {{iconMeta.color || ''}}; margin-right: {{iconMeta.gap || ''}};"
|
|
19
|
+
>{{iconMeta.text || iconMeta.name || ''}}</text>
|
|
20
|
+
</view>
|
|
21
|
+
<text class="km-node__text-value">{{textValue || ''}}</text>
|
|
22
|
+
</block>
|
|
23
|
+
</view>
|
|
24
|
+
</block>
|
|
25
|
+
<block wx:else>
|
|
26
|
+
<text class="km-node__text-value">{{textValue || ''}}</text>
|
|
27
|
+
</block>
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.km-node {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
color: inherit;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.km-node--text {
|
|
7
|
+
/* overflow hidden if needed */
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.km-node--text text {
|
|
11
|
+
display: inline;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.km-node__text {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
display: block;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
text-align: inherit;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.km-node__text-content {
|
|
23
|
+
display: inline-block;
|
|
24
|
+
vertical-align: middle;
|
|
25
|
+
height: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.km-node__text-icon {
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.km-node__text-value {
|
|
35
|
+
display: inline-block;
|
|
36
|
+
white-space: pre-wrap;
|
|
37
|
+
word-break: break-word;
|
|
38
|
+
vertical-align: middle;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@font-face {
|
|
42
|
+
font-family: 'km-icon';
|
|
43
|
+
src: url('data:font/woff;charset=utf-8;base64,d09GRgABAAAAAEl4AA0AAAAAcmgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAABJXAAAABoAAAAcrMtJV0dERUYAAEk8AAAAHgAAAB4AKQByT1MvMgAAAaQAAABGAAAAYDw3SVljbWFwAAAC7AAAAM8AAAIW8XL3K2dhc3AAAEk0AAAACAAAAAj//wADZ2x5ZgAABJgAAEBZAABkZPJymXJoZWFkAAABMAAAADEAAAA2MtZiFmhoZWEAAAFkAAAAIAAAACQNagmCaG10eAAAAewAAAD/AAABqqs3Ii9sb2NhAAADvAAAANoAAADaKv0P7G1heHAAAAGEAAAAHwAAACABmQHEbmFtZQAARPQAAAFGAAACgl6CAQJwb3N0AABGPAAAAvUAAATh1g15W3jaY2BkYGAA4lqffPd4fpuvDNwsDCDwVIyfA0b///i/gXMWcyeQy8HABBIFAAVdCfwAAAB42mNgZGBgbvjfwBDDOfP/x///OWcxAEVQQCYAuxgH/XjaY2BkYGDIYdzBoMwAAkxAzAWEDAz/wXwGACjlAl8AeNpjYGFRYJzAwMrAwNTJdIaBgaEfQjO+ZjBi5ACKMrAyM2AFAWmuKQwHnjE+y2Ju+N/AwMB8h6ERKMyIpESBgREAenQNCwAAeNo90cErBGEYx/Hf1LMH7MVxoigHtS600pzWnMjBlt2dFAeiNuWgXLgokgslbpyE/Aduyl38J3ty4aCs7/vOk6lPv+d5531n3nfGVF5JIZlUx9fAbawnEfIFq14/YhddFPjFmynZ9n4TbYzg2tcMW6Epr4NQT3jSJ2lcW9ec1fSEAheMnVume7KKBbQwiMye+5/kEpqYwQoOY59pn1xGw3Lt8NwHS7UY35frivqbet2fNYZp+4j76vj+GpUhjZJreLfxODecay/eTzVPzmIj9uX7VLnUmfdb/2fN4trcv0kYv8Oxe/V5Rzhg7inZ8wzjN5b0f6z8PV2d/AHivi0JAHja3dBFUoVRDITR88PD3d3d3d3d3d33zQqYwwVGbIGk8qV6kK7qIN7vlIsCRdlBRT865iPsWOig318/PwOjbwYd+7mKSZAoSbIUqdKky5ApS7YcufLkK1CoSLESpcqCZ4VKVarVqFWnXoNGTZq1aNWmXYdOXbr16NWn34BBQ4aNGDVm3IRJU6bNmDVn3oJFS5atWLVm3YZNW7bt2LVn34FDR46dOHXm3IVLV67duHXn3oNHT8Hv2YtXbyFaot9HfMeMC4jztyL/vr4AXx4eawAAAAAAAAAAAACwAPIDSgQ8BLIFUgWUBcIF/gY8BpIHCgdAB3wHoAgOCHAIxgk+CV4JzAnqCkQKrgtUC8QMEAxsDNQNFA1SDegONg6qDyQPgg/CEAIQxBEwEaQSHBLYE14T4hRcFPIVTBYMFkwWqBckGGAYxhmYGegaEBpeGuIbXhvwHPQd5B62Hygf6CBeILog9CFUIbgiBCJ0ItQjbCQSJGgkuCVsJcImKib0J44ocijOKSApUCo2KmQqtituK34sJixkLMgtdC3WLpgvPC+QMBww/DGCMagyMgAA') format('woff');
|
|
44
|
+
font-weight: normal;
|
|
45
|
+
font-style: normal;
|
|
46
|
+
font-display: swap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.icon {
|
|
50
|
+
font-family: 'km-icon' !important;
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
font-style: normal;
|
|
53
|
+
-webkit-font-smoothing: antialiased;
|
|
54
|
+
-moz-osx-font-smoothing: grayscale;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.km-node__text-icon--wrapper{
|
|
58
|
+
display: inline-block;
|
|
59
|
+
}
|