@cloudbase/cals 0.4.11-beta.1 → 0.4.11-beta.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.
@@ -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,CAqT7B;AASD,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO;;CAAwB,GAC9B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B"}
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,CAgU7B;AASD,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO;;CAAwB,GAC9B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B"}
@@ -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) {
233
+ // 包含不为空的属性,将部分为空属性处理成 0
234
+ if (Object.values(radiusInfo).some((corner) => !!corner)) {
235
+ if (!topLeft) {
236
+ topLeft = '0';
237
+ }
238
+ if (!topRight) {
239
+ topRight = '0';
240
+ }
241
+ if (!bottomRight) {
242
+ bottomRight = '0';
243
+ }
244
+ if (!bottomLeft) {
245
+ bottomLeft = '0';
246
+ }
247
+ }
232
248
  if ((0, lodash_1.uniq)((0, lodash_1.map)(radiusInfo, (val) => val)).length === 1) {
233
249
  // 4个值全相等的情况
234
- setStyleValue(style, 'borderRadius', _handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit));
250
+ setStyleValue(style, 'borderRadius', _handleStyleNumValue(topLeft, !!options.addPXUnit));
235
251
  }
236
- else if (radiusInfo.topLeft === radiusInfo.bottomRight && radiusInfo.topRight === radiusInfo.bottomLeft) {
252
+ else if (topLeft === bottomRight && topRight === bottomLeft) {
237
253
  // 俩俩相等的情况
238
- setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)}`);
254
+ setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)}`);
239
255
  }
240
- else if (radiusInfo.topRight === radiusInfo.bottomLeft) {
241
- setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit)}`);
256
+ else if (topRight === bottomLeft) {
257
+ setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)} ${_handleStyleNumValue(bottomRight, !!options.addPXUnit)}`);
242
258
  }
243
259
  else {
244
- setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomLeft, !!options.addPXUnit)}`);
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(radiusInfo.topLeft, !!options.addPXUnit));
249
- setStyleValue(style, 'borderTopRightRadius', _handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit));
250
- setStyleValue(style, 'borderBottomRightRadius', _handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit));
251
- setStyleValue(style, 'borderBottomLeftRadius', _handleStyleNumValue(radiusInfo.bottomLeft, !!options.addPXUnit));
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') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cals",
3
- "version": "0.4.11-beta.1",
3
+ "version": "0.4.11-beta.3",
4
4
  "description": "Common application specifications",
5
5
  "main": "lib/utils/index.js",
6
6
  "source": "src/utils/index.ts",