km-card-layout-component-miniprogram 0.1.5 → 0.1.7

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.
Files changed (24) hide show
  1. package/example/pages/home/index.js +4 -250
  2. package/miniprogram_dist/components/card-layout/index.js +214 -29
  3. package/miniprogram_dist/components/card-layout/index.wxml +29 -5
  4. package/miniprogram_dist/components/card-layout/index.wxss +28 -6
  5. package/miniprogram_dist/vendor/km-card-layout-core/index.js +58 -181
  6. package/miniprogram_dist/vendor/km-card-layout-core/interface/data/payload.js +2 -0
  7. package/miniprogram_dist/vendor/km-card-layout-core/interface/elements.js +2 -0
  8. package/miniprogram_dist/vendor/km-card-layout-core/interface/index.js +20 -0
  9. package/miniprogram_dist/vendor/km-card-layout-core/interface/layout.js +2 -0
  10. package/miniprogram_dist/vendor/km-card-layout-core/interface/render.js +2 -0
  11. package/miniprogram_dist/vendor/km-card-layout-core/utils.js +132 -0
  12. package/package.json +1 -1
  13. package/script/sync-core.js +10 -2
  14. package/src/components/card-layout/index.ts +340 -56
  15. package/src/components/card-layout/index.wxml +29 -5
  16. package/src/components/card-layout/index.wxss +28 -6
  17. package/src/vendor/km-card-layout-core/index.ts +153 -461
  18. package/src/vendor/km-card-layout-core/interface/data/payload.ts +45 -0
  19. package/src/vendor/km-card-layout-core/interface/elements.ts +73 -0
  20. package/src/vendor/km-card-layout-core/interface/index.ts +4 -0
  21. package/src/vendor/km-card-layout-core/interface/layout.ts +19 -0
  22. package/src/vendor/km-card-layout-core/interface/render.ts +52 -0
  23. package/src/vendor/km-card-layout-core/types.d.ts +22 -154
  24. package/src/vendor/km-card-layout-core/utils.ts +141 -0
