eoss 0.1.0-alpha.21 → 0.1.0-alpha.23
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/account-login.js +125 -125
- package/lib/alert.js +2 -2
- package/lib/aside.js +2 -2
- package/lib/autocomplete.js +239 -239
- package/lib/avatar.js +2 -2
- package/lib/backtop.js +4 -4
- package/lib/badge.js +2 -2
- package/lib/breadcrumb-item.js +2 -2
- package/lib/breadcrumb.js +2 -2
- package/lib/button-group.js +2 -2
- package/lib/button.js +2 -2
- package/lib/ca-login.js +6 -6
- package/lib/calendar.js +2 -2
- package/lib/card.js +2 -2
- package/lib/carousel-item.js +22 -22
- package/lib/carousel.js +40 -26
- package/lib/cascader-panel.js +12 -12
- package/lib/cascader.js +506 -492
- package/lib/checkbox-button.js +2 -2
- package/lib/checkbox-group.js +137 -137
- package/lib/checkbox.js +2 -2
- package/lib/col.js +2 -2
- package/lib/collapse-item.js +1224 -1030
- package/lib/collapse.js +1225 -1030
- package/lib/color-picker.js +12 -12
- package/lib/container.js +2 -2
- package/lib/cron.js +2 -2
- package/lib/data-table.js +121 -121
- package/lib/date-picker.js +225 -225
- package/lib/dialog.js +17 -17
- package/lib/divider.js +2 -2
- package/lib/drawer.js +6 -6
- package/lib/dropdown-item.js +2 -2
- package/lib/dropdown-menu.js +10 -10
- package/lib/dropdown.js +13 -13
- package/lib/email-login.js +365 -365
- package/lib/empty.js +2 -2
- package/lib/eoss.common.js +21402 -20724
- package/lib/flip.js +2 -2
- package/lib/flow-group.js +251 -251
- package/lib/flow.js +15933 -18946
- package/lib/flows.js +9195 -0
- package/lib/footer.js +2 -2
- package/lib/form-item.js +28 -17
- package/lib/form.js +1228 -1033
- package/lib/header.js +2 -2
- package/lib/icon.js +129 -129
- package/lib/icons.js +4 -4
- package/lib/image-viewer.js +6 -6
- package/lib/image.js +4 -4
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +4 -4
- package/lib/input-number.js +11 -11
- package/lib/input.js +28 -14
- package/lib/link.js +2 -2
- package/lib/loading.js +6 -6
- package/lib/login.js +277 -229
- package/lib/lowcode.js +964 -325
- package/lib/main.js +634 -565
- package/lib/marquee.js +6 -6
- package/lib/menu-item-group.js +2 -2
- package/lib/menu-item.js +2 -2
- package/lib/menu.js +1934 -1934
- package/lib/message-box.js +12 -12
- package/lib/message.js +10 -10
- package/lib/notification.js +16 -16
- package/lib/option-group.js +2 -2
- package/lib/option.js +6 -6
- package/lib/page-header.js +2 -2
- package/lib/pagination.js +16 -16
- package/lib/phone-login.js +127 -127
- package/lib/popconfirm.js +4 -4
- package/lib/popover.js +219 -219
- package/lib/progress.js +2 -2
- package/lib/qr-code.js +8 -8
- package/lib/qrcode-login.js +119 -119
- package/lib/radio-button.js +2 -2
- package/lib/radio-group.js +119 -119
- package/lib/radio.js +2 -2
- package/lib/rate.js +6 -6
- package/lib/row.js +2 -2
- package/lib/scrollbar.js +46 -32
- package/lib/select.js +823 -796
- package/lib/selector-panel.js +141 -141
- package/lib/selector.js +1040 -160
- package/lib/slider.js +2 -2
- package/lib/step.js +1225 -1030
- package/lib/steps.js +6 -6
- package/lib/submenu.js +27 -27
- package/lib/switch.js +15 -15
- package/lib/tab-pane.js +2 -2
- package/lib/table-column.js +8 -8
- package/lib/table.js +2530 -2516
- package/lib/tabs.js +28 -14
- package/lib/tag.js +2 -2
- package/lib/theme-chalk/autocomplete.css +1 -1
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/cascader-panel.css +1 -1
- package/lib/theme-chalk/cascader.css +1 -1
- package/lib/theme-chalk/checkbox-group.css +1 -1
- package/lib/theme-chalk/date-picker.css +1 -1
- package/lib/theme-chalk/descriptions-item.css +1 -1
- package/lib/theme-chalk/descriptions.css +1 -1
- package/lib/theme-chalk/empty.css +1 -1
- package/lib/theme-chalk/flow.css +1 -1
- package/lib/theme-chalk/flows.css +1 -0
- package/lib/theme-chalk/form.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/input-number.css +1 -1
- package/lib/theme-chalk/input.css +1 -1
- package/lib/theme-chalk/lowcode.css +1 -1
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/menu.css +1 -1
- package/lib/theme-chalk/message-box.css +1 -1
- package/lib/theme-chalk/message.css +1 -1
- package/lib/theme-chalk/notification.css +1 -1
- package/lib/theme-chalk/pagination.css +1 -1
- package/lib/theme-chalk/scrollbar.css +1 -1
- package/lib/theme-chalk/select.css +1 -1
- package/lib/theme-chalk/selector-panel.css +1 -1
- package/lib/theme-chalk/selector.css +1 -1
- package/lib/theme-chalk/slider.css +1 -1
- package/lib/theme-chalk/table.css +1 -1
- package/lib/theme-chalk/tabs.css +1 -1
- package/lib/theme-chalk/time-picker.css +1 -1
- package/lib/theme-chalk/time-select.css +1 -1
- package/lib/theme-chalk/timeline-item.css +1 -1
- package/lib/theme-chalk/transfer.css +1 -1
- package/lib/theme-chalk/tree.css +1 -1
- package/lib/theme-chalk/upload.css +1 -1
- package/lib/time-picker.js +16 -16
- package/lib/time-select.js +15 -15
- package/lib/timeline-item.js +2 -2
- package/lib/timeline.js +2 -2
- package/lib/tips.js +129 -129
- package/lib/toolbar.js +4 -4
- package/lib/tooltip.js +220 -220
- package/lib/transfer.js +8 -8
- package/lib/tree-group.js +124 -124
- package/lib/tree.js +144 -144
- package/lib/upload.js +155 -155
- package/lib/utils/resize-event.js +20 -6
- package/package.json +3 -1
- package/packages/carousel/src/carousel.vue +2 -2
- package/packages/flow/index.js +4 -4
- package/packages/flow/src/component/FreeCirculation.vue +4 -3
- package/packages/flow/src/component/SendMsg.vue +2 -4
- package/packages/flow/src/component/opinions.vue +203 -226
- package/packages/flow/src/component/taskUnionExamine.vue +2 -4
- package/packages/flow/src/freeStartFlow.vue +2 -2
- package/packages/flow/src/selectUser.vue +36 -1
- package/packages/flow/src/supervise.vue +4 -2
- package/packages/flows/index.js +7 -0
- package/packages/flows/readme.md +600 -0
- package/packages/flows/src/components/basis.vue +108 -0
- package/packages/flows/src/components/distribute.vue +42 -0
- package/packages/flows/src/components/opinions-file.vue +123 -0
- package/packages/{flow-copy/src/component → flows/src/components}/opinions.vue +227 -204
- package/packages/flows/src/components/quick-actions.vue +64 -0
- package/packages/flows/src/components/reject.vue +83 -0
- package/packages/flows/src/components/start-flow.vue +210 -0
- package/packages/flows/src/flow.vue +510 -0
- package/packages/{flow/src/flow.vue → flows/src/flows.vue} +40 -1327
- package/packages/form/src/form-item.vue +9 -2
- package/packages/form/src/label-wrap.vue +4 -1
- package/packages/login/src/login.vue +61 -32
- package/packages/lowcode/src/aside.vue +15 -2
- package/packages/lowcode/src/editor.vue +187 -0
- package/packages/lowcode/src/lowcode.vue +195 -41
- package/packages/lowcode/src/pages.vue +174 -26
- package/packages/lowcode/src/toolbar.vue +3 -18
- package/packages/main/src/components/pages.vue +97 -65
- package/packages/main/src/components/router-page.vue +0 -2
- package/packages/main/src/gzw.vue +3 -2
- package/packages/main/src/minxs.js +72 -51
- package/packages/menu/src/menu.vue +4 -4
- package/packages/select/src/select.vue +5 -0
- package/packages/selector/src/selector.vue +147 -17
- package/packages/theme-chalk/src/base.scss +6 -0
- package/packages/theme-chalk/src/checkbox-group.scss +1 -0
- package/packages/theme-chalk/src/common/var.scss +1 -1
- package/packages/theme-chalk/src/flow.scss +7 -4
- package/packages/theme-chalk/src/flows.scss +141 -0
- package/packages/theme-chalk/src/form.scss +1 -1
- package/packages/theme-chalk/src/index.scss +1 -0
- package/packages/theme-chalk/src/input.scss +1 -0
- package/packages/theme-chalk/src/lowcode.scss +21 -18
- package/packages/theme-chalk/src/select.scss +3 -1
- package/packages/theme-chalk/src/selector.scss +11 -5
- package/src/index.js +4 -1
- package/src/utils/resize-event.js +21 -7
- package/packages/flow/src/component/quick-actions.vue +0 -1168
- package/packages/flow-copy/index.js +0 -7
- package/packages/flow-copy/src/component/Circulate.vue +0 -452
- package/packages/flow-copy/src/component/CustomPreset.vue +0 -333
- package/packages/flow-copy/src/component/FreeCirculation.vue +0 -275
- package/packages/flow-copy/src/component/Preset.vue +0 -273
- package/packages/flow-copy/src/component/SendMsg.vue +0 -290
- package/packages/flow-copy/src/component/TimeLimit.vue +0 -205
- package/packages/flow-copy/src/component/taskUnionExamine.vue +0 -818
- package/packages/flow-copy/src/freeStartFlow.vue +0 -2912
- package/packages/flow-copy/src/processForm.vue +0 -1411
- package/packages/flow-copy/src/processReject.vue +0 -319
- package/packages/flow-copy/src/reset.vue +0 -944
- package/packages/flow-copy/src/selectUser.vue +0 -513
- package/packages/flow-copy/src/startTaskRead.vue +0 -723
- package/packages/flow-copy/src/supervise.vue +0 -182
- package/packages/flow-copy/src/table.vue +0 -65
- /package/packages/{flow-copy → flow}/src/component/FileList.vue +0 -0
- /package/packages/{flow-copy → flow}/src/main.vue +0 -0
- /package/packages/{flow-copy/src → flows/src/components}/form.vue +0 -0
- /package/packages/{flow/src/component → flows/src/components}/message.vue +0 -0
- /package/packages/{flow/src/component → flows/src/components}/opinions-list.vue +0 -0
package/lib/menu.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 175);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -191,7 +191,7 @@ module.exports =
|
|
|
191
191
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return warning; });
|
|
192
192
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
193
193
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
194
|
-
/* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
194
|
+
/* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
|
|
195
195
|
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
|
|
196
196
|
/* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
|
|
197
197
|
/* harmony import */ var _date__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
|
|
@@ -2143,7 +2143,7 @@ var loadJs = function loadJs(url, callback) {
|
|
|
2143
2143
|
var loading = function loading() {
|
|
2144
2144
|
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '请求中...';
|
|
2145
2145
|
|
|
2146
|
-
var Loading = __webpack_require__(
|
|
2146
|
+
var Loading = __webpack_require__(18).default;
|
|
2147
2147
|
return Loading.service({
|
|
2148
2148
|
text: text,
|
|
2149
2149
|
spinner: 'es-icon-jiazai',
|
|
@@ -4040,14 +4040,215 @@ function _broadcast(componentName, eventName, params) {
|
|
|
4040
4040
|
/***/ 12:
|
|
4041
4041
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4042
4042
|
|
|
4043
|
+
"use strict";
|
|
4044
|
+
/* unused harmony export getHue */
|
|
4045
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getColor; });
|
|
4046
|
+
/* unused harmony export getLightness */
|
|
4047
|
+
/* unused harmony export getSaturation */
|
|
4048
|
+
/* unused harmony export rgbToHsv */
|
|
4049
|
+
/* unused harmony export hsvTorgb */
|
|
4050
|
+
/* unused harmony export mixColor */
|
|
4051
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getRgb; });
|
|
4052
|
+
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
4053
|
+
|
|
4054
|
+
var $hueStep = 2;
|
|
4055
|
+
var $saturationStep1 = 0.16;
|
|
4056
|
+
var $saturationStep2 = 0.05;
|
|
4057
|
+
var $brightnessStep1 = 0.05;
|
|
4058
|
+
var $brightnessStep2 = 0.15;
|
|
4059
|
+
var $lightColorCount = 5;
|
|
4060
|
+
var $darkColorCount = 4;
|
|
4061
|
+
/**
|
|
4062
|
+
* getHue
|
|
4063
|
+
* @desc:转换色相
|
|
4064
|
+
* @author huangbo
|
|
4065
|
+
* @date 2022年5月7日
|
|
4066
|
+
**/
|
|
4067
|
+
var getHue = function getHue($h, $i, $isLight) {
|
|
4068
|
+
var $hue = void 0;
|
|
4069
|
+
if ($h >= 60 && $h <= 240) {
|
|
4070
|
+
$hue = $isLight ? $h - $hueStep * $i : $h + $hueStep * $i;
|
|
4071
|
+
} else {
|
|
4072
|
+
$hue = $isLight ? $h + $hueStep * $i : $h - $hueStep * $i;
|
|
4073
|
+
}
|
|
4074
|
+
$hue = ($hue + 360) % 360;
|
|
4075
|
+
return Math.round($hue);
|
|
4076
|
+
};
|
|
4077
|
+
|
|
4078
|
+
/**
|
|
4079
|
+
* getColor
|
|
4080
|
+
* @desc:根据颜色和对应的色板位置,计算出对应的色板颜色
|
|
4081
|
+
* @author huangbo
|
|
4082
|
+
* @date 2022年5月7日
|
|
4083
|
+
**/
|
|
4084
|
+
var getColor = function getColor($color, $n) {
|
|
4085
|
+
var $isLight = $n < 7;
|
|
4086
|
+
var $hsv = rgbToHsv($color);
|
|
4087
|
+
// 这里将i转换成以主色为中心,两侧的i值逐渐增大
|
|
4088
|
+
var $i = $isLight ? $lightColorCount + 1 - $n : $n - $lightColorCount - 1;
|
|
4089
|
+
var color = hsvTorgb(getHue($hsv[0], $i, $isLight), getSaturation($hsv[1], $i, $isLight), getLightness($hsv[2], $i, $isLight));
|
|
4090
|
+
return color;
|
|
4091
|
+
};
|
|
4092
|
+
|
|
4093
|
+
/**
|
|
4094
|
+
* getLightness
|
|
4095
|
+
* @desc:转换明度
|
|
4096
|
+
* @author huangbo
|
|
4097
|
+
* @date 2022年5月7日
|
|
4098
|
+
* @return {string,array} 元素类名或者id
|
|
4099
|
+
**/
|
|
4100
|
+
var getLightness = function getLightness($v, $i, $isLight) {
|
|
4101
|
+
var $value = $isLight ? $v + $brightnessStep1 * $i : $v - $brightnessStep2 * $i;
|
|
4102
|
+
$value = $value < 1 ? $value : 1;
|
|
4103
|
+
return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($value, 2);
|
|
4104
|
+
};
|
|
4105
|
+
|
|
4106
|
+
/**
|
|
4107
|
+
* getSaturation
|
|
4108
|
+
* @desc:转换饱和度
|
|
4109
|
+
* @author huangbo
|
|
4110
|
+
* @date 2022年5月7日
|
|
4111
|
+
**/
|
|
4112
|
+
var getSaturation = function getSaturation($s, $i, $isLight) {
|
|
4113
|
+
var $saturation = void 0;
|
|
4114
|
+
if ($isLight) {
|
|
4115
|
+
$saturation = $s - $saturationStep1 * $i;
|
|
4116
|
+
} else if ($i === $darkColorCount) {
|
|
4117
|
+
$saturation = $s + $saturationStep1;
|
|
4118
|
+
} else {
|
|
4119
|
+
$saturation = $s + $saturationStep2 * $i;
|
|
4120
|
+
}
|
|
4121
|
+
$saturation = $saturation < 1 ? $saturation : 1;
|
|
4122
|
+
|
|
4123
|
+
if ($isLight && $i === $lightColorCount && $saturation > 0.1) {
|
|
4124
|
+
$saturation = 0.1;
|
|
4125
|
+
}
|
|
4126
|
+
$saturation = $saturation > 0.06 ? $saturation : 0.06;
|
|
4127
|
+
return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($saturation, 2);
|
|
4128
|
+
};
|
|
4129
|
+
|
|
4130
|
+
/**
|
|
4131
|
+
* rgbToHsv
|
|
4132
|
+
* @desc:rgb转化成hsv
|
|
4133
|
+
* @author huangbo
|
|
4134
|
+
* @date 2022年5月7日
|
|
4135
|
+
* @param {string} [$color] - 颜色值
|
|
4136
|
+
**/
|
|
4137
|
+
var rgbToHsv = function rgbToHsv($color) {
|
|
4138
|
+
var rgb = getRgb($color);
|
|
4139
|
+
var $red = rgb[0];
|
|
4140
|
+
var $green = rgb[1];
|
|
4141
|
+
var $blue = rgb[2];
|
|
4142
|
+
var $max = Math.max($red, $green, $blue);
|
|
4143
|
+
var $min = Math.min($red, $green, $blue);
|
|
4144
|
+
var $diff = $max - $min;
|
|
4145
|
+
var $h = 0;
|
|
4146
|
+
if ($max === $min) {
|
|
4147
|
+
$h = 0;
|
|
4148
|
+
} else if ($max === $red) {
|
|
4149
|
+
$h = 60 * ($green - $blue) / $diff + ($green > $blue - 1 ? 0 : 360);
|
|
4150
|
+
} else if ($max === $green) {
|
|
4151
|
+
$h = 60 * ($blue - $red) / $diff + 120;
|
|
4152
|
+
} else if ($max === $blue) {
|
|
4153
|
+
$h = 60 * ($red - $green) / $diff + 240;
|
|
4154
|
+
}
|
|
4155
|
+
var $s = $max === 0 ? 0 : $diff / $max;
|
|
4156
|
+
var $v = $max / 255;
|
|
4157
|
+
return [$h, $s, $v];
|
|
4158
|
+
};
|
|
4159
|
+
|
|
4160
|
+
/**
|
|
4161
|
+
* hsvTorgb
|
|
4162
|
+
* @desc:hsv转化成rgb
|
|
4163
|
+
* @author huangbo
|
|
4164
|
+
* @date 2022年5月7日
|
|
4165
|
+
* @param {string} [$color] - 颜色值
|
|
4166
|
+
**/
|
|
4167
|
+
var hsvTorgb = function hsvTorgb($h, $s, $v) {
|
|
4168
|
+
var $th = Math.floor($h / 60);
|
|
4169
|
+
var $t1 = $h / 60 - $th;
|
|
4170
|
+
var $t2 = $v * (1 - $s);
|
|
4171
|
+
var $t3 = $v * (1 - $t1 * $s);
|
|
4172
|
+
var $t4 = $v * (1 - (1 - $t1) * $s);
|
|
4173
|
+
var $r = [$v, $t3, $t2, $t2, $t4, $v][$th % 6];
|
|
4174
|
+
var $g = [$t4, $v, $v, $t3, $t2, $t2][$th % 6];
|
|
4175
|
+
var $b = [$t2, $t2, $t4, $v, $v, $t3][$th % 6];
|
|
4176
|
+
// return `rgb(${Math.round($r * 255)}, ${Math.round($g * 255)}, ${Math.round($b * 255)})`;
|
|
4177
|
+
var red = Math.round($r * 255);
|
|
4178
|
+
var green = Math.round($g * 255);
|
|
4179
|
+
var blue = Math.round($b * 255);
|
|
4180
|
+
red = red.toString(16);
|
|
4181
|
+
green = green.toString(16);
|
|
4182
|
+
blue = blue.toString(16);
|
|
4183
|
+
red = red.length === 1 ? '0' + red : red;
|
|
4184
|
+
green = green.length === 1 ? '0' + green : green;
|
|
4185
|
+
blue = blue.length === 1 ? '0' + blue : blue;
|
|
4186
|
+
return '#' + red + green + blue;
|
|
4187
|
+
};
|
|
4188
|
+
|
|
4189
|
+
/**
|
|
4190
|
+
* mixColor
|
|
4191
|
+
* @desc:生成混合色
|
|
4192
|
+
* @author huangbo
|
|
4193
|
+
* @date 2022年5月7日
|
|
4194
|
+
* @param {string} [$color1] - 颜色值
|
|
4195
|
+
* @param {string} [$color2] - 颜色值
|
|
4196
|
+
* @param {string} [$n] - 百分比 0~1
|
|
4197
|
+
**/
|
|
4198
|
+
var mixColor = function mixColor($color1, $color2, $n) {
|
|
4199
|
+
var rgb1 = getRgb($color1);
|
|
4200
|
+
var rgb2 = getRgb($color2);
|
|
4201
|
+
var r = rgb1[0] * $n + rgb2[0] * (1 - $n);
|
|
4202
|
+
var g = rgb1[1] * $n + rgb2[1] * (1 - $n);
|
|
4203
|
+
var b = rgb1[2] * $n + rgb2[2] * (1 - $n);
|
|
4204
|
+
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
4205
|
+
};
|
|
4206
|
+
|
|
4207
|
+
/**
|
|
4208
|
+
* getRgb
|
|
4209
|
+
* @desc:获取颜色值的rgb值
|
|
4210
|
+
* @author huangbo
|
|
4211
|
+
* @date 2022年5月7日
|
|
4212
|
+
* @param {string} [$color] - 颜色值
|
|
4213
|
+
**/
|
|
4214
|
+
var getRgb = function getRgb($color) {
|
|
4215
|
+
var rgb = [];
|
|
4216
|
+
// 16进制颜色值的正则
|
|
4217
|
+
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
4218
|
+
// 把颜色值变成小写
|
|
4219
|
+
$color = $color.toLowerCase();
|
|
4220
|
+
if (reg.test($color)) {
|
|
4221
|
+
// 如果只有三位的值,需变成六位,如:#fff => #ffffff
|
|
4222
|
+
if ($color.length === 4) {
|
|
4223
|
+
var colorNew = '#';
|
|
4224
|
+
for (var i = 1; i < 4; i++) {
|
|
4225
|
+
colorNew += $color.slice(i, i + 1).concat($color.slice(i, i + 1));
|
|
4226
|
+
}
|
|
4227
|
+
$color = colorNew;
|
|
4228
|
+
}
|
|
4229
|
+
// 处理六位的颜色值,转为RGB
|
|
4230
|
+
for (var _i = 1; _i < 7; _i += 2) {
|
|
4231
|
+
rgb.push(parseInt('0x' + $color.slice(_i, _i + 2), 16));
|
|
4232
|
+
}
|
|
4233
|
+
} else {
|
|
4234
|
+
rgb = $color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
|
|
4235
|
+
}
|
|
4236
|
+
return rgb;
|
|
4237
|
+
};
|
|
4238
|
+
|
|
4239
|
+
/***/ }),
|
|
4240
|
+
|
|
4241
|
+
/***/ 13:
|
|
4242
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4243
|
+
|
|
4043
4244
|
"use strict";
|
|
4044
4245
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
4045
4246
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
4046
|
-
/* harmony import */ var eoss_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
4247
|
+
/* harmony import */ var eoss_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26);
|
|
4047
4248
|
|
|
4048
4249
|
|
|
4049
4250
|
|
|
4050
|
-
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(
|
|
4251
|
+
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(42);
|
|
4051
4252
|
var stopPropagation = function stopPropagation(e) {
|
|
4052
4253
|
return e.stopPropagation();
|
|
4053
4254
|
};
|
|
@@ -4308,224 +4509,16 @@ var stopPropagation = function stopPropagation(e) {
|
|
|
4308
4509
|
|
|
4309
4510
|
/***/ }),
|
|
4310
4511
|
|
|
4311
|
-
/***/
|
|
4512
|
+
/***/ 14:
|
|
4312
4513
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4313
4514
|
|
|
4314
4515
|
"use strict";
|
|
4315
|
-
/*
|
|
4316
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "
|
|
4317
|
-
/*
|
|
4318
|
-
/*
|
|
4319
|
-
/*
|
|
4320
|
-
/*
|
|
4321
|
-
/* unused harmony export mixColor */
|
|
4322
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getRgb; });
|
|
4323
|
-
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
4324
|
-
|
|
4325
|
-
var $hueStep = 2;
|
|
4326
|
-
var $saturationStep1 = 0.16;
|
|
4327
|
-
var $saturationStep2 = 0.05;
|
|
4328
|
-
var $brightnessStep1 = 0.05;
|
|
4329
|
-
var $brightnessStep2 = 0.15;
|
|
4330
|
-
var $lightColorCount = 5;
|
|
4331
|
-
var $darkColorCount = 4;
|
|
4332
|
-
/**
|
|
4333
|
-
* getHue
|
|
4334
|
-
* @desc:转换色相
|
|
4335
|
-
* @author huangbo
|
|
4336
|
-
* @date 2022年5月7日
|
|
4337
|
-
**/
|
|
4338
|
-
var getHue = function getHue($h, $i, $isLight) {
|
|
4339
|
-
var $hue = void 0;
|
|
4340
|
-
if ($h >= 60 && $h <= 240) {
|
|
4341
|
-
$hue = $isLight ? $h - $hueStep * $i : $h + $hueStep * $i;
|
|
4342
|
-
} else {
|
|
4343
|
-
$hue = $isLight ? $h + $hueStep * $i : $h - $hueStep * $i;
|
|
4344
|
-
}
|
|
4345
|
-
$hue = ($hue + 360) % 360;
|
|
4346
|
-
return Math.round($hue);
|
|
4347
|
-
};
|
|
4348
|
-
|
|
4349
|
-
/**
|
|
4350
|
-
* getColor
|
|
4351
|
-
* @desc:根据颜色和对应的色板位置,计算出对应的色板颜色
|
|
4352
|
-
* @author huangbo
|
|
4353
|
-
* @date 2022年5月7日
|
|
4354
|
-
**/
|
|
4355
|
-
var getColor = function getColor($color, $n) {
|
|
4356
|
-
var $isLight = $n < 7;
|
|
4357
|
-
var $hsv = rgbToHsv($color);
|
|
4358
|
-
// 这里将i转换成以主色为中心,两侧的i值逐渐增大
|
|
4359
|
-
var $i = $isLight ? $lightColorCount + 1 - $n : $n - $lightColorCount - 1;
|
|
4360
|
-
var color = hsvTorgb(getHue($hsv[0], $i, $isLight), getSaturation($hsv[1], $i, $isLight), getLightness($hsv[2], $i, $isLight));
|
|
4361
|
-
return color;
|
|
4362
|
-
};
|
|
4363
|
-
|
|
4364
|
-
/**
|
|
4365
|
-
* getLightness
|
|
4366
|
-
* @desc:转换明度
|
|
4367
|
-
* @author huangbo
|
|
4368
|
-
* @date 2022年5月7日
|
|
4369
|
-
* @return {string,array} 元素类名或者id
|
|
4370
|
-
**/
|
|
4371
|
-
var getLightness = function getLightness($v, $i, $isLight) {
|
|
4372
|
-
var $value = $isLight ? $v + $brightnessStep1 * $i : $v - $brightnessStep2 * $i;
|
|
4373
|
-
$value = $value < 1 ? $value : 1;
|
|
4374
|
-
return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($value, 2);
|
|
4375
|
-
};
|
|
4376
|
-
|
|
4377
|
-
/**
|
|
4378
|
-
* getSaturation
|
|
4379
|
-
* @desc:转换饱和度
|
|
4380
|
-
* @author huangbo
|
|
4381
|
-
* @date 2022年5月7日
|
|
4382
|
-
**/
|
|
4383
|
-
var getSaturation = function getSaturation($s, $i, $isLight) {
|
|
4384
|
-
var $saturation = void 0;
|
|
4385
|
-
if ($isLight) {
|
|
4386
|
-
$saturation = $s - $saturationStep1 * $i;
|
|
4387
|
-
} else if ($i === $darkColorCount) {
|
|
4388
|
-
$saturation = $s + $saturationStep1;
|
|
4389
|
-
} else {
|
|
4390
|
-
$saturation = $s + $saturationStep2 * $i;
|
|
4391
|
-
}
|
|
4392
|
-
$saturation = $saturation < 1 ? $saturation : 1;
|
|
4393
|
-
|
|
4394
|
-
if ($isLight && $i === $lightColorCount && $saturation > 0.1) {
|
|
4395
|
-
$saturation = 0.1;
|
|
4396
|
-
}
|
|
4397
|
-
$saturation = $saturation > 0.06 ? $saturation : 0.06;
|
|
4398
|
-
return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($saturation, 2);
|
|
4399
|
-
};
|
|
4400
|
-
|
|
4401
|
-
/**
|
|
4402
|
-
* rgbToHsv
|
|
4403
|
-
* @desc:rgb转化成hsv
|
|
4404
|
-
* @author huangbo
|
|
4405
|
-
* @date 2022年5月7日
|
|
4406
|
-
* @param {string} [$color] - 颜色值
|
|
4407
|
-
**/
|
|
4408
|
-
var rgbToHsv = function rgbToHsv($color) {
|
|
4409
|
-
var rgb = getRgb($color);
|
|
4410
|
-
var $red = rgb[0];
|
|
4411
|
-
var $green = rgb[1];
|
|
4412
|
-
var $blue = rgb[2];
|
|
4413
|
-
var $max = Math.max($red, $green, $blue);
|
|
4414
|
-
var $min = Math.min($red, $green, $blue);
|
|
4415
|
-
var $diff = $max - $min;
|
|
4416
|
-
var $h = 0;
|
|
4417
|
-
if ($max === $min) {
|
|
4418
|
-
$h = 0;
|
|
4419
|
-
} else if ($max === $red) {
|
|
4420
|
-
$h = 60 * ($green - $blue) / $diff + ($green > $blue - 1 ? 0 : 360);
|
|
4421
|
-
} else if ($max === $green) {
|
|
4422
|
-
$h = 60 * ($blue - $red) / $diff + 120;
|
|
4423
|
-
} else if ($max === $blue) {
|
|
4424
|
-
$h = 60 * ($red - $green) / $diff + 240;
|
|
4425
|
-
}
|
|
4426
|
-
var $s = $max === 0 ? 0 : $diff / $max;
|
|
4427
|
-
var $v = $max / 255;
|
|
4428
|
-
return [$h, $s, $v];
|
|
4429
|
-
};
|
|
4430
|
-
|
|
4431
|
-
/**
|
|
4432
|
-
* hsvTorgb
|
|
4433
|
-
* @desc:hsv转化成rgb
|
|
4434
|
-
* @author huangbo
|
|
4435
|
-
* @date 2022年5月7日
|
|
4436
|
-
* @param {string} [$color] - 颜色值
|
|
4437
|
-
**/
|
|
4438
|
-
var hsvTorgb = function hsvTorgb($h, $s, $v) {
|
|
4439
|
-
var $th = Math.floor($h / 60);
|
|
4440
|
-
var $t1 = $h / 60 - $th;
|
|
4441
|
-
var $t2 = $v * (1 - $s);
|
|
4442
|
-
var $t3 = $v * (1 - $t1 * $s);
|
|
4443
|
-
var $t4 = $v * (1 - (1 - $t1) * $s);
|
|
4444
|
-
var $r = [$v, $t3, $t2, $t2, $t4, $v][$th % 6];
|
|
4445
|
-
var $g = [$t4, $v, $v, $t3, $t2, $t2][$th % 6];
|
|
4446
|
-
var $b = [$t2, $t2, $t4, $v, $v, $t3][$th % 6];
|
|
4447
|
-
// return `rgb(${Math.round($r * 255)}, ${Math.round($g * 255)}, ${Math.round($b * 255)})`;
|
|
4448
|
-
var red = Math.round($r * 255);
|
|
4449
|
-
var green = Math.round($g * 255);
|
|
4450
|
-
var blue = Math.round($b * 255);
|
|
4451
|
-
red = red.toString(16);
|
|
4452
|
-
green = green.toString(16);
|
|
4453
|
-
blue = blue.toString(16);
|
|
4454
|
-
red = red.length === 1 ? '0' + red : red;
|
|
4455
|
-
green = green.length === 1 ? '0' + green : green;
|
|
4456
|
-
blue = blue.length === 1 ? '0' + blue : blue;
|
|
4457
|
-
return '#' + red + green + blue;
|
|
4458
|
-
};
|
|
4459
|
-
|
|
4460
|
-
/**
|
|
4461
|
-
* mixColor
|
|
4462
|
-
* @desc:生成混合色
|
|
4463
|
-
* @author huangbo
|
|
4464
|
-
* @date 2022年5月7日
|
|
4465
|
-
* @param {string} [$color1] - 颜色值
|
|
4466
|
-
* @param {string} [$color2] - 颜色值
|
|
4467
|
-
* @param {string} [$n] - 百分比 0~1
|
|
4468
|
-
**/
|
|
4469
|
-
var mixColor = function mixColor($color1, $color2, $n) {
|
|
4470
|
-
var rgb1 = getRgb($color1);
|
|
4471
|
-
var rgb2 = getRgb($color2);
|
|
4472
|
-
var r = rgb1[0] * $n + rgb2[0] * (1 - $n);
|
|
4473
|
-
var g = rgb1[1] * $n + rgb2[1] * (1 - $n);
|
|
4474
|
-
var b = rgb1[2] * $n + rgb2[2] * (1 - $n);
|
|
4475
|
-
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
4476
|
-
};
|
|
4477
|
-
|
|
4478
|
-
/**
|
|
4479
|
-
* getRgb
|
|
4480
|
-
* @desc:获取颜色值的rgb值
|
|
4481
|
-
* @author huangbo
|
|
4482
|
-
* @date 2022年5月7日
|
|
4483
|
-
* @param {string} [$color] - 颜色值
|
|
4484
|
-
**/
|
|
4485
|
-
var getRgb = function getRgb($color) {
|
|
4486
|
-
var rgb = [];
|
|
4487
|
-
// 16进制颜色值的正则
|
|
4488
|
-
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
4489
|
-
// 把颜色值变成小写
|
|
4490
|
-
$color = $color.toLowerCase();
|
|
4491
|
-
if (reg.test($color)) {
|
|
4492
|
-
// 如果只有三位的值,需变成六位,如:#fff => #ffffff
|
|
4493
|
-
if ($color.length === 4) {
|
|
4494
|
-
var colorNew = '#';
|
|
4495
|
-
for (var i = 1; i < 4; i++) {
|
|
4496
|
-
colorNew += $color.slice(i, i + 1).concat($color.slice(i, i + 1));
|
|
4497
|
-
}
|
|
4498
|
-
$color = colorNew;
|
|
4499
|
-
}
|
|
4500
|
-
// 处理六位的颜色值,转为RGB
|
|
4501
|
-
for (var _i = 1; _i < 7; _i += 2) {
|
|
4502
|
-
rgb.push(parseInt('0x' + $color.slice(_i, _i + 2), 16));
|
|
4503
|
-
}
|
|
4504
|
-
} else {
|
|
4505
|
-
rgb = $color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
|
|
4506
|
-
}
|
|
4507
|
-
return rgb;
|
|
4508
|
-
};
|
|
4509
|
-
|
|
4510
|
-
/***/ }),
|
|
4511
|
-
|
|
4512
|
-
/***/ 14:
|
|
4513
|
-
/***/ (function(module, exports) {
|
|
4514
|
-
|
|
4515
|
-
module.exports = require("throttle-debounce");
|
|
4516
|
-
|
|
4517
|
-
/***/ }),
|
|
4518
|
-
|
|
4519
|
-
/***/ 15:
|
|
4520
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4521
|
-
|
|
4522
|
-
"use strict";
|
|
4523
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollbarWidth; });
|
|
4524
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return scrollIntoView; });
|
|
4525
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getScrollSize; });
|
|
4526
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return scrollMove; });
|
|
4527
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
4528
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
4516
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollbarWidth; });
|
|
4517
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return scrollIntoView; });
|
|
4518
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getScrollSize; });
|
|
4519
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return scrollMove; });
|
|
4520
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
4521
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
4529
4522
|
|
|
4530
4523
|
|
|
4531
4524
|
/**
|
|
@@ -4661,6 +4654,13 @@ function scrollMove(wrap) {
|
|
|
4661
4654
|
|
|
4662
4655
|
/***/ }),
|
|
4663
4656
|
|
|
4657
|
+
/***/ 15:
|
|
4658
|
+
/***/ (function(module, exports) {
|
|
4659
|
+
|
|
4660
|
+
module.exports = require("throttle-debounce");
|
|
4661
|
+
|
|
4662
|
+
/***/ }),
|
|
4663
|
+
|
|
4664
4664
|
/***/ 16:
|
|
4665
4665
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4666
4666
|
|
|
@@ -4683,15 +4683,15 @@ function scrollMove(wrap) {
|
|
|
4683
4683
|
|
|
4684
4684
|
/***/ }),
|
|
4685
4685
|
|
|
4686
|
-
/***/
|
|
4686
|
+
/***/ 175:
|
|
4687
4687
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4688
4688
|
|
|
4689
4689
|
"use strict";
|
|
4690
4690
|
// ESM COMPAT FLAG
|
|
4691
4691
|
__webpack_require__.r(__webpack_exports__);
|
|
4692
4692
|
|
|
4693
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/menu.vue?vue&type=template&id=
|
|
4694
|
-
var
|
|
4693
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/menu.vue?vue&type=template&id=f189ecf2&
|
|
4694
|
+
var menuvue_type_template_id_f189ecf2_render = function () {
|
|
4695
4695
|
var _vm = this
|
|
4696
4696
|
var _h = _vm.$createElement
|
|
4697
4697
|
var _c = _vm._self._c || _h
|
|
@@ -4786,10 +4786,10 @@ var menuvue_type_template_id_9d8db1ce_render = function () {
|
|
|
4786
4786
|
)
|
|
4787
4787
|
}
|
|
4788
4788
|
var staticRenderFns = []
|
|
4789
|
-
|
|
4789
|
+
menuvue_type_template_id_f189ecf2_render._withStripped = true
|
|
4790
4790
|
|
|
4791
4791
|
|
|
4792
|
-
// CONCATENATED MODULE: ./packages/menu/src/menu.vue?vue&type=template&id=
|
|
4792
|
+
// CONCATENATED MODULE: ./packages/menu/src/menu.vue?vue&type=template&id=f189ecf2&
|
|
4793
4793
|
|
|
4794
4794
|
// EXTERNAL MODULE: ./packages/menu/src/mixins.js
|
|
4795
4795
|
var mixins = __webpack_require__(80);
|
|
@@ -4801,7 +4801,7 @@ var submenu = __webpack_require__(91);
|
|
|
4801
4801
|
var menu_item = __webpack_require__(57);
|
|
4802
4802
|
|
|
4803
4803
|
// EXTERNAL MODULE: ./src/components/bar.js
|
|
4804
|
-
var bar = __webpack_require__(
|
|
4804
|
+
var bar = __webpack_require__(38);
|
|
4805
4805
|
|
|
4806
4806
|
// EXTERNAL MODULE: ./packages/menu/src/menu-item-group.vue + 4 modules
|
|
4807
4807
|
var menu_item_group = __webpack_require__(82);
|
|
@@ -4813,7 +4813,7 @@ var emitter = __webpack_require__(10);
|
|
|
4813
4813
|
var migrating = __webpack_require__(27);
|
|
4814
4814
|
|
|
4815
4815
|
// EXTERNAL MODULE: ./src/utils/aria-utils.js
|
|
4816
|
-
var aria_utils = __webpack_require__(
|
|
4816
|
+
var aria_utils = __webpack_require__(43);
|
|
4817
4817
|
|
|
4818
4818
|
// CONCATENATED MODULE: ./src/utils/menu/aria-submenu.js
|
|
4819
4819
|
|
|
@@ -4950,10 +4950,10 @@ Menu.prototype.init = function () {
|
|
|
4950
4950
|
var dom = __webpack_require__(5);
|
|
4951
4951
|
|
|
4952
4952
|
// EXTERNAL MODULE: ./src/utils/scrollbar.js
|
|
4953
|
-
var scrollbar = __webpack_require__(
|
|
4953
|
+
var scrollbar = __webpack_require__(14);
|
|
4954
4954
|
|
|
4955
4955
|
// EXTERNAL MODULE: external "throttle-debounce"
|
|
4956
|
-
var external_throttle_debounce_ = __webpack_require__(
|
|
4956
|
+
var external_throttle_debounce_ = __webpack_require__(15);
|
|
4957
4957
|
|
|
4958
4958
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/menu.vue?vue&type=script&lang=js&
|
|
4959
4959
|
//
|
|
@@ -5376,11 +5376,6 @@ var external_throttle_debounce_ = __webpack_require__(14);
|
|
|
5376
5376
|
},
|
|
5377
5377
|
|
|
5378
5378
|
methods: {
|
|
5379
|
-
// 处理滚轮事件,阻止冒泡
|
|
5380
|
-
handleWheel: function handleWheel(e) {
|
|
5381
|
-
this.barSize && e.stopPropagation();
|
|
5382
|
-
},
|
|
5383
|
-
|
|
5384
5379
|
// 更新选中项索引
|
|
5385
5380
|
updateActiveIndex: function updateActiveIndex(val) {
|
|
5386
5381
|
var item = this.items[val] || this.items[this.activeIndex] || this.items[this.defaultActive];
|
|
@@ -5411,6 +5406,11 @@ var external_throttle_debounce_ = __webpack_require__(14);
|
|
|
5411
5406
|
};
|
|
5412
5407
|
},
|
|
5413
5408
|
|
|
5409
|
+
// 处理滚轮事件,阻止冒泡
|
|
5410
|
+
handleWheel: function handleWheel(e) {
|
|
5411
|
+
this.barSize && e.stopPropagation();
|
|
5412
|
+
},
|
|
5413
|
+
|
|
5414
5414
|
// 处理滚动事件
|
|
5415
5415
|
handleScroll: function handleScroll() {
|
|
5416
5416
|
var _scrollMove = Object(scrollbar["d" /* scrollMove */])(this.$refs.menuContainer),
|
|
@@ -5633,7 +5633,7 @@ var componentNormalizer = __webpack_require__(3);
|
|
|
5633
5633
|
|
|
5634
5634
|
var component = Object(componentNormalizer["a" /* default */])(
|
|
5635
5635
|
src_menuvue_type_script_lang_js_,
|
|
5636
|
-
|
|
5636
|
+
menuvue_type_template_id_f189ecf2_render,
|
|
5637
5637
|
staticRenderFns,
|
|
5638
5638
|
false,
|
|
5639
5639
|
null,
|
|
@@ -5655,7 +5655,7 @@ menu.install = function (Vue) {
|
|
|
5655
5655
|
|
|
5656
5656
|
/***/ }),
|
|
5657
5657
|
|
|
5658
|
-
/***/
|
|
5658
|
+
/***/ 18:
|
|
5659
5659
|
/***/ (function(module, exports) {
|
|
5660
5660
|
|
|
5661
5661
|
module.exports = require("eoss/lib/loading");
|
|
@@ -5921,7 +5921,7 @@ module.exports = require("lodash/cloneDeep");
|
|
|
5921
5921
|
|
|
5922
5922
|
/***/ }),
|
|
5923
5923
|
|
|
5924
|
-
/***/
|
|
5924
|
+
/***/ 26:
|
|
5925
5925
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5926
5926
|
|
|
5927
5927
|
"use strict";
|
|
@@ -6146,7 +6146,7 @@ if (!external_vue_default.a.prototype.$isServer) {
|
|
|
6146
6146
|
|
|
6147
6147
|
/* harmony default export */ var popup_manager = (PopupManager);
|
|
6148
6148
|
// EXTERNAL MODULE: ./src/utils/scrollbar.js
|
|
6149
|
-
var scrollbar = __webpack_require__(
|
|
6149
|
+
var scrollbar = __webpack_require__(14);
|
|
6150
6150
|
|
|
6151
6151
|
// CONCATENATED MODULE: ./src/utils/popup/index.js
|
|
6152
6152
|
|
|
@@ -6560,1606 +6560,38 @@ module.exports = require("eoss/lib/tooltip");
|
|
|
6560
6560
|
|
|
6561
6561
|
/***/ }),
|
|
6562
6562
|
|
|
6563
|
-
/***/
|
|
6564
|
-
/***/ (function(module,
|
|
6563
|
+
/***/ 38:
|
|
6564
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
6565
6565
|
|
|
6566
|
-
|
|
6566
|
+
"use strict";
|
|
6567
|
+
/* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
|
6568
|
+
/**
|
|
6569
|
+
* 滚动条组件 - 处理表格的垂直和水平滚动条
|
|
6570
|
+
*/
|
|
6567
6571
|
|
|
6568
|
-
/***/ }),
|
|
6569
6572
|
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
6593
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
6594
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
6595
|
-
* SOFTWARE.
|
|
6596
|
-
*/
|
|
6597
|
-
|
|
6598
|
-
//
|
|
6599
|
-
// Cross module loader
|
|
6600
|
-
// Supported: Node, AMD, Browser globals
|
|
6601
|
-
//
|
|
6602
|
-
(function (root, factory) {
|
|
6603
|
-
if (true) {
|
|
6604
|
-
// AMD. Register as an anonymous module.
|
|
6605
|
-
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
6606
|
-
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
6607
|
-
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
6608
|
-
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
6609
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
6610
|
-
} else {}
|
|
6611
|
-
})(this, function () {
|
|
6612
|
-
'use strict';
|
|
6613
|
-
|
|
6614
|
-
var root = window;
|
|
6615
|
-
// default options
|
|
6616
|
-
var DEFAULTS = {
|
|
6617
|
-
// placement of the popper
|
|
6618
|
-
placement: 'bottom',
|
|
6619
|
-
|
|
6620
|
-
gpuAcceleration: true,
|
|
6621
|
-
|
|
6622
|
-
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
6623
|
-
offset: 0,
|
|
6624
|
-
|
|
6625
|
-
// the element which will act as boundary of the popper
|
|
6626
|
-
boundariesElement: 'viewport',
|
|
6627
|
-
|
|
6628
|
-
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
6629
|
-
boundariesPadding: 5,
|
|
6630
|
-
|
|
6631
|
-
// popper will try to prevent overflow following this order,
|
|
6632
|
-
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
6633
|
-
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
6634
|
-
|
|
6635
|
-
// the behavior used by flip to change the placement of the popper
|
|
6636
|
-
flipBehavior: 'flip',
|
|
6637
|
-
|
|
6638
|
-
arrowElement: '[x-arrow]',
|
|
6639
|
-
|
|
6640
|
-
arrowOffset: 0,
|
|
6641
|
-
|
|
6642
|
-
// list of functions used to modify the offsets before they are applied to the popper
|
|
6643
|
-
modifiers: [
|
|
6644
|
-
'shift',
|
|
6645
|
-
'offset',
|
|
6646
|
-
'preventOverflow',
|
|
6647
|
-
'keepTogether',
|
|
6648
|
-
'arrow',
|
|
6649
|
-
'flip',
|
|
6650
|
-
'applyStyle'
|
|
6651
|
-
],
|
|
6652
|
-
|
|
6653
|
-
modifiersIgnored: [],
|
|
6654
|
-
|
|
6655
|
-
forceAbsolute: false
|
|
6656
|
-
};
|
|
6657
|
-
|
|
6658
|
-
/**
|
|
6659
|
-
* Create a new Popper.js instance
|
|
6660
|
-
* @constructor Popper
|
|
6661
|
-
* @param {HTMLElement} reference - The reference element used to position the popper
|
|
6662
|
-
* @param {HTMLElement|Object} popper
|
|
6663
|
-
* The HTML element used as popper, or a configuration used to generate the popper.
|
|
6664
|
-
* @param {String} [popper.tagName='div'] The tag name of the generated popper.
|
|
6665
|
-
* @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
|
|
6666
|
-
* @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
|
|
6667
|
-
* @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
|
|
6668
|
-
* @param {String} [popper.content=''] The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.
|
|
6669
|
-
* @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
|
|
6670
|
-
* @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
|
|
6671
|
-
* @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
|
|
6672
|
-
* @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
|
|
6673
|
-
* @param {Object} options
|
|
6674
|
-
* @param {String} [options.placement=bottom]
|
|
6675
|
-
* Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
|
|
6676
|
-
* left(-start, -end)`
|
|
6677
|
-
*
|
|
6678
|
-
* @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
|
|
6679
|
-
* The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
|
|
6680
|
-
* its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
|
|
6681
|
-
* reference element.
|
|
6682
|
-
* By default, it will look for a child node of the popper with the `x-arrow` attribute.
|
|
6683
|
-
*
|
|
6684
|
-
* @param {Boolean} [options.gpuAcceleration=true]
|
|
6685
|
-
* When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
|
|
6686
|
-
* browser to use the GPU to accelerate the rendering.
|
|
6687
|
-
* If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
|
|
6688
|
-
*
|
|
6689
|
-
* @param {Number} [options.offset=0]
|
|
6690
|
-
* Amount of pixels the popper will be shifted (can be negative).
|
|
6691
|
-
*
|
|
6692
|
-
* @param {String|Element} [options.boundariesElement='viewport']
|
|
6693
|
-
* The element which will define the boundaries of the popper position, the popper will never be placed outside
|
|
6694
|
-
* of the defined boundaries (except if `keepTogether` is enabled)
|
|
6695
|
-
*
|
|
6696
|
-
* @param {Number} [options.boundariesPadding=5]
|
|
6697
|
-
* Additional padding for the boundaries
|
|
6698
|
-
*
|
|
6699
|
-
* @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
|
|
6700
|
-
* Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
|
|
6701
|
-
* this means that the last ones will never overflow
|
|
6702
|
-
*
|
|
6703
|
-
* @param {String|Array} [options.flipBehavior='flip']
|
|
6704
|
-
* The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
|
|
6705
|
-
* overlap its reference element. Defining `flip` as value, the placement will be flipped on
|
|
6706
|
-
* its axis (`right - left`, `top - bottom`).
|
|
6707
|
-
* You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
|
|
6708
|
-
* how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
|
|
6709
|
-
* then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
|
|
6710
|
-
*
|
|
6711
|
-
* @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
|
|
6712
|
-
* List of functions used to modify the data before they are applied to the popper, add your custom functions
|
|
6713
|
-
* to this array to edit the offsets and placement.
|
|
6714
|
-
* The function should reflect the @params and @returns of preventOverflow
|
|
6715
|
-
*
|
|
6716
|
-
* @param {Array} [options.modifiersIgnored=[]]
|
|
6717
|
-
* Put here any built-in modifier name you want to exclude from the modifiers list
|
|
6718
|
-
* The function should reflect the @params and @returns of preventOverflow
|
|
6719
|
-
*
|
|
6720
|
-
* @param {Boolean} [options.removeOnDestroy=false]
|
|
6721
|
-
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
|
|
6722
|
-
*/
|
|
6723
|
-
function Popper(reference, popper, options) {
|
|
6724
|
-
this._reference = reference.jquery ? reference[0] : reference;
|
|
6725
|
-
this.state = {};
|
|
6726
|
-
|
|
6727
|
-
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
6728
|
-
// generate a default popper if is not defined
|
|
6729
|
-
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
6730
|
-
var isConfig =
|
|
6731
|
-
popper && Object.prototype.toString.call(popper) === '[object Object]';
|
|
6732
|
-
if (isNotDefined || isConfig) {
|
|
6733
|
-
this._popper = this.parse(isConfig ? popper : {});
|
|
6734
|
-
}
|
|
6735
|
-
// otherwise, use the given HTMLElement as popper
|
|
6736
|
-
else {
|
|
6737
|
-
this._popper = popper.jquery ? popper[0] : popper;
|
|
6738
|
-
}
|
|
6739
|
-
|
|
6740
|
-
// with {} we create a new object with the options inside it
|
|
6741
|
-
this._options = Object.assign({}, DEFAULTS, options);
|
|
6742
|
-
|
|
6743
|
-
// refactoring modifiers' list
|
|
6744
|
-
this._options.modifiers = this._options.modifiers.map(
|
|
6745
|
-
function (modifier) {
|
|
6746
|
-
// remove ignored modifiers
|
|
6747
|
-
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
|
|
6748
|
-
|
|
6749
|
-
// set the x-placement attribute before everything else because it could be used to add margins to the popper
|
|
6750
|
-
// margins needs to be calculated to get the correct popper offsets
|
|
6751
|
-
if (modifier === 'applyStyle') {
|
|
6752
|
-
this._popper.setAttribute('x-placement', this._options.placement);
|
|
6753
|
-
}
|
|
6754
|
-
|
|
6755
|
-
// return predefined modifier identified by string or keep the custom one
|
|
6756
|
-
return this.modifiers[modifier] || modifier;
|
|
6757
|
-
}.bind(this)
|
|
6758
|
-
);
|
|
6759
|
-
|
|
6760
|
-
// make sure to apply the popper position before any computation
|
|
6761
|
-
this.state.position = this._getPosition(this._popper, this._reference);
|
|
6762
|
-
setStyle(this._popper, { position: this.state.position, top: 0 });
|
|
6763
|
-
|
|
6764
|
-
// fire the first update to position the popper in the right place
|
|
6765
|
-
this.update();
|
|
6766
|
-
|
|
6767
|
-
// setup event listeners, they will take care of update the position in specific situations
|
|
6768
|
-
this._setupEventListeners();
|
|
6769
|
-
return this;
|
|
6770
|
-
}
|
|
6771
|
-
|
|
6772
|
-
//
|
|
6773
|
-
// Methods
|
|
6774
|
-
//
|
|
6775
|
-
/**
|
|
6776
|
-
* Destroy the popper
|
|
6777
|
-
* @method
|
|
6778
|
-
* @memberof Popper
|
|
6779
|
-
*/
|
|
6780
|
-
Popper.prototype.destroy = function () {
|
|
6781
|
-
this._popper.removeAttribute('x-placement');
|
|
6782
|
-
this._popper.style.left = '';
|
|
6783
|
-
this._popper.style.position = '';
|
|
6784
|
-
this._popper.style.top = '';
|
|
6785
|
-
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
6786
|
-
this._removeEventListeners();
|
|
6787
|
-
|
|
6788
|
-
// remove the popper if user explicity asked for the deletion on destroy
|
|
6789
|
-
if (this._options.removeOnDestroy) {
|
|
6790
|
-
this._popper.remove();
|
|
6791
|
-
}
|
|
6792
|
-
return this;
|
|
6793
|
-
};
|
|
6794
|
-
|
|
6795
|
-
/**
|
|
6796
|
-
* Updates the position of the popper, computing the new offsets and applying the new style
|
|
6797
|
-
* @method
|
|
6798
|
-
* @memberof Popper
|
|
6799
|
-
*/
|
|
6800
|
-
Popper.prototype.update = function () {
|
|
6801
|
-
var data = { instance: this, styles: {} };
|
|
6802
|
-
|
|
6803
|
-
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
6804
|
-
// and refer to _originalPlacement to know the original value
|
|
6805
|
-
data.placement = this._options.placement;
|
|
6806
|
-
data._originalPlacement = this._options.placement;
|
|
6807
|
-
|
|
6808
|
-
// compute the popper and reference offsets and put them inside data.offsets
|
|
6809
|
-
data.offsets = this._getOffsets(
|
|
6810
|
-
this._popper,
|
|
6811
|
-
this._reference,
|
|
6812
|
-
data.placement
|
|
6813
|
-
);
|
|
6814
|
-
|
|
6815
|
-
// get boundaries
|
|
6816
|
-
data.boundaries = this._getBoundaries(
|
|
6817
|
-
data,
|
|
6818
|
-
this._options.boundariesPadding,
|
|
6819
|
-
this._options.boundariesElement
|
|
6820
|
-
);
|
|
6821
|
-
|
|
6822
|
-
data = this.runModifiers(data, this._options.modifiers);
|
|
6823
|
-
|
|
6824
|
-
if (typeof this.state.updateCallback === 'function') {
|
|
6825
|
-
this.state.updateCallback(data);
|
|
6826
|
-
}
|
|
6827
|
-
};
|
|
6828
|
-
|
|
6829
|
-
/**
|
|
6830
|
-
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
|
|
6831
|
-
* @method
|
|
6832
|
-
* @memberof Popper
|
|
6833
|
-
* @param {Function} callback
|
|
6834
|
-
*/
|
|
6835
|
-
Popper.prototype.onCreate = function (callback) {
|
|
6836
|
-
// the createCallbacks return as first argument the popper instance
|
|
6837
|
-
callback(this);
|
|
6838
|
-
return this;
|
|
6839
|
-
};
|
|
6840
|
-
|
|
6841
|
-
/**
|
|
6842
|
-
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
|
|
6843
|
-
* used to style popper and its arrow.
|
|
6844
|
-
* NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
|
|
6845
|
-
* @method
|
|
6846
|
-
* @memberof Popper
|
|
6847
|
-
* @param {Function} callback
|
|
6848
|
-
*/
|
|
6849
|
-
Popper.prototype.onUpdate = function (callback) {
|
|
6850
|
-
this.state.updateCallback = callback;
|
|
6851
|
-
return this;
|
|
6852
|
-
};
|
|
6853
|
-
|
|
6854
|
-
/**
|
|
6855
|
-
* Helper used to generate poppers from a configuration file
|
|
6856
|
-
* @method
|
|
6857
|
-
* @memberof Popper
|
|
6858
|
-
* @param config {Object} configuration
|
|
6859
|
-
* @returns {HTMLElement} popper
|
|
6860
|
-
*/
|
|
6861
|
-
Popper.prototype.parse = function (config) {
|
|
6862
|
-
var defaultConfig = {
|
|
6863
|
-
tagName: 'div',
|
|
6864
|
-
classNames: ['popper'],
|
|
6865
|
-
attributes: [],
|
|
6866
|
-
parent: root.document.body,
|
|
6867
|
-
content: '',
|
|
6868
|
-
contentType: 'text',
|
|
6869
|
-
arrowTagName: 'div',
|
|
6870
|
-
arrowClassNames: ['popper__arrow'],
|
|
6871
|
-
arrowAttributes: ['x-arrow']
|
|
6872
|
-
};
|
|
6873
|
-
config = Object.assign({}, defaultConfig, config);
|
|
6874
|
-
|
|
6875
|
-
var d = root.document;
|
|
6876
|
-
|
|
6877
|
-
var popper = d.createElement(config.tagName);
|
|
6878
|
-
addClassNames(popper, config.classNames);
|
|
6879
|
-
addAttributes(popper, config.attributes);
|
|
6880
|
-
if (config.contentType === 'node') {
|
|
6881
|
-
popper.appendChild(
|
|
6882
|
-
config.content.jquery ? config.content[0] : config.content
|
|
6883
|
-
);
|
|
6884
|
-
} else if (config.contentType === 'html') {
|
|
6885
|
-
popper.innerHTML = config.content;
|
|
6886
|
-
} else {
|
|
6887
|
-
popper.textContent = config.content;
|
|
6888
|
-
}
|
|
6889
|
-
|
|
6890
|
-
if (config.arrowTagName) {
|
|
6891
|
-
var arrow = d.createElement(config.arrowTagName);
|
|
6892
|
-
addClassNames(arrow, config.arrowClassNames);
|
|
6893
|
-
addAttributes(arrow, config.arrowAttributes);
|
|
6894
|
-
popper.appendChild(arrow);
|
|
6895
|
-
}
|
|
6896
|
-
|
|
6897
|
-
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
6898
|
-
|
|
6899
|
-
// if the given parent is a string, use it to match an element
|
|
6900
|
-
// if more than one element is matched, the first one will be used as parent
|
|
6901
|
-
// if no elements are matched, the script will throw an error
|
|
6902
|
-
if (typeof parent === 'string') {
|
|
6903
|
-
parent = d.querySelectorAll(config.parent);
|
|
6904
|
-
if (parent.length > 1) {
|
|
6905
|
-
console.warn(
|
|
6906
|
-
'WARNING: the given `parent` query(' +
|
|
6907
|
-
config.parent +
|
|
6908
|
-
') matched more than one element, the first one will be used'
|
|
6909
|
-
);
|
|
6910
|
-
}
|
|
6911
|
-
if (parent.length === 0) {
|
|
6912
|
-
throw "ERROR: the given `parent` doesn't exists!";
|
|
6913
|
-
}
|
|
6914
|
-
parent = parent[0];
|
|
6915
|
-
}
|
|
6916
|
-
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
|
|
6917
|
-
// the first one will be used as parent
|
|
6918
|
-
if (parent.length > 1 && parent instanceof Element === false) {
|
|
6919
|
-
console.warn(
|
|
6920
|
-
'WARNING: you have passed as parent a list of elements, the first one will be used'
|
|
6921
|
-
);
|
|
6922
|
-
parent = parent[0];
|
|
6923
|
-
}
|
|
6924
|
-
|
|
6925
|
-
// append the generated popper to its parent
|
|
6926
|
-
parent.appendChild(popper);
|
|
6927
|
-
|
|
6928
|
-
return popper;
|
|
6929
|
-
|
|
6930
|
-
/**
|
|
6931
|
-
* Adds class names to the given element
|
|
6932
|
-
* @function
|
|
6933
|
-
* @ignore
|
|
6934
|
-
* @param {HTMLElement} target
|
|
6935
|
-
* @param {Array} classes
|
|
6936
|
-
*/
|
|
6937
|
-
function addClassNames(element, classNames) {
|
|
6938
|
-
classNames.forEach(function (className) {
|
|
6939
|
-
element.classList.add(className);
|
|
6940
|
-
});
|
|
6941
|
-
}
|
|
6942
|
-
|
|
6943
|
-
/**
|
|
6944
|
-
* Adds attributes to the given element
|
|
6945
|
-
* @function
|
|
6946
|
-
* @ignore
|
|
6947
|
-
* @param {HTMLElement} target
|
|
6948
|
-
* @param {Array} attributes
|
|
6949
|
-
* @example
|
|
6950
|
-
* addAttributes(element, [ 'data-info:foobar' ]);
|
|
6951
|
-
*/
|
|
6952
|
-
function addAttributes(element, attributes) {
|
|
6953
|
-
attributes.forEach(function (attribute) {
|
|
6954
|
-
element.setAttribute(
|
|
6955
|
-
attribute.split(':')[0],
|
|
6956
|
-
attribute.split(':')[1] || ''
|
|
6957
|
-
);
|
|
6958
|
-
});
|
|
6959
|
-
}
|
|
6960
|
-
};
|
|
6961
|
-
|
|
6962
|
-
/**
|
|
6963
|
-
* Helper used to get the position which will be applied to the popper
|
|
6964
|
-
* @method
|
|
6965
|
-
* @memberof Popper
|
|
6966
|
-
* @param config {HTMLElement} popper element
|
|
6967
|
-
* @param reference {HTMLElement} reference element
|
|
6968
|
-
* @returns {String} position
|
|
6969
|
-
*/
|
|
6970
|
-
Popper.prototype._getPosition = function (popper, reference) {
|
|
6971
|
-
var container = getOffsetParent(reference);
|
|
6972
|
-
|
|
6973
|
-
if (this._options.forceAbsolute) {
|
|
6974
|
-
return 'absolute';
|
|
6975
|
-
}
|
|
6976
|
-
|
|
6977
|
-
// Decide if the popper will be fixed
|
|
6978
|
-
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
6979
|
-
var isParentFixed = isFixed(reference, container);
|
|
6980
|
-
return isParentFixed ? 'fixed' : 'absolute';
|
|
6981
|
-
};
|
|
6982
|
-
|
|
6983
|
-
/**
|
|
6984
|
-
* Get offsets to the popper
|
|
6985
|
-
* @method
|
|
6986
|
-
* @memberof Popper
|
|
6987
|
-
* @access private
|
|
6988
|
-
* @param {Element} popper - the popper element
|
|
6989
|
-
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
6990
|
-
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
6991
|
-
*/
|
|
6992
|
-
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
6993
|
-
placement = placement.split('-')[0];
|
|
6994
|
-
var popperOffsets = {};
|
|
6995
|
-
|
|
6996
|
-
popperOffsets.position = this.state.position;
|
|
6997
|
-
var isParentFixed = popperOffsets.position === 'fixed';
|
|
6998
|
-
|
|
6999
|
-
//
|
|
7000
|
-
// Get reference element position
|
|
7001
|
-
//
|
|
7002
|
-
var referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
7003
|
-
reference,
|
|
7004
|
-
getOffsetParent(popper),
|
|
7005
|
-
isParentFixed
|
|
7006
|
-
);
|
|
7007
|
-
|
|
7008
|
-
//
|
|
7009
|
-
// Get popper sizes
|
|
7010
|
-
//
|
|
7011
|
-
var popperRect = getOuterSizes(popper);
|
|
7012
|
-
|
|
7013
|
-
//
|
|
7014
|
-
// Compute offsets of popper
|
|
7015
|
-
//
|
|
7016
|
-
|
|
7017
|
-
// depending by the popper placement we have to compute its offsets slightly differently
|
|
7018
|
-
if (['right', 'left'].indexOf(placement) !== -1) {
|
|
7019
|
-
popperOffsets.top =
|
|
7020
|
-
referenceOffsets.top +
|
|
7021
|
-
referenceOffsets.height / 2 -
|
|
7022
|
-
popperRect.height / 2;
|
|
7023
|
-
if (placement === 'left') {
|
|
7024
|
-
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
7025
|
-
} else {
|
|
7026
|
-
popperOffsets.left = referenceOffsets.right;
|
|
7027
|
-
}
|
|
7028
|
-
} else {
|
|
7029
|
-
popperOffsets.left =
|
|
7030
|
-
referenceOffsets.left +
|
|
7031
|
-
referenceOffsets.width / 2 -
|
|
7032
|
-
popperRect.width / 2;
|
|
7033
|
-
if (placement === 'top') {
|
|
7034
|
-
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
7035
|
-
} else {
|
|
7036
|
-
popperOffsets.top = referenceOffsets.bottom;
|
|
7037
|
-
}
|
|
7038
|
-
}
|
|
7039
|
-
|
|
7040
|
-
// Add width and height to our offsets object
|
|
7041
|
-
popperOffsets.width = popperRect.width;
|
|
7042
|
-
popperOffsets.height = popperRect.height;
|
|
7043
|
-
|
|
7044
|
-
return {
|
|
7045
|
-
popper: popperOffsets,
|
|
7046
|
-
reference: referenceOffsets
|
|
7047
|
-
};
|
|
7048
|
-
};
|
|
7049
|
-
|
|
7050
|
-
/**
|
|
7051
|
-
* Setup needed event listeners used to update the popper position
|
|
7052
|
-
* @method
|
|
7053
|
-
* @memberof Popper
|
|
7054
|
-
* @access private
|
|
7055
|
-
*/
|
|
7056
|
-
Popper.prototype._setupEventListeners = function () {
|
|
7057
|
-
// NOTE: 1 DOM access here
|
|
7058
|
-
this.state.updateBound = this.update.bind(this);
|
|
7059
|
-
root.addEventListener('resize', this.state.updateBound);
|
|
7060
|
-
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
7061
|
-
if (this._options.boundariesElement !== 'window') {
|
|
7062
|
-
var target = getScrollParent(this._reference);
|
|
7063
|
-
// here it could be both `body` or `documentElement` thanks to Firefox, we then check both
|
|
7064
|
-
if (
|
|
7065
|
-
target === root.document.body ||
|
|
7066
|
-
target === root.document.documentElement
|
|
7067
|
-
) {
|
|
7068
|
-
target = root;
|
|
7069
|
-
}
|
|
7070
|
-
target.addEventListener('scroll', this.state.updateBound);
|
|
7071
|
-
this.state.scrollTarget = target;
|
|
7072
|
-
}
|
|
7073
|
-
};
|
|
7074
|
-
|
|
7075
|
-
/**
|
|
7076
|
-
* Remove event listeners used to update the popper position
|
|
7077
|
-
* @method
|
|
7078
|
-
* @memberof Popper
|
|
7079
|
-
* @access private
|
|
7080
|
-
*/
|
|
7081
|
-
Popper.prototype._removeEventListeners = function () {
|
|
7082
|
-
// NOTE: 1 DOM access here
|
|
7083
|
-
root.removeEventListener('resize', this.state.updateBound);
|
|
7084
|
-
if (
|
|
7085
|
-
this._options.boundariesElement !== 'window' &&
|
|
7086
|
-
this.state.scrollTarget
|
|
7087
|
-
) {
|
|
7088
|
-
this.state.scrollTarget.removeEventListener(
|
|
7089
|
-
'scroll',
|
|
7090
|
-
this.state.updateBound
|
|
7091
|
-
);
|
|
7092
|
-
this.state.scrollTarget = null;
|
|
7093
|
-
}
|
|
7094
|
-
this.state.updateBound = null;
|
|
7095
|
-
};
|
|
7096
|
-
|
|
7097
|
-
/**
|
|
7098
|
-
* Computed the boundaries limits and return them
|
|
7099
|
-
* @method
|
|
7100
|
-
* @memberof Popper
|
|
7101
|
-
* @access private
|
|
7102
|
-
* @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
|
|
7103
|
-
* @param {Number} padding - Boundaries padding
|
|
7104
|
-
* @param {Element} boundariesElement - Element used to define the boundaries
|
|
7105
|
-
* @returns {Object} Coordinates of the boundaries
|
|
7106
|
-
*/
|
|
7107
|
-
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
7108
|
-
// NOTE: 1 DOM access here
|
|
7109
|
-
var boundaries = {};
|
|
7110
|
-
var width, height;
|
|
7111
|
-
if (boundariesElement === 'window') {
|
|
7112
|
-
var body = root.document.body,
|
|
7113
|
-
html = root.document.documentElement;
|
|
7114
|
-
|
|
7115
|
-
height = Math.max(
|
|
7116
|
-
body.scrollHeight,
|
|
7117
|
-
body.offsetHeight,
|
|
7118
|
-
html.clientHeight,
|
|
7119
|
-
html.scrollHeight,
|
|
7120
|
-
html.offsetHeight
|
|
7121
|
-
);
|
|
7122
|
-
width = Math.max(
|
|
7123
|
-
body.scrollWidth,
|
|
7124
|
-
body.offsetWidth,
|
|
7125
|
-
html.clientWidth,
|
|
7126
|
-
html.scrollWidth,
|
|
7127
|
-
html.offsetWidth
|
|
7128
|
-
);
|
|
7129
|
-
|
|
7130
|
-
boundaries = {
|
|
7131
|
-
top: 0,
|
|
7132
|
-
right: width,
|
|
7133
|
-
bottom: height,
|
|
7134
|
-
left: 0
|
|
7135
|
-
};
|
|
7136
|
-
} else if (boundariesElement === 'viewport') {
|
|
7137
|
-
var offsetParent = getOffsetParent(this._popper);
|
|
7138
|
-
var scrollParent = getScrollParent(this._popper);
|
|
7139
|
-
var offsetParentRect = getOffsetRect(offsetParent);
|
|
7140
|
-
|
|
7141
|
-
// Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
|
|
7142
|
-
var getScrollTopValue = function (element) {
|
|
7143
|
-
return element == document.body
|
|
7144
|
-
? Math.max(
|
|
7145
|
-
document.documentElement.scrollTop,
|
|
7146
|
-
document.body.scrollTop
|
|
7147
|
-
)
|
|
7148
|
-
: element.scrollTop;
|
|
7149
|
-
};
|
|
7150
|
-
var getScrollLeftValue = function (element) {
|
|
7151
|
-
return element == document.body
|
|
7152
|
-
? Math.max(
|
|
7153
|
-
document.documentElement.scrollLeft,
|
|
7154
|
-
document.body.scrollLeft
|
|
7155
|
-
)
|
|
7156
|
-
: element.scrollLeft;
|
|
7157
|
-
};
|
|
7158
|
-
|
|
7159
|
-
// if the popper is fixed we don't have to substract scrolling from the boundaries
|
|
7160
|
-
var scrollTop =
|
|
7161
|
-
data.offsets.popper.position === 'fixed'
|
|
7162
|
-
? 0
|
|
7163
|
-
: getScrollTopValue(scrollParent);
|
|
7164
|
-
var scrollLeft =
|
|
7165
|
-
data.offsets.popper.position === 'fixed'
|
|
7166
|
-
? 0
|
|
7167
|
-
: getScrollLeftValue(scrollParent);
|
|
7168
|
-
|
|
7169
|
-
boundaries = {
|
|
7170
|
-
top: 0 - (offsetParentRect.top - scrollTop),
|
|
7171
|
-
right:
|
|
7172
|
-
root.document.documentElement.clientWidth -
|
|
7173
|
-
(offsetParentRect.left - scrollLeft),
|
|
7174
|
-
bottom:
|
|
7175
|
-
root.document.documentElement.clientHeight -
|
|
7176
|
-
(offsetParentRect.top - scrollTop),
|
|
7177
|
-
left: 0 - (offsetParentRect.left - scrollLeft)
|
|
7178
|
-
};
|
|
7179
|
-
} else {
|
|
7180
|
-
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
7181
|
-
boundaries = {
|
|
7182
|
-
top: 0,
|
|
7183
|
-
left: 0,
|
|
7184
|
-
right: boundariesElement.clientWidth,
|
|
7185
|
-
bottom: boundariesElement.clientHeight
|
|
7186
|
-
};
|
|
7187
|
-
} else {
|
|
7188
|
-
boundaries = getOffsetRect(boundariesElement);
|
|
7189
|
-
}
|
|
7190
|
-
}
|
|
7191
|
-
boundaries.left += padding;
|
|
7192
|
-
boundaries.right -= padding;
|
|
7193
|
-
boundaries.top = boundaries.top + padding;
|
|
7194
|
-
boundaries.bottom = boundaries.bottom - padding;
|
|
7195
|
-
return boundaries;
|
|
7196
|
-
};
|
|
7197
|
-
|
|
7198
|
-
/**
|
|
7199
|
-
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
|
|
7200
|
-
* @method
|
|
7201
|
-
* @memberof Popper
|
|
7202
|
-
* @access public
|
|
7203
|
-
* @param {Object} data
|
|
7204
|
-
* @param {Array} modifiers
|
|
7205
|
-
* @param {Function} ends
|
|
7206
|
-
*/
|
|
7207
|
-
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
7208
|
-
var modifiersToRun = modifiers.slice();
|
|
7209
|
-
if (ends !== undefined) {
|
|
7210
|
-
modifiersToRun = this._options.modifiers.slice(
|
|
7211
|
-
0,
|
|
7212
|
-
getArrayKeyIndex(this._options.modifiers, ends)
|
|
7213
|
-
);
|
|
7214
|
-
}
|
|
7215
|
-
|
|
7216
|
-
modifiersToRun.forEach(
|
|
7217
|
-
function (modifier) {
|
|
7218
|
-
if (isFunction(modifier)) {
|
|
7219
|
-
data = modifier.call(this, data);
|
|
7220
|
-
}
|
|
7221
|
-
}.bind(this)
|
|
7222
|
-
);
|
|
7223
|
-
|
|
7224
|
-
return data;
|
|
7225
|
-
};
|
|
7226
|
-
|
|
7227
|
-
/**
|
|
7228
|
-
* Helper used to know if the given modifier depends from another one.
|
|
7229
|
-
* @method
|
|
7230
|
-
* @memberof Popper
|
|
7231
|
-
* @param {String} requesting - name of requesting modifier
|
|
7232
|
-
* @param {String} requested - name of requested modifier
|
|
7233
|
-
* @returns {Boolean}
|
|
7234
|
-
*/
|
|
7235
|
-
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
7236
|
-
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
7237
|
-
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
7238
|
-
return modifier === requested;
|
|
7239
|
-
}).length;
|
|
7240
|
-
};
|
|
7241
|
-
|
|
7242
|
-
//
|
|
7243
|
-
// Modifiers
|
|
7244
|
-
//
|
|
7245
|
-
|
|
7246
|
-
/**
|
|
7247
|
-
* Modifiers list
|
|
7248
|
-
* @namespace Popper.modifiers
|
|
7249
|
-
* @memberof Popper
|
|
7250
|
-
* @type {Object}
|
|
7251
|
-
*/
|
|
7252
|
-
Popper.prototype.modifiers = {};
|
|
7253
|
-
|
|
7254
|
-
/**
|
|
7255
|
-
* Apply the computed styles to the popper element
|
|
7256
|
-
* @method
|
|
7257
|
-
* @memberof Popper.modifiers
|
|
7258
|
-
* @argument {Object} data - The data object generated by `update` method
|
|
7259
|
-
* @returns {Object} The same data object
|
|
7260
|
-
*/
|
|
7261
|
-
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
7262
|
-
// apply the final offsets to the popper
|
|
7263
|
-
// NOTE: 1 DOM access here
|
|
7264
|
-
var styles = {
|
|
7265
|
-
position: data.offsets.popper.position
|
|
7266
|
-
};
|
|
7267
|
-
|
|
7268
|
-
// round top and left to avoid blurry text
|
|
7269
|
-
var left = Math.round(data.offsets.popper.left);
|
|
7270
|
-
var top = Math.round(data.offsets.popper.top);
|
|
7271
|
-
|
|
7272
|
-
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
7273
|
-
// we automatically use the supported prefixed version if needed
|
|
7274
|
-
var prefixedProperty;
|
|
7275
|
-
if (
|
|
7276
|
-
this._options.gpuAcceleration &&
|
|
7277
|
-
(prefixedProperty = getSupportedPropertyName('transform'))
|
|
7278
|
-
) {
|
|
7279
|
-
styles[prefixedProperty] =
|
|
7280
|
-
'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
7281
|
-
styles.top = 0;
|
|
7282
|
-
styles.left = 0;
|
|
7283
|
-
}
|
|
7284
|
-
// othwerise, we use the standard `left` and `top` properties
|
|
7285
|
-
else {
|
|
7286
|
-
styles.left = left;
|
|
7287
|
-
styles.top = top;
|
|
7288
|
-
}
|
|
7289
|
-
|
|
7290
|
-
// any property present in `data.styles` will be applied to the popper,
|
|
7291
|
-
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
7292
|
-
// Be aware, modifiers could override the properties defined in the previous
|
|
7293
|
-
// lines of this modifier!
|
|
7294
|
-
Object.assign(styles, data.styles);
|
|
7295
|
-
|
|
7296
|
-
setStyle(this._popper, styles);
|
|
7297
|
-
|
|
7298
|
-
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
|
|
7299
|
-
// NOTE: 1 DOM access here
|
|
7300
|
-
this._popper.setAttribute('x-placement', data.placement);
|
|
7301
|
-
|
|
7302
|
-
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
|
|
7303
|
-
if (
|
|
7304
|
-
this.isModifierRequired(
|
|
7305
|
-
this.modifiers.applyStyle,
|
|
7306
|
-
this.modifiers.arrow
|
|
7307
|
-
) &&
|
|
7308
|
-
data.offsets.arrow
|
|
7309
|
-
) {
|
|
7310
|
-
setStyle(data.arrowElement, data.offsets.arrow);
|
|
7311
|
-
}
|
|
7312
|
-
|
|
7313
|
-
return data;
|
|
7314
|
-
};
|
|
7315
|
-
|
|
7316
|
-
/**
|
|
7317
|
-
* Modifier used to shift the popper on the start or end of its reference element side
|
|
7318
|
-
* @method
|
|
7319
|
-
* @memberof Popper.modifiers
|
|
7320
|
-
* @argument {Object} data - The data object generated by `update` method
|
|
7321
|
-
* @returns {Object} The data object, properly modified
|
|
7322
|
-
*/
|
|
7323
|
-
Popper.prototype.modifiers.shift = function (data) {
|
|
7324
|
-
var placement = data.placement;
|
|
7325
|
-
var basePlacement = placement.split('-')[0];
|
|
7326
|
-
var shiftVariation = placement.split('-')[1];
|
|
7327
|
-
|
|
7328
|
-
// if shift shiftVariation is specified, run the modifier
|
|
7329
|
-
if (shiftVariation) {
|
|
7330
|
-
var reference = data.offsets.reference;
|
|
7331
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
7332
|
-
|
|
7333
|
-
var shiftOffsets = {
|
|
7334
|
-
y: {
|
|
7335
|
-
start: { top: reference.top },
|
|
7336
|
-
end: { top: reference.top + reference.height - popper.height }
|
|
7337
|
-
},
|
|
7338
|
-
x: {
|
|
7339
|
-
start: { left: reference.left },
|
|
7340
|
-
end: { left: reference.left + reference.width - popper.width }
|
|
7341
|
-
}
|
|
7342
|
-
};
|
|
7343
|
-
|
|
7344
|
-
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
7345
|
-
|
|
7346
|
-
data.offsets.popper = Object.assign(
|
|
7347
|
-
popper,
|
|
7348
|
-
shiftOffsets[axis][shiftVariation]
|
|
7349
|
-
);
|
|
7350
|
-
}
|
|
7351
|
-
|
|
7352
|
-
return data;
|
|
7353
|
-
};
|
|
7354
|
-
|
|
7355
|
-
/**
|
|
7356
|
-
* Modifier used to make sure the popper does not overflows from it's boundaries
|
|
7357
|
-
* @method
|
|
7358
|
-
* @memberof Popper.modifiers
|
|
7359
|
-
* @argument {Object} data - The data object generated by `update` method
|
|
7360
|
-
* @returns {Object} The data object, properly modified
|
|
7361
|
-
*/
|
|
7362
|
-
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
7363
|
-
var order = this._options.preventOverflowOrder;
|
|
7364
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
7365
|
-
|
|
7366
|
-
var check = {
|
|
7367
|
-
left: function () {
|
|
7368
|
-
var left = popper.left;
|
|
7369
|
-
if (popper.left < data.boundaries.left) {
|
|
7370
|
-
left = Math.max(popper.left, data.boundaries.left);
|
|
7371
|
-
}
|
|
7372
|
-
return { left: left };
|
|
7373
|
-
},
|
|
7374
|
-
right: function () {
|
|
7375
|
-
var left = popper.left;
|
|
7376
|
-
if (popper.right > data.boundaries.right) {
|
|
7377
|
-
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
7378
|
-
}
|
|
7379
|
-
return { left: left };
|
|
7380
|
-
},
|
|
7381
|
-
top: function () {
|
|
7382
|
-
var top = popper.top;
|
|
7383
|
-
if (popper.top < data.boundaries.top) {
|
|
7384
|
-
top = Math.max(popper.top, data.boundaries.top);
|
|
7385
|
-
}
|
|
7386
|
-
return { top: top };
|
|
7387
|
-
},
|
|
7388
|
-
bottom: function () {
|
|
7389
|
-
var top = popper.top;
|
|
7390
|
-
if (popper.bottom > data.boundaries.bottom) {
|
|
7391
|
-
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
7392
|
-
}
|
|
7393
|
-
return { top: top };
|
|
7394
|
-
}
|
|
7395
|
-
};
|
|
7396
|
-
|
|
7397
|
-
order.forEach(function (direction) {
|
|
7398
|
-
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
7399
|
-
});
|
|
7400
|
-
|
|
7401
|
-
return data;
|
|
7402
|
-
};
|
|
7403
|
-
|
|
7404
|
-
/**
|
|
7405
|
-
* Modifier used to make sure the popper is always near its reference
|
|
7406
|
-
* @method
|
|
7407
|
-
* @memberof Popper.modifiers
|
|
7408
|
-
* @argument {Object} data - The data object generated by _update method
|
|
7409
|
-
* @returns {Object} The data object, properly modified
|
|
7410
|
-
*/
|
|
7411
|
-
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
7412
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
7413
|
-
var reference = data.offsets.reference;
|
|
7414
|
-
var f = Math.floor;
|
|
7415
|
-
|
|
7416
|
-
if (popper.right < f(reference.left)) {
|
|
7417
|
-
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
7418
|
-
}
|
|
7419
|
-
if (popper.left > f(reference.right)) {
|
|
7420
|
-
data.offsets.popper.left = f(reference.right);
|
|
7421
|
-
}
|
|
7422
|
-
if (popper.bottom < f(reference.top)) {
|
|
7423
|
-
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
7424
|
-
}
|
|
7425
|
-
if (popper.top > f(reference.bottom)) {
|
|
7426
|
-
data.offsets.popper.top = f(reference.bottom);
|
|
7427
|
-
}
|
|
7428
|
-
|
|
7429
|
-
return data;
|
|
7430
|
-
};
|
|
7431
|
-
|
|
7432
|
-
/**
|
|
7433
|
-
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
|
|
7434
|
-
* Requires the `preventOverflow` modifier before it in order to work.
|
|
7435
|
-
* **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
|
|
7436
|
-
* @method
|
|
7437
|
-
* @memberof Popper.modifiers
|
|
7438
|
-
* @argument {Object} data - The data object generated by _update method
|
|
7439
|
-
* @returns {Object} The data object, properly modified
|
|
7440
|
-
*/
|
|
7441
|
-
Popper.prototype.modifiers.flip = function (data) {
|
|
7442
|
-
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
7443
|
-
// otherwise flip would not work as expected.
|
|
7444
|
-
if (
|
|
7445
|
-
!this.isModifierRequired(
|
|
7446
|
-
this.modifiers.flip,
|
|
7447
|
-
this.modifiers.preventOverflow
|
|
7448
|
-
)
|
|
7449
|
-
) {
|
|
7450
|
-
console.warn(
|
|
7451
|
-
'WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!'
|
|
7452
|
-
);
|
|
7453
|
-
return data;
|
|
7454
|
-
}
|
|
7455
|
-
|
|
7456
|
-
if (data.flipped && data.placement === data._originalPlacement) {
|
|
7457
|
-
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
7458
|
-
return data;
|
|
7459
|
-
}
|
|
7460
|
-
|
|
7461
|
-
var placement = data.placement.split('-')[0];
|
|
7462
|
-
var placementOpposite = getOppositePlacement(placement);
|
|
7463
|
-
var variation = data.placement.split('-')[1] || '';
|
|
7464
|
-
|
|
7465
|
-
var flipOrder = [];
|
|
7466
|
-
if (this._options.flipBehavior === 'flip') {
|
|
7467
|
-
flipOrder = [placement, placementOpposite];
|
|
7468
|
-
} else {
|
|
7469
|
-
flipOrder = this._options.flipBehavior;
|
|
7470
|
-
}
|
|
7471
|
-
|
|
7472
|
-
flipOrder.forEach(
|
|
7473
|
-
function (step, index) {
|
|
7474
|
-
if (placement !== step || flipOrder.length === index + 1) {
|
|
7475
|
-
return;
|
|
7476
|
-
}
|
|
7477
|
-
|
|
7478
|
-
placement = data.placement.split('-')[0];
|
|
7479
|
-
placementOpposite = getOppositePlacement(placement);
|
|
7480
|
-
|
|
7481
|
-
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
7482
|
-
|
|
7483
|
-
// this boolean is used to distinguish right and bottom from top and left
|
|
7484
|
-
// they need different computations to get flipped
|
|
7485
|
-
var a = ['right', 'bottom'].indexOf(placement) !== -1;
|
|
7486
|
-
|
|
7487
|
-
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
|
|
7488
|
-
if (
|
|
7489
|
-
(a &&
|
|
7490
|
-
Math.floor(data.offsets.reference[placement]) >
|
|
7491
|
-
Math.floor(popperOffsets[placementOpposite])) ||
|
|
7492
|
-
(!a &&
|
|
7493
|
-
Math.floor(data.offsets.reference[placement]) <
|
|
7494
|
-
Math.floor(popperOffsets[placementOpposite]))
|
|
7495
|
-
) {
|
|
7496
|
-
// we'll use this boolean to detect any flip loop
|
|
7497
|
-
data.flipped = true;
|
|
7498
|
-
data.placement = flipOrder[index + 1];
|
|
7499
|
-
if (variation) {
|
|
7500
|
-
data.placement += '-' + variation;
|
|
7501
|
-
}
|
|
7502
|
-
data.offsets.popper = this._getOffsets(
|
|
7503
|
-
this._popper,
|
|
7504
|
-
this._reference,
|
|
7505
|
-
data.placement
|
|
7506
|
-
).popper;
|
|
7507
|
-
|
|
7508
|
-
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
7509
|
-
}
|
|
7510
|
-
}.bind(this)
|
|
7511
|
-
);
|
|
7512
|
-
return data;
|
|
7513
|
-
};
|
|
7514
|
-
|
|
7515
|
-
/**
|
|
7516
|
-
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
|
|
7517
|
-
* The offsets will shift the popper on the side of its reference element.
|
|
7518
|
-
* @method
|
|
7519
|
-
* @memberof Popper.modifiers
|
|
7520
|
-
* @argument {Object} data - The data object generated by _update method
|
|
7521
|
-
* @returns {Object} The data object, properly modified
|
|
7522
|
-
*/
|
|
7523
|
-
Popper.prototype.modifiers.offset = function (data) {
|
|
7524
|
-
var offset = this._options.offset;
|
|
7525
|
-
var popper = data.offsets.popper;
|
|
7526
|
-
|
|
7527
|
-
if (data.placement.indexOf('left') !== -1) {
|
|
7528
|
-
popper.top -= offset;
|
|
7529
|
-
} else if (data.placement.indexOf('right') !== -1) {
|
|
7530
|
-
popper.top += offset;
|
|
7531
|
-
} else if (data.placement.indexOf('top') !== -1) {
|
|
7532
|
-
popper.left -= offset;
|
|
7533
|
-
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
7534
|
-
popper.left += offset;
|
|
7535
|
-
}
|
|
7536
|
-
return data;
|
|
7537
|
-
};
|
|
7538
|
-
|
|
7539
|
-
/**
|
|
7540
|
-
* Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element
|
|
7541
|
-
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
|
|
7542
|
-
* @method
|
|
7543
|
-
* @memberof Popper.modifiers
|
|
7544
|
-
* @argument {Object} data - The data object generated by _update method
|
|
7545
|
-
* @returns {Object} The data object, properly modified
|
|
7546
|
-
*/
|
|
7547
|
-
Popper.prototype.modifiers.arrow = function (data) {
|
|
7548
|
-
var arrow = this._options.arrowElement;
|
|
7549
|
-
var arrowOffset = this._options.arrowOffset;
|
|
7550
|
-
|
|
7551
|
-
// if the arrowElement is a string, suppose it's a CSS selector
|
|
7552
|
-
if (typeof arrow === 'string') {
|
|
7553
|
-
arrow = this._popper.querySelector(arrow);
|
|
7554
|
-
}
|
|
7555
|
-
|
|
7556
|
-
// if arrow element is not found, don't run the modifier
|
|
7557
|
-
if (!arrow) {
|
|
7558
|
-
return data;
|
|
7559
|
-
}
|
|
7560
|
-
|
|
7561
|
-
// the arrow element must be child of its popper
|
|
7562
|
-
if (!this._popper.contains(arrow)) {
|
|
7563
|
-
console.warn(
|
|
7564
|
-
'WARNING: `arrowElement` must be child of its popper element!'
|
|
7565
|
-
);
|
|
7566
|
-
return data;
|
|
7567
|
-
}
|
|
7568
|
-
|
|
7569
|
-
// arrow depends on keepTogether in order to work
|
|
7570
|
-
if (
|
|
7571
|
-
!this.isModifierRequired(
|
|
7572
|
-
this.modifiers.arrow,
|
|
7573
|
-
this.modifiers.keepTogether
|
|
7574
|
-
)
|
|
7575
|
-
) {
|
|
7576
|
-
console.warn(
|
|
7577
|
-
'WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'
|
|
7578
|
-
);
|
|
7579
|
-
return data;
|
|
7580
|
-
}
|
|
7581
|
-
|
|
7582
|
-
var arrowStyle = {};
|
|
7583
|
-
var placement = data.placement.split('-')[0];
|
|
7584
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
7585
|
-
var reference = data.offsets.reference;
|
|
7586
|
-
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
7587
|
-
|
|
7588
|
-
var len = isVertical ? 'height' : 'width';
|
|
7589
|
-
var side = isVertical ? 'top' : 'left';
|
|
7590
|
-
var translate = isVertical ? 'translateY' : 'translateX';
|
|
7591
|
-
var altSide = isVertical ? 'left' : 'top';
|
|
7592
|
-
var opSide = isVertical ? 'bottom' : 'right';
|
|
7593
|
-
var arrowSize = getOuterSizes(arrow)[len];
|
|
7594
|
-
|
|
7595
|
-
//
|
|
7596
|
-
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
|
|
7597
|
-
//
|
|
7598
|
-
|
|
7599
|
-
// top/left side
|
|
7600
|
-
if (reference[opSide] - arrowSize < popper[side]) {
|
|
7601
|
-
data.offsets.popper[side] -=
|
|
7602
|
-
popper[side] - (reference[opSide] - arrowSize);
|
|
7603
|
-
}
|
|
7604
|
-
// bottom/right side
|
|
7605
|
-
if (reference[side] + arrowSize > popper[opSide]) {
|
|
7606
|
-
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
|
|
7607
|
-
}
|
|
7608
|
-
|
|
7609
|
-
// compute center of the popper
|
|
7610
|
-
var center =
|
|
7611
|
-
reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
7612
|
-
|
|
7613
|
-
var sideValue = center - popper[side];
|
|
7614
|
-
|
|
7615
|
-
// prevent arrow from being placed not contiguously to its popper
|
|
7616
|
-
sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
|
|
7617
|
-
arrowStyle[side] = sideValue;
|
|
7618
|
-
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
|
|
7619
|
-
|
|
7620
|
-
data.offsets.arrow = arrowStyle;
|
|
7621
|
-
data.arrowElement = arrow;
|
|
7622
|
-
|
|
7623
|
-
return data;
|
|
7624
|
-
};
|
|
7625
|
-
|
|
7626
|
-
//
|
|
7627
|
-
// Helpers
|
|
7628
|
-
//
|
|
7629
|
-
|
|
7630
|
-
/**
|
|
7631
|
-
* Get the outer sizes of the given element (offset size + margins)
|
|
7632
|
-
* @function
|
|
7633
|
-
* @ignore
|
|
7634
|
-
* @argument {Element} element
|
|
7635
|
-
* @returns {Object} object containing width and height properties
|
|
7636
|
-
*/
|
|
7637
|
-
function getOuterSizes(element) {
|
|
7638
|
-
// NOTE: 1 DOM access here
|
|
7639
|
-
var _display = element.style.display,
|
|
7640
|
-
_visibility = element.style.visibility;
|
|
7641
|
-
element.style.display = 'block';
|
|
7642
|
-
element.style.visibility = 'hidden';
|
|
7643
|
-
var calcWidthToForceRepaint = element.offsetWidth;
|
|
7644
|
-
// original method
|
|
7645
|
-
var styles = root.getComputedStyle(element);
|
|
7646
|
-
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
7647
|
-
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
7648
|
-
var result = {
|
|
7649
|
-
width: element.offsetWidth + y,
|
|
7650
|
-
height: element.offsetHeight + x
|
|
7651
|
-
};
|
|
7652
|
-
|
|
7653
|
-
// reset element styles
|
|
7654
|
-
element.style.display = _display;
|
|
7655
|
-
element.style.visibility = _visibility;
|
|
7656
|
-
return result;
|
|
7657
|
-
}
|
|
7658
|
-
|
|
7659
|
-
/**
|
|
7660
|
-
* Get the opposite placement of the given one/
|
|
7661
|
-
* @function
|
|
7662
|
-
* @ignore
|
|
7663
|
-
* @argument {String} placement
|
|
7664
|
-
* @returns {String} flipped placement
|
|
7665
|
-
*/
|
|
7666
|
-
function getOppositePlacement(placement) {
|
|
7667
|
-
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
7668
|
-
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
7669
|
-
return hash[matched];
|
|
7670
|
-
});
|
|
7671
|
-
}
|
|
7672
|
-
|
|
7673
|
-
/**
|
|
7674
|
-
* Given the popper offsets, generate an output similar to getBoundingClientRect
|
|
7675
|
-
* @function
|
|
7676
|
-
* @ignore
|
|
7677
|
-
* @argument {Object} popperOffsets
|
|
7678
|
-
* @returns {Object} ClientRect like output
|
|
7679
|
-
*/
|
|
7680
|
-
function getPopperClientRect(popperOffsets) {
|
|
7681
|
-
var offsets = Object.assign({}, popperOffsets);
|
|
7682
|
-
offsets.right = offsets.left + offsets.width;
|
|
7683
|
-
offsets.bottom = offsets.top + offsets.height;
|
|
7684
|
-
return offsets;
|
|
7685
|
-
}
|
|
7686
|
-
|
|
7687
|
-
/**
|
|
7688
|
-
* Given an array and the key to find, returns its index
|
|
7689
|
-
* @function
|
|
7690
|
-
* @ignore
|
|
7691
|
-
* @argument {Array} arr
|
|
7692
|
-
* @argument keyToFind
|
|
7693
|
-
* @returns index or null
|
|
7694
|
-
*/
|
|
7695
|
-
function getArrayKeyIndex(arr, keyToFind) {
|
|
7696
|
-
var i = 0,
|
|
7697
|
-
key;
|
|
7698
|
-
for (key in arr) {
|
|
7699
|
-
if (arr[key] === keyToFind) {
|
|
7700
|
-
return i;
|
|
7701
|
-
}
|
|
7702
|
-
i++;
|
|
7703
|
-
}
|
|
7704
|
-
return null;
|
|
7705
|
-
}
|
|
7706
|
-
|
|
7707
|
-
/**
|
|
7708
|
-
* Get CSS computed property of the given element
|
|
7709
|
-
* @function
|
|
7710
|
-
* @ignore
|
|
7711
|
-
* @argument {Eement} element
|
|
7712
|
-
* @argument {String} property
|
|
7713
|
-
*/
|
|
7714
|
-
function getStyleComputedProperty(element, property) {
|
|
7715
|
-
// NOTE: 1 DOM access here
|
|
7716
|
-
var css = root.getComputedStyle(element, null);
|
|
7717
|
-
return css[property];
|
|
7718
|
-
}
|
|
7719
|
-
/**
|
|
7720
|
-
* Returns the offset parent of the given element
|
|
7721
|
-
* @function
|
|
7722
|
-
* @ignore
|
|
7723
|
-
* @argument {Element} element
|
|
7724
|
-
* @returns {Element} offset parent
|
|
7725
|
-
*/
|
|
7726
|
-
function getOffsetParent(element) {
|
|
7727
|
-
var offsetParent = element.offsetParent;
|
|
7728
|
-
return offsetParent === root.document.body || !offsetParent
|
|
7729
|
-
? root.document.documentElement
|
|
7730
|
-
: offsetParent;
|
|
7731
|
-
}
|
|
7732
|
-
|
|
7733
|
-
/**
|
|
7734
|
-
* Returns the scrolling parent of the given element
|
|
7735
|
-
* @function
|
|
7736
|
-
* @ignore
|
|
7737
|
-
* @argument {Element} element
|
|
7738
|
-
* @returns {Element} offset parent
|
|
7739
|
-
*/
|
|
7740
|
-
function getScrollParent(element) {
|
|
7741
|
-
var parent = element.parentNode;
|
|
7742
|
-
if (!parent || parent.nodeType !== 1) {
|
|
7743
|
-
return element;
|
|
7744
|
-
}
|
|
7745
|
-
|
|
7746
|
-
if (parent === root.document) {
|
|
7747
|
-
// Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
|
|
7748
|
-
// greater than 0 and return the proper element
|
|
7749
|
-
if (root.document.body.scrollTop || root.document.body.scrollLeft) {
|
|
7750
|
-
return root.document.body;
|
|
7751
|
-
} else {
|
|
7752
|
-
return root.document.documentElement;
|
|
7753
|
-
}
|
|
7754
|
-
}
|
|
7755
|
-
|
|
7756
|
-
// Firefox want us to check `-x` and `-y` variations as well
|
|
7757
|
-
if (
|
|
7758
|
-
['scroll', 'auto'].indexOf(
|
|
7759
|
-
getStyleComputedProperty(parent, 'overflow')
|
|
7760
|
-
) !== -1 ||
|
|
7761
|
-
['scroll', 'auto'].indexOf(
|
|
7762
|
-
getStyleComputedProperty(parent, 'overflow-x')
|
|
7763
|
-
) !== -1 ||
|
|
7764
|
-
['scroll', 'auto'].indexOf(
|
|
7765
|
-
getStyleComputedProperty(parent, 'overflow-y')
|
|
7766
|
-
) !== -1
|
|
7767
|
-
) {
|
|
7768
|
-
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
7769
|
-
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
7770
|
-
// fixes issue #65
|
|
7771
|
-
return parent;
|
|
7772
|
-
}
|
|
7773
|
-
return getScrollParent(element.parentNode);
|
|
7774
|
-
}
|
|
7775
|
-
|
|
7776
|
-
/**
|
|
7777
|
-
* Check if the given element is fixed or is inside a fixed parent
|
|
7778
|
-
* @function
|
|
7779
|
-
* @ignore
|
|
7780
|
-
* @argument {Element} element
|
|
7781
|
-
* @argument {Element} customContainer
|
|
7782
|
-
* @returns {Boolean} answer to "isFixed?"
|
|
7783
|
-
*/
|
|
7784
|
-
function isFixed(element) {
|
|
7785
|
-
if (element === root.document.body) {
|
|
7786
|
-
return false;
|
|
7787
|
-
}
|
|
7788
|
-
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
7789
|
-
return true;
|
|
7790
|
-
}
|
|
7791
|
-
return element.parentNode && element.parentNode.nodeType === 1
|
|
7792
|
-
? isFixed(element.parentNode)
|
|
7793
|
-
: element;
|
|
7794
|
-
}
|
|
7795
|
-
|
|
7796
|
-
/**
|
|
7797
|
-
* Set the style to the given popper
|
|
7798
|
-
* @function
|
|
7799
|
-
* @ignore
|
|
7800
|
-
* @argument {Element} element - Element to apply the style to
|
|
7801
|
-
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
|
|
7802
|
-
*/
|
|
7803
|
-
function setStyle(element, styles) {
|
|
7804
|
-
function is_numeric(n) {
|
|
7805
|
-
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
7806
|
-
}
|
|
7807
|
-
Object.keys(styles).forEach(function (prop) {
|
|
7808
|
-
var unit = '';
|
|
7809
|
-
// add unit if the value is numeric and is one of the following
|
|
7810
|
-
if (
|
|
7811
|
-
['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==
|
|
7812
|
-
-1 &&
|
|
7813
|
-
is_numeric(styles[prop])
|
|
7814
|
-
) {
|
|
7815
|
-
unit = 'px';
|
|
7816
|
-
}
|
|
7817
|
-
element.style[prop] = styles[prop] + unit;
|
|
7818
|
-
});
|
|
7819
|
-
}
|
|
7820
|
-
|
|
7821
|
-
/**
|
|
7822
|
-
* Check if the given variable is a function
|
|
7823
|
-
* @function
|
|
7824
|
-
* @ignore
|
|
7825
|
-
* @argument {*} functionToCheck - variable to check
|
|
7826
|
-
* @returns {Boolean} answer to: is a function?
|
|
7827
|
-
*/
|
|
7828
|
-
function isFunction(functionToCheck) {
|
|
7829
|
-
var getType = {};
|
|
7830
|
-
return (
|
|
7831
|
-
functionToCheck &&
|
|
7832
|
-
getType.toString.call(functionToCheck) === '[object Function]'
|
|
7833
|
-
);
|
|
7834
|
-
}
|
|
7835
|
-
|
|
7836
|
-
/**
|
|
7837
|
-
* Get the position of the given element, relative to its offset parent
|
|
7838
|
-
* @function
|
|
7839
|
-
* @ignore
|
|
7840
|
-
* @param {Element} element
|
|
7841
|
-
* @return {Object} position - Coordinates of the element and its `scrollTop`
|
|
7842
|
-
*/
|
|
7843
|
-
function getOffsetRect(element) {
|
|
7844
|
-
var transform = getStyle(element, 'transform')
|
|
7845
|
-
.replace(/[^0-9\-,]/g, '')
|
|
7846
|
-
.split(',');
|
|
7847
|
-
var elementRect = {
|
|
7848
|
-
width: element.offsetWidth,
|
|
7849
|
-
height: element.offsetHeight,
|
|
7850
|
-
left:
|
|
7851
|
-
element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
|
|
7852
|
-
top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
|
|
7853
|
-
};
|
|
7854
|
-
|
|
7855
|
-
elementRect.right = elementRect.left + elementRect.width;
|
|
7856
|
-
elementRect.bottom = elementRect.top + elementRect.height;
|
|
7857
|
-
|
|
7858
|
-
// position
|
|
7859
|
-
return elementRect;
|
|
7860
|
-
}
|
|
7861
|
-
|
|
7862
|
-
/**
|
|
7863
|
-
* Get bounding client rect of given element
|
|
7864
|
-
* @function
|
|
7865
|
-
* @ignore
|
|
7866
|
-
* @param {HTMLElement} element
|
|
7867
|
-
* @return {Object} client rect
|
|
7868
|
-
*/
|
|
7869
|
-
function getBoundingClientRect(element) {
|
|
7870
|
-
var rect = element.getBoundingClientRect();
|
|
7871
|
-
|
|
7872
|
-
// whether the IE version is lower than 11
|
|
7873
|
-
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
7874
|
-
|
|
7875
|
-
// fix ie document bounding top always 0 bug
|
|
7876
|
-
var rectTop =
|
|
7877
|
-
isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
|
|
7878
|
-
|
|
7879
|
-
return {
|
|
7880
|
-
left: rect.left,
|
|
7881
|
-
top: rectTop,
|
|
7882
|
-
right: rect.right,
|
|
7883
|
-
bottom: rect.bottom,
|
|
7884
|
-
width: rect.right - rect.left,
|
|
7885
|
-
height: rect.bottom - rectTop
|
|
7886
|
-
};
|
|
7887
|
-
}
|
|
7888
|
-
|
|
7889
|
-
function getStyle(dom, attr) {
|
|
7890
|
-
if (dom.style[attr]) {
|
|
7891
|
-
return dom.style[attr];
|
|
7892
|
-
}
|
|
7893
|
-
if (window.getComputedStyle) {
|
|
7894
|
-
return getComputedStyle(dom, null)[attr];
|
|
7895
|
-
}
|
|
7896
|
-
return dom.currentStyle[attr];
|
|
7897
|
-
}
|
|
7898
|
-
|
|
7899
|
-
/**
|
|
7900
|
-
* Given an element and one of its parents, return the offset
|
|
7901
|
-
* @function
|
|
7902
|
-
* @ignore
|
|
7903
|
-
* @param {HTMLElement} element
|
|
7904
|
-
* @param {HTMLElement} parent
|
|
7905
|
-
* @return {Object} rect
|
|
7906
|
-
*/
|
|
7907
|
-
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
7908
|
-
var elementRect = getBoundingClientRect(element);
|
|
7909
|
-
var parentRect = getBoundingClientRect(parent);
|
|
7910
|
-
|
|
7911
|
-
if (fixed) {
|
|
7912
|
-
var scrollParent = getScrollParent(parent);
|
|
7913
|
-
parentRect.top += scrollParent.scrollTop;
|
|
7914
|
-
parentRect.bottom += scrollParent.scrollTop;
|
|
7915
|
-
parentRect.left += scrollParent.scrollLeft;
|
|
7916
|
-
parentRect.right += scrollParent.scrollLeft;
|
|
7917
|
-
}
|
|
7918
|
-
|
|
7919
|
-
var rect = {
|
|
7920
|
-
top: elementRect.top - parentRect.top,
|
|
7921
|
-
left: elementRect.left - parentRect.left,
|
|
7922
|
-
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
7923
|
-
right: elementRect.left - parentRect.left + elementRect.width,
|
|
7924
|
-
width: elementRect.width,
|
|
7925
|
-
height: elementRect.height
|
|
7926
|
-
};
|
|
7927
|
-
return rect;
|
|
7928
|
-
}
|
|
7929
|
-
|
|
7930
|
-
/**
|
|
7931
|
-
* Get the prefixed supported property name
|
|
7932
|
-
* @function
|
|
7933
|
-
* @ignore
|
|
7934
|
-
* @argument {String} property (camelCase)
|
|
7935
|
-
* @returns {String} prefixed property (camelCase)
|
|
7936
|
-
*/
|
|
7937
|
-
function getSupportedPropertyName(property) {
|
|
7938
|
-
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
7939
|
-
|
|
7940
|
-
for (var i = 0; i < prefixes.length; i++) {
|
|
7941
|
-
var toCheck = prefixes[i]
|
|
7942
|
-
? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1)
|
|
7943
|
-
: property;
|
|
7944
|
-
if (typeof root.document.body.style[toCheck] !== 'undefined') {
|
|
7945
|
-
return toCheck;
|
|
7946
|
-
}
|
|
7947
|
-
}
|
|
7948
|
-
return null;
|
|
7949
|
-
}
|
|
7950
|
-
|
|
7951
|
-
/**
|
|
7952
|
-
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
|
|
7953
|
-
* objects to a target object. It will return the target object.
|
|
7954
|
-
* This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
|
|
7955
|
-
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
7956
|
-
* @function
|
|
7957
|
-
* @ignore
|
|
7958
|
-
*/
|
|
7959
|
-
if (!Object.assign) {
|
|
7960
|
-
Object.defineProperty(Object, 'assign', {
|
|
7961
|
-
enumerable: false,
|
|
7962
|
-
configurable: true,
|
|
7963
|
-
writable: true,
|
|
7964
|
-
value: function (target) {
|
|
7965
|
-
if (target === undefined || target === null) {
|
|
7966
|
-
throw new TypeError('Cannot convert first argument to object');
|
|
7967
|
-
}
|
|
7968
|
-
|
|
7969
|
-
var to = Object(target);
|
|
7970
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
7971
|
-
var nextSource = arguments[i];
|
|
7972
|
-
if (nextSource === undefined || nextSource === null) {
|
|
7973
|
-
continue;
|
|
7974
|
-
}
|
|
7975
|
-
nextSource = Object(nextSource);
|
|
7976
|
-
|
|
7977
|
-
var keysArray = Object.keys(nextSource);
|
|
7978
|
-
for (
|
|
7979
|
-
var nextIndex = 0, len = keysArray.length;
|
|
7980
|
-
nextIndex < len;
|
|
7981
|
-
nextIndex++
|
|
7982
|
-
) {
|
|
7983
|
-
var nextKey = keysArray[nextIndex];
|
|
7984
|
-
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
7985
|
-
if (desc !== undefined && desc.enumerable) {
|
|
7986
|
-
to[nextKey] = nextSource[nextKey];
|
|
7987
|
-
}
|
|
7988
|
-
}
|
|
7989
|
-
}
|
|
7990
|
-
return to;
|
|
7991
|
-
}
|
|
7992
|
-
});
|
|
7993
|
-
}
|
|
7994
|
-
|
|
7995
|
-
return Popper;
|
|
7996
|
-
});
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
/***/ }),
|
|
8000
|
-
|
|
8001
|
-
/***/ 42:
|
|
8002
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
8003
|
-
|
|
8004
|
-
"use strict";
|
|
8005
|
-
var aria = aria || {};
|
|
8006
|
-
|
|
8007
|
-
aria.Utils = aria.Utils || {};
|
|
8008
|
-
|
|
8009
|
-
/**
|
|
8010
|
-
* @desc Set focus on descendant nodes until the first focusable element is
|
|
8011
|
-
* found.
|
|
8012
|
-
* @param element
|
|
8013
|
-
* DOM node for which to find the first focusable descendant.
|
|
8014
|
-
* @returns
|
|
8015
|
-
* true if a focusable element is found and focus is set.
|
|
8016
|
-
*/
|
|
8017
|
-
aria.Utils.focusFirstDescendant = function (element) {
|
|
8018
|
-
for (var i = 0; i < element.childNodes.length; i++) {
|
|
8019
|
-
var child = element.childNodes[i];
|
|
8020
|
-
if (aria.Utils.attemptFocus(child) || aria.Utils.focusFirstDescendant(child)) {
|
|
8021
|
-
return true;
|
|
8022
|
-
}
|
|
8023
|
-
}
|
|
8024
|
-
return false;
|
|
8025
|
-
};
|
|
8026
|
-
|
|
8027
|
-
/**
|
|
8028
|
-
* @desc Find the last descendant node that is focusable.
|
|
8029
|
-
* @param element
|
|
8030
|
-
* DOM node for which to find the last focusable descendant.
|
|
8031
|
-
* @returns
|
|
8032
|
-
* true if a focusable element is found and focus is set.
|
|
8033
|
-
*/
|
|
8034
|
-
|
|
8035
|
-
aria.Utils.focusLastDescendant = function (element) {
|
|
8036
|
-
for (var i = element.childNodes.length - 1; i >= 0; i--) {
|
|
8037
|
-
var child = element.childNodes[i];
|
|
8038
|
-
if (aria.Utils.attemptFocus(child) || aria.Utils.focusLastDescendant(child)) {
|
|
8039
|
-
return true;
|
|
8040
|
-
}
|
|
8041
|
-
}
|
|
8042
|
-
return false;
|
|
8043
|
-
};
|
|
8044
|
-
|
|
8045
|
-
/**
|
|
8046
|
-
* @desc Set Attempt to set focus on the current node.
|
|
8047
|
-
* @param element
|
|
8048
|
-
* The node to attempt to focus on.
|
|
8049
|
-
* @returns
|
|
8050
|
-
* true if element is focused.
|
|
8051
|
-
*/
|
|
8052
|
-
aria.Utils.attemptFocus = function (element) {
|
|
8053
|
-
if (!aria.Utils.isFocusable(element)) {
|
|
8054
|
-
return false;
|
|
8055
|
-
}
|
|
8056
|
-
aria.Utils.IgnoreUtilFocusChanges = true;
|
|
8057
|
-
try {
|
|
8058
|
-
element.focus();
|
|
8059
|
-
} catch (e) {}
|
|
8060
|
-
aria.Utils.IgnoreUtilFocusChanges = false;
|
|
8061
|
-
return document.activeElement === element;
|
|
8062
|
-
};
|
|
8063
|
-
|
|
8064
|
-
aria.Utils.isFocusable = function (element) {
|
|
8065
|
-
if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute('tabIndex') !== null) {
|
|
8066
|
-
return true;
|
|
8067
|
-
}
|
|
8068
|
-
|
|
8069
|
-
if (element.disabled) {
|
|
8070
|
-
return false;
|
|
8071
|
-
}
|
|
8072
|
-
|
|
8073
|
-
switch (element.nodeName) {
|
|
8074
|
-
case 'A':
|
|
8075
|
-
return !!element.href && element.rel !== 'ignore';
|
|
8076
|
-
case 'INPUT':
|
|
8077
|
-
return element.type !== 'hidden' && element.type !== 'file';
|
|
8078
|
-
case 'BUTTON':
|
|
8079
|
-
case 'SELECT':
|
|
8080
|
-
case 'TEXTAREA':
|
|
8081
|
-
return true;
|
|
8082
|
-
default:
|
|
8083
|
-
return false;
|
|
8084
|
-
}
|
|
8085
|
-
};
|
|
8086
|
-
|
|
8087
|
-
/**
|
|
8088
|
-
* 触发一个事件
|
|
8089
|
-
* mouseenter, mouseleave, mouseover, keyup, change, click 等
|
|
8090
|
-
* @param {Element} elm
|
|
8091
|
-
* @param {String} name
|
|
8092
|
-
* @param {*} opts
|
|
8093
|
-
*/
|
|
8094
|
-
aria.Utils.triggerEvent = function (elm, name) {
|
|
8095
|
-
var eventName = void 0;
|
|
8096
|
-
|
|
8097
|
-
if (/^mouse|click/.test(name)) {
|
|
8098
|
-
eventName = 'MouseEvents';
|
|
8099
|
-
} else if (/^key/.test(name)) {
|
|
8100
|
-
eventName = 'KeyboardEvent';
|
|
8101
|
-
} else {
|
|
8102
|
-
eventName = 'HTMLEvents';
|
|
8103
|
-
}
|
|
8104
|
-
var evt = document.createEvent(eventName);
|
|
8105
|
-
|
|
8106
|
-
for (var _len = arguments.length, opts = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
8107
|
-
opts[_key - 2] = arguments[_key];
|
|
8108
|
-
}
|
|
8109
|
-
|
|
8110
|
-
evt.initEvent.apply(evt, [name].concat(opts));
|
|
8111
|
-
elm.dispatchEvent ? elm.dispatchEvent(evt) : elm.fireEvent('on' + name, evt);
|
|
8112
|
-
|
|
8113
|
-
return elm;
|
|
8114
|
-
};
|
|
8115
|
-
|
|
8116
|
-
aria.Utils.keys = {
|
|
8117
|
-
tab: 9,
|
|
8118
|
-
enter: 13,
|
|
8119
|
-
space: 32,
|
|
8120
|
-
left: 37,
|
|
8121
|
-
up: 38,
|
|
8122
|
-
right: 39,
|
|
8123
|
-
down: 40,
|
|
8124
|
-
esc: 27
|
|
8125
|
-
};
|
|
8126
|
-
|
|
8127
|
-
/* harmony default export */ __webpack_exports__["a"] = (aria.Utils);
|
|
8128
|
-
|
|
8129
|
-
/***/ }),
|
|
8130
|
-
|
|
8131
|
-
/***/ 44:
|
|
8132
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
8133
|
-
|
|
8134
|
-
"use strict";
|
|
8135
|
-
/* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
|
8136
|
-
/**
|
|
8137
|
-
* 滚动条组件 - 处理表格的垂直和水平滚动条
|
|
8138
|
-
*/
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
var BAR_MAP = {
|
|
8142
|
-
vertical: {
|
|
8143
|
-
offset: 'offsetHeight',
|
|
8144
|
-
scroll: 'scrollTop',
|
|
8145
|
-
scrollSize: 'scrollHeight',
|
|
8146
|
-
size: 'height',
|
|
8147
|
-
key: 'vertical',
|
|
8148
|
-
axis: 'Y',
|
|
8149
|
-
client: 'clientY',
|
|
8150
|
-
direction: 'top'
|
|
8151
|
-
},
|
|
8152
|
-
horizontal: {
|
|
8153
|
-
offset: 'offsetWidth',
|
|
8154
|
-
scroll: 'scrollLeft',
|
|
8155
|
-
scrollSize: 'scrollWidth',
|
|
8156
|
-
size: 'width',
|
|
8157
|
-
key: 'horizontal',
|
|
8158
|
-
axis: 'X',
|
|
8159
|
-
client: 'clientX',
|
|
8160
|
-
direction: 'left'
|
|
8161
|
-
}
|
|
8162
|
-
};
|
|
6573
|
+
var BAR_MAP = {
|
|
6574
|
+
vertical: {
|
|
6575
|
+
offset: 'offsetHeight',
|
|
6576
|
+
scroll: 'scrollTop',
|
|
6577
|
+
scrollSize: 'scrollHeight',
|
|
6578
|
+
size: 'height',
|
|
6579
|
+
key: 'vertical',
|
|
6580
|
+
axis: 'Y',
|
|
6581
|
+
client: 'clientY',
|
|
6582
|
+
direction: 'top'
|
|
6583
|
+
},
|
|
6584
|
+
horizontal: {
|
|
6585
|
+
offset: 'offsetWidth',
|
|
6586
|
+
scroll: 'scrollLeft',
|
|
6587
|
+
scrollSize: 'scrollWidth',
|
|
6588
|
+
size: 'width',
|
|
6589
|
+
key: 'horizontal',
|
|
6590
|
+
axis: 'X',
|
|
6591
|
+
client: 'clientX',
|
|
6592
|
+
direction: 'left'
|
|
6593
|
+
}
|
|
6594
|
+
};
|
|
8163
6595
|
|
|
8164
6596
|
// 计算滚动位置的缓存
|
|
8165
6597
|
var scrollPositionCache = new Map();
|
|
@@ -8367,122 +6799,1690 @@ function renderThumbStyle(_ref3) {
|
|
|
8367
6799
|
|
|
8368
6800
|
|
|
8369
6801
|
/**
|
|
8370
|
-
* 鼠标移动处理函数
|
|
8371
|
-
* @param {MouseEvent} event - 鼠标事件对象
|
|
8372
|
-
*/
|
|
8373
|
-
handleMouseMove: function handleMouseMove(event) {
|
|
8374
|
-
if (!this.cursorDown) return;
|
|
8375
|
-
|
|
8376
|
-
var _barConfig3 = this.barConfig,
|
|
8377
|
-
axis = _barConfig3.axis,
|
|
8378
|
-
direction = _barConfig3.direction,
|
|
8379
|
-
client = _barConfig3.client,
|
|
8380
|
-
offset = _barConfig3.offset,
|
|
8381
|
-
scroll = _barConfig3.scroll,
|
|
8382
|
-
scrollSize = _barConfig3.scrollSize;
|
|
8383
|
-
|
|
8384
|
-
var prevPage = this[axis];
|
|
8385
|
-
|
|
8386
|
-
if (!prevPage || !this.scrollWrapper) return;
|
|
8387
|
-
|
|
8388
|
-
// 阻止文本选择和上下文菜单
|
|
8389
|
-
this.disableUserSelection();
|
|
8390
|
-
|
|
8391
|
-
// 计算鼠标相对于轨道的位置
|
|
8392
|
-
var trackRect = this.$el.getBoundingClientRect();
|
|
8393
|
-
var mousePosition = event[client] - trackRect[direction];
|
|
6802
|
+
* 鼠标移动处理函数
|
|
6803
|
+
* @param {MouseEvent} event - 鼠标事件对象
|
|
6804
|
+
*/
|
|
6805
|
+
handleMouseMove: function handleMouseMove(event) {
|
|
6806
|
+
if (!this.cursorDown) return;
|
|
6807
|
+
|
|
6808
|
+
var _barConfig3 = this.barConfig,
|
|
6809
|
+
axis = _barConfig3.axis,
|
|
6810
|
+
direction = _barConfig3.direction,
|
|
6811
|
+
client = _barConfig3.client,
|
|
6812
|
+
offset = _barConfig3.offset,
|
|
6813
|
+
scroll = _barConfig3.scroll,
|
|
6814
|
+
scrollSize = _barConfig3.scrollSize;
|
|
6815
|
+
|
|
6816
|
+
var prevPage = this[axis];
|
|
6817
|
+
|
|
6818
|
+
if (!prevPage || !this.scrollWrapper) return;
|
|
6819
|
+
|
|
6820
|
+
// 阻止文本选择和上下文菜单
|
|
6821
|
+
this.disableUserSelection();
|
|
6822
|
+
|
|
6823
|
+
// 计算鼠标相对于轨道的位置
|
|
6824
|
+
var trackRect = this.$el.getBoundingClientRect();
|
|
6825
|
+
var mousePosition = event[client] - trackRect[direction];
|
|
6826
|
+
|
|
6827
|
+
// 计算滑块应该移动到的位置(考虑鼠标在滑块内部的偏移量)
|
|
6828
|
+
var thumbPosition = mousePosition - prevPage;
|
|
6829
|
+
|
|
6830
|
+
// 确保滑块位置在轨道范围内
|
|
6831
|
+
var maxThumbPosition = this.$el[offset] - (this.$refs.thumb && this.$refs.thumb[offset] || 0);
|
|
6832
|
+
var clampedThumbPosition = Math.max(0, Math.min(thumbPosition, maxThumbPosition));
|
|
6833
|
+
|
|
6834
|
+
// 计算滑块位置百分比
|
|
6835
|
+
var thumbPositionPercentage = clampedThumbPosition * 100 / (this.$el[offset] || 1);
|
|
6836
|
+
|
|
6837
|
+
// 计算并设置滚动位置
|
|
6838
|
+
var scrollPosition = thumbPositionPercentage * this.scrollWrapper[scrollSize] / 100;
|
|
6839
|
+
|
|
6840
|
+
this.scrollWrapper[scroll] = scrollPosition;
|
|
6841
|
+
this.$emit('move', scroll, scrollPosition);
|
|
6842
|
+
},
|
|
6843
|
+
|
|
6844
|
+
|
|
6845
|
+
/**
|
|
6846
|
+
* 鼠标释放处理函数
|
|
6847
|
+
*/
|
|
6848
|
+
handleMouseUp: function handleMouseUp() {
|
|
6849
|
+
this.cursorDown = false;
|
|
6850
|
+
var axis = this.barConfig.axis;
|
|
6851
|
+
|
|
6852
|
+
this[axis] = 0;
|
|
6853
|
+
|
|
6854
|
+
// 移除事件监听器
|
|
6855
|
+
Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* off */ "f"])(document, 'mousemove', this.handleMouseMove);
|
|
6856
|
+
|
|
6857
|
+
// 恢复文本选择和上下文菜单
|
|
6858
|
+
this.restoreUserSelection();
|
|
6859
|
+
},
|
|
6860
|
+
|
|
6861
|
+
|
|
6862
|
+
/**
|
|
6863
|
+
* 禁用用户选择和上下文菜单
|
|
6864
|
+
*/
|
|
6865
|
+
disableUserSelection: function disableUserSelection() {
|
|
6866
|
+
document.body.onselectstart = document.body.oncontextmenu = function () {
|
|
6867
|
+
return false;
|
|
6868
|
+
};
|
|
6869
|
+
},
|
|
6870
|
+
|
|
6871
|
+
|
|
6872
|
+
/**
|
|
6873
|
+
* 恢复用户选择和上下文菜单
|
|
6874
|
+
*/
|
|
6875
|
+
restoreUserSelection: function restoreUserSelection() {
|
|
6876
|
+
document.onselectstart = null;
|
|
6877
|
+
document.body.onselectstart = document.body.oncontextmenu = function () {
|
|
6878
|
+
return true;
|
|
6879
|
+
};
|
|
6880
|
+
}
|
|
6881
|
+
},
|
|
6882
|
+
|
|
6883
|
+
render: function render() {
|
|
6884
|
+
var h = arguments[0];
|
|
6885
|
+
var size = this.size,
|
|
6886
|
+
move = this.move,
|
|
6887
|
+
barConfig = this.barConfig;
|
|
6888
|
+
|
|
6889
|
+
|
|
6890
|
+
return h(
|
|
6891
|
+
'div',
|
|
6892
|
+
{
|
|
6893
|
+
'class': ['es-scrollbar__bar', 'is-' + barConfig.key],
|
|
6894
|
+
on: {
|
|
6895
|
+
'mousedown': this.handleTrackClick
|
|
6896
|
+
}
|
|
6897
|
+
},
|
|
6898
|
+
[h('div', {
|
|
6899
|
+
ref: 'thumb',
|
|
6900
|
+
'class': 'es-scrollbar__thumb',
|
|
6901
|
+
on: {
|
|
6902
|
+
'mousedown': this.handleThumbClick
|
|
6903
|
+
},
|
|
6904
|
+
|
|
6905
|
+
style: renderThumbStyle({ size: size, move: move, bar: barConfig })
|
|
6906
|
+
})]
|
|
6907
|
+
);
|
|
6908
|
+
},
|
|
6909
|
+
destroyed: function destroyed() {
|
|
6910
|
+
// 清理事件监听器
|
|
6911
|
+
Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* off */ "f"])(document, 'mouseup', this.handleMouseUp);
|
|
6912
|
+
Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* off */ "f"])(document, 'mousemove', this.handleMouseMove);
|
|
6913
|
+
|
|
6914
|
+
// 确保恢复用户选择功能
|
|
6915
|
+
this.restoreUserSelection();
|
|
6916
|
+
}
|
|
6917
|
+
});
|
|
6918
|
+
|
|
6919
|
+
/***/ }),
|
|
6920
|
+
|
|
6921
|
+
/***/ 4:
|
|
6922
|
+
/***/ (function(module, exports) {
|
|
6923
|
+
|
|
6924
|
+
module.exports = require("vue");
|
|
6925
|
+
|
|
6926
|
+
/***/ }),
|
|
6927
|
+
|
|
6928
|
+
/***/ 42:
|
|
6929
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
6930
|
+
|
|
6931
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
6932
|
+
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
6933
|
+
* @version {{version}}
|
|
6934
|
+
* @license
|
|
6935
|
+
* Copyright (c) 2016 Federico Zivolo and contributors
|
|
6936
|
+
*
|
|
6937
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6938
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6939
|
+
* in the Software without restriction, including without limitation the rights
|
|
6940
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
6941
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
6942
|
+
* furnished to do so, subject to the following conditions:
|
|
6943
|
+
*
|
|
6944
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
6945
|
+
* copies or substantial portions of the Software.
|
|
6946
|
+
*
|
|
6947
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
6948
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
6949
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
6950
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
6951
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
6952
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
6953
|
+
* SOFTWARE.
|
|
6954
|
+
*/
|
|
6955
|
+
|
|
6956
|
+
//
|
|
6957
|
+
// Cross module loader
|
|
6958
|
+
// Supported: Node, AMD, Browser globals
|
|
6959
|
+
//
|
|
6960
|
+
(function (root, factory) {
|
|
6961
|
+
if (true) {
|
|
6962
|
+
// AMD. Register as an anonymous module.
|
|
6963
|
+
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
6964
|
+
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
6965
|
+
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
6966
|
+
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
6967
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
6968
|
+
} else {}
|
|
6969
|
+
})(this, function () {
|
|
6970
|
+
'use strict';
|
|
6971
|
+
|
|
6972
|
+
var root = window;
|
|
6973
|
+
// default options
|
|
6974
|
+
var DEFAULTS = {
|
|
6975
|
+
// placement of the popper
|
|
6976
|
+
placement: 'bottom',
|
|
6977
|
+
|
|
6978
|
+
gpuAcceleration: true,
|
|
6979
|
+
|
|
6980
|
+
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
6981
|
+
offset: 0,
|
|
6982
|
+
|
|
6983
|
+
// the element which will act as boundary of the popper
|
|
6984
|
+
boundariesElement: 'viewport',
|
|
6985
|
+
|
|
6986
|
+
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
6987
|
+
boundariesPadding: 5,
|
|
6988
|
+
|
|
6989
|
+
// popper will try to prevent overflow following this order,
|
|
6990
|
+
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
6991
|
+
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
6992
|
+
|
|
6993
|
+
// the behavior used by flip to change the placement of the popper
|
|
6994
|
+
flipBehavior: 'flip',
|
|
6995
|
+
|
|
6996
|
+
arrowElement: '[x-arrow]',
|
|
6997
|
+
|
|
6998
|
+
arrowOffset: 0,
|
|
6999
|
+
|
|
7000
|
+
// list of functions used to modify the offsets before they are applied to the popper
|
|
7001
|
+
modifiers: [
|
|
7002
|
+
'shift',
|
|
7003
|
+
'offset',
|
|
7004
|
+
'preventOverflow',
|
|
7005
|
+
'keepTogether',
|
|
7006
|
+
'arrow',
|
|
7007
|
+
'flip',
|
|
7008
|
+
'applyStyle'
|
|
7009
|
+
],
|
|
7010
|
+
|
|
7011
|
+
modifiersIgnored: [],
|
|
7012
|
+
|
|
7013
|
+
forceAbsolute: false
|
|
7014
|
+
};
|
|
7015
|
+
|
|
7016
|
+
/**
|
|
7017
|
+
* Create a new Popper.js instance
|
|
7018
|
+
* @constructor Popper
|
|
7019
|
+
* @param {HTMLElement} reference - The reference element used to position the popper
|
|
7020
|
+
* @param {HTMLElement|Object} popper
|
|
7021
|
+
* The HTML element used as popper, or a configuration used to generate the popper.
|
|
7022
|
+
* @param {String} [popper.tagName='div'] The tag name of the generated popper.
|
|
7023
|
+
* @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
|
|
7024
|
+
* @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
|
|
7025
|
+
* @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
|
|
7026
|
+
* @param {String} [popper.content=''] The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.
|
|
7027
|
+
* @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
|
|
7028
|
+
* @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
|
|
7029
|
+
* @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
|
|
7030
|
+
* @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
|
|
7031
|
+
* @param {Object} options
|
|
7032
|
+
* @param {String} [options.placement=bottom]
|
|
7033
|
+
* Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
|
|
7034
|
+
* left(-start, -end)`
|
|
7035
|
+
*
|
|
7036
|
+
* @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
|
|
7037
|
+
* The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
|
|
7038
|
+
* its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
|
|
7039
|
+
* reference element.
|
|
7040
|
+
* By default, it will look for a child node of the popper with the `x-arrow` attribute.
|
|
7041
|
+
*
|
|
7042
|
+
* @param {Boolean} [options.gpuAcceleration=true]
|
|
7043
|
+
* When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
|
|
7044
|
+
* browser to use the GPU to accelerate the rendering.
|
|
7045
|
+
* If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
|
|
7046
|
+
*
|
|
7047
|
+
* @param {Number} [options.offset=0]
|
|
7048
|
+
* Amount of pixels the popper will be shifted (can be negative).
|
|
7049
|
+
*
|
|
7050
|
+
* @param {String|Element} [options.boundariesElement='viewport']
|
|
7051
|
+
* The element which will define the boundaries of the popper position, the popper will never be placed outside
|
|
7052
|
+
* of the defined boundaries (except if `keepTogether` is enabled)
|
|
7053
|
+
*
|
|
7054
|
+
* @param {Number} [options.boundariesPadding=5]
|
|
7055
|
+
* Additional padding for the boundaries
|
|
7056
|
+
*
|
|
7057
|
+
* @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
|
|
7058
|
+
* Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
|
|
7059
|
+
* this means that the last ones will never overflow
|
|
7060
|
+
*
|
|
7061
|
+
* @param {String|Array} [options.flipBehavior='flip']
|
|
7062
|
+
* The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
|
|
7063
|
+
* overlap its reference element. Defining `flip` as value, the placement will be flipped on
|
|
7064
|
+
* its axis (`right - left`, `top - bottom`).
|
|
7065
|
+
* You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
|
|
7066
|
+
* how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
|
|
7067
|
+
* then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
|
|
7068
|
+
*
|
|
7069
|
+
* @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
|
|
7070
|
+
* List of functions used to modify the data before they are applied to the popper, add your custom functions
|
|
7071
|
+
* to this array to edit the offsets and placement.
|
|
7072
|
+
* The function should reflect the @params and @returns of preventOverflow
|
|
7073
|
+
*
|
|
7074
|
+
* @param {Array} [options.modifiersIgnored=[]]
|
|
7075
|
+
* Put here any built-in modifier name you want to exclude from the modifiers list
|
|
7076
|
+
* The function should reflect the @params and @returns of preventOverflow
|
|
7077
|
+
*
|
|
7078
|
+
* @param {Boolean} [options.removeOnDestroy=false]
|
|
7079
|
+
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
|
|
7080
|
+
*/
|
|
7081
|
+
function Popper(reference, popper, options) {
|
|
7082
|
+
this._reference = reference.jquery ? reference[0] : reference;
|
|
7083
|
+
this.state = {};
|
|
7084
|
+
|
|
7085
|
+
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
7086
|
+
// generate a default popper if is not defined
|
|
7087
|
+
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
7088
|
+
var isConfig =
|
|
7089
|
+
popper && Object.prototype.toString.call(popper) === '[object Object]';
|
|
7090
|
+
if (isNotDefined || isConfig) {
|
|
7091
|
+
this._popper = this.parse(isConfig ? popper : {});
|
|
7092
|
+
}
|
|
7093
|
+
// otherwise, use the given HTMLElement as popper
|
|
7094
|
+
else {
|
|
7095
|
+
this._popper = popper.jquery ? popper[0] : popper;
|
|
7096
|
+
}
|
|
7097
|
+
|
|
7098
|
+
// with {} we create a new object with the options inside it
|
|
7099
|
+
this._options = Object.assign({}, DEFAULTS, options);
|
|
7100
|
+
|
|
7101
|
+
// refactoring modifiers' list
|
|
7102
|
+
this._options.modifiers = this._options.modifiers.map(
|
|
7103
|
+
function (modifier) {
|
|
7104
|
+
// remove ignored modifiers
|
|
7105
|
+
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
|
|
7106
|
+
|
|
7107
|
+
// set the x-placement attribute before everything else because it could be used to add margins to the popper
|
|
7108
|
+
// margins needs to be calculated to get the correct popper offsets
|
|
7109
|
+
if (modifier === 'applyStyle') {
|
|
7110
|
+
this._popper.setAttribute('x-placement', this._options.placement);
|
|
7111
|
+
}
|
|
7112
|
+
|
|
7113
|
+
// return predefined modifier identified by string or keep the custom one
|
|
7114
|
+
return this.modifiers[modifier] || modifier;
|
|
7115
|
+
}.bind(this)
|
|
7116
|
+
);
|
|
7117
|
+
|
|
7118
|
+
// make sure to apply the popper position before any computation
|
|
7119
|
+
this.state.position = this._getPosition(this._popper, this._reference);
|
|
7120
|
+
setStyle(this._popper, { position: this.state.position, top: 0 });
|
|
7121
|
+
|
|
7122
|
+
// fire the first update to position the popper in the right place
|
|
7123
|
+
this.update();
|
|
7124
|
+
|
|
7125
|
+
// setup event listeners, they will take care of update the position in specific situations
|
|
7126
|
+
this._setupEventListeners();
|
|
7127
|
+
return this;
|
|
7128
|
+
}
|
|
7129
|
+
|
|
7130
|
+
//
|
|
7131
|
+
// Methods
|
|
7132
|
+
//
|
|
7133
|
+
/**
|
|
7134
|
+
* Destroy the popper
|
|
7135
|
+
* @method
|
|
7136
|
+
* @memberof Popper
|
|
7137
|
+
*/
|
|
7138
|
+
Popper.prototype.destroy = function () {
|
|
7139
|
+
this._popper.removeAttribute('x-placement');
|
|
7140
|
+
this._popper.style.left = '';
|
|
7141
|
+
this._popper.style.position = '';
|
|
7142
|
+
this._popper.style.top = '';
|
|
7143
|
+
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
7144
|
+
this._removeEventListeners();
|
|
7145
|
+
|
|
7146
|
+
// remove the popper if user explicity asked for the deletion on destroy
|
|
7147
|
+
if (this._options.removeOnDestroy) {
|
|
7148
|
+
this._popper.remove();
|
|
7149
|
+
}
|
|
7150
|
+
return this;
|
|
7151
|
+
};
|
|
7152
|
+
|
|
7153
|
+
/**
|
|
7154
|
+
* Updates the position of the popper, computing the new offsets and applying the new style
|
|
7155
|
+
* @method
|
|
7156
|
+
* @memberof Popper
|
|
7157
|
+
*/
|
|
7158
|
+
Popper.prototype.update = function () {
|
|
7159
|
+
var data = { instance: this, styles: {} };
|
|
7160
|
+
|
|
7161
|
+
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
7162
|
+
// and refer to _originalPlacement to know the original value
|
|
7163
|
+
data.placement = this._options.placement;
|
|
7164
|
+
data._originalPlacement = this._options.placement;
|
|
7165
|
+
|
|
7166
|
+
// compute the popper and reference offsets and put them inside data.offsets
|
|
7167
|
+
data.offsets = this._getOffsets(
|
|
7168
|
+
this._popper,
|
|
7169
|
+
this._reference,
|
|
7170
|
+
data.placement
|
|
7171
|
+
);
|
|
7172
|
+
|
|
7173
|
+
// get boundaries
|
|
7174
|
+
data.boundaries = this._getBoundaries(
|
|
7175
|
+
data,
|
|
7176
|
+
this._options.boundariesPadding,
|
|
7177
|
+
this._options.boundariesElement
|
|
7178
|
+
);
|
|
7179
|
+
|
|
7180
|
+
data = this.runModifiers(data, this._options.modifiers);
|
|
7181
|
+
|
|
7182
|
+
if (typeof this.state.updateCallback === 'function') {
|
|
7183
|
+
this.state.updateCallback(data);
|
|
7184
|
+
}
|
|
7185
|
+
};
|
|
7186
|
+
|
|
7187
|
+
/**
|
|
7188
|
+
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
|
|
7189
|
+
* @method
|
|
7190
|
+
* @memberof Popper
|
|
7191
|
+
* @param {Function} callback
|
|
7192
|
+
*/
|
|
7193
|
+
Popper.prototype.onCreate = function (callback) {
|
|
7194
|
+
// the createCallbacks return as first argument the popper instance
|
|
7195
|
+
callback(this);
|
|
7196
|
+
return this;
|
|
7197
|
+
};
|
|
7198
|
+
|
|
7199
|
+
/**
|
|
7200
|
+
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
|
|
7201
|
+
* used to style popper and its arrow.
|
|
7202
|
+
* NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
|
|
7203
|
+
* @method
|
|
7204
|
+
* @memberof Popper
|
|
7205
|
+
* @param {Function} callback
|
|
7206
|
+
*/
|
|
7207
|
+
Popper.prototype.onUpdate = function (callback) {
|
|
7208
|
+
this.state.updateCallback = callback;
|
|
7209
|
+
return this;
|
|
7210
|
+
};
|
|
7211
|
+
|
|
7212
|
+
/**
|
|
7213
|
+
* Helper used to generate poppers from a configuration file
|
|
7214
|
+
* @method
|
|
7215
|
+
* @memberof Popper
|
|
7216
|
+
* @param config {Object} configuration
|
|
7217
|
+
* @returns {HTMLElement} popper
|
|
7218
|
+
*/
|
|
7219
|
+
Popper.prototype.parse = function (config) {
|
|
7220
|
+
var defaultConfig = {
|
|
7221
|
+
tagName: 'div',
|
|
7222
|
+
classNames: ['popper'],
|
|
7223
|
+
attributes: [],
|
|
7224
|
+
parent: root.document.body,
|
|
7225
|
+
content: '',
|
|
7226
|
+
contentType: 'text',
|
|
7227
|
+
arrowTagName: 'div',
|
|
7228
|
+
arrowClassNames: ['popper__arrow'],
|
|
7229
|
+
arrowAttributes: ['x-arrow']
|
|
7230
|
+
};
|
|
7231
|
+
config = Object.assign({}, defaultConfig, config);
|
|
7232
|
+
|
|
7233
|
+
var d = root.document;
|
|
7234
|
+
|
|
7235
|
+
var popper = d.createElement(config.tagName);
|
|
7236
|
+
addClassNames(popper, config.classNames);
|
|
7237
|
+
addAttributes(popper, config.attributes);
|
|
7238
|
+
if (config.contentType === 'node') {
|
|
7239
|
+
popper.appendChild(
|
|
7240
|
+
config.content.jquery ? config.content[0] : config.content
|
|
7241
|
+
);
|
|
7242
|
+
} else if (config.contentType === 'html') {
|
|
7243
|
+
popper.innerHTML = config.content;
|
|
7244
|
+
} else {
|
|
7245
|
+
popper.textContent = config.content;
|
|
7246
|
+
}
|
|
7247
|
+
|
|
7248
|
+
if (config.arrowTagName) {
|
|
7249
|
+
var arrow = d.createElement(config.arrowTagName);
|
|
7250
|
+
addClassNames(arrow, config.arrowClassNames);
|
|
7251
|
+
addAttributes(arrow, config.arrowAttributes);
|
|
7252
|
+
popper.appendChild(arrow);
|
|
7253
|
+
}
|
|
7254
|
+
|
|
7255
|
+
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
7256
|
+
|
|
7257
|
+
// if the given parent is a string, use it to match an element
|
|
7258
|
+
// if more than one element is matched, the first one will be used as parent
|
|
7259
|
+
// if no elements are matched, the script will throw an error
|
|
7260
|
+
if (typeof parent === 'string') {
|
|
7261
|
+
parent = d.querySelectorAll(config.parent);
|
|
7262
|
+
if (parent.length > 1) {
|
|
7263
|
+
console.warn(
|
|
7264
|
+
'WARNING: the given `parent` query(' +
|
|
7265
|
+
config.parent +
|
|
7266
|
+
') matched more than one element, the first one will be used'
|
|
7267
|
+
);
|
|
7268
|
+
}
|
|
7269
|
+
if (parent.length === 0) {
|
|
7270
|
+
throw "ERROR: the given `parent` doesn't exists!";
|
|
7271
|
+
}
|
|
7272
|
+
parent = parent[0];
|
|
7273
|
+
}
|
|
7274
|
+
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
|
|
7275
|
+
// the first one will be used as parent
|
|
7276
|
+
if (parent.length > 1 && parent instanceof Element === false) {
|
|
7277
|
+
console.warn(
|
|
7278
|
+
'WARNING: you have passed as parent a list of elements, the first one will be used'
|
|
7279
|
+
);
|
|
7280
|
+
parent = parent[0];
|
|
7281
|
+
}
|
|
7282
|
+
|
|
7283
|
+
// append the generated popper to its parent
|
|
7284
|
+
parent.appendChild(popper);
|
|
7285
|
+
|
|
7286
|
+
return popper;
|
|
7287
|
+
|
|
7288
|
+
/**
|
|
7289
|
+
* Adds class names to the given element
|
|
7290
|
+
* @function
|
|
7291
|
+
* @ignore
|
|
7292
|
+
* @param {HTMLElement} target
|
|
7293
|
+
* @param {Array} classes
|
|
7294
|
+
*/
|
|
7295
|
+
function addClassNames(element, classNames) {
|
|
7296
|
+
classNames.forEach(function (className) {
|
|
7297
|
+
element.classList.add(className);
|
|
7298
|
+
});
|
|
7299
|
+
}
|
|
7300
|
+
|
|
7301
|
+
/**
|
|
7302
|
+
* Adds attributes to the given element
|
|
7303
|
+
* @function
|
|
7304
|
+
* @ignore
|
|
7305
|
+
* @param {HTMLElement} target
|
|
7306
|
+
* @param {Array} attributes
|
|
7307
|
+
* @example
|
|
7308
|
+
* addAttributes(element, [ 'data-info:foobar' ]);
|
|
7309
|
+
*/
|
|
7310
|
+
function addAttributes(element, attributes) {
|
|
7311
|
+
attributes.forEach(function (attribute) {
|
|
7312
|
+
element.setAttribute(
|
|
7313
|
+
attribute.split(':')[0],
|
|
7314
|
+
attribute.split(':')[1] || ''
|
|
7315
|
+
);
|
|
7316
|
+
});
|
|
7317
|
+
}
|
|
7318
|
+
};
|
|
7319
|
+
|
|
7320
|
+
/**
|
|
7321
|
+
* Helper used to get the position which will be applied to the popper
|
|
7322
|
+
* @method
|
|
7323
|
+
* @memberof Popper
|
|
7324
|
+
* @param config {HTMLElement} popper element
|
|
7325
|
+
* @param reference {HTMLElement} reference element
|
|
7326
|
+
* @returns {String} position
|
|
7327
|
+
*/
|
|
7328
|
+
Popper.prototype._getPosition = function (popper, reference) {
|
|
7329
|
+
var container = getOffsetParent(reference);
|
|
7330
|
+
|
|
7331
|
+
if (this._options.forceAbsolute) {
|
|
7332
|
+
return 'absolute';
|
|
7333
|
+
}
|
|
7334
|
+
|
|
7335
|
+
// Decide if the popper will be fixed
|
|
7336
|
+
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
7337
|
+
var isParentFixed = isFixed(reference, container);
|
|
7338
|
+
return isParentFixed ? 'fixed' : 'absolute';
|
|
7339
|
+
};
|
|
7340
|
+
|
|
7341
|
+
/**
|
|
7342
|
+
* Get offsets to the popper
|
|
7343
|
+
* @method
|
|
7344
|
+
* @memberof Popper
|
|
7345
|
+
* @access private
|
|
7346
|
+
* @param {Element} popper - the popper element
|
|
7347
|
+
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
7348
|
+
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
7349
|
+
*/
|
|
7350
|
+
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
7351
|
+
placement = placement.split('-')[0];
|
|
7352
|
+
var popperOffsets = {};
|
|
7353
|
+
|
|
7354
|
+
popperOffsets.position = this.state.position;
|
|
7355
|
+
var isParentFixed = popperOffsets.position === 'fixed';
|
|
7356
|
+
|
|
7357
|
+
//
|
|
7358
|
+
// Get reference element position
|
|
7359
|
+
//
|
|
7360
|
+
var referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
7361
|
+
reference,
|
|
7362
|
+
getOffsetParent(popper),
|
|
7363
|
+
isParentFixed
|
|
7364
|
+
);
|
|
7365
|
+
|
|
7366
|
+
//
|
|
7367
|
+
// Get popper sizes
|
|
7368
|
+
//
|
|
7369
|
+
var popperRect = getOuterSizes(popper);
|
|
7370
|
+
|
|
7371
|
+
//
|
|
7372
|
+
// Compute offsets of popper
|
|
7373
|
+
//
|
|
7374
|
+
|
|
7375
|
+
// depending by the popper placement we have to compute its offsets slightly differently
|
|
7376
|
+
if (['right', 'left'].indexOf(placement) !== -1) {
|
|
7377
|
+
popperOffsets.top =
|
|
7378
|
+
referenceOffsets.top +
|
|
7379
|
+
referenceOffsets.height / 2 -
|
|
7380
|
+
popperRect.height / 2;
|
|
7381
|
+
if (placement === 'left') {
|
|
7382
|
+
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
7383
|
+
} else {
|
|
7384
|
+
popperOffsets.left = referenceOffsets.right;
|
|
7385
|
+
}
|
|
7386
|
+
} else {
|
|
7387
|
+
popperOffsets.left =
|
|
7388
|
+
referenceOffsets.left +
|
|
7389
|
+
referenceOffsets.width / 2 -
|
|
7390
|
+
popperRect.width / 2;
|
|
7391
|
+
if (placement === 'top') {
|
|
7392
|
+
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
7393
|
+
} else {
|
|
7394
|
+
popperOffsets.top = referenceOffsets.bottom;
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
|
|
7398
|
+
// Add width and height to our offsets object
|
|
7399
|
+
popperOffsets.width = popperRect.width;
|
|
7400
|
+
popperOffsets.height = popperRect.height;
|
|
7401
|
+
|
|
7402
|
+
return {
|
|
7403
|
+
popper: popperOffsets,
|
|
7404
|
+
reference: referenceOffsets
|
|
7405
|
+
};
|
|
7406
|
+
};
|
|
7407
|
+
|
|
7408
|
+
/**
|
|
7409
|
+
* Setup needed event listeners used to update the popper position
|
|
7410
|
+
* @method
|
|
7411
|
+
* @memberof Popper
|
|
7412
|
+
* @access private
|
|
7413
|
+
*/
|
|
7414
|
+
Popper.prototype._setupEventListeners = function () {
|
|
7415
|
+
// NOTE: 1 DOM access here
|
|
7416
|
+
this.state.updateBound = this.update.bind(this);
|
|
7417
|
+
root.addEventListener('resize', this.state.updateBound);
|
|
7418
|
+
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
7419
|
+
if (this._options.boundariesElement !== 'window') {
|
|
7420
|
+
var target = getScrollParent(this._reference);
|
|
7421
|
+
// here it could be both `body` or `documentElement` thanks to Firefox, we then check both
|
|
7422
|
+
if (
|
|
7423
|
+
target === root.document.body ||
|
|
7424
|
+
target === root.document.documentElement
|
|
7425
|
+
) {
|
|
7426
|
+
target = root;
|
|
7427
|
+
}
|
|
7428
|
+
target.addEventListener('scroll', this.state.updateBound);
|
|
7429
|
+
this.state.scrollTarget = target;
|
|
7430
|
+
}
|
|
7431
|
+
};
|
|
7432
|
+
|
|
7433
|
+
/**
|
|
7434
|
+
* Remove event listeners used to update the popper position
|
|
7435
|
+
* @method
|
|
7436
|
+
* @memberof Popper
|
|
7437
|
+
* @access private
|
|
7438
|
+
*/
|
|
7439
|
+
Popper.prototype._removeEventListeners = function () {
|
|
7440
|
+
// NOTE: 1 DOM access here
|
|
7441
|
+
root.removeEventListener('resize', this.state.updateBound);
|
|
7442
|
+
if (
|
|
7443
|
+
this._options.boundariesElement !== 'window' &&
|
|
7444
|
+
this.state.scrollTarget
|
|
7445
|
+
) {
|
|
7446
|
+
this.state.scrollTarget.removeEventListener(
|
|
7447
|
+
'scroll',
|
|
7448
|
+
this.state.updateBound
|
|
7449
|
+
);
|
|
7450
|
+
this.state.scrollTarget = null;
|
|
7451
|
+
}
|
|
7452
|
+
this.state.updateBound = null;
|
|
7453
|
+
};
|
|
7454
|
+
|
|
7455
|
+
/**
|
|
7456
|
+
* Computed the boundaries limits and return them
|
|
7457
|
+
* @method
|
|
7458
|
+
* @memberof Popper
|
|
7459
|
+
* @access private
|
|
7460
|
+
* @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
|
|
7461
|
+
* @param {Number} padding - Boundaries padding
|
|
7462
|
+
* @param {Element} boundariesElement - Element used to define the boundaries
|
|
7463
|
+
* @returns {Object} Coordinates of the boundaries
|
|
7464
|
+
*/
|
|
7465
|
+
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
7466
|
+
// NOTE: 1 DOM access here
|
|
7467
|
+
var boundaries = {};
|
|
7468
|
+
var width, height;
|
|
7469
|
+
if (boundariesElement === 'window') {
|
|
7470
|
+
var body = root.document.body,
|
|
7471
|
+
html = root.document.documentElement;
|
|
7472
|
+
|
|
7473
|
+
height = Math.max(
|
|
7474
|
+
body.scrollHeight,
|
|
7475
|
+
body.offsetHeight,
|
|
7476
|
+
html.clientHeight,
|
|
7477
|
+
html.scrollHeight,
|
|
7478
|
+
html.offsetHeight
|
|
7479
|
+
);
|
|
7480
|
+
width = Math.max(
|
|
7481
|
+
body.scrollWidth,
|
|
7482
|
+
body.offsetWidth,
|
|
7483
|
+
html.clientWidth,
|
|
7484
|
+
html.scrollWidth,
|
|
7485
|
+
html.offsetWidth
|
|
7486
|
+
);
|
|
7487
|
+
|
|
7488
|
+
boundaries = {
|
|
7489
|
+
top: 0,
|
|
7490
|
+
right: width,
|
|
7491
|
+
bottom: height,
|
|
7492
|
+
left: 0
|
|
7493
|
+
};
|
|
7494
|
+
} else if (boundariesElement === 'viewport') {
|
|
7495
|
+
var offsetParent = getOffsetParent(this._popper);
|
|
7496
|
+
var scrollParent = getScrollParent(this._popper);
|
|
7497
|
+
var offsetParentRect = getOffsetRect(offsetParent);
|
|
7498
|
+
|
|
7499
|
+
// Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
|
|
7500
|
+
var getScrollTopValue = function (element) {
|
|
7501
|
+
return element == document.body
|
|
7502
|
+
? Math.max(
|
|
7503
|
+
document.documentElement.scrollTop,
|
|
7504
|
+
document.body.scrollTop
|
|
7505
|
+
)
|
|
7506
|
+
: element.scrollTop;
|
|
7507
|
+
};
|
|
7508
|
+
var getScrollLeftValue = function (element) {
|
|
7509
|
+
return element == document.body
|
|
7510
|
+
? Math.max(
|
|
7511
|
+
document.documentElement.scrollLeft,
|
|
7512
|
+
document.body.scrollLeft
|
|
7513
|
+
)
|
|
7514
|
+
: element.scrollLeft;
|
|
7515
|
+
};
|
|
7516
|
+
|
|
7517
|
+
// if the popper is fixed we don't have to substract scrolling from the boundaries
|
|
7518
|
+
var scrollTop =
|
|
7519
|
+
data.offsets.popper.position === 'fixed'
|
|
7520
|
+
? 0
|
|
7521
|
+
: getScrollTopValue(scrollParent);
|
|
7522
|
+
var scrollLeft =
|
|
7523
|
+
data.offsets.popper.position === 'fixed'
|
|
7524
|
+
? 0
|
|
7525
|
+
: getScrollLeftValue(scrollParent);
|
|
7526
|
+
|
|
7527
|
+
boundaries = {
|
|
7528
|
+
top: 0 - (offsetParentRect.top - scrollTop),
|
|
7529
|
+
right:
|
|
7530
|
+
root.document.documentElement.clientWidth -
|
|
7531
|
+
(offsetParentRect.left - scrollLeft),
|
|
7532
|
+
bottom:
|
|
7533
|
+
root.document.documentElement.clientHeight -
|
|
7534
|
+
(offsetParentRect.top - scrollTop),
|
|
7535
|
+
left: 0 - (offsetParentRect.left - scrollLeft)
|
|
7536
|
+
};
|
|
7537
|
+
} else {
|
|
7538
|
+
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
7539
|
+
boundaries = {
|
|
7540
|
+
top: 0,
|
|
7541
|
+
left: 0,
|
|
7542
|
+
right: boundariesElement.clientWidth,
|
|
7543
|
+
bottom: boundariesElement.clientHeight
|
|
7544
|
+
};
|
|
7545
|
+
} else {
|
|
7546
|
+
boundaries = getOffsetRect(boundariesElement);
|
|
7547
|
+
}
|
|
7548
|
+
}
|
|
7549
|
+
boundaries.left += padding;
|
|
7550
|
+
boundaries.right -= padding;
|
|
7551
|
+
boundaries.top = boundaries.top + padding;
|
|
7552
|
+
boundaries.bottom = boundaries.bottom - padding;
|
|
7553
|
+
return boundaries;
|
|
7554
|
+
};
|
|
7555
|
+
|
|
7556
|
+
/**
|
|
7557
|
+
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
|
|
7558
|
+
* @method
|
|
7559
|
+
* @memberof Popper
|
|
7560
|
+
* @access public
|
|
7561
|
+
* @param {Object} data
|
|
7562
|
+
* @param {Array} modifiers
|
|
7563
|
+
* @param {Function} ends
|
|
7564
|
+
*/
|
|
7565
|
+
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
7566
|
+
var modifiersToRun = modifiers.slice();
|
|
7567
|
+
if (ends !== undefined) {
|
|
7568
|
+
modifiersToRun = this._options.modifiers.slice(
|
|
7569
|
+
0,
|
|
7570
|
+
getArrayKeyIndex(this._options.modifiers, ends)
|
|
7571
|
+
);
|
|
7572
|
+
}
|
|
7573
|
+
|
|
7574
|
+
modifiersToRun.forEach(
|
|
7575
|
+
function (modifier) {
|
|
7576
|
+
if (isFunction(modifier)) {
|
|
7577
|
+
data = modifier.call(this, data);
|
|
7578
|
+
}
|
|
7579
|
+
}.bind(this)
|
|
7580
|
+
);
|
|
7581
|
+
|
|
7582
|
+
return data;
|
|
7583
|
+
};
|
|
7584
|
+
|
|
7585
|
+
/**
|
|
7586
|
+
* Helper used to know if the given modifier depends from another one.
|
|
7587
|
+
* @method
|
|
7588
|
+
* @memberof Popper
|
|
7589
|
+
* @param {String} requesting - name of requesting modifier
|
|
7590
|
+
* @param {String} requested - name of requested modifier
|
|
7591
|
+
* @returns {Boolean}
|
|
7592
|
+
*/
|
|
7593
|
+
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
7594
|
+
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
7595
|
+
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
7596
|
+
return modifier === requested;
|
|
7597
|
+
}).length;
|
|
7598
|
+
};
|
|
7599
|
+
|
|
7600
|
+
//
|
|
7601
|
+
// Modifiers
|
|
7602
|
+
//
|
|
7603
|
+
|
|
7604
|
+
/**
|
|
7605
|
+
* Modifiers list
|
|
7606
|
+
* @namespace Popper.modifiers
|
|
7607
|
+
* @memberof Popper
|
|
7608
|
+
* @type {Object}
|
|
7609
|
+
*/
|
|
7610
|
+
Popper.prototype.modifiers = {};
|
|
7611
|
+
|
|
7612
|
+
/**
|
|
7613
|
+
* Apply the computed styles to the popper element
|
|
7614
|
+
* @method
|
|
7615
|
+
* @memberof Popper.modifiers
|
|
7616
|
+
* @argument {Object} data - The data object generated by `update` method
|
|
7617
|
+
* @returns {Object} The same data object
|
|
7618
|
+
*/
|
|
7619
|
+
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
7620
|
+
// apply the final offsets to the popper
|
|
7621
|
+
// NOTE: 1 DOM access here
|
|
7622
|
+
var styles = {
|
|
7623
|
+
position: data.offsets.popper.position
|
|
7624
|
+
};
|
|
7625
|
+
|
|
7626
|
+
// round top and left to avoid blurry text
|
|
7627
|
+
var left = Math.round(data.offsets.popper.left);
|
|
7628
|
+
var top = Math.round(data.offsets.popper.top);
|
|
7629
|
+
|
|
7630
|
+
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
7631
|
+
// we automatically use the supported prefixed version if needed
|
|
7632
|
+
var prefixedProperty;
|
|
7633
|
+
if (
|
|
7634
|
+
this._options.gpuAcceleration &&
|
|
7635
|
+
(prefixedProperty = getSupportedPropertyName('transform'))
|
|
7636
|
+
) {
|
|
7637
|
+
styles[prefixedProperty] =
|
|
7638
|
+
'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
7639
|
+
styles.top = 0;
|
|
7640
|
+
styles.left = 0;
|
|
7641
|
+
}
|
|
7642
|
+
// othwerise, we use the standard `left` and `top` properties
|
|
7643
|
+
else {
|
|
7644
|
+
styles.left = left;
|
|
7645
|
+
styles.top = top;
|
|
7646
|
+
}
|
|
7647
|
+
|
|
7648
|
+
// any property present in `data.styles` will be applied to the popper,
|
|
7649
|
+
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
7650
|
+
// Be aware, modifiers could override the properties defined in the previous
|
|
7651
|
+
// lines of this modifier!
|
|
7652
|
+
Object.assign(styles, data.styles);
|
|
7653
|
+
|
|
7654
|
+
setStyle(this._popper, styles);
|
|
7655
|
+
|
|
7656
|
+
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
|
|
7657
|
+
// NOTE: 1 DOM access here
|
|
7658
|
+
this._popper.setAttribute('x-placement', data.placement);
|
|
7659
|
+
|
|
7660
|
+
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
|
|
7661
|
+
if (
|
|
7662
|
+
this.isModifierRequired(
|
|
7663
|
+
this.modifiers.applyStyle,
|
|
7664
|
+
this.modifiers.arrow
|
|
7665
|
+
) &&
|
|
7666
|
+
data.offsets.arrow
|
|
7667
|
+
) {
|
|
7668
|
+
setStyle(data.arrowElement, data.offsets.arrow);
|
|
7669
|
+
}
|
|
7670
|
+
|
|
7671
|
+
return data;
|
|
7672
|
+
};
|
|
7673
|
+
|
|
7674
|
+
/**
|
|
7675
|
+
* Modifier used to shift the popper on the start or end of its reference element side
|
|
7676
|
+
* @method
|
|
7677
|
+
* @memberof Popper.modifiers
|
|
7678
|
+
* @argument {Object} data - The data object generated by `update` method
|
|
7679
|
+
* @returns {Object} The data object, properly modified
|
|
7680
|
+
*/
|
|
7681
|
+
Popper.prototype.modifiers.shift = function (data) {
|
|
7682
|
+
var placement = data.placement;
|
|
7683
|
+
var basePlacement = placement.split('-')[0];
|
|
7684
|
+
var shiftVariation = placement.split('-')[1];
|
|
7685
|
+
|
|
7686
|
+
// if shift shiftVariation is specified, run the modifier
|
|
7687
|
+
if (shiftVariation) {
|
|
7688
|
+
var reference = data.offsets.reference;
|
|
7689
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7690
|
+
|
|
7691
|
+
var shiftOffsets = {
|
|
7692
|
+
y: {
|
|
7693
|
+
start: { top: reference.top },
|
|
7694
|
+
end: { top: reference.top + reference.height - popper.height }
|
|
7695
|
+
},
|
|
7696
|
+
x: {
|
|
7697
|
+
start: { left: reference.left },
|
|
7698
|
+
end: { left: reference.left + reference.width - popper.width }
|
|
7699
|
+
}
|
|
7700
|
+
};
|
|
7701
|
+
|
|
7702
|
+
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
7703
|
+
|
|
7704
|
+
data.offsets.popper = Object.assign(
|
|
7705
|
+
popper,
|
|
7706
|
+
shiftOffsets[axis][shiftVariation]
|
|
7707
|
+
);
|
|
7708
|
+
}
|
|
7709
|
+
|
|
7710
|
+
return data;
|
|
7711
|
+
};
|
|
7712
|
+
|
|
7713
|
+
/**
|
|
7714
|
+
* Modifier used to make sure the popper does not overflows from it's boundaries
|
|
7715
|
+
* @method
|
|
7716
|
+
* @memberof Popper.modifiers
|
|
7717
|
+
* @argument {Object} data - The data object generated by `update` method
|
|
7718
|
+
* @returns {Object} The data object, properly modified
|
|
7719
|
+
*/
|
|
7720
|
+
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
7721
|
+
var order = this._options.preventOverflowOrder;
|
|
7722
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7723
|
+
|
|
7724
|
+
var check = {
|
|
7725
|
+
left: function () {
|
|
7726
|
+
var left = popper.left;
|
|
7727
|
+
if (popper.left < data.boundaries.left) {
|
|
7728
|
+
left = Math.max(popper.left, data.boundaries.left);
|
|
7729
|
+
}
|
|
7730
|
+
return { left: left };
|
|
7731
|
+
},
|
|
7732
|
+
right: function () {
|
|
7733
|
+
var left = popper.left;
|
|
7734
|
+
if (popper.right > data.boundaries.right) {
|
|
7735
|
+
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
7736
|
+
}
|
|
7737
|
+
return { left: left };
|
|
7738
|
+
},
|
|
7739
|
+
top: function () {
|
|
7740
|
+
var top = popper.top;
|
|
7741
|
+
if (popper.top < data.boundaries.top) {
|
|
7742
|
+
top = Math.max(popper.top, data.boundaries.top);
|
|
7743
|
+
}
|
|
7744
|
+
return { top: top };
|
|
7745
|
+
},
|
|
7746
|
+
bottom: function () {
|
|
7747
|
+
var top = popper.top;
|
|
7748
|
+
if (popper.bottom > data.boundaries.bottom) {
|
|
7749
|
+
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
7750
|
+
}
|
|
7751
|
+
return { top: top };
|
|
7752
|
+
}
|
|
7753
|
+
};
|
|
7754
|
+
|
|
7755
|
+
order.forEach(function (direction) {
|
|
7756
|
+
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
7757
|
+
});
|
|
7758
|
+
|
|
7759
|
+
return data;
|
|
7760
|
+
};
|
|
7761
|
+
|
|
7762
|
+
/**
|
|
7763
|
+
* Modifier used to make sure the popper is always near its reference
|
|
7764
|
+
* @method
|
|
7765
|
+
* @memberof Popper.modifiers
|
|
7766
|
+
* @argument {Object} data - The data object generated by _update method
|
|
7767
|
+
* @returns {Object} The data object, properly modified
|
|
7768
|
+
*/
|
|
7769
|
+
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
7770
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7771
|
+
var reference = data.offsets.reference;
|
|
7772
|
+
var f = Math.floor;
|
|
7773
|
+
|
|
7774
|
+
if (popper.right < f(reference.left)) {
|
|
7775
|
+
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
7776
|
+
}
|
|
7777
|
+
if (popper.left > f(reference.right)) {
|
|
7778
|
+
data.offsets.popper.left = f(reference.right);
|
|
7779
|
+
}
|
|
7780
|
+
if (popper.bottom < f(reference.top)) {
|
|
7781
|
+
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
7782
|
+
}
|
|
7783
|
+
if (popper.top > f(reference.bottom)) {
|
|
7784
|
+
data.offsets.popper.top = f(reference.bottom);
|
|
7785
|
+
}
|
|
7786
|
+
|
|
7787
|
+
return data;
|
|
7788
|
+
};
|
|
7789
|
+
|
|
7790
|
+
/**
|
|
7791
|
+
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
|
|
7792
|
+
* Requires the `preventOverflow` modifier before it in order to work.
|
|
7793
|
+
* **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
|
|
7794
|
+
* @method
|
|
7795
|
+
* @memberof Popper.modifiers
|
|
7796
|
+
* @argument {Object} data - The data object generated by _update method
|
|
7797
|
+
* @returns {Object} The data object, properly modified
|
|
7798
|
+
*/
|
|
7799
|
+
Popper.prototype.modifiers.flip = function (data) {
|
|
7800
|
+
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
7801
|
+
// otherwise flip would not work as expected.
|
|
7802
|
+
if (
|
|
7803
|
+
!this.isModifierRequired(
|
|
7804
|
+
this.modifiers.flip,
|
|
7805
|
+
this.modifiers.preventOverflow
|
|
7806
|
+
)
|
|
7807
|
+
) {
|
|
7808
|
+
console.warn(
|
|
7809
|
+
'WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!'
|
|
7810
|
+
);
|
|
7811
|
+
return data;
|
|
7812
|
+
}
|
|
7813
|
+
|
|
7814
|
+
if (data.flipped && data.placement === data._originalPlacement) {
|
|
7815
|
+
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
7816
|
+
return data;
|
|
7817
|
+
}
|
|
7818
|
+
|
|
7819
|
+
var placement = data.placement.split('-')[0];
|
|
7820
|
+
var placementOpposite = getOppositePlacement(placement);
|
|
7821
|
+
var variation = data.placement.split('-')[1] || '';
|
|
7822
|
+
|
|
7823
|
+
var flipOrder = [];
|
|
7824
|
+
if (this._options.flipBehavior === 'flip') {
|
|
7825
|
+
flipOrder = [placement, placementOpposite];
|
|
7826
|
+
} else {
|
|
7827
|
+
flipOrder = this._options.flipBehavior;
|
|
7828
|
+
}
|
|
7829
|
+
|
|
7830
|
+
flipOrder.forEach(
|
|
7831
|
+
function (step, index) {
|
|
7832
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
|
7833
|
+
return;
|
|
7834
|
+
}
|
|
7835
|
+
|
|
7836
|
+
placement = data.placement.split('-')[0];
|
|
7837
|
+
placementOpposite = getOppositePlacement(placement);
|
|
7838
|
+
|
|
7839
|
+
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
7840
|
+
|
|
7841
|
+
// this boolean is used to distinguish right and bottom from top and left
|
|
7842
|
+
// they need different computations to get flipped
|
|
7843
|
+
var a = ['right', 'bottom'].indexOf(placement) !== -1;
|
|
7844
|
+
|
|
7845
|
+
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
|
|
7846
|
+
if (
|
|
7847
|
+
(a &&
|
|
7848
|
+
Math.floor(data.offsets.reference[placement]) >
|
|
7849
|
+
Math.floor(popperOffsets[placementOpposite])) ||
|
|
7850
|
+
(!a &&
|
|
7851
|
+
Math.floor(data.offsets.reference[placement]) <
|
|
7852
|
+
Math.floor(popperOffsets[placementOpposite]))
|
|
7853
|
+
) {
|
|
7854
|
+
// we'll use this boolean to detect any flip loop
|
|
7855
|
+
data.flipped = true;
|
|
7856
|
+
data.placement = flipOrder[index + 1];
|
|
7857
|
+
if (variation) {
|
|
7858
|
+
data.placement += '-' + variation;
|
|
7859
|
+
}
|
|
7860
|
+
data.offsets.popper = this._getOffsets(
|
|
7861
|
+
this._popper,
|
|
7862
|
+
this._reference,
|
|
7863
|
+
data.placement
|
|
7864
|
+
).popper;
|
|
7865
|
+
|
|
7866
|
+
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
7867
|
+
}
|
|
7868
|
+
}.bind(this)
|
|
7869
|
+
);
|
|
7870
|
+
return data;
|
|
7871
|
+
};
|
|
7872
|
+
|
|
7873
|
+
/**
|
|
7874
|
+
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
|
|
7875
|
+
* The offsets will shift the popper on the side of its reference element.
|
|
7876
|
+
* @method
|
|
7877
|
+
* @memberof Popper.modifiers
|
|
7878
|
+
* @argument {Object} data - The data object generated by _update method
|
|
7879
|
+
* @returns {Object} The data object, properly modified
|
|
7880
|
+
*/
|
|
7881
|
+
Popper.prototype.modifiers.offset = function (data) {
|
|
7882
|
+
var offset = this._options.offset;
|
|
7883
|
+
var popper = data.offsets.popper;
|
|
7884
|
+
|
|
7885
|
+
if (data.placement.indexOf('left') !== -1) {
|
|
7886
|
+
popper.top -= offset;
|
|
7887
|
+
} else if (data.placement.indexOf('right') !== -1) {
|
|
7888
|
+
popper.top += offset;
|
|
7889
|
+
} else if (data.placement.indexOf('top') !== -1) {
|
|
7890
|
+
popper.left -= offset;
|
|
7891
|
+
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
7892
|
+
popper.left += offset;
|
|
7893
|
+
}
|
|
7894
|
+
return data;
|
|
7895
|
+
};
|
|
7896
|
+
|
|
7897
|
+
/**
|
|
7898
|
+
* Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element
|
|
7899
|
+
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
|
|
7900
|
+
* @method
|
|
7901
|
+
* @memberof Popper.modifiers
|
|
7902
|
+
* @argument {Object} data - The data object generated by _update method
|
|
7903
|
+
* @returns {Object} The data object, properly modified
|
|
7904
|
+
*/
|
|
7905
|
+
Popper.prototype.modifiers.arrow = function (data) {
|
|
7906
|
+
var arrow = this._options.arrowElement;
|
|
7907
|
+
var arrowOffset = this._options.arrowOffset;
|
|
7908
|
+
|
|
7909
|
+
// if the arrowElement is a string, suppose it's a CSS selector
|
|
7910
|
+
if (typeof arrow === 'string') {
|
|
7911
|
+
arrow = this._popper.querySelector(arrow);
|
|
7912
|
+
}
|
|
7913
|
+
|
|
7914
|
+
// if arrow element is not found, don't run the modifier
|
|
7915
|
+
if (!arrow) {
|
|
7916
|
+
return data;
|
|
7917
|
+
}
|
|
7918
|
+
|
|
7919
|
+
// the arrow element must be child of its popper
|
|
7920
|
+
if (!this._popper.contains(arrow)) {
|
|
7921
|
+
console.warn(
|
|
7922
|
+
'WARNING: `arrowElement` must be child of its popper element!'
|
|
7923
|
+
);
|
|
7924
|
+
return data;
|
|
7925
|
+
}
|
|
7926
|
+
|
|
7927
|
+
// arrow depends on keepTogether in order to work
|
|
7928
|
+
if (
|
|
7929
|
+
!this.isModifierRequired(
|
|
7930
|
+
this.modifiers.arrow,
|
|
7931
|
+
this.modifiers.keepTogether
|
|
7932
|
+
)
|
|
7933
|
+
) {
|
|
7934
|
+
console.warn(
|
|
7935
|
+
'WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'
|
|
7936
|
+
);
|
|
7937
|
+
return data;
|
|
7938
|
+
}
|
|
7939
|
+
|
|
7940
|
+
var arrowStyle = {};
|
|
7941
|
+
var placement = data.placement.split('-')[0];
|
|
7942
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7943
|
+
var reference = data.offsets.reference;
|
|
7944
|
+
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
7945
|
+
|
|
7946
|
+
var len = isVertical ? 'height' : 'width';
|
|
7947
|
+
var side = isVertical ? 'top' : 'left';
|
|
7948
|
+
var translate = isVertical ? 'translateY' : 'translateX';
|
|
7949
|
+
var altSide = isVertical ? 'left' : 'top';
|
|
7950
|
+
var opSide = isVertical ? 'bottom' : 'right';
|
|
7951
|
+
var arrowSize = getOuterSizes(arrow)[len];
|
|
7952
|
+
|
|
7953
|
+
//
|
|
7954
|
+
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
|
|
7955
|
+
//
|
|
7956
|
+
|
|
7957
|
+
// top/left side
|
|
7958
|
+
if (reference[opSide] - arrowSize < popper[side]) {
|
|
7959
|
+
data.offsets.popper[side] -=
|
|
7960
|
+
popper[side] - (reference[opSide] - arrowSize);
|
|
7961
|
+
}
|
|
7962
|
+
// bottom/right side
|
|
7963
|
+
if (reference[side] + arrowSize > popper[opSide]) {
|
|
7964
|
+
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7967
|
+
// compute center of the popper
|
|
7968
|
+
var center =
|
|
7969
|
+
reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
7970
|
+
|
|
7971
|
+
var sideValue = center - popper[side];
|
|
7972
|
+
|
|
7973
|
+
// prevent arrow from being placed not contiguously to its popper
|
|
7974
|
+
sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
|
|
7975
|
+
arrowStyle[side] = sideValue;
|
|
7976
|
+
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
|
|
7977
|
+
|
|
7978
|
+
data.offsets.arrow = arrowStyle;
|
|
7979
|
+
data.arrowElement = arrow;
|
|
7980
|
+
|
|
7981
|
+
return data;
|
|
7982
|
+
};
|
|
7983
|
+
|
|
7984
|
+
//
|
|
7985
|
+
// Helpers
|
|
7986
|
+
//
|
|
7987
|
+
|
|
7988
|
+
/**
|
|
7989
|
+
* Get the outer sizes of the given element (offset size + margins)
|
|
7990
|
+
* @function
|
|
7991
|
+
* @ignore
|
|
7992
|
+
* @argument {Element} element
|
|
7993
|
+
* @returns {Object} object containing width and height properties
|
|
7994
|
+
*/
|
|
7995
|
+
function getOuterSizes(element) {
|
|
7996
|
+
// NOTE: 1 DOM access here
|
|
7997
|
+
var _display = element.style.display,
|
|
7998
|
+
_visibility = element.style.visibility;
|
|
7999
|
+
element.style.display = 'block';
|
|
8000
|
+
element.style.visibility = 'hidden';
|
|
8001
|
+
var calcWidthToForceRepaint = element.offsetWidth;
|
|
8002
|
+
// original method
|
|
8003
|
+
var styles = root.getComputedStyle(element);
|
|
8004
|
+
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
8005
|
+
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
8006
|
+
var result = {
|
|
8007
|
+
width: element.offsetWidth + y,
|
|
8008
|
+
height: element.offsetHeight + x
|
|
8009
|
+
};
|
|
8010
|
+
|
|
8011
|
+
// reset element styles
|
|
8012
|
+
element.style.display = _display;
|
|
8013
|
+
element.style.visibility = _visibility;
|
|
8014
|
+
return result;
|
|
8015
|
+
}
|
|
8016
|
+
|
|
8017
|
+
/**
|
|
8018
|
+
* Get the opposite placement of the given one/
|
|
8019
|
+
* @function
|
|
8020
|
+
* @ignore
|
|
8021
|
+
* @argument {String} placement
|
|
8022
|
+
* @returns {String} flipped placement
|
|
8023
|
+
*/
|
|
8024
|
+
function getOppositePlacement(placement) {
|
|
8025
|
+
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
8026
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
8027
|
+
return hash[matched];
|
|
8028
|
+
});
|
|
8029
|
+
}
|
|
8030
|
+
|
|
8031
|
+
/**
|
|
8032
|
+
* Given the popper offsets, generate an output similar to getBoundingClientRect
|
|
8033
|
+
* @function
|
|
8034
|
+
* @ignore
|
|
8035
|
+
* @argument {Object} popperOffsets
|
|
8036
|
+
* @returns {Object} ClientRect like output
|
|
8037
|
+
*/
|
|
8038
|
+
function getPopperClientRect(popperOffsets) {
|
|
8039
|
+
var offsets = Object.assign({}, popperOffsets);
|
|
8040
|
+
offsets.right = offsets.left + offsets.width;
|
|
8041
|
+
offsets.bottom = offsets.top + offsets.height;
|
|
8042
|
+
return offsets;
|
|
8043
|
+
}
|
|
8044
|
+
|
|
8045
|
+
/**
|
|
8046
|
+
* Given an array and the key to find, returns its index
|
|
8047
|
+
* @function
|
|
8048
|
+
* @ignore
|
|
8049
|
+
* @argument {Array} arr
|
|
8050
|
+
* @argument keyToFind
|
|
8051
|
+
* @returns index or null
|
|
8052
|
+
*/
|
|
8053
|
+
function getArrayKeyIndex(arr, keyToFind) {
|
|
8054
|
+
var i = 0,
|
|
8055
|
+
key;
|
|
8056
|
+
for (key in arr) {
|
|
8057
|
+
if (arr[key] === keyToFind) {
|
|
8058
|
+
return i;
|
|
8059
|
+
}
|
|
8060
|
+
i++;
|
|
8061
|
+
}
|
|
8062
|
+
return null;
|
|
8063
|
+
}
|
|
8064
|
+
|
|
8065
|
+
/**
|
|
8066
|
+
* Get CSS computed property of the given element
|
|
8067
|
+
* @function
|
|
8068
|
+
* @ignore
|
|
8069
|
+
* @argument {Eement} element
|
|
8070
|
+
* @argument {String} property
|
|
8071
|
+
*/
|
|
8072
|
+
function getStyleComputedProperty(element, property) {
|
|
8073
|
+
// NOTE: 1 DOM access here
|
|
8074
|
+
var css = root.getComputedStyle(element, null);
|
|
8075
|
+
return css[property];
|
|
8076
|
+
}
|
|
8077
|
+
/**
|
|
8078
|
+
* Returns the offset parent of the given element
|
|
8079
|
+
* @function
|
|
8080
|
+
* @ignore
|
|
8081
|
+
* @argument {Element} element
|
|
8082
|
+
* @returns {Element} offset parent
|
|
8083
|
+
*/
|
|
8084
|
+
function getOffsetParent(element) {
|
|
8085
|
+
var offsetParent = element.offsetParent;
|
|
8086
|
+
return offsetParent === root.document.body || !offsetParent
|
|
8087
|
+
? root.document.documentElement
|
|
8088
|
+
: offsetParent;
|
|
8089
|
+
}
|
|
8090
|
+
|
|
8091
|
+
/**
|
|
8092
|
+
* Returns the scrolling parent of the given element
|
|
8093
|
+
* @function
|
|
8094
|
+
* @ignore
|
|
8095
|
+
* @argument {Element} element
|
|
8096
|
+
* @returns {Element} offset parent
|
|
8097
|
+
*/
|
|
8098
|
+
function getScrollParent(element) {
|
|
8099
|
+
var parent = element.parentNode;
|
|
8100
|
+
if (!parent || parent.nodeType !== 1) {
|
|
8101
|
+
return element;
|
|
8102
|
+
}
|
|
8103
|
+
|
|
8104
|
+
if (parent === root.document) {
|
|
8105
|
+
// Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
|
|
8106
|
+
// greater than 0 and return the proper element
|
|
8107
|
+
if (root.document.body.scrollTop || root.document.body.scrollLeft) {
|
|
8108
|
+
return root.document.body;
|
|
8109
|
+
} else {
|
|
8110
|
+
return root.document.documentElement;
|
|
8111
|
+
}
|
|
8112
|
+
}
|
|
8113
|
+
|
|
8114
|
+
// Firefox want us to check `-x` and `-y` variations as well
|
|
8115
|
+
if (
|
|
8116
|
+
['scroll', 'auto'].indexOf(
|
|
8117
|
+
getStyleComputedProperty(parent, 'overflow')
|
|
8118
|
+
) !== -1 ||
|
|
8119
|
+
['scroll', 'auto'].indexOf(
|
|
8120
|
+
getStyleComputedProperty(parent, 'overflow-x')
|
|
8121
|
+
) !== -1 ||
|
|
8122
|
+
['scroll', 'auto'].indexOf(
|
|
8123
|
+
getStyleComputedProperty(parent, 'overflow-y')
|
|
8124
|
+
) !== -1
|
|
8125
|
+
) {
|
|
8126
|
+
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
8127
|
+
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
8128
|
+
// fixes issue #65
|
|
8129
|
+
return parent;
|
|
8130
|
+
}
|
|
8131
|
+
return getScrollParent(element.parentNode);
|
|
8132
|
+
}
|
|
8133
|
+
|
|
8134
|
+
/**
|
|
8135
|
+
* Check if the given element is fixed or is inside a fixed parent
|
|
8136
|
+
* @function
|
|
8137
|
+
* @ignore
|
|
8138
|
+
* @argument {Element} element
|
|
8139
|
+
* @argument {Element} customContainer
|
|
8140
|
+
* @returns {Boolean} answer to "isFixed?"
|
|
8141
|
+
*/
|
|
8142
|
+
function isFixed(element) {
|
|
8143
|
+
if (element === root.document.body) {
|
|
8144
|
+
return false;
|
|
8145
|
+
}
|
|
8146
|
+
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
8147
|
+
return true;
|
|
8148
|
+
}
|
|
8149
|
+
return element.parentNode && element.parentNode.nodeType === 1
|
|
8150
|
+
? isFixed(element.parentNode)
|
|
8151
|
+
: element;
|
|
8152
|
+
}
|
|
8153
|
+
|
|
8154
|
+
/**
|
|
8155
|
+
* Set the style to the given popper
|
|
8156
|
+
* @function
|
|
8157
|
+
* @ignore
|
|
8158
|
+
* @argument {Element} element - Element to apply the style to
|
|
8159
|
+
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
|
|
8160
|
+
*/
|
|
8161
|
+
function setStyle(element, styles) {
|
|
8162
|
+
function is_numeric(n) {
|
|
8163
|
+
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
8164
|
+
}
|
|
8165
|
+
Object.keys(styles).forEach(function (prop) {
|
|
8166
|
+
var unit = '';
|
|
8167
|
+
// add unit if the value is numeric and is one of the following
|
|
8168
|
+
if (
|
|
8169
|
+
['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==
|
|
8170
|
+
-1 &&
|
|
8171
|
+
is_numeric(styles[prop])
|
|
8172
|
+
) {
|
|
8173
|
+
unit = 'px';
|
|
8174
|
+
}
|
|
8175
|
+
element.style[prop] = styles[prop] + unit;
|
|
8176
|
+
});
|
|
8177
|
+
}
|
|
8178
|
+
|
|
8179
|
+
/**
|
|
8180
|
+
* Check if the given variable is a function
|
|
8181
|
+
* @function
|
|
8182
|
+
* @ignore
|
|
8183
|
+
* @argument {*} functionToCheck - variable to check
|
|
8184
|
+
* @returns {Boolean} answer to: is a function?
|
|
8185
|
+
*/
|
|
8186
|
+
function isFunction(functionToCheck) {
|
|
8187
|
+
var getType = {};
|
|
8188
|
+
return (
|
|
8189
|
+
functionToCheck &&
|
|
8190
|
+
getType.toString.call(functionToCheck) === '[object Function]'
|
|
8191
|
+
);
|
|
8192
|
+
}
|
|
8193
|
+
|
|
8194
|
+
/**
|
|
8195
|
+
* Get the position of the given element, relative to its offset parent
|
|
8196
|
+
* @function
|
|
8197
|
+
* @ignore
|
|
8198
|
+
* @param {Element} element
|
|
8199
|
+
* @return {Object} position - Coordinates of the element and its `scrollTop`
|
|
8200
|
+
*/
|
|
8201
|
+
function getOffsetRect(element) {
|
|
8202
|
+
var transform = getStyle(element, 'transform')
|
|
8203
|
+
.replace(/[^0-9\-,]/g, '')
|
|
8204
|
+
.split(',');
|
|
8205
|
+
var elementRect = {
|
|
8206
|
+
width: element.offsetWidth,
|
|
8207
|
+
height: element.offsetHeight,
|
|
8208
|
+
left:
|
|
8209
|
+
element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
|
|
8210
|
+
top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
|
|
8211
|
+
};
|
|
8212
|
+
|
|
8213
|
+
elementRect.right = elementRect.left + elementRect.width;
|
|
8214
|
+
elementRect.bottom = elementRect.top + elementRect.height;
|
|
8215
|
+
|
|
8216
|
+
// position
|
|
8217
|
+
return elementRect;
|
|
8218
|
+
}
|
|
8219
|
+
|
|
8220
|
+
/**
|
|
8221
|
+
* Get bounding client rect of given element
|
|
8222
|
+
* @function
|
|
8223
|
+
* @ignore
|
|
8224
|
+
* @param {HTMLElement} element
|
|
8225
|
+
* @return {Object} client rect
|
|
8226
|
+
*/
|
|
8227
|
+
function getBoundingClientRect(element) {
|
|
8228
|
+
var rect = element.getBoundingClientRect();
|
|
8229
|
+
|
|
8230
|
+
// whether the IE version is lower than 11
|
|
8231
|
+
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
8232
|
+
|
|
8233
|
+
// fix ie document bounding top always 0 bug
|
|
8234
|
+
var rectTop =
|
|
8235
|
+
isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
|
|
8236
|
+
|
|
8237
|
+
return {
|
|
8238
|
+
left: rect.left,
|
|
8239
|
+
top: rectTop,
|
|
8240
|
+
right: rect.right,
|
|
8241
|
+
bottom: rect.bottom,
|
|
8242
|
+
width: rect.right - rect.left,
|
|
8243
|
+
height: rect.bottom - rectTop
|
|
8244
|
+
};
|
|
8245
|
+
}
|
|
8246
|
+
|
|
8247
|
+
function getStyle(dom, attr) {
|
|
8248
|
+
if (dom.style[attr]) {
|
|
8249
|
+
return dom.style[attr];
|
|
8250
|
+
}
|
|
8251
|
+
if (window.getComputedStyle) {
|
|
8252
|
+
return getComputedStyle(dom, null)[attr];
|
|
8253
|
+
}
|
|
8254
|
+
return dom.currentStyle[attr];
|
|
8255
|
+
}
|
|
8256
|
+
|
|
8257
|
+
/**
|
|
8258
|
+
* Given an element and one of its parents, return the offset
|
|
8259
|
+
* @function
|
|
8260
|
+
* @ignore
|
|
8261
|
+
* @param {HTMLElement} element
|
|
8262
|
+
* @param {HTMLElement} parent
|
|
8263
|
+
* @return {Object} rect
|
|
8264
|
+
*/
|
|
8265
|
+
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
8266
|
+
var elementRect = getBoundingClientRect(element);
|
|
8267
|
+
var parentRect = getBoundingClientRect(parent);
|
|
8268
|
+
|
|
8269
|
+
if (fixed) {
|
|
8270
|
+
var scrollParent = getScrollParent(parent);
|
|
8271
|
+
parentRect.top += scrollParent.scrollTop;
|
|
8272
|
+
parentRect.bottom += scrollParent.scrollTop;
|
|
8273
|
+
parentRect.left += scrollParent.scrollLeft;
|
|
8274
|
+
parentRect.right += scrollParent.scrollLeft;
|
|
8275
|
+
}
|
|
8276
|
+
|
|
8277
|
+
var rect = {
|
|
8278
|
+
top: elementRect.top - parentRect.top,
|
|
8279
|
+
left: elementRect.left - parentRect.left,
|
|
8280
|
+
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
8281
|
+
right: elementRect.left - parentRect.left + elementRect.width,
|
|
8282
|
+
width: elementRect.width,
|
|
8283
|
+
height: elementRect.height
|
|
8284
|
+
};
|
|
8285
|
+
return rect;
|
|
8286
|
+
}
|
|
8287
|
+
|
|
8288
|
+
/**
|
|
8289
|
+
* Get the prefixed supported property name
|
|
8290
|
+
* @function
|
|
8291
|
+
* @ignore
|
|
8292
|
+
* @argument {String} property (camelCase)
|
|
8293
|
+
* @returns {String} prefixed property (camelCase)
|
|
8294
|
+
*/
|
|
8295
|
+
function getSupportedPropertyName(property) {
|
|
8296
|
+
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
8297
|
+
|
|
8298
|
+
for (var i = 0; i < prefixes.length; i++) {
|
|
8299
|
+
var toCheck = prefixes[i]
|
|
8300
|
+
? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1)
|
|
8301
|
+
: property;
|
|
8302
|
+
if (typeof root.document.body.style[toCheck] !== 'undefined') {
|
|
8303
|
+
return toCheck;
|
|
8304
|
+
}
|
|
8305
|
+
}
|
|
8306
|
+
return null;
|
|
8307
|
+
}
|
|
8308
|
+
|
|
8309
|
+
/**
|
|
8310
|
+
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
|
|
8311
|
+
* objects to a target object. It will return the target object.
|
|
8312
|
+
* This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
|
|
8313
|
+
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
8314
|
+
* @function
|
|
8315
|
+
* @ignore
|
|
8316
|
+
*/
|
|
8317
|
+
if (!Object.assign) {
|
|
8318
|
+
Object.defineProperty(Object, 'assign', {
|
|
8319
|
+
enumerable: false,
|
|
8320
|
+
configurable: true,
|
|
8321
|
+
writable: true,
|
|
8322
|
+
value: function (target) {
|
|
8323
|
+
if (target === undefined || target === null) {
|
|
8324
|
+
throw new TypeError('Cannot convert first argument to object');
|
|
8325
|
+
}
|
|
8326
|
+
|
|
8327
|
+
var to = Object(target);
|
|
8328
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8329
|
+
var nextSource = arguments[i];
|
|
8330
|
+
if (nextSource === undefined || nextSource === null) {
|
|
8331
|
+
continue;
|
|
8332
|
+
}
|
|
8333
|
+
nextSource = Object(nextSource);
|
|
8334
|
+
|
|
8335
|
+
var keysArray = Object.keys(nextSource);
|
|
8336
|
+
for (
|
|
8337
|
+
var nextIndex = 0, len = keysArray.length;
|
|
8338
|
+
nextIndex < len;
|
|
8339
|
+
nextIndex++
|
|
8340
|
+
) {
|
|
8341
|
+
var nextKey = keysArray[nextIndex];
|
|
8342
|
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
8343
|
+
if (desc !== undefined && desc.enumerable) {
|
|
8344
|
+
to[nextKey] = nextSource[nextKey];
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
}
|
|
8348
|
+
return to;
|
|
8349
|
+
}
|
|
8350
|
+
});
|
|
8351
|
+
}
|
|
8352
|
+
|
|
8353
|
+
return Popper;
|
|
8354
|
+
});
|
|
8394
8355
|
|
|
8395
|
-
// 计算滑块应该移动到的位置(考虑鼠标在滑块内部的偏移量)
|
|
8396
|
-
var thumbPosition = mousePosition - prevPage;
|
|
8397
8356
|
|
|
8398
|
-
|
|
8399
|
-
var maxThumbPosition = this.$el[offset] - (this.$refs.thumb && this.$refs.thumb[offset] || 0);
|
|
8400
|
-
var clampedThumbPosition = Math.max(0, Math.min(thumbPosition, maxThumbPosition));
|
|
8357
|
+
/***/ }),
|
|
8401
8358
|
|
|
8402
|
-
|
|
8403
|
-
|
|
8359
|
+
/***/ 43:
|
|
8360
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
8404
8361
|
|
|
8405
|
-
|
|
8406
|
-
|
|
8362
|
+
"use strict";
|
|
8363
|
+
var aria = aria || {};
|
|
8407
8364
|
|
|
8408
|
-
|
|
8409
|
-
this.$emit('move', scroll, scrollPosition);
|
|
8410
|
-
},
|
|
8365
|
+
aria.Utils = aria.Utils || {};
|
|
8411
8366
|
|
|
8367
|
+
/**
|
|
8368
|
+
* @desc Set focus on descendant nodes until the first focusable element is
|
|
8369
|
+
* found.
|
|
8370
|
+
* @param element
|
|
8371
|
+
* DOM node for which to find the first focusable descendant.
|
|
8372
|
+
* @returns
|
|
8373
|
+
* true if a focusable element is found and focus is set.
|
|
8374
|
+
*/
|
|
8375
|
+
aria.Utils.focusFirstDescendant = function (element) {
|
|
8376
|
+
for (var i = 0; i < element.childNodes.length; i++) {
|
|
8377
|
+
var child = element.childNodes[i];
|
|
8378
|
+
if (aria.Utils.attemptFocus(child) || aria.Utils.focusFirstDescendant(child)) {
|
|
8379
|
+
return true;
|
|
8380
|
+
}
|
|
8381
|
+
}
|
|
8382
|
+
return false;
|
|
8383
|
+
};
|
|
8412
8384
|
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8385
|
+
/**
|
|
8386
|
+
* @desc Find the last descendant node that is focusable.
|
|
8387
|
+
* @param element
|
|
8388
|
+
* DOM node for which to find the last focusable descendant.
|
|
8389
|
+
* @returns
|
|
8390
|
+
* true if a focusable element is found and focus is set.
|
|
8391
|
+
*/
|
|
8419
8392
|
|
|
8420
|
-
|
|
8393
|
+
aria.Utils.focusLastDescendant = function (element) {
|
|
8394
|
+
for (var i = element.childNodes.length - 1; i >= 0; i--) {
|
|
8395
|
+
var child = element.childNodes[i];
|
|
8396
|
+
if (aria.Utils.attemptFocus(child) || aria.Utils.focusLastDescendant(child)) {
|
|
8397
|
+
return true;
|
|
8398
|
+
}
|
|
8399
|
+
}
|
|
8400
|
+
return false;
|
|
8401
|
+
};
|
|
8421
8402
|
|
|
8422
|
-
|
|
8423
|
-
|
|
8403
|
+
/**
|
|
8404
|
+
* @desc Set Attempt to set focus on the current node.
|
|
8405
|
+
* @param element
|
|
8406
|
+
* The node to attempt to focus on.
|
|
8407
|
+
* @returns
|
|
8408
|
+
* true if element is focused.
|
|
8409
|
+
*/
|
|
8410
|
+
aria.Utils.attemptFocus = function (element) {
|
|
8411
|
+
if (!aria.Utils.isFocusable(element)) {
|
|
8412
|
+
return false;
|
|
8413
|
+
}
|
|
8414
|
+
aria.Utils.IgnoreUtilFocusChanges = true;
|
|
8415
|
+
try {
|
|
8416
|
+
element.focus();
|
|
8417
|
+
} catch (e) {}
|
|
8418
|
+
aria.Utils.IgnoreUtilFocusChanges = false;
|
|
8419
|
+
return document.activeElement === element;
|
|
8420
|
+
};
|
|
8424
8421
|
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8422
|
+
aria.Utils.isFocusable = function (element) {
|
|
8423
|
+
if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute('tabIndex') !== null) {
|
|
8424
|
+
return true;
|
|
8425
|
+
}
|
|
8428
8426
|
|
|
8427
|
+
if (element.disabled) {
|
|
8428
|
+
return false;
|
|
8429
|
+
}
|
|
8429
8430
|
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8431
|
+
switch (element.nodeName) {
|
|
8432
|
+
case 'A':
|
|
8433
|
+
return !!element.href && element.rel !== 'ignore';
|
|
8434
|
+
case 'INPUT':
|
|
8435
|
+
return element.type !== 'hidden' && element.type !== 'file';
|
|
8436
|
+
case 'BUTTON':
|
|
8437
|
+
case 'SELECT':
|
|
8438
|
+
case 'TEXTAREA':
|
|
8439
|
+
return true;
|
|
8440
|
+
default:
|
|
8441
|
+
return false;
|
|
8442
|
+
}
|
|
8443
|
+
};
|
|
8438
8444
|
|
|
8445
|
+
/**
|
|
8446
|
+
* 触发一个事件
|
|
8447
|
+
* mouseenter, mouseleave, mouseover, keyup, change, click 等
|
|
8448
|
+
* @param {Element} elm
|
|
8449
|
+
* @param {String} name
|
|
8450
|
+
* @param {*} opts
|
|
8451
|
+
*/
|
|
8452
|
+
aria.Utils.triggerEvent = function (elm, name) {
|
|
8453
|
+
var eventName = void 0;
|
|
8439
8454
|
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
}
|
|
8449
|
-
},
|
|
8455
|
+
if (/^mouse|click/.test(name)) {
|
|
8456
|
+
eventName = 'MouseEvents';
|
|
8457
|
+
} else if (/^key/.test(name)) {
|
|
8458
|
+
eventName = 'KeyboardEvent';
|
|
8459
|
+
} else {
|
|
8460
|
+
eventName = 'HTMLEvents';
|
|
8461
|
+
}
|
|
8462
|
+
var evt = document.createEvent(eventName);
|
|
8450
8463
|
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
move = this.move,
|
|
8455
|
-
barConfig = this.barConfig;
|
|
8464
|
+
for (var _len = arguments.length, opts = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
8465
|
+
opts[_key - 2] = arguments[_key];
|
|
8466
|
+
}
|
|
8456
8467
|
|
|
8468
|
+
evt.initEvent.apply(evt, [name].concat(opts));
|
|
8469
|
+
elm.dispatchEvent ? elm.dispatchEvent(evt) : elm.fireEvent('on' + name, evt);
|
|
8457
8470
|
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
{
|
|
8461
|
-
'class': ['es-scrollbar__bar', 'is-' + barConfig.key],
|
|
8462
|
-
on: {
|
|
8463
|
-
'mousedown': this.handleTrackClick
|
|
8464
|
-
}
|
|
8465
|
-
},
|
|
8466
|
-
[h('div', {
|
|
8467
|
-
ref: 'thumb',
|
|
8468
|
-
'class': 'es-scrollbar__thumb',
|
|
8469
|
-
on: {
|
|
8470
|
-
'mousedown': this.handleThumbClick
|
|
8471
|
-
},
|
|
8471
|
+
return elm;
|
|
8472
|
+
};
|
|
8472
8473
|
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8474
|
+
aria.Utils.keys = {
|
|
8475
|
+
tab: 9,
|
|
8476
|
+
enter: 13,
|
|
8477
|
+
space: 32,
|
|
8478
|
+
left: 37,
|
|
8479
|
+
up: 38,
|
|
8480
|
+
right: 39,
|
|
8481
|
+
down: 40,
|
|
8482
|
+
esc: 27
|
|
8483
|
+
};
|
|
8481
8484
|
|
|
8482
|
-
|
|
8483
|
-
this.restoreUserSelection();
|
|
8484
|
-
}
|
|
8485
|
-
});
|
|
8485
|
+
/* harmony default export */ __webpack_exports__["a"] = (aria.Utils);
|
|
8486
8486
|
|
|
8487
8487
|
/***/ }),
|
|
8488
8488
|
|
|
@@ -9985,7 +9985,7 @@ render._withStripped = true
|
|
|
9985
9985
|
// CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=template&id=744ca69a&
|
|
9986
9986
|
|
|
9987
9987
|
// EXTERNAL MODULE: ./src/utils/scrollbar.js
|
|
9988
|
-
var scrollbar = __webpack_require__(
|
|
9988
|
+
var scrollbar = __webpack_require__(14);
|
|
9989
9989
|
|
|
9990
9990
|
// EXTERNAL MODULE: ./packages/menu/src/mixins.js
|
|
9991
9991
|
var mixins = __webpack_require__(80);
|
|
@@ -9997,7 +9997,7 @@ var menu_mixin = __webpack_require__(76);
|
|
|
9997
9997
|
var emitter = __webpack_require__(10);
|
|
9998
9998
|
|
|
9999
9999
|
// EXTERNAL MODULE: ./src/utils/vue-popper.js
|
|
10000
|
-
var vue_popper = __webpack_require__(
|
|
10000
|
+
var vue_popper = __webpack_require__(13);
|
|
10001
10001
|
|
|
10002
10002
|
// EXTERNAL MODULE: ./packages/menu/src/menu-item.vue + 4 modules
|
|
10003
10003
|
var menu_item = __webpack_require__(57);
|