km-card-layout-component-miniprogram 0.1.19 → 0.1.21

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 (46) hide show
  1. package/example/app.js +11 -1
  2. package/example/pages/home/index.js +324 -101
  3. package/example/pages/home/index.wxml +2 -1
  4. package/miniprogram_dist/components/card-layout/elements/custom-element/index.js +12 -6
  5. package/miniprogram_dist/components/card-layout/elements/custom-element/index.wxml +4 -6
  6. package/miniprogram_dist/components/card-layout/elements/custom-element/index.wxss +1 -1
  7. package/miniprogram_dist/components/card-layout/elements/icon-element/index.js +32 -15
  8. package/miniprogram_dist/components/card-layout/elements/icon-element/index.wxml +3 -7
  9. package/miniprogram_dist/components/card-layout/elements/icon-element/index.wxss +3 -17
  10. package/miniprogram_dist/components/card-layout/elements/icon-font.wxss +429 -0
  11. package/miniprogram_dist/components/card-layout/elements/image-element/index.js +18 -9
  12. package/miniprogram_dist/components/card-layout/elements/image-element/index.wxml +8 -10
  13. package/miniprogram_dist/components/card-layout/elements/image-element/index.wxss +1 -1
  14. package/miniprogram_dist/components/card-layout/elements/layout-panel-element/index.js +37 -0
  15. package/miniprogram_dist/components/card-layout/elements/layout-panel-element/index.json +3 -0
  16. package/miniprogram_dist/components/card-layout/elements/layout-panel-element/index.wxml +5 -0
  17. package/miniprogram_dist/components/card-layout/elements/layout-panel-element/index.wxss +10 -0
  18. package/miniprogram_dist/components/card-layout/elements/text-element/index.js +41 -17
  19. package/miniprogram_dist/components/card-layout/elements/text-element/index.wxml +8 -34
  20. package/miniprogram_dist/components/card-layout/elements/text-element/index.wxss +5 -18
  21. package/miniprogram_dist/components/card-layout/index.js +39 -108
  22. package/miniprogram_dist/components/card-layout/index.json +9 -1
  23. package/miniprogram_dist/components/card-layout/index.wxml +25 -46
  24. package/miniprogram_dist/components/card-layout/index.wxss +1 -538
  25. package/package.json +1 -1
  26. package/src/components/card-layout/elements/custom-element/index.ts +13 -7
  27. package/src/components/card-layout/elements/custom-element/index.wxml +4 -6
  28. package/src/components/card-layout/elements/custom-element/index.wxss +1 -1
  29. package/src/components/card-layout/elements/icon-element/index.ts +34 -16
  30. package/src/components/card-layout/elements/icon-element/index.wxml +3 -7
  31. package/src/components/card-layout/elements/icon-element/index.wxss +3 -17
  32. package/src/components/card-layout/elements/icon-font.wxss +429 -0
  33. package/src/components/card-layout/elements/image-element/index.ts +21 -11
  34. package/src/components/card-layout/elements/image-element/index.wxml +8 -10
  35. package/src/components/card-layout/elements/image-element/index.wxss +1 -1
  36. package/src/components/card-layout/elements/layout-panel-element/index.json +3 -0
  37. package/src/components/card-layout/elements/layout-panel-element/index.ts +40 -0
  38. package/src/components/card-layout/elements/layout-panel-element/index.wxml +5 -0
  39. package/src/components/card-layout/elements/layout-panel-element/index.wxss +10 -0
  40. package/src/components/card-layout/elements/text-element/index.ts +48 -19
  41. package/src/components/card-layout/elements/text-element/index.wxml +8 -34
  42. package/src/components/card-layout/elements/text-element/index.wxss +5 -18
  43. package/src/components/card-layout/index.json +9 -1
  44. package/src/components/card-layout/index.ts +45 -159
  45. package/src/components/card-layout/index.wxml +25 -46
  46. package/src/components/card-layout/index.wxss +1 -538
@@ -4,19 +4,29 @@ import {
4
4
  getIconName,
5
5
  styleObjectToString,
6
6
  type IconElement,
7
- } from '../../../../vendor/km-card-layout-core/index';
8
- import { ICON_CODE_MAP } from '../../icon-map';
7
+ } from "../../../../vendor/km-card-layout-core/index";
8
+ import { ICON_CODE_MAP } from "../../icon-map";
9
9
 
