fast-element-plus 2.0.23 → 2.0.25

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,35 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and releases should follow [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [2.0.25] - 2026-10-19
8
+
9
+ ### Fixed
10
+
11
+ - Keep `FaTable` expansion content horizontally sticky, remove the expanded cell's default padding, and move wrapper styles into the stylesheet with a configurable `--fa-table-expand-width` (default `100cqw`).
12
+ - Scope table, dialog and drawer structural styles to their own elements; support table headers in both fixed and auto layouts without styling nested tables.
13
+ - Apply table date-range popper styles after Teleport, including the compact size, and let mobile search controls override compact desktop widths.
14
+ - Let responsive icon-selector popper widths override Element Plus's inline automatic width.
15
+ - Restore compact detail-form spacing, limit twinkle animation to the direct child, and remove obsolete internal table styles and duplicate form rules.
16
+ - Keep drawer resize handles inside the clipped body and increase their desktop hit area to 8px; suppress custom loading animation and component size transitions when reduced motion is requested.
17
+
18
+ ### Changed
19
+
20
+ - Organize component styles around existing `fa-*` namespaces with shallow nesting for related elements and states, merge repeated selectors within the same scope, consolidate size variants into local CSS variables, and use internal table/tree hooks instead of repeated Element Plus DOM chains.
21
+ - Use ordinary component scopes for internal overrides and states; reserve context specificity reduction for long structural boundaries and overridable table defaults. Retain standalone Teleport namespaces and remove unused Sass imports and the unused desktop mixin.
22
+ - Target dialog/drawer scrollbar views and every built-in table-image branch through dedicated classes, replacing three contextual `:where()` selectors without increasing specificity.
23
+ - Use parent selectors for same-element states and pseudo-elements while keeping standalone component element names explicit. Standardize runtime size classes on hyphenated suffixes, including `fa-form-detail-small`, and remove legacy underscore classes and compatibility selectors.
24
+
25
+ ### Documentation and Tooling
26
+
27
+ - Document the shared SCSS organization, naming, spacing, specificity and validation conventions in `AGENTS.md`; normalize spacing between style rules without changing compiled CSS.
28
+
29
+ ## [2.0.24] - 2026-10-18
30
+
31
+ ### Fixed
32
+
33
+ - Size `FaTable` expansion content to its main container with `100cqw` and border-box sizing, independently of the total column width.
34
+ - Apply 16px padding to expansion content, reduced to 12px for the `small` component size.
35
+
7
36
  ## [2.0.23] - 2026-10-17
8
37
 
9
38
  ### Added
@@ -259,6 +288,8 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
259
288
  - Scoped Table styles and added responsive IconSelector styling.
260
289
  - Improved dialogs, drawers, tables, forms, trees, selectors, car-number input, images, and uploads for dark mode, touch input, and narrow viewports.
261
290
 
291
+ [2.0.25]: https://gitee.com/FastDotnet/fast.element.plus/compare/v2.0.24...v2.0.25
292
+ [2.0.24]: https://gitee.com/FastDotnet/fast.element.plus/compare/v2.0.23...v2.0.24
262
293
  [2.0.23]: https://gitee.com/FastDotnet/fast.element.plus/compare/v2.0.22...v2.0.23
263
294
  [2.0.22]: https://gitee.com/FastDotnet/fast.element.plus/compare/v2.0.21...v2.0.22
264
295
  [2.0.21]: https://gitee.com/FastDotnet/fast.element.plus/compare/v2.0.20...v2.0.21
@@ -245,7 +245,10 @@ var dialog_default = defineComponent({
245
245
  "onClick": handleCloseClick
246
246
  }, [createVNode(ElIcon, null, { default: () => [createVNode(Close, null, null)] })])
247
247
  ]),