@@ -1,253 +1,7 @@
1
- const layouts = [
2
- {
3
- "id": "3",
4
- "name": "内置布局-右侧logo",
5
- "width": 343,
6
- "height": 210,
7
- "children": [
8
- {
9
- "id": "f2dd3515-2147-460a-b788-3f58dd5f858b",
10
- "type": "custom",
11
- "style": {
12
- "borderRadius": 0,
13
- "backgroundColor": "currentColor"
14
- },
15
- "layout": {
16
- "x": 20,
17
- "y": 104,
18
- "mode": "absolute",
19
- "width": 12,
20
- "height": 1,
21
- "zIndex": 8
22
- },
23
- "binding": "decor-1764137606935"
24
- },
25
- {
26
- "id": "7fd4c8cd-6bea-42d0-9a80-b1ba27f4abd3",
27
- "type": "custom",
28
- "style": {
29
- "borderRadius": 0,
30
- "backgroundColor": "currentColor"
31
- },
32
- "layout": {
33
- "x": 37,
34
- "y": 104,
35
- "mode": "absolute",
36
- "width": 105,
37
- "height": 1,
38
- "zIndex": 9
39
- },
40
- "binding": "decor-1764137663972"
41
- },
42
- {
43
- "id": "4985e0b1-8200-4f15-b18e-e1dcccce56a4",
44
- "name": "mobile",
45
- "type": "icon",
46
- "style": {
47
- "color": "",
48
- "fontSize": 11
49
- },
50
- "layout": {
51
- "x": 20,
52
- "y": 124,
53
- "mode": "absolute",
54
- "width": 11,
55
- "height": 11,
56
- "zIndex": 10
57
- },
58
- "binding": "decor-icon-1764137759247"
59
- },
60
- {
61
- "id": "a5fbea00-26d1-4f68-8cea-053e8541ae5c",
62
- "name": "email",
63
- "type": "icon",
64
- "style": {
65
- "color": "",
66
- "fontSize": 10
67
- },
68
- "layout": {
69
- "x": 20,
70
- "y": 147,
71
- "mode": "absolute",
72
- "width": 10,
73
- "height": 10,
74
- "zIndex": 11
75
- },
76
- "binding": "decor-icon-1764137817702"
77
- },
78
- {
79
- "id": "ce82ffa0-3e48-48aa-81c2-a5fbe07271a7",
80
- "name": "address",
81
- "type": "icon",
82
- "style": {
83
- "color": "",
84
- "fontSize": 10
85
- },
86
- "layout": {
87
- "x": 20,
88
- "y": 169,
89
- "mode": "absolute",
90
- "width": 10,
91
- "height": 10,
92
- "zIndex": 12
93
- },
94
- "binding": "decor-icon-1764137829061"
95
- },
96
- {
97
- "id": "1",
98
- "type": "text",
99
- "style": {
100
- "color": "",
101
- "fontSize": 16,
102
- "textAlign": "left",
103
- "fontWeight": "bold",
104
- "lineHeight": 22
105
- },
106
- "layout": {
107
- "x": 20,
108
- "y": 45,
109
- "mode": "absolute",
110
- "width": 210,
111
- "height": 22,
112
- "zIndex": 1
113
- },
114
- "binding": "user.name",
115
- "defaultValue": "名片君"
116
- },
117
- {
118
- "id": "2",
119
- "type": "text",
120
- "style": {
121
- "color": "",
122
- "fontSize": 11,
123
- "textAlign": "left",
124
- "fontWeight": "normal",
125
- "lineHeight": 15
126
- },
127
- "layout": {
128
- "x": 20,
129
- "y": 74,
130
- "mode": "absolute",
131
- "width": 210,
132
- "height": 15,
133
- "zIndex": 3
134
- },
135
- "binding": "user.company",
136
- "defaultValue": "合肥魅客网络有限公司"
137
- },
138
- {
139
- "id": "4",
140
- "type": "text",
141
- "style": {
142
- "color": "",
143
- "fontSize": 10,
144
- "textAlign": "left",
145
- "fontWeight": "normal",
146
- "lineHeight": 15
147
- },
148
- "layout": {
149
- "x": 20,
150
- "y": 21,
151
- "mode": "absolute",
152
- "width": 210,
153
- "height": 15,
154
- "zIndex": 2
155
- },
156
- "binding": "user.duty",
157
- "defaultValue": "销售经理"
158
- },
159
- {
160
- "id": "3",
161
- "type": "text",
162
- "style": {
163
- "color": "",
164
- "fontSize": 10,
165
- "textAlign": "left",
166
- "fontWeight": "normal",
167
- "lineHeight": 15
168
- },
169
- "layout": {
170
- "x": 36,
171
- "y": 123,
172
- "mode": "absolute",
173
- "width": 280,
174
- "height": 15,
175
- "zIndex": 5
176
- },
177
- "binding": "user.mobile",
178
- "defaultValue": "18888888888"
179
- },
180
- {
181
- "id": "5",
182
- "type": "text",
183
- "style": {
184
- "color": "",
185
- "fontSize": 10,
186
- "textAlign": "left",
187
- "fontWeight": "normal",
188
- "lineHeight": 15
189
- },
190
- "layout": {
191
- "x": 36,
192
- "y": 145,
193
- "mode": "absolute",
194
- "width": 280,
195
- "height": 15,
196
- "zIndex": 6
197
- },
198
- "binding": "user.email",
199
- "defaultValue": "km@kuanmai.com"
200
- },
201
- {
202
- "id": "8",
203
- "url": "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4c71811adfa51e1e3ab4181a88cebc87.png",
204
- "type": "image",
205
- "style": {
206
- "color": "#000000",
207
- "objectFit": "contain",
208
- "borderRadius": 0
209
- },
210
- "layout": {
211
- "x": 263,
212
- "y": 20,
213
- "mode": "absolute",
214
- "width": 60,
215
- "height": 60,
216
- "zIndex": 4
217
- },
218
- "binding": "user.logo",
219
- "defaultValue": "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4c71811adfa51e1e3ab4181a88cebc87.png"
220
- },
221
- {
222
- "id": "9",
223
- "type": "text",
224
- "style": {
225
- "color": "",
226
- "fontSize": 10,
227
- "textAlign": "left",
228
- "fontWeight": "normal",
229
- "lineHeight": 15
230
- },
231
- "layout": {
232
- "x": 36,
233
- "y": 167,
234
- "mode": "absolute",
235
- "width": 280,
236
- "height": 33,
237
- "zIndex": 7
238
- },
239
- "binding": "user.address",
240
- "defaultValue": "安徽省合肥市包河区硅谷大厦"
241
- }
242
- ],
243
- "container": {
244
- "mode": "absolute"
245
- },
246
- "fontColor": "#333333",
247
- "backgroundImage": "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/0a7331e2e1a9a4cbc828afe6c338aaae.png",
248
- "backgroundZIndex": 1
249
- }
250
- ]
1
+
2
+
3
+ const layouts = [{"name":"内置布局-右侧logo","width":343,"height":210,"children":[{"id":"f2dd3515-2147-460a-b788-3f58dd5f858b","type":"custom","style":{"borderRadius":0,"backgroundColor":"currentColor"},"layout":{"x":20,"y":104,"mode":"absolute","width":12,"height":1,"zIndex":8}},{"id":"7fd4c8cd-6bea-42d0-9a80-b1ba27f4abd3","type":"custom","style":{"borderRadius":0,"backgroundColor":"currentColor"},"layout":{"x":37,"y":104,"mode":"absolute","width":105,"height":1,"zIndex":9}},{"id":"1","key":"name","type":"text","style":{"color":"","fontSize":16,"textAlign":"left","fontWeight":"bold","lineHeight":22},"layout":{"x":20,"y":45,"mode":"absolute","width":210,"height":22,"zIndex":1},"binding":"user.name","defaultValue":"名片君"},{"id":"2","key":"company","type":"text","style":{"color":"","fontSize":11,"textAlign":"left","fontWeight":"normal","lineHeight":15},"layout":{"x":20,"y":74,"mode":"absolute","width":210,"height":15,"zIndex":3},"binding":"user.company","defaultValue":"合肥魅客网络有限公司"},{"id":"4","key":"duty","type":"text","style":{"color":"","fontSize":10,"textAlign":"left","fontWeight":"normal","lineHeight":15},"layout":{"x":20,"y":21,"mode":"absolute","width":210,"height":15,"zIndex":2},"binding":"user.duty","defaultValue":"销售经理"},{"id":"3","key":"mobile","icon":{"style":"fill","enable":true},"type":"text","style":{"color":"","fontSize":10,"textAlign":"left","fontWeight":"normal","lineHeight":15},"layout":{"x":20,"y":123,"mode":"absolute","width":280,"height":15,"zIndex":5},"binding":"user.mobile","defaultValue":"18888888888"},{"id":"5","key":"email","icon":{"style":"fill","enable":true},"type":"text","style":{"color":"","fontSize":10,"textAlign":"left","fontWeight":"normal","lineHeight":15},"layout":{"x":20,"y":145,"mode":"absolute","width":280,"height":15,"zIndex":6},"binding":"user.email","defaultValue":"km@kuanmai.com"},{"id":"8","key":"logo","type":"image","style":{"color":"#000000","objectFit":"contain","borderRadius":0},"layout":{"x":263,"y":20,"mode":"absolute","width":60,"height":60,"zIndex":4},"binding":"user.logo","defaultValue":"https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4c71811adfa51e1e3ab4181a88cebc87.png"},{"id":"9","key":"address","icon":{"style":"fill","enable":true},"type":"text","style":{"color":"","fontSize":10,"textAlign":"left","fontWeight":"normal","lineHeight":15},"layout":{"x":20,"y":167,"mode":"absolute","width":280,"height":33,"zIndex":7},"binding":"user.address","defaultValue":"安徽省合肥市包河区硅谷大厦"}],"container":{"mode":"absolute"},"fontColor":"#333333","backgroundImage":"https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/0a7331e2e1a9a4cbc828afe6c338aaae.png","backgroundZIndex":1}]
4
+
251
5
 
