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":"index.js","sources":["../../../../packages/components/button/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport Button, { faButtonEmits, faButtonProps } from \"./src/button\";\nimport type { ExtractPropTypes } from \"vue\";\n\nexport const FaButton = withInstall(Button);\nexport default
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../packages/components/button/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport Button, { faButtonEmits, faButtonProps } from \"./src/button\";\nimport type { ExtractPropTypes } from \"vue\";\n\nexport const FaButton = withInstall(Button);\nexport default FaButton;\n\nexport { faButtonProps, faButtonEmits };\n\nexport type FaButtonInstance = InstanceType<typeof Button>;\n\nexport type FaButtonProps = ExtractPropTypes<typeof faButtonProps>;\n\nexport type FaButtonEmits = typeof faButtonEmits;\n"],"names":["FaButton","withInstall","Button"],"mappings":"8KAIaA,EAAWC,EAAAA,YAAYC,EAAAA"}
|
|
@@ -95,7 +95,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
95
95
|
/** @description 按钮 html 元素 */
|
|
96
96
|
ref: import('vue').ComputedRef<HTMLButtonElement>;
|
|
97
97
|
/** @description 按钮尺寸 */
|
|
98
|
-
size: import('vue').ComputedRef<"" | "
|
|
98
|
+
size: import('vue').ComputedRef<"" | "default" | "small" | "large">;
|
|
99
99
|
/** @description 按钮类型 */
|
|
100
100
|
type: import('vue').ComputedRef<"" | "default" | "text" | "primary" | "success" | "warning" | "info" | "danger">;
|
|
101
101
|
/** @description 按钮已禁用 */
|
|
@@ -2,7 +2,7 @@ import { TSXWithInstall } from "@fast-china/utils";
|
|
|
2
2
|
import { default as CarNumber } from "./src/carNumber";
|
|
3
3
|
|
|
4
4
|
export declare const FaCarNumber: TSXWithInstall<typeof CarNumber>;
|
|
5
|
-
export default
|
|
5
|
+
export default FaCarNumber;
|
|
6
6
|
|
|
7
7
|
export * from "./src/common";
|
|
8
8
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@fast-china/utils"),r=require("./src/carNumber.js"),t=require("./src/common.js"),a=e.withInstall(r.default);exports.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@fast-china/utils"),r=require("./src/carNumber.js"),t=require("./src/common.js"),a=e.withInstall(r.default);exports.CarNumberArea=t.CarNumberArea,exports.CarNumberDigit=t.CarNumberDigit,exports.CarNumberLetter=t.CarNumberLetter,exports.FaCarNumber=a,exports.default=a;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../packages/components/carNumber/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport CarNumber from \"./src/carNumber\";\n\nexport const FaCarNumber = withInstall(CarNumber);\nexport default
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../packages/components/carNumber/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport CarNumber from \"./src/carNumber\";\n\nexport const FaCarNumber = withInstall(CarNumber);\nexport default FaCarNumber;\n\nexport * from \"./src/common\";\n\nexport type FaCarNumberInstance = InstanceType<typeof CarNumber>;\n"],"names":["FaCarNumber","withInstall","CarNumber"],"mappings":"8MAGaA,EAAcC,EAAAA,YAAYC,EAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("element-plus"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("element-plus"),a=require("@element-plus/icons-vue");require("../../../constants/index.js");const r=require("@fast-china/utils"),l=require("lodash-unified"),o=require("./common.js"),u=require("@vueuse/core"),n=require("../../../constants/regex.js");function i(t){return"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!e.isVNode(t)}const s=e.defineComponent({name:"FaCarNumber",props:{...t.inputProps,modelValue:{type:String,default:void 0},placeholder:{type:String,default:"请选择"}},emits:{"update:modelValue":e=>l.isString(e)||l.isNull(e),change:e=>l.isString(e)||l.isNull(e)},setup(l,{attrs:s,slots:d,emit:c,expose:p}){const v=u.useVModel(l,"modelValue",c,{passive:!0}),m=e.reactive({switchLetter:e.computed(()=>v.value?.length>=1),disabledButton:e.computed(()=>v.value?.length>=8)}),_=e.ref(),b=e.inject(t.formContextKey,void 0),f=e.inject(t.formItemContextKey,void 0),g=e=>2===e.length?`${e} ● `:e.length>2?`${e.slice(0,2)} ● ${e.slice(2)}`:e,h=e=>{v.value??="",v.value+=e},N=()=>{0!==v.value?.length&&(v.value=v.value.substring(0,v.value.length-1))},V=()=>{let e=!1;7===v.value.length?e=n.RegExps.CarNumber.test(v.value):8===v.value.length&&(e=n.RegExps.NewEnergyCarNumber.test(v.value)),e?(c("change",v.value),f?.prop&&b?.validateField([f.prop])):f?.prop&&b?(c("change",v.value),b.validateField([f.prop])):t.ElMessage.error("车牌号格式不正确"),_.value?.hide()},C=()=>{v.value=null,c("change",null),f?.prop&&b?.validateField([f.prop])},y=r.useProps(l,t.inputProps,["modelValue","readonly","formatter"]);r.useRender(()=>e.createVNode(t.ElPopover,{ref:_,width:"auto",popperClass:"fa-car-number__popover",trigger:"click",showArrow:!1,showAfter:0,hideAfter:0},{reference:()=>e.createVNode(t.ElInput,e.mergeProps(y.value,{class:"fa-car-number__input",modelValue:v.value,"onUpdate:modelValue":e=>v.value=e,readonly:!0,formatter:g}),null),default:()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{class:["fa-car-number__popover__area",m.switchLetter?"fa-car-number__popover__hide":""]},[o.CarNumberArea.map(a=>e.createVNode(t.ElButton,{disabled:m.disabledButton,onClick:()=>h(a)},i(a)?a:{default:()=>[a]}))]),e.createVNode("div",{class:["fa-car-number__popover__digit-letter",m.switchLetter?"":"fa-car-number__popover__hide"]},[o.CarNumberDigit.map(a=>e.createVNode(t.ElButton,{disabled:m.disabledButton,onClick:()=>h(a)},i(a)?a:{default:()=>[a]})),o.CarNumberLetter.map(a=>e.createVNode(t.ElButton,{disabled:m.disabledButton,onClick:()=>h(a)},i(a)?a:{default:()=>[a]}))]),e.createVNode("div",{class:"fa-car-number__popover__btn"},[e.createVNode(t.ElButton,{class:"fa-car-number__popover__btn__clear",disabled:null===v.value||0===v.value.length,onClick:C},{default:()=>[e.createTextVNode("清除")]}),e.createVNode(t.ElButton,{class:"fa-car-number__popover__btn__back",type:"danger",icon:a.Back,disabled:null===v.value||0===v.value.length,onClick:N},null),e.createVNode(t.ElButton,{class:"fa-car-number__popover__btn__confirm",type:"primary",disabled:null===v.value||v.value.length<7,onClick:V},{default:()=>[e.createTextVNode("确认")]})])])}))}});exports.default=s;
|
|
2
2
|
//# sourceMappingURL=carNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carNumber.js","sources":["../../../../../packages/components/carNumber/src/carNumber.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, reactive, ref } from \"vue\";\nimport { ElButton, ElInput, ElMessage, ElPopover, formContextKey, formItemContextKey, inputProps } from \"element-plus\";\nimport { Back } from \"@element-plus/icons-vue\";\nimport { RegExps } from \"@fast-element-plus/constants\";\nimport { useProps, useRender } from \"@fast-china/utils\";\nimport { isNull, isString } from \"lodash-unified\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\nimport { useVModel } from \"@vueuse/core\";\n\nexport default defineComponent({\n\tname: \"FaCarNumber\",\n\tprops: {\n\t\t...inputProps,\n\t\t/** @description v-model绑定值 */\n\t\tmodelValue: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description placeholder */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: \"请选择\",\n\t\t},\n\t},\n\temits: {\n\t\t/** @description v-model 回调 */\n\t\t\"update:modelValue\": (value: string) => isString(value) || isNull(value),\n\t\t/** @description 改变 */\n\t\tchange: (value: string) => isString(value) || isNull(value),\n\t},\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst modelValue = useVModel(props, \"modelValue\", emit);\n\n\t\tconst state = reactive({\n\t\t\tswitchLetter: computed(() => {\n\t\t\t\tif (modelValue.value?.length >= 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t\tdisabledButton: computed(() => {\n\t\t\t\tif (modelValue.value?.length >= 8) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t});\n\n\t\tconst popoverRef = ref<PopoverInstance>();\n\t\t// 获取 el-form 组件上下文\n\t\tconst formContext = inject(formContextKey, undefined);\n\t\t// 获取 el-form-item 组件上下文\n\t\tconst formItemContext = inject(formItemContextKey, undefined);\n\n\t\tconst handleInputFormatter = (value: string): string => {\n\t\t\tif (value.length === 2) {\n\t\t\t\treturn `${value} ● `;\n\t\t\t} else if (value.length > 2) {\n\t\t\t\treturn `${value.slice(0, 2)} ● ${value.slice(2)}`;\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t};\n\n\t\tconst handleSelectCarNumber = (value: string): void => {\n\t\t\tmodelValue.value ??= \"\";\n\t\t\tmodelValue.value += value;\n\t\t};\n\n\t\tconst handleBackClick = (): void => {\n\t\t\tif (modelValue.value?.length === 0) return;\n\t\t\tmodelValue.value = modelValue.value.substring(0, modelValue.value.length - 1);\n\t\t};\n\n\t\tconst handleConfirmClick = (): void => {\n\t\t\tlet success = false;\n\t\t\tif (modelValue.value.length === 7) {\n\t\t\t\tsuccess = RegExps.CarNumber.test(modelValue.value);\n\t\t\t} else if (modelValue.value.length === 8) {\n\t\t\t\tsuccess = RegExps.NewEnergyCarNumber.test(modelValue.value);\n\t\t\t}\n\t\t\tif (success) {\n\t\t\t\temit(\"change\", modelValue.value);\n\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t\t} else {\n\t\t\t\tif (formItemContext?.prop && formContext) {\n\t\t\t\t\temit(\"change\", modelValue.value);\n\t\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\t\tformContext.validateField([formItemContext.prop]);\n\t\t\t\t} else {\n\t\t\t\t\tElMessage.error(\"车牌号格式不正确\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tpopoverRef.value?.hide();\n\t\t};\n\n\t\tconst handleClearClick = (): void => {\n\t\t\tmodelValue.value = null;\n\t\t\temit(\"change\", null);\n\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t};\n\n\t\tconst elInputProps = useProps(props, inputProps, [\"modelValue\", \"readonly\", \"formatter\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tref={popoverRef}\n\t\t\t\twidth=\"auto\"\n\t\t\t\tpopperClass=\"fa-car-number__popover\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t{...elInputProps.value}\n\t\t\t\t\t\t\tclass=\"fa-car-number__input\"\n\t\t\t\t\t\t\tvModel={modelValue.value}\n\t\t\t\t\t\t\treadonly\n\t\t\t\t\t\t\tformatter={handleInputFormatter}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__area\", state.switchLetter ? \"fa-car-number__popover__hide\" : \"\"]}>\n\t\t\t\t\t\t\t\t{CarNumberArea.map((area) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(area)}>\n\t\t\t\t\t\t\t\t\t\t{area}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__digit-letter\", state.switchLetter ? \"\" : \"fa-car-number__popover__hide\"]}>\n\t\t\t\t\t\t\t\t{CarNumberDigit.map((digit) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(digit)}>\n\t\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t{CarNumberLetter.map((letter) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(letter)}>\n\t\t\t\t\t\t\t\t\t\t{letter}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-car-number__popover__btn\">\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__clear\"\n\t\t\t\t\t\t\t\t\tdisabled={modelValue.value === null || modelValue.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleClearClick}\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</ElButton>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__back\"\n\t\t\t\t\t\t\t\t\ttype=\"danger\"\n\t\t\t\t\t\t\t\t\ticon={Back}\n\t\t\t\t\t\t\t\t\tdisabled={modelValue.value === null || modelValue.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleBackClick}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__confirm\"\n\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\tdisabled={modelValue.value === null || modelValue.value.length < 7}\n\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\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</ElButton>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\t},\n});\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","CarNumber","name","props","inputProps","modelValue","type","String","default","undefined","placeholder","emits","isString","value","isNull","change","setup","attrs","slots","emit","expose","useVModel","state","reactive","switchLetter","computed","length","disabledButton","popoverRef","ref","formContext","inject","formContextKey","formItemContext","formItemContextKey","handleInputFormatter","slice","handleSelectCarNumber","handleBackClick","substring","handleConfirmClick","success","RegExps","test","NewEnergyCarNumber","prop","validateField","ElMessage","error","hide","handleClearClick","elInputProps","useProps","useRender","_createVNode","ElPopover","width","popperClass","trigger","showArrow","showAfter","hideAfter","reference","ElInput","_mergeProps","class","$event","readonly","formatter","_Fragment","CarNumberArea","map","area","ElButton","disabled","onClick","CarNumberDigit","digit","CarNumberLetter","letter","_createTextVNode","icon","Back"],"mappings":"sYAQyC,SAAAA,EAAAC,GAAA,MAAA,mBAAAA,GAAA,oBAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,KAAAK,EAAAA,QAAAL,EAAA,CAEzC,MAAAM,oBAA+B,CAC9BC,KAAM,cACNC,MAAO,IACHC,EAAAA,WAEHC,WAAY,CACXC,KAAMC,OACNC,aAASC,GAGVC,YAAa,CACZJ,KAAMC,OACNC,QAAS,QAGXG,MAAO,CAEN,uB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AMtC,EAAsB0C,IAAOrF,EACpFqF,GAAAA,EAAM,CAAAvE,QAAAA,IAAA,CAANuE,QAEDzB,EAAAA,YAAA,MAAA,CAAAW,MAAA,+BAAA,CAAAX,EAAAA,YAAAmB,WAAA,CAAAR,MAAA,qCAAAS,SAK8B,OAArBrE,EAAWQ,OAA8C,IAA5BR,EAAWQ,MAAMa,OAAYiD,QAC3DzB,GAAgB,CAAA1C,QAAAA,IAAA,CAAAwE,EAAAA,gBAAA,SAAA1B,EAAAA,YAAAmB,WAAA,CAAAR,MAAA,oCAAA3D,KAAA,SAAA2E,KAOnBC,EAAAA,KAAIR,SACqB,OAArBrE,EAAWQ,OAA8C,IAA5BR,EAAWQ,MAAMa,OAAYiD,QAC3DrC,GAAe,MAAAgB,EAAAA,YAAAmB,WAAA,CAAAR,MAAA,uCAAA3D,KAAA,UAAAoE,SAKO,OAArBrE,EAAWQ,OAAkBR,EAAWQ,MAAMa,OAAS,EAACiD,QACzDnC,GAAkB,CAAAhC,QAAAA,IAAA,CAAAwE,EAAAA,gBAAA,eAUnC"}
|
|
1
|
+
{"version":3,"file":"carNumber.js","sources":["../../../../../packages/components/carNumber/src/carNumber.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, reactive, ref } from \"vue\";\nimport { ElButton, ElInput, ElMessage, ElPopover, formContextKey, formItemContextKey, inputProps } from \"element-plus\";\nimport { Back } from \"@element-plus/icons-vue\";\nimport { RegExps } from \"@fast-element-plus/constants\";\nimport { useProps, useRender } from \"@fast-china/utils\";\nimport { isNull, isString } from \"lodash-unified\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\nimport { useVModel } from \"@vueuse/core\";\n\nexport default defineComponent({\n\tname: \"FaCarNumber\",\n\tprops: {\n\t\t...inputProps,\n\t\t/** @description v-model绑定值 */\n\t\tmodelValue: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description placeholder */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: \"请选择\",\n\t\t},\n\t},\n\temits: {\n\t\t/** @description v-model 回调 */\n\t\t\"update:modelValue\": (value: string) => isString(value) || isNull(value),\n\t\t/** @description 改变 */\n\t\tchange: (value: string) => isString(value) || isNull(value),\n\t},\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst modelValue = useVModel(props, \"modelValue\", emit, { passive: true });\n\n\t\tconst state = reactive({\n\t\t\tswitchLetter: computed(() => {\n\t\t\t\tif (modelValue.value?.length >= 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t\tdisabledButton: computed(() => {\n\t\t\t\tif (modelValue.value?.length >= 8) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t});\n\n\t\tconst popoverRef = ref<PopoverInstance>();\n\t\t// 获取 el-form 组件上下文\n\t\tconst formContext = inject(formContextKey, undefined);\n\t\t// 获取 el-form-item 组件上下文\n\t\tconst formItemContext = inject(formItemContextKey, undefined);\n\n\t\tconst handleInputFormatter = (value: string): string => {\n\t\t\tif (value.length === 2) {\n\t\t\t\treturn `${value} ● `;\n\t\t\t} else if (value.length > 2) {\n\t\t\t\treturn `${value.slice(0, 2)} ● ${value.slice(2)}`;\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t};\n\n\t\tconst handleSelectCarNumber = (value: string): void => {\n\t\t\tmodelValue.value ??= \"\";\n\t\t\tmodelValue.value += value;\n\t\t};\n\n\t\tconst handleBackClick = (): void => {\n\t\t\tif (modelValue.value?.length === 0) return;\n\t\t\tmodelValue.value = modelValue.value.substring(0, modelValue.value.length - 1);\n\t\t};\n\n\t\tconst handleConfirmClick = (): void => {\n\t\t\tlet success = false;\n\t\t\tif (modelValue.value.length === 7) {\n\t\t\t\tsuccess = RegExps.CarNumber.test(modelValue.value);\n\t\t\t} else if (modelValue.value.length === 8) {\n\t\t\t\tsuccess = RegExps.NewEnergyCarNumber.test(modelValue.value);\n\t\t\t}\n\t\t\tif (success) {\n\t\t\t\temit(\"change\", modelValue.value);\n\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t\t} else {\n\t\t\t\tif (formItemContext?.prop && formContext) {\n\t\t\t\t\temit(\"change\", modelValue.value);\n\t\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\t\tformContext.validateField([formItemContext.prop]);\n\t\t\t\t} else {\n\t\t\t\t\tElMessage.error(\"车牌号格式不正确\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tpopoverRef.value?.hide();\n\t\t};\n\n\t\tconst handleClearClick = (): void => {\n\t\t\tmodelValue.value = null;\n\t\t\temit(\"change\", null);\n\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t};\n\n\t\tconst elInputProps = useProps(props, inputProps, [\"modelValue\", \"readonly\", \"formatter\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tref={popoverRef}\n\t\t\t\twidth=\"auto\"\n\t\t\t\tpopperClass=\"fa-car-number__popover\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t{...elInputProps.value}\n\t\t\t\t\t\t\tclass=\"fa-car-number__input\"\n\t\t\t\t\t\t\tvModel={modelValue.value}\n\t\t\t\t\t\t\treadonly\n\t\t\t\t\t\t\tformatter={handleInputFormatter}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__area\", state.switchLetter ? \"fa-car-number__popover__hide\" : \"\"]}>\n\t\t\t\t\t\t\t\t{CarNumberArea.map((area) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(area)}>\n\t\t\t\t\t\t\t\t\t\t{area}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__digit-letter\", state.switchLetter ? \"\" : \"fa-car-number__popover__hide\"]}>\n\t\t\t\t\t\t\t\t{CarNumberDigit.map((digit) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(digit)}>\n\t\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t{CarNumberLetter.map((letter) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(letter)}>\n\t\t\t\t\t\t\t\t\t\t{letter}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-car-number__popover__btn\">\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__clear\"\n\t\t\t\t\t\t\t\t\tdisabled={modelValue.value === null || modelValue.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleClearClick}\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</ElButton>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__back\"\n\t\t\t\t\t\t\t\t\ttype=\"danger\"\n\t\t\t\t\t\t\t\t\ticon={Back}\n\t\t\t\t\t\t\t\t\tdisabled={modelValue.value === null || modelValue.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleBackClick}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__confirm\"\n\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\tdisabled={modelValue.value === null || modelValue.value.length < 7}\n\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\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</ElButton>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\t},\n});\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","CarNumber","name","props","inputProps","modelValue","type","String","default","undefined","placeholder","emits","isString","value","isNull","change","setup","attrs","slots","emit","expose","useVModel","passive","state","reactive","switchLetter","computed","length","disabledButton","popoverRef","ref","formContext","inject","formContextKey","formItemContext","formItemContextKey","handleInputFormatter","slice","handleSelectCarNumber","handleBackClick","substring","handleConfirmClick","success","RegExps","test","NewEnergyCarNumber","prop","validateField","ElMessage","error","hide","handleClearClick","elInputProps","useProps","useRender","_createVNode","ElPopover","width","popperClass","trigger","showArrow","showAfter","hideAfter","reference","ElInput","_mergeProps","class","$event","readonly","formatter","_Fragment","CarNumberArea","map","area","ElButton","disabled","onClick","CarNumberDigit","digit","CarNumberLetter","letter","_createTextVNode","icon","Back"],"mappings":"sYAQyC,SAAAA,EAAAC,GAAA,MAAA,mBAAAA,GAAA,oBAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,KAAAK,EAAAA,QAAAL,EAAA,CAEzC,MAAAM,oBAA+B,CAC9BC,KAAM,cACNC,MAAO,IACHC,EAAAA,WAEHC,WAAY,CACXC,KAAMC,OACNC,aAASC,GAGVC,YAAa,CACZJ,KAAMC,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AmB,EAAAA,SAAA,CAAAC,SACPpD,EAAMK,eAAcgD,QAAWA,IAAMtC,EAAsB0C,IAAOtF,EACpFsF,GAAAA,EAAM,CAAAxE,QAAAA,IAAA,CAANwE,QAEDzB,EAAAA,YAAA,MAAA,CAAAW,MAAA,+BAAA,CAAAX,EAAAA,YAAAmB,WAAA,CAAAR,MAAA,qCAAAS,SAK8B,OAArBtE,EAAWQ,OAA8C,IAA5BR,EAAWQ,MAAMc,OAAYiD,QAC3DzB,GAAgB,CAAA3C,QAAAA,IAAA,CAAAyE,EAAAA,gBAAA,SAAA1B,EAAAA,YAAAmB,WAAA,CAAAR,MAAA,oCAAA5D,KAAA,SAAA4E,KAOnBC,EAAAA,KAAIR,SACqB,OAArBtE,EAAWQ,OAA8C,IAA5BR,EAAWQ,MAAMc,OAAYiD,QAC3DrC,GAAe,MAAAgB,EAAAA,YAAAmB,WAAA,CAAAR,MAAA,uCAAA5D,KAAA,UAAAqE,SAKO,OAArBtE,EAAWQ,OAAkBR,EAAWQ,MAAMc,OAAS,EAACiD,QACzDnC,GAAkB,CAAAjC,QAAAA,IAAA,CAAAyE,EAAAA,gBAAA,eAUnC"}
|
|
@@ -31,7 +31,7 @@ export declare const faDialogProps: {
|
|
|
31
31
|
};
|
|
32
32
|
/** @description width of Dialog, default is 50% */
|
|
33
33
|
width: {
|
|
34
|
-
type: (
|
|
34
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
35
35
|
default: string;
|
|
36
36
|
};
|
|
37
37
|
/** @description 显示刷新按钮 */
|
|
@@ -177,7 +177,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
177
177
|
};
|
|
178
178
|
/** @description width of Dialog, default is 50% */
|
|
179
179
|
width: {
|
|
180
|
-
type: (
|
|
180
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
181
181
|
default: string;
|
|
182
182
|
};
|
|
183
183
|
/** @description 显示刷新按钮 */
|
|
@@ -322,7 +322,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
322
322
|
};
|
|
323
323
|
/** @description width of Dialog, default is 50% */
|
|
324
324
|
width: {
|
|
325
|
-
type: (
|
|
325
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
326
326
|
default: string;
|
|
327
327
|
};
|
|
328
328
|
/** @description 显示刷新按钮 */
|
|
@@ -3,7 +3,7 @@ import { FormItemContext, FormValidationResult } from 'element-plus';
|
|
|
3
3
|
export declare const faFormProps: {
|
|
4
4
|
/** @description Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
5
5
|
labelWidth: {
|
|
6
|
-
type: (
|
|
6
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
7
7
|
default: string;
|
|
8
8
|
};
|
|
9
9
|
/** @description Suffix of the label. */
|
|
@@ -59,7 +59,7 @@ type FaFormSlots = {
|
|
|
59
59
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
60
60
|
/** @description Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
61
61
|
labelWidth: {
|
|
62
|
-
type: (
|
|
62
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
63
63
|
default: string;
|
|
64
64
|
};
|
|
65
65
|
/** @description Suffix of the label. */
|
|
@@ -125,7 +125,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
125
125
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
126
126
|
/** @description Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */
|
|
127
127
|
labelWidth: {
|
|
128
|
-
type: (
|
|
128
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
129
129
|
default: string;
|
|
130
130
|
};
|
|
131
131
|
/** @description Suffix of the label. */
|
|
@@ -8,12 +8,12 @@ export declare const faFormItemProps: {
|
|
|
8
8
|
};
|
|
9
9
|
/** @description 偏移量 */
|
|
10
10
|
offset: {
|
|
11
|
-
type: (
|
|
11
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
12
12
|
default: number;
|
|
13
13
|
};
|
|
14
14
|
/** @description 栅格跨度 */
|
|
15
15
|
span: {
|
|
16
|
-
type: (
|
|
16
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
17
17
|
};
|
|
18
18
|
/** @description 独占一行。如果设置 span 则无效 */
|
|
19
19
|
row: BooleanConstructor;
|
|
@@ -77,12 +77,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
77
77
|
};
|
|
78
78
|
/** @description 偏移量 */
|
|
79
79
|
offset: {
|
|
80
|
-
type: (
|
|
80
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
81
81
|
default: number;
|
|
82
82
|
};
|
|
83
83
|
/** @description 栅格跨度 */
|
|
84
84
|
span: {
|
|
85
|
-
type: (
|
|
85
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
86
86
|
};
|
|
87
87
|
/** @description 独占一行。如果设置 span 则无效 */
|
|
88
88
|
row: BooleanConstructor;
|
|
@@ -125,7 +125,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
125
125
|
};
|
|
126
126
|
}>, {
|
|
127
127
|
/** @description 表单项大小 */
|
|
128
|
-
size: import('vue').ComputedRef<"" | "
|
|
128
|
+
size: import('vue').ComputedRef<"" | "default" | "small" | "large">;
|
|
129
129
|
/** @description 校验消息 */
|
|
130
130
|
validateMessage: import('vue').ComputedRef<string>;
|
|
131
131
|
/** @description 校验状态 */
|
|
@@ -146,12 +146,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
146
146
|
};
|
|
147
147
|
/** @description 偏移量 */
|
|
148
148
|
offset: {
|
|
149
|
-
type: (
|
|
149
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
150
150
|
default: number;
|
|
151
151
|
};
|
|
152
152
|
/** @description 栅格跨度 */
|
|
153
153
|
span: {
|
|
154
|
-
type: (
|
|
154
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
155
155
|
};
|
|
156
156
|
/** @description 独占一行。如果设置 span 则无效 */
|
|
157
157
|
row: BooleanConstructor;
|
|
@@ -6,7 +6,7 @@ export declare const faIconProps: {
|
|
|
6
6
|
};
|
|
7
7
|
/** @description 大小 */
|
|
8
8
|
size: {
|
|
9
|
-
type: (
|
|
9
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
10
10
|
};
|
|
11
11
|
/** @description 颜色*/
|
|
12
12
|
color: StringConstructor;
|
|
@@ -19,7 +19,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
19
19
|
};
|
|
20
20
|
/** @description 大小 */
|
|
21
21
|
size: {
|
|
22
|
-
type: (
|
|
22
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
23
23
|
};
|
|
24
24
|
/** @description 颜色*/
|
|
25
25
|
color: StringConstructor;
|
|
@@ -31,7 +31,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
31
31
|
};
|
|
32
32
|
/** @description 大小 */
|
|
33
33
|
size: {
|
|
34
|
-
type: (
|
|
34
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
35
35
|
};
|
|
36
36
|
/** @description 颜色*/
|
|
37
37
|
color: StringConstructor;
|
|
@@ -208,13 +208,13 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
208
208
|
__epPropKey: true;
|
|
209
209
|
};
|
|
210
210
|
}>> & Readonly<{}>, {
|
|
211
|
-
small: boolean;
|
|
212
211
|
base64: boolean;
|
|
213
212
|
original: boolean;
|
|
214
213
|
normal: boolean;
|
|
214
|
+
small: boolean;
|
|
215
215
|
thumb: boolean;
|
|
216
216
|
src: string;
|
|
217
|
-
fit: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "
|
|
217
|
+
fit: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "cover" | "fill" | "contain" | "none" | "scale-down", unknown>;
|
|
218
218
|
lazy: boolean;
|
|
219
219
|
closeOnPressEscape: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
220
220
|
hideOnClickModal: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TableProps } from 'element-plus';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
import { PagedInput, PagedResult } from '../../table';
|
|
4
|
+
import { ElSelectorOutput } from '../../select/src/select.type';
|
|
4
5
|
export declare const faInputDialogPageProps: {
|
|
5
6
|
/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
6
7
|
rowKey: {
|
|
@@ -8,7 +9,7 @@ export declare const faInputDialogPageProps: {
|
|
|
8
9
|
default: string;
|
|
9
10
|
};
|
|
10
11
|
/** @description v-model绑定值 */
|
|
11
|
-
modelValue: (
|
|
12
|
+
modelValue: (StringConstructor | NumberConstructor)[];
|
|
12
13
|
/** @description v-model:label绑定值 */
|
|
13
14
|
label: StringConstructor;
|
|
14
15
|
/** @description 输入框占位文本 */
|
|
@@ -38,7 +39,7 @@ export declare const faInputDialogPageEmits: {
|
|
|
38
39
|
/** @description v-model:label 回调 */
|
|
39
40
|
"update:label": (value: string) => boolean;
|
|
40
41
|
/** @description 改变 */
|
|
41
|
-
change: (
|
|
42
|
+
change: (data: ElSelectorOutput | ElSelectorOutput[] | any | any[], value?: string | number | boolean | object | (string | number | boolean | object)[]) => boolean;
|
|
42
43
|
};
|
|
43
44
|
type FaInputDialogPageSlots = {
|
|
44
45
|
/** @description 默认内容插槽 */
|
|
@@ -51,7 +52,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
51
52
|
default: string;
|
|
52
53
|
};
|
|
53
54
|
/** @description v-model绑定值 */
|
|
54
|
-
modelValue: (
|
|
55
|
+
modelValue: (StringConstructor | NumberConstructor)[];
|
|
55
56
|
/** @description v-model:label绑定值 */
|
|
56
57
|
label: StringConstructor;
|
|
57
58
|
/** @description 输入框占位文本 */
|
|
@@ -87,7 +88,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
87
88
|
/** @description v-model:label 回调 */
|
|
88
89
|
"update:label": (value: string) => boolean;
|
|
89
90
|
/** @description 改变 */
|
|
90
|
-
change: (
|
|
91
|
+
change: (data: ElSelectorOutput | ElSelectorOutput[] | any | any[], value?: string | number | boolean | object | (string | number | boolean | object)[]) => boolean;
|
|
91
92
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
92
93
|
/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
93
94
|
rowKey: {
|
|
@@ -95,7 +96,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
95
96
|
default: string;
|
|
96
97
|
};
|
|
97
98
|
/** @description v-model绑定值 */
|
|
98
|
-
modelValue: (
|
|
99
|
+
modelValue: (StringConstructor | NumberConstructor)[];
|
|
99
100
|
/** @description v-model:label绑定值 */
|
|
100
101
|
label: StringConstructor;
|
|
101
102
|
/** @description 输入框占位文本 */
|
|
@@ -120,7 +121,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
120
121
|
};
|
|
121
122
|
}>> & Readonly<{
|
|
122
123
|
"onUpdate:modelValue"?: (value: string | number) => any;
|
|
123
|
-
onChange?: (
|
|
124
|
+
onChange?: (data: any, value?: string | number | boolean | object | (string | number | boolean | object)[]) => any;
|
|
124
125
|
"onUpdate:label"?: (value: string) => any;
|
|
125
126
|
}>, {
|
|
126
127
|
disabled: 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"),t=require("@element-plus/icons-vue"),i=require("@fast-china/utils"),o=require("lodash-unified"),a=require("../../table/index.js"),u=require("@vueuse/core"),n=require("../../dialog/index.js"),r={rowKey:{type:[String,Function],default:"id"},modelValue:[String,Number],label:String,placeholder:{type:String,default:"请选择"},disabled:Boolean,title:String,requestApi:{type:i.definePropType(Function)},initParam:i.definePropType([String,Number,Object]),labelKey:{type:String,default:"name"}},s={"update:modelValue":e=>o.isString(e)||o.isNumber(e)||o.isNull(e),"update:label":e=>o.isString(e)||o.isNull(e),change:
|
|
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"),i=require("@fast-china/utils"),o=require("lodash-unified"),a=require("../../table/index.js"),u=require("@vueuse/core"),n=require("../../dialog/index.js"),r={rowKey:{type:[String,Function],default:"id"},modelValue:[String,Number],label:String,placeholder:{type:String,default:"请选择"},disabled:Boolean,title:String,requestApi:{type:i.definePropType(Function)},initParam:i.definePropType([String,Number,Object]),labelKey:{type:String,default:"name"}},s={"update:modelValue":e=>o.isString(e)||o.isNumber(e)||o.isNull(e),"update:label":e=>o.isString(e)||o.isNull(e),change:(e,l)=>!0},d=e.defineComponent({name:"FaInputDialogPage",props:r,emits:s,slots:i.makeSlots(),setup(r,{attrs:s,slots:d,emit:c,expose:p}){const g=u.useVModel(r,"modelValue",c,{passive:!0}),f=u.useVModel(r,"label",c,{passive:!0}),v=e.reactive({selectionRow:i.withDefineType()}),m=e.ref(),w=e.ref(),b=()=>{g.value=null,f.value=null,c("change",null)},y=()=>{m.value.open(()=>{if(v.selectionRow){w.value.selectedListIds.includes(o.isFunction(r.rowKey)?r.rowKey(v.selectionRow):v.selectionRow[r.rowKey])||w.value.toggleRowSelection(v.selectionRow)}})},S=()=>{m.value.close(()=>{if(w.value.selected){const e=w.value.selectedList[0];g.value=o.isFunction(r.rowKey)?r.rowKey(e):e[r.rowKey],f.value=e[r.labelKey],c("change",e,g.value)}else g.value=null,f.value=null,c("change",null,null)})},h=e=>{w.value.clearSelection(),w.value.toggleRowSelection(e),v.selectionRow=e,S()};return i.useRender(()=>e.createVNode("div",{class:"fa-input-dialog-page"},[e.createVNode(l.ElInput,{modelValue:f.value,"onUpdate:modelValue":e=>f.value=e,placeholder:r.placeholder,disabled:r.disabled,readonly:!0},{append:()=>e.createVNode(l.ElButtonGroup,null,{default:()=>[e.createVNode(l.ElButton,{disabled:r.disabled,icon:t.Delete,onClick:b},null),e.createVNode(l.ElButton,{disabled:r.disabled,icon:t.Search,onClick:y},null)]})}),e.createVNode(n.FaDialog,{ref:m,style:"--height: 70%;",width:"50%",title:r.title,fullHeight:!0,disabledConfirmButton:!w.value?.selected,onConfirmClick:S},{default:()=>[e.createVNode(a.FaTable,{ref:w,rowKey:r.rowKey,requestApi:r.requestApi,initParam:r.initParam,single:!0,rowClickSelection:!0,hideSearchTime:!0,onRowDblclick:h},{default:()=>d.default&&d.default()})]})])),i.useExpose(p,{selectionRow:e.computed(()=>v.selectionRow),open:y,clear:b})}});exports.default=d,exports.faInputDialogPageEmits=s,exports.faInputDialogPageProps=r;
|
|
2
2
|
//# sourceMappingURL=inputDialogPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputDialogPage.js","sources":["../../../../../packages/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref } from \"vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"@fast-china/utils\";\nimport { isFunction, isNull, isNumber, isString } from \"lodash-unified\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport { FaTable, type FaTableInstance, type PagedInput, type PagedResult } from \"@fast-element-plus/components/table\";\nimport { useVModel } from \"@vueuse/core\";\nimport FaDialog, { FaDialogInstance } from \"@fast-element-plus/components/dialog\";\n\nexport const faInputDialogPageProps = {\n\t/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */\n\trowKey: {\n\t\ttype: [String, Function] as PropType<TableProps<any>[\"rowKey\"]>,\n\t\tdefault: \"id\",\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: [String, Number],\n\t/** @description v-model:label绑定值 */\n\tlabel: String,\n\t/** @description 输入框占位文本 */\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: \"请选择\",\n\t},\n\t/** @description 禁用 */\n\tdisabled: Boolean,\n\t/** @description 标题 */\n\ttitle: String,\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult | any[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n\t/** @description 显示文本 Key */\n\tlabelKey: {\n\t\ttype: String,\n\t\tdefault: \"name\",\n\t},\n};\n\nexport const faInputDialogPageEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | number) => isString(value) || isNumber(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string) => isString(value) || isNull(value),\n\t/** @description 改变 */\n\tchange: (
|
|
1
|
+
{"version":3,"file":"inputDialogPage.js","sources":["../../../../../packages/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref } from \"vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"@fast-china/utils\";\nimport { isFunction, isNull, isNumber, isString } from \"lodash-unified\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport { FaTable, type FaTableInstance, type PagedInput, type PagedResult } from \"@fast-element-plus/components/table\";\nimport { useVModel } from \"@vueuse/core\";\nimport FaDialog, { FaDialogInstance } from \"@fast-element-plus/components/dialog\";\nimport { ElSelectorOutput } from \"@fast-element-plus/components/select/src/select.type\";\n\nexport const faInputDialogPageProps = {\n\t/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */\n\trowKey: {\n\t\ttype: [String, Function] as PropType<TableProps<any>[\"rowKey\"]>,\n\t\tdefault: \"id\",\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: [String, Number],\n\t/** @description v-model:label绑定值 */\n\tlabel: String,\n\t/** @description 输入框占位文本 */\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: \"请选择\",\n\t},\n\t/** @description 禁用 */\n\tdisabled: Boolean,\n\t/** @description 标题 */\n\ttitle: String,\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult | any[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | any>([String, Number, Object]),\n\t/** @description 显示文本 Key */\n\tlabelKey: {\n\t\ttype: String,\n\t\tdefault: \"name\",\n\t},\n};\n\nexport const faInputDialogPageEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | number) => isString(value) || isNumber(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string) => isString(value) || isNull(value),\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 FaInputDialogPageSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n};\n\nexport default defineComponent({\n\tname: \"FaInputDialogPage\",\n\tprops: faInputDialogPageProps,\n\temits: faInputDialogPageEmits,\n\tslots: makeSlots<FaInputDialogPageSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst modelValue = useVModel(props, \"modelValue\", emit, { passive: true });\n\t\tconst selectedLabel = useVModel(props, \"label\", emit, { passive: true });\n\n\t\tconst state = reactive({\n\t\t\tselectionRow: withDefineType<unknown>(),\n\t\t});\n\n\t\tconst faDialogRef = ref<FaDialogInstance>();\n\t\tconst faTableRef = ref<FaTableInstance>();\n\n\t\tconst handleDeleteClick = (): void => {\n\t\t\tmodelValue.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\temit(\"change\", null);\n\t\t};\n\n\t\tconst handleSearchClick = (): void => {\n\t\t\tfaDialogRef.value.open(() => {\n\t\t\t\tif (state.selectionRow) {\n\t\t\t\t\t// 判断当前行是否选中\n\t\t\t\t\tconst rowSelected = faTableRef.value.selectedListIds.includes(\n\t\t\t\t\t\tisFunction(props.rowKey) ? props.rowKey(state.selectionRow) : state.selectionRow[props.rowKey]\n\t\t\t\t\t);\n\t\t\t\t\tif (!rowSelected) {\n\t\t\t\t\t\tfaTableRef.value.toggleRowSelection(state.selectionRow);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleConfirmClick = (): void => {\n\t\t\tfaDialogRef.value.close(() => {\n\t\t\t\tif (faTableRef.value.selected) {\n\t\t\t\t\tconst selectedData = faTableRef.value.selectedList[0];\n\t\t\t\t\tmodelValue.value = isFunction(props.rowKey) ? props.rowKey(selectedData) : selectedData[props.rowKey];\n\t\t\t\t\tselectedLabel.value = selectedData[props.labelKey];\n\t\t\t\t\temit(\"change\", selectedData, modelValue.value);\n\t\t\t\t} else {\n\t\t\t\t\tmodelValue.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleTableRowDblclick = (row: any): void => {\n\t\t\tfaTableRef.value.clearSelection();\n\t\t\tfaTableRef.value.toggleRowSelection(row);\n\t\t\tstate.selectionRow = row;\n\t\t\thandleConfirmClick();\n\t\t};\n\n\t\tuseRender(() => (\n\t\t\t<div class=\"fa-input-dialog-page\">\n\t\t\t\t<ElInput vModel={selectedLabel.value} placeholder={props.placeholder} disabled={props.disabled} readonly>\n\t\t\t\t\t{{\n\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t<ElButtonGroup>\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Delete} onClick={handleDeleteClick} />\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Search} onClick={handleSearchClick} />\n\t\t\t\t\t\t\t</ElButtonGroup>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t</ElInput>\n\t\t\t\t<FaDialog\n\t\t\t\t\tref={faDialogRef}\n\t\t\t\t\tstyle=\"--height: 70%;\"\n\t\t\t\t\twidth=\"50%\"\n\t\t\t\t\ttitle={props.title}\n\t\t\t\t\tfullHeight\n\t\t\t\t\tdisabledConfirmButton={!faTableRef.value?.selected}\n\t\t\t\t\tonConfirmClick={handleConfirmClick}\n\t\t\t\t>\n\t\t\t\t\t<FaTable\n\t\t\t\t\t\tref={faTableRef}\n\t\t\t\t\t\trowKey={props.rowKey}\n\t\t\t\t\t\trequestApi={props.requestApi}\n\t\t\t\t\t\tinitParam={props.initParam}\n\t\t\t\t\t\tsingle\n\t\t\t\t\t\trowClickSelection\n\t\t\t\t\t\thideSearchTime\n\t\t\t\t\t\tonRowDblclick={handleTableRowDblclick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tdefault: () => slots.default && slots.default(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t</FaTable>\n\t\t\t\t</FaDialog>\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 选择行数据 */\n\t\t\tselectionRow: computed(() => state.selectionRow),\n\t\t\t/** @description 打开选择器弹窗 */\n\t\t\topen: handleSearchClick,\n\t\t\t/** @description 清除选择 */\n\t\t\tclear: handleDeleteClick,\n\t\t});\n\t},\n});\n"],"names":["faInputDialogPageProps","rowKey","type","String","Function","default","modelValue","Number","label","placeholder","disabled","Boolean","title","requestApi","definePropType","initParam","Object","labelKey","faInputDialogPageEmits","value","isString","isNumber","isNull","change","data","InputDialogPage","name","props","emits","slots","makeSlots","setup","attrs","emit","expose","useVModel","passive","selectedLabel","state","reactive","selectionRow","withDefineType","faDialogRef","ref","faTableRef","handleDeleteClick","handleSearchClick","open","selectedListIds","includes","isFunction","toggleRowSelection","handleConfirmClick","close","selected","selectedData","selectedList","handleTableRowDblclick","row","clearSelection","useRender","_createVNode","class","ElInput","$event","readonly","append","ElButtonGroup","ElButton","icon","Delete","onClick","Search","FaDialog","style","width","fullHeight","disabledConfirmButton","onConfirmClick","FaTable","single","rowClickSelection","hideSearchTime","onRowDblclick","useExpose","computed","clear"],"mappings":"4VAYaA,EAAyB,CAErCC,OAAQ,CACPC,KAAM,CAACC,OAAQC,UACfC,QAAS,MAGVC,WAAY,CAACH,OAAQI,QAErBC,MAAOL,OAEPM,YAAa,CACZP,KAAMC,OACNE,QAAS,OAGVK,SAAUC,QAEVC,MAAOT,OAEPU,WAAY,CACXX,KAAMY,EAAAA,eAAsEV,WAG7EW,UAAWD,EAAAA,eAAsC,CAACX,OAAQI,OAAQS,SAElEC,SAAU,CACTf,KAAMC,OACNE,QAAS,SAIEa,EAAyB,CAErC,oBAAsBC,GAA2BC,EAAAA,SAASD,IAAUE,EAAAA,SAASF,IAAUG,EAAAA,OAAOH,GAE9F,kBAAmCC,EAAAA,SAASD,IAAUG,EAAAA,OAAOH,GAE7DI,OAAQA,CACPC,EACAL,KACa,GAQfM,oBAA+B,CAC9BC,KAAM,oBACNC,MAAO3B,EACP4B,MAAOV,EACPW,MAAOC,EAAAA,YACPC,KAAAA,CAAMJ,GAAOK,MAAEA,EAAAA,MAAOH,EAAAA,KAAOI,EAAAA,OAAMC,IAClC,MAAM5B,EAA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uD,UAAA,GAAA,CAE5FC,OAAQA,IAAAL,EAAAA,YAAAM,EAAAA,cAAA,KAAA,CAAA9D,QAAAA,IAAA,CAAAwD,EAAAA,YAAAO,WAAA,CAAA1D,SAEciB,EAAMjB,SAAQ2D,KAAQC,EAAAA,OAAMC,QAAW1B,GAAiB,MAAAgB,EAAAA,YAAAO,WAAA,CAAA1D,SACxDiB,EAAMjB,SAAQ2D,KAAQG,EAAAA,OAAMD,QAAWzB,GAAiB,WAE7Ee,EAAAA,YAAAY,WAAA,CAAA9B,IAIGD,EAAWgC,MAAA,iBAAAC,MAAA,MAAA/D,MAGTe,EAAMf,MAAKgE,YAAA,EAAAC,uBAEMjC,EAAWzB,OAAOmC,SAAQwB,eAClC1B,GAAkB,CAAA/C,QAAAA,IAAA,CAAAwD,EAAAA,YAAAkB,UAAA,CAAApC,IAG5BC,EAAU3C,OACP0B,EAAM1B,OAAMY,WACRc,EAAMd,WAAUE,UACjBY,EAAMZ,UAASiE,QAAA,EAAAC,mBAAA,EAAAC,gBAAA,EAAAC,cAIX1B,GAAsB,CAGpCpD,QAASA,IAAMwB,EAAMxB,SAAWwB,EAAMxB,kBAOpC+E,EAAAA,UAAUlD,EAAQ,CAExBM,aAAc6C,EAAAA,SAAS,IAAM/C,EAAME,cAEnCO,KAAMD,EAENwC,MAAOzC,GAET"}
|
|
@@ -13,7 +13,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
13
13
|
collapsed: BooleanConstructor;
|
|
14
14
|
/** @description 折叠行数 */
|
|
15
15
|
collapsedRows: {
|
|
16
|
-
type: (
|
|
16
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
17
17
|
default: number;
|
|
18
18
|
};
|
|
19
19
|
/** @description 间距,偏移 */
|
|
@@ -39,7 +39,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
39
39
|
collapsed: BooleanConstructor;
|
|
40
40
|
/** @description 折叠行数 */
|
|
41
41
|
collapsedRows: {
|
|
42
|
-
type: (
|
|
42
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
43
43
|
default: number;
|
|
44
44
|
};
|
|
45
45
|
/** @description 间距,偏移 */
|
|
@@ -6,12 +6,12 @@ type FaLayoutGridItemSlots = {
|
|
|
6
6
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
7
7
|
/** @description 偏移 */
|
|
8
8
|
offset: {
|
|
9
|
-
type: (
|
|
9
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
10
10
|
default: number;
|
|
11
11
|
};
|
|
12
12
|
/** @description 占位 */
|
|
13
13
|
span: {
|
|
14
|
-
type: (
|
|
14
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
15
15
|
default: number;
|
|
16
16
|
};
|
|
17
17
|
/** @description 后缀 */
|
|
@@ -49,12 +49,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
49
49
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
50
50
|
/** @description 偏移 */
|
|
51
51
|
offset: {
|
|
52
|
-
type: (
|
|
52
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
53
53
|
default: number;
|
|
54
54
|
};
|
|
55
55
|
/** @description 占位 */
|
|
56
56
|
span: {
|
|
57
|
-
type: (
|
|
57
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
58
58
|
default: number;
|
|
59
59
|
};
|
|
60
60
|
/** @description 后缀 */
|
|
@@ -17,7 +17,7 @@ export declare const SelectProps: {
|
|
|
17
17
|
* @description binding value
|
|
18
18
|
*/
|
|
19
19
|
modelValue: {
|
|
20
|
-
type: (BooleanConstructor | ObjectConstructor |
|
|
20
|
+
type: (BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
21
21
|
default: any;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
@@ -280,7 +280,7 @@ export declare const faSelectProps: {
|
|
|
280
280
|
label: import('vue').PropType<string | string[]>;
|
|
281
281
|
/** @description 宽度 */
|
|
282
282
|
width: {
|
|
283
|
-
type: (
|
|
283
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
284
284
|
default: string;
|
|
285
285
|
};
|
|
286
286
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -593,7 +593,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
593
593
|
label: import('vue').PropType<string | string[]>;
|
|
594
594
|
/** @description 宽度 */
|
|
595
595
|
width: {
|
|
596
|
-
type: (
|
|
596
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
597
597
|
default: string;
|
|
598
598
|
};
|
|
599
599
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -898,7 +898,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
898
898
|
label: import('vue').PropType<string | string[]>;
|
|
899
899
|
/** @description 宽度 */
|
|
900
900
|
width: {
|
|
901
|
-
type: (
|
|
901
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
902
902
|
default: string;
|
|
903
903
|
};
|
|
904
904
|
/** @description 更多细节,只有使用slot的时候有用 */
|
|
@@ -1180,6 +1180,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1180
1180
|
width: string | number;
|
|
1181
1181
|
persistent: boolean;
|
|
1182
1182
|
fallbackPlacements: Placement[];
|
|
1183
|
+
filterable: boolean;
|
|
1183
1184
|
moreDetail: boolean;
|
|
1184
1185
|
loadingText: string;
|
|
1185
1186
|
noMatchText: string;
|
|
@@ -1189,7 +1190,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1189
1190
|
defaultSelected: boolean;
|
|
1190
1191
|
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>;
|
|
1191
1192
|
automaticDropdown: boolean;
|
|
1192
|
-
filterable: boolean;
|
|
1193
1193
|
allowCreate: boolean;
|
|
1194
1194
|
remote: boolean;
|
|
1195
1195
|
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("@fast-china/utils"),o=require("@vueuse/core"),r=require("lodash-unified"),i=require("./selectOption.js"),n={name:String,id:String,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:l.useSizeProp,effect:{type:t.definePropType(String),default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,default:""},popperOptions:{type:t.definePropType(Object),default:()=>({})},remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String},defaultFirstOption:Boolean,reserveKeyword:{type:Boolean,default:!0},valueKey:{type:String,default:"value"},collapseTags:Boolean,collapseTagsTooltip:Boolean,maxCollapseTags:{type:Number,default:1},teleported:l.useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:t.definePropType([String,Object,Function]),default:a.CircleClose},fitInputWidth:Boolean,suffixIcon:{type:t.definePropType([String,Object,Function]),default:a.ArrowDown},tagType:{...l.tagProps.type,default:"info"},tagEffect:{...l.tagProps.effect,default:"light"},validateEvent:{type:Boolean,default:!0},remoteShowSuffix:Boolean,placement:{type:t.definePropType(String),default:"bottom-start"},fallbackPlacements:{type:t.definePropType(Array),default:["bottom-start","top-start","right","left"]},...l.useEmptyValuesProps,...l.useAriaProps(["ariaLabel"])},u={...n,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:t.definePropType([String,Number,Boolean,Object,Array]),default:void 0},label:t.definePropType([String,Array]),width:{type:[String,Number],default:"100%"},moreDetail:Boolean,lazy:{type:Boolean,default:!0},defaultSelected:Boolean,props:{type:t.definePropType(Object),default:()=>({label:"label",hide:"hide",disabled:"disabled",children:"children"})},data:{type:t.definePropType(Array),default:()=>[]},requestApi:{type:t.definePropType(Function)},initParam:t.definePropType([String,Number,Object])},d={...l.selectEmits,"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},s=e.defineComponent({name:"FaSelect",props:u,emits:d,slots:t.makeSlots(),setup(a,{attrs:u,slots:d,emit:s,expose:p}){const c=o.useVModel(a,"label",s),f=l.useGlobalSize(),m=e.reactive({value:t.withDefineType(),loading:!1,selectorData:t.withDefineType([]),debut:!0,echo:!(a.data?.length>0),nextRefresh:!1}),y=e.ref(),g=e=>e?.map(e=>({...e,value:e[a.valueKey],label:r.isFunction(a.props.label)?a.props.label(e):e[a.props.label??"label"],hide:r.isFunction(a.props.hide)?a.props.hide(e):e[a.props.hide??"hide"],disabled:r.isFunction(a.props.disabled)?a.props.disabled(e):e[a.props.disabled??"disabled"],children:r.isFunction(a.props.children)?g(a.props.children(e)):g(e[a.props.children??"children"])})).filter(e=>!e.hide),b=async()=>{if(a.requestApi){m.loading=!0;const l=a.initParam??{};try{const e=await a.requestApi(l);m.echo=!1,m.selectorData=g(e),s("dataChangeCallBack",m.selectorData)}catch(e){t.consoleError("FaSelect",e),m.selectorData=[]}finally{m.loading=!1}}else m.echo=!1,m.selectorData=g(a.data)},h=e=>{if(a.multiple){const l=e;if(0===l?.length)return m.value=null,c.value=null,s("update:modelValue",null),void s("change",null,null);const a=m.selectorData.filter(e=>l.includes(e.value));m.value=e,c.value=a.map(e=>e.label),s("update:modelValue",e),s("change",a,e)}else{if(r.isNil(e))return m.value=null,c.value=null,s("update:modelValue",null),void s("change",null,null);const l=m.selectorData.find(l=>l.value===e);m.value=e,c.value=l.label,s("update:modelValue",e),s("change",l,e)}},v=()=>{m.value=null,c.value=null,s("update:modelValue",null),s("clear")},S=async e=>{e&&(m.debut?(m.debut=!1,!a.defaultSelected&&a.lazy&&await b()):m.nextRefresh&&(m.nextRefresh=!1,await b())),s("visible-change",e)};e.watch(()=>a.modelValue,e=>{if(m.echo&&!r.isNil(e)){const l=!r.isNil(a.label);if(a.multiple){if(!r.isArray(e))return void t.consoleError("FaSelect","当启用 multiple 时,传入的 modelValue 必须是Array。");if(l&&!r.isArray(a.label))return void t.consoleError("FaSelect","当启用 multiple 时,传入的 modelValue:label 必须是Array。");m.selectorData=e.slice(0,a.multipleLimit>0?a.multipleLimit:e.length).map((e,t)=>({value:e,label:l?a.label[t]:void 0}))}else{if(r.isArray(e))return void t.consoleError("FaSelect","当禁用 multiple 时,传入的 modelValue 不能是Array。");if(l&&r.isArray(a.label))return void t.consoleError("FaSelect","当禁用 multiple 时,传入的 modelValue:label 不能是Array。");m.selectorData=[{value:e,label:a.label}]}}m.value=e},{immediate:!0}),e.onMounted(async()=>{a.defaultSelected?(await b(),m.selectorData.length>0&&h(a.multiple?[m.selectorData[0].value]:m.selectorData[0].value)):!a.requestApi&&a.data?.length>0?(m.debut=!1,await b()):a.lazy||await b(),e.watch(()=>a.initParam,(e,l)=>{r.isEqual(e,l)||(m.nextRefresh=!0,r.isNil(m.value)||h())}),e.watch(()=>a.data,async()=>{a.requestApi||await b()},{deep:!0})});const T=t.useProps(a,n,["modelValue","popperClass","loading"]),B=t.useEmits(l.selectEmits,s,["update:modelValue","change","clear","visible-change"]),P=e.computed(()=>{let e=`fa-select-dropdown ${a.popperClass}`;return a.moreDetail&&(e+=` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${f.value}`),e});return t.useRender(()=>e.createVNode(l.ElSelect,e.mergeProps(T.value,B.value,{ref:y,class:"fa-select",popperClass:P.value,style:{width:t.addUnit(a.width)},modelValue:m.value,"onUpdate:modelValue":e=>m.value=e,loading:m.loading,onChange:h,onClear:v,onVisibleChange:S}),{default:()=>m.selectorData.map(l=>e.createVNode(i.default,{data:l,moreDetail:a.moreDetail},{default:d.default})),...d.header&&{header:()=>d.header()},...d.footer&&{footer:()=>d.footer()},...d.prefix&&{prefix:()=>d.prefix()},...d.empty&&{empty:()=>d.empty()},...d.tag&&{tag:()=>d.tag()},...d.loading&&{loading:()=>d.loading()},...d.label&&{label:({label:e,value:l})=>d.label({label:e,value:l})}})),t.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:b,setSelection:e=>h(e),clearSelection:()=>h(null)})}});exports.SelectProps=n,exports.default=s,exports.faSelectEmits=d,exports.faSelectProps=u;
|
|
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("@fast-china/utils"),o=require("@vueuse/core"),r=require("lodash-unified"),i=require("./selectOption.js"),n={name:String,id:String,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:l.useSizeProp,effect:{type:t.definePropType(String),default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,default:""},popperOptions:{type:t.definePropType(Object),default:()=>({})},remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String},defaultFirstOption:Boolean,reserveKeyword:{type:Boolean,default:!0},valueKey:{type:String,default:"value"},collapseTags:Boolean,collapseTagsTooltip:Boolean,maxCollapseTags:{type:Number,default:1},teleported:l.useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:t.definePropType([String,Object,Function]),default:a.CircleClose},fitInputWidth:Boolean,suffixIcon:{type:t.definePropType([String,Object,Function]),default:a.ArrowDown},tagType:{...l.tagProps.type,default:"info"},tagEffect:{...l.tagProps.effect,default:"light"},validateEvent:{type:Boolean,default:!0},remoteShowSuffix:Boolean,placement:{type:t.definePropType(String),default:"bottom-start"},fallbackPlacements:{type:t.definePropType(Array),default:["bottom-start","top-start","right","left"]},...l.useEmptyValuesProps,...l.useAriaProps(["ariaLabel"])},u={...n,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:t.definePropType([String,Number,Boolean,Object,Array]),default:void 0},label:t.definePropType([String,Array]),width:{type:[String,Number],default:"100%"},moreDetail:Boolean,lazy:{type:Boolean,default:!0},defaultSelected:Boolean,props:{type:t.definePropType(Object),default:()=>({label:"label",hide:"hide",disabled:"disabled",children:"children"})},data:{type:t.definePropType(Array),default:()=>[]},requestApi:{type:t.definePropType(Function)},initParam:t.definePropType([String,Number,Object])},d={...l.selectEmits,"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},s=e.defineComponent({name:"FaSelect",props:u,emits:d,slots:t.makeSlots(),setup(a,{attrs:u,slots:d,emit:s,expose:p}){const c=o.useVModel(a,"label",s,{passive:!0}),f=l.useGlobalSize(),m=e.reactive({value:t.withDefineType(),loading:!1,selectorData:t.withDefineType([]),debut:!0,echo:!(a.data?.length>0),nextRefresh:!1}),y=e.ref(),g=e=>e?.map(e=>({...e,value:e[a.valueKey],label:r.isFunction(a.props.label)?a.props.label(e):e[a.props.label??"label"],hide:r.isFunction(a.props.hide)?a.props.hide(e):e[a.props.hide??"hide"],disabled:r.isFunction(a.props.disabled)?a.props.disabled(e):e[a.props.disabled??"disabled"],children:r.isFunction(a.props.children)?g(a.props.children(e)):g(e[a.props.children??"children"])})).filter(e=>!e.hide),b=async()=>{if(a.requestApi){m.loading=!0;const l=a.initParam??{};try{const e=await a.requestApi(l);m.echo=!1,m.selectorData=g(e),s("dataChangeCallBack",m.selectorData)}catch(e){t.consoleError("FaSelect",e),m.selectorData=[]}finally{m.loading=!1}}else m.echo=!1,m.selectorData=g(a.data)},h=e=>{if(a.multiple){const l=e;if(0===l?.length)return m.value=null,c.value=null,s("update:modelValue",null),void s("change",null,null);const a=m.selectorData.filter(e=>l.includes(e.value));m.value=e,c.value=a.map(e=>e.label),s("update:modelValue",e),s("change",a,e)}else{if(r.isNil(e))return m.value=null,c.value=null,s("update:modelValue",null),void s("change",null,null);const l=m.selectorData.find(l=>l.value===e);m.value=e,c.value=l.label,s("update:modelValue",e),s("change",l,e)}},v=()=>{m.value=null,c.value=null,s("update:modelValue",null),s("clear")},S=async e=>{e&&(m.debut?(m.debut=!1,!a.defaultSelected&&a.lazy&&await b()):m.nextRefresh&&(m.nextRefresh=!1,await b())),s("visible-change",e)};e.watch(()=>a.modelValue,e=>{if(m.echo&&!r.isNil(e)){const l=!r.isNil(a.label);if(a.multiple){if(!r.isArray(e))return void t.consoleError("FaSelect","当启用 multiple 时,传入的 modelValue 必须是Array。");if(l&&!r.isArray(a.label))return void t.consoleError("FaSelect","当启用 multiple 时,传入的 modelValue:label 必须是Array。");m.selectorData=e.slice(0,a.multipleLimit>0?a.multipleLimit:e.length).map((e,t)=>({value:e,label:l?a.label[t]:void 0}))}else{if(r.isArray(e))return void t.consoleError("FaSelect","当禁用 multiple 时,传入的 modelValue 不能是Array。");if(l&&r.isArray(a.label))return void t.consoleError("FaSelect","当禁用 multiple 时,传入的 modelValue:label 不能是Array。");m.selectorData=[{value:e,label:a.label}]}}m.value=e},{immediate:!0}),e.onMounted(async()=>{a.defaultSelected?(await b(),m.selectorData.length>0&&h(a.multiple?[m.selectorData[0].value]:m.selectorData[0].value)):!a.requestApi&&a.data?.length>0?(m.debut=!1,await b()):a.lazy||await b(),e.watch(()=>a.initParam,(e,l)=>{r.isEqual(e,l)||(m.nextRefresh=!0,r.isNil(m.value)||h())}),e.watch(()=>a.data,async()=>{a.requestApi||await b()},{deep:!0})});const T=t.useProps(a,n,["modelValue","popperClass","loading"]),B=t.useEmits(l.selectEmits,s,["update:modelValue","change","clear","visible-change"]),P=e.computed(()=>{let e=`fa-select-dropdown ${a.popperClass}`;return a.moreDetail&&(e+=` fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${f.value}`),e});return t.useRender(()=>e.createVNode(l.ElSelect,e.mergeProps(T.value,B.value,{ref:y,class:"fa-select",popperClass:P.value,style:{width:t.addUnit(a.width)},modelValue:m.value,"onUpdate:modelValue":e=>m.value=e,loading:m.loading,onChange:h,onClear:v,onVisibleChange:S}),{default:()=>m.selectorData.map(l=>e.createVNode(i.default,{data:l,moreDetail:a.moreDetail},{default:d.default})),...d.header&&{header:()=>d.header()},...d.footer&&{footer:()=>d.footer()},...d.prefix&&{prefix:()=>d.prefix()},...d.empty&&{empty:()=>d.empty()},...d.tag&&{tag:()=>d.tag()},...d.loading&&{loading:()=>d.loading()},...d.label&&{label:({label:e,value:l})=>d.label({label:e,value:l})}})),t.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:b,setSelection:e=>h(e),clearSelection:()=>h(null)})}});exports.SelectProps=n,exports.default=s,exports.faSelectEmits=d,exports.faSelectProps=u;
|
|
2
2
|
//# sourceMappingURL=select.js.map
|