10
- const mapIconGlyph = (name?: string, fallback?: string) => {
11
- if (!name) return fallback;
12
- const glyph = ICON_CODE_MAP[name];
13
- if (glyph) return String.fromCharCode(parseInt(glyph, 16));
14
- return fallback || name;
10
+ const normalizeIconName = (name?: string) => {
11
+ if (!name) return "";
12
+ return name.startsWith("icon-") ? name.slice(5) : name;
13
+ };
14
+
15
+ const buildIconClassName = (name?: string) => {
16
+ const normalized = normalizeIconName(name);
17
+ if (!normalized) return "";
18
+ return `icon-${normalized}`;
19
+ };
20
+
21
+ const buildIconCode = (name?: string) => {
22
+ const normalized = normalizeIconName(name);
23
+ if (!normalized) return "";
24
+ return ICON_CODE_MAP[normalized] || "";
15
25
  };
16
26
 
17
27
  Component({
18
28
  options: {
19
- styleIsolation: 'apply-shared',
29
+ styleIsolation: "apply-shared",
20
30
  },
21
31
  properties: {
22
32
  element: {
@@ -29,18 +39,26 @@ Component({
29
39
  },
30
40
  },
31
41
  data: {
32
- wrapperStyle: '',
33
- contentStyle: '',
34
- iconText: '',
42
+ wrapperStyle: "",
43
+ contentStyle: "",
44
+ iconClass: "",
45
+ iconCode: "",
35
46
  },
36
47
  observers: {
37
- element(el: IconElement) {
48
+ element() {
49
+ this.rebuild();
50
+ },
51
+ },
52
+ methods: {
53
+ rebuild() {
54
+ const el = this.data.element as IconElement;
38
55
  if (!el) return;
39
- const wrapperStyle = styleObjectToString(buildWrapperStyle(el, 'rpx'), 'rpx');
40
- const contentStyle = styleObjectToString(buildBaseContentStyle(el), 'rpx');
56
+ const wrapperStyle = styleObjectToString(buildWrapperStyle(el, "rpx"), "rpx");
57
+ const contentStyle = styleObjectToString(buildBaseContentStyle(el), "rpx");
41
58
  const name = getIconName(el);
42
- const iconText = mapIconGlyph(name, name || '');
43
- this.setData({ wrapperStyle, contentStyle, iconText });
59
+ const iconClass = buildIconClassName(name);
60
+ const iconCode = buildIconCode(name);
61
+ this.setData({ wrapperStyle, contentStyle, iconClass, iconCode });
44
62
  },
45
63
  },
46
64
  });
@@ -1,7 +1,3 @@
1
- <template name="icon-element">
2
- <view class="km-node km-node--icon" style="{{wrapperStyle}}">
3
- <view class="km-node__icon icon" style="{{contentStyle}}">
4
- {{iconText}}
5
- </view>
6
- </view>
7
- </template>
1
+ <view class="km-node km-node--icon canvas-item" style="{{wrapperStyle}}">
2
+ <view class="km-node__icon icon {{iconClass}} canvas-item" style="{{contentStyle}}" data-icon="{{iconCode}}"></view>
3
+ </view>
@@ -1,3 +1,5 @@
1
+ @import "../icon-font.wxss";
2
+
1
3
  .km-node {
2
4
  box-sizing: border-box;
3
5
  color: inherit;
@@ -18,20 +20,4 @@
18
20
  font-family: 'km-icon', 'PingFang SC', 'Microsoft Yahei', sans-serif;
19
21
  font-style: normal;
20
22
  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
- }
23
+ }
@@ -0,0 +1,429 @@
1
+ .icon {
2
+ font-family: 'km-icon' !important;
3
+ font-size: 16px;
4
+ font-style: normal;
5
+ -webkit-font-smoothing: antialiased;
6
+ -moz-osx-font-smoothing: grayscale;
7
+ }
8
+
9
+ .icon-buy-vip-13:before {
10
+ content: '\e66a';
11
+ }
12
+
13
+ .icon-buy-vip-11:before {
14
+ content: '\e669';
15
+ }
16
+
17
+ .icon-buy-vip-12:before {
18
+ content: '\e668';
19
+ }
20
+
21
+ .icon-contact-wechat:before {
22
+ content: '\e667';
23
+ }
24
+
25
+ .icon-contact-phone:before {
26
+ content: '\e666';
27
+ }
28
+
29
+ .icon-column-group:before {
30
+ content: '\e664';
31
+ }
32
+
33
+ .icon-minichat:before {
34
+ content: '\e617';
35
+ }
36
+
37
+ .icon-remove-module:before {
38
+ content: '\e660';
39
+ }
40
+
41
+ .icon-add-module:before {
42
+ content: '\e662';
43
+ }
44
+
45
+ .icon-drag:before {
46
+ content: '\e661';
47
+ }
48
+
49
+ .icon-switch-company:before {
50
+ content: '\e65f';
51
+ }
52
+
53
+ .icon-switch-person:before {
54
+ content: '\e65e';
55
+ }
56
+
57
+ .icon-manual-entry:before {
58
+ content: '\e65d';
59
+ }
60
+
61
+ .icon-play:before {
62
+ content: '\e65c';
63
+ }
64
+
65
+ .icon-plus:before {
66
+ content: '\e659';
67
+ }
68
+
69
+ .icon-file-pdf:before {
70
+ content: '\e65b';
71
+ }
72
+
73
+ .icon-file-video:before {
74
+ content: '\e65a';
75
+ }
76
+
77
+ .icon-upload:before {
78
+ content: '\e650';
79
+ }
80
+
81
+ .icon-cert-company:before {
82
+ content: '\e64f';
83
+ }
84
+
85
+ .icon-qr-code:before {
86
+ content: '\e658';
87
+ }
88
+
89
+ .icon-company-card:before {
90
+ content: '\e657';
91
+ }
92
+
93
+ .icon-card-import:before {
94
+ content: '\e64e';
95
+ }
96
+
97
+ .icon-camera:before {
98
+ content: '\e655';
99
+ }
100
+
101
+ .icon-card-apply:before {
102
+ content: '\e632';
103
+ }
104
+
105
+ .icon-check-2:before {
106
+ content: '\e616';
107
+ }
108
+
109
+ .icon-check:before {
110
+ content: '\e614';
111
+ }
112
+
113
+ .icon-buy-vip-4:before {
114
+ content: '\e613';
115
+ }
116
+
117
+ .icon-buy-vip-10:before {
118
+ content: '\e656';
119
+ }
120
+
121
+ .icon-weixin-2:before {
122
+ content: '\e653';
123
+ }
124
+
125
+ .icon-qrcode-1:before {
126
+ content: '\e654';
127
+ }
128
+
129
+ .icon-local:before {
130
+ content: '\e652';
131
+ }
132
+
133
+ .icon-cert-job:before {
134
+ content: '\e64d';
135
+ }
136
+
137
+ .icon-cert-name:before {
138
+ content: '\e651';
139
+ }
140
+
141
+ .icon-card-style-1:before {
142
+ content: '\e64c';
143
+ }
144
+
145
+ .icon-add-pic:before {
146
+ content: '\e646';
147
+ }
148
+
149
+ .icon-add-text:before {
150
+ content: '\e647';
151
+ }
152
+
153
+ .icon-buy-vip-2:before {
154
+ content: '\e648';
155
+ }
156
+
157
+ .icon-company-upload-logo:before {
158
+ content: '\e649';
159
+ }
160
+
161
+ .icon-Headset-one:before {
162
+ content: '\e64a';
163
+ }
164
+
165
+ .icon-edit-info:before {
166
+ content: '\e64b';
167
+ }
168
+
169
+ .icon-more-action:before {
170
+ content: '\e645';
171
+ }
172
+
173
+ .icon-upload-video:before {
174
+ content: '\e644';
175
+ }
176
+
177
+ .icon-upload-image:before {
178
+ content: '\e643';
179
+ }
180
+
181
+ .icon-company-info:before {
182
+ content: '\e62a';
183
+ }
184
+
185
+ .icon-contact:before {
186
+ content: '\e642';
187
+ }
188
+
189
+ .icon-notice-1:before {
190
+ content: '\e641';
191
+ }
192
+
193
+ .icon-visitor:before {
194
+ content: '\e640';
195
+ }
196
+
197
+ .icon-mobile-2:before {
198
+ content: '\e63e';
199
+ }
200
+
201
+ .icon-weixin-1:before {
202
+ content: '\e63f';
203
+ }
204
+
205
+ .icon-share:before {
206
+ content: '\e63d';
207
+ }
208
+
209
+ .icon-refund-mistake:before {
210
+ content: '\e637';
211
+ }
212
+
213
+ .icon-buy-vip-7:before {
214
+ content: '\e63b';
215
+ }
216
+
217
+ .icon-table-import:before {
218
+ content: '\e63c';
219
+ }
220
+
221
+ .icon-misService:before {
222
+ content: '\e63a';
223
+ }
224
+
225
+ .icon-buy-vip-6:before {
226
+ content: '\e634';
227
+ }
228
+
229
+ .icon-import:before {
230
+ content: '\e638';
231
+ }
232
+
233
+ .icon-download:before {
234
+ content: '\e639';
235
+ }
236
+
237
+ .icon-image:before {
238
+ content: '\e636';
239
+ }
240
+
241
+ .icon-buy-vip-9:before {
242
+ content: '\e635';
243
+ }
244
+
245
+ .icon-buy-vip-5:before {
246
+ content: '\e62f';
247
+ }
248
+
249
+ .icon-buy-vip-3:before {
250
+ content: '\e630';
251
+ }
252
+
253
+ .icon-buy-vip-1:before {
254
+ content: '\e631';
255
+ }
256
+
257
+ .icon-buy-vip-8:before {
258
+ content: '\e633';
259
+ }
260
+
261
+ .icon-companyWx:before {
262
+ content: '\e62b';
263
+ }
264
+
265
+ .icon-dingding:before {
266
+ content: '\e62c';
267
+ }
268
+
269
+ .icon-shui:before {
270
+ content: '\e62d';
271
+ }
272
+
273
+ .icon-gongzhang:before {
274
+ content: '\e62e';
275
+ }
276
+
277
+ .icon-wait:before {
278
+ content: '\e629';
279
+ }
280
+
281
+ .icon-addImg:before {
282
+ content: '\e628';
283
+ }
284
+
285
+ .icon-copy:before {
286
+ content: '\e625';
287
+ }
288
+
289
+ .icon-mobile-1:before {
290
+ content: '\e627';
291
+ }
292
+
293
+ .icon-functional-config:before {
294
+ content: '\e604';
295
+ }
296
+
297
+ .icon-module-config:before {
298
+ content: '\e601';
299
+ }
300
+
301
+ .icon-select-right:before {
302
+ content: '\e626';
303
+ }
304
+
305
+ .icon-like:before {
306
+ content: '\e624';
307
+ }
308
+
309
+ .icon-weixin:before {
310
+ content: '\e620';
311
+ }
312
+
313
+ .icon-column-user:before {
314
+ content: '\e621';
315
+ }
316
+
317
+ .icon-column-card:before {
318
+ content: '\e622';
319
+ }
320
+
321
+ .icon-column-company-card:before {
322
+ content: '\e623';
323
+ }
324
+
325
+ .icon-on-job:before {
326
+ content: '\e61e';
327
+ }
328
+
329
+ .icon-person:before {
330
+ content: '\e61f';
331
+ }
332
+
333
+ .icon-wallet:before {
334
+ content: '\e615';
335
+ }
336
+
337
+ .icon-opinion:before {
338
+ content: '\e618';
339
+ }
340
+
341
+ .icon-sys-set:before {
342
+ content: '\e619';
343
+ }
344
+
345
+ .icon-sys-msg:before {
346
+ content: '\e61d';
347
+ }
348
+
349
+ .icon-add:before {
350
+ content: '\e61a';
351
+ }
352
+
353
+ .icon-search:before {
354
+ content: '\e61b';
355
+ }
356
+
357
+ .icon-delete:before {
358
+ content: '\e61c';
359
+ }
360
+
361
+ .icon-enter:before {
362
+ content: '\e60f';
363
+ }
364
+
365
+ .icon-card-style:before {
366
+ content: '\e610';
367
+ }
368
+
369
+ .icon-switch:before {
370
+ content: '\e612';
371
+ }
372
+
373
+ .icon-card-edit:before {
374
+ content: '\e60a';
375
+ }
376
+
377
+ .icon-close:before {
378
+ content: '\e60d';
379
+ }
380
+
381
+ .icon-notice:before {
382
+ content: '\e611';
383
+ }
384
+
385
+ .icon-edit:before {
386
+ content: '\e60b';
387
+ }
388
+
389
+ .icon-help-info:before {
390
+ content: '\e60c';
391
+ }
392
+
393
+ .icon-tag-filtering:before {
394
+ content: '\e60e';
395
+ }
396
+
397
+ .icon-kuanmai-logo:before {
398
+ content: '\e603';
399
+ }
400
+
401
+ .icon-company:before {
402
+ content: '\e606';
403
+ }
404
+
405
+ .icon-email:before {
406
+ content: '\e607';
407
+ }
408
+
409
+ .icon-round:before {
410
+ content: '\e608';
411
+ }
412
+
413
+ .icon-address:before {
414
+ content: '\e609';
415
+ }
416
+
417
+ .icon-mobile:before {
418
+ content: '\e602';
419
+ }
420
+ .icon-helper:before {
421
+ content: '\e663';
422
+ }
423
+
424
+ .icon-bag:before {
425
+ content: '\e605';
426
+ }
427
+ .icon-group:before {
428
+ content: '\e665';
429
+ }
@@ -4,11 +4,11 @@ import {
4
4
  getImageSrc,
5
5
  styleObjectToString,
6
6
  type ImageElement,
7
- } from '../../../../vendor/km-card-layout-core/index';
7
+ } from "../../../../vendor/km-card-layout-core/index";
8
8
 
9
9
  Component({
10
10
  options: {
11
- styleIsolation: 'apply-shared',
11
+ styleIsolation: "apply-shared",
12
12
  },
13
13
  properties: {
14
14
  element: {
@@ -19,21 +19,31 @@ Component({
19
19
  type: Object,
20
20
  value: {},
21
21
  },
22
+
22
23
  },
23
24
  data: {
24
- wrapperStyle: '',
25
- contentStyle: '',
26
- imageSrc: '',
27
- mode: 'aspectFill',
25
+ wrapperStyle: "",
26
+ contentStyle: "",
27
+ imageSrc: "",
28
+ mode: "aspectFill",
28
29
  },
29
30
  observers: {
30
- element(el: ImageElement) {
31
+ element() {
32
+ this.rebuild();
33
+ },
34
+ rootData() {
35
+ this.rebuild();
36
+ },
37
+ },
38
+ methods: {
39
+ rebuild() {
40
+ const el = this.data.element as ImageElement;
31
41
  if (!el) return;
32
- const data: Record<string, any> = this.data.rootData || {};
33
- const wrapperStyle = styleObjectToString(buildWrapperStyle(el, 'rpx'), 'rpx');
34
- const contentStyle = styleObjectToString(buildImageContentStyle(el), 'rpx');
42
+ const data = this.data.rootData || {};
43
+ const wrapperStyle = styleObjectToString(buildWrapperStyle(el, "rpx"), "rpx");
44
+ const contentStyle = styleObjectToString(buildImageContentStyle(el), "rpx");
35
45
  const imageSrc = getImageSrc(el, data);
36
- const mode = el.fit === 'contain' ? 'aspectFit' : 'aspectFill';
46
+ const mode = el.fit === "contain" ? "aspectFit" : "aspectFill";
37
47
  this.setData({ wrapperStyle, contentStyle, imageSrc, mode });
38
48
  },
39
49
  },
@@ -1,10 +1,8 @@
1
- <template name="image-element">
2
- <view class="km-node" style="{{wrapperStyle}}">
3
- <image
4
- class="km-node__image"
5
- style="{{contentStyle}}"
6
- src="{{imageSrc}}"
7
- mode="{{mode}}"
8
- />
9
- </view>
10
- </template>
1
+ <view class="km-node canvas-item" style="{{wrapperStyle}}">
2
+ <image
3
+ class="km-node__image canvas-item"
4
+ style="{{contentStyle}}"
5
+ src="{{imageSrc}}"
6
+ mode="{{mode}}"
7
+ />
8
+ </view>
@@ -7,4 +7,4 @@
7
7
  width: 100%;
8
8
  height: 100%;
9
9
  display: block;
10
- }
10
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,40 @@
1
+ import {
2
+ buildPanelContentStyle,
3
+ buildWrapperStyle,
4
+ styleObjectToString,
5
+ type LayoutPanelElement,
6
+ } from "../../../../vendor/km-card-layout-core/index";
7
+
8
+ Component({
9
+ options: {
10
+ styleIsolation: "apply-shared",
11
+ },
12
+ properties: {
13
+ element: {
14
+ type: Object,
15
+ value: {},
16
+ },
17
+ rootData: {
18
+ type: Object,
19
+ value: {},
20
+ },
21
+ },
22
+ data: {
23
+ wrapperStyle: "",
24
+ contentStyle: "",
25
+ },
26
+ observers: {
27
+ element() {
28
+ this.rebuild();
29
+ },
30
+ },
31
+ methods: {
32
+ rebuild() {
33
+ const el = this.data.element as LayoutPanelElement;
34
+ if (!el) return;
35
+ const wrapperStyle = styleObjectToString(buildWrapperStyle(el, "rpx"), "rpx");
36
+ const contentStyle = styleObjectToString(buildPanelContentStyle(el, "rpx"), "rpx");
37
+ this.setData({ wrapperStyle, contentStyle });
38
+ },
39
+ },
40
+ });
@@ -0,0 +1,5 @@
1
+ <view class="km-node itemClass" style="{{wrapperStyle}}">
2
+ <view class="km-node__panel itemClass" style="{{contentStyle}}">
3
+ <slot></slot>
4
+ </view>
5
+ </view>
@@ -0,0 +1,10 @@
1
+ .km-node {
2
+ box-sizing: border-box;
3
+ color: inherit;
4
+ }
5
+
6
+ .km-node__panel {
7
+ width: 100%;
8
+ height: 100%;
9
+ box-sizing: border-box;
10
+ }