ele-admin-plus 1.5.1-beta.3 → 1.5.1-beta.4

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 (107) hide show
  1. package/es/ele-admin-layout/index.d.ts +2 -2
  2. package/es/ele-app/index.d.ts +2 -2
  3. package/es/ele-app/types.d.ts +1 -1
  4. package/es/ele-basic-select/index.d.ts +3 -3
  5. package/es/ele-buttons/components/item-render.js +47 -11
  6. package/es/ele-buttons/types.d.ts +2 -0
  7. package/es/ele-check-card/index.d.ts +2 -2
  8. package/es/ele-cropper/index.d.ts +1 -1
  9. package/es/ele-dropdown/components/pro-dropdown.d.ts +4 -4
  10. package/es/ele-dropdown/index.d.ts +2 -2
  11. package/es/ele-dropdown-provider/util.js +15 -2
  12. package/es/ele-file-list/index.d.ts +2 -2
  13. package/es/ele-icon-select/index.d.ts +4 -4
  14. package/es/ele-loading/components/main-content.js +1 -1
  15. package/es/ele-loading/index.d.ts +1 -1
  16. package/es/ele-menus/components/menu-items.d.ts +1 -1
  17. package/es/ele-modal-render/components/item-render.d.ts +5 -5
  18. package/es/ele-modal-render/components/item-render.js +10 -12
  19. package/es/ele-modal-render/index.d.ts +5 -5
  20. package/es/ele-modal-render/types.d.ts +49 -49
  21. package/es/ele-modal-render/use-modal.d.ts +1 -1
  22. package/es/ele-modal-render/util.d.ts +2 -2
  23. package/es/ele-modal-render/util.js +1 -3
  24. package/es/ele-popconfirm/index.d.ts +4 -4
  25. package/es/ele-popconfirm-provider/util.js +12 -6
  26. package/es/ele-printer/index.d.ts +2 -2
  27. package/es/ele-printer/util.d.ts +1 -1
  28. package/es/ele-printer/util.js +64 -43
  29. package/es/ele-pro-form/index.js +1 -1
  30. package/es/ele-pro-layout/index.d.ts +4 -4
  31. package/es/ele-pro-table/components/tool-column-list.d.ts +4 -0
  32. package/es/ele-pro-table/components/tool-column-list.js +15 -3
  33. package/es/ele-pro-table/components/tool-column.js +11 -2
  34. package/es/ele-pro-table/components/tool-export.js +21 -11
  35. package/es/ele-pro-table/components/tool-print.js +35 -25
  36. package/es/ele-pro-table/index.d.ts +2 -2
  37. package/es/ele-pro-table/props.d.ts +1 -1
  38. package/es/ele-pro-table/style/index.scss +3 -3
  39. package/es/ele-qr-code-svg/qrcodegen.js +1 -1
  40. package/es/ele-split-panel/index.d.ts +6 -6
  41. package/es/ele-tab-tool/index.d.ts +1 -1
  42. package/es/ele-table-select/index.d.ts +7 -7
  43. package/es/ele-tabs/index.d.ts +3 -3
  44. package/es/ele-tree-select/index.d.ts +4 -4
  45. package/es/ele-upload-list/index.d.ts +1 -1
  46. package/es/ele-viewer/util.d.ts +105 -0
  47. package/es/ele-viewer/util.js +10 -2
  48. package/es/ele-virtual-table/components/header-cell.js +1 -1
  49. package/es/utils/common.d.ts +5 -0
  50. package/es/utils/common.js +7 -0
  51. package/es/utils/hook.d.ts +0 -105
  52. package/es/utils/hook.js +0 -9
  53. package/es/utils/modal-hook.d.ts +3 -3
  54. package/lib/ele-admin-layout/index.d.ts +2 -2
  55. package/lib/ele-app/index.d.ts +2 -2
  56. package/lib/ele-app/types.d.ts +1 -1
  57. package/lib/ele-basic-select/index.d.ts +3 -3
  58. package/lib/ele-buttons/components/item-render.cjs +47 -11
  59. package/lib/ele-buttons/types.d.ts +2 -0
  60. package/lib/ele-check-card/index.d.ts +2 -2
  61. package/lib/ele-cropper/index.d.ts +1 -1
  62. package/lib/ele-dropdown/components/pro-dropdown.d.ts +4 -4
  63. package/lib/ele-dropdown/index.d.ts +2 -2
  64. package/lib/ele-dropdown-provider/util.cjs +15 -2
  65. package/lib/ele-file-list/index.d.ts +2 -2
  66. package/lib/ele-icon-select/index.d.ts +4 -4
  67. package/lib/ele-loading/components/main-content.cjs +2 -2
  68. package/lib/ele-loading/index.d.ts +1 -1
  69. package/lib/ele-menus/components/menu-items.d.ts +1 -1
  70. package/lib/ele-modal-render/components/item-render.cjs +10 -12
  71. package/lib/ele-modal-render/components/item-render.d.ts +5 -5
  72. package/lib/ele-modal-render/index.d.ts +5 -5
  73. package/lib/ele-modal-render/types.d.ts +49 -49
  74. package/lib/ele-modal-render/use-modal.d.ts +1 -1
  75. package/lib/ele-modal-render/util.cjs +1 -3
  76. package/lib/ele-modal-render/util.d.ts +2 -2
  77. package/lib/ele-popconfirm/index.d.ts +4 -4
  78. package/lib/ele-popconfirm-provider/util.cjs +12 -6
  79. package/lib/ele-printer/index.d.ts +2 -2
  80. package/lib/ele-printer/util.cjs +64 -43
  81. package/lib/ele-printer/util.d.ts +1 -1
  82. package/lib/ele-pro-form/index.cjs +2 -2
  83. package/lib/ele-pro-layout/index.d.ts +4 -4
  84. package/lib/ele-pro-table/components/tool-column-list.cjs +15 -3
  85. package/lib/ele-pro-table/components/tool-column-list.d.ts +4 -0
  86. package/lib/ele-pro-table/components/tool-column.cjs +11 -2
  87. package/lib/ele-pro-table/components/tool-export.cjs +20 -10
  88. package/lib/ele-pro-table/components/tool-print.cjs +34 -24
  89. package/lib/ele-pro-table/index.d.ts +2 -2
  90. package/lib/ele-pro-table/props.d.ts +1 -1
  91. package/lib/ele-pro-table/style/index.scss +3 -3
  92. package/lib/ele-qr-code-svg/qrcodegen.cjs +1 -1
  93. package/lib/ele-split-panel/index.d.ts +6 -6
  94. package/lib/ele-tab-tool/index.d.ts +1 -1
  95. package/lib/ele-table-select/index.d.ts +7 -7
  96. package/lib/ele-tabs/index.d.ts +3 -3
  97. package/lib/ele-tree-select/index.d.ts +4 -4
  98. package/lib/ele-upload-list/index.d.ts +1 -1
  99. package/lib/ele-viewer/util.cjs +8 -0
  100. package/lib/ele-viewer/util.d.ts +105 -0
  101. package/lib/ele-virtual-table/components/header-cell.cjs +1 -1
  102. package/lib/utils/common.cjs +7 -0
  103. package/lib/utils/common.d.ts +5 -0
  104. package/lib/utils/hook.cjs +0 -9
  105. package/lib/utils/hook.d.ts +0 -105
  106. package/lib/utils/modal-hook.d.ts +3 -3
  107. package/package.json +1 -1
