hys-ui 0.2.0 → 0.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 (201) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +15 -1
  3. package/dist/components/HysAlert/HysAlert.vue.js +5 -54
  4. package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
  5. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
  6. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
  7. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
  8. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
  9. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
  10. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
  11. package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
  12. package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
  13. package/dist/components/HysCascader/HysCascader.vue.js +2 -2
  14. package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
  15. package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
  16. package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
  17. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  18. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
  19. package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
  20. package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
  21. package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
  22. package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
  23. package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
  24. package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
  25. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  26. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
  27. package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
  28. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
  29. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
  30. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
  31. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  32. package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
  33. package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
  34. package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
  35. package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
  36. package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
  37. package/dist/components/HysGantt/HysGantt.vue.js +1 -1
  38. package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
  39. package/dist/components/HysMention/HysMention.vue.js +1 -1
  40. package/dist/components/HysMention/HysMention2.vue.js +112 -100
  41. package/dist/components/HysModal/HysModal.vue.js +2 -2
  42. package/dist/components/HysModal/HysModal2.vue.js +490 -85
  43. package/dist/components/HysPopover/HysPopover.vue.js +5 -91
  44. package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
  45. package/dist/components/HysProgress/HysProgress.vue.js +2 -2
  46. package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
  47. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  48. package/dist/components/HysSelect/HysSelect2.vue.js +730 -594
  49. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  50. package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
  51. package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
  52. package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
  53. package/dist/components/HysTable/HysTable.vue.js +2 -2
  54. package/dist/components/HysTable/HysTable2.vue.js +389 -368
  55. package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
  56. package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
  57. package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
  58. package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
  59. package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
  60. package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
  61. package/dist/components/HysTour/HysTour.vue.js +46 -42
  62. package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
  63. package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
  64. package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
  65. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
  66. package/dist/components/HysTree/HysTree.vue.js +2 -2
  67. package/dist/components/HysTree/HysTree2.vue.js +195 -184
  68. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
  69. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
  70. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  71. package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
  72. package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
  73. package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
  74. package/dist/composables/color.js +97 -0
  75. package/dist/composables/dataGrid.js +68 -0
  76. package/dist/composables/drawer.js +17 -0
  77. package/dist/composables/feedback.js +14 -0
  78. package/dist/composables/menu.js +96 -0
  79. package/dist/composables/modal.js +14 -0
  80. package/dist/composables/overlayManager.js +48 -18
  81. package/dist/composables/progress.js +94 -0
  82. package/dist/composables/tagInput.js +16 -0
  83. package/dist/composables/timeline.js +19 -0
  84. package/dist/composables/transfer.js +19 -17
  85. package/dist/composables/upload.js +55 -0
  86. package/dist/composables/uploadRequest.js +58 -0
  87. package/dist/composables/useAlert.js +124 -0
  88. package/dist/composables/useColorPicker.js +402 -0
  89. package/dist/composables/useContextMenu.js +514 -0
  90. package/dist/composables/useDataGridRemote.js +67 -0
  91. package/dist/composables/useDialog.js +86 -43
  92. package/dist/composables/useDrawerPush.js +33 -0
  93. package/dist/composables/useDrawerResize.js +221 -0
  94. package/dist/composables/useFloating.js +110 -76
  95. package/dist/composables/useHysModal.js +185 -0
  96. package/dist/composables/useModal.js +295 -0
  97. package/dist/composables/useModalInteraction.js +394 -0
  98. package/dist/composables/usePopupSurface.js +458 -0
  99. package/dist/composables/useTagInput.js +313 -0
  100. package/dist/composables/useTransferMotion.js +185 -0
  101. package/dist/composables/useUpload.js +472 -0
  102. package/dist/composables/useUploadModel.js +65 -0
  103. package/dist/composables/useUploadRequests.js +266 -0
  104. package/dist/composables/useVirtualTableLayout.js +277 -0
  105. package/dist/composables/virtualTable.js +43 -0
  106. package/dist/index.js +27 -24
  107. package/dist/internal/PopupReference.js +39 -0
  108. package/dist/internal/PopupSurfacePanel.vue.js +7 -0
  109. package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
  110. package/dist/motion/PopupMotion.js +105 -0
  111. package/dist/motion/popup.js +10 -0
  112. package/dist/style.css +1 -1
  113. package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
  114. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
  115. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
  116. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
  117. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
  118. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
  119. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
  120. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  121. package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
  122. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
  123. package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
  124. package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
  125. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
  126. package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
  127. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
  128. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +1 -1
  129. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
  130. package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
  131. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
  132. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
  133. package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -1
  134. package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
  135. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
  136. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
  137. package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
  138. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +13 -4
  139. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
  140. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
  141. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +2 -2
  142. package/dist/types/components/HysTable/HysTable.vue.d.ts +4 -4
  143. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
  144. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
  145. package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
  146. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
  147. package/dist/types/components/HysTour/HysTour.vue.d.ts +2 -1
  148. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
  149. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
  150. package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
  151. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
  152. package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
  153. package/dist/types/composables/autocomplete.d.ts +3 -0
  154. package/dist/types/composables/avatar.d.ts +3 -0
  155. package/dist/types/composables/cascader.d.ts +3 -0
  156. package/dist/types/composables/color.d.ts +97 -0
  157. package/dist/types/composables/dataGrid.d.ts +100 -0
  158. package/dist/types/composables/datePicker.d.ts +3 -0
  159. package/dist/types/composables/drawer.d.ts +102 -0
  160. package/dist/types/composables/feedback.d.ts +98 -0
  161. package/dist/types/composables/formContext.d.ts +2 -0
  162. package/dist/types/composables/menu.d.ts +183 -0
  163. package/dist/types/composables/modal.d.ts +183 -0
  164. package/dist/types/composables/overlayManager.d.ts +7 -3
  165. package/dist/types/composables/popupSurface.d.ts +83 -0
  166. package/dist/types/composables/progress.d.ts +92 -0
  167. package/dist/types/composables/selectOptions.d.ts +2 -0
  168. package/dist/types/composables/table.d.ts +3 -0
  169. package/dist/types/composables/tagInput.d.ts +96 -0
  170. package/dist/types/composables/timeline.d.ts +82 -0
  171. package/dist/types/composables/transfer.d.ts +7 -0
  172. package/dist/types/composables/tree.d.ts +3 -0
  173. package/dist/types/composables/treeSelect.d.ts +3 -0
  174. package/dist/types/composables/upload.d.ts +202 -0
  175. package/dist/types/composables/uploadRequest.d.ts +3 -0
  176. package/dist/types/composables/useAlert.d.ts +21 -0
  177. package/dist/types/composables/useCascader.d.ts +1 -1
  178. package/dist/types/composables/useColorPicker.d.ts +101 -0
  179. package/dist/types/composables/useContextMenu.d.ts +81 -0
  180. package/dist/types/composables/useDataGridRemote.d.ts +15 -0
  181. package/dist/types/composables/useDialog.d.ts +16 -3
  182. package/dist/types/composables/useDrawerPush.d.ts +6 -0
  183. package/dist/types/composables/useDrawerResize.d.ts +27 -0
  184. package/dist/types/composables/useFloating.d.ts +21 -2
  185. package/dist/types/composables/useHysModal.d.ts +44 -0
  186. package/dist/types/composables/useModal.d.ts +62 -0
  187. package/dist/types/composables/useModalInteraction.d.ts +27 -0
  188. package/dist/types/composables/usePopupSurface.d.ts +3341 -0
  189. package/dist/types/composables/useTagInput.d.ts +66 -0
  190. package/dist/types/composables/useTransferMotion.d.ts +36 -0
  191. package/dist/types/composables/useUpload.d.ts +94 -0
  192. package/dist/types/composables/useUploadModel.d.ts +14 -0
  193. package/dist/types/composables/useUploadRequests.d.ts +38 -0
  194. package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
  195. package/dist/types/composables/virtualTable.d.ts +126 -0
  196. package/dist/types/index.d.ts +17 -2
  197. package/dist/types/internal/PopupReference.d.ts +18 -0
  198. package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
  199. package/dist/types/motion/PopupMotion.d.ts +59 -0
  200. package/dist/types/motion/popup.d.ts +12 -0
  201. package/package.json +1 -1
