eoss 0.1.0-alpha.39 → 0.1.0-alpha.40
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 +837 -862
- package/lib/alert.js +2 -2
- package/lib/aside.js +2 -2
- package/lib/audit-trajectory.js +4 -4
- package/lib/autocomplete.js +1813 -1988
- 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 +837 -862
- package/lib/calendar.js +839 -864
- package/lib/card.js +2 -2
- package/lib/carousel-item.js +846 -871
- package/lib/carousel.js +839 -864
- package/lib/cascader-panel.js +852 -877
- package/lib/cascader.js +2048 -2223
- package/lib/checkbox-button.js +4 -4
- package/lib/checkbox-group.js +859 -884
- package/lib/checkbox.js +4 -4
- package/lib/col.js +2 -2
- package/lib/collapse-item.js +1040 -1065
- package/lib/collapse.js +1040 -1065
- package/lib/color-picker.js +972 -1122
- package/lib/container.js +2 -2
- package/lib/cron.js +12 -12
- package/lib/data-table.js +843 -868
- package/lib/date-picker.js +10520 -10695
- package/lib/descriptions-item.js +4 -4
- package/lib/descriptions.js +4 -4
- package/lib/dialog.js +837 -862
- package/lib/divider.js +2 -2
- package/lib/drawer.js +2 -2
- package/lib/dropdown-item.js +4 -4
- package/lib/dropdown-menu.js +974 -1124
- package/lib/dropdown.js +841 -866
- package/lib/email-login.js +837 -862
- package/lib/empty.js +2 -2
- package/lib/eoss.common.js +4023 -2668
- package/lib/flip.js +2 -2
- package/lib/flow-group.js +853 -878
- package/lib/flow.js +868 -893
- package/lib/flows.js +854 -879
- package/lib/footer.js +2 -2
- package/lib/form-item.js +860 -885
- package/lib/form.js +933 -950
- package/lib/guide.js +2 -2
- package/lib/header.js +2 -2
- package/lib/icon.js +837 -862
- package/lib/icons.js +2 -2
- package/lib/image-viewer.js +837 -862
- 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 +839 -864
- package/lib/link.js +2 -2
- package/lib/loading.js +2 -2
- package/lib/login.js +867 -891
- package/lib/lowcode-view.js +1843 -1185
- package/lib/lowcode.js +3050 -1569
- package/lib/main.js +970 -988
- package/lib/marquee.js +837 -862
- package/lib/menu-item-group.js +15 -15
- package/lib/menu-item.js +6 -6
- package/lib/menu.js +2227 -2368
- package/lib/message-box.js +843 -868
- package/lib/message.js +839 -864
- package/lib/notification.js +861 -886
- package/lib/option-group.js +4 -4
- package/lib/option.js +839 -864
- package/lib/page-header.js +2 -2
- package/lib/pagination.js +839 -864
- package/lib/phone-login.js +847 -866
- package/lib/popconfirm.js +4 -4
- package/lib/popover.js +1831 -2006
- package/lib/process-config.js +839 -864
- package/lib/process-module.js +846 -871
- package/lib/process-rule.js +905 -930
- package/lib/progress.js +2 -2
- package/lib/qr-code.js +4 -4
- package/lib/qrcode-login.js +839 -864
- package/lib/radio-button.js +4 -4
- package/lib/radio-group.js +850 -875
- package/lib/radio.js +4 -4
- package/lib/rate.js +837 -862
- package/lib/retrial-auth.js +837 -862
- package/lib/row.js +2 -2
- package/lib/scrollbar.js +839 -864
- package/lib/select.js +2139 -2314
- package/lib/selector-panel.js +940 -965
- package/lib/selector.js +852 -877
- package/lib/slider.js +4 -4
- package/lib/step.js +32 -32
- package/lib/steps.js +874 -899
- package/lib/submenu.js +1269 -1385
- package/lib/switch.js +839 -864
- package/lib/tab-pane.js +4 -4
- package/lib/table-column.js +840 -865
- package/lib/table.js +1825 -2000
- package/lib/tabs.js +846 -871
- package/lib/tag.js +2 -2
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/lowcode.css +1 -1
- package/lib/time-picker.js +6471 -6646
- package/lib/time-select.js +5039 -5214
- package/lib/timeline-item.js +2 -2
- package/lib/timeline.js +2 -2
- package/lib/tips.js +837 -862
- package/lib/toolbar.js +4 -4
- package/lib/tooltip.js +1813 -1988
- package/lib/transfer.js +837 -862
- package/lib/tree-group.js +853 -878
- package/lib/tree.js +1026 -1051
- package/lib/update-history.js +4 -4
- package/lib/upload.js +859 -884
- package/lib/wujie.js +841 -866
- package/package.json +1 -1
- package/packages/flow-group/src/main.vue +2 -2
- package/packages/form/src/form-item-render.vue +1 -0
- package/packages/form/src/form-item.vue +12 -6
- package/packages/form/src/form.vue +5 -5
- package/packages/login/src/login.vue +1 -0
- package/packages/lowcode/src/attribute/function.vue +28 -9
- package/packages/lowcode/src/attribute/props.vue +202 -0
- package/packages/lowcode/src/attribute/styles.vue +79 -5
- package/packages/lowcode/src/attribute.vue +61 -4
- package/packages/lowcode/src/canvas.vue +159 -2
- package/packages/lowcode/src/form-render.vue +305 -0
- package/packages/lowcode/src/lowcode.vue +33 -13
- package/packages/lowcode/src/modules.vue +53 -37
- package/packages/lowcode/src/render.vue +80 -25
- package/packages/lowcode/src/util/components.js +100 -0
- package/packages/lowcode/src/util/props-util.js +67 -0
- package/packages/lowcode/src/util/source-generator.js +69 -9
- package/packages/lowcode/src/util/source-parser.js +64 -10
- package/packages/lowcode-view/src/render.vue +48 -18
- package/packages/main/src/components/userinfo.vue +0 -1
- package/packages/menu/src/menu-item-group.vue +1 -1
- package/packages/menu/src/mixins.js +8 -4
- package/packages/menu/src/submenu.vue +35 -5
- package/packages/phone-login/src/phone-login.vue +5 -2
- package/packages/theme-chalk/dist/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/dist/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/src/lowcode.scss +21 -2
- package/src/index.js +336 -336
package/lib/color-picker.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 193);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -361,7 +361,7 @@ function _broadcast(componentName, eventName, params) {
|
|
|
361
361
|
|
|
362
362
|
/***/ }),
|
|
363
363
|
|
|
364
|
-
/***/
|
|
364
|
+
/***/ 193:
|
|
365
365
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
366
366
|
|
|
367
367
|
"use strict";
|
|
@@ -2317,7 +2317,7 @@ function scrollMove(wrap) {
|
|
|
2317
2317
|
|
|
2318
2318
|
|
|
2319
2319
|
|
|
2320
|
-
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(
|
|
2320
|
+
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(53);
|
|
2321
2321
|
var stopPropagation = function stopPropagation(e) {
|
|
2322
2322
|
return e.stopPropagation();
|
|
2323
2323
|
};
|
|
@@ -3331,10 +3331,12 @@ function insertAfter(newEl, targetEl) {
|
|
|
3331
3331
|
|
|
3332
3332
|
/***/ }),
|
|
3333
3333
|
|
|
3334
|
-
/***/
|
|
3334
|
+
/***/ 53:
|
|
3335
3335
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3336
3336
|
|
|
3337
|
-
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__
|
|
3337
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
3338
|
+
|
|
3339
|
+
/**
|
|
3338
3340
|
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
3339
3341
|
* @version {{version}}
|
|
3340
3342
|
* @license
|
|
@@ -3357,68 +3359,60 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3357
3359
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3358
3360
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3359
3361
|
* SOFTWARE.
|
|
3360
|
-
*/
|
|
3361
|
-
|
|
3362
|
-
//
|
|
3363
|
-
// Cross module loader
|
|
3364
|
-
// Supported: Node, AMD, Browser globals
|
|
3365
|
-
//
|
|
3366
|
-
(function (root, factory) {
|
|
3367
|
-
if (true) {
|
|
3368
|
-
// AMD. Register as an anonymous module.
|
|
3362
|
+
*/
|
|
3363
|
+
|
|
3364
|
+
//
|
|
3365
|
+
// Cross module loader
|
|
3366
|
+
// Supported: Node, AMD, Browser globals
|
|
3367
|
+
//
|
|
3368
|
+
(function (root, factory) {
|
|
3369
|
+
if (true) {
|
|
3370
|
+
// AMD. Register as an anonymous module.
|
|
3369
3371
|
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
3370
3372
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
3371
3373
|
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
3372
3374
|
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
3373
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
3374
|
-
} else {}
|
|
3375
|
-
})(this, function () {
|
|
3376
|
-
'use strict';
|
|
3377
|
-
|
|
3378
|
-
var root =
|
|
3379
|
-
// default options
|
|
3380
|
-
var DEFAULTS = {
|
|
3381
|
-
// placement of the popper
|
|
3382
|
-
placement: 'bottom',
|
|
3383
|
-
|
|
3384
|
-
gpuAcceleration: true,
|
|
3385
|
-
|
|
3386
|
-
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
3387
|
-
offset: 0,
|
|
3388
|
-
|
|
3389
|
-
// the element which will act as boundary of the popper
|
|
3390
|
-
boundariesElement: 'viewport',
|
|
3391
|
-
|
|
3392
|
-
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
3393
|
-
boundariesPadding: 5,
|
|
3394
|
-
|
|
3395
|
-
// popper will try to prevent overflow following this order,
|
|
3396
|
-
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
3397
|
-
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
3398
|
-
|
|
3399
|
-
// the behavior used by flip to change the placement of the popper
|
|
3400
|
-
flipBehavior: 'flip',
|
|
3401
|
-
|
|
3402
|
-
arrowElement: '[x-arrow]',
|
|
3403
|
-
|
|
3404
|
-
arrowOffset: 0,
|
|
3405
|
-
|
|
3406
|
-
// list of functions used to modify the offsets before they are applied to the popper
|
|
3407
|
-
modifiers: [
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
'applyStyle'
|
|
3415
|
-
],
|
|
3416
|
-
|
|
3417
|
-
modifiersIgnored: [],
|
|
3418
|
-
|
|
3419
|
-
forceAbsolute: false
|
|
3420
|
-
};
|
|
3421
|
-
|
|
3375
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
3376
|
+
} else {}
|
|
3377
|
+
})(this, function () {
|
|
3378
|
+
'use strict';
|
|
3379
|
+
|
|
3380
|
+
var root = window;
|
|
3381
|
+
// default options
|
|
3382
|
+
var DEFAULTS = {
|
|
3383
|
+
// placement of the popper
|
|
3384
|
+
placement: 'bottom',
|
|
3385
|
+
|
|
3386
|
+
gpuAcceleration: true,
|
|
3387
|
+
|
|
3388
|
+
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
3389
|
+
offset: 0,
|
|
3390
|
+
|
|
3391
|
+
// the element which will act as boundary of the popper
|
|
3392
|
+
boundariesElement: 'viewport',
|
|
3393
|
+
|
|
3394
|
+
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
3395
|
+
boundariesPadding: 5,
|
|
3396
|
+
|
|
3397
|
+
// popper will try to prevent overflow following this order,
|
|
3398
|
+
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
3399
|
+
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
3400
|
+
|
|
3401
|
+
// the behavior used by flip to change the placement of the popper
|
|
3402
|
+
flipBehavior: 'flip',
|
|
3403
|
+
|
|
3404
|
+
arrowElement: '[x-arrow]',
|
|
3405
|
+
|
|
3406
|
+
arrowOffset: 0,
|
|
3407
|
+
|
|
3408
|
+
// list of functions used to modify the offsets before they are applied to the popper
|
|
3409
|
+
modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
|
|
3410
|
+
|
|
3411
|
+
modifiersIgnored: [],
|
|
3412
|
+
|
|
3413
|
+
forceAbsolute: false
|
|
3414
|
+
};
|
|
3415
|
+
|
|
3422
3416
|
/**
|
|
3423
3417
|
* Create a new Popper.js instance
|
|
3424
3418
|
* @constructor Popper
|
|
@@ -3483,125 +3477,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3483
3477
|
*
|
|
3484
3478
|
* @param {Boolean} [options.removeOnDestroy=false]
|
|
3485
3479
|
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
|
|
3486
|
-
*/
|
|
3487
|
-
function Popper(reference, popper, options) {
|
|
3488
|
-
this._reference = reference.jquery ? reference[0] : reference;
|
|
3489
|
-
this.state = {};
|
|
3490
|
-
|
|
3491
|
-
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
3492
|
-
// generate a default popper if is not defined
|
|
3493
|
-
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
3494
|
-
var isConfig =
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
);
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
//
|
|
3529
|
-
this.
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
//
|
|
3537
|
-
// Methods
|
|
3538
|
-
//
|
|
3480
|
+
*/
|
|
3481
|
+
function Popper(reference, popper, options) {
|
|
3482
|
+
this._reference = reference.jquery ? reference[0] : reference;
|
|
3483
|
+
this.state = {};
|
|
3484
|
+
|
|
3485
|
+
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
3486
|
+
// generate a default popper if is not defined
|
|
3487
|
+
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
3488
|
+
var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
|
|
3489
|
+
if (isNotDefined || isConfig) {
|
|
3490
|
+
this._popper = this.parse(isConfig ? popper : {});
|
|
3491
|
+
}
|
|
3492
|
+
// otherwise, use the given HTMLElement as popper
|
|
3493
|
+
else {
|
|
3494
|
+
this._popper = popper.jquery ? popper[0] : popper;
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
// with {} we create a new object with the options inside it
|
|
3498
|
+
this._options = Object.assign({}, DEFAULTS, options);
|
|
3499
|
+
|
|
3500
|
+
// refactoring modifiers' list
|
|
3501
|
+
this._options.modifiers = this._options.modifiers.map(function (modifier) {
|
|
3502
|
+
// remove ignored modifiers
|
|
3503
|
+
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
|
|
3504
|
+
|
|
3505
|
+
// set the x-placement attribute before everything else because it could be used to add margins to the popper
|
|
3506
|
+
// margins needs to be calculated to get the correct popper offsets
|
|
3507
|
+
if (modifier === 'applyStyle') {
|
|
3508
|
+
this._popper.setAttribute('x-placement', this._options.placement);
|
|
3509
|
+
}
|
|
3510
|
+
|
|
3511
|
+
// return predefined modifier identified by string or keep the custom one
|
|
3512
|
+
return this.modifiers[modifier] || modifier;
|
|
3513
|
+
}.bind(this));
|
|
3514
|
+
|
|
3515
|
+
// make sure to apply the popper position before any computation
|
|
3516
|
+
this.state.position = this._getPosition(this._popper, this._reference);
|
|
3517
|
+
setStyle(this._popper, { position: this.state.position, top: 0 });
|
|
3518
|
+
|
|
3519
|
+
// fire the first update to position the popper in the right place
|
|
3520
|
+
this.update();
|
|
3521
|
+
|
|
3522
|
+
// setup event listeners, they will take care of update the position in specific situations
|
|
3523
|
+
this._setupEventListeners();
|
|
3524
|
+
return this;
|
|
3525
|
+
}
|
|
3526
|
+
|
|
3527
|
+
//
|
|
3528
|
+
// Methods
|
|
3529
|
+
//
|
|
3539
3530
|
/**
|
|
3540
3531
|
* Destroy the popper
|
|
3541
3532
|
* @method
|
|
3542
3533
|
* @memberof Popper
|
|
3543
|
-
*/
|
|
3544
|
-
Popper.prototype.destroy = function () {
|
|
3545
|
-
this._popper.removeAttribute('x-placement');
|
|
3546
|
-
this._popper.style.left = '';
|
|
3547
|
-
this._popper.style.position = '';
|
|
3548
|
-
this._popper.style.top = '';
|
|
3549
|
-
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
3550
|
-
this._removeEventListeners();
|
|
3551
|
-
|
|
3552
|
-
// remove the popper if user explicity asked for the deletion on destroy
|
|
3553
|
-
if (this._options.removeOnDestroy) {
|
|
3554
|
-
this._popper.remove();
|
|
3555
|
-
}
|
|
3556
|
-
return this;
|
|
3557
|
-
};
|
|
3558
|
-
|
|
3534
|
+
*/
|
|
3535
|
+
Popper.prototype.destroy = function () {
|
|
3536
|
+
this._popper.removeAttribute('x-placement');
|
|
3537
|
+
this._popper.style.left = '';
|
|
3538
|
+
this._popper.style.position = '';
|
|
3539
|
+
this._popper.style.top = '';
|
|
3540
|
+
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
3541
|
+
this._removeEventListeners();
|
|
3542
|
+
|
|
3543
|
+
// remove the popper if user explicity asked for the deletion on destroy
|
|
3544
|
+
if (this._options.removeOnDestroy) {
|
|
3545
|
+
this._popper.remove();
|
|
3546
|
+
}
|
|
3547
|
+
return this;
|
|
3548
|
+
};
|
|
3549
|
+
|
|
3559
3550
|
/**
|
|
3560
3551
|
* Updates the position of the popper, computing the new offsets and applying the new style
|
|
3561
3552
|
* @method
|
|
3562
3553
|
* @memberof Popper
|
|
3563
|
-
*/
|
|
3564
|
-
Popper.prototype.update = function () {
|
|
3565
|
-
var data = { instance: this, styles: {} };
|
|
3566
|
-
|
|
3567
|
-
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
3568
|
-
// and refer to _originalPlacement to know the original value
|
|
3569
|
-
data.placement = this._options.placement;
|
|
3570
|
-
data._originalPlacement = this._options.placement;
|
|
3571
|
-
|
|
3572
|
-
// compute the popper and reference offsets and put them inside data.offsets
|
|
3573
|
-
data.offsets = this._getOffsets(
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
data
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
data = this.runModifiers(data, this._options.modifiers);
|
|
3587
|
-
|
|
3588
|
-
if (typeof this.state.updateCallback === 'function') {
|
|
3589
|
-
this.state.updateCallback(data);
|
|
3590
|
-
}
|
|
3591
|
-
};
|
|
3592
|
-
|
|
3554
|
+
*/
|
|
3555
|
+
Popper.prototype.update = function () {
|
|
3556
|
+
var data = { instance: this, styles: {} };
|
|
3557
|
+
|
|
3558
|
+
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
3559
|
+
// and refer to _originalPlacement to know the original value
|
|
3560
|
+
data.placement = this._options.placement;
|
|
3561
|
+
data._originalPlacement = this._options.placement;
|
|
3562
|
+
|
|
3563
|
+
// compute the popper and reference offsets and put them inside data.offsets
|
|
3564
|
+
data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
|
|
3565
|
+
|
|
3566
|
+
// get boundaries
|
|
3567
|
+
data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
|
|
3568
|
+
|
|
3569
|
+
data = this.runModifiers(data, this._options.modifiers);
|
|
3570
|
+
|
|
3571
|
+
if (typeof this.state.updateCallback === 'function') {
|
|
3572
|
+
this.state.updateCallback(data);
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
|
|
3593
3576
|
/**
|
|
3594
3577
|
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
|
|
3595
3578
|
* @method
|
|
3596
3579
|
* @memberof Popper
|
|
3597
3580
|
* @param {Function} callback
|
|
3598
|
-
*/
|
|
3599
|
-
Popper.prototype.onCreate = function (callback) {
|
|
3600
|
-
// the createCallbacks return as first argument the popper instance
|
|
3601
|
-
callback(this);
|
|
3602
|
-
return this;
|
|
3603
|
-
};
|
|
3604
|
-
|
|
3581
|
+
*/
|
|
3582
|
+
Popper.prototype.onCreate = function (callback) {
|
|
3583
|
+
// the createCallbacks return as first argument the popper instance
|
|
3584
|
+
callback(this);
|
|
3585
|
+
return this;
|
|
3586
|
+
};
|
|
3587
|
+
|
|
3605
3588
|
/**
|
|
3606
3589
|
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
|
|
3607
3590
|
* used to style popper and its arrow.
|
|
@@ -3609,101 +3592,93 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3609
3592
|
* @method
|
|
3610
3593
|
* @memberof Popper
|
|
3611
3594
|
* @param {Function} callback
|
|
3612
|
-
*/
|
|
3613
|
-
Popper.prototype.onUpdate = function (callback) {
|
|
3614
|
-
this.state.updateCallback = callback;
|
|
3615
|
-
return this;
|
|
3616
|
-
};
|
|
3617
|
-
|
|
3595
|
+
*/
|
|
3596
|
+
Popper.prototype.onUpdate = function (callback) {
|
|
3597
|
+
this.state.updateCallback = callback;
|
|
3598
|
+
return this;
|
|
3599
|
+
};
|
|
3600
|
+
|
|
3618
3601
|
/**
|
|
3619
3602
|
* Helper used to generate poppers from a configuration file
|
|
3620
3603
|
* @method
|
|
3621
3604
|
* @memberof Popper
|
|
3622
3605
|
* @param config {Object} configuration
|
|
3623
3606
|
* @returns {HTMLElement} popper
|
|
3624
|
-
*/
|
|
3625
|
-
Popper.prototype.parse = function (config) {
|
|
3626
|
-
var defaultConfig = {
|
|
3627
|
-
tagName: 'div',
|
|
3628
|
-
classNames: ['popper'],
|
|
3629
|
-
attributes: [],
|
|
3630
|
-
parent: root.document.body,
|
|
3631
|
-
content: '',
|
|
3632
|
-
contentType: 'text',
|
|
3633
|
-
arrowTagName: 'div',
|
|
3634
|
-
arrowClassNames: ['popper__arrow'],
|
|
3635
|
-
arrowAttributes: ['x-arrow']
|
|
3636
|
-
};
|
|
3637
|
-
config = Object.assign({}, defaultConfig, config);
|
|
3638
|
-
|
|
3639
|
-
var d = root.document;
|
|
3640
|
-
|
|
3641
|
-
var popper = d.createElement(config.tagName);
|
|
3642
|
-
addClassNames(popper, config.classNames);
|
|
3643
|
-
addAttributes(popper, config.attributes);
|
|
3644
|
-
if (config.contentType === 'node') {
|
|
3645
|
-
popper.appendChild(
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
} else
|
|
3649
|
-
popper.
|
|
3650
|
-
}
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
// if
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
parent = parent[0];
|
|
3679
|
-
}
|
|
3680
|
-
|
|
3681
|
-
// the
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
parent = parent[0];
|
|
3687
|
-
}
|
|
3688
|
-
|
|
3689
|
-
// append the generated popper to its parent
|
|
3690
|
-
parent.appendChild(popper);
|
|
3691
|
-
|
|
3692
|
-
return popper;
|
|
3693
|
-
|
|
3607
|
+
*/
|
|
3608
|
+
Popper.prototype.parse = function (config) {
|
|
3609
|
+
var defaultConfig = {
|
|
3610
|
+
tagName: 'div',
|
|
3611
|
+
classNames: ['popper'],
|
|
3612
|
+
attributes: [],
|
|
3613
|
+
parent: root.document.body,
|
|
3614
|
+
content: '',
|
|
3615
|
+
contentType: 'text',
|
|
3616
|
+
arrowTagName: 'div',
|
|
3617
|
+
arrowClassNames: ['popper__arrow'],
|
|
3618
|
+
arrowAttributes: ['x-arrow']
|
|
3619
|
+
};
|
|
3620
|
+
config = Object.assign({}, defaultConfig, config);
|
|
3621
|
+
|
|
3622
|
+
var d = root.document;
|
|
3623
|
+
|
|
3624
|
+
var popper = d.createElement(config.tagName);
|
|
3625
|
+
addClassNames(popper, config.classNames);
|
|
3626
|
+
addAttributes(popper, config.attributes);
|
|
3627
|
+
if (config.contentType === 'node') {
|
|
3628
|
+
popper.appendChild(config.content.jquery ? config.content[0] : config.content);
|
|
3629
|
+
} else if (config.contentType === 'html') {
|
|
3630
|
+
popper.innerHTML = config.content;
|
|
3631
|
+
} else {
|
|
3632
|
+
popper.textContent = config.content;
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
if (config.arrowTagName) {
|
|
3636
|
+
var arrow = d.createElement(config.arrowTagName);
|
|
3637
|
+
addClassNames(arrow, config.arrowClassNames);
|
|
3638
|
+
addAttributes(arrow, config.arrowAttributes);
|
|
3639
|
+
popper.appendChild(arrow);
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
3643
|
+
|
|
3644
|
+
// if the given parent is a string, use it to match an element
|
|
3645
|
+
// if more than one element is matched, the first one will be used as parent
|
|
3646
|
+
// if no elements are matched, the script will throw an error
|
|
3647
|
+
if (typeof parent === 'string') {
|
|
3648
|
+
parent = d.querySelectorAll(config.parent);
|
|
3649
|
+
if (parent.length > 1) {
|
|
3650
|
+
console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
|
|
3651
|
+
}
|
|
3652
|
+
if (parent.length === 0) {
|
|
3653
|
+
throw "ERROR: the given `parent` doesn't exists!";
|
|
3654
|
+
}
|
|
3655
|
+
parent = parent[0];
|
|
3656
|
+
}
|
|
3657
|
+
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
|
|
3658
|
+
// the first one will be used as parent
|
|
3659
|
+
if (parent.length > 1 && parent instanceof Element === false) {
|
|
3660
|
+
console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
|
|
3661
|
+
parent = parent[0];
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
// append the generated popper to its parent
|
|
3665
|
+
parent.appendChild(popper);
|
|
3666
|
+
|
|
3667
|
+
return popper;
|
|
3668
|
+
|
|
3694
3669
|
/**
|
|
3695
3670
|
* Adds class names to the given element
|
|
3696
3671
|
* @function
|
|
3697
3672
|
* @ignore
|
|
3698
3673
|
* @param {HTMLElement} target
|
|
3699
3674
|
* @param {Array} classes
|
|
3700
|
-
*/
|
|
3701
|
-
function addClassNames(element, classNames) {
|
|
3702
|
-
classNames.forEach(function (className) {
|
|
3703
|
-
element.classList.add(className);
|
|
3704
|
-
});
|
|
3705
|
-
}
|
|
3706
|
-
|
|
3675
|
+
*/
|
|
3676
|
+
function addClassNames(element, classNames) {
|
|
3677
|
+
classNames.forEach(function (className) {
|
|
3678
|
+
element.classList.add(className);
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3707
3682
|
/**
|
|
3708
3683
|
* Adds attributes to the given element
|
|
3709
3684
|
* @function
|
|
@@ -3712,17 +3687,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3712
3687
|
* @param {Array} attributes
|
|
3713
3688
|
* @example
|
|
3714
3689
|
* addAttributes(element, [ 'data-info:foobar' ]);
|
|
3715
|
-
*/
|
|
3716
|
-
function addAttributes(element, attributes) {
|
|
3717
|
-
attributes.forEach(function (attribute) {
|
|
3718
|
-
element.setAttribute(
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
}
|
|
3724
|
-
};
|
|
3725
|
-
|
|
3690
|
+
*/
|
|
3691
|
+
function addAttributes(element, attributes) {
|
|
3692
|
+
attributes.forEach(function (attribute) {
|
|
3693
|
+
element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3696
|
+
};
|
|
3697
|
+
|
|
3726
3698
|
/**
|
|
3727
3699
|
* Helper used to get the position which will be applied to the popper
|
|
3728
3700
|
* @method
|
|
@@ -3730,20 +3702,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3730
3702
|
* @param config {HTMLElement} popper element
|
|
3731
3703
|
* @param reference {HTMLElement} reference element
|
|
3732
3704
|
* @returns {String} position
|
|
3733
|
-
*/
|
|
3734
|
-
Popper.prototype._getPosition = function (popper, reference) {
|
|
3735
|
-
var container = getOffsetParent(reference);
|
|
3736
|
-
|
|
3737
|
-
if (this._options.forceAbsolute) {
|
|
3738
|
-
return 'absolute';
|
|
3739
|
-
}
|
|
3740
|
-
|
|
3741
|
-
// Decide if the popper will be fixed
|
|
3742
|
-
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
3743
|
-
var isParentFixed = isFixed(reference, container);
|
|
3744
|
-
return isParentFixed ? 'fixed' : 'absolute';
|
|
3745
|
-
};
|
|
3746
|
-
|
|
3705
|
+
*/
|
|
3706
|
+
Popper.prototype._getPosition = function (popper, reference) {
|
|
3707
|
+
var container = getOffsetParent(reference);
|
|
3708
|
+
|
|
3709
|
+
if (this._options.forceAbsolute) {
|
|
3710
|
+
return 'absolute';
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
// Decide if the popper will be fixed
|
|
3714
|
+
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
3715
|
+
var isParentFixed = isFixed(reference, container);
|
|
3716
|
+
return isParentFixed ? 'fixed' : 'absolute';
|
|
3717
|
+
};
|
|
3718
|
+
|
|
3747
3719
|
/**
|
|
3748
3720
|
* Get offsets to the popper
|
|
3749
3721
|
* @method
|
|
@@ -3752,110 +3724,91 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3752
3724
|
* @param {Element} popper - the popper element
|
|
3753
3725
|
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
3754
3726
|
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
3755
|
-
*/
|
|
3756
|
-
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
3757
|
-
placement = placement.split('-')[0];
|
|
3758
|
-
var popperOffsets = {};
|
|
3759
|
-
|
|
3760
|
-
popperOffsets.position = this.state.position;
|
|
3761
|
-
var isParentFixed = popperOffsets.position === 'fixed';
|
|
3762
|
-
|
|
3763
|
-
//
|
|
3764
|
-
// Get reference element position
|
|
3765
|
-
//
|
|
3766
|
-
var referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
//
|
|
3774
|
-
//
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
//
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
if (placement === '
|
|
3788
|
-
popperOffsets.
|
|
3789
|
-
} else {
|
|
3790
|
-
popperOffsets.
|
|
3791
|
-
}
|
|
3792
|
-
}
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
// Add width and height to our offsets object
|
|
3805
|
-
popperOffsets.width = popperRect.width;
|
|
3806
|
-
popperOffsets.height = popperRect.height;
|
|
3807
|
-
|
|
3808
|
-
return {
|
|
3809
|
-
popper: popperOffsets,
|
|
3810
|
-
reference: referenceOffsets
|
|
3811
|
-
};
|
|
3812
|
-
};
|
|
3813
|
-
|
|
3727
|
+
*/
|
|
3728
|
+
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
3729
|
+
placement = placement.split('-')[0];
|
|
3730
|
+
var popperOffsets = {};
|
|
3731
|
+
|
|
3732
|
+
popperOffsets.position = this.state.position;
|
|
3733
|
+
var isParentFixed = popperOffsets.position === 'fixed';
|
|
3734
|
+
|
|
3735
|
+
//
|
|
3736
|
+
// Get reference element position
|
|
3737
|
+
//
|
|
3738
|
+
var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, popper, isParentFixed);
|
|
3739
|
+
|
|
3740
|
+
//
|
|
3741
|
+
// Get popper sizes
|
|
3742
|
+
//
|
|
3743
|
+
var popperRect = getOuterSizes(popper);
|
|
3744
|
+
|
|
3745
|
+
//
|
|
3746
|
+
// Compute offsets of popper
|
|
3747
|
+
//
|
|
3748
|
+
|
|
3749
|
+
// depending by the popper placement we have to compute its offsets slightly differently
|
|
3750
|
+
if (['right', 'left'].indexOf(placement) !== -1) {
|
|
3751
|
+
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
|
|
3752
|
+
if (placement === 'left') {
|
|
3753
|
+
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
3754
|
+
} else {
|
|
3755
|
+
popperOffsets.left = referenceOffsets.right;
|
|
3756
|
+
}
|
|
3757
|
+
} else {
|
|
3758
|
+
popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
|
|
3759
|
+
if (placement === 'top') {
|
|
3760
|
+
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
3761
|
+
} else {
|
|
3762
|
+
popperOffsets.top = referenceOffsets.bottom;
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
// Add width and height to our offsets object
|
|
3767
|
+
popperOffsets.width = popperRect.width;
|
|
3768
|
+
popperOffsets.height = popperRect.height;
|
|
3769
|
+
|
|
3770
|
+
return {
|
|
3771
|
+
popper: popperOffsets,
|
|
3772
|
+
reference: referenceOffsets
|
|
3773
|
+
};
|
|
3774
|
+
};
|
|
3775
|
+
|
|
3814
3776
|
/**
|
|
3815
3777
|
* Setup needed event listeners used to update the popper position
|
|
3816
3778
|
* @method
|
|
3817
3779
|
* @memberof Popper
|
|
3818
3780
|
* @access private
|
|
3819
|
-
*/
|
|
3820
|
-
Popper.prototype._setupEventListeners = function () {
|
|
3821
|
-
// NOTE: 1 DOM access here
|
|
3822
|
-
this.state.updateBound = this.update.bind(this);
|
|
3823
|
-
// 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
|
|
3824
|
-
this.state.realWindow = getRealWindow(this._popper);
|
|
3825
|
-
this.state.realWindow.addEventListener('resize', this.state.updateBound);
|
|
3826
|
-
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
3827
|
-
if (this._options.boundariesElement !== 'window') {
|
|
3828
|
-
var target = getScrollParent(this._reference);
|
|
3829
|
-
target.addEventListener('scroll', this.state.updateBound);
|
|
3830
|
-
this.state.scrollTarget = target;
|
|
3831
|
-
}
|
|
3832
|
-
};
|
|
3833
|
-
|
|
3781
|
+
*/
|
|
3782
|
+
Popper.prototype._setupEventListeners = function () {
|
|
3783
|
+
// NOTE: 1 DOM access here
|
|
3784
|
+
this.state.updateBound = this.update.bind(this);
|
|
3785
|
+
// 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
|
|
3786
|
+
this.state.realWindow = getRealWindow(this._popper);
|
|
3787
|
+
this.state.realWindow.addEventListener('resize', this.state.updateBound);
|
|
3788
|
+
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
3789
|
+
if (this._options.boundariesElement !== 'window') {
|
|
3790
|
+
var target = getScrollParent(this._reference);
|
|
3791
|
+
target.addEventListener('scroll', this.state.updateBound);
|
|
3792
|
+
this.state.scrollTarget = target;
|
|
3793
|
+
}
|
|
3794
|
+
};
|
|
3795
|
+
|
|
3834
3796
|
/**
|
|
3835
3797
|
* Remove event listeners used to update the popper position
|
|
3836
3798
|
* @method
|
|
3837
3799
|
* @memberof Popper
|
|
3838
3800
|
* @access private
|
|
3839
|
-
*/
|
|
3840
|
-
Popper.prototype._removeEventListeners = function () {
|
|
3841
|
-
// NOTE: 1 DOM access here
|
|
3842
|
-
(this.state.realWindow || root).removeEventListener(
|
|
3843
|
-
|
|
3844
|
-
this.state.updateBound
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
this.state.scrollTarget.removeEventListener(
|
|
3851
|
-
'scroll',
|
|
3852
|
-
this.state.updateBound
|
|
3853
|
-
);
|
|
3854
|
-
this.state.scrollTarget = null;
|
|
3855
|
-
}
|
|
3856
|
-
this.state.updateBound = null;
|
|
3857
|
-
};
|
|
3858
|
-
|
|
3801
|
+
*/
|
|
3802
|
+
Popper.prototype._removeEventListeners = function () {
|
|
3803
|
+
// NOTE: 1 DOM access here
|
|
3804
|
+
(this.state.realWindow || root).removeEventListener('resize', this.state.updateBound);
|
|
3805
|
+
if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
|
|
3806
|
+
this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
|
|
3807
|
+
this.state.scrollTarget = null;
|
|
3808
|
+
}
|
|
3809
|
+
this.state.updateBound = null;
|
|
3810
|
+
};
|
|
3811
|
+
|
|
3859
3812
|
/**
|
|
3860
3813
|
* Computed the boundaries limits and return them
|
|
3861
3814
|
* @method
|
|
@@ -3865,75 +3818,56 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3865
3818
|
* @param {Number} padding - Boundaries padding
|
|
3866
3819
|
* @param {Element} boundariesElement - Element used to define the boundaries
|
|
3867
3820
|
* @returns {Object} Coordinates of the boundaries
|
|
3868
|
-
*/
|
|
3869
|
-
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
3870
|
-
// NOTE: 1 DOM access here
|
|
3871
|
-
var boundaries = {};
|
|
3872
|
-
var width, height;
|
|
3873
|
-
if (boundariesElement === 'window') {
|
|
3874
|
-
var body = root.document.body,
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
height = Math.max(
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
);
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
} else {
|
|
3919
|
-
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
3920
|
-
boundaries = {
|
|
3921
|
-
top: 0,
|
|
3922
|
-
left: 0,
|
|
3923
|
-
right: boundariesElement.clientWidth,
|
|
3924
|
-
bottom: boundariesElement.clientHeight
|
|
3925
|
-
};
|
|
3926
|
-
} else {
|
|
3927
|
-
boundaries = getOffsetRect(boundariesElement);
|
|
3928
|
-
}
|
|
3929
|
-
}
|
|
3930
|
-
boundaries.left += padding;
|
|
3931
|
-
boundaries.right -= padding;
|
|
3932
|
-
boundaries.top = boundaries.top + padding;
|
|
3933
|
-
boundaries.bottom = boundaries.bottom - padding;
|
|
3934
|
-
return boundaries;
|
|
3935
|
-
};
|
|
3936
|
-
|
|
3821
|
+
*/
|
|
3822
|
+
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
3823
|
+
// NOTE: 1 DOM access here
|
|
3824
|
+
var boundaries = {};
|
|
3825
|
+
var width, height;
|
|
3826
|
+
if (boundariesElement === 'window') {
|
|
3827
|
+
var body = root.document.body,
|
|
3828
|
+
html = root.document.documentElement;
|
|
3829
|
+
|
|
3830
|
+
height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
|
3831
|
+
width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
|
|
3832
|
+
|
|
3833
|
+
boundaries = {
|
|
3834
|
+
top: 0,
|
|
3835
|
+
right: width,
|
|
3836
|
+
bottom: height,
|
|
3837
|
+
left: 0
|
|
3838
|
+
};
|
|
3839
|
+
} else if (boundariesElement === 'viewport') {
|
|
3840
|
+
// 将真实 window 的视口换算到 popper 所在包含块的坐标系。
|
|
3841
|
+
// 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
|
|
3842
|
+
// 统一从元素自身的 view 与真实包含块获取
|
|
3843
|
+
var realWindow = getRealWindow(this._popper);
|
|
3844
|
+
var containingBlockRect = getContainingBlockRect(this._popper, data.offsets.popper.position === 'fixed');
|
|
3845
|
+
|
|
3846
|
+
boundaries = {
|
|
3847
|
+
top: 0 - containingBlockRect.top,
|
|
3848
|
+
right: realWindow.document.documentElement.clientWidth - containingBlockRect.left,
|
|
3849
|
+
bottom: realWindow.document.documentElement.clientHeight - containingBlockRect.top,
|
|
3850
|
+
left: 0 - containingBlockRect.left
|
|
3851
|
+
};
|
|
3852
|
+
} else {
|
|
3853
|
+
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
3854
|
+
boundaries = {
|
|
3855
|
+
top: 0,
|
|
3856
|
+
left: 0,
|
|
3857
|
+
right: boundariesElement.clientWidth,
|
|
3858
|
+
bottom: boundariesElement.clientHeight
|
|
3859
|
+
};
|
|
3860
|
+
} else {
|
|
3861
|
+
boundaries = getOffsetRect(boundariesElement);
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
boundaries.left += padding;
|
|
3865
|
+
boundaries.right -= padding;
|
|
3866
|
+
boundaries.top = boundaries.top + padding;
|
|
3867
|
+
boundaries.bottom = boundaries.bottom - padding;
|
|
3868
|
+
return boundaries;
|
|
3869
|
+
};
|
|
3870
|
+
|
|
3937
3871
|
/**
|
|
3938
3872
|
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
|
|
3939
3873
|
* @method
|
|
@@ -3942,27 +3876,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3942
3876
|
* @param {Object} data
|
|
3943
3877
|
* @param {Array} modifiers
|
|
3944
3878
|
* @param {Function} ends
|
|
3945
|
-
*/
|
|
3946
|
-
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
3947
|
-
var modifiersToRun = modifiers.slice();
|
|
3948
|
-
if (ends !== undefined) {
|
|
3949
|
-
modifiersToRun = this._options.modifiers.slice(
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
);
|
|
3962
|
-
|
|
3963
|
-
return data;
|
|
3964
|
-
};
|
|
3965
|
-
|
|
3879
|
+
*/
|
|
3880
|
+
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
3881
|
+
var modifiersToRun = modifiers.slice();
|
|
3882
|
+
if (ends !== undefined) {
|
|
3883
|
+
modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3886
|
+
modifiersToRun.forEach(function (modifier) {
|
|
3887
|
+
if (isFunction(modifier)) {
|
|
3888
|
+
data = modifier.call(this, data);
|
|
3889
|
+
}
|
|
3890
|
+
}.bind(this));
|
|
3891
|
+
|
|
3892
|
+
return data;
|
|
3893
|
+
};
|
|
3894
|
+
|
|
3966
3895
|
/**
|
|
3967
3896
|
* Helper used to know if the given modifier depends from another one.
|
|
3968
3897
|
* @method
|
|
@@ -3970,204 +3899,191 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
3970
3899
|
* @param {String} requesting - name of requesting modifier
|
|
3971
3900
|
* @param {String} requested - name of requested modifier
|
|
3972
3901
|
* @returns {Boolean}
|
|
3973
|
-
*/
|
|
3974
|
-
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
3975
|
-
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
3976
|
-
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
3977
|
-
return modifier === requested;
|
|
3978
|
-
}).length;
|
|
3979
|
-
};
|
|
3980
|
-
|
|
3981
|
-
//
|
|
3982
|
-
// Modifiers
|
|
3983
|
-
//
|
|
3984
|
-
|
|
3902
|
+
*/
|
|
3903
|
+
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
3904
|
+
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
3905
|
+
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
3906
|
+
return modifier === requested;
|
|
3907
|
+
}).length;
|
|
3908
|
+
};
|
|
3909
|
+
|
|
3910
|
+
//
|
|
3911
|
+
// Modifiers
|
|
3912
|
+
//
|
|
3913
|
+
|
|
3985
3914
|
/**
|
|
3986
3915
|
* Modifiers list
|
|
3987
3916
|
* @namespace Popper.modifiers
|
|
3988
3917
|
* @memberof Popper
|
|
3989
3918
|
* @type {Object}
|
|
3990
|
-
*/
|
|
3991
|
-
Popper.prototype.modifiers = {};
|
|
3992
|
-
|
|
3919
|
+
*/
|
|
3920
|
+
Popper.prototype.modifiers = {};
|
|
3921
|
+
|
|
3993
3922
|
/**
|
|
3994
3923
|
* Apply the computed styles to the popper element
|
|
3995
3924
|
* @method
|
|
3996
3925
|
* @memberof Popper.modifiers
|
|
3997
3926
|
* @argument {Object} data - The data object generated by `update` method
|
|
3998
3927
|
* @returns {Object} The same data object
|
|
3999
|
-
*/
|
|
4000
|
-
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
4001
|
-
// apply the final offsets to the popper
|
|
4002
|
-
// NOTE: 1 DOM access here
|
|
4003
|
-
var styles = {
|
|
4004
|
-
position: data.offsets.popper.position
|
|
4005
|
-
};
|
|
4006
|
-
|
|
4007
|
-
// round top and left to avoid blurry text
|
|
4008
|
-
var left = Math.round(data.offsets.popper.left);
|
|
4009
|
-
var top = Math.round(data.offsets.popper.top);
|
|
4010
|
-
|
|
4011
|
-
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
4012
|
-
// we automatically use the supported prefixed version if needed
|
|
4013
|
-
var prefixedProperty;
|
|
4014
|
-
if (
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
//
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
this.modifiers.arrow
|
|
4046
|
-
) &&
|
|
4047
|
-
data.offsets.arrow
|
|
4048
|
-
) {
|
|
4049
|
-
setStyle(data.arrowElement, data.offsets.arrow);
|
|
4050
|
-
}
|
|
4051
|
-
|
|
4052
|
-
return data;
|
|
4053
|
-
};
|
|
4054
|
-
|
|
3928
|
+
*/
|
|
3929
|
+
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
3930
|
+
// apply the final offsets to the popper
|
|
3931
|
+
// NOTE: 1 DOM access here
|
|
3932
|
+
var styles = {
|
|
3933
|
+
position: data.offsets.popper.position
|
|
3934
|
+
};
|
|
3935
|
+
|
|
3936
|
+
// round top and left to avoid blurry text
|
|
3937
|
+
var left = Math.round(data.offsets.popper.left);
|
|
3938
|
+
var top = Math.round(data.offsets.popper.top);
|
|
3939
|
+
|
|
3940
|
+
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
3941
|
+
// we automatically use the supported prefixed version if needed
|
|
3942
|
+
var prefixedProperty;
|
|
3943
|
+
if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
|
|
3944
|
+
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
3945
|
+
styles.top = 0;
|
|
3946
|
+
styles.left = 0;
|
|
3947
|
+
}
|
|
3948
|
+
// othwerise, we use the standard `left` and `top` properties
|
|
3949
|
+
else {
|
|
3950
|
+
styles.left = left;
|
|
3951
|
+
styles.top = top;
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
// any property present in `data.styles` will be applied to the popper,
|
|
3955
|
+
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
3956
|
+
// Be aware, modifiers could override the properties defined in the previous
|
|
3957
|
+
// lines of this modifier!
|
|
3958
|
+
Object.assign(styles, data.styles);
|
|
3959
|
+
|
|
3960
|
+
setStyle(this._popper, styles);
|
|
3961
|
+
|
|
3962
|
+
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
|
|
3963
|
+
// NOTE: 1 DOM access here
|
|
3964
|
+
this._popper.setAttribute('x-placement', data.placement);
|
|
3965
|
+
|
|
3966
|
+
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
|
|
3967
|
+
if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
|
|
3968
|
+
setStyle(data.arrowElement, data.offsets.arrow);
|
|
3969
|
+
}
|
|
3970
|
+
|
|
3971
|
+
return data;
|
|
3972
|
+
};
|
|
3973
|
+
|
|
4055
3974
|
/**
|
|
4056
3975
|
* Modifier used to shift the popper on the start or end of its reference element side
|
|
4057
3976
|
* @method
|
|
4058
3977
|
* @memberof Popper.modifiers
|
|
4059
3978
|
* @argument {Object} data - The data object generated by `update` method
|
|
4060
3979
|
* @returns {Object} The data object, properly modified
|
|
4061
|
-
*/
|
|
4062
|
-
Popper.prototype.modifiers.shift = function (data) {
|
|
4063
|
-
var placement = data.placement;
|
|
4064
|
-
var basePlacement = placement.split('-')[0];
|
|
4065
|
-
var shiftVariation = placement.split('-')[1];
|
|
4066
|
-
|
|
4067
|
-
// if shift shiftVariation is specified, run the modifier
|
|
4068
|
-
if (shiftVariation) {
|
|
4069
|
-
var reference = data.offsets.reference;
|
|
4070
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
4071
|
-
|
|
4072
|
-
var shiftOffsets = {
|
|
4073
|
-
y: {
|
|
4074
|
-
start: { top: reference.top },
|
|
4075
|
-
end: { top: reference.top + reference.height - popper.height }
|
|
4076
|
-
},
|
|
4077
|
-
x: {
|
|
4078
|
-
start: { left: reference.left },
|
|
4079
|
-
end: { left: reference.left + reference.width - popper.width }
|
|
4080
|
-
}
|
|
4081
|
-
};
|
|
4082
|
-
|
|
4083
|
-
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
4084
|
-
|
|
4085
|
-
data.offsets.popper = Object.assign(
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
return data;
|
|
4092
|
-
};
|
|
4093
|
-
|
|
3980
|
+
*/
|
|
3981
|
+
Popper.prototype.modifiers.shift = function (data) {
|
|
3982
|
+
var placement = data.placement;
|
|
3983
|
+
var basePlacement = placement.split('-')[0];
|
|
3984
|
+
var shiftVariation = placement.split('-')[1];
|
|
3985
|
+
|
|
3986
|
+
// if shift shiftVariation is specified, run the modifier
|
|
3987
|
+
if (shiftVariation) {
|
|
3988
|
+
var reference = data.offsets.reference;
|
|
3989
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
3990
|
+
|
|
3991
|
+
var shiftOffsets = {
|
|
3992
|
+
y: {
|
|
3993
|
+
start: { top: reference.top },
|
|
3994
|
+
end: { top: reference.top + reference.height - popper.height }
|
|
3995
|
+
},
|
|
3996
|
+
x: {
|
|
3997
|
+
start: { left: reference.left },
|
|
3998
|
+
end: { left: reference.left + reference.width - popper.width }
|
|
3999
|
+
}
|
|
4000
|
+
};
|
|
4001
|
+
|
|
4002
|
+
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
4003
|
+
|
|
4004
|
+
data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
|
|
4005
|
+
}
|
|
4006
|
+
|
|
4007
|
+
return data;
|
|
4008
|
+
};
|
|
4009
|
+
|
|
4094
4010
|
/**
|
|
4095
4011
|
* Modifier used to make sure the popper does not overflows from it's boundaries
|
|
4096
4012
|
* @method
|
|
4097
4013
|
* @memberof Popper.modifiers
|
|
4098
4014
|
* @argument {Object} data - The data object generated by `update` method
|
|
4099
4015
|
* @returns {Object} The data object, properly modified
|
|
4100
|
-
*/
|
|
4101
|
-
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
4102
|
-
var order = this._options.preventOverflowOrder;
|
|
4103
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
4104
|
-
|
|
4105
|
-
var check = {
|
|
4106
|
-
left: function () {
|
|
4107
|
-
var left = popper.left;
|
|
4108
|
-
if (popper.left < data.boundaries.left) {
|
|
4109
|
-
left = Math.max(popper.left, data.boundaries.left);
|
|
4110
|
-
}
|
|
4111
|
-
return { left: left };
|
|
4112
|
-
},
|
|
4113
|
-
right: function () {
|
|
4114
|
-
var left = popper.left;
|
|
4115
|
-
if (popper.right > data.boundaries.right) {
|
|
4116
|
-
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
4117
|
-
}
|
|
4118
|
-
return { left: left };
|
|
4119
|
-
},
|
|
4120
|
-
top: function () {
|
|
4121
|
-
var top = popper.top;
|
|
4122
|
-
if (popper.top < data.boundaries.top) {
|
|
4123
|
-
top = Math.max(popper.top, data.boundaries.top);
|
|
4124
|
-
}
|
|
4125
|
-
return { top: top };
|
|
4126
|
-
},
|
|
4127
|
-
bottom: function () {
|
|
4128
|
-
var top = popper.top;
|
|
4129
|
-
if (popper.bottom > data.boundaries.bottom) {
|
|
4130
|
-
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
4131
|
-
}
|
|
4132
|
-
return { top: top };
|
|
4133
|
-
}
|
|
4134
|
-
};
|
|
4135
|
-
|
|
4136
|
-
order.forEach(function (direction) {
|
|
4137
|
-
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
4138
|
-
});
|
|
4139
|
-
|
|
4140
|
-
return data;
|
|
4141
|
-
};
|
|
4142
|
-
|
|
4016
|
+
*/
|
|
4017
|
+
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
4018
|
+
var order = this._options.preventOverflowOrder;
|
|
4019
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
4020
|
+
|
|
4021
|
+
var check = {
|
|
4022
|
+
left: function left() {
|
|
4023
|
+
var left = popper.left;
|
|
4024
|
+
if (popper.left < data.boundaries.left) {
|
|
4025
|
+
left = Math.max(popper.left, data.boundaries.left);
|
|
4026
|
+
}
|
|
4027
|
+
return { left: left };
|
|
4028
|
+
},
|
|
4029
|
+
right: function right() {
|
|
4030
|
+
var left = popper.left;
|
|
4031
|
+
if (popper.right > data.boundaries.right) {
|
|
4032
|
+
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
4033
|
+
}
|
|
4034
|
+
return { left: left };
|
|
4035
|
+
},
|
|
4036
|
+
top: function top() {
|
|
4037
|
+
var top = popper.top;
|
|
4038
|
+
if (popper.top < data.boundaries.top) {
|
|
4039
|
+
top = Math.max(popper.top, data.boundaries.top);
|
|
4040
|
+
}
|
|
4041
|
+
return { top: top };
|
|
4042
|
+
},
|
|
4043
|
+
bottom: function bottom() {
|
|
4044
|
+
var top = popper.top;
|
|
4045
|
+
if (popper.bottom > data.boundaries.bottom) {
|
|
4046
|
+
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
4047
|
+
}
|
|
4048
|
+
return { top: top };
|
|
4049
|
+
}
|
|
4050
|
+
};
|
|
4051
|
+
|
|
4052
|
+
order.forEach(function (direction) {
|
|
4053
|
+
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
4054
|
+
});
|
|
4055
|
+
|
|
4056
|
+
return data;
|
|
4057
|
+
};
|
|
4058
|
+
|
|
4143
4059
|
/**
|
|
4144
4060
|
* Modifier used to make sure the popper is always near its reference
|
|
4145
4061
|
* @method
|
|
4146
4062
|
* @memberof Popper.modifiers
|
|
4147
4063
|
* @argument {Object} data - The data object generated by _update method
|
|
4148
4064
|
* @returns {Object} The data object, properly modified
|
|
4149
|
-
*/
|
|
4150
|
-
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
4151
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
4152
|
-
var reference = data.offsets.reference;
|
|
4153
|
-
var f = Math.floor;
|
|
4154
|
-
|
|
4155
|
-
if (popper.right < f(reference.left)) {
|
|
4156
|
-
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
4157
|
-
}
|
|
4158
|
-
if (popper.left > f(reference.right)) {
|
|
4159
|
-
data.offsets.popper.left = f(reference.right);
|
|
4160
|
-
}
|
|
4161
|
-
if (popper.bottom < f(reference.top)) {
|
|
4162
|
-
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
4163
|
-
}
|
|
4164
|
-
if (popper.top > f(reference.bottom)) {
|
|
4165
|
-
data.offsets.popper.top = f(reference.bottom);
|
|
4166
|
-
}
|
|
4167
|
-
|
|
4168
|
-
return data;
|
|
4169
|
-
};
|
|
4170
|
-
|
|
4065
|
+
*/
|
|
4066
|
+
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
4067
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
4068
|
+
var reference = data.offsets.reference;
|
|
4069
|
+
var f = Math.floor;
|
|
4070
|
+
|
|
4071
|
+
if (popper.right < f(reference.left)) {
|
|
4072
|
+
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
4073
|
+
}
|
|
4074
|
+
if (popper.left > f(reference.right)) {
|
|
4075
|
+
data.offsets.popper.left = f(reference.right);
|
|
4076
|
+
}
|
|
4077
|
+
if (popper.bottom < f(reference.top)) {
|
|
4078
|
+
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
4079
|
+
}
|
|
4080
|
+
if (popper.top > f(reference.bottom)) {
|
|
4081
|
+
data.offsets.popper.top = f(reference.bottom);
|
|
4082
|
+
}
|
|
4083
|
+
|
|
4084
|
+
return data;
|
|
4085
|
+
};
|
|
4086
|
+
|
|
4171
4087
|
/**
|
|
4172
4088
|
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
|
|
4173
4089
|
* Requires the `preventOverflow` modifier before it in order to work.
|
|
@@ -4176,81 +4092,61 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4176
4092
|
* @memberof Popper.modifiers
|
|
4177
4093
|
* @argument {Object} data - The data object generated by _update method
|
|
4178
4094
|
* @returns {Object} The data object, properly modified
|
|
4179
|
-
*/
|
|
4180
|
-
Popper.prototype.modifiers.flip = function (data) {
|
|
4181
|
-
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
4182
|
-
// otherwise flip would not work as expected.
|
|
4183
|
-
if (
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
) {
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
) {
|
|
4235
|
-
// we'll use this boolean to detect any flip loop
|
|
4236
|
-
data.flipped = true;
|
|
4237
|
-
data.placement = flipOrder[index + 1];
|
|
4238
|
-
if (variation) {
|
|
4239
|
-
data.placement += '-' + variation;
|
|
4240
|
-
}
|
|
4241
|
-
data.offsets.popper = this._getOffsets(
|
|
4242
|
-
this._popper,
|
|
4243
|
-
this._reference,
|
|
4244
|
-
data.placement
|
|
4245
|
-
).popper;
|
|
4246
|
-
|
|
4247
|
-
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
4248
|
-
}
|
|
4249
|
-
}.bind(this)
|
|
4250
|
-
);
|
|
4251
|
-
return data;
|
|
4252
|
-
};
|
|
4253
|
-
|
|
4095
|
+
*/
|
|
4096
|
+
Popper.prototype.modifiers.flip = function (data) {
|
|
4097
|
+
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
4098
|
+
// otherwise flip would not work as expected.
|
|
4099
|
+
if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
|
|
4100
|
+
console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
|
|
4101
|
+
return data;
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
if (data.flipped && data.placement === data._originalPlacement) {
|
|
4105
|
+
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
4106
|
+
return data;
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
var placement = data.placement.split('-')[0];
|
|
4110
|
+
var placementOpposite = getOppositePlacement(placement);
|
|
4111
|
+
var variation = data.placement.split('-')[1] || '';
|
|
4112
|
+
|
|
4113
|
+
var flipOrder = [];
|
|
4114
|
+
if (this._options.flipBehavior === 'flip') {
|
|
4115
|
+
flipOrder = [placement, placementOpposite];
|
|
4116
|
+
} else {
|
|
4117
|
+
flipOrder = this._options.flipBehavior;
|
|
4118
|
+
}
|
|
4119
|
+
|
|
4120
|
+
flipOrder.forEach(function (step, index) {
|
|
4121
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
|
4122
|
+
return;
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
placement = data.placement.split('-')[0];
|
|
4126
|
+
placementOpposite = getOppositePlacement(placement);
|
|
4127
|
+
|
|
4128
|
+
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
4129
|
+
|
|
4130
|
+
// this boolean is used to distinguish right and bottom from top and left
|
|
4131
|
+
// they need different computations to get flipped
|
|
4132
|
+
var a = ['right', 'bottom'].indexOf(placement) !== -1;
|
|
4133
|
+
|
|
4134
|
+
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
|
|
4135
|
+
if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
|
|
4136
|
+
// we'll use this boolean to detect any flip loop
|
|
4137
|
+
data.flipped = true;
|
|
4138
|
+
data.placement = flipOrder[index + 1];
|
|
4139
|
+
if (variation) {
|
|
4140
|
+
data.placement += '-' + variation;
|
|
4141
|
+
}
|
|
4142
|
+
data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
|
|
4143
|
+
|
|
4144
|
+
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
4145
|
+
}
|
|
4146
|
+
}.bind(this));
|
|
4147
|
+
return data;
|
|
4148
|
+
};
|
|
4149
|
+
|
|
4254
4150
|
/**
|
|
4255
4151
|
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
|
|
4256
4152
|
* The offsets will shift the popper on the side of its reference element.
|
|
@@ -4258,23 +4154,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4258
4154
|
* @memberof Popper.modifiers
|
|
4259
4155
|
* @argument {Object} data - The data object generated by _update method
|
|
4260
4156
|
* @returns {Object} The data object, properly modified
|
|
4261
|
-
*/
|
|
4262
|
-
Popper.prototype.modifiers.offset = function (data) {
|
|
4263
|
-
var offset = this._options.offset;
|
|
4264
|
-
var popper = data.offsets.popper;
|
|
4265
|
-
|
|
4266
|
-
if (data.placement.indexOf('left') !== -1) {
|
|
4267
|
-
popper.top -= offset;
|
|
4268
|
-
} else if (data.placement.indexOf('right') !== -1) {
|
|
4269
|
-
popper.top += offset;
|
|
4270
|
-
} else if (data.placement.indexOf('top') !== -1) {
|
|
4271
|
-
popper.left -= offset;
|
|
4272
|
-
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
4273
|
-
popper.left += offset;
|
|
4274
|
-
}
|
|
4275
|
-
return data;
|
|
4276
|
-
};
|
|
4277
|
-
|
|
4157
|
+
*/
|
|
4158
|
+
Popper.prototype.modifiers.offset = function (data) {
|
|
4159
|
+
var offset = this._options.offset;
|
|
4160
|
+
var popper = data.offsets.popper;
|
|
4161
|
+
|
|
4162
|
+
if (data.placement.indexOf('left') !== -1) {
|
|
4163
|
+
popper.top -= offset;
|
|
4164
|
+
} else if (data.placement.indexOf('right') !== -1) {
|
|
4165
|
+
popper.top += offset;
|
|
4166
|
+
} else if (data.placement.indexOf('top') !== -1) {
|
|
4167
|
+
popper.left -= offset;
|
|
4168
|
+
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
4169
|
+
popper.left += offset;
|
|
4170
|
+
}
|
|
4171
|
+
return data;
|
|
4172
|
+
};
|
|
4173
|
+
|
|
4278
4174
|
/**
|
|
4279
4175
|
* 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
|
|
4280
4176
|
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
|
|
@@ -4282,147 +4178,136 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4282
4178
|
* @memberof Popper.modifiers
|
|
4283
4179
|
* @argument {Object} data - The data object generated by _update method
|
|
4284
4180
|
* @returns {Object} The data object, properly modified
|
|
4285
|
-
*/
|
|
4286
|
-
Popper.prototype.modifiers.arrow = function (data) {
|
|
4287
|
-
var arrow = this._options.arrowElement;
|
|
4288
|
-
var arrowOffset = this._options.arrowOffset;
|
|
4289
|
-
|
|
4290
|
-
// if the arrowElement is a string, suppose it's a CSS selector
|
|
4291
|
-
if (typeof arrow === 'string') {
|
|
4292
|
-
arrow = this._popper.querySelector(arrow);
|
|
4293
|
-
}
|
|
4294
|
-
|
|
4295
|
-
// if arrow element is not found, don't run the modifier
|
|
4296
|
-
if (!arrow) {
|
|
4297
|
-
return data;
|
|
4298
|
-
}
|
|
4299
|
-
|
|
4300
|
-
// the arrow element must be child of its popper
|
|
4301
|
-
if (!this._popper.contains(arrow)) {
|
|
4302
|
-
console.warn(
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
)
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
var
|
|
4322
|
-
var
|
|
4323
|
-
var
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
//
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
//
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
data.offsets.arrow = arrowStyle;
|
|
4360
|
-
data.arrowElement = arrow;
|
|
4361
|
-
|
|
4362
|
-
return data;
|
|
4363
|
-
};
|
|
4364
|
-
|
|
4365
|
-
//
|
|
4366
|
-
// Helpers
|
|
4367
|
-
//
|
|
4368
|
-
|
|
4181
|
+
*/
|
|
4182
|
+
Popper.prototype.modifiers.arrow = function (data) {
|
|
4183
|
+
var arrow = this._options.arrowElement;
|
|
4184
|
+
var arrowOffset = this._options.arrowOffset;
|
|
4185
|
+
|
|
4186
|
+
// if the arrowElement is a string, suppose it's a CSS selector
|
|
4187
|
+
if (typeof arrow === 'string') {
|
|
4188
|
+
arrow = this._popper.querySelector(arrow);
|
|
4189
|
+
}
|
|
4190
|
+
|
|
4191
|
+
// if arrow element is not found, don't run the modifier
|
|
4192
|
+
if (!arrow) {
|
|
4193
|
+
return data;
|
|
4194
|
+
}
|
|
4195
|
+
|
|
4196
|
+
// the arrow element must be child of its popper
|
|
4197
|
+
if (!this._popper.contains(arrow)) {
|
|
4198
|
+
console.warn('WARNING: `arrowElement` must be child of its popper element!');
|
|
4199
|
+
return data;
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4202
|
+
// arrow depends on keepTogether in order to work
|
|
4203
|
+
if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
|
|
4204
|
+
console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
|
|
4205
|
+
return data;
|
|
4206
|
+
}
|
|
4207
|
+
|
|
4208
|
+
var arrowStyle = {};
|
|
4209
|
+
var placement = data.placement.split('-')[0];
|
|
4210
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
4211
|
+
var reference = data.offsets.reference;
|
|
4212
|
+
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
4213
|
+
|
|
4214
|
+
var len = isVertical ? 'height' : 'width';
|
|
4215
|
+
var side = isVertical ? 'top' : 'left';
|
|
4216
|
+
var translate = isVertical ? 'translateY' : 'translateX';
|
|
4217
|
+
var altSide = isVertical ? 'left' : 'top';
|
|
4218
|
+
var opSide = isVertical ? 'bottom' : 'right';
|
|
4219
|
+
var arrowSize = getOuterSizes(arrow)[len];
|
|
4220
|
+
|
|
4221
|
+
//
|
|
4222
|
+
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
|
|
4223
|
+
//
|
|
4224
|
+
|
|
4225
|
+
// top/left side
|
|
4226
|
+
if (reference[opSide] - arrowSize < popper[side]) {
|
|
4227
|
+
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
|
|
4228
|
+
}
|
|
4229
|
+
// bottom/right side
|
|
4230
|
+
if (reference[side] + arrowSize > popper[opSide]) {
|
|
4231
|
+
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
|
|
4232
|
+
}
|
|
4233
|
+
|
|
4234
|
+
// compute center of the popper
|
|
4235
|
+
var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
4236
|
+
|
|
4237
|
+
var sideValue = center - popper[side];
|
|
4238
|
+
|
|
4239
|
+
// prevent arrow from being placed not contiguously to its popper
|
|
4240
|
+
sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
|
|
4241
|
+
arrowStyle[side] = sideValue;
|
|
4242
|
+
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
|
|
4243
|
+
|
|
4244
|
+
data.offsets.arrow = arrowStyle;
|
|
4245
|
+
data.arrowElement = arrow;
|
|
4246
|
+
|
|
4247
|
+
return data;
|
|
4248
|
+
};
|
|
4249
|
+
|
|
4250
|
+
//
|
|
4251
|
+
// Helpers
|
|
4252
|
+
//
|
|
4253
|
+
|
|
4369
4254
|
/**
|
|
4370
4255
|
* Get the outer sizes of the given element (offset size + margins)
|
|
4371
4256
|
* @function
|
|
4372
4257
|
* @ignore
|
|
4373
4258
|
* @argument {Element} element
|
|
4374
4259
|
* @returns {Object} object containing width and height properties
|
|
4375
|
-
*/
|
|
4376
|
-
function getOuterSizes(element) {
|
|
4377
|
-
// NOTE: 1 DOM access here
|
|
4378
|
-
var _display = element.style.display,
|
|
4379
|
-
|
|
4380
|
-
element.style.display = 'block';
|
|
4381
|
-
element.style.visibility = 'hidden';
|
|
4382
|
-
var calcWidthToForceRepaint = element.offsetWidth;
|
|
4383
|
-
// original method
|
|
4384
|
-
var styles = getRealWindow(element).getComputedStyle(element);
|
|
4385
|
-
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
4386
|
-
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
4387
|
-
var result = {
|
|
4388
|
-
width: element.offsetWidth + y,
|
|
4389
|
-
height: element.offsetHeight + x
|
|
4390
|
-
};
|
|
4391
|
-
|
|
4392
|
-
// reset element styles
|
|
4393
|
-
element.style.display = _display;
|
|
4394
|
-
element.style.visibility = _visibility;
|
|
4395
|
-
return result;
|
|
4396
|
-
}
|
|
4397
|
-
|
|
4260
|
+
*/
|
|
4261
|
+
function getOuterSizes(element) {
|
|
4262
|
+
// NOTE: 1 DOM access here
|
|
4263
|
+
var _display = element.style.display,
|
|
4264
|
+
_visibility = element.style.visibility;
|
|
4265
|
+
element.style.display = 'block';
|
|
4266
|
+
element.style.visibility = 'hidden';
|
|
4267
|
+
var calcWidthToForceRepaint = element.offsetWidth;
|
|
4268
|
+
// original method
|
|
4269
|
+
var styles = getRealWindow(element).getComputedStyle(element);
|
|
4270
|
+
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
4271
|
+
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
4272
|
+
var result = {
|
|
4273
|
+
width: element.offsetWidth + y,
|
|
4274
|
+
height: element.offsetHeight + x
|
|
4275
|
+
};
|
|
4276
|
+
|
|
4277
|
+
// reset element styles
|
|
4278
|
+
element.style.display = _display;
|
|
4279
|
+
element.style.visibility = _visibility;
|
|
4280
|
+
return result;
|
|
4281
|
+
}
|
|
4282
|
+
|
|
4398
4283
|
/**
|
|
4399
4284
|
* Get the opposite placement of the given one/
|
|
4400
4285
|
* @function
|
|
4401
4286
|
* @ignore
|
|
4402
4287
|
* @argument {String} placement
|
|
4403
4288
|
* @returns {String} flipped placement
|
|
4404
|
-
*/
|
|
4405
|
-
function getOppositePlacement(placement) {
|
|
4406
|
-
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
4407
|
-
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
4408
|
-
return hash[matched];
|
|
4409
|
-
});
|
|
4410
|
-
}
|
|
4411
|
-
|
|
4289
|
+
*/
|
|
4290
|
+
function getOppositePlacement(placement) {
|
|
4291
|
+
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
4292
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
4293
|
+
return hash[matched];
|
|
4294
|
+
});
|
|
4295
|
+
}
|
|
4296
|
+
|
|
4412
4297
|
/**
|
|
4413
4298
|
* Given the popper offsets, generate an output similar to getBoundingClientRect
|
|
4414
4299
|
* @function
|
|
4415
4300
|
* @ignore
|
|
4416
4301
|
* @argument {Object} popperOffsets
|
|
4417
4302
|
* @returns {Object} ClientRect like output
|
|
4418
|
-
*/
|
|
4419
|
-
function getPopperClientRect(popperOffsets) {
|
|
4420
|
-
var offsets = Object.assign({}, popperOffsets);
|
|
4421
|
-
offsets.right = offsets.left + offsets.width;
|
|
4422
|
-
offsets.bottom = offsets.top + offsets.height;
|
|
4423
|
-
return offsets;
|
|
4424
|
-
}
|
|
4425
|
-
|
|
4303
|
+
*/
|
|
4304
|
+
function getPopperClientRect(popperOffsets) {
|
|
4305
|
+
var offsets = Object.assign({}, popperOffsets);
|
|
4306
|
+
offsets.right = offsets.left + offsets.width;
|
|
4307
|
+
offsets.bottom = offsets.top + offsets.height;
|
|
4308
|
+
return offsets;
|
|
4309
|
+
}
|
|
4310
|
+
|
|
4426
4311
|
/**
|
|
4427
4312
|
* Given an array and the key to find, returns its index
|
|
4428
4313
|
* @function
|
|
@@ -4430,48 +4315,46 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4430
4315
|
* @argument {Array} arr
|
|
4431
4316
|
* @argument keyToFind
|
|
4432
4317
|
* @returns index or null
|
|
4433
|
-
*/
|
|
4434
|
-
function getArrayKeyIndex(arr, keyToFind) {
|
|
4435
|
-
var i = 0,
|
|
4436
|
-
|
|
4437
|
-
for (key in arr) {
|
|
4438
|
-
if (arr[key] === keyToFind) {
|
|
4439
|
-
return i;
|
|
4440
|
-
}
|
|
4441
|
-
i++;
|
|
4442
|
-
}
|
|
4443
|
-
return null;
|
|
4444
|
-
}
|
|
4445
|
-
|
|
4318
|
+
*/
|
|
4319
|
+
function getArrayKeyIndex(arr, keyToFind) {
|
|
4320
|
+
var i = 0,
|
|
4321
|
+
key;
|
|
4322
|
+
for (key in arr) {
|
|
4323
|
+
if (arr[key] === keyToFind) {
|
|
4324
|
+
return i;
|
|
4325
|
+
}
|
|
4326
|
+
i++;
|
|
4327
|
+
}
|
|
4328
|
+
return null;
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4446
4331
|
/**
|
|
4447
4332
|
* Get CSS computed property of the given element
|
|
4448
4333
|
* @function
|
|
4449
4334
|
* @ignore
|
|
4450
4335
|
* @argument {Eement} element
|
|
4451
4336
|
* @argument {String} property
|
|
4452
|
-
*/
|
|
4453
|
-
function getStyleComputedProperty(element, property) {
|
|
4454
|
-
// NOTE: 1 DOM access here
|
|
4455
|
-
// 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
|
|
4456
|
-
// 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
|
|
4457
|
-
var css = getRealWindow(element).getComputedStyle(element, null);
|
|
4458
|
-
return css[property];
|
|
4459
|
-
}
|
|
4460
|
-
|
|
4337
|
+
*/
|
|
4338
|
+
function getStyleComputedProperty(element, property) {
|
|
4339
|
+
// NOTE: 1 DOM access here
|
|
4340
|
+
// 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
|
|
4341
|
+
// 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
|
|
4342
|
+
var css = getRealWindow(element).getComputedStyle(element, null);
|
|
4343
|
+
return css[property];
|
|
4344
|
+
}
|
|
4345
|
+
|
|
4461
4346
|
/**
|
|
4462
4347
|
* Returns the offset parent of the given element
|
|
4463
4348
|
* @function
|
|
4464
4349
|
* @ignore
|
|
4465
4350
|
* @argument {Element} element
|
|
4466
4351
|
* @returns {Element} offset parent
|
|
4467
|
-
*/
|
|
4468
|
-
function getOffsetParent(element) {
|
|
4469
|
-
var offsetParent = element.offsetParent;
|
|
4470
|
-
return offsetParent === root.document.body || !offsetParent
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
}
|
|
4474
|
-
|
|
4352
|
+
*/
|
|
4353
|
+
function getOffsetParent(element) {
|
|
4354
|
+
var offsetParent = element.offsetParent;
|
|
4355
|
+
return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4475
4358
|
/**
|
|
4476
4359
|
* Returns the window the given element actually renders in.
|
|
4477
4360
|
* 无界等微前端场景下组件代码运行在沙箱 window 中,而 DOM 实际渲染在
|
|
@@ -4480,16 +4363,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4480
4363
|
* @ignore
|
|
4481
4364
|
* @argument {Element} element
|
|
4482
4365
|
* @returns {Window} window
|
|
4483
|
-
*/
|
|
4484
|
-
function getRealWindow(element) {
|
|
4485
|
-
return
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
element.ownerDocument.defaultView) ||
|
|
4489
|
-
root
|
|
4490
|
-
);
|
|
4491
|
-
}
|
|
4492
|
-
|
|
4366
|
+
*/
|
|
4367
|
+
function getRealWindow(element) {
|
|
4368
|
+
return element && element.ownerDocument && element.ownerDocument.defaultView || root;
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4493
4371
|
/**
|
|
4494
4372
|
* Returns the viewport rect of the containing block actually used to position the popper.
|
|
4495
4373
|
* 无界微前端等场景下 popper 被挂载进子应用的 shadowRoot,offsetParent 的兜底值
|
|
@@ -4503,82 +4381,72 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4503
4381
|
* @argument {Element} element - popper element
|
|
4504
4382
|
* @argument {Boolean} fixed - whether the popper is fixed positioned
|
|
4505
4383
|
* @returns {Object} rect
|
|
4506
|
-
*/
|
|
4507
|
-
function getContainingBlockRect(element, fixed) {
|
|
4508
|
-
if (fixed) {
|
|
4509
|
-
return { top: 0, left: 0, right: 0, bottom: 0 };
|
|
4510
|
-
}
|
|
4511
|
-
|
|
4512
|
-
var node = element.parentNode;
|
|
4513
|
-
while (node) {
|
|
4514
|
-
if (node.nodeType === 1) {
|
|
4515
|
-
if (getStyleComputedProperty(node, 'position') !== 'static') {
|
|
4516
|
-
return getBoundingClientRect(node);
|
|
4517
|
-
}
|
|
4518
|
-
} else if (node.nodeType === 11) {
|
|
4519
|
-
// 遇到 shadowRoot,跨边界从宿主元素继续向上查找
|
|
4520
|
-
node = node.host;
|
|
4521
|
-
continue;
|
|
4522
|
-
} else {
|
|
4523
|
-
break;
|
|
4524
|
-
}
|
|
4525
|
-
node = node.parentNode;
|
|
4526
|
-
}
|
|
4527
|
-
|
|
4528
|
-
var win = getRealWindow(element);
|
|
4529
|
-
return {
|
|
4530
|
-
top: -(win.pageYOffset || 0),
|
|
4531
|
-
left: -(win.pageXOffset || 0),
|
|
4532
|
-
right: 0,
|
|
4533
|
-
bottom: 0
|
|
4534
|
-
};
|
|
4535
|
-
}
|
|
4536
|
-
|
|
4384
|
+
*/
|
|
4385
|
+
function getContainingBlockRect(element, fixed) {
|
|
4386
|
+
if (fixed) {
|
|
4387
|
+
return { top: 0, left: 0, right: 0, bottom: 0 };
|
|
4388
|
+
}
|
|
4389
|
+
|
|
4390
|
+
var node = element.parentNode;
|
|
4391
|
+
while (node) {
|
|
4392
|
+
if (node.nodeType === 1) {
|
|
4393
|
+
if (getStyleComputedProperty(node, 'position') !== 'static') {
|
|
4394
|
+
return getBoundingClientRect(node);
|
|
4395
|
+
}
|
|
4396
|
+
} else if (node.nodeType === 11) {
|
|
4397
|
+
// 遇到 shadowRoot,跨边界从宿主元素继续向上查找
|
|
4398
|
+
node = node.host;
|
|
4399
|
+
continue;
|
|
4400
|
+
} else {
|
|
4401
|
+
break;
|
|
4402
|
+
}
|
|
4403
|
+
node = node.parentNode;
|
|
4404
|
+
}
|
|
4405
|
+
|
|
4406
|
+
var win = getRealWindow(element);
|
|
4407
|
+
return {
|
|
4408
|
+
top: -(win.pageYOffset || 0),
|
|
4409
|
+
left: -(win.pageXOffset || 0),
|
|
4410
|
+
right: 0,
|
|
4411
|
+
bottom: 0
|
|
4412
|
+
};
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4537
4415
|
/**
|
|
4538
4416
|
* Returns the scrolling parent of the given element
|
|
4539
4417
|
* @function
|
|
4540
4418
|
* @ignore
|
|
4541
4419
|
* @argument {Element} element
|
|
4542
4420
|
* @returns {Element} offset parent
|
|
4543
|
-
*/
|
|
4544
|
-
function getScrollParent(element) {
|
|
4545
|
-
var parent = element.parentNode;
|
|
4546
|
-
if (!parent) {
|
|
4547
|
-
return element;
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4550
|
-
if (parent.nodeType === 11) {
|
|
4551
|
-
// 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
|
|
4552
|
-
// 否则查找到 shadowRoot 即终止,滚动事件无法被监听
|
|
4553
|
-
return getScrollParent(parent.host);
|
|
4554
|
-
}
|
|
4555
|
-
|
|
4556
|
-
if (parent.nodeType !== 1) {
|
|
4557
|
-
// 到达 document,返回元素实际渲染所在的真实 window,
|
|
4558
|
-
// 保证 window 滚动时能触发位置更新
|
|
4559
|
-
return getRealWindow(element);
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
|
-
// Firefox want us to check `-x` and `-y` variations as well
|
|
4563
|
-
if (
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
) !== -1
|
|
4573
|
-
) {
|
|
4574
|
-
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
4575
|
-
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
4576
|
-
// fixes issue #65
|
|
4577
|
-
return parent;
|
|
4578
|
-
}
|
|
4579
|
-
return getScrollParent(parent);
|
|
4580
|
-
}
|
|
4581
|
-
|
|
4421
|
+
*/
|
|
4422
|
+
function getScrollParent(element) {
|
|
4423
|
+
var parent = element.parentNode;
|
|
4424
|
+
if (!parent) {
|
|
4425
|
+
return element;
|
|
4426
|
+
}
|
|
4427
|
+
|
|
4428
|
+
if (parent.nodeType === 11) {
|
|
4429
|
+
// 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
|
|
4430
|
+
// 否则查找到 shadowRoot 即终止,滚动事件无法被监听
|
|
4431
|
+
return getScrollParent(parent.host);
|
|
4432
|
+
}
|
|
4433
|
+
|
|
4434
|
+
if (parent.nodeType !== 1) {
|
|
4435
|
+
// 到达 document,返回元素实际渲染所在的真实 window,
|
|
4436
|
+
// 保证 window 滚动时能触发位置更新
|
|
4437
|
+
return getRealWindow(element);
|
|
4438
|
+
}
|
|
4439
|
+
|
|
4440
|
+
// Firefox want us to check `-x` and `-y` variations as well
|
|
4441
|
+
if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
|
|
4442
|
+
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
4443
|
+
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
4444
|
+
// fixes issue #65
|
|
4445
|
+
return parent;
|
|
4446
|
+
}
|
|
4447
|
+
return getScrollParent(parent);
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4582
4450
|
/**
|
|
4583
4451
|
* Check if the given element is fixed or is inside a fixed parent
|
|
4584
4452
|
* @function
|
|
@@ -4586,125 +4454,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4586
4454
|
* @argument {Element} element
|
|
4587
4455
|
* @argument {Element} customContainer
|
|
4588
4456
|
* @returns {Boolean} answer to "isFixed?"
|
|
4589
|
-
*/
|
|
4590
|
-
function isFixed(element) {
|
|
4591
|
-
if (element === root.document.body) {
|
|
4592
|
-
return false;
|
|
4593
|
-
}
|
|
4594
|
-
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
4595
|
-
return true;
|
|
4596
|
-
}
|
|
4597
|
-
var parent = element.parentNode;
|
|
4598
|
-
if (parent && parent.nodeType === 11) {
|
|
4599
|
-
// 跨 shadowRoot 边界,从宿主元素继续向上判断
|
|
4600
|
-
parent = parent.host;
|
|
4601
|
-
}
|
|
4602
|
-
return parent && parent.nodeType === 1 ? isFixed(parent) : false;
|
|
4603
|
-
}
|
|
4604
|
-
|
|
4457
|
+
*/
|
|
4458
|
+
function isFixed(element) {
|
|
4459
|
+
if (element === root.document.body) {
|
|
4460
|
+
return false;
|
|
4461
|
+
}
|
|
4462
|
+
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
4463
|
+
return true;
|
|
4464
|
+
}
|
|
4465
|
+
var parent = element.parentNode;
|
|
4466
|
+
if (parent && parent.nodeType === 11) {
|
|
4467
|
+
// 跨 shadowRoot 边界,从宿主元素继续向上判断
|
|
4468
|
+
parent = parent.host;
|
|
4469
|
+
}
|
|
4470
|
+
return parent && parent.nodeType === 1 ? isFixed(parent) : false;
|
|
4471
|
+
}
|
|
4472
|
+
|
|
4605
4473
|
/**
|
|
4606
4474
|
* Set the style to the given popper
|
|
4607
4475
|
* @function
|
|
4608
4476
|
* @ignore
|
|
4609
4477
|
* @argument {Element} element - Element to apply the style to
|
|
4610
4478
|
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
|
|
4611
|
-
*/
|
|
4612
|
-
function setStyle(element, styles) {
|
|
4613
|
-
function is_numeric(n) {
|
|
4614
|
-
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
4615
|
-
}
|
|
4616
|
-
Object.keys(styles).forEach(function (prop) {
|
|
4617
|
-
var unit = '';
|
|
4618
|
-
// add unit if the value is numeric and is one of the following
|
|
4619
|
-
if (
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
element.style[prop] = styles[prop] + unit;
|
|
4627
|
-
});
|
|
4628
|
-
}
|
|
4629
|
-
|
|
4479
|
+
*/
|
|
4480
|
+
function setStyle(element, styles) {
|
|
4481
|
+
function is_numeric(n) {
|
|
4482
|
+
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
4483
|
+
}
|
|
4484
|
+
Object.keys(styles).forEach(function (prop) {
|
|
4485
|
+
var unit = '';
|
|
4486
|
+
// add unit if the value is numeric and is one of the following
|
|
4487
|
+
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
|
|
4488
|
+
unit = 'px';
|
|
4489
|
+
}
|
|
4490
|
+
element.style[prop] = styles[prop] + unit;
|
|
4491
|
+
});
|
|
4492
|
+
}
|
|
4493
|
+
|
|
4630
4494
|
/**
|
|
4631
4495
|
* Check if the given variable is a function
|
|
4632
4496
|
* @function
|
|
4633
4497
|
* @ignore
|
|
4634
4498
|
* @argument {*} functionToCheck - variable to check
|
|
4635
4499
|
* @returns {Boolean} answer to: is a function?
|
|
4636
|
-
*/
|
|
4637
|
-
function isFunction(functionToCheck) {
|
|
4638
|
-
var getType = {};
|
|
4639
|
-
return (
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
);
|
|
4643
|
-
}
|
|
4644
|
-
|
|
4500
|
+
*/
|
|
4501
|
+
function isFunction(functionToCheck) {
|
|
4502
|
+
var getType = {};
|
|
4503
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
4504
|
+
}
|
|
4505
|
+
|
|
4645
4506
|
/**
|
|
4646
4507
|
* Get the position of the given element, relative to its offset parent
|
|
4647
4508
|
* @function
|
|
4648
4509
|
* @ignore
|
|
4649
4510
|
* @param {Element} element
|
|
4650
4511
|
* @return {Object} position - Coordinates of the element and its `scrollTop`
|
|
4651
|
-
*/
|
|
4652
|
-
function getOffsetRect(element) {
|
|
4653
|
-
var transform = getStyle(element, 'transform')
|
|
4654
|
-
|
|
4655
|
-
.
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
return elementRect;
|
|
4669
|
-
}
|
|
4670
|
-
|
|
4512
|
+
*/
|
|
4513
|
+
function getOffsetRect(element) {
|
|
4514
|
+
var transform = getStyle(element, 'transform').replace(/[^0-9\-,]/g, '').split(',');
|
|
4515
|
+
var elementRect = {
|
|
4516
|
+
width: element.offsetWidth,
|
|
4517
|
+
height: element.offsetHeight,
|
|
4518
|
+
left: element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
|
|
4519
|
+
top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
|
|
4520
|
+
};
|
|
4521
|
+
|
|
4522
|
+
elementRect.right = elementRect.left + elementRect.width;
|
|
4523
|
+
elementRect.bottom = elementRect.top + elementRect.height;
|
|
4524
|
+
|
|
4525
|
+
// position
|
|
4526
|
+
return elementRect;
|
|
4527
|
+
}
|
|
4528
|
+
|
|
4671
4529
|
/**
|
|
4672
4530
|
* Get bounding client rect of given element
|
|
4673
4531
|
* @function
|
|
4674
4532
|
* @ignore
|
|
4675
4533
|
* @param {HTMLElement} element
|
|
4676
4534
|
* @return {Object} client rect
|
|
4677
|
-
*/
|
|
4678
|
-
function getBoundingClientRect(element) {
|
|
4679
|
-
var rect = element.getBoundingClientRect();
|
|
4680
|
-
|
|
4681
|
-
// whether the IE version is lower than 11
|
|
4682
|
-
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
4683
|
-
|
|
4684
|
-
// fix ie document bounding top always 0 bug
|
|
4685
|
-
var rectTop =
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4535
|
+
*/
|
|
4536
|
+
function getBoundingClientRect(element) {
|
|
4537
|
+
var rect = element.getBoundingClientRect();
|
|
4538
|
+
|
|
4539
|
+
// whether the IE version is lower than 11
|
|
4540
|
+
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
4541
|
+
|
|
4542
|
+
// fix ie document bounding top always 0 bug
|
|
4543
|
+
var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
|
|
4544
|
+
|
|
4545
|
+
return {
|
|
4546
|
+
left: rect.left,
|
|
4547
|
+
top: rectTop,
|
|
4548
|
+
right: rect.right,
|
|
4549
|
+
bottom: rect.bottom,
|
|
4550
|
+
width: rect.right - rect.left,
|
|
4551
|
+
height: rect.bottom - rectTop
|
|
4552
|
+
};
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4555
|
+
function getStyle(dom, attr) {
|
|
4556
|
+
if (dom.style[attr]) {
|
|
4557
|
+
return dom.style[attr];
|
|
4558
|
+
}
|
|
4559
|
+
if (window.getComputedStyle) {
|
|
4560
|
+
return getComputedStyle(dom, null)[attr];
|
|
4561
|
+
}
|
|
4562
|
+
return dom.currentStyle[attr];
|
|
4563
|
+
}
|
|
4564
|
+
|
|
4708
4565
|
/**
|
|
4709
4566
|
* Given an element and one of its parents, return the offset
|
|
4710
4567
|
* @function
|
|
@@ -4712,45 +4569,43 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4712
4569
|
* @param {HTMLElement} element
|
|
4713
4570
|
* @param {HTMLElement} parent
|
|
4714
4571
|
* @return {Object} rect
|
|
4715
|
-
*/
|
|
4716
|
-
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
4717
|
-
var elementRect = getBoundingClientRect(element);
|
|
4718
|
-
// parent 为 popper 元素:取其真实包含块的视口 rect,
|
|
4719
|
-
// 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
|
|
4720
|
-
var parentRect = getContainingBlockRect(parent, fixed);
|
|
4721
|
-
|
|
4722
|
-
var rect = {
|
|
4723
|
-
top: elementRect.top - parentRect.top,
|
|
4724
|
-
left: elementRect.left - parentRect.left,
|
|
4725
|
-
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
4726
|
-
right: elementRect.left - parentRect.left + elementRect.width,
|
|
4727
|
-
width: elementRect.width,
|
|
4728
|
-
height: elementRect.height
|
|
4729
|
-
};
|
|
4730
|
-
return rect;
|
|
4731
|
-
}
|
|
4732
|
-
|
|
4572
|
+
*/
|
|
4573
|
+
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
4574
|
+
var elementRect = getBoundingClientRect(element);
|
|
4575
|
+
// parent 为 popper 元素:取其真实包含块的视口 rect,
|
|
4576
|
+
// 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
|
|
4577
|
+
var parentRect = getContainingBlockRect(parent, fixed);
|
|
4578
|
+
|
|
4579
|
+
var rect = {
|
|
4580
|
+
top: elementRect.top - parentRect.top,
|
|
4581
|
+
left: elementRect.left - parentRect.left,
|
|
4582
|
+
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
4583
|
+
right: elementRect.left - parentRect.left + elementRect.width,
|
|
4584
|
+
width: elementRect.width,
|
|
4585
|
+
height: elementRect.height
|
|
4586
|
+
};
|
|
4587
|
+
return rect;
|
|
4588
|
+
}
|
|
4589
|
+
|
|
4733
4590
|
/**
|
|
4734
4591
|
* Get the prefixed supported property name
|
|
4735
4592
|
* @function
|
|
4736
4593
|
* @ignore
|
|
4737
4594
|
* @argument {String} property (camelCase)
|
|
4738
4595
|
* @returns {String} prefixed property (camelCase)
|
|
4739
|
-
*/
|
|
4740
|
-
function getSupportedPropertyName(property) {
|
|
4741
|
-
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
4742
|
-
|
|
4743
|
-
for (var i = 0; i < prefixes.length; i++) {
|
|
4744
|
-
var toCheck = prefixes[i]
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
}
|
|
4753
|
-
|
|
4596
|
+
*/
|
|
4597
|
+
function getSupportedPropertyName(property) {
|
|
4598
|
+
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
4599
|
+
|
|
4600
|
+
for (var i = 0; i < prefixes.length; i++) {
|
|
4601
|
+
var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
|
|
4602
|
+
if (typeof root.document.body.style[toCheck] !== 'undefined') {
|
|
4603
|
+
return toCheck;
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
return null;
|
|
4607
|
+
}
|
|
4608
|
+
|
|
4754
4609
|
/**
|
|
4755
4610
|
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
|
|
4756
4611
|
* objects to a target object. It will return the target object.
|
|
@@ -4758,46 +4613,41 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
4758
4613
|
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
4759
4614
|
* @function
|
|
4760
4615
|
* @ignore
|
|
4761
|
-
*/
|
|
4762
|
-
if (!Object.assign) {
|
|
4763
|
-
Object.defineProperty(Object, 'assign', {
|
|
4764
|
-
enumerable: false,
|
|
4765
|
-
configurable: true,
|
|
4766
|
-
writable: true,
|
|
4767
|
-
value: function (target) {
|
|
4768
|
-
if (target === undefined || target === null) {
|
|
4769
|
-
throw new TypeError('Cannot convert first argument to object');
|
|
4770
|
-
}
|
|
4771
|
-
|
|
4772
|
-
var to = Object(target);
|
|
4773
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4774
|
-
var nextSource = arguments[i];
|
|
4775
|
-
if (nextSource === undefined || nextSource === null) {
|
|
4776
|
-
continue;
|
|
4777
|
-
}
|
|
4778
|
-
nextSource = Object(nextSource);
|
|
4779
|
-
|
|
4780
|
-
var keysArray = Object.keys(nextSource);
|
|
4781
|
-
for (
|
|
4782
|
-
var nextIndex = 0, len = keysArray.length;
|
|
4783
|
-
nextIndex < len;
|
|
4784
|
-
nextIndex++
|
|
4785
|
-
) {
|
|
4786
|
-
var nextKey = keysArray[nextIndex];
|
|
4787
|
-
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
4788
|
-
if (desc !== undefined && desc.enumerable) {
|
|
4789
|
-
to[nextKey] = nextSource[nextKey];
|
|
4790
|
-
}
|
|
4791
|
-
}
|
|
4792
|
-
}
|
|
4793
|
-
return to;
|
|
4794
|
-
}
|
|
4795
|
-
});
|
|
4796
|
-
}
|
|
4797
|
-
|
|
4798
|
-
return Popper;
|
|
4799
|
-
});
|
|
4616
|
+
*/
|
|
4617
|
+
if (!Object.assign) {
|
|
4618
|
+
Object.defineProperty(Object, 'assign', {
|
|
4619
|
+
enumerable: false,
|
|
4620
|
+
configurable: true,
|
|
4621
|
+
writable: true,
|
|
4622
|
+
value: function value(target) {
|
|
4623
|
+
if (target === undefined || target === null) {
|
|
4624
|
+
throw new TypeError('Cannot convert first argument to object');
|
|
4625
|
+
}
|
|
4800
4626
|
|
|
4627
|
+
var to = Object(target);
|
|
4628
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
4629
|
+
var nextSource = arguments[i];
|
|
4630
|
+
if (nextSource === undefined || nextSource === null) {
|
|
4631
|
+
continue;
|
|
4632
|
+
}
|
|
4633
|
+
nextSource = Object(nextSource);
|
|
4634
|
+
|
|
4635
|
+
var keysArray = Object.keys(nextSource);
|
|
4636
|
+
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
|
4637
|
+
var nextKey = keysArray[nextIndex];
|
|
4638
|
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
4639
|
+
if (desc !== undefined && desc.enumerable) {
|
|
4640
|
+
to[nextKey] = nextSource[nextKey];
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
return to;
|
|
4645
|
+
}
|
|
4646
|
+
});
|
|
4647
|
+
}
|
|
4648
|
+
|
|
4649
|
+
return Popper;
|
|
4650
|
+
});
|
|
4801
4651
|
|
|
4802
4652
|
/***/ })
|
|
4803
4653
|
|