fast-element-plus 1.0.11 → 1.0.14
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/dist/index.full.js +4036 -3991
- package/dist/index.full.js.map +1 -1
- package/dist/index.full.min.js +1 -1
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +1 -1
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +4036 -3991
- package/dist/index.full.mjs.map +1 -1
- package/dist/styles/index.css +6 -6
- package/es/component.mjs +1 -1
- package/es/component.mjs.map +1 -1
- package/es/components/avatar/src/avatar.d.ts +37 -9
- package/es/components/button/index.d.ts +1 -1
- package/es/components/button/index.mjs +1 -1
- package/es/components/button/index.mjs.map +1 -1
- package/es/components/button/src/button.d.ts +1 -1
- package/es/components/carNumber/index.d.ts +1 -1
- package/es/components/carNumber/index.mjs +1 -1
- package/es/components/carNumber/index.mjs.map +1 -1
- package/es/components/carNumber/src/carNumber.mjs +1 -1
- package/es/components/carNumber/src/carNumber.mjs.map +1 -1
- package/es/components/dialog/src/dialog.d.ts +3 -3
- package/es/components/form/src/form.d.ts +3 -3
- package/es/components/form/src/formItem.d.ts +7 -7
- package/es/components/icon/src/icon.d.ts +3 -3
- package/es/components/image/src/image.d.ts +2 -2
- package/es/components/inputDialogPage/src/inputDialogPage.d.ts +7 -6
- package/es/components/inputDialogPage/src/inputDialogPage.mjs +1 -1
- package/es/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/es/components/layoutGrid/src/layoutGrid.d.ts +2 -2
- package/es/components/layoutGrid/src/layoutGridItem.d.ts +4 -4
- package/es/components/select/src/select.d.ts +5 -5
- package/es/components/select/src/select.mjs +1 -1
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/selectPage/src/selectPage.d.ts +4 -4
- package/es/components/selectPage/src/selectPage.mjs +1 -1
- package/es/components/selectPage/src/selectPage.mjs.map +1 -1
- package/es/components/selectV2/src/selectV2.d.ts +9 -9
- package/es/components/selectV2/src/selectV2.mjs +1 -1
- package/es/components/selectV2/src/selectV2.mjs.map +1 -1
- package/es/components/table/src/table.d.ts +32 -25
- package/es/components/table/src/table.mjs +1 -1
- package/es/components/table/src/table.mjs.map +1 -1
- package/es/components/table/src/tableColumn.d.ts +8 -8
- package/es/components/table/src/tableSearchFormItem.mjs +1 -1
- package/es/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/es/components/table/src/useTable.d.ts +1 -1
- package/es/components/table/src/useTable.mjs +1 -1
- package/es/components/table/src/useTable.mjs.map +1 -1
- package/es/components/tree/src/tree.d.ts +9 -9
- package/es/components/tree/src/tree.mjs +1 -1
- package/es/components/tree/src/tree.mjs.map +1 -1
- package/es/components/treeSelect/src/treeSelect.d.ts +7 -7
- package/es/components/treeSelect/src/treeSelect.mjs +1 -1
- package/es/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/es/components/upload/src/upload.d.ts +8 -4
- package/es/components/upload/src/useUpload.d.ts +4 -4
- package/es/components/uploadImage/src/uploadImage.d.ts +17 -13
- package/es/components/uploadImages/src/uploadImages.d.ts +11 -7
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/component.js +1 -1
- package/lib/component.js.map +1 -1
- package/lib/components/avatar/src/avatar.d.ts +37 -9
- package/lib/components/button/index.d.ts +1 -1
- package/lib/components/button/index.js +1 -1
- package/lib/components/button/index.js.map +1 -1
- package/lib/components/button/src/button.d.ts +1 -1
- package/lib/components/carNumber/index.d.ts +1 -1
- package/lib/components/carNumber/index.js +1 -1
- package/lib/components/carNumber/index.js.map +1 -1
- package/lib/components/carNumber/src/carNumber.js +1 -1
- package/lib/components/carNumber/src/carNumber.js.map +1 -1
- package/lib/components/dialog/src/dialog.d.ts +3 -3
- package/lib/components/form/src/form.d.ts +3 -3
- package/lib/components/form/src/formItem.d.ts +7 -7
- package/lib/components/icon/src/icon.d.ts +3 -3
- package/lib/components/image/src/image.d.ts +2 -2
- package/lib/components/inputDialogPage/src/inputDialogPage.d.ts +7 -6
- package/lib/components/inputDialogPage/src/inputDialogPage.js +1 -1
- package/lib/components/inputDialogPage/src/inputDialogPage.js.map +1 -1
- package/lib/components/layoutGrid/src/layoutGrid.d.ts +2 -2
- package/lib/components/layoutGrid/src/layoutGridItem.d.ts +4 -4
- package/lib/components/select/src/select.d.ts +5 -5
- package/lib/components/select/src/select.js +1 -1
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/selectPage/src/selectPage.d.ts +4 -4
- package/lib/components/selectPage/src/selectPage.js +1 -1
- package/lib/components/selectPage/src/selectPage.js.map +1 -1
- package/lib/components/selectV2/src/selectV2.d.ts +9 -9
- package/lib/components/selectV2/src/selectV2.js +1 -1
- package/lib/components/selectV2/src/selectV2.js.map +1 -1
- package/lib/components/table/src/table.d.ts +32 -25
- package/lib/components/table/src/table.js +1 -1
- package/lib/components/table/src/table.js.map +1 -1
- package/lib/components/table/src/tableColumn.d.ts +8 -8
- package/lib/components/table/src/tableSearchFormItem.js +1 -1
- package/lib/components/table/src/tableSearchFormItem.js.map +1 -1
- package/lib/components/table/src/useTable.d.ts +1 -1
- package/lib/components/table/src/useTable.js +1 -1
- package/lib/components/table/src/useTable.js.map +1 -1
- package/lib/components/tree/src/tree.d.ts +9 -9
- package/lib/components/tree/src/tree.js +1 -1
- package/lib/components/tree/src/tree.js.map +1 -1
- package/lib/components/treeSelect/src/treeSelect.d.ts +7 -7
- package/lib/components/treeSelect/src/treeSelect.js +1 -1
- package/lib/components/treeSelect/src/treeSelect.js.map +1 -1
- package/lib/components/upload/src/upload.d.ts +8 -4
- package/lib/components/upload/src/useUpload.d.ts +4 -4
- package/lib/components/uploadImage/src/uploadImage.d.ts +17 -13
- package/lib/components/uploadImages/src/uploadImages.d.ts +11 -7
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/styles/components/table.scss +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectV2.js","sources":["../../../../../packages/components/selectV2/src/selectV2.tsx"],"sourcesContent":["import { computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { ElSelectV2, tagProps, useAriaProps, useEmptyValuesProps, useGlobalSize, useSizeProp, useTooltipContentProps } from \"element-plus\";\nimport { CircleClose } from \"@element-plus/icons-vue\";\nimport { addUnit, consoleError, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"@fast-china/utils\";\nimport { useVModel } from \"@vueuse/core\";\nimport { isArray, isBoolean, isEqual, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport type { ElSelectorOutput } from \"@fast-element-plus/components/select/src/select.type\";\nimport type { PagedInput, PagedResult } from \"@fast-element-plus/components/table\";\nimport type { Options, Placement, PopperEffect } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\ntype Props = {\n\tlabel?: string;\n\tvalue?: string;\n\tdisabled?: string;\n\toptions?: string;\n};\n\nexport const SelectV2Props = {\n\t/**\n\t * @description whether creating new items is allowed. To use this, `filterable` must be true\n\t */\n\tallowCreate: Boolean,\n\t/**\n\t * @description autocomplete of select input\n\t */\n\tautocomplete: {\n\t\ttype: definePropType<\"none\" | \"both\" | \"list\" | \"inline\">(String),\n\t\tdefault: \"none\",\n\t},\n\t/**\n\t * @description for non-filterable Select, this prop decides if the option menu pops up when the input is focused\n\t */\n\tautomaticDropdown: Boolean,\n\t/**\n\t * @description whether select can be cleared\n\t */\n\tclearable: Boolean,\n\t/**\n\t * @description custom clear icon\n\t */\n\tclearIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: CircleClose,\n\t},\n\t/**\n\t * @description tooltip theme, built-in theme: `dark` / `light`\n\t */\n\teffect: {\n\t\ttype: definePropType<PopperEffect | string>(String),\n\t\tdefault: \"light\",\n\t},\n\t/**\n\t * @description whether to collapse tags to a text when multiple selecting\n\t */\n\tcollapseTags: Boolean,\n\t/**\n\t * @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true\n\t */\n\tcollapseTagsTooltip: Boolean,\n\t/**\n\t * @description The max tags number to be shown. To use this, `collapse-tags` must be true\n\t */\n\tmaxCollapseTags: {\n\t\ttype: Number,\n\t\tdefault: 1,\n\t},\n\t/**\n\t * @description\n\t */\n\tdefaultFirstOption: Boolean,\n\t/**\n\t * @description is disabled\n\t */\n\tdisabled: Boolean,\n\t/**\n\t * @description\n\t */\n\testimatedOptionHeight: {\n\t\ttype: Number,\n\t\tdefault: undefined,\n\t},\n\t/**\n\t * @description is filterable\n\t */\n\tfilterable: Boolean,\n\t/**\n\t * @description\n\t */\n\tfilterMethod: Function,\n\t/**\n\t * @description The height of the dropdown panel, 34px for each item\n\t */\n\theight: {\n\t\ttype: Number,\n\t\tdefault: 274, // same as select dropdown menu\n\t},\n\t/**\n\t * @description The height of the dropdown item\n\t */\n\titemHeight: {\n\t\ttype: Number,\n\t\tdefault: 34,\n\t},\n\t/**\n\t * @description\n\t */\n\tid: String,\n\t/**\n\t * @description whether Select is loading data from server\n\t */\n\tloading: Boolean,\n\t/**\n\t * @description displayed text while loading data from server, default is 'Loading'\n\t */\n\tloadingText: String,\n\t/**\n\t * @description biding value\n\t */\n\tmodelValue: {\n\t\ttype: definePropType<any[] | string | number | boolean | Record<string, any> | any>([Array, String, Number, Boolean, Object]),\n\t},\n\t/**\n\t * @description is multiple\n\t */\n\tmultiple: Boolean,\n\t/**\n\t * @description maximum number of options user can select when multiple is true. No limit when set to 0\n\t */\n\tmultipleLimit: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * @description the name attribute of select input\n\t */\n\tname: String,\n\t/**\n\t * @description displayed text when there is no options, you can also use slot empty, the default is 'No Data'\n\t */\n\tnoDataText: String,\n\t/**\n\t * @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data'\n\t */\n\tnoMatchText: String,\n\t/**\n\t * @description function that gets called when the input value changes. Its parameter is the current input value. To use this, `filterable` must be true\n\t */\n\tremoteMethod: Function,\n\t/**\n\t * @description whether reserve the keyword after select filtered option.\n\t */\n\treserveKeyword: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description data of the options, the key of `value` and `label` can be customize by `props`\n\t */\n\toptions: {\n\t\ttype: definePropType<\n\t\t\t(\n\t\t\t\t| Record<string, any>\n\t\t\t\t| (Record<string, any> & {\n\t\t\t\t\t\tcreated?: boolean;\n\t\t\t\t })\n\t\t\t)[]\n\t\t>(Array),\n\t\t// required: true,\n\t},\n\t/**\n\t * @description placeholder, the default is 'Please select'\n\t */\n\tplaceholder: {\n\t\ttype: String,\n\t},\n\t/**\n\t * @description whether select dropdown is teleported to the body\n\t */\n\tteleported: useTooltipContentProps.teleported,\n\t/**\n\t * @description when select dropdown is inactive and `persistent` is `false`, select dropdown will be destroyed\n\t */\n\tpersistent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description custom class name for Select's dropdown\n\t */\n\tpopperClass: {\n\t\ttype: String,\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * @description [popper.js](https://popper.js.org/docs/v2/) parameters\n\t */\n\tpopperOptions: {\n\t\ttype: definePropType<Partial<Options>>(Object),\n\t\tdefault: (): Partial<Options> => ({}),\n\t},\n\t/**\n\t * @description whether search data from server\n\t */\n\tremote: Boolean,\n\t/**\n\t * @description size of component\n\t */\n\tsize: useSizeProp,\n\t/**\n\t * @description configuration options, see the following table\n\t */\n\tprops: {\n\t\ttype: definePropType<Props>(Object),\n\t\tdefault: (): Required<Props> => ({\n\t\t\tlabel: \"label\",\n\t\t\tvalue: \"value\",\n\t\t\tdisabled: \"disabled\",\n\t\t\toptions: \"options\",\n\t\t}),\n\t},\n\t/**\n\t * @description unique identity key name for value, required when value is an object\n\t */\n\tvalueKey: {\n\t\ttype: String,\n\t\tdefault: \"value\",\n\t},\n\t/**\n\t * @description Controls whether the scrollbar is always displayed\n\t */\n\tscrollbarAlwaysOn: Boolean,\n\t/**\n\t * @description whether to trigger form validation\n\t */\n\tvalidateEvent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description offset of the dropdown\n\t */\n\toffset: {\n\t\ttype: Number,\n\t\tdefault: 12,\n\t},\n\t/**\n\t * @description Determines whether the arrow is displayed\n\t */\n\tshowArrow: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description position of dropdown\n\t */\n\tplacement: {\n\t\ttype: definePropType<Placement>(String),\n\t\tdefault: \"bottom-start\",\n\t},\n\t/**\n\t * @description list of possible positions for dropdown\n\t */\n\tfallbackPlacements: {\n\t\ttype: definePropType<Placement[]>(Array),\n\t\tdefault: [\"bottom-start\", \"top-start\", \"right\", \"left\"],\n\t},\n\t/**\n\t * @description tag type\n\t */\n\ttagType: { ...tagProps.type, default: \"info\" },\n\t/**\n\t * @description tag effect\n\t */\n\ttagEffect: { ...tagProps.effect, default: \"light\" },\n\t/**\n\t * @description tabindex for input\n\t */\n\ttabindex: {\n\t\ttype: [String, Number],\n\t\tdefault: 0,\n\t},\n\t/**\n\t * @description which element the select dropdown appends to\n\t */\n\tappendTo: String,\n\t...useEmptyValuesProps,\n\t...useAriaProps([\"ariaLabel\"]),\n};\n\nexport const selectV2Emits = {\n\t\"update:modelValue\": (value: string | number | boolean | object | (string | number | boolean | object)[]): boolean => true,\n\tchange: (val: string | number | boolean | object | (string | number | boolean | object)[]): boolean => true,\n\t\"remove-tag\": (val: unknown): boolean => true,\n\t\"visible-change\": (visible: boolean): boolean => true,\n\tfocus: (evt: FocusEvent): boolean => true,\n\tblur: (evt: FocusEvent): boolean => true,\n\tclear: (): boolean => true,\n};\n\nexport const faSelectV2Props = {\n\t...SelectV2Props,\n\t/** @description whether Select is disabled 重载使其支持 ElForm*/\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: undefined,\n\t},\n\t/** @description displayed text while loading data from server, default is 'Loading' */\n\tloadingText: {\n\t\ttype: String,\n\t\tdefault: \"加载中...\",\n\t},\n\t/** @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data' */\n\tnoMatchText: {\n\t\ttype: String,\n\t\tdefault: \"暂无匹配的数据\",\n\t},\n\t/** @description displayed text when there is no options, you can also use slot `empty`, default is 'No data' */\n\tnoDataText: {\n\t\ttype: String,\n\t\tdefault: \"暂无数据\",\n\t},\n\t/** @description whether to collapse tags to a text when multiple selecting */\n\tcollapseTags: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true */\n\tcollapseTagsTooltip: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: {\n\t\ttype: definePropType<string | number | boolean | object | (string | number | boolean | object)[]>([String, Number, Boolean, Object, Array]),\n\t\tdefault: undefined,\n\t},\n\t/** @description v-model:label绑定值 */\n\tlabel: definePropType<string | string[]>([String, Array]),\n\t/** @description 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"100%\",\n\t},\n\t/** @description 更多细节,只有使用slot的时候有用 */\n\tmoreDetail: Boolean,\n\t/** @description 懒加载远程数据,默认 true。当下拉框第一次显示的时候才会加载远程数据*/\n\tlazy: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 默认选中。不能和懒加载一起使用 */\n\tdefaultSelected: Boolean,\n\t/** @description 下拉框数据 */\n\tdata: {\n\t\ttype: definePropType<ElSelectorOutput[]>(Array),\n\t\tdefault: (): ElSelectorOutput[] => [],\n\t},\n\t/** 分页返回 */\n\tpageResult: Boolean,\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<((params?: any) => Promise<ElSelectorOutput[]>) | ((params?: PagedInput) => Promise<PagedResult<ElSelectorOutput>>)>(\n\t\t\tFunction\n\t\t),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n};\n\nexport const faSelectV2Emits = {\n\t...selectV2Emits,\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | number | boolean | object | (string | number | boolean | object)[]): boolean =>\n\t\tisString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string | string[]): boolean => isString(value) || isArray(value) || isNull(value),\n\t/** @description 数据改变 */\n\tdataChangeCallBack: (data: ElSelectorOutput[] | any[]): boolean => isArray(data),\n\t/** @description 改变 */\n\tchange: (\n\t\tdata: ElSelectorOutput | ElSelectorOutput[] | any | any[],\n\t\tvalue?: string | number | boolean | object | (string | number | boolean | object)[]\n\t): boolean => true,\n};\n\ntype FaSelectV2Slots = {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: { item: ElSelectorOutput; index: number; disabled: boolean };\n\t/** @description 下拉列表顶部的内容 */\n\theader: never;\n\t/** @description 下拉列表底部的内容 */\n\tfooter: never;\n\t/** @description Select 组件头部内容 */\n\tprefix: never;\n\t/** @description 无选项时的列表 */\n\tempty: never;\n\t/** @description select 组件自定义标签内容 */\n\ttag: never;\n\t/** @description select 组件自定义 loading内容 */\n\tloading: never;\n\t/** @description select 组件自定义标签内容 */\n\tlabel: { label: string; value: string | number | boolean | object };\n};\n\nexport default defineComponent({\n\tname: \"FaSelectV2\",\n\tprops: faSelectV2Props,\n\temits: faSelectV2Emits,\n\tslots: makeSlots<FaSelectV2Slots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst selectedLabel = useVModel(props, \"label\", emit);\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<string | number | boolean | object | (string | number | boolean | object)[]>(),\n\t\t\tloading: false,\n\t\t\tselectorData: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 首次出现 */\n\t\t\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: props.data?.length > 0 ? false : true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\n\t\t});\n\n\t\tconst selectV2Ref = ref<InstanceType<typeof ElSelectV2>>();\n\n\t\tconst loadData = async (): Promise<void> => {\n\t\t\t// 判断是否需要自动请求\n\t\t\tif (props.requestApi) {\n\t\t\t\tstate.loading = true;\n\t\t\t\tconst params = props.initParam ?? {};\n\t\t\t\ttry {\n\t\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\t\t// 这里不允许回显了\n\t\t\t\t\tstate.echo = false;\n\t\t\t\t\t// 判断是否为分页返回\n\t\t\t\t\tif (props.pageResult) {\n\t\t\t\t\t\tstate.selectorData = (resData as PagedResult<ElSelectorOutput>).rows;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate.selectorData = resData as ElSelectorOutput[];\n\t\t\t\t\t}\n\t\t\t\t\temit(\"dataChangeCallBack\", state.selectorData);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsoleError(\"FaSelect\", error);\n\t\t\t\t\tstate.selectorData = [];\n\t\t\t\t} finally {\n\t\t\t\t\tstate.loading = false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// 这里不允许回显了\n\t\t\t\tstate.echo = false;\n\t\t\t\tstate.selectorData = props.data;\n\t\t\t}\n\t\t};\n\n\t\tconst handleChange = (value?: string | number | boolean | object | (string | number | boolean | object)[]): void => {\n\t\t\t// 判断是否为多选\n\t\t\tif (props.multiple) {\n\t\t\t\t// value 必然是数组\n\t\t\t\tconst valueArr = value as (string | number | boolean | object)[];\n\t\t\t\tif (valueArr?.length === 0) {\n\t\t\t\t\tstate.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\temit(\"update:modelValue\", null);\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst dataList = state.selectorData.filter((f) => valueArr.includes(f.value));\n\t\t\t\tstate.value = value;\n\t\t\t\tselectedLabel.value = dataList.map((m) => m.label);\n\t\t\t\temit(\"update:modelValue\", value);\n\t\t\t\temit(\"change\", dataList, value);\n\t\t\t} else {\n\t\t\t\t// value 必然不是数组\n\t\t\t\tif (isNil(value)) {\n\t\t\t\t\tstate.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\temit(\"update:modelValue\", null);\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst data = state.selectorData.find((f) => f.value === value);\n\t\t\t\tstate.value = value;\n\t\t\t\tselectedLabel.value = data.label;\n\t\t\t\temit(\"update:modelValue\", value);\n\t\t\t\temit(\"change\", data, value);\n\t\t\t}\n\t\t};\n\n\t\tconst handleClear = (): void => {\n\t\t\tstate.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\temit(\"update:modelValue\", null);\n\t\t\temit(\"clear\");\n\t\t};\n\n\t\tconst handleVisibleChange = async (visible: boolean): Promise<void> => {\n\t\t\tif (visible) {\n\t\t\t\tif (state.debut) {\n\t\t\t\t\t// 首次出现\n\t\t\t\t\tstate.debut = false;\n\t\t\t\t\t// 懒加载\n\t\t\t\t\t!props.defaultSelected && props.lazy && (await loadData());\n\t\t\t\t} else {\n\t\t\t\t\t// 判断再次出现是否需要刷新数据\n\t\t\t\t\tif (state.nextRefresh) {\n\t\t\t\t\t\tstate.nextRefresh = false;\n\t\t\t\t\t\tawait loadData();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\temit(\"visible-change\", visible);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tif (state.echo && !isNil(newValue)) {\n\t\t\t\t\tconst hasLabel = !isNil(props.label);\n\t\t\t\t\t// 判断是否为多选\n\t\t\t\t\tif (props.multiple) {\n\t\t\t\t\t\t// 判断是否为数组\n\t\t\t\t\t\tif (!isArray(newValue)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当启用 multiple 时,传入的 modelValue 必须是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && !isArray(props.label)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当启用 multiple 时,传入的 modelValue:label 必须是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.selectorData = newValue\n\t\t\t\t\t\t\t// 最大选项截取\n\t\t\t\t\t\t\t.slice(0, props.multipleLimit > 0 ? props.multipleLimit : newValue.length)\n\t\t\t\t\t\t\t.map((item, index) => ({\n\t\t\t\t\t\t\t\tvalue: item,\n\t\t\t\t\t\t\t\tlabel: hasLabel ? props.label[index] : undefined,\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (isArray(newValue)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当禁用 multiple 时,传入的 modelValue 不能是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && isArray(props.label)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当禁用 multiple 时,传入的 modelValue:label 不能是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.selectorData = [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\t\tlabel: props.label,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstate.value = newValue;\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tonMounted(async () => {\n\t\t\tif (props.defaultSelected) {\n\t\t\t\tawait loadData();\n\t\t\t\tif (state.selectorData.length > 0) {\n\t\t\t\t\thandleChange(props.multiple ? [state.selectorData[0].value] : state.selectorData[0].value);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 判断是否为本地数据\n\t\t\telse if (!props.requestApi && props.data?.length > 0) {\n\t\t\t\tstate.debut = false;\n\t\t\t\tawait loadData();\n\t\t\t}\n\t\t\t// 判断是否非默认选中,且未启用懒加载\n\t\t\telse if (!props.lazy) {\n\t\t\t\tawait loadData();\n\t\t\t}\n\t\t\twatch(\n\t\t\t\t() => props.initParam,\n\t\t\t\t(newValue, oldValue) => {\n\t\t\t\t\tif (!isEqual(newValue, oldValue)) {\n\t\t\t\t\t\tstate.nextRefresh = true;\n\t\t\t\t\t\tif (!isNil(state.value)) {\n\t\t\t\t\t\t\thandleChange();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\twatch(\n\t\t\t\t() => props.data,\n\t\t\t\tasync () => {\n\t\t\t\t\tif (!props.requestApi) {\n\t\t\t\t\t\tawait loadData();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ deep: true }\n\t\t\t);\n\t\t});\n\n\t\tconst elSelectV2Props = useProps(props, SelectV2Props, [\"modelValue\", \"popperClass\", \"loading\", \"options\", \"itemHeight\"]);\n\t\tconst elSelectV2Emits = useEmits(faSelectV2Emits, emit, [\"update:modelValue\", \"change\", \"clear\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => {\n\t\t\tlet localClass = `fa-select-v2-dropdown ${props.popperClass}`;\n\t\t\tif (props.moreDetail) {\n\t\t\t\tlocalClass += ` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${_globalSize.value}`;\n\t\t\t}\n\t\t\treturn localClass;\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<ElSelectV2\n\t\t\t\t{...elSelectV2Props.value}\n\t\t\t\t{...elSelectV2Emits.value}\n\t\t\t\tref={selectV2Ref}\n\t\t\t\tclass=\"fa-select-v2\"\n\t\t\t\tpopperClass={elPopperClass.value}\n\t\t\t\tstyle={{ width: addUnit(props.width) }}\n\t\t\t\tvModel={state.value}\n\t\t\t\tloading={state.loading}\n\t\t\t\toptions={state.selectorData}\n\t\t\t\titemHeight={props.itemHeight + (_globalSize.value === \"small\" ? 0 : 8)}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tonClear={handleClear}\n\t\t\t\tonVisibleChange={handleVisibleChange}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\t...(slots.default && {\n\t\t\t\t\t\tdefault: ({ item, index, disabled }: { item: ElSelectorOutput; index: number; disabled: boolean }): VNode[] =>\n\t\t\t\t\t\t\tslots.default({ item, index, disabled }),\n\t\t\t\t\t}),\n\t\t\t\t\t...(slots.header && { header: (): VNode[] => slots.header() }),\n\t\t\t\t\t...(slots.footer && { footer: (): VNode[] => slots.footer() }),\n\t\t\t\t\t...(slots.prefix && { prefix: (): VNode[] => slots.prefix() }),\n\t\t\t\t\t...(slots.empty && { empty: (): VNode[] => slots.empty() }),\n\t\t\t\t\t...(slots.tag && { tag: (): VNode[] => slots.tag() }),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading() }),\n\t\t\t\t\t...(slots.label && {\n\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] =>\n\t\t\t\t\t\t\tslots.label({ label, value }),\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElSelectV2>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectV2Ref.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectV2Ref.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectV2Ref.value?.selectedLabel),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 刷新 */\n\t\t\trefresh: loadData,\n\t\t\t/** @description 设置选择 */\n\t\t\tsetSelection: (value: string | number | boolean | object | (string | number | boolean | object)[]) => handleChange(value),\n\t\t\t/** @description 清除选择 */\n\t\t\tclearSelection: () => handleChange(null),\n\t\t});\n\t},\n});\n"],"names":["SelectV2Props","allowCreate","Boolean","autocomplete","type","definePropType","String","default","automaticDropdown","clearable","clearIcon","Object","Function","CircleClose","effect","collapseTags","collapseTagsTooltip","maxCollapseTags","Number","defaultFirstOption","disabled","estimatedOptionHeight","undefined","filterable","filterMethod","height","itemHeight","id","loading","loadingText","modelValue","Array","multiple","multipleLimit","name","noDataText","noMatchText","remoteMethod","reserveKeyword","options","placeholder","teleported","useTooltipContentProps","persistent","popperClass","popperOptions","remote","size","useSizeProp","props","label","value","valueKey","scrollbarAlwaysOn","validateEvent","offset","showArrow","placement","fallbackPlacements","tagType","tagProps","tagEffect","tabindex","appendTo","useEmptyValuesProps","useAriaProps","selectV2Emits","change","val","visible","focus","evt","blur","clear","faSelectV2Props","width","moreDetail","lazy","defaultSelected","data","pageResult","requestApi","initParam","faSelectV2Emits","isString","isNumber","isBoolean","isObject","isArray","isNull","dataChangeCallBack","SelectV2","emits","slots","makeSlots","setup","attrs","emit","expose","selectedLabel","useVModel","_globalSize","useGlobalSize","state","reactive","withDefineType","selectorData","debut","echo","length","nextRefresh","selectV2Ref","ref","loadData","async","params","resData","rows","error","consoleError","handleChange","valueArr","dataList","filter","includes","f","map","m","isNil","find","handleClear","handleVisibleChange","watch","newValue","hasLabel","slice","item","index","immediate","onMounted","oldValue","isEqual","deep","elSelectV2Props","useProps","elSelectV2Emits","useEmits","elPopperClass","computed","localClass","useRender","_createVNode","ElSelectV2","_mergeProps","class","style","addUnit","$event","onChange","onClear","onVisibleChange","header","footer","prefix","empty","tag","useExpose","refresh","setSelection","clearSelection"],"mappings":"uRAkBaA,EAAgB,CAI5BC,YAAaC,QAIbC,aAAc,CACbC,KAAMC,EAAAA,eAAoDC,QAC1DC,QAAS,QAKVC,kBAAmBN,QAInBO,UAAWP,QAIXQ,UAAW,CACVN,KAAMC,EAAAA,eAAmC,CAACC,OAAQK,OAAQC,WAC1DL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D,eAEjDvE,QAASwH,EAAAA,SAAS,IAAM7C,EAAM3E,SAE9B2I,QAAStD,EAETuD,aAAerH,GAAuFqE,EAAarE,GAEnHsH,eAAgBA,IAAMjD,EAAa,OAErC"}
|
|
1
|
+
{"version":3,"file":"selectV2.js","sources":["../../../../../packages/components/selectV2/src/selectV2.tsx"],"sourcesContent":["import { computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { ElSelectV2, tagProps, useAriaProps, useEmptyValuesProps, useGlobalSize, useSizeProp, useTooltipContentProps } from \"element-plus\";\nimport { CircleClose } from \"@element-plus/icons-vue\";\nimport { addUnit, consoleError, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"@fast-china/utils\";\nimport { useVModel } from \"@vueuse/core\";\nimport { isArray, isBoolean, isEqual, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport type { ElSelectorOutput } from \"@fast-element-plus/components/select/src/select.type\";\nimport type { PagedInput, PagedResult } from \"@fast-element-plus/components/table\";\nimport type { Options, Placement, PopperEffect } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\ntype Props = {\n\tlabel?: string;\n\tvalue?: string;\n\tdisabled?: string;\n\toptions?: string;\n};\n\nexport const SelectV2Props = {\n\t/**\n\t * @description whether creating new items is allowed. To use this, `filterable` must be true\n\t */\n\tallowCreate: Boolean,\n\t/**\n\t * @description autocomplete of select input\n\t */\n\tautocomplete: {\n\t\ttype: definePropType<\"none\" | \"both\" | \"list\" | \"inline\">(String),\n\t\tdefault: \"none\",\n\t},\n\t/**\n\t * @description for non-filterable Select, this prop decides if the option menu pops up when the input is focused\n\t */\n\tautomaticDropdown: Boolean,\n\t/**\n\t * @description whether select can be cleared\n\t */\n\tclearable: Boolean,\n\t/**\n\t * @description custom clear icon\n\t */\n\tclearIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: CircleClose,\n\t},\n\t/**\n\t * @description tooltip theme, built-in theme: `dark` / `light`\n\t */\n\teffect: {\n\t\ttype: definePropType<PopperEffect | string>(String),\n\t\tdefault: \"light\",\n\t},\n\t/**\n\t * @description whether to collapse tags to a text when multiple selecting\n\t */\n\tcollapseTags: Boolean,\n\t/**\n\t * @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true\n\t */\n\tcollapseTagsTooltip: Boolean,\n\t/**\n\t * @description The max tags number to be shown. To use this, `collapse-tags` must be true\n\t */\n\tmaxCollapseTags: {\n\t\ttype: Number,\n\t\tdefault: 1,\n\t},\n\t/**\n\t * @description\n\t */\n\tdefaultFirstOption: Boolean,\n\t/**\n\t * @description is disabled\n\t */\n\tdisabled: Boolean,\n\t/**\n\t * @description\n\t */\n\testimatedOptionHeight: {\n\t\ttype: Number,\n\t\tdefault: undefined,\n\t},\n\t/**\n\t * @description is filterable\n\t */\n\tfilterable: Boolean,\n\t/**\n\t * @description\n\t */\n\tfilterMethod: Function,\n\t/**\n\t * @description The height of the dropdown panel, 34px for each item\n\t */\n\theight: {\n\t\ttype: Number,\n\t\tdefault: 274, // same as select dropdown menu\n\t},\n\t/**\n\t * @description The height of the dropdown item\n\t */\n\titemHeight: {\n\t\ttype: Number,\n\t\tdefault: 34,\n\t},\n\t/**\n\t * @description\n\t */\n\tid: String,\n\t/**\n\t * @description whether Select is loading data from server\n\t */\n\tloading: Boolean,\n\t/**\n\t * @description displayed text while loading data from server, default is 'Loading'\n\t */\n\tloadingText: String,\n\t/**\n\t * @description biding value\n\t */\n\tmodelValue: {\n\t\ttype: definePropType<any[] | string | number | boolean | Record<string, any> | any>([Array, String, Number, Boolean, Object]),\n\t},\n\t/**\n\t * @description is multiple\n\t */\n\tmultiple: Boolean,\n\t/**\n\t * @description maximum number of options user can select when multiple is true. No limit when set to 0\n\t */\n\tmultipleLimit: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * @description the name attribute of select input\n\t */\n\tname: String,\n\t/**\n\t * @description displayed text when there is no options, you can also use slot empty, the default is 'No Data'\n\t */\n\tnoDataText: String,\n\t/**\n\t * @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data'\n\t */\n\tnoMatchText: String,\n\t/**\n\t * @description function that gets called when the input value changes. Its parameter is the current input value. To use this, `filterable` must be true\n\t */\n\tremoteMethod: Function,\n\t/**\n\t * @description whether reserve the keyword after select filtered option.\n\t */\n\treserveKeyword: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description data of the options, the key of `value` and `label` can be customize by `props`\n\t */\n\toptions: {\n\t\ttype: definePropType<\n\t\t\t(\n\t\t\t\t| Record<string, any>\n\t\t\t\t| (Record<string, any> & {\n\t\t\t\t\t\tcreated?: boolean;\n\t\t\t\t })\n\t\t\t)[]\n\t\t>(Array),\n\t\t// required: true,\n\t},\n\t/**\n\t * @description placeholder, the default is 'Please select'\n\t */\n\tplaceholder: {\n\t\ttype: String,\n\t},\n\t/**\n\t * @description whether select dropdown is teleported to the body\n\t */\n\tteleported: useTooltipContentProps.teleported,\n\t/**\n\t * @description when select dropdown is inactive and `persistent` is `false`, select dropdown will be destroyed\n\t */\n\tpersistent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description custom class name for Select's dropdown\n\t */\n\tpopperClass: {\n\t\ttype: String,\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * @description [popper.js](https://popper.js.org/docs/v2/) parameters\n\t */\n\tpopperOptions: {\n\t\ttype: definePropType<Partial<Options>>(Object),\n\t\tdefault: (): Partial<Options> => ({}),\n\t},\n\t/**\n\t * @description whether search data from server\n\t */\n\tremote: Boolean,\n\t/**\n\t * @description size of component\n\t */\n\tsize: useSizeProp,\n\t/**\n\t * @description configuration options, see the following table\n\t */\n\tprops: {\n\t\ttype: definePropType<Props>(Object),\n\t\tdefault: (): Required<Props> => ({\n\t\t\tlabel: \"label\",\n\t\t\tvalue: \"value\",\n\t\t\tdisabled: \"disabled\",\n\t\t\toptions: \"options\",\n\t\t}),\n\t},\n\t/**\n\t * @description unique identity key name for value, required when value is an object\n\t */\n\tvalueKey: {\n\t\ttype: String,\n\t\tdefault: \"value\",\n\t},\n\t/**\n\t * @description Controls whether the scrollbar is always displayed\n\t */\n\tscrollbarAlwaysOn: Boolean,\n\t/**\n\t * @description whether to trigger form validation\n\t */\n\tvalidateEvent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description offset of the dropdown\n\t */\n\toffset: {\n\t\ttype: Number,\n\t\tdefault: 12,\n\t},\n\t/**\n\t * @description Determines whether the arrow is displayed\n\t */\n\tshowArrow: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description position of dropdown\n\t */\n\tplacement: {\n\t\ttype: definePropType<Placement>(String),\n\t\tdefault: \"bottom-start\",\n\t},\n\t/**\n\t * @description list of possible positions for dropdown\n\t */\n\tfallbackPlacements: {\n\t\ttype: definePropType<Placement[]>(Array),\n\t\tdefault: [\"bottom-start\", \"top-start\", \"right\", \"left\"],\n\t},\n\t/**\n\t * @description tag type\n\t */\n\ttagType: { ...tagProps.type, default: \"info\" },\n\t/**\n\t * @description tag effect\n\t */\n\ttagEffect: { ...tagProps.effect, default: \"light\" },\n\t/**\n\t * @description tabindex for input\n\t */\n\ttabindex: {\n\t\ttype: [String, Number],\n\t\tdefault: 0,\n\t},\n\t/**\n\t * @description which element the select dropdown appends to\n\t */\n\tappendTo: String,\n\t...useEmptyValuesProps,\n\t...useAriaProps([\"ariaLabel\"]),\n};\n\nexport const selectV2Emits = {\n\t\"update:modelValue\": (value: string | number | boolean | object | (string | number | boolean | object)[]): boolean => true,\n\tchange: (val: string | number | boolean | object | (string | number | boolean | object)[]): boolean => true,\n\t\"remove-tag\": (val: unknown): boolean => true,\n\t\"visible-change\": (visible: boolean): boolean => true,\n\tfocus: (evt: FocusEvent): boolean => true,\n\tblur: (evt: FocusEvent): boolean => true,\n\tclear: (): boolean => true,\n};\n\nexport const faSelectV2Props = {\n\t...SelectV2Props,\n\t/** @description whether Select is disabled 重载使其支持 ElForm*/\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: undefined,\n\t},\n\t/** @description displayed text while loading data from server, default is 'Loading' */\n\tloadingText: {\n\t\ttype: String,\n\t\tdefault: \"加载中...\",\n\t},\n\t/** @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data' */\n\tnoMatchText: {\n\t\ttype: String,\n\t\tdefault: \"暂无匹配的数据\",\n\t},\n\t/** @description displayed text when there is no options, you can also use slot `empty`, default is 'No data' */\n\tnoDataText: {\n\t\ttype: String,\n\t\tdefault: \"暂无数据\",\n\t},\n\t/** @description whether to collapse tags to a text when multiple selecting */\n\tcollapseTags: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true */\n\tcollapseTagsTooltip: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: {\n\t\ttype: definePropType<string | number | boolean | object | (string | number | boolean | object)[]>([String, Number, Boolean, Object, Array]),\n\t\tdefault: undefined,\n\t},\n\t/** @description v-model:label绑定值 */\n\tlabel: definePropType<string | string[]>([String, Array]),\n\t/** @description 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"100%\",\n\t},\n\t/** @description 更多细节,只有使用slot的时候有用 */\n\tmoreDetail: Boolean,\n\t/** @description 懒加载远程数据,默认 true。当下拉框第一次显示的时候才会加载远程数据*/\n\tlazy: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 默认选中。不能和懒加载一起使用 */\n\tdefaultSelected: Boolean,\n\t/** @description 下拉框数据 */\n\tdata: {\n\t\ttype: definePropType<ElSelectorOutput[]>(Array),\n\t\tdefault: (): ElSelectorOutput[] => [],\n\t},\n\t/** 分页返回 */\n\tpageResult: Boolean,\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<((params?: any) => Promise<ElSelectorOutput[]>) | ((params?: PagedInput) => Promise<PagedResult<ElSelectorOutput>>)>(\n\t\t\tFunction\n\t\t),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n};\n\nexport const faSelectV2Emits = {\n\t...selectV2Emits,\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | number | boolean | object | (string | number | boolean | object)[]): boolean =>\n\t\tisString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string | string[]): boolean => isString(value) || isArray(value) || isNull(value),\n\t/** @description 数据改变 */\n\tdataChangeCallBack: (data: ElSelectorOutput[] | any[]): boolean => isArray(data),\n\t/** @description 改变 */\n\tchange: (\n\t\tdata: ElSelectorOutput | ElSelectorOutput[] | any | any[],\n\t\tvalue?: string | number | boolean | object | (string | number | boolean | object)[]\n\t): boolean => true,\n};\n\ntype FaSelectV2Slots = {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: { item: ElSelectorOutput; index: number; disabled: boolean };\n\t/** @description 下拉列表顶部的内容 */\n\theader: never;\n\t/** @description 下拉列表底部的内容 */\n\tfooter: never;\n\t/** @description Select 组件头部内容 */\n\tprefix: never;\n\t/** @description 无选项时的列表 */\n\tempty: never;\n\t/** @description select 组件自定义标签内容 */\n\ttag: never;\n\t/** @description select 组件自定义 loading内容 */\n\tloading: never;\n\t/** @description select 组件自定义标签内容 */\n\tlabel: { label: string; value: string | number | boolean | object };\n};\n\nexport default defineComponent({\n\tname: \"FaSelectV2\",\n\tprops: faSelectV2Props,\n\temits: faSelectV2Emits,\n\tslots: makeSlots<FaSelectV2Slots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst selectedLabel = useVModel(props, \"label\", emit, { passive: true });\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<string | number | boolean | object | (string | number | boolean | object)[]>(),\n\t\t\tloading: false,\n\t\t\tselectorData: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 首次出现 */\n\t\t\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: props.data?.length > 0 ? false : true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\n\t\t});\n\n\t\tconst selectV2Ref = ref<InstanceType<typeof ElSelectV2>>();\n\n\t\tconst loadData = async (): Promise<void> => {\n\t\t\t// 判断是否需要自动请求\n\t\t\tif (props.requestApi) {\n\t\t\t\tstate.loading = true;\n\t\t\t\tconst params = props.initParam ?? {};\n\t\t\t\ttry {\n\t\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\t\t// 这里不允许回显了\n\t\t\t\t\tstate.echo = false;\n\t\t\t\t\t// 判断是否为分页返回\n\t\t\t\t\tif (props.pageResult) {\n\t\t\t\t\t\tstate.selectorData = (resData as PagedResult<ElSelectorOutput>).rows;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate.selectorData = resData as ElSelectorOutput[];\n\t\t\t\t\t}\n\t\t\t\t\temit(\"dataChangeCallBack\", state.selectorData);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsoleError(\"FaSelect\", error);\n\t\t\t\t\tstate.selectorData = [];\n\t\t\t\t} finally {\n\t\t\t\t\tstate.loading = false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// 这里不允许回显了\n\t\t\t\tstate.echo = false;\n\t\t\t\tstate.selectorData = props.data;\n\t\t\t}\n\t\t};\n\n\t\tconst handleChange = (value?: string | number | boolean | object | (string | number | boolean | object)[]): void => {\n\t\t\t// 判断是否为多选\n\t\t\tif (props.multiple) {\n\t\t\t\t// value 必然是数组\n\t\t\t\tconst valueArr = value as (string | number | boolean | object)[];\n\t\t\t\tif (valueArr?.length === 0) {\n\t\t\t\t\tstate.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\temit(\"update:modelValue\", null);\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst dataList = state.selectorData.filter((f) => valueArr.includes(f.value));\n\t\t\t\tstate.value = value;\n\t\t\t\tselectedLabel.value = dataList.map((m) => m.label);\n\t\t\t\temit(\"update:modelValue\", value);\n\t\t\t\temit(\"change\", dataList, value);\n\t\t\t} else {\n\t\t\t\t// value 必然不是数组\n\t\t\t\tif (isNil(value)) {\n\t\t\t\t\tstate.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\temit(\"update:modelValue\", null);\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst data = state.selectorData.find((f) => f.value === value);\n\t\t\t\tstate.value = value;\n\t\t\t\tselectedLabel.value = data.label;\n\t\t\t\temit(\"update:modelValue\", value);\n\t\t\t\temit(\"change\", data, value);\n\t\t\t}\n\t\t};\n\n\t\tconst handleClear = (): void => {\n\t\t\tstate.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\temit(\"update:modelValue\", null);\n\t\t\temit(\"clear\");\n\t\t};\n\n\t\tconst handleVisibleChange = async (visible: boolean): Promise<void> => {\n\t\t\tif (visible) {\n\t\t\t\tif (state.debut) {\n\t\t\t\t\t// 首次出现\n\t\t\t\t\tstate.debut = false;\n\t\t\t\t\t// 懒加载\n\t\t\t\t\t!props.defaultSelected && props.lazy && (await loadData());\n\t\t\t\t} else {\n\t\t\t\t\t// 判断再次出现是否需要刷新数据\n\t\t\t\t\tif (state.nextRefresh) {\n\t\t\t\t\t\tstate.nextRefresh = false;\n\t\t\t\t\t\tawait loadData();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\temit(\"visible-change\", visible);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tif (state.echo && !isNil(newValue)) {\n\t\t\t\t\tconst hasLabel = !isNil(props.label);\n\t\t\t\t\t// 判断是否为多选\n\t\t\t\t\tif (props.multiple) {\n\t\t\t\t\t\t// 判断是否为数组\n\t\t\t\t\t\tif (!isArray(newValue)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当启用 multiple 时,传入的 modelValue 必须是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && !isArray(props.label)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当启用 multiple 时,传入的 modelValue:label 必须是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.selectorData = newValue\n\t\t\t\t\t\t\t// 最大选项截取\n\t\t\t\t\t\t\t.slice(0, props.multipleLimit > 0 ? props.multipleLimit : newValue.length)\n\t\t\t\t\t\t\t.map((item, index) => ({\n\t\t\t\t\t\t\t\tvalue: item,\n\t\t\t\t\t\t\t\tlabel: hasLabel ? props.label[index] : undefined,\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (isArray(newValue)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当禁用 multiple 时,传入的 modelValue 不能是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && isArray(props.label)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectV2\", \"当禁用 multiple 时,传入的 modelValue:label 不能是Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.selectorData = [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\t\tlabel: props.label,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstate.value = newValue;\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tonMounted(async () => {\n\t\t\tif (props.defaultSelected) {\n\t\t\t\tawait loadData();\n\t\t\t\tif (state.selectorData.length > 0) {\n\t\t\t\t\thandleChange(props.multiple ? [state.selectorData[0].value] : state.selectorData[0].value);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 判断是否为本地数据\n\t\t\telse if (!props.requestApi && props.data?.length > 0) {\n\t\t\t\tstate.debut = false;\n\t\t\t\tawait loadData();\n\t\t\t}\n\t\t\t// 判断是否非默认选中,且未启用懒加载\n\t\t\telse if (!props.lazy) {\n\t\t\t\tawait loadData();\n\t\t\t}\n\t\t\twatch(\n\t\t\t\t() => props.initParam,\n\t\t\t\t(newValue, oldValue) => {\n\t\t\t\t\tif (!isEqual(newValue, oldValue)) {\n\t\t\t\t\t\tstate.nextRefresh = true;\n\t\t\t\t\t\tif (!isNil(state.value)) {\n\t\t\t\t\t\t\thandleChange();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\twatch(\n\t\t\t\t() => props.data,\n\t\t\t\tasync () => {\n\t\t\t\t\tif (!props.requestApi) {\n\t\t\t\t\t\tawait loadData();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ deep: true }\n\t\t\t);\n\t\t});\n\n\t\tconst elSelectV2Props = useProps(props, SelectV2Props, [\"modelValue\", \"popperClass\", \"loading\", \"options\", \"itemHeight\"]);\n\t\tconst elSelectV2Emits = useEmits(faSelectV2Emits, emit, [\"update:modelValue\", \"change\", \"clear\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => {\n\t\t\tlet localClass = `fa-select-v2-dropdown ${props.popperClass}`;\n\t\t\tif (props.moreDetail) {\n\t\t\t\tlocalClass += ` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${_globalSize.value}`;\n\t\t\t}\n\t\t\treturn localClass;\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<ElSelectV2\n\t\t\t\t{...elSelectV2Props.value}\n\t\t\t\t{...elSelectV2Emits.value}\n\t\t\t\tref={selectV2Ref}\n\t\t\t\tclass=\"fa-select-v2\"\n\t\t\t\tpopperClass={elPopperClass.value}\n\t\t\t\tstyle={{ width: addUnit(props.width) }}\n\t\t\t\tvModel={state.value}\n\t\t\t\tloading={state.loading}\n\t\t\t\toptions={state.selectorData}\n\t\t\t\titemHeight={props.itemHeight + (_globalSize.value === \"small\" ? 0 : 8)}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tonClear={handleClear}\n\t\t\t\tonVisibleChange={handleVisibleChange}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\t...(slots.default && {\n\t\t\t\t\t\tdefault: ({ item, index, disabled }: { item: ElSelectorOutput; index: number; disabled: boolean }): VNode[] =>\n\t\t\t\t\t\t\tslots.default({ item, index, disabled }),\n\t\t\t\t\t}),\n\t\t\t\t\t...(slots.header && { header: (): VNode[] => slots.header() }),\n\t\t\t\t\t...(slots.footer && { footer: (): VNode[] => slots.footer() }),\n\t\t\t\t\t...(slots.prefix && { prefix: (): VNode[] => slots.prefix() }),\n\t\t\t\t\t...(slots.empty && { empty: (): VNode[] => slots.empty() }),\n\t\t\t\t\t...(slots.tag && { tag: (): VNode[] => slots.tag() }),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading() }),\n\t\t\t\t\t...(slots.label && {\n\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] =>\n\t\t\t\t\t\t\tslots.label({ label, value }),\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElSelectV2>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectV2Ref.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectV2Ref.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectV2Ref.value?.selectedLabel),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 刷新 */\n\t\t\trefresh: loadData,\n\t\t\t/** @description 设置选择 */\n\t\t\tsetSelection: (value: string | number | boolean | object | (string | number | boolean | object)[]) => handleChange(value),\n\t\t\t/** @description 清除选择 */\n\t\t\tclearSelection: () => handleChange(null),\n\t\t});\n\t},\n});\n"],"names":["SelectV2Props","allowCreate","Boolean","autocomplete","type","definePropType","String","default","automaticDropdown","clearable","clearIcon","Object","Function","CircleClose","effect","collapseTags","collapseTagsTooltip","maxCollapseTags","Number","defaultFirstOption","disabled","estimatedOptionHeight","undefined","filterable","filterMethod","height","itemHeight","id","loading","loadingText","modelValue","Array","multiple","multipleLimit","name","noDataText","noMatchText","remoteMethod","reserveKeyword","options","placeholder","teleported","useTooltipContentProps","persistent","popperClass","popperOptions","remote","size","useSizeProp","props","label","value","valueKey","scrollbarAlwaysOn","validateEvent","offset","showArrow","placement","fallbackPlacements","tagType","tagProps","tagEffect","tabindex","appendTo","useEmptyValuesProps","useAriaProps","selectV2Emits","change","val","visible","focus","evt","blur","clear","faSelectV2Props","width","moreDetail","lazy","defaultSelected","data","pageResult","requestApi","initParam","faSelectV2Emits","isString","isNumber","isBoolean","isObject","isArray","isNull","dataChangeCallBack","SelectV2","emits","slots","makeSlots","setup","attrs","emit","expose","selectedLabel","useVModel","passive","_globalSize","useGlobalSize","state","reactive","withDefineType","selectorData","debut","echo","length","nextRefresh","selectV2Ref","ref","loadData","async","params","resData","rows","error","consoleError","handleChange","valueArr","dataList","filter","includes","f","map","m","isNil","find","handleClear","handleVisibleChange","watch","newValue","hasLabel","slice","item","index","immediate","onMounted","oldValue","isEqual","deep","elSelectV2Props","useProps","elSelectV2Emits","useEmits","elPopperClass","computed","localClass","useRender","_createVNode","ElSelectV2","_mergeProps","class","style","addUnit","$event","onChange","onClear","onVisibleChange","header","footer","prefix","empty","tag","useExpose","refresh","setSelection","clearSelection"],"mappings":"uRAkBaA,EAAgB,CAI5BC,YAAaC,QAIbC,aAAc,CAC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,CAExB5B,MAAO+E,EAAAA,SAAS,IAAMrC,EAAY7D,OAAOmB,OAEzCE,KAAM6E,EAAAA,SAAS,IAAMrC,EAAY7D,OAAOqB,MAExC2B,cAAekD,EAAAA,SAAS,IAAMrC,EAAY7D,OAAOgD,eAEjDvE,QAASyH,EAAAA,SAAS,IAAM7C,EAAM5E,SAE9B4I,QAAStD,EAETuD,aAAetH,GAAuFsE,EAAatE,GAEnHuH,eAAgBA,IAAMjD,EAAa,OAErC"}
|
|
@@ -27,15 +27,15 @@ export declare const tableProps: {
|
|
|
27
27
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
28
28
|
__epPropKey: true;
|
|
29
29
|
};
|
|
30
|
-
width: (
|
|
30
|
+
width: (StringConstructor | NumberConstructor)[];
|
|
31
31
|
/**
|
|
32
32
|
* @description table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles
|
|
33
33
|
*/
|
|
34
|
-
height: (
|
|
34
|
+
height: (StringConstructor | NumberConstructor)[];
|
|
35
35
|
/**
|
|
36
36
|
* @description table's max-height. The legal value is a number or the height in px
|
|
37
37
|
*/
|
|
38
|
-
maxHeight: (
|
|
38
|
+
maxHeight: (StringConstructor | NumberConstructor)[];
|
|
39
39
|
/**
|
|
40
40
|
* @description whether width of column automatically fits its container
|
|
41
41
|
*/
|
|
@@ -113,7 +113,7 @@ export declare const tableProps: {
|
|
|
113
113
|
/**
|
|
114
114
|
* @description key of current row, a set only prop
|
|
115
115
|
*/
|
|
116
|
-
currentRowKey: (
|
|
116
|
+
currentRowKey: (StringConstructor | NumberConstructor)[];
|
|
117
117
|
/**
|
|
118
118
|
* @description displayed text when data is empty. You can customize this area with `#empty`
|
|
119
119
|
*/
|
|
@@ -199,7 +199,7 @@ export declare const tableProps: {
|
|
|
199
199
|
*/
|
|
200
200
|
showOverflowTooltip: PropType<TableProps<DefaultRow>["showOverflowTooltip"]>;
|
|
201
201
|
scrollbarTabindex: {
|
|
202
|
-
type: (
|
|
202
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
203
203
|
default: any;
|
|
204
204
|
};
|
|
205
205
|
};
|
|
@@ -300,6 +300,8 @@ export declare const faTableProps: {
|
|
|
300
300
|
};
|
|
301
301
|
/** @description 隐藏搜索时间 */
|
|
302
302
|
hideSearchTime: BooleanConstructor;
|
|
303
|
+
/** @description 未来搜索时间 */
|
|
304
|
+
futureSearchTime: BooleanConstructor;
|
|
303
305
|
/** @description 搜索时间范围 */
|
|
304
306
|
dataSearchRange: {
|
|
305
307
|
type: PropType<FaTableDataRange>;
|
|
@@ -348,15 +350,15 @@ export declare const faTableProps: {
|
|
|
348
350
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
349
351
|
__epPropKey: true;
|
|
350
352
|
};
|
|
351
|
-
width: (
|
|
353
|
+
width: (StringConstructor | NumberConstructor)[];
|
|
352
354
|
/**
|
|
353
355
|
* @description table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles
|
|
354
356
|
*/
|
|
355
|
-
height: (
|
|
357
|
+
height: (StringConstructor | NumberConstructor)[];
|
|
356
358
|
/**
|
|
357
359
|
* @description table's max-height. The legal value is a number or the height in px
|
|
358
360
|
*/
|
|
359
|
-
maxHeight: (
|
|
361
|
+
maxHeight: (StringConstructor | NumberConstructor)[];
|
|
360
362
|
/**
|
|
361
363
|
* @description whether width of column automatically fits its container
|
|
362
364
|
*/
|
|
@@ -422,7 +424,7 @@ export declare const faTableProps: {
|
|
|
422
424
|
/**
|
|
423
425
|
* @description key of current row, a set only prop
|
|
424
426
|
*/
|
|
425
|
-
currentRowKey: (
|
|
427
|
+
currentRowKey: (StringConstructor | NumberConstructor)[];
|
|
426
428
|
/**
|
|
427
429
|
* @description displayed text when data is empty. You can customize this area with `#empty`
|
|
428
430
|
*/
|
|
@@ -504,7 +506,7 @@ export declare const faTableProps: {
|
|
|
504
506
|
*/
|
|
505
507
|
showOverflowTooltip: PropType<TableProps<DefaultRow>["showOverflowTooltip"]>;
|
|
506
508
|
scrollbarTabindex: {
|
|
507
|
-
type: (
|
|
509
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
508
510
|
default: any;
|
|
509
511
|
};
|
|
510
512
|
};
|
|
@@ -706,6 +708,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
706
708
|
};
|
|
707
709
|
/** @description 隐藏搜索时间 */
|
|
708
710
|
hideSearchTime: BooleanConstructor;
|
|
711
|
+
/** @description 未来搜索时间 */
|
|
712
|
+
futureSearchTime: BooleanConstructor;
|
|
709
713
|
/** @description 搜索时间范围 */
|
|
710
714
|
dataSearchRange: {
|
|
711
715
|
type: PropType<FaTableDataRange>;
|
|
@@ -754,15 +758,15 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
754
758
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
755
759
|
__epPropKey: true;
|
|
756
760
|
};
|
|
757
|
-
width: (
|
|
761
|
+
width: (StringConstructor | NumberConstructor)[];
|
|
758
762
|
/**
|
|
759
763
|
* @description table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles
|
|
760
764
|
*/
|
|
761
|
-
height: (
|
|
765
|
+
height: (StringConstructor | NumberConstructor)[];
|
|
762
766
|
/**
|
|
763
767
|
* @description table's max-height. The legal value is a number or the height in px
|
|
764
768
|
*/
|
|
765
|
-
maxHeight: (
|
|
769
|
+
maxHeight: (StringConstructor | NumberConstructor)[];
|
|
766
770
|
/**
|
|
767
771
|
* @description whether width of column automatically fits its container
|
|
768
772
|
*/
|
|
@@ -828,7 +832,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
828
832
|
/**
|
|
829
833
|
* @description key of current row, a set only prop
|
|
830
834
|
*/
|
|
831
|
-
currentRowKey: (
|
|
835
|
+
currentRowKey: (StringConstructor | NumberConstructor)[];
|
|
832
836
|
/**
|
|
833
837
|
* @description displayed text when data is empty. You can customize this area with `#empty`
|
|
834
838
|
*/
|
|
@@ -910,7 +914,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
910
914
|
*/
|
|
911
915
|
showOverflowTooltip: PropType<TableProps<DefaultRow>["showOverflowTooltip"]>;
|
|
912
916
|
scrollbarTabindex: {
|
|
913
|
-
type: (
|
|
917
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
914
918
|
default: any;
|
|
915
919
|
};
|
|
916
920
|
}>, {
|
|
@@ -1130,6 +1134,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1130
1134
|
};
|
|
1131
1135
|
/** @description 隐藏搜索时间 */
|
|
1132
1136
|
hideSearchTime: BooleanConstructor;
|
|
1137
|
+
/** @description 未来搜索时间 */
|
|
1138
|
+
futureSearchTime: BooleanConstructor;
|
|
1133
1139
|
/** @description 搜索时间范围 */
|
|
1134
1140
|
dataSearchRange: {
|
|
1135
1141
|
type: PropType<FaTableDataRange>;
|
|
@@ -1178,15 +1184,15 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1178
1184
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
1179
1185
|
__epPropKey: true;
|
|
1180
1186
|
};
|
|
1181
|
-
width: (
|
|
1187
|
+
width: (StringConstructor | NumberConstructor)[];
|
|
1182
1188
|
/**
|
|
1183
1189
|
* @description table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles
|
|
1184
1190
|
*/
|
|
1185
|
-
height: (
|
|
1191
|
+
height: (StringConstructor | NumberConstructor)[];
|
|
1186
1192
|
/**
|
|
1187
1193
|
* @description table's max-height. The legal value is a number or the height in px
|
|
1188
1194
|
*/
|
|
1189
|
-
maxHeight: (
|
|
1195
|
+
maxHeight: (StringConstructor | NumberConstructor)[];
|
|
1190
1196
|
/**
|
|
1191
1197
|
* @description whether width of column automatically fits its container
|
|
1192
1198
|
*/
|
|
@@ -1252,7 +1258,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1252
1258
|
/**
|
|
1253
1259
|
* @description key of current row, a set only prop
|
|
1254
1260
|
*/
|
|
1255
|
-
currentRowKey: (
|
|
1261
|
+
currentRowKey: (StringConstructor | NumberConstructor)[];
|
|
1256
1262
|
/**
|
|
1257
1263
|
* @description displayed text when data is empty. You can customize this area with `#empty`
|
|
1258
1264
|
*/
|
|
@@ -1334,7 +1340,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1334
1340
|
*/
|
|
1335
1341
|
showOverflowTooltip: PropType<TableProps<DefaultRow>["showOverflowTooltip"]>;
|
|
1336
1342
|
scrollbarTabindex: {
|
|
1337
|
-
type: (
|
|
1343
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
1338
1344
|
default: any;
|
|
1339
1345
|
};
|
|
1340
1346
|
}>> & Readonly<{
|
|
@@ -1380,6 +1386,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1380
1386
|
lazy: boolean;
|
|
1381
1387
|
className: string;
|
|
1382
1388
|
columns: false | FaTableColumnCtx[];
|
|
1389
|
+
scrollbarAlwaysOn: boolean;
|
|
1390
|
+
defaultExpandAll: boolean;
|
|
1391
|
+
indent: number;
|
|
1392
|
+
treeData: boolean;
|
|
1393
|
+
pagination: boolean;
|
|
1383
1394
|
rowKey: string | ((row: any) => string);
|
|
1384
1395
|
border: boolean;
|
|
1385
1396
|
highlightCurrentRow: boolean;
|
|
@@ -1394,22 +1405,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1394
1405
|
columnSettingBtn: boolean;
|
|
1395
1406
|
toolBtn: boolean;
|
|
1396
1407
|
hideSearchTime: boolean;
|
|
1408
|
+
futureSearchTime: boolean;
|
|
1397
1409
|
dataSearchRange: FaTableDataRange;
|
|
1398
|
-
pagination: boolean;
|
|
1399
1410
|
hideImage: boolean;
|
|
1400
1411
|
single: boolean;
|
|
1401
1412
|
rowClickSelection: boolean;
|
|
1402
|
-
treeData: boolean;
|
|
1403
1413
|
autoRefresh: boolean;
|
|
1404
1414
|
stripe: boolean;
|
|
1405
1415
|
showHeader: boolean;
|
|
1406
1416
|
showSummary: boolean;
|
|
1407
|
-
defaultExpandAll: boolean;
|
|
1408
1417
|
selectOnIndeterminate: boolean;
|
|
1409
|
-
indent: number;
|
|
1410
1418
|
treeProps: TreeProps;
|
|
1411
1419
|
tableLayout: Layout;
|
|
1412
|
-
scrollbarAlwaysOn: boolean;
|
|
1413
1420
|
flexible: boolean;
|
|
1414
1421
|
scrollbarTabindex: string | number;
|
|
1415
1422
|
}, import('vue').SlotsType<Partial<import('@fast-china/utils').MakeSlots<FaTableSlots>>>, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("element-plus"),a=require("@element-plus/icons-vue"),l=require("@fast-element-plus/icons-vue"),o=require("@fast-china/utils"),n=require("lodash-unified"),i=require("./table.type.js"),r=require("./tableColumn.js"),c=require("./tableColumnSettingDialog.js"),s=require("./tablePagination.js"),d=require("./tableSearchForm.js"),u=require("./useTable.js");const m={data:{type:Array,default:()=>[]},size:t.useSizeProp,width:[String,Number],height:[String,Number],maxHeight:[String,Number],fit:{type:Boolean,default:!0},stripe:Boolean,border:Boolean,rowKey:[String,Function],showHeader:{type:Boolean,default:!0},showSummary:Boolean,sumText:String,summaryMethod:Function,rowClassName:[String,Function],rowStyle:[Object,Function],cellClassName:[String,Function],cellStyle:[Object,Function],headerRowClassName:[String,Function],headerRowStyle:[Object,Function],headerCellClassName:[String,Function],headerCellStyle:[Object,Function],highlightCurrentRow:Boolean,currentRowKey:[String,Number],emptyText:String,expandRowKeys:Array,defaultExpandAll:Boolean,defaultSort:Object,tooltipEffect:String,tooltipOptions:Object,spanMethod:Function,selectOnIndeterminate:{type:Boolean,default:!0},indent:{type:Number,default:16},treeProps:{type:Object,default:()=>({hasChildren:"hasChildren",children:"children",checkStrictly:!1})},lazy:Boolean,load:Function,style:{type:Object,default:()=>({})},className:{type:String,default:""},tableLayout:{type:String,default:"fixed"},scrollbarAlwaysOn:Boolean,flexible:Boolean,showOverflowTooltip:[Boolean,Object],scrollbarTabindex:{type:[Number,String],default:void 0}},p={...m,border:{type:Boolean,default:!0},highlightCurrentRow:{type:Boolean,default:!0},rowKey:{type:[String,Function],default:"id"},spanMethod:{type:Function,validator:()=>(o.consoleWarn("FaTable","'spanMethod' 属性,组件已经封装,外部使用会失效。"),!1)},tableKey:{type:String,default:()=>o.stringUtil.generateRandomString(8)},data:{type:o.definePropType(Array),default:()=>[]},requestApi:{type:o.definePropType(Function)},dataCallback:{type:o.definePropType(Function)},initParam:o.definePropType([String,Number,Object]),columns:{type:o.definePropType([Array,Boolean]),default:()=>!1},columnsChange:{type:o.definePropType(Function)},searchFormCols:{type:o.definePropType([String,Number,Object]),default:()=>({xs:3,sm:3,md:4,lg:5,xl:6})},collapsedSearch:{type:Boolean,default:!0},advancedSearchDrawer:{type:Boolean,default:!1},searchForm:{type:Boolean,default:!0},headerCard:{type:Boolean,default:!0},refreshBtn:{type:Boolean,default:!0},searchBtn:{type:Boolean,default:!0},columnSettingBtn:{type:Boolean,default:!1},toolBtn:{type:Boolean,default:!0},hideSearchTime:Boolean,dataSearchRange:{type:o.definePropType(String),default:"Past3D"},pagination:{type:Boolean,default:!0},hideImage:Boolean,single:Boolean,rowClickSelection:Boolean,treeData:Boolean,props:{type:o.definePropType(Object),default:()=>({span:void 0,children:"children"})},autoRefresh:{type:Boolean,default:!0},rowSelectable:Function},h={select:(e,t)=>n.isArray(e)&&n.isObject(t),selectAll:e=>n.isArray(e),selectionChange:e=>n.isArray(e),cellMouseEnter:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellMouseLeave:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellClick:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellDblclick:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellContextmenu:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,rowClick:(e,t,a)=>n.isObject(e)&&n.isObject(t)&&a instanceof Event,rowContextmenu:(e,t,a)=>n.isObject(e)&&n.isObject(t)&&a instanceof Event,rowDblclick:(e,t,a)=>n.isObject(e)&&n.isObject(t)&&a instanceof Event,headerClick:(e,t)=>n.isObject(e)&&t instanceof Event,headerContextmenu:(e,t)=>n.isObject(e)&&t instanceof Event,sortChange:e=>n.isObject(e),filterChange:e=>n.isString(e)||n.isNumber(e)||n.isBoolean(e)||n.isObject(e),currentChange:(e,t)=>n.isObject(e)&&(n.isNull(t)||n.isObject(t)),headerDragend:(e,t,a,l)=>n.isNumber(e)&&n.isNumber(t)&&n.isObject(a)&&l instanceof MouseEvent,expandChange:(e,t)=>n.isObject(e)&&(n.isBoolean(t)||n.isArray(t)),refresh:e=>n.isObject(e),reset:e=>n.isObject(e),sizeChange:e=>n.isNumber(e),paginationChange:(e,t)=>n.isNumber(e)&&n.isNumber(t),customCellClick:(e,{row:t,column:a,$index:l})=>(n.isNil(e)||n.isString(e))&&n.isObject(t)&&n.isObject(a)&&n.isNumber(l)},g=e.defineComponent({name:"FaTable",props:p,emits:h,slots:o.makeSlots(),setup(p,{attrs:h,slots:g,emit:b,expose:f}){const{_globalSize:C,state:S,elementRef:w,tableRef:y,handleTableColumnAutoWidth:_,loadTableColumns:v,handleSizeChange:N,handlePaginationChange:x,defaultSearchTime:P,tableSearch:O,tableReset:T,doRender:V,doLoading:E,handleCustomCellClick:j}=u.useTable(p,g,b),I=e.ref();let F=0;const B=e=>{if(0===e&&(F=0),S.spanColumns?.length>0){return 0===Number(S.tableSpanData["__table-index"][e])?F+(S.tablePagination.pageIndex-1)*S.tablePagination.pageSize+1:(F++,F+(S.tablePagination.pageIndex-1)*S.tablePagination.pageSize)}return e+(S.tablePagination.pageIndex-1)*S.tablePagination.pageSize+1},L=(e,t)=>{p.single&&(y.value.clearSelection(),e.length>0&&t&&y.value.toggleRowSelection(t)),b("select",e,t)},D=e=>{p.single&&(S.selected?S.tableData.length>0&&(y.value.clearSelection(),y.value.toggleRowSelection(S.tableData[0])):y.value.clearSelection()),b("selectAll",e)},R=e=>{0===e.length?S.selected=!1:S.selected=!0,p.single&&e.length>0?S.selectedList=[e[e.length-1]]:S.selectedList=e,S.indeterminateSelectedListIds=S.indeterminateSelectedListIds.filter(e=>S.selectedListIds.some(t=>t===e)),b("selectionChange",S.selectedList)},k=({column:e,prop:t,order:a})=>{e.multiOrder?"descending"===e.multiOrder?e.multiOrder="ascending":e.multiOrder=null:e.multiOrder="descending",S.searchParam.sortList=[...new Set([...p.initParam?.sortList??[],...S.searchParam?.sortList??[]])];const l=S.orgColumns.find(e=>e.prop===t),o=l?.sortableField??l?.prop??e.property,n=S.searchParam.sortList.findIndex(e=>e.enField===o);e.multiOrder?-1===n?S.searchParam.sortList.push({enField:o,cnField:e.label,mode:e.multiOrder}):S.searchParam.sortList[n].mode=e.multiOrder:S.searchParam.sortList.splice(n,1),0===S.searchParam.sortList.length&&delete S.searchParam.sortList,b("sortChange",{column:e,prop:t,order:e.multiOrder}),O()},M=(e,t)=>{e&&(p.rowClickSelection&&(p.single&&t&&y.value.toggleRowSelection(t),y.value.toggleRowSelection(e)),b("currentChange",e,t))},A=({row:e,column:t,rowIndex:a,columnIndex:l})=>{let o=null;if("selection"===t.type){const t=n.isFunction(p.rowKey)?p.rowKey(e):e[p.rowKey];S.indeterminateSelectedListIds.some(e=>e===t)&&(o="fa-table__selection-column__indeterminate")}const i=S.tableColumns.find(e=>e.prop===t.property);if(i?.dataDeleteField&&e&&!0===e[i.dataDeleteField]&&(o?o+=" fa-table__data-delete-column":o="fa-table__data-delete-column"),p.cellClassName){let i=null;return i=n.isString(p.cellClassName)?p.cellClassName:p.cellClassName({row:e,column:t,rowIndex:a,columnIndex:l}),i?o?`${o} ${i}`:i:o}return o},z=({row:e,column:t,rowIndex:a,columnIndex:l})=>(t.order=t.multiOrder,p.headerCellClassName?n.isFunction(p.headerCellClassName)?p.headerCellClassName({row:e,column:t,rowIndex:a,columnIndex:l}):p.headerCellClassName:null),K=({row:e,column:t,rowIndex:a,columnIndex:l})=>{const o=t.property??t.columnKey;if(-1!==S.spanColumns.findIndex(e=>e.prop===o)){const e=Number(S.tableSpanData[o][a]);return e>0?{rowspan:e,colspan:1}:{rowspan:0,colspan:0}}return{rowspan:1,colspan:1}},H=async(e,t,a,l)=>{S.orgColumns.forEach(t=>{a.property===t.prop&&(t.width=e,t.smallWidth=e)}),b("headerDragend",e,t,a,l),p.columnsChange&&await o.clickUtil.debounceAsync(()=>p.columnsChange(S.orgColumns),500)},q=e=>{S.previewList=[e],S.imagePreview=!0};e.onMounted(async()=>{S.initParam=p.initParam,P(),Object.keys(p.initParam??{}).forEach(e=>{S.searchParam[e]=p.initParam[e]}),await O(),e.watch(()=>p.columns,async()=>{v()},{deep:!0,immediate:!0}),e.watch(()=>p.initParam,()=>{Object.keys(p.initParam??{}).forEach(e=>{S.searchParam[e]=p.initParam[e]})},{deep:!0}),e.watch(()=>p.data,async()=>{!p.requestApi&&p.autoRefresh&&await O()},{deep:!0,immediate:!0}),e.watchEffect(async()=>{const e=w.value;if(e){const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:a}=t.contentRect;S.tableWidth=e,S.tableHeight=a}o.clickUtil.debounceAsync(async()=>{await _()},100)});return t.observe(e),()=>{t.disconnect()}}})}),e.onActivated(async()=>{await _()});const $=e.computed(()=>S.searchColumns.filter(e=>e.search.slot).map(e=>e.search.slot)),U=e.computed(()=>S.tableColumns.filter(e=>e.slot).map(e=>e.slot)),W=["multiOrder","columnId","order","sortableField","disabledSortable","spanProp","pureSearch","search"],Y=o.useProps(p,m,["data","spanMethod","headerCellClassName","cellClassName"]);return o.useRender(()=>e.createVNode("div",{ref:w,class:["fa-table",`fa-table-${C.value}`,`fa-table__${p.tableKey??"notFound"}`,{fa__click__disabled:S.loading}],style:{"--fa-table-width":""+(S.tableWidth?`${S.tableWidth}px`:""),"--fa-table-height":""+(S.tableHeight?`${S.tableHeight}px`:"")}},[e.createVNode(d.default,{show:p.searchForm&&S.searchForm,collapsedSearch:p.collapsedSearch,advancedSearchDrawer:p.advancedSearchDrawer,cols:p.searchFormCols,search:O,reset:T},n.pick(g,$.value)),g.topHeader&&e.createVNode("div",{class:"el-card fa-table__header"},[g.topHeader({search:O,...i.getTableDefaultSlots(S)})]),e.createVNode("div",{class:"el-card fa-table__main"},[p.headerCard&&e.createVNode("div",{class:"fa-table__main-header"},[e.createVNode("div",{class:"fa-table__main-header-left"},[g.header&&g.header({search:O,...i.getTableDefaultSlots(S)})]),e.createVNode("div",{class:"fa-table__main-header-right"},[p.toolBtn&&e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"fa-table__main-header-right__div-search"},[e.createVNode(t.ElInput,{class:"fa-table__main-header-right__input-search",disabled:S.loading,prefixIcon:a.Search,placeholder:"关键字搜索",modelValue:S.searchParam.searchValue,modelModifiers:{trim:!0},"onUpdate:modelValue":e=>S.searchParam.searchValue=e,clearable:!0,onCompositionupdate:e=>{S.searchValueUpdate=e.data},onCompositionend:e=>{S.searchValueUpdate=""},onChange:()=>O()},null),e.createVNode("div",{class:"fa-table__main-header-right__div-search__hidden"},[S.searchParam.searchValue,S.searchValueUpdate])]),p.requestApi&&!p.hideSearchTime&&e.createVNode(t.ElDatePicker,{class:"fa-table__main-header-right__data-search",popperClass:"fa-table__main-header-right__data-search__popper",disabled:S.loading,type:"daterange",modelValue:S.searchParam.searchTimeList,"onUpdate:modelValue":e=>S.searchParam.searchTimeList=e,defaultTime:o.dateUtil.getDefaultTime(),shortcuts:o.dateUtil.getShortcuts(),valueFormat:"YYYY-MM-DD HH:mm:ss",clearable:!1,teleported:!1,unlinkPanels:!0,onChange:()=>O()},null),p.refreshBtn&&e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,title:"刷新",circle:!0,icon:a.Refresh,onClick:()=>O()},null),p.searchBtn&&S.searchColumns.length>0&&e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,title:S.searchForm?"隐藏搜索栏":"显示搜索栏",circle:!0,icon:a.Search,onClick:()=>S.searchForm=!S.searchForm},null),p.columnSettingBtn&&p.columns&&e.createVNode(t.ElDropdown,{title:"表格列配置",trigger:"click"},{default:()=>e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,circle:!0,icon:a.Setting},null),dropdown:()=>e.createVNode(t.ElDropdownMenu,null,{default:()=>[g.columnSetting&&g.columnSetting(),e.createVNode(t.ElDropdownItem,{title:"表格列配置",divided:!0,onClick:()=>I.value.open()},{default:()=>[e.createTextVNode("表格列配置")]})]})}),g.toolButton&&g.toolButton({search:O,...i.getTableDefaultSlots(S)}),g.toolButtonAdv&&e.createVNode(t.ElDropdown,{title:"高级操作",trigger:"click"},{default:()=>e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,circle:!0,icon:a.More},null),dropdown:()=>{let a;return e.createVNode(t.ElDropdownMenu,null,"function"==typeof(l=a=g.toolButtonAdv({search:O,...i.getTableDefaultSlots(S)}))||"[object Object]"===Object.prototype.toString.call(l)&&!e.isVNode(l)?a:{default:()=>[a]});var l}})])])]),e.withDirectives(e.createVNode(t.ElTable,e.mergeProps(Y.value,{ref:y,"element-loading-text":S.loadingText,data:S.tableData,spanMethod:K,headerCellClassName:z,cellClassName:A,onSelectionChange:R,onSortChange:k,onSelect:L,onSelectAll:D,onCurrentChange:M,onHeaderDragend:H,onCellMouseEnter:(e,t,a,l)=>b("cellMouseEnter",e,t,a,l),onCellMouseLeave:(e,t,a,l)=>b("cellMouseLeave",e,t,a,l),onCellClick:(e,t,a,l)=>b("cellClick",e,t,a,l),onCellDblclick:(e,t,a,l)=>b("cellDblclick",e,t,a,l),onCellContextmenu:(e,t,a,l)=>b("cellContextmenu",e,t,a,l),onRowClick:(e,t,a)=>b("rowClick",e,t,a),onRowContextmenu:(e,t,a)=>b("rowContextmenu",e,t,a),onRowDblclick:(e,t,a)=>b("rowDblclick",e,t,a),onHeaderClick:(e,t)=>b("headerClick",e,t),onHeaderContextmenu:(e,t)=>b("headerContextmenu",e,t),onFilterChange:e=>b("filterChange",e),onExpandChange:(e,t)=>b("expandChange",e,t)}),{append:()=>g.append&&g.append(),empty:()=>e.createVNode("div",{class:"fa-table__empty"},[g.empty?g.empty():e.createVNode(e.Fragment,null,[e.createVNode(t.ElIcon,null,{default:()=>[e.createVNode(l.NotData,null,null)]}),e.createVNode("div",null,[e.createTextVNode("暂无数据")])])]),default:()=>e.createVNode(e.Fragment,null,[e.createVNode(t.ElTableColumn,{className:"fa-table__index-column",type:"index",fixed:"left",width:S.tablePagination.pageIndex*S.tablePagination.pageSize>=100?S.tablePagination.pageIndex*S.tablePagination.pageSize>=1e3?50:40:30,align:"center",index:B,showOverflowTooltip:!1,resizable:!1,columnKey:"__table-index"},null),e.createVNode(t.ElTableColumn,{className:"fa-table__selection-column",type:"selection",fixed:"left",width:35,align:"center",reserveSelection:!0,showOverflowTooltip:!1,resizable:!1,columnKey:"__table-selection",selectable:p.rowSelectable},null),g.operation&&e.createVNode(t.ElTableColumn,{fixed:"right",width:S.operationColumnWidth,headerAlign:"center",align:"left",showOverflowTooltip:!1,className:"fa-table__operation-column",resizable:!1,columnKey:"__table-operation"},{header:()=>e.createVNode("div",{class:"fa-table__auto-width-column__cell-header __fa-table__auto-width-column__cell-header____table-operation"},[e.createVNode("span",null,[e.createTextVNode("操作")])]),default:({row:t,column:a,$index:l})=>e.createVNode("div",{class:"fa-table__auto-width-column__cell __fa-table__auto-width-column__cell____table-operation"},[g.operation({row:t,column:a,$index:l,search:O,...i.getTableDefaultSlots(S)})])}),0===S.tableColumns?.length?g.default&&g.default():S.tableColumns.map(a=>a.show&&("expand"===a.type?e.createVNode(t.ElTableColumn,e.mergeProps(a,{width:35,fixed:a.fixed??"left",resizable:!1}),{default:({row:t,column:l,$index:o})=>e.createVNode(e.Fragment,null,[a.render&&a.render({row:t,column:l,$index:o,...i.getTableDefaultSlots(S)}),a.slot&&g[a.slot]&&g[a.slot]({row:t,column:l,$index:o,...i.getTableDefaultSlots(S)})])}):a.prop&&e.createVNode(r.default,e.mergeProps(n.omit(a,W),{hideImage:p.hideImage,resizable:!0,onImagePreview:q,onCustomCellClick:j}),n.pick(g,U.value))))])}),[[e.resolveDirective("loading"),S.loading]]),e.createVNode("div",{class:"fa-table__main-footer"},[e.createVNode("div",{class:"fa-table__main-footer__left"},[g.footer&&g.footer({search:O,...i.getTableDefaultSlots(S)})]),g.pagination?g.pagination({pageIndex:S.tablePagination.pageIndex,pageSize:S.tablePagination.pageSize,totalRows:S.tablePagination.totalRows,handleSizeChange:N,handlePaginationChange:x}):e.createVNode(e.Fragment,null,[p.pagination?e.createVNode(s.default,{onSizeChange:N,onCurrentChange:x},null):e.createVNode(t.ElPagination,{class:"fa-table-pagination",size:"small",layout:"total",total:S.tableData.length},null)])])]),S.imagePreview&&e.createVNode(t.ElImageViewer,{closeOnPressEscape:!0,hideOnClickModal:!0,teleported:!0,onClose:()=>S.imagePreview=!1,urlList:S.previewList},null),p.columnSettingBtn&&e.createVNode(c.default,{ref:I,change:p.columnsChange},null)])),o.useExpose(f,{clearSelection:e.computed(()=>y.value?.clearSelection),getSelectionRows:e.computed(()=>y.value?.getSelectionRows),toggleRowSelection:e.computed(()=>y.value?.toggleRowSelection),toggleAllSelection:e.computed(()=>y.value?.toggleAllSelection),toggleRowExpansion:e.computed(()=>y.value?.toggleRowExpansion),setCurrentRow:e.computed(()=>y.value?.setCurrentRow),clearSort:e.computed(()=>y.value?.clearSort),clearFilter:e.computed(()=>y.value?.clearFilter),doLayout:e.computed(()=>y.value?.doLayout),sort:e.computed(()=>y.value?.sort),scrollTo:e.computed(()=>y.value?.scrollTo),setScrollTop:e.computed(()=>y.value?.setScrollTop),setScrollLeft:e.computed(()=>y.value?.setScrollLeft),columns:e.computed(()=>y.value?.columns),updateKeyChildren:e.computed(()=>y.value?.updateKeyChildren),loading:e.computed(()=>S.loading),tableData:e.computed(()=>S.tableData),tablePagination:e.computed(()=>S.tablePagination),searchParam:e.computed(()=>S.searchParam),selected:e.computed(()=>S.selected),selectedList:e.computed(()=>S.selectedList),selectedListIds:e.computed(()=>S.selectedListIds),indeterminateSelectedListIds:e.computed(()=>S.indeterminateSelectedListIds),tableWidth:e.computed(()=>S.tableWidth),tableHeight:e.computed(()=>S.tableHeight),toggleRowIndeterminateSelection:(e,t)=>{const a=n.isFunction(p.rowKey)?p.rowKey(e):e[p.rowKey],l=S.tableData.find(e=>n.isFunction(p.rowKey)?p.rowKey(e):e[p.rowKey]===a);if(!0===t)S.indeterminateSelectedListIds.some(e=>e===a)||S.indeterminateSelectedListIds.push(a),y.value.toggleRowSelection(l,!0);else if(!1===t){const e=S.indeterminateSelectedListIds.findIndex(e=>e===a);e>=0&&S.indeterminateSelectedListIds.splice(e,1),y.value.toggleRowSelection(l,!1)}else{const e=S.indeterminateSelectedListIds.findIndex(e=>e===a);e>=0?S.indeterminateSelectedListIds.splice(e,1):S.indeterminateSelectedListIds.push(a),y.value.toggleRowSelection(l)}},refresh:O,reset:T,doRender:V,doLoading:E})}});exports.default=g,exports.faTableEmits=h,exports.faTableProps=p,exports.tableProps=m;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("element-plus"),a=require("@element-plus/icons-vue"),l=require("@fast-element-plus/icons-vue"),o=require("@fast-china/utils"),n=require("lodash-unified"),r=require("./table.type.js"),i=require("./tableColumn.js"),c=require("./tableColumnSettingDialog.js"),s=require("./tablePagination.js"),d=require("./tableSearchForm.js"),u=require("./useTable.js");const m={data:{type:Array,default:()=>[]},size:t.useSizeProp,width:[String,Number],height:[String,Number],maxHeight:[String,Number],fit:{type:Boolean,default:!0},stripe:Boolean,border:Boolean,rowKey:[String,Function],showHeader:{type:Boolean,default:!0},showSummary:Boolean,sumText:String,summaryMethod:Function,rowClassName:[String,Function],rowStyle:[Object,Function],cellClassName:[String,Function],cellStyle:[Object,Function],headerRowClassName:[String,Function],headerRowStyle:[Object,Function],headerCellClassName:[String,Function],headerCellStyle:[Object,Function],highlightCurrentRow:Boolean,currentRowKey:[String,Number],emptyText:String,expandRowKeys:Array,defaultExpandAll:Boolean,defaultSort:Object,tooltipEffect:String,tooltipOptions:Object,spanMethod:Function,selectOnIndeterminate:{type:Boolean,default:!0},indent:{type:Number,default:16},treeProps:{type:Object,default:()=>({hasChildren:"hasChildren",children:"children",checkStrictly:!1})},lazy:Boolean,load:Function,style:{type:Object,default:()=>({})},className:{type:String,default:""},tableLayout:{type:String,default:"fixed"},scrollbarAlwaysOn:Boolean,flexible:Boolean,showOverflowTooltip:[Boolean,Object],scrollbarTabindex:{type:[Number,String],default:void 0}},p={...m,border:{type:Boolean,default:!0},highlightCurrentRow:{type:Boolean,default:!0},rowKey:{type:[String,Function],default:"id"},spanMethod:{type:Function,validator:()=>(o.consoleWarn("FaTable","'spanMethod' 属性,组件已经封装,外部使用会失效。"),!1)},tableKey:{type:String,default:()=>o.stringUtil.generateRandomString(8)},data:{type:o.definePropType(Array),default:()=>[]},requestApi:{type:o.definePropType(Function)},dataCallback:{type:o.definePropType(Function)},initParam:o.definePropType([String,Number,Object]),columns:{type:o.definePropType([Array,Boolean]),default:()=>!1},columnsChange:{type:o.definePropType(Function)},searchFormCols:{type:o.definePropType([String,Number,Object]),default:()=>({xs:3,sm:3,md:4,lg:5,xl:6})},collapsedSearch:{type:Boolean,default:!0},advancedSearchDrawer:{type:Boolean,default:!1},searchForm:{type:Boolean,default:!0},headerCard:{type:Boolean,default:!0},refreshBtn:{type:Boolean,default:!0},searchBtn:{type:Boolean,default:!0},columnSettingBtn:{type:Boolean,default:!1},toolBtn:{type:Boolean,default:!0},hideSearchTime:Boolean,futureSearchTime:Boolean,dataSearchRange:{type:o.definePropType(String),default:"Past3D"},pagination:{type:Boolean,default:!0},hideImage:Boolean,single:Boolean,rowClickSelection:Boolean,treeData:Boolean,props:{type:o.definePropType(Object),default:()=>({span:void 0,children:"children"})},autoRefresh:{type:Boolean,default:!0},rowSelectable:Function},h={select:(e,t)=>n.isArray(e)&&n.isObject(t),selectAll:e=>n.isArray(e),selectionChange:e=>n.isArray(e),cellMouseEnter:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellMouseLeave:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellClick:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellDblclick:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,cellContextmenu:(e,t,a,l)=>n.isObject(e)&&n.isObject(t)&&a instanceof HTMLTableCellElement&&l instanceof Event,rowClick:(e,t,a)=>n.isObject(e)&&n.isObject(t)&&a instanceof Event,rowContextmenu:(e,t,a)=>n.isObject(e)&&n.isObject(t)&&a instanceof Event,rowDblclick:(e,t,a)=>n.isObject(e)&&n.isObject(t)&&a instanceof Event,headerClick:(e,t)=>n.isObject(e)&&t instanceof Event,headerContextmenu:(e,t)=>n.isObject(e)&&t instanceof Event,sortChange:e=>n.isObject(e),filterChange:e=>n.isString(e)||n.isNumber(e)||n.isBoolean(e)||n.isObject(e),currentChange:(e,t)=>n.isObject(e)&&(n.isNull(t)||n.isObject(t)),headerDragend:(e,t,a,l)=>n.isNumber(e)&&n.isNumber(t)&&n.isObject(a)&&l instanceof MouseEvent,expandChange:(e,t)=>n.isObject(e)&&(n.isBoolean(t)||n.isArray(t)),refresh:e=>n.isObject(e),reset:e=>n.isObject(e),sizeChange:e=>n.isNumber(e),paginationChange:(e,t)=>n.isNumber(e)&&n.isNumber(t),customCellClick:(e,{row:t,column:a,$index:l})=>(n.isNil(e)||n.isString(e))&&n.isObject(t)&&n.isObject(a)&&n.isNumber(l)},g=e.defineComponent({name:"FaTable",props:p,emits:h,slots:o.makeSlots(),setup(p,{attrs:h,slots:g,emit:b,expose:f}){const{_globalSize:C,state:S,elementRef:w,tableRef:y,handleTableColumnAutoWidth:_,loadTableColumns:v,handleSizeChange:N,handlePaginationChange:x,defaultSearchTime:P,tableSearch:O,tableReset:T,doRender:V,doLoading:E,handleCustomCellClick:j}=u.useTable(p,g,b),I=e.ref();let B=0;const F=e=>{if(0===e&&(B=0),S.spanColumns?.length>0){return 0===Number(S.tableSpanData["__table-index"][e])?B+(S.tablePagination.pageIndex-1)*S.tablePagination.pageSize+1:(B++,B+(S.tablePagination.pageIndex-1)*S.tablePagination.pageSize)}return e+(S.tablePagination.pageIndex-1)*S.tablePagination.pageSize+1},L=(e,t)=>{p.single&&(y.value.clearSelection(),e.length>0&&t&&y.value.toggleRowSelection(t)),b("select",e,t)},D=e=>{p.single&&(S.selected?S.tableData.length>0&&(y.value.clearSelection(),y.value.toggleRowSelection(S.tableData[0])):y.value.clearSelection()),b("selectAll",e)},R=e=>{0===e.length?S.selected=!1:S.selected=!0,p.single&&e.length>0?S.selectedList=[e[e.length-1]]:S.selectedList=e,S.indeterminateSelectedListIds=S.indeterminateSelectedListIds.filter(e=>S.selectedListIds.some(t=>t===e)),b("selectionChange",S.selectedList)},k=({column:e,prop:t,order:a})=>{e.multiOrder?"descending"===e.multiOrder?e.multiOrder="ascending":e.multiOrder=null:e.multiOrder="descending",S.searchParam.sortList=[...new Set([...p.initParam?.sortList??[],...S.searchParam?.sortList??[]])];const l=S.orgColumns.find(e=>e.prop===t),o=l?.sortableField??l?.prop??e.property,n=S.searchParam.sortList.findIndex(e=>e.enField===o);e.multiOrder?-1===n?S.searchParam.sortList.push({enField:o,cnField:e.label,mode:e.multiOrder}):S.searchParam.sortList[n].mode=e.multiOrder:S.searchParam.sortList.splice(n,1),0===S.searchParam.sortList.length&&delete S.searchParam.sortList,b("sortChange",{column:e,prop:t,order:e.multiOrder}),O()},M=(e,t)=>{e&&(p.rowClickSelection&&(p.single&&t&&y.value.toggleRowSelection(t),y.value.toggleRowSelection(e)),b("currentChange",e,t))},A=({row:e,column:t,rowIndex:a,columnIndex:l})=>{let o=null;if("selection"===t.type){const t=n.isFunction(p.rowKey)?p.rowKey(e):e[p.rowKey];S.indeterminateSelectedListIds.some(e=>e===t)&&(o="fa-table__selection-column__indeterminate")}const r=S.tableColumns.find(e=>e.prop===t.property);if(r?.dataDeleteField&&e&&!0===e[r.dataDeleteField]&&(o?o+=" fa-table__data-delete-column":o="fa-table__data-delete-column"),p.cellClassName){let r=null;return r=n.isString(p.cellClassName)?p.cellClassName:p.cellClassName({row:e,column:t,rowIndex:a,columnIndex:l}),r?o?`${o} ${r}`:r:o}return o},z=({row:e,column:t,rowIndex:a,columnIndex:l})=>(t.order=t.multiOrder,p.headerCellClassName?n.isFunction(p.headerCellClassName)?p.headerCellClassName({row:e,column:t,rowIndex:a,columnIndex:l}):p.headerCellClassName:null),K=({row:e,column:t,rowIndex:a,columnIndex:l})=>{const o=t.property??t.columnKey;if(-1!==S.spanColumns.findIndex(e=>e.prop===o)){const e=Number(S.tableSpanData[o][a]);return e>0?{rowspan:e,colspan:1}:{rowspan:0,colspan:0}}return{rowspan:1,colspan:1}},H=async(e,t,a,l)=>{S.orgColumns.forEach(t=>{a.property===t.prop&&(t.width=e,t.smallWidth=e)}),b("headerDragend",e,t,a,l),p.columnsChange&&await o.clickUtil.debounceAsync(()=>p.columnsChange(S.orgColumns),500)},q=e=>{S.previewList=[e],S.imagePreview=!0};e.onMounted(async()=>{S.initParam=p.initParam,P(),Object.keys(p.initParam??{}).forEach(e=>{S.searchParam[e]=p.initParam[e]}),await O(),e.watch(()=>p.columns,async()=>{v()},{deep:!0,immediate:!0}),e.watch(()=>p.initParam,()=>{Object.keys(p.initParam??{}).forEach(e=>{S.searchParam[e]=p.initParam[e]})},{deep:!0}),e.watch(()=>p.data,async()=>{!p.requestApi&&p.autoRefresh&&await O()},{deep:!0,immediate:!0}),e.watchEffect(async()=>{const e=w.value;if(e){const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:a}=t.contentRect;S.tableWidth=e,S.tableHeight=a}o.clickUtil.debounceAsync(async()=>{await _()},100)});return t.observe(e),()=>{t.disconnect()}}})}),e.onActivated(async()=>{await _()});const $=e.computed(()=>S.searchColumns.filter(e=>e.search.slot).map(e=>e.search.slot)),U=e.computed(()=>S.tableColumns.filter(e=>e.slot).map(e=>e.slot)),W=["multiOrder","columnId","order","sortableField","disabledSortable","spanProp","pureSearch","search"],Y=o.useProps(p,m,["data","spanMethod","headerCellClassName","cellClassName"]);return o.useRender(()=>e.createVNode("div",{ref:w,class:["fa-table",`fa-table-${C.value}`,`fa-table__${p.tableKey??"notFound"}`,{fa__click__disabled:S.loading}],style:{"--fa-table-width":""+(S.tableWidth?`${S.tableWidth}px`:""),"--fa-table-height":""+(S.tableHeight?`${S.tableHeight}px`:"")}},[e.createVNode(d.default,{show:p.searchForm&&S.searchForm,collapsedSearch:p.collapsedSearch,advancedSearchDrawer:p.advancedSearchDrawer,cols:p.searchFormCols,search:O,reset:T},n.pick(g,$.value)),g.topHeader&&e.createVNode("div",{class:"el-card fa-table__header"},[g.topHeader({search:O,...r.getTableDefaultSlots(S)})]),e.createVNode("div",{class:"el-card fa-table__main"},[p.headerCard&&e.createVNode("div",{class:"fa-table__main-header"},[e.createVNode("div",{class:"fa-table__main-header-left"},[g.header&&g.header({search:O,...r.getTableDefaultSlots(S)})]),e.createVNode("div",{class:"fa-table__main-header-right"},[p.toolBtn&&e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"fa-table__main-header-right__div-search"},[e.createVNode(t.ElInput,{class:"fa-table__main-header-right__input-search",disabled:S.loading,prefixIcon:a.Search,placeholder:"关键字搜索",modelValue:S.searchParam.searchValue,modelModifiers:{trim:!0},"onUpdate:modelValue":e=>S.searchParam.searchValue=e,clearable:!0,onCompositionupdate:e=>{S.searchValueUpdate=e.data},onCompositionend:e=>{S.searchValueUpdate=""},onChange:()=>O()},null),e.createVNode("div",{class:"fa-table__main-header-right__div-search__hidden"},[S.searchParam.searchValue,S.searchValueUpdate])]),p.requestApi&&!p.hideSearchTime&&e.createVNode(t.ElDatePicker,{class:"fa-table__main-header-right__data-search",popperClass:"fa-table__main-header-right__data-search__popper",disabled:S.loading,type:"daterange",modelValue:S.searchParam.searchTimeList,"onUpdate:modelValue":e=>S.searchParam.searchTimeList=e,defaultTime:o.dateUtil.getDefaultTime(p.futureSearchTime),shortcuts:o.dateUtil.getShortcuts(p.futureSearchTime),valueFormat:"YYYY-MM-DD HH:mm:ss",clearable:!1,teleported:!1,unlinkPanels:!0,onChange:()=>O()},null),p.refreshBtn&&e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,title:"刷新",circle:!0,icon:a.Refresh,onClick:()=>O()},null),p.searchBtn&&S.searchColumns.length>0&&e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,title:S.searchForm?"隐藏搜索栏":"显示搜索栏",circle:!0,icon:a.Search,onClick:()=>S.searchForm=!S.searchForm},null),p.columnSettingBtn&&p.columns&&e.createVNode(t.ElDropdown,{title:"表格列配置",trigger:"click"},{default:()=>e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,circle:!0,icon:a.Setting},null),dropdown:()=>e.createVNode(t.ElDropdownMenu,null,{default:()=>[g.columnSetting&&g.columnSetting(),e.createVNode(t.ElDropdownItem,{title:"表格列配置",divided:!0,onClick:()=>I.value.open()},{default:()=>[e.createTextVNode("表格列配置")]})]})}),g.toolButton&&g.toolButton({search:O,...r.getTableDefaultSlots(S)}),g.toolButtonAdv&&e.createVNode(t.ElDropdown,{title:"高级操作",trigger:"click"},{default:()=>e.createVNode(t.ElButton,{loading:S.loading,loadingIcon:a.Eleme,circle:!0,icon:a.More},null),dropdown:()=>{let a;return e.createVNode(t.ElDropdownMenu,null,"function"==typeof(l=a=g.toolButtonAdv({search:O,...r.getTableDefaultSlots(S)}))||"[object Object]"===Object.prototype.toString.call(l)&&!e.isVNode(l)?a:{default:()=>[a]});var l}})])])]),e.withDirectives(e.createVNode(t.ElTable,e.mergeProps(Y.value,{ref:y,"element-loading-text":S.loadingText,data:S.tableData,spanMethod:K,headerCellClassName:z,cellClassName:A,onSelectionChange:R,onSortChange:k,onSelect:L,onSelectAll:D,onCurrentChange:M,onHeaderDragend:H,onCellMouseEnter:(e,t,a,l)=>b("cellMouseEnter",e,t,a,l),onCellMouseLeave:(e,t,a,l)=>b("cellMouseLeave",e,t,a,l),onCellClick:(e,t,a,l)=>b("cellClick",e,t,a,l),onCellDblclick:(e,t,a,l)=>b("cellDblclick",e,t,a,l),onCellContextmenu:(e,t,a,l)=>b("cellContextmenu",e,t,a,l),onRowClick:(e,t,a)=>b("rowClick",e,t,a),onRowContextmenu:(e,t,a)=>b("rowContextmenu",e,t,a),onRowDblclick:(e,t,a)=>b("rowDblclick",e,t,a),onHeaderClick:(e,t)=>b("headerClick",e,t),onHeaderContextmenu:(e,t)=>b("headerContextmenu",e,t),onFilterChange:e=>b("filterChange",e),onExpandChange:(e,t)=>b("expandChange",e,t)}),{append:()=>g.append&&g.append(),empty:()=>e.createVNode("div",{class:"fa-table__empty"},[g.empty?g.empty():e.createVNode(e.Fragment,null,[e.createVNode(t.ElIcon,null,{default:()=>[e.createVNode(l.NotData,null,null)]}),e.createVNode("div",null,[e.createTextVNode("暂无数据")])])]),default:()=>e.createVNode(e.Fragment,null,[e.createVNode(t.ElTableColumn,{className:"fa-table__index-column",type:"index",fixed:"left",width:S.tablePagination.pageIndex*S.tablePagination.pageSize>=100?S.tablePagination.pageIndex*S.tablePagination.pageSize>=1e3?50:40:30,align:"center",index:F,showOverflowTooltip:!1,resizable:!1,columnKey:"__table-index"},null),e.createVNode(t.ElTableColumn,{className:"fa-table__selection-column",type:"selection",fixed:"left",width:35,align:"center",reserveSelection:!0,showOverflowTooltip:!1,resizable:!1,columnKey:"__table-selection",selectable:p.rowSelectable},null),g.operation&&e.createVNode(t.ElTableColumn,{fixed:"right",width:S.operationColumnWidth,headerAlign:"center",align:"left",showOverflowTooltip:!1,className:"fa-table__operation-column",resizable:!1,columnKey:"__table-operation"},{header:()=>e.createVNode("div",{class:"fa-table__auto-width-column__cell-header __fa-table__auto-width-column__cell-header____table-operation"},[e.createVNode("span",null,[e.createTextVNode("操作")])]),default:({row:t,column:a,$index:l})=>e.createVNode("div",{class:"fa-table__auto-width-column__cell __fa-table__auto-width-column__cell____table-operation"},[g.operation({row:t,column:a,$index:l,search:O,...r.getTableDefaultSlots(S)})])}),0===S.tableColumns?.length?g.default&&g.default():S.tableColumns.map(a=>a.show&&("expand"===a.type?e.createVNode(t.ElTableColumn,e.mergeProps(a,{width:35,fixed:a.fixed??"left",resizable:!1}),{default:({row:t,column:l,$index:o})=>e.createVNode(e.Fragment,null,[a.render&&a.render({row:t,column:l,$index:o,...r.getTableDefaultSlots(S)}),a.slot&&g[a.slot]&&g[a.slot]({row:t,column:l,$index:o,...r.getTableDefaultSlots(S)})])}):a.prop&&e.createVNode(i.default,e.mergeProps(n.omit(a,W),{hideImage:p.hideImage,resizable:!0,onImagePreview:q,onCustomCellClick:j}),n.pick(g,U.value))))])}),[[e.resolveDirective("loading"),S.loading]]),e.createVNode("div",{class:"fa-table__main-footer"},[e.createVNode("div",{class:"fa-table__main-footer__left"},[g.footer&&g.footer({search:O,...r.getTableDefaultSlots(S)})]),g.pagination?g.pagination({pageIndex:S.tablePagination.pageIndex,pageSize:S.tablePagination.pageSize,totalRows:S.tablePagination.totalRows,handleSizeChange:N,handlePaginationChange:x}):e.createVNode(e.Fragment,null,[p.pagination?e.createVNode(s.default,{onSizeChange:N,onCurrentChange:x},null):e.createVNode(t.ElPagination,{class:"fa-table-pagination",size:"small",layout:"total",total:S.tableData.length},null)])])]),S.imagePreview&&e.createVNode(t.ElImageViewer,{closeOnPressEscape:!0,hideOnClickModal:!0,teleported:!0,onClose:()=>S.imagePreview=!1,urlList:S.previewList},null),p.columnSettingBtn&&e.createVNode(c.default,{ref:I,change:p.columnsChange},null)])),o.useExpose(f,{clearSelection:e.computed(()=>y.value?.clearSelection),getSelectionRows:e.computed(()=>y.value?.getSelectionRows),toggleRowSelection:e.computed(()=>y.value?.toggleRowSelection),toggleAllSelection:e.computed(()=>y.value?.toggleAllSelection),toggleRowExpansion:e.computed(()=>y.value?.toggleRowExpansion),setCurrentRow:e.computed(()=>y.value?.setCurrentRow),clearSort:e.computed(()=>y.value?.clearSort),clearFilter:e.computed(()=>y.value?.clearFilter),doLayout:e.computed(()=>y.value?.doLayout),sort:e.computed(()=>y.value?.sort),scrollTo:e.computed(()=>y.value?.scrollTo),setScrollTop:e.computed(()=>y.value?.setScrollTop),setScrollLeft:e.computed(()=>y.value?.setScrollLeft),columns:e.computed(()=>y.value?.columns),updateKeyChildren:e.computed(()=>y.value?.updateKeyChildren),loading:e.computed(()=>S.loading),tableData:e.computed(()=>S.tableData),tablePagination:e.computed(()=>S.tablePagination),searchParam:e.computed(()=>S.searchParam),selected:e.computed(()=>S.selected),selectedList:e.computed(()=>S.selectedList),selectedListIds:e.computed(()=>S.selectedListIds),indeterminateSelectedListIds:e.computed(()=>S.indeterminateSelectedListIds),tableWidth:e.computed(()=>S.tableWidth),tableHeight:e.computed(()=>S.tableHeight),toggleRowIndeterminateSelection:(e,t)=>{const a=n.isFunction(p.rowKey)?p.rowKey(e):e[p.rowKey],l=S.tableData.find(e=>n.isFunction(p.rowKey)?p.rowKey(e):e[p.rowKey]===a);if(!0===t)S.indeterminateSelectedListIds.some(e=>e===a)||S.indeterminateSelectedListIds.push(a),y.value.toggleRowSelection(l,!0);else if(!1===t){const e=S.indeterminateSelectedListIds.findIndex(e=>e===a);e>=0&&S.indeterminateSelectedListIds.splice(e,1),y.value.toggleRowSelection(l,!1)}else{const e=S.indeterminateSelectedListIds.findIndex(e=>e===a);e>=0?S.indeterminateSelectedListIds.splice(e,1):S.indeterminateSelectedListIds.push(a),y.value.toggleRowSelection(l)}},refresh:O,reset:T,doRender:V,doLoading:E})}});exports.default=g,exports.faTableEmits=h,exports.faTableProps=p,exports.tableProps=m;
|
|
2
2
|
//# sourceMappingURL=table.js.map
|