@easyv/config 1.0.37 → 1.0.38

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/src/legend.js CHANGED
@@ -1,4 +1,4 @@
1
- const { translate: translateConfig, font, show: showConfig } = require('.');
1
+ const { translate: translateConfig, font, show: showConfig, showRule } = require('.');
2
2
  const defaultFont = font({
3
3
  fontFamily: 'Mircosoft Yahei',
4
4
  fontSize: 12,
@@ -283,6 +283,7 @@ export const legendOfPie = ({
283
283
  value: [
284
284
  showConfig(show),
285
285
  {
286
+ ...showRule(),
286
287
  name: 'order',
287
288
  displayName: '顺序',
288
289
  value: order,
@@ -296,6 +297,7 @@ export const legendOfPie = ({
296
297
  },
297
298
  },
298
299
  {
300
+ ...showRule(),
299
301
  name: 'iconSize',
300
302
  displayName: '图标尺寸',
301
303
  value: [
@@ -319,6 +321,7 @@ export const legendOfPie = ({
319
321
  type: 'group',
320
322
  },
321
323
  {
324
+ ...showRule(),
322
325
  name: 'iconGap',
323
326
  displayName: '间距',
324
327
  value: iconGap,
@@ -327,7 +330,7 @@ export const legendOfPie = ({
327
330
  },
328
331
  },
329
332
  {
330
- rule: [['show', '$eq', true]],
333
+ ...showRule(),
331
334
  name: 'name',
332
335
  displayName: '类目',
333
336
  value: [
@@ -342,13 +345,13 @@ export const legendOfPie = ({
342
345
  ],
343
346
  },
344
347
  {
345
- rule: [['show', '$eq', true]],
348
+ ...showRule(),
346
349
  name: 'percent',
347
350
  displayName: '占比值',
348
351
  value: [
349
352
  showConfig(showPercent),
350
353
  {
351
- rule: [['show', '$eq', true]],
354
+ ...showRule(),
352
355
  name: 'precision',
353
356
  displayName: '小数位数',
354
357
  value: precision,
@@ -358,7 +361,7 @@ export const legendOfPie = ({
358
361
  },
359
362
  },
360
363
  {
361
- rule: [['show', '$eq', true]],
364
+ ...showRule(),
362
365
  name: 'gap',
363
366
  displayName: '间距',
364
367
  value: percentGap,
@@ -368,14 +371,14 @@ export const legendOfPie = ({
368
371
  },
369
372
  },
370
373
  {
371
- rule: [['show', '$eq', true]],
374
+ ...showRule(),
372
375
  name: 'sameColor',
373
376
  displayName: '颜色跟随',
374
377
  value: percentSameColor,
375
378
  type: 'boolean',
376
379
  },
377
380
  {
378
- rule: [['show', '$eq', true]],
381
+ ...showRule(),
379
382
  name: 'font',
380
383
  displayName: '文本样式',
381
384
  value: percentFont,
@@ -384,13 +387,13 @@ export const legendOfPie = ({
384
387
  ],
385
388
  },
386
389
  {
387
- rule: [['show', '$eq', true]],
390
+ ...showRule(),
388
391
  name: 'value',
389
392
  displayName: '真实值',
390
393
  value: [
391
394
  showConfig(showValue),
392
395
  {
393
- rule: [['show', '$eq', true]],
396
+ ...showRule(),
394
397
  name: 'suffix',
395
398
  displayName: '后缀',
396
399
  value: [
@@ -401,14 +404,14 @@ export const legendOfPie = ({
401
404
  type: 'boolean',
402
405
  },
403
406
  {
404
- rule: [['show', '$eq', true]],
407
+ ...showRule(),
405
408
  name: 'text',
406
409
  displayName: '内容',
407
410
  value: text,
408
411
  type: 'input',
409
412
  },
410
413
  {
411
- rule: [['show', '$eq', true]],
414
+ ...showRule(),
412
415
  name: 'fontSize',
413
416
  displayName: '字号',
414
417
  value: fontSize,
@@ -418,7 +421,7 @@ export const legendOfPie = ({
418
421
  },
419
422
  },
420
423
  {
421
- rule: [['show', '$eq', true]],
424
+ ...showRule(),
422
425
  ...translateConfig(suffixTranslateX, suffixTranslateY),
423
426
  },
424
427
  ],
@@ -427,7 +430,7 @@ export const legendOfPie = ({
427
430
  },
428
431
  },
429
432
  {
430
- rule: [['show', '$eq', true]],
433
+ ...showRule(),
431
434
  name: 'gap',
432
435
  displayName: '间距',
433
436
  value: valueGap,
@@ -437,14 +440,14 @@ export const legendOfPie = ({
437
440
  },
438
441
  },
439
442
  {
440
- rule: [['show', '$eq', true]],
443
+ ...showRule(),
441
444
  name: 'sameColor',
442
445
  displayName: '颜色跟随',
443
446
  value: valueSameColor,
444
447
  type: 'boolean',
445
448
  },
446
449
  {
447
- rule: [['show', '$eq', true]],
450
+ ...showRule(),
448
451
  name: 'font',
449
452
  displayName: '文本样式',
450
453
  value: valueFont,
@@ -453,7 +456,7 @@ export const legendOfPie = ({
453
456
  ],
454
457
  },
455
458
  {
456
- rule: [['show', '$eq', true]],
459
+ ...showRule(),
457
460
  name: 'layout',
458
461
  displayName: '布局',
459
462
  value: [
@@ -0,0 +1,31 @@
1
+ const defaultMutiColor = {
2
+ type: 'linear',
3
+ pure: '#fff',
4
+ linear: {
5
+ stops: [
6
+ { offset: 0, color: '#fff' },
7
+ { offset: 50, color: '#ff0' },
8
+ { offset: 100, color: '#f0f' }
9
+ ],
10
+ angle: 30,
11
+ opacity: 1
12
+ }
13
+ };
14
+ export default ({
15
+ type = defaultMutiColor.type,
16
+ pure = defaultMutiColor.pure,
17
+ linear:{
18
+ stops = defaultMutiColor.linear.stops,
19
+ angle = defaultMutiColor.linear.angle,
20
+ opacity = defaultMutiColor.linear.opacity,
21
+ } = defaultMutiColor.linear
22
+ } = defaultMutiColor) => ({
23
+ type,
24
+ pure,
25
+ linear:{
26
+ stops,
27
+ angle,
28
+ opacity
29
+ }
30
+ });
31
+
package/src/pie.js CHANGED
@@ -1,4 +1,4 @@
1
- import { font, show as showConfig, translate as translateConfig } from './';
1
+ import { font, show as showConfig, showRule, translate as translateConfig } from './';
2
2
 
3
3
  const defaultBasePie = {
4
4
  chart: {
@@ -8,7 +8,6 @@ const defaultBasePie = {
8
8
  padAngle: 2,
9
9
  },
10
10
  };
11
-
12
11
  const basePie = ({
13
12
  chart: {
14
13
  innerRadius = defaultBasePie.chart.innerRadius,
@@ -72,14 +71,15 @@ const basePie = ({
72
71
  const defaultCategoryText = {
73
72
  categoryText: {
74
73
  show:true,
75
- font:font()
74
+ font:font(),
75
+ gap:10
76
76
  }
77
77
  }
78
-
79
78
  const categoryText=({
80
79
  categoryText: {
81
- show = defaultCategoryText.show,
82
- font = defaultCategoryText.font
80
+ show = defaultCategoryText.categoryText.show,
81
+ font = defaultCategoryText.categoryText.font,
82
+ gap = defaultCategoryText.categoryText.gap
83
83
  } = defaultCategoryText,
84
84
  })=>({
85
85
  name: 'categoryText',
@@ -92,11 +92,21 @@ const categoryText=({
92
92
  type: 'boolean',
93
93
  },
94
94
  {
95
- rule: [['show', '$eq', true]],
95
+ ...showRule(),
96
96
  name: 'textStyle',
97
97
  displayName: '文本样式',
98
98
  value: font,
99
99
  type:"textStyle"
100
+ },
101
+ {
102
+ ...showRule(),
103
+ name: 'gap',
104
+ displayName: '间距',
105
+ value: gap,
106
+ type: 'number',
107
+ config:{
108
+ suffix:"px"
109
+ }
100
110
  }
101
111
  ]
102
112
  })
@@ -111,7 +121,6 @@ const defaultDecorate = {
111
121
  direction: 'clockwise',
112
122
  },
113
123
  };
114
-
115
124
  const decorate = ({
116
125
  decorate: {
117
126
  show = defaultDecorate.show,
@@ -208,7 +217,6 @@ const defaultDecorate2 = {
208
217
  radiusWidth: 0.3,
209
218
  opacity: 80,
210
219
  };
211
-
212
220
  const decorate2 = ({
213
221
  show = defaultDecorate2.show,
214
222
  radiusWidth = defaultDecorate2.radiusWidth,
@@ -249,6 +257,95 @@ const decorate2 = ({
249
257
  ]
250
258
  });
251
259
 
260
+ const defaultOuterDecorate = {
261
+ color:"#CF00FF",
262
+ width:10,
263
+ tick:{
264
+ show:true,
265
+ count:12,
266
+ color:"#CF00FF",
267
+ width:3,
268
+ length:8
269
+ }
270
+ }
271
+ const outerDecorate=({
272
+ color = defaultOuterDecorate.color,
273
+ width = defaultOuterDecorate.width,
274
+ tick:{
275
+ show = defaultOuterDecorate.tick.show,
276
+ count = defaultOuterDecorate.tick.count,
277
+ color: tickColor = defaultOuterDecorate.tick.color,
278
+ width: tickWidth = defaultOuterDecorate.tick.width,
279
+ length = defaultOuterDecorate.tick.length
280
+ } = defaultOuterDecorate.tick
281
+ } = defaultOuterDecorate)=>({
282
+ name: 'outerDecorate',
283
+ displayName: '外环装饰',
284
+ value: [
285
+ {
286
+ name: 'color',
287
+ displayName: '颜色',
288
+ value: color,
289
+ type: 'color'
290
+ },
291
+ {
292
+ name:"width",
293
+ displayName:"粗细",
294
+ value: width,
295
+ type: "number",
296
+ config:{
297
+ min:0,
298
+ max:100,
299
+ suffix:"px"
300
+ }
301
+ },
302
+ {
303
+ name: 'tick',
304
+ displayName: '刻度',
305
+ value: [
306
+ showConfig(show),
307
+ {
308
+ ...showRule(),
309
+ name:"count",
310
+ displayName:"个数",
311
+ value:count,
312
+ type:"number",
313
+ config:{
314
+ min:0
315
+ }
316
+ },
317
+ {
318
+ ...showRule(),
319
+ name:"color",
320
+ displayName:"颜色",
321
+ value:tickColor,
322
+ type:"color"
323
+ },
324
+ {
325
+ ...showRule(),
326
+ name:"width",
327
+ displayName:"粗细",
328
+ value:tickWidth,
329
+ type:"number",
330
+ config:{
331
+ suffix:"px"
332
+ }
333
+ },
334
+ {
335
+ ...showRule(),
336
+ name:"length",
337
+ displayName:"长度",
338
+ value:length,
339
+ type:"number",
340
+ config:{
341
+ suffix:"px"
342
+ }
343
+ }
344
+ ],
345
+ }
346
+ ]
347
+ })
348
+
252
349
  const defaultCurrent = {
253
350
  current: {
254
351
  show: true,
@@ -273,7 +370,6 @@ const defaultCurrent = {
273
370
  },
274
371
  },
275
372
  };
276
-
277
373
  const current = ({
278
374
  current: {
279
375
  show = defaultCurrent.current.show,
@@ -427,6 +523,12 @@ export const rosePie = (_basePie = defaultBasePie) => ({
427
523
  value: [basePie(_basePie)],
428
524
  });
429
525
 
526
+ export const rosePieDecorate = (_basePie = defaultBasePie, _outerDecorate = defaultOuterDecorate)=>({
527
+ name: ' fan',
528
+ displayName: '环图属性',
529
+ value:[basePie(_basePie),outerDecorate(_outerDecorate)]
530
+ })
531
+
430
532
  export const donut = (
431
533
  {
432
534
  basePie: _basePie = defaultBasePie,
package/src/show.js CHANGED
@@ -3,3 +3,9 @@ export default (show = false) => ({
3
3
  value: show,
4
4
  type: 'boolean',
5
5
  });
6
+
7
+ export const showRule=(name="show",type="$eq",value=true)=>{
8
+ return {
9
+ rule:[[name,type,value]]
10
+ }
11
+ }