@cloudbase/cals 0.4.11-beta.0 → 0.4.11-beta.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMrC,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF;AA0ID,wBAAgB,gCAAgC,CAC9C,WAAW,GAAE,GAAQ,EACrB,OAAO,GAAE;IACP,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACoD,GACrE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMrC,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF;AA0ID,wBAAgB,gCAAgC,CAC9C,WAAW,GAAE,GAAQ,EACrB,OAAO,GAAE;IACP,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACoD,GACrE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAuU7B;AASD,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO;;CAAwB,GAC9B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B"}
|
|
@@ -215,7 +215,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
|
|
|
215
215
|
// https://developer.mozilla.org/zh-CN/docs/Web/CSS/border
|
|
216
216
|
// 虽然border-width,、border-style和 border-color 简写属性接受最多 4 个参数来为不同的边设置宽度、风格和颜色,但 boder 属性只接受三个参数,分别是宽度、风格和颜色,所以这样会使得四条边的边框相同。
|
|
217
217
|
const { top = '0', right = '0', bottom = '0', left = '0' } = width;
|
|
218
|
-
setStyleValue(style, 'borderWidth', `${_handleStyleNumValue(top, !!options.addPXUnit)} ${_handleStyleNumValue(right, !!options.addPXUnit)} ${_handleStyleNumValue(bottom, !!options.addPXUnit)} ${_handleStyleNumValue(left, !!options.addPXUnit)}`);
|
|
218
|
+
setStyleValue(style, 'borderWidth', `${_handleStyleNumValue(top, !!options.addPXUnit) || '0'} ${_handleStyleNumValue(right, !!options.addPXUnit) || '0'} ${_handleStyleNumValue(bottom, !!options.addPXUnit) || '0'} ${_handleStyleNumValue(left, !!options.addPXUnit) || '0'}`);
|
|
219
219
|
if (type) {
|
|
220
220
|
setStyleValue(style, 'borderStyle', type);
|
|
221
221
|
}
|
|
@@ -228,27 +228,43 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
|
|
|
228
228
|
setStyleValue(style, 'borderRadius', _handleStyleNumValue(radius, !!options.addPXUnit));
|
|
229
229
|
}
|
|
230
230
|
if (radiusInfo && !(0, common_1.isEmptyObj)(radiusInfo)) {
|
|
231
|
+
let { topLeft, topRight, bottomRight, bottomLeft } = radiusInfo;
|
|
231
232
|
if (Object.keys(radiusInfo).length === 4) {
|
|
232
233
|
if ((0, lodash_1.uniq)((0, lodash_1.map)(radiusInfo, (val) => val)).length === 1) {
|
|
233
234
|
// 4个值全相等的情况
|
|
234
|
-
setStyleValue(style, 'borderRadius', _handleStyleNumValue(
|
|
235
|
+
setStyleValue(style, 'borderRadius', _handleStyleNumValue(topLeft, !!options.addPXUnit));
|
|
235
236
|
}
|
|
236
|
-
else if (
|
|
237
|
+
else if (topLeft === bottomRight && topRight === bottomLeft) {
|
|
237
238
|
// 俩俩相等的情况
|
|
238
|
-
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(
|
|
239
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)}`);
|
|
239
240
|
}
|
|
240
|
-
else if (
|
|
241
|
-
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(
|
|
241
|
+
else if (topRight === bottomLeft) {
|
|
242
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)} ${_handleStyleNumValue(bottomRight, !!options.addPXUnit)}`);
|
|
242
243
|
}
|
|
243
244
|
else {
|
|
244
|
-
|
|
245
|
+
// 包含不为空的属性,将部分为空属性处理成 0
|
|
246
|
+
if (Object.values(radiusInfo).some((corner) => !!corner)) {
|
|
247
|
+
if (!topLeft) {
|
|
248
|
+
topLeft = '0';
|
|
249
|
+
}
|
|
250
|
+
if (!topRight) {
|
|
251
|
+
topRight = '0';
|
|
252
|
+
}
|
|
253
|
+
if (!bottomRight) {
|
|
254
|
+
bottomRight = '0';
|
|
255
|
+
}
|
|
256
|
+
if (!bottomLeft) {
|
|
257
|
+
bottomLeft = '0';
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)} ${_handleStyleNumValue(bottomRight, !!options.addPXUnit)} ${_handleStyleNumValue(bottomLeft, !!options.addPXUnit)}`);
|
|
245
261
|
}
|
|
246
262
|
}
|
|
247
263
|
else {
|
|
248
|
-
setStyleValue(style, 'borderTopLeftRadius', _handleStyleNumValue(
|
|
249
|
-
setStyleValue(style, 'borderTopRightRadius', _handleStyleNumValue(
|
|
250
|
-
setStyleValue(style, 'borderBottomRightRadius', _handleStyleNumValue(
|
|
251
|
-
setStyleValue(style, 'borderBottomLeftRadius', _handleStyleNumValue(
|
|
264
|
+
setStyleValue(style, 'borderTopLeftRadius', _handleStyleNumValue(topLeft, !!options.addPXUnit));
|
|
265
|
+
setStyleValue(style, 'borderTopRightRadius', _handleStyleNumValue(topRight, !!options.addPXUnit));
|
|
266
|
+
setStyleValue(style, 'borderBottomRightRadius', _handleStyleNumValue(bottomRight, !!options.addPXUnit));
|
|
267
|
+
setStyleValue(style, 'borderBottomLeftRadius', _handleStyleNumValue(bottomLeft, !!options.addPXUnit));
|
|
252
268
|
}
|
|
253
269
|
}
|
|
254
270
|
if (type === 'none') {
|