@@ -1,101 +1,506 @@
1
- import { defineComponent as B, ref as g, toRef as E, watch as O, onDeactivated as $, openBlock as r, createBlock as x, Teleport as D, createVNode as C, Transition as M, withCtx as S, unref as f, withDirectives as H, createElementBlock as y, mergeProps as N, withModifiers as R, createElementVNode as u, normalizeStyle as V, renderSlot as h, toDisplayString as z, createCommentVNode as m, vShow as A } from "vue";
2
- import { useHysRootAttrs as P } from "../../config.js";
3
- import { X as T } from "lucide-vue-next";
4
- import { useDialog as q } from "../../composables/useDialog.js";
5
- const W = ["aria-label", "aria-busy"], X = { class: "hys-ui-dialog-head" }, j = ["disabled"], F = { class: "hys-ui-dialog-body" }, G = {
1
+ import { defineComponent as oe, useSlots as le, useAttrs as ie, ref as ne, useId as re, computed as h, mergeProps as B, openBlock as n, createBlock as C, Teleport as de, createVNode as g, Transition as se, normalizeProps as y, guardReactiveProps as m, withCtx as w, unref as a, withDirectives as j, createElementBlock as u, createElementVNode as c, toDisplayString as v, createCommentVNode as s, normalizeStyle as z, normalizeClass as T, renderSlot as b, resolveDynamicComponent as D, createTextVNode as F, vShow as p, withModifiers as ue } from "vue";
2
+ import { Info as q, CircleHelp as ce, CircleX as ye, TriangleAlert as me, CircleCheck as fe, GripHorizontal as he, GripVertical as N, Minimize2 as ge, Maximize2 as ve, X as be, LoaderCircle as ke } from "lucide-vue-next";
3
+ import R from "../HysButton/HysButton.vue.js";
4
+ import { useHysRootAttrs as Be } from "../../config.js";
5
+ import { useModal as Ce } from "../../composables/useModal.js";
6
+ import { modalLength as k, modalWidth as we } from "../../composables/modal.js";
7
+ const ze = ["role", "aria-modal", "aria-label", "aria-labelledby", "aria-describedby", "aria-busy"], xe = { class: "hys-ui-modal-title-wrap" }, Se = {
8
+ class: "hys-ui-modal-head-actions",
9
+ "data-hys-modal-no-drag": ""
10
+ }, Pe = ["aria-label", "title", "aria-pressed"], He = ["aria-label", "disabled"], Te = {
6
11
  key: 0,
7
- class: "hys-ui-dialog-foot"
8
- }, Q = /* @__PURE__ */ B({
12
+ class: "hys-ui-modal-loading",
13
+ role: "status"
14
+ }, De = { class: "hys-ui-modal-content" }, Fe = ["data-type"], Ae = { class: "hys-ui-modal-content-main" }, Oe = {
15
+ key: 1,
16
+ role: "alert",
17
+ class: "hys-ui-modal-error"
18
+ }, Ve = /* @__PURE__ */ oe({
19
+ inheritAttrs: !1,
9
20
  __name: "HysModal",
10
21
  props: {
11
- open: { type: Boolean },
12
- title: {},
13
- width: { default: "560px" },
22
+ open: { type: Boolean, default: void 0 },
23
+ modelValue: { type: Boolean, default: void 0 },
24
+ defaultOpen: { type: Boolean },
25
+ title: { default: "" },
26
+ description: {},
27
+ type: { default: "default" },
28
+ showIcon: { type: Boolean, default: void 0 },
29
+ opacity: {},
30
+ maskOpacity: {},
31
+ icon: {},
32
+ width: {},
33
+ height: {},
34
+ maxHeight: {},
35
+ minWidth: {},
36
+ minHeight: {},
37
+ maxWidth: {},
38
+ size: { default: "md" },
39
+ centered: { type: Boolean, default: !0 },
40
+ top: {},
41
+ center: { type: Boolean },
42
+ fullscreen: { type: Boolean, default: void 0 },
43
+ defaultFullscreen: { type: Boolean },
44
+ showFullscreen: { type: Boolean },
14
45
  closeOnMask: { type: Boolean, default: !0 },
15
46
  closeOnEscape: { type: Boolean, default: !0 },
16
47
  showClose: { type: Boolean, default: !0 },
17
48
  destroyOnClose: { type: Boolean, default: !0 },
18
- fullscreen: { type: Boolean },
19
- placement: { default: "right" },
20
- beforeClose: {}
49
+ forceRender: { type: Boolean },
50
+ modal: { type: Boolean, default: !0 },
51
+ modalPenetrable: { type: Boolean },
52
+ appendTo: { type: [String, Object, Boolean], default: "body" },
53
+ lockScroll: { type: Boolean, default: void 0 },
54
+ trapFocus: { type: Boolean, default: void 0 },
55
+ restoreFocus: { type: Boolean, default: !0 },
56
+ initialFocus: { type: [String, Boolean, Object], default: "auto" },
57
+ openDelay: {},
58
+ closeDelay: {},
59
+ transition: { type: [String, Object, Boolean], default: "scale" },
60
+ transitionDuration: {},
61
+ zIndex: {},
62
+ headerClass: {},
63
+ headerSize: { default: "md" },
64
+ footerSize: { default: "md" },
65
+ headerHeight: {},
66
+ footerHeight: {},
67
+ titleFontSize: {},
68
+ bodyClass: {},
69
+ footerClass: {},
70
+ overlayClass: {},
71
+ modalClass: {},
72
+ headerStyle: {},
73
+ bodyStyle: {},
74
+ footerStyle: {},
75
+ maskStyle: {},
76
+ modalStyle: {},
77
+ ariaLabel: {},
78
+ ariaLabelledby: {},
79
+ ariaDescribedby: {},
80
+ role: {},
81
+ headerAriaLevel: { default: 2 },
82
+ closeText: { default: "关闭" },
83
+ fullscreenText: { default: "全屏" },
84
+ restoreText: { default: "还原" },
85
+ footer: { type: Boolean, default: void 0 },
86
+ footerAlign: {},
87
+ showCancel: { type: Boolean, default: !0 },
88
+ okText: { default: "确定" },
89
+ cancelText: { default: "取消" },
90
+ okVariant: {},
91
+ okButtonProps: {},
92
+ cancelButtonProps: {},
93
+ confirmLoading: { type: Boolean },
94
+ confirmDisabled: { type: Boolean },
95
+ cancelDisabled: { type: Boolean },
96
+ closeWhileConfirming: { type: Boolean },
97
+ loading: { type: Boolean },
98
+ loadingText: { default: "正在加载…" },
99
+ showError: { type: Boolean, default: !0 },
100
+ errorText: {},
101
+ confirmOnCtrlEnter: { type: Boolean },
102
+ closeOnConfirm: { type: Boolean, default: !0 },
103
+ beforeClose: {},
104
+ beforeConfirm: {},
105
+ draggable: { type: Boolean },
106
+ dragHandlePosition: { default: "center" },
107
+ dragMode: { default: "live" },
108
+ dragThreshold: { default: 6 },
109
+ dragEffect: { default: "lift" },
110
+ overflow: { type: Boolean },
111
+ keepHandleVisible: { type: Boolean, default: !0 },
112
+ resizable: { type: Boolean },
113
+ resetPositionOnClose: { type: Boolean, default: !0 },
114
+ resetSizeOnClose: { type: Boolean, default: !0 },
115
+ placement: {}
21
116
  },
22
- emits: ["close", "closeError"],
23
- setup(e, { expose: k, emit: w }) {
24
- const p = P(), s = e, v = w, d = g(), l = g(!1), { active: n } = q(E(s, "open"), d, () => {
25
- s.closeOnEscape && i("escape");
26
- });
27
- let a = 0;
28
- function b() {
29
- a++, l.value = !1;
117
+ emits: ["update:open", "update:modelValue", "update:fullscreen", "open", "opened", "close", "closed", "afterClose", "visibleChange", "fullscreenChange", "ok", "cancel", "closeError", "confirmError", "openAutoFocus", "closeAutoFocus", "dragStart", "drag", "dragEnd", "resizeStart", "resize", "resizeEnd"],
118
+ setup(e, { expose: G, emit: U }) {
119
+ const l = e, X = U, J = le(), Q = ie(), A = Be(), x = ne(), O = re(), S = O + "-title", P = O + "-description", t = Ce(
120
+ l,
121
+ x,
122
+ (d, ...o) => X(d, ...o)
123
+ ), r = t.fullscreen, f = h(() => ({
124
+ close: t.requestClose,
125
+ cancel: t.cancel,
126
+ confirm: t.confirm,
127
+ closing: t.closing.value,
128
+ confirming: t.confirming.value,
129
+ busy: t.busy.value,
130
+ error: t.error.value,
131
+ titleId: S,
132
+ descriptionId: P,
133
+ fullscreen: r.value,
134
+ toggleFullscreen: t.toggleFullscreen
135
+ })), Y = h(
136
+ () => l.footer !== !1 && (l.footer === !0 || !!J.footer)
137
+ ), Z = h(
138
+ () => Math.max(1, Math.min(6, Math.trunc(l.headerAriaLevel)))
139
+ ), _ = h(() => {
140
+ var d, o;
141
+ return {
142
+ ...l.modalStyle,
143
+ ...l.opacity !== void 0 ? {
144
+ "--hys-ui-modal-opacity": t.alpha(l.opacity) * 100 + "%",
145
+ background: `color-mix(in srgb,var(--hys-ui-surface,var(--hys-ui-theme-surface)) ${t.alpha(l.opacity) * 100}%,transparent)`
146
+ } : {},
147
+ width: r.value ? "100%" : k(
148
+ ((d = t.interaction.dimensions.value) == null ? void 0 : d.width) ?? we(l)
149
+ ),
150
+ height: r.value ? "100dvh" : k(((o = t.interaction.dimensions.value) == null ? void 0 : o.height) ?? l.height),
151
+ maxWidth: r.value ? "100%" : l.maxWidth ? `min(${l.maxWidth}px,100%)` : "100%",
152
+ maxHeight: r.value ? "100dvh" : k(l.maxHeight) ?? "calc(100dvh - 36px)",
153
+ "--hys-ui-modal-x": t.interaction.position.value.x + "px",
154
+ "--hys-ui-modal-y": t.interaction.position.value.y + "px"
155
+ };
156
+ }), ee = h(() => ({
157
+ ...l.maskStyle,
158
+ ...l.modal !== !1 && l.maskOpacity !== void 0 ? {
159
+ "--hys-ui-modal-mask-opacity": t.alpha(l.maskOpacity) * 100 + "%",
160
+ background: `color-mix(in srgb,#0b183d ${t.alpha(l.maskOpacity) * 100}%,transparent)`
161
+ } : {},
162
+ zIndex: t.state.zIndex.value,
163
+ ...l.centered === !1 && !r.value ? { alignItems: "flex-start", paddingTop: k(l.top) ?? "15vh" } : {},
164
+ ...l.transitionDuration !== void 0 ? {
165
+ "--hys-ui-modal-duration": Math.max(0, Math.min(5e3, l.transitionDuration)) + "ms"
166
+ } : {}
167
+ })), te = h(() => {
168
+ const d = typeof l.transition == "object" ? l.transition : {
169
+ name: typeof l.transition == "string" ? l.transition : void 0
170
+ }, o = d.name ?? "hys-ui-modal-motion";
171
+ return B(
172
+ { ...d },
173
+ {
174
+ name: ["fade", "scale", "slide"].includes(o) ? "hys-ui-modal-" + o : o,
175
+ appear: !0,
176
+ css: t.motion.value && d.css !== !1,
177
+ ...l.transitionDuration !== void 0 ? { duration: Math.max(0, Math.min(5e3, l.transitionDuration)) } : {},
178
+ onAfterEnter: t.afterEnter,
179
+ onAfterLeave: t.afterLeave
180
+ }
181
+ );
182
+ }), ae = h(
183
+ () => l.icon ?? {
184
+ info: q,
185
+ success: fe,
186
+ warning: me,
187
+ error: ye,
188
+ confirm: ce,
189
+ default: q
190
+ }[l.type]
191
+ );
192
+ function H() {
193
+ l.draggable && t.interaction.resetPosition();
30
194
  }
31
- O(() => s.open, (o) => {
32
- o || b();
33
- }), $(b);
34
- async function i(o = "button") {
35
- if (l.value || !s.open || !n.value) return;
36
- const t = ++a;
37
- l.value = !0;
38
- try {
39
- if (s.beforeClose && await s.beforeClose(o) === !1) return;
40
- n.value && t === a && v("close");
41
- } catch (c) {
42
- n.value && t === a && v("closeError", c);
43
- } finally {
44
- t === a && (l.value = !1);
45
- }
46
- }
47
- return k({ close: i, element: d }), (o, t) => (r(), x(D, { to: "body" }, [
48
- C(M, { name: "hys-ui-modal-motion" }, {
49
- default: S(() => [
50
- f(n) && (e.open || !e.destroyOnClose) ? H((r(), y("div", N({ key: 0 }, f(p), {
51
- class: ["hys-ui-overlay", { "hys-ui-modal-fullscreen": e.fullscreen }],
52
- onPointerdown: t[1] || (t[1] = R((c) => e.closeOnMask && i("mask"), ["self"]))
53
- }), [
54
- u("section", {
55
- ref_key: "dialog",
56
- ref: d,
57
- tabindex: "-1",
58
- class: "hys-ui-modal",
59
- role: "dialog",
60
- "aria-modal": "true",
61
- "aria-label": e.title,
62
- "aria-busy": l.value,
63
- style: V({ maxWidth: e.fullscreen ? "100%" : e.width, width: e.fullscreen ? "100%" : void 0, height: e.fullscreen ? "100dvh" : void 0, maxHeight: e.fullscreen ? "100dvh" : void 0 })
64
- }, [
65
- u("header", X, [
66
- h(o.$slots, "header", {}, () => [
67
- u("h3", null, z(e.title), 1)
68
- ], !0),
69
- e.showClose ? (r(), y("button", {
195
+ return G({
196
+ element: x,
197
+ open: t.shown,
198
+ closing: t.closing,
199
+ confirming: t.confirming,
200
+ fullscreen: r,
201
+ get position() {
202
+ return t.interaction.getPosition();
203
+ },
204
+ get dimensions() {
205
+ return t.interaction.getDimensions();
206
+ },
207
+ show: t.show,
208
+ hide: () => t.requestClose("api"),
209
+ close: t.requestClose,
210
+ handleOpen: t.show,
211
+ handleClose: () => t.requestClose("api"),
212
+ confirm: t.confirm,
213
+ cancel: t.cancel,
214
+ focus: t.state.focus,
215
+ toggleFullscreen: t.toggleFullscreen,
216
+ setFullscreen: t.setFullscreen,
217
+ resetPosition: t.interaction.resetPosition,
218
+ resetSize: t.interaction.resetSize,
219
+ setPosition: t.interaction.setPosition,
220
+ setSize: t.interaction.setSize
221
+ }), (d, o) => (n(), C(de, {
222
+ to: e.appendTo || "body",
223
+ disabled: e.appendTo === !1
224
+ }, [
225
+ g(se, y(m(te.value)), {
226
+ default: w(() => {
227
+ var E, M;
228
+ return [
229
+ a(t).state.active.value && (e.forceRender || a(t).rendered.value) ? j((n(), u("div", B({ key: 0 }, a(A), {
230
+ class: ["hys-ui-overlay hys-ui-modal-overlay", [
231
+ e.overlayClass,
232
+ {
233
+ "hys-ui-modal-fullscreen": a(r),
234
+ "hys-ui-modal-no-mask": l.modal === !1,
235
+ "hys-ui-modal-penetrable": l.modal === !1 && e.modalPenetrable,
236
+ "hys-ui-modal-center": e.center,
237
+ "hys-ui-modal-allow-overflow": e.overflow
238
+ }
239
+ ]],
240
+ style: ee.value,
241
+ onPointerdown: o[11] || (o[11] = //@ts-ignore
242
+ (...i) => a(t).maskDown && a(t).maskDown(...i)),
243
+ onPointerup: o[12] || (o[12] = //@ts-ignore
244
+ (...i) => a(t).maskUp && a(t).maskUp(...i))
245
+ }), [
246
+ a(t).interaction.previewing.value ? (n(), u("div", {
247
+ key: 0,
248
+ ref: (i) => a(t).interaction.previewLayer.value = i,
249
+ class: "hys-ui-modal-drag-preview",
250
+ "aria-hidden": "true"
251
+ }, [
252
+ c("span", null, v(e.title || "移动位置"), 1)
253
+ ], 512)) : s("", !0),
254
+ c("section", B({
255
+ ref_key: "dialog",
256
+ ref: x
257
+ }, { ...a(A), ...a(Q) }, {
258
+ tabindex: "-1",
259
+ class: ["hys-ui-modal", [
260
+ e.modalClass,
261
+ "hys-ui-modal-" + (e.size ?? "md"),
262
+ "hys-ui-modal-drag-effect-" + e.dragEffect,
263
+ {
264
+ "hys-ui-modal-dragging": a(t).interaction.dragging.value,
265
+ "hys-ui-modal-resizing": a(t).interaction.resizing.value,
266
+ "hys-ui-modal-preview-origin": a(t).interaction.previewing.value
267
+ }
268
+ ]],
269
+ role: e.role ?? "dialog",
270
+ "aria-modal": l.modal === !1 && e.modalPenetrable ? void 0 : !0,
271
+ "aria-label": e.ariaLabel || e.title || "对话框",
272
+ "aria-labelledby": e.ariaLabelledby || (e.title || d.$slots.header ? S : void 0),
273
+ "aria-describedby": e.ariaDescribedby || (e.description ? P : void 0),
274
+ "aria-busy": a(t).busy.value || void 0,
275
+ style: _.value,
276
+ onKeydown: o[10] || (o[10] = //@ts-ignore
277
+ (...i) => a(t).key && a(t).key(...i))
278
+ }), [
279
+ e.title || d.$slots.header || e.showClose || e.showFullscreen || e.draggable ? (n(), u("header", {
70
280
  key: 0,
71
- type: "button",
72
- class: "hys-ui-icon-action",
73
- "aria-label": "关闭",
74
- disabled: l.value,
75
- onClick: t[0] || (t[0] = (c) => i("button"))
281
+ class: T(["hys-ui-dialog-head", [
282
+ e.headerClass,
283
+ "hys-ui-modal-header-" + (e.headerSize ?? "md"),
284
+ {
285
+ "hys-ui-modal-header-with-center-grip": e.draggable && !a(r) && e.dragHandlePosition === "center"
286
+ }
287
+ ]]),
288
+ style: z({
289
+ ...e.headerStyle,
290
+ minHeight: a(k)(e.headerHeight) ?? ((E = e.headerStyle) == null ? void 0 : E.minHeight)
291
+ })
292
+ }, [
293
+ e.draggable && !a(r) && e.dragHandlePosition === "center" ? (n(), u("button", {
294
+ key: 0,
295
+ type: "button",
296
+ class: "hys-ui-modal-drag-handle hys-ui-modal-drag-handle-center",
297
+ "data-hys-modal-drag-handle": "",
298
+ "aria-label": "移动弹窗",
299
+ title: "拖动移动弹窗;双击复位,Alt 加方向键微调",
300
+ onPointerdown: o[0] || (o[0] = (i) => a(t).interaction.start(i, "drag")),
301
+ onKeydown: o[1] || (o[1] = //@ts-ignore
302
+ (...i) => a(t).interaction.headerKey && a(t).interaction.headerKey(...i)),
303
+ onDblclick: H
304
+ }, [
305
+ g(a(he), {
306
+ size: 18,
307
+ "aria-hidden": "true"
308
+ })
309
+ ], 32)) : s("", !0),
310
+ c("div", xe, [
311
+ e.draggable && !a(r) && ["left", "both"].includes(e.dragHandlePosition) ? (n(), u("button", {
312
+ key: 0,
313
+ type: "button",
314
+ class: "hys-ui-modal-drag-handle",
315
+ "data-hys-modal-drag-handle": "",
316
+ "aria-label": "移动弹窗",
317
+ title: "拖动移动弹窗;双击复位,Alt 加方向键微调",
318
+ onPointerdown: o[2] || (o[2] = (i) => a(t).interaction.start(i, "drag")),
319
+ onKeydown: o[3] || (o[3] = //@ts-ignore
320
+ (...i) => a(t).interaction.headerKey && a(t).interaction.headerKey(...i)),
321
+ onDblclick: H
322
+ }, [
323
+ g(a(N), {
324
+ size: 16,
325
+ "aria-hidden": "true"
326
+ })
327
+ ], 32)) : s("", !0),
328
+ b(d.$slots, "header", y(m(f.value)), () => [
329
+ (n(), C(D("h" + Z.value), {
330
+ id: S,
331
+ class: "hys-ui-modal-title",
332
+ style: z({ fontSize: a(k)(e.titleFontSize) })
333
+ }, {
334
+ default: w(() => [
335
+ F(v(e.title), 1)
336
+ ]),
337
+ _: 1
338
+ }, 8, ["style"]))
339
+ ], !0)
340
+ ]),
341
+ c("div", Se, [
342
+ e.draggable && !a(r) && ["right", "both"].includes(e.dragHandlePosition) ? (n(), u("button", {
343
+ key: 0,
344
+ type: "button",
345
+ class: "hys-ui-modal-drag-handle",
346
+ "data-hys-modal-drag-handle": "",
347
+ "aria-label": "从右侧移动弹窗",
348
+ title: "从右侧拖动;双击复位,Alt 加方向键微调",
349
+ onPointerdown: o[4] || (o[4] = (i) => a(t).interaction.start(i, "drag")),
350
+ onKeydown: o[5] || (o[5] = //@ts-ignore
351
+ (...i) => a(t).interaction.headerKey && a(t).interaction.headerKey(...i)),
352
+ onDblclick: H
353
+ }, [
354
+ g(a(N), {
355
+ size: 16,
356
+ "aria-hidden": "true"
357
+ })
358
+ ], 32)) : s("", !0),
359
+ e.showFullscreen ? (n(), u("button", {
360
+ key: 1,
361
+ type: "button",
362
+ class: "hys-ui-icon-action",
363
+ "aria-label": a(r) ? e.restoreText : e.fullscreenText,
364
+ title: a(r) ? e.restoreText : e.fullscreenText,
365
+ "aria-pressed": a(r),
366
+ onClick: o[6] || (o[6] = //@ts-ignore
367
+ (...i) => a(t).toggleFullscreen && a(t).toggleFullscreen(...i))
368
+ }, [
369
+ b(d.$slots, "fullscreen-icon", y(m(f.value)), () => [
370
+ (n(), C(D(a(r) ? a(ge) : a(ve)), { size: 16 }))
371
+ ], !0)
372
+ ], 8, Pe)) : s("", !0),
373
+ e.showClose ? (n(), u("button", {
374
+ key: 2,
375
+ type: "button",
376
+ class: "hys-ui-icon-action",
377
+ "aria-label": e.closeText,
378
+ disabled: a(t).closing.value || a(t).confirming.value && !e.closeWhileConfirming,
379
+ onClick: o[7] || (o[7] = (i) => a(t).requestClose("button", i))
380
+ }, [
381
+ b(d.$slots, "close-icon", y(m(f.value)), () => [
382
+ g(a(be), { size: 18 })
383
+ ], !0)
384
+ ], 8, He)) : s("", !0)
385
+ ])
386
+ ], 6)) : s("", !0),
387
+ c("div", {
388
+ class: T(["hys-ui-dialog-body", e.bodyClass]),
389
+ style: z(e.bodyStyle)
76
390
  }, [
77
- C(f(T), { size: 18 })
78
- ], 8, j)) : m("", !0)
79
- ]),
80
- u("div", F, [
81
- h(o.$slots, "default", {}, void 0, !0)
82
- ]),
83
- o.$slots.footer ? (r(), y("footer", G, [
84
- h(o.$slots, "footer", {
85
- close: i,
86
- closing: l.value
87
- }, void 0, !0)
88
- ])) : m("", !0)
89
- ], 12, W)
90
- ], 16)), [
91
- [A, e.open]
92
- ]) : m("", !0)
93
- ]),
391
+ e.loading ? (n(), u("div", Te, [
392
+ b(d.$slots, "loading", y(m(f.value)), () => [
393
+ g(a(ke), {
394
+ size: 23,
395
+ class: "hys-ui-modal-spinner"
396
+ }),
397
+ c("span", null, v(e.loadingText), 1)
398
+ ], !0)
399
+ ])) : s("", !0),
400
+ j(c("div", De, [
401
+ e.showIcon ?? e.type !== "default" ? (n(), u("span", {
402
+ key: 0,
403
+ class: "hys-ui-modal-type-icon",
404
+ "data-type": e.type,
405
+ "aria-hidden": "true"
406
+ }, [
407
+ b(d.$slots, "icon", y(m(f.value)), () => [
408
+ (n(), C(D(ae.value), { size: 24 }))
409
+ ], !0)
410
+ ], 8, Fe)) : s("", !0),
411
+ c("div", Ae, [
412
+ e.description ? (n(), u("p", {
413
+ key: 0,
414
+ id: P,
415
+ class: "hys-ui-modal-description"
416
+ }, v(e.description), 1)) : s("", !0),
417
+ b(d.$slots, "default", y(m(f.value)), void 0, !0)
418
+ ])
419
+ ], 512), [
420
+ [p, !e.loading]
421
+ ]),
422
+ e.showError && a(t).error.value ? (n(), u("p", Oe, v(a(t).error.value), 1)) : s("", !0)
423
+ ], 6),
424
+ Y.value ? (n(), u("footer", {
425
+ key: 1,
426
+ class: T(["hys-ui-dialog-foot", [
427
+ e.footerClass,
428
+ "hys-ui-modal-footer-" + (e.footerSize ?? "md")
429
+ ]]),
430
+ style: z({
431
+ ...e.footerStyle,
432
+ minHeight: a(k)(e.footerHeight) ?? ((M = e.footerStyle) == null ? void 0 : M.minHeight),
433
+ justifyContent: e.footerAlign === "start" ? "flex-start" : e.footerAlign === "center" || e.center ? "center" : "flex-end",
434
+ paddingInlineEnd: e.resizable && !a(r) ? "38px" : void 0
435
+ })
436
+ }, [
437
+ b(d.$slots, "footer", y(m(f.value)), () => {
438
+ var i, K, L, $, I, V, W;
439
+ return [
440
+ e.showCancel ? (n(), C(R, B({ key: 0 }, e.cancelButtonProps, {
441
+ "data-hys-modal-cancel": "",
442
+ variant: ((i = e.cancelButtonProps) == null ? void 0 : i.variant) ?? "secondary",
443
+ size: ((K = e.cancelButtonProps) == null ? void 0 : K.size) ?? e.footerSize ?? "md",
444
+ disabled: e.cancelDisabled || ((L = e.cancelButtonProps) == null ? void 0 : L.disabled) || a(t).closing.value || a(t).confirming.value && !e.closeWhileConfirming,
445
+ onClick: a(t).cancel
446
+ }), {
447
+ default: w(() => [
448
+ F(v(e.cancelText), 1)
449
+ ]),
450
+ _: 1
451
+ }, 16, ["variant", "size", "disabled", "onClick"])) : s("", !0),
452
+ g(R, B(e.okButtonProps, {
453
+ "data-hys-modal-confirm": "",
454
+ variant: (($ = e.okButtonProps) == null ? void 0 : $.variant) ?? e.okVariant ?? "primary",
455
+ size: ((I = e.okButtonProps) == null ? void 0 : I.size) ?? e.footerSize ?? "md",
456
+ loading: a(t).confirming.value || ((V = e.okButtonProps) == null ? void 0 : V.loading),
457
+ disabled: e.confirmDisabled || ((W = e.okButtonProps) == null ? void 0 : W.disabled) || a(t).closing.value || e.loading,
458
+ onClick: a(t).confirm
459
+ }), {
460
+ default: w(() => [
461
+ F(v(e.okText), 1)
462
+ ]),
463
+ _: 1
464
+ }, 16, ["variant", "size", "loading", "disabled", "onClick"])
465
+ ];
466
+ }, !0)
467
+ ], 6)) : s("", !0),
468
+ e.resizable && !a(r) ? (n(), u("button", {
469
+ key: 2,
470
+ type: "button",
471
+ class: "hys-ui-modal-resize-handle",
472
+ "aria-label": "调整弹窗尺寸",
473
+ title: "拖拽调整尺寸;方向键微调,Home 恢复",
474
+ onPointerdown: o[8] || (o[8] = ue((i) => a(t).interaction.start(i, "resize"), ["stop"])),
475
+ onKeydown: o[9] || (o[9] = //@ts-ignore
476
+ (...i) => a(t).interaction.resizeKey && a(t).interaction.resizeKey(...i))
477
+ }, [...o[13] || (o[13] = [
478
+ c("svg", {
479
+ width: "17",
480
+ height: "17",
481
+ viewBox: "0 0 20 20",
482
+ fill: "none",
483
+ "aria-hidden": "true"
484
+ }, [
485
+ c("path", {
486
+ d: "m5 16 11-11m-6 11 6-6m-1 6 1-1",
487
+ stroke: "currentColor",
488
+ "stroke-width": "1.7",
489
+ "stroke-linecap": "round"
490
+ })
491
+ ], -1)
492
+ ])], 32)) : s("", !0)
493
+ ], 16, ze)
494
+ ], 16)), [
495
+ [p, a(t).shown.value]
496
+ ]) : s("", !0)
497
+ ];
498
+ }),
94
499
  _: 3
95
- })
96
- ]));
500
+ }, 16)
501
+ ], 8, ["to", "disabled"]));
97
502
  }
98
503
  });
99
504
  export {
100
- Q as default
505
+ Ve as default
101
506
  };