248
- default: () => withDirectives(createVNode(ElScrollbar, { "element-loading-text": "加载中..." }, { default: () => [!state.refreshing && slots.default?.(state)] }), [[resolveDirective("loading"), state.loading]]),
248
+ default: () => withDirectives(createVNode(ElScrollbar, {
249
+ "viewClass": "fa-dialog__scrollbar-view",
250
+ "element-loading-text": "加载中..."
251
+ }, { default: () => [!state.refreshing && slots.default?.(state)] }), [[resolveDirective("loading"), state.loading]]),
249
252
  ...!props.hideFooter && { footer: () => [createVNode(Fragment, null, [
250
253
  slots.footer?.({
251
254
  loading: state.loading,
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.mjs","names":["update:modelValue"],"sources":["../../../../src/components/dialog/src/dialog.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, nextTick, reactive, shallowRef, toRef, watch } from \"vue\";\nimport { Close, Eleme, Refresh } from \"@element-plus/icons-vue\";\nimport { ElButton, ElDialog, ElIcon, ElMessage, ElMessageBox, ElScrollbar, dialogEmits, dialogProps, useGlobalSize } from \"element-plus\";\nimport { FullScreen, FullScreenExit } from \"@fast-element-plus/icons-vue\";\nimport { callOptionalFunction, definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { DialogInstance } from \"element-plus\";\n\n/** FaDialog 的运行时 Props 定义 */\nexport const faDialogProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...dialogProps,\n\t/** whether to align the dialog both horizontally and vertically */\n\talignCenter: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */\n\tappendToBody: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** enable dragging feature for Dialog */\n\tdraggable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** destroy elements in Dialog when closed */\n\tdestroyOnClose: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** draggable Dialog can overflow the viewport */\n\toverflow: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** value for `margin-top` of Dialog CSS, default is 15vh */\n\ttop: {\n\t\ttype: String,\n\t\tdefault: \"5vh\",\n\t},\n\t/** width of Dialog, default is 50% */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"90%\",\n\t},\n\t/** 显示刷新按钮 */\n\tshowRefresh: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示全屏图标 */\n\tshowFullscreen: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示关闭按钮 */\n\tshowCloseButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示确认按钮 */\n\tshowConfirmButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 禁用确认按钮 */\n\tdisabledConfirmButton: Boolean,\n\t/** 关闭按钮文字,默认取消 */\n\tcloseButtonText: {\n\t\ttype: String,\n\t\tdefault: \"取消\",\n\t},\n\t/** 确认按钮文字,默认确认 */\n\tconfirmButtonText: {\n\t\ttype: String,\n\t\tdefault: \"确认\",\n\t},\n\t/** 隐藏底部操作 */\n\thideFooter: Boolean,\n\t/** 撑满高度 */\n\tfullHeight: Boolean,\n\t/** 显示关闭回调 */\n\tshowBeforeClose: Boolean,\n\t/** 打开之后 */\n\tafterOpen: {\n\t\ttype: definePropType<() => void | Promise<void>>(Function),\n\t},\n};\n\n/** FaDialog 的运行时 Emits 定义 */\nexport const faDialogEmits = {\n\t...dialogEmits,\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: boolean) => typeof value === \"boolean\",\n\t/** 确认按钮点击事件 */\n\tconfirmClick: () => true,\n};\n\n/** FaDialog 的插槽参数 */\nexport interface FaDialogSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: { loading: boolean };\n\t/** 头部插槽 */\n\theader: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 标题插槽 */\n\ttitle: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 底部插槽 */\n\tfooter: { loading: boolean; close: () => void };\n}\n\nexport default defineComponent({\n\tname: \"FaDialog\",\n\tprops: faDialogProps,\n\temits: faDialogEmits,\n\tslots: makeSlots<FaDialogSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst dialogRef = shallowRef<DialogInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t\tvisible: false,\n\t\t\tfullscreen: false,\n\t\t\trefreshing: false,\n\t\t});\n\n\t\tlet cacheOpenFunction: (() => void | Promise<void>) | undefined;\n\n\t\tconst handleOpen = async (openFunction?: () => void | Promise<void>) => {\n\t\t\tstate.visible = true;\n\t\t\tcacheOpenFunction = openFunction;\n\t\t\tawait nextTick();\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(props.afterOpen ?? openFunction);\n\t\t\t\temit(\"open\");\n\t\t\t} catch (error) {\n\t\t\t\tstate.visible = false;\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleClose = async (closeFunction?: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(closeFunction);\n\t\t\t\temit(\"close\");\n\t\t\t\tstate.visible = false;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleRefresh = async () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.refreshing = true;\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 500);\n\t\t\t\t});\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tawait handleOpen(cacheOpenFunction);\n\t\t\t\tElMessage.success(\"刷新成功\");\n\t\t\t} finally {\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleBeforeClose = (done: () => void) => {\n\t\t\tif (state.loading) return;\n\t\t\t// 解决 image 预览摁下 ese 会关闭弹窗的问题\n\t\t\tif (document.querySelector(\".el-image-viewer__wrapper\")) return;\n\n\t\t\tconst newDone = () => {\n\t\t\t\t// 组件对外约定为无参数完成钩子,不采用 Element Plus 的 done 回调签名。\n\t\t\t\treturn callOptionalFunction(props.beforeClose, done).then(() => {\n\t\t\t\t\temit(\"close\");\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (props.showBeforeClose) {\n\t\t\t\t// 用户取消关闭属于正常分支,无需继续执行 beforeClose。\n\t\t\t\tElMessageBox.confirm(\"确定关闭?\", { type: \"warning\" }).then(() => newDone());\n\t\t\t} else {\n\t\t\t\tnewDone();\n\t\t\t}\n\t\t};\n\n\t\tconst handleFullscreen = () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.fullscreen = !state.fullscreen;\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\temit(\"confirmClick\");\n\t\t};\n\n\t\tconst handleCloseClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\thandleClose();\n\t\t};\n\n\t\twatch(\n\t\t\t() => state.visible,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"update:modelValue\", newValue);\n\t\t\t}\n\t\t);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elDialogProps = useProps(props, dialogProps, [\"modelValue\", \"fullscreen\", \"showClose\", \"beforeClose\"]);\n\t\t// open、close 是 Fast 异步业务流程完成事件,不直接透传 Element Plus 的同名生命周期事件。\n\t\tconst elDialogEmits = useEmits(dialogEmits, emit, [\"open\", \"close\", \"update:modelValue\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElDialog\n\t\t\t\t{...elDialogProps.value}\n\t\t\t\t{...elDialogEmits.value}\n\t\t\t\tref={dialogRef}\n\t\t\t\tclass={[\n\t\t\t\t\t\"fa-dialog\",\n\t\t\t\t\t`fa-dialog-${globalSize.value}`,\n\t\t\t\t\t{ \"fa-dialog__full-height\": props.fullHeight, \"fa-dialog__fullscreen\": state.fullscreen },\n\t\t\t\t]}\n\t\t\t\tvModel={state.visible}\n\t\t\t\tfullscreen={state.fullscreen}\n\t\t\t\tshowClose={false}\n\t\t\t\tbeforeClose={handleBeforeClose}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\theader: ({ titleId, titleClass }: { close: () => void; titleId: string; titleClass: string }) => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div id={titleId} class={[\"fa-dialog__header-title\", titleClass]}>\n\t\t\t\t\t\t\t\t{slots.title?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass }) ?? props.title}\n\t\t\t\t\t\t\t\t{slots.header?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass })}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{props.showRefresh && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"刷新\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-dialog__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleRefresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t<Refresh />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showFullscreen && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle={state.fullscreen ? \"关闭全屏显示\" : \"全屏显示\"}\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-dialog__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleFullscreen}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>{state.fullscreen ? <FullScreenExit /> : <FullScreen />}</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showClose && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"关闭\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-dialog__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleCloseClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t<Close />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<ElScrollbar vLoading={state.loading} element-loading-text=\"加载中...\">\n\t\t\t\t\t\t\t{!state.refreshing && slots.default?.(state)}\n\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t),\n\t\t\t\t\t...(!props.hideFooter && {\n\t\t\t\t\t\tfooter: () => [\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{slots.footer?.({ loading: state.loading, close: handleCloseClick })}\n\t\t\t\t\t\t\t\t{props.showCloseButton && (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.loading} onClick={handleCloseClick}>\n\t\t\t\t\t\t\t\t\t\t{props.closeButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{props.showConfirmButton && (\n\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\tloadingIcon={Eleme}\n\t\t\t\t\t\t\t\t\t\tdisabled={props.disabledConfirmButton}\n\t\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{state.loading ? \"加载中...\" : props.confirmButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElDialog>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 调用原生关闭流程,并执行 beforeClose。 */\n\t\t\thandleClose: computed(() => dialogRef.value?.handleClose),\n\t\t\t/** 弹窗内容引用 */\n\t\t\tdialogContentRef: computed<{ resetPosition: () => void; updatePosition: () => void } | undefined>(\n\t\t\t\t() => dialogRef.value?.dialogContentRef as { resetPosition: () => void; updatePosition: () => void } | undefined\n\t\t\t),\n\t\t\t/** 重置位置 */\n\t\t\tresetPosition: computed(() => dialogRef.value?.resetPosition),\n\t\t\t/** 加载状态 */\n\t\t\tloading: toRef(state, \"loading\"),\n\t\t\t/** 是否显示 */\n\t\t\tvisible: toRef(state, \"visible\"),\n\t\t\t/** 打开弹窗 */\n\t\t\topen: handleOpen,\n\t\t\t/** 关闭弹窗 */\n\t\t\tclose: handleClose,\n\t\t\t/** 刷新弹窗 */\n\t\t\trefresh: handleRefresh,\n\t\t\t/** 弹窗加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,WAAW;EACV,MAAM;EACN,SA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Q;IAAgB,GAAA,CAAA,YAAA,QAAA,MAAA,EAAA,eAAA,CAAA,YAAA,OAAA,MAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA;GAM1B,CAAA;GAGH,eAAS,eAAA,YAAA,aAAA,EAAA,wBAAA,SAAA,GAAA,EAAA,eAAA,CAEN,CAAC,MAAM,cAAc,MAAM,UAAU,KAAK,CAAC,EAAA,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GADtB,MAAM,OAAO,CAAA,CAAA;GAIrC,GAAI,CAAC,MAAM,cAAc,EACxB,cAAc,CAAA,YAAA,UAAA,MAAA;IAEX,MAAM,SAAS;KAAE,SAAS,MAAM;KAAS,OAAO;IAAiB,CAAC;IAClE,MAAM,mBAAe,YAAA,UAAA;KAAA,YACD,MAAM;KAAO,WAAW;IAAgB,GAAA,EAAA,eAAA,CAC1D,MAAM,eAAe,EAAA,CAAA;IAGvB,MAAM,qBAAiB,YAAA,UAAA;KAAA,WAEb,MAAM;KAAO,eACT;KAAK,YACR,MAAM;KAAqB,QAAA;KAAA,WAE5B;IAAkB,GAAA,EAAA,eAAA,CAE1B,MAAM,UAAU,WAAW,MAAM,iBAAiB,EAAA,CAAA;GAEpD,CAAA,CAAA,EAGJ;EAAE,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;GAExB,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,kBAAkB,eACX,UAAU,OAAO,gBACxB;;GAEA,eAAe,eAAe,UAAU,OAAO,aAAa;;GAE5D,SAAS,MAAM,OAAO,SAAS;;GAE/B,SAAS,MAAM,OAAO,SAAS;;GAE/B,MAAM;;GAEN,OAAO;;GAEP,SAAS;;GAET,WAAW;EACZ,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"dialog.mjs","names":["update:modelValue"],"sources":["../../../../src/components/dialog/src/dialog.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, nextTick, reactive, shallowRef, toRef, watch } from \"vue\";\nimport { Close, Eleme, Refresh } from \"@element-plus/icons-vue\";\nimport { ElButton, ElDialog, ElIcon, ElMessage, ElMessageBox, ElScrollbar, dialogEmits, dialogProps, useGlobalSize } from \"element-plus\";\nimport { FullScreen, FullScreenExit } from \"@fast-element-plus/icons-vue\";\nimport { callOptionalFunction, definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { DialogInstance } from \"element-plus\";\n\n/** FaDialog 的运行时 Props 定义 */\nexport const faDialogProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...dialogProps,\n\t/** whether to align the dialog both horizontally and vertically */\n\talignCenter: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */\n\tappendToBody: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** enable dragging feature for Dialog */\n\tdraggable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** destroy elements in Dialog when closed */\n\tdestroyOnClose: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** draggable Dialog can overflow the viewport */\n\toverflow: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** value for `margin-top` of Dialog CSS, default is 15vh */\n\ttop: {\n\t\ttype: String,\n\t\tdefault: \"5vh\",\n\t},\n\t/** width of Dialog, default is 50% */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"90%\",\n\t},\n\t/** 显示刷新按钮 */\n\tshowRefresh: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示全屏图标 */\n\tshowFullscreen: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示关闭按钮 */\n\tshowCloseButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示确认按钮 */\n\tshowConfirmButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 禁用确认按钮 */\n\tdisabledConfirmButton: Boolean,\n\t/** 关闭按钮文字,默认取消 */\n\tcloseButtonText: {\n\t\ttype: String,\n\t\tdefault: \"取消\",\n\t},\n\t/** 确认按钮文字,默认确认 */\n\tconfirmButtonText: {\n\t\ttype: String,\n\t\tdefault: \"确认\",\n\t},\n\t/** 隐藏底部操作 */\n\thideFooter: Boolean,\n\t/** 撑满高度 */\n\tfullHeight: Boolean,\n\t/** 显示关闭回调 */\n\tshowBeforeClose: Boolean,\n\t/** 打开之后 */\n\tafterOpen: {\n\t\ttype: definePropType<() => void | Promise<void>>(Function),\n\t},\n};\n\n/** FaDialog 的运行时 Emits 定义 */\nexport const faDialogEmits = {\n\t...dialogEmits,\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: boolean) => typeof value === \"boolean\",\n\t/** 确认按钮点击事件 */\n\tconfirmClick: () => true,\n};\n\n/** FaDialog 的插槽参数 */\nexport interface FaDialogSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: { loading: boolean };\n\t/** 头部插槽 */\n\theader: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 标题插槽 */\n\ttitle: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 底部插槽 */\n\tfooter: { loading: boolean; close: () => void };\n}\n\nexport default defineComponent({\n\tname: \"FaDialog\",\n\tprops: faDialogProps,\n\temits: faDialogEmits,\n\tslots: makeSlots<FaDialogSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst dialogRef = shallowRef<DialogInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t\tvisible: false,\n\t\t\tfullscreen: false,\n\t\t\trefreshing: false,\n\t\t});\n\n\t\tlet cacheOpenFunction: (() => void | Promise<void>) | undefined;\n\n\t\tconst handleOpen = async (openFunction?: () => void | Promise<void>) => {\n\t\t\tstate.visible = true;\n\t\t\tcacheOpenFunction = openFunction;\n\t\t\tawait nextTick();\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(props.afterOpen ?? openFunction);\n\t\t\t\temit(\"open\");\n\t\t\t} catch (error) {\n\t\t\t\tstate.visible = false;\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleClose = async (closeFunction?: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(closeFunction);\n\t\t\t\temit(\"close\");\n\t\t\t\tstate.visible = false;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleRefresh = async () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.refreshing = true;\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 500);\n\t\t\t\t});\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tawait handleOpen(cacheOpenFunction);\n\t\t\t\tElMessage.success(\"刷新成功\");\n\t\t\t} finally {\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleBeforeClose = (done: () => void) => {\n\t\t\tif (state.loading) return;\n\t\t\t// 解决 image 预览摁下 ese 会关闭弹窗的问题\n\t\t\tif (document.querySelector(\".el-image-viewer__wrapper\")) return;\n\n\t\t\tconst newDone = () => {\n\t\t\t\t// 组件对外约定为无参数完成钩子,不采用 Element Plus 的 done 回调签名。\n\t\t\t\treturn callOptionalFunction(props.beforeClose, done).then(() => {\n\t\t\t\t\temit(\"close\");\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (props.showBeforeClose) {\n\t\t\t\t// 用户取消关闭属于正常分支,无需继续执行 beforeClose。\n\t\t\t\tElMessageBox.confirm(\"确定关闭?\", { type: \"warning\" }).then(() => newDone());\n\t\t\t} else {\n\t\t\t\tnewDone();\n\t\t\t}\n\t\t};\n\n\t\tconst handleFullscreen = () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.fullscreen = !state.fullscreen;\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\temit(\"confirmClick\");\n\t\t};\n\n\t\tconst handleCloseClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\thandleClose();\n\t\t};\n\n\t\twatch(\n\t\t\t() => state.visible,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"update:modelValue\", newValue);\n\t\t\t}\n\t\t);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elDialogProps = useProps(props, dialogProps, [\"modelValue\", \"fullscreen\", \"showClose\", \"beforeClose\"]);\n\t\t// open、close 是 Fast 异步业务流程完成事件,不直接透传 Element Plus 的同名生命周期事件。\n\t\tconst elDialogEmits = useEmits(dialogEmits, emit, [\"open\", \"close\", \"update:modelValue\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElDialog\n\t\t\t\t{...elDialogProps.value}\n\t\t\t\t{...elDialogEmits.value}\n\t\t\t\tref={dialogRef}\n\t\t\t\tclass={[\n\t\t\t\t\t\"fa-dialog\",\n\t\t\t\t\t`fa-dialog-${globalSize.value}`,\n\t\t\t\t\t{ \"fa-dialog__full-height\": props.fullHeight, \"fa-dialog__fullscreen\": state.fullscreen },\n\t\t\t\t]}\n\t\t\t\tvModel={state.visible}\n\t\t\t\tfullscreen={state.fullscreen}\n\t\t\t\tshowClose={false}\n\t\t\t\tbeforeClose={handleBeforeClose}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\theader: ({ titleId, titleClass }: { close: () => void; titleId: string; titleClass: string }) => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div id={titleId} class={[\"fa-dialog__header-title\", titleClass]}>\n\t\t\t\t\t\t\t\t{slots.title?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass }) ?? props.title}\n\t\t\t\t\t\t\t\t{slots.header?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass })}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{props.showRefresh && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"刷新\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-dialog__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleRefresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t<Refresh />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showFullscreen && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle={state.fullscreen ? \"关闭全屏显示\" : \"全屏显示\"}\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-dialog__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleFullscreen}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>{state.fullscreen ? <FullScreenExit /> : <FullScreen />}</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showClose && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"关闭\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-dialog__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleCloseClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t<Close />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<ElScrollbar viewClass=\"fa-dialog__scrollbar-view\" vLoading={state.loading} element-loading-text=\"加载中...\">\n\t\t\t\t\t\t\t{!state.refreshing && slots.default?.(state)}\n\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t),\n\t\t\t\t\t...(!props.hideFooter && {\n\t\t\t\t\t\tfooter: () => [\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{slots.footer?.({ loading: state.loading, close: handleCloseClick })}\n\t\t\t\t\t\t\t\t{props.showCloseButton && (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.loading} onClick={handleCloseClick}>\n\t\t\t\t\t\t\t\t\t\t{props.closeButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{props.showConfirmButton && (\n\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\tloadingIcon={Eleme}\n\t\t\t\t\t\t\t\t\t\tdisabled={props.disabledConfirmButton}\n\t\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{state.loading ? \"加载中...\" : props.confirmButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElDialog>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 调用原生关闭流程,并执行 beforeClose。 */\n\t\t\thandleClose: computed(() => dialogRef.value?.handleClose),\n\t\t\t/** 弹窗内容引用 */\n\t\t\tdialogContentRef: computed<{ resetPosition: () => void; updatePosition: () => void } | undefined>(\n\t\t\t\t() => dialogRef.value?.dialogContentRef as { resetPosition: () => void; updatePosition: () => void } | undefined\n\t\t\t),\n\t\t\t/** 重置位置 */\n\t\t\tresetPosition: computed(() => dialogRef.value?.resetPosition),\n\t\t\t/** 加载状态 */\n\t\t\tloading: toRef(state, \"loading\"),\n\t\t\t/** 是否显示 */\n\t\t\tvisible: toRef(state, \"visible\"),\n\t\t\t/** 打开弹窗 */\n\t\t\topen: handleOpen,\n\t\t\t/** 关闭弹窗 */\n\t\t\tclose: handleClose,\n\t\t\t/** 刷新弹窗 */\n\t\t\trefresh: handleRefresh,\n\t\t\t/** 弹窗加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,WAAW;EACV,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,UAAU;EACT,MAAM;E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,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA;GAM1B,CAAA;GAGH,eAAS,eAAA,YAAA,aAAA;IAAA,aAAA;IAAA,wBAAA;GAAA,GAAA,EAAA,eAAA,CAEN,CAAC,MAAM,cAAc,MAAM,UAAU,KAAK,CAAC,EAAA,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GADgB,MAAM,OAAO,CAAA,CAAA;GAI3E,GAAI,CAAC,MAAM,cAAc,EACxB,cAAc,CAAA,YAAA,UAAA,MAAA;IAEX,MAAM,SAAS;KAAE,SAAS,MAAM;KAAS,OAAO;IAAiB,CAAC;IAClE,MAAM,mBAAe,YAAA,UAAA;KAAA,YACD,MAAM;KAAO,WAAW;IAAgB,GAAA,EAAA,eAAA,CAC1D,MAAM,eAAe,EAAA,CAAA;IAGvB,MAAM,qBAAiB,YAAA,UAAA;KAAA,WAEb,MAAM;KAAO,eACT;KAAK,YACR,MAAM;KAAqB,QAAA;KAAA,WAE5B;IAAkB,GAAA,EAAA,eAAA,CAE1B,MAAM,UAAU,WAAW,MAAM,iBAAiB,EAAA,CAAA;GAEpD,CAAA,CAAA,EAGJ;EAAE,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;GAExB,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,kBAAkB,eACX,UAAU,OAAO,gBACxB;;GAEA,eAAe,eAAe,UAAU,OAAO,aAAa;;GAE5D,SAAS,MAAM,OAAO,SAAS;;GAE/B,SAAS,MAAM,OAAO,SAAS;;GAE/B,MAAM;;GAEN,OAAO;;GAEP,SAAS;;GAET,WAAW;EACZ,CAAC;CACF;AACD,CAAC"}
@@ -261,7 +261,10 @@ var drawer_default = defineComponent({
261
261
  default: () => createVNode(Fragment, null, [props.draggable && createVNode("div", {
262
262
  "class": "fa-drawer__draggable",
263
263
  "onPointerdown": handleDraggablePointerdown
264
- }, null), withDirectives(createVNode(ElScrollbar, { "element-loading-text": "加载中..." }, { default: () => [!state.refreshing && slots.default?.(state)] }), [[resolveDirective("loading"), state.loading]])]),
264
+ }, null), withDirectives(createVNode(ElScrollbar, {
265
+ "viewClass": "fa-drawer__scrollbar-view",
266
+ "element-loading-text": "加载中..."
267
+ }, { default: () => [!state.refreshing && slots.default?.(state)] }), [[resolveDirective("loading"), state.loading]])]),
265
268
  ...!props.hideFooter && { footer: () => [createVNode(Fragment, null, [
266
269
  slots.footer?.({
267
270
  loading: state.loading,
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.mjs","names":["update:modelValue"],"sources":["../../../../src/components/drawer/src/drawer.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, nextTick, onBeforeUnmount, reactive, shallowRef, toRef, watch } from \"vue\";\nimport { Close, Eleme, Refresh } from \"@element-plus/icons-vue\";\nimport { ElButton, ElDrawer, ElIcon, ElMessage, ElMessageBox, ElScrollbar, drawerEmits, drawerProps, useGlobalSize } from \"element-plus\";\nimport { FullScreen, FullScreenExit } from \"@fast-element-plus/icons-vue\";\nimport { callOptionalFunction, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\n\n/** FaDrawer 的运行时 Props 定义 */\nexport const faDrawerProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...drawerProps,\n\t/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */\n\tappendToBody: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** enable dragging feature for Dialog */\n\tdraggable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** destroy elements in Dialog when closed */\n\tdestroyOnClose: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示刷新按钮 */\n\tshowRefresh: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示全屏图标 */\n\tshowFullscreen: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示关闭按钮 */\n\tshowCloseButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示确认按钮 */\n\tshowConfirmButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 禁用确认按钮 */\n\tdisabledConfirmButton: Boolean,\n\t/** 关闭按钮文字,默认取消 */\n\tcloseButtonText: {\n\t\ttype: String,\n\t\tdefault: \"取消\",\n\t},\n\t/** 确认按钮文字,默认确认 */\n\tconfirmButtonText: {\n\t\ttype: String,\n\t\tdefault: \"确认\",\n\t},\n\t/** 隐藏底部操作 */\n\thideFooter: Boolean,\n\t/** 显示关闭回调 */\n\tshowBeforeClose: Boolean,\n\t/** 打开之后 */\n\tafterOpen: {\n\t\ttype: definePropType<() => void | Promise<void>>(Function),\n\t},\n};\n\n/** FaDrawer 的运行时 Emits 定义 */\nexport const faDrawerEmits = {\n\t...drawerEmits,\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: boolean) => typeof value === \"boolean\",\n\t/** 确认按钮点击事件 */\n\tconfirmClick: () => true,\n};\n\n/** FaDrawer 的插槽参数 */\nexport interface FaDrawerSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: { loading: boolean };\n\t/** 头部插槽 */\n\theader: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 标题插槽 */\n\ttitle: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 底部插槽 */\n\tfooter: { loading: boolean; close: () => void };\n}\n\nexport default defineComponent({\n\tname: \"FaDrawer\",\n\tprops: faDrawerProps,\n\temits: faDrawerEmits,\n\tslots: makeSlots<FaDrawerSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst drawerRef = shallowRef<InstanceType<typeof ElDrawer> | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t\tvisible: false,\n\t\t\tfullscreen: false,\n\t\t\tsize: withDefineType<typeof props.size>(),\n\t\t\tdragging: false,\n\t\t\trefreshing: false,\n\t\t});\n\n\t\tlet cacheOpenFunction: (() => void | Promise<void>) | undefined;\n\n\t\tconst handleOpen = async (openFunction?: () => void | Promise<void>) => {\n\t\t\tstate.visible = true;\n\t\t\tcacheOpenFunction = openFunction;\n\t\t\tawait nextTick();\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(props.afterOpen ?? openFunction);\n\t\t\t\temit(\"open\");\n\t\t\t} catch (error) {\n\t\t\t\tstate.visible = false;\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleClose = async (closeFunction?: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(closeFunction);\n\t\t\t\temit(\"close\");\n\t\t\t\tstate.visible = false;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleRefresh = async () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.refreshing = true;\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 500);\n\t\t\t\t});\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tawait handleOpen(cacheOpenFunction);\n\t\t\t\tElMessage.success(\"刷新成功\");\n\t\t\t} finally {\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleBeforeClose = (done: () => void) => {\n\t\t\tif (state.loading) return;\n\t\t\t// 解决 image 预览摁下 ese 会关闭弹窗的问题\n\t\t\tif (document.querySelector(\".el-image-viewer__wrapper\")) return;\n\n\t\t\tconst newDone = () => {\n\t\t\t\t// 组件对外约定为无参数完成钩子,不采用 Element Plus 的 done 回调签名。\n\t\t\t\treturn callOptionalFunction(props.beforeClose, done).then(() => {\n\t\t\t\t\temit(\"close\");\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (props.showBeforeClose) {\n\t\t\t\t// 用户取消关闭属于正常分支,无需继续执行 beforeClose。\n\t\t\t\tElMessageBox.confirm(\"确定关闭?\", { type: \"warning\" }).then(() => newDone());\n\t\t\t} else {\n\t\t\t\tnewDone();\n\t\t\t}\n\t\t};\n\n\t\tconst handleFullscreen = () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.fullscreen = !state.fullscreen;\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\temit(\"confirmClick\");\n\t\t};\n\n\t\tconst handleCloseClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\thandleClose();\n\t\t};\n\n\t\tconst handleDraggablePointermove = (event: PointerEvent) => {\n\t\t\tconst horizontal = props.direction === \"rtl\" || props.direction === \"ltr\";\n\t\t\tconst viewportSize = horizontal ? document.documentElement.clientWidth : document.documentElement.clientHeight;\n\t\t\tlet nextSize: number;\n\t\t\tswitch (props.direction) {\n\t\t\t\tcase \"ltr\":\n\t\t\t\t\tnextSize = event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ttb\":\n\t\t\t\t\tnextSize = event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"btt\":\n\t\t\t\t\tnextSize = viewportSize - event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"rtl\":\n\t\t\t\tdefault:\n\t\t\t\t\tnextSize = viewportSize - event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstate.size = `${Math.min(Math.max(nextSize, viewportSize * 0.2), viewportSize * 0.95).toString()}px`;\n\t\t};\n\n\t\tconst stopDraggable = () => {\n\t\t\tstate.dragging = false;\n\t\t\tdocument.removeEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.removeEventListener(\"pointerup\", stopDraggable);\n\t\t};\n\n\t\tconst handleDraggablePointerdown = (event: PointerEvent) => {\n\t\t\tevent.preventDefault();\n\t\t\tstate.dragging = true;\n\t\t\tdocument.addEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.addEventListener(\"pointerup\", stopDraggable, { once: true });\n\t\t};\n\n\t\twatch(\n\t\t\t() => state.visible,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"update:modelValue\", newValue);\n\t\t\t}\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.size,\n\t\t\t(newValue) => {\n\t\t\t\tstate.size = newValue;\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tonBeforeUnmount(stopDraggable);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elDrawerProps = useProps(props, drawerProps, [\"modelValue\", \"size\", \"showClose\", \"beforeClose\"]);\n\t\t// open、close 是 Fast 异步业务流程完成事件,不直接透传 Element Plus 的同名生命周期事件。\n\t\tconst elDrawerEmits = useEmits(drawerEmits, emit, [\"open\", \"close\", \"update:modelValue\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElDrawer\n\t\t\t\t{...elDrawerProps.value}\n\t\t\t\t{...elDrawerEmits.value}\n\t\t\t\tref={drawerRef}\n\t\t\t\tclass={[\n\t\t\t\t\t\"fa-drawer\",\n\t\t\t\t\t`fa-drawer-${globalSize.value}`,\n\t\t\t\t\t{ \"fa-drawer__fullscreen\": state.fullscreen, \"fa-drawer__dragging\": state.dragging },\n\t\t\t\t]}\n\t\t\t\tvModel={state.visible}\n\t\t\t\tsize={state.size}\n\t\t\t\tshowClose={false}\n\t\t\t\tbeforeClose={handleBeforeClose}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\theader: ({ titleId, titleClass }: { close: () => void; titleId: string; titleClass: string }) => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div id={titleId} class={[\"fa-drawer__header-title\", titleClass]}>\n\t\t\t\t\t\t\t\t{slots.title?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass }) ?? props.title}\n\t\t\t\t\t\t\t\t{slots.header?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass })}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{props.showRefresh && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"刷新\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleRefresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Refresh />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showFullscreen && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle={state.fullscreen ? \"关闭全屏显示\" : \"全屏显示\"}\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleFullscreen}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>{state.fullscreen ? <FullScreenExit /> : <FullScreen />}</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showClose && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"关闭\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleCloseClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Close />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{props.draggable && <div class=\"fa-drawer__draggable\" onPointerdown={handleDraggablePointerdown} />}\n\t\t\t\t\t\t\t<ElScrollbar vLoading={state.loading} element-loading-text=\"加载中...\">\n\t\t\t\t\t\t\t\t{!state.refreshing && slots.default?.(state)}\n\t\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\t...(!props.hideFooter && {\n\t\t\t\t\t\tfooter: () => [\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{slots.footer?.({ loading: state.loading, close: handleCloseClick })}\n\t\t\t\t\t\t\t\t{props.showCloseButton && (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.loading} onClick={handleCloseClick}>\n\t\t\t\t\t\t\t\t\t\t{props.closeButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{props.showConfirmButton && (\n\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\tloadingIcon={Eleme}\n\t\t\t\t\t\t\t\t\t\tdisabled={props.disabledConfirmButton}\n\t\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{state.loading ? \"加载中...\" : props.confirmButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElDrawer>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */\n\t\t\thandleClose: computed(() => drawerRef.value?.handleClose),\n\t\t\t/** 加载状态 */\n\t\t\tloading: toRef(state, \"loading\"),\n\t\t\t/** 是否显示 */\n\t\t\tvisible: toRef(state, \"visible\"),\n\t\t\t/** 打开弹窗 */\n\t\t\topen: handleOpen,\n\t\t\t/** 关闭弹窗 */\n\t\t\tclose: handleClose,\n\t\t\t/** 刷新弹窗 */\n\t\t\trefresh: handleRefresh,\n\t\t\t/** 弹窗加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,WAAW;EACV,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,iBAAiB;EAChB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,uBAAuB;;CAEvB,iBAAiB;E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AAA,EAAA,eAAA,CAE1B,MAAM,UAAU,WAAW,MAAM,iBAAiB,EAAA,CAAA;GAEpD,CAAA,CAAA,EAGJ;EAAE,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;GAExB,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,SAAS,MAAM,OAAO,SAAS;;GAE/B,SAAS,MAAM,OAAO,SAAS;;GAE/B,MAAM;;GAEN,OAAO;;GAEP,SAAS;;GAET,WAAW;EACZ,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"drawer.mjs","names":["update:modelValue"],"sources":["../../../../src/components/drawer/src/drawer.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, nextTick, onBeforeUnmount, reactive, shallowRef, toRef, watch } from \"vue\";\nimport { Close, Eleme, Refresh } from \"@element-plus/icons-vue\";\nimport { ElButton, ElDrawer, ElIcon, ElMessage, ElMessageBox, ElScrollbar, drawerEmits, drawerProps, useGlobalSize } from \"element-plus\";\nimport { FullScreen, FullScreenExit } from \"@fast-element-plus/icons-vue\";\nimport { callOptionalFunction, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\n\n/** FaDrawer 的运行时 Props 定义 */\nexport const faDrawerProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...drawerProps,\n\t/** whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` */\n\tappendToBody: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** enable dragging feature for Dialog */\n\tdraggable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** destroy elements in Dialog when closed */\n\tdestroyOnClose: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示刷新按钮 */\n\tshowRefresh: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示全屏图标 */\n\tshowFullscreen: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示关闭按钮 */\n\tshowCloseButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 显示确认按钮 */\n\tshowConfirmButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 禁用确认按钮 */\n\tdisabledConfirmButton: Boolean,\n\t/** 关闭按钮文字,默认取消 */\n\tcloseButtonText: {\n\t\ttype: String,\n\t\tdefault: \"取消\",\n\t},\n\t/** 确认按钮文字,默认确认 */\n\tconfirmButtonText: {\n\t\ttype: String,\n\t\tdefault: \"确认\",\n\t},\n\t/** 隐藏底部操作 */\n\thideFooter: Boolean,\n\t/** 显示关闭回调 */\n\tshowBeforeClose: Boolean,\n\t/** 打开之后 */\n\tafterOpen: {\n\t\ttype: definePropType<() => void | Promise<void>>(Function),\n\t},\n};\n\n/** FaDrawer 的运行时 Emits 定义 */\nexport const faDrawerEmits = {\n\t...drawerEmits,\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: boolean) => typeof value === \"boolean\",\n\t/** 确认按钮点击事件 */\n\tconfirmClick: () => true,\n};\n\n/** FaDrawer 的插槽参数 */\nexport interface FaDrawerSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: { loading: boolean };\n\t/** 头部插槽 */\n\theader: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 标题插槽 */\n\ttitle: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** 底部插槽 */\n\tfooter: { loading: boolean; close: () => void };\n}\n\nexport default defineComponent({\n\tname: \"FaDrawer\",\n\tprops: faDrawerProps,\n\temits: faDrawerEmits,\n\tslots: makeSlots<FaDrawerSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst drawerRef = shallowRef<InstanceType<typeof ElDrawer> | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t\tvisible: false,\n\t\t\tfullscreen: false,\n\t\t\tsize: withDefineType<typeof props.size>(),\n\t\t\tdragging: false,\n\t\t\trefreshing: false,\n\t\t});\n\n\t\tlet cacheOpenFunction: (() => void | Promise<void>) | undefined;\n\n\t\tconst handleOpen = async (openFunction?: () => void | Promise<void>) => {\n\t\t\tstate.visible = true;\n\t\t\tcacheOpenFunction = openFunction;\n\t\t\tawait nextTick();\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(props.afterOpen ?? openFunction);\n\t\t\t\temit(\"open\");\n\t\t\t} catch (error) {\n\t\t\t\tstate.visible = false;\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleClose = async (closeFunction?: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(closeFunction);\n\t\t\t\temit(\"close\");\n\t\t\t\tstate.visible = false;\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>) => {\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleRefresh = async () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.refreshing = true;\n\t\t\tstate.loading = true;\n\t\t\ttry {\n\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 500);\n\t\t\t\t});\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tawait handleOpen(cacheOpenFunction);\n\t\t\t\tElMessage.success(\"刷新成功\");\n\t\t\t} finally {\n\t\t\t\tstate.refreshing = false;\n\t\t\t\tstate.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst handleBeforeClose = (done: () => void) => {\n\t\t\tif (state.loading) return;\n\t\t\t// 解决 image 预览摁下 ese 会关闭弹窗的问题\n\t\t\tif (document.querySelector(\".el-image-viewer__wrapper\")) return;\n\n\t\t\tconst newDone = () => {\n\t\t\t\t// 组件对外约定为无参数完成钩子,不采用 Element Plus 的 done 回调签名。\n\t\t\t\treturn callOptionalFunction(props.beforeClose, done).then(() => {\n\t\t\t\t\temit(\"close\");\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (props.showBeforeClose) {\n\t\t\t\t// 用户取消关闭属于正常分支,无需继续执行 beforeClose。\n\t\t\t\tElMessageBox.confirm(\"确定关闭?\", { type: \"warning\" }).then(() => newDone());\n\t\t\t} else {\n\t\t\t\tnewDone();\n\t\t\t}\n\t\t};\n\n\t\tconst handleFullscreen = () => {\n\t\t\tif (state.loading) return;\n\t\t\tstate.fullscreen = !state.fullscreen;\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\temit(\"confirmClick\");\n\t\t};\n\n\t\tconst handleCloseClick = () => {\n\t\t\tif (state.loading) return;\n\t\t\thandleClose();\n\t\t};\n\n\t\tconst handleDraggablePointermove = (event: PointerEvent) => {\n\t\t\tconst horizontal = props.direction === \"rtl\" || props.direction === \"ltr\";\n\t\t\tconst viewportSize = horizontal ? document.documentElement.clientWidth : document.documentElement.clientHeight;\n\t\t\tlet nextSize: number;\n\t\t\tswitch (props.direction) {\n\t\t\t\tcase \"ltr\":\n\t\t\t\t\tnextSize = event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ttb\":\n\t\t\t\t\tnextSize = event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"btt\":\n\t\t\t\t\tnextSize = viewportSize - event.clientY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"rtl\":\n\t\t\t\tdefault:\n\t\t\t\t\tnextSize = viewportSize - event.clientX;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstate.size = `${Math.min(Math.max(nextSize, viewportSize * 0.2), viewportSize * 0.95).toString()}px`;\n\t\t};\n\n\t\tconst stopDraggable = () => {\n\t\t\tstate.dragging = false;\n\t\t\tdocument.removeEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.removeEventListener(\"pointerup\", stopDraggable);\n\t\t};\n\n\t\tconst handleDraggablePointerdown = (event: PointerEvent) => {\n\t\t\tevent.preventDefault();\n\t\t\tstate.dragging = true;\n\t\t\tdocument.addEventListener(\"pointermove\", handleDraggablePointermove);\n\t\t\tdocument.addEventListener(\"pointerup\", stopDraggable, { once: true });\n\t\t};\n\n\t\twatch(\n\t\t\t() => state.visible,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"update:modelValue\", newValue);\n\t\t\t}\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.size,\n\t\t\t(newValue) => {\n\t\t\t\tstate.size = newValue;\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tonBeforeUnmount(stopDraggable);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elDrawerProps = useProps(props, drawerProps, [\"modelValue\", \"size\", \"showClose\", \"beforeClose\"]);\n\t\t// open、close 是 Fast 异步业务流程完成事件,不直接透传 Element Plus 的同名生命周期事件。\n\t\tconst elDrawerEmits = useEmits(drawerEmits, emit, [\"open\", \"close\", \"update:modelValue\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElDrawer\n\t\t\t\t{...elDrawerProps.value}\n\t\t\t\t{...elDrawerEmits.value}\n\t\t\t\tref={drawerRef}\n\t\t\t\tclass={[\n\t\t\t\t\t\"fa-drawer\",\n\t\t\t\t\t`fa-drawer-${globalSize.value}`,\n\t\t\t\t\t{ \"fa-drawer__fullscreen\": state.fullscreen, \"fa-drawer__dragging\": state.dragging },\n\t\t\t\t]}\n\t\t\t\tvModel={state.visible}\n\t\t\t\tsize={state.size}\n\t\t\t\tshowClose={false}\n\t\t\t\tbeforeClose={handleBeforeClose}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\theader: ({ titleId, titleClass }: { close: () => void; titleId: string; titleClass: string }) => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div id={titleId} class={[\"fa-drawer__header-title\", titleClass]}>\n\t\t\t\t\t\t\t\t{slots.title?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass }) ?? props.title}\n\t\t\t\t\t\t\t\t{slots.header?.({ loading: state.loading, close: handleCloseClick, titleId, titleClass })}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{props.showRefresh && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"刷新\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleRefresh}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Refresh />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showFullscreen && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle={state.fullscreen ? \"关闭全屏显示\" : \"全屏显示\"}\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleFullscreen}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon>{state.fullscreen ? <FullScreenExit /> : <FullScreen />}</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.showClose && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\ttitle=\"关闭\"\n\t\t\t\t\t\t\t\t\tclass={[\n\t\t\t\t\t\t\t\t\t\t\"fa-drawer__header-icon\",\n\t\t\t\t\t\t\t\t\t\tstate.loading ? \"fa__click__disabled fa__click__disabled__cursor \" : \"fa__hover__twinkle\",\n\t\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t\t\tonClick={handleCloseClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Close />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{props.draggable && <div class=\"fa-drawer__draggable\" onPointerdown={handleDraggablePointerdown} />}\n\t\t\t\t\t\t\t<ElScrollbar viewClass=\"fa-drawer__scrollbar-view\" vLoading={state.loading} element-loading-text=\"加载中...\">\n\t\t\t\t\t\t\t\t{!state.refreshing && slots.default?.(state)}\n\t\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\t...(!props.hideFooter && {\n\t\t\t\t\t\tfooter: () => [\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{slots.footer?.({ loading: state.loading, close: handleCloseClick })}\n\t\t\t\t\t\t\t\t{props.showCloseButton && (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.loading} onClick={handleCloseClick}>\n\t\t\t\t\t\t\t\t\t\t{props.closeButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{props.showConfirmButton && (\n\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\tloadingIcon={Eleme}\n\t\t\t\t\t\t\t\t\t\tdisabled={props.disabledConfirmButton}\n\t\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{state.loading ? \"加载中...\" : props.confirmButtonText}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElDrawer>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */\n\t\t\thandleClose: computed(() => drawerRef.value?.handleClose),\n\t\t\t/** 加载状态 */\n\t\t\tloading: toRef(state, \"loading\"),\n\t\t\t/** 是否显示 */\n\t\t\tvisible: toRef(state, \"visible\"),\n\t\t\t/** 打开弹窗 */\n\t\t\topen: handleOpen,\n\t\t\t/** 关闭弹窗 */\n\t\t\tclose: handleClose,\n\t\t\t/** 刷新弹窗 */\n\t\t\trefresh: handleRefresh,\n\t\t\t/** 弹窗加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,WAAW;EACV,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,gBAAgB;EACf,MAAM;EACN,SAAS;CACV;;CAEA,iBAAiB;EAChB,MAAM;EACN,SAAS;CACV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AA,UAAA;KAAA,WAEb,MAAM;KAAO,eACT;KAAK,YACR,MAAM;KAAqB,QAAA;KAAA,WAE5B;IAAkB,GAAA,EAAA,eAAA,CAE1B,MAAM,UAAU,WAAW,MAAM,iBAAiB,EAAA,CAAA;GAEpD,CAAA,CAAA,EAGJ;EAAE,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;GAExB,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,SAAS,MAAM,OAAO,SAAS;;GAE/B,SAAS,MAAM,OAAO,SAAS;;GAE/B,MAAM;;GAEN,OAAO;;GAEP,SAAS;;GAET,WAAW;EACZ,CAAC;CACF;AACD,CAAC"}
@@ -83,7 +83,7 @@ var form_default = defineComponent({
83
83
  "class": [
84
84
  "fa-form",
85
85
  `fa-form-${globalSize.value}`,
86
- { [`fa-form-detail fa-form-detail_${globalSize.value}`]: props.detailForm }
86
+ { [`fa-form-detail fa-form-detail-${globalSize.value}`]: props.detailForm }
87
87
  ]
88
88
  }), { default: () => props.grid ? createVNode(FaLayoutGrid, {
89
89
  "collapsed": true,
@@ -1 +1 @@
1
- {"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/components/form/src/form.tsx"],"sourcesContent":["import { computed, defineComponent, provide, reactive, shallowRef } from \"vue\";\nimport { ElForm, formEmits, formProps, useGlobalSize } from \"element-plus\";\nimport { definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaLayoutGrid } from \"../../layoutGrid\";\nimport { formUtil } from \"../utils/form\";\nimport type { FormInstance, FormValidateCallback } from \"element-plus\";\nimport type { FaLayoutGridBreakpoint } from \"../../layoutGrid\";\n\n/** FaForm 的运行时 Props 定义 */\nexport const faFormProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...formProps,\n\t/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */\n\tlabelWidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"auto\",\n\t},\n\t/** Suffix of the label. */\n\tlabelSuffix: {\n\t\ttype: String,\n\t\tdefault: \":\",\n\t},\n\t/** When validation fails, scroll to the first error form entry. */\n\tscrollToError: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 详情From,会删除 FormItem 的 paddinfa-bottom */\n\tdetailForm: Boolean,\n\t/** Grid布局 */\n\tgrid: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** Grid布局列配置 */\n\tcols: {\n\t\ttype: definePropType<string | number | Record<FaLayoutGridBreakpoint, number>>([String, Number, Object]),\n\t\tdefault: () => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t},\n};\n\n/** FaForm 的运行时事件定义。 */\nexport const faFormEmits = {\n\t...formEmits,\n};\n\n/** FaForm 的插槽参数 */\nexport interface FaFormSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: { cols: Record<FaLayoutGridBreakpoint, number>; gap: [number, number] };\n}\n\nexport default defineComponent({\n\tname: \"FaForm\",\n\tprops: faFormProps,\n\temits: faFormEmits,\n\tslots: makeSlots<FaFormSlots>(),\n\tsetup(props, { slots, expose, emit }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst formRef = shallowRef<FormInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tcols: computed(() => {\n\t\t\t\tif (typeof props.cols === \"object\" && props.cols !== null) {\n\t\t\t\t\treturn props.cols;\n\t\t\t\t} else {\n\t\t\t\t\tconst colsNumber = typeof props.cols === \"number\" ? props.cols : Number(props.cols);\n\t\t\t\t\treturn { xs: 1, sm: colsNumber, md: colsNumber, lg: colsNumber, xl: colsNumber };\n\t\t\t\t}\n\t\t\t}),\n\t\t\tgap: computed<[number, number]>(() => (globalSize.value === \"small\" ? [15, 0] : [20, 0])),\n\t\t});\n\n\t\t// 注入 cols\n\t\tprovide(\"faFormCols\", state.cols);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elFormProps = useProps(props, formProps);\n\t\tconst elFormEmits = useEmits(formEmits, emit);\n\n\t\tuseRender(() => (\n\t\t\t<ElForm\n\t\t\t\t{...elFormProps.value}\n\t\t\t\t{...elFormEmits.value}\n\t\t\t\tref={formRef}\n\t\t\t\tclass={[\"fa-form\", `fa-form-${globalSize.value}`, { [`fa-form-detail fa-form-detail_${globalSize.value}`]: props.detailForm }]}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\tprops.grid ? (\n\t\t\t\t\t\t\t<FaLayoutGrid collapsed gap={state.gap} cols={state.cols}>\n\t\t\t\t\t\t\t\t{slots.default?.(state)}\n\t\t\t\t\t\t\t</FaLayoutGrid>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tslots.default?.(state)\n\t\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElForm>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 对整个表单的内容进行验证。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidate: (callback?: FormValidateCallback) =>\n\t\t\t\tcallback ? (formRef.value?.validate(callback) ?? Promise.reject(new Error(\"ElForm 实例尚未挂载。\"))) : formUtil.validate(formRef),\n\t\t\t/** 验证具体的某个字段。 */\n\t\t\tvalidateField: computed(() => formRef.value?.validateField),\n\t\t\t/** 重置该表单项,将其值重置为初始值,并移除校验结果 */\n\t\t\tresetFields: computed(() => formRef.value?.resetFields),\n\t\t\t/** 清理某个字段的表单验证信息。 */\n\t\t\tclearValidate: computed(() => formRef.value?.clearValidate),\n\t\t\t/** 滚动到指定的字段 */\n\t\t\tscrollToField: computed(() => formRef.value?.scrollToField),\n\t\t\t/** 获取所有字段的 context */\n\t\t\tfields: computed(() => formRef.value?.fields),\n\t\t\t/** 获取指定字段的 context。 */\n\t\t\tgetField: computed(() => formRef.value?.getField),\n\t\t\t/** 设置表单字段的初始值。 */\n\t\t\tsetInitialValues: computed(() => formRef.value?.setInitialValues),\n\t\t\t/** 对整个表单的内容进行验证,带滚动。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidateScrollToField: () => formUtil.validateScrollToField(formRef),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;AASA,MAAa,cAAc;CAE1B,GAAG;;CAEH,YAAY;EACX,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,eAAe;EACd,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;;CAEZ,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,MAAM;EACL,MAAM,eAAyE;GAAC;GAAQ;GAAQ;EAAM,CAAC;EACvG,gBAAgB;GAAE,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;EAAE;CACrD;AACD;;AAGA,MAAa,cAAc,EAC1B,GAAG,UACJ;AAQA,IAAA,eAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAuB;CAC9B,MAAM,OAAO,EAAE,OAAO,QAAQ,QAAQ;EACrC,MAAM,aAAa,cAAc;EACjC,MAAM,UAAU,WAAgC,IAAI;EAEpD,MAAM,QAAQ,SAAS;GACtB,MAAM,eAAe;IACpB,IAAI,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,MACpD,OAAO,MAAM;SACP;KACN,MAAM,aAAa,OAAO,MAAM,SAAS,WAAW,MAAM,OAAO,OAAO,MAAM,IAAI;KAClF,OAAO;MAAE,IAAI;MAAG,IAAI;MAAY,IAAI;MAAY,IAAI;MAAY,IAAI;KAAW;IAChF;GACD,CAAC;GACD,KAAK,eAAkC,WAAW,UAAU,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE;EACzF,CAAC;EAGD,QAAQ,cAAc,MAAM,IAAI;EAGhC,MAAM,cAAc,SAAS,OAAO,SAAS;EAC7C,MAAM,cAAc,SAAS,WAAW,IAAI;EAE5C,gBAAU,YAAA,QAAA,WAEJ,YAAY,OACZ,YAAY,OAAK;GAAA,OAChB;GAAO,SACL;IAAC;IAAW,WAAW,WAAW;IAAS,GAAG,iCAAiC,WAAW,UAAU,MAAM,WAAW;GAAC;EAAC,CAAA,GAAA,EAG7H,eACC,MAAM,OAAI,YAAA,cAAA;GAAA,aAAA;GAAA,OACoB,MAAM;GAAG,QAAQ,MAAM;EAAI,GAAA,EAAA,eAAA,CACtD,MAAM,UAAU,KAAK,CAAC,EAAA,CAAA,IAGxB,MAAM,UAAU,KAAK,EACrB,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;GAExB,WAAW,aACV,WAAY,QAAQ,OAAO,SAAS,QAAQ,KAAK,QAAQ,uBAAO,IAAI,MAAM,gBAAgB,CAAC,IAAK,SAAS,SAAS,OAAO;;GAE1H,eAAe,eAAe,QAAQ,OAAO,aAAa;;GAE1D,aAAa,eAAe,QAAQ,OAAO,WAAW;;GAEtD,eAAe,eAAe,QAAQ,OAAO,aAAa;;GAE1D,eAAe,eAAe,QAAQ,OAAO,aAAa;;GAE1D,QAAQ,eAAe,QAAQ,OAAO,MAAM;;GAE5C,UAAU,eAAe,QAAQ,OAAO,QAAQ;;GAEhD,kBAAkB,eAAe,QAAQ,OAAO,gBAAgB;;GAEhE,6BAA6B,SAAS,sBAAsB,OAAO;EACpE,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/components/form/src/form.tsx"],"sourcesContent":["import { computed, defineComponent, provide, reactive, shallowRef } from \"vue\";\nimport { ElForm, formEmits, formProps, useGlobalSize } from \"element-plus\";\nimport { definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaLayoutGrid } from \"../../layoutGrid\";\nimport { formUtil } from \"../utils/form\";\nimport type { FormInstance, FormValidateCallback } from \"element-plus\";\nimport type { FaLayoutGridBreakpoint } from \"../../layoutGrid\";\n\n/** FaForm 的运行时 Props 定义 */\nexport const faFormProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...formProps,\n\t/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */\n\tlabelWidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"auto\",\n\t},\n\t/** Suffix of the label. */\n\tlabelSuffix: {\n\t\ttype: String,\n\t\tdefault: \":\",\n\t},\n\t/** When validation fails, scroll to the first error form entry. */\n\tscrollToError: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 详情From,会删除 FormItem 的 paddinfa-bottom */\n\tdetailForm: Boolean,\n\t/** Grid布局 */\n\tgrid: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** Grid布局列配置 */\n\tcols: {\n\t\ttype: definePropType<string | number | Record<FaLayoutGridBreakpoint, number>>([String, Number, Object]),\n\t\tdefault: () => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t},\n};\n\n/** FaForm 的运行时事件定义。 */\nexport const faFormEmits = {\n\t...formEmits,\n};\n\n/** FaForm 的插槽参数 */\nexport interface FaFormSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: { cols: Record<FaLayoutGridBreakpoint, number>; gap: [number, number] };\n}\n\nexport default defineComponent({\n\tname: \"FaForm\",\n\tprops: faFormProps,\n\temits: faFormEmits,\n\tslots: makeSlots<FaFormSlots>(),\n\tsetup(props, { slots, expose, emit }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst formRef = shallowRef<FormInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tcols: computed(() => {\n\t\t\t\tif (typeof props.cols === \"object\" && props.cols !== null) {\n\t\t\t\t\treturn props.cols;\n\t\t\t\t} else {\n\t\t\t\t\tconst colsNumber = typeof props.cols === \"number\" ? props.cols : Number(props.cols);\n\t\t\t\t\treturn { xs: 1, sm: colsNumber, md: colsNumber, lg: colsNumber, xl: colsNumber };\n\t\t\t\t}\n\t\t\t}),\n\t\t\tgap: computed<[number, number]>(() => (globalSize.value === \"small\" ? [15, 0] : [20, 0])),\n\t\t});\n\n\t\t// 注入 cols\n\t\tprovide(\"faFormCols\", state.cols);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elFormProps = useProps(props, formProps);\n\t\tconst elFormEmits = useEmits(formEmits, emit);\n\n\t\tuseRender(() => (\n\t\t\t<ElForm\n\t\t\t\t{...elFormProps.value}\n\t\t\t\t{...elFormEmits.value}\n\t\t\t\tref={formRef}\n\t\t\t\tclass={[\"fa-form\", `fa-form-${globalSize.value}`, { [`fa-form-detail fa-form-detail-${globalSize.value}`]: props.detailForm }]}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\tprops.grid ? (\n\t\t\t\t\t\t\t<FaLayoutGrid collapsed gap={state.gap} cols={state.cols}>\n\t\t\t\t\t\t\t\t{slots.default?.(state)}\n\t\t\t\t\t\t\t</FaLayoutGrid>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tslots.default?.(state)\n\t\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElForm>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 对整个表单的内容进行验证。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidate: (callback?: FormValidateCallback) =>\n\t\t\t\tcallback ? (formRef.value?.validate(callback) ?? Promise.reject(new Error(\"ElForm 实例尚未挂载。\"))) : formUtil.validate(formRef),\n\t\t\t/** 验证具体的某个字段。 */\n\t\t\tvalidateField: computed(() => formRef.value?.validateField),\n\t\t\t/** 重置该表单项,将其值重置为初始值,并移除校验结果 */\n\t\t\tresetFields: computed(() => formRef.value?.resetFields),\n\t\t\t/** 清理某个字段的表单验证信息。 */\n\t\t\tclearValidate: computed(() => formRef.value?.clearValidate),\n\t\t\t/** 滚动到指定的字段 */\n\t\t\tscrollToField: computed(() => formRef.value?.scrollToField),\n\t\t\t/** 获取所有字段的 context */\n\t\t\tfields: computed(() => formRef.value?.fields),\n\t\t\t/** 获取指定字段的 context。 */\n\t\t\tgetField: computed(() => formRef.value?.getField),\n\t\t\t/** 设置表单字段的初始值。 */\n\t\t\tsetInitialValues: computed(() => formRef.value?.setInitialValues),\n\t\t\t/** 对整个表单的内容进行验证,带滚动。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidateScrollToField: () => formUtil.validateScrollToField(formRef),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;AASA,MAAa,cAAc;CAE1B,GAAG;;CAEH,YAAY;EACX,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,eAAe;EACd,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;;CAEZ,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,MAAM;EACL,MAAM,eAAyE;GAAC;GAAQ;GAAQ;EAAM,CAAC;EACvG,gBAAgB;GAAE,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;EAAE;CACrD;AACD;;AAGA,MAAa,cAAc,EAC1B,GAAG,UACJ;AAQA,IAAA,eAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAuB;CAC9B,MAAM,OAAO,EAAE,OAAO,QAAQ,QAAQ;EACrC,MAAM,aAAa,cAAc;EACjC,MAAM,UAAU,WAAgC,IAAI;EAEpD,MAAM,QAAQ,SAAS;GACtB,MAAM,eAAe;IACpB,IAAI,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,MACpD,OAAO,MAAM;SACP;KACN,MAAM,aAAa,OAAO,MAAM,SAAS,WAAW,MAAM,OAAO,OAAO,MAAM,IAAI;KAClF,OAAO;MAAE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leCellClassName = ({ row, column, rowIndex, columnIndex }) => {
357
- let localCellClassName = "";
357
+ let localCellClassName = "fa-table__cell";
358
358
  if (column.type === "selection") {
359
359
  const rowKey = getRowKey(row);
360
- if (state.indeterminateSelectedListIds.some((s) => s === rowKey)) localCellClassName = "fa-table__selection-column__indeterminate";
360
+ if (state.indeterminateSelectedListIds.some((s) => s === rowKey)) localCellClassName += " fa-table__selection-column__indeterminate";
361
361
  }
362
362
  const columnInfo = state.tableColumns.find((f) => f.prop === column.property);
363
363
  if (columnInfo?.dataDeleteField) {
364
- if (row[columnInfo.dataDeleteField] === true) {
365
- if (localCellClassName) localCellClassName += " fa-table__data-delete-column";
366
- else localCellClassName = "fa-table__data-delete-column";
367
- }
364
+ if (row[columnInfo.dataDeleteField] === true) localCellClassName += " fa-table__data-delete-column";
368
365
  }
369
366
  if (props.cellClassName) {
370
367
  const cellClassName = typeof props.cellClassName === "string" ? props.cellClassName : props.cellClassName({
@@ -374,22 +371,21 @@ var table_default = defineComponent({
374
371
  columnIndex
375
372
  });
376
373
  if (!cellClassName) return localCellClassName;
377
- if (localCellClassName) return `${localCellClassName} ${cellClassName}`;
378
- else return cellClassName;
374
+ return `${localCellClassName} ${cellClassName}`;
379
375
  } else return localCellClassName;
380
376
  };
381
377
  const handleHeaderCellClassName = ({ row, column, rowIndex, columnIndex }) => {
382
378
  column.order = column.multiOrder === "ascending" || column.multiOrder === "descending" ? column.multiOrder : null;
383
379
  if (props.headerCellClassName) {
384
- if (typeof props.headerCellClassName === "function") return props.headerCellClassName({
380
+ const headerCellClassName = typeof props.headerCellClassName === "function" ? props.headerCellClassName({
385
381
  row,
386
382
  column,
387
383
  rowIndex,
388
384
  columnIndex
389
- });
390
- else return props.headerCellClassName;
385
+ }) : props.headerCellClassName;
386
+ return headerCellClassName ? `fa-table__header-cell ${headerCellClassName}` : "fa-table__header-cell";
391
387
  }
392
- return "";
388
+ return "fa-table__header-cell";
393
389
  };
394
390
  const handleSpanMethod = ({ column, rowIndex }) => {
395
391
  /** 原生的 span-method 会失效 */
@@ -521,7 +517,10 @@ var table_default = defineComponent({
521
517
  search: tableSearch,
522
518
  ...getTableDefaultSlots(state)
523
519
  })]),
524
- createVNode("div", { "class": "el-card fa-table__main" }, [
520
+ createVNode("div", {
521
+ "class": "el-card fa-table__main",
522
+ "style": { containerType: slots.expand ? "inline-size" : void 0 }
523
+ }, [
525
524
  props.headerCard && createVNode("div", { "class": "fa-table__main-header" }, [createVNode("div", { "class": "fa-table__main-header-left" }, [slots.header?.({
526
525
  search: tableSearch,
527
526
  ...getTableDefaultSlots(state)
@@ -545,7 +544,7 @@ var table_default = defineComponent({
545
544
  }, null), createVNode("div", { "class": "fa-table__main-header-right__div-search__hidden" }, [state.searchParam.searchValue, state.searchValueUpdate])]),
546
545
  props.requestApi && !props.hideSearchTime && createVNode(ElDatePicker, mergeProps({ onChange: tableSearch }, {
547
546
  "class": "fa-table__main-header-right__data-search",
548
- "popperClass": "fa-table__main-header-right__data-search__popper",
547
+ "popperClass": `fa-table__main-header-right__data-search__popper fa-table__main-header-right__data-search__popper-${globalSize.value}`,
549
548
  "disabled": state.loading,
550
549
  "type": "daterange",
551
550
  "modelValue": state.searchParam.searchTimeList,
@@ -611,6 +610,7 @@ var table_default = defineComponent({
611
610
  })
612
611
  ])])]),
613
612
  withDirectives(createVNode(ElTable, mergeProps(elTableProps.value, {
613
+ "class": "fa-table__table",
614
614
  "ref": tableRef,
615
615
  "element-loading-text": state.loadingText,
616
616
  "data": state.tableData,
@@ -655,13 +655,13 @@ var table_default = defineComponent({
655
655
  "showOverflowTooltip": false,
656
656
  "resizable": false,
657
657
  "columnKey": "__table-expand"
658
- }, { default: ({ row, column, $index }) => slots.expand?.({
658
+ }, { default: ({ row, column, $index }) => createVNode("div", { "class": "fa-table__expand-wrapper" }, [slots.expand?.({
659
659
  row,
660
660
  column,
661
661
  $index,
662
662
  search: tableSearch,
663
663
  ...getTableDefaultSlots(state)
664
- }) }),
664
+ })]) }),
665
665
  props.selectionColumn && createVNode(ElTableColumn, {
666
666
  "className": "fa-table__selection-column",
667
667
  "type": "selection",