@moubing/bing-ui 0.11.1 → 0.12.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 (210) hide show
  1. package/README.md +300 -171
  2. package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
  3. package/dist/bing-ui.css +1 -1
  4. package/dist/components/BingAnimatedText/BingAnimatedText.js +7 -0
  5. package/dist/components/BingAnimatedText/BingAnimatedText.vue_vue_type_script_setup_true_lang.js +194 -0
  6. package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.js +7 -0
  7. package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.vue_vue_type_script_setup_true_lang.js +244 -0
  8. package/dist/components/BingAutocomplete/BingAutocomplete.js +7 -0
  9. package/dist/components/BingAutocomplete/BingAutocomplete.vue.d.ts +4 -4
  10. package/dist/components/BingAutocomplete/BingAutocomplete.vue_vue_type_script_setup_true_lang.js +560 -0
  11. package/dist/components/BingButton/BingButton.js +7 -0
  12. package/dist/components/BingButton/BingButton.vue.d.ts +2 -2
  13. package/dist/components/BingButton/BingButton.vue_vue_type_script_setup_true_lang.js +200 -0
  14. package/dist/components/BingCard/BingCard.js +7 -0
  15. package/dist/components/BingCard/BingCard.vue_vue_type_script_setup_true_lang.js +481 -0
  16. package/dist/components/BingCarouselTransition/BingCarouselTransition.js +7 -0
  17. package/dist/components/BingCarouselTransition/BingCarouselTransition.vue_vue_type_script_setup_true_lang.js +174 -0
  18. package/dist/components/BingCheckbox/BingCheckbox.js +7 -0
  19. package/dist/components/BingCheckbox/BingCheckbox.vue.d.ts +4 -4
  20. package/dist/components/BingCheckbox/BingCheckbox.vue_vue_type_script_setup_true_lang.js +233 -0
  21. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.context.js +4 -0
  22. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.js +7 -0
  23. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue.d.ts +4 -4
  24. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue_vue_type_script_setup_true_lang.js +105 -0
  25. package/dist/components/BingCodeBlock/BingCodeBlock.highlight.js +78 -0
  26. package/dist/components/BingCodeBlock/BingCodeBlock.js +7 -0
  27. package/dist/components/BingCodeBlock/BingCodeBlock.vue_vue_type_script_setup_true_lang.js +347 -0
  28. package/dist/components/BingColorPicker/BingColorPicker.js +7 -0
  29. package/dist/components/BingColorPicker/BingColorPicker.utils.d.ts +70 -0
  30. package/dist/components/BingColorPicker/BingColorPicker.utils.js +265 -0
  31. package/dist/components/BingColorPicker/BingColorPicker.vue.d.ts +7 -7
  32. package/dist/components/BingColorPicker/BingColorPicker.vue_vue_type_script_setup_true_lang.js +540 -0
  33. package/dist/components/BingColorPicker/BingColorPickerFormatEditor.js +7 -0
  34. package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue.d.ts +27 -0
  35. package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue_vue_type_script_setup_true_lang.js +142 -0
  36. package/dist/components/BingColorPicker/BingColorPickerSpectrum.js +7 -0
  37. package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue.d.ts +26 -0
  38. package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue_vue_type_script_setup_true_lang.js +168 -0
  39. package/dist/components/BingConfigProvider/BingConfigProvider.js +5 -0
  40. package/dist/components/BingConfigProvider/BingConfigProvider.types.d.ts +5 -0
  41. package/dist/components/BingConfigProvider/BingConfigProvider.vue.d.ts +18 -0
  42. package/dist/components/BingConfigProvider/BingConfigProvider.vue_vue_type_script_setup_true_lang.js +18 -0
  43. package/dist/components/BingConfigProvider/index.d.ts +3 -0
  44. package/dist/components/BingCursor/BingCursor.controller.js +240 -0
  45. package/dist/components/BingCursor/BingCursor.js +7 -0
  46. package/dist/components/BingCursor/BingCursor.native.js +20 -0
  47. package/dist/components/BingCursor/BingCursor.presets.js +60 -0
  48. package/dist/components/BingCursor/BingCursor.shapes.js +83 -0
  49. package/dist/components/BingCursor/BingCursor.styleSource.js +83 -0
  50. package/dist/components/BingCursor/BingCursor.vue_vue_type_script_setup_true_lang.js +73 -0
  51. package/dist/components/BingDatePicker/BingDatePicker.js +7 -0
  52. package/dist/components/BingDatePicker/BingDatePicker.utils.d.ts +26 -0
  53. package/dist/components/BingDatePicker/BingDatePicker.utils.js +137 -0
  54. package/dist/components/BingDatePicker/BingDatePicker.vue.d.ts +14 -14
  55. package/dist/components/BingDatePicker/BingDatePicker.vue_vue_type_script_setup_true_lang.js +804 -0
  56. package/dist/components/BingDatePicker/BingDatePickerCalendar.js +7 -0
  57. package/dist/components/BingDatePicker/BingDatePickerCalendar.vue.d.ts +37 -0
  58. package/dist/components/BingDatePicker/BingDatePickerCalendar.vue_vue_type_script_setup_true_lang.js +248 -0
  59. package/dist/components/BingDatePicker/BingDatePickerTimePanel.js +7 -0
  60. package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue.d.ts +26 -0
  61. package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue_vue_type_script_setup_true_lang.js +97 -0
  62. package/dist/components/BingDeckTransition/BingDeckTransition.js +7 -0
  63. package/dist/components/BingDeckTransition/BingDeckTransition.vue_vue_type_script_setup_true_lang.js +187 -0
  64. package/dist/components/BingDialog/BingDialog.js +7 -0
  65. package/dist/components/BingDialog/BingDialog.vue.d.ts +4 -5
  66. package/dist/components/BingDialog/BingDialog.vue_vue_type_script_setup_true_lang.js +558 -0
  67. package/dist/components/BingDropDown/BingDropDown.context.js +4 -0
  68. package/dist/components/BingDropDown/BingDropDown.js +7 -0
  69. package/dist/components/BingDropDown/BingDropDown.vue.d.ts +1 -2
  70. package/dist/components/BingDropDown/BingDropDown.vue_vue_type_script_setup_true_lang.js +649 -0
  71. package/dist/components/BingDropDown/BingDropDownItem.js +7 -0
  72. package/dist/components/BingDropDown/BingDropDownItem.vue.d.ts +1 -1
  73. package/dist/components/BingDropDown/BingDropDownItem.vue_vue_type_script_setup_true_lang.js +308 -0
  74. package/dist/components/BingFilePreview/BingFilePreview.js +7 -0
  75. package/dist/components/BingFilePreview/BingFilePreview.vue.d.ts +4 -5
  76. package/dist/components/BingFilePreview/BingFilePreview.vue_vue_type_script_setup_true_lang.js +589 -0
  77. package/dist/components/BingForm/BingForm.context.js +7 -0
  78. package/dist/components/BingForm/BingForm.js +7 -0
  79. package/dist/components/BingForm/BingForm.vue.d.ts +0 -1
  80. package/dist/components/BingForm/BingForm.vue_vue_type_script_setup_true_lang.js +300 -0
  81. package/dist/components/BingForm/formFocus.js +13 -0
  82. package/dist/components/BingForm/formTabOrder.js +27 -0
  83. package/dist/components/BingForm/useFormControl.d.ts +1 -1
  84. package/dist/components/BingForm/useFormControl.js +24 -0
  85. package/dist/components/BingForm/useFormNextHint.js +135 -0
  86. package/dist/components/BingFormItem/BingFormItem.js +7 -0
  87. package/dist/components/BingFormItem/BingFormItem.vue.d.ts +1 -1
  88. package/dist/components/BingFormItem/BingFormItem.vue_vue_type_script_setup_true_lang.js +252 -0
  89. package/dist/components/BingIcon/BingIcon.js +7 -0
  90. package/dist/components/BingIcon/BingIcon.vue_vue_type_script_setup_true_lang.js +48 -0
  91. package/dist/components/BingImage/BingImage.js +7 -0
  92. package/dist/components/BingImage/BingImage.vue_vue_type_script_setup_true_lang.js +244 -0
  93. package/dist/components/BingImagePreview/BingImagePreview.js +7 -0
  94. package/dist/components/BingImagePreview/BingImagePreview.vue.d.ts +4 -5
  95. package/dist/components/BingImagePreview/BingImagePreview.vue_vue_type_script_setup_true_lang.js +699 -0
  96. package/dist/components/BingInput/BingInput.js +7 -0
  97. package/dist/components/BingInput/BingInput.vue.d.ts +6 -6
  98. package/dist/components/BingInput/BingInput.vue_vue_type_script_setup_true_lang.js +311 -0
  99. package/dist/components/BingRadio/BingRadio.js +7 -0
  100. package/dist/components/BingRadio/BingRadio.vue.d.ts +4 -4
  101. package/dist/components/BingRadio/BingRadio.vue_vue_type_script_setup_true_lang.js +170 -0
  102. package/dist/components/BingRadioGroup/BingRadioGroup.context.js +4 -0
  103. package/dist/components/BingRadioGroup/BingRadioGroup.js +7 -0
  104. package/dist/components/BingRadioGroup/BingRadioGroup.vue.d.ts +4 -4
  105. package/dist/components/BingRadioGroup/BingRadioGroup.vue_vue_type_script_setup_true_lang.js +125 -0
  106. package/dist/components/BingResizable/BingResizable.js +7 -0
  107. package/dist/components/BingResizable/BingResizable.vue.d.ts +1 -1
  108. package/dist/components/BingResizable/BingResizable.vue_vue_type_script_setup_true_lang.js +555 -0
  109. package/dist/components/BingScrollbar/BingScrollbar.js +7 -0
  110. package/dist/components/BingScrollbar/BingScrollbar.vue.d.ts +2 -2
  111. package/dist/components/BingScrollbar/BingScrollbar.vue_vue_type_script_setup_true_lang.js +398 -0
  112. package/dist/components/BingSelect/BingSelect.js +7 -0
  113. package/dist/components/BingSelect/BingSelect.vue.d.ts +7 -7
  114. package/dist/components/BingSelect/BingSelect.vue_vue_type_script_setup_true_lang.js +1066 -0
  115. package/dist/components/BingSlider/BingSlider.js +7 -0
  116. package/dist/components/BingSlider/BingSlider.vue.d.ts +6 -6
  117. package/dist/components/BingSlider/BingSlider.vue_vue_type_script_setup_true_lang.js +130 -0
  118. package/dist/components/BingSortableList/BingSortableList.js +7 -0
  119. package/dist/components/BingSortableList/BingSortableList.vue_vue_type_script_setup_true_lang.js +334 -0
  120. package/dist/components/BingSortableList/BingSortableListItem.js +7 -0
  121. package/dist/components/BingSortableList/BingSortableListItem.vue_vue_type_script_setup_true_lang.js +76 -0
  122. package/dist/components/BingSplitPane/BingSplitPane.js +7 -0
  123. package/dist/components/BingSplitPane/BingSplitPane.vue_vue_type_script_setup_true_lang.js +167 -0
  124. package/dist/components/BingTable/BingTable.js +7 -0
  125. package/dist/components/BingTable/BingTable.measurements.js +72 -0
  126. package/dist/components/BingTable/BingTable.vue.d.ts +1 -2
  127. package/dist/components/BingTable/BingTable.vue_vue_type_script_setup_true_lang.js +1416 -0
  128. package/dist/components/BingTable/BingTableCellValue.js +7 -0
  129. package/dist/components/BingTable/BingTableCellValue.vue_vue_type_script_setup_true_lang.js +68 -0
  130. package/dist/components/BingTable/BingTableHeaderCell.js +5 -0
  131. package/dist/components/BingTable/BingTableHeaderCell.vue_vue_type_script_setup_true_lang.js +45 -0
  132. package/dist/components/BingTable/BingTableHeaderContent.js +7 -0
  133. package/dist/components/BingTable/BingTableHeaderContent.vue_vue_type_script_setup_true_lang.js +110 -0
  134. package/dist/components/BingTable/useTableColumns.js +126 -0
  135. package/dist/components/BingTableColumnControls/BingTableColumnControls.js +7 -0
  136. package/dist/components/BingTableColumnControls/BingTableColumnControls.vue.d.ts +1 -1
  137. package/dist/components/BingTableColumnControls/BingTableColumnControls.vue_vue_type_script_setup_true_lang.js +251 -0
  138. package/dist/components/BingTabs/BingTabs.js +7 -0
  139. package/dist/components/BingTabs/BingTabs.vue.d.ts +2 -3
  140. package/dist/components/BingTabs/BingTabs.vue_vue_type_script_setup_true_lang.js +320 -0
  141. package/dist/components/BingTag/BingTag.js +7 -0
  142. package/dist/components/BingTag/BingTag.vue.d.ts +0 -1
  143. package/dist/components/BingTag/BingTag.vue_vue_type_script_setup_true_lang.js +65 -0
  144. package/dist/components/BingTextarea/BingTextarea.js +7 -0
  145. package/dist/components/BingTextarea/BingTextarea.vue.d.ts +6 -6
  146. package/dist/components/BingTextarea/BingTextarea.vue_vue_type_script_setup_true_lang.js +243 -0
  147. package/dist/components/BingToast/BingToast.js +7 -0
  148. package/dist/components/BingToast/BingToast.service.js +132 -0
  149. package/dist/components/BingToast/BingToast.types.d.ts +1 -1
  150. package/dist/components/BingToast/BingToast.types.js +19 -0
  151. package/dist/components/BingToast/BingToast.vue.d.ts +0 -1
  152. package/dist/components/BingToast/BingToast.vue_vue_type_script_setup_true_lang.js +307 -0
  153. package/dist/components/BingTooltip/BingTooltip.js +7 -0
  154. package/dist/components/BingTooltip/BingTooltip.shared.js +14 -0
  155. package/dist/components/BingTooltip/BingTooltip.vue.d.ts +4 -5
  156. package/dist/components/BingTooltip/BingTooltip.vue_vue_type_script_setup_true_lang.js +572 -0
  157. package/dist/components/BingTreeSelect/BingTreeSelect.js +7 -0
  158. package/dist/components/BingTreeSelect/BingTreeSelect.vue.d.ts +7 -7
  159. package/dist/components/BingTreeSelect/BingTreeSelect.vue_vue_type_script_setup_true_lang.js +1274 -0
  160. package/dist/components/index.d.ts +1 -0
  161. package/dist/icons/LICENSE-lucide.txt +39 -0
  162. package/dist/icons/createIcon.d.ts +8 -0
  163. package/dist/icons/createIcon.js +36 -0
  164. package/dist/icons/icons.d.ts +51 -0
  165. package/dist/icons/icons.js +252 -0
  166. package/dist/icons/index.d.ts +3 -0
  167. package/dist/index.js +48 -0
  168. package/dist/motion/clickParticles.d.ts +1 -1
  169. package/dist/motion/clickParticles2.js +66 -0
  170. package/dist/motion/index.d.ts +1 -1
  171. package/dist/motion/index.js +17 -0
  172. package/dist/motion/liquidHover.js +36 -0
  173. package/dist/motion/optionDetailMotion.d.ts +7 -1
  174. package/dist/motion/optionDetailMotion.js +74 -0
  175. package/dist/motion/panelMotion.js +19 -0
  176. package/dist/motion/reducedMotion.d.ts +16 -0
  177. package/dist/motion/reducedMotion.js +28 -0
  178. package/dist/motion/selectPanelMotion.js +115 -0
  179. package/dist/motion/smoothScroll.d.ts +2 -0
  180. package/dist/motion/smoothScroll.js +276 -0
  181. package/dist/motion/useClickFeedback.js +47 -0
  182. package/dist/motion/useTextControlCaret.js +136 -0
  183. package/dist/utils/clipboard.d.ts +9 -0
  184. package/dist/utils/clipboard.js +16 -0
  185. package/dist/utils/config.d.ts +42 -0
  186. package/dist/utils/config.js +37 -0
  187. package/dist/utils/controlAttrs.js +37 -0
  188. package/dist/utils/floating.d.ts +86 -0
  189. package/dist/utils/floating.js +99 -0
  190. package/dist/utils/glass.js +25 -0
  191. package/dist/utils/overlay.js +94 -0
  192. package/dist/utils/scrollLock.js +44 -0
  193. package/dist/utils/search.d.ts +16 -0
  194. package/dist/utils/search.js +23 -0
  195. package/dist/utils/useClientReady.js +10 -0
  196. package/dist/utils/useDeferredBlurValidation.d.ts +18 -0
  197. package/dist/utils/useDeferredBlurValidation.js +34 -0
  198. package/dist/utils/useKeyboardScrollSync.d.ts +11 -0
  199. package/dist/utils/useKeyboardScrollSync.js +28 -0
  200. package/dist/utils/useOptionDetailPanel.d.ts +50 -0
  201. package/dist/utils/useOptionDetailPanel.js +180 -0
  202. package/dist/utils/useOutsidePointerDown.d.ts +8 -0
  203. package/dist/utils/useOutsidePointerDown.js +17 -0
  204. package/dist/utils/useSearchShortcutFocus.d.ts +18 -0
  205. package/dist/utils/useSearchShortcutFocus.js +47 -0
  206. package/dist/utils/useVirtualList.d.ts +42 -0
  207. package/dist/utils/useVirtualList.js +74 -0
  208. package/package.json +15 -9
  209. package/dist/bing-ui.es.js +0 -31276
  210. package/dist/bing-ui.umd.js +0 -229
