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/cascader.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 = 234);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -3706,7 +3706,7 @@ var getRgb = function getRgb($color) {
|
|
|
3706
3706
|
|
|
3707
3707
|
/***/ }),
|
|
3708
3708
|
|
|
3709
|
-
/***/
|
|
3709
|
+
/***/ 137:
|
|
3710
3710
|
/***/ (function(module, exports) {
|
|
3711
3711
|
|
|
3712
3712
|
module.exports = require("eoss/lib/cascader-panel");
|
|
@@ -3817,7 +3817,152 @@ module.exports = require("vue");
|
|
|
3817
3817
|
|
|
3818
3818
|
/***/ }),
|
|
3819
3819
|
|
|
3820
|
-
/***/
|
|
3820
|
+
/***/ 23:
|
|
3821
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3822
|
+
|
|
3823
|
+
"use strict";
|
|
3824
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollbarWidth; });
|
|
3825
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return scrollIntoView; });
|
|
3826
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getScrollSize; });
|
|
3827
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return scrollMove; });
|
|
3828
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
3829
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
3830
|
+
|
|
3831
|
+
|
|
3832
|
+
/**
|
|
3833
|
+
* 缓存变量,用于存储计算过的滚动条宽度
|
|
3834
|
+
*/
|
|
3835
|
+
var scrollBarWidth = void 0;
|
|
3836
|
+
|
|
3837
|
+
/**
|
|
3838
|
+
* 计算并返回浏览器滚动条的宽度
|
|
3839
|
+
* @returns {number} 滚动条宽度(像素)
|
|
3840
|
+
*/
|
|
3841
|
+
var getScrollbarWidth = function getScrollbarWidth() {
|
|
3842
|
+
// 服务器端渲染时返回0
|
|
3843
|
+
if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return 0;
|
|
3844
|
+
// 如果已经计算过,直接返回缓存值
|
|
3845
|
+
if (scrollBarWidth !== undefined) return scrollBarWidth;
|
|
3846
|
+
|
|
3847
|
+
// 创建测试元素
|
|
3848
|
+
var outer = document.createElement('div');
|
|
3849
|
+
outer.className = 'es-scrollbar__wrap';
|
|
3850
|
+
outer.style.visibility = 'hidden';
|
|
3851
|
+
outer.style.width = '100px';
|
|
3852
|
+
outer.style.position = 'absolute';
|
|
3853
|
+
outer.style.top = '-9999px';
|
|
3854
|
+
document.body.appendChild(outer);
|
|
3855
|
+
|
|
3856
|
+
// 计算无滚动条时的宽度
|
|
3857
|
+
var widthNoScroll = outer.offsetWidth;
|
|
3858
|
+
outer.style.overflow = 'scroll';
|
|
3859
|
+
|
|
3860
|
+
// 创建内部元素并计算有滚动条时的宽度
|
|
3861
|
+
var inner = document.createElement('div');
|
|
3862
|
+
inner.style.width = '100%';
|
|
3863
|
+
outer.appendChild(inner);
|
|
3864
|
+
|
|
3865
|
+
var widthWithScroll = inner.offsetWidth;
|
|
3866
|
+
// 清理DOM
|
|
3867
|
+
outer.parentNode.removeChild(outer);
|
|
3868
|
+
// 计算滚动条宽度
|
|
3869
|
+
scrollBarWidth = widthNoScroll - widthWithScroll;
|
|
3870
|
+
|
|
3871
|
+
return scrollBarWidth;
|
|
3872
|
+
};
|
|
3873
|
+
|
|
3874
|
+
/**
|
|
3875
|
+
* 将指定元素滚动到容器视图中
|
|
3876
|
+
* @param {HTMLElement} container - 容器元素
|
|
3877
|
+
* @param {HTMLElement} selected - 要滚动到视图中的元素
|
|
3878
|
+
* @example
|
|
3879
|
+
* // 用法示例
|
|
3880
|
+
* const container = document.querySelector('.container');
|
|
3881
|
+
* const element = document.querySelector('.target-element');
|
|
3882
|
+
* scrollIntoView(container, element);
|
|
3883
|
+
*/
|
|
3884
|
+
function scrollIntoView(container, selected) {
|
|
3885
|
+
// 服务器端渲染时不执行
|
|
3886
|
+
if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
|
|
3887
|
+
|
|
3888
|
+
// 如果没有指定元素,滚动到顶部
|
|
3889
|
+
if (!selected) {
|
|
3890
|
+
container.scrollTop = 0;
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
|
|
3894
|
+
// 收集所有偏移父元素
|
|
3895
|
+
var offsetParents = [];
|
|
3896
|
+
var pointer = selected.offsetParent;
|
|
3897
|
+
while (pointer && container !== pointer && container.contains(pointer)) {
|
|
3898
|
+
offsetParents.push(pointer);
|
|
3899
|
+
pointer = pointer.offsetParent;
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
// 计算元素相对于容器的顶部偏移量
|
|
3903
|
+
var top = selected.offsetTop + offsetParents.reduce(function (prev, curr) {
|
|
3904
|
+
return prev + curr.offsetTop;
|
|
3905
|
+
}, 0);
|
|
3906
|
+
var bottom = top + selected.offsetHeight;
|
|
3907
|
+
var viewRectTop = container.scrollTop;
|
|
3908
|
+
var viewRectBottom = viewRectTop + container.clientHeight;
|
|
3909
|
+
|
|
3910
|
+
// 调整滚动位置使元素可见
|
|
3911
|
+
if (top < viewRectTop) {
|
|
3912
|
+
container.scrollTop = top;
|
|
3913
|
+
} else if (bottom > viewRectBottom) {
|
|
3914
|
+
container.scrollTop = bottom - container.clientHeight;
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
// 获取滚动条大小
|
|
3919
|
+
function getScrollSize(wrap) {
|
|
3920
|
+
if (!wrap) {
|
|
3921
|
+
return { width: '', height: '' };
|
|
3922
|
+
};
|
|
3923
|
+
var heightPercentage = 0;
|
|
3924
|
+
var widthPercentage = 0;
|
|
3925
|
+
|
|
3926
|
+
// 修复滚动条尺寸计算逻辑
|
|
3927
|
+
var scrollHeight = wrap.scrollHeight;
|
|
3928
|
+
var scrollWidth = wrap.scrollWidth;
|
|
3929
|
+
var clientHeight = wrap.clientHeight;
|
|
3930
|
+
var clientWidth = wrap.clientWidth;
|
|
3931
|
+
var sizes = {
|
|
3932
|
+
width: '',
|
|
3933
|
+
height: ''
|
|
3934
|
+
};
|
|
3935
|
+
// 只有当内容高度超过容器高度时才显示垂直滚动条
|
|
3936
|
+
if (scrollHeight > clientHeight) {
|
|
3937
|
+
heightPercentage = clientHeight * 100 / scrollHeight;
|
|
3938
|
+
sizes.height = heightPercentage < 100 ? heightPercentage + '%' : '100%';
|
|
3939
|
+
} else {
|
|
3940
|
+
sizes.height = '';
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
// 只有当内容宽度超过容器宽度时才显示水平滚动条
|
|
3944
|
+
if (scrollWidth > clientWidth) {
|
|
3945
|
+
widthPercentage = clientWidth * 100 / scrollWidth;
|
|
3946
|
+
sizes.width = widthPercentage < 100 ? widthPercentage + '%' : '100%';
|
|
3947
|
+
} else {
|
|
3948
|
+
sizes.width = '';
|
|
3949
|
+
}
|
|
3950
|
+
return sizes;
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3953
|
+
// 滚动条移动
|
|
3954
|
+
function scrollMove(wrap) {
|
|
3955
|
+
if (!wrap) return;
|
|
3956
|
+
|
|
3957
|
+
// 立即更新滚动条位置,不使用阈值判断
|
|
3958
|
+
var y = wrap.scrollTop * 100 / wrap.clientHeight;
|
|
3959
|
+
var x = wrap.scrollLeft * 100 / wrap.clientWidth;
|
|
3960
|
+
return { y: y, x: x };
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
/***/ }),
|
|
3964
|
+
|
|
3965
|
+
/***/ 234:
|
|
3821
3966
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3822
3967
|
|
|
3823
3968
|
"use strict";
|
|
@@ -4139,7 +4284,7 @@ var emitter = __webpack_require__(15);
|
|
|
4139
4284
|
var migrating = __webpack_require__(46);
|
|
4140
4285
|
|
|
4141
4286
|
// EXTERNAL MODULE: ./src/utils/aria-utils.js
|
|
4142
|
-
var aria_utils = __webpack_require__(
|
|
4287
|
+
var aria_utils = __webpack_require__(62);
|
|
4143
4288
|
|
|
4144
4289
|
// EXTERNAL MODULE: ./src/utils/util.js
|
|
4145
4290
|
var util = __webpack_require__(1);
|
|
@@ -4148,7 +4293,7 @@ var util = __webpack_require__(1);
|
|
|
4148
4293
|
var types = __webpack_require__(3);
|
|
4149
4294
|
|
|
4150
4295
|
// EXTERNAL MODULE: ./src/utils/shared.js
|
|
4151
|
-
var shared = __webpack_require__(
|
|
4296
|
+
var shared = __webpack_require__(82);
|
|
4152
4297
|
|
|
4153
4298
|
// EXTERNAL MODULE: ./src/utils/resize-event.js
|
|
4154
4299
|
var resize_event = __webpack_require__(38);
|
|
@@ -4161,7 +4306,7 @@ var input_ = __webpack_require__(14);
|
|
|
4161
4306
|
var input_default = /*#__PURE__*/__webpack_require__.n(input_);
|
|
4162
4307
|
|
|
4163
4308
|
// EXTERNAL MODULE: external "eoss/lib/tag"
|
|
4164
|
-
var tag_ = __webpack_require__(
|
|
4309
|
+
var tag_ = __webpack_require__(69);
|
|
4165
4310
|
var tag_default = /*#__PURE__*/__webpack_require__.n(tag_);
|
|
4166
4311
|
|
|
4167
4312
|
// EXTERNAL MODULE: external "eoss/lib/scrollbar"
|
|
@@ -4169,7 +4314,7 @@ var scrollbar_ = __webpack_require__(34);
|
|
|
4169
4314
|
var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
|
|
4170
4315
|
|
|
4171
4316
|
// EXTERNAL MODULE: external "eoss/lib/cascader-panel"
|
|
4172
|
-
var cascader_panel_ = __webpack_require__(
|
|
4317
|
+
var cascader_panel_ = __webpack_require__(137);
|
|
4173
4318
|
var cascader_panel_default = /*#__PURE__*/__webpack_require__.n(cascader_panel_);
|
|
4174
4319
|
|
|
4175
4320
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cascader/src/cascader.vue?vue&type=script&lang=js&
|
|
@@ -5222,238 +5367,93 @@ cascader.install = function (Vue) {
|
|
|
5222
5367
|
|
|
5223
5368
|
/***/ }),
|
|
5224
5369
|
|
|
5225
|
-
/***/
|
|
5370
|
+
/***/ 24:
|
|
5371
|
+
/***/ (function(module, exports) {
|
|
5372
|
+
|
|
5373
|
+
module.exports = require("throttle-debounce");
|
|
5374
|
+
|
|
5375
|
+
/***/ }),
|
|
5376
|
+
|
|
5377
|
+
/***/ 27:
|
|
5226
5378
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5227
5379
|
|
|
5228
5380
|
"use strict";
|
|
5229
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollbarWidth; });
|
|
5230
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return scrollIntoView; });
|
|
5231
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getScrollSize; });
|
|
5232
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return scrollMove; });
|
|
5233
5381
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
5234
5382
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
5383
|
+
/* harmony import */ var eoss_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32);
|
|
5235
5384
|
|
|
5236
5385
|
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5386
|
+
|
|
5387
|
+
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(53);
|
|
5388
|
+
var stopPropagation = function stopPropagation(e) {
|
|
5389
|
+
return e.stopPropagation();
|
|
5390
|
+
};
|
|
5241
5391
|
|
|
5242
5392
|
/**
|
|
5243
|
-
*
|
|
5244
|
-
* @
|
|
5393
|
+
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
|
|
5394
|
+
* @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
|
|
5395
|
+
* @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
|
|
5396
|
+
* @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
|
|
5397
|
+
* @param {Boolean} [visible=false] Visibility of the popup element.
|
|
5398
|
+
* @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
|
|
5245
5399
|
*/
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5400
|
+
/* harmony default export */ __webpack_exports__["a"] = ({
|
|
5401
|
+
props: {
|
|
5402
|
+
transformOrigin: {
|
|
5403
|
+
type: [Boolean, String],
|
|
5404
|
+
default: true
|
|
5405
|
+
},
|
|
5406
|
+
placement: {
|
|
5407
|
+
type: String,
|
|
5408
|
+
default: 'bottom'
|
|
5409
|
+
},
|
|
5410
|
+
boundariesPadding: {
|
|
5411
|
+
type: Number,
|
|
5412
|
+
default: 5
|
|
5413
|
+
},
|
|
5414
|
+
reference: { type: Object },
|
|
5415
|
+
popper: { type: Object },
|
|
5416
|
+
offset: {
|
|
5417
|
+
type: Number,
|
|
5418
|
+
default: 0
|
|
5419
|
+
},
|
|
5420
|
+
value: { type: Boolean },
|
|
5421
|
+
visibleArrow: { type: Boolean },
|
|
5422
|
+
arrowOffset: {
|
|
5423
|
+
type: Number,
|
|
5424
|
+
default: 35
|
|
5425
|
+
},
|
|
5426
|
+
appendToBody: {
|
|
5427
|
+
type: Boolean,
|
|
5428
|
+
default: true
|
|
5429
|
+
},
|
|
5430
|
+
popperOptions: {
|
|
5431
|
+
type: Object,
|
|
5432
|
+
default: function _default() {
|
|
5433
|
+
return {
|
|
5434
|
+
gpuAcceleration: false
|
|
5435
|
+
};
|
|
5436
|
+
}
|
|
5437
|
+
},
|
|
5438
|
+
queryParent: { type: Boolean }
|
|
5439
|
+
},
|
|
5260
5440
|
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5441
|
+
data: function data() {
|
|
5442
|
+
return {
|
|
5443
|
+
showPopper: false,
|
|
5444
|
+
currentPlacement: ''
|
|
5445
|
+
};
|
|
5446
|
+
},
|
|
5264
5447
|
|
|
5265
|
-
// 创建内部元素并计算有滚动条时的宽度
|
|
5266
|
-
var inner = document.createElement('div');
|
|
5267
|
-
inner.style.width = '100%';
|
|
5268
|
-
outer.appendChild(inner);
|
|
5269
5448
|
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
}
|
|
5278
|
-
|
|
5279
|
-
/**
|
|
5280
|
-
* 将指定元素滚动到容器视图中
|
|
5281
|
-
* @param {HTMLElement} container - 容器元素
|
|
5282
|
-
* @param {HTMLElement} selected - 要滚动到视图中的元素
|
|
5283
|
-
* @example
|
|
5284
|
-
* // 用法示例
|
|
5285
|
-
* const container = document.querySelector('.container');
|
|
5286
|
-
* const element = document.querySelector('.target-element');
|
|
5287
|
-
* scrollIntoView(container, element);
|
|
5288
|
-
*/
|
|
5289
|
-
function scrollIntoView(container, selected) {
|
|
5290
|
-
// 服务器端渲染时不执行
|
|
5291
|
-
if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
|
|
5292
|
-
|
|
5293
|
-
// 如果没有指定元素,滚动到顶部
|
|
5294
|
-
if (!selected) {
|
|
5295
|
-
container.scrollTop = 0;
|
|
5296
|
-
return;
|
|
5297
|
-
}
|
|
5298
|
-
|
|
5299
|
-
// 收集所有偏移父元素
|
|
5300
|
-
var offsetParents = [];
|
|
5301
|
-
var pointer = selected.offsetParent;
|
|
5302
|
-
while (pointer && container !== pointer && container.contains(pointer)) {
|
|
5303
|
-
offsetParents.push(pointer);
|
|
5304
|
-
pointer = pointer.offsetParent;
|
|
5305
|
-
}
|
|
5306
|
-
|
|
5307
|
-
// 计算元素相对于容器的顶部偏移量
|
|
5308
|
-
var top = selected.offsetTop + offsetParents.reduce(function (prev, curr) {
|
|
5309
|
-
return prev + curr.offsetTop;
|
|
5310
|
-
}, 0);
|
|
5311
|
-
var bottom = top + selected.offsetHeight;
|
|
5312
|
-
var viewRectTop = container.scrollTop;
|
|
5313
|
-
var viewRectBottom = viewRectTop + container.clientHeight;
|
|
5314
|
-
|
|
5315
|
-
// 调整滚动位置使元素可见
|
|
5316
|
-
if (top < viewRectTop) {
|
|
5317
|
-
container.scrollTop = top;
|
|
5318
|
-
} else if (bottom > viewRectBottom) {
|
|
5319
|
-
container.scrollTop = bottom - container.clientHeight;
|
|
5320
|
-
}
|
|
5321
|
-
}
|
|
5322
|
-
|
|
5323
|
-
// 获取滚动条大小
|
|
5324
|
-
function getScrollSize(wrap) {
|
|
5325
|
-
if (!wrap) {
|
|
5326
|
-
return { width: '', height: '' };
|
|
5327
|
-
};
|
|
5328
|
-
var heightPercentage = 0;
|
|
5329
|
-
var widthPercentage = 0;
|
|
5330
|
-
|
|
5331
|
-
// 修复滚动条尺寸计算逻辑
|
|
5332
|
-
var scrollHeight = wrap.scrollHeight;
|
|
5333
|
-
var scrollWidth = wrap.scrollWidth;
|
|
5334
|
-
var clientHeight = wrap.clientHeight;
|
|
5335
|
-
var clientWidth = wrap.clientWidth;
|
|
5336
|
-
var sizes = {
|
|
5337
|
-
width: '',
|
|
5338
|
-
height: ''
|
|
5339
|
-
};
|
|
5340
|
-
// 只有当内容高度超过容器高度时才显示垂直滚动条
|
|
5341
|
-
if (scrollHeight > clientHeight) {
|
|
5342
|
-
heightPercentage = clientHeight * 100 / scrollHeight;
|
|
5343
|
-
sizes.height = heightPercentage < 100 ? heightPercentage + '%' : '100%';
|
|
5344
|
-
} else {
|
|
5345
|
-
sizes.height = '';
|
|
5346
|
-
}
|
|
5347
|
-
|
|
5348
|
-
// 只有当内容宽度超过容器宽度时才显示水平滚动条
|
|
5349
|
-
if (scrollWidth > clientWidth) {
|
|
5350
|
-
widthPercentage = clientWidth * 100 / scrollWidth;
|
|
5351
|
-
sizes.width = widthPercentage < 100 ? widthPercentage + '%' : '100%';
|
|
5352
|
-
} else {
|
|
5353
|
-
sizes.width = '';
|
|
5354
|
-
}
|
|
5355
|
-
return sizes;
|
|
5356
|
-
}
|
|
5357
|
-
|
|
5358
|
-
// 滚动条移动
|
|
5359
|
-
function scrollMove(wrap) {
|
|
5360
|
-
if (!wrap) return;
|
|
5361
|
-
|
|
5362
|
-
// 立即更新滚动条位置,不使用阈值判断
|
|
5363
|
-
var y = wrap.scrollTop * 100 / wrap.clientHeight;
|
|
5364
|
-
var x = wrap.scrollLeft * 100 / wrap.clientWidth;
|
|
5365
|
-
return { y: y, x: x };
|
|
5366
|
-
}
|
|
5367
|
-
|
|
5368
|
-
/***/ }),
|
|
5369
|
-
|
|
5370
|
-
/***/ 24:
|
|
5371
|
-
/***/ (function(module, exports) {
|
|
5372
|
-
|
|
5373
|
-
module.exports = require("throttle-debounce");
|
|
5374
|
-
|
|
5375
|
-
/***/ }),
|
|
5376
|
-
|
|
5377
|
-
/***/ 27:
|
|
5378
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5379
|
-
|
|
5380
|
-
"use strict";
|
|
5381
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
5382
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
5383
|
-
/* harmony import */ var eoss_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32);
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(52);
|
|
5388
|
-
var stopPropagation = function stopPropagation(e) {
|
|
5389
|
-
return e.stopPropagation();
|
|
5390
|
-
};
|
|
5391
|
-
|
|
5392
|
-
/**
|
|
5393
|
-
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
|
|
5394
|
-
* @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
|
|
5395
|
-
* @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
|
|
5396
|
-
* @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
|
|
5397
|
-
* @param {Boolean} [visible=false] Visibility of the popup element.
|
|
5398
|
-
* @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
|
|
5399
|
-
*/
|
|
5400
|
-
/* harmony default export */ __webpack_exports__["a"] = ({
|
|
5401
|
-
props: {
|
|
5402
|
-
transformOrigin: {
|
|
5403
|
-
type: [Boolean, String],
|
|
5404
|
-
default: true
|
|
5405
|
-
},
|
|
5406
|
-
placement: {
|
|
5407
|
-
type: String,
|
|
5408
|
-
default: 'bottom'
|
|
5409
|
-
},
|
|
5410
|
-
boundariesPadding: {
|
|
5411
|
-
type: Number,
|
|
5412
|
-
default: 5
|
|
5413
|
-
},
|
|
5414
|
-
reference: { type: Object },
|
|
5415
|
-
popper: { type: Object },
|
|
5416
|
-
offset: {
|
|
5417
|
-
type: Number,
|
|
5418
|
-
default: 0
|
|
5419
|
-
},
|
|
5420
|
-
value: { type: Boolean },
|
|
5421
|
-
visibleArrow: { type: Boolean },
|
|
5422
|
-
arrowOffset: {
|
|
5423
|
-
type: Number,
|
|
5424
|
-
default: 35
|
|
5425
|
-
},
|
|
5426
|
-
appendToBody: {
|
|
5427
|
-
type: Boolean,
|
|
5428
|
-
default: true
|
|
5429
|
-
},
|
|
5430
|
-
popperOptions: {
|
|
5431
|
-
type: Object,
|
|
5432
|
-
default: function _default() {
|
|
5433
|
-
return {
|
|
5434
|
-
gpuAcceleration: false
|
|
5435
|
-
};
|
|
5436
|
-
}
|
|
5437
|
-
},
|
|
5438
|
-
queryParent: { type: Boolean }
|
|
5439
|
-
},
|
|
5440
|
-
|
|
5441
|
-
data: function data() {
|
|
5442
|
-
return {
|
|
5443
|
-
showPopper: false,
|
|
5444
|
-
currentPlacement: ''
|
|
5445
|
-
};
|
|
5446
|
-
},
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
watch: {
|
|
5450
|
-
value: {
|
|
5451
|
-
immediate: true,
|
|
5452
|
-
handler: function handler(val) {
|
|
5453
|
-
this.showPopper = val;
|
|
5454
|
-
this.$emit('input', val);
|
|
5455
|
-
}
|
|
5456
|
-
},
|
|
5449
|
+
watch: {
|
|
5450
|
+
value: {
|
|
5451
|
+
immediate: true,
|
|
5452
|
+
handler: function handler(val) {
|
|
5453
|
+
this.showPopper = val;
|
|
5454
|
+
this.$emit('input', val);
|
|
5455
|
+
}
|
|
5456
|
+
},
|
|
5457
5457
|
|
|
5458
5458
|
showPopper: function showPopper(val) {
|
|
5459
5459
|
if (this.disabled) return;
|
|
@@ -6757,10 +6757,12 @@ function insertAfter(newEl, targetEl) {
|
|
|
6757
6757
|
|
|
6758
6758
|
/***/ }),
|
|
6759
6759
|
|
|
6760
|
-
/***/
|
|
6760
|
+
/***/ 53:
|
|
6761
6761
|
/***/ (function(module, exports, __webpack_require__) {
|
|
6762
6762
|
|
|
6763
|
-
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__
|
|
6763
|
+
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; };
|
|
6764
|
+
|
|
6765
|
+
/**
|
|
6764
6766
|
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
6765
6767
|
* @version {{version}}
|
|
6766
6768
|
* @license
|
|
@@ -6783,68 +6785,60 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
6783
6785
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
6784
6786
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
6785
6787
|
* SOFTWARE.
|
|
6786
|
-
*/
|
|
6787
|
-
|
|
6788
|
-
//
|
|
6789
|
-
// Cross module loader
|
|
6790
|
-
// Supported: Node, AMD, Browser globals
|
|
6791
|
-
//
|
|
6792
|
-
(function (root, factory) {
|
|
6793
|
-
if (true) {
|
|
6794
|
-
// AMD. Register as an anonymous module.
|
|
6788
|
+
*/
|
|
6789
|
+
|
|
6790
|
+
//
|
|
6791
|
+
// Cross module loader
|
|
6792
|
+
// Supported: Node, AMD, Browser globals
|
|
6793
|
+
//
|
|
6794
|
+
(function (root, factory) {
|
|
6795
|
+
if (true) {
|
|
6796
|
+
// AMD. Register as an anonymous module.
|
|
6795
6797
|
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
6796
6798
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
6797
6799
|
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
6798
6800
|
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
6799
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
6800
|
-
} else {}
|
|
6801
|
-
})(this, function () {
|
|
6802
|
-
'use strict';
|
|
6803
|
-
|
|
6804
|
-
var root =
|
|
6805
|
-
// default options
|
|
6806
|
-
var DEFAULTS = {
|
|
6807
|
-
// placement of the popper
|
|
6808
|
-
placement: 'bottom',
|
|
6809
|
-
|
|
6810
|
-
gpuAcceleration: true,
|
|
6811
|
-
|
|
6812
|
-
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
6813
|
-
offset: 0,
|
|
6814
|
-
|
|
6815
|
-
// the element which will act as boundary of the popper
|
|
6816
|
-
boundariesElement: 'viewport',
|
|
6817
|
-
|
|
6818
|
-
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
6819
|
-
boundariesPadding: 5,
|
|
6820
|
-
|
|
6821
|
-
// popper will try to prevent overflow following this order,
|
|
6822
|
-
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
6823
|
-
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
6824
|
-
|
|
6825
|
-
// the behavior used by flip to change the placement of the popper
|
|
6826
|
-
flipBehavior: 'flip',
|
|
6827
|
-
|
|
6828
|
-
arrowElement: '[x-arrow]',
|
|
6829
|
-
|
|
6830
|
-
arrowOffset: 0,
|
|
6831
|
-
|
|
6832
|
-
// list of functions used to modify the offsets before they are applied to the popper
|
|
6833
|
-
modifiers: [
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
'applyStyle'
|
|
6841
|
-
],
|
|
6842
|
-
|
|
6843
|
-
modifiersIgnored: [],
|
|
6844
|
-
|
|
6845
|
-
forceAbsolute: false
|
|
6846
|
-
};
|
|
6847
|
-
|
|
6801
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
6802
|
+
} else {}
|
|
6803
|
+
})(this, function () {
|
|
6804
|
+
'use strict';
|
|
6805
|
+
|
|
6806
|
+
var root = window;
|
|
6807
|
+
// default options
|
|
6808
|
+
var DEFAULTS = {
|
|
6809
|
+
// placement of the popper
|
|
6810
|
+
placement: 'bottom',
|
|
6811
|
+
|
|
6812
|
+
gpuAcceleration: true,
|
|
6813
|
+
|
|
6814
|
+
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
6815
|
+
offset: 0,
|
|
6816
|
+
|
|
6817
|
+
// the element which will act as boundary of the popper
|
|
6818
|
+
boundariesElement: 'viewport',
|
|
6819
|
+
|
|
6820
|
+
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
6821
|
+
boundariesPadding: 5,
|
|
6822
|
+
|
|
6823
|
+
// popper will try to prevent overflow following this order,
|
|
6824
|
+
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
6825
|
+
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
6826
|
+
|
|
6827
|
+
// the behavior used by flip to change the placement of the popper
|
|
6828
|
+
flipBehavior: 'flip',
|
|
6829
|
+
|
|
6830
|
+
arrowElement: '[x-arrow]',
|
|
6831
|
+
|
|
6832
|
+
arrowOffset: 0,
|
|
6833
|
+
|
|
6834
|
+
// list of functions used to modify the offsets before they are applied to the popper
|
|
6835
|
+
modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
|
|
6836
|
+
|
|
6837
|
+
modifiersIgnored: [],
|
|
6838
|
+
|
|
6839
|
+
forceAbsolute: false
|
|
6840
|
+
};
|
|
6841
|
+
|
|
6848
6842
|
/**
|
|
6849
6843
|
* Create a new Popper.js instance
|
|
6850
6844
|
* @constructor Popper
|
|
@@ -6909,125 +6903,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
6909
6903
|
*
|
|
6910
6904
|
* @param {Boolean} [options.removeOnDestroy=false]
|
|
6911
6905
|
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
|
|
6912
|
-
*/
|
|
6913
|
-
function Popper(reference, popper, options) {
|
|
6914
|
-
this._reference = reference.jquery ? reference[0] : reference;
|
|
6915
|
-
this.state = {};
|
|
6916
|
-
|
|
6917
|
-
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
6918
|
-
// generate a default popper if is not defined
|
|
6919
|
-
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
6920
|
-
var isConfig =
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
);
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
//
|
|
6955
|
-
this.
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
//
|
|
6963
|
-
// Methods
|
|
6964
|
-
//
|
|
6906
|
+
*/
|
|
6907
|
+
function Popper(reference, popper, options) {
|
|
6908
|
+
this._reference = reference.jquery ? reference[0] : reference;
|
|
6909
|
+
this.state = {};
|
|
6910
|
+
|
|
6911
|
+
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
6912
|
+
// generate a default popper if is not defined
|
|
6913
|
+
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
6914
|
+
var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
|
|
6915
|
+
if (isNotDefined || isConfig) {
|
|
6916
|
+
this._popper = this.parse(isConfig ? popper : {});
|
|
6917
|
+
}
|
|
6918
|
+
// otherwise, use the given HTMLElement as popper
|
|
6919
|
+
else {
|
|
6920
|
+
this._popper = popper.jquery ? popper[0] : popper;
|
|
6921
|
+
}
|
|
6922
|
+
|
|
6923
|
+
// with {} we create a new object with the options inside it
|
|
6924
|
+
this._options = Object.assign({}, DEFAULTS, options);
|
|
6925
|
+
|
|
6926
|
+
// refactoring modifiers' list
|
|
6927
|
+
this._options.modifiers = this._options.modifiers.map(function (modifier) {
|
|
6928
|
+
// remove ignored modifiers
|
|
6929
|
+
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
|
|
6930
|
+
|
|
6931
|
+
// set the x-placement attribute before everything else because it could be used to add margins to the popper
|
|
6932
|
+
// margins needs to be calculated to get the correct popper offsets
|
|
6933
|
+
if (modifier === 'applyStyle') {
|
|
6934
|
+
this._popper.setAttribute('x-placement', this._options.placement);
|
|
6935
|
+
}
|
|
6936
|
+
|
|
6937
|
+
// return predefined modifier identified by string or keep the custom one
|
|
6938
|
+
return this.modifiers[modifier] || modifier;
|
|
6939
|
+
}.bind(this));
|
|
6940
|
+
|
|
6941
|
+
// make sure to apply the popper position before any computation
|
|
6942
|
+
this.state.position = this._getPosition(this._popper, this._reference);
|
|
6943
|
+
setStyle(this._popper, { position: this.state.position, top: 0 });
|
|
6944
|
+
|
|
6945
|
+
// fire the first update to position the popper in the right place
|
|
6946
|
+
this.update();
|
|
6947
|
+
|
|
6948
|
+
// setup event listeners, they will take care of update the position in specific situations
|
|
6949
|
+
this._setupEventListeners();
|
|
6950
|
+
return this;
|
|
6951
|
+
}
|
|
6952
|
+
|
|
6953
|
+
//
|
|
6954
|
+
// Methods
|
|
6955
|
+
//
|
|
6965
6956
|
/**
|
|
6966
6957
|
* Destroy the popper
|
|
6967
6958
|
* @method
|
|
6968
6959
|
* @memberof Popper
|
|
6969
|
-
*/
|
|
6970
|
-
Popper.prototype.destroy = function () {
|
|
6971
|
-
this._popper.removeAttribute('x-placement');
|
|
6972
|
-
this._popper.style.left = '';
|
|
6973
|
-
this._popper.style.position = '';
|
|
6974
|
-
this._popper.style.top = '';
|
|
6975
|
-
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
6976
|
-
this._removeEventListeners();
|
|
6977
|
-
|
|
6978
|
-
// remove the popper if user explicity asked for the deletion on destroy
|
|
6979
|
-
if (this._options.removeOnDestroy) {
|
|
6980
|
-
this._popper.remove();
|
|
6981
|
-
}
|
|
6982
|
-
return this;
|
|
6983
|
-
};
|
|
6984
|
-
|
|
6960
|
+
*/
|
|
6961
|
+
Popper.prototype.destroy = function () {
|
|
6962
|
+
this._popper.removeAttribute('x-placement');
|
|
6963
|
+
this._popper.style.left = '';
|
|
6964
|
+
this._popper.style.position = '';
|
|
6965
|
+
this._popper.style.top = '';
|
|
6966
|
+
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
6967
|
+
this._removeEventListeners();
|
|
6968
|
+
|
|
6969
|
+
// remove the popper if user explicity asked for the deletion on destroy
|
|
6970
|
+
if (this._options.removeOnDestroy) {
|
|
6971
|
+
this._popper.remove();
|
|
6972
|
+
}
|
|
6973
|
+
return this;
|
|
6974
|
+
};
|
|
6975
|
+
|
|
6985
6976
|
/**
|
|
6986
6977
|
* Updates the position of the popper, computing the new offsets and applying the new style
|
|
6987
6978
|
* @method
|
|
6988
6979
|
* @memberof Popper
|
|
6989
|
-
*/
|
|
6990
|
-
Popper.prototype.update = function () {
|
|
6991
|
-
var data = { instance: this, styles: {} };
|
|
6992
|
-
|
|
6993
|
-
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
6994
|
-
// and refer to _originalPlacement to know the original value
|
|
6995
|
-
data.placement = this._options.placement;
|
|
6996
|
-
data._originalPlacement = this._options.placement;
|
|
6997
|
-
|
|
6998
|
-
// compute the popper and reference offsets and put them inside data.offsets
|
|
6999
|
-
data.offsets = this._getOffsets(
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
data
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
data = this.runModifiers(data, this._options.modifiers);
|
|
7013
|
-
|
|
7014
|
-
if (typeof this.state.updateCallback === 'function') {
|
|
7015
|
-
this.state.updateCallback(data);
|
|
7016
|
-
}
|
|
7017
|
-
};
|
|
7018
|
-
|
|
6980
|
+
*/
|
|
6981
|
+
Popper.prototype.update = function () {
|
|
6982
|
+
var data = { instance: this, styles: {} };
|
|
6983
|
+
|
|
6984
|
+
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
6985
|
+
// and refer to _originalPlacement to know the original value
|
|
6986
|
+
data.placement = this._options.placement;
|
|
6987
|
+
data._originalPlacement = this._options.placement;
|
|
6988
|
+
|
|
6989
|
+
// compute the popper and reference offsets and put them inside data.offsets
|
|
6990
|
+
data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
|
|
6991
|
+
|
|
6992
|
+
// get boundaries
|
|
6993
|
+
data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
|
|
6994
|
+
|
|
6995
|
+
data = this.runModifiers(data, this._options.modifiers);
|
|
6996
|
+
|
|
6997
|
+
if (typeof this.state.updateCallback === 'function') {
|
|
6998
|
+
this.state.updateCallback(data);
|
|
6999
|
+
}
|
|
7000
|
+
};
|
|
7001
|
+
|
|
7019
7002
|
/**
|
|
7020
7003
|
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
|
|
7021
7004
|
* @method
|
|
7022
7005
|
* @memberof Popper
|
|
7023
7006
|
* @param {Function} callback
|
|
7024
|
-
*/
|
|
7025
|
-
Popper.prototype.onCreate = function (callback) {
|
|
7026
|
-
// the createCallbacks return as first argument the popper instance
|
|
7027
|
-
callback(this);
|
|
7028
|
-
return this;
|
|
7029
|
-
};
|
|
7030
|
-
|
|
7007
|
+
*/
|
|
7008
|
+
Popper.prototype.onCreate = function (callback) {
|
|
7009
|
+
// the createCallbacks return as first argument the popper instance
|
|
7010
|
+
callback(this);
|
|
7011
|
+
return this;
|
|
7012
|
+
};
|
|
7013
|
+
|
|
7031
7014
|
/**
|
|
7032
7015
|
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
|
|
7033
7016
|
* used to style popper and its arrow.
|
|
@@ -7035,101 +7018,93 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7035
7018
|
* @method
|
|
7036
7019
|
* @memberof Popper
|
|
7037
7020
|
* @param {Function} callback
|
|
7038
|
-
*/
|
|
7039
|
-
Popper.prototype.onUpdate = function (callback) {
|
|
7040
|
-
this.state.updateCallback = callback;
|
|
7041
|
-
return this;
|
|
7042
|
-
};
|
|
7043
|
-
|
|
7021
|
+
*/
|
|
7022
|
+
Popper.prototype.onUpdate = function (callback) {
|
|
7023
|
+
this.state.updateCallback = callback;
|
|
7024
|
+
return this;
|
|
7025
|
+
};
|
|
7026
|
+
|
|
7044
7027
|
/**
|
|
7045
7028
|
* Helper used to generate poppers from a configuration file
|
|
7046
7029
|
* @method
|
|
7047
7030
|
* @memberof Popper
|
|
7048
7031
|
* @param config {Object} configuration
|
|
7049
7032
|
* @returns {HTMLElement} popper
|
|
7050
|
-
*/
|
|
7051
|
-
Popper.prototype.parse = function (config) {
|
|
7052
|
-
var defaultConfig = {
|
|
7053
|
-
tagName: 'div',
|
|
7054
|
-
classNames: ['popper'],
|
|
7055
|
-
attributes: [],
|
|
7056
|
-
parent: root.document.body,
|
|
7057
|
-
content: '',
|
|
7058
|
-
contentType: 'text',
|
|
7059
|
-
arrowTagName: 'div',
|
|
7060
|
-
arrowClassNames: ['popper__arrow'],
|
|
7061
|
-
arrowAttributes: ['x-arrow']
|
|
7062
|
-
};
|
|
7063
|
-
config = Object.assign({}, defaultConfig, config);
|
|
7064
|
-
|
|
7065
|
-
var d = root.document;
|
|
7066
|
-
|
|
7067
|
-
var popper = d.createElement(config.tagName);
|
|
7068
|
-
addClassNames(popper, config.classNames);
|
|
7069
|
-
addAttributes(popper, config.attributes);
|
|
7070
|
-
if (config.contentType === 'node') {
|
|
7071
|
-
popper.appendChild(
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
} else
|
|
7075
|
-
popper.
|
|
7076
|
-
}
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
// if
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
parent = parent[0];
|
|
7105
|
-
}
|
|
7106
|
-
|
|
7107
|
-
// the
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
parent = parent[0];
|
|
7113
|
-
}
|
|
7114
|
-
|
|
7115
|
-
// append the generated popper to its parent
|
|
7116
|
-
parent.appendChild(popper);
|
|
7117
|
-
|
|
7118
|
-
return popper;
|
|
7119
|
-
|
|
7033
|
+
*/
|
|
7034
|
+
Popper.prototype.parse = function (config) {
|
|
7035
|
+
var defaultConfig = {
|
|
7036
|
+
tagName: 'div',
|
|
7037
|
+
classNames: ['popper'],
|
|
7038
|
+
attributes: [],
|
|
7039
|
+
parent: root.document.body,
|
|
7040
|
+
content: '',
|
|
7041
|
+
contentType: 'text',
|
|
7042
|
+
arrowTagName: 'div',
|
|
7043
|
+
arrowClassNames: ['popper__arrow'],
|
|
7044
|
+
arrowAttributes: ['x-arrow']
|
|
7045
|
+
};
|
|
7046
|
+
config = Object.assign({}, defaultConfig, config);
|
|
7047
|
+
|
|
7048
|
+
var d = root.document;
|
|
7049
|
+
|
|
7050
|
+
var popper = d.createElement(config.tagName);
|
|
7051
|
+
addClassNames(popper, config.classNames);
|
|
7052
|
+
addAttributes(popper, config.attributes);
|
|
7053
|
+
if (config.contentType === 'node') {
|
|
7054
|
+
popper.appendChild(config.content.jquery ? config.content[0] : config.content);
|
|
7055
|
+
} else if (config.contentType === 'html') {
|
|
7056
|
+
popper.innerHTML = config.content;
|
|
7057
|
+
} else {
|
|
7058
|
+
popper.textContent = config.content;
|
|
7059
|
+
}
|
|
7060
|
+
|
|
7061
|
+
if (config.arrowTagName) {
|
|
7062
|
+
var arrow = d.createElement(config.arrowTagName);
|
|
7063
|
+
addClassNames(arrow, config.arrowClassNames);
|
|
7064
|
+
addAttributes(arrow, config.arrowAttributes);
|
|
7065
|
+
popper.appendChild(arrow);
|
|
7066
|
+
}
|
|
7067
|
+
|
|
7068
|
+
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
7069
|
+
|
|
7070
|
+
// if the given parent is a string, use it to match an element
|
|
7071
|
+
// if more than one element is matched, the first one will be used as parent
|
|
7072
|
+
// if no elements are matched, the script will throw an error
|
|
7073
|
+
if (typeof parent === 'string') {
|
|
7074
|
+
parent = d.querySelectorAll(config.parent);
|
|
7075
|
+
if (parent.length > 1) {
|
|
7076
|
+
console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
|
|
7077
|
+
}
|
|
7078
|
+
if (parent.length === 0) {
|
|
7079
|
+
throw "ERROR: the given `parent` doesn't exists!";
|
|
7080
|
+
}
|
|
7081
|
+
parent = parent[0];
|
|
7082
|
+
}
|
|
7083
|
+
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
|
|
7084
|
+
// the first one will be used as parent
|
|
7085
|
+
if (parent.length > 1 && parent instanceof Element === false) {
|
|
7086
|
+
console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
|
|
7087
|
+
parent = parent[0];
|
|
7088
|
+
}
|
|
7089
|
+
|
|
7090
|
+
// append the generated popper to its parent
|
|
7091
|
+
parent.appendChild(popper);
|
|
7092
|
+
|
|
7093
|
+
return popper;
|
|
7094
|
+
|
|
7120
7095
|
/**
|
|
7121
7096
|
* Adds class names to the given element
|
|
7122
7097
|
* @function
|
|
7123
7098
|
* @ignore
|
|
7124
7099
|
* @param {HTMLElement} target
|
|
7125
7100
|
* @param {Array} classes
|
|
7126
|
-
*/
|
|
7127
|
-
function addClassNames(element, classNames) {
|
|
7128
|
-
classNames.forEach(function (className) {
|
|
7129
|
-
element.classList.add(className);
|
|
7130
|
-
});
|
|
7131
|
-
}
|
|
7132
|
-
|
|
7101
|
+
*/
|
|
7102
|
+
function addClassNames(element, classNames) {
|
|
7103
|
+
classNames.forEach(function (className) {
|
|
7104
|
+
element.classList.add(className);
|
|
7105
|
+
});
|
|
7106
|
+
}
|
|
7107
|
+
|
|
7133
7108
|
/**
|
|
7134
7109
|
* Adds attributes to the given element
|
|
7135
7110
|
* @function
|
|
@@ -7138,17 +7113,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7138
7113
|
* @param {Array} attributes
|
|
7139
7114
|
* @example
|
|
7140
7115
|
* addAttributes(element, [ 'data-info:foobar' ]);
|
|
7141
|
-
*/
|
|
7142
|
-
function addAttributes(element, attributes) {
|
|
7143
|
-
attributes.forEach(function (attribute) {
|
|
7144
|
-
element.setAttribute(
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
}
|
|
7150
|
-
};
|
|
7151
|
-
|
|
7116
|
+
*/
|
|
7117
|
+
function addAttributes(element, attributes) {
|
|
7118
|
+
attributes.forEach(function (attribute) {
|
|
7119
|
+
element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
|
|
7120
|
+
});
|
|
7121
|
+
}
|
|
7122
|
+
};
|
|
7123
|
+
|
|
7152
7124
|
/**
|
|
7153
7125
|
* Helper used to get the position which will be applied to the popper
|
|
7154
7126
|
* @method
|
|
@@ -7156,132 +7128,113 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7156
7128
|
* @param config {HTMLElement} popper element
|
|
7157
7129
|
* @param reference {HTMLElement} reference element
|
|
7158
7130
|
* @returns {String} position
|
|
7159
|
-
*/
|
|
7160
|
-
Popper.prototype._getPosition = function (popper, reference) {
|
|
7161
|
-
var container = getOffsetParent(reference);
|
|
7162
|
-
|
|
7163
|
-
if (this._options.forceAbsolute) {
|
|
7164
|
-
return 'absolute';
|
|
7165
|
-
}
|
|
7166
|
-
|
|
7167
|
-
// Decide if the popper will be fixed
|
|
7168
|
-
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
7169
|
-
var isParentFixed = isFixed(reference, container);
|
|
7170
|
-
return isParentFixed ? 'fixed' : 'absolute';
|
|
7171
|
-
};
|
|
7172
|
-
|
|
7173
|
-
/**
|
|
7174
|
-
* Get offsets to the popper
|
|
7175
|
-
* @method
|
|
7176
|
-
* @memberof Popper
|
|
7131
|
+
*/
|
|
7132
|
+
Popper.prototype._getPosition = function (popper, reference) {
|
|
7133
|
+
var container = getOffsetParent(reference);
|
|
7134
|
+
|
|
7135
|
+
if (this._options.forceAbsolute) {
|
|
7136
|
+
return 'absolute';
|
|
7137
|
+
}
|
|
7138
|
+
|
|
7139
|
+
// Decide if the popper will be fixed
|
|
7140
|
+
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
7141
|
+
var isParentFixed = isFixed(reference, container);
|
|
7142
|
+
return isParentFixed ? 'fixed' : 'absolute';
|
|
7143
|
+
};
|
|
7144
|
+
|
|
7145
|
+
/**
|
|
7146
|
+
* Get offsets to the popper
|
|
7147
|
+
* @method
|
|
7148
|
+
* @memberof Popper
|
|
7177
7149
|
* @access private
|
|
7178
7150
|
* @param {Element} popper - the popper element
|
|
7179
7151
|
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
7180
7152
|
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
7181
|
-
*/
|
|
7182
|
-
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
7183
|
-
placement = placement.split('-')[0];
|
|
7184
|
-
var popperOffsets = {};
|
|
7185
|
-
|
|
7186
|
-
popperOffsets.position = this.state.position;
|
|
7187
|
-
var isParentFixed = popperOffsets.position === 'fixed';
|
|
7188
|
-
|
|
7189
|
-
//
|
|
7190
|
-
// Get reference element position
|
|
7191
|
-
//
|
|
7192
|
-
var referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
//
|
|
7200
|
-
//
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
//
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
if (placement === '
|
|
7214
|
-
popperOffsets.
|
|
7215
|
-
} else {
|
|
7216
|
-
popperOffsets.
|
|
7217
|
-
}
|
|
7218
|
-
}
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
// Add width and height to our offsets object
|
|
7231
|
-
popperOffsets.width = popperRect.width;
|
|
7232
|
-
popperOffsets.height = popperRect.height;
|
|
7233
|
-
|
|
7234
|
-
return {
|
|
7235
|
-
popper: popperOffsets,
|
|
7236
|
-
reference: referenceOffsets
|
|
7237
|
-
};
|
|
7238
|
-
};
|
|
7239
|
-
|
|
7153
|
+
*/
|
|
7154
|
+
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
7155
|
+
placement = placement.split('-')[0];
|
|
7156
|
+
var popperOffsets = {};
|
|
7157
|
+
|
|
7158
|
+
popperOffsets.position = this.state.position;
|
|
7159
|
+
var isParentFixed = popperOffsets.position === 'fixed';
|
|
7160
|
+
|
|
7161
|
+
//
|
|
7162
|
+
// Get reference element position
|
|
7163
|
+
//
|
|
7164
|
+
var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, popper, isParentFixed);
|
|
7165
|
+
|
|
7166
|
+
//
|
|
7167
|
+
// Get popper sizes
|
|
7168
|
+
//
|
|
7169
|
+
var popperRect = getOuterSizes(popper);
|
|
7170
|
+
|
|
7171
|
+
//
|
|
7172
|
+
// Compute offsets of popper
|
|
7173
|
+
//
|
|
7174
|
+
|
|
7175
|
+
// depending by the popper placement we have to compute its offsets slightly differently
|
|
7176
|
+
if (['right', 'left'].indexOf(placement) !== -1) {
|
|
7177
|
+
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
|
|
7178
|
+
if (placement === 'left') {
|
|
7179
|
+
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
7180
|
+
} else {
|
|
7181
|
+
popperOffsets.left = referenceOffsets.right;
|
|
7182
|
+
}
|
|
7183
|
+
} else {
|
|
7184
|
+
popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
|
|
7185
|
+
if (placement === 'top') {
|
|
7186
|
+
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
7187
|
+
} else {
|
|
7188
|
+
popperOffsets.top = referenceOffsets.bottom;
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
// Add width and height to our offsets object
|
|
7193
|
+
popperOffsets.width = popperRect.width;
|
|
7194
|
+
popperOffsets.height = popperRect.height;
|
|
7195
|
+
|
|
7196
|
+
return {
|
|
7197
|
+
popper: popperOffsets,
|
|
7198
|
+
reference: referenceOffsets
|
|
7199
|
+
};
|
|
7200
|
+
};
|
|
7201
|
+
|
|
7240
7202
|
/**
|
|
7241
7203
|
* Setup needed event listeners used to update the popper position
|
|
7242
7204
|
* @method
|
|
7243
7205
|
* @memberof Popper
|
|
7244
7206
|
* @access private
|
|
7245
|
-
*/
|
|
7246
|
-
Popper.prototype._setupEventListeners = function () {
|
|
7247
|
-
// NOTE: 1 DOM access here
|
|
7248
|
-
this.state.updateBound = this.update.bind(this);
|
|
7249
|
-
// 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
|
|
7250
|
-
this.state.realWindow = getRealWindow(this._popper);
|
|
7251
|
-
this.state.realWindow.addEventListener('resize', this.state.updateBound);
|
|
7252
|
-
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
7253
|
-
if (this._options.boundariesElement !== 'window') {
|
|
7254
|
-
var target = getScrollParent(this._reference);
|
|
7255
|
-
target.addEventListener('scroll', this.state.updateBound);
|
|
7256
|
-
this.state.scrollTarget = target;
|
|
7257
|
-
}
|
|
7258
|
-
};
|
|
7259
|
-
|
|
7207
|
+
*/
|
|
7208
|
+
Popper.prototype._setupEventListeners = function () {
|
|
7209
|
+
// NOTE: 1 DOM access here
|
|
7210
|
+
this.state.updateBound = this.update.bind(this);
|
|
7211
|
+
// 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
|
|
7212
|
+
this.state.realWindow = getRealWindow(this._popper);
|
|
7213
|
+
this.state.realWindow.addEventListener('resize', this.state.updateBound);
|
|
7214
|
+
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
7215
|
+
if (this._options.boundariesElement !== 'window') {
|
|
7216
|
+
var target = getScrollParent(this._reference);
|
|
7217
|
+
target.addEventListener('scroll', this.state.updateBound);
|
|
7218
|
+
this.state.scrollTarget = target;
|
|
7219
|
+
}
|
|
7220
|
+
};
|
|
7221
|
+
|
|
7260
7222
|
/**
|
|
7261
7223
|
* Remove event listeners used to update the popper position
|
|
7262
7224
|
* @method
|
|
7263
7225
|
* @memberof Popper
|
|
7264
7226
|
* @access private
|
|
7265
|
-
*/
|
|
7266
|
-
Popper.prototype._removeEventListeners = function () {
|
|
7267
|
-
// NOTE: 1 DOM access here
|
|
7268
|
-
(this.state.realWindow || root).removeEventListener(
|
|
7269
|
-
|
|
7270
|
-
this.state.updateBound
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
this.state.scrollTarget.removeEventListener(
|
|
7277
|
-
'scroll',
|
|
7278
|
-
this.state.updateBound
|
|
7279
|
-
);
|
|
7280
|
-
this.state.scrollTarget = null;
|
|
7281
|
-
}
|
|
7282
|
-
this.state.updateBound = null;
|
|
7283
|
-
};
|
|
7284
|
-
|
|
7227
|
+
*/
|
|
7228
|
+
Popper.prototype._removeEventListeners = function () {
|
|
7229
|
+
// NOTE: 1 DOM access here
|
|
7230
|
+
(this.state.realWindow || root).removeEventListener('resize', this.state.updateBound);
|
|
7231
|
+
if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
|
|
7232
|
+
this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
|
|
7233
|
+
this.state.scrollTarget = null;
|
|
7234
|
+
}
|
|
7235
|
+
this.state.updateBound = null;
|
|
7236
|
+
};
|
|
7237
|
+
|
|
7285
7238
|
/**
|
|
7286
7239
|
* Computed the boundaries limits and return them
|
|
7287
7240
|
* @method
|
|
@@ -7291,75 +7244,56 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7291
7244
|
* @param {Number} padding - Boundaries padding
|
|
7292
7245
|
* @param {Element} boundariesElement - Element used to define the boundaries
|
|
7293
7246
|
* @returns {Object} Coordinates of the boundaries
|
|
7294
|
-
*/
|
|
7295
|
-
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
7296
|
-
// NOTE: 1 DOM access here
|
|
7297
|
-
var boundaries = {};
|
|
7298
|
-
var width, height;
|
|
7299
|
-
if (boundariesElement === 'window') {
|
|
7300
|
-
var body = root.document.body,
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
height = Math.max(
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
);
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
} else {
|
|
7345
|
-
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
7346
|
-
boundaries = {
|
|
7347
|
-
top: 0,
|
|
7348
|
-
left: 0,
|
|
7349
|
-
right: boundariesElement.clientWidth,
|
|
7350
|
-
bottom: boundariesElement.clientHeight
|
|
7351
|
-
};
|
|
7352
|
-
} else {
|
|
7353
|
-
boundaries = getOffsetRect(boundariesElement);
|
|
7354
|
-
}
|
|
7355
|
-
}
|
|
7356
|
-
boundaries.left += padding;
|
|
7357
|
-
boundaries.right -= padding;
|
|
7358
|
-
boundaries.top = boundaries.top + padding;
|
|
7359
|
-
boundaries.bottom = boundaries.bottom - padding;
|
|
7360
|
-
return boundaries;
|
|
7361
|
-
};
|
|
7362
|
-
|
|
7247
|
+
*/
|
|
7248
|
+
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
7249
|
+
// NOTE: 1 DOM access here
|
|
7250
|
+
var boundaries = {};
|
|
7251
|
+
var width, height;
|
|
7252
|
+
if (boundariesElement === 'window') {
|
|
7253
|
+
var body = root.document.body,
|
|
7254
|
+
html = root.document.documentElement;
|
|
7255
|
+
|
|
7256
|
+
height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
|
7257
|
+
width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
|
|
7258
|
+
|
|
7259
|
+
boundaries = {
|
|
7260
|
+
top: 0,
|
|
7261
|
+
right: width,
|
|
7262
|
+
bottom: height,
|
|
7263
|
+
left: 0
|
|
7264
|
+
};
|
|
7265
|
+
} else if (boundariesElement === 'viewport') {
|
|
7266
|
+
// 将真实 window 的视口换算到 popper 所在包含块的坐标系。
|
|
7267
|
+
// 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
|
|
7268
|
+
// 统一从元素自身的 view 与真实包含块获取
|
|
7269
|
+
var realWindow = getRealWindow(this._popper);
|
|
7270
|
+
var containingBlockRect = getContainingBlockRect(this._popper, data.offsets.popper.position === 'fixed');
|
|
7271
|
+
|
|
7272
|
+
boundaries = {
|
|
7273
|
+
top: 0 - containingBlockRect.top,
|
|
7274
|
+
right: realWindow.document.documentElement.clientWidth - containingBlockRect.left,
|
|
7275
|
+
bottom: realWindow.document.documentElement.clientHeight - containingBlockRect.top,
|
|
7276
|
+
left: 0 - containingBlockRect.left
|
|
7277
|
+
};
|
|
7278
|
+
} else {
|
|
7279
|
+
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
7280
|
+
boundaries = {
|
|
7281
|
+
top: 0,
|
|
7282
|
+
left: 0,
|
|
7283
|
+
right: boundariesElement.clientWidth,
|
|
7284
|
+
bottom: boundariesElement.clientHeight
|
|
7285
|
+
};
|
|
7286
|
+
} else {
|
|
7287
|
+
boundaries = getOffsetRect(boundariesElement);
|
|
7288
|
+
}
|
|
7289
|
+
}
|
|
7290
|
+
boundaries.left += padding;
|
|
7291
|
+
boundaries.right -= padding;
|
|
7292
|
+
boundaries.top = boundaries.top + padding;
|
|
7293
|
+
boundaries.bottom = boundaries.bottom - padding;
|
|
7294
|
+
return boundaries;
|
|
7295
|
+
};
|
|
7296
|
+
|
|
7363
7297
|
/**
|
|
7364
7298
|
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
|
|
7365
7299
|
* @method
|
|
@@ -7368,27 +7302,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7368
7302
|
* @param {Object} data
|
|
7369
7303
|
* @param {Array} modifiers
|
|
7370
7304
|
* @param {Function} ends
|
|
7371
|
-
*/
|
|
7372
|
-
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
7373
|
-
var modifiersToRun = modifiers.slice();
|
|
7374
|
-
if (ends !== undefined) {
|
|
7375
|
-
modifiersToRun = this._options.modifiers.slice(
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
);
|
|
7388
|
-
|
|
7389
|
-
return data;
|
|
7390
|
-
};
|
|
7391
|
-
|
|
7305
|
+
*/
|
|
7306
|
+
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
7307
|
+
var modifiersToRun = modifiers.slice();
|
|
7308
|
+
if (ends !== undefined) {
|
|
7309
|
+
modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
|
|
7310
|
+
}
|
|
7311
|
+
|
|
7312
|
+
modifiersToRun.forEach(function (modifier) {
|
|
7313
|
+
if (isFunction(modifier)) {
|
|
7314
|
+
data = modifier.call(this, data);
|
|
7315
|
+
}
|
|
7316
|
+
}.bind(this));
|
|
7317
|
+
|
|
7318
|
+
return data;
|
|
7319
|
+
};
|
|
7320
|
+
|
|
7392
7321
|
/**
|
|
7393
7322
|
* Helper used to know if the given modifier depends from another one.
|
|
7394
7323
|
* @method
|
|
@@ -7396,204 +7325,191 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7396
7325
|
* @param {String} requesting - name of requesting modifier
|
|
7397
7326
|
* @param {String} requested - name of requested modifier
|
|
7398
7327
|
* @returns {Boolean}
|
|
7399
|
-
*/
|
|
7400
|
-
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
7401
|
-
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
7402
|
-
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
7403
|
-
return modifier === requested;
|
|
7404
|
-
}).length;
|
|
7405
|
-
};
|
|
7406
|
-
|
|
7407
|
-
//
|
|
7408
|
-
// Modifiers
|
|
7409
|
-
//
|
|
7410
|
-
|
|
7328
|
+
*/
|
|
7329
|
+
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
7330
|
+
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
7331
|
+
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
7332
|
+
return modifier === requested;
|
|
7333
|
+
}).length;
|
|
7334
|
+
};
|
|
7335
|
+
|
|
7336
|
+
//
|
|
7337
|
+
// Modifiers
|
|
7338
|
+
//
|
|
7339
|
+
|
|
7411
7340
|
/**
|
|
7412
7341
|
* Modifiers list
|
|
7413
7342
|
* @namespace Popper.modifiers
|
|
7414
7343
|
* @memberof Popper
|
|
7415
7344
|
* @type {Object}
|
|
7416
|
-
*/
|
|
7417
|
-
Popper.prototype.modifiers = {};
|
|
7418
|
-
|
|
7345
|
+
*/
|
|
7346
|
+
Popper.prototype.modifiers = {};
|
|
7347
|
+
|
|
7419
7348
|
/**
|
|
7420
7349
|
* Apply the computed styles to the popper element
|
|
7421
7350
|
* @method
|
|
7422
7351
|
* @memberof Popper.modifiers
|
|
7423
7352
|
* @argument {Object} data - The data object generated by `update` method
|
|
7424
7353
|
* @returns {Object} The same data object
|
|
7425
|
-
*/
|
|
7426
|
-
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
7427
|
-
// apply the final offsets to the popper
|
|
7428
|
-
// NOTE: 1 DOM access here
|
|
7429
|
-
var styles = {
|
|
7430
|
-
position: data.offsets.popper.position
|
|
7431
|
-
};
|
|
7432
|
-
|
|
7433
|
-
// round top and left to avoid blurry text
|
|
7434
|
-
var left = Math.round(data.offsets.popper.left);
|
|
7435
|
-
var top = Math.round(data.offsets.popper.top);
|
|
7436
|
-
|
|
7437
|
-
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
7438
|
-
// we automatically use the supported prefixed version if needed
|
|
7439
|
-
var prefixedProperty;
|
|
7440
|
-
if (
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
//
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
this.modifiers.arrow
|
|
7472
|
-
) &&
|
|
7473
|
-
data.offsets.arrow
|
|
7474
|
-
) {
|
|
7475
|
-
setStyle(data.arrowElement, data.offsets.arrow);
|
|
7476
|
-
}
|
|
7477
|
-
|
|
7478
|
-
return data;
|
|
7479
|
-
};
|
|
7480
|
-
|
|
7354
|
+
*/
|
|
7355
|
+
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
7356
|
+
// apply the final offsets to the popper
|
|
7357
|
+
// NOTE: 1 DOM access here
|
|
7358
|
+
var styles = {
|
|
7359
|
+
position: data.offsets.popper.position
|
|
7360
|
+
};
|
|
7361
|
+
|
|
7362
|
+
// round top and left to avoid blurry text
|
|
7363
|
+
var left = Math.round(data.offsets.popper.left);
|
|
7364
|
+
var top = Math.round(data.offsets.popper.top);
|
|
7365
|
+
|
|
7366
|
+
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
7367
|
+
// we automatically use the supported prefixed version if needed
|
|
7368
|
+
var prefixedProperty;
|
|
7369
|
+
if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
|
|
7370
|
+
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
7371
|
+
styles.top = 0;
|
|
7372
|
+
styles.left = 0;
|
|
7373
|
+
}
|
|
7374
|
+
// othwerise, we use the standard `left` and `top` properties
|
|
7375
|
+
else {
|
|
7376
|
+
styles.left = left;
|
|
7377
|
+
styles.top = top;
|
|
7378
|
+
}
|
|
7379
|
+
|
|
7380
|
+
// any property present in `data.styles` will be applied to the popper,
|
|
7381
|
+
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
7382
|
+
// Be aware, modifiers could override the properties defined in the previous
|
|
7383
|
+
// lines of this modifier!
|
|
7384
|
+
Object.assign(styles, data.styles);
|
|
7385
|
+
|
|
7386
|
+
setStyle(this._popper, styles);
|
|
7387
|
+
|
|
7388
|
+
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
|
|
7389
|
+
// NOTE: 1 DOM access here
|
|
7390
|
+
this._popper.setAttribute('x-placement', data.placement);
|
|
7391
|
+
|
|
7392
|
+
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
|
|
7393
|
+
if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
|
|
7394
|
+
setStyle(data.arrowElement, data.offsets.arrow);
|
|
7395
|
+
}
|
|
7396
|
+
|
|
7397
|
+
return data;
|
|
7398
|
+
};
|
|
7399
|
+
|
|
7481
7400
|
/**
|
|
7482
7401
|
* Modifier used to shift the popper on the start or end of its reference element side
|
|
7483
7402
|
* @method
|
|
7484
7403
|
* @memberof Popper.modifiers
|
|
7485
7404
|
* @argument {Object} data - The data object generated by `update` method
|
|
7486
7405
|
* @returns {Object} The data object, properly modified
|
|
7487
|
-
*/
|
|
7488
|
-
Popper.prototype.modifiers.shift = function (data) {
|
|
7489
|
-
var placement = data.placement;
|
|
7490
|
-
var basePlacement = placement.split('-')[0];
|
|
7491
|
-
var shiftVariation = placement.split('-')[1];
|
|
7492
|
-
|
|
7493
|
-
// if shift shiftVariation is specified, run the modifier
|
|
7494
|
-
if (shiftVariation) {
|
|
7495
|
-
var reference = data.offsets.reference;
|
|
7496
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
7497
|
-
|
|
7498
|
-
var shiftOffsets = {
|
|
7499
|
-
y: {
|
|
7500
|
-
start: { top: reference.top },
|
|
7501
|
-
end: { top: reference.top + reference.height - popper.height }
|
|
7502
|
-
},
|
|
7503
|
-
x: {
|
|
7504
|
-
start: { left: reference.left },
|
|
7505
|
-
end: { left: reference.left + reference.width - popper.width }
|
|
7506
|
-
}
|
|
7507
|
-
};
|
|
7508
|
-
|
|
7509
|
-
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
7510
|
-
|
|
7511
|
-
data.offsets.popper = Object.assign(
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
return data;
|
|
7518
|
-
};
|
|
7519
|
-
|
|
7406
|
+
*/
|
|
7407
|
+
Popper.prototype.modifiers.shift = function (data) {
|
|
7408
|
+
var placement = data.placement;
|
|
7409
|
+
var basePlacement = placement.split('-')[0];
|
|
7410
|
+
var shiftVariation = placement.split('-')[1];
|
|
7411
|
+
|
|
7412
|
+
// if shift shiftVariation is specified, run the modifier
|
|
7413
|
+
if (shiftVariation) {
|
|
7414
|
+
var reference = data.offsets.reference;
|
|
7415
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7416
|
+
|
|
7417
|
+
var shiftOffsets = {
|
|
7418
|
+
y: {
|
|
7419
|
+
start: { top: reference.top },
|
|
7420
|
+
end: { top: reference.top + reference.height - popper.height }
|
|
7421
|
+
},
|
|
7422
|
+
x: {
|
|
7423
|
+
start: { left: reference.left },
|
|
7424
|
+
end: { left: reference.left + reference.width - popper.width }
|
|
7425
|
+
}
|
|
7426
|
+
};
|
|
7427
|
+
|
|
7428
|
+
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
7429
|
+
|
|
7430
|
+
data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
|
|
7431
|
+
}
|
|
7432
|
+
|
|
7433
|
+
return data;
|
|
7434
|
+
};
|
|
7435
|
+
|
|
7520
7436
|
/**
|
|
7521
7437
|
* Modifier used to make sure the popper does not overflows from it's boundaries
|
|
7522
7438
|
* @method
|
|
7523
7439
|
* @memberof Popper.modifiers
|
|
7524
7440
|
* @argument {Object} data - The data object generated by `update` method
|
|
7525
7441
|
* @returns {Object} The data object, properly modified
|
|
7526
|
-
*/
|
|
7527
|
-
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
7528
|
-
var order = this._options.preventOverflowOrder;
|
|
7529
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
7530
|
-
|
|
7531
|
-
var check = {
|
|
7532
|
-
left: function () {
|
|
7533
|
-
var left = popper.left;
|
|
7534
|
-
if (popper.left < data.boundaries.left) {
|
|
7535
|
-
left = Math.max(popper.left, data.boundaries.left);
|
|
7536
|
-
}
|
|
7537
|
-
return { left: left };
|
|
7538
|
-
},
|
|
7539
|
-
right: function () {
|
|
7540
|
-
var left = popper.left;
|
|
7541
|
-
if (popper.right > data.boundaries.right) {
|
|
7542
|
-
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
7543
|
-
}
|
|
7544
|
-
return { left: left };
|
|
7545
|
-
},
|
|
7546
|
-
top: function () {
|
|
7547
|
-
var top = popper.top;
|
|
7548
|
-
if (popper.top < data.boundaries.top) {
|
|
7549
|
-
top = Math.max(popper.top, data.boundaries.top);
|
|
7550
|
-
}
|
|
7551
|
-
return { top: top };
|
|
7552
|
-
},
|
|
7553
|
-
bottom: function () {
|
|
7554
|
-
var top = popper.top;
|
|
7555
|
-
if (popper.bottom > data.boundaries.bottom) {
|
|
7556
|
-
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
7557
|
-
}
|
|
7558
|
-
return { top: top };
|
|
7559
|
-
}
|
|
7560
|
-
};
|
|
7561
|
-
|
|
7562
|
-
order.forEach(function (direction) {
|
|
7563
|
-
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
7564
|
-
});
|
|
7565
|
-
|
|
7566
|
-
return data;
|
|
7567
|
-
};
|
|
7568
|
-
|
|
7442
|
+
*/
|
|
7443
|
+
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
7444
|
+
var order = this._options.preventOverflowOrder;
|
|
7445
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7446
|
+
|
|
7447
|
+
var check = {
|
|
7448
|
+
left: function left() {
|
|
7449
|
+
var left = popper.left;
|
|
7450
|
+
if (popper.left < data.boundaries.left) {
|
|
7451
|
+
left = Math.max(popper.left, data.boundaries.left);
|
|
7452
|
+
}
|
|
7453
|
+
return { left: left };
|
|
7454
|
+
},
|
|
7455
|
+
right: function right() {
|
|
7456
|
+
var left = popper.left;
|
|
7457
|
+
if (popper.right > data.boundaries.right) {
|
|
7458
|
+
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
7459
|
+
}
|
|
7460
|
+
return { left: left };
|
|
7461
|
+
},
|
|
7462
|
+
top: function top() {
|
|
7463
|
+
var top = popper.top;
|
|
7464
|
+
if (popper.top < data.boundaries.top) {
|
|
7465
|
+
top = Math.max(popper.top, data.boundaries.top);
|
|
7466
|
+
}
|
|
7467
|
+
return { top: top };
|
|
7468
|
+
},
|
|
7469
|
+
bottom: function bottom() {
|
|
7470
|
+
var top = popper.top;
|
|
7471
|
+
if (popper.bottom > data.boundaries.bottom) {
|
|
7472
|
+
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
7473
|
+
}
|
|
7474
|
+
return { top: top };
|
|
7475
|
+
}
|
|
7476
|
+
};
|
|
7477
|
+
|
|
7478
|
+
order.forEach(function (direction) {
|
|
7479
|
+
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
7480
|
+
});
|
|
7481
|
+
|
|
7482
|
+
return data;
|
|
7483
|
+
};
|
|
7484
|
+
|
|
7569
7485
|
/**
|
|
7570
7486
|
* Modifier used to make sure the popper is always near its reference
|
|
7571
7487
|
* @method
|
|
7572
7488
|
* @memberof Popper.modifiers
|
|
7573
7489
|
* @argument {Object} data - The data object generated by _update method
|
|
7574
7490
|
* @returns {Object} The data object, properly modified
|
|
7575
|
-
*/
|
|
7576
|
-
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
7577
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
7578
|
-
var reference = data.offsets.reference;
|
|
7579
|
-
var f = Math.floor;
|
|
7580
|
-
|
|
7581
|
-
if (popper.right < f(reference.left)) {
|
|
7582
|
-
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
7583
|
-
}
|
|
7584
|
-
if (popper.left > f(reference.right)) {
|
|
7585
|
-
data.offsets.popper.left = f(reference.right);
|
|
7586
|
-
}
|
|
7587
|
-
if (popper.bottom < f(reference.top)) {
|
|
7588
|
-
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
7589
|
-
}
|
|
7590
|
-
if (popper.top > f(reference.bottom)) {
|
|
7591
|
-
data.offsets.popper.top = f(reference.bottom);
|
|
7592
|
-
}
|
|
7593
|
-
|
|
7594
|
-
return data;
|
|
7595
|
-
};
|
|
7596
|
-
|
|
7491
|
+
*/
|
|
7492
|
+
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
7493
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7494
|
+
var reference = data.offsets.reference;
|
|
7495
|
+
var f = Math.floor;
|
|
7496
|
+
|
|
7497
|
+
if (popper.right < f(reference.left)) {
|
|
7498
|
+
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
7499
|
+
}
|
|
7500
|
+
if (popper.left > f(reference.right)) {
|
|
7501
|
+
data.offsets.popper.left = f(reference.right);
|
|
7502
|
+
}
|
|
7503
|
+
if (popper.bottom < f(reference.top)) {
|
|
7504
|
+
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
7505
|
+
}
|
|
7506
|
+
if (popper.top > f(reference.bottom)) {
|
|
7507
|
+
data.offsets.popper.top = f(reference.bottom);
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
return data;
|
|
7511
|
+
};
|
|
7512
|
+
|
|
7597
7513
|
/**
|
|
7598
7514
|
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
|
|
7599
7515
|
* Requires the `preventOverflow` modifier before it in order to work.
|
|
@@ -7602,81 +7518,61 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7602
7518
|
* @memberof Popper.modifiers
|
|
7603
7519
|
* @argument {Object} data - The data object generated by _update method
|
|
7604
7520
|
* @returns {Object} The data object, properly modified
|
|
7605
|
-
*/
|
|
7606
|
-
Popper.prototype.modifiers.flip = function (data) {
|
|
7607
|
-
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
7608
|
-
// otherwise flip would not work as expected.
|
|
7609
|
-
if (
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
) {
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
) {
|
|
7661
|
-
// we'll use this boolean to detect any flip loop
|
|
7662
|
-
data.flipped = true;
|
|
7663
|
-
data.placement = flipOrder[index + 1];
|
|
7664
|
-
if (variation) {
|
|
7665
|
-
data.placement += '-' + variation;
|
|
7666
|
-
}
|
|
7667
|
-
data.offsets.popper = this._getOffsets(
|
|
7668
|
-
this._popper,
|
|
7669
|
-
this._reference,
|
|
7670
|
-
data.placement
|
|
7671
|
-
).popper;
|
|
7672
|
-
|
|
7673
|
-
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
7674
|
-
}
|
|
7675
|
-
}.bind(this)
|
|
7676
|
-
);
|
|
7677
|
-
return data;
|
|
7678
|
-
};
|
|
7679
|
-
|
|
7521
|
+
*/
|
|
7522
|
+
Popper.prototype.modifiers.flip = function (data) {
|
|
7523
|
+
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
7524
|
+
// otherwise flip would not work as expected.
|
|
7525
|
+
if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
|
|
7526
|
+
console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
|
|
7527
|
+
return data;
|
|
7528
|
+
}
|
|
7529
|
+
|
|
7530
|
+
if (data.flipped && data.placement === data._originalPlacement) {
|
|
7531
|
+
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
7532
|
+
return data;
|
|
7533
|
+
}
|
|
7534
|
+
|
|
7535
|
+
var placement = data.placement.split('-')[0];
|
|
7536
|
+
var placementOpposite = getOppositePlacement(placement);
|
|
7537
|
+
var variation = data.placement.split('-')[1] || '';
|
|
7538
|
+
|
|
7539
|
+
var flipOrder = [];
|
|
7540
|
+
if (this._options.flipBehavior === 'flip') {
|
|
7541
|
+
flipOrder = [placement, placementOpposite];
|
|
7542
|
+
} else {
|
|
7543
|
+
flipOrder = this._options.flipBehavior;
|
|
7544
|
+
}
|
|
7545
|
+
|
|
7546
|
+
flipOrder.forEach(function (step, index) {
|
|
7547
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
|
7548
|
+
return;
|
|
7549
|
+
}
|
|
7550
|
+
|
|
7551
|
+
placement = data.placement.split('-')[0];
|
|
7552
|
+
placementOpposite = getOppositePlacement(placement);
|
|
7553
|
+
|
|
7554
|
+
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
7555
|
+
|
|
7556
|
+
// this boolean is used to distinguish right and bottom from top and left
|
|
7557
|
+
// they need different computations to get flipped
|
|
7558
|
+
var a = ['right', 'bottom'].indexOf(placement) !== -1;
|
|
7559
|
+
|
|
7560
|
+
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
|
|
7561
|
+
if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
|
|
7562
|
+
// we'll use this boolean to detect any flip loop
|
|
7563
|
+
data.flipped = true;
|
|
7564
|
+
data.placement = flipOrder[index + 1];
|
|
7565
|
+
if (variation) {
|
|
7566
|
+
data.placement += '-' + variation;
|
|
7567
|
+
}
|
|
7568
|
+
data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
|
|
7569
|
+
|
|
7570
|
+
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
7571
|
+
}
|
|
7572
|
+
}.bind(this));
|
|
7573
|
+
return data;
|
|
7574
|
+
};
|
|
7575
|
+
|
|
7680
7576
|
/**
|
|
7681
7577
|
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
|
|
7682
7578
|
* The offsets will shift the popper on the side of its reference element.
|
|
@@ -7684,23 +7580,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7684
7580
|
* @memberof Popper.modifiers
|
|
7685
7581
|
* @argument {Object} data - The data object generated by _update method
|
|
7686
7582
|
* @returns {Object} The data object, properly modified
|
|
7687
|
-
*/
|
|
7688
|
-
Popper.prototype.modifiers.offset = function (data) {
|
|
7689
|
-
var offset = this._options.offset;
|
|
7690
|
-
var popper = data.offsets.popper;
|
|
7691
|
-
|
|
7692
|
-
if (data.placement.indexOf('left') !== -1) {
|
|
7693
|
-
popper.top -= offset;
|
|
7694
|
-
} else if (data.placement.indexOf('right') !== -1) {
|
|
7695
|
-
popper.top += offset;
|
|
7696
|
-
} else if (data.placement.indexOf('top') !== -1) {
|
|
7697
|
-
popper.left -= offset;
|
|
7698
|
-
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
7699
|
-
popper.left += offset;
|
|
7700
|
-
}
|
|
7701
|
-
return data;
|
|
7702
|
-
};
|
|
7703
|
-
|
|
7583
|
+
*/
|
|
7584
|
+
Popper.prototype.modifiers.offset = function (data) {
|
|
7585
|
+
var offset = this._options.offset;
|
|
7586
|
+
var popper = data.offsets.popper;
|
|
7587
|
+
|
|
7588
|
+
if (data.placement.indexOf('left') !== -1) {
|
|
7589
|
+
popper.top -= offset;
|
|
7590
|
+
} else if (data.placement.indexOf('right') !== -1) {
|
|
7591
|
+
popper.top += offset;
|
|
7592
|
+
} else if (data.placement.indexOf('top') !== -1) {
|
|
7593
|
+
popper.left -= offset;
|
|
7594
|
+
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
7595
|
+
popper.left += offset;
|
|
7596
|
+
}
|
|
7597
|
+
return data;
|
|
7598
|
+
};
|
|
7599
|
+
|
|
7704
7600
|
/**
|
|
7705
7601
|
* 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
|
|
7706
7602
|
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
|
|
@@ -7708,147 +7604,136 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7708
7604
|
* @memberof Popper.modifiers
|
|
7709
7605
|
* @argument {Object} data - The data object generated by _update method
|
|
7710
7606
|
* @returns {Object} The data object, properly modified
|
|
7711
|
-
*/
|
|
7712
|
-
Popper.prototype.modifiers.arrow = function (data) {
|
|
7713
|
-
var arrow = this._options.arrowElement;
|
|
7714
|
-
var arrowOffset = this._options.arrowOffset;
|
|
7715
|
-
|
|
7716
|
-
// if the arrowElement is a string, suppose it's a CSS selector
|
|
7717
|
-
if (typeof arrow === 'string') {
|
|
7718
|
-
arrow = this._popper.querySelector(arrow);
|
|
7719
|
-
}
|
|
7720
|
-
|
|
7721
|
-
// if arrow element is not found, don't run the modifier
|
|
7722
|
-
if (!arrow) {
|
|
7723
|
-
return data;
|
|
7724
|
-
}
|
|
7725
|
-
|
|
7726
|
-
// the arrow element must be child of its popper
|
|
7727
|
-
if (!this._popper.contains(arrow)) {
|
|
7728
|
-
console.warn(
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
)
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
var
|
|
7748
|
-
var
|
|
7749
|
-
var
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
//
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
//
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
data.offsets.arrow = arrowStyle;
|
|
7786
|
-
data.arrowElement = arrow;
|
|
7787
|
-
|
|
7788
|
-
return data;
|
|
7789
|
-
};
|
|
7790
|
-
|
|
7791
|
-
//
|
|
7792
|
-
// Helpers
|
|
7793
|
-
//
|
|
7794
|
-
|
|
7607
|
+
*/
|
|
7608
|
+
Popper.prototype.modifiers.arrow = function (data) {
|
|
7609
|
+
var arrow = this._options.arrowElement;
|
|
7610
|
+
var arrowOffset = this._options.arrowOffset;
|
|
7611
|
+
|
|
7612
|
+
// if the arrowElement is a string, suppose it's a CSS selector
|
|
7613
|
+
if (typeof arrow === 'string') {
|
|
7614
|
+
arrow = this._popper.querySelector(arrow);
|
|
7615
|
+
}
|
|
7616
|
+
|
|
7617
|
+
// if arrow element is not found, don't run the modifier
|
|
7618
|
+
if (!arrow) {
|
|
7619
|
+
return data;
|
|
7620
|
+
}
|
|
7621
|
+
|
|
7622
|
+
// the arrow element must be child of its popper
|
|
7623
|
+
if (!this._popper.contains(arrow)) {
|
|
7624
|
+
console.warn('WARNING: `arrowElement` must be child of its popper element!');
|
|
7625
|
+
return data;
|
|
7626
|
+
}
|
|
7627
|
+
|
|
7628
|
+
// arrow depends on keepTogether in order to work
|
|
7629
|
+
if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
|
|
7630
|
+
console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
|
|
7631
|
+
return data;
|
|
7632
|
+
}
|
|
7633
|
+
|
|
7634
|
+
var arrowStyle = {};
|
|
7635
|
+
var placement = data.placement.split('-')[0];
|
|
7636
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
7637
|
+
var reference = data.offsets.reference;
|
|
7638
|
+
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
7639
|
+
|
|
7640
|
+
var len = isVertical ? 'height' : 'width';
|
|
7641
|
+
var side = isVertical ? 'top' : 'left';
|
|
7642
|
+
var translate = isVertical ? 'translateY' : 'translateX';
|
|
7643
|
+
var altSide = isVertical ? 'left' : 'top';
|
|
7644
|
+
var opSide = isVertical ? 'bottom' : 'right';
|
|
7645
|
+
var arrowSize = getOuterSizes(arrow)[len];
|
|
7646
|
+
|
|
7647
|
+
//
|
|
7648
|
+
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
|
|
7649
|
+
//
|
|
7650
|
+
|
|
7651
|
+
// top/left side
|
|
7652
|
+
if (reference[opSide] - arrowSize < popper[side]) {
|
|
7653
|
+
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
|
|
7654
|
+
}
|
|
7655
|
+
// bottom/right side
|
|
7656
|
+
if (reference[side] + arrowSize > popper[opSide]) {
|
|
7657
|
+
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
|
|
7658
|
+
}
|
|
7659
|
+
|
|
7660
|
+
// compute center of the popper
|
|
7661
|
+
var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
7662
|
+
|
|
7663
|
+
var sideValue = center - popper[side];
|
|
7664
|
+
|
|
7665
|
+
// prevent arrow from being placed not contiguously to its popper
|
|
7666
|
+
sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
|
|
7667
|
+
arrowStyle[side] = sideValue;
|
|
7668
|
+
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
|
|
7669
|
+
|
|
7670
|
+
data.offsets.arrow = arrowStyle;
|
|
7671
|
+
data.arrowElement = arrow;
|
|
7672
|
+
|
|
7673
|
+
return data;
|
|
7674
|
+
};
|
|
7675
|
+
|
|
7676
|
+
//
|
|
7677
|
+
// Helpers
|
|
7678
|
+
//
|
|
7679
|
+
|
|
7795
7680
|
/**
|
|
7796
7681
|
* Get the outer sizes of the given element (offset size + margins)
|
|
7797
7682
|
* @function
|
|
7798
7683
|
* @ignore
|
|
7799
7684
|
* @argument {Element} element
|
|
7800
7685
|
* @returns {Object} object containing width and height properties
|
|
7801
|
-
*/
|
|
7802
|
-
function getOuterSizes(element) {
|
|
7803
|
-
// NOTE: 1 DOM access here
|
|
7804
|
-
var _display = element.style.display,
|
|
7805
|
-
|
|
7806
|
-
element.style.display = 'block';
|
|
7807
|
-
element.style.visibility = 'hidden';
|
|
7808
|
-
var calcWidthToForceRepaint = element.offsetWidth;
|
|
7809
|
-
// original method
|
|
7810
|
-
var styles = getRealWindow(element).getComputedStyle(element);
|
|
7811
|
-
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
7812
|
-
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
7813
|
-
var result = {
|
|
7814
|
-
width: element.offsetWidth + y,
|
|
7815
|
-
height: element.offsetHeight + x
|
|
7816
|
-
};
|
|
7817
|
-
|
|
7818
|
-
// reset element styles
|
|
7819
|
-
element.style.display = _display;
|
|
7820
|
-
element.style.visibility = _visibility;
|
|
7821
|
-
return result;
|
|
7822
|
-
}
|
|
7823
|
-
|
|
7686
|
+
*/
|
|
7687
|
+
function getOuterSizes(element) {
|
|
7688
|
+
// NOTE: 1 DOM access here
|
|
7689
|
+
var _display = element.style.display,
|
|
7690
|
+
_visibility = element.style.visibility;
|
|
7691
|
+
element.style.display = 'block';
|
|
7692
|
+
element.style.visibility = 'hidden';
|
|
7693
|
+
var calcWidthToForceRepaint = element.offsetWidth;
|
|
7694
|
+
// original method
|
|
7695
|
+
var styles = getRealWindow(element).getComputedStyle(element);
|
|
7696
|
+
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
7697
|
+
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
7698
|
+
var result = {
|
|
7699
|
+
width: element.offsetWidth + y,
|
|
7700
|
+
height: element.offsetHeight + x
|
|
7701
|
+
};
|
|
7702
|
+
|
|
7703
|
+
// reset element styles
|
|
7704
|
+
element.style.display = _display;
|
|
7705
|
+
element.style.visibility = _visibility;
|
|
7706
|
+
return result;
|
|
7707
|
+
}
|
|
7708
|
+
|
|
7824
7709
|
/**
|
|
7825
7710
|
* Get the opposite placement of the given one/
|
|
7826
7711
|
* @function
|
|
7827
7712
|
* @ignore
|
|
7828
7713
|
* @argument {String} placement
|
|
7829
7714
|
* @returns {String} flipped placement
|
|
7830
|
-
*/
|
|
7831
|
-
function getOppositePlacement(placement) {
|
|
7832
|
-
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
7833
|
-
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
7834
|
-
return hash[matched];
|
|
7835
|
-
});
|
|
7836
|
-
}
|
|
7837
|
-
|
|
7715
|
+
*/
|
|
7716
|
+
function getOppositePlacement(placement) {
|
|
7717
|
+
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
7718
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
7719
|
+
return hash[matched];
|
|
7720
|
+
});
|
|
7721
|
+
}
|
|
7722
|
+
|
|
7838
7723
|
/**
|
|
7839
7724
|
* Given the popper offsets, generate an output similar to getBoundingClientRect
|
|
7840
7725
|
* @function
|
|
7841
7726
|
* @ignore
|
|
7842
7727
|
* @argument {Object} popperOffsets
|
|
7843
7728
|
* @returns {Object} ClientRect like output
|
|
7844
|
-
*/
|
|
7845
|
-
function getPopperClientRect(popperOffsets) {
|
|
7846
|
-
var offsets = Object.assign({}, popperOffsets);
|
|
7847
|
-
offsets.right = offsets.left + offsets.width;
|
|
7848
|
-
offsets.bottom = offsets.top + offsets.height;
|
|
7849
|
-
return offsets;
|
|
7850
|
-
}
|
|
7851
|
-
|
|
7729
|
+
*/
|
|
7730
|
+
function getPopperClientRect(popperOffsets) {
|
|
7731
|
+
var offsets = Object.assign({}, popperOffsets);
|
|
7732
|
+
offsets.right = offsets.left + offsets.width;
|
|
7733
|
+
offsets.bottom = offsets.top + offsets.height;
|
|
7734
|
+
return offsets;
|
|
7735
|
+
}
|
|
7736
|
+
|
|
7852
7737
|
/**
|
|
7853
7738
|
* Given an array and the key to find, returns its index
|
|
7854
7739
|
* @function
|
|
@@ -7856,48 +7741,46 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7856
7741
|
* @argument {Array} arr
|
|
7857
7742
|
* @argument keyToFind
|
|
7858
7743
|
* @returns index or null
|
|
7859
|
-
*/
|
|
7860
|
-
function getArrayKeyIndex(arr, keyToFind) {
|
|
7861
|
-
var i = 0,
|
|
7862
|
-
|
|
7863
|
-
for (key in arr) {
|
|
7864
|
-
if (arr[key] === keyToFind) {
|
|
7865
|
-
return i;
|
|
7866
|
-
}
|
|
7867
|
-
i++;
|
|
7868
|
-
}
|
|
7869
|
-
return null;
|
|
7870
|
-
}
|
|
7871
|
-
|
|
7744
|
+
*/
|
|
7745
|
+
function getArrayKeyIndex(arr, keyToFind) {
|
|
7746
|
+
var i = 0,
|
|
7747
|
+
key;
|
|
7748
|
+
for (key in arr) {
|
|
7749
|
+
if (arr[key] === keyToFind) {
|
|
7750
|
+
return i;
|
|
7751
|
+
}
|
|
7752
|
+
i++;
|
|
7753
|
+
}
|
|
7754
|
+
return null;
|
|
7755
|
+
}
|
|
7756
|
+
|
|
7872
7757
|
/**
|
|
7873
7758
|
* Get CSS computed property of the given element
|
|
7874
7759
|
* @function
|
|
7875
7760
|
* @ignore
|
|
7876
7761
|
* @argument {Eement} element
|
|
7877
7762
|
* @argument {String} property
|
|
7878
|
-
*/
|
|
7879
|
-
function getStyleComputedProperty(element, property) {
|
|
7880
|
-
// NOTE: 1 DOM access here
|
|
7881
|
-
// 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
|
|
7882
|
-
// 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
|
|
7883
|
-
var css = getRealWindow(element).getComputedStyle(element, null);
|
|
7884
|
-
return css[property];
|
|
7885
|
-
}
|
|
7886
|
-
|
|
7763
|
+
*/
|
|
7764
|
+
function getStyleComputedProperty(element, property) {
|
|
7765
|
+
// NOTE: 1 DOM access here
|
|
7766
|
+
// 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
|
|
7767
|
+
// 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
|
|
7768
|
+
var css = getRealWindow(element).getComputedStyle(element, null);
|
|
7769
|
+
return css[property];
|
|
7770
|
+
}
|
|
7771
|
+
|
|
7887
7772
|
/**
|
|
7888
7773
|
* Returns the offset parent of the given element
|
|
7889
7774
|
* @function
|
|
7890
7775
|
* @ignore
|
|
7891
7776
|
* @argument {Element} element
|
|
7892
7777
|
* @returns {Element} offset parent
|
|
7893
|
-
*/
|
|
7894
|
-
function getOffsetParent(element) {
|
|
7895
|
-
var offsetParent = element.offsetParent;
|
|
7896
|
-
return offsetParent === root.document.body || !offsetParent
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
}
|
|
7900
|
-
|
|
7778
|
+
*/
|
|
7779
|
+
function getOffsetParent(element) {
|
|
7780
|
+
var offsetParent = element.offsetParent;
|
|
7781
|
+
return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
|
|
7782
|
+
}
|
|
7783
|
+
|
|
7901
7784
|
/**
|
|
7902
7785
|
* Returns the window the given element actually renders in.
|
|
7903
7786
|
* 无界等微前端场景下组件代码运行在沙箱 window 中,而 DOM 实际渲染在
|
|
@@ -7906,16 +7789,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7906
7789
|
* @ignore
|
|
7907
7790
|
* @argument {Element} element
|
|
7908
7791
|
* @returns {Window} window
|
|
7909
|
-
*/
|
|
7910
|
-
function getRealWindow(element) {
|
|
7911
|
-
return
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
element.ownerDocument.defaultView) ||
|
|
7915
|
-
root
|
|
7916
|
-
);
|
|
7917
|
-
}
|
|
7918
|
-
|
|
7792
|
+
*/
|
|
7793
|
+
function getRealWindow(element) {
|
|
7794
|
+
return element && element.ownerDocument && element.ownerDocument.defaultView || root;
|
|
7795
|
+
}
|
|
7796
|
+
|
|
7919
7797
|
/**
|
|
7920
7798
|
* Returns the viewport rect of the containing block actually used to position the popper.
|
|
7921
7799
|
* 无界微前端等场景下 popper 被挂载进子应用的 shadowRoot,offsetParent 的兜底值
|
|
@@ -7929,82 +7807,72 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
7929
7807
|
* @argument {Element} element - popper element
|
|
7930
7808
|
* @argument {Boolean} fixed - whether the popper is fixed positioned
|
|
7931
7809
|
* @returns {Object} rect
|
|
7932
|
-
*/
|
|
7933
|
-
function getContainingBlockRect(element, fixed) {
|
|
7934
|
-
if (fixed) {
|
|
7935
|
-
return { top: 0, left: 0, right: 0, bottom: 0 };
|
|
7936
|
-
}
|
|
7937
|
-
|
|
7938
|
-
var node = element.parentNode;
|
|
7939
|
-
while (node) {
|
|
7940
|
-
if (node.nodeType === 1) {
|
|
7941
|
-
if (getStyleComputedProperty(node, 'position') !== 'static') {
|
|
7942
|
-
return getBoundingClientRect(node);
|
|
7943
|
-
}
|
|
7944
|
-
} else if (node.nodeType === 11) {
|
|
7945
|
-
// 遇到 shadowRoot,跨边界从宿主元素继续向上查找
|
|
7946
|
-
node = node.host;
|
|
7947
|
-
continue;
|
|
7948
|
-
} else {
|
|
7949
|
-
break;
|
|
7950
|
-
}
|
|
7951
|
-
node = node.parentNode;
|
|
7952
|
-
}
|
|
7953
|
-
|
|
7954
|
-
var win = getRealWindow(element);
|
|
7955
|
-
return {
|
|
7956
|
-
top: -(win.pageYOffset || 0),
|
|
7957
|
-
left: -(win.pageXOffset || 0),
|
|
7958
|
-
right: 0,
|
|
7959
|
-
bottom: 0
|
|
7960
|
-
};
|
|
7961
|
-
}
|
|
7962
|
-
|
|
7810
|
+
*/
|
|
7811
|
+
function getContainingBlockRect(element, fixed) {
|
|
7812
|
+
if (fixed) {
|
|
7813
|
+
return { top: 0, left: 0, right: 0, bottom: 0 };
|
|
7814
|
+
}
|
|
7815
|
+
|
|
7816
|
+
var node = element.parentNode;
|
|
7817
|
+
while (node) {
|
|
7818
|
+
if (node.nodeType === 1) {
|
|
7819
|
+
if (getStyleComputedProperty(node, 'position') !== 'static') {
|
|
7820
|
+
return getBoundingClientRect(node);
|
|
7821
|
+
}
|
|
7822
|
+
} else if (node.nodeType === 11) {
|
|
7823
|
+
// 遇到 shadowRoot,跨边界从宿主元素继续向上查找
|
|
7824
|
+
node = node.host;
|
|
7825
|
+
continue;
|
|
7826
|
+
} else {
|
|
7827
|
+
break;
|
|
7828
|
+
}
|
|
7829
|
+
node = node.parentNode;
|
|
7830
|
+
}
|
|
7831
|
+
|
|
7832
|
+
var win = getRealWindow(element);
|
|
7833
|
+
return {
|
|
7834
|
+
top: -(win.pageYOffset || 0),
|
|
7835
|
+
left: -(win.pageXOffset || 0),
|
|
7836
|
+
right: 0,
|
|
7837
|
+
bottom: 0
|
|
7838
|
+
};
|
|
7839
|
+
}
|
|
7840
|
+
|
|
7963
7841
|
/**
|
|
7964
7842
|
* Returns the scrolling parent of the given element
|
|
7965
7843
|
* @function
|
|
7966
7844
|
* @ignore
|
|
7967
7845
|
* @argument {Element} element
|
|
7968
7846
|
* @returns {Element} offset parent
|
|
7969
|
-
*/
|
|
7970
|
-
function getScrollParent(element) {
|
|
7971
|
-
var parent = element.parentNode;
|
|
7972
|
-
if (!parent) {
|
|
7973
|
-
return element;
|
|
7974
|
-
}
|
|
7975
|
-
|
|
7976
|
-
if (parent.nodeType === 11) {
|
|
7977
|
-
// 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
|
|
7978
|
-
// 否则查找到 shadowRoot 即终止,滚动事件无法被监听
|
|
7979
|
-
return getScrollParent(parent.host);
|
|
7980
|
-
}
|
|
7981
|
-
|
|
7982
|
-
if (parent.nodeType !== 1) {
|
|
7983
|
-
// 到达 document,返回元素实际渲染所在的真实 window,
|
|
7984
|
-
// 保证 window 滚动时能触发位置更新
|
|
7985
|
-
return getRealWindow(element);
|
|
7986
|
-
}
|
|
7987
|
-
|
|
7988
|
-
// Firefox want us to check `-x` and `-y` variations as well
|
|
7989
|
-
if (
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
) !== -1
|
|
7999
|
-
) {
|
|
8000
|
-
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
8001
|
-
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
8002
|
-
// fixes issue #65
|
|
8003
|
-
return parent;
|
|
8004
|
-
}
|
|
8005
|
-
return getScrollParent(parent);
|
|
8006
|
-
}
|
|
8007
|
-
|
|
7847
|
+
*/
|
|
7848
|
+
function getScrollParent(element) {
|
|
7849
|
+
var parent = element.parentNode;
|
|
7850
|
+
if (!parent) {
|
|
7851
|
+
return element;
|
|
7852
|
+
}
|
|
7853
|
+
|
|
7854
|
+
if (parent.nodeType === 11) {
|
|
7855
|
+
// 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
|
|
7856
|
+
// 否则查找到 shadowRoot 即终止,滚动事件无法被监听
|
|
7857
|
+
return getScrollParent(parent.host);
|
|
7858
|
+
}
|
|
7859
|
+
|
|
7860
|
+
if (parent.nodeType !== 1) {
|
|
7861
|
+
// 到达 document,返回元素实际渲染所在的真实 window,
|
|
7862
|
+
// 保证 window 滚动时能触发位置更新
|
|
7863
|
+
return getRealWindow(element);
|
|
7864
|
+
}
|
|
7865
|
+
|
|
7866
|
+
// Firefox want us to check `-x` and `-y` variations as well
|
|
7867
|
+
if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
|
|
7868
|
+
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
7869
|
+
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
7870
|
+
// fixes issue #65
|
|
7871
|
+
return parent;
|
|
7872
|
+
}
|
|
7873
|
+
return getScrollParent(parent);
|
|
7874
|
+
}
|
|
7875
|
+
|
|
8008
7876
|
/**
|
|
8009
7877
|
* Check if the given element is fixed or is inside a fixed parent
|
|
8010
7878
|
* @function
|
|
@@ -8012,125 +7880,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
8012
7880
|
* @argument {Element} element
|
|
8013
7881
|
* @argument {Element} customContainer
|
|
8014
7882
|
* @returns {Boolean} answer to "isFixed?"
|
|
8015
|
-
*/
|
|
8016
|
-
function isFixed(element) {
|
|
8017
|
-
if (element === root.document.body) {
|
|
8018
|
-
return false;
|
|
8019
|
-
}
|
|
8020
|
-
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
8021
|
-
return true;
|
|
8022
|
-
}
|
|
8023
|
-
var parent = element.parentNode;
|
|
8024
|
-
if (parent && parent.nodeType === 11) {
|
|
8025
|
-
// 跨 shadowRoot 边界,从宿主元素继续向上判断
|
|
8026
|
-
parent = parent.host;
|
|
8027
|
-
}
|
|
8028
|
-
return parent && parent.nodeType === 1 ? isFixed(parent) : false;
|
|
8029
|
-
}
|
|
8030
|
-
|
|
7883
|
+
*/
|
|
7884
|
+
function isFixed(element) {
|
|
7885
|
+
if (element === root.document.body) {
|
|
7886
|
+
return false;
|
|
7887
|
+
}
|
|
7888
|
+
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
7889
|
+
return true;
|
|
7890
|
+
}
|
|
7891
|
+
var parent = element.parentNode;
|
|
7892
|
+
if (parent && parent.nodeType === 11) {
|
|
7893
|
+
// 跨 shadowRoot 边界,从宿主元素继续向上判断
|
|
7894
|
+
parent = parent.host;
|
|
7895
|
+
}
|
|
7896
|
+
return parent && parent.nodeType === 1 ? isFixed(parent) : false;
|
|
7897
|
+
}
|
|
7898
|
+
|
|
8031
7899
|
/**
|
|
8032
7900
|
* Set the style to the given popper
|
|
8033
7901
|
* @function
|
|
8034
7902
|
* @ignore
|
|
8035
7903
|
* @argument {Element} element - Element to apply the style to
|
|
8036
7904
|
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
|
|
8037
|
-
*/
|
|
8038
|
-
function setStyle(element, styles) {
|
|
8039
|
-
function is_numeric(n) {
|
|
8040
|
-
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
8041
|
-
}
|
|
8042
|
-
Object.keys(styles).forEach(function (prop) {
|
|
8043
|
-
var unit = '';
|
|
8044
|
-
// add unit if the value is numeric and is one of the following
|
|
8045
|
-
if (
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
element.style[prop] = styles[prop] + unit;
|
|
8053
|
-
});
|
|
8054
|
-
}
|
|
8055
|
-
|
|
7905
|
+
*/
|
|
7906
|
+
function setStyle(element, styles) {
|
|
7907
|
+
function is_numeric(n) {
|
|
7908
|
+
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
7909
|
+
}
|
|
7910
|
+
Object.keys(styles).forEach(function (prop) {
|
|
7911
|
+
var unit = '';
|
|
7912
|
+
// add unit if the value is numeric and is one of the following
|
|
7913
|
+
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
|
|
7914
|
+
unit = 'px';
|
|
7915
|
+
}
|
|
7916
|
+
element.style[prop] = styles[prop] + unit;
|
|
7917
|
+
});
|
|
7918
|
+
}
|
|
7919
|
+
|
|
8056
7920
|
/**
|
|
8057
7921
|
* Check if the given variable is a function
|
|
8058
7922
|
* @function
|
|
8059
7923
|
* @ignore
|
|
8060
7924
|
* @argument {*} functionToCheck - variable to check
|
|
8061
7925
|
* @returns {Boolean} answer to: is a function?
|
|
8062
|
-
*/
|
|
8063
|
-
function isFunction(functionToCheck) {
|
|
8064
|
-
var getType = {};
|
|
8065
|
-
return (
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
);
|
|
8069
|
-
}
|
|
8070
|
-
|
|
7926
|
+
*/
|
|
7927
|
+
function isFunction(functionToCheck) {
|
|
7928
|
+
var getType = {};
|
|
7929
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
7930
|
+
}
|
|
7931
|
+
|
|
8071
7932
|
/**
|
|
8072
7933
|
* Get the position of the given element, relative to its offset parent
|
|
8073
7934
|
* @function
|
|
8074
7935
|
* @ignore
|
|
8075
7936
|
* @param {Element} element
|
|
8076
7937
|
* @return {Object} position - Coordinates of the element and its `scrollTop`
|
|
8077
|
-
*/
|
|
8078
|
-
function getOffsetRect(element) {
|
|
8079
|
-
var transform = getStyle(element, 'transform')
|
|
8080
|
-
|
|
8081
|
-
.
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
return elementRect;
|
|
8095
|
-
}
|
|
8096
|
-
|
|
7938
|
+
*/
|
|
7939
|
+
function getOffsetRect(element) {
|
|
7940
|
+
var transform = getStyle(element, 'transform').replace(/[^0-9\-,]/g, '').split(',');
|
|
7941
|
+
var elementRect = {
|
|
7942
|
+
width: element.offsetWidth,
|
|
7943
|
+
height: element.offsetHeight,
|
|
7944
|
+
left: element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
|
|
7945
|
+
top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
|
|
7946
|
+
};
|
|
7947
|
+
|
|
7948
|
+
elementRect.right = elementRect.left + elementRect.width;
|
|
7949
|
+
elementRect.bottom = elementRect.top + elementRect.height;
|
|
7950
|
+
|
|
7951
|
+
// position
|
|
7952
|
+
return elementRect;
|
|
7953
|
+
}
|
|
7954
|
+
|
|
8097
7955
|
/**
|
|
8098
7956
|
* Get bounding client rect of given element
|
|
8099
7957
|
* @function
|
|
8100
7958
|
* @ignore
|
|
8101
7959
|
* @param {HTMLElement} element
|
|
8102
7960
|
* @return {Object} client rect
|
|
8103
|
-
*/
|
|
8104
|
-
function getBoundingClientRect(element) {
|
|
8105
|
-
var rect = element.getBoundingClientRect();
|
|
8106
|
-
|
|
8107
|
-
// whether the IE version is lower than 11
|
|
8108
|
-
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
8109
|
-
|
|
8110
|
-
// fix ie document bounding top always 0 bug
|
|
8111
|
-
var rectTop =
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
7961
|
+
*/
|
|
7962
|
+
function getBoundingClientRect(element) {
|
|
7963
|
+
var rect = element.getBoundingClientRect();
|
|
7964
|
+
|
|
7965
|
+
// whether the IE version is lower than 11
|
|
7966
|
+
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
7967
|
+
|
|
7968
|
+
// fix ie document bounding top always 0 bug
|
|
7969
|
+
var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
|
|
7970
|
+
|
|
7971
|
+
return {
|
|
7972
|
+
left: rect.left,
|
|
7973
|
+
top: rectTop,
|
|
7974
|
+
right: rect.right,
|
|
7975
|
+
bottom: rect.bottom,
|
|
7976
|
+
width: rect.right - rect.left,
|
|
7977
|
+
height: rect.bottom - rectTop
|
|
7978
|
+
};
|
|
7979
|
+
}
|
|
7980
|
+
|
|
7981
|
+
function getStyle(dom, attr) {
|
|
7982
|
+
if (dom.style[attr]) {
|
|
7983
|
+
return dom.style[attr];
|
|
7984
|
+
}
|
|
7985
|
+
if (window.getComputedStyle) {
|
|
7986
|
+
return getComputedStyle(dom, null)[attr];
|
|
7987
|
+
}
|
|
7988
|
+
return dom.currentStyle[attr];
|
|
7989
|
+
}
|
|
7990
|
+
|
|
8134
7991
|
/**
|
|
8135
7992
|
* Given an element and one of its parents, return the offset
|
|
8136
7993
|
* @function
|
|
@@ -8138,45 +7995,43 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
8138
7995
|
* @param {HTMLElement} element
|
|
8139
7996
|
* @param {HTMLElement} parent
|
|
8140
7997
|
* @return {Object} rect
|
|
8141
|
-
*/
|
|
8142
|
-
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
8143
|
-
var elementRect = getBoundingClientRect(element);
|
|
8144
|
-
// parent 为 popper 元素:取其真实包含块的视口 rect,
|
|
8145
|
-
// 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
|
|
8146
|
-
var parentRect = getContainingBlockRect(parent, fixed);
|
|
8147
|
-
|
|
8148
|
-
var rect = {
|
|
8149
|
-
top: elementRect.top - parentRect.top,
|
|
8150
|
-
left: elementRect.left - parentRect.left,
|
|
8151
|
-
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
8152
|
-
right: elementRect.left - parentRect.left + elementRect.width,
|
|
8153
|
-
width: elementRect.width,
|
|
8154
|
-
height: elementRect.height
|
|
8155
|
-
};
|
|
8156
|
-
return rect;
|
|
8157
|
-
}
|
|
8158
|
-
|
|
7998
|
+
*/
|
|
7999
|
+
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
8000
|
+
var elementRect = getBoundingClientRect(element);
|
|
8001
|
+
// parent 为 popper 元素:取其真实包含块的视口 rect,
|
|
8002
|
+
// 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
|
|
8003
|
+
var parentRect = getContainingBlockRect(parent, fixed);
|
|
8004
|
+
|
|
8005
|
+
var rect = {
|
|
8006
|
+
top: elementRect.top - parentRect.top,
|
|
8007
|
+
left: elementRect.left - parentRect.left,
|
|
8008
|
+
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
8009
|
+
right: elementRect.left - parentRect.left + elementRect.width,
|
|
8010
|
+
width: elementRect.width,
|
|
8011
|
+
height: elementRect.height
|
|
8012
|
+
};
|
|
8013
|
+
return rect;
|
|
8014
|
+
}
|
|
8015
|
+
|
|
8159
8016
|
/**
|
|
8160
8017
|
* Get the prefixed supported property name
|
|
8161
8018
|
* @function
|
|
8162
8019
|
* @ignore
|
|
8163
8020
|
* @argument {String} property (camelCase)
|
|
8164
8021
|
* @returns {String} prefixed property (camelCase)
|
|
8165
|
-
*/
|
|
8166
|
-
function getSupportedPropertyName(property) {
|
|
8167
|
-
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
8168
|
-
|
|
8169
|
-
for (var i = 0; i < prefixes.length; i++) {
|
|
8170
|
-
var toCheck = prefixes[i]
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
}
|
|
8179
|
-
|
|
8022
|
+
*/
|
|
8023
|
+
function getSupportedPropertyName(property) {
|
|
8024
|
+
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
8025
|
+
|
|
8026
|
+
for (var i = 0; i < prefixes.length; i++) {
|
|
8027
|
+
var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
|
|
8028
|
+
if (typeof root.document.body.style[toCheck] !== 'undefined') {
|
|
8029
|
+
return toCheck;
|
|
8030
|
+
}
|
|
8031
|
+
}
|
|
8032
|
+
return null;
|
|
8033
|
+
}
|
|
8034
|
+
|
|
8180
8035
|
/**
|
|
8181
8036
|
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
|
|
8182
8037
|
* objects to a target object. It will return the target object.
|
|
@@ -8184,50 +8039,45 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
8184
8039
|
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
8185
8040
|
* @function
|
|
8186
8041
|
* @ignore
|
|
8187
|
-
*/
|
|
8188
|
-
if (!Object.assign) {
|
|
8189
|
-
Object.defineProperty(Object, 'assign', {
|
|
8190
|
-
enumerable: false,
|
|
8191
|
-
configurable: true,
|
|
8192
|
-
writable: true,
|
|
8193
|
-
value: function (target) {
|
|
8194
|
-
if (target === undefined || target === null) {
|
|
8195
|
-
throw new TypeError('Cannot convert first argument to object');
|
|
8196
|
-
}
|
|
8197
|
-
|
|
8198
|
-
var to = Object(target);
|
|
8199
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
8200
|
-
var nextSource = arguments[i];
|
|
8201
|
-
if (nextSource === undefined || nextSource === null) {
|
|
8202
|
-
continue;
|
|
8203
|
-
}
|
|
8204
|
-
nextSource = Object(nextSource);
|
|
8205
|
-
|
|
8206
|
-
var keysArray = Object.keys(nextSource);
|
|
8207
|
-
for (
|
|
8208
|
-
var
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
return to;
|
|
8220
|
-
}
|
|
8221
|
-
});
|
|
8222
|
-
}
|
|
8223
|
-
|
|
8224
|
-
return Popper;
|
|
8225
|
-
});
|
|
8042
|
+
*/
|
|
8043
|
+
if (!Object.assign) {
|
|
8044
|
+
Object.defineProperty(Object, 'assign', {
|
|
8045
|
+
enumerable: false,
|
|
8046
|
+
configurable: true,
|
|
8047
|
+
writable: true,
|
|
8048
|
+
value: function value(target) {
|
|
8049
|
+
if (target === undefined || target === null) {
|
|
8050
|
+
throw new TypeError('Cannot convert first argument to object');
|
|
8051
|
+
}
|
|
8052
|
+
|
|
8053
|
+
var to = Object(target);
|
|
8054
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8055
|
+
var nextSource = arguments[i];
|
|
8056
|
+
if (nextSource === undefined || nextSource === null) {
|
|
8057
|
+
continue;
|
|
8058
|
+
}
|
|
8059
|
+
nextSource = Object(nextSource);
|
|
8060
|
+
|
|
8061
|
+
var keysArray = Object.keys(nextSource);
|
|
8062
|
+
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
|
8063
|
+
var nextKey = keysArray[nextIndex];
|
|
8064
|
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
8065
|
+
if (desc !== undefined && desc.enumerable) {
|
|
8066
|
+
to[nextKey] = nextSource[nextKey];
|
|
8067
|
+
}
|
|
8068
|
+
}
|
|
8069
|
+
}
|
|
8070
|
+
return to;
|
|
8071
|
+
}
|
|
8072
|
+
});
|
|
8073
|
+
}
|
|
8226
8074
|
|
|
8075
|
+
return Popper;
|
|
8076
|
+
});
|
|
8227
8077
|
|
|
8228
8078
|
/***/ }),
|
|
8229
8079
|
|
|
8230
|
-
/***/
|
|
8080
|
+
/***/ 62:
|
|
8231
8081
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
8232
8082
|
|
|
8233
8083
|
"use strict";
|
|
@@ -8357,7 +8207,7 @@ aria.Utils.keys = {
|
|
|
8357
8207
|
|
|
8358
8208
|
/***/ }),
|
|
8359
8209
|
|
|
8360
|
-
/***/
|
|
8210
|
+
/***/ 69:
|
|
8361
8211
|
/***/ (function(module, exports) {
|
|
8362
8212
|
|
|
8363
8213
|
module.exports = require("eoss/lib/tag");
|
|
@@ -8414,759 +8264,736 @@ module.exports = require("eoss/lib/tag");
|
|
|
8414
8264
|
/* unused harmony export getSecond */
|
|
8415
8265
|
/* unused harmony export getWeekday */
|
|
8416
8266
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
* The MIT License (MIT)
|
|
8420
|
-
*
|
|
8421
|
-
* Copyright (c) 2015 Taylor Hakes
|
|
8422
|
-
*
|
|
8423
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8424
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8425
|
-
* in the Software without restriction, including without limitation the rights
|
|
8426
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8427
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
8428
|
-
* furnished to do so, subject to the following conditions:
|
|
8429
|
-
*
|
|
8430
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
8431
|
-
* copies or substantial portions of the Software.
|
|
8432
|
-
*
|
|
8433
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
8434
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
8435
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
8436
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
8437
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
8438
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
8439
|
-
* SOFTWARE.
|
|
8440
|
-
*/
|
|
8441
|
-
|
|
8442
|
-
/*eslint-disable*/
|
|
8443
|
-
// 把 YYYY-MM-DD 改成了 yyyy-MM-dd
|
|
8444
|
-
|
|
8445
|
-
|
|
8267
|
+
|
|
8268
|
+
|
|
8446
8269
|
/**
|
|
8447
8270
|
* Parse or format dates
|
|
8448
8271
|
* @class fecha
|
|
8449
|
-
*/
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
function regexEscape(str) {
|
|
8460
|
-
return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
|
|
8461
|
-
}
|
|
8462
|
-
|
|
8463
|
-
function shorten(arr, sLen) {
|
|
8464
|
-
|
|
8465
|
-
for (
|
|
8466
|
-
newArr.push(arr[i].substr(0, sLen));
|
|
8467
|
-
}
|
|
8468
|
-
return newArr;
|
|
8469
|
-
}
|
|
8470
|
-
|
|
8471
|
-
function monthUpdate() {
|
|
8472
|
-
return function (d, v) {
|
|
8473
|
-
|
|
8474
|
-
if (~index) {
|
|
8475
|
-
d.month = index;
|
|
8476
|
-
}
|
|
8477
|
-
};
|
|
8478
|
-
}
|
|
8479
|
-
|
|
8480
|
-
function pad(val, len) {
|
|
8481
|
-
val = String(val);
|
|
8482
|
-
len = len || 2;
|
|
8483
|
-
while (val.length < len) {
|
|
8484
|
-
val = '0' + val;
|
|
8485
|
-
}
|
|
8486
|
-
return val;
|
|
8487
|
-
}
|
|
8488
|
-
|
|
8489
|
-
// 直接使用中文日期名称常量
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
return D + '日';
|
|
8497
|
-
};
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
D: function(dateObj) {
|
|
8501
|
-
return dateObj.getDay();
|
|
8502
|
-
},
|
|
8503
|
-
DD: function(dateObj) {
|
|
8504
|
-
return pad(dateObj.getDay());
|
|
8505
|
-
},
|
|
8506
|
-
Do: function(dateObj) {
|
|
8507
|
-
return DoFn(dateObj.getDate());
|
|
8508
|
-
},
|
|
8509
|
-
d: function(dateObj) {
|
|
8510
|
-
return dateObj.getDate();
|
|
8511
|
-
},
|
|
8512
|
-
dd: function(dateObj) {
|
|
8513
|
-
return pad(dateObj.getDate());
|
|
8514
|
-
},
|
|
8515
|
-
ddd: function(dateObj) {
|
|
8516
|
-
return dayNamesShort[dateObj.getDay()];
|
|
8517
|
-
},
|
|
8518
|
-
dddd: function(dateObj) {
|
|
8519
|
-
return dayNames[dateObj.getDay()];
|
|
8520
|
-
},
|
|
8521
|
-
M: function(dateObj) {
|
|
8522
|
-
return dateObj.getMonth() + 1;
|
|
8523
|
-
},
|
|
8524
|
-
MM: function(dateObj) {
|
|
8525
|
-
return pad(dateObj.getMonth() + 1);
|
|
8526
|
-
},
|
|
8527
|
-
MMM: function(dateObj) {
|
|
8528
|
-
return monthNamesShort[dateObj.getMonth()];
|
|
8529
|
-
},
|
|
8530
|
-
MMMM: function(dateObj) {
|
|
8531
|
-
return monthNames[dateObj.getMonth()];
|
|
8532
|
-
},
|
|
8533
|
-
yy: function(dateObj) {
|
|
8534
|
-
return pad(String(dateObj.getFullYear()), 4).substr(2);
|
|
8535
|
-
},
|
|
8536
|
-
yyyy: function(dateObj) {
|
|
8537
|
-
return pad(dateObj.getFullYear(), 4);
|
|
8538
|
-
},
|
|
8539
|
-
h: function(dateObj) {
|
|
8540
|
-
return dateObj.getHours() % 12 || 12;
|
|
8541
|
-
},
|
|
8542
|
-
hh: function(dateObj) {
|
|
8543
|
-
return pad(dateObj.getHours() % 12 || 12);
|
|
8544
|
-
},
|
|
8545
|
-
H: function(dateObj) {
|
|
8546
|
-
return dateObj.getHours();
|
|
8547
|
-
},
|
|
8548
|
-
HH: function(dateObj) {
|
|
8549
|
-
return pad(dateObj.getHours());
|
|
8550
|
-
},
|
|
8551
|
-
m: function(dateObj) {
|
|
8552
|
-
return dateObj.getMinutes();
|
|
8553
|
-
},
|
|
8554
|
-
mm: function(dateObj) {
|
|
8555
|
-
return pad(dateObj.getMinutes());
|
|
8556
|
-
},
|
|
8557
|
-
s: function(dateObj) {
|
|
8558
|
-
return dateObj.getSeconds();
|
|
8559
|
-
},
|
|
8560
|
-
ss: function(dateObj) {
|
|
8561
|
-
return pad(dateObj.getSeconds());
|
|
8562
|
-
},
|
|
8563
|
-
S: function(dateObj) {
|
|
8564
|
-
return Math.round(dateObj.getMilliseconds() / 100);
|
|
8565
|
-
},
|
|
8566
|
-
SS: function(dateObj) {
|
|
8567
|
-
return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
|
|
8568
|
-
},
|
|
8569
|
-
SSS: function(dateObj) {
|
|
8570
|
-
return pad(dateObj.getMilliseconds(), 3);
|
|
8571
|
-
},
|
|
8572
|
-
a: function(dateObj) {
|
|
8573
|
-
return dateObj.getHours() < 12 ? '上午' : '下午';
|
|
8574
|
-
},
|
|
8575
|
-
A: function(dateObj) {
|
|
8576
|
-
return dateObj.getHours() < 12 ? '上午' : '下午';
|
|
8577
|
-
},
|
|
8578
|
-
ZZ: function(dateObj) {
|
|
8579
|
-
|
|
8580
|
-
return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
|
|
8581
|
-
}
|
|
8582
|
-
};
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
d: [twoDigits, function (d, v) {
|
|
8586
|
-
d.day = v;
|
|
8587
|
-
}],
|
|
8588
|
-
Do: [twoDigits + word, function (d, v) {
|
|
8589
|
-
d.day = parseInt(v, 10);
|
|
8590
|
-
}],
|
|
8591
|
-
M: [twoDigits, function (d, v) {
|
|
8592
|
-
d.month = v - 1;
|
|
8593
|
-
}],
|
|
8594
|
-
yy: [twoDigits, function (d, v) {
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
}
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
parseFlags.
|
|
8643
|
-
parseFlags.
|
|
8644
|
-
parseFlags.
|
|
8645
|
-
parseFlags.
|
|
8646
|
-
parseFlags.
|
|
8647
|
-
parseFlags.
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
*
|
|
8665
|
-
* @
|
|
8666
|
-
* @param {
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
};
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
*
|
|
8699
|
-
* @
|
|
8700
|
-
* @param {string}
|
|
8701
|
-
* @
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
//
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
} else {
|
|
8757
|
-
date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
if (
|
|
8791
|
-
if (
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
//
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
temp.
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
//
|
|
8860
|
-
//
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
}
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
if (
|
|
8887
|
-
date = new Date(
|
|
8888
|
-
}
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
d.
|
|
8897
|
-
//
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
};
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
}
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
return
|
|
8982
|
-
};
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
}
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
}
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
)
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
return month
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
};
|
|
9086
|
-
|
|
8272
|
+
*/
|
|
8273
|
+
var fecha = {};
|
|
8274
|
+
var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
|
|
8275
|
+
var twoDigits = '\\d\\d?';
|
|
8276
|
+
var threeDigits = '\\d{3}';
|
|
8277
|
+
var fourDigits = '\\d{4}';
|
|
8278
|
+
var word = '[^\\s]+';
|
|
8279
|
+
var literal = /\[([^]*?)\]/gm;
|
|
8280
|
+
var noop = function noop() {};
|
|
8281
|
+
|
|
8282
|
+
function regexEscape(str) {
|
|
8283
|
+
return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
|
|
8284
|
+
}
|
|
8285
|
+
|
|
8286
|
+
function shorten(arr, sLen) {
|
|
8287
|
+
var newArr = [];
|
|
8288
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
8289
|
+
newArr.push(arr[i].substr(0, sLen));
|
|
8290
|
+
}
|
|
8291
|
+
return newArr;
|
|
8292
|
+
}
|
|
8293
|
+
|
|
8294
|
+
function monthUpdate() {
|
|
8295
|
+
return function (d, v) {
|
|
8296
|
+
var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
|
|
8297
|
+
if (~index) {
|
|
8298
|
+
d.month = index;
|
|
8299
|
+
}
|
|
8300
|
+
};
|
|
8301
|
+
}
|
|
8302
|
+
|
|
8303
|
+
function pad(val, len) {
|
|
8304
|
+
val = String(val);
|
|
8305
|
+
len = len || 2;
|
|
8306
|
+
while (val.length < len) {
|
|
8307
|
+
val = '0' + val;
|
|
8308
|
+
}
|
|
8309
|
+
return val;
|
|
8310
|
+
}
|
|
8311
|
+
|
|
8312
|
+
// 直接使用中文日期名称常量
|
|
8313
|
+
var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
|
|
8314
|
+
var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
|
|
8315
|
+
var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
|
|
8316
|
+
var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
|
|
8317
|
+
var amPm = ['上午', '下午'];
|
|
8318
|
+
var DoFn = function DoFn(D) {
|
|
8319
|
+
return D + '日';
|
|
8320
|
+
};
|
|
8321
|
+
|
|
8322
|
+
var formatFlags = {
|
|
8323
|
+
D: function D(dateObj) {
|
|
8324
|
+
return dateObj.getDay();
|
|
8325
|
+
},
|
|
8326
|
+
DD: function DD(dateObj) {
|
|
8327
|
+
return pad(dateObj.getDay());
|
|
8328
|
+
},
|
|
8329
|
+
Do: function Do(dateObj) {
|
|
8330
|
+
return DoFn(dateObj.getDate());
|
|
8331
|
+
},
|
|
8332
|
+
d: function d(dateObj) {
|
|
8333
|
+
return dateObj.getDate();
|
|
8334
|
+
},
|
|
8335
|
+
dd: function dd(dateObj) {
|
|
8336
|
+
return pad(dateObj.getDate());
|
|
8337
|
+
},
|
|
8338
|
+
ddd: function ddd(dateObj) {
|
|
8339
|
+
return dayNamesShort[dateObj.getDay()];
|
|
8340
|
+
},
|
|
8341
|
+
dddd: function dddd(dateObj) {
|
|
8342
|
+
return dayNames[dateObj.getDay()];
|
|
8343
|
+
},
|
|
8344
|
+
M: function M(dateObj) {
|
|
8345
|
+
return dateObj.getMonth() + 1;
|
|
8346
|
+
},
|
|
8347
|
+
MM: function MM(dateObj) {
|
|
8348
|
+
return pad(dateObj.getMonth() + 1);
|
|
8349
|
+
},
|
|
8350
|
+
MMM: function MMM(dateObj) {
|
|
8351
|
+
return monthNamesShort[dateObj.getMonth()];
|
|
8352
|
+
},
|
|
8353
|
+
MMMM: function MMMM(dateObj) {
|
|
8354
|
+
return monthNames[dateObj.getMonth()];
|
|
8355
|
+
},
|
|
8356
|
+
yy: function yy(dateObj) {
|
|
8357
|
+
return pad(String(dateObj.getFullYear()), 4).substr(2);
|
|
8358
|
+
},
|
|
8359
|
+
yyyy: function yyyy(dateObj) {
|
|
8360
|
+
return pad(dateObj.getFullYear(), 4);
|
|
8361
|
+
},
|
|
8362
|
+
h: function h(dateObj) {
|
|
8363
|
+
return dateObj.getHours() % 12 || 12;
|
|
8364
|
+
},
|
|
8365
|
+
hh: function hh(dateObj) {
|
|
8366
|
+
return pad(dateObj.getHours() % 12 || 12);
|
|
8367
|
+
},
|
|
8368
|
+
H: function H(dateObj) {
|
|
8369
|
+
return dateObj.getHours();
|
|
8370
|
+
},
|
|
8371
|
+
HH: function HH(dateObj) {
|
|
8372
|
+
return pad(dateObj.getHours());
|
|
8373
|
+
},
|
|
8374
|
+
m: function m(dateObj) {
|
|
8375
|
+
return dateObj.getMinutes();
|
|
8376
|
+
},
|
|
8377
|
+
mm: function mm(dateObj) {
|
|
8378
|
+
return pad(dateObj.getMinutes());
|
|
8379
|
+
},
|
|
8380
|
+
s: function s(dateObj) {
|
|
8381
|
+
return dateObj.getSeconds();
|
|
8382
|
+
},
|
|
8383
|
+
ss: function ss(dateObj) {
|
|
8384
|
+
return pad(dateObj.getSeconds());
|
|
8385
|
+
},
|
|
8386
|
+
S: function S(dateObj) {
|
|
8387
|
+
return Math.round(dateObj.getMilliseconds() / 100);
|
|
8388
|
+
},
|
|
8389
|
+
SS: function SS(dateObj) {
|
|
8390
|
+
return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
|
|
8391
|
+
},
|
|
8392
|
+
SSS: function SSS(dateObj) {
|
|
8393
|
+
return pad(dateObj.getMilliseconds(), 3);
|
|
8394
|
+
},
|
|
8395
|
+
a: function a(dateObj) {
|
|
8396
|
+
return dateObj.getHours() < 12 ? '上午' : '下午';
|
|
8397
|
+
},
|
|
8398
|
+
A: function A(dateObj) {
|
|
8399
|
+
return dateObj.getHours() < 12 ? '上午' : '下午';
|
|
8400
|
+
},
|
|
8401
|
+
ZZ: function ZZ(dateObj) {
|
|
8402
|
+
var o = dateObj.getTimezoneOffset();
|
|
8403
|
+
return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
|
|
8404
|
+
}
|
|
8405
|
+
};
|
|
8406
|
+
|
|
8407
|
+
var parseFlags = {
|
|
8408
|
+
d: [twoDigits, function (d, v) {
|
|
8409
|
+
d.day = v;
|
|
8410
|
+
}],
|
|
8411
|
+
Do: [twoDigits + word, function (d, v) {
|
|
8412
|
+
d.day = parseInt(v, 10);
|
|
8413
|
+
}],
|
|
8414
|
+
M: [twoDigits, function (d, v) {
|
|
8415
|
+
d.month = v - 1;
|
|
8416
|
+
}],
|
|
8417
|
+
yy: [twoDigits, function (d, v) {
|
|
8418
|
+
var da = new Date(),
|
|
8419
|
+
cent = +('' + da.getFullYear()).substr(0, 2);
|
|
8420
|
+
d.year = '' + (v > 68 ? cent - 1 : cent) + v;
|
|
8421
|
+
}],
|
|
8422
|
+
h: [twoDigits, function (d, v) {
|
|
8423
|
+
d.hour = v;
|
|
8424
|
+
}],
|
|
8425
|
+
m: [twoDigits, function (d, v) {
|
|
8426
|
+
d.minute = v;
|
|
8427
|
+
}],
|
|
8428
|
+
s: [twoDigits, function (d, v) {
|
|
8429
|
+
d.second = v;
|
|
8430
|
+
}],
|
|
8431
|
+
yyyy: [fourDigits, function (d, v) {
|
|
8432
|
+
d.year = v;
|
|
8433
|
+
}],
|
|
8434
|
+
S: ['\\d', function (d, v) {
|
|
8435
|
+
d.millisecond = v * 100;
|
|
8436
|
+
}],
|
|
8437
|
+
SS: ['\\d{2}', function (d, v) {
|
|
8438
|
+
d.millisecond = v * 10;
|
|
8439
|
+
}],
|
|
8440
|
+
SSS: [threeDigits, function (d, v) {
|
|
8441
|
+
d.millisecond = v;
|
|
8442
|
+
}],
|
|
8443
|
+
D: [twoDigits, noop],
|
|
8444
|
+
ddd: [word, noop],
|
|
8445
|
+
MMM: [word, monthUpdate('monthNamesShort')],
|
|
8446
|
+
MMMM: [word, monthUpdate('monthNames')],
|
|
8447
|
+
a: [word, function (d, v) {
|
|
8448
|
+
var val = v.toLowerCase();
|
|
8449
|
+
if (val === '上午') {
|
|
8450
|
+
d.isPm = false;
|
|
8451
|
+
} else if (val === '下午') {
|
|
8452
|
+
d.isPm = true;
|
|
8453
|
+
}
|
|
8454
|
+
}],
|
|
8455
|
+
ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
|
|
8456
|
+
var parts = (v + '').match(/([+-]|\d\d)/gi),
|
|
8457
|
+
minutes = void 0;
|
|
8458
|
+
|
|
8459
|
+
if (parts) {
|
|
8460
|
+
minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
|
|
8461
|
+
d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
|
|
8462
|
+
}
|
|
8463
|
+
}]
|
|
8464
|
+
};
|
|
8465
|
+
parseFlags.dd = parseFlags.d;
|
|
8466
|
+
parseFlags.dddd = parseFlags.ddd;
|
|
8467
|
+
parseFlags.DD = parseFlags.D;
|
|
8468
|
+
parseFlags.mm = parseFlags.m;
|
|
8469
|
+
parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
|
|
8470
|
+
parseFlags.MM = parseFlags.M;
|
|
8471
|
+
parseFlags.ss = parseFlags.s;
|
|
8472
|
+
parseFlags.A = parseFlags.a;
|
|
8473
|
+
|
|
8474
|
+
// Some common format strings
|
|
8475
|
+
fecha.masks = {
|
|
8476
|
+
default: 'ddd MMM dd yyyy HH:mm:ss',
|
|
8477
|
+
shortDate: 'M/D/yy',
|
|
8478
|
+
mediumDate: 'MMM d, yyyy',
|
|
8479
|
+
longDate: 'MMMM d, yyyy',
|
|
8480
|
+
fullDate: 'dddd, MMMM d, yyyy',
|
|
8481
|
+
shortTime: 'HH:mm',
|
|
8482
|
+
mediumTime: 'HH:mm:ss',
|
|
8483
|
+
longTime: 'HH:mm:ss.SSS'
|
|
8484
|
+
};
|
|
8485
|
+
|
|
8486
|
+
/***
|
|
8487
|
+
* Format a date
|
|
8488
|
+
* @method format
|
|
8489
|
+
* @param {Date|number} dateObj
|
|
8490
|
+
* @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
|
|
8491
|
+
*/
|
|
8492
|
+
fecha.format = function (dateObj, mask) {
|
|
8493
|
+
if (typeof dateObj === 'number') {
|
|
8494
|
+
dateObj = new Date(dateObj);
|
|
8495
|
+
}
|
|
8496
|
+
|
|
8497
|
+
if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
|
|
8498
|
+
throw new Error('Invalid Date in fecha.format');
|
|
8499
|
+
}
|
|
8500
|
+
|
|
8501
|
+
mask = fecha.masks[mask] || mask || fecha.masks['default'];
|
|
8502
|
+
|
|
8503
|
+
var literals = [];
|
|
8504
|
+
|
|
8505
|
+
// Make literals inactive by replacing them with ??
|
|
8506
|
+
mask = mask.replace(literal, function ($0, $1) {
|
|
8507
|
+
literals.push($1);
|
|
8508
|
+
return '@@@';
|
|
8509
|
+
});
|
|
8510
|
+
// Apply formatting rules
|
|
8511
|
+
mask = mask.replace(token, function ($0) {
|
|
8512
|
+
return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
|
|
8513
|
+
});
|
|
8514
|
+
// Inline literal values back into the formatted value
|
|
8515
|
+
return mask.replace(/@@@/g, function () {
|
|
8516
|
+
return literals.shift();
|
|
8517
|
+
});
|
|
8518
|
+
};
|
|
8519
|
+
|
|
8520
|
+
/**
|
|
8521
|
+
* Parse a date string into an object, changes - into /
|
|
8522
|
+
* @method parse
|
|
8523
|
+
* @param {string} dateStr Date string
|
|
8524
|
+
* @param {string} format Date parse format
|
|
8525
|
+
* @returns {Date|boolean}
|
|
8526
|
+
*/
|
|
8527
|
+
fecha.parse = function (dateStr, format) {
|
|
8528
|
+
if (typeof format !== 'string') {
|
|
8529
|
+
throw new Error('Invalid format in fecha.parse');
|
|
8530
|
+
}
|
|
8531
|
+
|
|
8532
|
+
format = fecha.masks[format] || format;
|
|
8533
|
+
|
|
8534
|
+
// Avoid regular expression denial of service, fail early for really long strings
|
|
8535
|
+
// https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
|
|
8536
|
+
if (dateStr.length > 1000) {
|
|
8537
|
+
return null;
|
|
8538
|
+
}
|
|
8539
|
+
|
|
8540
|
+
var dateInfo = {};
|
|
8541
|
+
var parseInfo = [];
|
|
8542
|
+
var literals = [];
|
|
8543
|
+
format = format.replace(literal, function ($0, $1) {
|
|
8544
|
+
literals.push($1);
|
|
8545
|
+
return '@@@';
|
|
8546
|
+
});
|
|
8547
|
+
var newFormat = regexEscape(format).replace(token, function ($0) {
|
|
8548
|
+
if (parseFlags[$0]) {
|
|
8549
|
+
var info = parseFlags[$0];
|
|
8550
|
+
parseInfo.push(info[1]);
|
|
8551
|
+
return '(' + info[0] + ')';
|
|
8552
|
+
}
|
|
8553
|
+
|
|
8554
|
+
return $0;
|
|
8555
|
+
});
|
|
8556
|
+
newFormat = newFormat.replace(/@@@/g, function () {
|
|
8557
|
+
return literals.shift();
|
|
8558
|
+
});
|
|
8559
|
+
var matches = dateStr.match(new RegExp(newFormat, 'i'));
|
|
8560
|
+
if (!matches) {
|
|
8561
|
+
return null;
|
|
8562
|
+
}
|
|
8563
|
+
|
|
8564
|
+
for (var i = 1; i < matches.length; i++) {
|
|
8565
|
+
parseInfo[i - 1](dateInfo, matches[i]);
|
|
8566
|
+
}
|
|
8567
|
+
|
|
8568
|
+
var today = new Date();
|
|
8569
|
+
if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
|
|
8570
|
+
dateInfo.hour = +dateInfo.hour + 12;
|
|
8571
|
+
} else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
|
|
8572
|
+
dateInfo.hour = 0;
|
|
8573
|
+
}
|
|
8574
|
+
|
|
8575
|
+
var date = void 0;
|
|
8576
|
+
if (dateInfo.timezoneOffset != null) {
|
|
8577
|
+
dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
|
|
8578
|
+
date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
|
|
8579
|
+
} else {
|
|
8580
|
+
date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
|
|
8581
|
+
}
|
|
8582
|
+
return date;
|
|
8583
|
+
};
|
|
8584
|
+
|
|
8585
|
+
// 导出fecha对象
|
|
8586
|
+
|
|
8587
|
+
|
|
8588
|
+
// 以下是从date-util.js合并的函数
|
|
8589
|
+
var newArray = function newArray(start, end) {
|
|
8590
|
+
var result = [];
|
|
8591
|
+
for (var i = start; i <= end; i++) {
|
|
8592
|
+
result.push(i);
|
|
8593
|
+
}
|
|
8594
|
+
return result;
|
|
8595
|
+
};
|
|
8596
|
+
|
|
8597
|
+
var getSettings = function getSettings() {
|
|
8598
|
+
return {
|
|
8599
|
+
dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
|
|
8600
|
+
dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
|
|
8601
|
+
monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
|
8602
|
+
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
|
8603
|
+
amPm: ['上午', '下午']
|
|
8604
|
+
};
|
|
8605
|
+
};
|
|
8606
|
+
|
|
8607
|
+
var toDate = function toDate(date) {
|
|
8608
|
+
return isDate(date) ? new Date(date) : null;
|
|
8609
|
+
};
|
|
8610
|
+
|
|
8611
|
+
var isDate = function isDate(date) {
|
|
8612
|
+
if (date === null || date === undefined) return false;
|
|
8613
|
+
if (isNaN(new Date(date).getTime())) return false;
|
|
8614
|
+
if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
|
|
8615
|
+
return true;
|
|
8616
|
+
};
|
|
8617
|
+
|
|
8618
|
+
var isDateObject = function isDateObject(val) {
|
|
8619
|
+
return val instanceof Date;
|
|
8620
|
+
};
|
|
8621
|
+
|
|
8622
|
+
var formatDate = function formatDate(date) {
|
|
8623
|
+
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
|
|
8624
|
+
|
|
8625
|
+
// 处理多种输入类型
|
|
8626
|
+
if (!date) return '';
|
|
8627
|
+
|
|
8628
|
+
// 如果是时间戳,转成日期对象
|
|
8629
|
+
if (typeof date === 'number') {
|
|
8630
|
+
date = new Date(date);
|
|
8631
|
+
}
|
|
8632
|
+
// 如果是字符串,转成日期对象
|
|
8633
|
+
if (typeof date === 'string') {
|
|
8634
|
+
date = new Date(date);
|
|
8635
|
+
}
|
|
8636
|
+
|
|
8637
|
+
// 调用toDate进一步验证和转换
|
|
8638
|
+
date = toDate(date);
|
|
8639
|
+
if (!date) return '';
|
|
8640
|
+
|
|
8641
|
+
// 兼容大写和小写的格式标记
|
|
8642
|
+
// 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
|
|
8643
|
+
var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
|
|
8644
|
+
|
|
8645
|
+
// 使用fecha库进行格式化,支持中文配置
|
|
8646
|
+
var str = fecha.format(date, lowercaseFormat, getSettings());
|
|
8647
|
+
return str;
|
|
8648
|
+
};
|
|
8649
|
+
|
|
8650
|
+
var parseDate = function parseDate(string, format) {
|
|
8651
|
+
return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
|
|
8652
|
+
};
|
|
8653
|
+
|
|
8654
|
+
var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
|
|
8655
|
+
if (month === 3 || month === 5 || month === 8 || month === 10) {
|
|
8656
|
+
return 30;
|
|
8657
|
+
}
|
|
8658
|
+
|
|
8659
|
+
if (month === 1) {
|
|
8660
|
+
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
|
|
8661
|
+
return 29;
|
|
8662
|
+
} else {
|
|
8663
|
+
return 28;
|
|
8664
|
+
}
|
|
8665
|
+
}
|
|
8666
|
+
|
|
8667
|
+
return 31;
|
|
8668
|
+
};
|
|
8669
|
+
|
|
8670
|
+
var getDayCountOfYear = function getDayCountOfYear(year) {
|
|
8671
|
+
var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
|
|
8672
|
+
return isLeapYear ? 366 : 365;
|
|
8673
|
+
};
|
|
8674
|
+
|
|
8675
|
+
var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
|
|
8676
|
+
var temp = new Date(date.getTime());
|
|
8677
|
+
temp.setDate(1);
|
|
8678
|
+
return temp.getDay();
|
|
8679
|
+
};
|
|
8680
|
+
|
|
8681
|
+
// see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
|
|
8682
|
+
// {prev, next} Date should work for Daylight Saving Time
|
|
8683
|
+
// Adding 24 * 60 * 60 * 1000 does not work in the above scenario
|
|
8684
|
+
var prevDate = function prevDate(date) {
|
|
8685
|
+
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
8686
|
+
|
|
8687
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
|
|
8688
|
+
};
|
|
8689
|
+
|
|
8690
|
+
var nextDate = function nextDate(date) {
|
|
8691
|
+
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
8692
|
+
|
|
8693
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
|
|
8694
|
+
};
|
|
8695
|
+
|
|
8696
|
+
var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
|
|
8697
|
+
var result = new Date(year, month, 1);
|
|
8698
|
+
var day = result.getDay();
|
|
8699
|
+
|
|
8700
|
+
if (day === 0) {
|
|
8701
|
+
return prevDate(result, 7);
|
|
8702
|
+
} else {
|
|
8703
|
+
return prevDate(result, day);
|
|
8704
|
+
}
|
|
8705
|
+
};
|
|
8706
|
+
|
|
8707
|
+
var getWeekNumber = function getWeekNumber(date) {
|
|
8708
|
+
// 支持多种输入类型
|
|
8709
|
+
if (!date || !isDate(date)) {
|
|
8710
|
+
date = new Date();
|
|
8711
|
+
}
|
|
8712
|
+
if (typeof date === 'string') {
|
|
8713
|
+
date = new Date(date);
|
|
8714
|
+
}
|
|
8715
|
+
|
|
8716
|
+
// 验证日期有效性
|
|
8717
|
+
if (!isDate(date)) return null;
|
|
8718
|
+
|
|
8719
|
+
var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
8720
|
+
// 设置为最近的星期四:当前日期 + 4 - 当前星期数
|
|
8721
|
+
// 将星期日的星期数设为7
|
|
8722
|
+
d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
|
|
8723
|
+
// 获取当年的第一天
|
|
8724
|
+
var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
|
|
8725
|
+
// 计算到最近的星期四的完整周数
|
|
8726
|
+
var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
|
|
8727
|
+
// 返回周数
|
|
8728
|
+
return weekNo;
|
|
8729
|
+
};
|
|
8730
|
+
|
|
8731
|
+
var getRangeHours = function getRangeHours(ranges) {
|
|
8732
|
+
var hours = [];
|
|
8733
|
+
var disabledHours = [];
|
|
8734
|
+
|
|
8735
|
+
(ranges || []).forEach(function (range) {
|
|
8736
|
+
var value = range.map(function (date) {
|
|
8737
|
+
return date.getHours();
|
|
8738
|
+
});
|
|
8739
|
+
|
|
8740
|
+
disabledHours = disabledHours.concat(newArray(value[0], value[1]));
|
|
8741
|
+
});
|
|
8742
|
+
|
|
8743
|
+
if (disabledHours.length) {
|
|
8744
|
+
for (var i = 0; i < 24; i++) {
|
|
8745
|
+
hours[i] = disabledHours.indexOf(i) === -1;
|
|
8746
|
+
}
|
|
8747
|
+
} else {
|
|
8748
|
+
for (var _i = 0; _i < 24; _i++) {
|
|
8749
|
+
hours[_i] = false;
|
|
8750
|
+
}
|
|
8751
|
+
}
|
|
8752
|
+
|
|
8753
|
+
return hours;
|
|
8754
|
+
};
|
|
8755
|
+
|
|
8756
|
+
var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
|
|
8757
|
+
if (amount <= 0) return [];
|
|
8758
|
+
var temp = new Date(date.getTime());
|
|
8759
|
+
temp.setDate(0);
|
|
8760
|
+
var lastDay = temp.getDate();
|
|
8761
|
+
return range(amount).map(function (_, index) {
|
|
8762
|
+
return lastDay - (amount - index - 1);
|
|
8763
|
+
});
|
|
8764
|
+
};
|
|
8765
|
+
|
|
8766
|
+
var getMonthDays = function getMonthDays(date) {
|
|
8767
|
+
var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
8768
|
+
var days = temp.getDate();
|
|
8769
|
+
return range(days).map(function (_, index) {
|
|
8770
|
+
return index + 1;
|
|
8771
|
+
});
|
|
8772
|
+
};
|
|
8773
|
+
|
|
8774
|
+
function setRangeData(arr, start, end, value) {
|
|
8775
|
+
for (var i = start; i < end; i++) {
|
|
8776
|
+
arr[i] = value;
|
|
8777
|
+
}
|
|
8778
|
+
}
|
|
8779
|
+
|
|
8780
|
+
var getRangeMinutes = function getRangeMinutes(ranges, hour) {
|
|
8781
|
+
var minutes = new Array(60);
|
|
8782
|
+
|
|
8783
|
+
if (ranges.length > 0) {
|
|
8784
|
+
ranges.forEach(function (range) {
|
|
8785
|
+
var start = range[0];
|
|
8786
|
+
var end = range[1];
|
|
8787
|
+
var startHour = start.getHours();
|
|
8788
|
+
var startMinute = start.getMinutes();
|
|
8789
|
+
var endHour = end.getHours();
|
|
8790
|
+
var endMinute = end.getMinutes();
|
|
8791
|
+
if (startHour === hour && endHour !== hour) {
|
|
8792
|
+
setRangeData(minutes, startMinute, 60, true);
|
|
8793
|
+
} else if (startHour === hour && endHour === hour) {
|
|
8794
|
+
setRangeData(minutes, startMinute, endMinute + 1, true);
|
|
8795
|
+
} else if (startHour !== hour && endHour === hour) {
|
|
8796
|
+
setRangeData(minutes, 0, endMinute + 1, true);
|
|
8797
|
+
} else if (startHour < hour && endHour > hour) {
|
|
8798
|
+
setRangeData(minutes, 0, 60, true);
|
|
8799
|
+
}
|
|
8800
|
+
});
|
|
8801
|
+
} else {
|
|
8802
|
+
setRangeData(minutes, 0, 60, true);
|
|
8803
|
+
}
|
|
8804
|
+
return minutes;
|
|
8805
|
+
};
|
|
8806
|
+
|
|
8807
|
+
var range = function range(n) {
|
|
8808
|
+
// see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
|
|
8809
|
+
return Array.apply(null, { length: n }).map(function (_, n) {
|
|
8810
|
+
return n;
|
|
8811
|
+
});
|
|
8812
|
+
};
|
|
8813
|
+
|
|
8814
|
+
var modifyDate = function modifyDate(date, y, m, d) {
|
|
8815
|
+
return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
8816
|
+
};
|
|
8817
|
+
|
|
8818
|
+
var modifyTime = function modifyTime(date, h, m, s) {
|
|
8819
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
|
|
8820
|
+
};
|
|
8821
|
+
|
|
8822
|
+
var modifyWithTimeString = function modifyWithTimeString(date, time) {
|
|
8823
|
+
if (date == null || !time) {
|
|
8824
|
+
return date;
|
|
8825
|
+
}
|
|
8826
|
+
time = parseDate(time, 'HH:mm:ss');
|
|
8827
|
+
return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
|
|
8828
|
+
};
|
|
8829
|
+
|
|
8830
|
+
var clearTime = function clearTime(date) {
|
|
8831
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
8832
|
+
};
|
|
8833
|
+
|
|
8834
|
+
var clearMilliseconds = function clearMilliseconds(date) {
|
|
8835
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
|
|
8836
|
+
};
|
|
8837
|
+
|
|
8838
|
+
var limitTimeRange = function limitTimeRange(date, ranges) {
|
|
8839
|
+
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
|
|
8840
|
+
|
|
8841
|
+
// TODO: refactory a more elegant solution
|
|
8842
|
+
if (ranges.length === 0) return date;
|
|
8843
|
+
var normalizeDate = function normalizeDate(date) {
|
|
8844
|
+
return fecha.parse(fecha.format(date, format), format);
|
|
8845
|
+
};
|
|
8846
|
+
var ndate = normalizeDate(date);
|
|
8847
|
+
var nranges = ranges.map(function (range) {
|
|
8848
|
+
return range.map(normalizeDate);
|
|
8849
|
+
});
|
|
8850
|
+
if (nranges.some(function (nrange) {
|
|
8851
|
+
return ndate >= nrange[0] && ndate <= nrange[1];
|
|
8852
|
+
})) return date;
|
|
8853
|
+
|
|
8854
|
+
var minDate = nranges[0][0];
|
|
8855
|
+
var maxDate = nranges[0][0];
|
|
8856
|
+
|
|
8857
|
+
nranges.forEach(function (nrange) {
|
|
8858
|
+
minDate = new Date(Math.min(nrange[0], minDate));
|
|
8859
|
+
maxDate = new Date(Math.max(nrange[1], minDate));
|
|
8860
|
+
});
|
|
8861
|
+
|
|
8862
|
+
var ret = ndate < minDate ? minDate : maxDate;
|
|
8863
|
+
// preserve Year/Month/Date
|
|
8864
|
+
return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
|
|
8865
|
+
};
|
|
8866
|
+
|
|
8867
|
+
var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
|
|
8868
|
+
var limitedDate = limitTimeRange(date, selectableRange, format);
|
|
8869
|
+
return limitedDate.getTime() === date.getTime();
|
|
8870
|
+
};
|
|
8871
|
+
|
|
8872
|
+
var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
|
|
8873
|
+
// clamp date to the number of days in `year`, `month`
|
|
8874
|
+
// eg: (2010-1-31, 2010, 2) => 2010-2-28
|
|
8875
|
+
var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
|
|
8876
|
+
return modifyDate(date, year, month, monthDate);
|
|
8877
|
+
};
|
|
8878
|
+
|
|
8879
|
+
var prevMonth = function prevMonth(date) {
|
|
8880
|
+
var year = date.getFullYear();
|
|
8881
|
+
var month = date.getMonth();
|
|
8882
|
+
return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
|
|
8883
|
+
};
|
|
8884
|
+
|
|
8885
|
+
var nextMonth = function nextMonth(date) {
|
|
8886
|
+
var year = date.getFullYear();
|
|
8887
|
+
var month = date.getMonth();
|
|
8888
|
+
return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
|
|
8889
|
+
};
|
|
8890
|
+
|
|
8891
|
+
var prevYear = function prevYear(date) {
|
|
8892
|
+
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
8893
|
+
|
|
8894
|
+
var year = date.getFullYear();
|
|
8895
|
+
var month = date.getMonth();
|
|
8896
|
+
return changeYearMonthAndClampDate(date, year - amount, month);
|
|
8897
|
+
};
|
|
8898
|
+
|
|
8899
|
+
var nextYear = function nextYear(date) {
|
|
8900
|
+
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
8901
|
+
|
|
8902
|
+
var year = date.getFullYear();
|
|
8903
|
+
var month = date.getMonth();
|
|
8904
|
+
return changeYearMonthAndClampDate(date, year + amount, month);
|
|
8905
|
+
};
|
|
8906
|
+
|
|
8907
|
+
var extractDateFormat = function extractDateFormat(format) {
|
|
8908
|
+
return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
|
|
8909
|
+
};
|
|
8910
|
+
|
|
8911
|
+
var extractTimeFormat = function extractTimeFormat(format) {
|
|
8912
|
+
return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
|
|
8913
|
+
};
|
|
8914
|
+
|
|
8915
|
+
var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
|
|
8916
|
+
return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
|
|
8917
|
+
};
|
|
8918
|
+
|
|
9087
8919
|
/**
|
|
9088
8920
|
* 计算两个日期之间的工作日数量(不包括周末和节假日)
|
|
9089
8921
|
* @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
|
|
9090
8922
|
* @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
|
|
9091
8923
|
* @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
|
|
9092
8924
|
* @returns {number} 工作日数量
|
|
9093
|
-
*/
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
);
|
|
9099
|
-
}
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
|
|
9105
|
-
throw new Error(
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
}
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
8925
|
+
*/
|
|
8926
|
+
var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
|
|
8927
|
+
var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
8928
|
+
|
|
8929
|
+
if (typeof start_date !== 'string' || typeof end_date !== 'string') {
|
|
8930
|
+
throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
|
|
8931
|
+
}
|
|
8932
|
+
|
|
8933
|
+
var startDateObj = new Date(start_date);
|
|
8934
|
+
var endDateObj = new Date(end_date);
|
|
8935
|
+
|
|
8936
|
+
if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
|
|
8937
|
+
throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
|
|
8938
|
+
}
|
|
8939
|
+
|
|
8940
|
+
if (startDateObj > endDateObj) {
|
|
8941
|
+
throw new Error('Start date should be earlier than or equal to end date.');
|
|
8942
|
+
}
|
|
8943
|
+
|
|
8944
|
+
var workdays = 0;
|
|
8945
|
+
|
|
8946
|
+
// Iterate through each day in the date range
|
|
8947
|
+
|
|
8948
|
+
var _loop = function _loop(currentDate) {
|
|
8949
|
+
// Check if the current day is a weekend (Saturday or Sunday)
|
|
8950
|
+
var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
|
|
8951
|
+
|
|
8952
|
+
// Check if the current day is a holiday
|
|
8953
|
+
var isHoliday = holidays.some(function (holiday) {
|
|
8954
|
+
var holidayDate = new Date(holiday);
|
|
8955
|
+
return currentDate.toDateString() === holidayDate.toDateString();
|
|
8956
|
+
});
|
|
8957
|
+
|
|
8958
|
+
// If it's a workday (not a weekend or holiday), increment the workdays count
|
|
8959
|
+
if (!isWeekend && !isHoliday) {
|
|
8960
|
+
workdays++;
|
|
8961
|
+
}
|
|
8962
|
+
};
|
|
8963
|
+
|
|
8964
|
+
for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
|
|
8965
|
+
_loop(currentDate);
|
|
8966
|
+
}
|
|
8967
|
+
|
|
8968
|
+
return workdays;
|
|
8969
|
+
};
|
|
8970
|
+
|
|
9140
8971
|
/**
|
|
9141
8972
|
* 日期加减天数
|
|
9142
8973
|
* @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
|
|
9143
8974
|
* @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
|
|
9144
8975
|
* @returns {string} 结果日期,格式为 "YYYY-MM-DD"
|
|
9145
|
-
*/
|
|
9146
|
-
|
|
9147
|
-
if (typeof start_date !== 'string' || !Number.isInteger(days)) {
|
|
9148
|
-
throw new Error(
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
return `${resultYear}-${resultMonth}-${resultDay}`;
|
|
9168
|
-
};
|
|
9169
|
-
|
|
8976
|
+
*/
|
|
8977
|
+
var dateAddDays = function dateAddDays(start_date, days) {
|
|
8978
|
+
if (typeof start_date !== 'string' || !Number.isInteger(days)) {
|
|
8979
|
+
throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days.");
|
|
8980
|
+
}
|
|
8981
|
+
|
|
8982
|
+
var startDateObj = new Date(start_date);
|
|
8983
|
+
if (isNaN(startDateObj.getTime())) {
|
|
8984
|
+
throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
8985
|
+
}
|
|
8986
|
+
|
|
8987
|
+
var resultDateObj = new Date(startDateObj);
|
|
8988
|
+
resultDateObj.setDate(resultDateObj.getDate() + days);
|
|
8989
|
+
|
|
8990
|
+
var resultYear = resultDateObj.getFullYear();
|
|
8991
|
+
var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
|
|
8992
|
+
var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
|
|
8993
|
+
|
|
8994
|
+
return resultYear + '-' + resultMonth + '-' + resultDay;
|
|
8995
|
+
};
|
|
8996
|
+
|
|
9170
8997
|
/**
|
|
9171
8998
|
* 计算两个日期之间的差值
|
|
9172
8999
|
* @date 2023年12月14日
|
|
@@ -9174,182 +9001,180 @@ const dateAddDays = function (start_date, days) {
|
|
|
9174
9001
|
* @param {String} end_date - 结束日期字符串
|
|
9175
9002
|
* @param {String} unit - 单位:year/month/day
|
|
9176
9003
|
* @returns {Number} 差值
|
|
9177
|
-
*/
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
return (
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9004
|
+
*/
|
|
9005
|
+
var dateDiff = function dateDiff(start_date, end_date) {
|
|
9006
|
+
var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
|
|
9007
|
+
|
|
9008
|
+
// Assuming date strings are in "YYYY-MM-DD" format
|
|
9009
|
+
var startDate = new Date(start_date);
|
|
9010
|
+
var endDate = new Date(end_date);
|
|
9011
|
+
|
|
9012
|
+
// If the date is invalid, return 0
|
|
9013
|
+
if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
|
|
9014
|
+
return 0;
|
|
9015
|
+
}
|
|
9016
|
+
|
|
9017
|
+
if (unit === 'year') {
|
|
9018
|
+
return endDate.getFullYear() - startDate.getFullYear();
|
|
9019
|
+
} else if (unit === 'month') {
|
|
9020
|
+
return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
|
|
9021
|
+
} else {
|
|
9022
|
+
// Default to day
|
|
9023
|
+
var timeDifference = endDate - startDate;
|
|
9024
|
+
// Calculate days (86400000 milliseconds per day)
|
|
9025
|
+
return Math.floor(timeDifference / 86400000);
|
|
9026
|
+
}
|
|
9027
|
+
};
|
|
9028
|
+
|
|
9203
9029
|
/**
|
|
9204
9030
|
* 获取月份中的日期
|
|
9205
9031
|
* @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
|
|
9206
9032
|
* @returns {number} 月份中的日期(1-31)
|
|
9207
|
-
*/
|
|
9208
|
-
|
|
9209
|
-
if (typeof date !== 'string') {
|
|
9210
|
-
throw new Error(
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
return dateObj.getDate();
|
|
9223
|
-
};
|
|
9224
|
-
|
|
9033
|
+
*/
|
|
9034
|
+
var dayOfMonth = function dayOfMonth(date) {
|
|
9035
|
+
if (typeof date !== 'string') {
|
|
9036
|
+
throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
9037
|
+
}
|
|
9038
|
+
|
|
9039
|
+
var dateObj = new Date(date);
|
|
9040
|
+
if (isNaN(dateObj.getTime())) {
|
|
9041
|
+
throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
9042
|
+
}
|
|
9043
|
+
|
|
9044
|
+
return dateObj.getDate();
|
|
9045
|
+
};
|
|
9046
|
+
|
|
9225
9047
|
/**
|
|
9226
9048
|
* 获取当前日期
|
|
9227
9049
|
* @date 2022年5月7日
|
|
9228
9050
|
* @param {string} format - 日期格式,默认为'YYYY-MM-DD'
|
|
9229
9051
|
* @returns {string} 当前日期的格式化字符串
|
|
9230
|
-
*/
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9052
|
+
*/
|
|
9053
|
+
var getCurrentDate = function getCurrentDate() {
|
|
9054
|
+
var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
|
|
9055
|
+
|
|
9056
|
+
return formatDate(new Date(), format);
|
|
9057
|
+
};
|
|
9058
|
+
|
|
9235
9059
|
/**
|
|
9236
9060
|
* 获取当前日期时间
|
|
9237
9061
|
* @date 2022年5月7日
|
|
9238
9062
|
* @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
|
|
9239
9063
|
* @returns {string} 当前日期时间的格式化字符串
|
|
9240
|
-
*/
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9064
|
+
*/
|
|
9065
|
+
var getCurrentDateTime = function getCurrentDateTime() {
|
|
9066
|
+
var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
|
|
9067
|
+
|
|
9068
|
+
return formatDate(new Date(), format);
|
|
9069
|
+
};
|
|
9070
|
+
|
|
9245
9071
|
/**
|
|
9246
9072
|
* 获取小时
|
|
9247
9073
|
* @date 2022年5月7日
|
|
9248
9074
|
* @param {Date|string} [date] - 日期对象或日期字符串
|
|
9249
9075
|
* @returns {number} 小时数(0-23)
|
|
9250
|
-
*/
|
|
9251
|
-
|
|
9252
|
-
if (!date) {
|
|
9253
|
-
return new Date().getHours();
|
|
9254
|
-
}
|
|
9255
|
-
if (typeof date === 'string') {
|
|
9256
|
-
date = new Date(date);
|
|
9257
|
-
}
|
|
9258
|
-
return date.getHours();
|
|
9259
|
-
};
|
|
9260
|
-
|
|
9076
|
+
*/
|
|
9077
|
+
var getHour = function getHour(date) {
|
|
9078
|
+
if (!date) {
|
|
9079
|
+
return new Date().getHours();
|
|
9080
|
+
}
|
|
9081
|
+
if (typeof date === 'string') {
|
|
9082
|
+
date = new Date(date);
|
|
9083
|
+
}
|
|
9084
|
+
return date.getHours();
|
|
9085
|
+
};
|
|
9086
|
+
|
|
9261
9087
|
/**
|
|
9262
9088
|
* 获取分钟
|
|
9263
9089
|
* @date 2022年5月7日
|
|
9264
9090
|
* @param {Date|string} [date] - 日期对象或日期字符串
|
|
9265
9091
|
* @returns {number} 分钟数(0-59)
|
|
9266
|
-
*/
|
|
9267
|
-
|
|
9268
|
-
if (!date) {
|
|
9269
|
-
return new Date().getMinutes();
|
|
9270
|
-
}
|
|
9271
|
-
if (typeof date === 'string') {
|
|
9272
|
-
date = new Date(date);
|
|
9273
|
-
}
|
|
9274
|
-
return date.getMinutes();
|
|
9275
|
-
};
|
|
9276
|
-
|
|
9092
|
+
*/
|
|
9093
|
+
var getMinute = function getMinute(date) {
|
|
9094
|
+
if (!date) {
|
|
9095
|
+
return new Date().getMinutes();
|
|
9096
|
+
}
|
|
9097
|
+
if (typeof date === 'string') {
|
|
9098
|
+
date = new Date(date);
|
|
9099
|
+
}
|
|
9100
|
+
return date.getMinutes();
|
|
9101
|
+
};
|
|
9102
|
+
|
|
9277
9103
|
/**
|
|
9278
9104
|
* 获取月份
|
|
9279
9105
|
* @date 2022年5月7日
|
|
9280
9106
|
* @param {Date|string} [date] - 日期对象或日期字符串
|
|
9281
9107
|
* @returns {number} 月份数(1-12)
|
|
9282
|
-
*/
|
|
9283
|
-
|
|
9284
|
-
if (!date) {
|
|
9285
|
-
return new Date().getMonth() + 1;
|
|
9286
|
-
}
|
|
9287
|
-
if (typeof date === 'string') {
|
|
9288
|
-
date = new Date(date);
|
|
9289
|
-
}
|
|
9290
|
-
return date.getMonth() + 1;
|
|
9291
|
-
};
|
|
9292
|
-
|
|
9108
|
+
*/
|
|
9109
|
+
var getMonth = function getMonth(date) {
|
|
9110
|
+
if (!date) {
|
|
9111
|
+
return new Date().getMonth() + 1;
|
|
9112
|
+
}
|
|
9113
|
+
if (typeof date === 'string') {
|
|
9114
|
+
date = new Date(date);
|
|
9115
|
+
}
|
|
9116
|
+
return date.getMonth() + 1;
|
|
9117
|
+
};
|
|
9118
|
+
|
|
9293
9119
|
/**
|
|
9294
9120
|
* 获取秒
|
|
9295
9121
|
* @date 2022年5月7日
|
|
9296
9122
|
* @param {Date|string} [date] - 日期对象或日期字符串
|
|
9297
9123
|
* @returns {number} 秒数(0-59)
|
|
9298
|
-
*/
|
|
9299
|
-
|
|
9300
|
-
if (!date) {
|
|
9301
|
-
return new Date().getSeconds();
|
|
9302
|
-
}
|
|
9303
|
-
if (typeof date === 'string') {
|
|
9304
|
-
date = new Date(date);
|
|
9305
|
-
}
|
|
9306
|
-
return date.getSeconds();
|
|
9307
|
-
};
|
|
9308
|
-
|
|
9124
|
+
*/
|
|
9125
|
+
var getSecond = function getSecond(date) {
|
|
9126
|
+
if (!date) {
|
|
9127
|
+
return new Date().getSeconds();
|
|
9128
|
+
}
|
|
9129
|
+
if (typeof date === 'string') {
|
|
9130
|
+
date = new Date(date);
|
|
9131
|
+
}
|
|
9132
|
+
return date.getSeconds();
|
|
9133
|
+
};
|
|
9134
|
+
|
|
9309
9135
|
/**
|
|
9310
9136
|
* 获取星期几
|
|
9311
9137
|
* @date 2022年5月7日
|
|
9312
9138
|
* @param {Date|string} [date] - 日期对象或日期字符串
|
|
9313
9139
|
* @returns {number} 星期几(0-6,0表示星期日)
|
|
9314
|
-
*/
|
|
9315
|
-
|
|
9316
|
-
if (!date) {
|
|
9317
|
-
return new Date().getDay();
|
|
9318
|
-
}
|
|
9319
|
-
if (typeof date === 'string') {
|
|
9320
|
-
date = new Date(date);
|
|
9321
|
-
}
|
|
9322
|
-
return date.getDay();
|
|
9323
|
-
};
|
|
9324
|
-
|
|
9325
|
-
|
|
9140
|
+
*/
|
|
9141
|
+
var getWeekday = function getWeekday(date) {
|
|
9142
|
+
if (!date) {
|
|
9143
|
+
return new Date().getDay();
|
|
9144
|
+
}
|
|
9145
|
+
if (typeof date === 'string') {
|
|
9146
|
+
date = new Date(date);
|
|
9147
|
+
}
|
|
9148
|
+
return date.getDay();
|
|
9149
|
+
};
|
|
9150
|
+
|
|
9326
9151
|
/**
|
|
9327
9152
|
* @desc 获取上午/下午/晚上
|
|
9328
9153
|
* @author huangbo
|
|
9329
9154
|
* @date 2022年5月7日
|
|
9330
9155
|
* @param {String} [time] - 时间
|
|
9331
|
-
**/
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
if (!time) {
|
|
9335
|
-
hour = new Date().getHours();
|
|
9336
|
-
} else if (typeof time === 'string') {
|
|
9337
|
-
// 从时间字符串中提取小时
|
|
9338
|
-
|
|
9339
|
-
if (match) {
|
|
9340
|
-
hour = parseInt(match[1], 10);
|
|
9341
|
-
}
|
|
9342
|
-
} else if (typeof time === 'number') {
|
|
9343
|
-
hour = time;
|
|
9344
|
-
}
|
|
9345
|
-
// 判断时间段
|
|
9346
|
-
if (hour >= 5 && hour < 12) {
|
|
9347
|
-
return '上午';
|
|
9348
|
-
} else if (hour >= 12 && hour < 18) {
|
|
9349
|
-
return '下午';
|
|
9350
|
-
} else {
|
|
9351
|
-
return '晚上';
|
|
9352
|
-
}
|
|
9156
|
+
**/
|
|
9157
|
+
var timeCycle = function timeCycle(time) {
|
|
9158
|
+
var hour = 0;
|
|
9159
|
+
if (!time) {
|
|
9160
|
+
hour = new Date().getHours();
|
|
9161
|
+
} else if (typeof time === 'string') {
|
|
9162
|
+
// 从时间字符串中提取小时
|
|
9163
|
+
var match = time.match(/^(\d{1,2})/);
|
|
9164
|
+
if (match) {
|
|
9165
|
+
hour = parseInt(match[1], 10);
|
|
9166
|
+
}
|
|
9167
|
+
} else if (typeof time === 'number') {
|
|
9168
|
+
hour = time;
|
|
9169
|
+
}
|
|
9170
|
+
// 判断时间段
|
|
9171
|
+
if (hour >= 5 && hour < 12) {
|
|
9172
|
+
return '上午';
|
|
9173
|
+
} else if (hour >= 12 && hour < 18) {
|
|
9174
|
+
return '下午';
|
|
9175
|
+
} else {
|
|
9176
|
+
return '晚上';
|
|
9177
|
+
}
|
|
9353
9178
|
};
|
|
9354
9179
|
|
|
9355
9180
|
/***/ }),
|
|
@@ -9361,7 +9186,7 @@ module.exports = require("eoss/lib/message-box");
|
|
|
9361
9186
|
|
|
9362
9187
|
/***/ }),
|
|
9363
9188
|
|
|
9364
|
-
/***/
|
|
9189
|
+
/***/ 82:
|
|
9365
9190
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9366
9191
|
|
|
9367
9192
|
"use strict";
|