@@ -11,52 +11,59 @@ import type {
11
11
  } from '../ele-app/plus';
12
12
 
13
13
  /**
14
- * 提供给内容组件的弹窗数据
14
+ * 弹窗 id
15
15
  */
16
- export interface ModalHolderProvider {
17
- /** 关闭弹窗方法 */
18
- closeModal: () => void;
19
- /** 移除弹窗方法 */
20
- removeModal: () => void;
21
- /** 修改弹窗属性方法 */
22
- setModalProps: (option?: Record<string, any>) => void;
23
- /** 弹窗属性 */
24
- modalProps: Ref<EleModalPropsAndEmits | EleDrawerPropsAndEmits>;
25
- }
16
+ export type ModalItemId = string | number;
26
17
 
27
18
  /**
28
19
  * 弹窗类型
29
20
  */
30
- export type ModalItemType = 'modal' | 'drawer';
21
+ export type ModalItemType = 'modal' | 'drawer' | 'custom';
31
22
 
32
23
  /**
33
- * 弹窗 id
24
+ * 弹窗组件属性
34
25
  */
35
- export type ModalItemId = string | number;
26
+ export type ModalItemProps<T extends ModalItemType> = T extends 'drawer'
27
+ ? EleDrawerPropsAndEmits
28
+ : T extends 'modal'
29
+ ? EleModalPropsAndEmits
30
+ : Record<string, any>;
36
31
 
37
32
  /**
38
- * 弹窗内容组件属性
33
+ * 提供给内容组件的弹窗数据
39
34
  */
