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