@easyv/config 1.1.35 → 1.1.36

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/control.js CHANGED
@@ -4,19 +4,48 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.control = void 0;
7
+ var defaultControl = {
8
+ height: 20,
9
+ color: "rgba(20, 95, 255, 0.1)",
10
+ margin: {
11
+ left: 40,
12
+ right: 40
13
+ },
14
+ drag: {
15
+ width: 30,
16
+ color: "RGBA(255, 255, 255, .3)"
17
+ }
18
+ };
7
19
  var control = function control() {
20
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultControl,
21
+ _ref$height = _ref.height,
22
+ height = _ref$height === void 0 ? defaultControl.height : _ref$height,
23
+ _ref$color = _ref.color,
24
+ color = _ref$color === void 0 ? defaultControl.color : _ref$color,
25
+ _ref$margin = _ref.margin;
26
+ _ref$margin = _ref$margin === void 0 ? defaultControl.margin : _ref$margin;
27
+ var _ref$margin$left = _ref$margin.left,
28
+ left = _ref$margin$left === void 0 ? defaultControl.margin.left : _ref$margin$left,
29
+ _ref$margin$right = _ref$margin.right,
30
+ right = _ref$margin$right === void 0 ? defaultControl.margin.right : _ref$margin$right,
31
+ _ref$drag = _ref.drag;
32
+ _ref$drag = _ref$drag === void 0 ? defaultControl.drag : _ref$drag;
33
+ var _ref$drag$width = _ref$drag.width,
34
+ width = _ref$drag$width === void 0 ? defaultControl.drag.width : _ref$drag$width,
35
+ _ref$drag$color = _ref$drag.color,
36
+ dragColor = _ref$drag$color === void 0 ? defaultControl.drag.color : _ref$drag$color;
8
37
  return {
9
38
  name: "control",
10
39
  displayName: "控制条",
11
40
  value: [{
12
41
  name: "height",
13
42
  displayName: "高度",
14
- value: 20,
43
+ value: height,
15
44
  type: "number"
16
45
  }, {
17
46
  name: "color",
18
47
  displayName: "背景颜色",
19
- value: "rgba(20, 95, 255, 0.1)",
48
+ value: color,
20
49
  type: "color"
21
50
  }, {
22
51
  type: "group",
@@ -25,7 +54,7 @@ var control = function control() {
25
54
  value: [{
26
55
  name: "left",
27
56
  displayName: "左边距",
28
- value: 40,
57
+ value: left,
29
58
  type: "number",
30
59
  config: {
31
60
  span: 12
@@ -33,7 +62,7 @@ var control = function control() {
33
62
  }, {
34
63
  name: "right",
35
64
  displayName: "右边距",
36
- value: 40,
65
+ value: right,
37
66
  type: "number",
38
67
  config: {
39
68
  span: 12
@@ -45,16 +74,17 @@ var control = function control() {
45
74
  value: [{
46
75
  name: "width",
47
76
  displayName: "宽度",
48
- value: 30,
49
- type: "number",
77
+ value: width,
78
+ type: "range",
50
79
  config: {
51
80
  suffix: "%",
52
- min: 1
81
+ min: 1,
82
+ max: 100
53
83
  }
54
84
  }, {
55
85
  name: "color",
56
86
  displayName: "颜色",
57
- value: "RGBA(255, 255, 255, .3)",
87
+ value: dragColor,
58
88
  type: "color"
59
89
  }]
60
90
  }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/config",
3
- "version": "1.1.35",
3
+ "version": "1.1.36",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/control.js CHANGED
@@ -1,4 +1,28 @@
1
- export const control = () => {
1
+ const defaultControl={
2
+ height:20,
3
+ color:"rgba(20, 95, 255, 0.1)",
4
+ margin:{
5
+ left:40,
6
+ right:40
7
+ },
8
+ drag:{
9
+ width:30,
10
+ color:"RGBA(255, 255, 255, .3)"
11
+ }
12
+ }
13
+
14
+ export const control = ({
15
+ height = defaultControl.height,
16
+ color = defaultControl.color,
17
+ margin:{
18
+ left = defaultControl.margin.left,
19
+ right = defaultControl.margin.right
20
+ } = defaultControl.margin,
21
+ drag:{
22
+ width = defaultControl.drag.width,
23
+ color:dragColor = defaultControl.drag.color
24
+ } = defaultControl.drag
25
+ } = defaultControl) => {
2
26
  return {
3
27
  name: "control",
4
28
  displayName: "控制条",
@@ -6,13 +30,13 @@ export const control = () => {
6
30
  {
7
31
  name: "height",
8
32
  displayName: "高度",
9
- value: 20,
33
+ value: height,
10
34
  type: "number",
11
35
  },
12
36
  {
13
37
  name: "color",
14
38
  displayName: "背景颜色",
15
- value: "rgba(20, 95, 255, 0.1)",
39
+ value: color,
16
40
  type: "color",
17
41
  },
18
42
  {
@@ -23,7 +47,7 @@ export const control = () => {
23
47
  {
24
48
  name: "left",
25
49
  displayName: "左边距",
26
- value: 40,
50
+ value: left,
27
51
  type: "number",
28
52
  config: {
29
53
  span: 12,
@@ -32,7 +56,7 @@ export const control = () => {
32
56
  {
33
57
  name: "right",
34
58
  displayName: "右边距",
35
- value: 40,
59
+ value: right,
36
60
  type: "number",
37
61
  config: {
38
62
  span: 12,
@@ -47,17 +71,18 @@ export const control = () => {
47
71
  {
48
72
  name: "width",
49
73
  displayName: "宽度",
50
- value: 30,
51
- type: "number",
74
+ value: width,
75
+ type: "range",
52
76
  config: {
53
77
  suffix: "%",
54
78
  min: 1,
79
+ max:100
55
80
  },
56
81
  },
57
82
  {
58
83
  name: "color",
59
84
  displayName: "颜色",
60
- value: "RGBA(255, 255, 255, .3)",
85
+ value: dragColor,
61
86
  type: "color",
62
87
  },
63
88
  ],