252
6
  const cardData = {
253
7
  user: {
@@ -12,25 +12,226 @@ const pickCardId = (layout, idx) => {
12
12
  return layout.name || layout.id;
13
13
  return `card-${idx}`;
14
14
  };
15
+ const withUnit = (value, unit) => (0, index_1.addUnit)(value, unit);
16
+ const buildCardStyle = (layout, unit) => (0, index_1.styleObjectToString)({
17
+ width: withUnit(layout.width, unit),
18
+ height: withUnit(layout.height, unit),
19
+ color: layout.fontColor,
20
+ borderRadius: layout.borderRadius !== undefined
21
+ ? withUnit(layout.borderRadius, unit)
22
+ : undefined,
23
+ padding: layout.padding !== undefined ? withUnit(layout.padding, unit) : undefined,
24
+ position: 'relative',
25
+ overflow: 'hidden',
26
+ boxSizing: 'border-box',
27
+ backgroundColor: 'transparent',
28
+ }, unit);
29
+ const buildBackgroundStyle = (layout, unit) => (0, index_1.styleObjectToString)({
30
+ zIndex: layout.backgroundZIndex,
31
+ borderRadius: layout.borderRadius !== undefined
32
+ ? withUnit(layout.borderRadius, unit)
33
+ : undefined,
34
+ width: '100%',
35
+ height: '100%',
36
+ position: 'absolute',
37
+ left: 0,
38
+ top: 0,
39
+ }, unit);
40
+ const buildWrapperStyle = (el, unit) => {
41
+ if (!el.layout || el.layout.mode !== 'absolute')
42
+ return '';
43
+ return (0, index_1.styleObjectToString)({
44
+ position: 'absolute',
45
+ left: withUnit(el.layout.x, unit),
46
+ top: withUnit(el.layout.y, unit),
47
+ width: withUnit(el.layout.width, unit),
48
+ height: withUnit(el.layout.height, unit),
49
+ zIndex: el.layout.zIndex,
50
+ boxSizing: 'border-box',
51
+ display: 'flex',
52
+ alignItems: 'center',
53
+ }, unit);
54
+ };
55
+ const buildPanelContentStyle = (el, unit) => (0, index_1.styleObjectToString)({
56
+ position: 'relative',
57
+ width: '100%',
58
+ height: '100%',
59
+ display: 'block',
60
+ boxSizing: 'border-box',
61
+ ...(el.style || {}),
62
+ }, unit);
63
+ const buildTextContentStyle = (el, unit) => {
64
+ var _a, _b, _c;
65
+ const textAlign = ((_a = el.style) === null || _a === void 0 ? void 0 : _a.textAlign) || el.align || undefined;
66
+ const style = {
67
+ ...el.style,
68
+ whiteSpace: 'pre-wrap',
69
+ wordBreak: 'break-word',
70
+ lineHeight: ((_b = el.style) === null || _b === void 0 ? void 0 : _b.lineHeight) !== undefined && ((_c = el.style) === null || _c === void 0 ? void 0 : _c.lineHeight) !== null
71
+ ? el.style.lineHeight
72
+ : '1.2',
73
+ display: 'inline-flex',
74
+ alignItems: 'center',
75
+ };
76
+ if (textAlign)
77
+ style.textAlign = textAlign;
78
+ return (0, index_1.styleObjectToString)(style, unit);
79
+ };
80
+ const buildBaseContentStyle = (el, unit) => (0, index_1.styleObjectToString)({
81
+ ...(el.style || {}),
82
+ boxSizing: 'border-box',
83
+ }, unit);
84
+ const mapIconGlyph = (name, fallback) => {
85
+ if (!name)
86
+ return fallback;
87
+ const glyph = icon_map_1.ICON_CODE_MAP[name];
88
+ if (glyph)
89
+ return String.fromCharCode(parseInt(glyph, 16));
90
+ return fallback || name;
91
+ };
92
+ const buildTextIcon = (el, unit) => {
93
+ var _a, _b, _c, _d, _e;
94
+ const icon = el.icon;
95
+ if (!icon || icon.enable === false)
96
+ return undefined;
97
+ const style = icon.style || 'fill';
98
+ const baseName = el.key || el.binding || el.id;
99
+ let name;
100
+ if (style === 'dot')
101
+ name = 'round';
102
+ else if (style === 'line')
103
+ name = baseName ? `${baseName}-line` : undefined;
104
+ else
105
+ name = baseName || undefined;
106
+ if (!name)
107
+ return undefined;
108
+ const size = icon.size !== undefined && icon.size !== null
109
+ ? icon.size
110
+ : (_a = el.style) === null || _a === void 0 ? void 0 : _a.fontSize;
111
+ const gap = icon.gap !== undefined && icon.gap !== null ? icon.gap : 4;
112
+ const color = (_d = (_b = icon.color) !== null && _b !== void 0 ? _b : (_c = el.style) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : undefined;
113
+ const text = mapIconGlyph(name, name);
114
+ return {
115
+ name,
116
+ text,
117
+ size: size !== undefined ? withUnit(size, unit) : undefined,
118
+ gap: gap !== undefined ? withUnit(gap, unit) : undefined,
119
+ wrapperStyle: (0, index_1.styleObjectToString)({
120
+ display: 'inline-flex',
121
+ alignItems: 'center',
122
+ height: ((_e = el.style) === null || _e === void 0 ? void 0 : _e.lineHeight) || 'auto',
123
+ }, unit),
124
+ color,
125
+ align: icon.align || 'left',
126
+ };
127
+ };
128
+ const buildRenderNode = (el, data, unit) => {
129
+ var _a, _b, _c, _d, _e, _f, _g, _h;
130
+ if (!el || el.visible === false)
131
+ return null;
132
+ const wrapperStyle = buildWrapperStyle(el, unit);
133
+ if (el.type === 'layout-panel') {
134
+ const panel = el;
135
+ return {
136
+ id: el.id,
137
+ type: el.type,
138
+ wrapperStyle,
139
+ contentStyle: buildPanelContentStyle(panel, unit),
140
+ children: buildRenderNodes(panel.children || [], data, unit),
141
+ };
142
+ }
143
+ if (el.type === 'text') {
144
+ const textValue = (_b = (_a = (0, index_1.resolveBindingValue)(el.binding, data)) !== null && _a !== void 0 ? _a : el.defaultValue) !== null && _b !== void 0 ? _b : '';
145
+ return {
146
+ id: el.id,
147
+ type: el.type,
148
+ wrapperStyle,
149
+ contentStyle: buildTextContentStyle(el, unit),
150
+ text: `${textValue}`,
151
+ icon: buildTextIcon(el, unit),
152
+ };
153
+ }
154
+ if (el.type === 'image') {
155
+ const style = { ...(el.style || {}) };
156
+ const borderWidth = Number(style.borderWidth);
157
+ if (Number.isFinite(borderWidth) && borderWidth > 0) {
158
+ if (!style.borderStyle)
159
+ style.borderStyle = 'solid';
160
+ if (!style.borderColor)
161
+ style.borderColor = '#000000';
162
+ }
163
+ const src = (_e = (_d = (_c = (0, index_1.resolveBindingValue)(el.binding, data)) !== null && _c !== void 0 ? _c : el.defaultUrl) !== null && _d !== void 0 ? _d : el.defaultValue) !== null && _e !== void 0 ? _e : '';
164
+ const mode = el.fit === 'contain' ? 'aspectFit' : 'aspectFill';
165
+ return {
166
+ id: el.id,
167
+ type: el.type,
168
+ wrapperStyle,
169
+ contentStyle: (0, index_1.styleObjectToString)(style, unit),
170
+ src,
171
+ mode,
172
+ };
173
+ }
174
+ if (el.type === 'icon') {
175
+ const resolved = (_h = (_g = (_f = (0, index_1.resolveBindingValue)(el.binding, data)) !== null && _f !== void 0 ? _f : el.name) !== null && _g !== void 0 ? _g : el.defaultValue) !== null && _h !== void 0 ? _h : '';
176
+ const text = mapIconGlyph(`${resolved}`, `${resolved}`);
177
+ return {
178
+ id: el.id,
179
+ type: el.type,
180
+ wrapperStyle,
181
+ contentStyle: buildBaseContentStyle(el, unit),
182
+ name: `${resolved}`,
183
+ text,
184
+ };
185
+ }
186
+ if (el.type === 'custom') {
187
+ return {
188
+ id: el.id,
189
+ type: el.type,
190
+ wrapperStyle,
191
+ contentStyle: buildBaseContentStyle(el, unit),
192
+ };
193
+ }
194
+ return null;
195
+ };
196
+ const buildRenderNodes = (children, data, unit) => {
197
+ if (!Array.isArray(children))
198
+ return [];
199
+ const nodes = [];
200
+ children.forEach(el => {
201
+ if (!el || el.visible === false)
202
+ return;
203
+ const node = buildRenderNode(el, data, unit);
204
+ if (node)
205
+ nodes.push(node);
206
+ });
207
+ return nodes;
208
+ };
209
+ const buildCards = (layouts, data, unit) => layouts.map(layout => ({
210
+ id: layout.name || layout.id || '',
211
+ cardStyle: buildCardStyle(layout, unit),
212
+ backgroundImage: layout.backgroundImage || '',
213
+ backgroundStyle: buildBackgroundStyle(layout, unit),
214
+ nodes: buildRenderNodes(layout.children || [], data, unit),
215
+ }));
15
216
  Component({
16
217
  options: {
17
- styleIsolation: 'apply-shared'
218
+ styleIsolation: 'apply-shared',
18
219
  },
19
220
  properties: {
20
221
  layout: {
21
222
  type: Array,
22
223
  optionalTypes: [Object],
23
- value: []
224
+ value: [],
24
225
  },
25
226
  data: {
26
227
  type: Object,
27
228
  value: {
28
- user: {}
29
- }
30
- }
229
+ user: {},
230
+ },
231
+ },
31
232
  },
32
233
  data: {
33
- cards: []
234
+ cards: [],
34
235
  },
35
236
  observers: {
36
237
  layout() {
@@ -38,27 +239,14 @@ Component({
38
239
  },
39
240
  data() {
40
241
  this.rebuild();
41
- }
242
+ },
42
243
  },
43
244
  lifetimes: {
44
245
  attached() {
45
246
  this.rebuild();
46
- }
247
+ },
47
248
  },
48
249
  methods: {
49
- normalizeIconGlyph(nodes) {
50
- return nodes.map(node => {
51
- if (node.type === 'icon') {
52
- const glyph = icon_map_1.ICON_CODE_MAP[node.name || node.text || ''];
53
- const text = glyph ? String.fromCharCode(parseInt(glyph, 16)) : node.text;
54
- return { ...node, text };
55
- }
56
- if (node.children && node.children.length) {
57
- return { ...node, children: this.normalizeIconGlyph(node.children) };
58
- }
59
- return node;
60
- });
61
- },
62
250
  rebuild() {
63
251
  const layoutInput = ensureArray(this.data.layout);
64
252
  const dataInput = (this.data.data || {});
@@ -66,15 +254,12 @@ Component({
66
254
  this.setData({ cards: [] });
67
255
  return;
68
256
  }
69
- const rendered = (0, index_1.buildRenderResult)(layoutInput, dataInput, 'rpx');
70
- const cards = rendered.map((card, idx) => ({
257
+ const normalizedLayouts = (0, index_1.normalizeLayout)(layoutInput);
258
+ const cards = buildCards(normalizedLayouts, dataInput, 'rpx').map((card, idx) => ({
259
+ ...card,
71
260
  id: pickCardId(layoutInput[idx], idx),
72
- cardStyle: card.cardStyle,
73
- backgroundImage: card.backgroundImage,
74
- backgroundStyle: card.backgroundStyle,
75
- nodes: this.normalizeIconGlyph(card.renderTree)
76
261
  }));
77
262
  this.setData({ cards });
78
- }
79
- }
263
+ },
264
+ },
80
265
  });
@@ -1,6 +1,6 @@
1
- <view class="km-card-layout-list">
1
+ <view class="km-card-layout">
2
2
  <block wx:for="{{cards}}" wx:key="id">
3
- <view class="km-card-layout-item">
3
+ <view class="km-card-layout__item">
4
4
  <view class="km-card" style="{{item.cardStyle}}">
5
5
  <image
6
6
  wx:if="{{item.backgroundImage}}"
@@ -31,7 +31,7 @@
31
31
  <block wx:elif="{{node.type === 'icon'}}">
32
32
  <view class="km-node km-node--icon" style="{{node.wrapperStyle}}">
33
33
  <view
34
- wx:if="{{node.name === 'dot'}}"
34
+ wx:if="{{node.name === 'dot' || node.name === 'round'}}"
35
35
  class="km-node__icon-dot"
36
36
  style="{{node.contentStyle}}"
37
37
  />
@@ -39,7 +39,7 @@
39
39
  wx:else
40
40
  class="km-node__icon icon"
41
41
  style="{{node.contentStyle}}"
42
- >{{node.text}}</view>
42
+ >{{node.text || ''}}</view>
43
43
  </view>
44
44
  </block>
45
45
  <block wx:elif="{{node.type === 'layout-panel'}}">
@@ -60,7 +60,31 @@
60
60
  </block>
61
61
  <block wx:else>
62
62
  <view class="km-node km-node--text" style="{{node.wrapperStyle}}">
63
- <view style="{{node.contentStyle}}">{{node.text}}</view>
63
+ <view class="km-node__text" style="{{node.contentStyle}}">
64
+ <block wx:if="{{node.icon && node.icon.name}}">
65
+ <view class="km-node__text-content">
66
+ <block wx:if="{{node.icon.align === 'right'}}">
67
+ <text class="km-node__text-value">{{node.text || ''}}</text>
68
+ <view style="{{node.icon.wrapperStyle}}">
69
+ <text
70
+ class="km-node__text-icon icon"
71
+ style="font-size: {{node.icon.size || '16px'}}; color: {{node.icon.color || ''}}; margin-right: {{node.icon.gap || ''}};">{{node.icon.text || node.icon.name || ''}}</text>
72
+ </view>
73
+ </block>
74
+ <block wx:else>
75
+ <view style="{{node.icon.wrapperStyle}}">
76
+ <text
77
+ class="km-node__text-icon icon"
78
+ style="font-size: {{node.icon.size || '16px'}}; color: {{node.icon.color || ''}}; margin-right: {{node.icon.gap || ''}};">{{node.icon.text || node.icon.name || ''}}</text>
79
+ </view>
80
+ <text class="km-node__text-value">{{node.text || ''}}</text>
81
+ </block>
82
+ </view>
83
+ </block>
84
+ <block wx:else>
85
+ <text class="km-node__text-value">{{node.text || ''}}</text>
86
+ </block>
87
+ </view>
64
88
  </view>
65
89
  </block>
66
90
  </template>
@@ -1,11 +1,12 @@
1
1
 
2
2
 
3
- .km-card-layout-list {
3
+ .km-card-layout {
4
4
  display: flex;
5
5
  flex-direction: column;
6
+ gap: 16rpx;
6
7
  }
7
8
 
8
- .km-card-layout-item {
9
+ .km-card-layout__item {
9
10
  width: 100%;
10
11
  }
11
12
 
@@ -15,7 +16,7 @@
15
16
  box-sizing: border-box;
16
17
  color: inherit;
17
18
  font-family: 'PingFang SC', 'Microsoft Yahei', sans-serif;
18
- background: #0f1115;
19
+ background: transparent;
19
20
  }
20
21
 
21
22
  .km-card__bg {
@@ -32,11 +33,12 @@
32
33
  color: inherit;
33
34
  }
34
35
 
35
- .km-node--icon{
36
+ .km-node--icon {
36
37
  display: flex;
37
38
  align-items: center;
38
- justify-items: center;
39
+ justify-content: center;
39
40
  }
41
+
40
42
  .km-node__image {
41
43
  width: 100%;
42
44
  height: 100%;
@@ -73,9 +75,29 @@
73
75
  box-sizing: border-box;
74
76
  }
75
77
 
76
- .km-node--text text {
78
+ .km-node__text {
79
+ width: 100%;
80
+ height: 100%;
77
81
  display: block;
82
+ box-sizing: border-box;
83
+ text-align: inherit;
84
+ }
85
+
86
+ .km-node__text-content {
87
+ display: inline-block;
88
+ vertical-align: middle;
89
+ height: 100%;
90
+ }
91
+
92
+ .km-node__text-value {
93
+ display: inline-block;
94
+ white-space: pre-wrap;
78
95
  word-break: break-word;
96
+ vertical-align: middle;
97
+ }
98
+
99
+ .km-node--text text {
100
+ display: inline;
79
101
  }
80
102
 
81
103
  /* ICON */