qidian-vue-ui 1.2.124 → 1.3.0

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.
Files changed (37) hide show
  1. package/dist/components/codemirror/index.vue.d.ts +1 -1
  2. package/dist/components/config-provider/index.d.ts +4 -4
  3. package/dist/components/config-provider/types.d.ts +1 -1
  4. package/dist/components/config-provider/useConfig.d.ts +4 -4
  5. package/dist/components/crud/tabs-table/index.vue.d.ts +2 -2
  6. package/dist/components/dialog/index.css +1 -1
  7. package/dist/components/dialog/index.vue.d.ts +4 -4
  8. package/dist/components/dialog/index.vue.mjs +48 -72
  9. package/dist/components/drawer/index.css +9 -0
  10. package/dist/components/drawer/index.vue.d.ts +4 -4
  11. package/dist/components/drawer/index.vue.mjs +76 -6
  12. package/dist/components/drawer/{index.vue2.mjs → index.vue3.mjs} +2 -0
  13. package/dist/components/drawer/props.d.ts +1 -1
  14. package/dist/components/drawer/props.mjs +2 -2
  15. package/dist/components/drawer/types.d.ts +1 -0
  16. package/dist/components/md-editor/index.vue.d.ts +2 -2
  17. package/dist/components/service-dialog-table-select/index.css +10 -10
  18. package/dist/components/service-dialog-table-select/index.vue.mjs +1 -1
  19. package/dist/components/service-dialog-table-select/index.vue2.mjs +1 -1
  20. package/dist/components/stream-markdown/index.css +1 -1
  21. package/dist/components/stream-markdown/index.vue.d.ts +8 -120
  22. package/dist/components/stream-markdown/index.vue.mjs +1 -1
  23. package/dist/components/stream-markdown/index.vue2.mjs +56 -20
  24. package/dist/components/stream-markdown/index2.css +1 -1
  25. package/dist/components/stream-markdown/previewers/echarts.vue2.mjs +3 -1
  26. package/dist/components/stream-markdown/previewers/markmap.vue2.mjs +3 -1
  27. package/dist/components/stream-markdown/props.d.ts +1 -0
  28. package/dist/components/stream-markdown/props.mjs +2 -1
  29. package/dist/components/stream-markdown/types.d.ts +11 -1
  30. package/dist/components/tinymce/index.vue.d.ts +1 -1
  31. package/dist/hooks/useModal.d.ts +2 -1
  32. package/dist/hooks/useModal.mjs +109 -10
  33. package/dist/index.mjs +1 -0
  34. package/dist/styles/index.css +6 -0
  35. package/dist/utils/overlayStack.d.ts +15 -0
  36. package/dist/utils/overlayStack.mjs +151 -0
  37. package/package.json +5 -4