@@ -0,0 +1,589 @@
1
+ import { useConfigZIndex as e } from "../../utils/config.js";
2
+ import t from "../BingButton/BingButton.js";
3
+ import { Download as n, ExternalLink as r, File as i, FileBraces as a, FileImage as o, FileQuestionMark as s, FileSpreadsheet as ee, FileText as te, FileType as ne, LoaderCircle as c, Presentation as re, X as ie } from "../../icons/icons.js";
4
+ import l from "../BingIcon/BingIcon.js";
5
+ import u from "../BingScrollbar/BingScrollbar.js";
6
+ import { useOverlay as ae } from "../../utils/overlay.js";
7
+ import { useClientReady as oe } from "../../utils/useClientReady.js";
8
+ import { createGlassCssVariables as se, defaultGlassEffect as d } from "../../utils/glass.js";
9
+ import { createScrollLock as ce } from "../../utils/scrollLock.js";
10
+ import le from "../BingImagePreview/BingImagePreview.js";
11
+ import { Fragment as f, Teleport as ue, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createTextVNode as v, createVNode as y, defineComponent as b, nextTick as de, normalizeClass as fe, normalizeStyle as x, onBeforeUnmount as pe, openBlock as S, ref as C, renderList as w, toDisplayString as T, unref as E, watch as D, withCtx as O } from "vue";
12
+ //#region src/components/BingFilePreview/BingFilePreview.vue?vue&type=script&setup=true&lang.ts
13
+ var me = ["aria-label"], he = { class: "bing-file-preview__header" }, ge = { class: "bing-file-preview__identity" }, _e = {
14
+ class: "bing-file-preview__icon",
15
+ "aria-hidden": "true"
16
+ }, ve = { class: "bing-file-preview__icon-badge" }, ye = { class: "bing-file-preview__heading" }, be = { class: "bing-file-preview__title" }, xe = { class: "bing-file-preview__meta" }, Se = { key: 0 }, Ce = { class: "bing-file-preview__actions" }, we = { class: "bing-file-preview__body" }, Te = {
17
+ key: 0,
18
+ class: "bing-file-preview__fallback"
19
+ }, Ee = {
20
+ class: "bing-file-preview__fallback-icon",
21
+ "aria-hidden": "true"
22
+ }, De = ["src", "title"], Oe = {
23
+ key: 2,
24
+ class: "bing-file-preview__table-wrap"
25
+ }, ke = {
26
+ key: 0,
27
+ class: "bing-file-preview__loader"
28
+ }, Ae = {
29
+ key: 1,
30
+ class: "bing-file-preview__fallback"
31
+ }, je = { class: "bing-file-preview__table-scroll" }, Me = { class: "bing-file-preview__table" }, Ne = {
32
+ key: 3,
33
+ class: "bing-file-preview__text-wrap"
34
+ }, Pe = {
35
+ key: 0,
36
+ class: "bing-file-preview__loader"
37
+ }, Fe = {
38
+ key: 1,
39
+ class: "bing-file-preview__fallback"
40
+ }, Ie = ["innerHTML"], Le = {
41
+ key: 1,
42
+ class: "bing-file-preview__text"
43
+ }, Re = {
44
+ key: 4,
45
+ class: "bing-file-preview__fallback"
46
+ }, ze = {
47
+ class: "bing-file-preview__fallback-icon",
48
+ "aria-hidden": "true"
49
+ }, Be = { class: "bing-file-preview__icon-badge" }, Ve = { class: "bing-file-preview__fallback-actions" }, He = {
50
+ key: 5,
51
+ class: "bing-file-preview__fallback"
52
+ }, Ue = {
53
+ class: "bing-file-preview__fallback-icon",
54
+ "aria-hidden": "true"
55
+ }, We = 180, k = /* @__PURE__ */ b({
56
+ __name: "BingFilePreview",
57
+ props: {
58
+ modelValue: {
59
+ type: Boolean,
60
+ default: !1
61
+ },
62
+ file: { default: void 0 },
63
+ src: { default: void 0 },
64
+ name: { default: void 0 },
65
+ type: { default: "auto" },
66
+ mimeType: { default: void 0 },
67
+ previewSrc: { default: void 0 },
68
+ content: { default: void 0 },
69
+ downloadUrl: { default: void 0 },
70
+ size: { default: void 0 },
71
+ zIndex: {},
72
+ width: { default: "min(1120px, calc(100vw - 36px))" },
73
+ height: { default: "min(760px, calc(100vh - 36px))" },
74
+ smoothScroll: {
75
+ type: [Boolean, Object],
76
+ default: !0
77
+ },
78
+ lockScroll: {
79
+ type: Boolean,
80
+ default: !0
81
+ },
82
+ closeOnEsc: {
83
+ type: Boolean,
84
+ default: !0
85
+ },
86
+ closeOnOverlay: {
87
+ type: Boolean,
88
+ default: !0
89
+ },
90
+ downloadable: {
91
+ type: Boolean,
92
+ default: !0
93
+ },
94
+ openable: {
95
+ type: Boolean,
96
+ default: !0
97
+ },
98
+ jsonHighlight: {
99
+ type: Boolean,
100
+ default: !0
101
+ },
102
+ jsonHighlightMaxLength: { default: 35e5 },
103
+ textMaxLength: { default: 24e4 },
104
+ csvMaxRows: { default: 80 },
105
+ csvMaxColumns: { default: 24 },
106
+ teleportTo: { default: "body" },
107
+ ariaLabel: { default: "文件预览" },
108
+ glass: {
109
+ type: Boolean,
110
+ default: d.glass
111
+ },
112
+ glassBlur: { default: void 0 },
113
+ glassOpacity: { default: void 0 },
114
+ glassSaturation: { default: void 0 }
115
+ },
116
+ emits: [
117
+ "update:modelValue",
118
+ "close",
119
+ "download",
120
+ "openExternal",
121
+ "error"
122
+ ],
123
+ setup(d, { emit: b }) {
124
+ let k = d, A = b, j = e("filePreview", () => k.zIndex), M = oe(), N = C(null), P = C(null), F = C(k.modelValue), I = C(!1), L = C("idle"), R = C(""), z = C(""), B = 0, V, H = 0, U = p(() => {
125
+ if (k.file) return {
126
+ ...k.file,
127
+ type: k.file.type ?? k.type,
128
+ mimeType: k.file.mimeType ?? k.mimeType,
129
+ previewSrc: k.file.previewSrc ?? k.previewSrc,
130
+ content: k.file.content ?? k.content,
131
+ downloadUrl: k.file.downloadUrl ?? k.downloadUrl,
132
+ size: k.file.size ?? k.size
133
+ };
134
+ if (!(!k.src && !k.content)) return {
135
+ src: k.src ?? "",
136
+ name: k.name,
137
+ type: k.type,
138
+ mimeType: k.mimeType,
139
+ previewSrc: k.previewSrc,
140
+ content: k.content,
141
+ downloadUrl: k.downloadUrl,
142
+ size: k.size
143
+ };
144
+ }), Ge = p(() => U.value?.name || ft(U.value?.src) || "未命名文件"), W = p(() => mt(U.value)), G = p(() => U.value?.previewSrc || U.value?.src || ""), K = p(() => U.value?.downloadUrl || U.value?.src || G.value), Ke = p(() => !!U.value), q = p(() => [
145
+ "text",
146
+ "json",
147
+ "csv"
148
+ ].includes(W.value)), qe = p(() => ["pdf"].includes(W.value) || Je.value), Je = p(() => [
149
+ "docx",
150
+ "xlsx",
151
+ "pptx",
152
+ "office"
153
+ ].includes(W.value) && !!U.value?.previewSrc), Ye = p(() => [
154
+ "docx",
155
+ "xlsx",
156
+ "pptx",
157
+ "office"
158
+ ].includes(W.value)), Xe = p(() => q.value && L.value === "loading"), Ze = p(() => q.value && L.value === "error"), Qe = p(() => `${Ge.value} 预览`), $e = p(() => [
159
+ "bing-file-preview-root",
160
+ `bing-file-preview-root--${W.value}`,
161
+ { "is-active": I.value }
162
+ ]), et = ae({
163
+ open: () => M.value && F.value && W.value !== "image",
164
+ elements: () => [N.value],
165
+ zIndex: () => j.value,
166
+ modal: !0,
167
+ closeOnEscape: () => k.modelValue && k.closeOnEsc,
168
+ onEscape: () => Z("escape")
169
+ }), tt = p(() => ({
170
+ ...se("bing-file-preview", {
171
+ glass: k.glass,
172
+ glassBlur: k.glassBlur,
173
+ glassOpacity: k.glassOpacity,
174
+ glassSaturation: k.glassSaturation
175
+ }),
176
+ zIndex: et.zIndex.value
177
+ })), nt = p(() => ({
178
+ width: dt(k.width),
179
+ height: dt(k.height)
180
+ })), rt = p(() => {
181
+ let e = U.value;
182
+ if (!e) return [];
183
+ let t = e.src || e.previewSrc;
184
+ return t ? [{
185
+ src: t,
186
+ previewSrc: e.previewSrc || t,
187
+ alt: e.name || "",
188
+ downloadUrl: e.downloadUrl || t,
189
+ downloadName: e.name,
190
+ caption: e.name
191
+ }] : [];
192
+ }), it = p(() => {
193
+ switch (W.value) {
194
+ case "image": return o;
195
+ case "pdf": return ne;
196
+ case "text": return te;
197
+ case "json": return a;
198
+ case "csv":
199
+ case "xlsx": return ee;
200
+ case "pptx": return re;
201
+ case "docx": return te;
202
+ default: return W.value === "unknown" ? s : i;
203
+ }
204
+ }), at = p(() => {
205
+ switch (W.value) {
206
+ case "image": return "IMG";
207
+ case "pdf": return "PDF";
208
+ case "text": return "TXT";
209
+ case "json": return "JSON";
210
+ case "csv": return "CSV";
211
+ case "docx": return "DOC";
212
+ case "xlsx": return "XLS";
213
+ case "pptx": return "PPT";
214
+ case "office": return "文档";
215
+ default: return "文件";
216
+ }
217
+ }), ot = p(() => {
218
+ switch (W.value) {
219
+ case "image": return "图片";
220
+ case "pdf": return "PDF";
221
+ case "text": return "文本";
222
+ case "json": return "JSON";
223
+ case "csv": return "CSV";
224
+ case "docx": return "Word 文档";
225
+ case "xlsx": return "电子表格";
226
+ case "pptx": return "演示文稿";
227
+ case "office": return "Office 文档";
228
+ default: return "文件";
229
+ }
230
+ }), st = p(() => {
231
+ let e = U.value?.size;
232
+ if (!e || e <= 0) return;
233
+ let t = [
234
+ "B",
235
+ "KB",
236
+ "MB",
237
+ "GB"
238
+ ], n = e, r = 0;
239
+ for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
240
+ return `${n.toFixed(r === 0 ? 0 : 1)} ${t[r]}`;
241
+ }), J = p(() => {
242
+ if (W.value !== "json") return R.value;
243
+ try {
244
+ return JSON.stringify(JSON.parse(R.value), null, 2);
245
+ } catch {
246
+ return R.value;
247
+ }
248
+ }), ct = p(() => W.value !== "json" || !k.jsonHighlight || J.value.length > k.jsonHighlightMaxLength ? $(J.value) : wt(J.value)), Y = p(() => W.value === "csv" ? Et(R.value).slice(0, k.csvMaxRows).map((e) => e.slice(0, k.csvMaxColumns)) : []), lt = p(() => Y.value[0] ?? []), ut = p(() => Y.value.slice(1));
249
+ function X() {
250
+ return typeof window < "u" && typeof document < "u";
251
+ }
252
+ function dt(e) {
253
+ return typeof e == "number" ? `${e}px` : e;
254
+ }
255
+ function ft(e) {
256
+ if (e) try {
257
+ let t = new URL(e, X() ? window.location.href : "http://localhost").pathname.split("/").filter(Boolean).pop();
258
+ return t ? decodeURIComponent(t) : void 0;
259
+ } catch {
260
+ return e.split("/").filter(Boolean).pop();
261
+ }
262
+ }
263
+ function pt(e) {
264
+ return ((e?.split(/[?#]/)[0])?.match(/\.([a-zA-Z0-9]+)$/))?.[1]?.toLowerCase();
265
+ }
266
+ function mt(e) {
267
+ if (!e) return "unknown";
268
+ if (e.type && e.type !== "auto") return e.type === "office" ? "office" : e.type;
269
+ let t = e.mimeType?.toLowerCase() ?? "", n = pt(e.name) || pt(e.src);
270
+ return t.startsWith("image/") ? "image" : t === "application/pdf" || n === "pdf" ? "pdf" : t.includes("json") || n === "json" ? "json" : t.includes("csv") || n === "csv" ? "csv" : t.startsWith("text/") || [
271
+ "txt",
272
+ "md",
273
+ "log",
274
+ "xml",
275
+ "html",
276
+ "css",
277
+ "js",
278
+ "ts"
279
+ ].includes(n ?? "") ? "text" : n === "docx" || t.includes("wordprocessingml") ? "docx" : n === "xlsx" || t.includes("spreadsheetml") ? "xlsx" : n === "pptx" || t.includes("presentationml") ? "pptx" : "unknown";
280
+ }
281
+ let { lock: ht, unlock: gt } = ce();
282
+ function Z(e) {
283
+ P.value?.stop(), A("update:modelValue", !1), A("close", e);
284
+ }
285
+ function _t() {
286
+ k.closeOnOverlay && Z("overlay");
287
+ }
288
+ function vt(e) {
289
+ Z(e);
290
+ }
291
+ function yt() {
292
+ let e = U.value;
293
+ if (!e || (A("download", {
294
+ file: e,
295
+ kind: W.value
296
+ }), !X() || !K.value)) return;
297
+ let t = document.createElement("a");
298
+ t.href = K.value, t.download = e.name || "", t.rel = "noopener", document.body.appendChild(t), t.click(), t.remove();
299
+ }
300
+ function bt() {
301
+ let e = U.value;
302
+ !e || !X() || (A("openExternal", {
303
+ file: e,
304
+ kind: W.value
305
+ }), window.open(G.value || e.src, "_blank", "noopener,noreferrer"));
306
+ }
307
+ function xt() {
308
+ X() && (B &&= (window.cancelAnimationFrame(B), 0), V &&= (window.clearTimeout(V), void 0));
309
+ }
310
+ async function St(e) {
311
+ if (W.value === "image") {
312
+ F.value = e, I.value = e;
313
+ return;
314
+ }
315
+ if (!X()) {
316
+ F.value = e, I.value = e;
317
+ return;
318
+ }
319
+ if (xt(), e) {
320
+ k.lockScroll && ht(), F.value = !0, I.value = !1, await de(), et.isTop() && N.value?.focus(), B = window.requestAnimationFrame(() => {
321
+ B = 0, I.value = !0;
322
+ });
323
+ return;
324
+ }
325
+ I.value = !1, V = window.setTimeout(() => {
326
+ V = void 0, F.value = !1, gt();
327
+ }, We);
328
+ }
329
+ async function Ct() {
330
+ let e = ++H, t = U.value;
331
+ if (!k.modelValue || !t || !q.value) {
332
+ L.value = "idle", R.value = "", z.value = "";
333
+ return;
334
+ }
335
+ if (t.content !== void 0) {
336
+ R.value = Q(t.content), L.value = "loaded", z.value = "";
337
+ return;
338
+ }
339
+ if (!t.src) {
340
+ L.value = "error", z.value = "未提供文件地址";
341
+ return;
342
+ }
343
+ L.value = "loading", z.value = "";
344
+ try {
345
+ let n = await fetch(t.src);
346
+ if (!n.ok) throw Error(`文件请求失败(${n.status})`);
347
+ let r = await n.text();
348
+ if (e !== H) return;
349
+ R.value = Q(r), L.value = "loaded";
350
+ } catch (t) {
351
+ if (e !== H) return;
352
+ let n = t instanceof Error ? t : /* @__PURE__ */ Error("文件加载失败");
353
+ L.value = "error", z.value = "文件加载失败,请重试或下载后查看。", A("error", n);
354
+ }
355
+ }
356
+ function Q(e) {
357
+ return e.length <= k.textMaxLength ? e : `${e.slice(0, k.textMaxLength)}\n\n…内容已截断`;
358
+ }
359
+ function $(e) {
360
+ return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
361
+ }
362
+ function wt(e) {
363
+ let t = /("(?:\\.|[^"\\])*"(?=\s*:))|("(?:\\.|[^"\\])*")|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g, n = 0, r = "";
364
+ for (let i of e.matchAll(t)) {
365
+ let t = i.index ?? 0, a = i[0];
366
+ r += $(e.slice(n, t)), r += `<span class="${Tt(i)}">${$(a)}</span>`, n = t + a.length;
367
+ }
368
+ return r += $(e.slice(n)), r;
369
+ }
370
+ function Tt(e) {
371
+ return e[1] ? "bing-file-preview__json-token bing-file-preview__json-token--key" : e[2] ? "bing-file-preview__json-token bing-file-preview__json-token--string" : e[3] ? `bing-file-preview__json-token bing-file-preview__json-token--${e[3]}` : "bing-file-preview__json-token bing-file-preview__json-token--number";
372
+ }
373
+ function Et(e) {
374
+ let t = [], n = [], r = "", i = !1;
375
+ for (let a = 0; a < e.length; a += 1) {
376
+ let o = e[a], s = e[a + 1];
377
+ if (o === "\"" && i && s === "\"") {
378
+ r += "\"", a += 1;
379
+ continue;
380
+ }
381
+ if (o === "\"") {
382
+ i = !i;
383
+ continue;
384
+ }
385
+ if (o === "," && !i) {
386
+ n.push(r), r = "";
387
+ continue;
388
+ }
389
+ if ((o === "\n" || o === "\r") && !i) {
390
+ o === "\r" && s === "\n" && (a += 1), n.push(r), t.push(n), n = [], r = "";
391
+ continue;
392
+ }
393
+ r += o;
394
+ }
395
+ return n.push(r), t.push(n), t.filter((e) => e.some((e) => e.length > 0));
396
+ }
397
+ return D([M, () => k.modelValue], ([e, t]) => {
398
+ e && St(t);
399
+ }, { immediate: !0 }), D(() => k.modelValue, (e) => {
400
+ e || P.value?.stop();
401
+ }), D(() => [
402
+ M.value,
403
+ k.modelValue,
404
+ W.value,
405
+ U.value?.src,
406
+ U.value?.content
407
+ ], () => {
408
+ M.value && Ct();
409
+ }, { immediate: !0 }), pe(() => {
410
+ P.value?.stop(), xt(), gt();
411
+ }), (e, a) => W.value === "image" ? (S(), m(le, {
412
+ key: 0,
413
+ "model-value": d.modelValue,
414
+ items: rt.value,
415
+ downloadable: d.downloadable,
416
+ "z-index": E(j),
417
+ "lock-scroll": d.lockScroll,
418
+ "close-on-esc": d.closeOnEsc,
419
+ "close-on-overlay": d.closeOnOverlay,
420
+ glass: d.glass,
421
+ "glass-blur": d.glassBlur,
422
+ "glass-opacity": d.glassOpacity,
423
+ "glass-saturation": d.glassSaturation,
424
+ "onUpdate:modelValue": a[0] ||= (e) => A("update:modelValue", e),
425
+ onClose: vt
426
+ }, null, 8, [
427
+ "model-value",
428
+ "items",
429
+ "downloadable",
430
+ "z-index",
431
+ "lock-scroll",
432
+ "close-on-esc",
433
+ "close-on-overlay",
434
+ "glass",
435
+ "glass-blur",
436
+ "glass-opacity",
437
+ "glass-saturation"
438
+ ])) : E(M) ? (S(), m(ue, {
439
+ key: 1,
440
+ to: d.teleportTo
441
+ }, [F.value ? (S(), g("div", {
442
+ key: 0,
443
+ ref_key: "rootRef",
444
+ ref: N,
445
+ class: fe($e.value),
446
+ style: x(tt.value),
447
+ tabindex: "-1",
448
+ role: "dialog",
449
+ "aria-modal": "true",
450
+ "aria-label": d.ariaLabel
451
+ }, [_("div", {
452
+ class: "bing-file-preview__backdrop",
453
+ "aria-hidden": "true",
454
+ onClick: _t
455
+ }), _("section", {
456
+ class: "bing-file-preview",
457
+ style: x(nt.value)
458
+ }, [_("header", he, [_("div", ge, [_("span", _e, [y(l, {
459
+ icon: it.value,
460
+ size: "md"
461
+ }, null, 8, ["icon"]), _("span", ve, T(at.value), 1)]), _("div", ye, [_("h2", be, T(Ge.value), 1), _("div", xe, [_("span", null, T(ot.value), 1), st.value ? (S(), g("span", Se, T(st.value), 1)) : h("", !0)])])]), _("div", Ce, [
462
+ d.openable && G.value ? (S(), m(t, {
463
+ key: 0,
464
+ throttle: !1,
465
+ variant: "ghost",
466
+ size: "sm",
467
+ "aria-label": "在新标签页打开文件",
468
+ onClick: bt
469
+ }, {
470
+ prefix: O(() => [y(l, {
471
+ icon: E(r),
472
+ size: "sm"
473
+ }, null, 8, ["icon"])]),
474
+ _: 1
475
+ })) : h("", !0),
476
+ d.downloadable && K.value ? (S(), m(t, {
477
+ key: 1,
478
+ throttle: !1,
479
+ variant: "ghost",
480
+ size: "sm",
481
+ "aria-label": "下载文件",
482
+ onClick: yt
483
+ }, {
484
+ prefix: O(() => [y(l, {
485
+ icon: E(n),
486
+ size: "sm"
487
+ }, null, 8, ["icon"])]),
488
+ _: 1
489
+ })) : h("", !0),
490
+ y(t, {
491
+ throttle: !1,
492
+ variant: "ghost",
493
+ size: "sm",
494
+ "aria-label": "关闭文件预览",
495
+ onClick: a[1] ||= (e) => Z("close")
496
+ }, {
497
+ prefix: O(() => [y(l, {
498
+ icon: E(ie),
499
+ size: "sm"
500
+ }, null, 8, ["icon"])]),
501
+ _: 1
502
+ })
503
+ ])]), _("div", we, [Ke.value ? W.value === "pdf" || qe.value ? (S(), g("iframe", {
504
+ key: 1,
505
+ class: "bing-file-preview__frame",
506
+ src: G.value,
507
+ title: Qe.value
508
+ }, null, 8, De)) : W.value === "csv" ? (S(), g("div", Oe, [Xe.value ? (S(), g("div", ke, [y(l, {
509
+ icon: E(c),
510
+ size: "md"
511
+ }, null, 8, ["icon"]), a[3] ||= _("span", null, "正在加载文件", -1)])) : Ze.value ? (S(), g("div", Ae, [a[4] ||= _("h3", null, "CSV 文件加载失败", -1), _("p", null, T(z.value), 1)])) : (S(), m(u, {
512
+ key: 2,
513
+ ref_key: "contentScrollRef",
514
+ ref: P,
515
+ class: "bing-file-preview__scroll",
516
+ height: "100%",
517
+ smooth: d.smoothScroll,
518
+ horizontal: "",
519
+ always: "",
520
+ "aria-label": "CSV 预览内容"
521
+ }, {
522
+ default: O(() => [_("div", je, [_("table", Me, [_("thead", null, [_("tr", null, [(S(!0), g(f, null, w(lt.value, (e, t) => (S(), g("th", { key: `head-${t}` }, T(e || `第 ${t + 1} 列`), 1))), 128))])]), _("tbody", null, [(S(!0), g(f, null, w(ut.value, (e, t) => (S(), g("tr", { key: `row-${t}` }, [(S(!0), g(f, null, w(e, (e, n) => (S(), g("td", { key: `cell-${t}-${n}` }, T(e), 1))), 128))]))), 128))])])])]),
523
+ _: 1
524
+ }, 8, ["smooth"]))])) : W.value === "text" || W.value === "json" ? (S(), g("div", Ne, [Xe.value ? (S(), g("div", Pe, [y(l, {
525
+ icon: E(c),
526
+ size: "md"
527
+ }, null, 8, ["icon"]), a[5] ||= _("span", null, "正在加载文件", -1)])) : Ze.value ? (S(), g("div", Fe, [a[6] ||= _("h3", null, "文本加载失败", -1), _("p", null, T(z.value), 1)])) : (S(), m(u, {
528
+ key: 2,
529
+ ref_key: "contentScrollRef",
530
+ ref: P,
531
+ class: "bing-file-preview__scroll",
532
+ height: "100%",
533
+ smooth: d.smoothScroll,
534
+ always: "",
535
+ "aria-label": "文本预览内容"
536
+ }, {
537
+ default: O(() => [W.value === "json" ? (S(), g("pre", {
538
+ key: 0,
539
+ class: "bing-file-preview__text bing-file-preview__text--json",
540
+ innerHTML: ct.value
541
+ }, null, 8, Ie)) : (S(), g("pre", Le, T(J.value), 1))]),
542
+ _: 1
543
+ }, 8, ["smooth"]))])) : Ye.value ? (S(), g("div", Re, [
544
+ _("span", ze, [y(l, {
545
+ icon: it.value,
546
+ size: "xl"
547
+ }, null, 8, ["icon"]), _("span", Be, T(at.value), 1)]),
548
+ a[9] ||= _("h3", null, "暂不支持直接预览此文档", -1),
549
+ a[10] ||= _("p", null, " 此文档暂时无法在线预览,可在新标签页打开或下载后查看。 ", -1),
550
+ _("div", Ve, [d.openable && G.value ? (S(), m(t, {
551
+ key: 0,
552
+ throttle: !1,
553
+ variant: "secondary",
554
+ onClick: bt
555
+ }, {
556
+ prefix: O(() => [y(l, {
557
+ icon: E(r),
558
+ size: "sm"
559
+ }, null, 8, ["icon"])]),
560
+ default: O(() => [a[7] ||= v(" 打开 ", -1)]),
561
+ _: 1
562
+ })) : h("", !0), d.downloadable && K.value ? (S(), m(t, {
563
+ key: 1,
564
+ throttle: !1,
565
+ variant: "primary",
566
+ onClick: yt
567
+ }, {
568
+ prefix: O(() => [y(l, {
569
+ icon: E(n),
570
+ size: "sm"
571
+ }, null, 8, ["icon"])]),
572
+ default: O(() => [a[8] ||= v(" 下载 ", -1)]),
573
+ _: 1
574
+ })) : h("", !0)])
575
+ ])) : (S(), g("div", He, [
576
+ _("span", Ue, [y(l, {
577
+ icon: E(i),
578
+ size: "xl"
579
+ }, null, 8, ["icon"])]),
580
+ a[11] ||= _("h3", null, "暂不支持此文件预览", -1),
581
+ a[12] ||= _("p", null, "请下载文件后查看。", -1)
582
+ ])) : (S(), g("div", Te, [_("span", Ee, [y(l, {
583
+ icon: E(i),
584
+ size: "xl"
585
+ }, null, 8, ["icon"])]), a[2] ||= _("h3", null, "未选择文件", -1)]))])], 4)], 14, me)) : h("", !0)], 8, ["to"])) : h("", !0);
586
+ }
587
+ });
588
+ //#endregion
589
+ export { k as default };
@@ -0,0 +1,7 @@
1
+ //#region src/components/BingForm/BingForm.context.ts
2
+ var e = Symbol("BingFormContext"), t = Symbol("BingFormItemContext");
3
+ function n(e) {
4
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, [...t]]));
5
+ }
6
+ //#endregion
7
+ export { e as bingFormContextKey, t as bingFormItemContextKey, n as cloneErrors };
@@ -0,0 +1,7 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "./BingForm.vue_vue_type_script_setup_true_lang.js";
3
+ /* empty css */
4
+ //#region src/components/BingForm/BingForm.vue
5
+ var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-1fb61d96"]]);
6
+ //#endregion
7
+ export { n as default };
@@ -13,7 +13,6 @@ declare const __VLS_base: import('vue').DefineComponent<BingFormProps, BingFormE
13
13
  disabled: boolean;
14
14
  columns: BingFormResponsiveNumber;
15
15
  gap: BingFormGap;
16
- size: import('./BingForm.types').BingFormSize;
17
16
  layout: import('./BingForm.types').BingFormLayout;
18
17
  model: BingFormModel;
19
18
  schema: import('./BingForm.types').BingFormSchema;