@antv/l7-component 2.17.12 → 2.18.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/package.json +6 -7
- package/es/assets/iconfont/iconfont.js +0 -46
- package/es/constants/index.d.ts +0 -60
- package/es/constants/index.js +0 -60
- package/es/control/baseControl/buttonControl.d.ts +0 -59
- package/es/control/baseControl/buttonControl.js +0 -177
- package/es/control/baseControl/control.d.ts +0 -112
- package/es/control/baseControl/control.js +0 -302
- package/es/control/baseControl/index.d.ts +0 -4
- package/es/control/baseControl/index.js +0 -4
- package/es/control/baseControl/popperControl.d.ts +0 -26
- package/es/control/baseControl/popperControl.js +0 -120
- package/es/control/baseControl/selectControl.d.ts +0 -46
- package/es/control/baseControl/selectControl.js +0 -204
- package/es/control/exportImage.d.ts +0 -18
- package/es/control/exportImage.js +0 -159
- package/es/control/fullscreen.d.ts +0 -19
- package/es/control/fullscreen.js +0 -119
- package/es/control/geoLocate.d.ts +0 -16
- package/es/control/geoLocate.js +0 -108
- package/es/control/layerSwitch.d.ts +0 -19
- package/es/control/layerSwitch.js +0 -141
- package/es/control/logo.d.ts +0 -13
- package/es/control/logo.js +0 -75
- package/es/control/mapTheme.d.ts +0 -10
- package/es/control/mapTheme.js +0 -110
- package/es/control/mouseLocation.d.ts +0 -15
- package/es/control/mouseLocation.js +0 -83
- package/es/control/scale.d.ts +0 -34
- package/es/control/scale.js +0 -149
- package/es/control/zoom.d.ts +0 -38
- package/es/control/zoom.js +0 -132
- package/es/css/button.less +0 -70
- package/es/css/control.less +0 -71
- package/es/css/index.css +0 -594
- package/es/css/index.less +0 -12
- package/es/css/l7.less +0 -60
- package/es/css/layerPopup.less +0 -8
- package/es/css/logo.less +0 -18
- package/es/css/mouseLocation.less +0 -9
- package/es/css/popper.less +0 -64
- package/es/css/popup.less +0 -185
- package/es/css/scale.less +0 -34
- package/es/css/select.less +0 -86
- package/es/css/variables.less +0 -28
- package/es/css/zoom.less +0 -29
- package/es/images/layers.png +0 -0
- package/es/images/layers.svg +0 -1
- package/es/images/logo.png +0 -0
- package/es/images/quanping.svg +0 -12
- package/es/index.d.ts +0 -18
- package/es/index.js +0 -49
- package/es/interface.d.ts +0 -18
- package/es/interface.js +0 -1
- package/es/marker-layer.d.ts +0 -54
- package/es/marker-layer.js +0 -343
- package/es/marker.d.ts +0 -55
- package/es/marker.js +0 -410
- package/es/popup/layerPopup.d.ts +0 -86
- package/es/popup/layerPopup.js +0 -312
- package/es/popup/popup.d.ts +0 -139
- package/es/popup/popup.js +0 -567
- package/es/utils/anchor.d.ts +0 -22
- package/es/utils/anchor.js +0 -31
- package/es/utils/icon.d.ts +0 -1
- package/es/utils/icon.js +0 -9
- package/es/utils/popper.d.ts +0 -75
- package/es/utils/popper.js +0 -259
- package/es/utils/screenfull.d.ts +0 -2
- package/es/utils/screenfull.js +0 -128
- package/lib/assets/iconfont/iconfont.js +0 -48
- package/lib/constants/index.js +0 -68
- package/lib/control/baseControl/buttonControl.js +0 -183
- package/lib/control/baseControl/control.js +0 -314
- package/lib/control/baseControl/index.js +0 -39
- package/lib/control/baseControl/popperControl.js +0 -126
- package/lib/control/baseControl/selectControl.js +0 -210
- package/lib/control/exportImage.js +0 -165
- package/lib/control/fullscreen.js +0 -125
- package/lib/control/geoLocate.js +0 -114
- package/lib/control/layerSwitch.js +0 -147
- package/lib/control/logo.js +0 -81
- package/lib/control/mapTheme.js +0 -116
- package/lib/control/mouseLocation.js +0 -89
- package/lib/control/scale.js +0 -155
- package/lib/control/zoom.js +0 -138
- package/lib/css/button.less +0 -70
- package/lib/css/control.less +0 -71
- package/lib/css/index.css +0 -594
- package/lib/css/index.less +0 -12
- package/lib/css/l7.less +0 -60
- package/lib/css/layerPopup.less +0 -8
- package/lib/css/logo.less +0 -18
- package/lib/css/mouseLocation.less +0 -9
- package/lib/css/popper.less +0 -64
- package/lib/css/popup.less +0 -185
- package/lib/css/scale.less +0 -34
- package/lib/css/select.less +0 -86
- package/lib/css/variables.less +0 -28
- package/lib/css/zoom.less +0 -29
- package/lib/images/layers.png +0 -0
- package/lib/images/layers.svg +0 -1
- package/lib/images/logo.png +0 -0
- package/lib/images/quanping.svg +0 -12
- package/lib/index.js +0 -169
- package/lib/interface.js +0 -5
- package/lib/marker-layer.js +0 -349
- package/lib/marker.js +0 -417
- package/lib/popup/layerPopup.js +0 -317
- package/lib/popup/popup.js +0 -573
- package/lib/utils/anchor.js +0 -40
- package/lib/utils/icon.js +0 -16
- package/lib/utils/popper.js +0 -263
- package/lib/utils/screenfull.js +0 -136
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
import { PositionType, TYPES } from '@antv/l7-core';
|
|
12
|
-
import { DOM } from '@antv/l7-utils';
|
|
13
|
-
import EventEmitter from 'eventemitter3';
|
|
14
|
-
export { PositionType } from '@antv/l7-core';
|
|
15
|
-
export { Control };
|
|
16
|
-
var Control = /*#__PURE__*/function (_ref) {
|
|
17
|
-
_inherits(Control, _ref);
|
|
18
|
-
var _super = _createSuper(Control);
|
|
19
|
-
/**
|
|
20
|
-
* 当前控件实例配置
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 控件的 DOM 容器
|
|
25
|
-
* @protected
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 当前控件是否显示
|
|
30
|
-
* @protected
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
function Control(option) {
|
|
34
|
-
var _this;
|
|
35
|
-
_classCallCheck(this, Control);
|
|
36
|
-
_this = _super.call(this);
|
|
37
|
-
Control.controlCount++;
|
|
38
|
-
_this.controlOption = _objectSpread(_objectSpread({}, _this.getDefault(option)), option || {});
|
|
39
|
-
return _this;
|
|
40
|
-
}
|
|
41
|
-
_createClass(Control, [{
|
|
42
|
-
key: "getOptions",
|
|
43
|
-
value: function getOptions() {
|
|
44
|
-
return this.controlOption;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 更新配置的方法,子类如果有自己的配置,也需要重写该方法
|
|
49
|
-
* @param newOptions
|
|
50
|
-
*/
|
|
51
|
-
}, {
|
|
52
|
-
key: "setOptions",
|
|
53
|
-
value: function setOptions(newOptions) {
|
|
54
|
-
var defaultOptions = this.getDefault(newOptions);
|
|
55
|
-
Object.entries(newOptions).forEach(function (_ref2) {
|
|
56
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
57
|
-
key = _ref3[0],
|
|
58
|
-
value = _ref3[1];
|
|
59
|
-
if (value === undefined) {
|
|
60
|
-
newOptions[key] = defaultOptions[key];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
if ('position' in newOptions) {
|
|
64
|
-
this.setPosition(newOptions.position);
|
|
65
|
-
}
|
|
66
|
-
if ('className' in newOptions) {
|
|
67
|
-
this.setClassName(newOptions.className);
|
|
68
|
-
}
|
|
69
|
-
if ('style' in newOptions) {
|
|
70
|
-
this.setStyle(newOptions.style);
|
|
71
|
-
}
|
|
72
|
-
this.controlOption = _objectSpread(_objectSpread({}, this.controlOption), newOptions);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 当 Control 被添加至 Scene 中,被 controlService 调用的方法
|
|
77
|
-
* @param sceneContainer
|
|
78
|
-
*/
|
|
79
|
-
}, {
|
|
80
|
-
key: "addTo",
|
|
81
|
-
value: function addTo(sceneContainer) {
|
|
82
|
-
// 初始化各个 Service 实例
|
|
83
|
-
this.mapsService = sceneContainer.get(TYPES.IMapService);
|
|
84
|
-
this.renderService = sceneContainer.get(TYPES.IRendererService);
|
|
85
|
-
this.layerService = sceneContainer.get(TYPES.ILayerService);
|
|
86
|
-
this.controlService = sceneContainer.get(TYPES.IControlService);
|
|
87
|
-
this.configService = sceneContainer.get(TYPES.IGlobalConfigService);
|
|
88
|
-
this.scene = sceneContainer.get(TYPES.ISceneService);
|
|
89
|
-
this.sceneContainer = sceneContainer;
|
|
90
|
-
this.isShow = true;
|
|
91
|
-
|
|
92
|
-
// 初始化 container
|
|
93
|
-
this.container = this.onAdd();
|
|
94
|
-
DOM.addClass(this.container, 'l7-control');
|
|
95
|
-
var _this$controlOption = this.controlOption,
|
|
96
|
-
className = _this$controlOption.className,
|
|
97
|
-
style = _this$controlOption.style;
|
|
98
|
-
if (className) {
|
|
99
|
-
this.setClassName(className);
|
|
100
|
-
}
|
|
101
|
-
if (style) {
|
|
102
|
-
this.setStyle(style);
|
|
103
|
-
}
|
|
104
|
-
// 将 container 插入容器中
|
|
105
|
-
this.insertContainer();
|
|
106
|
-
this.emit('add', this);
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 将控件移除时触发
|
|
112
|
-
*/
|
|
113
|
-
}, {
|
|
114
|
-
key: "remove",
|
|
115
|
-
value: function remove() {
|
|
116
|
-
if (!this.mapsService) {
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
DOM.remove(this.container);
|
|
120
|
-
this.onRemove();
|
|
121
|
-
this.emit('remove', this);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Control 被添加的时候被调用,返回 Control 对应的 DOM 容器
|
|
126
|
-
*/
|
|
127
|
-
}, {
|
|
128
|
-
key: "onAdd",
|
|
129
|
-
value: function onAdd() {
|
|
130
|
-
return DOM.create('div');
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Control 被移除时调用
|
|
135
|
-
*/
|
|
136
|
-
// tslint:disable-next-line:no-empty
|
|
137
|
-
}, {
|
|
138
|
-
key: "onRemove",
|
|
139
|
-
value: function onRemove() {}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* 显示控件时触发
|
|
143
|
-
*/
|
|
144
|
-
}, {
|
|
145
|
-
key: "show",
|
|
146
|
-
value: function show() {
|
|
147
|
-
var container = this.container;
|
|
148
|
-
DOM.removeClass(container, 'l7-control--hide');
|
|
149
|
-
this.isShow = true;
|
|
150
|
-
this.emit('show', this);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* 隐藏控件时触发
|
|
155
|
-
*/
|
|
156
|
-
}, {
|
|
157
|
-
key: "hide",
|
|
158
|
-
value: function hide() {
|
|
159
|
-
var container = this.container;
|
|
160
|
-
DOM.addClass(container, 'l7-control--hide');
|
|
161
|
-
this.isShow = false;
|
|
162
|
-
this.emit('hide', this);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* 获取默认构造器参数
|
|
167
|
-
*/
|
|
168
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
169
|
-
}, {
|
|
170
|
-
key: "getDefault",
|
|
171
|
-
value: function getDefault(option) {
|
|
172
|
-
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
173
|
-
return {
|
|
174
|
-
position: PositionType.TOPRIGHT,
|
|
175
|
-
name: "".concat(Control.controlCount)
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* 获取当前控件对应的 DOM 容器
|
|
181
|
-
*/
|
|
182
|
-
}, {
|
|
183
|
-
key: "getContainer",
|
|
184
|
-
value: function getContainer() {
|
|
185
|
-
return this.container;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* 获取当前 Control 是否展示
|
|
190
|
-
*/
|
|
191
|
-
}, {
|
|
192
|
-
key: "getIsShow",
|
|
193
|
-
value: function getIsShow() {
|
|
194
|
-
return this.isShow;
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
197
|
-
key: "_refocusOnMap",
|
|
198
|
-
value: function _refocusOnMap(e) {
|
|
199
|
-
// if map exists and event is not a keyboard event
|
|
200
|
-
if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
|
|
201
|
-
var container = this.mapsService.getContainer();
|
|
202
|
-
if (container !== null) {
|
|
203
|
-
container.focus();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* 设置当前控件位置
|
|
210
|
-
* @param position
|
|
211
|
-
*/
|
|
212
|
-
}, {
|
|
213
|
-
key: "setPosition",
|
|
214
|
-
value: function setPosition() {
|
|
215
|
-
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PositionType.TOPLEFT;
|
|
216
|
-
// 考虑组件的自动布局,需要销毁重建
|
|
217
|
-
var controlService = this.controlService;
|
|
218
|
-
if (controlService) {
|
|
219
|
-
controlService.removeControl(this);
|
|
220
|
-
}
|
|
221
|
-
this.controlOption.position = position;
|
|
222
|
-
if (controlService) {
|
|
223
|
-
controlService.addControl(this, this.sceneContainer);
|
|
224
|
-
}
|
|
225
|
-
return this;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* 设置容器 container 的样式相关位置,包含 className
|
|
230
|
-
* @param className
|
|
231
|
-
*/
|
|
232
|
-
}, {
|
|
233
|
-
key: "setClassName",
|
|
234
|
-
value: function setClassName(className) {
|
|
235
|
-
var container = this.container;
|
|
236
|
-
var oldClassName = this.controlOption.className;
|
|
237
|
-
if (oldClassName) {
|
|
238
|
-
DOM.removeClass(container, oldClassName);
|
|
239
|
-
}
|
|
240
|
-
if (className) {
|
|
241
|
-
DOM.addClass(container, className);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* 设置容器 container 的样式相关位置,包含 style
|
|
247
|
-
* @param style
|
|
248
|
-
*/
|
|
249
|
-
}, {
|
|
250
|
-
key: "setStyle",
|
|
251
|
-
value: function setStyle(style) {
|
|
252
|
-
var container = this.container;
|
|
253
|
-
if (style) {
|
|
254
|
-
container.setAttribute('style', style);
|
|
255
|
-
} else {
|
|
256
|
-
container.removeAttribute('style');
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* 将控件 DOM 插入到对应 position 的容器中
|
|
262
|
-
* @protected
|
|
263
|
-
*/
|
|
264
|
-
}, {
|
|
265
|
-
key: "insertContainer",
|
|
266
|
-
value: function insertContainer() {
|
|
267
|
-
var position = this.controlOption.position;
|
|
268
|
-
var container = this.container;
|
|
269
|
-
if (position instanceof Element) {
|
|
270
|
-
position.appendChild(container);
|
|
271
|
-
} else {
|
|
272
|
-
var corner = this.controlService.controlCorners[position];
|
|
273
|
-
if (['bottomleft', 'bottomright', 'righttop', 'rightbottom'].includes(position)) {
|
|
274
|
-
corner.insertBefore(container, corner.firstChild);
|
|
275
|
-
} else {
|
|
276
|
-
corner.appendChild(container);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* 检查当前传入 option 是否包含 keys 字段
|
|
283
|
-
* @param option
|
|
284
|
-
* @param keys
|
|
285
|
-
* @protected
|
|
286
|
-
*/
|
|
287
|
-
}, {
|
|
288
|
-
key: "checkUpdateOption",
|
|
289
|
-
value: function checkUpdateOption(option, keys) {
|
|
290
|
-
return keys.some(function (key) {
|
|
291
|
-
return key in option;
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
}]);
|
|
295
|
-
return Control;
|
|
296
|
-
}(EventEmitter);
|
|
297
|
-
/**
|
|
298
|
-
* 当前类型控件实例个数
|
|
299
|
-
* @protected
|
|
300
|
-
*/
|
|
301
|
-
_defineProperty(Control, "controlCount", 0);
|
|
302
|
-
export { Control as default };
|
|
@@ -1,4 +0,0 @@
|
|
|
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';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Popper, PopperPlacement, PopperTrigger } from '../../utils/popper';
|
|
2
|
-
import ButtonControl, { IButtonControlOption } from './buttonControl';
|
|
3
|
-
export { PopperControl };
|
|
4
|
-
export interface IPopperControlOption extends IButtonControlOption {
|
|
5
|
-
popperPlacement: PopperPlacement;
|
|
6
|
-
popperClassName?: string;
|
|
7
|
-
popperTrigger: PopperTrigger;
|
|
8
|
-
}
|
|
9
|
-
export default class PopperControl<O extends IPopperControlOption = IPopperControlOption> extends ButtonControl<O> {
|
|
10
|
-
/**
|
|
11
|
-
* 气泡实例
|
|
12
|
-
* @protected
|
|
13
|
-
*/
|
|
14
|
-
protected popper: Popper;
|
|
15
|
-
getPopper(): Popper;
|
|
16
|
-
hide(): void;
|
|
17
|
-
/**
|
|
18
|
-
* 获取默认配置
|
|
19
|
-
* @param option
|
|
20
|
-
*/
|
|
21
|
-
getDefault(option?: Partial<O>): O;
|
|
22
|
-
onAdd(): HTMLElement;
|
|
23
|
-
onRemove(): void;
|
|
24
|
-
initPopper(): Popper;
|
|
25
|
-
setOptions(option: Partial<O>): void;
|
|
26
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _get from "@babel/runtime/helpers/esm/get";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
import { Popper } from "../../utils/popper";
|
|
11
|
-
import ButtonControl from "./buttonControl";
|
|
12
|
-
export { PopperControl };
|
|
13
|
-
var PopperPlacementMap = {
|
|
14
|
-
topleft: 'right-start',
|
|
15
|
-
topcenter: 'bottom',
|
|
16
|
-
topright: 'left-start',
|
|
17
|
-
bottomleft: 'right-end',
|
|
18
|
-
bottomcenter: 'top',
|
|
19
|
-
bottomright: 'left-end',
|
|
20
|
-
lefttop: 'bottom-start',
|
|
21
|
-
leftcenter: 'right',
|
|
22
|
-
leftbottom: 'top-start',
|
|
23
|
-
righttop: 'bottom-end',
|
|
24
|
-
rightcenter: 'left',
|
|
25
|
-
rightbottom: 'top-end'
|
|
26
|
-
};
|
|
27
|
-
var PopperControl = /*#__PURE__*/function (_ButtonControl) {
|
|
28
|
-
_inherits(PopperControl, _ButtonControl);
|
|
29
|
-
var _super = _createSuper(PopperControl);
|
|
30
|
-
function PopperControl() {
|
|
31
|
-
_classCallCheck(this, PopperControl);
|
|
32
|
-
return _super.apply(this, arguments);
|
|
33
|
-
}
|
|
34
|
-
_createClass(PopperControl, [{
|
|
35
|
-
key: "getPopper",
|
|
36
|
-
value:
|
|
37
|
-
/**
|
|
38
|
-
* 气泡实例
|
|
39
|
-
* @protected
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
function getPopper() {
|
|
43
|
-
return this.popper;
|
|
44
|
-
}
|
|
45
|
-
}, {
|
|
46
|
-
key: "hide",
|
|
47
|
-
value: function hide() {
|
|
48
|
-
this.popper.hide();
|
|
49
|
-
_get(_getPrototypeOf(PopperControl.prototype), "hide", this).call(this);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 获取默认配置
|
|
54
|
-
* @param option
|
|
55
|
-
*/
|
|
56
|
-
}, {
|
|
57
|
-
key: "getDefault",
|
|
58
|
-
value: function getDefault(option) {
|
|
59
|
-
var _option$position;
|
|
60
|
-
var defaultOption = _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option);
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
62
|
-
var position = (_option$position = option === null || option === void 0 ? void 0 : option.position) !== null && _option$position !== void 0 ? _option$position : defaultOption.position;
|
|
63
|
-
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option)), {}, {
|
|
64
|
-
popperPlacement: position instanceof Element ? 'bottom' : PopperPlacementMap[position],
|
|
65
|
-
popperTrigger: 'click'
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "onAdd",
|
|
70
|
-
value: function onAdd() {
|
|
71
|
-
var button = _get(_getPrototypeOf(PopperControl.prototype), "onAdd", this).call(this);
|
|
72
|
-
this.initPopper();
|
|
73
|
-
return button;
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "onRemove",
|
|
77
|
-
value: function onRemove() {
|
|
78
|
-
this.popper.destroy();
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "initPopper",
|
|
82
|
-
value: function initPopper() {
|
|
83
|
-
var _this = this;
|
|
84
|
-
var _this$controlOption = this.controlOption,
|
|
85
|
-
popperClassName = _this$controlOption.popperClassName,
|
|
86
|
-
popperPlacement = _this$controlOption.popperPlacement,
|
|
87
|
-
popperTrigger = _this$controlOption.popperTrigger;
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
89
|
-
var popperContainer = this.mapsService.getMapContainer();
|
|
90
|
-
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
92
|
-
this.popper = new Popper(this.button, {
|
|
93
|
-
className: popperClassName,
|
|
94
|
-
placement: popperPlacement,
|
|
95
|
-
trigger: popperTrigger,
|
|
96
|
-
container: popperContainer,
|
|
97
|
-
unique: true
|
|
98
|
-
});
|
|
99
|
-
this.popper.on('show', function () {
|
|
100
|
-
_this.emit('popperShow', _this);
|
|
101
|
-
}).on('hide', function () {
|
|
102
|
-
_this.emit('popperHide', _this);
|
|
103
|
-
});
|
|
104
|
-
return this.popper;
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "setOptions",
|
|
108
|
-
value: function setOptions(option) {
|
|
109
|
-
_get(_getPrototypeOf(PopperControl.prototype), "setOptions", this).call(this, option);
|
|
110
|
-
if (this.checkUpdateOption(option, ['popperPlacement', 'popperTrigger', 'popperClassName'])) {
|
|
111
|
-
var content = this.popper.getContent();
|
|
112
|
-
this.popper.destroy();
|
|
113
|
-
this.initPopper();
|
|
114
|
-
this.popper.setContent(content);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}]);
|
|
118
|
-
return PopperControl;
|
|
119
|
-
}(ButtonControl);
|
|
120
|
-
export { PopperControl as default };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { IPopperControlOption, PopperControl } from './popperControl';
|
|
2
|
-
type BaseOptionItem = {
|
|
3
|
-
value: string;
|
|
4
|
-
text: string;
|
|
5
|
-
[key: string]: string;
|
|
6
|
-
};
|
|
7
|
-
type NormalOptionItem = BaseOptionItem & {
|
|
8
|
-
icon?: HTMLElement;
|
|
9
|
-
};
|
|
10
|
-
type ImageOptionItem = BaseOptionItem & {
|
|
11
|
-
img: string;
|
|
12
|
-
};
|
|
13
|
-
export type ControlOptionItem = ImageOptionItem | NormalOptionItem;
|
|
14
|
-
export interface ISelectControlOption extends IPopperControlOption {
|
|
15
|
-
options: ControlOptionItem[];
|
|
16
|
-
defaultValue?: string | string[];
|
|
17
|
-
}
|
|
18
|
-
export { SelectControl };
|
|
19
|
-
export default class SelectControl<O extends ISelectControlOption = ISelectControlOption> extends PopperControl<O> {
|
|
20
|
-
/**
|
|
21
|
-
* 当前选中的值
|
|
22
|
-
* @protected
|
|
23
|
-
*/
|
|
24
|
-
protected selectValue: string[];
|
|
25
|
-
/**
|
|
26
|
-
* 选项对应的 DOM 列表
|
|
27
|
-
* @protected
|
|
28
|
-
*/
|
|
29
|
-
protected optionDOMList: HTMLElement[];
|
|
30
|
-
setOptions(option: Partial<O>): void;
|
|
31
|
-
onAdd(): HTMLElement;
|
|
32
|
-
getSelectValue(): string | string[];
|
|
33
|
-
setSelectValue(value: string | string[], emitEvent?: boolean): void;
|
|
34
|
-
/**
|
|
35
|
-
* 是否为多选
|
|
36
|
-
* @protected
|
|
37
|
-
*/
|
|
38
|
-
protected getIsMultiple(): boolean;
|
|
39
|
-
protected getPopperContent(options: ControlOptionItem[]): HTMLElement;
|
|
40
|
-
protected createNormalOption: (option: NormalOptionItem) => HTMLElement;
|
|
41
|
-
protected createImageOption(option: ImageOptionItem): HTMLElement;
|
|
42
|
-
protected createCheckbox(isSelect: boolean): HTMLElement;
|
|
43
|
-
protected onItemClick: (item: ControlOptionItem) => void;
|
|
44
|
-
protected isImageOptions(): boolean;
|
|
45
|
-
protected transSelectValue(value: string | string[]): string[];
|
|
46
|
-
}
|