40
- export type ModalItemComponentProps =
41
- | Record<string, any>
42
- | ((data: ModalHolderProvider) => Record<string, any>);
35
+ export interface ModalHolderProvider<T extends ModalItemType> {
36
+ /** 关闭弹窗方法 */
37
+ closeModal: () => void;
38
+ /** 移除弹窗方法 */
39
+ removeModal: () => void;
40
+ /** 修改弹窗属性方法 */
41
+ setModalProps: (option?: ModalItemProps<T>) => void;
42
+ /** 弹窗属性 */
43
+ modalProps: Ref<ModalItemProps<T>>;
44
+ }
43
45
 
44
46
  /**
45
47
  * 弹窗数据配置
46
48
  */
47
- export interface ModalItemOption<T extends ModalItemType> {
49
+ export interface ModalItem<
50
+ T extends ModalItemType,
51
+ P extends Record<string, any>
52
+ > {
48
53
  /** 弹窗类型 */
49
54
  type?: T;
50
55
  /** 弹窗内容组件 */
51
- component?: UserComponent;
56
+ component?: UserComponent<P>;
52
57
  /** 弹窗内容异步组件 */
53
- asyncComponent?: AsyncComponentLoader;
58
+ asyncComponent?: AsyncComponentLoader<Component<P>>;
54
59
  /** 弹窗内容异步组件配置 */
55
60
  asyncComponentOptions?: Partial<AsyncComponentOptions>;
56
61
  /** 弹窗内容组件属性 */
57
- componentProps?: ModalItemComponentProps;
62
+ componentProps?:
63
+ | (Record<string, any> & P)
64
+ | ((data: ModalHolderProvider<T>) => Record<string, any> & P);
58
65
  /** 弹窗属性 */
59
- props?: T extends 'drawer' ? EleDrawerPropsAndEmits : EleModalPropsAndEmits;
66
+ props?: ModalItemProps<T>;
60
67
  /** 传递插槽 */
61
68
  slots?: SlotObject;
62
69
  /** 是否自定义弹窗组件 */
@@ -73,17 +80,14 @@ export interface ModalItemOption<T extends ModalItemType> {
73
80
  modalId?: ModalItemId;
74
81
  }
75
82
 
76
- /**
77
- * 打开的弹窗数据
78
- */
79
- export type ModalItem = ModalItemOption<'drawer'> | ModalItemOption<'modal'>;
80
-
81
83
  /**
82
84
  * 提供给后代组件的弹窗操作方法
83
85
  */
84
86
  export interface ModalUtilProvider {
85
87
  /** 打开弹窗 */
86
- openModal: (option: ModalItem) => ModalItemId;
88
+ openModal: <T extends ModalItemType, P extends Record<string, any>>(
89
+ option: ModalItem<T, P>
90
+ ) => ModalItemId;
87
91
  /** 关闭弹窗 */
88
92
  closeModal: (modalId?: ModalItemId) => void;
89
93
  /** 关闭所有弹窗 */
@@ -91,32 +95,28 @@ export interface ModalUtilProvider {
91
95
  /** 修改弹窗失活状态 */
92
96
  updateModalState: (modalId?: ModalItemId, deactivated?: boolean) => void;
93
97
  /** 修改弹窗属性 */
94
- updateModalProps: (
98
+ updateModalProps: <T extends ModalItemType>(
95
99
  modalId?: ModalItemId,
96
- option?: Record<string, any>
100
+ option?: ModalItemProps<T>
97
101
  ) => void;
98
102
  }
99
103
 
100
104
  /**
101
105
  * 弹窗操作方法
102
106
  */
103
- export interface UseModalMethods<T extends ModalItemType | unknown = unknown> {
107
+ export interface UseModalMethods {
104
108
  /** 打开弹窗 */
105
- openModal: (
106
- option: T extends 'drawer'
107
- ? ModalItemOption<'drawer'>
108
- : T extends 'modal'
109
- ? ModalItemOption<'modal'>
110
- : ModalItem
109
+ openModal: <T extends ModalItemType, P extends Record<string, any>>(
110
+ option: ModalItem<T, P>
111
111
  ) => ModalItemId;
112
112
  /** 关闭所有弹窗(是否只关闭当前组件中打开的弹窗) */
113
113
  closeAllModal: (current?: boolean) => void;
114
114
  /** 关闭弹窗(指定弹窗 id 或者当前内容组件所在弹窗) */
115
115
  closeModal: (modalId?: ModalItemId) => void;
116
116
  /** 修改弹窗属性(指定弹窗 id 或者当前内容组件所在弹窗) */
117
- setModalProps: (
118
- modalId?: ModalItemId | Record<string, any>,
119
- options?: Record<string, any>
117
+ setModalProps: <T extends ModalItemType>(
118
+ modalId?: ModalItemId | ModalItemProps<T>,
119
+ options?: ModalItemProps<T>
120
120
  ) => void;
121
121
  }
122
122
 
@@ -124,17 +124,19 @@ export interface UseModalMethods<T extends ModalItemType | unknown = unknown> {
124
124
  * useModalRender 返回类型
125
125
  */
126
126
  export interface UseModalRenderResult {
127
- modals: Ref<ModalItem[]>;
128
- openModal: (option: ModalItem) => ModalItemId;
127
+ modals: Ref<ModalItem<ModalItemType, Record<string, any>>[]>;
128
+ openModal: <T extends ModalItemType, P extends Record<string, any>>(
129
+ option: ModalItem<T, P>
130
+ ) => ModalItemId;
129
131
  closeModal: (modalId?: ModalItemId) => void;
130
132
  closeAllModal: () => void;
131
133
  removeModal: (modalId?: ModalItemId) => void;
132
134
  removeAllModal: () => void;
133
135
  updateModalVisible: (modalId?: ModalItemId, visible?: boolean) => void;
134
136
  updateModalState: (modalId?: ModalItemId, deactivated?: boolean) => void;
135
- updateModalProps: (
137
+ updateModalProps: <T extends ModalItemType>(
136
138
  modalId?: ModalItemId,
137
- option?: Record<string, any>
139
+ option?: ModalItemProps<T>
138
140
  ) => void;
139
141
  }
140
142
 
@@ -142,9 +144,7 @@ export interface UseModalRenderResult {
142
144
  * useModal 返回类型
143
145
  */
144
146
  export interface UseModalResult<T extends ModalItemType>
145
- extends UseModalMethods<T> {
147
+ extends UseModalMethods {
146
148
  ModalHolder: Component;
147
- modalProps?: Ref<
148
- T extends 'drawer' ? EleDrawerPropsAndEmits : EleModalPropsAndEmits
149
- >;
149
+ modalProps?: Ref<ModalItemProps<T>>;
150
150
  }
@@ -1,3 +1,3 @@
1
- import { UseModalResult, ModalItemType } from './types';
1
+ import { ModalItemType, UseModalResult } from './types';
2
2
 
3
3
  export declare function useModal<T extends ModalItemType>(): UseModalResult<T>;
@@ -1,5 +1,5 @@
1
1
  import { InjectionKey } from 'vue';
2
- import { ModalUtilProvider, ModalHolderProvider, UseModalRenderResult } from './types';
2
+ import { ModalItemType, ModalUtilProvider, ModalHolderProvider, UseModalRenderResult } from './types';
3
3
 
4
4
  /**
5
5
  * 弹窗渲染器容器注入键名
@@ -8,7 +8,7 @@ export declare const MODAL_UTIL_KEY: InjectionKey<ModalUtilProvider>;
8
8
  /**
9
9
  * 直接父级的弹窗渲染器注入键名
10
10
  */
11
- export declare const MODAL_HOLDER_KEY: InjectionKey<ModalHolderProvider>;
11
+ export declare const MODAL_HOLDER_KEY: InjectionKey<ModalHolderProvider<ModalItemType>>;
12
12
  /**
13
13
  * 弹窗渲染器数据操作
14
14
  */
@@ -3,9 +3,7 @@ import ModalLoading from "./components/modal-loading";
3
3
  const MODAL_UTIL_KEY = Symbol(
4
4
  "modalUtil"
5
5
  );
6
- const MODAL_HOLDER_KEY = Symbol(
7
- "modalHolder"
8
- );
6
+ const MODAL_HOLDER_KEY = Symbol("modalHolder");
9
7
  function getItemComponent(item, onLoaded) {
10
8
  const { component, asyncComponent, custom, asyncComponentOptions } = item;
11
9
  if (component && typeof component === "object") {
@@ -218,8 +218,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
218
218
  hidePopper: () => void;
219
219
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
220
220
  cancel: (_e: MouseEvent) => void;
221
- confirm: (_e: MouseEvent) => void;
222
221
  "update:visible": (value: boolean) => void;
222
+ confirm: (_e: MouseEvent) => void;
223
223
  "before-enter": () => void;
224
224
  "before-leave": () => void;
225
225
  "after-enter": () => void;
@@ -422,8 +422,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
422
422
  arrowBg: StringConstructor;
423
423
  }>> & Readonly<{
424
424
  onCancel?: ((_e: MouseEvent) => any) | undefined;
425
- onConfirm?: ((_e: MouseEvent) => any) | undefined;
426
425
  "onUpdate:visible"?: ((value: boolean) => any) | undefined;
426
+ onConfirm?: ((_e: MouseEvent) => any) | undefined;
427
427
  "onBefore-enter"?: (() => any) | undefined;
428
428
  "onBefore-leave"?: (() => any) | undefined;
429
429
  "onAfter-enter"?: (() => any) | undefined;
@@ -451,8 +451,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
451
451
  arrowOffset: number;
452
452
  virtualTriggering: boolean;
453
453
  gpuAcceleration: boolean;
454
- confirmButtonType: ("" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text") | undefined;
455
- cancelButtonType: ("" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text") | undefined;
454
+ confirmButtonType: ("" | "success" | "primary" | "warning" | "info" | "default" | "danger" | "text") | undefined;
455
+ cancelButtonType: ("" | "success" | "primary" | "warning" | "info" | "default" | "danger" | "text") | undefined;
456
456
  iconColor: string;
457
457
  hideIcon: boolean;
458
458
  hideConfirmButton: boolean;
@@ -7,18 +7,24 @@ function usePopconfirmProvider() {
7
7
  const popconfirmVirtualRef = shallowRef();
8
8
  const popconfirmProps = shallowRef({});
9
9
  const openPopconfirm = (triggerEl, props) => {
10
- if (triggerEl == null || popconfirmVirtualRef.value === triggerEl) {
10
+ if (triggerEl == null) {
11
+ return;
12
+ }
13
+ if (popconfirmVirtualRef.value === triggerEl) {
14
+ popconfirmProps.value = props || {};
11
15
  return;
12
16
  }
13
17
  popconfirmRef.value && popconfirmRef.value.hidePopper();
14
18
  nextTick(() => {
15
19
  popconfirmProps.value = props || {};
16
20
  popconfirmVirtualRef.value = triggerEl;
17
- nextTick(() => {
18
- if (popconfirmRef.value) {
19
- unref(popconfirmRef.value.tooltipRef)?.handleOpen?.();
20
- }
21
- });
21
+ if (!popconfirmProps.value.disabled) {
22
+ nextTick(() => {
23
+ if (popconfirmRef.value) {
24
+ unref(popconfirmRef.value.tooltipRef)?.handleOpen?.();
25
+ }
26
+ });
27
+ }
22
28
  });
23
29
  };
24
30
  provide(POPCONFIRM_KEY, {
@@ -18,8 +18,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
18
18
  }>, {
19
19
  print: (options?: any) => void;
20
20
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
- "update:modelValue": (_value: boolean) => void;
22
21
  done: () => void;
22
+ "update:modelValue": (_value: boolean) => void;
23
23
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
24
24
  modelValue: BooleanConstructor;
25
25
  headerStyle: import('vue').PropType<import('../ele-app/types').StyleValue>;
@@ -33,8 +33,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
33
33
  static: BooleanConstructor;
34
34
  options: ObjectConstructor;
35
35
  }>> & Readonly<{
36
- "onUpdate:modelValue"?: ((_value: boolean) => any) | undefined;
37
36
  onDone?: (() => any) | undefined;
37
+ "onUpdate:modelValue"?: ((_value: boolean) => any) | undefined;
38
38
  }>, {
39
39
  modelValue: boolean;
40
40
  static: boolean;
@@ -8,7 +8,7 @@ export declare const printingClass = "ele-printing";
8
8
  * @param options 参数
9
9
  * @param userOptions 自定义参数
10
10
  */
11
- export declare function mergeOptions(options?: any, userOptions?: any): any;
11
+ export declare function mergeOptions(options?: Record<string, any>, userOptions?: Record<string, any>): Record<string, any> | undefined;
12
12
  /**
13
13
  * 创建并获取打印容器
14
14
  */
@@ -1,5 +1,6 @@
1
1
  import { onBeforeUnmount } from "vue";
2
2
  import { useTimer } from "../utils/hook";
3
+ import { escape } from "../utils/common";
3
4
  const printContainerId = "ele-printer-container";
4
5
  const printFrameId = "ele-printer-iframe";
5
6
  const printingClass = "ele-printing";
@@ -20,28 +21,13 @@ function getPrintContainer() {
20
21
  document.body.appendChild(elem);
21
22
  return elem;
22
23
  }
23
- function getOptionCss(opt) {
24
- const css = ["@page {"];
25
- if (opt.margin != null && opt.margin !== "") {
26
- const v = typeof opt.margin === "number" ? opt.margin + "px" : opt.margin;
27
- css.push(`margin: ${v};`);
28
- }
29
- if (opt.direction != null && opt.direction !== "") {
30
- css.push(`size: ${opt.direction};`);
31
- }
32
- if (opt.orientation != null && opt.orientation !== "") {
33
- css.push(`page-orientation: ${opt.orientation};`);
34
- }
35
- css.push("}");
36
- return css.join(" ");
37
- }
38
24
  function removePrintFrame() {
39
25
  const pFrame = document.getElementById(printFrameId);
40
26
  if (pFrame) {
27
+ const url = pFrame.getAttribute("src");
41
28
  if (pFrame.parentNode) {
42
29
  pFrame.parentNode.removeChild(pFrame);
43
30
  }
44
- const url = pFrame.getAttribute("src");
45
31
  if (url) {
46
32
  try {
47
33
  window.URL.revokeObjectURL(url);
@@ -64,6 +50,39 @@ function getPrintFrame() {
64
50
  elem.focus();
65
51
  return elem;
66
52
  }
53
+ function getOptionCss(opt) {
54
+ const css = ["@page {"];
55
+ if (opt.margin != null && opt.margin !== "") {
56
+ const v = typeof opt.margin === "number" ? `${opt.margin}px` : opt.margin;
57
+ css.push(`margin: ${escape(v)};`);
58
+ }
59
+ if (opt.direction != null && opt.direction !== "") {
60
+ css.push(`size: ${escape(opt.direction)};`);
61
+ }
62
+ if (opt.orientation != null && opt.orientation !== "") {
63
+ css.push(`page-orientation: ${escape(opt.orientation)};`);
64
+ }
65
+ css.push("}");
66
+ return css.join(" ");
67
+ }
68
+ function initFormEl(containerEl) {
69
+ Array.from(containerEl.querySelectorAll("input")).forEach(
70
+ (el) => {
71
+ if (el.value === "") {
72
+ const type = el.getAttribute("type");
73
+ if (type && ["button", "submit", "reset"].includes(type)) {
74
+ return;
75
+ }
76
+ }
77
+ el.setAttribute("value", el.value);
78
+ }
79
+ );
80
+ Array.from(containerEl.querySelectorAll("textarea")).forEach(
81
+ (el) => {
82
+ el.innerText = el.value;
83
+ }
84
+ );
85
+ }
67
86
  function doPrintOnFrame(opt, printId, timeout) {
68
87
  const pFrame = getPrintFrame();
69
88
  const pWin = pFrame.contentWindow;
@@ -75,36 +94,31 @@ function doPrintOnFrame(opt, printId, timeout) {
75
94
  if (!pDoc) {
76
95
  return;
77
96
  }
78
- const container = getPrintContainer();
79
- Array.from(
80
- container.querySelectorAll('input[type="text"], input[type="number"]')
81
- ).forEach((el) => {
82
- el.setAttribute("value", el.value);
83
- });
84
- pDoc.open();
85
- const printOption = opt.options ? `JSON.parse('${JSON.stringify(opt.options)}')` : "";
97
+ initFormEl(getPrintContainer());
98
+ const printOption = opt.options ? `JSON.parse(${JSON.stringify(JSON.stringify(opt.options))})` : "";
99
+ const printJsStr = `window.print(${printOption});
100
+ window.parent.postMessage('elePrintDone_${Number(printId)}', '*');`;
101
+ const printJsFuncStr = `setTimeout(function() { ${printJsStr} }, ${Number(timeout)});`;
102
+ const printTitle = opt.title ? JSON.stringify(String(opt.title)) : void 0;
86
103
  const optHtml = `
87
104
  <style type="text/css" media="print">
88
105
  ${getOptionCss(opt)}
89
106
  </style>
90
107
  <script>
91
- const $html = document.querySelector('html');
108
+ const $html = document.documentElement;
92
109
  if($html && $html.classList && $html.classList.add) {
93
110
  $html.classList.add('${printingClass}');
94
111
  }
95
112
  window.onload = function() {
96
- if(${opt.title == null ? 0 : 1}) {
97
- document.title = '${opt.title}';
113
+ if(${printTitle == null ? 0 : 1}) {
114
+ document.title = ${printTitle};
98
115
  }
99
- ${"setTimeout(() => {"}
100
- window.print(${printOption});
101
- window.parent.postMessage('elePrintDone_${printId}', '*');
102
- ${["}, ", timeout, ");"].join("")}
116
+ ${printJsFuncStr}
103
117
  };
104
118
  <\/script>
105
119
  `;
106
- const html = document.querySelector("html")?.outerHTML || "";
107
- const content = html.replace(/<script/g, '<textarea style="display:none;" ').replace(/<\/script>/g, "</textarea>").replace(/<\/html>/, optHtml + "</html>");
120
+ const content = document.documentElement.outerHTML.replace(/<script/g, '<textarea style="display:none;" ').replace(/<\/script>/g, "</textarea>").replace(/<\/html>/, `${optHtml}</html>`);
121
+ pDoc.open();
108
122
  pDoc.write(`<!DOCTYPE html>${content}`);
109
123
  pDoc.close();
110
124
  return pWin;
@@ -119,7 +133,7 @@ function usePrinter(done) {
119
133
  doPrintOnFrame(option, printId, printTimeout);
120
134
  return;
121
135
  }
122
- const $html = document.querySelector("html");
136
+ const $html = document.documentElement;
123
137
  if (!$html) {
124
138
  done && done();
125
139
  return;
@@ -171,18 +185,25 @@ function printPdf(option) {
171
185
  try {
172
186
  pFrame.contentWindow && pFrame.contentWindow.print(option.options);
173
187
  option.done && option.done();
174
- window.URL.revokeObjectURL(url);
175
- return;
188
+ try {
189
+ window.URL.revokeObjectURL(url);
190
+ } catch (e) {
191
+ console.error(e);
192
+ }
176
193
  } catch (e) {
177
194
  console.error(e);
195
+ if (!option.arraybuffer && option.url) {
196
+ try {
197
+ window.URL.revokeObjectURL(url);
198
+ } catch (e2) {
199
+ console.error(e2);
200
+ }
201
+ window.open(option.url);
202
+ } else {
203
+ window.open(url);
204
+ }
205
+ option.done && option.done();
178
206
  }
179
- if (!option.arraybuffer && option.url) {
180
- window.URL.revokeObjectURL(url);
181
- window.open(option.url);
182
- } else {
183
- window.open(url);
184
- }
185
- option.done && option.done();
186
207
  };
187
208
  const doPrint = (buffer) => {
188
209
  const blob = new window.Blob([buffer], { type: "application/pdf" });
@@ -2,7 +2,7 @@ import { defineComponent, useModel, ref, computed, watch, onBeforeUnmount, creat
2
2
  import { ElForm } from "element-plus";
3
3
  import { useLocale } from "../ele-config-provider/receiver";
4
4
  import { eachTree } from "../utils/common";
5
- import { useContentSlot } from "../utils/hook";
5
+ import { useContentSlot } from "../ele-viewer/util";
6
6
  import { translateJsCode } from "./components/render-core";
7
7
  import { ChildrenRender } from "./components/render-util";
8
8
  import ProFormFooter from "./components/pro-form-footer";
@@ -183,10 +183,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
183
183
  };
184
184
  }>, {
185
185
  layoutRef: import('vue').Ref<EleAdminLayoutInstance, EleAdminLayoutInstance>;
186
- openModal: (option: import('../ele-modal-render/types').ModalItem) => import('../ele-modal-render/types').ModalItemId;
186
+ openModal: <T extends import('../ele-modal-render/types').ModalItemType, P extends Record<string, any>>(option: import('../ele-modal-render/types').ModalItem<T, P>) => import('../ele-modal-render/types').ModalItemId;
187
187
  closeModal: (modalId?: import('../ele-modal-render/types').ModalItemId) => void;
188
188
  closeAllModal: () => void;
189
- updateModalProps: (modalId?: import('../ele-modal-render/types').ModalItemId, option?: Record<string, any>) => void;
189
+ updateModalProps: <T extends import('../ele-modal-render/types').ModalItemType>(modalId?: import('../ele-modal-render/types').ModalItemId, option?: import('../ele-modal-render/types').ModalItemProps<T>) => void;
190
190
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
191
191
  tabContextMenu: (_option: TabItemEventOption) => void;
192
192
  "update:maximized": (_maximized: boolean) => void;
@@ -370,11 +370,12 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
370
370
  }>, {
371
371
  height: string | number;
372
372
  transitionDelay: number;
373
- expanded: boolean;
374
373
  uniqueOpened: boolean;
375
374
  collapse: boolean;
376
375
  ellipsis: boolean;
376
+ expanded: boolean;
377
377
  compact: boolean;
378
+ responsive: boolean;
378
379
  tabBar: TabBar;
379
380
  breadcrumb: boolean | EleBreadcrumbProps;
380
381
  backTop: boolean | EleBacktopProps;
@@ -394,7 +395,6 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
394
395
  sideboxIconSlot: string;
395
396
  menuScrollToActive: boolean;
396
397
  keepAlive: boolean;
397
- responsive: boolean;
398
398
  redirectPath: string;
399
399
  fluid: boolean;
400
400
  compressOnEsc: boolean;
@@ -22,6 +22,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
22
22
  fixedLeftTooltip: (_el: HTMLElement) => void;
23
23
  fixedRightTooltip: (_el: HTMLElement) => void;
24
24
  colWidthChange: (_item: ColItem, _width?: string | number | undefined) => void;
25
+ sortStart: () => void;
26
+ sortEnd: () => void;
25
27
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
26
28
  /** 列配置数据 */
27
29
  data: PropType<ColItem[]>;
@@ -43,6 +45,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
43
45
  onFixedLeftTooltip?: ((_el: HTMLElement) => any) | undefined;
44
46
  onFixedRightTooltip?: ((_el: HTMLElement) => any) | undefined;
45
47
  onColWidthChange?: ((_item: ColItem, _width?: string | number | undefined) => any) | undefined;
48
+ onSortStart?: (() => any) | undefined;
49
+ onSortEnd?: (() => any) | undefined;
46
50
  }>, {
47
51
  sortable: boolean;
48
52
  allowFixed: boolean;
@@ -44,7 +44,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
44
44
  fixedRight: (_item) => true,
45
45
  fixedLeftTooltip: (_el) => true,
46
46
  fixedRightTooltip: (_el) => true,
47
- colWidthChange: (_item, _width) => true
47
+ colWidthChange: (_item, _width) => true,
48
+ sortStart: () => true,
49
+ sortEnd: () => true
48
50
  },
49
51
  setup(__props, { emit: __emit }) {
50
52
  const props = __props;
@@ -88,6 +90,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
88
90
  const handleSortChange = (colItems) => {
89
91
  handleChildSortChange(colItems, props.parent);
90
92
  };
93
+ const handleSortStart = () => {
94
+ emit("sortStart");
95
+ };
96
+ const handleSortEnd = () => {
97
+ emit("sortEnd");
98
+ };
91
99
  return (_ctx, _cache) => {
92
100
  const _component_ToolColumnList = resolveComponent("ToolColumnList", true);
93
101
  return openBlock(), createBlock(unref(VueDraggable), {
@@ -98,7 +106,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
98
106
  handle: ".ele-tool-column-handle",
99
107
  componentData: { class: "ele-tool-column-list" },
100
108
  forceFallback: true,
101
- "onUpdate:modelValue": handleSortChange
109
+ "onUpdate:modelValue": handleSortChange,
110
+ onStart: handleSortStart,
111
+ onEnd: handleSortEnd
102
112
  }, {
103
113
  item: withCtx(({ element: d }) => [
104
114
  createElementVNode("div", _hoisted_1, [
@@ -167,7 +177,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
167
177
  onFixedRight: handleFixedRight,
168
178
  onFixedLeftTooltip: handleChildFixedLeftTooltip,
169
179
  onFixedRightTooltip: handleChildFixedRightTooltip,
170
- onColWidthChange: handleColWidthChange
180
+ onColWidthChange: handleColWidthChange,
181
+ onSortStart: handleSortStart,
182
+ onSortEnd: handleSortEnd
171
183
  }, null, 8, ["data", "parent", "sortable", "allowWidth", "columnWidthPlaceholder"])) : createCommentVNode("", true)
172
184
  ])
173
185
  ]),
@@ -38,6 +38,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
38
38
  const colItems = ref([]);
39
39
  const isCheckAll = ref(false);
40
40
  const isIndeterminate = ref(false);
41
+ const isDragging = ref(false);
41
42
  const initColItems = () => {
42
43
  const { cols, checkAll, indeterminate } = getColItems(
43
44
  props.columns,
@@ -162,6 +163,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
162
163
  initColItems();
163
164
  updateColumns(true);
164
165
  };
166
+ const handleSortStart = () => {
167
+ isDragging.value = true;
168
+ };
169
+ const handleSortEnd = () => {
170
+ isDragging.value = false;
171
+ };
165
172
  watch(
166
173
  [() => props.columns, () => props.locale],
167
174
  () => {
@@ -193,7 +200,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
193
200
  }, {
194
201
  body: withCtx(() => [
195
202
  createElementVNode("div", {
196
- class: normalizeClass(["ele-popover-body ele-tool-column", { "is-sortable": __props.sortable }])
203
+ class: normalizeClass(["ele-popover-body ele-tool-column", [{ "is-sortable": __props.sortable }, { "is-dragging": isDragging.value }]])
197
204
  }, [
198
205
  createElementVNode("div", _hoisted_1, [
199
206
  createElementVNode("div", _hoisted_2, [
@@ -219,7 +226,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
219
226
  onFixedLeft: handleFixedLeft,
220
227
  onFixedRight: handleFixedRight,
221
228
  onFixedLeftTooltip: handleFixedLeftTooltip,
222
- onFixedRightTooltip: handleFixedRightTooltip
229
+ onFixedRightTooltip: handleFixedRightTooltip,
230
+ onSortStart: handleSortStart,
231
+ onSortEnd: handleSortEnd
223
232
  }, null, 8, ["data", "sortable", "allowFixed"])) : createCommentVNode("", true)
224
233
  ], 2)
225
234
  ]),