@@ -48,7 +48,7 @@ declare const _default: import("vue").DefineComponent<QdCodemirrorProps, {
48
48
  $root: import("vue").ComponentPublicInstance | null;
49
49
  $parent: import("vue").ComponentPublicInstance | null;
50
50
  $host: Element | null;
51
- $emit: ((event: "blur", viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "change", value: string, viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "update:modelValue", value: string, viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "focus", viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "ready", payload: {
51
+ $emit: ((event: "blur", viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "change", value: string, viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "focus", viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "update:modelValue", value: string, viewUpdate: import("@codemirror/view").ViewUpdate) => void) & ((event: "ready", payload: {
52
52
  view: import("@codemirror/view").EditorView;
53
53
  state: import("@codemirror/state").EditorState;
54
54
  container: HTMLDivElement;
@@ -95,7 +95,7 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
95
95
  table?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["table"] & {
96
96
  bordered?: boolean;
97
97
  };
98
- dialog?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["dialog"] & {
98
+ wrapper?: {
99
99
  attach?: import("..").QdDialogProps["attach"];
100
100
  };
101
101
  columnsController?: {
@@ -223,7 +223,7 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
223
223
  table?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["table"] & {
224
224
  bordered?: boolean;
225
225
  };
226
- dialog?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["dialog"] & {
226
+ wrapper?: {
227
227
  attach?: import("..").QdDialogProps["attach"];
228
228
  };
229
229
  columnsController?: {
@@ -336,7 +336,7 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
336
336
  table?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["table"] & {
337
337
  bordered?: boolean;
338
338
  };
339
- dialog?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["dialog"] & {
339
+ wrapper?: {
340
340
  attach?: import("..").QdDialogProps["attach"];
341
341
  };
342
342
  columnsController?: {
@@ -377,6 +377,7 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
377
377
  tinymce: Pick<import("../tinymce").QdTinymceProps, "name" | "action" | "headers" | "method" | "formatResponse" | "bucketConfigKey" | "skinUrl" | "skinDarkUrl" | "localeUrl" | "contentCss" | "emoticonsUrl" | "externalPlugins"> | undefined;
378
378
  dict: import("../..").QdDictBaseOptions<import("../..").QdDictItem, unknown, string, string> | undefined;
379
379
  avatar: import("../..").QdAvatarBaseOptions | undefined;
380
+ locale: string | undefined;
380
381
  user: import("./types").QdUser | undefined;
381
382
  org: {
382
383
  search?: Pick<import("..").QdOrgSelectProps, "service" | "transformParams" | "transformRes">;
@@ -384,7 +385,6 @@ export declare const QdConfigProvider: import("vue").DefineComponent<{
384
385
  listOrgByIds?: import("..").QdOrgListByIdsOptions;
385
386
  } | undefined;
386
387
  agentChat: Pick<import("../..").UseAgentChatOptions, "getSessionId" | "getUrl"> | undefined;
387
- locale: string | undefined;
388
388
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
389
389
  export type { QdConfigProviderProps } from './types';
390
390
  export { useConfig as useQdConfig } from './useConfig';
@@ -110,7 +110,7 @@ export interface QdConfigProviderProps {
110
110
  table?: NonNullable<TdConfigProviderProps['globalConfig']>['table'] & {
111
111
  bordered?: boolean;
112
112
  };
113
- dialog?: NonNullable<TdConfigProviderProps['globalConfig']>['dialog'] & {
113
+ wrapper?: {
114
114
  attach?: QdDialogProps['attach'];
115
115
  };
116
116
  columnsController?: {
@@ -83,7 +83,7 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
83
83
  table?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["table"] & {
84
84
  bordered?: boolean;
85
85
  };
86
- dialog?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["dialog"] & {
86
+ wrapper?: {
87
87
  attach?: import("..").QdDialogProps["attach"];
88
88
  };
89
89
  columnsController?: {
@@ -194,7 +194,7 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
194
194
  table?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["table"] & {
195
195
  bordered?: boolean;
196
196
  };
197
- dialog?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["dialog"] & {
197
+ wrapper?: {
198
198
  attach?: import("..").QdDialogProps["attach"];
199
199
  };
200
200
  columnsController?: {
@@ -305,7 +305,7 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
305
305
  table?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["table"] & {
306
306
  bordered?: boolean;
307
307
  };
308
- dialog?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["dialog"] & {
308
+ wrapper?: {
309
309
  attach?: import("..").QdDialogProps["attach"];
310
310
  };
311
311
  columnsController?: {
@@ -417,7 +417,7 @@ export declare function useConfig<T extends keyof NonNullable<QdConfigProviderPr
417
417
  table?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["table"] & {
418
418
  bordered?: boolean;
419
419
  };
420
- dialog?: NonNullable<import("tdesign-vue-next").TdConfigProviderProps["globalConfig"]>["dialog"] & {
420
+ wrapper?: {
421
421
  attach?: import("..").QdDialogProps["attach"];
422
422
  };
423
423
  columnsController?: {
@@ -50,7 +50,6 @@ declare const _default: <D extends TableRowData = TableRowData, R = unknown, P =
50
50
  delCheckChildren?: boolean | ((context: import("../../service/table/types").QdServiceTableDeleteCheckContext<D>) => import("../../service/table/types").QdServiceTableDeleteCheckResult | Promise<import("../../service/table/types").QdServiceTableDeleteCheckResult>) | undefined;
51
51
  }) | undefined;
52
52
  loading?: (boolean | import("tdesign-vue-next").TNode) | undefined;
53
- attach?: import("tdesign-vue-next").AttachNode | undefined;
54
53
  expandIcon?: boolean | ((h: typeof import("vue").h, props: import("tdesign-vue-next").ExpandArrowRenderParams<D>) => import("tdesign-vue-next").TNodeReturnValue) | undefined;
55
54
  filterIcon?: ((h: typeof import("vue").h, props: {
56
55
  col: import("tdesign-vue-next").PrimaryTableCol<D>;
@@ -76,6 +75,8 @@ declare const _default: <D extends TableRowData = TableRowData, R = unknown, P =
76
75
  onValidate?: ((context: import("tdesign-vue-next").PrimaryTableValidateContext) => void) | undefined;
77
76
  loadingProps?: Partial<import("tdesign-vue-next").LoadingProps> | undefined;
78
77
  scroll?: import("tdesign-vue-next").TScroll | undefined;
78
+ attach?: import("tdesign-vue-next").AttachNode | undefined;
79
+ locale?: import("tdesign-vue-next").TableConfig | undefined;
79
80
  hover?: boolean | undefined;
80
81
  onBefore?: (() => void) | undefined;
81
82
  onAfter?: (() => void) | undefined;
@@ -83,7 +84,6 @@ declare const _default: <D extends TableRowData = TableRowData, R = unknown, P =
83
84
  manual?: boolean | undefined;
84
85
  height?: string | number | undefined;
85
86
  resizable?: boolean | undefined;
86
- locale?: import("tdesign-vue-next").TableConfig | undefined;
87
87
  onSelectChange?: ((selectedRowKeys: Array<string | number>, options: import("tdesign-vue-next").SelectOptions<D>) => void) | undefined;
88
88
  maxHeight?: string | number | undefined;
89
89
  onScrollY?: ((params: {
@@ -103,6 +103,6 @@
103
103
  .qd-dialog--deactivated-hidden {
104
104
  display: none;
105
105
  }
106
- .qd-dialog--transparent-overlay .t-dialog__mask {
106
+ .qd-dialog.qd-overlay--transparent .t-dialog__mask {
107
107
  opacity: 0 !important;
108
108
  }
@@ -19,19 +19,19 @@ declare const __VLS_component: import("vue").DefineComponent<QdDialogProps, {
19
19
  }>, {
20
20
  closeOnEscKeydown: boolean;
21
21
  closeOnOverlayClick: boolean;
22
+ theme: "default" | "info" | "warning" | "danger" | "success";
23
+ footer: boolean | import("tdesign-vue-next").TNode;
24
+ header: string | boolean | import("tdesign-vue-next").TNode;
22
25
  closeBtn: string | boolean | import("tdesign-vue-next").TNode;
23
26
  confirmOnEnter: boolean;
24
27
  destroyOnClose: boolean;
25
- footer: boolean | import("tdesign-vue-next").TNode;
26
- header: string | boolean | import("tdesign-vue-next").TNode;
27
28
  lazy: boolean;
28
29
  preventScrollThrough: boolean;
29
30
  showOverlay: boolean;
30
- theme: "default" | "info" | "warning" | "danger" | "success";
31
31
  width: string | number;
32
+ hideOnDeactivated: boolean;
32
33
  autoHeight: boolean;
33
34
  fullscreenBtn: boolean;
34
- hideOnDeactivated: boolean;
35
35
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
36
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
37
37
  export default _default;
@@ -1,9 +1,10 @@
1
1
  import './index.css'
2
- import { defineComponent, mergeDefaults, getCurrentInstance, reactive, ref, computed, watch, onActivated, nextTick, onBeforeUnmount, createBlock, openBlock, unref, mergeProps, isRef, createSlots, withCtx, renderSlot, createCommentVNode, Teleport, createElementBlock, resolveDynamicComponent, Fragment, renderList, normalizeProps } from "vue";
2
+ import { defineComponent, mergeDefaults, getCurrentInstance, reactive, ref, computed, watch, onActivated, nextTick, onDeactivated, onBeforeUnmount, createBlock, openBlock, unref, mergeProps, isRef, createSlots, withCtx, renderSlot, createCommentVNode, Teleport, createElementBlock, resolveDynamicComponent, Fragment, renderList, normalizeProps } from "vue";
3
3
  import { useDraggable, useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
4
4
  import { useActivated, domOn, suspectedWrapperPromise, isEmpty, filterSlots } from "qidian-shared";
5
5
  import { FullscreenExitIcon, FullscreenIcon } from "tdesign-icons-vue-next";
6
6
  import { Dialog, Divider, Button } from "tdesign-vue-next";
7
+ import { OVERLAY_TRANSPARENT_CLASS, OVERLAY_CLOSING_CLASS, updateOverlayMasks, resolveAttachParent, markPreviousOverlaysTransparent, registerOverlayEsc, setOverlayActive, unregisterOverlayEsc, setOverlayEscEnabled, focusTopOverlay } from "../../utils/overlayStack.mjs";
7
8
  import { getTransformOffset } from "../../utils/tools.mjs";
8
9
  import { useConfig } from "../config-provider/useConfig.mjs";
9
10
  import { qdDialogProps } from "./props.mjs";
@@ -71,8 +72,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
72
  let isContainerOutsideController;
72
73
  const contentVisible = ref(false);
73
74
  const openedTime = ref(0);
74
- const { t } = useConfig("dialog");
75
+ const { t } = useConfig("wrapper");
75
76
  const { activated } = useActivated();
77
+ const escEnabled = computed(
78
+ () => !confirmLoad.value && !props.confirmLoading && props.closeOnEscKeydown !== false
79
+ );
76
80
  const reProps = computed(() => {
77
81
  const {
78
82
  visible: inVisible,
@@ -89,6 +93,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
89
93
  ...dialogOptions
90
94
  } = props;
91
95
  const reConfirmLoading = confirmLoad.value || confirmLoading;
96
+ const hasMask = dialogOptions.showOverlay !== false && mode !== "normal" && mode !== "modeless";
92
97
  return {
93
98
  header,
94
99
  footerExtend,
@@ -102,7 +107,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
102
107
  attach: attach ?? t("attach") ?? "body",
103
108
  mode: currentMode.value || mode,
104
109
  confirmLoading: reConfirmLoading,
105
- closeOnEscKeydown: reConfirmLoading ? false : dialogOptions.closeOnEscKeydown,
110
+ closeOnEscKeydown: hasMask ? false : reConfirmLoading ? false : dialogOptions.closeOnEscKeydown,
106
111
  closeOnOverlayClick: reConfirmLoading ? false : dialogOptions.closeOnOverlayClick,
107
112
  closeBtn: reConfirmLoading ? false : dialogOptions.closeBtn,
108
113
  cancelBtn: reConfirmLoading ? typeof dialogOptions.cancelBtn === "object" ? { ...dialogOptions.cancelBtn, disabled: true } : { disabled: true } : dialogOptions.cancelBtn,
@@ -127,11 +132,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
127
132
  onClosed: () => {
128
133
  if (dialogOptions.destroyOnClose) contentVisible.value = false;
129
134
  dialogOptions.onClosed?.();
130
- updateMasks({ excludeClassName: uniqueClassName });
131
135
  const containerEl = document.querySelector(`.${uniqueClassName}`);
132
136
  if (containerEl) {
133
- containerEl.classList.remove("qd-dialog--transparent-overlay", "qd-dialog--closing");
137
+ containerEl.classList.remove(OVERLAY_TRANSPARENT_CLASS, OVERLAY_CLOSING_CLASS);
134
138
  }
139
+ updateOverlayMasks(
140
+ resolveAttachParent(reProps.value.dialogOptions.attach),
141
+ uniqueClassName
142
+ );
135
143
  },
136
144
  onOpened: () => {
137
145
  dialogOptions.onOpened?.();
@@ -197,66 +205,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
197
205
  () => currentMode.value === "full-screen" || reProps.value.dialogOptions.mode === "full-screen"
198
206
  );
199
207
  const dragDisabled = computed(() => visible.value ? isFullscreen.value : false);
200
- function getAttachParent() {
201
- const { attach } = reProps.value.dialogOptions;
202
- if (typeof attach === "function") {
203
- return attach();
204
- } else if (typeof attach === "string") {
205
- return document.querySelector(attach) || document.body;
206
- } else if (typeof attach === "object" && attach !== null) {
207
- return attach;
208
- } else {
209
- return document.body;
210
- }
211
- }
212
- function updateMasks(options) {
213
- const parentNode = getAttachParent();
214
- if (!parentNode) return;
215
- const qdDialogs = Array.from(parentNode.querySelectorAll(".qd-dialog")).filter((el) => {
216
- if (options?.excludeClassName && el.classList.contains(options.excludeClassName)) return false;
217
- if (el.classList.contains("qd-dialog--closing") || el.classList.contains("qd-dialog--deactivated-hidden") || getComputedStyle(el).display === "none") {
218
- return false;
219
- }
220
- const wrap = el.querySelector(".t-dialog__wrap");
221
- if (wrap && wrap.style.display === "none") return false;
222
- const mask = el.querySelector(".t-dialog__mask");
223
- if (!mask || mask.style.display === "none") return false;
224
- return true;
225
- });
226
- qdDialogs.sort((a, b) => {
227
- const timeA = Number(a.dataset.openedTime || Number.MAX_SAFE_INTEGER);
228
- const timeB = Number(b.dataset.openedTime || Number.MAX_SAFE_INTEGER);
229
- return timeA - timeB;
230
- });
231
- qdDialogs.forEach((el) => {
232
- el.classList.remove("qd-dialog--transparent-overlay");
233
- });
234
- if (qdDialogs.length > 0) {
235
- for (let i = 0; i < qdDialogs.length - 1; i++) {
236
- qdDialogs[i].classList.add("qd-dialog--transparent-overlay");
237
- }
238
- }
239
- }
240
- function updatePreviousMasksBeforeOpen() {
241
- const { showOverlay, mode } = reProps.value.dialogOptions;
242
- const hasMask = showOverlay !== false && mode !== "normal" && mode !== "modeless";
243
- if (!hasMask) return;
244
- const parentNode = getAttachParent();
245
- if (!parentNode) return;
246
- const qdDialogs = Array.from(parentNode.querySelectorAll(".qd-dialog")).filter((el) => {
247
- if (el.classList.contains(uniqueClassName) || el.classList.contains("qd-dialog--closing") || el.classList.contains("qd-dialog--deactivated-hidden") || getComputedStyle(el).display === "none") {
248
- return false;
249
- }
250
- const wrap = el.querySelector(".t-dialog__wrap");
251
- if (wrap && wrap.style.display === "none") return false;
252
- const mask = el.querySelector(".t-dialog__mask");
253
- if (!mask || mask.style.display === "none") return false;
254
- return true;
255
- });
256
- qdDialogs.forEach((el) => {
257
- el.classList.add("qd-dialog--transparent-overlay");
258
- });
259
- }
260
208
  function getDefaultFullscreenBtn(width) {
261
209
  if (width === void 0) return true;
262
210
  if (typeof width === "number") return width > 500;
@@ -283,23 +231,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
283
231
  visible,
284
232
  (val) => {
285
233
  const containerEl = document.querySelector(`.${uniqueClassName}`);
234
+ const { showOverlay, mode, attach } = reProps.value.dialogOptions;
235
+ const hasMask = showOverlay !== false && mode !== "normal" && mode !== "modeless";
236
+ const parent = resolveAttachParent(attach);
286
237
  if (val) {
287
238
  openedTime.value = performance.now();
288
- if (containerEl) containerEl.classList.remove("qd-dialog--closing");
289
- updatePreviousMasksBeforeOpen();
239
+ if (containerEl) {
240
+ containerEl.classList.remove(OVERLAY_CLOSING_CLASS, OVERLAY_TRANSPARENT_CLASS);
241
+ }
242
+ if (hasMask) {
243
+ markPreviousOverlaysTransparent(parent, uniqueClassName);
244
+ registerOverlayEsc(uniqueClassName, {
245
+ close: () => {
246
+ visible.value = false;
247
+ },
248
+ closeOnEscKeydown: escEnabled.value
249
+ });
250
+ setOverlayActive(uniqueClassName, activated.value);
251
+ }
290
252
  } else {
291
- if (containerEl) containerEl.classList.add("qd-dialog--closing");
292
- updateMasks({ excludeClassName: uniqueClassName });
253
+ if (containerEl) containerEl.classList.add(OVERLAY_CLOSING_CLASS);
254
+ updateOverlayMasks(parent, uniqueClassName);
255
+ unregisterOverlayEsc(uniqueClassName);
293
256
  }
294
257
  },
295
258
  { flush: "sync" }
296
259
  );
260
+ watch(escEnabled, (val) => {
261
+ setOverlayEscEnabled(uniqueClassName, val);
262
+ });
297
263
  onActivated(() => {
298
- if (visible.value) nextTick(updateMasks);
264
+ setOverlayActive(uniqueClassName, true);
265
+ if (!visible.value) return;
266
+ nextTick(() => {
267
+ const parent = resolveAttachParent(reProps.value.dialogOptions.attach);
268
+ updateOverlayMasks(parent);
269
+ focusTopOverlay(parent);
270
+ });
271
+ });
272
+ onDeactivated(() => {
273
+ setOverlayActive(uniqueClassName, false);
299
274
  });
300
275
  onBeforeUnmount(() => {
301
276
  isContainerOutsideController?.abort();
302
- updateMasks({ excludeClassName: uniqueClassName });
277
+ unregisterOverlayEsc(uniqueClassName);
278
+ updateOverlayMasks(resolveAttachParent(reProps.value.dialogOptions.attach), uniqueClassName);
303
279
  });
304
280
  __expose(expose);
305
281
  return (_ctx, _cache) => {
@@ -311,7 +287,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
311
287
  uniqueClassName,
312
288
  (!_ctx.$slots.footer || reProps.value.dialogOptions.footer === false || typeof reProps.value.dialogOptions.footer !== "boolean" && !reProps.value.dialogOptions.footer) && (_ctx.$slots["footer-extend"] || reProps.value.footerExtend || reProps.value.extendBtns?.length) ? "qd-dialog--has-footer-extend" : "",
313
289
  reProps.value.autoHeight ? "qd-dialog--auto-height" : "",
314
- reProps.value.hideOnDeactivated && !unref(activated) ? "qd-dialog--deactivated-hidden" : ""
290
+ reProps.value.hideOnDeactivated && !unref(activated) ? "qd-dialog--deactivated-hidden qd-overlay--deactivated" : ""
315
291
  ],
316
292
  "data-opened-time": openedTime.value || void 0,
317
293
  "dialog-style": dialogStyle.value
@@ -0,0 +1,9 @@
1
+ .qd-drawer .t-drawer__mask {
2
+ transition: opacity 0.2s linear;
3
+ }
4
+ .qd-drawer--deactivated-hidden {
5
+ display: none;
6
+ }
7
+ .qd-drawer.qd-overlay--transparent .t-drawer__mask {
8
+ opacity: 0 !important;
9
+ }
@@ -11,17 +11,17 @@ declare const __VLS_component: import("vue").DefineComponent<QdDrawerProps, {
11
11
  }, string, import("vue").PublicProps, Readonly<QdDrawerProps> & Readonly<{
12
12
  "onUpdate:visible"?: ((args_0: boolean | undefined) => any) | undefined;
13
13
  }>, {
14
+ size: string;
14
15
  closeOnEscKeydown: boolean;
15
16
  closeOnOverlayClick: boolean;
16
- attach: import("tdesign-vue-next").AttachNode;
17
- closeBtn: string | boolean | import("tdesign-vue-next").TNode;
18
- destroyOnClose: boolean;
19
17
  footer: boolean | import("tdesign-vue-next").TNode;
20
18
  header: string | boolean | import("tdesign-vue-next").TNode;
19
+ closeBtn: string | boolean | import("tdesign-vue-next").TNode;
20
+ destroyOnClose: boolean;
21
21
  lazy: boolean;
22
22
  preventScrollThrough: boolean;
23
23
  showOverlay: boolean;
24
- size: string;
24
+ hideOnDeactivated: boolean;
25
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
27
27
  export default _default;
@@ -1,7 +1,10 @@
1
- import { defineComponent, mergeDefaults, ref, computed, createBlock, openBlock, unref, mergeProps, isRef, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps } from "vue";
1
+ import './index.css'
2
+ import { defineComponent, mergeDefaults, getCurrentInstance, ref, computed, watch, onActivated, nextTick, onDeactivated, onBeforeUnmount, createBlock, openBlock, unref, mergeProps, isRef, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps } from "vue";
2
3
  import { useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
3
- import { suspectedWrapperPromise } from "qidian-shared";
4
+ import { useActivated, suspectedWrapperPromise } from "qidian-shared";
4
5
  import { Drawer } from "tdesign-vue-next";
6
+ import { resolveAttachParent, OVERLAY_CLOSING_CLASS, OVERLAY_TRANSPARENT_CLASS, markPreviousOverlaysTransparent, registerOverlayEsc, setOverlayActive, updateOverlayMasks, unregisterOverlayEsc, setOverlayEscEnabled, focusTopOverlay } from "../../utils/overlayStack.mjs";
7
+ import { useConfig } from "../config-provider/useConfig.mjs";
5
8
  import { qdDrawerProps } from "./props.mjs";
6
9
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
10
  ...{
@@ -10,6 +13,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10
13
  __name: "index",
11
14
  props: /* @__PURE__ */ mergeDefaults({
12
15
  onConfirm: { type: Function },
16
+ hideOnDeactivated: { type: Boolean },
13
17
  attach: { type: [String, Function] },
14
18
  body: {},
15
19
  cancelBtn: {},
@@ -47,14 +51,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
51
  const props = __props;
48
52
  const emit = __emit;
49
53
  const { visible } = useVModels(props, emit, { passive: true });
54
+ const { uid } = getCurrentInstance();
55
+ const uniqueClassName = `qd-drawer--${uid}`;
50
56
  const confirmLoad = ref(false);
57
+ const { t } = useConfig("wrapper");
58
+ const { activated } = useActivated();
59
+ const openedTime = ref(0);
60
+ const escEnabled = computed(
61
+ () => !confirmLoad.value && !props.confirmLoading && props.closeOnEscKeydown !== false
62
+ );
51
63
  const reProps = computed(() => {
52
- const { visible: inVisible, confirmLoading, ...drawerOptions } = props;
64
+ const { visible: inVisible, confirmLoading, hideOnDeactivated, ...drawerOptions } = props;
53
65
  const reConfirmLoading = confirmLoad.value || confirmLoading;
66
+ const hasMask = drawerOptions.showOverlay !== false;
54
67
  return {
55
68
  drawerOptions: {
56
69
  ...drawerOptions,
57
- closeOnEscKeydown: reConfirmLoading ? false : drawerOptions.closeOnEscKeydown,
70
+ attach: drawerOptions.attach ?? t("attach") ?? "body",
71
+ closeOnEscKeydown: hasMask ? false : reConfirmLoading ? false : drawerOptions.closeOnEscKeydown,
58
72
  closeOnOverlayClick: reConfirmLoading ? false : drawerOptions.closeOnOverlayClick,
59
73
  closeBtn: reConfirmLoading ? false : drawerOptions.closeBtn,
60
74
  cancelBtn: reConfirmLoading ? typeof drawerOptions.cancelBtn === "object" ? { ...drawerOptions.cancelBtn, disabled: true } : { disabled: true } : drawerOptions.cancelBtn,
@@ -72,6 +86,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
72
86
  visible.value = false;
73
87
  }
74
88
  },
89
+ hideOnDeactivated,
75
90
  models: { visible: inVisible }
76
91
  };
77
92
  });
@@ -81,12 +96,67 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
96
  function hide() {
82
97
  visible.value = false;
83
98
  }
99
+ watch(
100
+ visible,
101
+ (val) => {
102
+ const containerEl = document.querySelector(`.${uniqueClassName}`);
103
+ const { showOverlay, attach } = reProps.value.drawerOptions;
104
+ const hasMask = showOverlay !== false;
105
+ const parent = resolveAttachParent(attach);
106
+ if (val) {
107
+ openedTime.value = performance.now();
108
+ if (containerEl) {
109
+ containerEl.classList.remove(OVERLAY_CLOSING_CLASS, OVERLAY_TRANSPARENT_CLASS);
110
+ }
111
+ if (hasMask) {
112
+ markPreviousOverlaysTransparent(parent, uniqueClassName);
113
+ registerOverlayEsc(uniqueClassName, {
114
+ close: () => {
115
+ visible.value = false;
116
+ },
117
+ closeOnEscKeydown: escEnabled.value
118
+ });
119
+ setOverlayActive(uniqueClassName, activated.value);
120
+ }
121
+ } else {
122
+ if (containerEl) containerEl.classList.add(OVERLAY_CLOSING_CLASS);
123
+ updateOverlayMasks(parent, uniqueClassName);
124
+ unregisterOverlayEsc(uniqueClassName);
125
+ }
126
+ },
127
+ { flush: "sync" }
128
+ );
129
+ watch(escEnabled, (val) => {
130
+ setOverlayEscEnabled(uniqueClassName, val);
131
+ });
132
+ onActivated(() => {
133
+ setOverlayActive(uniqueClassName, true);
134
+ if (!visible.value) return;
135
+ nextTick(() => {
136
+ const parent = resolveAttachParent(reProps.value.drawerOptions.attach);
137
+ updateOverlayMasks(parent);
138
+ focusTopOverlay(parent);
139
+ });
140
+ });
141
+ onDeactivated(() => {
142
+ setOverlayActive(uniqueClassName, false);
143
+ });
144
+ onBeforeUnmount(() => {
145
+ unregisterOverlayEsc(uniqueClassName);
146
+ updateOverlayMasks(resolveAttachParent(reProps.value.drawerOptions.attach), uniqueClassName);
147
+ });
84
148
  const expose = { show, hide };
85
149
  __expose(expose);
86
150
  return (_ctx, _cache) => {
87
151
  return openBlock(), createBlock(unref(Drawer), mergeProps({
88
152
  visible: unref(visible),
89
- "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(visible) ? visible.value = $event : null)
153
+ "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(visible) ? visible.value = $event : null),
154
+ class: [
155
+ "qd-drawer",
156
+ uniqueClassName,
157
+ reProps.value.hideOnDeactivated && !unref(activated) ? "qd-drawer--deactivated-hidden qd-overlay--deactivated" : ""
158
+ ],
159
+ "data-opened-time": openedTime.value || void 0
90
160
  }, reProps.value.drawerOptions), createSlots({ _: 2 }, [
91
161
  renderList(_ctx.$slots, (_, name) => {
92
162
  return {
@@ -96,7 +166,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
96
166
  ])
97
167
  };
98
168
  })
99
- ]), 1040, ["visible"]);
169
+ ]), 1040, ["visible", "class", "data-opened-time"]);
100
170
  };
101
171
  }
102
172
  });
@@ -1,4 +1,6 @@
1
+ import './index.css'
1
2
  import _sfc_main from "./index.vue.mjs";
3
+ /* empty css */
2
4
  export {
3
5
  _sfc_main as default
4
6
  };
@@ -1,5 +1,4 @@
1
1
  export declare const qdDrawerProps: {
2
- readonly attach: "body";
3
2
  readonly size: "min(400px, 100%)";
4
3
  readonly header: true;
5
4
  readonly footer: true;
@@ -10,4 +9,5 @@ export declare const qdDrawerProps: {
10
9
  readonly lazy: true;
11
10
  readonly preventScrollThrough: true;
12
11
  readonly showOverlay: true;
12
+ readonly hideOnDeactivated: true;
13
13
  };
@@ -1,5 +1,4 @@
1
1
  const qdDrawerProps = {
2
- attach: "body",
3
2
  size: "min(400px, 100%)",
4
3
  header: true,
5
4
  footer: true,
@@ -9,7 +8,8 @@ const qdDrawerProps = {
9
8
  destroyOnClose: false,
10
9
  lazy: true,
11
10
  preventScrollThrough: true,
12
- showOverlay: true
11
+ showOverlay: true,
12
+ hideOnDeactivated: true
13
13
  };
14
14
  export {
15
15
  qdDrawerProps
@@ -2,6 +2,7 @@ import type { DrawerInstance, TdDialogProps, TdDrawerProps } from 'tdesign-vue-n
2
2
  export type QdDrawerDone = (closed: boolean) => void;
3
3
  export interface QdDrawerProps extends Omit<TdDrawerProps, 'onConfirm'>, Pick<TdDialogProps, 'confirmLoading'> {
4
4
  onConfirm?: (done: QdDrawerDone) => void | boolean | Promise<void | boolean>;
5
+ hideOnDeactivated?: boolean;
5
6
  }
6
7
  export interface QdDrawerInstanceFunctions extends Required<Pick<DrawerInstance, 'show' | 'hide'>> {
7
8
  }
@@ -76,9 +76,9 @@ declare const __VLS_component: import("vue").DefineComponent<QdMdEditorProps, {
76
76
  noEcharts: boolean;
77
77
  previewComponent: import("vue").Component;
78
78
  }> & Omit<{
79
- readonly theme: import("md-editor-v3").Themes;
80
79
  readonly placeholder: string;
81
80
  readonly class: string;
81
+ readonly theme: import("md-editor-v3").Themes;
82
82
  readonly style: string | import("vue").CSSProperties;
83
83
  readonly disabled: boolean;
84
84
  readonly modelValue: string;
@@ -156,7 +156,7 @@ declare const __VLS_component: import("vue").DefineComponent<QdMdEditorProps, {
156
156
  readonly "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined | undefined;
157
157
  readonly onOninputBoxWidthChange?: ((...args: any[]) => any) | undefined | undefined;
158
158
  readonly onOnRemount?: ((...args: any[]) => any) | undefined | undefined;
159
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "theme" | "placeholder" | "class" | "style" | "onDrop" | "onFocus" | "onBlur" | "onChange" | "onInput" | "onError" | "disabled" | "id" | "modelValue" | "language" | "preview" | "pageFullscreen" | "htmlPreview" | "onSave" | "onUploadImg" | "toolbars" | "floatingToolbars" | "toolbarsExclude" | "tabWidth" | "tableShape" | "defToolbars" | "footers" | "scrollAuto" | "defFooters" | "autoFocus" | "autoDetectCode" | "completions" | "showToolbarName" | "inputBoxWidth" | "oninputBoxWidthChange" | "transformImgUrl" | "catalogLayout" | "catalogMaxDepth" | "onHtmlChanged" | "onGetCatalog" | "showCodeRowNumber" | "mdHeadingId" | "sanitize" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList" | "customIcon" | "sanitizeMermaid" | "codeFoldable" | "autoFoldThreshold" | "onRemount" | "previewComponent" | "noPrettier" | "noUploadImg" | "readOnly" | "maxLength" | "editorId" | "previewTheme" | "noMermaid" | "noKatex" | "codeTheme" | "noHighlight" | "noImgZoomIn" | "noEcharts">;
159
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "placeholder" | "class" | "theme" | "style" | "onDrop" | "onFocus" | "onBlur" | "onChange" | "onInput" | "onError" | "disabled" | "id" | "modelValue" | "language" | "preview" | "pageFullscreen" | "htmlPreview" | "onSave" | "onUploadImg" | "toolbars" | "floatingToolbars" | "toolbarsExclude" | "tabWidth" | "tableShape" | "defToolbars" | "footers" | "scrollAuto" | "defFooters" | "autoFocus" | "autoDetectCode" | "completions" | "showToolbarName" | "inputBoxWidth" | "oninputBoxWidthChange" | "transformImgUrl" | "catalogLayout" | "catalogMaxDepth" | "onHtmlChanged" | "onGetCatalog" | "showCodeRowNumber" | "mdHeadingId" | "sanitize" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList" | "customIcon" | "sanitizeMermaid" | "codeFoldable" | "autoFoldThreshold" | "onRemount" | "previewComponent" | "noPrettier" | "noUploadImg" | "readOnly" | "maxLength" | "editorId" | "previewTheme" | "noMermaid" | "noKatex" | "codeTheme" | "noHighlight" | "noImgZoomIn" | "noEcharts">;
160
160
  $attrs: {
161
161
  [x: string]: unknown;
162
162
  };
@@ -1,31 +1,31 @@
1
- .qd-dialog-table-select[data-v-78ae8603] {
1
+ .qd-dialog-table-select[data-v-814b91a7] {
2
2
  width: 100%;
3
3
  }
4
- .qd-dialog-table-select__trigger[data-v-78ae8603] {
4
+ .qd-dialog-table-select__trigger[data-v-814b91a7] {
5
5
  width: 100%;
6
6
  }
7
- .qd-dialog-table-select__trigger[data-v-78ae8603]:not(.qd-dialog-table-select__trigger--readonly):not(.qd-dialog-table-select__trigger--disabled) {
7
+ .qd-dialog-table-select__trigger[data-v-814b91a7]:not(.qd-dialog-table-select__trigger--readonly):not(.qd-dialog-table-select__trigger--disabled) {
8
8
  cursor: pointer;
9
9
  }
10
- .qd-dialog-table-select__input-trigger[data-v-78ae8603] {
10
+ .qd-dialog-table-select__input-trigger[data-v-814b91a7] {
11
11
  border-top-left-radius: 0;
12
12
  border-bottom-left-radius: 0;
13
13
  }
14
- .qd-dialog-table-select__table[data-v-78ae8603] .qd-crud-search > .t-loading__parent > .t-card__body,
15
- .qd-dialog-table-select__table[data-v-78ae8603] .qd-crud-table__body > .t-loading__parent > .t-card__body {
14
+ .qd-dialog-table-select__table[data-v-814b91a7] .qd-crud-search > .t-loading__parent > .t-card__body,
15
+ .qd-dialog-table-select__table[data-v-814b91a7] .qd-crud-table__body > .t-loading__parent > .t-card__body {
16
16
  padding: 0 !important;
17
17
  }
18
- .qd-dialog-table-select__table[data-v-78ae8603] .qd-crud-table__toolbar {
18
+ .qd-dialog-table-select__table[data-v-814b91a7] .qd-crud-table__toolbar {
19
19
  display: none;
20
20
  }
21
- .qd-dialog-table-select__table[data-v-78ae8603] .qd-service-table {
21
+ .qd-dialog-table-select__table[data-v-814b91a7] .qd-service-table {
22
22
  margin-top: 0;
23
23
  }
24
- .qd-dialog-table-select__table-add[data-v-78ae8603] {
24
+ .qd-dialog-table-select__table-add[data-v-814b91a7] {
25
25
  margin-top: var(--td-comp-margin-m);
26
26
  display: flex;
27
27
  }
28
- .qd-dialog-table-select__table-add .t-input__wrap[data-v-78ae8603] {
28
+ .qd-dialog-table-select__table-add .t-input__wrap[data-v-814b91a7] {
29
29
  flex: 1 1 0;
30
30
  overflow: hidden;
31
31
  margin-right: var(--td-comp-margin-m);
@@ -2,7 +2,7 @@ import './index.css'
2
2
  import _sfc_main from "./index.vue2.mjs";
3
3
  /* empty css */
4
4
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
5
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-78ae8603"]]);
5
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-814b91a7"]]);
6
6
  export {
7
7
  index as default
8
8
  };