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":"select.js","sources":["../../../../../packages/components/select/src/select.tsx"],"sourcesContent":["import { computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { ElSelect, selectEmits, tagProps, useAriaProps, useEmptyValuesProps, useGlobalSize, useSizeProp, useTooltipContentProps } from \"element-plus\";\nimport { ArrowDown, 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, isFunction, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport FaSelectOption from \"./selectOption\";\nimport type { ElSelectorOutput } from \"./select.type\";\nimport type { Options, Placement, PopperEffect } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\nexport const SelectProps = {\n\t/**\n\t * @description the name attribute of select input\n\t */\n\tname: String,\n\t/**\n\t * @description native input id\n\t */\n\tid: String,\n\t/**\n\t * @description binding value\n\t */\n\tmodelValue: {\n\t\ttype: [Array, String, Number, Boolean, Object],\n\t\tdefault: undefined,\n\t},\n\t/**\n\t * @description the autocomplete attribute of select input\n\t */\n\tautocomplete: {\n\t\ttype: String,\n\t\tdefault: \"off\",\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 size of Input\n\t */\n\tsize: useSizeProp,\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 Select is disabled\n\t */\n\tdisabled: Boolean,\n\t/**\n\t * @description whether select can be cleared\n\t */\n\tclearable: Boolean,\n\t/**\n\t * @description whether Select is filterable\n\t */\n\tfilterable: Boolean,\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 whether Select is loading data from server\n\t */\n\tloading: Boolean,\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 options are loaded from server\n\t */\n\tremote: 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 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 displayed text when there is no options, you can also use slot `empty`, default is 'No data'\n\t */\n\tnoDataText: String,\n\t/**\n\t * @description custom remote search method\n\t */\n\tremoteMethod: Function,\n\t/**\n\t * @description custom filter method\n\t */\n\tfilterMethod: Function,\n\t/**\n\t * @description whether multiple-select is activated\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 placeholder, default is 'Select'\n\t */\n\tplaceholder: {\n\t\ttype: String,\n\t},\n\t/**\n\t * @description select first matching option on enter key. Use with `filterable` or `remote`\n\t */\n\tdefaultFirstOption: Boolean,\n\t/**\n\t * @description when `multiple` and `filter` is true, whether to reserve current keyword after selecting an option\n\t */\n\treserveKeyword: {\n\t\ttype: Boolean,\n\t\tdefault: true,\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 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 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 clear icon component\n\t */\n\tclearIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: CircleClose,\n\t},\n\t/**\n\t * @description whether the width of the dropdown is the same as the input\n\t */\n\tfitInputWidth: Boolean,\n\t/**\n\t * @description custom suffix icon component\n\t */\n\tsuffixIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: ArrowDown,\n\t},\n\t/**\n\t * @description tag type\n\t */\n\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 whether to trigger form validation\n\t */\n\tvalidateEvent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description in remote search method show suffix icon\n\t */\n\tremoteShowSuffix: Boolean,\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...useEmptyValuesProps,\n\t...useAriaProps([\"ariaLabel\"]),\n};\n\nexport type SelectComponentProps = {\n\t/** @description 指定标签为节点的某个属性值 */\n\tlabel?: string | ((data: any) => string);\n\t/** @description 指定是否隐藏为节点的某个属性值 */\n\thide?: string | ((data: any) => boolean);\n\t/** @description 指定是否禁用为节点的某个属性值 */\n\tdisabled?: string | ((data: any) => boolean);\n\t/** @description 指定子节点对象为节点的某个属性值 */\n\tchildren?: string;\n};\n\nexport const faSelectProps = {\n\t...SelectProps,\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\tprops: {\n\t\ttype: definePropType<SelectComponentProps>(Object),\n\t\tdefault: (): Partial<SelectComponentProps> => ({\n\t\t\tlabel: \"label\",\n\t\t\thide: \"hide\",\n\t\t\tdisabled: \"disabled\",\n\t\t\tchildren: \"children\",\n\t\t}),\n\t},\n\t/** @description 下拉框数据 */\n\tdata: {\n\t\ttype: definePropType<ElSelectorOutput[]>(Array),\n\t\tdefault: (): ElSelectorOutput[] => [],\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: any) => Promise<ElSelectorOutput[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n};\n\nexport const faSelectEmits = {\n\t...selectEmits,\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 FaSelectSlots = {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: ElSelectorOutput;\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: \"FaSelect\",\n\tprops: faSelectProps,\n\temits: faSelectEmits,\n\tslots: makeSlots<FaSelectSlots>(),\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 selectRef = ref<InstanceType<typeof ElSelect>>();\n\n\t\tconst handleData = (data: ElSelectorOutput[]): ElSelectorOutput[] => {\n\t\t\treturn data\n\t\t\t\t?.map((m) => ({\n\t\t\t\t\t...m,\n\t\t\t\t\tvalue: m[props.valueKey],\n\t\t\t\t\tlabel: isFunction(props.props.label) ? props.props.label(m) : m[props.props.label ?? \"label\"],\n\t\t\t\t\thide: isFunction(props.props.hide) ? props.props.hide(m) : m[props.props.hide ?? \"hide\"],\n\t\t\t\t\tdisabled: isFunction(props.props.disabled) ? props.props.disabled(m) : m[props.props.disabled ?? \"disabled\"],\n\t\t\t\t\tchildren: isFunction(props.props.children)\n\t\t\t\t\t\t? handleData(props.props.children(m))\n\t\t\t\t\t\t: handleData(m[props.props.children ?? \"children\"]),\n\t\t\t\t}))\n\t\t\t\t.filter((f) => !f.hide);\n\t\t};\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\tstate.selectorData = handleData(resData);\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 = handleData(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(\"FaSelect\", \"当启用 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(\"FaSelect\", \"当启用 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(\"FaSelect\", \"当禁用 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(\"FaSelect\", \"当禁用 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 elSelectProps = useProps(props, SelectProps, [\"modelValue\", \"popperClass\", \"loading\"]);\n\t\tconst elSelectEmits = useEmits(selectEmits, emit, [\"update:modelValue\", \"change\", \"clear\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => {\n\t\t\tlet localClass = `fa-select-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<ElSelect\n\t\t\t\t{...elSelectProps.value}\n\t\t\t\t{...elSelectEmits.value}\n\t\t\t\tref={selectRef}\n\t\t\t\tclass=\"fa-select\"\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\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\tdefault: (): VNode[] =>\n\t\t\t\t\t\tstate.selectorData.map((item) => (\n\t\t\t\t\t\t\t<FaSelectOption vSlots={{ default: slots.default }} data={item} moreDetail={props.moreDetail} />\n\t\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</ElSelect>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectRef.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectRef.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectRef.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":["SelectProps","name","String","id","modelValue","type","Array","Number","Boolean","Object","default","undefined","autocomplete","automaticDropdown","size","useSizeProp","effect","definePropType","disabled","clearable","filterable","allowCreate","loading","popperClass","popperOptions","remote","loadingText","noMatchText","noDataText","remoteMethod","Function","filterMethod","multiple","multipleLimit","placeholder","defaultFirstOption","reserveKeyword","valueKey","collapseTags","collapseTagsTooltip","maxCollapseTags","teleported","useTooltipContentProps","persistent","clearIcon","CircleClose","fitInputWidth","suffixIcon","ArrowDown","tagType","tagProps","tagEffect","validateEvent","remoteShowSuffix","placement","fallbackPlacements","useEmptyValuesProps","useAriaProps","faSelectProps","label","width","moreDetail","lazy","defaultSelected","props","hide","children","data","requestApi","initParam","faSelectEmits","selectEmits","value","isString","isNumber","isBoolean","isObject","isArray","isNull","dataChangeCallBack","change","Select","emits","slots","makeSlots","setup","attrs","emit","expose","selectedLabel","useVModel","_globalSize","useGlobalSize","state","reactive","withDefineType","selectorData","debut","echo","length","nextRefresh","selectRef","ref","handleData","map","m","isFunction","filter","f","loadData","async","params","resData","error","consoleError","handleChange","valueArr","dataList","includes","isNil","find","handleClear","handleVisibleChange","visible","watch","newValue","hasLabel","slice","item","index","immediate","onMounted","oldValue","isEqual","deep","elSelectProps","useProps","elSelectEmits","useEmits","elPopperClass","computed","localClass","useRender","_createVNode","ElSelect","_mergeProps","class","style","addUnit","$event","onChange","onClear","onVisibleChange","FaSelectOption","header","footer","prefix","empty","tag","useExpose","focus","blur","refresh","setSelection","clearSelection"],"mappings":"sTAWaA,EAAc,CAI1BC,KAAMC,OAINC,GAAID,OAIJE,WAAY,CACXC,KAAM,CAACC,MAAOJ,OAAQK,OAAQC,QAASC,QACvCC,aAASC,GAKVC,aAAc,CACbP,KAAMH,OACNQ,QAAS,OAKVG,kBAAmBL,QAInBM,KAAMC,EAAAA,YAINC,OAAQ,CACPX,KAAMY,EAAAA,eAAsCf,QAC5CQ,QAAS,SAKVQ,SAAUV,QAIVW,UAAWX,QAIXY,WAAYZ,QAIZa,YAAab,QAIbc,QAASd,QAITe,YAAa,CACZlB,KAAMH,OACNQ,QAAS,IAKVc,cAAe,CACdnB,KAAMY,EAAAA,eAAiCR,QACvCC,QAASA,MAAyB,IAKnCe,OAAQjB,QAIRkB,YAAaxB,OAIbyB,YAAazB,OAIb0B,WAAY1B,OAIZ2B,aAAcC,SAIdC,aAAcD,SAIdE,SAAUxB,QAIVyB,cAAe,CACd5B,KAAME,OACNG,QAAS,GAKVwB,YAAa,CACZ7B,KAAMH,QAKPiC,mBAAoB3B,QAIpB4B,eAAgB,CACf/B,KAAMG,QACNE,SAAS,GAKV2B,SAAU,CACThC,KAAMH,OACNQ,QAAS,SAKV4B,aAAc9B,QAId+B,oBAAqB/B,QAIrBgC,gBAAiB,CAChBnC,KAAME,OACNG,QAAS,GAKV+B,WAAYC,EAAAA,uBAAuBD,WAInCE,WAAY,CACXtC,KAAMG,QACNE,SAAS,GAKVkC,UAAW,CACVvC,KAAMY,EAAAA,e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E,EAAMwE,aAC/CxE,EAAMyE,QAAU,CAAEA,OAAQA,IAAezE,EAAMyE,aAC/CzE,EAAM0E,OAAS,CAAEA,MAAOA,IAAe1E,EAAM0E,YAC7C1E,EAAM2E,KAAO,CAAEA,IAAKA,IAAe3E,EAAM2E,UACzC3E,EAAM7D,SAAW,CAAEA,QAASA,IAAe6D,EAAM7D,cACjD6D,EAAMxB,OAAS,CAClBA,MAAOA,EAAGA,QAAOa,WAChBW,EAAMxB,MAAM,CAAEA,QAAOa,cAMnBuF,EAAAA,UAAUvE,EAAQ,CAExBwE,MAAOpB,EAAAA,SAAS,IAAMvC,EAAU7B,OAAOwF,OAEvCC,KAAMrB,EAAAA,SAAS,IAAMvC,EAAU7B,OAAOyF,MAEtCxE,cAAemD,EAAAA,SAAS,IAAMvC,EAAU7B,OAAOiB,eAE/CnE,QAASsH,EAAAA,SAAS,IAAM/C,EAAMvE,SAE9B4I,QAASrD,EAETsD,aAAe3F,GAAuF2C,EAAa3C,GAEnH4F,eAAgBA,IAAMjD,EAAa,OAErC"}
|
|
1
|
+
{"version":3,"file":"select.js","sources":["../../../../../packages/components/select/src/select.tsx"],"sourcesContent":["import { computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { ElSelect, selectEmits, tagProps, useAriaProps, useEmptyValuesProps, useGlobalSize, useSizeProp, useTooltipContentProps } from \"element-plus\";\nimport { ArrowDown, 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, isFunction, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport FaSelectOption from \"./selectOption\";\nimport type { ElSelectorOutput } from \"./select.type\";\nimport type { Options, Placement, PopperEffect } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\nexport const SelectProps = {\n\t/**\n\t * @description the name attribute of select input\n\t */\n\tname: String,\n\t/**\n\t * @description native input id\n\t */\n\tid: String,\n\t/**\n\t * @description binding value\n\t */\n\tmodelValue: {\n\t\ttype: [Array, String, Number, Boolean, Object],\n\t\tdefault: undefined,\n\t},\n\t/**\n\t * @description the autocomplete attribute of select input\n\t */\n\tautocomplete: {\n\t\ttype: String,\n\t\tdefault: \"off\",\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 size of Input\n\t */\n\tsize: useSizeProp,\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 Select is disabled\n\t */\n\tdisabled: Boolean,\n\t/**\n\t * @description whether select can be cleared\n\t */\n\tclearable: Boolean,\n\t/**\n\t * @description whether Select is filterable\n\t */\n\tfilterable: Boolean,\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 whether Select is loading data from server\n\t */\n\tloading: Boolean,\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 options are loaded from server\n\t */\n\tremote: 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 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 displayed text when there is no options, you can also use slot `empty`, default is 'No data'\n\t */\n\tnoDataText: String,\n\t/**\n\t * @description custom remote search method\n\t */\n\tremoteMethod: Function,\n\t/**\n\t * @description custom filter method\n\t */\n\tfilterMethod: Function,\n\t/**\n\t * @description whether multiple-select is activated\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 placeholder, default is 'Select'\n\t */\n\tplaceholder: {\n\t\ttype: String,\n\t},\n\t/**\n\t * @description select first matching option on enter key. Use with `filterable` or `remote`\n\t */\n\tdefaultFirstOption: Boolean,\n\t/**\n\t * @description when `multiple` and `filter` is true, whether to reserve current keyword after selecting an option\n\t */\n\treserveKeyword: {\n\t\ttype: Boolean,\n\t\tdefault: true,\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 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 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 clear icon component\n\t */\n\tclearIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: CircleClose,\n\t},\n\t/**\n\t * @description whether the width of the dropdown is the same as the input\n\t */\n\tfitInputWidth: Boolean,\n\t/**\n\t * @description custom suffix icon component\n\t */\n\tsuffixIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: ArrowDown,\n\t},\n\t/**\n\t * @description tag type\n\t */\n\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 whether to trigger form validation\n\t */\n\tvalidateEvent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * @description in remote search method show suffix icon\n\t */\n\tremoteShowSuffix: Boolean,\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...useEmptyValuesProps,\n\t...useAriaProps([\"ariaLabel\"]),\n};\n\nexport type SelectComponentProps = {\n\t/** @description 指定标签为节点的某个属性值 */\n\tlabel?: string | ((data: any) => string);\n\t/** @description 指定是否隐藏为节点的某个属性值 */\n\thide?: string | ((data: any) => boolean);\n\t/** @description 指定是否禁用为节点的某个属性值 */\n\tdisabled?: string | ((data: any) => boolean);\n\t/** @description 指定子节点对象为节点的某个属性值 */\n\tchildren?: string;\n};\n\nexport const faSelectProps = {\n\t...SelectProps,\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\tprops: {\n\t\ttype: definePropType<SelectComponentProps>(Object),\n\t\tdefault: (): Partial<SelectComponentProps> => ({\n\t\t\tlabel: \"label\",\n\t\t\thide: \"hide\",\n\t\t\tdisabled: \"disabled\",\n\t\t\tchildren: \"children\",\n\t\t}),\n\t},\n\t/** @description 下拉框数据 */\n\tdata: {\n\t\ttype: definePropType<ElSelectorOutput[]>(Array),\n\t\tdefault: (): ElSelectorOutput[] => [],\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: any) => Promise<ElSelectorOutput[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n};\n\nexport const faSelectEmits = {\n\t...selectEmits,\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 FaSelectSlots = {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: ElSelectorOutput;\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: \"FaSelect\",\n\tprops: faSelectProps,\n\temits: faSelectEmits,\n\tslots: makeSlots<FaSelectSlots>(),\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 selectRef = ref<InstanceType<typeof ElSelect>>();\n\n\t\tconst handleData = (data: ElSelectorOutput[]): ElSelectorOutput[] => {\n\t\t\treturn data\n\t\t\t\t?.map((m) => ({\n\t\t\t\t\t...m,\n\t\t\t\t\tvalue: m[props.valueKey],\n\t\t\t\t\tlabel: isFunction(props.props.label) ? props.props.label(m) : m[props.props.label ?? \"label\"],\n\t\t\t\t\thide: isFunction(props.props.hide) ? props.props.hide(m) : m[props.props.hide ?? \"hide\"],\n\t\t\t\t\tdisabled: isFunction(props.props.disabled) ? props.props.disabled(m) : m[props.props.disabled ?? \"disabled\"],\n\t\t\t\t\tchildren: isFunction(props.props.children)\n\t\t\t\t\t\t? handleData(props.props.children(m))\n\t\t\t\t\t\t: handleData(m[props.props.children ?? \"children\"]),\n\t\t\t\t}))\n\t\t\t\t.filter((f) => !f.hide);\n\t\t};\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\tstate.selectorData = handleData(resData);\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 = handleData(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(\"FaSelect\", \"当启用 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(\"FaSelect\", \"当启用 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(\"FaSelect\", \"当禁用 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(\"FaSelect\", \"当禁用 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 elSelectProps = useProps(props, SelectProps, [\"modelValue\", \"popperClass\", \"loading\"]);\n\t\tconst elSelectEmits = useEmits(selectEmits, emit, [\"update:modelValue\", \"change\", \"clear\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => {\n\t\t\tlet localClass = `fa-select-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<ElSelect\n\t\t\t\t{...elSelectProps.value}\n\t\t\t\t{...elSelectEmits.value}\n\t\t\t\tref={selectRef}\n\t\t\t\tclass=\"fa-select\"\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\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\tdefault: (): VNode[] =>\n\t\t\t\t\t\tstate.selectorData.map((item) => (\n\t\t\t\t\t\t\t<FaSelectOption vSlots={{ default: slots.default }} data={item} moreDetail={props.moreDetail} />\n\t\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</ElSelect>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectRef.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectRef.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectRef.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":["SelectProps","name","String","id","modelValue","type","Array","Number","Boolean","Object","default","undefined","autocomplete","automaticDropdown","size","useSizeProp","effect","definePropType","disabled","clearable","filterable","allowCreate","loading","popperClass","popperOptions","remote","loadingText","noMatchText","noDataText","remoteMethod","Function","filterMethod","multiple","multipleLimit","placeholder","defaultFirstOption","reserveKeyword","valueKey","collapseTags","collapseTagsTooltip","maxCollapseTags","teleported","useTooltipContentProps","persistent","clearIcon","CircleClose","fitInputWidth","suffixIcon","ArrowDown","tagType","tagProps","tagEffect","validateEvent","remoteShowSuffix","placement","fallbackPlacements","useEmptyValuesProps","useAriaProps","faSelectProps","label","width","moreDetail","lazy","defaultSelected","props","hide","children","data","requestApi","initParam","faSelectEmits","selectEmits","value","isString","isNumber","isBoolean","isObject","isArray","isNull","dataChangeCallBack","change","Select","emits","slots","makeSlots","setup","attrs","emit","expose","selectedLabel","useVModel","passive","_globalSize","useGlobalSize","state","reactive","withDefineType","selectorData","debut","echo","length","nextRefresh","selectRef","ref","handleData","map","m","isFunction","filter","f","loadData","async","params","resData","error","consoleError","handleChange","valueArr","dataList","includes","isNil","find","handleClear","handleVisibleChange","visible","watch","newValue","hasLabel","slice","item","index","immediate","onMounted","oldValue","isEqual","deep","elSelectProps","useProps","elSelectEmits","useEmits","elPopperClass","computed","localClass","useRender","_createVNode","ElSelect","_mergeProps","class","style","addUnit","$event","onChange","onClear","onVisibleChange","FaSelectOption","header","footer","prefix","empty","tag","useExpose","focus","blur","refresh","setSelection","clearSelection"],"mappings":"sTAWaA,EAAc,CAI1BC,KAAMC,OAINC,GAAID,OAIJE,WAAY,CACXC,KAAM,CAACC,MAAOJ,OAAQK,OAAQC,QAASC,QACvCC,aAASC,GAKVC,aAAc,CACbP,KAAMH,OACNQ,QAAS,OAKVG,kBAAmBL,QAInBM,KAAMC,EAAAA,YAINC,OAAQ,CACPX,KAAMY,EAAAA,eAAsCf,QAC5CQ,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E,SAE9B6I,QAASrD,EAETsD,aAAe5F,GAAuF4C,EAAa5C,GAEnH6F,eAAgBA,IAAMjD,EAAa,OAErC"}
|
|
@@ -41,7 +41,7 @@ export declare const faSelectPageProps: {
|
|
|
41
41
|
label: import('vue').PropType<string | string[]>;
|
|
42
42
|
/** @description 宽度 */
|
|
43
43
|
width: {
|
|
44
|
-
type: (
|
|
44
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
45
45
|
default: string;
|
|
46
46
|
};
|
|
47
47
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -235,7 +235,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
235
235
|
label: import('vue').PropType<string | string[]>;
|
|
236
236
|
/** @description 宽度 */
|
|
237
237
|
width: {
|
|
238
|
-
type: (
|
|
238
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
239
239
|
default: string;
|
|
240
240
|
};
|
|
241
241
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -431,7 +431,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
431
431
|
label: import('vue').PropType<string | string[]>;
|
|
432
432
|
/** @description 宽度 */
|
|
433
433
|
width: {
|
|
434
|
-
type: (
|
|
434
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
435
435
|
default: string;
|
|
436
436
|
};
|
|
437
437
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -584,6 +584,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
584
584
|
width: string | number;
|
|
585
585
|
persistent: boolean;
|
|
586
586
|
fallbackPlacements: Placement[];
|
|
587
|
+
filterable: boolean;
|
|
587
588
|
moreDetail: boolean;
|
|
588
589
|
loadingText: string;
|
|
589
590
|
noMatchText: string;
|
|
@@ -592,7 +593,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
592
593
|
collapseTagsTooltip: boolean;
|
|
593
594
|
valueOnClear: import('element-plus/es/utils/index.mjs').EpPropMergeType<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown>;
|
|
594
595
|
automaticDropdown: boolean;
|
|
595
|
-
filterable: boolean;
|
|
596
596
|
allowCreate: boolean;
|
|
597
597
|
remote: boolean;
|
|
598
598
|
multiple: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("element-plus"),a=require("@element-plus/icons-vue"),t=require("../../select/index.js"),o=require("@fast-china/utils"),r=require("@vueuse/core"),i=require("lodash-unified"),s=require("../../select/src/select.js"),d={...s.SelectProps,disabled:{type:Boolean,default:void 0},loadingText:{type:String,default:"加载中..."},noMatchText:{type:String,default:"暂无匹配的数据"},noDataText:{type:String,default:"暂无数据"},collapseTags:{type:Boolean,default:!0},collapseTagsTooltip:{type:Boolean,default:!0},modelValue:{type:o.definePropType([String,Number,Boolean,Object,Array]),default:void 0},label:o.definePropType([String,Array]),width:{type:[String,Number],default:"100%"},moreDetail:Boolean,props:{type:o.definePropType(Object),default:()=>({label:"label",hide:"hide",disabled:"disabled",children:"children"})},requestApi:{type:o.definePropType(Function)},initParam:o.definePropType([String,Number,Object])},u={...l.selectEmits,"update:modelValue":e=>i.isString(e)||i.isNumber(e)||i.isBoolean(e)||i.isObject(e)||i.isArray(e)||i.isNull(e),"update:label":e=>i.isString(e)||i.isArray(e)||i.isNull(e),dataChangeCallBack:e=>i.isArray(e),change:(e,l)=>!0},n=e.defineComponent({name:"FaSelectPage",props:d,emits:u,slots:o.makeSlots(),setup(d,{attrs:u,slots:n,emit:c,expose:p}){const g=r.useVModel(d,"label",c),f=l.useGlobalSize(),m=e.reactive({value:o.withDefineType(),loading:!1,selectorData:o.withDefineType([]),selectedList:o.withDefineType([]),debut:!0,echo:!0,nextRefresh:!1,pageIndex:1,pageSize:15,totalRows:0,searchValue:void 0,defaultSelectorData:o.withDefineType()}),b=e.ref(),h=e=>e?.map(e=>({...e,value:e[d.valueKey],label:i.isFunction(d.props.label)?d.props.label(e):e[d.props.label??"label"],hide:i.isFunction(d.props.hide)?d.props.hide(e):e[d.props.hide??"hide"],disabled:i.isFunction(d.props.disabled)?d.props.disabled(e):e[d.props.disabled??"disabled"],children:i.isFunction(d.props.children)?h(d.props.children(e)):h(e[d.props.children??"children"])})).filter(e=>!e.hide),v=async e=>{m.loading=!0,m.pageIndex=e??m.pageIndex;const l={...d.initParam??{},pageIndex:m.pageIndex,pageSize:m.pageSize,searchValue:m.searchValue};try{const e=await d.requestApi(l);m.echo=!1,m.totalRows=e.totalRows,m.selectorData=h(e.rows),c("dataChangeCallBack",m.selectorData)}catch(a){o.consoleError("FaSelectPage",a),m.pageIndex=1,m.totalRows=0,m.selectorData=[]}finally{m.loading=!1}},y=e=>{if(d.multiple){const l=e;if(0===l?.length)return m.value=null,g.value=null,m.selectedList=[],c("update:modelValue",null),void c("change",null,null);const a=m.selectorData.filter(e=>l.includes(e.value));m.value=e,g.value=a.map(e=>e.label),m.selectedList=[...m.selectedList.filter(e=>!a.some(l=>l.value===e.value)),...a].filter(e=>l.includes(e.value)),c("update:modelValue",e),c("change",a,e)}else{if(i.isNil(e))return m.value=null,g.value=null,m.selectedList=[],c("update:modelValue",null),void c("change",null,null);const l=m.selectorData.find(l=>l.value===e);m.value=e,g.value=l.label,m.selectedList.some(l=>l.value===e)||(m.selectedList=[l]),c("update:modelValue",e),c("change",l,e)}},S=()=>{m.value=null,g.value=null,m.selectedList=[],c("update:modelValue",null),c("clear")},V=async e=>{e&&(m.debut?(m.debut=!1,await v()):m.nextRefresh&&(m.nextRefresh=!1,await v())),c("visible-change",e)};e.watch(()=>d.modelValue,e=>{if(m.echo&&!i.isNil(e)){const l=!i.isNil(d.label);if(d.multiple){if(!i.isArray(e))return void o.consoleError("FaSelectPage","当启用 multiple 时,传入的 modelValue 必须是Array。");if(l&&!i.isArray(d.label))return void o.consoleError("FaSelectPage","当启用 multiple 时,传入的 modelValue:label 必须是Array。");m.selectedList=e.slice(0,d.multipleLimit>0?d.multipleLimit:e.length).map((e,a)=>({value:e,label:l?d.label[a]:void 0}))}else{if(i.isArray(e))return void o.consoleError("FaSelectPage","当禁用 multiple 时,传入的 modelValue 不能是Array。");if(l&&i.isArray(d.label))return void o.consoleError("FaSelectPage","当禁用 multiple 时,传入的 modelValue:label 不能是Array。");m.defaultSelectorData={value:e,label:d.label}}}m.value=e},{immediate:!0}),e.onMounted(()=>{e.watch(()=>d.initParam,(e,l)=>{i.isEqual(e,l)||(m.nextRefresh=!0,i.isNil(m.value)||y())})});const x=o.useProps(d,s.SelectProps,["modelValue","popperClass","loading"]),w=o.useEmits(l.selectEmits,c,["update:modelValue","change","clear","visible-change"]),P=e.computed(()=>{let e=`fa-select-page-dropdown fa-select-page-dropdown-${f.value} ${d.popperClass}`;return d.moreDetail&&(e+=` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${f.value}`),e});return o.useRender(()=>e.createVNode(l.ElSelect,e.mergeProps(x.value,w.value,{ref:b,class:"fa-select-page",popperClass:P.value,style:{width:o.addUnit(d.width)},modelValue:m.value,"onUpdate:modelValue":e=>m.value=e,loading:m.loading,onChange:y,onClear:S,onVisibleChange:V}),{default:()=>m.selectorData.map(l=>e.createVNode(t.FaSelectOption,{data:l,moreDetail:d.moreDetail},{default:n.default})),header:()=>e.createVNode(e.Fragment,null,[m.defaultSelectorData&&e.createVNode(l.ElOption,{class:"fa-select-page-dropdown__default-selector",value:m.defaultSelectorData.value,label:m.defaultSelectorData.label,disabled:!0},{default:()=>[e.createVNode("span",null,[m.defaultSelectorData.label]),e.createVNode("span",null,[e.createTextVNode("Default")])]}),e.createVNode(l.ElInput,{class:"fa-select-page-dropdown__search-input",clearable:!0,placeholder:"请输入关键字搜索",modelValue:m.searchValue,modelModifiers:{trim:!0},"onUpdate:modelValue":e=>m.searchValue=e,onKeyup:e=>{"Enter"===e.key&&v(1)}},{append:()=>e.createVNode(l.ElButton,{loading:m.loading,icon:a.Search,onClick:()=>v(1)},null)}),n.header&&n.header()]),footer:()=>e.createVNode(e.Fragment,null,[e.createVNode(l.ElPagination,{class:"fa-select-page-dropdown__pagination",size:"small",currentPage:m.pageIndex,pageSize:m.pageSize,total:m.totalRows,layout:"prev, pager, next, total",pagerCount:5,onCurrentChange:v},null),n.footer&&n.footer()]),...n.prefix&&{prefix:()=>n.prefix()},...n.empty&&{empty:()=>n.empty()},...n.tag&&{tag:()=>n.tag()},...n.loading&&{loading:()=>n.loading()},...d.multiple?{label:({label:l,value:a})=>{const t=m.selectedList.find(e=>e.value===a);return n.label?n.label({label:t?.label,value:i.isNil(t)?a:t?.value}):t&&e.createVNode("span",{class:"el-select__tags-text"},[t.label])}}:n.label&&{label:({label:e,value:l})=>n.label({label:e,value:l})}})),o.useExpose(p,{focus:e.computed(()=>b.value?.focus),blur:e.computed(()=>b.value?.blur),selectedLabel:e.computed(()=>b.value?.selectedLabel),loading:e.computed(()=>m.loading),selectedList:e.computed(()=>m.selectedList),refresh:v,setSelection:e=>y(e),clearSelection:()=>y(null)})}});exports.default=n,exports.faSelectPageEmits=u,exports.faSelectPageProps=d;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("element-plus"),a=require("@element-plus/icons-vue"),t=require("../../select/index.js"),o=require("@fast-china/utils"),r=require("@vueuse/core"),i=require("lodash-unified"),s=require("../../select/src/select.js"),d={...s.SelectProps,disabled:{type:Boolean,default:void 0},loadingText:{type:String,default:"加载中..."},noMatchText:{type:String,default:"暂无匹配的数据"},noDataText:{type:String,default:"暂无数据"},collapseTags:{type:Boolean,default:!0},collapseTagsTooltip:{type:Boolean,default:!0},modelValue:{type:o.definePropType([String,Number,Boolean,Object,Array]),default:void 0},label:o.definePropType([String,Array]),width:{type:[String,Number],default:"100%"},moreDetail:Boolean,props:{type:o.definePropType(Object),default:()=>({label:"label",hide:"hide",disabled:"disabled",children:"children"})},requestApi:{type:o.definePropType(Function)},initParam:o.definePropType([String,Number,Object])},u={...l.selectEmits,"update:modelValue":e=>i.isString(e)||i.isNumber(e)||i.isBoolean(e)||i.isObject(e)||i.isArray(e)||i.isNull(e),"update:label":e=>i.isString(e)||i.isArray(e)||i.isNull(e),dataChangeCallBack:e=>i.isArray(e),change:(e,l)=>!0},n=e.defineComponent({name:"FaSelectPage",props:d,emits:u,slots:o.makeSlots(),setup(d,{attrs:u,slots:n,emit:c,expose:p}){const g=r.useVModel(d,"label",c,{passive:!0}),f=l.useGlobalSize(),m=e.reactive({value:o.withDefineType(),loading:!1,selectorData:o.withDefineType([]),selectedList:o.withDefineType([]),debut:!0,echo:!0,nextRefresh:!1,pageIndex:1,pageSize:15,totalRows:0,searchValue:void 0,defaultSelectorData:o.withDefineType()}),b=e.ref(),h=e=>e?.map(e=>({...e,value:e[d.valueKey],label:i.isFunction(d.props.label)?d.props.label(e):e[d.props.label??"label"],hide:i.isFunction(d.props.hide)?d.props.hide(e):e[d.props.hide??"hide"],disabled:i.isFunction(d.props.disabled)?d.props.disabled(e):e[d.props.disabled??"disabled"],children:i.isFunction(d.props.children)?h(d.props.children(e)):h(e[d.props.children??"children"])})).filter(e=>!e.hide),v=async e=>{m.loading=!0,m.pageIndex=e??m.pageIndex;const l={...d.initParam??{},pageIndex:m.pageIndex,pageSize:m.pageSize,searchValue:m.searchValue};try{const e=await d.requestApi(l);m.echo=!1,m.totalRows=e.totalRows,m.selectorData=h(e.rows),c("dataChangeCallBack",m.selectorData)}catch(a){o.consoleError("FaSelectPage",a),m.pageIndex=1,m.totalRows=0,m.selectorData=[]}finally{m.loading=!1}},y=e=>{if(d.multiple){const l=e;if(0===l?.length)return m.value=null,g.value=null,m.selectedList=[],c("update:modelValue",null),void c("change",null,null);const a=m.selectorData.filter(e=>l.includes(e.value));m.value=e,g.value=a.map(e=>e.label),m.selectedList=[...m.selectedList.filter(e=>!a.some(l=>l.value===e.value)),...a].filter(e=>l.includes(e.value)),c("update:modelValue",e),c("change",a,e)}else{if(i.isNil(e))return m.value=null,g.value=null,m.selectedList=[],c("update:modelValue",null),void c("change",null,null);const l=m.selectorData.find(l=>l.value===e);m.value=e,g.value=l.label,m.selectedList.some(l=>l.value===e)||(m.selectedList=[l]),c("update:modelValue",e),c("change",l,e)}},S=()=>{m.value=null,g.value=null,m.selectedList=[],c("update:modelValue",null),c("clear")},V=async e=>{e&&(m.debut?(m.debut=!1,await v()):m.nextRefresh&&(m.nextRefresh=!1,await v())),c("visible-change",e)};e.watch(()=>d.modelValue,e=>{if(m.echo&&!i.isNil(e)){const l=!i.isNil(d.label);if(d.multiple){if(!i.isArray(e))return void o.consoleError("FaSelectPage","当启用 multiple 时,传入的 modelValue 必须是Array。");if(l&&!i.isArray(d.label))return void o.consoleError("FaSelectPage","当启用 multiple 时,传入的 modelValue:label 必须是Array。");m.selectedList=e.slice(0,d.multipleLimit>0?d.multipleLimit:e.length).map((e,a)=>({value:e,label:l?d.label[a]:void 0}))}else{if(i.isArray(e))return void o.consoleError("FaSelectPage","当禁用 multiple 时,传入的 modelValue 不能是Array。");if(l&&i.isArray(d.label))return void o.consoleError("FaSelectPage","当禁用 multiple 时,传入的 modelValue:label 不能是Array。");m.defaultSelectorData={value:e,label:d.label}}}m.value=e},{immediate:!0}),e.onMounted(()=>{e.watch(()=>d.initParam,(e,l)=>{i.isEqual(e,l)||(m.nextRefresh=!0,i.isNil(m.value)||y())})});const x=o.useProps(d,s.SelectProps,["modelValue","popperClass","loading"]),w=o.useEmits(l.selectEmits,c,["update:modelValue","change","clear","visible-change"]),P=e.computed(()=>{let e=`fa-select-page-dropdown fa-select-page-dropdown-${f.value} ${d.popperClass}`;return d.moreDetail&&(e+=` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${f.value}`),e});return o.useRender(()=>e.createVNode(l.ElSelect,e.mergeProps(x.value,w.value,{ref:b,class:"fa-select-page",popperClass:P.value,style:{width:o.addUnit(d.width)},modelValue:m.value,"onUpdate:modelValue":e=>m.value=e,loading:m.loading,onChange:y,onClear:S,onVisibleChange:V}),{default:()=>m.selectorData.map(l=>e.createVNode(t.FaSelectOption,{data:l,moreDetail:d.moreDetail},{default:n.default})),header:()=>e.createVNode(e.Fragment,null,[m.defaultSelectorData&&e.createVNode(l.ElOption,{class:"fa-select-page-dropdown__default-selector",value:m.defaultSelectorData.value,label:m.defaultSelectorData.label,disabled:!0},{default:()=>[e.createVNode("span",null,[m.defaultSelectorData.label]),e.createVNode("span",null,[e.createTextVNode("Default")])]}),e.createVNode(l.ElInput,{class:"fa-select-page-dropdown__search-input",clearable:!0,placeholder:"请输入关键字搜索",modelValue:m.searchValue,modelModifiers:{trim:!0},"onUpdate:modelValue":e=>m.searchValue=e,onKeyup:e=>{"Enter"===e.key&&v(1)}},{append:()=>e.createVNode(l.ElButton,{loading:m.loading,icon:a.Search,onClick:()=>v(1)},null)}),n.header&&n.header()]),footer:()=>e.createVNode(e.Fragment,null,[e.createVNode(l.ElPagination,{class:"fa-select-page-dropdown__pagination",size:"small",currentPage:m.pageIndex,pageSize:m.pageSize,total:m.totalRows,layout:"prev, pager, next, total",pagerCount:5,onCurrentChange:v},null),n.footer&&n.footer()]),...n.prefix&&{prefix:()=>n.prefix()},...n.empty&&{empty:()=>n.empty()},...n.tag&&{tag:()=>n.tag()},...n.loading&&{loading:()=>n.loading()},...d.multiple?{label:({label:l,value:a})=>{const t=m.selectedList.find(e=>e.value===a);return n.label?n.label({label:t?.label,value:i.isNil(t)?a:t?.value}):t&&e.createVNode("span",{class:"el-select__tags-text"},[t.label])}}:n.label&&{label:({label:e,value:l})=>n.label({label:e,value:l})}})),o.useExpose(p,{focus:e.computed(()=>b.value?.focus),blur:e.computed(()=>b.value?.blur),selectedLabel:e.computed(()=>b.value?.selectedLabel),loading:e.computed(()=>m.loading),selectedList:e.computed(()=>m.selectedList),refresh:v,setSelection:e=>y(e),clearSelection:()=>y(null)})}});exports.default=n,exports.faSelectPageEmits=u,exports.faSelectPageProps=d;
|
|
2
2
|
//# sourceMappingURL=selectPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectPage.js","sources":["../../../../../packages/components/selectPage/src/selectPage.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { ElButton, ElInput, ElOption, ElPagination, ElSelect, selectEmits, useGlobalSize } from \"element-plus\";\nimport { Search } from \"@element-plus/icons-vue\";\nimport { FaSelectOption, SelectProps } from \"@fast-element-plus/components/select\";\nimport { type SelectComponentProps } from \"@fast-element-plus/components/select/src/select\";\nimport { addUnit, consoleError, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"@fast-china/utils\";\nimport { useVModel } from \"@vueuse/core\";\nimport { isArray, isBoolean, isEqual, isFunction, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport type { ElSelectorOutput } from \"@fast-element-plus/components/select\";\nimport type { PagedInput, PagedResult } from \"@fast-element-plus/components/table\";\nimport type { VNode } from \"vue\";\n\nexport const faSelectPageProps = {\n\t...SelectProps,\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 配置选项 */\n\tprops: {\n\t\ttype: definePropType<SelectComponentProps>(Object),\n\t\tdefault: (): Partial<SelectComponentProps> => ({\n\t\t\tlabel: \"label\",\n\t\t\thide: \"hide\",\n\t\t\tdisabled: \"disabled\",\n\t\t\tchildren: \"children\",\n\t\t}),\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult<ElSelectorOutput>>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n};\n\nexport const faSelectPageEmits = {\n\t...selectEmits,\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 FaSelectPageSlots = {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: ElSelectorOutput;\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: \"FaSelectPage\",\n\tprops: faSelectPageProps,\n\temits: faSelectPageEmits,\n\tslots: makeSlots<FaSelectPageSlots>(),\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\tselectedList: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 首次出现 */\n\t\t\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\n\t\t\tpageIndex: 1,\n\t\t\tpageSize: 15,\n\t\t\ttotalRows: 0,\n\t\t\tsearchValue: undefined,\n\t\t\tdefaultSelectorData: withDefineType<ElSelectorOutput>(),\n\t\t});\n\n\t\tconst selectRef = ref<InstanceType<typeof ElSelect>>();\n\n\t\tconst handleData = (data: ElSelectorOutput[]): ElSelectorOutput[] => {\n\t\t\treturn data\n\t\t\t\t?.map((m) => ({\n\t\t\t\t\t...m,\n\t\t\t\t\tvalue: m[props.valueKey],\n\t\t\t\t\tlabel: isFunction(props.props.label) ? props.props.label(m) : m[props.props.label ?? \"label\"],\n\t\t\t\t\thide: isFunction(props.props.hide) ? props.props.hide(m) : m[props.props.hide ?? \"hide\"],\n\t\t\t\t\tdisabled: isFunction(props.props.disabled) ? props.props.disabled(m) : m[props.props.disabled ?? \"disabled\"],\n\t\t\t\t\tchildren: isFunction(props.props.children)\n\t\t\t\t\t\t? handleData(props.props.children(m))\n\t\t\t\t\t\t: handleData(m[props.props.children ?? \"children\"]),\n\t\t\t\t}))\n\t\t\t\t.filter((f) => !f.hide);\n\t\t};\n\n\t\tconst loadData = async (pageIndex?: number): Promise<void> => {\n\t\t\tstate.loading = true;\n\t\t\tstate.pageIndex = pageIndex ?? state.pageIndex;\n\t\t\tconst params: PagedInput = {\n\t\t\t\t...(props.initParam ?? {}),\n\t\t\t\tpageIndex: state.pageIndex,\n\t\t\t\tpageSize: state.pageSize,\n\t\t\t\tsearchValue: state.searchValue,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\t// 这里不允许回显了\n\t\t\t\tstate.echo = false;\n\t\t\t\tstate.totalRows = resData.totalRows;\n\t\t\t\tstate.selectorData = handleData(resData.rows);\n\t\t\t\temit(\"dataChangeCallBack\", state.selectorData);\n\t\t\t} catch (error) {\n\t\t\t\tconsoleError(\"FaSelectPage\", error);\n\t\t\t\tstate.pageIndex = 1;\n\t\t\t\tstate.totalRows = 0;\n\t\t\t\tstate.selectorData = [];\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\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\tstate.selectedList = [];\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\tstate.selectedList = [...state.selectedList.filter((f) => !dataList.some((s) => s.value === f.value)), ...dataList]\n\t\t\t\t\t// 过滤不存在的\n\t\t\t\t\t.filter((f) => valueArr.includes(f.value));\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\tstate.selectedList = [];\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\tif (!state.selectedList.some((s) => s.value === value)) {\n\t\t\t\t\tstate.selectedList = [data];\n\t\t\t\t}\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\tstate.selectedList = [];\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\tawait 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\tif (!isArray(newValue)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectPage\", \"当启用 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(\"FaSelectPage\", \"当启用 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.selectedList = 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(\"FaSelectPage\", \"当禁用 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(\"FaSelectPage\", \"当禁用 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.defaultSelectorData = {\n\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\tlabel: props.label,\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(() => {\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});\n\n\t\tconst elSelectProps = useProps(props, SelectProps, [\"modelValue\", \"popperClass\", \"loading\"]);\n\t\tconst elSelectEmits = useEmits(selectEmits, emit, [\"update:modelValue\", \"change\", \"clear\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => {\n\t\t\tlet localClass = `fa-select-page-dropdown fa-select-page-dropdown-${_globalSize.value} ${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<ElSelect\n\t\t\t\t{...elSelectProps.value}\n\t\t\t\t{...elSelectEmits.value}\n\t\t\t\tref={selectRef}\n\t\t\t\tclass=\"fa-select-page\"\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\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\tdefault: (): VNode[] =>\n\t\t\t\t\t\tstate.selectorData.map((item) => (\n\t\t\t\t\t\t\t<FaSelectOption vSlots={{ default: slots.default }} data={item} moreDetail={props.moreDetail} />\n\t\t\t\t\t\t)),\n\t\t\t\t\theader: (): VNode[] => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{state.defaultSelectorData && (\n\t\t\t\t\t\t\t\t<ElOption\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__default-selector\"\n\t\t\t\t\t\t\t\t\tvalue={state.defaultSelectorData.value}\n\t\t\t\t\t\t\t\t\tlabel={state.defaultSelectorData.label}\n\t\t\t\t\t\t\t\t\tdisabled={true}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span>{state.defaultSelectorData.label}</span>\n\t\t\t\t\t\t\t\t\t<span>Default</span>\n\t\t\t\t\t\t\t\t</ElOption>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__search-input\"\n\t\t\t\t\t\t\t\t\tclearable\n\t\t\t\t\t\t\t\t\tplaceholder=\"请输入关键字搜索\"\n\t\t\t\t\t\t\t\t\tvModel_trim={state.searchValue}\n\t\t\t\t\t\t\t\t\tonKeyup={(event: KeyboardEvent) => {\n\t\t\t\t\t\t\t\t\t\tif (event.key === \"Enter\") {\n\t\t\t\t\t\t\t\t\t\t\tloadData(1);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\tappend: () => <ElButton loading={state.loading} icon={Search} onClick={() => loadData(1)}></ElButton>,\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t</ElInput>\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t{slots.header && slots.header()}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tfooter: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<ElPagination\n\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__pagination\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tcurrentPage={state.pageIndex}\n\t\t\t\t\t\t\t\tpageSize={state.pageSize}\n\t\t\t\t\t\t\t\ttotal={state.totalRows}\n\t\t\t\t\t\t\t\tlayout=\"prev, pager, next, total\"\n\t\t\t\t\t\t\t\tpagerCount={5}\n\t\t\t\t\t\t\t\tonCurrentChange={loadData}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{slots.footer && slots.footer()}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\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...(props.multiple\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] => {\n\t\t\t\t\t\t\t\t\tconst selectedData = state.selectedList.find((f) => f.value === value);\n\t\t\t\t\t\t\t\t\tif (slots.label) {\n\t\t\t\t\t\t\t\t\t\treturn slots.label({ label: selectedData?.label, value: isNil(selectedData) ? value : selectedData?.value });\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn selectedData && <span class=\"el-select__tags-text\">{selectedData.label}</span>;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: slots.label && {\n\t\t\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] =>\n\t\t\t\t\t\t\t\t\tslots.label({ label, value }),\n\t\t\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElSelect>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectRef.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectRef.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectRef.value?.selectedLabel),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 选中的数据 */\n\t\t\tselectedList: computed(() => state.selectedList),\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":["faSelectPageProps","SelectProps","disabled","type","Boolean","default","undefined","loadingText","String","noMatchText","noDataText","collapseTags","collapseTagsTooltip","modelValue","definePropType","Number","Object","Array","label","width","moreDetail","props","hide","children","requestApi","Function","initParam","faSelectPageEmits","selectEmits","value","isString","isNumber","isBoolean","isObject","isArray","isNull","dataChangeCallBack","data","change","SelectPage","name","emits","slots","makeSlots","setup","attrs","emit","expose","selectedLabel","useVModel","_globalSize","useGlobalSize","state","reactive","withDefineType","loading","selectorData","selectedList","debut","echo","nextRefresh","pageIndex","pageSize","totalRows","searchValue","defaultSelectorData","selectRef","ref","handleData","map","m","valueKey","isFunction","filter","f","loadData","async","params","resData","rows","error","consoleError","handleChange","multiple","valueArr","length","dataList","includes","some","s","isNil","find","handleClear","handleVisibleChange","visible","watch","newValue","hasLabel","slice","multipleLimit","item","index","immediate","onMounted","oldValue","isEqual","elSelectProps","useProps","elSelectEmits","useEmits","elPopperClass","computed","localClass","popperClass","useRender","_createVNode","ElSelect","_mergeProps","class","style","addUnit","$event","onChange","onClear","onVisibleChange","FaSelectOption","header","_Fragment","ElOption","_createTextVNode","ElInput","clearable","placeholder","modelModifiers","trim","onKeyup","event","key","append","ElButton","icon","Search","onClick","footer","ElPagination","size","currentPage","total","layout","pagerCount","onCurrentChange","prefix","empty","tag","selectedData","use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AAM7C,EAAUrC,OAAOmB,eAE/CO,QAASwD,EAAAA,SAAS,IAAM3D,EAAMG,SAE9BE,aAAcsD,EAAAA,SAAS,IAAM3D,EAAMK,cAEnCqG,QAASnF,EAEToF,aAAelI,GAAuFqD,EAAarD,GAEnHmI,eAAgBA,IAAM9E,EAAa,OAErC"}
|
|
1
|
+
{"version":3,"file":"selectPage.js","sources":["../../../../../packages/components/selectPage/src/selectPage.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { ElButton, ElInput, ElOption, ElPagination, ElSelect, selectEmits, useGlobalSize } from \"element-plus\";\nimport { Search } from \"@element-plus/icons-vue\";\nimport { FaSelectOption, SelectProps } from \"@fast-element-plus/components/select\";\nimport { type SelectComponentProps } from \"@fast-element-plus/components/select/src/select\";\nimport { addUnit, consoleError, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"@fast-china/utils\";\nimport { useVModel } from \"@vueuse/core\";\nimport { isArray, isBoolean, isEqual, isFunction, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport type { ElSelectorOutput } from \"@fast-element-plus/components/select\";\nimport type { PagedInput, PagedResult } from \"@fast-element-plus/components/table\";\nimport type { VNode } from \"vue\";\n\nexport const faSelectPageProps = {\n\t...SelectProps,\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 配置选项 */\n\tprops: {\n\t\ttype: definePropType<SelectComponentProps>(Object),\n\t\tdefault: (): Partial<SelectComponentProps> => ({\n\t\t\tlabel: \"label\",\n\t\t\thide: \"hide\",\n\t\t\tdisabled: \"disabled\",\n\t\t\tchildren: \"children\",\n\t\t}),\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult<ElSelectorOutput>>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n};\n\nexport const faSelectPageEmits = {\n\t...selectEmits,\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 FaSelectPageSlots = {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: ElSelectorOutput;\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: \"FaSelectPage\",\n\tprops: faSelectPageProps,\n\temits: faSelectPageEmits,\n\tslots: makeSlots<FaSelectPageSlots>(),\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\tselectedList: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 首次出现 */\n\t\t\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\n\t\t\tpageIndex: 1,\n\t\t\tpageSize: 15,\n\t\t\ttotalRows: 0,\n\t\t\tsearchValue: undefined,\n\t\t\tdefaultSelectorData: withDefineType<ElSelectorOutput>(),\n\t\t});\n\n\t\tconst selectRef = ref<InstanceType<typeof ElSelect>>();\n\n\t\tconst handleData = (data: ElSelectorOutput[]): ElSelectorOutput[] => {\n\t\t\treturn data\n\t\t\t\t?.map((m) => ({\n\t\t\t\t\t...m,\n\t\t\t\t\tvalue: m[props.valueKey],\n\t\t\t\t\tlabel: isFunction(props.props.label) ? props.props.label(m) : m[props.props.label ?? \"label\"],\n\t\t\t\t\thide: isFunction(props.props.hide) ? props.props.hide(m) : m[props.props.hide ?? \"hide\"],\n\t\t\t\t\tdisabled: isFunction(props.props.disabled) ? props.props.disabled(m) : m[props.props.disabled ?? \"disabled\"],\n\t\t\t\t\tchildren: isFunction(props.props.children)\n\t\t\t\t\t\t? handleData(props.props.children(m))\n\t\t\t\t\t\t: handleData(m[props.props.children ?? \"children\"]),\n\t\t\t\t}))\n\t\t\t\t.filter((f) => !f.hide);\n\t\t};\n\n\t\tconst loadData = async (pageIndex?: number): Promise<void> => {\n\t\t\tstate.loading = true;\n\t\t\tstate.pageIndex = pageIndex ?? state.pageIndex;\n\t\t\tconst params: PagedInput = {\n\t\t\t\t...(props.initParam ?? {}),\n\t\t\t\tpageIndex: state.pageIndex,\n\t\t\t\tpageSize: state.pageSize,\n\t\t\t\tsearchValue: state.searchValue,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\t// 这里不允许回显了\n\t\t\t\tstate.echo = false;\n\t\t\t\tstate.totalRows = resData.totalRows;\n\t\t\t\tstate.selectorData = handleData(resData.rows);\n\t\t\t\temit(\"dataChangeCallBack\", state.selectorData);\n\t\t\t} catch (error) {\n\t\t\t\tconsoleError(\"FaSelectPage\", error);\n\t\t\t\tstate.pageIndex = 1;\n\t\t\t\tstate.totalRows = 0;\n\t\t\t\tstate.selectorData = [];\n\t\t\t} finally {\n\t\t\t\tstate.loading = false;\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\tstate.selectedList = [];\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\tstate.selectedList = [...state.selectedList.filter((f) => !dataList.some((s) => s.value === f.value)), ...dataList]\n\t\t\t\t\t// 过滤不存在的\n\t\t\t\t\t.filter((f) => valueArr.includes(f.value));\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\tstate.selectedList = [];\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\tif (!state.selectedList.some((s) => s.value === value)) {\n\t\t\t\t\tstate.selectedList = [data];\n\t\t\t\t}\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\tstate.selectedList = [];\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\tawait 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\tif (!isArray(newValue)) {\n\t\t\t\t\t\t\tconsoleError(\"FaSelectPage\", \"当启用 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(\"FaSelectPage\", \"当启用 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.selectedList = 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(\"FaSelectPage\", \"当禁用 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(\"FaSelectPage\", \"当禁用 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.defaultSelectorData = {\n\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\tlabel: props.label,\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(() => {\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});\n\n\t\tconst elSelectProps = useProps(props, SelectProps, [\"modelValue\", \"popperClass\", \"loading\"]);\n\t\tconst elSelectEmits = useEmits(selectEmits, emit, [\"update:modelValue\", \"change\", \"clear\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => {\n\t\t\tlet localClass = `fa-select-page-dropdown fa-select-page-dropdown-${_globalSize.value} ${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<ElSelect\n\t\t\t\t{...elSelectProps.value}\n\t\t\t\t{...elSelectEmits.value}\n\t\t\t\tref={selectRef}\n\t\t\t\tclass=\"fa-select-page\"\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\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\tdefault: (): VNode[] =>\n\t\t\t\t\t\tstate.selectorData.map((item) => (\n\t\t\t\t\t\t\t<FaSelectOption vSlots={{ default: slots.default }} data={item} moreDetail={props.moreDetail} />\n\t\t\t\t\t\t)),\n\t\t\t\t\theader: (): VNode[] => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{state.defaultSelectorData && (\n\t\t\t\t\t\t\t\t<ElOption\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__default-selector\"\n\t\t\t\t\t\t\t\t\tvalue={state.defaultSelectorData.value}\n\t\t\t\t\t\t\t\t\tlabel={state.defaultSelectorData.label}\n\t\t\t\t\t\t\t\t\tdisabled={true}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span>{state.defaultSelectorData.label}</span>\n\t\t\t\t\t\t\t\t\t<span>Default</span>\n\t\t\t\t\t\t\t\t</ElOption>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__search-input\"\n\t\t\t\t\t\t\t\t\tclearable\n\t\t\t\t\t\t\t\t\tplaceholder=\"请输入关键字搜索\"\n\t\t\t\t\t\t\t\t\tvModel_trim={state.searchValue}\n\t\t\t\t\t\t\t\t\tonKeyup={(event: KeyboardEvent) => {\n\t\t\t\t\t\t\t\t\t\tif (event.key === \"Enter\") {\n\t\t\t\t\t\t\t\t\t\t\tloadData(1);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\tappend: () => <ElButton loading={state.loading} icon={Search} onClick={() => loadData(1)}></ElButton>,\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t</ElInput>\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t{slots.header && slots.header()}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\tfooter: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<ElPagination\n\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__pagination\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tcurrentPage={state.pageIndex}\n\t\t\t\t\t\t\t\tpageSize={state.pageSize}\n\t\t\t\t\t\t\t\ttotal={state.totalRows}\n\t\t\t\t\t\t\t\tlayout=\"prev, pager, next, total\"\n\t\t\t\t\t\t\t\tpagerCount={5}\n\t\t\t\t\t\t\t\tonCurrentChange={loadData}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{slots.footer && slots.footer()}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\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...(props.multiple\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] => {\n\t\t\t\t\t\t\t\t\tconst selectedData = state.selectedList.find((f) => f.value === value);\n\t\t\t\t\t\t\t\t\tif (slots.label) {\n\t\t\t\t\t\t\t\t\t\treturn slots.label({ label: selectedData?.label, value: isNil(selectedData) ? value : selectedData?.value });\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn selectedData && <span class=\"el-select__tags-text\">{selectedData.label}</span>;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: slots.label && {\n\t\t\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] =>\n\t\t\t\t\t\t\t\t\tslots.label({ label, value }),\n\t\t\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElSelect>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectRef.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectRef.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectRef.value?.selectedLabel),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 选中的数据 */\n\t\t\tselectedList: computed(() => state.selectedList),\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":["faSelectPageProps","SelectProps","disabled","type","Boolean","default","undefined","loadingText","String","noMatchText","noDataText","collapseTags","collapseTagsTooltip","modelValue","definePropType","Number","Object","Array","label","width","moreDetail","props","hide","children","requestApi","Function","initParam","faSelectPageEmits","selectEmits","value","isString","isNumber","isBoolean","isObject","isArray","isNull","dataChangeCallBack","data","change","SelectPage","name","emits","slots","makeSlots","setup","attrs","emit","expose","selectedLabel","useVModel","passive","_globalSize","useGlobalSize","state","reactive","withDefineType","loading","selectorData","selectedList","debut","echo","nextRefresh","pageIndex","pageSize","totalRows","searchValue","defaultSelectorData","selectRef","ref","handleData","map","m","valueKey","isFunction","filter","f","loadData","async","params","resData","rows","error","consoleError","handleChange","multiple","valueArr","length","dataList","includes","some","s","isNil","find","handleClear","handleVisibleChange","visible","watch","newValue","hasLabel","slice","multipleLimit","item","index","immediate","onMounted","oldValue","isEqual","elSelectProps","useProps","elSelectEmits","useEmits","elPopperClass","computed","localClass","popperClass","useRender","_createVNode","ElSelect","_mergeProps","class","style","addUnit","$event","onChange","onClear","onVisibleChange","FaSelectOption","header","_Fragment","ElOption","_createTextVNode","ElInput","clearable","placeholder","modelModifiers","trim","onKeyup","event","key","append","ElButton","icon","Search","onClick","footer","ElPagination","size","currentPage","total","layout","pagerCount","onCurrentChange","prefix","empty","tag","selectedData","useExpose","focus","blur","refresh","setSelection","clearSelection"],"mappings":"kWAYaA,EAAoB,IAC7BC,EAAAA,YAEHC,SAAU,CACTC,KAAMC,QACNC,aAASC,GAGVC,YAAa,CACZJ,KAAMK,OACNH,QAAS,UAGVI,YAAa,CACZN,KAAMK,OACNH,QAAS,WAGVK,WAAY,CACXP,KAAMK,OACNH,QAAS,QAGVM,aAAc,CACbR,KAAMC,QACNC,SAAS,GAGVO,oBAAqB,CACpBT,KAAMC,QACNC,SAAS,GAGVQ,WAAY,CACXV,KAAMW,EAAAA,eAA4F,CAACN,OAAQO,OAAQX,QAASY,OAAQC,QACpIZ,aAASC,GAGVY,MAAOJ,EAAAA,eAAkC,CAACN,OAAQS,QAElDE,MAAO,CACNhB,KAAM,CAACK,OAAQO,QACfV,QAAS,QAGVe,WAAYhB,QAEZiB,MAAO,CACNlB,KAAMW,EAAAA,eAAqCE,QAC3CX,QAASA,KAAAA,CACRa,MAAO,QACPI,KAAM,OACNpB,SAAU,WACVqB,SAAU,cAIZC,WAAY,CACXrB,KAAMW,EAAAA,eAAgFW,WAGvFC,UAAWZ,EAAAA,eAAsC,CAACN,OAAQO,OAAQC,UAGtDW,EAAoB,IAC7BC,EAAAA,YAEH,oBAAsBC,GACrBC,WAASD,IAAUE,EAAAA,SAASF,IAAUG,EAAAA,UAAUH,IAAUI,EAAAA,SAASJ,IAAUK,EAAAA,QAAQL,IAAUM,EAAAA,OAAON,GAEvG,eAAiBA,GAAsCC,EAAAA,SAASD,IAAUK,EAAAA,QAAQL,IAAUM,EAAAA,OAAON,GAEnGO,mBAAqBC,GAA8CH,EAAAA,QAAQG,GAE3EC,OAAQA,CACPD,EACAR,KACa,GAsBfU,oBAA+B,CAC9BC,KAAM,eACNnB,MAAOrB,EACPyC,MAAOd,EACPe,MAAOC,EAAAA,YACPC,KAAAA,CAAMvB,GAAOwB,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CC,KAAM9C,EAAAA,SAAS,IAAM7C,EAAUtC,OAAOiI,MAEtC9G,cAAegE,EAAAA,SAAS,IAAM7C,EAAUtC,OAAOmB,eAE/CQ,QAASwD,EAAAA,SAAS,IAAM3D,EAAMG,SAE9BE,aAAcsD,EAAAA,SAAS,IAAM3D,EAAMK,cAEnCqG,QAASnF,EAEToF,aAAenI,GAAuFsD,EAAatD,GAEnHoI,eAAgBA,IAAM9E,EAAa,OAErC"}
|
|
@@ -278,7 +278,7 @@ export declare const SelectV2Props: {
|
|
|
278
278
|
* @description tabindex for input
|
|
279
279
|
*/
|
|
280
280
|
tabindex: {
|
|
281
|
-
type: (
|
|
281
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
282
282
|
default: number;
|
|
283
283
|
};
|
|
284
284
|
/**
|
|
@@ -335,7 +335,7 @@ export declare const faSelectV2Props: {
|
|
|
335
335
|
label: import('vue').PropType<string | string[]>;
|
|
336
336
|
/** @description 宽度 */
|
|
337
337
|
width: {
|
|
338
|
-
type: (
|
|
338
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
339
339
|
default: string;
|
|
340
340
|
};
|
|
341
341
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -607,7 +607,7 @@ export declare const faSelectV2Props: {
|
|
|
607
607
|
* @description tabindex for input
|
|
608
608
|
*/
|
|
609
609
|
tabindex: {
|
|
610
|
-
type: (
|
|
610
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
611
611
|
default: number;
|
|
612
612
|
};
|
|
613
613
|
/**
|
|
@@ -695,7 +695,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
695
695
|
label: import('vue').PropType<string | string[]>;
|
|
696
696
|
/** @description 宽度 */
|
|
697
697
|
width: {
|
|
698
|
-
type: (
|
|
698
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
699
699
|
default: string;
|
|
700
700
|
};
|
|
701
701
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -967,7 +967,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
967
967
|
* @description tabindex for input
|
|
968
968
|
*/
|
|
969
969
|
tabindex: {
|
|
970
|
-
type: (
|
|
970
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
971
971
|
default: number;
|
|
972
972
|
};
|
|
973
973
|
/**
|
|
@@ -1043,7 +1043,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1043
1043
|
label: import('vue').PropType<string | string[]>;
|
|
1044
1044
|
/** @description 宽度 */
|
|
1045
1045
|
width: {
|
|
1046
|
-
type: (
|
|
1046
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
1047
1047
|
default: string;
|
|
1048
1048
|
};
|
|
1049
1049
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -1315,7 +1315,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1315
1315
|
* @description tabindex for input
|
|
1316
1316
|
*/
|
|
1317
1317
|
tabindex: {
|
|
1318
|
-
type: (
|
|
1318
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
1319
1319
|
default: number;
|
|
1320
1320
|
};
|
|
1321
1321
|
/**
|
|
@@ -1371,6 +1371,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1371
1371
|
persistent: boolean;
|
|
1372
1372
|
height: number;
|
|
1373
1373
|
fallbackPlacements: Placement[];
|
|
1374
|
+
filterable: boolean;
|
|
1374
1375
|
moreDetail: boolean;
|
|
1375
1376
|
loadingText: string;
|
|
1376
1377
|
noMatchText: string;
|
|
@@ -1380,7 +1381,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1380
1381
|
defaultSelected: boolean;
|
|
1381
1382
|
valueOnClear: import('element-plus/es/utils/index.mjs').EpPropMergeType<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown>;
|
|
1382
1383
|
automaticDropdown: boolean;
|
|
1383
|
-
filterable: boolean;
|
|
1384
1384
|
allowCreate: boolean;
|
|
1385
1385
|
remote: boolean;
|
|
1386
1386
|
multiple: boolean;
|
|
@@ -1391,9 +1391,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1391
1391
|
maxCollapseTags: number;
|
|
1392
1392
|
tagType: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "primary" | "success" | "warning" | "info" | "danger", unknown>;
|
|
1393
1393
|
tagEffect: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "plain" | "dark" | "light", unknown>;
|
|
1394
|
-
scrollbarAlwaysOn: boolean;
|
|
1395
1394
|
pageResult: boolean;
|
|
1396
1395
|
estimatedOptionHeight: number;
|
|
1397
1396
|
itemHeight: number;
|
|
1397
|
+
scrollbarAlwaysOn: boolean;
|
|
1398
1398
|
}, import('vue').SlotsType<Partial<import('@fast-china/utils').MakeSlots<FaSelectV2Slots>>>, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
1399
1399
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("element-plus"),t=require("@element-plus/icons-vue"),a=require("@fast-china/utils"),o=require("@vueuse/core"),r=require("lodash-unified"),i={allowCreate:Boolean,autocomplete:{type:a.definePropType(String),default:"none"},automaticDropdown:Boolean,clearable:Boolean,clearIcon:{type:a.definePropType([String,Object,Function]),default:t.CircleClose},effect:{type:a.definePropType(String),default:"light"},collapseTags:Boolean,collapseTagsTooltip:Boolean,maxCollapseTags:{type:Number,default:1},defaultFirstOption:Boolean,disabled:Boolean,estimatedOptionHeight:{type:Number,default:void 0},filterable:Boolean,filterMethod:Function,height:{type:Number,default:274},itemHeight:{type:Number,default:34},id:String,loading:Boolean,loadingText:String,modelValue:{type:a.definePropType([Array,String,Number,Boolean,Object])},multiple:Boolean,multipleLimit:{type:Number,default:0},name:String,noDataText:String,noMatchText:String,remoteMethod:Function,reserveKeyword:{type:Boolean,default:!0},options:{type:a.definePropType(Array)},placeholder:{type:String},teleported:l.useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0},popperClass:{type:String,default:""},popperOptions:{type:a.definePropType(Object),default:()=>({})},remote:Boolean,size:l.useSizeProp,props:{type:a.definePropType(Object),default:()=>({label:"label",value:"value",disabled:"disabled",options:"options"})},valueKey:{type:String,default:"value"},scrollbarAlwaysOn:Boolean,validateEvent:{type:Boolean,default:!0},offset:{type:Number,default:12},showArrow:{type:Boolean,default:!0},placement:{type:a.definePropType(String),default:"bottom-start"},fallbackPlacements:{type:a.definePropType(Array),default:["bottom-start","top-start","right","left"]},tagType:{...l.tagProps.type,default:"info"},tagEffect:{...l.tagProps.effect,default:"light"},tabindex:{type:[String,Number],default:0},appendTo:String,...l.useEmptyValuesProps,...l.useAriaProps(["ariaLabel"])},u={"update:modelValue":e=>!0,change:e=>!0,"remove-tag":e=>!0,"visible-change":e=>!0,focus:e=>!0,blur:e=>!0,clear:()=>!0},n={...i,disabled:{type:Boolean,default:void 0},loadingText:{type:String,default:"加载中..."},noMatchText:{type:String,default:"暂无匹配的数据"},noDataText:{type:String,default:"暂无数据"},collapseTags:{type:Boolean,default:!0},collapseTagsTooltip:{type:Boolean,default:!0},modelValue:{type:a.definePropType([String,Number,Boolean,Object,Array]),default:void 0},label:a.definePropType([String,Array]),width:{type:[String,Number],default:"100%"},moreDetail:Boolean,lazy:{type:Boolean,default:!0},defaultSelected:Boolean,data:{type:a.definePropType(Array),default:()=>[]},pageResult:Boolean,requestApi:{type:a.definePropType(Function)},initParam:a.definePropType([String,Number,Object])},s={...u,"update:modelValue":e=>r.isString(e)||r.isNumber(e)||r.isBoolean(e)||r.isObject(e)||r.isArray(e)||r.isNull(e),"update:label":e=>r.isString(e)||r.isArray(e)||r.isNull(e),dataChangeCallBack:e=>r.isArray(e),change:(e,l)=>!0},d=e.defineComponent({name:"FaSelectV2",props:n,emits:s,slots:a.makeSlots(),setup(t,{attrs:u,slots:n,emit:d,expose:p}){const c=o.useVModel(t,"label",d),f=l.useGlobalSize(),m=e.reactive({value:a.withDefineType(),loading:!1,selectorData:a.withDefineType([]),debut:!0,echo:!(t.data?.length>0),nextRefresh:!1}),y=e.ref(),g=async()=>{if(t.requestApi){m.loading=!0;const l=t.initParam??{};try{const e=await t.requestApi(l);m.echo=!1,t.pageResult?m.selectorData=e.rows:m.selectorData=e,d("dataChangeCallBack",m.selectorData)}catch(e){a.consoleError("FaSelect",e),m.selectorData=[]}finally{m.loading=!1}}else m.echo=!1,m.selectorData=t.data},b=e=>{if(t.multiple){const l=e;if(0===l?.length)return m.value=null,c.value=null,d("update:modelValue",null),void d("change",null,null);const t=m.selectorData.filter(e=>l.includes(e.value));m.value=e,c.value=t.map(e=>e.label),d("update:modelValue",e),d("change",t,e)}else{if(r.isNil(e))return m.value=null,c.value=null,d("update:modelValue",null),void d("change",null,null);const l=m.selectorData.find(l=>l.value===e);m.value=e,c.value=l.label,d("update:modelValue",e),d("change",l,e)}},v=()=>{m.value=null,c.value=null,d("update:modelValue",null),d("clear")},h=async e=>{e&&(m.debut?(m.debut=!1,!t.defaultSelected&&t.lazy&&await g()):m.nextRefresh&&(m.nextRefresh=!1,await g())),d("visible-change",e)};e.watch(()=>t.modelValue,e=>{if(m.echo&&!r.isNil(e)){const l=!r.isNil(t.label);if(t.multiple){if(!r.isArray(e))return void a.consoleError("FaSelectV2","当启用 multiple 时,传入的 modelValue 必须是Array。");if(l&&!r.isArray(t.label))return void a.consoleError("FaSelectV2","当启用 multiple 时,传入的 modelValue:label 必须是Array。");m.selectorData=e.slice(0,t.multipleLimit>0?t.multipleLimit:e.length).map((e,a)=>({value:e,label:l?t.label[a]:void 0}))}else{if(r.isArray(e))return void a.consoleError("FaSelectV2","当禁用 multiple 时,传入的 modelValue 不能是Array。");if(l&&r.isArray(t.label))return void a.consoleError("FaSelectV2","当禁用 multiple 时,传入的 modelValue:label 不能是Array。");m.selectorData=[{value:e,label:t.label}]}}m.value=e},{immediate:!0}),e.onMounted(async()=>{t.defaultSelected?(await g(),m.selectorData.length>0&&b(t.multiple?[m.selectorData[0].value]:m.selectorData[0].value)):!t.requestApi&&t.data?.length>0?(m.debut=!1,await g()):t.lazy||await g(),e.watch(()=>t.initParam,(e,l)=>{r.isEqual(e,l)||(m.nextRefresh=!0,r.isNil(m.value)||b())}),e.watch(()=>t.data,async()=>{t.requestApi||await g()},{deep:!0})});const S=a.useProps(t,i,["modelValue","popperClass","loading","options","itemHeight"]),T=a.useEmits(s,d,["update:modelValue","change","clear","visible-change"]),V=e.computed(()=>{let e=`fa-select-v2-dropdown ${t.popperClass}`;return t.moreDetail&&(e+=` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${f.value}`),e});return a.useRender(()=>e.createVNode(l.ElSelectV2,e.mergeProps(S.value,T.value,{ref:y,class:"fa-select-v2",popperClass:V.value,style:{width:a.addUnit(t.width)},modelValue:m.value,"onUpdate:modelValue":e=>m.value=e,loading:m.loading,options:m.selectorData,itemHeight:t.itemHeight+("small"===f.value?0:8),onChange:b,onClear:v,onVisibleChange:h}),{...n.default&&{default:({item:e,index:l,disabled:t})=>n.default({item:e,index:l,disabled:t})},...n.header&&{header:()=>n.header()},...n.footer&&{footer:()=>n.footer()},...n.prefix&&{prefix:()=>n.prefix()},...n.empty&&{empty:()=>n.empty()},...n.tag&&{tag:()=>n.tag()},...n.loading&&{loading:()=>n.loading()},...n.label&&{label:({label:e,value:l})=>n.label({label:e,value:l})}})),a.useExpose(p,{focus:e.computed(()=>y.value?.focus),blur:e.computed(()=>y.value?.blur),selectedLabel:e.computed(()=>y.value?.selectedLabel),loading:e.computed(()=>m.loading),refresh:g,setSelection:e=>b(e),clearSelection:()=>b(null)})}});exports.SelectV2Props=i,exports.default=d,exports.faSelectV2Emits=s,exports.faSelectV2Props=n,exports.selectV2Emits=u;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("element-plus"),t=require("@element-plus/icons-vue"),a=require("@fast-china/utils"),o=require("@vueuse/core"),r=require("lodash-unified"),i={allowCreate:Boolean,autocomplete:{type:a.definePropType(String),default:"none"},automaticDropdown:Boolean,clearable:Boolean,clearIcon:{type:a.definePropType([String,Object,Function]),default:t.CircleClose},effect:{type:a.definePropType(String),default:"light"},collapseTags:Boolean,collapseTagsTooltip:Boolean,maxCollapseTags:{type:Number,default:1},defaultFirstOption:Boolean,disabled:Boolean,estimatedOptionHeight:{type:Number,default:void 0},filterable:Boolean,filterMethod:Function,height:{type:Number,default:274},itemHeight:{type:Number,default:34},id:String,loading:Boolean,loadingText:String,modelValue:{type:a.definePropType([Array,String,Number,Boolean,Object])},multiple:Boolean,multipleLimit:{type:Number,default:0},name:String,noDataText:String,noMatchText:String,remoteMethod:Function,reserveKeyword:{type:Boolean,default:!0},options:{type:a.definePropType(Array)},placeholder:{type:String},teleported:l.useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0},popperClass:{type:String,default:""},popperOptions:{type:a.definePropType(Object),default:()=>({})},remote:Boolean,size:l.useSizeProp,props:{type:a.definePropType(Object),default:()=>({label:"label",value:"value",disabled:"disabled",options:"options"})},valueKey:{type:String,default:"value"},scrollbarAlwaysOn:Boolean,validateEvent:{type:Boolean,default:!0},offset:{type:Number,default:12},showArrow:{type:Boolean,default:!0},placement:{type:a.definePropType(String),default:"bottom-start"},fallbackPlacements:{type:a.definePropType(Array),default:["bottom-start","top-start","right","left"]},tagType:{...l.tagProps.type,default:"info"},tagEffect:{...l.tagProps.effect,default:"light"},tabindex:{type:[String,Number],default:0},appendTo:String,...l.useEmptyValuesProps,...l.useAriaProps(["ariaLabel"])},u={"update:modelValue":e=>!0,change:e=>!0,"remove-tag":e=>!0,"visible-change":e=>!0,focus:e=>!0,blur:e=>!0,clear:()=>!0},n={...i,disabled:{type:Boolean,default:void 0},loadingText:{type:String,default:"加载中..."},noMatchText:{type:String,default:"暂无匹配的数据"},noDataText:{type:String,default:"暂无数据"},collapseTags:{type:Boolean,default:!0},collapseTagsTooltip:{type:Boolean,default:!0},modelValue:{type:a.definePropType([String,Number,Boolean,Object,Array]),default:void 0},label:a.definePropType([String,Array]),width:{type:[String,Number],default:"100%"},moreDetail:Boolean,lazy:{type:Boolean,default:!0},defaultSelected:Boolean,data:{type:a.definePropType(Array),default:()=>[]},pageResult:Boolean,requestApi:{type:a.definePropType(Function)},initParam:a.definePropType([String,Number,Object])},s={...u,"update:modelValue":e=>r.isString(e)||r.isNumber(e)||r.isBoolean(e)||r.isObject(e)||r.isArray(e)||r.isNull(e),"update:label":e=>r.isString(e)||r.isArray(e)||r.isNull(e),dataChangeCallBack:e=>r.isArray(e),change:(e,l)=>!0},d=e.defineComponent({name:"FaSelectV2",props:n,emits:s,slots:a.makeSlots(),setup(t,{attrs:u,slots:n,emit:d,expose:p}){const c=o.useVModel(t,"label",d,{passive:!0}),f=l.useGlobalSize(),m=e.reactive({value:a.withDefineType(),loading:!1,selectorData:a.withDefineType([]),debut:!0,echo:!(t.data?.length>0),nextRefresh:!1}),y=e.ref(),g=async()=>{if(t.requestApi){m.loading=!0;const l=t.initParam??{};try{const e=await t.requestApi(l);m.echo=!1,t.pageResult?m.selectorData=e.rows:m.selectorData=e,d("dataChangeCallBack",m.selectorData)}catch(e){a.consoleError("FaSelect",e),m.selectorData=[]}finally{m.loading=!1}}else m.echo=!1,m.selectorData=t.data},b=e=>{if(t.multiple){const l=e;if(0===l?.length)return m.value=null,c.value=null,d("update:modelValue",null),void d("change",null,null);const t=m.selectorData.filter(e=>l.includes(e.value));m.value=e,c.value=t.map(e=>e.label),d("update:modelValue",e),d("change",t,e)}else{if(r.isNil(e))return m.value=null,c.value=null,d("update:modelValue",null),void d("change",null,null);const l=m.selectorData.find(l=>l.value===e);m.value=e,c.value=l.label,d("update:modelValue",e),d("change",l,e)}},v=()=>{m.value=null,c.value=null,d("update:modelValue",null),d("clear")},h=async e=>{e&&(m.debut?(m.debut=!1,!t.defaultSelected&&t.lazy&&await g()):m.nextRefresh&&(m.nextRefresh=!1,await g())),d("visible-change",e)};e.watch(()=>t.modelValue,e=>{if(m.echo&&!r.isNil(e)){const l=!r.isNil(t.label);if(t.multiple){if(!r.isArray(e))return void a.consoleError("FaSelectV2","当启用 multiple 时,传入的 modelValue 必须是Array。");if(l&&!r.isArray(t.label))return void a.consoleError("FaSelectV2","当启用 multiple 时,传入的 modelValue:label 必须是Array。");m.selectorData=e.slice(0,t.multipleLimit>0?t.multipleLimit:e.length).map((e,a)=>({value:e,label:l?t.label[a]:void 0}))}else{if(r.isArray(e))return void a.consoleError("FaSelectV2","当禁用 multiple 时,传入的 modelValue 不能是Array。");if(l&&r.isArray(t.label))return void a.consoleError("FaSelectV2","当禁用 multiple 时,传入的 modelValue:label 不能是Array。");m.selectorData=[{value:e,label:t.label}]}}m.value=e},{immediate:!0}),e.onMounted(async()=>{t.defaultSelected?(await g(),m.selectorData.length>0&&b(t.multiple?[m.selectorData[0].value]:m.selectorData[0].value)):!t.requestApi&&t.data?.length>0?(m.debut=!1,await g()):t.lazy||await g(),e.watch(()=>t.initParam,(e,l)=>{r.isEqual(e,l)||(m.nextRefresh=!0,r.isNil(m.value)||b())}),e.watch(()=>t.data,async()=>{t.requestApi||await g()},{deep:!0})});const S=a.useProps(t,i,["modelValue","popperClass","loading","options","itemHeight"]),T=a.useEmits(s,d,["update:modelValue","change","clear","visible-change"]),V=e.computed(()=>{let e=`fa-select-v2-dropdown ${t.popperClass}`;return t.moreDetail&&(e+=` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${f.value}`),e});return a.useRender(()=>e.createVNode(l.ElSelectV2,e.mergeProps(S.value,T.value,{ref:y,class:"fa-select-v2",popperClass:V.value,style:{width:a.addUnit(t.width)},modelValue:m.value,"onUpdate:modelValue":e=>m.value=e,loading:m.loading,options:m.selectorData,itemHeight:t.itemHeight+("small"===f.value?0:8),onChange:b,onClear:v,onVisibleChange:h}),{...n.default&&{default:({item:e,index:l,disabled:t})=>n.default({item:e,index:l,disabled:t})},...n.header&&{header:()=>n.header()},...n.footer&&{footer:()=>n.footer()},...n.prefix&&{prefix:()=>n.prefix()},...n.empty&&{empty:()=>n.empty()},...n.tag&&{tag:()=>n.tag()},...n.loading&&{loading:()=>n.loading()},...n.label&&{label:({label:e,value:l})=>n.label({label:e,value:l})}})),a.useExpose(p,{focus:e.computed(()=>y.value?.focus),blur:e.computed(()=>y.value?.blur),selectedLabel:e.computed(()=>y.value?.selectedLabel),loading:e.computed(()=>m.loading),refresh:g,setSelection:e=>b(e),clearSelection:()=>b(null)})}});exports.SelectV2Props=i,exports.default=d,exports.faSelectV2Emits=s,exports.faSelectV2Props=n,exports.selectV2Emits=u;
|
|
2
2
|
//# sourceMappingURL=selectV2.js.map
|