bkui-vue 1.0.3-beta.67.dialog.3 → 1.0.3-beta.67.dialog.5

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.
@@ -86,12 +86,16 @@
86
86
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
87
87
  }
88
88
  .bk-modal-content {
89
+ position: relative;
89
90
  max-height: 100vh;
90
91
  font-size: 0;
91
92
  }
92
93
  .bk-modal-content div {
93
94
  font-size: 12px;
94
95
  }
96
+ .bk-modal-footer {
97
+ position: relative;
98
+ }
95
99
  .bk-modal-close {
96
100
  position: absolute;
97
101
  top: 6px;
@@ -215,12 +215,16 @@
215
215
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
216
216
  }
217
217
  .bk-modal-content {
218
+ position: relative;
218
219
  max-height: 100vh;
219
220
  font-size: 0;
220
221
  }
221
222
  .bk-modal-content div {
222
223
  font-size: 12px;
223
224
  }
225
+ .bk-modal-footer {
226
+ position: relative;
227
+ }
224
228
  .bk-modal-close {
225
229
  position: absolute;
226
230
  top: 6px;
@@ -942,6 +942,7 @@ function _isSlot(s) {
942
942
  "quickClose": props.quickClose,
943
943
  "showMask": props.showMask,
944
944
  "transfer": props.transfer,
945
+ "renderDirective": props.renderDirective,
945
946
  "left": props.fullscreen ? '0px' : positionData.moveStyle.left,
946
947
  "top": props.fullscreen ? '0px' : positionData.moveStyle.top,
947
948
  "zIndex": props.zIndex,
@@ -432,7 +432,7 @@ const shared_namespaceObject = x({ ["withInstall"]: () => __WEBPACK_EXTERNAL_MOD
432
432
  ;// CONCATENATED MODULE: external "vue"
433
433
  var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
434
434
  var external_vue_y = x => () => x
435
- const external_vue_namespaceObject = external_vue_x({ ["createApp"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createApp, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref });
435
+ const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["createApp"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createApp, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref });
436
436
  ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
437
437
  function _typeof(o) {
438
438
  "@babel/helpers - typeof";
@@ -589,6 +589,7 @@ var genDefaultState = function genDefaultState() {
589
589
  title: undefined,
590
590
  subTitle: undefined,
591
591
  content: undefined,
592
+ footer: undefined,
592
593
  headerAlign: 'center',
593
594
  contentAlign: 'center',
594
595
  footerAlign: 'center',
@@ -597,7 +598,7 @@ var genDefaultState = function genDefaultState() {
597
598
  escClose: false,
598
599
  closeIcon: true,
599
600
  confirmText: '确定',
600
- theme: 'primary',
601
+ theme: undefined,
601
602
  confirmButtonTheme: 'primary',
602
603
  cancelText: '',
603
604
  beforeClose: function beforeClose() {
@@ -749,6 +750,29 @@ var genDefaultState = function genDefaultState() {
749
750
  }
750
751
  return state.content;
751
752
  };
753
+ var renderFooter = function renderFooter() {
754
+ if ((0,isFunction_namespaceObject["default"])(state.footer)) {
755
+ return state.footer();
756
+ }
757
+ if (state.footer) {
758
+ return state.footer;
759
+ }
760
+ return (0,external_vue_namespaceObject.createVNode)(external_vue_namespaceObject.Fragment, null, [state.confirmText && (0,external_vue_namespaceObject.createVNode)(button_namespaceObject["default"], {
761
+ "loading": isLoading.value,
762
+ "theme": state.confirmButtonTheme,
763
+ "onClick": handleConfirm
764
+ }, {
765
+ "default": function _default() {
766
+ return [state.confirmText];
767
+ }
768
+ }), state.cancelText && (0,external_vue_namespaceObject.createVNode)(button_namespaceObject["default"], {
769
+ "onClick": handleCancel
770
+ }, {
771
+ "default": function _default() {
772
+ return [state.cancelText];
773
+ }
774
+ })]);
775
+ };
752
776
  return (0,external_vue_namespaceObject.createVNode)(modal_namespaceObject["default"], {
753
777
  "class": [resolveClassName('infobox'), state["class"]],
754
778
  "isShow": isShow.value,
@@ -779,21 +803,7 @@ var genDefaultState = function genDefaultState() {
779
803
  footer: function footer() {
780
804
  return (0,external_vue_namespaceObject.createVNode)("div", {
781
805
  "class": _defineProperty(_defineProperty({}, resolveClassName('infobox-footer'), true), "is-position-".concat(state.footerAlign), state.footerAlign)
782
- }, [state.confirmText && (0,external_vue_namespaceObject.createVNode)(button_namespaceObject["default"], {
783
- "loading": isLoading.value,
784
- "theme": state.confirmButtonTheme,
785
- "onClick": handleConfirm
786
- }, {
787
- "default": function _default() {
788
- return [state.confirmText];
789
- }
790
- }), state.cancelText && (0,external_vue_namespaceObject.createVNode)(button_namespaceObject["default"], {
791
- "onClick": handleCancel
792
- }, {
793
- "default": function _default() {
794
- return [state.cancelText];
795
- }
796
- })]);
806
+ }, [renderFooter()]);
797
807
  },
798
808
  close: function close() {
799
809
  return (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.Error, {
@@ -9,6 +9,7 @@ export interface Props {
9
9
  title?: string | (() => VNode | string) | VNode;
10
10
  subTitle?: string | (() => VNode) | VNode;
11
11
  content?: string | (() => VNode) | VNode;
12
+ footer?: string | (() => VNode) | VNode;
12
13
  headerAlign?: 'left' | 'center' | 'right';
13
14
  footerAlign?: 'left' | 'center' | 'right';
14
15
  contentAlign?: 'left' | 'center' | 'right';
@@ -87,7 +87,7 @@ function _defineProperty(obj, key, value) {
87
87
  ;// CONCATENATED MODULE: external "vue"
88
88
  var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
89
89
  var external_vue_y = x => () => x
90
- const external_vue_namespaceObject = external_vue_x({ ["Teleport"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Teleport, ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["mergeProps"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["useAttrs"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.useAttrs, ["useSlots"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.useSlots, ["vShow"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.vShow, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
90
+ const external_vue_namespaceObject = external_vue_x({ ["Teleport"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Teleport, ["Transition"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Transition, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["mergeProps"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["useAttrs"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.useAttrs, ["useSlots"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.useSlots, ["vShow"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.vShow, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
91
91
  ;// CONCATENATED MODULE: external "../config-provider"
92
92
  var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
93
93
  var config_provider_y = x => () => x
@@ -130,41 +130,42 @@ var useContentResize = function useContentResize(root, resizeTarget, props) {
130
130
  resolveClassName = _usePrefix.resolveClassName;
131
131
  var isContentScroll = (0,external_vue_namespaceObject.ref)(false);
132
132
  var contentStyles = (0,external_vue_namespaceObject.ref)({});
133
- var observer;
134
- var handleContentBoxChange = function handleContentBoxChange() {
135
- var calcContentScroll = (0,throttle_namespaceObject["default"])(function () {
136
- var _root$value$querySele = root.value.querySelector(".".concat(resolveClassName('modal-header'))).getBoundingClientRect(),
137
- headerHeight = _root$value$querySele.height;
138
- var _root$value$querySele2 = root.value.querySelector(".".concat(resolveClassName('modal-content'), " div")).getBoundingClientRect(),
139
- contentHeight = _root$value$querySele2.height;
140
- var _root$value$querySele3 = root.value.querySelector(".".concat(resolveClassName('modal-footer'))).getBoundingClientRect(),
141
- footerHeight = _root$value$querySele3.height;
142
- var windowInnerHeight = window.innerHeight;
143
- isContentScroll.value = windowInnerHeight < headerHeight + contentHeight + footerHeight + 20;
144
- if (isContentScroll.value || props.fullscreen) {
145
- contentStyles.value = {
146
- height: "".concat(windowInnerHeight - headerHeight - footerHeight, "px"),
147
- overflow: 'auto',
148
- 'scrollbar-gutter': 'stable'
149
- };
150
- // fullscreen 时默认为 true
151
- isContentScroll.value = true;
152
- } else {
153
- contentStyles.value = {};
154
- }
155
- }, 30);
156
- observer = new ResizeObserver(function () {
157
- calcContentScroll();
158
- });
159
- observer.observe(resizeTarget.value);
160
- calcContentScroll();
161
- };
133
+ var calcContentScroll = (0,throttle_namespaceObject["default"])(function () {
134
+ if (!props.isShow) {
135
+ // onMouted 时监听了 window resize事件这个时候 DOM 可能不存在
136
+ return;
137
+ }
138
+ var _root$value$querySele = root.value.querySelector(".".concat(resolveClassName('modal-header'))).getBoundingClientRect(),
139
+ headerHeight = _root$value$querySele.height;
140
+ var _root$value$querySele2 = root.value.querySelector(".".concat(resolveClassName('modal-content'), " div")).getBoundingClientRect(),
141
+ contentHeight = _root$value$querySele2.height;
142
+ var _root$value$querySele3 = root.value.querySelector(".".concat(resolveClassName('modal-footer'))).getBoundingClientRect(),
143
+ footerHeight = _root$value$querySele3.height;
144
+ var windowInnerHeight = window.innerHeight;
145
+ isContentScroll.value = windowInnerHeight < headerHeight + contentHeight + footerHeight + 20;
146
+ if (isContentScroll.value || props.fullscreen) {
147
+ contentStyles.value = {
148
+ height: "".concat(windowInnerHeight - headerHeight - footerHeight, "px"),
149
+ overflow: 'auto',
150
+ 'scrollbar-gutter': 'stable'
151
+ };
152
+ // fullscreen 时默认为 true
153
+ isContentScroll.value = true;
154
+ } else {
155
+ contentStyles.value = {};
156
+ }
157
+ }, 30);
162
158
  (0,external_vue_namespaceObject.watch)(function () {
163
159
  return props.isShow;
164
160
  }, function () {
161
+ var observer;
165
162
  if (props.isShow) {
166
- setTimeout(function () {
167
- handleContentBoxChange();
163
+ (0,external_vue_namespaceObject.nextTick)(function () {
164
+ observer = new ResizeObserver(function () {
165
+ calcContentScroll();
166
+ });
167
+ observer.observe(resizeTarget.value);
168
+ calcContentScroll();
168
169
  });
169
170
  } else {
170
171
  if (observer) {
@@ -175,6 +176,12 @@ var useContentResize = function useContentResize(root, resizeTarget, props) {
175
176
  }, {
176
177
  immediate: true
177
178
  });
179
+ (0,external_vue_namespaceObject.onMounted)(function () {
180
+ window.addEventListener('resize', calcContentScroll);
181
+ });
182
+ (0,external_vue_namespaceObject.onBeforeUnmount)(function () {
183
+ window.removeEventListener('resize', calcContentScroll);
184
+ });
178
185
  return {
179
186
  contentStyles: contentStyles,
180
187
  isContentScroll: isContentScroll
@@ -86,12 +86,16 @@
86
86
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
87
87
  }
88
88
  .bk-modal-content {
89
+ position: relative;
89
90
  max-height: 100vh;
90
91
  font-size: 0;
91
92
  }
92
93
  .bk-modal-content div {
93
94
  font-size: 12px;
94
95
  }
96
+ .bk-modal-footer {
97
+ position: relative;
98
+ }
95
99
  .bk-modal-close {
96
100
  position: absolute;
97
101
  top: 6px;
@@ -23,6 +23,7 @@
23
23
  }
24
24
 
25
25
  .@{bk-prefix}-modal-content {
26
+ position: relative;
26
27
  max-height: 100vh;
27
28
  font-size: 0;
28
29
 
@@ -30,6 +31,9 @@
30
31
  font-size: 12px;
31
32
  }
32
33
  }
34
+ .@{bk-prefix}-modal-footer {
35
+ position: relative;
36
+ }
33
37
 
34
38
  .@{bk-prefix}-modal-close {
35
39
  position: absolute;
@@ -215,12 +215,16 @@
215
215
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
216
216
  }
217
217
  .bk-modal-content {
218
+ position: relative;
218
219
  max-height: 100vh;
219
220
  font-size: 0;
220
221
  }
221
222
  .bk-modal-content div {
222
223
  font-size: 12px;
223
224
  }
225
+ .bk-modal-footer {
226
+ position: relative;
227
+ }
224
228
  .bk-modal-close {
225
229
  position: absolute;
226
230
  top: 6px;
@@ -681,6 +681,7 @@ sliderProps.width["default"] = '400';
681
681
  "quickClose": props.quickClose,
682
682
  "showMask": props.showMask,
683
683
  "transfer": props.transfer,
684
+ "renderDirective": props.renderDirective,
684
685
  "zIndex": props.zIndex,
685
686
  "onHidden": handleHidden,
686
687
  "onShown": handleShown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "1.0.3-beta.67.dialog.3",
3
+ "version": "1.0.3-beta.67.dialog.5",
4
4
  "workspaces": {
5
5
  "packages": [
6
6
  "packages/!(**.bak)*",