eoss 0.1.0-alpha.35 → 0.1.0-alpha.37
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/0.js +1 -1
- package/lib/1.js +1 -1
- package/lib/10.js +1 -1
- package/lib/11.js +1 -1
- package/lib/12.js +1 -1
- package/lib/13.js +1 -1
- package/lib/14.js +1 -1
- package/lib/15.js +1 -1
- package/lib/16.js +1 -1
- package/lib/17.js +1 -1
- package/lib/18.js +1 -1
- package/lib/19.js +1 -1
- package/lib/20.js +1 -1
- package/lib/21.js +1 -1
- package/lib/22.js +1 -1
- package/lib/23.js +1 -1
- package/lib/24.js +1 -1
- package/lib/25.js +1 -1
- package/lib/26.js +1 -1
- package/lib/27.js +1 -1
- package/lib/28.js +1 -1
- package/lib/29.js +1 -1
- package/lib/3.js +1 -1
- package/lib/30.js +1 -1
- package/lib/31.js +1 -1
- package/lib/32.js +1 -1
- package/lib/33.js +1 -1
- package/lib/34.js +1 -1
- package/lib/35.js +1 -1
- package/lib/36.js +1 -1
- package/lib/37.js +1 -1
- package/lib/38.js +1 -1
- package/lib/39.js +1 -1
- package/lib/4.js +1 -1
- package/lib/40.js +1 -1
- package/lib/41.js +1 -1
- package/lib/42.js +1 -1
- package/lib/43.js +1 -1
- package/lib/44.js +1 -1
- package/lib/45.js +1 -1
- package/lib/46.js +1 -1
- package/lib/47.js +1 -1
- package/lib/48.js +1 -1
- package/lib/49.js +1 -1
- package/lib/5.js +1 -1
- package/lib/50.js +1 -1
- package/lib/51.js +1 -1
- package/lib/52.js +1 -1
- package/lib/53.js +1 -1
- package/lib/54.js +1 -1
- package/lib/55.js +1 -1
- package/lib/56.js +1 -1
- package/lib/57.js +1 -1
- package/lib/58.js +1 -1
- package/lib/59.js +1 -1
- package/lib/6.js +1 -1
- package/lib/60.js +1 -1
- package/lib/61.js +1 -1
- package/lib/62.js +1 -1
- package/lib/63.js +1 -1
- package/lib/64.js +1 -1
- package/lib/65.js +1 -1
- package/lib/66.js +1 -1
- package/lib/67.js +1 -1
- package/lib/68.js +1 -1
- package/lib/69.js +1 -1
- package/lib/7.js +1 -1
- package/lib/70.js +1 -1
- package/lib/71.js +1 -1
- package/lib/72.js +1 -1
- package/lib/73.js +1 -1
- package/lib/74.js +1 -1
- package/lib/75.js +1 -1
- package/lib/76.js +1 -1
- package/lib/77.js +1 -1
- package/lib/78.js +1 -1
- package/lib/79.js +1 -1
- package/lib/8.js +1 -1
- package/lib/80.js +1 -1
- package/lib/81.js +1 -1
- package/lib/9.js +1 -1
- package/lib/account-login.js +1101 -1035
- package/lib/alert.js +2 -2
- package/lib/aside.js +2 -2
- package/lib/audit-trajectory.js +150 -150
- package/lib/autocomplete.js +2095 -1871
- package/lib/avatar.js +2 -2
- package/lib/backtop.js +2 -2
- package/lib/badge.js +2 -2
- package/lib/breadcrumb-item.js +4 -4
- package/lib/breadcrumb.js +4 -4
- package/lib/button-group.js +4 -4
- package/lib/button.js +2 -2
- package/lib/ca-login.js +862 -837
- package/lib/calendar.js +864 -839
- package/lib/card.js +2 -2
- package/lib/carousel-item.js +864 -839
- package/lib/carousel.js +866 -841
- package/lib/cascader-panel.js +878 -853
- package/lib/cascader.js +2325 -2101
- package/lib/checkbox-button.js +4 -4
- package/lib/checkbox-group.js +1060 -1025
- package/lib/checkbox.js +6 -6
- package/lib/col.js +2 -2
- package/lib/collapse-item.js +920 -895
- package/lib/collapse.js +913 -888
- package/lib/color-picker.js +1155 -956
- package/lib/container.js +2 -2
- package/lib/cron.js +18 -18
- package/lib/data-table.js +1053 -1018
- package/lib/date-picker.js +2094 -1870
- package/lib/descriptions-item.js +144 -0
- package/lib/descriptions.js +561 -0
- package/lib/dialog.js +943 -918
- package/lib/divider.js +2 -2
- package/lib/drawer.js +12 -12
- package/lib/dropdown-item.js +6 -6
- package/lib/dropdown-menu.js +1157 -958
- package/lib/dropdown.js +870 -845
- package/lib/email-login.js +1047 -1012
- package/lib/empty.js +2 -2
- package/lib/eoss.common.js +3493 -2313
- package/lib/flip.js +2 -2
- package/lib/flow-group.js +876 -851
- package/lib/flow.js +1184 -1149
- package/lib/flows.js +1080 -1045
- package/lib/footer.js +2 -2
- package/lib/form-item.js +877 -852
- package/lib/form.js +1123 -1087
- package/lib/guide.js +2 -2
- package/lib/header.js +2 -2
- package/lib/icon.js +1009 -984
- package/lib/icons.js +6 -6
- package/lib/image-viewer.js +862 -837
- package/lib/image.js +4 -4
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +2 -2
- package/lib/input-number.js +6 -6
- package/lib/input.js +870 -845
- package/lib/link.js +2 -2
- package/lib/loading.js +13 -13
- package/lib/login.js +1116 -1066
- package/lib/lowcode-view.js +1078 -1043
- package/lib/lowcode.js +1131 -1096
- package/lib/main.js +1185 -1148
- package/lib/marquee.js +862 -837
- package/lib/menu-item-group.js +20 -17
- package/lib/menu-item.js +8 -8
- package/lib/menu.js +2390 -2164
- package/lib/message-box.js +950 -925
- package/lib/message.js +941 -916
- package/lib/notification.js +962 -937
- package/lib/option-group.js +4 -4
- package/lib/option.js +871 -846
- package/lib/page-header.js +2 -2
- package/lib/pagination.js +866 -841
- package/lib/phone-login.js +1049 -1014
- package/lib/popconfirm.js +4 -4
- package/lib/popover.js +2100 -1876
- package/lib/process-config.js +1065 -1030
- package/lib/process-module.js +1053 -1018
- package/lib/process-rule.js +1062 -1027
- package/lib/progress.js +2 -2
- package/lib/qr-code.js +4 -4
- package/lib/qrcode-login.js +1052 -1017
- package/lib/radio-button.js +4 -4
- package/lib/radio-group.js +2608 -2573
- package/lib/radio.js +6 -6
- package/lib/rate.js +864 -839
- package/lib/retrial-auth.js +7063 -0
- package/lib/row.js +2 -2
- package/lib/scrollbar.js +868 -843
- package/lib/select.js +2591 -2357
- package/lib/selector-panel.js +2659 -2624
- package/lib/selector.js +1068 -1033
- package/lib/slider.js +6 -6
- package/lib/step.js +44 -44
- package/lib/steps.js +911 -886
- package/lib/submenu.js +1439 -1236
- package/lib/switch.js +866 -841
- package/lib/tab-pane.js +4 -4
- package/lib/table-column.js +936 -911
- package/lib/table.js +2318 -2084
- package/lib/tabs.js +866 -841
- package/lib/tag.js +2 -2
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/descriptions.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/retrial-auth.css +1 -0
- package/lib/time-picker.js +2047 -1823
- package/lib/time-select.js +2041 -1817
- package/lib/timeline-item.js +2 -2
- package/lib/timeline.js +2 -2
- package/lib/tips.js +1047 -1012
- package/lib/toolbar.js +36 -17
- package/lib/tooltip.js +2080 -1856
- package/lib/transfer.js +881 -856
- package/lib/tree-group.js +1020 -995
- package/lib/tree.js +1062 -1027
- package/lib/update-history.js +151 -151
- package/lib/upload.js +1082 -1047
- package/lib/utils/ajax.js +5 -1
- package/lib/utils/popper.js +97 -48
- package/lib/wujie.js +866 -841
- package/package.json +1 -1
- package/packages/account-login/src/account-login.vue +29 -0
- package/packages/descriptions/index.js +8 -0
- package/packages/descriptions/src/index.js +181 -0
- package/packages/descriptions/src/item.js +30 -0
- package/packages/descriptions/src/row.js +120 -0
- package/packages/descriptions-item/index.js +8 -0
- package/packages/login/src/login.vue +8 -0
- package/packages/login/src/mixins.js +3 -1
- package/packages/main/src/minxs.js +1 -0
- package/packages/menu/src/menu.vue +0 -1
- package/packages/menu/src/mixins.js +4 -3
- package/packages/menu/src/submenu.vue +4 -4
- package/packages/retrial-auth/index.js +5 -0
- package/packages/retrial-auth/src/main.vue +300 -0
- package/packages/theme-chalk/src/base.scss +2 -1
- package/packages/theme-chalk/src/descriptions.scss +0 -1
- package/packages/theme-chalk/src/index.scss +3 -0
- package/packages/theme-chalk/src/retrial-auth.scss +38 -0
- package/packages/toolbar/src/toolbar.vue +5 -0
- package/src/index.js +336 -327
- package/src/utils/ajax.js +2 -1
- package/src/utils/popper.js +109 -70
package/lib/dropdown-menu.js
CHANGED
|
@@ -82,12 +82,12 @@ 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 = 237);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
|
-
/***/
|
|
90
|
+
/***/ 11:
|
|
91
91
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
92
92
|
|
|
93
93
|
"use strict";
|
|
@@ -303,7 +303,7 @@ if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
/* harmony default export */ __webpack_exports__["a"] = (PopupManager);
|
|
306
|
-
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(
|
|
306
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(45)))
|
|
307
307
|
|
|
308
308
|
/***/ }),
|
|
309
309
|
|
|
@@ -314,7 +314,7 @@ module.exports = require("vue");
|
|
|
314
314
|
|
|
315
315
|
/***/ }),
|
|
316
316
|
|
|
317
|
-
/***/
|
|
317
|
+
/***/ 22:
|
|
318
318
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
319
319
|
|
|
320
320
|
"use strict";
|
|
@@ -336,7 +336,7 @@ module.exports = require("vue");
|
|
|
336
336
|
|
|
337
337
|
/***/ }),
|
|
338
338
|
|
|
339
|
-
/***/
|
|
339
|
+
/***/ 23:
|
|
340
340
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
341
341
|
|
|
342
342
|
"use strict";
|
|
@@ -481,7 +481,7 @@ function scrollMove(wrap) {
|
|
|
481
481
|
|
|
482
482
|
/***/ }),
|
|
483
483
|
|
|
484
|
-
/***/
|
|
484
|
+
/***/ 237:
|
|
485
485
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
486
486
|
|
|
487
487
|
"use strict";
|
|
@@ -555,11 +555,11 @@ render._withStripped = true
|
|
|
555
555
|
var vue_popper = __webpack_require__(27);
|
|
556
556
|
|
|
557
557
|
// EXTERNAL MODULE: external "eoss/lib/dropdown-item"
|
|
558
|
-
var dropdown_item_ = __webpack_require__(
|
|
558
|
+
var dropdown_item_ = __webpack_require__(63);
|
|
559
559
|
var dropdown_item_default = /*#__PURE__*/__webpack_require__.n(dropdown_item_);
|
|
560
560
|
|
|
561
561
|
// EXTERNAL MODULE: external "eoss/lib/scrollbar"
|
|
562
|
-
var scrollbar_ = __webpack_require__(
|
|
562
|
+
var scrollbar_ = __webpack_require__(34);
|
|
563
563
|
var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
|
|
564
564
|
|
|
565
565
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/dropdown/src/dropdown-menu.vue?vue&type=script&lang=js&
|
|
@@ -858,11 +858,11 @@ dropdown_menu.install = function (Vue) {
|
|
|
858
858
|
"use strict";
|
|
859
859
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
860
860
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
861
|
-
/* harmony import */ var eoss_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
861
|
+
/* harmony import */ var eoss_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32);
|
|
862
862
|
|
|
863
863
|
|
|
864
864
|
|
|
865
|
-
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(
|
|
865
|
+
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(52);
|
|
866
866
|
var stopPropagation = function stopPropagation(e) {
|
|
867
867
|
return e.stopPropagation();
|
|
868
868
|
};
|
|
@@ -1123,17 +1123,17 @@ var stopPropagation = function stopPropagation(e) {
|
|
|
1123
1123
|
|
|
1124
1124
|
/***/ }),
|
|
1125
1125
|
|
|
1126
|
-
/***/
|
|
1126
|
+
/***/ 32:
|
|
1127
1127
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1128
1128
|
|
|
1129
1129
|
"use strict";
|
|
1130
1130
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
1131
1131
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
1132
|
-
/* harmony import */ var eoss_src_utils_merge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
1133
|
-
/* harmony import */ var eoss_src_utils_popup_popup_manager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
1132
|
+
/* harmony import */ var eoss_src_utils_merge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
|
|
1133
|
+
/* harmony import */ var eoss_src_utils_popup_popup_manager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11);
|
|
1134
1134
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return eoss_src_utils_popup_popup_manager__WEBPACK_IMPORTED_MODULE_2__["a"]; });
|
|
1135
1135
|
|
|
1136
|
-
/* harmony import */ var _scrollbar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
1136
|
+
/* harmony import */ var _scrollbar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23);
|
|
1137
1137
|
/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5);
|
|
1138
1138
|
|
|
1139
1139
|
|
|
@@ -1364,7 +1364,7 @@ var scrollBarWidth = void 0;
|
|
|
1364
1364
|
|
|
1365
1365
|
/***/ }),
|
|
1366
1366
|
|
|
1367
|
-
/***/
|
|
1367
|
+
/***/ 34:
|
|
1368
1368
|
/***/ (function(module, exports) {
|
|
1369
1369
|
|
|
1370
1370
|
module.exports = require("eoss/lib/scrollbar");
|
|
@@ -1476,7 +1476,7 @@ function normalizeComponent(
|
|
|
1476
1476
|
|
|
1477
1477
|
/***/ }),
|
|
1478
1478
|
|
|
1479
|
-
/***/
|
|
1479
|
+
/***/ 45:
|
|
1480
1480
|
/***/ (function(module, exports) {
|
|
1481
1481
|
|
|
1482
1482
|
var g;
|
|
@@ -1762,12 +1762,10 @@ function insertAfter(newEl, targetEl) {
|
|
|
1762
1762
|
|
|
1763
1763
|
/***/ }),
|
|
1764
1764
|
|
|
1765
|
-
/***/
|
|
1765
|
+
/***/ 52:
|
|
1766
1766
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1767
1767
|
|
|
1768
|
-
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__
|
|
1769
|
-
|
|
1770
|
-
/**
|
|
1768
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
1771
1769
|
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
1772
1770
|
* @version {{version}}
|
|
1773
1771
|
* @license
|
|
@@ -1790,60 +1788,68 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
1790
1788
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1791
1789
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1792
1790
|
* SOFTWARE.
|
|
1793
|
-
*/
|
|
1794
|
-
|
|
1795
|
-
//
|
|
1796
|
-
// Cross module loader
|
|
1797
|
-
// Supported: Node, AMD, Browser globals
|
|
1798
|
-
//
|
|
1799
|
-
(function (root, factory) {
|
|
1800
|
-
if (true) {
|
|
1801
|
-
// AMD. Register as an anonymous module.
|
|
1791
|
+
*/
|
|
1792
|
+
|
|
1793
|
+
//
|
|
1794
|
+
// Cross module loader
|
|
1795
|
+
// Supported: Node, AMD, Browser globals
|
|
1796
|
+
//
|
|
1797
|
+
(function (root, factory) {
|
|
1798
|
+
if (true) {
|
|
1799
|
+
// AMD. Register as an anonymous module.
|
|
1802
1800
|
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
1803
1801
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
1804
1802
|
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
1805
1803
|
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
1806
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
1807
|
-
} else {}
|
|
1808
|
-
})(this, function () {
|
|
1809
|
-
'use strict';
|
|
1810
|
-
|
|
1811
|
-
var root =
|
|
1812
|
-
// default options
|
|
1813
|
-
var DEFAULTS = {
|
|
1814
|
-
// placement of the popper
|
|
1815
|
-
placement: 'bottom',
|
|
1816
|
-
|
|
1817
|
-
gpuAcceleration: true,
|
|
1818
|
-
|
|
1819
|
-
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
1820
|
-
offset: 0,
|
|
1821
|
-
|
|
1822
|
-
// the element which will act as boundary of the popper
|
|
1823
|
-
boundariesElement: 'viewport',
|
|
1824
|
-
|
|
1825
|
-
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
1826
|
-
boundariesPadding: 5,
|
|
1827
|
-
|
|
1828
|
-
// popper will try to prevent overflow following this order,
|
|
1829
|
-
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
1830
|
-
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
1831
|
-
|
|
1832
|
-
// the behavior used by flip to change the placement of the popper
|
|
1833
|
-
flipBehavior: 'flip',
|
|
1834
|
-
|
|
1835
|
-
arrowElement: '[x-arrow]',
|
|
1836
|
-
|
|
1837
|
-
arrowOffset: 0,
|
|
1838
|
-
|
|
1839
|
-
// list of functions used to modify the offsets before they are applied to the popper
|
|
1840
|
-
modifiers: [
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1804
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
1805
|
+
} else {}
|
|
1806
|
+
})(this, function () {
|
|
1807
|
+
'use strict';
|
|
1808
|
+
|
|
1809
|
+
var root = window;
|
|
1810
|
+
// default options
|
|
1811
|
+
var DEFAULTS = {
|
|
1812
|
+
// placement of the popper
|
|
1813
|
+
placement: 'bottom',
|
|
1814
|
+
|
|
1815
|
+
gpuAcceleration: true,
|
|
1816
|
+
|
|
1817
|
+
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
1818
|
+
offset: 0,
|
|
1819
|
+
|
|
1820
|
+
// the element which will act as boundary of the popper
|
|
1821
|
+
boundariesElement: 'viewport',
|
|
1822
|
+
|
|
1823
|
+
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
1824
|
+
boundariesPadding: 5,
|
|
1825
|
+
|
|
1826
|
+
// popper will try to prevent overflow following this order,
|
|
1827
|
+
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
1828
|
+
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
1829
|
+
|
|
1830
|
+
// the behavior used by flip to change the placement of the popper
|
|
1831
|
+
flipBehavior: 'flip',
|
|
1832
|
+
|
|
1833
|
+
arrowElement: '[x-arrow]',
|
|
1834
|
+
|
|
1835
|
+
arrowOffset: 0,
|
|
1836
|
+
|
|
1837
|
+
// list of functions used to modify the offsets before they are applied to the popper
|
|
1838
|
+
modifiers: [
|
|
1839
|
+
'shift',
|
|
1840
|
+
'offset',
|
|
1841
|
+
'preventOverflow',
|
|
1842
|
+
'keepTogether',
|
|
1843
|
+
'arrow',
|
|
1844
|
+
'flip',
|
|
1845
|
+
'applyStyle'
|
|
1846
|
+
],
|
|
1847
|
+
|
|
1848
|
+
modifiersIgnored: [],
|
|
1849
|
+
|
|
1850
|
+
forceAbsolute: false
|
|
1851
|
+
};
|
|
1852
|
+
|
|
1847
1853
|
/**
|
|
1848
1854
|
* Create a new Popper.js instance
|
|
1849
1855
|
* @constructor Popper
|
|
@@ -1908,114 +1914,125 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
1908
1914
|
*
|
|
1909
1915
|
* @param {Boolean} [options.removeOnDestroy=false]
|
|
1910
1916
|
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
|
|
1911
|
-
*/
|
|
1912
|
-
function Popper(reference, popper, options) {
|
|
1913
|
-
this._reference = reference.jquery ? reference[0] : reference;
|
|
1914
|
-
this.state = {};
|
|
1915
|
-
|
|
1916
|
-
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
1917
|
-
// generate a default popper if is not defined
|
|
1918
|
-
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
1919
|
-
var isConfig =
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
this.
|
|
1952
|
-
|
|
1953
|
-
//
|
|
1954
|
-
this.
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1917
|
+
*/
|
|
1918
|
+
function Popper(reference, popper, options) {
|
|
1919
|
+
this._reference = reference.jquery ? reference[0] : reference;
|
|
1920
|
+
this.state = {};
|
|
1921
|
+
|
|
1922
|
+
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
1923
|
+
// generate a default popper if is not defined
|
|
1924
|
+
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
1925
|
+
var isConfig =
|
|
1926
|
+
popper && Object.prototype.toString.call(popper) === '[object Object]';
|
|
1927
|
+
if (isNotDefined || isConfig) {
|
|
1928
|
+
this._popper = this.parse(isConfig ? popper : {});
|
|
1929
|
+
}
|
|
1930
|
+
// otherwise, use the given HTMLElement as popper
|
|
1931
|
+
else {
|
|
1932
|
+
this._popper = popper.jquery ? popper[0] : popper;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
// with {} we create a new object with the options inside it
|
|
1936
|
+
this._options = Object.assign({}, DEFAULTS, options);
|
|
1937
|
+
|
|
1938
|
+
// refactoring modifiers' list
|
|
1939
|
+
this._options.modifiers = this._options.modifiers.map(
|
|
1940
|
+
function (modifier) {
|
|
1941
|
+
// remove ignored modifiers
|
|
1942
|
+
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
|
|
1943
|
+
|
|
1944
|
+
// set the x-placement attribute before everything else because it could be used to add margins to the popper
|
|
1945
|
+
// margins needs to be calculated to get the correct popper offsets
|
|
1946
|
+
if (modifier === 'applyStyle') {
|
|
1947
|
+
this._popper.setAttribute('x-placement', this._options.placement);
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
// return predefined modifier identified by string or keep the custom one
|
|
1951
|
+
return this.modifiers[modifier] || modifier;
|
|
1952
|
+
}.bind(this)
|
|
1953
|
+
);
|
|
1954
|
+
|
|
1955
|
+
// make sure to apply the popper position before any computation
|
|
1956
|
+
this.state.position = this._getPosition(this._popper, this._reference);
|
|
1957
|
+
setStyle(this._popper, { position: this.state.position, top: 0 });
|
|
1958
|
+
|
|
1959
|
+
// fire the first update to position the popper in the right place
|
|
1960
|
+
this.update();
|
|
1961
|
+
|
|
1962
|
+
// setup event listeners, they will take care of update the position in specific situations
|
|
1963
|
+
this._setupEventListeners();
|
|
1964
|
+
return this;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
//
|
|
1968
|
+
// Methods
|
|
1969
|
+
//
|
|
1961
1970
|
/**
|
|
1962
1971
|
* Destroy the popper
|
|
1963
1972
|
* @method
|
|
1964
1973
|
* @memberof Popper
|
|
1965
|
-
*/
|
|
1966
|
-
Popper.prototype.destroy = function () {
|
|
1967
|
-
this._popper.removeAttribute('x-placement');
|
|
1968
|
-
this._popper.style.left = '';
|
|
1969
|
-
this._popper.style.position = '';
|
|
1970
|
-
this._popper.style.top = '';
|
|
1971
|
-
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
1972
|
-
this._removeEventListeners();
|
|
1973
|
-
|
|
1974
|
-
// remove the popper if user explicity asked for the deletion on destroy
|
|
1975
|
-
if (this._options.removeOnDestroy) {
|
|
1976
|
-
this._popper.remove();
|
|
1977
|
-
}
|
|
1978
|
-
return this;
|
|
1979
|
-
};
|
|
1980
|
-
|
|
1974
|
+
*/
|
|
1975
|
+
Popper.prototype.destroy = function () {
|
|
1976
|
+
this._popper.removeAttribute('x-placement');
|
|
1977
|
+
this._popper.style.left = '';
|
|
1978
|
+
this._popper.style.position = '';
|
|
1979
|
+
this._popper.style.top = '';
|
|
1980
|
+
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
1981
|
+
this._removeEventListeners();
|
|
1982
|
+
|
|
1983
|
+
// remove the popper if user explicity asked for the deletion on destroy
|
|
1984
|
+
if (this._options.removeOnDestroy) {
|
|
1985
|
+
this._popper.remove();
|
|
1986
|
+
}
|
|
1987
|
+
return this;
|
|
1988
|
+
};
|
|
1989
|
+
|
|
1981
1990
|
/**
|
|
1982
1991
|
* Updates the position of the popper, computing the new offsets and applying the new style
|
|
1983
1992
|
* @method
|
|
1984
1993
|
* @memberof Popper
|
|
1985
|
-
*/
|
|
1986
|
-
Popper.prototype.update = function () {
|
|
1987
|
-
var data = { instance: this, styles: {} };
|
|
1988
|
-
|
|
1989
|
-
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
1990
|
-
// and refer to _originalPlacement to know the original value
|
|
1991
|
-
data.placement = this._options.placement;
|
|
1992
|
-
data._originalPlacement = this._options.placement;
|
|
1993
|
-
|
|
1994
|
-
// compute the popper and reference offsets and put them inside data.offsets
|
|
1995
|
-
data.offsets = this._getOffsets(
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
1994
|
+
*/
|
|
1995
|
+
Popper.prototype.update = function () {
|
|
1996
|
+
var data = { instance: this, styles: {} };
|
|
1997
|
+
|
|
1998
|
+
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
1999
|
+
// and refer to _originalPlacement to know the original value
|
|
2000
|
+
data.placement = this._options.placement;
|
|
2001
|
+
data._originalPlacement = this._options.placement;
|
|
2002
|
+
|
|
2003
|
+
// compute the popper and reference offsets and put them inside data.offsets
|
|
2004
|
+
data.offsets = this._getOffsets(
|
|
2005
|
+
this._popper,
|
|
2006
|
+
this._reference,
|
|
2007
|
+
data.placement
|
|
2008
|
+
);
|
|
2009
|
+
|
|
2010
|
+
// get boundaries
|
|
2011
|
+
data.boundaries = this._getBoundaries(
|
|
2012
|
+
data,
|
|
2013
|
+
this._options.boundariesPadding,
|
|
2014
|
+
this._options.boundariesElement
|
|
2015
|
+
);
|
|
2016
|
+
|
|
2017
|
+
data = this.runModifiers(data, this._options.modifiers);
|
|
2018
|
+
|
|
2019
|
+
if (typeof this.state.updateCallback === 'function') {
|
|
2020
|
+
this.state.updateCallback(data);
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
|
|
2007
2024
|
/**
|
|
2008
2025
|
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
|
|
2009
2026
|
* @method
|
|
2010
2027
|
* @memberof Popper
|
|
2011
2028
|
* @param {Function} callback
|
|
2012
|
-
*/
|
|
2013
|
-
Popper.prototype.onCreate = function (callback) {
|
|
2014
|
-
// the createCallbacks return as first argument the popper instance
|
|
2015
|
-
callback(this);
|
|
2016
|
-
return this;
|
|
2017
|
-
};
|
|
2018
|
-
|
|
2029
|
+
*/
|
|
2030
|
+
Popper.prototype.onCreate = function (callback) {
|
|
2031
|
+
// the createCallbacks return as first argument the popper instance
|
|
2032
|
+
callback(this);
|
|
2033
|
+
return this;
|
|
2034
|
+
};
|
|
2035
|
+
|
|
2019
2036
|
/**
|
|
2020
2037
|
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
|
|
2021
2038
|
* used to style popper and its arrow.
|
|
@@ -2023,93 +2040,101 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2023
2040
|
* @method
|
|
2024
2041
|
* @memberof Popper
|
|
2025
2042
|
* @param {Function} callback
|
|
2026
|
-
*/
|
|
2027
|
-
Popper.prototype.onUpdate = function (callback) {
|
|
2028
|
-
this.state.updateCallback = callback;
|
|
2029
|
-
return this;
|
|
2030
|
-
};
|
|
2031
|
-
|
|
2043
|
+
*/
|
|
2044
|
+
Popper.prototype.onUpdate = function (callback) {
|
|
2045
|
+
this.state.updateCallback = callback;
|
|
2046
|
+
return this;
|
|
2047
|
+
};
|
|
2048
|
+
|
|
2032
2049
|
/**
|
|
2033
2050
|
* Helper used to generate poppers from a configuration file
|
|
2034
2051
|
* @method
|
|
2035
2052
|
* @memberof Popper
|
|
2036
2053
|
* @param config {Object} configuration
|
|
2037
2054
|
* @returns {HTMLElement} popper
|
|
2038
|
-
*/
|
|
2039
|
-
Popper.prototype.parse = function (config) {
|
|
2040
|
-
var defaultConfig = {
|
|
2041
|
-
tagName: 'div',
|
|
2042
|
-
classNames: ['popper'],
|
|
2043
|
-
attributes: [],
|
|
2044
|
-
parent: root.document.body,
|
|
2045
|
-
content: '',
|
|
2046
|
-
contentType: 'text',
|
|
2047
|
-
arrowTagName: 'div',
|
|
2048
|
-
arrowClassNames: ['popper__arrow'],
|
|
2049
|
-
arrowAttributes: ['x-arrow']
|
|
2050
|
-
};
|
|
2051
|
-
config = Object.assign({}, defaultConfig, config);
|
|
2052
|
-
|
|
2053
|
-
var d = root.document;
|
|
2054
|
-
|
|
2055
|
-
var popper = d.createElement(config.tagName);
|
|
2056
|
-
addClassNames(popper, config.classNames);
|
|
2057
|
-
addAttributes(popper, config.attributes);
|
|
2058
|
-
if (config.contentType === 'node') {
|
|
2059
|
-
popper.appendChild(
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
} else {
|
|
2063
|
-
popper.
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
// if
|
|
2078
|
-
if
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
parent = parent[0];
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
//
|
|
2096
|
-
parent.
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2055
|
+
*/
|
|
2056
|
+
Popper.prototype.parse = function (config) {
|
|
2057
|
+
var defaultConfig = {
|
|
2058
|
+
tagName: 'div',
|
|
2059
|
+
classNames: ['popper'],
|
|
2060
|
+
attributes: [],
|
|
2061
|
+
parent: root.document.body,
|
|
2062
|
+
content: '',
|
|
2063
|
+
contentType: 'text',
|
|
2064
|
+
arrowTagName: 'div',
|
|
2065
|
+
arrowClassNames: ['popper__arrow'],
|
|
2066
|
+
arrowAttributes: ['x-arrow']
|
|
2067
|
+
};
|
|
2068
|
+
config = Object.assign({}, defaultConfig, config);
|
|
2069
|
+
|
|
2070
|
+
var d = root.document;
|
|
2071
|
+
|
|
2072
|
+
var popper = d.createElement(config.tagName);
|
|
2073
|
+
addClassNames(popper, config.classNames);
|
|
2074
|
+
addAttributes(popper, config.attributes);
|
|
2075
|
+
if (config.contentType === 'node') {
|
|
2076
|
+
popper.appendChild(
|
|
2077
|
+
config.content.jquery ? config.content[0] : config.content
|
|
2078
|
+
);
|
|
2079
|
+
} else if (config.contentType === 'html') {
|
|
2080
|
+
popper.innerHTML = config.content;
|
|
2081
|
+
} else {
|
|
2082
|
+
popper.textContent = config.content;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
if (config.arrowTagName) {
|
|
2086
|
+
var arrow = d.createElement(config.arrowTagName);
|
|
2087
|
+
addClassNames(arrow, config.arrowClassNames);
|
|
2088
|
+
addAttributes(arrow, config.arrowAttributes);
|
|
2089
|
+
popper.appendChild(arrow);
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
2093
|
+
|
|
2094
|
+
// if the given parent is a string, use it to match an element
|
|
2095
|
+
// if more than one element is matched, the first one will be used as parent
|
|
2096
|
+
// if no elements are matched, the script will throw an error
|
|
2097
|
+
if (typeof parent === 'string') {
|
|
2098
|
+
parent = d.querySelectorAll(config.parent);
|
|
2099
|
+
if (parent.length > 1) {
|
|
2100
|
+
console.warn(
|
|
2101
|
+
'WARNING: the given `parent` query(' +
|
|
2102
|
+
config.parent +
|
|
2103
|
+
') matched more than one element, the first one will be used'
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
2106
|
+
if (parent.length === 0) {
|
|
2107
|
+
throw "ERROR: the given `parent` doesn't exists!";
|
|
2108
|
+
}
|
|
2109
|
+
parent = parent[0];
|
|
2110
|
+
}
|
|
2111
|
+
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
|
|
2112
|
+
// the first one will be used as parent
|
|
2113
|
+
if (parent.length > 1 && parent instanceof Element === false) {
|
|
2114
|
+
console.warn(
|
|
2115
|
+
'WARNING: you have passed as parent a list of elements, the first one will be used'
|
|
2116
|
+
);
|
|
2117
|
+
parent = parent[0];
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
// append the generated popper to its parent
|
|
2121
|
+
parent.appendChild(popper);
|
|
2122
|
+
|
|
2123
|
+
return popper;
|
|
2124
|
+
|
|
2100
2125
|
/**
|
|
2101
2126
|
* Adds class names to the given element
|
|
2102
2127
|
* @function
|
|
2103
2128
|
* @ignore
|
|
2104
2129
|
* @param {HTMLElement} target
|
|
2105
2130
|
* @param {Array} classes
|
|
2106
|
-
*/
|
|
2107
|
-
function addClassNames(element, classNames) {
|
|
2108
|
-
classNames.forEach(function (className) {
|
|
2109
|
-
element.classList.add(className);
|
|
2110
|
-
});
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2131
|
+
*/
|
|
2132
|
+
function addClassNames(element, classNames) {
|
|
2133
|
+
classNames.forEach(function (className) {
|
|
2134
|
+
element.classList.add(className);
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2113
2138
|
/**
|
|
2114
2139
|
* Adds attributes to the given element
|
|
2115
2140
|
* @function
|
|
@@ -2118,14 +2143,17 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2118
2143
|
* @param {Array} attributes
|
|
2119
2144
|
* @example
|
|
2120
2145
|
* addAttributes(element, [ 'data-info:foobar' ]);
|
|
2121
|
-
*/
|
|
2122
|
-
function addAttributes(element, attributes) {
|
|
2123
|
-
attributes.forEach(function (attribute) {
|
|
2124
|
-
element.setAttribute(
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2146
|
+
*/
|
|
2147
|
+
function addAttributes(element, attributes) {
|
|
2148
|
+
attributes.forEach(function (attribute) {
|
|
2149
|
+
element.setAttribute(
|
|
2150
|
+
attribute.split(':')[0],
|
|
2151
|
+
attribute.split(':')[1] || ''
|
|
2152
|
+
);
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2129
2157
|
/**
|
|
2130
2158
|
* Helper used to get the position which will be applied to the popper
|
|
2131
2159
|
* @method
|
|
@@ -2133,20 +2161,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2133
2161
|
* @param config {HTMLElement} popper element
|
|
2134
2162
|
* @param reference {HTMLElement} reference element
|
|
2135
2163
|
* @returns {String} position
|
|
2136
|
-
*/
|
|
2137
|
-
Popper.prototype._getPosition = function (popper, reference) {
|
|
2138
|
-
var container = getOffsetParent(reference);
|
|
2139
|
-
|
|
2140
|
-
if (this._options.forceAbsolute) {
|
|
2141
|
-
return 'absolute';
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2144
|
-
// Decide if the popper will be fixed
|
|
2145
|
-
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
2146
|
-
var isParentFixed = isFixed(reference, container);
|
|
2147
|
-
return isParentFixed ? 'fixed' : 'absolute';
|
|
2148
|
-
};
|
|
2149
|
-
|
|
2164
|
+
*/
|
|
2165
|
+
Popper.prototype._getPosition = function (popper, reference) {
|
|
2166
|
+
var container = getOffsetParent(reference);
|
|
2167
|
+
|
|
2168
|
+
if (this._options.forceAbsolute) {
|
|
2169
|
+
return 'absolute';
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
// Decide if the popper will be fixed
|
|
2173
|
+
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
2174
|
+
var isParentFixed = isFixed(reference, container);
|
|
2175
|
+
return isParentFixed ? 'fixed' : 'absolute';
|
|
2176
|
+
};
|
|
2177
|
+
|
|
2150
2178
|
/**
|
|
2151
2179
|
* Get offsets to the popper
|
|
2152
2180
|
* @method
|
|
@@ -2155,93 +2183,110 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2155
2183
|
* @param {Element} popper - the popper element
|
|
2156
2184
|
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
2157
2185
|
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
2158
|
-
*/
|
|
2159
|
-
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
2160
|
-
placement = placement.split('-')[0];
|
|
2161
|
-
var popperOffsets = {};
|
|
2162
|
-
|
|
2163
|
-
popperOffsets.position = this.state.position;
|
|
2164
|
-
var isParentFixed = popperOffsets.position === 'fixed';
|
|
2165
|
-
|
|
2166
|
-
//
|
|
2167
|
-
// Get reference element position
|
|
2168
|
-
//
|
|
2169
|
-
var referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
//
|
|
2177
|
-
//
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
//
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
if (placement === '
|
|
2191
|
-
popperOffsets.
|
|
2192
|
-
} else {
|
|
2193
|
-
popperOffsets.
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2186
|
+
*/
|
|
2187
|
+
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
2188
|
+
placement = placement.split('-')[0];
|
|
2189
|
+
var popperOffsets = {};
|
|
2190
|
+
|
|
2191
|
+
popperOffsets.position = this.state.position;
|
|
2192
|
+
var isParentFixed = popperOffsets.position === 'fixed';
|
|
2193
|
+
|
|
2194
|
+
//
|
|
2195
|
+
// Get reference element position
|
|
2196
|
+
//
|
|
2197
|
+
var referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
2198
|
+
reference,
|
|
2199
|
+
popper,
|
|
2200
|
+
isParentFixed
|
|
2201
|
+
);
|
|
2202
|
+
|
|
2203
|
+
//
|
|
2204
|
+
// Get popper sizes
|
|
2205
|
+
//
|
|
2206
|
+
var popperRect = getOuterSizes(popper);
|
|
2207
|
+
|
|
2208
|
+
//
|
|
2209
|
+
// Compute offsets of popper
|
|
2210
|
+
//
|
|
2211
|
+
|
|
2212
|
+
// depending by the popper placement we have to compute its offsets slightly differently
|
|
2213
|
+
if (['right', 'left'].indexOf(placement) !== -1) {
|
|
2214
|
+
popperOffsets.top =
|
|
2215
|
+
referenceOffsets.top +
|
|
2216
|
+
referenceOffsets.height / 2 -
|
|
2217
|
+
popperRect.height / 2;
|
|
2218
|
+
if (placement === 'left') {
|
|
2219
|
+
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
2220
|
+
} else {
|
|
2221
|
+
popperOffsets.left = referenceOffsets.right;
|
|
2222
|
+
}
|
|
2223
|
+
} else {
|
|
2224
|
+
popperOffsets.left =
|
|
2225
|
+
referenceOffsets.left +
|
|
2226
|
+
referenceOffsets.width / 2 -
|
|
2227
|
+
popperRect.width / 2;
|
|
2228
|
+
if (placement === 'top') {
|
|
2229
|
+
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
2230
|
+
} else {
|
|
2231
|
+
popperOffsets.top = referenceOffsets.bottom;
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
// Add width and height to our offsets object
|
|
2236
|
+
popperOffsets.width = popperRect.width;
|
|
2237
|
+
popperOffsets.height = popperRect.height;
|
|
2238
|
+
|
|
2239
|
+
return {
|
|
2240
|
+
popper: popperOffsets,
|
|
2241
|
+
reference: referenceOffsets
|
|
2242
|
+
};
|
|
2243
|
+
};
|
|
2244
|
+
|
|
2207
2245
|
/**
|
|
2208
2246
|
* Setup needed event listeners used to update the popper position
|
|
2209
2247
|
* @method
|
|
2210
2248
|
* @memberof Popper
|
|
2211
2249
|
* @access private
|
|
2212
|
-
*/
|
|
2213
|
-
Popper.prototype._setupEventListeners = function () {
|
|
2214
|
-
// NOTE: 1 DOM access here
|
|
2215
|
-
this.state.updateBound = this.update.bind(this);
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
};
|
|
2228
|
-
|
|
2250
|
+
*/
|
|
2251
|
+
Popper.prototype._setupEventListeners = function () {
|
|
2252
|
+
// NOTE: 1 DOM access here
|
|
2253
|
+
this.state.updateBound = this.update.bind(this);
|
|
2254
|
+
// 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
|
|
2255
|
+
this.state.realWindow = getRealWindow(this._popper);
|
|
2256
|
+
this.state.realWindow.addEventListener('resize', this.state.updateBound);
|
|
2257
|
+
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
2258
|
+
if (this._options.boundariesElement !== 'window') {
|
|
2259
|
+
var target = getScrollParent(this._reference);
|
|
2260
|
+
target.addEventListener('scroll', this.state.updateBound);
|
|
2261
|
+
this.state.scrollTarget = target;
|
|
2262
|
+
}
|
|
2263
|
+
};
|
|
2264
|
+
|
|
2229
2265
|
/**
|
|
2230
2266
|
* Remove event listeners used to update the popper position
|
|
2231
2267
|
* @method
|
|
2232
2268
|
* @memberof Popper
|
|
2233
2269
|
* @access private
|
|
2234
|
-
*/
|
|
2235
|
-
Popper.prototype._removeEventListeners = function () {
|
|
2236
|
-
// NOTE: 1 DOM access here
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
this.state.
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2270
|
+
*/
|
|
2271
|
+
Popper.prototype._removeEventListeners = function () {
|
|
2272
|
+
// NOTE: 1 DOM access here
|
|
2273
|
+
(this.state.realWindow || root).removeEventListener(
|
|
2274
|
+
'resize',
|
|
2275
|
+
this.state.updateBound
|
|
2276
|
+
);
|
|
2277
|
+
if (
|
|
2278
|
+
this._options.boundariesElement !== 'window' &&
|
|
2279
|
+
this.state.scrollTarget
|
|
2280
|
+
) {
|
|
2281
|
+
this.state.scrollTarget.removeEventListener(
|
|
2282
|
+
'scroll',
|
|
2283
|
+
this.state.updateBound
|
|
2284
|
+
);
|
|
2285
|
+
this.state.scrollTarget = null;
|
|
2286
|
+
}
|
|
2287
|
+
this.state.updateBound = null;
|
|
2288
|
+
};
|
|
2289
|
+
|
|
2245
2290
|
/**
|
|
2246
2291
|
* Computed the boundaries limits and return them
|
|
2247
2292
|
* @method
|
|
@@ -2251,66 +2296,75 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2251
2296
|
* @param {Number} padding - Boundaries padding
|
|
2252
2297
|
* @param {Element} boundariesElement - Element used to define the boundaries
|
|
2253
2298
|
* @returns {Object} Coordinates of the boundaries
|
|
2254
|
-
*/
|
|
2255
|
-
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
2256
|
-
// NOTE: 1 DOM access here
|
|
2257
|
-
var boundaries = {};
|
|
2258
|
-
var width, height;
|
|
2259
|
-
if (boundariesElement === 'window') {
|
|
2260
|
-
var body = root.document.body,
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
height = Math.max(
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
};
|
|
2284
|
-
|
|
2285
|
-
//
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2299
|
+
*/
|
|
2300
|
+
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
2301
|
+
// NOTE: 1 DOM access here
|
|
2302
|
+
var boundaries = {};
|
|
2303
|
+
var width, height;
|
|
2304
|
+
if (boundariesElement === 'window') {
|
|
2305
|
+
var body = root.document.body,
|
|
2306
|
+
html = root.document.documentElement;
|
|
2307
|
+
|
|
2308
|
+
height = Math.max(
|
|
2309
|
+
body.scrollHeight,
|
|
2310
|
+
body.offsetHeight,
|
|
2311
|
+
html.clientHeight,
|
|
2312
|
+
html.scrollHeight,
|
|
2313
|
+
html.offsetHeight
|
|
2314
|
+
);
|
|
2315
|
+
width = Math.max(
|
|
2316
|
+
body.scrollWidth,
|
|
2317
|
+
body.offsetWidth,
|
|
2318
|
+
html.clientWidth,
|
|
2319
|
+
html.scrollWidth,
|
|
2320
|
+
html.offsetWidth
|
|
2321
|
+
);
|
|
2322
|
+
|
|
2323
|
+
boundaries = {
|
|
2324
|
+
top: 0,
|
|
2325
|
+
right: width,
|
|
2326
|
+
bottom: height,
|
|
2327
|
+
left: 0
|
|
2328
|
+
};
|
|
2329
|
+
} else if (boundariesElement === 'viewport') {
|
|
2330
|
+
// 将真实 window 的视口换算到 popper 所在包含块的坐标系。
|
|
2331
|
+
// 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
|
|
2332
|
+
// 统一从元素自身的 view 与真实包含块获取
|
|
2333
|
+
var realWindow = getRealWindow(this._popper);
|
|
2334
|
+
var containingBlockRect = getContainingBlockRect(
|
|
2335
|
+
this._popper,
|
|
2336
|
+
data.offsets.popper.position === 'fixed'
|
|
2337
|
+
);
|
|
2338
|
+
|
|
2339
|
+
boundaries = {
|
|
2340
|
+
top: 0 - containingBlockRect.top,
|
|
2341
|
+
right:
|
|
2342
|
+
realWindow.document.documentElement.clientWidth -
|
|
2343
|
+
containingBlockRect.left,
|
|
2344
|
+
bottom:
|
|
2345
|
+
realWindow.document.documentElement.clientHeight -
|
|
2346
|
+
containingBlockRect.top,
|
|
2347
|
+
left: 0 - containingBlockRect.left
|
|
2348
|
+
};
|
|
2349
|
+
} else {
|
|
2350
|
+
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
2351
|
+
boundaries = {
|
|
2352
|
+
top: 0,
|
|
2353
|
+
left: 0,
|
|
2354
|
+
right: boundariesElement.clientWidth,
|
|
2355
|
+
bottom: boundariesElement.clientHeight
|
|
2356
|
+
};
|
|
2357
|
+
} else {
|
|
2358
|
+
boundaries = getOffsetRect(boundariesElement);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
boundaries.left += padding;
|
|
2362
|
+
boundaries.right -= padding;
|
|
2363
|
+
boundaries.top = boundaries.top + padding;
|
|
2364
|
+
boundaries.bottom = boundaries.bottom - padding;
|
|
2365
|
+
return boundaries;
|
|
2366
|
+
};
|
|
2367
|
+
|
|
2314
2368
|
/**
|
|
2315
2369
|
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
|
|
2316
2370
|
* @method
|
|
@@ -2319,22 +2373,27 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2319
2373
|
* @param {Object} data
|
|
2320
2374
|
* @param {Array} modifiers
|
|
2321
2375
|
* @param {Function} ends
|
|
2322
|
-
*/
|
|
2323
|
-
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
2324
|
-
var modifiersToRun = modifiers.slice();
|
|
2325
|
-
if (ends !== undefined) {
|
|
2326
|
-
modifiersToRun = this._options.modifiers.slice(
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2376
|
+
*/
|
|
2377
|
+
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
2378
|
+
var modifiersToRun = modifiers.slice();
|
|
2379
|
+
if (ends !== undefined) {
|
|
2380
|
+
modifiersToRun = this._options.modifiers.slice(
|
|
2381
|
+
0,
|
|
2382
|
+
getArrayKeyIndex(this._options.modifiers, ends)
|
|
2383
|
+
);
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
modifiersToRun.forEach(
|
|
2387
|
+
function (modifier) {
|
|
2388
|
+
if (isFunction(modifier)) {
|
|
2389
|
+
data = modifier.call(this, data);
|
|
2390
|
+
}
|
|
2391
|
+
}.bind(this)
|
|
2392
|
+
);
|
|
2393
|
+
|
|
2394
|
+
return data;
|
|
2395
|
+
};
|
|
2396
|
+
|
|
2338
2397
|
/**
|
|
2339
2398
|
* Helper used to know if the given modifier depends from another one.
|
|
2340
2399
|
* @method
|
|
@@ -2342,191 +2401,204 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2342
2401
|
* @param {String} requesting - name of requesting modifier
|
|
2343
2402
|
* @param {String} requested - name of requested modifier
|
|
2344
2403
|
* @returns {Boolean}
|
|
2345
|
-
*/
|
|
2346
|
-
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
2347
|
-
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
2348
|
-
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
2349
|
-
return modifier === requested;
|
|
2350
|
-
}).length;
|
|
2351
|
-
};
|
|
2352
|
-
|
|
2353
|
-
//
|
|
2354
|
-
// Modifiers
|
|
2355
|
-
//
|
|
2356
|
-
|
|
2404
|
+
*/
|
|
2405
|
+
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
2406
|
+
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
2407
|
+
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
2408
|
+
return modifier === requested;
|
|
2409
|
+
}).length;
|
|
2410
|
+
};
|
|
2411
|
+
|
|
2412
|
+
//
|
|
2413
|
+
// Modifiers
|
|
2414
|
+
//
|
|
2415
|
+
|
|
2357
2416
|
/**
|
|
2358
2417
|
* Modifiers list
|
|
2359
2418
|
* @namespace Popper.modifiers
|
|
2360
2419
|
* @memberof Popper
|
|
2361
2420
|
* @type {Object}
|
|
2362
|
-
*/
|
|
2363
|
-
Popper.prototype.modifiers = {};
|
|
2364
|
-
|
|
2421
|
+
*/
|
|
2422
|
+
Popper.prototype.modifiers = {};
|
|
2423
|
+
|
|
2365
2424
|
/**
|
|
2366
2425
|
* Apply the computed styles to the popper element
|
|
2367
2426
|
* @method
|
|
2368
2427
|
* @memberof Popper.modifiers
|
|
2369
2428
|
* @argument {Object} data - The data object generated by `update` method
|
|
2370
2429
|
* @returns {Object} The same data object
|
|
2371
|
-
*/
|
|
2372
|
-
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
2373
|
-
// apply the final offsets to the popper
|
|
2374
|
-
// NOTE: 1 DOM access here
|
|
2375
|
-
var styles = {
|
|
2376
|
-
position: data.offsets.popper.position
|
|
2377
|
-
};
|
|
2378
|
-
|
|
2379
|
-
// round top and left to avoid blurry text
|
|
2380
|
-
var left = Math.round(data.offsets.popper.left);
|
|
2381
|
-
var top = Math.round(data.offsets.popper.top);
|
|
2382
|
-
|
|
2383
|
-
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
2384
|
-
// we automatically use the supported prefixed version if needed
|
|
2385
|
-
var prefixedProperty;
|
|
2386
|
-
if (
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
this._popper
|
|
2408
|
-
|
|
2409
|
-
//
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2430
|
+
*/
|
|
2431
|
+
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
2432
|
+
// apply the final offsets to the popper
|
|
2433
|
+
// NOTE: 1 DOM access here
|
|
2434
|
+
var styles = {
|
|
2435
|
+
position: data.offsets.popper.position
|
|
2436
|
+
};
|
|
2437
|
+
|
|
2438
|
+
// round top and left to avoid blurry text
|
|
2439
|
+
var left = Math.round(data.offsets.popper.left);
|
|
2440
|
+
var top = Math.round(data.offsets.popper.top);
|
|
2441
|
+
|
|
2442
|
+
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
2443
|
+
// we automatically use the supported prefixed version if needed
|
|
2444
|
+
var prefixedProperty;
|
|
2445
|
+
if (
|
|
2446
|
+
this._options.gpuAcceleration &&
|
|
2447
|
+
(prefixedProperty = getSupportedPropertyName('transform'))
|
|
2448
|
+
) {
|
|
2449
|
+
styles[prefixedProperty] =
|
|
2450
|
+
'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
2451
|
+
styles.top = 0;
|
|
2452
|
+
styles.left = 0;
|
|
2453
|
+
}
|
|
2454
|
+
// othwerise, we use the standard `left` and `top` properties
|
|
2455
|
+
else {
|
|
2456
|
+
styles.left = left;
|
|
2457
|
+
styles.top = top;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
// any property present in `data.styles` will be applied to the popper,
|
|
2461
|
+
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
2462
|
+
// Be aware, modifiers could override the properties defined in the previous
|
|
2463
|
+
// lines of this modifier!
|
|
2464
|
+
Object.assign(styles, data.styles);
|
|
2465
|
+
|
|
2466
|
+
setStyle(this._popper, styles);
|
|
2467
|
+
|
|
2468
|
+
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
|
|
2469
|
+
// NOTE: 1 DOM access here
|
|
2470
|
+
this._popper.setAttribute('x-placement', data.placement);
|
|
2471
|
+
|
|
2472
|
+
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
|
|
2473
|
+
if (
|
|
2474
|
+
this.isModifierRequired(
|
|
2475
|
+
this.modifiers.applyStyle,
|
|
2476
|
+
this.modifiers.arrow
|
|
2477
|
+
) &&
|
|
2478
|
+
data.offsets.arrow
|
|
2479
|
+
) {
|
|
2480
|
+
setStyle(data.arrowElement, data.offsets.arrow);
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
return data;
|
|
2484
|
+
};
|
|
2485
|
+
|
|
2417
2486
|
/**
|
|
2418
2487
|
* Modifier used to shift the popper on the start or end of its reference element side
|
|
2419
2488
|
* @method
|
|
2420
2489
|
* @memberof Popper.modifiers
|
|
2421
2490
|
* @argument {Object} data - The data object generated by `update` method
|
|
2422
2491
|
* @returns {Object} The data object, properly modified
|
|
2423
|
-
*/
|
|
2424
|
-
Popper.prototype.modifiers.shift = function (data) {
|
|
2425
|
-
var placement = data.placement;
|
|
2426
|
-
var basePlacement = placement.split('-')[0];
|
|
2427
|
-
var shiftVariation = placement.split('-')[1];
|
|
2428
|
-
|
|
2429
|
-
// if shift shiftVariation is specified, run the modifier
|
|
2430
|
-
if (shiftVariation) {
|
|
2431
|
-
var reference = data.offsets.reference;
|
|
2432
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
2433
|
-
|
|
2434
|
-
var shiftOffsets = {
|
|
2435
|
-
y: {
|
|
2436
|
-
start: { top: reference.top },
|
|
2437
|
-
end: { top: reference.top + reference.height - popper.height }
|
|
2438
|
-
},
|
|
2439
|
-
x: {
|
|
2440
|
-
start: { left: reference.left },
|
|
2441
|
-
end: { left: reference.left + reference.width - popper.width }
|
|
2442
|
-
}
|
|
2443
|
-
};
|
|
2444
|
-
|
|
2445
|
-
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
2446
|
-
|
|
2447
|
-
data.offsets.popper = Object.assign(
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2492
|
+
*/
|
|
2493
|
+
Popper.prototype.modifiers.shift = function (data) {
|
|
2494
|
+
var placement = data.placement;
|
|
2495
|
+
var basePlacement = placement.split('-')[0];
|
|
2496
|
+
var shiftVariation = placement.split('-')[1];
|
|
2497
|
+
|
|
2498
|
+
// if shift shiftVariation is specified, run the modifier
|
|
2499
|
+
if (shiftVariation) {
|
|
2500
|
+
var reference = data.offsets.reference;
|
|
2501
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2502
|
+
|
|
2503
|
+
var shiftOffsets = {
|
|
2504
|
+
y: {
|
|
2505
|
+
start: { top: reference.top },
|
|
2506
|
+
end: { top: reference.top + reference.height - popper.height }
|
|
2507
|
+
},
|
|
2508
|
+
x: {
|
|
2509
|
+
start: { left: reference.left },
|
|
2510
|
+
end: { left: reference.left + reference.width - popper.width }
|
|
2511
|
+
}
|
|
2512
|
+
};
|
|
2513
|
+
|
|
2514
|
+
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
2515
|
+
|
|
2516
|
+
data.offsets.popper = Object.assign(
|
|
2517
|
+
popper,
|
|
2518
|
+
shiftOffsets[axis][shiftVariation]
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
return data;
|
|
2523
|
+
};
|
|
2524
|
+
|
|
2453
2525
|
/**
|
|
2454
2526
|
* Modifier used to make sure the popper does not overflows from it's boundaries
|
|
2455
2527
|
* @method
|
|
2456
2528
|
* @memberof Popper.modifiers
|
|
2457
2529
|
* @argument {Object} data - The data object generated by `update` method
|
|
2458
2530
|
* @returns {Object} The data object, properly modified
|
|
2459
|
-
*/
|
|
2460
|
-
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
2461
|
-
var order = this._options.preventOverflowOrder;
|
|
2462
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
2463
|
-
|
|
2464
|
-
var check = {
|
|
2465
|
-
left: function
|
|
2466
|
-
var left = popper.left;
|
|
2467
|
-
if (popper.left < data.boundaries.left) {
|
|
2468
|
-
left = Math.max(popper.left, data.boundaries.left);
|
|
2469
|
-
}
|
|
2470
|
-
return { left: left };
|
|
2471
|
-
},
|
|
2472
|
-
right: function
|
|
2473
|
-
var left = popper.left;
|
|
2474
|
-
if (popper.right > data.boundaries.right) {
|
|
2475
|
-
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
2476
|
-
}
|
|
2477
|
-
return { left: left };
|
|
2478
|
-
},
|
|
2479
|
-
top: function
|
|
2480
|
-
var top = popper.top;
|
|
2481
|
-
if (popper.top < data.boundaries.top) {
|
|
2482
|
-
top = Math.max(popper.top, data.boundaries.top);
|
|
2483
|
-
}
|
|
2484
|
-
return { top: top };
|
|
2485
|
-
},
|
|
2486
|
-
bottom: function
|
|
2487
|
-
var top = popper.top;
|
|
2488
|
-
if (popper.bottom > data.boundaries.bottom) {
|
|
2489
|
-
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
2490
|
-
}
|
|
2491
|
-
return { top: top };
|
|
2492
|
-
}
|
|
2493
|
-
};
|
|
2494
|
-
|
|
2495
|
-
order.forEach(function (direction) {
|
|
2496
|
-
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
2497
|
-
});
|
|
2498
|
-
|
|
2499
|
-
return data;
|
|
2500
|
-
};
|
|
2501
|
-
|
|
2531
|
+
*/
|
|
2532
|
+
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
2533
|
+
var order = this._options.preventOverflowOrder;
|
|
2534
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2535
|
+
|
|
2536
|
+
var check = {
|
|
2537
|
+
left: function () {
|
|
2538
|
+
var left = popper.left;
|
|
2539
|
+
if (popper.left < data.boundaries.left) {
|
|
2540
|
+
left = Math.max(popper.left, data.boundaries.left);
|
|
2541
|
+
}
|
|
2542
|
+
return { left: left };
|
|
2543
|
+
},
|
|
2544
|
+
right: function () {
|
|
2545
|
+
var left = popper.left;
|
|
2546
|
+
if (popper.right > data.boundaries.right) {
|
|
2547
|
+
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
2548
|
+
}
|
|
2549
|
+
return { left: left };
|
|
2550
|
+
},
|
|
2551
|
+
top: function () {
|
|
2552
|
+
var top = popper.top;
|
|
2553
|
+
if (popper.top < data.boundaries.top) {
|
|
2554
|
+
top = Math.max(popper.top, data.boundaries.top);
|
|
2555
|
+
}
|
|
2556
|
+
return { top: top };
|
|
2557
|
+
},
|
|
2558
|
+
bottom: function () {
|
|
2559
|
+
var top = popper.top;
|
|
2560
|
+
if (popper.bottom > data.boundaries.bottom) {
|
|
2561
|
+
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
2562
|
+
}
|
|
2563
|
+
return { top: top };
|
|
2564
|
+
}
|
|
2565
|
+
};
|
|
2566
|
+
|
|
2567
|
+
order.forEach(function (direction) {
|
|
2568
|
+
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
2569
|
+
});
|
|
2570
|
+
|
|
2571
|
+
return data;
|
|
2572
|
+
};
|
|
2573
|
+
|
|
2502
2574
|
/**
|
|
2503
2575
|
* Modifier used to make sure the popper is always near its reference
|
|
2504
2576
|
* @method
|
|
2505
2577
|
* @memberof Popper.modifiers
|
|
2506
2578
|
* @argument {Object} data - The data object generated by _update method
|
|
2507
2579
|
* @returns {Object} The data object, properly modified
|
|
2508
|
-
*/
|
|
2509
|
-
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
2510
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
2511
|
-
var reference = data.offsets.reference;
|
|
2512
|
-
var f = Math.floor;
|
|
2513
|
-
|
|
2514
|
-
if (popper.right < f(reference.left)) {
|
|
2515
|
-
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
2516
|
-
}
|
|
2517
|
-
if (popper.left > f(reference.right)) {
|
|
2518
|
-
data.offsets.popper.left = f(reference.right);
|
|
2519
|
-
}
|
|
2520
|
-
if (popper.bottom < f(reference.top)) {
|
|
2521
|
-
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
2522
|
-
}
|
|
2523
|
-
if (popper.top > f(reference.bottom)) {
|
|
2524
|
-
data.offsets.popper.top = f(reference.bottom);
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
return data;
|
|
2528
|
-
};
|
|
2529
|
-
|
|
2580
|
+
*/
|
|
2581
|
+
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
2582
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2583
|
+
var reference = data.offsets.reference;
|
|
2584
|
+
var f = Math.floor;
|
|
2585
|
+
|
|
2586
|
+
if (popper.right < f(reference.left)) {
|
|
2587
|
+
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
2588
|
+
}
|
|
2589
|
+
if (popper.left > f(reference.right)) {
|
|
2590
|
+
data.offsets.popper.left = f(reference.right);
|
|
2591
|
+
}
|
|
2592
|
+
if (popper.bottom < f(reference.top)) {
|
|
2593
|
+
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
2594
|
+
}
|
|
2595
|
+
if (popper.top > f(reference.bottom)) {
|
|
2596
|
+
data.offsets.popper.top = f(reference.bottom);
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
return data;
|
|
2600
|
+
};
|
|
2601
|
+
|
|
2530
2602
|
/**
|
|
2531
2603
|
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
|
|
2532
2604
|
* Requires the `preventOverflow` modifier before it in order to work.
|
|
@@ -2535,61 +2607,81 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2535
2607
|
* @memberof Popper.modifiers
|
|
2536
2608
|
* @argument {Object} data - The data object generated by _update method
|
|
2537
2609
|
* @returns {Object} The data object, properly modified
|
|
2538
|
-
*/
|
|
2539
|
-
Popper.prototype.modifiers.flip = function (data) {
|
|
2540
|
-
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
2541
|
-
// otherwise flip would not work as expected.
|
|
2542
|
-
if (
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
flipOrder
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2610
|
+
*/
|
|
2611
|
+
Popper.prototype.modifiers.flip = function (data) {
|
|
2612
|
+
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
2613
|
+
// otherwise flip would not work as expected.
|
|
2614
|
+
if (
|
|
2615
|
+
!this.isModifierRequired(
|
|
2616
|
+
this.modifiers.flip,
|
|
2617
|
+
this.modifiers.preventOverflow
|
|
2618
|
+
)
|
|
2619
|
+
) {
|
|
2620
|
+
console.warn(
|
|
2621
|
+
'WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!'
|
|
2622
|
+
);
|
|
2623
|
+
return data;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
if (data.flipped && data.placement === data._originalPlacement) {
|
|
2627
|
+
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
2628
|
+
return data;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
var placement = data.placement.split('-')[0];
|
|
2632
|
+
var placementOpposite = getOppositePlacement(placement);
|
|
2633
|
+
var variation = data.placement.split('-')[1] || '';
|
|
2634
|
+
|
|
2635
|
+
var flipOrder = [];
|
|
2636
|
+
if (this._options.flipBehavior === 'flip') {
|
|
2637
|
+
flipOrder = [placement, placementOpposite];
|
|
2638
|
+
} else {
|
|
2639
|
+
flipOrder = this._options.flipBehavior;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
flipOrder.forEach(
|
|
2643
|
+
function (step, index) {
|
|
2644
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
placement = data.placement.split('-')[0];
|
|
2649
|
+
placementOpposite = getOppositePlacement(placement);
|
|
2650
|
+
|
|
2651
|
+
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
2652
|
+
|
|
2653
|
+
// this boolean is used to distinguish right and bottom from top and left
|
|
2654
|
+
// they need different computations to get flipped
|
|
2655
|
+
var a = ['right', 'bottom'].indexOf(placement) !== -1;
|
|
2656
|
+
|
|
2657
|
+
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
|
|
2658
|
+
if (
|
|
2659
|
+
(a &&
|
|
2660
|
+
Math.floor(data.offsets.reference[placement]) >
|
|
2661
|
+
Math.floor(popperOffsets[placementOpposite])) ||
|
|
2662
|
+
(!a &&
|
|
2663
|
+
Math.floor(data.offsets.reference[placement]) <
|
|
2664
|
+
Math.floor(popperOffsets[placementOpposite]))
|
|
2665
|
+
) {
|
|
2666
|
+
// we'll use this boolean to detect any flip loop
|
|
2667
|
+
data.flipped = true;
|
|
2668
|
+
data.placement = flipOrder[index + 1];
|
|
2669
|
+
if (variation) {
|
|
2670
|
+
data.placement += '-' + variation;
|
|
2671
|
+
}
|
|
2672
|
+
data.offsets.popper = this._getOffsets(
|
|
2673
|
+
this._popper,
|
|
2674
|
+
this._reference,
|
|
2675
|
+
data.placement
|
|
2676
|
+
).popper;
|
|
2677
|
+
|
|
2678
|
+
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
2679
|
+
}
|
|
2680
|
+
}.bind(this)
|
|
2681
|
+
);
|
|
2682
|
+
return data;
|
|
2683
|
+
};
|
|
2684
|
+
|
|
2593
2685
|
/**
|
|
2594
2686
|
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
|
|
2595
2687
|
* The offsets will shift the popper on the side of its reference element.
|
|
@@ -2597,23 +2689,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2597
2689
|
* @memberof Popper.modifiers
|
|
2598
2690
|
* @argument {Object} data - The data object generated by _update method
|
|
2599
2691
|
* @returns {Object} The data object, properly modified
|
|
2600
|
-
*/
|
|
2601
|
-
Popper.prototype.modifiers.offset = function (data) {
|
|
2602
|
-
var offset = this._options.offset;
|
|
2603
|
-
var popper = data.offsets.popper;
|
|
2604
|
-
|
|
2605
|
-
if (data.placement.indexOf('left') !== -1) {
|
|
2606
|
-
popper.top -= offset;
|
|
2607
|
-
} else if (data.placement.indexOf('right') !== -1) {
|
|
2608
|
-
popper.top += offset;
|
|
2609
|
-
} else if (data.placement.indexOf('top') !== -1) {
|
|
2610
|
-
popper.left -= offset;
|
|
2611
|
-
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
2612
|
-
popper.left += offset;
|
|
2613
|
-
}
|
|
2614
|
-
return data;
|
|
2615
|
-
};
|
|
2616
|
-
|
|
2692
|
+
*/
|
|
2693
|
+
Popper.prototype.modifiers.offset = function (data) {
|
|
2694
|
+
var offset = this._options.offset;
|
|
2695
|
+
var popper = data.offsets.popper;
|
|
2696
|
+
|
|
2697
|
+
if (data.placement.indexOf('left') !== -1) {
|
|
2698
|
+
popper.top -= offset;
|
|
2699
|
+
} else if (data.placement.indexOf('right') !== -1) {
|
|
2700
|
+
popper.top += offset;
|
|
2701
|
+
} else if (data.placement.indexOf('top') !== -1) {
|
|
2702
|
+
popper.left -= offset;
|
|
2703
|
+
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
2704
|
+
popper.left += offset;
|
|
2705
|
+
}
|
|
2706
|
+
return data;
|
|
2707
|
+
};
|
|
2708
|
+
|
|
2617
2709
|
/**
|
|
2618
2710
|
* 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
|
|
2619
2711
|
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
|
|
@@ -2621,136 +2713,147 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2621
2713
|
* @memberof Popper.modifiers
|
|
2622
2714
|
* @argument {Object} data - The data object generated by _update method
|
|
2623
2715
|
* @returns {Object} The data object, properly modified
|
|
2624
|
-
*/
|
|
2625
|
-
Popper.prototype.modifiers.arrow = function (data) {
|
|
2626
|
-
var arrow = this._options.arrowElement;
|
|
2627
|
-
var arrowOffset = this._options.arrowOffset;
|
|
2628
|
-
|
|
2629
|
-
// if the arrowElement is a string, suppose it's a CSS selector
|
|
2630
|
-
if (typeof arrow === 'string') {
|
|
2631
|
-
arrow = this._popper.querySelector(arrow);
|
|
2632
|
-
}
|
|
2633
|
-
|
|
2634
|
-
// if arrow element is not found, don't run the modifier
|
|
2635
|
-
if (!arrow) {
|
|
2636
|
-
return data;
|
|
2637
|
-
}
|
|
2638
|
-
|
|
2639
|
-
// the arrow element must be child of its popper
|
|
2640
|
-
if (!this._popper.contains(arrow)) {
|
|
2641
|
-
console.warn(
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
var
|
|
2661
|
-
var
|
|
2662
|
-
var
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
//
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
//
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2716
|
+
*/
|
|
2717
|
+
Popper.prototype.modifiers.arrow = function (data) {
|
|
2718
|
+
var arrow = this._options.arrowElement;
|
|
2719
|
+
var arrowOffset = this._options.arrowOffset;
|
|
2720
|
+
|
|
2721
|
+
// if the arrowElement is a string, suppose it's a CSS selector
|
|
2722
|
+
if (typeof arrow === 'string') {
|
|
2723
|
+
arrow = this._popper.querySelector(arrow);
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
// if arrow element is not found, don't run the modifier
|
|
2727
|
+
if (!arrow) {
|
|
2728
|
+
return data;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
// the arrow element must be child of its popper
|
|
2732
|
+
if (!this._popper.contains(arrow)) {
|
|
2733
|
+
console.warn(
|
|
2734
|
+
'WARNING: `arrowElement` must be child of its popper element!'
|
|
2735
|
+
);
|
|
2736
|
+
return data;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
// arrow depends on keepTogether in order to work
|
|
2740
|
+
if (
|
|
2741
|
+
!this.isModifierRequired(
|
|
2742
|
+
this.modifiers.arrow,
|
|
2743
|
+
this.modifiers.keepTogether
|
|
2744
|
+
)
|
|
2745
|
+
) {
|
|
2746
|
+
console.warn(
|
|
2747
|
+
'WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'
|
|
2748
|
+
);
|
|
2749
|
+
return data;
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
var arrowStyle = {};
|
|
2753
|
+
var placement = data.placement.split('-')[0];
|
|
2754
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2755
|
+
var reference = data.offsets.reference;
|
|
2756
|
+
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
2757
|
+
|
|
2758
|
+
var len = isVertical ? 'height' : 'width';
|
|
2759
|
+
var side = isVertical ? 'top' : 'left';
|
|
2760
|
+
var translate = isVertical ? 'translateY' : 'translateX';
|
|
2761
|
+
var altSide = isVertical ? 'left' : 'top';
|
|
2762
|
+
var opSide = isVertical ? 'bottom' : 'right';
|
|
2763
|
+
var arrowSize = getOuterSizes(arrow)[len];
|
|
2764
|
+
|
|
2765
|
+
//
|
|
2766
|
+
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
|
|
2767
|
+
//
|
|
2768
|
+
|
|
2769
|
+
// top/left side
|
|
2770
|
+
if (reference[opSide] - arrowSize < popper[side]) {
|
|
2771
|
+
data.offsets.popper[side] -=
|
|
2772
|
+
popper[side] - (reference[opSide] - arrowSize);
|
|
2773
|
+
}
|
|
2774
|
+
// bottom/right side
|
|
2775
|
+
if (reference[side] + arrowSize > popper[opSide]) {
|
|
2776
|
+
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
// compute center of the popper
|
|
2780
|
+
var center =
|
|
2781
|
+
reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
2782
|
+
|
|
2783
|
+
var sideValue = center - popper[side];
|
|
2784
|
+
|
|
2785
|
+
// prevent arrow from being placed not contiguously to its popper
|
|
2786
|
+
sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
|
|
2787
|
+
arrowStyle[side] = sideValue;
|
|
2788
|
+
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
|
|
2789
|
+
|
|
2790
|
+
data.offsets.arrow = arrowStyle;
|
|
2791
|
+
data.arrowElement = arrow;
|
|
2792
|
+
|
|
2793
|
+
return data;
|
|
2794
|
+
};
|
|
2795
|
+
|
|
2796
|
+
//
|
|
2797
|
+
// Helpers
|
|
2798
|
+
//
|
|
2799
|
+
|
|
2697
2800
|
/**
|
|
2698
2801
|
* Get the outer sizes of the given element (offset size + margins)
|
|
2699
2802
|
* @function
|
|
2700
2803
|
* @ignore
|
|
2701
2804
|
* @argument {Element} element
|
|
2702
2805
|
* @returns {Object} object containing width and height properties
|
|
2703
|
-
*/
|
|
2704
|
-
function getOuterSizes(element) {
|
|
2705
|
-
// NOTE: 1 DOM access here
|
|
2706
|
-
var _display = element.style.display,
|
|
2707
|
-
|
|
2708
|
-
element.style.display = 'block';
|
|
2709
|
-
element.style.visibility = 'hidden';
|
|
2710
|
-
var calcWidthToForceRepaint = element.offsetWidth;
|
|
2711
|
-
// original method
|
|
2712
|
-
var styles =
|
|
2713
|
-
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
2714
|
-
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
2715
|
-
var result = {
|
|
2716
|
-
width: element.offsetWidth + y,
|
|
2717
|
-
height: element.offsetHeight + x
|
|
2718
|
-
};
|
|
2719
|
-
|
|
2720
|
-
// reset element styles
|
|
2721
|
-
element.style.display = _display;
|
|
2722
|
-
element.style.visibility = _visibility;
|
|
2723
|
-
return result;
|
|
2724
|
-
}
|
|
2725
|
-
|
|
2806
|
+
*/
|
|
2807
|
+
function getOuterSizes(element) {
|
|
2808
|
+
// NOTE: 1 DOM access here
|
|
2809
|
+
var _display = element.style.display,
|
|
2810
|
+
_visibility = element.style.visibility;
|
|
2811
|
+
element.style.display = 'block';
|
|
2812
|
+
element.style.visibility = 'hidden';
|
|
2813
|
+
var calcWidthToForceRepaint = element.offsetWidth;
|
|
2814
|
+
// original method
|
|
2815
|
+
var styles = getRealWindow(element).getComputedStyle(element);
|
|
2816
|
+
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
2817
|
+
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
2818
|
+
var result = {
|
|
2819
|
+
width: element.offsetWidth + y,
|
|
2820
|
+
height: element.offsetHeight + x
|
|
2821
|
+
};
|
|
2822
|
+
|
|
2823
|
+
// reset element styles
|
|
2824
|
+
element.style.display = _display;
|
|
2825
|
+
element.style.visibility = _visibility;
|
|
2826
|
+
return result;
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2726
2829
|
/**
|
|
2727
2830
|
* Get the opposite placement of the given one/
|
|
2728
2831
|
* @function
|
|
2729
2832
|
* @ignore
|
|
2730
2833
|
* @argument {String} placement
|
|
2731
2834
|
* @returns {String} flipped placement
|
|
2732
|
-
*/
|
|
2733
|
-
function getOppositePlacement(placement) {
|
|
2734
|
-
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
2735
|
-
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
2736
|
-
return hash[matched];
|
|
2737
|
-
});
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2835
|
+
*/
|
|
2836
|
+
function getOppositePlacement(placement) {
|
|
2837
|
+
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
2838
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
2839
|
+
return hash[matched];
|
|
2840
|
+
});
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2740
2843
|
/**
|
|
2741
2844
|
* Given the popper offsets, generate an output similar to getBoundingClientRect
|
|
2742
2845
|
* @function
|
|
2743
2846
|
* @ignore
|
|
2744
2847
|
* @argument {Object} popperOffsets
|
|
2745
2848
|
* @returns {Object} ClientRect like output
|
|
2746
|
-
*/
|
|
2747
|
-
function getPopperClientRect(popperOffsets) {
|
|
2748
|
-
var offsets = Object.assign({}, popperOffsets);
|
|
2749
|
-
offsets.right = offsets.left + offsets.width;
|
|
2750
|
-
offsets.bottom = offsets.top + offsets.height;
|
|
2751
|
-
return offsets;
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2849
|
+
*/
|
|
2850
|
+
function getPopperClientRect(popperOffsets) {
|
|
2851
|
+
var offsets = Object.assign({}, popperOffsets);
|
|
2852
|
+
offsets.right = offsets.left + offsets.width;
|
|
2853
|
+
offsets.bottom = offsets.top + offsets.height;
|
|
2854
|
+
return offsets;
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2754
2857
|
/**
|
|
2755
2858
|
* Given an array and the key to find, returns its index
|
|
2756
2859
|
* @function
|
|
@@ -2758,76 +2861,155 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2758
2861
|
* @argument {Array} arr
|
|
2759
2862
|
* @argument keyToFind
|
|
2760
2863
|
* @returns index or null
|
|
2761
|
-
*/
|
|
2762
|
-
function getArrayKeyIndex(arr, keyToFind) {
|
|
2763
|
-
var i = 0,
|
|
2764
|
-
|
|
2765
|
-
for (key in arr) {
|
|
2766
|
-
if (arr[key] === keyToFind) {
|
|
2767
|
-
return i;
|
|
2768
|
-
}
|
|
2769
|
-
i++;
|
|
2770
|
-
}
|
|
2771
|
-
return null;
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2864
|
+
*/
|
|
2865
|
+
function getArrayKeyIndex(arr, keyToFind) {
|
|
2866
|
+
var i = 0,
|
|
2867
|
+
key;
|
|
2868
|
+
for (key in arr) {
|
|
2869
|
+
if (arr[key] === keyToFind) {
|
|
2870
|
+
return i;
|
|
2871
|
+
}
|
|
2872
|
+
i++;
|
|
2873
|
+
}
|
|
2874
|
+
return null;
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2774
2877
|
/**
|
|
2775
2878
|
* Get CSS computed property of the given element
|
|
2776
2879
|
* @function
|
|
2777
2880
|
* @ignore
|
|
2778
2881
|
* @argument {Eement} element
|
|
2779
2882
|
* @argument {String} property
|
|
2780
|
-
*/
|
|
2781
|
-
function getStyleComputedProperty(element, property) {
|
|
2782
|
-
// NOTE: 1 DOM access here
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2883
|
+
*/
|
|
2884
|
+
function getStyleComputedProperty(element, property) {
|
|
2885
|
+
// NOTE: 1 DOM access here
|
|
2886
|
+
// 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
|
|
2887
|
+
// 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
|
|
2888
|
+
var css = getRealWindow(element).getComputedStyle(element, null);
|
|
2889
|
+
return css[property];
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2786
2892
|
/**
|
|
2787
2893
|
* Returns the offset parent of the given element
|
|
2788
2894
|
* @function
|
|
2789
2895
|
* @ignore
|
|
2790
2896
|
* @argument {Element} element
|
|
2791
2897
|
* @returns {Element} offset parent
|
|
2792
|
-
*/
|
|
2793
|
-
function getOffsetParent(element) {
|
|
2794
|
-
var offsetParent = element.offsetParent;
|
|
2795
|
-
return offsetParent === root.document.body || !offsetParent
|
|
2796
|
-
|
|
2797
|
-
|
|
2898
|
+
*/
|
|
2899
|
+
function getOffsetParent(element) {
|
|
2900
|
+
var offsetParent = element.offsetParent;
|
|
2901
|
+
return offsetParent === root.document.body || !offsetParent
|
|
2902
|
+
? root.document.documentElement
|
|
2903
|
+
: offsetParent;
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
/**
|
|
2907
|
+
* Returns the window the given element actually renders in.
|
|
2908
|
+
* 无界等微前端场景下组件代码运行在沙箱 window 中,而 DOM 实际渲染在
|
|
2909
|
+
* 主应用的 window(shadowRoot 内),滚动量、视口尺寸等必须取自元素自身的 view
|
|
2910
|
+
* @function
|
|
2911
|
+
* @ignore
|
|
2912
|
+
* @argument {Element} element
|
|
2913
|
+
* @returns {Window} window
|
|
2914
|
+
*/
|
|
2915
|
+
function getRealWindow(element) {
|
|
2916
|
+
return (
|
|
2917
|
+
(element &&
|
|
2918
|
+
element.ownerDocument &&
|
|
2919
|
+
element.ownerDocument.defaultView) ||
|
|
2920
|
+
root
|
|
2921
|
+
);
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
/**
|
|
2925
|
+
* Returns the viewport rect of the containing block actually used to position the popper.
|
|
2926
|
+
* 无界微前端等场景下 popper 被挂载进子应用的 shadowRoot,offsetParent 的兜底值
|
|
2927
|
+
* (documentElement)与浏览器真实的包含块不再重合,导致下拉框/提示框整体偏移
|
|
2928
|
+
* (偏移量恰为子应用容器在主应用中的位置),因此需要沿 composed tree 查找:
|
|
2929
|
+
* - fixed 定位:包含块为视口;
|
|
2930
|
+
* - absolute 定位:最近的 positioned 祖先元素(跨 shadowRoot 边界查找);
|
|
2931
|
+
* - 无 positioned 祖先:初始包含块,其视口原点为真实 window 滚动量的负值。
|
|
2932
|
+
* @function
|
|
2933
|
+
* @ignore
|
|
2934
|
+
* @argument {Element} element - popper element
|
|
2935
|
+
* @argument {Boolean} fixed - whether the popper is fixed positioned
|
|
2936
|
+
* @returns {Object} rect
|
|
2937
|
+
*/
|
|
2938
|
+
function getContainingBlockRect(element, fixed) {
|
|
2939
|
+
if (fixed) {
|
|
2940
|
+
return { top: 0, left: 0, right: 0, bottom: 0 };
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
var node = element.parentNode;
|
|
2944
|
+
while (node) {
|
|
2945
|
+
if (node.nodeType === 1) {
|
|
2946
|
+
if (getStyleComputedProperty(node, 'position') !== 'static') {
|
|
2947
|
+
return getBoundingClientRect(node);
|
|
2948
|
+
}
|
|
2949
|
+
} else if (node.nodeType === 11) {
|
|
2950
|
+
// 遇到 shadowRoot,跨边界从宿主元素继续向上查找
|
|
2951
|
+
node = node.host;
|
|
2952
|
+
continue;
|
|
2953
|
+
} else {
|
|
2954
|
+
break;
|
|
2955
|
+
}
|
|
2956
|
+
node = node.parentNode;
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
var win = getRealWindow(element);
|
|
2960
|
+
return {
|
|
2961
|
+
top: -(win.pageYOffset || 0),
|
|
2962
|
+
left: -(win.pageXOffset || 0),
|
|
2963
|
+
right: 0,
|
|
2964
|
+
bottom: 0
|
|
2965
|
+
};
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2798
2968
|
/**
|
|
2799
2969
|
* Returns the scrolling parent of the given element
|
|
2800
2970
|
* @function
|
|
2801
2971
|
* @ignore
|
|
2802
2972
|
* @argument {Element} element
|
|
2803
2973
|
* @returns {Element} offset parent
|
|
2804
|
-
*/
|
|
2805
|
-
function getScrollParent(element) {
|
|
2806
|
-
var parent = element.parentNode;
|
|
2807
|
-
if (!parent
|
|
2808
|
-
return element;
|
|
2809
|
-
}
|
|
2810
|
-
|
|
2811
|
-
if (parent ===
|
|
2812
|
-
//
|
|
2813
|
-
//
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2974
|
+
*/
|
|
2975
|
+
function getScrollParent(element) {
|
|
2976
|
+
var parent = element.parentNode;
|
|
2977
|
+
if (!parent) {
|
|
2978
|
+
return element;
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
if (parent.nodeType === 11) {
|
|
2982
|
+
// 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
|
|
2983
|
+
// 否则查找到 shadowRoot 即终止,滚动事件无法被监听
|
|
2984
|
+
return getScrollParent(parent.host);
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
if (parent.nodeType !== 1) {
|
|
2988
|
+
// 到达 document,返回元素实际渲染所在的真实 window,
|
|
2989
|
+
// 保证 window 滚动时能触发位置更新
|
|
2990
|
+
return getRealWindow(element);
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
// Firefox want us to check `-x` and `-y` variations as well
|
|
2994
|
+
if (
|
|
2995
|
+
['scroll', 'auto'].indexOf(
|
|
2996
|
+
getStyleComputedProperty(parent, 'overflow')
|
|
2997
|
+
) !== -1 ||
|
|
2998
|
+
['scroll', 'auto'].indexOf(
|
|
2999
|
+
getStyleComputedProperty(parent, 'overflow-x')
|
|
3000
|
+
) !== -1 ||
|
|
3001
|
+
['scroll', 'auto'].indexOf(
|
|
3002
|
+
getStyleComputedProperty(parent, 'overflow-y')
|
|
3003
|
+
) !== -1
|
|
3004
|
+
) {
|
|
3005
|
+
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
3006
|
+
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
3007
|
+
// fixes issue #65
|
|
3008
|
+
return parent;
|
|
3009
|
+
}
|
|
3010
|
+
return getScrollParent(parent);
|
|
3011
|
+
}
|
|
3012
|
+
|
|
2831
3013
|
/**
|
|
2832
3014
|
* Check if the given element is fixed or is inside a fixed parent
|
|
2833
3015
|
* @function
|
|
@@ -2835,109 +3017,125 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2835
3017
|
* @argument {Element} element
|
|
2836
3018
|
* @argument {Element} customContainer
|
|
2837
3019
|
* @returns {Boolean} answer to "isFixed?"
|
|
2838
|
-
*/
|
|
2839
|
-
function isFixed(element) {
|
|
2840
|
-
if (element === root.document.body) {
|
|
2841
|
-
return false;
|
|
2842
|
-
}
|
|
2843
|
-
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
2844
|
-
return true;
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
3020
|
+
*/
|
|
3021
|
+
function isFixed(element) {
|
|
3022
|
+
if (element === root.document.body) {
|
|
3023
|
+
return false;
|
|
3024
|
+
}
|
|
3025
|
+
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
3026
|
+
return true;
|
|
3027
|
+
}
|
|
3028
|
+
var parent = element.parentNode;
|
|
3029
|
+
if (parent && parent.nodeType === 11) {
|
|
3030
|
+
// 跨 shadowRoot 边界,从宿主元素继续向上判断
|
|
3031
|
+
parent = parent.host;
|
|
3032
|
+
}
|
|
3033
|
+
return parent && parent.nodeType === 1 ? isFixed(parent) : false;
|
|
3034
|
+
}
|
|
3035
|
+
|
|
2849
3036
|
/**
|
|
2850
3037
|
* Set the style to the given popper
|
|
2851
3038
|
* @function
|
|
2852
3039
|
* @ignore
|
|
2853
3040
|
* @argument {Element} element - Element to apply the style to
|
|
2854
3041
|
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
|
|
2855
|
-
*/
|
|
2856
|
-
function setStyle(element, styles) {
|
|
2857
|
-
function is_numeric(n) {
|
|
2858
|
-
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
2859
|
-
}
|
|
2860
|
-
Object.keys(styles).forEach(function (prop) {
|
|
2861
|
-
var unit = '';
|
|
2862
|
-
// add unit if the value is numeric and is one of the following
|
|
2863
|
-
if (
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
3042
|
+
*/
|
|
3043
|
+
function setStyle(element, styles) {
|
|
3044
|
+
function is_numeric(n) {
|
|
3045
|
+
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
3046
|
+
}
|
|
3047
|
+
Object.keys(styles).forEach(function (prop) {
|
|
3048
|
+
var unit = '';
|
|
3049
|
+
// add unit if the value is numeric and is one of the following
|
|
3050
|
+
if (
|
|
3051
|
+
['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==
|
|
3052
|
+
-1 &&
|
|
3053
|
+
is_numeric(styles[prop])
|
|
3054
|
+
) {
|
|
3055
|
+
unit = 'px';
|
|
3056
|
+
}
|
|
3057
|
+
element.style[prop] = styles[prop] + unit;
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
|
|
2870
3061
|
/**
|
|
2871
3062
|
* Check if the given variable is a function
|
|
2872
3063
|
* @function
|
|
2873
3064
|
* @ignore
|
|
2874
3065
|
* @argument {*} functionToCheck - variable to check
|
|
2875
3066
|
* @returns {Boolean} answer to: is a function?
|
|
2876
|
-
*/
|
|
2877
|
-
function isFunction(functionToCheck) {
|
|
2878
|
-
var getType = {};
|
|
2879
|
-
return
|
|
2880
|
-
|
|
2881
|
-
|
|
3067
|
+
*/
|
|
3068
|
+
function isFunction(functionToCheck) {
|
|
3069
|
+
var getType = {};
|
|
3070
|
+
return (
|
|
3071
|
+
functionToCheck &&
|
|
3072
|
+
getType.toString.call(functionToCheck) === '[object Function]'
|
|
3073
|
+
);
|
|
3074
|
+
}
|
|
3075
|
+
|
|
2882
3076
|
/**
|
|
2883
3077
|
* Get the position of the given element, relative to its offset parent
|
|
2884
3078
|
* @function
|
|
2885
3079
|
* @ignore
|
|
2886
3080
|
* @param {Element} element
|
|
2887
3081
|
* @return {Object} position - Coordinates of the element and its `scrollTop`
|
|
2888
|
-
*/
|
|
2889
|
-
function getOffsetRect(element) {
|
|
2890
|
-
var transform = getStyle(element, 'transform')
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
3082
|
+
*/
|
|
3083
|
+
function getOffsetRect(element) {
|
|
3084
|
+
var transform = getStyle(element, 'transform')
|
|
3085
|
+
.replace(/[^0-9\-,]/g, '')
|
|
3086
|
+
.split(',');
|
|
3087
|
+
var elementRect = {
|
|
3088
|
+
width: element.offsetWidth,
|
|
3089
|
+
height: element.offsetHeight,
|
|
3090
|
+
left:
|
|
3091
|
+
element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
|
|
3092
|
+
top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
|
|
3093
|
+
};
|
|
3094
|
+
|
|
3095
|
+
elementRect.right = elementRect.left + elementRect.width;
|
|
3096
|
+
elementRect.bottom = elementRect.top + elementRect.height;
|
|
3097
|
+
|
|
3098
|
+
// position
|
|
3099
|
+
return elementRect;
|
|
3100
|
+
}
|
|
3101
|
+
|
|
2905
3102
|
/**
|
|
2906
3103
|
* Get bounding client rect of given element
|
|
2907
3104
|
* @function
|
|
2908
3105
|
* @ignore
|
|
2909
3106
|
* @param {HTMLElement} element
|
|
2910
3107
|
* @return {Object} client rect
|
|
2911
|
-
*/
|
|
2912
|
-
function getBoundingClientRect(element) {
|
|
2913
|
-
var rect = element.getBoundingClientRect();
|
|
2914
|
-
|
|
2915
|
-
// whether the IE version is lower than 11
|
|
2916
|
-
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
2917
|
-
|
|
2918
|
-
// fix ie document bounding top always 0 bug
|
|
2919
|
-
var rectTop =
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
3108
|
+
*/
|
|
3109
|
+
function getBoundingClientRect(element) {
|
|
3110
|
+
var rect = element.getBoundingClientRect();
|
|
3111
|
+
|
|
3112
|
+
// whether the IE version is lower than 11
|
|
3113
|
+
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
3114
|
+
|
|
3115
|
+
// fix ie document bounding top always 0 bug
|
|
3116
|
+
var rectTop =
|
|
3117
|
+
isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
|
|
3118
|
+
|
|
3119
|
+
return {
|
|
3120
|
+
left: rect.left,
|
|
3121
|
+
top: rectTop,
|
|
3122
|
+
right: rect.right,
|
|
3123
|
+
bottom: rect.bottom,
|
|
3124
|
+
width: rect.right - rect.left,
|
|
3125
|
+
height: rect.bottom - rectTop
|
|
3126
|
+
};
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
function getStyle(dom, attr) {
|
|
3130
|
+
if (dom.style[attr]) {
|
|
3131
|
+
return dom.style[attr];
|
|
3132
|
+
}
|
|
3133
|
+
if (window.getComputedStyle) {
|
|
3134
|
+
return getComputedStyle(dom, null)[attr];
|
|
3135
|
+
}
|
|
3136
|
+
return dom.currentStyle[attr];
|
|
3137
|
+
}
|
|
3138
|
+
|
|
2941
3139
|
/**
|
|
2942
3140
|
* Given an element and one of its parents, return the offset
|
|
2943
3141
|
* @function
|
|
@@ -2945,49 +3143,45 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2945
3143
|
* @param {HTMLElement} element
|
|
2946
3144
|
* @param {HTMLElement} parent
|
|
2947
3145
|
* @return {Object} rect
|
|
2948
|
-
*/
|
|
2949
|
-
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
2950
|
-
var elementRect = getBoundingClientRect(element);
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
parentRect.
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
width: elementRect.width,
|
|
2967
|
-
height: elementRect.height
|
|
2968
|
-
};
|
|
2969
|
-
return rect;
|
|
2970
|
-
}
|
|
2971
|
-
|
|
3146
|
+
*/
|
|
3147
|
+
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
3148
|
+
var elementRect = getBoundingClientRect(element);
|
|
3149
|
+
// parent 为 popper 元素:取其真实包含块的视口 rect,
|
|
3150
|
+
// 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
|
|
3151
|
+
var parentRect = getContainingBlockRect(parent, fixed);
|
|
3152
|
+
|
|
3153
|
+
var rect = {
|
|
3154
|
+
top: elementRect.top - parentRect.top,
|
|
3155
|
+
left: elementRect.left - parentRect.left,
|
|
3156
|
+
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
3157
|
+
right: elementRect.left - parentRect.left + elementRect.width,
|
|
3158
|
+
width: elementRect.width,
|
|
3159
|
+
height: elementRect.height
|
|
3160
|
+
};
|
|
3161
|
+
return rect;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
2972
3164
|
/**
|
|
2973
3165
|
* Get the prefixed supported property name
|
|
2974
3166
|
* @function
|
|
2975
3167
|
* @ignore
|
|
2976
3168
|
* @argument {String} property (camelCase)
|
|
2977
3169
|
* @returns {String} prefixed property (camelCase)
|
|
2978
|
-
*/
|
|
2979
|
-
function getSupportedPropertyName(property) {
|
|
2980
|
-
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
2981
|
-
|
|
2982
|
-
for (var i = 0; i < prefixes.length; i++) {
|
|
2983
|
-
var toCheck = prefixes[i]
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
3170
|
+
*/
|
|
3171
|
+
function getSupportedPropertyName(property) {
|
|
3172
|
+
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
3173
|
+
|
|
3174
|
+
for (var i = 0; i < prefixes.length; i++) {
|
|
3175
|
+
var toCheck = prefixes[i]
|
|
3176
|
+
? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1)
|
|
3177
|
+
: property;
|
|
3178
|
+
if (typeof root.document.body.style[toCheck] !== 'undefined') {
|
|
3179
|
+
return toCheck;
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
return null;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
2991
3185
|
/**
|
|
2992
3186
|
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
|
|
2993
3187
|
* objects to a target object. It will return the target object.
|
|
@@ -2995,45 +3189,50 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
|
|
|
2995
3189
|
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
2996
3190
|
* @function
|
|
2997
3191
|
* @ignore
|
|
2998
|
-
*/
|
|
2999
|
-
if (!Object.assign) {
|
|
3000
|
-
Object.defineProperty(Object, 'assign', {
|
|
3001
|
-
enumerable: false,
|
|
3002
|
-
configurable: true,
|
|
3003
|
-
writable: true,
|
|
3004
|
-
value: function
|
|
3005
|
-
if (target === undefined || target === null) {
|
|
3006
|
-
throw new TypeError('Cannot convert first argument to object');
|
|
3007
|
-
}
|
|
3192
|
+
*/
|
|
3193
|
+
if (!Object.assign) {
|
|
3194
|
+
Object.defineProperty(Object, 'assign', {
|
|
3195
|
+
enumerable: false,
|
|
3196
|
+
configurable: true,
|
|
3197
|
+
writable: true,
|
|
3198
|
+
value: function (target) {
|
|
3199
|
+
if (target === undefined || target === null) {
|
|
3200
|
+
throw new TypeError('Cannot convert first argument to object');
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
var to = Object(target);
|
|
3204
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
3205
|
+
var nextSource = arguments[i];
|
|
3206
|
+
if (nextSource === undefined || nextSource === null) {
|
|
3207
|
+
continue;
|
|
3208
|
+
}
|
|
3209
|
+
nextSource = Object(nextSource);
|
|
3210
|
+
|
|
3211
|
+
var keysArray = Object.keys(nextSource);
|
|
3212
|
+
for (
|
|
3213
|
+
var nextIndex = 0, len = keysArray.length;
|
|
3214
|
+
nextIndex < len;
|
|
3215
|
+
nextIndex++
|
|
3216
|
+
) {
|
|
3217
|
+
var nextKey = keysArray[nextIndex];
|
|
3218
|
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
3219
|
+
if (desc !== undefined && desc.enumerable) {
|
|
3220
|
+
to[nextKey] = nextSource[nextKey];
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
return to;
|
|
3225
|
+
}
|
|
3226
|
+
});
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
return Popper;
|
|
3230
|
+
});
|
|
3008
3231
|
|
|
3009
|
-
var to = Object(target);
|
|
3010
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3011
|
-
var nextSource = arguments[i];
|
|
3012
|
-
if (nextSource === undefined || nextSource === null) {
|
|
3013
|
-
continue;
|
|
3014
|
-
}
|
|
3015
|
-
nextSource = Object(nextSource);
|
|
3016
|
-
|
|
3017
|
-
var keysArray = Object.keys(nextSource);
|
|
3018
|
-
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
|
3019
|
-
var nextKey = keysArray[nextIndex];
|
|
3020
|
-
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
3021
|
-
if (desc !== undefined && desc.enumerable) {
|
|
3022
|
-
to[nextKey] = nextSource[nextKey];
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
}
|
|
3026
|
-
return to;
|
|
3027
|
-
}
|
|
3028
|
-
});
|
|
3029
|
-
}
|
|
3030
|
-
|
|
3031
|
-
return Popper;
|
|
3032
|
-
});
|
|
3033
3232
|
|
|
3034
3233
|
/***/ }),
|
|
3035
3234
|
|
|
3036
|
-
/***/
|
|
3235
|
+
/***/ 63:
|
|
3037
3236
|
/***/ (function(module, exports) {
|
|
3038
3237
|
|
|
3039
3238
|
module.exports = require("eoss/lib/dropdown-item");
|