km-card-layout-core 0.1.14 → 0.1.15
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/dist/utils.js +4 -4
- package/package.json +1 -1
- package/types.d.ts +8 -0
- package/utils.ts +6 -6
package/dist/utils.js
CHANGED
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.DEFAULT_DECOR_COLOR = exports.resolveSpecialStyle = exports.updateElementsStyle = exports.applyBackground = exports.applySpecialStyle = exports.backgroundChange = void 0;
|
|
18
|
+
exports.buildRenderData = buildRenderData;
|
|
18
19
|
const km_card_layout_core_1 = require("km-card-layout-core");
|
|
19
20
|
const changeBackground_1 = require("./ops/changeBackground");
|
|
20
21
|
__exportStar(require("./bindings"), exports);
|
|
@@ -25,7 +26,7 @@ Object.defineProperty(exports, "applyBackground", { enumerable: true, get: funct
|
|
|
25
26
|
Object.defineProperty(exports, "updateElementsStyle", { enumerable: true, get: function () { return changeBackground_2.updateElementsStyle; } });
|
|
26
27
|
Object.defineProperty(exports, "resolveSpecialStyle", { enumerable: true, get: function () { return changeBackground_2.resolveSpecialStyle; } });
|
|
27
28
|
Object.defineProperty(exports, "DEFAULT_DECOR_COLOR", { enumerable: true, get: function () { return changeBackground_2.DEFAULT_DECOR_COLOR; } });
|
|
28
|
-
|
|
29
|
+
function buildRenderData(layout, items, config) {
|
|
29
30
|
// 绑定数据
|
|
30
31
|
let renderLayout = (0, km_card_layout_core_1.applyItemCollectBindings)(layout, items);
|
|
31
32
|
// 设置显示逻辑
|
|
@@ -34,5 +35,4 @@ const buildRenderData = (layout, items, dataInput, config) => {
|
|
|
34
35
|
// 设置背景
|
|
35
36
|
renderLayout = renderLayout.map((la, index) => (0, km_card_layout_core_1.backgroundChange)(config.currentBg[index], la));
|
|
36
37
|
return renderLayout;
|
|
37
|
-
}
|
|
38
|
-
exports.buildRenderData = buildRenderData;
|
|
38
|
+
}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -149,3 +149,11 @@ export function buildRenderResult(
|
|
|
149
149
|
data: Record<string, any>,
|
|
150
150
|
unit?: 'px' | 'rpx'
|
|
151
151
|
): RenderResult;
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
export function buildRenderData (
|
|
155
|
+
layout: CardLayoutSchema[],
|
|
156
|
+
items: TemplateItem[],
|
|
157
|
+
dataInput: Record<string, any>,
|
|
158
|
+
config: Config
|
|
159
|
+
): CardLayoutSchema[];
|
package/utils.ts
CHANGED
|
@@ -26,19 +26,19 @@ export type Config = {
|
|
|
26
26
|
currentBg: TemplateBackground[];
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
export const buildRenderData = (
|
|
29
|
+
export function buildRenderData(
|
|
31
30
|
layout: CardLayoutSchema[],
|
|
32
31
|
items: TemplateItem[],
|
|
33
|
-
dataInput: Record<string, any>,
|
|
34
32
|
config: Config
|
|
35
|
-
): CardLayoutSchema[]
|
|
33
|
+
): CardLayoutSchema[] {
|
|
36
34
|
// 绑定数据
|
|
37
35
|
let renderLayout = applyItemCollectBindings(layout, items);
|
|
38
36
|
// 设置显示逻辑
|
|
39
37
|
renderLayout = setElementVisible(renderLayout, 'avatar', config.showAvatar);
|
|
40
38
|
renderLayout = setElementVisible(renderLayout, 'logo', config.showLogo);
|
|
41
39
|
// 设置背景
|
|
42
|
-
renderLayout = renderLayout.map((la,index) =>
|
|
40
|
+
renderLayout = renderLayout.map((la, index) =>
|
|
41
|
+
backgroundChange(config.currentBg[index], la)
|
|
42
|
+
);
|
|
43
43
|
return renderLayout;
|
|
44
|
-
}
|
|
44
|
+
}
|