fast-element-plus 2.0.19 → 2.0.21
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 +47 -20
- package/CONTRIBUTING.md +3 -4
- package/README.md +80 -27
- package/README.zh.md +66 -27
- package/dist/component.d.ts +110 -110
- 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 +6 -6
- package/dist/components/contextMenu/src/contextMenu.mjs +5 -5
- 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 +74 -74
- package/dist/components/dialog/src/dialog.mjs +31 -31
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +57 -57
- package/dist/components/drawer/src/drawer.mjs +24 -24
- 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 +18 -18
- package/dist/components/layoutGrid/src/layoutGridItem.mjs +8 -8
- package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +88 -88
- package/dist/components/select/src/select.mjs +28 -28
- 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 +78 -84
- package/dist/components/selectPage/src/selectPage.mjs +49 -35
- 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 +160 -851
- package/dist/components/selectV2/src/selectV2.mjs +30 -338
- 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 +131 -327
- 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 +62 -213
- 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 +6 -6
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +86 -86
- package/dist/components/tree/src/tree.mjs +46 -46
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +144 -150
- package/dist/components/treeSelect/src/treeSelect.mjs +55 -55
- 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 +17 -17
- 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 +23 -23
- 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.global.min.js +4 -4
- 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":"iconSelector.mjs","names":["update:modelValue"],"sources":["../../../../src/components/iconSelector/src/iconSelector.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, watch } from \"vue\";\nimport * as ElementPlusIconsVue from \"@element-plus/icons-vue\";\nimport { ChromeFilled, RefreshRight } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElInput, ElPopover, ElScrollbar } from \"element-plus\";\nimport * as FastElementPlusIconsVue from \"@fast-element-plus/icons-vue\";\nimport { definePropType, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport { FaIcon } from \"../../icon\";\nimport type { PropType } from \"vue\";\n\ntype IconType = \"ele\" | \"fastEle\" | \"local\";\n\nexport default defineComponent({\n\tname: \"FaIconSelector\",\n\tprops: {\n\t\t/** @description v-model绑定值 */\n\t\tmodelValue: String as PropType<string | null>,\n\t\t/** @description 自定义图标 */\n\t\tcustomIcons: {\n\t\t\ttype: definePropType<string[]>(Array),\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\temits: {\n\t\t/** @description v-model 回调 */\n\t\t\"update:modelValue\": (value: string | null) => typeof value === \"string\" || value === null,\n\t\t/** @description 改变 */\n\t\tchange: (value: string | null) => typeof value === \"string\" || value === null,\n\t},\n\tsetup(props, { emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<string | null>(null),\n\t\t\tsearchValue: withDefineType<string | null>(),\n\t\t\ticonType: withDefineType<IconType>(\"ele\"),\n\t\t\tpopoverVisible: false,\n\t\t\ticonNames: withDefineType<string[]>(Object.keys(ElementPlusIconsVue).map((name) => `el-icon-${name}`)),\n\t\t\trenderIconNames: computed((): string[] => {\n\t\t\t\tif (!state.searchValue) return state.iconNames;\n\t\t\t\treturn state.iconNames.filter((f) => f.toLowerCase().includes(state.searchValue?.toLowerCase() ?? \"\"));\n\t\t\t}),\n\t\t});\n\t\tconst popoverVisibleModel = computed({\n\t\t\tget: () => state.popoverVisible,\n\t\t\tset: (visible: boolean) => {\n\t\t\t\tstate.popoverVisible = visible;\n\t\t\t\tif (!visible) state.searchValue = null;\n\t\t\t},\n\t\t});\n\n\t\tconst handleTabClick = (iconType: IconType) => {\n\t\t\tstate.iconType = iconType;\n\t\t\tstate.iconNames = [];\n\t\t\tswitch (iconType) {\n\t\t\t\tcase \"ele\":\n\t\t\t\t\tstate.iconNames = Object.keys(ElementPlusIconsVue).map((name) => `el-icon-${name}`);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"fastEle\":\n\t\t\t\t\tstate.iconNames = Object.keys(FastElementPlusIconsVue).map((name) => `fa-icon-${name}`);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"local\":\n\t\t\t\t\tstate.iconNames = props.customIcons;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t};\n\n\t\tconst handleIconClick = (value: string) => {\n\t\t\tstate.popoverVisible = false;\n\t\t\tstate.value = value;\n\t\t\tstate.searchValue = \"\";\n\t\t\temit(\"update:modelValue\", value);\n\t\t\temit(\"change\", value);\n\t\t};\n\n\t\tconst handleRefresh = () => {\n\t\t\tstate.value = null;\n\t\t\tstate.searchValue = null;\n\t\t\temit(\"update:modelValue\", null);\n\t\t\temit(\"change\", null);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tstate.value = newValue ?? null;\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.customIcons,\n\t\t\t() => {\n\t\t\t\tif (state.iconType === \"local\") state.iconNames = [...props.customIcons];\n\t\t\t},\n\t\t\t{ deep: true }\n\t\t);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tpopperClass=\"fa-icon-selector-popover\"\n\t\t\t\tvModel:visible={popoverVisibleModel.value}\n\t\t\t\twidth=\"auto\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\tclass=\"fa-icon-selector\"\n\t\t\t\t\t\t\tmodelValue={state.popoverVisible ? (state.searchValue ?? \"\") : (state.value ?? \"\")}\n\t\t\t\t\t\t\tplaceholder={state.popoverVisible ? \"搜索图标\" : \"请选择图标\"}\n\t\t\t\t\t\t\treadonly={!state.popoverVisible}\n\t\t\t\t\t\t\tonInput={(value: string) => {\n\t\t\t\t\t\t\t\tif (state.popoverVisible) state.searchValue = value;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\tprepend: () => <ElIcon>{state.value ? <FaIcon name={state.value} /> : <ChromeFilled />}</ElIcon>,\n\t\t\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t\t\t<ElIcon\n\t\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\thandleRefresh();\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<RefreshRight />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</ElInput>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box\">\n\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-header\">\n\t\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-header__title\">请选择图标</div>\n\t\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-header__tab\">\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclass={{ \"is-active\": state.iconType === \"ele\" }}\n\t\t\t\t\t\t\t\t\t\ttitle=\"Element Plus 图标\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => handleTabClick(\"ele\")}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tele\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclass={{ \"is-active\": state.iconType === \"fastEle\" }}\n\t\t\t\t\t\t\t\t\t\ttitle=\"Fast Element Plus 图标\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => handleTabClick(\"fastEle\")}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tfastEle\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclass={{ \"is-active\": state.iconType === \"local\" }}\n\t\t\t\t\t\t\t\t\t\ttitle=\"本地图标\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => handleTabClick(\"local\")}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tlocal\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-body\">\n\t\t\t\t\t\t\t\t<ElScrollbar>\n\t\t\t\t\t\t\t\t\t{state.renderIconNames.map((m) => (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tkey={m}\n\t\t\t\t\t\t\t\t\t\t\tclass=\"fa-icon-selector-popover__box-body__item\"\n\t\t\t\t\t\t\t\t\t\t\ttitle={m}\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => handleIconClick(m)}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<FaIcon name={m} />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 当前图标来源。 */\n\t\t\ticonType: computed(() => state.iconType),\n\t\t\t/** 当前选中的图标名称。 */\n\t\t\tvalue: computed(() => state.value),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;AAOoC,SAAA,QAAA,GAAA;CAAA,OAAA,OAAA,MAAA,cAAA,OAAA,UAAA,SAAA,KAAA,CAAA,MAAA,qBAAA,CAAA,QAAA,CAAA;AAAA;AAIpC,IAAA,uBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;;EAEN,YAAY;;EAEZ,aAAa;GACZ,MAAM,eAAyB,KA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A,QAAA;MAAA,SAOG,EAAE,aAAa,MAAM,aAAa,MAAM;MAAC,SAAA;MAAA,iBAEjC,eAAe,KAAK;KAAC,GAAA,CAAA,gBAAA,KAAA,CAAA,CAAA;KAAA,YAAA,UAAA;MAAA,QAAA;MAAA,SAM7B,EAAE,aAAa,MAAM,aAAa,UAAU;MAAC,SAAA;MAAA,iBAErC,eAAe,SAAS;KAAC,GAAA,CAAA,gBAAA,SAAA,CAAA,CAAA;KAAA,YAAA,UAAA;MAAA,QAAA;MAAA,SAMjC,EAAE,aAAa,MAAM,aAAa,QAAQ;MAAC,SAAA;MAAA,iBAEnC,eAAe,OAAO;KAAC,GAAA,CAAA,gBAAA,OAAA,CAAA,CAAA;IAAA,CAAA,CAAA,CAAA,GAAA,YAAA,OAAA,EAAA,SAAA,qCAAA,GAAA,CAAA,YAAA,aAAA,MAAA,QAAA,QAQtC,MAAM,gBAAgB,KAAK,MAAC,YAAA,UAAA;KAAA,QAAA;KAAA,OAGtB;KAAC,SAAA;KAAA,SAEC;KAAC,iBACO,gBAAgB,CAAC;IAAC,GAAA,CAAA,YAAA,QAAA,EAAA,QAEnB,EAAC,GAAA,IAAA,CAAA,CAAA,CAEhB,CAAC,IAAA,QAAA,EAAA,eAAA,CAAA,KAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA;GAAA;EAIL,CAAA,CAGH;EAED,OAAO,UAAU,QAAQ;;GAExB,UAAU,eAAe,MAAM,QAAQ;;GAEvC,OAAO,eAAe,MAAM,KAAK;EAClC,CAAC;CACF;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"iconSelector.mjs","names":["update:modelValue"],"sources":["../../../../src/components/iconSelector/src/iconSelector.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, watch } from \"vue\";\nimport * as ElementPlusIconsVue from \"@element-plus/icons-vue\";\nimport { ChromeFilled, RefreshRight } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElInput, ElPopover, ElScrollbar } from \"element-plus\";\nimport * as FastElementPlusIconsVue from \"@fast-element-plus/icons-vue\";\nimport { definePropType, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport { FaIcon } from \"../../icon\";\nimport type { PropType } from \"vue\";\n\ntype IconType = \"ele\" | \"fastEle\" | \"local\";\n\nexport default defineComponent({\n\tname: \"FaIconSelector\",\n\tprops: {\n\t\t/** v-model 绑定值 */\n\t\tmodelValue: String as PropType<string | null>,\n\t\t/** 自定义图标 */\n\t\tcustomIcons: {\n\t\t\ttype: definePropType<string[]>(Array),\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\temits: {\n\t\t/** v-model 回调 */\n\t\t\"update:modelValue\": (value: string | null) => typeof value === \"string\" || value === null,\n\t\t/** 改变 */\n\t\tchange: (value: string | null) => typeof value === \"string\" || value === null,\n\t},\n\tsetup(props, { emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<string | null>(null),\n\t\t\tsearchValue: withDefineType<string | null>(),\n\t\t\ticonType: withDefineType<IconType>(\"ele\"),\n\t\t\tpopoverVisible: false,\n\t\t\ticonNames: withDefineType<string[]>(Object.keys(ElementPlusIconsVue).map((name) => `el-icon-${name}`)),\n\t\t\trenderIconNames: computed((): string[] => {\n\t\t\t\tif (!state.searchValue) return state.iconNames;\n\t\t\t\treturn state.iconNames.filter((f) => f.toLowerCase().includes(state.searchValue?.toLowerCase() ?? \"\"));\n\t\t\t}),\n\t\t});\n\t\tconst popoverVisibleModel = computed({\n\t\t\tget: () => state.popoverVisible,\n\t\t\tset: (visible: boolean) => {\n\t\t\t\tstate.popoverVisible = visible;\n\t\t\t\tif (!visible) state.searchValue = null;\n\t\t\t},\n\t\t});\n\n\t\tconst handleTabClick = (iconType: IconType) => {\n\t\t\tstate.iconType = iconType;\n\t\t\tstate.iconNames = [];\n\t\t\tswitch (iconType) {\n\t\t\t\tcase \"ele\":\n\t\t\t\t\tstate.iconNames = Object.keys(ElementPlusIconsVue).map((name) => `el-icon-${name}`);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"fastEle\":\n\t\t\t\t\tstate.iconNames = Object.keys(FastElementPlusIconsVue).map((name) => `fa-icon-${name}`);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"local\":\n\t\t\t\t\tstate.iconNames = props.customIcons;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t};\n\n\t\tconst handleIconClick = (value: string) => {\n\t\t\tstate.popoverVisible = false;\n\t\t\tstate.value = value;\n\t\t\tstate.searchValue = \"\";\n\t\t\temit(\"update:modelValue\", value);\n\t\t\temit(\"change\", value);\n\t\t};\n\n\t\tconst handleRefresh = () => {\n\t\t\tstate.value = null;\n\t\t\tstate.searchValue = null;\n\t\t\temit(\"update:modelValue\", null);\n\t\t\temit(\"change\", null);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tstate.value = newValue ?? null;\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.customIcons,\n\t\t\t() => {\n\t\t\t\tif (state.iconType === \"local\") state.iconNames = [...props.customIcons];\n\t\t\t},\n\t\t\t{ deep: true }\n\t\t);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tpopperClass=\"fa-icon-selector-popover\"\n\t\t\t\tvModel:visible={popoverVisibleModel.value}\n\t\t\t\twidth=\"auto\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\tclass=\"fa-icon-selector\"\n\t\t\t\t\t\t\tmodelValue={state.popoverVisible ? (state.searchValue ?? \"\") : (state.value ?? \"\")}\n\t\t\t\t\t\t\tplaceholder={state.popoverVisible ? \"搜索图标\" : \"请选择图标\"}\n\t\t\t\t\t\t\treadonly={!state.popoverVisible}\n\t\t\t\t\t\t\tonInput={(value: string) => {\n\t\t\t\t\t\t\t\tif (state.popoverVisible) state.searchValue = value;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\tprepend: () => <ElIcon>{state.value ? <FaIcon name={state.value} /> : <ChromeFilled />}</ElIcon>,\n\t\t\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t\t\t<ElIcon\n\t\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\thandleRefresh();\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<RefreshRight />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</ElInput>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box\">\n\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-header\">\n\t\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-header__title\">请选择图标</div>\n\t\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-header__tab\">\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclass={{ \"is-active\": state.iconType === \"ele\" }}\n\t\t\t\t\t\t\t\t\t\ttitle=\"Element Plus 图标\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => handleTabClick(\"ele\")}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tele\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclass={{ \"is-active\": state.iconType === \"fastEle\" }}\n\t\t\t\t\t\t\t\t\t\ttitle=\"Fast Element Plus 图标\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => handleTabClick(\"fastEle\")}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tfastEle\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclass={{ \"is-active\": state.iconType === \"local\" }}\n\t\t\t\t\t\t\t\t\t\ttitle=\"本地图标\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => handleTabClick(\"local\")}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tlocal\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-icon-selector-popover__box-body\">\n\t\t\t\t\t\t\t\t<ElScrollbar>\n\t\t\t\t\t\t\t\t\t{state.renderIconNames.map((m) => (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tkey={m}\n\t\t\t\t\t\t\t\t\t\t\tclass=\"fa-icon-selector-popover__box-body__item\"\n\t\t\t\t\t\t\t\t\t\t\ttitle={m}\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => handleIconClick(m)}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<FaIcon name={m} />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ElScrollbar>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 当前图标来源。 */\n\t\t\ticonType: computed(() => state.i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,OAAO,eAAe,MAAM,KAAK;EAClC,CAAC;CACF;AACD,CAAC"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { ImageViewerAction } from "element-plus";
|
|
2
|
-
/** FaImage 的运行时 Props
|
|
2
|
+
/** FaImage 的运行时 Props 定义 */
|
|
3
3
|
export declare const faImageProps: {
|
|
4
|
-
/**
|
|
4
|
+
/** when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode. */
|
|
5
5
|
hideOnClickModal: {
|
|
6
6
|
type: BooleanConstructor;
|
|
7
7
|
default: boolean;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
9
|
+
/** whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`. */
|
|
10
10
|
previewTeleported: {
|
|
11
11
|
type: BooleanConstructor;
|
|
12
12
|
default: boolean;
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
14
|
+
/** whether to use lazy load. */
|
|
15
15
|
lazy: {
|
|
16
16
|
type: BooleanConstructor;
|
|
17
17
|
default: boolean;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
19
|
+
/** Base64图片 */
|
|
20
20
|
base64: BooleanConstructor;
|
|
21
|
-
/**
|
|
21
|
+
/** 原图 */
|
|
22
22
|
original: BooleanConstructor;
|
|
23
|
-
/**
|
|
23
|
+
/** 标准 */
|
|
24
24
|
normal: BooleanConstructor;
|
|
25
|
-
/**
|
|
25
|
+
/** 小图 */
|
|
26
26
|
small: BooleanConstructor;
|
|
27
|
-
/**
|
|
27
|
+
/** 缩略图 */
|
|
28
28
|
thumb: BooleanConstructor;
|
|
29
|
-
/**
|
|
29
|
+
/** 是否可以预览图片 */
|
|
30
30
|
preview: {
|
|
31
31
|
type: BooleanConstructor;
|
|
32
32
|
default: boolean;
|
|
@@ -75,22 +75,22 @@ export declare const faImageEmits: {
|
|
|
75
75
|
close: () => boolean;
|
|
76
76
|
show: () => boolean;
|
|
77
77
|
};
|
|
78
|
-
/** FaImage
|
|
78
|
+
/** FaImage 的插槽参数 */
|
|
79
79
|
export interface FaImageSlots extends Record<string, unknown> {
|
|
80
|
-
/**
|
|
80
|
+
/** 当图像尚未加载时,自定义的占位符内容 */
|
|
81
81
|
placeholder: never;
|
|
82
|
-
/**
|
|
82
|
+
/** 自定义图像加载失败的内容 */
|
|
83
83
|
error: never;
|
|
84
|
-
/**
|
|
84
|
+
/** 当图像预览时自定义内容 */
|
|
85
85
|
viewer: {
|
|
86
86
|
src?: string;
|
|
87
87
|
};
|
|
88
|
-
/**
|
|
88
|
+
/** 图片预览进度内容 */
|
|
89
89
|
progress: {
|
|
90
90
|
activeIndex: number;
|
|
91
91
|
total: number;
|
|
92
92
|
};
|
|
93
|
-
/**
|
|
93
|
+
/** 图片预览工具栏内容 */
|
|
94
94
|
toolbar: {
|
|
95
95
|
actions: (action: ImageViewerAction, options?: Record<string, never>) => void;
|
|
96
96
|
prev: () => void;
|
|
@@ -99,39 +99,39 @@ export interface FaImageSlots extends Record<string, unknown> {
|
|
|
99
99
|
activeIndex: number;
|
|
100
100
|
setActiveItem: (index: number) => void;
|
|
101
101
|
};
|
|
102
|
-
/**
|
|
102
|
+
/** 图片预览加载失败内容 */
|
|
103
103
|
"viewer-error": {
|
|
104
104
|
activeIndex: number;
|
|
105
105
|
src: string;
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
109
|
-
/**
|
|
109
|
+
/** when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode. */
|
|
110
110
|
hideOnClickModal: {
|
|
111
111
|
type: BooleanConstructor;
|
|
112
112
|
default: boolean;
|
|
113
113
|
};
|
|
114
|
-
/**
|
|
114
|
+
/** whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`. */
|
|
115
115
|
previewTeleported: {
|
|
116
116
|
type: BooleanConstructor;
|
|
117
117
|
default: boolean;
|
|
118
118
|
};
|
|
119
|
-
/**
|
|
119
|
+
/** whether to use lazy load. */
|
|
120
120
|
lazy: {
|
|
121
121
|
type: BooleanConstructor;
|
|
122
122
|
default: boolean;
|
|
123
123
|
};
|
|
124
|
-
/**
|
|
124
|
+
/** Base64图片 */
|
|
125
125
|
base64: BooleanConstructor;
|
|
126
|
-
/**
|
|
126
|
+
/** 原图 */
|
|
127
127
|
original: BooleanConstructor;
|
|
128
|
-
/**
|
|
128
|
+
/** 标准 */
|
|
129
129
|
normal: BooleanConstructor;
|
|
130
|
-
/**
|
|
130
|
+
/** 小图 */
|
|
131
131
|
small: BooleanConstructor;
|
|
132
|
-
/**
|
|
132
|
+
/** 缩略图 */
|
|
133
133
|
thumb: BooleanConstructor;
|
|
134
|
-
/**
|
|
134
|
+
/** 是否可以预览图片 */
|
|
135
135
|
preview: {
|
|
136
136
|
type: BooleanConstructor;
|
|
137
137
|
default: boolean;
|
|
@@ -172,7 +172,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
172
172
|
__epPropKey: true;
|
|
173
173
|
};
|
|
174
174
|
}>, {
|
|
175
|
-
/**
|
|
175
|
+
/** 手动打开图片预览。 */
|
|
176
176
|
showPreview: import("vue").ComputedRef<(() => void) | undefined>;
|
|
177
177
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
178
178
|
load: (evt: Event) => boolean;
|
|
@@ -181,32 +181,32 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
181
181
|
close: () => boolean;
|
|
182
182
|
show: () => boolean;
|
|
183
183
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
184
|
-
/**
|
|
184
|
+
/** when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode. */
|
|
185
185
|
hideOnClickModal: {
|
|
186
186
|
type: BooleanConstructor;
|
|
187
187
|
default: boolean;
|
|
188
188
|
};
|
|
189
|
-
/**
|
|
189
|
+
/** whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`. */
|
|
190
190
|
previewTeleported: {
|
|
191
191
|
type: BooleanConstructor;
|
|
192
192
|
default: boolean;
|
|
193
193
|
};
|
|
194
|
-
/**
|
|
194
|
+
/** whether to use lazy load. */
|
|
195
195
|
lazy: {
|
|
196
196
|
type: BooleanConstructor;
|
|
197
197
|
default: boolean;
|
|
198
198
|
};
|
|
199
|
-
/**
|
|
199
|
+
/** Base64图片 */
|
|
200
200
|
base64: BooleanConstructor;
|
|
201
|
-
/**
|
|
201
|
+
/** 原图 */
|
|
202
202
|
original: BooleanConstructor;
|
|
203
|
-
/**
|
|
203
|
+
/** 标准 */
|
|
204
204
|
normal: BooleanConstructor;
|
|
205
|
-
/**
|
|
205
|
+
/** 小图 */
|
|
206
206
|
small: BooleanConstructor;
|
|
207
|
-
/**
|
|
207
|
+
/** 缩略图 */
|
|
208
208
|
thumb: BooleanConstructor;
|
|
209
|
-
/**
|
|
209
|
+
/** 是否可以预览图片 */
|
|
210
210
|
preview: {
|
|
211
211
|
type: BooleanConstructor;
|
|
212
212
|
default: boolean;
|
|
@@ -7,35 +7,35 @@ import { computed, createVNode, defineComponent, mergeProps, reactive, shallowRe
|
|
|
7
7
|
import { Picture } from "@element-plus/icons-vue";
|
|
8
8
|
import { ElIcon, ElImage, imageEmits, imageProps } from "element-plus";
|
|
9
9
|
//#region src/components/image/src/image.tsx
|
|
10
|
-
/** FaImage 的运行时 Props
|
|
10
|
+
/** FaImage 的运行时 Props 定义 */
|
|
11
11
|
const faImageProps = {
|
|
12
12
|
...imageProps,
|
|
13
|
-
/**
|
|
13
|
+
/** when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode. */
|
|
14
14
|
hideOnClickModal: {
|
|
15
15
|
type: Boolean,
|
|
16
16
|
default: true
|
|
17
17
|
},
|
|
18
|
-
/**
|
|
18
|
+
/** whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`. */
|
|
19
19
|
previewTeleported: {
|
|
20
20
|
type: Boolean,
|
|
21
21
|
default: true
|
|
22
22
|
},
|
|
23
|
-
/**
|
|
23
|
+
/** whether to use lazy load. */
|
|
24
24
|
lazy: {
|
|
25
25
|
type: Boolean,
|
|
26
26
|
default: true
|
|
27
27
|
},
|
|
28
|
-
/**
|
|
28
|
+
/** Base64图片 */
|
|
29
29
|
base64: Boolean,
|
|
30
|
-
/**
|
|
30
|
+
/** 原图 */
|
|
31
31
|
original: Boolean,
|
|
32
|
-
/**
|
|
32
|
+
/** 标准 */
|
|
33
33
|
normal: Boolean,
|
|
34
|
-
/**
|
|
34
|
+
/** 小图 */
|
|
35
35
|
small: Boolean,
|
|
36
|
-
/**
|
|
36
|
+
/** 缩略图 */
|
|
37
37
|
thumb: Boolean,
|
|
38
|
-
/**
|
|
38
|
+
/** 是否可以预览图片 */
|
|
39
39
|
preview: {
|
|
40
40
|
type: Boolean,
|
|
41
41
|
default: true
|
|
@@ -87,7 +87,7 @@ var image_default = defineComponent({
|
|
|
87
87
|
...slots["viewer-error"] && { "viewer-error": (scope) => slots["viewer-error"]?.(scope) ?? [] }
|
|
88
88
|
}));
|
|
89
89
|
return useExpose(expose, {
|
|
90
|
-
/**
|
|
90
|
+
/** 手动打开图片预览。 */
|
|
91
91
|
showPreview: computed(() => imageRef.value?.showPreview) });
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.mjs","names":["viewer-error"],"sources":["../../../../src/components/image/src/image.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, shallowRef, watch } from \"vue\";\nimport { Picture as ElIconPicture } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImage, imageEmits, imageProps } from \"element-plus\";\nimport { makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { ImageInstance, ImageViewerAction } from \"element-plus\";\n\n/** FaImage 的运行时 Props
|
|
1
|
+
{"version":3,"file":"image.mjs","names":["viewer-error"],"sources":["../../../../src/components/image/src/image.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, shallowRef, watch } from \"vue\";\nimport { Picture as ElIconPicture } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImage, imageEmits, imageProps } from \"element-plus\";\nimport { makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { ImageInstance, ImageViewerAction } from \"element-plus\";\n\n/** FaImage 的运行时 Props 定义 */\nexport const faImageProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...imageProps,\n\t/** when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode. */\n\thideOnClickModal: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`. */\n\tpreviewTeleported: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** whether to use lazy load. */\n\tlazy: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** Base64图片 */\n\tbase64: Boolean,\n\t/** 原图 */\n\toriginal: Boolean,\n\t/** 标准 */\n\tnormal: Boolean,\n\t/** 小图 */\n\tsmall: Boolean,\n\t/** 缩略图 */\n\tthumb: Boolean,\n\t/** 是否可以预览图片 */\n\tpreview: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n};\n\n/** FaImage 的运行时事件定义。 */\nexport const faImageEmits = {\n\t...imageEmits,\n};\n\n/** FaImage 的插槽参数 */\nexport interface FaImageSlots extends Record<string, unknown> {\n\t/** 当图像尚未加载时,自定义的占位符内容 */\n\tplaceholder: never;\n\t/** 自定义图像加载失败的内容 */\n\terror: never;\n\t/** 当图像预览时自定义内容 */\n\tviewer: { src?: string };\n\t/** 图片预览进度内容 */\n\tprogress: { activeIndex: number; total: number };\n\t/** 图片预览工具栏内容 */\n\ttoolbar: {\n\t\tactions: (action: ImageViewerAction, options?: Record<string, never>) => void;\n\t\tprev: () => void;\n\t\tnext: () => void;\n\t\treset: () => void;\n\t\tactiveIndex: number;\n\t\tsetActiveItem: (index: number) => void;\n\t};\n\t/** 图片预览加载失败内容 */\n\t\"viewer-error\": { activeIndex: number; src: string };\n}\n\nexport default defineComponent({\n\tname: \"FaImage\",\n\tprops: faImageProps,\n\temits: faImageEmits,\n\tslots: makeSlots<FaImageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst imageRef = shallowRef<ImageInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\t/** 图片加载错误 */\n\t\t\tloadError: false,\n\t\t\tsrc: computed(() => {\n\t\t\t\tif (!props.src) return undefined;\n\t\t\t\tif (props.base64) {\n\t\t\t\t\treturn `data:image/png;base64,${props.src}`;\n\t\t\t\t} else if (props.original || state.loadError) {\n\t\t\t\t\treturn props.src;\n\t\t\t\t} else if (props.normal) {\n\t\t\t\t\treturn `${props.src}@!normal`;\n\t\t\t\t} else if (props.small) {\n\t\t\t\t\treturn `${props.src}@!small`;\n\t\t\t\t} else if (props.thumb) {\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t} else {\n\t\t\t\t\t// 默认使用缩略图\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tpreviewList: computed(() => (props.preview && props.src ? [props.base64 ? `data:image/png;base64,${props.src}` : props.src] : [])),\n\t\t});\n\t\twatch(\n\t\t\t() => props.src,\n\t\t\t() => {\n\t\t\t\tstate.loadError = false;\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 bindProps = useProps(props, imageProps, [\"src\", \"previewSrcList\"]);\n\t\tconst bindEmits = useEmits(imageEmits, emit, [\"error\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElImage\n\t\t\t\t{...bindProps.value}\n\t\t\t\t{...bindEmits.value}\n\t\t\t\tclass=\"fa-image\"\n\t\t\t\tref={imageRef}\n\t\t\t\tsrc={state.src}\n\t\t\t\tpreviewSrcList={state.previewList}\n\t\t\t\tonError={(event) => {\n\t\t\t\t\tstate.loadError ||= true;\n\t\t\t\t\temit(\"error\", event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\terror: () =>\n\t\t\t\t\t\tslots.error ? (\n\t\t\t\t\t\t\tslots.error()\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div class=\"fa-image__error-image\">\n\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t<ElIconPicture />\n\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t...(slots.placeholder && { placeholder: () => slots.placeholder?.() ?? [] }),\n\t\t\t\t\t...(slots.viewer && { viewer: () => slots.viewer?.({ src: state.src }) ?? [] }),\n\t\t\t\t\t...(slots.progress && {\n\t\t\t\t\t\tprogress: (scope: { activeIndex: number; total: number }) => slots.progress?.(scope) ?? [],\n\t\t\t\t\t}),\n\t\t\t\t\t...(slots.toolbar && {\n\t\t\t\t\t\ttoolbar: (scope: FaImageSlots[\"toolbar\"]) => slots.toolbar?.(scope) ?? [],\n\t\t\t\t\t}),\n\t\t\t\t\t...(slots[\"viewer-error\"] && {\n\t\t\t\t\t\t\"viewer-error\": (scope: { activeIndex: number; src: string }) => slots[\"viewer-error\"]?.(scope) ?? [],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElImage>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 手动打开图片预览。 */\n\t\t\tshowPreview: computed(() => imageRef.value?.showPreview),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;AAOA,MAAa,eAAe;CAE3B,GAAG;;CAEH,kBAAkB;EACjB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,QAAQ;;CAER,UAAU;;CAEV,QA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AA,SAAA,OAAA,GAAA,EAAA,eAAA,CAAA,YAAA,SAAA,MAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA;GAQf,GAAI,MAAM,eAAe,EAAE,mBAAmB,MAAM,cAAc,KAAK,CAAA,EAAG;GAC1E,GAAI,MAAM,UAAU,EAAE,cAAc,MAAM,SAAS,EAAE,KAAK,MAAM,IAAI,CAAC,KAAK,CAAA,EAAG;GAC7E,GAAI,MAAM,YAAY,EACrB,WAAW,UAAkD,MAAM,WAAW,KAAK,KAAK,CAAA,EACzF;GACA,GAAI,MAAM,WAAW,EACpB,UAAU,UAAmC,MAAM,UAAU,KAAK,KAAK,CAAA,EACxE;GACA,GAAI,MAAM,mBAAmB,EAC5B,iBAAiB,UAAgD,MAAM,eAAe,GAAG,KAAK,KAAK,CAAA,EACpG;EAAE,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;AAExB,aAAa,eAAe,SAAS,OAAO,WAAW,EACxD,CAAC;CACF;AACD,CAAC"}
|
|
@@ -1,122 +1,122 @@
|
|
|
1
1
|
import type { TableProps } from "element-plus";
|
|
2
2
|
import type { PropType } from "vue";
|
|
3
3
|
import type { DefaultRow, PagedInput, PagedResult } from "../../table";
|
|
4
|
-
/** FaInputDialogPage 的运行时 Props
|
|
4
|
+
/** FaInputDialogPage 的运行时 Props 定义 */
|
|
5
5
|
export declare const faInputDialogPageProps: {
|
|
6
|
-
/**
|
|
6
|
+
/** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
7
7
|
rowKey: {
|
|
8
8
|
type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
|
|
9
9
|
default: string;
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
11
|
+
/** v-model 绑定值 */
|
|
12
12
|
modelValue: PropType<string | number | null>;
|
|
13
|
-
/**
|
|
13
|
+
/** v-model:label 绑定值 */
|
|
14
14
|
label: PropType<string | null>;
|
|
15
|
-
/**
|
|
15
|
+
/** 输入框占位文本 */
|
|
16
16
|
placeholder: {
|
|
17
17
|
type: StringConstructor;
|
|
18
18
|
default: string;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/** 禁用 */
|
|
21
21
|
disabled: BooleanConstructor;
|
|
22
|
-
/**
|
|
22
|
+
/** 标题 */
|
|
23
23
|
title: StringConstructor;
|
|
24
|
-
/**
|
|
24
|
+
/** 请求数据的函数 */
|
|
25
25
|
requestApi: {
|
|
26
26
|
type: PropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>;
|
|
27
27
|
};
|
|
28
28
|
/** 初始化参数 */
|
|
29
29
|
initParam: PropType<string | number | PagedInput>;
|
|
30
|
-
/**
|
|
30
|
+
/** 显示文本 Key */
|
|
31
31
|
labelKey: {
|
|
32
32
|
type: StringConstructor;
|
|
33
33
|
default: string;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
/** FaInputDialogPage 的运行时 Emits
|
|
36
|
+
/** FaInputDialogPage 的运行时 Emits 定义 */
|
|
37
37
|
export declare const faInputDialogPageEmits: {
|
|
38
|
-
/**
|
|
38
|
+
/** v-model 回调 */
|
|
39
39
|
"update:modelValue": (value: string | number | null) => boolean;
|
|
40
|
-
/**
|
|
40
|
+
/** v-model:label 回调 */
|
|
41
41
|
"update:label": (value: string | null) => boolean;
|
|
42
|
-
/**
|
|
42
|
+
/** 选中数据改变 */
|
|
43
43
|
change: (_data: DefaultRow | null, _value?: string | number | null) => boolean;
|
|
44
44
|
};
|
|
45
|
-
/** FaInputDialogPage
|
|
45
|
+
/** FaInputDialogPage 的插槽参数 */
|
|
46
46
|
export interface FaInputDialogPageSlots extends Record<string, unknown> {
|
|
47
|
-
/**
|
|
47
|
+
/** 默认内容插槽 */
|
|
48
48
|
default: never;
|
|
49
49
|
}
|
|
50
50
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
51
|
-
/**
|
|
51
|
+
/** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
52
52
|
rowKey: {
|
|
53
53
|
type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
|
|
54
54
|
default: string;
|
|
55
55
|
};
|
|
56
|
-
/**
|
|
56
|
+
/** v-model 绑定值 */
|
|
57
57
|
modelValue: PropType<string | number | null>;
|
|
58
|
-
/**
|
|
58
|
+
/** v-model:label 绑定值 */
|
|
59
59
|
label: PropType<string | null>;
|
|
60
|
-
/**
|
|
60
|
+
/** 输入框占位文本 */
|
|
61
61
|
placeholder: {
|
|
62
62
|
type: StringConstructor;
|
|
63
63
|
default: string;
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
65
|
+
/** 禁用 */
|
|
66
66
|
disabled: BooleanConstructor;
|
|
67
|
-
/**
|
|
67
|
+
/** 标题 */
|
|
68
68
|
title: StringConstructor;
|
|
69
|
-
/**
|
|
69
|
+
/** 请求数据的函数 */
|
|
70
70
|
requestApi: {
|
|
71
71
|
type: PropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>;
|
|
72
72
|
};
|
|
73
73
|
/** 初始化参数 */
|
|
74
74
|
initParam: PropType<string | number | PagedInput>;
|
|
75
|
-
/**
|
|
75
|
+
/** 显示文本 Key */
|
|
76
76
|
labelKey: {
|
|
77
77
|
type: StringConstructor;
|
|
78
78
|
default: string;
|
|
79
79
|
};
|
|
80
80
|
}>, {
|
|
81
|
-
/**
|
|
81
|
+
/** 选择行数据 */
|
|
82
82
|
selectionRow: import("vue").ComputedRef<DefaultRow | undefined>;
|
|
83
|
-
/**
|
|
83
|
+
/** 打开选择器弹窗 */
|
|
84
84
|
open: () => Promise<void>;
|
|
85
|
-
/**
|
|
85
|
+
/** 清除选择 */
|
|
86
86
|
clear: () => void;
|
|
87
87
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
88
|
-
/**
|
|
88
|
+
/** v-model 回调 */
|
|
89
89
|
"update:modelValue": (value: string | number | null) => boolean;
|
|
90
|
-
/**
|
|
90
|
+
/** v-model:label 回调 */
|
|
91
91
|
"update:label": (value: string | null) => boolean;
|
|
92
|
-
/**
|
|
92
|
+
/** 选中数据改变 */
|
|
93
93
|
change: (_data: DefaultRow | null, _value?: string | number | null) => boolean;
|
|
94
94
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
95
|
-
/**
|
|
95
|
+
/** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
96
96
|
rowKey: {
|
|
97
97
|
type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
|
|
98
98
|
default: string;
|
|
99
99
|
};
|
|
100
|
-
/**
|
|
100
|
+
/** v-model 绑定值 */
|
|
101
101
|
modelValue: PropType<string | number | null>;
|
|
102
|
-
/**
|
|
102
|
+
/** v-model:label 绑定值 */
|
|
103
103
|
label: PropType<string | null>;
|
|
104
|
-
/**
|
|
104
|
+
/** 输入框占位文本 */
|
|
105
105
|
placeholder: {
|
|
106
106
|
type: StringConstructor;
|
|
107
107
|
default: string;
|
|
108
108
|
};
|
|
109
|
-
/**
|
|
109
|
+
/** 禁用 */
|
|
110
110
|
disabled: BooleanConstructor;
|
|
111
|
-
/**
|
|
111
|
+
/** 标题 */
|
|
112
112
|
title: StringConstructor;
|
|
113
|
-
/**
|
|
113
|
+
/** 请求数据的函数 */
|
|
114
114
|
requestApi: {
|
|
115
115
|
type: PropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>;
|
|
116
116
|
};
|
|
117
117
|
/** 初始化参数 */
|
|
118
118
|
initParam: PropType<string | number | PagedInput>;
|
|
119
|
-
/**
|
|
119
|
+
/** 显示文本 Key */
|
|
120
120
|
labelKey: {
|
|
121
121
|
type: StringConstructor;
|
|
122
122
|
default: string;
|
|
@@ -9,27 +9,27 @@ import { computed, createVNode, defineComponent, reactive, shallowRef, useModel
|
|
|
9
9
|
import { Delete, Search } from "@element-plus/icons-vue";
|
|
10
10
|
import { ElButton, ElButtonGroup, ElInput } from "element-plus";
|
|
11
11
|
//#region src/components/inputDialogPage/src/inputDialogPage.tsx
|
|
12
|
-
/** FaInputDialogPage 的运行时 Props
|
|
12
|
+
/** FaInputDialogPage 的运行时 Props 定义 */
|
|
13
13
|
const faInputDialogPageProps = {
|
|
14
|
-
/**
|
|
14
|
+
/** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
15
15
|
rowKey: {
|
|
16
16
|
type: [String, Function],
|
|
17
17
|
default: "id"
|
|
18
18
|
},
|
|
19
|
-
/**
|
|
19
|
+
/** v-model 绑定值 */
|
|
20
20
|
modelValue: [String, Number],
|
|
21
|
-
/**
|
|
21
|
+
/** v-model:label 绑定值 */
|
|
22
22
|
label: String,
|
|
23
|
-
/**
|
|
23
|
+
/** 输入框占位文本 */
|
|
24
24
|
placeholder: {
|
|
25
25
|
type: String,
|
|
26
26
|
default: "请选择"
|
|
27
27
|
},
|
|
28
|
-
/**
|
|
28
|
+
/** 禁用 */
|
|
29
29
|
disabled: Boolean,
|
|
30
|
-
/**
|
|
30
|
+
/** 标题 */
|
|
31
31
|
title: String,
|
|
32
|
-
/**
|
|
32
|
+
/** 请求数据的函数 */
|
|
33
33
|
requestApi: { type: definePropType(Function) },
|
|
34
34
|
/** 初始化参数 */
|
|
35
35
|
initParam: definePropType([
|
|
@@ -37,19 +37,19 @@ const faInputDialogPageProps = {
|
|
|
37
37
|
Number,
|
|
38
38
|
Object
|
|
39
39
|
]),
|
|
40
|
-
/**
|
|
40
|
+
/** 显示文本 Key */
|
|
41
41
|
labelKey: {
|
|
42
42
|
type: String,
|
|
43
43
|
default: "name"
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
/** FaInputDialogPage 的运行时 Emits
|
|
46
|
+
/** FaInputDialogPage 的运行时 Emits 定义 */
|
|
47
47
|
const faInputDialogPageEmits = {
|
|
48
|
-
/**
|
|
48
|
+
/** v-model 回调 */
|
|
49
49
|
"update:modelValue": (value) => typeof value === "string" || typeof value === "number" || value === null,
|
|
50
|
-
/**
|
|
50
|
+
/** v-model:label 回调 */
|
|
51
51
|
"update:label": (value) => typeof value === "string" || value === null,
|
|
52
|
-
/**
|
|
52
|
+
/** 选中数据改变 */
|
|
53
53
|
change: (_data, _value) => true
|
|
54
54
|
};
|
|
55
55
|
var inputDialogPage_default = defineComponent({
|
|
@@ -137,11 +137,11 @@ var inputDialogPage_default = defineComponent({
|
|
|
137
137
|
"onRowDblclick": handleTableRowDblclick
|
|
138
138
|
}, { default: () => slots.default?.() })] })]));
|
|
139
139
|
return useExpose(expose, {
|
|
140
|
-
/**
|
|
140
|
+
/** 选择行数据 */
|
|
141
141
|
selectionRow: computed(() => state.selectionRow),
|
|
142
|
-
/**
|
|
142
|
+
/** 打开选择器弹窗 */
|
|
143
143
|
open: handleSearchClick,
|
|
144
|
-
/**
|
|
144
|
+
/** 清除选择 */
|
|
145
145
|
clear: handleDeleteClick
|
|
146
146
|
});
|
|
147
147
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputDialogPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, shallowRef, useModel } from \"vue\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport FaDialog from \"../../dialog\";\nimport { FaTable } from \"../../table\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport type { FaDialogInstance } from \"../../dialog\";\nimport type { DefaultRow, FaTableInstance, PagedInput, PagedResult } from \"../../table\";\n\n/** FaInputDialogPage 的运行时 Props
|
|
1
|
+
{"version":3,"file":"inputDialogPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, shallowRef, useModel } from \"vue\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport FaDialog from \"../../dialog\";\nimport { FaTable } from \"../../table\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport type { FaDialogInstance } from \"../../dialog\";\nimport type { DefaultRow, FaTableInstance, PagedInput, PagedResult } from \"../../table\";\n\n/** FaInputDialogPage 的运行时 Props 定义 */\nexport const faInputDialogPageProps = {\n\t/** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */\n\trowKey: {\n\t\ttype: [String, Function] as PropType<NonNullable<TableProps<DefaultRow>[\"rowKey\"]>>,\n\t\tdefault: \"id\",\n\t},\n\t/** v-model 绑定值 */\n\tmodelValue: [String, Number] as PropType<string | number | null>,\n\t/** v-model:label 绑定值 */\n\tlabel: String as PropType<string | null>,\n\t/** 输入框占位文本 */\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: \"请选择\",\n\t},\n\t/** 禁用 */\n\tdisabled: Boolean,\n\t/** 标题 */\n\ttitle: String,\n\t/** 请求数据的函数 */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n\t/** 显示文本 Key */\n\tlabelKey: {\n\t\ttype: String,\n\t\tdefault: \"name\",\n\t},\n};\n\n/** FaInputDialogPage 的运行时 Emits 定义 */\nexport const faInputDialogPageEmits = {\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: string | number | null) => typeof value === \"string\" || typeof value === \"number\" || value === null,\n\t/** v-model:label 回调 */\n\t\"update:label\": (value: string | null) => typeof value === \"string\" || value === null,\n\t/** 选中数据改变 */\n\tchange: (_data: DefaultRow | null, _value?: string | number | null) => true,\n};\n\n/** FaInputDialogPage 的插槽参数 */\nexport interface FaInputDialogPageSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaInputDialogPage\",\n\tprops: faInputDialogPageProps,\n\temits: faInputDialogPageEmits,\n\tslots: makeSlots<FaInputDialogPageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst modelValue = useModel(props, \"modelValue\");\n\t\tconst selectedLabel = useModel(props, \"label\");\n\n\t\tconst faDialogRef = shallowRef<FaDialogInstance | null>(null);\n\t\tconst faTableRef = shallowRef<FaTableInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tselectionRow: withDefineType<DefaultRow | undefined>(),\n\t\t});\n\n\t\tconst handleDeleteClick = () => {\n\t\t\tmodelValue.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\tstate.selectionRow = undefined;\n\t\t\temit(\"change\", null, null);\n\t\t};\n\n\t\tconst handleSearchClick = async () => {\n\t\t\tawait faDialogRef.value?.open(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tif (table === null) return;\n\t\t\t\tif (state.selectionRow) {\n\t\t\t\t\t// 判断当前行是否选中\n\t\t\t\t\tconst rawRowKey: unknown =\n\t\t\t\t\t\ttypeof props.rowKey === \"function\" ? props.rowKey(state.selectionRow) : state.selectionRow[props.rowKey];\n\t\t\t\t\tconst rowSelected = (typeof rawRowKey === \"string\" || typeof rawRowKey === \"number\") && table.selectedListIds.includes(rawRowKey);\n\t\t\t\t\tif (!rowSelected) {\n\t\t\t\t\t\ttable.toggleRowSelection?.(state.selectionRow);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tfaDialogRef.value?.close(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tconst selectedData = table?.selectedList[0];\n\t\t\t\tif (table?.selected && selectedData) {\n\t\t\t\t\tstate.selectionRow = selectedData;\n\t\t\t\t\tconst selectedValue: unknown = typeof props.rowKey === \"function\" ? props.rowKey(selectedData) : selectedData[props.rowKey];\n\t\t\t\t\tmodelValue.value = typeof selectedValue === \"string\" || typeof selectedValue === \"number\" ? selectedValue : null;\n\t\t\t\t\tconst label: unknown = selectedData[props.labelKey];\n\t\t\t\t\tselectedLabel.value = typeof label === \"string\" ? label : null;\n\t\t\t\t\temit(\"change\", selectedData, modelValue.value);\n\t\t\t\t} else {\n\t\t\t\t\tmodelValue.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\tstate.selectionRow = undefined;\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleTableRowDblclick = (row: DefaultRow) => {\n\t\t\tfaTableRef.value?.clearSelection?.();\n\t\t\tfaTableRef.value?.toggleRowSelection?.(row);\n\t\t\tstate.selectionRow = row;\n\t\t\thandleConfirmClick();\n\t\t};\n\n\t\tuseRender(() => (\n\t\t\t<div class=\"fa-input-dialog-page\">\n\t\t\t\t<ElInput vModel={selectedLabel.value} placeholder={props.placeholder} disabled={props.disabled} readonly>\n\t\t\t\t\t{{\n\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t<ElButtonGroup>\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Delete} onClick={handleDeleteClick} />\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Search} onClick={handleSearchClick} />\n\t\t\t\t\t\t\t</ElButtonGroup>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t</ElInput>\n\t\t\t\t<FaDialog\n\t\t\t\t\tref={faDialogRef}\n\t\t\t\t\tstyle=\"--height: 70%;\"\n\t\t\t\t\twidth=\"50%\"\n\t\t\t\t\ttitle={props.title}\n\t\t\t\t\tfullHeight\n\t\t\t\t\tdisabledConfirmButton={!faTableRef.value?.selected}\n\t\t\t\t\tonConfirmClick={handleConfirmClick}\n\t\t\t\t>\n\t\t\t\t\t<FaTable\n\t\t\t\t\t\tref={faTableRef}\n\t\t\t\t\t\trowKey={props.rowKey}\n\t\t\t\t\t\trequestApi={props.requestApi}\n\t\t\t\t\t\tinitParam={props.initParam}\n\t\t\t\t\t\tsingle\n\t\t\t\t\t\trowClickSelection\n\t\t\t\t\t\thideSearchTime\n\t\t\t\t\t\tonRowDblclick={handleTableRowDblclick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tdefault: () => slots.default?.(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t</FaTable>\n\t\t\t\t</FaDialog>\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 选择行数据 */\n\t\t\tselectionRow: computed(() => state.selectionRow),\n\t\t\t/** 打开选择器弹窗 */\n\t\t\topen: handleSearchClick,\n\t\t\t/** 清除选择 */\n\t\t\tclear: handleDeleteClick,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,yBAAyB;;CAErC,QAAQ;EACP,MAAM,CAAC,QAAQ,QAAQ;EACvB,SAAS;CACV;;CAEA,YAAY,CAAC,QAAQ,MAAM;;CAE3B,OAAO;;CAEP,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,UAAU;;CAEV,OAAO;;CAEP,YAAY,EACX,MAAM,eAA6E,QAAQ,EAC5F;;CAEA,WAAW,eAA6C;EAAC;EAAQ;EAAQ;CAAM,CAAC;;CAEhF,UAAU;EACT,MAAM;EACN,SAAS;CACV;AACD;;AAGA,MAA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