@easyv/config 1.3.1 → 1.3.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/control.js CHANGED
@@ -1,123 +1,123 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
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
- gap: 20,
15
- drag: {
16
- start: 0,
17
- width: 30,
18
- color: "RGBA(255, 255, 255, .3)"
19
- }
20
- };
21
- var control = function control() {
22
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultControl,
23
- _ref$height = _ref.height,
24
- height = _ref$height === void 0 ? defaultControl.height : _ref$height,
25
- _ref$color = _ref.color,
26
- color = _ref$color === void 0 ? defaultControl.color : _ref$color,
27
- _ref$margin = _ref.margin;
28
- _ref$margin = _ref$margin === void 0 ? defaultControl.margin : _ref$margin;
29
- var _ref$margin$left = _ref$margin.left,
30
- left = _ref$margin$left === void 0 ? defaultControl.margin.left : _ref$margin$left,
31
- _ref$margin$right = _ref$margin.right,
32
- right = _ref$margin$right === void 0 ? defaultControl.margin.right : _ref$margin$right,
33
- _ref$gap = _ref.gap,
34
- gap = _ref$gap === void 0 ? defaultControl.gap : _ref$gap,
35
- _ref$drag = _ref.drag;
36
- _ref$drag = _ref$drag === void 0 ? defaultControl.drag : _ref$drag;
37
- var _ref$drag$start = _ref$drag.start,
38
- start = _ref$drag$start === void 0 ? defaultControl.drag.start : _ref$drag$start,
39
- _ref$drag$width = _ref$drag.width,
40
- width = _ref$drag$width === void 0 ? defaultControl.drag.width : _ref$drag$width,
41
- _ref$drag$color = _ref$drag.color,
42
- dragColor = _ref$drag$color === void 0 ? defaultControl.drag.color : _ref$drag$color;
43
- return {
44
- name: "control",
45
- displayName: "控制条",
46
- value: [{
47
- name: "height",
48
- displayName: "高度",
49
- value: height,
50
- type: "number"
51
- }, {
52
- name: "color",
53
- displayName: "背景颜色",
54
- value: color,
55
- type: "color"
56
- }, {
57
- type: "group",
58
- name: "margin",
59
- displayName: "边距",
60
- value: [{
61
- name: "left",
62
- displayName: "左边距",
63
- value: left,
64
- type: "number",
65
- config: {
66
- span: 12
67
- }
68
- }, {
69
- name: "right",
70
- displayName: "右边距",
71
- value: right,
72
- type: "number",
73
- config: {
74
- span: 12
75
- }
76
- }]
77
- }, {
78
- name: "gap",
79
- displayName: "上间距",
80
- type: "number",
81
- value: gap,
82
- config: {
83
- suffix: "px"
84
- },
85
- tip: "与X轴的距离"
86
- }, {
87
- "name": "thumbnail",
88
- "displayName": "开启缩略图",
89
- "value": true,
90
- "type": "boolean"
91
- }, {
92
- name: "drag",
93
- displayName: "详情区域",
94
- value: [{
95
- name: "start",
96
- displayName: "起始位置",
97
- value: start,
98
- type: "range",
99
- config: {
100
- suffix: "%",
101
- min: 0,
102
- max: 100
103
- }
104
- }, {
105
- name: "width",
106
- displayName: "宽度",
107
- value: width,
108
- type: "range",
109
- config: {
110
- suffix: "%",
111
- min: 1,
112
- max: 100
113
- }
114
- }, {
115
- name: "color",
116
- displayName: "颜色",
117
- value: dragColor,
118
- type: "color"
119
- }]
120
- }]
121
- };
122
- };
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
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
+ gap: 20,
15
+ drag: {
16
+ start: 0,
17
+ width: 30,
18
+ color: "RGBA(255, 255, 255, .3)"
19
+ }
20
+ };
21
+ var control = function control() {
22
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultControl,
23
+ _ref$height = _ref.height,
24
+ height = _ref$height === void 0 ? defaultControl.height : _ref$height,
25
+ _ref$color = _ref.color,
26
+ color = _ref$color === void 0 ? defaultControl.color : _ref$color,
27
+ _ref$margin = _ref.margin;
28
+ _ref$margin = _ref$margin === void 0 ? defaultControl.margin : _ref$margin;
29
+ var _ref$margin$left = _ref$margin.left,
30
+ left = _ref$margin$left === void 0 ? defaultControl.margin.left : _ref$margin$left,
31
+ _ref$margin$right = _ref$margin.right,
32
+ right = _ref$margin$right === void 0 ? defaultControl.margin.right : _ref$margin$right,
33
+ _ref$gap = _ref.gap,
34
+ gap = _ref$gap === void 0 ? defaultControl.gap : _ref$gap,
35
+ _ref$drag = _ref.drag;
36
+ _ref$drag = _ref$drag === void 0 ? defaultControl.drag : _ref$drag;
37
+ var _ref$drag$start = _ref$drag.start,
38
+ start = _ref$drag$start === void 0 ? defaultControl.drag.start : _ref$drag$start,
39
+ _ref$drag$width = _ref$drag.width,
40
+ width = _ref$drag$width === void 0 ? defaultControl.drag.width : _ref$drag$width,
41
+ _ref$drag$color = _ref$drag.color,
42
+ dragColor = _ref$drag$color === void 0 ? defaultControl.drag.color : _ref$drag$color;
43
+ return {
44
+ name: "control",
45
+ displayName: "控制条",
46
+ value: [{
47
+ name: "height",
48
+ displayName: "高度",
49
+ value: height,
50
+ type: "number"
51
+ }, {
52
+ name: "color",
53
+ displayName: "背景颜色",
54
+ value: color,
55
+ type: "color"
56
+ }, {
57
+ type: "group",
58
+ name: "margin",
59
+ displayName: "边距",
60
+ value: [{
61
+ name: "left",
62
+ displayName: "左边距",
63
+ value: left,
64
+ type: "number",
65
+ config: {
66
+ span: 12
67
+ }
68
+ }, {
69
+ name: "right",
70
+ displayName: "右边距",
71
+ value: right,
72
+ type: "number",
73
+ config: {
74
+ span: 12
75
+ }
76
+ }]
77
+ }, {
78
+ name: "gap",
79
+ displayName: "上间距",
80
+ type: "number",
81
+ value: gap,
82
+ config: {
83
+ suffix: "px"
84
+ },
85
+ tip: "与X轴的距离"
86
+ }, {
87
+ "name": "thumbnail",
88
+ "displayName": "开启缩略图",
89
+ "value": true,
90
+ "type": "boolean"
91
+ }, {
92
+ name: "drag",
93
+ displayName: "详情区域",
94
+ value: [{
95
+ name: "start",
96
+ displayName: "起始位置",
97
+ value: start,
98
+ type: "range",
99
+ config: {
100
+ suffix: "%",
101
+ min: 0,
102
+ max: 100
103
+ }
104
+ }, {
105
+ name: "width",
106
+ displayName: "宽度",
107
+ value: width,
108
+ type: "range",
109
+ config: {
110
+ suffix: "%",
111
+ min: 1,
112
+ max: 100
113
+ }
114
+ }, {
115
+ name: "color",
116
+ displayName: "颜色",
117
+ value: dragColor,
118
+ type: "color"
119
+ }]
120
+ }]
121
+ };
122
+ };
123
123
  exports.control = control;
