fast-element-plus 2.0.18 → 2.0.20
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 +52 -19
- package/CONTRIBUTING.md +3 -4
- package/README.md +80 -27
- package/README.zh.md +66 -27
- package/dist/component.d.ts +123 -123
- package/dist/components/avatar/src/avatar.d.ts +26 -26
- package/dist/components/avatar/src/avatar.mjs +10 -10
- package/dist/components/avatar/src/avatar.mjs.map +1 -1
- package/dist/components/button/src/button.d.ts +32 -27
- package/dist/components/button/src/button.mjs +57 -36
- package/dist/components/button/src/button.mjs.map +1 -1
- package/dist/components/carNumber/src/carNumber.d.ts +8 -8
- package/dist/components/carNumber/src/carNumber.mjs +5 -5
- package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.d.ts +7 -7
- package/dist/components/contextMenu/src/contextMenu.mjs +7 -7
- package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.type.d.ts +7 -7
- package/dist/components/dialog/src/dialog.d.ts +76 -76
- package/dist/components/dialog/src/dialog.mjs +34 -34
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +59 -59
- package/dist/components/drawer/src/drawer.mjs +27 -27
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +30 -30
- package/dist/components/form/src/form.mjs +16 -16
- package/dist/components/form/src/form.mjs.map +1 -1
- package/dist/components/form/src/formItem.d.ts +30 -30
- package/dist/components/form/src/formItem.mjs +13 -13
- package/dist/components/form/src/formItem.mjs.map +1 -1
- package/dist/components/formItemTip/src/formItemTip.d.ts +9 -9
- package/dist/components/formItemTip/src/formItemTip.mjs +3 -3
- package/dist/components/formItemTip/src/formItemTip.mjs.map +1 -1
- package/dist/components/icon/src/icon.d.ts +10 -10
- package/dist/components/icon/src/icon.mjs +4 -4
- package/dist/components/icon/src/icon.mjs.map +1 -1
- package/dist/components/iconSelector/src/iconSelector.d.ts +6 -6
- package/dist/components/iconSelector/src/iconSelector.mjs +4 -4
- package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
- package/dist/components/image/src/image.d.ts +36 -36
- package/dist/components/image/src/image.mjs +11 -11
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +37 -37
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +16 -16
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +12 -12
- package/dist/components/layoutGrid/src/layoutGrid.mjs +6 -6
- package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGridItem.d.ts +19 -19
- package/dist/components/layoutGrid/src/layoutGridItem.mjs +9 -9
- package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +89 -89
- package/dist/components/select/src/select.mjs +30 -30
- package/dist/components/select/src/select.mjs.map +1 -1
- package/dist/components/select/src/selectOption.d.ts +13 -13
- package/dist/components/select/src/selectOption.mjs +6 -6
- package/dist/components/select/src/selectOption.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +76 -76
- package/dist/components/selectPage/src/selectPage.mjs +50 -36
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
- package/dist/components/selectV2/index.mjs +2 -1
- package/dist/components/selectV2/index.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +161 -852
- package/dist/components/selectV2/src/selectV2.mjs +32 -340
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/index.mjs +3 -2
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/page.type.d.ts +1 -1
- package/dist/components/table/src/table.d.ts +211 -744
- package/dist/components/table/src/table.mjs +111 -307
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/table.state.d.ts +3 -3
- package/dist/components/table/src/table.type.d.ts +1 -9
- package/dist/components/table/src/table.type.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +102 -399
- package/dist/components/table/src/tableColumn.mjs +28 -185
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.d.ts +4 -4
- package/dist/components/table/src/tableColumnSettingDialog.mjs +3 -3
- package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
- package/dist/components/table/src/tablePagination.d.ts +4 -4
- package/dist/components/table/src/tablePagination.mjs +3 -3
- package/dist/components/table/src/tablePagination.mjs.map +1 -1
- package/dist/components/table/src/tableSearchForm.d.ts +12 -12
- package/dist/components/table/src/tableSearchForm.mjs +6 -6
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
- package/dist/components/table/src/tableSearchFormItem.d.ts +4 -4
- package/dist/components/table/src/tableSearchFormItem.mjs +2 -2
- package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/dist/components/table/src/useTable.d.ts +1 -0
- package/dist/components/table/src/useTable.mjs +109 -65
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.d.ts +4 -4
- package/dist/components/table/utils/table.mjs +4 -4
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +87 -87
- package/dist/components/tree/src/tree.mjs +48 -48
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +139 -133
- package/dist/components/treeSelect/src/treeSelect.mjs +57 -57
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/dist/components/upload/src/upload.d.ts +36 -36
- package/dist/components/upload/src/upload.mjs +19 -19
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/uploadImage/src/uploadImage.d.ts +47 -47
- package/dist/components/uploadImage/src/uploadImage.mjs +24 -28
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +41 -41
- package/dist/components/uploadImages/src/uploadImages.mjs +21 -21
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-debounce/index.mjs +19 -11
- package/dist/directives/click-debounce/index.mjs.map +1 -1
- package/dist/directives/click-throttle/index.d.ts +4 -2
- package/dist/directives/click-throttle/index.mjs +21 -11
- package/dist/directives/click-throttle/index.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.global.min.js +3 -3
- package/dist/index.global.min.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal/props.d.ts +685 -0
- package/dist/internal/props.mjs +683 -0
- package/dist/internal/props.mjs.map +1 -0
- package/dist/utils/loading-tasks.d.ts +5 -0
- package/dist/utils/loading-tasks.mjs +32 -0
- package/dist/utils/loading-tasks.mjs.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +5 -10
|
@@ -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, 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/** @description 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/** @description enable dragging feature for Dialog */\n\tdraggable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description destroy elements in Dialog when closed */\n\tdestroyOnClose: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示刷新按钮 */\n\tshowRefresh: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示全屏图标 */\n\tshowFullscreen: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示关闭按钮 */\n\tshowCloseButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 显示确认按钮 */\n\tshowConfirmButton: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 禁用确认按钮 */\n\tdisabledConfirmButton: Boolean,\n\t/** @description 关闭按钮文字,默认取消 */\n\tcloseButtonText: {\n\t\ttype: String,\n\t\tdefault: \"取消\",\n\t},\n\t/** @description 确认按钮文字,默认确认 */\n\tconfirmButtonText: {\n\t\ttype: String,\n\t\tdefault: \"确认\",\n\t},\n\t/** @description 隐藏底部操作 */\n\thideFooter: Boolean,\n\t/** @description 显示关闭回调 */\n\tshowBeforeClose: Boolean,\n\t/** @description 打开之后 */\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/** @description v-model 回调 */\n\t\"update:modelValue\": (value: boolean) => typeof value === \"boolean\",\n\t/** @description 确认按钮点击事件 */\n\tconfirmClick: () => true,\n};\n\n/** FaDrawer 的插槽参数。 */\nexport interface FaDrawerSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: { loading: boolean };\n\t/** @description 头部插槽 */\n\theader: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** @description 标题插槽 */\n\ttitle: { loading: boolean; close: () => void; titleId: string; titleClass: string };\n\t/** @description 底部插槽 */\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/** @description 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */\n\t\t\thandleClose: computed(() => drawerRef.value?.handleClose),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 是否显示 */\n\t\t\tvisible: computed(() => state.visible),\n\t\t\t/** @description 打开弹窗 */\n\t\t\topen: handleOpen,\n\t\t\t/** @description 关闭弹窗 */\n\t\t\tclose: handleClose,\n\t\t\t/** @description 刷新弹窗 */\n\t\t\trefresh: hand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U,KAAK,CAAC,EAAA,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GADtB,MAAM,OAAO,CAAA,CAAA,CAAA,CAAA;GAKtC,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,SAAS,eAAe,MAAM,OAAO;;GAErC,SAAS,eAAe,MAAM,OAAO;;GAErC,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 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;EAChB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;;CAEZ,iBAAiB;;CAEjB,WAAW,EACV,MAAM,eAA2C,QAAQ,EAC1D;AACD;;AAGA,MAAa,gBAAgB;CAC5B,GAAG;;CAEH,sBAAsB,UAAmB,OAAO,UAAU;;CAE1D,oBAAoB;AACrB;AAcA,IAAA,iBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAyB;CAChC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,aAAa,cAAc;EACjC,MAAM,YAAY,WAAiD,IAAI;EAEvE,MAAM,QAAQ,SAAS;GACtB,SAAS;GACT,SAAS;GACT,YAAY;GACZ,MAAM,eAAkC;GACxC,UAAU;GACV,YAAY;EACb,CAAC;EAED,IAAI;EAEJ,MAAM,aAAa,OAAO,iBAA8C;GACvE,MAAM,UAAU;GAChB,oBAAoB;GACpB,MAAM,SAAS;GACf,MAAM,UAAU;GAChB,IAAI;IACH,MAAM,qBAAqB,MAAM,aAAa,YAAY;IAC1D,KAAK,MAAM;G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A,GAAA,EAAA,eAAA,CAEjG,CAAC,MAAM,cAAc,MAAM,UAAU,KAAK,CAAC,EAAA,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GADtB,MAAM,OAAO,CAAA,CAAA,CAAA,CAAA;GAKtC,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,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,30 +1,30 @@
|
|
|
1
1
|
import type { FormValidateCallback } from "element-plus";
|
|
2
2
|
import type { FaLayoutGridBreakpoint } from "../../layoutGrid";
|
|
3
|
-
/** FaForm 的运行时 Props
|
|
3
|
+
/** FaForm 的运行时 Props 定义 */
|
|
4
4
|
export declare const faFormProps: {
|
|
5
|
-
/**
|
|
5
|
+
/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
6
6
|
labelWidth: {
|
|
7
7
|
type: (NumberConstructor | StringConstructor)[];
|
|
8
8
|
default: string;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
10
|
+
/** Suffix of the label. */
|
|
11
11
|
labelSuffix: {
|
|
12
12
|
type: StringConstructor;
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/** When validation fails, scroll to the first error form entry. */
|
|
16
16
|
scrollToError: {
|
|
17
17
|
type: BooleanConstructor;
|
|
18
18
|
default: boolean;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/** 详情From,会删除 FormItem 的 paddinfa-bottom */
|
|
21
21
|
detailForm: BooleanConstructor;
|
|
22
|
-
/**
|
|
22
|
+
/** Grid布局 */
|
|
23
23
|
grid: {
|
|
24
24
|
type: BooleanConstructor;
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
27
|
+
/** Grid布局列配置 */
|
|
28
28
|
cols: {
|
|
29
29
|
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
30
30
|
default: () => {
|
|
@@ -63,38 +63,38 @@ export declare const faFormProps: {
|
|
|
63
63
|
export declare const faFormEmits: {
|
|
64
64
|
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => boolean;
|
|
65
65
|
};
|
|
66
|
-
/** FaForm
|
|
66
|
+
/** FaForm 的插槽参数 */
|
|
67
67
|
export interface FaFormSlots extends Record<string, unknown> {
|
|
68
|
-
/**
|
|
68
|
+
/** 默认内容插槽 */
|
|
69
69
|
default: {
|
|
70
70
|
cols: Record<FaLayoutGridBreakpoint, number>;
|
|
71
71
|
gap: [number, number];
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
75
|
-
/**
|
|
75
|
+
/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
76
76
|
labelWidth: {
|
|
77
77
|
type: (NumberConstructor | StringConstructor)[];
|
|
78
78
|
default: string;
|
|
79
79
|
};
|
|
80
|
-
/**
|
|
80
|
+
/** Suffix of the label. */
|
|
81
81
|
labelSuffix: {
|
|
82
82
|
type: StringConstructor;
|
|
83
83
|
default: string;
|
|
84
84
|
};
|
|
85
|
-
/**
|
|
85
|
+
/** When validation fails, scroll to the first error form entry. */
|
|
86
86
|
scrollToError: {
|
|
87
87
|
type: BooleanConstructor;
|
|
88
88
|
default: boolean;
|
|
89
89
|
};
|
|
90
|
-
/**
|
|
90
|
+
/** 详情From,会删除 FormItem 的 paddinfa-bottom */
|
|
91
91
|
detailForm: BooleanConstructor;
|
|
92
|
-
/**
|
|
92
|
+
/** Grid布局 */
|
|
93
93
|
grid: {
|
|
94
94
|
type: BooleanConstructor;
|
|
95
95
|
default: boolean;
|
|
96
96
|
};
|
|
97
|
-
/**
|
|
97
|
+
/** Grid布局列配置 */
|
|
98
98
|
cols: {
|
|
99
99
|
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
100
100
|
default: () => {
|
|
@@ -129,50 +129,50 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
129
129
|
};
|
|
130
130
|
disabled: BooleanConstructor;
|
|
131
131
|
}>, {
|
|
132
|
-
/**
|
|
132
|
+
/** 对整个表单的内容进行验证。 接收一个回调函数,或返回 Promise。 */
|
|
133
133
|
validate: (callback?: FormValidateCallback) => import("element-plus").FormValidationResult;
|
|
134
|
-
/**
|
|
134
|
+
/** 验证具体的某个字段。 */
|
|
135
135
|
validateField: import("vue").ComputedRef<((props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => import("element-plus").FormValidationResult) | undefined>;
|
|
136
|
-
/**
|
|
136
|
+
/** 重置该表单项,将其值重置为初始值,并移除校验结果 */
|
|
137
137
|
resetFields: import("vue").ComputedRef<((props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void) | undefined>;
|
|
138
|
-
/**
|
|
138
|
+
/** 清理某个字段的表单验证信息。 */
|
|
139
139
|
clearValidate: import("vue").ComputedRef<((props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void) | undefined>;
|
|
140
|
-
/**
|
|
140
|
+
/** 滚动到指定的字段 */
|
|
141
141
|
scrollToField: import("vue").ComputedRef<((prop: import("element-plus").FormItemProp) => void) | undefined>;
|
|
142
|
-
/**
|
|
142
|
+
/** 获取所有字段的 context */
|
|
143
143
|
fields: import("vue").ComputedRef<import("vue").Reactive<import("element-plus").FormItemContext[]> | undefined>;
|
|
144
|
-
/**
|
|
144
|
+
/** 获取指定字段的 context。 */
|
|
145
145
|
getField: import("vue").ComputedRef<((prop: import("element-plus").FormItemProp) => import("element-plus").FormItemContext | undefined) | undefined>;
|
|
146
|
-
/**
|
|
146
|
+
/** 设置表单字段的初始值。 */
|
|
147
147
|
setInitialValues: import("vue").ComputedRef<((initModel: Record<string, any>) => void) | undefined>;
|
|
148
|
-
/**
|
|
148
|
+
/** 对整个表单的内容进行验证,带滚动。 接收一个回调函数,或返回 Promise。 */
|
|
149
149
|
validateScrollToField: () => import("element-plus").FormValidationResult;
|
|
150
150
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
151
151
|
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => boolean;
|
|
152
152
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
153
|
-
/**
|
|
153
|
+
/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
154
154
|
labelWidth: {
|
|
155
155
|
type: (NumberConstructor | StringConstructor)[];
|
|
156
156
|
default: string;
|
|
157
157
|
};
|
|
158
|
-
/**
|
|
158
|
+
/** Suffix of the label. */
|
|
159
159
|
labelSuffix: {
|
|
160
160
|
type: StringConstructor;
|
|
161
161
|
default: string;
|
|
162
162
|
};
|
|
163
|
-
/**
|
|
163
|
+
/** When validation fails, scroll to the first error form entry. */
|
|
164
164
|
scrollToError: {
|
|
165
165
|
type: BooleanConstructor;
|
|
166
166
|
default: boolean;
|
|
167
167
|
};
|
|
168
|
-
/**
|
|
168
|
+
/** 详情From,会删除 FormItem 的 paddinfa-bottom */
|
|
169
169
|
detailForm: BooleanConstructor;
|
|
170
|
-
/**
|
|
170
|
+
/** Grid布局 */
|
|
171
171
|
grid: {
|
|
172
172
|
type: BooleanConstructor;
|
|
173
173
|
default: boolean;
|
|
174
174
|
};
|
|
175
|
-
/**
|
|
175
|
+
/** Grid布局列配置 */
|
|
176
176
|
cols: {
|
|
177
177
|
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
178
178
|
default: () => {
|
|
@@ -8,32 +8,32 @@ import { formUtil } from "../utils/form.mjs";
|
|
|
8
8
|
import { computed, createVNode, defineComponent, mergeProps, provide, reactive, shallowRef } from "vue";
|
|
9
9
|
import { ElForm, formEmits, formProps, useGlobalSize } from "element-plus";
|
|
10
10
|
//#region src/components/form/src/form.tsx
|
|
11
|
-
/** FaForm 的运行时 Props
|
|
11
|
+
/** FaForm 的运行时 Props 定义 */
|
|
12
12
|
const faFormProps = {
|
|
13
13
|
...formProps,
|
|
14
|
-
/**
|
|
14
|
+
/** Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
15
15
|
labelWidth: {
|
|
16
16
|
type: [String, Number],
|
|
17
17
|
default: "auto"
|
|
18
18
|
},
|
|
19
|
-
/**
|
|
19
|
+
/** Suffix of the label. */
|
|
20
20
|
labelSuffix: {
|
|
21
21
|
type: String,
|
|
22
22
|
default: ":"
|
|
23
23
|
},
|
|
24
|
-
/**
|
|
24
|
+
/** When validation fails, scroll to the first error form entry. */
|
|
25
25
|
scrollToError: {
|
|
26
26
|
type: Boolean,
|
|
27
27
|
default: true
|
|
28
28
|
},
|
|
29
|
-
/**
|
|
29
|
+
/** 详情From,会删除 FormItem 的 paddinfa-bottom */
|
|
30
30
|
detailForm: Boolean,
|
|
31
|
-
/**
|
|
31
|
+
/** Grid布局 */
|
|
32
32
|
grid: {
|
|
33
33
|
type: Boolean,
|
|
34
34
|
default: true
|
|
35
35
|
},
|
|
36
|
-
/**
|
|
36
|
+
/** Grid布局列配置 */
|
|
37
37
|
cols: {
|
|
38
38
|
type: definePropType([
|
|
39
39
|
String,
|
|
@@ -91,23 +91,23 @@ var form_default = defineComponent({
|
|
|
91
91
|
"cols": state.cols
|
|
92
92
|
}, { default: () => [slots.default?.(state)] }) : slots.default?.(state) }));
|
|
93
93
|
return useExpose(expose, {
|
|
94
|
-
/**
|
|
94
|
+
/** 对整个表单的内容进行验证。 接收一个回调函数,或返回 Promise。 */
|
|
95
95
|
validate: (callback) => callback ? formRef.value?.validate(callback) ?? Promise.reject(/* @__PURE__ */ new Error("ElForm 实例尚未挂载。")) : formUtil.validate(formRef),
|
|
96
|
-
/**
|
|
96
|
+
/** 验证具体的某个字段。 */
|
|
97
97
|
validateField: computed(() => formRef.value?.validateField),
|
|
98
|
-
/**
|
|
98
|
+
/** 重置该表单项,将其值重置为初始值,并移除校验结果 */
|
|
99
99
|
resetFields: computed(() => formRef.value?.resetFields),
|
|
100
|
-
/**
|
|
100
|
+
/** 清理某个字段的表单验证信息。 */
|
|
101
101
|
clearValidate: computed(() => formRef.value?.clearValidate),
|
|
102
|
-
/**
|
|
102
|
+
/** 滚动到指定的字段 */
|
|
103
103
|
scrollToField: computed(() => formRef.value?.scrollToField),
|
|
104
|
-
/**
|
|
104
|
+
/** 获取所有字段的 context */
|
|
105
105
|
fields: computed(() => formRef.value?.fields),
|
|
106
|
-
/**
|
|
106
|
+
/** 获取指定字段的 context。 */
|
|
107
107
|
getField: computed(() => formRef.value?.getField),
|
|
108
|
-
/**
|
|
108
|
+
/** 设置表单字段的初始值。 */
|
|
109
109
|
setInitialValues: computed(() => formRef.value?.setInitialValues),
|
|
110
|
-
/**
|
|
110
|
+
/** 对整个表单的内容进行验证,带滚动。 接收一个回调函数,或返回 Promise。 */
|
|
111
111
|
validateScrollToField: () => formUtil.validateScrollToField(formRef)
|
|
112
112
|
});
|
|
113
113
|
}
|
|
@@ -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
|
|
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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,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,22 +1,22 @@
|
|
|
1
|
-
/** FaFormItem 的运行时 Props
|
|
1
|
+
/** FaFormItem 的运行时 Props 定义 */
|
|
2
2
|
export declare const faFormItemProps: {
|
|
3
|
-
/**
|
|
3
|
+
/** Label tips 提示 */
|
|
4
4
|
tips: StringConstructor;
|
|
5
|
-
/**
|
|
5
|
+
/** Grid 布局 */
|
|
6
6
|
grid: {
|
|
7
7
|
type: BooleanConstructor;
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
10
|
+
/** 偏移量 */
|
|
11
11
|
offset: {
|
|
12
12
|
type: (NumberConstructor | StringConstructor)[];
|
|
13
13
|
default: number;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/** 栅格跨度 */
|
|
16
16
|
span: {
|
|
17
17
|
type: (NumberConstructor | StringConstructor)[];
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
19
|
+
/** 独占一行。如果设置 span 则无效 */
|
|
20
20
|
row: BooleanConstructor;
|
|
21
21
|
label: StringConstructor;
|
|
22
22
|
labelWidth: {
|
|
@@ -34,7 +34,7 @@ export declare const faFormItemProps: {
|
|
|
34
34
|
};
|
|
35
35
|
required: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
36
36
|
rules: {
|
|
37
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...
|
|
37
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>)) | null)[], unknown, unknown>>;
|
|
38
38
|
readonly required: false;
|
|
39
39
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
40
40
|
__epPropKey: true;
|
|
@@ -56,37 +56,37 @@ export declare const faFormItemProps: {
|
|
|
56
56
|
__epPropKey: true;
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
-
/** FaFormItem
|
|
59
|
+
/** FaFormItem 的插槽参数 */
|
|
60
60
|
export interface FaFormItemSlots extends Record<string, unknown> {
|
|
61
|
-
/**
|
|
61
|
+
/** 默认内容插槽 */
|
|
62
62
|
default: never;
|
|
63
|
-
/**
|
|
63
|
+
/** 标签位置显示的内容 */
|
|
64
64
|
label: {
|
|
65
65
|
label: string;
|
|
66
66
|
};
|
|
67
|
-
/**
|
|
67
|
+
/** 验证错误信息的显示内容 */
|
|
68
68
|
error: {
|
|
69
69
|
error: string;
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
73
|
-
/**
|
|
73
|
+
/** Label tips 提示 */
|
|
74
74
|
tips: StringConstructor;
|
|
75
|
-
/**
|
|
75
|
+
/** Grid 布局 */
|
|
76
76
|
grid: {
|
|
77
77
|
type: BooleanConstructor;
|
|
78
78
|
default: boolean;
|
|
79
79
|
};
|
|
80
|
-
/**
|
|
80
|
+
/** 偏移量 */
|
|
81
81
|
offset: {
|
|
82
82
|
type: (NumberConstructor | StringConstructor)[];
|
|
83
83
|
default: number;
|
|
84
84
|
};
|
|
85
|
-
/**
|
|
85
|
+
/** 栅格跨度 */
|
|
86
86
|
span: {
|
|
87
87
|
type: (NumberConstructor | StringConstructor)[];
|
|
88
88
|
};
|
|
89
|
-
/**
|
|
89
|
+
/** 独占一行。如果设置 span 则无效 */
|
|
90
90
|
row: BooleanConstructor;
|
|
91
91
|
label: StringConstructor;
|
|
92
92
|
labelWidth: {
|
|
@@ -104,7 +104,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
104
104
|
};
|
|
105
105
|
required: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
106
106
|
rules: {
|
|
107
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...
|
|
107
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>)) | null)[], unknown, unknown>>;
|
|
108
108
|
readonly required: false;
|
|
109
109
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
110
110
|
__epPropKey: true;
|
|
@@ -126,38 +126,38 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
126
126
|
__epPropKey: true;
|
|
127
127
|
};
|
|
128
128
|
}>, {
|
|
129
|
-
/**
|
|
129
|
+
/** 表单项大小 */
|
|
130
130
|
size: import("vue").ComputedRef<"" | "small" | "default" | "large" | undefined>;
|
|
131
|
-
/**
|
|
131
|
+
/** 校验消息 */
|
|
132
132
|
validateMessage: import("vue").ComputedRef<string | undefined>;
|
|
133
|
-
/**
|
|
133
|
+
/** 校验状态 */
|
|
134
134
|
validateState: import("vue").ComputedRef<"" | "error" | "success" | "validating" | undefined>;
|
|
135
|
-
/**
|
|
135
|
+
/** 验证表单项 */
|
|
136
136
|
validate: import("vue").ComputedRef<((trigger: string, callback?: import("element-plus").FormValidateCallback) => import("element-plus").FormValidationResult) | undefined>;
|
|
137
|
-
/**
|
|
137
|
+
/** 移除该表单项的校验结果 */
|
|
138
138
|
clearValidate: import("vue").ComputedRef<(() => void) | undefined>;
|
|
139
|
-
/**
|
|
139
|
+
/** 对该表单项进行重置,将其值重置为初始值并移除校验结果 */
|
|
140
140
|
resetField: import("vue").ComputedRef<(() => void) | undefined>;
|
|
141
|
-
/**
|
|
141
|
+
/** 设置该表单项的初始值。 */
|
|
142
142
|
setInitialValue: import("vue").ComputedRef<((value: any) => void) | undefined>;
|
|
143
143
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
144
|
-
/**
|
|
144
|
+
/** Label tips 提示 */
|
|
145
145
|
tips: StringConstructor;
|
|
146
|
-
/**
|
|
146
|
+
/** Grid 布局 */
|
|
147
147
|
grid: {
|
|
148
148
|
type: BooleanConstructor;
|
|
149
149
|
default: boolean;
|
|
150
150
|
};
|
|
151
|
-
/**
|
|
151
|
+
/** 偏移量 */
|
|
152
152
|
offset: {
|
|
153
153
|
type: (NumberConstructor | StringConstructor)[];
|
|
154
154
|
default: number;
|
|
155
155
|
};
|
|
156
|
-
/**
|
|
156
|
+
/** 栅格跨度 */
|
|
157
157
|
span: {
|
|
158
158
|
type: (NumberConstructor | StringConstructor)[];
|
|
159
159
|
};
|
|
160
|
-
/**
|
|
160
|
+
/** 独占一行。如果设置 span 则无效 */
|
|
161
161
|
row: BooleanConstructor;
|
|
162
162
|
label: StringConstructor;
|
|
163
163
|
labelWidth: {
|
|
@@ -175,7 +175,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
175
175
|
};
|
|
176
176
|
required: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
177
177
|
rules: {
|
|
178
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...
|
|
178
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>)) | null)[], unknown, unknown>>;
|
|
179
179
|
readonly required: false;
|
|
180
180
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
181
181
|
__epPropKey: true;
|
|
@@ -7,24 +7,24 @@ import { FaFormItemTip } from "../../formItemTip/index.mjs";
|
|
|
7
7
|
import { Fragment, computed, createVNode, defineComponent, inject, mergeProps, ref, shallowRef } from "vue";
|
|
8
8
|
import { ElFormItem, formItemProps } from "element-plus";
|
|
9
9
|
//#region src/components/form/src/formItem.tsx
|
|
10
|
-
/** FaFormItem 的运行时 Props
|
|
10
|
+
/** FaFormItem 的运行时 Props 定义 */
|
|
11
11
|
const faFormItemProps = {
|
|
12
12
|
...formItemProps,
|
|
13
|
-
/**
|
|
13
|
+
/** Label tips 提示 */
|
|
14
14
|
tips: String,
|
|
15
|
-
/**
|
|
15
|
+
/** Grid 布局 */
|
|
16
16
|
grid: {
|
|
17
17
|
type: Boolean,
|
|
18
18
|
default: true
|
|
19
19
|
},
|
|
20
|
-
/**
|
|
20
|
+
/** 偏移量 */
|
|
21
21
|
offset: {
|
|
22
22
|
type: [String, Number],
|
|
23
23
|
default: 0
|
|
24
24
|
},
|
|
25
|
-
/**
|
|
25
|
+
/** 栅格跨度 */
|
|
26
26
|
span: { type: [String, Number] },
|
|
27
|
-
/**
|
|
27
|
+
/** 独占一行。如果设置 span 则无效 */
|
|
28
28
|
row: Boolean
|
|
29
29
|
};
|
|
30
30
|
var formItem_default = defineComponent({
|
|
@@ -64,19 +64,19 @@ var formItem_default = defineComponent({
|
|
|
64
64
|
})] });
|
|
65
65
|
});
|
|
66
66
|
return useExpose(expose, {
|
|
67
|
-
/**
|
|
67
|
+
/** 表单项大小 */
|
|
68
68
|
size: computed(() => formItemRef.value?.size),
|
|
69
|
-
/**
|
|
69
|
+
/** 校验消息 */
|
|
70
70
|
validateMessage: computed(() => formItemRef.value?.validateMessage),
|
|
71
|
-
/**
|
|
71
|
+
/** 校验状态 */
|
|
72
72
|
validateState: computed(() => formItemRef.value?.validateState),
|
|
73
|
-
/**
|
|
73
|
+
/** 验证表单项 */
|
|
74
74
|
validate: computed(() => formItemRef.value?.validate),
|
|
75
|
-
/**
|
|
75
|
+
/** 移除该表单项的校验结果 */
|
|
76
76
|
clearValidate: computed(() => formItemRef.value?.clearValidate),
|
|
77
|
-
/**
|
|
77
|
+
/** 对该表单项进行重置,将其值重置为初始值并移除校验结果 */
|
|
78
78
|
resetField: computed(() => formItemRef.value?.resetField),
|
|
79
|
-
/**
|
|
79
|
+
/** 设置该表单项的初始值。 */
|
|
80
80
|
setInitialValue: computed(() => formItemRef.value?.setInitialValue)
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formItem.mjs","names":[],"sources":["../../../../src/components/form/src/formItem.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, ref, shallowRef } from \"vue\";\nimport { ElFormItem, formItemProps } from \"element-plus\";\nimport { makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaFormItemTip } from \"../../formItemTip\";\nimport { FaLayoutGridItem } from \"../../layoutGrid\";\nimport type { FormItemInstance } from \"element-plus\";\nimport type { Ref } from \"vue\";\n\n/** FaFormItem 的运行时 Props
|
|
1
|
+
{"version":3,"file":"formItem.mjs","names":[],"sources":["../../../../src/components/form/src/formItem.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, ref, shallowRef } from \"vue\";\nimport { ElFormItem, formItemProps } from \"element-plus\";\nimport { makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaFormItemTip } from \"../../formItemTip\";\nimport { FaLayoutGridItem } from \"../../layoutGrid\";\nimport type { FormItemInstance } from \"element-plus\";\nimport type { Ref } from \"vue\";\n\n/** FaFormItem 的运行时 Props 定义 */\nexport const faFormItemProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...formItemProps,\n\t/** Label tips 提示 */\n\ttips: String,\n\t/** Grid 布局 */\n\tgrid: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** 偏移量 */\n\toffset: {\n\t\ttype: [String, Number],\n\t\tdefault: 0,\n\t},\n\t/** 栅格跨度 */\n\tspan: {\n\t\ttype: [String, Number],\n\t},\n\t/** 独占一行。如果设置 span 则无效 */\n\trow: Boolean,\n};\n\n/** FaFormItem 的插槽参数 */\nexport interface FaFormItemSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: never;\n\t/** 标签位置显示的内容 */\n\tlabel: { label: string };\n\t/** 验证错误信息的显示内容 */\n\terror: { error: string };\n}\n\nexport default defineComponent({\n\tname: \"FaFormItem\",\n\tprops: faFormItemProps,\n\tslots: makeSlots<FaFormItemSlots>(),\n\tsetup(props, { slots, expose }) {\n\t\tconst formItemRef = shallowRef<FormItemInstance | null>(null);\n\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(4));\n\n\t\t// 获取响应式设置\n\t\tconst getResponsive = () => {\n\t\t\tif (!props.grid) return {};\n\t\t\tif (props.span) {\n\t\t\t\treturn {\n\t\t\t\t\tspan: typeof props.span === \"number\" ? props.span : Number(props.span),\n\t\t\t\t\toffset: typeof props.offset === \"number\" ? props.offset : Number(props.offset),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst result = {\n\t\t\t\t\tspan: 1,\n\t\t\t\t\toffset: typeof props.offset === \"number\" ? props.offset : Number(props.offset),\n\t\t\t\t};\n\t\t\t\tif (props.row) {\n\t\t\t\t\tresult.span = cols.value;\n\t\t\t\t}\n\t\t\t\treturn result;\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 elFormItemProps = useProps(props, formItemProps);\n\n\t\tuseRender(() => {\n\t\t\tconst FormItemWrapper = props.grid ? FaLayoutGridItem : Fragment;\n\t\t\treturn (\n\t\t\t\t<FormItemWrapper {...getResponsive()}>\n\t\t\t\t\t<ElFormItem ref={formItemRef} {...elFormItemProps.value}>\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tdefault: () => slots.default?.() ?? [],\n\t\t\t\t\t\t\t...(slots.label && !props.tips && { label: ({ label }: { label: string }) => slots.label?.({ label }) ?? [] }),\n\t\t\t\t\t\t\t...(slots.label &&\n\t\t\t\t\t\t\t\tprops.tips && {\n\t\t\t\t\t\t\t\t\tlabel: ({ label }: { label: string }) => [\n\t\t\t\t\t\t\t\t\t\t<FaFormItemTip>\n\t\t\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: () => slots.label?.({ label }) ?? [],\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t</FaFormItemTip>,\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t...(!slots.label &&\n\t\t\t\t\t\t\t\tprops.tips && {\n\t\t\t\t\t\t\t\t\tlabel: ({ label }: { label?: string }) => [<FaFormItemTip label={label ?? props.label} tips={props.tips} />],\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t...(slots.error && { error: ({ error }: { error: string }) => slots.error?.({ error }) ?? [] }),\n\t\t\t\t\t\t}}\n\t\t\t\t\t</ElFormItem>\n\t\t\t\t</FormItemWrapper>\n\t\t\t);\n\t\t});\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 表单项大小 */\n\t\t\tsize: computed(() => formItemRef.value?.size),\n\t\t\t/** 校验消息 */\n\t\t\tvalidateMessage: computed(() => formItemRef.value?.validateMessage),\n\t\t\t/** 校验状态 */\n\t\t\tvalidateState: computed(() => formItemRef.value?.validateState),\n\t\t\t/** 验证表单项 */\n\t\t\tvalidate: computed(() => formItemRef.value?.validate),\n\t\t\t/** 移除该表单项的校验结果 */\n\t\t\tclearValidate: computed(() => formItemRef.value?.clearValidate),\n\t\t\t/** 对该表单项进行重置,将其值重置为初始值并移除校验结果 */\n\t\t\tresetField: computed(() => formItemRef.value?.resetField),\n\t\t\t/** 设置该表单项的初始值。 */\n\t\t\tsetInitialValue: computed(() => formItemRef.value?.setInitialValue),\n\t\t});\n\t},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