km-card-layout-core 0.1.22 → 0.1.23
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/bindings.ts +4 -0
- package/dist/bindings.js +5 -0
- package/dist/render/builder.js +1 -2
- package/package.json +1 -1
- package/render/builder.ts +2 -3
package/bindings.ts
CHANGED
|
@@ -54,6 +54,10 @@ export function applyItemCollectBindings(
|
|
|
54
54
|
else delete base.defaultValue;
|
|
55
55
|
if (key !== undefined) base.key = key;
|
|
56
56
|
else delete base.key;
|
|
57
|
+
// sync icon name for text elements from template meta.extra.icon
|
|
58
|
+
if (el.type === 'text' && meta?.extra?.icon) {
|
|
59
|
+
base.icon = { ...(base.icon || {}), name: meta.extra.icon };
|
|
60
|
+
}
|
|
57
61
|
|
|
58
62
|
if (el.type === 'layout-panel') {
|
|
59
63
|
return {
|
package/dist/bindings.js
CHANGED
|
@@ -31,6 +31,7 @@ function applyItemCollectBindings(layouts = [], items = []) {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
const assignBinding = (el) => {
|
|
34
|
+
var _a;
|
|
34
35
|
const meta = metaMap.get(String(el.id));
|
|
35
36
|
const binding = meta && meta.bind !== undefined && meta.bind !== null
|
|
36
37
|
? meta.bind
|
|
@@ -50,6 +51,10 @@ function applyItemCollectBindings(layouts = [], items = []) {
|
|
|
50
51
|
base.key = key;
|
|
51
52
|
else
|
|
52
53
|
delete base.key;
|
|
54
|
+
// sync icon name for text elements from template meta.extra.icon
|
|
55
|
+
if (el.type === 'text' && ((_a = meta === null || meta === void 0 ? void 0 : meta.extra) === null || _a === void 0 ? void 0 : _a.icon)) {
|
|
56
|
+
base.icon = { ...(base.icon || {}), name: meta.extra.icon };
|
|
57
|
+
}
|
|
53
58
|
if (el.type === 'layout-panel') {
|
|
54
59
|
return {
|
|
55
60
|
...base,
|
package/dist/render/builder.js
CHANGED
|
@@ -86,8 +86,7 @@ const buildTextIcon = (el, unit) => {
|
|
|
86
86
|
if (!icon || icon.enable === false)
|
|
87
87
|
return undefined;
|
|
88
88
|
const style = icon.style || 'fill';
|
|
89
|
-
|
|
90
|
-
const baseName = el.key || el.binding || el.id;
|
|
89
|
+
const baseName = icon.name || el.key || el.binding || el.id;
|
|
91
90
|
let name;
|
|
92
91
|
if (style === 'dot')
|
|
93
92
|
name = 'round';
|
package/package.json
CHANGED
package/render/builder.ts
CHANGED
|
@@ -126,10 +126,9 @@ const buildTextIcon = (
|
|
|
126
126
|
): RenderNode['icon'] | undefined => {
|
|
127
127
|
const icon = el.icon;
|
|
128
128
|
if (!icon || icon.enable === false) return undefined;
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
const style = icon.style || 'fill';
|
|
131
|
-
|
|
132
|
-
const baseName = el.key || el.binding || el.id;
|
|
131
|
+
const baseName = icon.name || el.key || el.binding || el.id;
|
|
133
132
|
let name: string | undefined;
|
|
134
133
|
if (style === 'dot') name = 'round';
|
|
135
134
|
else if (style === 'line') name = baseName ? `${baseName}-line` : undefined;
|