@cloudbase/framework-plugin-low-code 1.7.2 → 1.7.3
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/lib/builder/config/common.d.ts +2 -0
- package/lib/builder/config/common.d.ts.map +1 -0
- package/lib/builder/config/common.js +13 -0
- package/lib/builder/config/index.d.ts +3 -0
- package/lib/builder/config/index.d.ts.map +1 -0
- package/lib/builder/config/index.js +29 -0
- package/lib/builder/config/mp.d.ts +2 -0
- package/lib/builder/config/mp.d.ts.map +1 -0
- package/lib/builder/config/mp.js +13 -0
- package/lib/builder/core/copy.d.ts +5 -0
- package/lib/builder/core/copy.d.ts.map +1 -0
- package/lib/builder/core/copy.js +62 -0
- package/lib/builder/core/generate.d.ts +9 -0
- package/lib/builder/core/generate.d.ts.map +1 -0
- package/lib/builder/core/generate.js +128 -0
- package/lib/builder/core/index.d.ts +32 -0
- package/lib/builder/core/index.d.ts.map +1 -0
- package/lib/builder/core/index.js +149 -0
- package/lib/builder/core/material.d.ts +4 -0
- package/lib/builder/core/material.d.ts.map +1 -0
- package/lib/builder/core/material.js +80 -0
- package/lib/builder/core/plugin.d.ts +4 -0
- package/lib/builder/core/plugin.d.ts.map +1 -0
- package/lib/builder/core/plugin.js +30 -0
- package/lib/builder/core/prepare.d.ts +8 -0
- package/lib/builder/core/prepare.d.ts.map +1 -0
- package/lib/builder/core/prepare.js +108 -0
- package/lib/builder/core/webpack.d.ts +15 -0
- package/lib/builder/core/webpack.d.ts.map +1 -0
- package/lib/builder/core/webpack.js +58 -0
- package/lib/builder/mp/BuildContext.d.ts +13 -0
- package/lib/builder/mp/BuildContext.d.ts.map +1 -0
- package/lib/builder/mp/BuildContext.js +2 -0
- package/lib/builder/mp/index.d.ts +33 -0
- package/lib/builder/mp/index.d.ts.map +1 -0
- package/lib/builder/mp/index.js +450 -0
- package/lib/builder/mp/lowcode.d.ts +8 -0
- package/lib/builder/mp/lowcode.d.ts.map +1 -0
- package/lib/builder/mp/lowcode.js +54 -0
- package/lib/builder/mp/materials.d.ts +15 -0
- package/lib/builder/mp/materials.d.ts.map +1 -0
- package/lib/builder/mp/materials.js +338 -0
- package/lib/builder/mp/mixMode.d.ts +10 -0
- package/lib/builder/mp/mixMode.d.ts.map +1 -0
- package/lib/builder/mp/mixMode.js +215 -0
- package/lib/builder/mp/mp_config.d.ts +18 -0
- package/lib/builder/mp/mp_config.d.ts.map +1 -0
- package/lib/builder/mp/mp_config.js +206 -0
- package/lib/builder/mp/util.d.ts +20 -0
- package/lib/builder/mp/util.d.ts.map +1 -0
- package/lib/builder/mp/util.js +243 -0
- package/lib/builder/mp/wxml.d.ts +16 -0
- package/lib/builder/mp/wxml.d.ts.map +1 -0
- package/lib/builder/mp/wxml.js +300 -0
- package/lib/builder/service/builder/copy.d.ts +14 -0
- package/lib/builder/service/builder/copy.d.ts.map +1 -0
- package/lib/builder/service/builder/copy.js +189 -0
- package/lib/builder/service/builder/generate.d.ts +52 -0
- package/lib/builder/service/builder/generate.d.ts.map +1 -0
- package/lib/builder/service/builder/generate.js +792 -0
- package/lib/builder/service/builder/index.d.ts +16 -0
- package/lib/builder/service/builder/index.d.ts.map +1 -0
- package/lib/builder/service/builder/index.js +69 -0
- package/lib/builder/service/builder/plugin.d.ts +8 -0
- package/lib/builder/service/builder/plugin.d.ts.map +1 -0
- package/lib/builder/service/builder/plugin.js +149 -0
- package/lib/builder/service/builder/webpack.d.ts +91 -0
- package/lib/builder/service/builder/webpack.d.ts.map +1 -0
- package/lib/builder/service/builder/webpack.js +589 -0
- package/lib/builder/types/common.d.ts +12 -0
- package/lib/builder/types/common.d.ts.map +1 -0
- package/lib/builder/types/common.js +7 -0
- package/lib/builder/util/common.d.ts +36 -0
- package/lib/builder/util/common.d.ts.map +1 -0
- package/lib/builder/util/common.js +257 -0
- package/lib/builder/util/console.d.ts +2 -0
- package/lib/builder/util/console.d.ts.map +1 -0
- package/lib/builder/util/console.js +13 -0
- package/lib/builder/util/generateFiles.d.ts +6 -0
- package/lib/builder/util/generateFiles.d.ts.map +1 -0
- package/lib/builder/util/generateFiles.js +94 -0
- package/lib/builder/util/index.d.ts +2 -0
- package/lib/builder/util/index.d.ts.map +1 -0
- package/lib/builder/util/index.js +13 -0
- package/lib/builder/util/junk.d.ts +3 -0
- package/lib/builder/util/junk.d.ts.map +1 -0
- package/lib/builder/util/junk.js +25 -0
- package/lib/builder/util/mp.d.ts +5 -0
- package/lib/builder/util/mp.d.ts.map +1 -0
- package/lib/builder/util/mp.js +99 -0
- package/lib/builder/util/name-mangler.d.ts +3 -0
- package/lib/builder/util/name-mangler.d.ts.map +1 -0
- package/lib/builder/util/name-mangler.js +7 -0
- package/lib/builder/util/net.d.ts +3 -0
- package/lib/builder/util/net.d.ts.map +1 -0
- package/lib/builder/util/net.js +54 -0
- package/lib/builder/util/process.d.ts +9 -0
- package/lib/builder/util/process.d.ts.map +1 -0
- package/lib/builder/util/process.js +28 -0
- package/lib/builder/util/style.d.ts +2 -0
- package/lib/builder/util/style.d.ts.map +1 -0
- package/lib/builder/util/style.js +13 -0
- package/lib/builder/util/weapp.d.ts +2 -0
- package/lib/builder/util/weapp.d.ts.map +1 -0
- package/lib/builder/util/weapp.js +13 -0
- package/lib/config/private.d.ts +3 -0
- package/lib/config/private.d.ts.map +1 -0
- package/lib/config/private.js +14 -0
- package/lib/generate.d.ts +2 -0
- package/lib/generate.d.ts.map +1 -0
- package/lib/generate.js +49 -0
- package/lib/generator/config/common.d.ts +6 -0
- package/lib/generator/config/common.d.ts.map +1 -0
- package/lib/generator/config/common.js +25 -0
- package/lib/generator/config/index.d.ts +18 -0
- package/lib/generator/config/index.d.ts.map +1 -0
- package/lib/generator/config/index.js +43 -0
- package/lib/generator/config/mp.d.ts +56 -0
- package/lib/generator/config/mp.d.ts.map +1 -0
- package/lib/generator/config/mp.js +104 -0
- package/lib/generator/core/generate.d.ts +59 -0
- package/lib/generator/core/generate.d.ts.map +1 -0
- package/lib/generator/core/generate.js +663 -0
- package/lib/generator/core/index.d.ts +25 -0
- package/lib/generator/core/index.d.ts.map +1 -0
- package/lib/generator/core/index.js +102 -0
- package/lib/generator/core/material.d.ts +14 -0
- package/lib/generator/core/material.d.ts.map +1 -0
- package/lib/generator/core/material.js +230 -0
- package/lib/generator/template.d.ts +3 -0
- package/lib/generator/template.d.ts.map +1 -0
- package/lib/generator/template.js +3 -0
- package/lib/generator/types/common.d.ts +69 -0
- package/lib/generator/types/common.d.ts.map +1 -0
- package/lib/generator/types/common.js +21 -0
- package/lib/generator/util/common.d.ts +36 -0
- package/lib/generator/util/common.d.ts.map +1 -0
- package/lib/generator/util/common.js +238 -0
- package/lib/generator/util/console.d.ts +3 -0
- package/lib/generator/util/console.d.ts.map +1 -0
- package/lib/generator/util/console.js +17 -0
- package/lib/generator/util/index.d.ts +2 -0
- package/lib/generator/util/index.d.ts.map +1 -0
- package/lib/generator/util/index.js +13 -0
- package/lib/generator/util/name-mangler.d.ts +17 -0
- package/lib/generator/util/name-mangler.d.ts.map +1 -0
- package/lib/generator/util/name-mangler.js +63 -0
- package/lib/generator/util/postcss-rpx.d.ts +11 -0
- package/lib/generator/util/postcss-rpx.d.ts.map +1 -0
- package/lib/generator/util/postcss-rpx.js +16 -0
- package/lib/generator/util/style.d.ts +6 -0
- package/lib/generator/util/style.d.ts.map +1 -0
- package/lib/generator/util/style.js +92 -0
- package/lib/generator/util/weapp.d.ts +5 -0
- package/lib/generator/util/weapp.d.ts.map +1 -0
- package/lib/generator/util/weapp.js +17 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.d.ts.map +0 -0
- package/lib/index.js +0 -0
- package/lib/types.d.ts +14 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +19 -0
- package/lib/utils/common.d.ts +0 -0
- package/lib/utils/common.d.ts.map +0 -0
- package/lib/utils/common.js +0 -0
- package/lib/utils/dataSource.d.ts +28 -0
- package/lib/utils/dataSource.d.ts.map +1 -0
- package/lib/utils/dataSource.js +171 -0
- package/lib/utils/index.d.ts +0 -0
- package/lib/utils/index.d.ts.map +0 -0
- package/lib/utils/index.js +0 -0
- package/lib/utils/postProcess.d.ts +3 -0
- package/lib/utils/postProcess.d.ts.map +1 -0
- package/lib/utils/postProcess.js +48 -0
- package/lib/weapps-core/config/index.d.ts +2 -0
- package/lib/weapps-core/config/index.d.ts.map +1 -0
- package/lib/weapps-core/config/index.js +13 -0
- package/lib/weapps-core/config/style.d.ts +7 -0
- package/lib/weapps-core/config/style.d.ts.map +1 -0
- package/lib/weapps-core/config/style.js +70 -0
- package/lib/weapps-core/index.d.ts +6 -0
- package/lib/weapps-core/index.d.ts.map +1 -0
- package/lib/weapps-core/index.js +31 -0
- package/lib/weapps-core/types/action.d.ts +25 -0
- package/lib/weapps-core/types/action.d.ts.map +1 -0
- package/lib/weapps-core/types/action.js +28 -0
- package/lib/weapps-core/types/app.d.ts +142 -0
- package/lib/weapps-core/types/app.d.ts.map +1 -0
- package/lib/weapps-core/types/app.js +21 -0
- package/lib/weapps-core/types/appbuild.d.ts +63 -0
- package/lib/weapps-core/types/appbuild.d.ts.map +1 -0
- package/lib/weapps-core/types/appbuild.js +78 -0
- package/lib/weapps-core/types/code_types.d.ts +26 -0
- package/lib/weapps-core/types/code_types.d.ts.map +1 -0
- package/lib/weapps-core/types/code_types.js +2 -0
- package/lib/weapps-core/types/git.d.ts +7 -0
- package/lib/weapps-core/types/git.d.ts.map +1 -0
- package/lib/weapps-core/types/git.js +2 -0
- package/lib/weapps-core/types/index.d.ts +11 -0
- package/lib/weapps-core/types/index.d.ts.map +1 -0
- package/lib/weapps-core/types/index.js +22 -0
- package/lib/weapps-core/types/lowcode.d.ts +26 -0
- package/lib/weapps-core/types/lowcode.d.ts.map +1 -0
- package/lib/weapps-core/types/lowcode.js +25 -0
- package/lib/weapps-core/types/material.d.ts +90 -0
- package/lib/weapps-core/types/material.d.ts.map +1 -0
- package/lib/weapps-core/types/material.js +9 -0
- package/lib/weapps-core/types/plugins.d.ts +17 -0
- package/lib/weapps-core/types/plugins.d.ts.map +1 -0
- package/lib/weapps-core/types/plugins.js +2 -0
- package/lib/weapps-core/types/style.d.ts +93 -0
- package/lib/weapps-core/types/style.d.ts.map +1 -0
- package/lib/weapps-core/types/style.js +2 -0
- package/lib/weapps-core/types/web.d.ts +120 -0
- package/lib/weapps-core/types/web.d.ts.map +1 -0
- package/lib/weapps-core/types/web.js +2 -0
- package/lib/weapps-core/utils/appbuild.d.ts +6 -0
- package/lib/weapps-core/utils/appbuild.d.ts.map +1 -0
- package/lib/weapps-core/utils/appbuild.js +40 -0
- package/lib/weapps-core/utils/common.d.ts +16 -0
- package/lib/weapps-core/utils/common.d.ts.map +1 -0
- package/lib/weapps-core/utils/common.js +90 -0
- package/lib/weapps-core/utils/file.d.ts +12 -0
- package/lib/weapps-core/utils/file.d.ts.map +1 -0
- package/lib/weapps-core/utils/file.js +142 -0
- package/lib/weapps-core/utils/formily.d.ts +5 -0
- package/lib/weapps-core/utils/formily.d.ts.map +1 -0
- package/lib/weapps-core/utils/formily.js +416 -0
- package/lib/weapps-core/utils/index.d.ts +7 -0
- package/lib/weapps-core/utils/index.d.ts.map +1 -0
- package/lib/weapps-core/utils/index.js +18 -0
- package/lib/weapps-core/utils/lowcdoe.d.ts +4 -0
- package/lib/weapps-core/utils/lowcdoe.d.ts.map +1 -0
- package/lib/weapps-core/utils/lowcdoe.js +69 -0
- package/lib/weapps-core/utils/style.d.ts +17 -0
- package/lib/weapps-core/utils/style.d.ts.map +1 -0
- package/lib/weapps-core/utils/style.js +330 -0
- package/package.json +3 -3
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.toCssText = exports.removeEffectTwiceStyle = exports.removeWrapperBadEffectStyle = exports.toRPX = exports.toREM = exports.translateStyleByHandler = exports.translateStyleToRem = exports.translateStyleToRpx = exports.removeInvalidStyleFormValue = exports.toCssStyle = void 0;
|
|
18
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
19
|
+
const map_1 = __importDefault(require("lodash/map"));
|
|
20
|
+
const config_1 = require("../config");
|
|
21
|
+
const common_1 = require("./common");
|
|
22
|
+
function _handleStyleNumValue(styleVal, addPXUnit) {
|
|
23
|
+
if (addPXUnit) {
|
|
24
|
+
const value = `${styleVal}`;
|
|
25
|
+
if (value.search(/^\d+$/) >= 0) {
|
|
26
|
+
return value + 'px';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return styleVal;
|
|
30
|
+
}
|
|
31
|
+
function toCssStyle(commonStyle = {}, options = { toRem: true, ignoreSelf: false, addPXUnit: false, toRpx: false }) {
|
|
32
|
+
const { size, text, border, background, margin, padding, zIndex, position, display, flexConfig, custom, self, } = commonStyle;
|
|
33
|
+
const style = {};
|
|
34
|
+
if (size) {
|
|
35
|
+
setStyleValue(style, 'width', _handleStyleNumValue(size.width, !!options.addPXUnit));
|
|
36
|
+
setStyleValue(style, 'height', _handleStyleNumValue(size.height, !!options.addPXUnit));
|
|
37
|
+
}
|
|
38
|
+
if (margin) {
|
|
39
|
+
setDistanceStyle(style, margin, 'margin', !!options.addPXUnit);
|
|
40
|
+
}
|
|
41
|
+
if (padding) {
|
|
42
|
+
setDistanceStyle(style, padding, 'padding', !!options.addPXUnit);
|
|
43
|
+
}
|
|
44
|
+
if (display) {
|
|
45
|
+
setStyleValue(style, 'display', display);
|
|
46
|
+
}
|
|
47
|
+
if (display === 'flex' && flexConfig) {
|
|
48
|
+
if (flexConfig.justifyContent)
|
|
49
|
+
setStyleValue(style, 'justifyContent', flexConfig.justifyContent);
|
|
50
|
+
if (flexConfig.alignItems)
|
|
51
|
+
setStyleValue(style, 'alignItems', flexConfig.alignItems);
|
|
52
|
+
if (flexConfig.flexWrap && flexConfig.flexDirection) {
|
|
53
|
+
setStyleValue(style, 'flexFlow', `${flexConfig.flexDirection} ${flexConfig.flexWrap}`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
if (flexConfig.flexWrap)
|
|
57
|
+
setStyleValue(style, 'flexWrap', flexConfig.flexWrap);
|
|
58
|
+
if (flexConfig.flexDirection)
|
|
59
|
+
setStyleValue(style, 'flexDirection', flexConfig.flexDirection);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (typeof zIndex === 'number' || `${zIndex}`.search(/^\d+$/) === 0) {
|
|
63
|
+
style.zIndex = zIndex;
|
|
64
|
+
}
|
|
65
|
+
if (text) {
|
|
66
|
+
setStyleValue(style, 'color', text.color);
|
|
67
|
+
setStyleValue(style, 'fontSize', _handleStyleNumValue(text.fontSize, !!options.addPXUnit));
|
|
68
|
+
setStyleValue(style, 'lineHeight', text.lineHeight);
|
|
69
|
+
setStyleValue(style, 'textAlign', text.textAlign);
|
|
70
|
+
setStyleValue(style, 'fontWeight', text.weight);
|
|
71
|
+
if (text.opacity) {
|
|
72
|
+
setStyleValue(style, 'opacity', text.opacity / 100);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (border) {
|
|
76
|
+
const { type, color, width, radius, radiusInfo } = border;
|
|
77
|
+
if (width !== undefined) {
|
|
78
|
+
if (type) {
|
|
79
|
+
setStyleValue(style, 'border', `${_handleStyleNumValue(width, !!options.addPXUnit)} ${type} ${color || ''}`);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
setStyleValue(style, 'borderWidth', _handleStyleNumValue(width, !!options.addPXUnit));
|
|
83
|
+
if (color)
|
|
84
|
+
setStyleValue(style, 'borderColor', color);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (radius !== undefined) {
|
|
88
|
+
setStyleValue(style, 'borderRadius', _handleStyleNumValue(radius, !!options.addPXUnit));
|
|
89
|
+
}
|
|
90
|
+
if (radiusInfo && !(0, common_1.isEmptyObj)(radiusInfo)) {
|
|
91
|
+
if (Object.keys(radiusInfo).length === 4) {
|
|
92
|
+
if ((0, uniq_1.default)((0, map_1.default)(radiusInfo, (val) => val)).length === 1) {
|
|
93
|
+
setStyleValue(style, 'borderRadius', _handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit));
|
|
94
|
+
}
|
|
95
|
+
else if (radiusInfo.topLeft === radiusInfo.bottomRight && radiusInfo.topRight === radiusInfo.bottomLeft) {
|
|
96
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)}`);
|
|
97
|
+
}
|
|
98
|
+
else if (radiusInfo.topRight === radiusInfo.bottomLeft) {
|
|
99
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit)}`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomLeft, !!options.addPXUnit)}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
setStyleValue(style, 'borderTopLeftRadius', _handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit));
|
|
107
|
+
setStyleValue(style, 'borderTopRightRadius', _handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit));
|
|
108
|
+
setStyleValue(style, 'borderBottomRightRadius', _handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit));
|
|
109
|
+
setStyleValue(style, 'borderBottomLeftRadius', _handleStyleNumValue(radiusInfo.bottomLeft, !!options.addPXUnit));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (background) {
|
|
114
|
+
const { bgType, color, image, size, repeat, position, positionObj } = background;
|
|
115
|
+
if (bgType === 'color') {
|
|
116
|
+
setStyleValue(style, 'background', color);
|
|
117
|
+
}
|
|
118
|
+
else if (bgType === 'image') {
|
|
119
|
+
if (image != null) {
|
|
120
|
+
if (image.search(/[()]/) >= 0) {
|
|
121
|
+
style.background = image;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
style.background = `url(${image})`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (repeat)
|
|
128
|
+
style.background += ` ${repeat}`;
|
|
129
|
+
if (size) {
|
|
130
|
+
setStyleValue(style, 'backgroundSize', _handleStyleNumValue(size, !!options.addPXUnit));
|
|
131
|
+
}
|
|
132
|
+
setStyleValue(style, 'backgroundPosition', position);
|
|
133
|
+
if (positionObj && !(0, common_1.isEmptyObj)(positionObj)) {
|
|
134
|
+
style.background += ` ${_handleStyleNumValue(positionObj.left, !!options.addPXUnit)} ${_handleStyleNumValue(positionObj.top, !!options.addPXUnit)}`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (bgType === undefined) {
|
|
138
|
+
setStyleValue(style, 'backgroundColor', color);
|
|
139
|
+
if (image != null) {
|
|
140
|
+
style.backgroundImage = `url(${image})`;
|
|
141
|
+
setStyleValue(style, 'backgroundRepeat', repeat);
|
|
142
|
+
setStyleValue(style, 'backgroundSize', _handleStyleNumValue(size, !!options.addPXUnit));
|
|
143
|
+
setStyleValue(style, 'backgroundPosition', position);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (position) {
|
|
148
|
+
setStyleValue(style, 'position', position.position);
|
|
149
|
+
if (position.left !== undefined) {
|
|
150
|
+
setStyleValue(style, 'left', _handleStyleNumValue(position.left, !!options.addPXUnit));
|
|
151
|
+
}
|
|
152
|
+
if (position.right !== undefined) {
|
|
153
|
+
setStyleValue(style, 'right', _handleStyleNumValue(position.right, !!options.addPXUnit));
|
|
154
|
+
}
|
|
155
|
+
if (position.top !== undefined) {
|
|
156
|
+
setStyleValue(style, 'top', _handleStyleNumValue(position.top, !!options.addPXUnit));
|
|
157
|
+
}
|
|
158
|
+
if (position.bottom !== undefined) {
|
|
159
|
+
setStyleValue(style, 'bottom', _handleStyleNumValue(position.bottom, !!options.addPXUnit));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (custom && custom.length > 0) {
|
|
163
|
+
custom.map((item) => {
|
|
164
|
+
setStyleValue(style, item.key, item.value);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (self && !options.ignoreSelf) {
|
|
168
|
+
const _a = self, { cssFloat } = _a, restSelf = __rest(_a, ["cssFloat"]);
|
|
169
|
+
Object.assign(style, restSelf, { float: cssFloat });
|
|
170
|
+
}
|
|
171
|
+
if (options.toRpx) {
|
|
172
|
+
return translateStyleToRpx(style);
|
|
173
|
+
}
|
|
174
|
+
return options.toRem ? translateStyleToRem(style) : style;
|
|
175
|
+
}
|
|
176
|
+
exports.toCssStyle = toCssStyle;
|
|
177
|
+
function removeInvalidStyleFormValue(styleForm = {}) {
|
|
178
|
+
return Object.keys(styleForm).reduce((result, key) => {
|
|
179
|
+
const propStyleFormData = styleForm[key];
|
|
180
|
+
if ((0, common_1.isPlainObject)(propStyleFormData)) {
|
|
181
|
+
setStyleValue(result, key, removeInvalidStyleFormValue(propStyleFormData));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
setStyleValue(result, key, styleForm[key]);
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}, {});
|
|
188
|
+
}
|
|
189
|
+
exports.removeInvalidStyleFormValue = removeInvalidStyleFormValue;
|
|
190
|
+
function setDistanceStyle(style, distance, attr, addPXUnit) {
|
|
191
|
+
if (Object.keys(distance).length === 4) {
|
|
192
|
+
if ((0, uniq_1.default)((0, map_1.default)(distance, (val) => val)).length === 1) {
|
|
193
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), _handleStyleNumValue(distance.top, addPXUnit));
|
|
194
|
+
}
|
|
195
|
+
else if (distance.top === distance.bottom && distance.left === distance.right) {
|
|
196
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)}`);
|
|
197
|
+
}
|
|
198
|
+
else if (distance.left === distance.right) {
|
|
199
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)}`);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)} ${_handleStyleNumValue(distance.left, addPXUnit)}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
config_1.DISTANCE_KEY_LIST.forEach((key) => {
|
|
207
|
+
if (distance[key] !== undefined)
|
|
208
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}_${key}`), _handleStyleNumValue(distance[key], addPXUnit));
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function translateStyleToRpx(style = {}) {
|
|
213
|
+
return translateStyleByHandler(style, toRPX);
|
|
214
|
+
}
|
|
215
|
+
exports.translateStyleToRpx = translateStyleToRpx;
|
|
216
|
+
function translateStyleToRem(style = {}) {
|
|
217
|
+
return translateStyleByHandler(style, toREM);
|
|
218
|
+
}
|
|
219
|
+
exports.translateStyleToRem = translateStyleToRem;
|
|
220
|
+
function translateStyleByHandler(style = {}, handler) {
|
|
221
|
+
return Object.keys(style).reduce((result, key) => {
|
|
222
|
+
const value = style[key];
|
|
223
|
+
if (config_1.PERCENTAGE_KEY_LIST.includes(key)) {
|
|
224
|
+
setStyleValue(result, key, value);
|
|
225
|
+
}
|
|
226
|
+
else if (value !== undefined && value !== null) {
|
|
227
|
+
setStyleValue(result, key, handler(value));
|
|
228
|
+
}
|
|
229
|
+
return result;
|
|
230
|
+
}, {});
|
|
231
|
+
}
|
|
232
|
+
exports.translateStyleByHandler = translateStyleByHandler;
|
|
233
|
+
function setStyleValue(object, key, value) {
|
|
234
|
+
if (value === undefined || value === null || value === '') {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (key === 'open') {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if ((0, common_1.isEmptyObj)(value)) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
object[(0, common_1.camelcase)(key)] = value;
|
|
244
|
+
}
|
|
245
|
+
function calPxToREM(px) {
|
|
246
|
+
if (Number.isNaN(px / 28))
|
|
247
|
+
return px.toString();
|
|
248
|
+
if (+px === 0) {
|
|
249
|
+
return '0';
|
|
250
|
+
}
|
|
251
|
+
return (px / 28).toFixed(4) + 'rem';
|
|
252
|
+
}
|
|
253
|
+
function toREM(cssLen) {
|
|
254
|
+
if (typeof cssLen === 'string') {
|
|
255
|
+
const cssLenArr = cssLen.split(' ');
|
|
256
|
+
return cssLenArr
|
|
257
|
+
.map((attr) => {
|
|
258
|
+
const matchResult = attr.match(/^(-?\d+)(px)?$/);
|
|
259
|
+
if (matchResult && matchResult[1]) {
|
|
260
|
+
return calPxToREM(+matchResult[1]);
|
|
261
|
+
}
|
|
262
|
+
return attr;
|
|
263
|
+
})
|
|
264
|
+
.join(' ');
|
|
265
|
+
}
|
|
266
|
+
else if (typeof cssLen === 'number') {
|
|
267
|
+
return calPxToREM(cssLen);
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
throw new Error('cssLen type error');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.toREM = toREM;
|
|
274
|
+
function toRPX(cssLen) {
|
|
275
|
+
if (typeof cssLen === 'string') {
|
|
276
|
+
const cssLenArr = cssLen.split(' ');
|
|
277
|
+
return cssLenArr
|
|
278
|
+
.map((attr) => {
|
|
279
|
+
const matchResult = attr.match(/^(-?\d+)(px)?$/);
|
|
280
|
+
if (matchResult && matchResult[1]) {
|
|
281
|
+
return `${+matchResult[1]}rpx`;
|
|
282
|
+
}
|
|
283
|
+
return attr;
|
|
284
|
+
})
|
|
285
|
+
.join(' ');
|
|
286
|
+
}
|
|
287
|
+
return `${cssLen}rpx`;
|
|
288
|
+
}
|
|
289
|
+
exports.toRPX = toRPX;
|
|
290
|
+
function removeWrapperBadEffectStyle(commonStyle = {}) {
|
|
291
|
+
return Object.keys(commonStyle).reduce((result, key) => {
|
|
292
|
+
const value = commonStyle[key];
|
|
293
|
+
const camelcaseKey = (0, common_1.camelcase)(key);
|
|
294
|
+
if (config_1.WRAPPER_REMOVE_STYLE_KEY_LIST.includes(camelcaseKey)) {
|
|
295
|
+
return result;
|
|
296
|
+
}
|
|
297
|
+
if (key === 'display' && value === 'flex') {
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
|
+
setStyleValue(result, camelcaseKey, value);
|
|
301
|
+
return result;
|
|
302
|
+
}, {});
|
|
303
|
+
}
|
|
304
|
+
exports.removeWrapperBadEffectStyle = removeWrapperBadEffectStyle;
|
|
305
|
+
function removeEffectTwiceStyle(commonStyle = {}) {
|
|
306
|
+
const style = {};
|
|
307
|
+
Object.keys(commonStyle).map((key) => {
|
|
308
|
+
const value = commonStyle[key];
|
|
309
|
+
const camelcaseKey = (0, common_1.camelcase)(key);
|
|
310
|
+
if (config_1.SELF_REMOVE_STYLE_KEY_LIST.includes(camelcaseKey)) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
if (config_1.SELF_REMOVE_WITH_PERCENTAGE_KEY_LIST.includes(camelcaseKey) && String(value).match(/.+%$/)) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
setStyleValue(style, camelcaseKey, value);
|
|
317
|
+
});
|
|
318
|
+
return style;
|
|
319
|
+
}
|
|
320
|
+
exports.removeEffectTwiceStyle = removeEffectTwiceStyle;
|
|
321
|
+
function toCssText(style, className = '.some-class-name') {
|
|
322
|
+
const attrText = Object.keys(style)
|
|
323
|
+
.map((key) => {
|
|
324
|
+
const value = style[key];
|
|
325
|
+
return `${(0, common_1.kebabCase)(key)}: ${value};`;
|
|
326
|
+
})
|
|
327
|
+
.join('\n');
|
|
328
|
+
return `${className} { ${attrText} }\n`;
|
|
329
|
+
}
|
|
330
|
+
exports.toCssText = toCssText;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@cloudbase/framework-core": "^1.8.16",
|
|
40
40
|
"@cloudbase/framework-plugin-auth": "^1.8.16",
|
|
41
41
|
"@cloudbase/framework-plugin-website": "^1.8.17",
|
|
42
|
-
"@cloudbase/lowcode-builder": "1.8.
|
|
42
|
+
"@cloudbase/lowcode-builder": "1.8.4",
|
|
43
43
|
"@cloudbase/lowcode-deployer": "^1.3.0",
|
|
44
44
|
"@formily/react-schema-renderer": "1.1.7",
|
|
45
45
|
"archiver": "^4.0.1",
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
"jest": "^27.5.1",
|
|
65
65
|
"typescript": "^4.7.4"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|