@antv/l7-component 2.21.0 → 2.21.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.
- package/es/assets/iconfont/iconfont.js +6 -6
- package/es/constants/index.js +2 -2
- package/es/control/baseControl/buttonControl.js +109 -144
- package/es/control/baseControl/control.js +212 -258
- package/es/control/baseControl/popperControl.js +67 -95
- package/es/control/baseControl/selectControl.js +132 -178
- package/es/control/exportImage.js +59 -142
- package/es/control/fullscreen.js +69 -100
- package/es/control/geoLocate.js +37 -84
- package/es/control/layerSwitch.js +111 -154
- package/es/control/logo.js +43 -69
- package/es/control/mapTheme.js +57 -98
- package/es/control/mouseLocation.js +37 -69
- package/es/control/scale.js +107 -135
- package/es/control/swipe.js +297 -393
- package/es/control/zoom.js +80 -112
- package/es/css/index.css +10 -7
- package/es/index.js +667 -1
- package/es/marker-layer.js +274 -326
- package/es/marker.d.ts +0 -2
- package/es/marker.js +394 -453
- package/es/popup/layerPopup.js +277 -321
- package/es/popup/popup.js +422 -482
- package/es/utils/anchor.js +6 -6
- package/es/utils/icon.js +4 -4
- package/es/utils/popper.js +180 -196
- package/es/utils/screenfull.js +29 -51
- package/lib/assets/iconfont/iconfont.js +6 -6
- package/lib/constants/index.d.ts +60 -0
- package/lib/constants/index.js +2 -2
- package/lib/control/baseControl/buttonControl.d.ts +60 -0
- package/lib/control/baseControl/buttonControl.js +110 -143
- package/lib/control/baseControl/control.d.ts +112 -0
- package/lib/control/baseControl/control.js +213 -257
- package/lib/control/baseControl/index.d.ts +4 -0
- package/lib/control/baseControl/index.js +5 -5
- package/lib/control/baseControl/popperControl.d.ts +28 -0
- package/lib/control/baseControl/popperControl.js +68 -94
- package/lib/control/baseControl/selectControl.d.ts +53 -0
- package/lib/control/baseControl/selectControl.js +133 -177
- package/lib/control/exportImage.d.ts +19 -0
- package/lib/control/exportImage.js +60 -141
- package/lib/control/fullscreen.d.ts +20 -0
- package/lib/control/fullscreen.js +70 -99
- package/lib/control/geoLocate.d.ts +17 -0
- package/lib/control/geoLocate.js +38 -83
- package/lib/control/layerSwitch.d.ts +27 -0
- package/lib/control/layerSwitch.js +112 -153
- package/lib/control/logo.d.ts +14 -0
- package/lib/control/logo.js +44 -69
- package/lib/control/mapTheme.d.ts +11 -0
- package/lib/control/mapTheme.js +58 -97
- package/lib/control/mouseLocation.d.ts +16 -0
- package/lib/control/mouseLocation.js +38 -68
- package/lib/control/scale.d.ts +35 -0
- package/lib/control/scale.js +108 -134
- package/lib/control/swipe.d.ts +66 -0
- package/lib/control/swipe.js +298 -392
- package/lib/control/zoom.d.ts +39 -0
- package/lib/control/zoom.js +81 -111
- package/lib/css/index.css +10 -7
- package/lib/index.d.ts +19 -0
- package/lib/index.js +683 -17
- package/lib/interface.d.ts +18 -0
- package/lib/marker-layer.d.ts +55 -0
- package/lib/marker-layer.js +276 -324
- package/lib/marker.d.ts +58 -0
- package/lib/marker.js +395 -452
- package/lib/popup/layerPopup.d.ts +99 -0
- package/lib/popup/layerPopup.js +278 -320
- package/lib/popup/popup.d.ts +142 -0
- package/lib/popup/popup.js +423 -481
- package/lib/utils/anchor.d.ts +22 -0
- package/lib/utils/anchor.js +6 -6
- package/lib/utils/icon.d.ts +1 -0
- package/lib/utils/icon.js +6 -5
- package/lib/utils/popper.d.ts +76 -0
- package/lib/utils/popper.js +184 -196
- package/lib/utils/screenfull.d.ts +2 -0
- package/lib/utils/screenfull.js +29 -52
- package/package.json +16 -20
- package/CHANGELOG.md +0 -325
- package/LICENSE.md +0 -21
|
@@ -7,305 +7,261 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.Control = void 0;
|
|
8
8
|
Object.defineProperty(exports, "PositionType", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function
|
|
10
|
+
get: function () {
|
|
11
11
|
return _l7Core.PositionType;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
exports.default = void 0;
|
|
15
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
15
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
17
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
18
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
22
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
17
|
var _l7Core = require("@antv/l7-core");
|
|
24
18
|
var _l7Utils = require("@antv/l7-utils");
|
|
25
19
|
var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
class Control extends _eventemitter.default {
|
|
21
|
+
constructor(option) {
|
|
22
|
+
super();
|
|
23
|
+
/**
|
|
24
|
+
* 当前控件实例配置
|
|
25
|
+
*/
|
|
26
|
+
(0, _defineProperty2.default)(this, "controlOption", void 0);
|
|
27
|
+
/**
|
|
28
|
+
* 控件的 DOM 容器
|
|
29
|
+
* @protected
|
|
30
|
+
*/
|
|
31
|
+
(0, _defineProperty2.default)(this, "container", void 0);
|
|
32
|
+
/**
|
|
33
|
+
* 当前控件是否显示
|
|
34
|
+
* @protected
|
|
35
|
+
*/
|
|
36
|
+
(0, _defineProperty2.default)(this, "isShow", void 0);
|
|
37
|
+
(0, _defineProperty2.default)(this, "sceneContainer", void 0);
|
|
38
|
+
(0, _defineProperty2.default)(this, "scene", void 0);
|
|
39
|
+
(0, _defineProperty2.default)(this, "mapsService", void 0);
|
|
40
|
+
(0, _defineProperty2.default)(this, "renderService", void 0);
|
|
41
|
+
(0, _defineProperty2.default)(this, "layerService", void 0);
|
|
42
|
+
(0, _defineProperty2.default)(this, "controlService", void 0);
|
|
43
|
+
(0, _defineProperty2.default)(this, "configService", void 0);
|
|
44
|
+
Control.controlCount++;
|
|
45
|
+
this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.getDefault(option)), option || {});
|
|
46
|
+
}
|
|
47
|
+
getOptions() {
|
|
48
|
+
return this.controlOption;
|
|
49
|
+
}
|
|
34
50
|
|
|
35
51
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @
|
|
52
|
+
* 更新配置的方法,子类如果有自己的配置,也需要重写该方法
|
|
53
|
+
* @param newOptions
|
|
38
54
|
*/
|
|
55
|
+
setOptions(newOptions) {
|
|
56
|
+
const defaultOptions = this.getDefault(newOptions);
|
|
57
|
+
Object.entries(newOptions).forEach(([key, value]) => {
|
|
58
|
+
if (value === undefined) {
|
|
59
|
+
newOptions[key] = defaultOptions[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if ('position' in newOptions) {
|
|
63
|
+
this.setPosition(newOptions.position);
|
|
64
|
+
}
|
|
65
|
+
if ('className' in newOptions) {
|
|
66
|
+
this.setClassName(newOptions.className);
|
|
67
|
+
}
|
|
68
|
+
if ('style' in newOptions) {
|
|
69
|
+
this.setStyle(newOptions.style);
|
|
70
|
+
}
|
|
71
|
+
this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.controlOption), newOptions);
|
|
72
|
+
}
|
|
39
73
|
|
|
40
74
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
75
|
+
* 当 Control 被添加至 Scene 中,被 controlService 调用的方法
|
|
76
|
+
* @param sceneContainer
|
|
43
77
|
*/
|
|
78
|
+
addTo(sceneContainer) {
|
|
79
|
+
// 初始化各个 Service 实例
|
|
80
|
+
this.mapsService = sceneContainer.mapService;
|
|
81
|
+
this.renderService = sceneContainer.rendererService;
|
|
82
|
+
this.layerService = sceneContainer.layerService;
|
|
83
|
+
this.controlService = sceneContainer.controlService;
|
|
84
|
+
this.configService = sceneContainer.globalConfigService;
|
|
85
|
+
this.scene = sceneContainer.sceneService;
|
|
86
|
+
this.sceneContainer = sceneContainer;
|
|
87
|
+
this.isShow = true;
|
|
44
88
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
key: "getOptions",
|
|
55
|
-
value: function getOptions() {
|
|
56
|
-
return this.controlOption;
|
|
89
|
+
// 初始化 container
|
|
90
|
+
this.container = this.onAdd();
|
|
91
|
+
_l7Utils.DOM.addClass(this.container, 'l7-control');
|
|
92
|
+
const {
|
|
93
|
+
className,
|
|
94
|
+
style
|
|
95
|
+
} = this.controlOption;
|
|
96
|
+
if (className) {
|
|
97
|
+
this.setClassName(className);
|
|
57
98
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
* 更新配置的方法,子类如果有自己的配置,也需要重写该方法
|
|
61
|
-
* @param newOptions
|
|
62
|
-
*/
|
|
63
|
-
}, {
|
|
64
|
-
key: "setOptions",
|
|
65
|
-
value: function setOptions(newOptions) {
|
|
66
|
-
var defaultOptions = this.getDefault(newOptions);
|
|
67
|
-
Object.entries(newOptions).forEach(function (_ref2) {
|
|
68
|
-
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
69
|
-
key = _ref3[0],
|
|
70
|
-
value = _ref3[1];
|
|
71
|
-
if (value === undefined) {
|
|
72
|
-
newOptions[key] = defaultOptions[key];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
if ('position' in newOptions) {
|
|
76
|
-
this.setPosition(newOptions.position);
|
|
77
|
-
}
|
|
78
|
-
if ('className' in newOptions) {
|
|
79
|
-
this.setClassName(newOptions.className);
|
|
80
|
-
}
|
|
81
|
-
if ('style' in newOptions) {
|
|
82
|
-
this.setStyle(newOptions.style);
|
|
83
|
-
}
|
|
84
|
-
this.controlOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.controlOption), newOptions);
|
|
99
|
+
if (style) {
|
|
100
|
+
this.setStyle(style);
|
|
85
101
|
}
|
|
102
|
+
// 将 container 插入容器中
|
|
103
|
+
this.insertContainer();
|
|
104
|
+
this.emit('add', this);
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
86
107
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
key: "addTo",
|
|
93
|
-
value: function addTo(sceneContainer) {
|
|
94
|
-
// 初始化各个 Service 实例
|
|
95
|
-
this.mapsService = sceneContainer.mapService;
|
|
96
|
-
this.renderService = sceneContainer.rendererService;
|
|
97
|
-
this.layerService = sceneContainer.layerService;
|
|
98
|
-
this.controlService = sceneContainer.controlService;
|
|
99
|
-
this.configService = sceneContainer.globalConfigService;
|
|
100
|
-
this.scene = sceneContainer.sceneService;
|
|
101
|
-
this.sceneContainer = sceneContainer;
|
|
102
|
-
this.isShow = true;
|
|
103
|
-
|
|
104
|
-
// 初始化 container
|
|
105
|
-
this.container = this.onAdd();
|
|
106
|
-
_l7Utils.DOM.addClass(this.container, 'l7-control');
|
|
107
|
-
var _this$controlOption = this.controlOption,
|
|
108
|
-
className = _this$controlOption.className,
|
|
109
|
-
style = _this$controlOption.style;
|
|
110
|
-
if (className) {
|
|
111
|
-
this.setClassName(className);
|
|
112
|
-
}
|
|
113
|
-
if (style) {
|
|
114
|
-
this.setStyle(style);
|
|
115
|
-
}
|
|
116
|
-
// 将 container 插入容器中
|
|
117
|
-
this.insertContainer();
|
|
118
|
-
this.emit('add', this);
|
|
108
|
+
/**
|
|
109
|
+
* 将控件移除时触发
|
|
110
|
+
*/
|
|
111
|
+
remove() {
|
|
112
|
+
if (!this.mapsService) {
|
|
119
113
|
return this;
|
|
120
114
|
}
|
|
115
|
+
_l7Utils.DOM.remove(this.container);
|
|
116
|
+
this.onRemove();
|
|
117
|
+
this.emit('remove', this);
|
|
118
|
+
}
|
|
121
119
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (!this.mapsService) {
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
_l7Utils.DOM.remove(this.container);
|
|
132
|
-
this.onRemove();
|
|
133
|
-
this.emit('remove', this);
|
|
134
|
-
}
|
|
120
|
+
/**
|
|
121
|
+
* Control 被添加的时候被调用,返回 Control 对应的 DOM 容器
|
|
122
|
+
*/
|
|
123
|
+
onAdd() {
|
|
124
|
+
return _l7Utils.DOM.create('div');
|
|
125
|
+
}
|
|
135
126
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
value: function onAdd() {
|
|
142
|
-
return _l7Utils.DOM.create('div');
|
|
143
|
-
}
|
|
127
|
+
/**
|
|
128
|
+
* Control 被移除时调用
|
|
129
|
+
*/
|
|
130
|
+
// tslint:disable-next-line:no-empty
|
|
131
|
+
onRemove() {}
|
|
144
132
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
/**
|
|
134
|
+
* 显示控件时触发
|
|
135
|
+
*/
|
|
136
|
+
show() {
|
|
137
|
+
const container = this.container;
|
|
138
|
+
_l7Utils.DOM.removeClass(container, 'l7-control--hide');
|
|
139
|
+
this.isShow = true;
|
|
140
|
+
this.emit('show', this);
|
|
141
|
+
}
|
|
152
142
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.emit('show', this);
|
|
163
|
-
}
|
|
143
|
+
/**
|
|
144
|
+
* 隐藏控件时触发
|
|
145
|
+
*/
|
|
146
|
+
hide() {
|
|
147
|
+
const container = this.container;
|
|
148
|
+
_l7Utils.DOM.addClass(container, 'l7-control--hide');
|
|
149
|
+
this.isShow = false;
|
|
150
|
+
this.emit('hide', this);
|
|
151
|
+
}
|
|
164
152
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
153
|
+
/**
|
|
154
|
+
* 获取默认构造器参数
|
|
155
|
+
*/
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
157
|
+
getDefault(option) {
|
|
158
|
+
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
159
|
+
return {
|
|
160
|
+
position: _l7Core.PositionType.TOPRIGHT,
|
|
161
|
+
name: `${Control.controlCount}`
|
|
162
|
+
};
|
|
163
|
+
}
|
|
176
164
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
value: function getDefault(option) {
|
|
184
|
-
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
185
|
-
return {
|
|
186
|
-
position: _l7Core.PositionType.TOPRIGHT,
|
|
187
|
-
name: "".concat(Control.controlCount)
|
|
188
|
-
};
|
|
189
|
-
}
|
|
165
|
+
/**
|
|
166
|
+
* 获取当前控件对应的 DOM 容器
|
|
167
|
+
*/
|
|
168
|
+
getContainer() {
|
|
169
|
+
return this.container;
|
|
170
|
+
}
|
|
190
171
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
172
|
+
/**
|
|
173
|
+
* 获取当前 Control 是否展示
|
|
174
|
+
*/
|
|
175
|
+
getIsShow() {
|
|
176
|
+
return this.isShow;
|
|
177
|
+
}
|
|
178
|
+
_refocusOnMap(e) {
|
|
179
|
+
// if map exists and event is not a keyboard event
|
|
180
|
+
if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
|
|
181
|
+
const container = this.mapsService.getContainer();
|
|
182
|
+
if (container !== null) {
|
|
183
|
+
container.focus();
|
|
184
|
+
}
|
|
198
185
|
}
|
|
186
|
+
}
|
|
199
187
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
188
|
+
/**
|
|
189
|
+
* 设置当前控件位置
|
|
190
|
+
* @param position
|
|
191
|
+
*/
|
|
192
|
+
setPosition(position = _l7Core.PositionType.TOPLEFT) {
|
|
193
|
+
// 考虑组件的自动布局,需要销毁重建
|
|
194
|
+
const controlService = this.controlService;
|
|
195
|
+
if (controlService) {
|
|
196
|
+
controlService.removeControl(this);
|
|
207
197
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
// if map exists and event is not a keyboard event
|
|
212
|
-
if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
|
|
213
|
-
var container = this.mapsService.getContainer();
|
|
214
|
-
if (container !== null) {
|
|
215
|
-
container.focus();
|
|
216
|
-
}
|
|
217
|
-
}
|
|
198
|
+
this.controlOption.position = position;
|
|
199
|
+
if (controlService) {
|
|
200
|
+
controlService.addControl(this, this.sceneContainer);
|
|
218
201
|
}
|
|
202
|
+
return this;
|
|
203
|
+
}
|
|
219
204
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
controlService.removeControl(this);
|
|
232
|
-
}
|
|
233
|
-
this.controlOption.position = position;
|
|
234
|
-
if (controlService) {
|
|
235
|
-
controlService.addControl(this, this.sceneContainer);
|
|
236
|
-
}
|
|
237
|
-
return this;
|
|
205
|
+
/**
|
|
206
|
+
* 设置容器 container 的样式相关位置,包含 className
|
|
207
|
+
* @param className
|
|
208
|
+
*/
|
|
209
|
+
setClassName(className) {
|
|
210
|
+
const container = this.container;
|
|
211
|
+
const {
|
|
212
|
+
className: oldClassName
|
|
213
|
+
} = this.controlOption;
|
|
214
|
+
if (oldClassName) {
|
|
215
|
+
_l7Utils.DOM.removeClass(container, oldClassName);
|
|
238
216
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
* 设置容器 container 的样式相关位置,包含 className
|
|
242
|
-
* @param className
|
|
243
|
-
*/
|
|
244
|
-
}, {
|
|
245
|
-
key: "setClassName",
|
|
246
|
-
value: function setClassName(className) {
|
|
247
|
-
var container = this.container;
|
|
248
|
-
var oldClassName = this.controlOption.className;
|
|
249
|
-
if (oldClassName) {
|
|
250
|
-
_l7Utils.DOM.removeClass(container, oldClassName);
|
|
251
|
-
}
|
|
252
|
-
if (className) {
|
|
253
|
-
_l7Utils.DOM.addClass(container, className);
|
|
254
|
-
}
|
|
217
|
+
if (className) {
|
|
218
|
+
_l7Utils.DOM.addClass(container, className);
|
|
255
219
|
}
|
|
220
|
+
}
|
|
256
221
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
} else {
|
|
268
|
-
container.removeAttribute('style');
|
|
269
|
-
}
|
|
222
|
+
/**
|
|
223
|
+
* 设置容器 container 的样式相关位置,包含 style
|
|
224
|
+
* @param style
|
|
225
|
+
*/
|
|
226
|
+
setStyle(style) {
|
|
227
|
+
const container = this.container;
|
|
228
|
+
if (style) {
|
|
229
|
+
container.setAttribute('style', style);
|
|
230
|
+
} else {
|
|
231
|
+
container.removeAttribute('style');
|
|
270
232
|
}
|
|
233
|
+
}
|
|
271
234
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
235
|
+
/**
|
|
236
|
+
* 将控件 DOM 插入到对应 position 的容器中
|
|
237
|
+
* @protected
|
|
238
|
+
*/
|
|
239
|
+
insertContainer() {
|
|
240
|
+
const position = this.controlOption.position;
|
|
241
|
+
const container = this.container;
|
|
242
|
+
if (position instanceof Element) {
|
|
243
|
+
position.appendChild(container);
|
|
244
|
+
} else {
|
|
245
|
+
const corner = this.controlService.controlCorners[position];
|
|
246
|
+
if (['bottomleft', 'bottomright', 'righttop', 'rightbottom'].includes(position)) {
|
|
247
|
+
corner.insertBefore(container, corner.firstChild);
|
|
283
248
|
} else {
|
|
284
|
-
|
|
285
|
-
if (['bottomleft', 'bottomright', 'righttop', 'rightbottom'].includes(position)) {
|
|
286
|
-
corner.insertBefore(container, corner.firstChild);
|
|
287
|
-
} else {
|
|
288
|
-
corner.appendChild(container);
|
|
289
|
-
}
|
|
249
|
+
corner.appendChild(container);
|
|
290
250
|
}
|
|
291
251
|
}
|
|
252
|
+
}
|
|
292
253
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
key
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
}]);
|
|
307
|
-
return Control;
|
|
308
|
-
}(_eventemitter.default);
|
|
254
|
+
/**
|
|
255
|
+
* 检查当前传入 option 是否包含 keys 字段
|
|
256
|
+
* @param option
|
|
257
|
+
* @param keys
|
|
258
|
+
* @protected
|
|
259
|
+
*/
|
|
260
|
+
checkUpdateOption(option, keys) {
|
|
261
|
+
return keys.some(key => key in option);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.default = exports.Control = Control;
|
|
309
265
|
/**
|
|
310
266
|
* 当前类型控件实例个数
|
|
311
267
|
* @protected
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ButtonControl, type IButtonControlOption } from './buttonControl';
|
|
2
|
+
export { Control, PositionType, type IControlOption } from './control';
|
|
3
|
+
export { PopperControl, type IPopperControlOption } from './popperControl';
|
|
4
|
+
export { SelectControl, type ControlOptionItem, type ISelectControlOption, } from './selectControl';
|
|
@@ -5,31 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "ButtonControl", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _buttonControl.ButtonControl;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "Control", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
14
|
+
get: function () {
|
|
15
15
|
return _control.Control;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "PopperControl", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function
|
|
20
|
+
get: function () {
|
|
21
21
|
return _popperControl.PopperControl;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "PositionType", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function
|
|
26
|
+
get: function () {
|
|
27
27
|
return _control.PositionType;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "SelectControl", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function
|
|
32
|
+
get: function () {
|
|
33
33
|
return _selectControl.SelectControl;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PopperPlacement, PopperTrigger } from '../../utils/popper';
|
|
2
|
+
import { Popper } from '../../utils/popper';
|
|
3
|
+
import type { IButtonControlOption } from './buttonControl';
|
|
4
|
+
import ButtonControl from './buttonControl';
|
|
5
|
+
export { PopperControl };
|
|
6
|
+
export interface IPopperControlOption extends IButtonControlOption {
|
|
7
|
+
popperPlacement: PopperPlacement;
|
|
8
|
+
popperClassName?: string;
|
|
9
|
+
popperTrigger: PopperTrigger;
|
|
10
|
+
}
|
|
11
|
+
export default class PopperControl<O extends IPopperControlOption = IPopperControlOption> extends ButtonControl<O> {
|
|
12
|
+
/**
|
|
13
|
+
* 气泡实例
|
|
14
|
+
* @protected
|
|
15
|
+
*/
|
|
16
|
+
protected popper: Popper;
|
|
17
|
+
getPopper(): Popper;
|
|
18
|
+
hide(): void;
|
|
19
|
+
/**
|
|
20
|
+
* 获取默认配置
|
|
21
|
+
* @param option
|
|
22
|
+
*/
|
|
23
|
+
getDefault(option?: Partial<O>): O;
|
|
24
|
+
onAdd(): HTMLElement;
|
|
25
|
+
onRemove(): void;
|
|
26
|
+
initPopper(): Popper;
|
|
27
|
+
setOptions(option: Partial<O>): void;
|
|
28
|
+
}
|