bkui-vue 1.0.3-beta.41 → 1.0.3-beta.43

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.
@@ -62,6 +62,8 @@ declare const BkModal: {
62
62
  };
63
63
  direction: import("vue-types").VueTypeValidableDef<string> & {
64
64
  default: string;
65
+ } & {
66
+ default: string;
65
67
  };
66
68
  title: import("vue-types").VueTypeValidableDef<string> & {
67
69
  default: string;
@@ -95,33 +97,31 @@ declare const BkModal: {
95
97
  top: import("vue-types").VueTypeValidableDef<string> & {
96
98
  default: string;
97
99
  };
100
+ hiddenDelay: import("vue-types").VueTypeValidableDef<number> & {
101
+ default: number;
102
+ } & {
103
+ default: number;
104
+ };
98
105
  }>> & {
99
106
  onClose?: (...args: any[]) => any;
100
107
  onHidden?: (...args: any[]) => any;
101
108
  onShown?: (...args: any[]) => any;
102
- "onQuick-close"?: (...args: any[]) => any;
103
109
  onQuickClose?: (...args: any[]) => any;
110
+ "onQuick-close"?: (...args: any[]) => any;
104
111
  }, {
112
+ zIndex: import("vue").Ref<string | number>;
105
113
  visible: import("vue").Ref<boolean>;
106
- compStyle: import("vue").ComputedRef<{
107
- [x: string]: string | number;
108
- width: string | number;
109
- height: string | number;
110
- minHeigth: string;
114
+ contentStyles: import("vue").Ref<{}>;
115
+ isContentScroll: import("vue").Ref<boolean>;
116
+ modalWrapperStyles: import("vue").ComputedRef<{
111
117
  display: string;
112
- zIndex: string | number;
113
- left: string;
114
- top: string;
115
- }>;
116
- fullscreenStyle: import("vue").ComputedRef<{
117
- width: string;
118
- height: string;
119
118
  }>;
120
119
  handleClickOutSide: (e: MouseEvent) => void;
121
120
  refRoot: import("vue").Ref<HTMLElement>;
122
121
  refMask: import("vue").Ref<HTMLElement>;
123
- showMask: boolean;
124
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "hidden" | "shown" | "quick-close" | "quickClose")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
122
+ resolveClassName: (cls: string) => string;
123
+ close: () => void;
124
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "hidden" | "shown" | "quickClose" | "quick-close")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
125
125
  isShow: import("vue-types").VueTypeValidableDef<boolean> & {
126
126
  default: boolean;
127
127
  } & {
@@ -183,6 +183,8 @@ declare const BkModal: {
183
183
  };
184
184
  direction: import("vue-types").VueTypeValidableDef<string> & {
185
185
  default: string;
186
+ } & {
187
+ default: string;
186
188
  };
187
189
  title: import("vue-types").VueTypeValidableDef<string> & {
188
190
  default: string;
@@ -216,12 +218,17 @@ declare const BkModal: {
216
218
  top: import("vue-types").VueTypeValidableDef<string> & {
217
219
  default: string;
218
220
  };
221
+ hiddenDelay: import("vue-types").VueTypeValidableDef<number> & {
222
+ default: number;
223
+ } & {
224
+ default: number;
225
+ };
219
226
  }>> & {
220
227
  onClose?: (...args: any[]) => any;
221
228
  onHidden?: (...args: any[]) => any;
222
229
  onShown?: (...args: any[]) => any;
223
- "onQuick-close"?: (...args: any[]) => any;
224
230
  onQuickClose?: (...args: any[]) => any;
231
+ "onQuick-close"?: (...args: any[]) => any;
225
232
  }, {
226
233
  title: string;
227
234
  width: string | number;
@@ -235,15 +242,16 @@ declare const BkModal: {
235
242
  transfer: string | boolean | HTMLElement;
236
243
  direction: string;
237
244
  renderDirective: "show" | "if";
238
- quickClose: boolean;
239
245
  scrollable: boolean;
240
246
  showMask: boolean;
241
247
  closeIcon: boolean;
242
248
  escClose: boolean;
243
249
  fullscreen: boolean;
250
+ quickClose: boolean;
244
251
  animateType: string;
245
252
  multiInstance: boolean;
246
253
  bodyClass: string | unknown[];
254
+ hiddenDelay: number;
247
255
  }, true, {}, {}, {
248
256
  P: {};
249
257
  B: {};
@@ -313,6 +321,8 @@ declare const BkModal: {
313
321
  };
314
322
  direction: import("vue-types").VueTypeValidableDef<string> & {
315
323
  default: string;
324
+ } & {
325
+ default: string;
316
326
  };
317
327
  title: import("vue-types").VueTypeValidableDef<string> & {
318
328
  default: string;
@@ -346,32 +356,30 @@ declare const BkModal: {
346
356
  top: import("vue-types").VueTypeValidableDef<string> & {
347
357
  default: string;
348
358
  };
359
+ hiddenDelay: import("vue-types").VueTypeValidableDef<number> & {
360
+ default: number;
361
+ } & {
362
+ default: number;
363
+ };
349
364
  }>> & {
350
365
  onClose?: (...args: any[]) => any;
351
366
  onHidden?: (...args: any[]) => any;
352
367
  onShown?: (...args: any[]) => any;
353
- "onQuick-close"?: (...args: any[]) => any;
354
368
  onQuickClose?: (...args: any[]) => any;
369
+ "onQuick-close"?: (...args: any[]) => any;
355
370
  }, {
371
+ zIndex: import("vue").Ref<string | number>;
356
372
  visible: import("vue").Ref<boolean>;
357
- compStyle: import("vue").ComputedRef<{
358
- [x: string]: string | number;
359
- width: string | number;
360
- height: string | number;
361
- minHeigth: string;
373
+ contentStyles: import("vue").Ref<{}>;
374
+ isContentScroll: import("vue").Ref<boolean>;
375
+ modalWrapperStyles: import("vue").ComputedRef<{
362
376
  display: string;
363
- zIndex: string | number;
364
- left: string;
365
- top: string;
366
- }>;
367
- fullscreenStyle: import("vue").ComputedRef<{
368
- width: string;
369
- height: string;
370
377
  }>;
371
378
  handleClickOutSide: (e: MouseEvent) => void;
372
379
  refRoot: import("vue").Ref<HTMLElement>;
373
380
  refMask: import("vue").Ref<HTMLElement>;
374
- showMask: boolean;
381
+ resolveClassName: (cls: string) => string;
382
+ close: () => void;
375
383
  }, {}, {}, {}, {
376
384
  title: string;
377
385
  width: string | number;
@@ -385,15 +393,16 @@ declare const BkModal: {
385
393
  transfer: string | boolean | HTMLElement;
386
394
  direction: string;
387
395
  renderDirective: "show" | "if";
388
- quickClose: boolean;
389
396
  scrollable: boolean;
390
397
  showMask: boolean;
391
398
  closeIcon: boolean;
392
399
  escClose: boolean;
393
400
  fullscreen: boolean;
401
+ quickClose: boolean;
394
402
  animateType: string;
395
403
  multiInstance: boolean;
396
404
  bodyClass: string | unknown[];
405
+ hiddenDelay: number;
397
406
  }>;
398
407
  __isFragment?: never;
399
408
  __isTeleport?: never;
@@ -460,6 +469,8 @@ declare const BkModal: {
460
469
  };
461
470
  direction: import("vue-types").VueTypeValidableDef<string> & {
462
471
  default: string;
472
+ } & {
473
+ default: string;
463
474
  };
464
475
  title: import("vue-types").VueTypeValidableDef<string> & {
465
476
  default: string;
@@ -493,33 +504,31 @@ declare const BkModal: {
493
504
  top: import("vue-types").VueTypeValidableDef<string> & {
494
505
  default: string;
495
506
  };
507
+ hiddenDelay: import("vue-types").VueTypeValidableDef<number> & {
508
+ default: number;
509
+ } & {
510
+ default: number;
511
+ };
496
512
  }>> & {
497
513
  onClose?: (...args: any[]) => any;
498
514
  onHidden?: (...args: any[]) => any;
499
515
  onShown?: (...args: any[]) => any;
500
- "onQuick-close"?: (...args: any[]) => any;
501
516
  onQuickClose?: (...args: any[]) => any;
517
+ "onQuick-close"?: (...args: any[]) => any;
502
518
  }, {
519
+ zIndex: import("vue").Ref<string | number>;
503
520
  visible: import("vue").Ref<boolean>;
504
- compStyle: import("vue").ComputedRef<{
505
- [x: string]: string | number;
506
- width: string | number;
507
- height: string | number;
508
- minHeigth: string;
521
+ contentStyles: import("vue").Ref<{}>;
522
+ isContentScroll: import("vue").Ref<boolean>;
523
+ modalWrapperStyles: import("vue").ComputedRef<{
509
524
  display: string;
510
- zIndex: string | number;
511
- left: string;
512
- top: string;
513
- }>;
514
- fullscreenStyle: import("vue").ComputedRef<{
515
- width: string;
516
- height: string;
517
525
  }>;
518
526
  handleClickOutSide: (e: MouseEvent) => void;
519
527
  refRoot: import("vue").Ref<HTMLElement>;
520
528
  refMask: import("vue").Ref<HTMLElement>;
521
- showMask: boolean;
522
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "hidden" | "shown" | "quick-close" | "quickClose")[], "close" | "hidden" | "shown" | "quick-close" | "quickClose", {
529
+ resolveClassName: (cls: string) => string;
530
+ close: () => void;
531
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "hidden" | "shown" | "quickClose" | "quick-close")[], "close" | "hidden" | "shown" | "quickClose" | "quick-close", {
523
532
  title: string;
524
533
  width: string | number;
525
534
  height: string | number;
@@ -532,15 +541,16 @@ declare const BkModal: {
532
541
  transfer: string | boolean | HTMLElement;
533
542
  direction: string;
534
543
  renderDirective: "show" | "if";
535
- quickClose: boolean;
536
544
  scrollable: boolean;
537
545
  showMask: boolean;
538
546
  closeIcon: boolean;
539
547
  escClose: boolean;
540
548
  fullscreen: boolean;
549
+ quickClose: boolean;
541
550
  animateType: string;
542
551
  multiInstance: boolean;
543
552
  bodyClass: string | unknown[];
553
+ hiddenDelay: number;
544
554
  }, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin<any[]> & Readonly<{
545
555
  propsMixin: {
546
556
  isShow: import("vue-types").VueTypeValidableDef<boolean> & {
@@ -604,6 +614,8 @@ declare const BkModal: {
604
614
  };
605
615
  direction: import("vue-types").VueTypeValidableDef<string> & {
606
616
  default: string;
617
+ } & {
618
+ default: string;
607
619
  };
608
620
  title: import("vue-types").VueTypeValidableDef<string> & {
609
621
  default: string;
@@ -637,6 +649,11 @@ declare const BkModal: {
637
649
  top: import("vue-types").VueTypeValidableDef<string> & {
638
650
  default: string;
639
651
  };
652
+ hiddenDelay: import("vue-types").VueTypeValidableDef<number> & {
653
+ default: number;
654
+ } & {
655
+ default: number;
656
+ };
640
657
  };
641
658
  }>;
642
659
  export default BkModal;
@@ -3,6 +3,7 @@ import "./modal.less";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__ from "../shared";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__ from "../config-provider";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__ from "lodash/throttle";
6
7
  import * as __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__ from "vue-types";
7
8
  /******/ var __webpack_modules__ = ({
8
9
 
@@ -505,7 +506,7 @@ function _defineProperty(obj, key, value) {
505
506
  ;// CONCATENATED MODULE: external "vue"
506
507
  var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
507
508
  var external_vue_y = x => () => x
508
- const external_vue_namespaceObject = external_vue_x({ ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
509
+ const external_vue_namespaceObject = external_vue_x({ ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
509
510
  // EXTERNAL MODULE: ../../node_modules/@babel/runtime/regenerator/index.js
510
511
  var regenerator = __webpack_require__(2841);
511
512
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
@@ -513,6 +514,97 @@ var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
513
514
  var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
514
515
  var config_provider_y = x => () => x
515
516
  const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__.usePrefix });
517
+ ;// CONCATENATED MODULE: external "lodash/throttle"
518
+ var throttle_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
519
+ var throttle_y = x => () => x
520
+ const throttle_namespaceObject = throttle_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__["default"] });
521
+ ;// CONCATENATED MODULE: ../../packages/modal/src/hooks.ts
522
+ /*
523
+ * Tencent is pleased to support the open source community by making
524
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
525
+ *
526
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
527
+ *
528
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
529
+ *
530
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
531
+ *
532
+ * ---------------------------------------------------
533
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
534
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
535
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
536
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
537
+ *
538
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
539
+ * the Software.
540
+ *
541
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
542
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
543
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
544
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
545
+ * IN THE SOFTWARE.
546
+ */
547
+
548
+
549
+
550
+ var useContentResize = function useContentResize(root, props) {
551
+ var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
552
+ resolveClassName = _usePrefix.resolveClassName;
553
+ var isContentScroll = (0,external_vue_namespaceObject.ref)(false);
554
+ var contentStyles = (0,external_vue_namespaceObject.ref)({});
555
+ var observer;
556
+ var handleResize = (0,throttle_namespaceObject["default"])(function () {
557
+ var calcContentScroll = function calcContentScroll() {
558
+ var _root$value$querySele = root.value.querySelector(".".concat(resolveClassName('modal-header'))).getBoundingClientRect(),
559
+ headerHeight = _root$value$querySele.height;
560
+ var _root$value$querySele2 = root.value.querySelector(".".concat(resolveClassName('modal-content'))).getBoundingClientRect(),
561
+ contentHeight = _root$value$querySele2.height;
562
+ var _root$value$querySele3 = root.value.querySelector(".".concat(resolveClassName('modal-footer'))).getBoundingClientRect(),
563
+ footerHeight = _root$value$querySele3.height;
564
+ var windowInnerHeight = window.innerHeight;
565
+ isContentScroll.value = windowInnerHeight < headerHeight + contentHeight + footerHeight;
566
+ if (isContentScroll.value || props.fullscreen) {
567
+ contentStyles.value = {
568
+ height: "".concat(windowInnerHeight - headerHeight - footerHeight, "px"),
569
+ overflow: 'scroll'
570
+ };
571
+ } else {
572
+ contentStyles.value = {};
573
+ }
574
+ };
575
+ observer = new MutationObserver(function () {
576
+ calcContentScroll();
577
+ });
578
+ observer.observe(root.value.querySelector(".".concat(resolveClassName('modal-content'), " div")), {
579
+ subtree: true,
580
+ attributes: true,
581
+ childList: true,
582
+ characterData: true
583
+ });
584
+ calcContentScroll();
585
+ }, 30);
586
+ (0,external_vue_namespaceObject.watch)(function () {
587
+ return props.isShow;
588
+ }, function () {
589
+ if (props.isShow) {
590
+ setTimeout(function () {
591
+ handleResize();
592
+ }, 100);
593
+ } else {
594
+ if (observer) {
595
+ observer.takeRecords();
596
+ observer.disconnect();
597
+ observer = null;
598
+ }
599
+ }
600
+ }, {
601
+ immediate: true
602
+ });
603
+ return {
604
+ contentStyles: contentStyles,
605
+ isContentScroll: isContentScroll
606
+ };
607
+ };
516
608
  ;// CONCATENATED MODULE: external "vue-types"
517
609
  var external_vue_types_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
518
610
  var external_vue_types_y = x => () => x
@@ -555,8 +647,8 @@ var ModalSizeEnum;
555
647
  var propsMixin = {
556
648
  // 是否显示弹框
557
649
  isShow: shared_namespaceObject.PropTypes.bool.def(false),
558
- width: shared_namespaceObject.PropTypes.oneOfType([String, Number]).def('50%'),
559
- height: shared_namespaceObject.PropTypes.oneOfType([String, Number]).def('50%'),
650
+ width: shared_namespaceObject.PropTypes.oneOfType([String, Number]).def('480px'),
651
+ height: shared_namespaceObject.PropTypes.oneOfType([String, Number]).def('1000'),
560
652
  // 配置自定义样式类名
561
653
  extCls: shared_namespaceObject.PropTypes.string || shared_namespaceObject.PropTypes.array,
562
654
  // 弹框出现时,是否允许页面滚动
@@ -582,7 +674,7 @@ var propsMixin = {
582
674
  // 内容区最大高度
583
675
  maxHeight: shared_namespaceObject.PropTypes.string,
584
676
  // 弹出方向
585
- direction: shared_namespaceObject.PropTypes.string,
677
+ direction: shared_namespaceObject.PropTypes.string.def(''),
586
678
  // title
587
679
  title: shared_namespaceObject.PropTypes.string.def(''),
588
680
  // 动画类型
@@ -601,7 +693,8 @@ var propsMixin = {
601
693
  infoType: shared_namespaceObject.PropTypes.theme(),
602
694
  bodyClass: shared_namespaceObject.PropTypes.string || shared_namespaceObject.PropTypes.array,
603
695
  left: shared_namespaceObject.PropTypes.string,
604
- top: shared_namespaceObject.PropTypes.string
696
+ top: shared_namespaceObject.PropTypes.string,
697
+ hiddenDelay: shared_namespaceObject.PropTypes.number.def(200)
605
698
  };
606
699
  ;// CONCATENATED MODULE: ../../packages/modal/src/modal.tsx
607
700
 
@@ -639,36 +732,36 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
639
732
 
640
733
 
641
734
 
735
+
642
736
  /* harmony default export */ const modal = ((0,external_vue_namespaceObject.defineComponent)({
643
737
  name: 'Modal',
644
738
  props: _objectSpread({}, propsMixin),
645
739
  emits: ['quick-close', 'quickClose', 'hidden', 'shown', 'close'],
646
740
  setup: function setup(props, ctx) {
647
- var visible = (0,external_vue_namespaceObject.ref)(false);
648
- var zIndex = (0,external_vue_namespaceObject.ref)(props.zIndex);
649
741
  var refRoot = (0,external_vue_namespaceObject.ref)();
650
742
  var refMask = (0,external_vue_namespaceObject.ref)();
743
+ var teleportTo = (0,external_vue_namespaceObject.ref)('body');
744
+ var visible = (0,external_vue_namespaceObject.ref)(false);
745
+ var zIndex = (0,external_vue_namespaceObject.ref)(props.zIndex);
746
+ var enableTeleport = (0,external_vue_namespaceObject.ref)(!!props.transfer);
651
747
  var backgroundColor = (0,external_vue_namespaceObject.ref)('rgba(0,0,0,0.6)');
652
748
  var closeTimer;
653
- var dialogWidth = (0,external_vue_namespaceObject.computed)(function () {
654
- return /^\d+\.?\d*$/.test("".concat(props.width)) ? "".concat(props.width, "px") : props.width;
655
- });
656
- var dialogHeight = (0,external_vue_namespaceObject.computed)(function () {
657
- return /^\d+\.?\d*$/.test("".concat(props.height)) ? "".concat(props.height, "px") : props.height;
658
- });
659
- var compStyle = (0,external_vue_namespaceObject.computed)(function () {
660
- return _defineProperty({
661
- width: dialogWidth.value,
662
- height: dialogHeight.value,
663
- minHeigth: "".concat(200, "px"),
664
- display: visible.value ? 'inherit' : 'none',
665
- zIndex: zIndex.value || 'inherit',
749
+ var _useContentResize = useContentResize(refRoot, props),
750
+ contentStyles = _useContentResize.contentStyles,
751
+ isContentScroll = _useContentResize.isContentScroll;
752
+ var modalWrapperStyles = (0,external_vue_namespaceObject.computed)(function () {
753
+ var baseStyles = {
754
+ display: visible.value ? 'inherit' : 'none'
755
+ };
756
+ if (props.fullscreen) {
757
+ return baseStyles;
758
+ }
759
+ return Object.assign(baseStyles, _defineProperty({
760
+ width: /^\d+\.?\d*$/.test("".concat(props.width)) ? "".concat(props.width, "px") : props.width,
666
761
  left: props.left,
667
762
  top: props.top
668
- }, props.direction, 0);
763
+ }, props.direction, 0));
669
764
  });
670
- var enableTeleport = (0,external_vue_namespaceObject.ref)(!!props.transfer);
671
- var teleportTo = (0,external_vue_namespaceObject.ref)('body');
672
765
  var resolveTransfer = function resolveTransfer() {
673
766
  if (props.transfer) {
674
767
  if (typeof props.transfer === 'boolean') {
@@ -703,12 +796,22 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
703
796
  _target === null || _target === void 0 || _target.appendChild(refRoot.value);
704
797
  }
705
798
  };
706
- var fullscreenStyle = (0,external_vue_namespaceObject.computed)(function () {
707
- return {
708
- width: "".concat(100, "%"),
709
- height: "".concat(100, "%")
710
- };
711
- });
799
+ var close = function close() {
800
+ if (visible.value) {
801
+ visible.value = false;
802
+ shared_namespaceObject.mask.hideMask({
803
+ el: refRoot.value,
804
+ mask: refMask.value,
805
+ showMask: props.showMask,
806
+ backgroundColor: backgroundColor.value
807
+ });
808
+ ctx.emit('hidden');
809
+ if (enableTeleport.value) {
810
+ var _refRoot$value2;
811
+ (_refRoot$value2 = refRoot.value) === null || _refRoot$value2 === void 0 || _refRoot$value2.remove();
812
+ }
813
+ }
814
+ };
712
815
  var closeModal = function closeModal() {
713
816
  shared_namespaceObject.mask.hideMask({
714
817
  el: refRoot.value,
@@ -720,10 +823,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
720
823
  // 直接设为false会失去离开的动画效果,这里延迟设置
721
824
  ctx.emit('hidden'); // 为false直接触发hidden事件,在上层有200ms的延时
722
825
  if (enableTeleport.value) {
723
- var _refRoot$value2;
724
- (_refRoot$value2 = refRoot.value) === null || _refRoot$value2 === void 0 || _refRoot$value2.remove();
826
+ var _refRoot$value3;
827
+ (_refRoot$value3 = refRoot.value) === null || _refRoot$value3 === void 0 || _refRoot$value3.remove();
725
828
  }
726
- }, 250);
829
+ }, props.hiddenDelay);
727
830
  };
728
831
  (0,external_vue_namespaceObject.watch)(function () {
729
832
  return props.isShow;
@@ -753,7 +856,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
753
856
  immediate: true
754
857
  });
755
858
  var handleBeforeClose = /*#__PURE__*/function () {
756
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(callbackFn) {
859
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(callbackFn) {
757
860
  var shouldClose, execRet;
758
861
  return regenerator_default().wrap(function _callee$(_context) {
759
862
  while (1) switch (_context.prev = _context.next) {
@@ -791,7 +894,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
791
894
  }, _callee);
792
895
  }));
793
896
  return function handleBeforeClose(_x) {
794
- return _ref2.apply(this, arguments);
897
+ return _ref.apply(this, arguments);
795
898
  };
796
899
  }();
797
900
  var handleClickOutSide = function handleClickOutSide(e) {
@@ -806,67 +909,61 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
806
909
  });
807
910
  }
808
911
  };
912
+ (0,external_vue_namespaceObject.onBeforeUnmount)(function () {
913
+ close();
914
+ });
809
915
  return {
916
+ zIndex: zIndex,
810
917
  visible: visible,
811
- compStyle: compStyle,
812
- fullscreenStyle: fullscreenStyle,
918
+ contentStyles: contentStyles,
919
+ isContentScroll: isContentScroll,
920
+ modalWrapperStyles: modalWrapperStyles,
813
921
  handleClickOutSide: handleClickOutSide,
814
922
  refRoot: refRoot,
815
923
  refMask: refMask,
816
- showMask: props.showMask
924
+ resolveClassName: resolveClassName,
925
+ close: close
817
926
  };
818
927
  },
819
928
  render: function render() {
820
- var _this$extCls,
821
- _this$bodyClass,
822
- _this$$slots$header,
823
- _this$$slots$header2,
929
+ var _this$$slots$header,
824
930
  _this$$slots,
825
- _this$$slots$footer,
826
- _this$$slots$footer2,
931
+ _this$$slots$default,
827
932
  _this$$slots2,
828
- _this$$slots$close,
829
- _this$$slots$close2,
933
+ _this$$slots$footer,
830
934
  _this$$slots3,
935
+ _this$$slots$close,
936
+ _this$$slots4,
831
937
  _this = this;
832
- var _usePrefix2 = (0,config_provider_namespaceObject.usePrefix)(),
833
- resolveClassName = _usePrefix2.resolveClassName;
834
- var maxHeight = this.maxHeight ? {
835
- maxHeight: this.maxHeight
836
- } : {};
837
- var bodyClass = "".concat(resolveClassName('modal-body'), " ").concat(this.animateType === 'slide' ? this.direction : '');
838
938
  return (0,external_vue_namespaceObject.createVNode)("div", {
839
939
  "ref": "refRoot",
840
- "class": [resolveClassName('modal-ctx'), this.visible ? '--show' : '--hide'],
940
+ "class": _defineProperty(_defineProperty(_defineProperty({}, this.resolveClassName('modal-ctx'), true), '--show', this.visible), '--hide', !this.visible),
841
941
  "style": {
842
- zIndex: this.compStyle.zIndex
942
+ zIndex: this.zIndex
843
943
  }
844
- }, [this.showMask ? (0,external_vue_namespaceObject.createVNode)("div", {
944
+ }, [this.showMask && (0,external_vue_namespaceObject.createVNode)("div", {
845
945
  "ref": "refMask",
846
- "class": [resolveClassName('modal-ctx-mask'), this.visible ? '--show' : '--hide'],
847
- "onClick": this.handleClickOutSide,
848
- "style": {
849
- zIndex: this.compStyle.zIndex
850
- }
851
- }, null) : '', (0,external_vue_namespaceObject.createVNode)("div", {
852
- "class": [resolveClassName('modal-wrapper'), (_this$extCls = this.extCls) !== null && _this$extCls !== void 0 ? _this$extCls : '', (_this$bodyClass = this.bodyClass) !== null && _this$bodyClass !== void 0 ? _this$bodyClass : '', this.size, this.fullscreen ? 'fullscreen' : ''],
853
- "style": [this.compStyle, this.fullscreen ? this.fullscreenStyle : '']
946
+ "class": _defineProperty({}, this.resolveClassName('modal-ctx-mask'), true),
947
+ "onClick": this.handleClickOutSide
948
+ }, null), (0,external_vue_namespaceObject.createVNode)("div", {
949
+ "class": _defineProperty(_defineProperty(_defineProperty({}, this.resolveClassName('modal-wrapper'), true), 'scroll-able', this.scrollable), 'multi-instance', this.multiInstance),
950
+ "style": this.modalWrapperStyles
854
951
  }, [(0,external_vue_namespaceObject.createVNode)(external_vue_namespaceObject.Transition, {
855
952
  "name": this.animateType
856
953
  }, {
857
954
  "default": function _default() {
858
- return [_this.visible ? (0,external_vue_namespaceObject.createVNode)("div", {
859
- "class": bodyClass
955
+ return [_this.visible && (0,external_vue_namespaceObject.createVNode)("div", {
956
+ "class": _defineProperty(_defineProperty({}, _this.resolveClassName('modal-body'), true), _this.direction, _this.animateType === 'slide')
860
957
  }, [(0,external_vue_namespaceObject.createVNode)("div", {
861
- "class": resolveClassName('modal-header')
862
- }, [(_this$$slots$header = (_this$$slots$header2 = (_this$$slots = _this.$slots).header) === null || _this$$slots$header2 === void 0 ? void 0 : _this$$slots$header2.call(_this$$slots)) !== null && _this$$slots$header !== void 0 ? _this$$slots$header : '']), _this.$slots["default"] && (0,external_vue_namespaceObject.createVNode)("div", {
863
- "class": resolveClassName('modal-content'),
864
- "style": [_this.dialogType === 'show' ? 'padding-bottom: 20px' : '', _objectSpread({}, maxHeight)]
865
- }, [_this.$slots["default"]()]), _this.dialogType === 'show' ? '' : (0,external_vue_namespaceObject.createVNode)("div", {
866
- "class": resolveClassName('modal-footer')
867
- }, [(_this$$slots$footer = (_this$$slots$footer2 = (_this$$slots2 = _this.$slots).footer) === null || _this$$slots$footer2 === void 0 ? void 0 : _this$$slots$footer2.call(_this$$slots2)) !== null && _this$$slots$footer !== void 0 ? _this$$slots$footer : '']), _this.closeIcon && (0,external_vue_namespaceObject.createVNode)("div", {
868
- "class": resolveClassName('modal-close')
869
- }, [(_this$$slots$close = (_this$$slots$close2 = (_this$$slots3 = _this.$slots).close) === null || _this$$slots$close2 === void 0 ? void 0 : _this$$slots$close2.call(_this$$slots3)) !== null && _this$$slots$close !== void 0 ? _this$$slots$close : ''])]) : ''];
958
+ "class": _this.resolveClassName('modal-header')
959
+ }, [(_this$$slots$header = (_this$$slots = _this.$slots).header) === null || _this$$slots$header === void 0 ? void 0 : _this$$slots$header.call(_this$$slots)]), (0,external_vue_namespaceObject.createVNode)("div", {
960
+ "class": _this.resolveClassName('modal-content'),
961
+ "style": _this.contentStyles
962
+ }, [(0,external_vue_namespaceObject.createVNode)("div", null, [(_this$$slots$default = (_this$$slots2 = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots2)])]), (0,external_vue_namespaceObject.createVNode)("div", {
963
+ "class": _defineProperty(_defineProperty({}, _this.resolveClassName('modal-footer'), true), 'is-fixed', _this.isContentScroll)
964
+ }, [(_this$$slots$footer = (_this$$slots3 = _this.$slots).footer) === null || _this$$slots$footer === void 0 ? void 0 : _this$$slots$footer.call(_this$$slots3)]), _this.closeIcon && (0,external_vue_namespaceObject.createVNode)("div", {
965
+ "class": _this.resolveClassName('modal-close')
966
+ }, [(_this$$slots$close = (_this$$slots4 = _this.$slots).close) === null || _this$$slots$close === void 0 ? void 0 : _this$$slots$close.call(_this$$slots4)])])];
870
967
  }
871
968
  })])]);
872
969
  }