@@ -5,14 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
12
  /**
10
13
  * TODO:有个触发回调的类型
11
14
  */
12
- var defaultAction = 'click';
15
+ var defaultAction = "click";
13
16
  var defaultCallback = {
14
17
  actions: [{
15
- name: '鼠标点击',
18
+ name: "鼠标点击",
16
19
  value: defaultAction
17
20
  }],
18
21
  extraInput: []
@@ -21,63 +24,67 @@ var _default = function _default(_ref) {
21
24
  var callback = _ref.callback,
22
25
  remoteControl = _ref.remoteControl;
23
26
  return {
24
- name: 'interaction',
25
- displayName: '交互',
27
+ name: "interaction",
28
+ displayName: "交互",
26
29
  value: callback || remoteControl ? [callback && Array.isArray(callback.callback) && {
27
- name: 'callback',
28
- displayName: '回调参数',
29
- type: 'array',
30
+ name: "callback",
31
+ displayName: "回调参数",
32
+ type: "array",
30
33
  value: callback.callback.map(function (_ref2, index) {
31
34
  var origin = _ref2.origin,
32
35
  target = _ref2.target;
33
36
  return {
34
- name: 'callback_' + index,
35
- displayName: '回调',
36
- type: 'object',
37
+ name: "callback_" + index,
38
+ displayName: "回调",
39
+ type: "object",
37
40
  value: [{
38
- name: 'actions',
39
- displayName: '匹配动作',
40
- type: 'select',
41
+ name: "actions",
42
+ displayName: "匹配动作",
43
+ type: "select",
41
44
  value: callback.value || defaultAction,
42
45
  config: {
43
46
  options: callback.actions ? callback.actions : defaultCallback.actions
44
47
  }
45
- }, {
46
- name: 'origin',
47
- displayName: '字段值',
48
- type: 'input',
48
+ }, _objectSpread({
49
+ name: "origin",
50
+ displayName: "字段值",
51
+ type: "input",
49
52
  value: origin
50
- }, {
51
- name: 'target',
52
- displayName: '变量名',
53
- type: 'input',
53
+ }, callback.originTip ? {
54
+ tip: callback.originTip
55
+ } : {}), {
56
+ name: "target",
57
+ displayName: "变量名",
58
+ type: "input",
54
59
  value: target
55
60
  }].concat((0, _toConsumableArray2["default"])(callback.extraInput ? callback.extraInput : defaultCallback.extraInput))
56
61
  };
57
62
  }),
58
63
  config: {
59
64
  template: [{
60
- name: 'callback',
61
- displayName: '回调',
62
- type: 'object',
65
+ name: "callback",
66
+ displayName: "回调",
67
+ type: "object",
63
68
  value: [{
64
- name: 'actions',
65
- displayName: '匹配动作',
66
- type: 'select',
69
+ name: "actions",
70
+ displayName: "匹配动作",
71
+ type: "select",
67
72
  value: callback.value || defaultAction,
68
73
  config: {
69
74
  options: callback.actions ? callback.actions : defaultCallback.actions
70
75
  }
71
- }, {
72
- name: 'origin',
73
- displayName: '字段值',
74
- type: 'input',
75
- value: ''
76
- }, {
77
- name: 'target',
78
- displayName: '变量名',
79
- type: 'input',
80
- value: '',
76
+ }, _objectSpread({
77
+ name: "origin",
78
+ displayName: "字段值",
79
+ type: "input",
80
+ value: ""
81
+ }, callback.originTip ? {
82
+ tip: callback.originTip
83
+ } : {}), {
84
+ name: "target",
85
+ displayName: "变量名",
86
+ type: "input",
87
+ value: "",
81
88
  config: {
82
89
  callback: true
83
90
  }
@@ -85,20 +92,20 @@ var _default = function _default(_ref) {
85
92
  }]
86
93
  }
87
94
  }, remoteControl && Array.isArray(remoteControl) && {
88
- name: 'remoteControl',
89
- displayName: '远程控制',
90
- type: 'array',
95
+ name: "remoteControl",
96
+ displayName: "远程控制",
97
+ type: "array",
91
98
  value: [],
92
99
  config: {
93
100
  template: [{
94
- name: 'controls',
95
- displayName: '控制',
96
- type: 'object',
101
+ name: "controls",
102
+ displayName: "控制",
103
+ type: "object",
97
104
  value: [].concat((0, _toConsumableArray2["default"])(remoteControl), [{
98
- name: 'control',
99
- displayName: '控制',
100
- type: 'remoteOptions',
101
- value: '{}'
105
+ name: "control",
106
+ displayName: "控制",
107
+ type: "remoteOptions",
108
+ value: "{}"
102
109
  }])
103
110
  }]
104
111
  }