fast-element-plus 1.0.15 → 1.0.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"button.mjs","sources":["../../../../../packages/components/button/src/button.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref, watch, withModifiers } from \"vue\";\nimport { ElButton, buttonEmits, buttonProps } from \"element-plus\";\nimport { Eleme } from \"@element-plus/icons-vue\";\nimport { useOverlay } from \"@fast-element-plus/hooks\";\nimport { consoleError, definePropType, execFunction, makeSlots, useExpose, useProps, useRender } from \"@fast-china/utils\";\nimport { isFunction } from \"lodash-unified\";\nimport type { ButtonInstance } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\nexport const faButtonProps = {\n\t...buttonProps,\n\t/**\n\t * @description customize loading icon component\n\t * @default Eleme\n\t */\n\tloadingIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: (): string | Component => Eleme,\n\t},\n\t/** @description 禁用加载 */\n\tdisabledLoading: Boolean,\n};\n\nexport const faButtonEmits = {\n\t...buttonEmits,\n\t/**\n\t * @description 点击事件\n\t * @param done 需要手动隐藏Loading\n\t */\n\tclick: (event: MouseEvent, done: () => void = () => {}): boolean => event instanceof MouseEvent && isFunction(done),\n};\n\ntype FaButtonSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 自定义加载中组件 */\n\tloading: never;\n\t/** @description 自定义图标组件 */\n\ticon: never;\n};\n\nexport default defineComponent({\n\tname: \"FaButton\",\n\tprops: faButtonProps,\n\temits: faButtonEmits,\n\tslots: makeSlots<FaButtonSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t});\n\n\t\tconst buttonRef = ref<ButtonInstance>();\n\n\t\tconst showLoading = (): void => {\n\t\t\tstate.loading = true;\n\t\t\t// 这里默认透明\n\t\t\tuseOverlay.show(0);\n\t\t};\n\n\t\tconst hideLoading = (): void => {\n\t\t\tstate.loading = false;\n\t\t\tuseOverlay.hide();\n\t\t};\n\n\t\tconst handleLoading = (loadingFunction: () => void | Promise<void>): void => {\n\t\t\tstate.loading = true;\n\t\t\texecFunction(loadingFunction)\n\t\t\t\t.then()\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsoleError(\"FaButton\", error);\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tstate.loading = false;\n\t\t\t\t});\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent): void => {\n\t\t\tif (props.disabledLoading) {\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event);\n\t\t\t} else {\n\t\t\t\tshowLoading();\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event, hideLoading);\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * 监听外部 loading 的值\n\t\t */\n\t\twatch(\n\t\t\t() => props.loading,\n\t\t\t(newValue) => {\n\t\t\t\tif (props.disabledLoading) return;\n\t\t\t\tif (newValue) {\n\t\t\t\t\tshowLoading();\n\t\t\t\t} else {\n\t\t\t\t\thideLoading();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst elButtonProps = useProps(props, buttonProps, [\"loading\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElButton\n\t\t\t\t{...elButtonProps.value}\n\t\t\t\tref={buttonRef}\n\t\t\t\tclass=\"fa-button\"\n\t\t\t\tloading={state.loading}\n\t\t\t\tonClick={withModifiers((event: Event) => handleClick(event as MouseEvent), [\"prevent\"])}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () => slots.default && slots.default(),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading() }),\n\t\t\t\t\t...(slots.icon && { icon: (): VNode[] => slots.icon() }),\n\t\t\t\t}}\n\t\t\t</ElButton>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 按钮 html 元素 */\n\t\t\tref: computed(() => buttonRef.value?.ref),\n\t\t\t/** @description 按钮尺寸 */\n\t\t\tsize: computed(() => buttonRef.value?.size),\n\t\t\t/** @description 按钮类型 */\n\t\t\ttype: computed(() => buttonRef.value?.type),\n\t\t\t/** @description 按钮已禁用 */\n\t\t\tdisabled: computed(() => buttonRef.value?.disabled),\n\t\t\t/** @description 是否在两个字符之间插入空格 */\n\t\t\tshouldAddSpace: computed(() => buttonRef.value?.shouldAddSpace),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 按钮加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"names":["faButtonProps","buttonProps","loadingIcon","type","definePropType","String","Object","Function","default","Eleme","disabledLoading","Boolean","faButtonEmits","buttonEmits","click","event","done","MouseEvent","isFunction","Button","name","props","emits","slots","makeSlots","setup","attrs","emit","expose","state","reactive","loading","buttonRef","ref","showLoading","useOverlay","show","hideLoading","hide","watch","newValue","immediate","elButtonProps","useProps","useRender","_createVNode","ElButton","_mergeProps","value","class","onClick","withModifiers","handleClick","icon","useExpose","computed","size","disabled","shouldAddSpace","doLoading","loadingFunction","execFunction","then","catch","error","consoleError","finally"],"mappings":"qiBASO,MAAMA,EAAgB,IACzBC,EAKHC,YAAa,CACZC,KAAMC,EAAmC,CAACC,OAAQC,OAAQC,WAC1DC,QAASA,IAA0BC,GAGpCC,gBAAiBC,SAGLC,EAAgB,IACzBC,EAKHC,MAAOA,CAACC,EAAmBC,EAAmBA,SAAsBD,aAAiBE,YAAcC,EAAWF,IAY/GG,mBAA+B,CAC9BC,KAAM,WACNC,MAAOrB,EACPsB,MAAOV,EACPW,MAAOC,IACPC,KAAAA,CAAMJ,GAAOK,MAAEA,EAAAA,MAAOH,EAAAA,KAAOI,EAAAA,OAAMC,IAClC,MAAMC,EAAQC,EAAS,CACtBC,SAAS,IAGJC,EAAYC,IAEZC,EAAcA,KACnBL,EAAME,SAAU,EAEhBI,EAAWC,KAAK,IAGXC,EAAcA,KACnBR,EAAME,SAAU,EAChBI,EAAWG,QA6BZC,EACC,IAAMlB,EAAMU,QACXS,IACInB,EAAMX,kBACN8B,EACHN,IAEAG,MAGF,CACCI,WAAW,IAIb,MAAMC,EAAgBC,EAAStB,EAAOpB,EAAa,CAAC,YAkBpD,OAhBA2C,EAAU,IAAAC,EAAAC,EAAAC,EAEJL,EAAcM,MAAK,CAAAf,IAClBD,EAASiB,MAAA,YAAAlB,QAELF,EAAME,QAAOmB,QACbC,EAAepC,GArCLA,CAAAA,IAChBM,EAAMX,gBAETiB,EAAK,QAASZ,IAEdmB,IAEAP,EAAK,QAASZ,EAAOsB,KA8BoBe,CAAYrC,GAAsB,CAAC,cAAW,CAGtFP,QAASA,IAAMe,EAAMf,SAAWe,EAAMf,aAClCe,EAAMQ,SAAW,CAAEA,QAASA,IAAeR,EAAMQ,cACjDR,EAAM8B,MAAQ,CAAEA,KAAMA,IAAe9B,EAAM8B,WAK3CC,EAAU1B,EAAQ,CAExBK,IAAKsB,EAAS,IAAMvB,EAAUgB,OAAOf,KAErCuB,KAAMD,EAAS,IAAMvB,EAAUgB,OAAOQ,MAEtCrD,KAAMoD,EAAS,IAAMvB,EAAUgB,OAAO7C,MAEtCsD,SAAUF,EAAS,IAAMvB,EAAUgB,OAAOS,UAE1CC,eAAgBH,EAAS,IAAMvB,EAAUgB,OAAOU,gBAEhD3B,QAASwB,EAAS,IAAM1B,EAAME,SAE9B4B,UAzEsBC,IACtB/B,EAAME,SAAU,EAChB8B,EAAaD,GACXE,OACAC,MAAOC,IACPC,EAAa,WAAYD,KAEzBE,QAAQ,KACRrC,EAAME,SAAU,MAmEpB"}
1
+ {"version":3,"file":"button.mjs","sources":["../../../../../packages/components/button/src/button.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref, watch, withModifiers } from \"vue\";\nimport { ElButton, buttonEmits, buttonProps } from \"element-plus\";\nimport { Eleme } from \"@element-plus/icons-vue\";\nimport { useOverlay } from \"@fast-element-plus/hooks\";\nimport { consoleError, definePropType, execFunction, makeSlots, useExpose, useProps, useRender } from \"@fast-china/utils\";\nimport { isFunction } from \"lodash-unified\";\nimport type { ButtonInstance } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\nexport const faButtonProps = {\n\t...buttonProps,\n\t/**\n\t * @description customize loading icon component\n\t * @default Eleme\n\t */\n\tloadingIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: (): string | Component => Eleme,\n\t},\n\t/** @description 禁用加载 */\n\tdisabledLoading: Boolean,\n};\n\nexport const faButtonEmits = {\n\t...buttonEmits,\n\t/**\n\t * @description 点击事件\n\t * @param done 需要手动隐藏Loading\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tclick: (event: MouseEvent, done: () => void = () => {}): boolean => event instanceof MouseEvent && isFunction(done),\n};\n\ntype FaButtonSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 自定义加载中组件 */\n\tloading: never;\n\t/** @description 自定义图标组件 */\n\ticon: never;\n};\n\nexport default defineComponent({\n\tname: \"FaButton\",\n\tprops: faButtonProps,\n\temits: faButtonEmits,\n\tslots: makeSlots<FaButtonSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t});\n\n\t\tconst buttonRef = ref<ButtonInstance>();\n\n\t\tconst showLoading = (): void => {\n\t\t\tstate.loading = true;\n\t\t\t// 这里默认透明\n\t\t\tuseOverlay.show(0);\n\t\t};\n\n\t\tconst hideLoading = (): void => {\n\t\t\tstate.loading = false;\n\t\t\tuseOverlay.hide();\n\t\t};\n\n\t\tconst handleLoading = (loadingFunction: () => void | Promise<void>): void => {\n\t\t\tstate.loading = true;\n\t\t\texecFunction(loadingFunction)\n\t\t\t\t.then()\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsoleError(\"FaButton\", error);\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tstate.loading = false;\n\t\t\t\t});\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent): void => {\n\t\t\tif (props.disabledLoading) {\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event);\n\t\t\t} else {\n\t\t\t\tshowLoading();\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event, hideLoading);\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * 监听外部 loading 的值\n\t\t */\n\t\twatch(\n\t\t\t() => props.loading,\n\t\t\t(newValue) => {\n\t\t\t\tif (props.disabledLoading) return;\n\t\t\t\tif (newValue) {\n\t\t\t\t\tshowLoading();\n\t\t\t\t} else {\n\t\t\t\t\thideLoading();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst elButtonProps = useProps(props, buttonProps, [\"loading\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElButton\n\t\t\t\t{...elButtonProps.value}\n\t\t\t\tref={buttonRef}\n\t\t\t\tclass=\"fa-button\"\n\t\t\t\tloading={state.loading}\n\t\t\t\tonClick={withModifiers((event: Event) => handleClick(event as MouseEvent), [\"prevent\"])}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () => slots.default && slots.default(),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading() }),\n\t\t\t\t\t...(slots.icon && { icon: (): VNode[] => slots.icon() }),\n\t\t\t\t}}\n\t\t\t</ElButton>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 按钮 html 元素 */\n\t\t\tref: computed(() => buttonRef.value?.ref),\n\t\t\t/** @description 按钮尺寸 */\n\t\t\tsize: computed(() => buttonRef.value?.size),\n\t\t\t/** @description 按钮类型 */\n\t\t\ttype: computed(() => buttonRef.value?.type),\n\t\t\t/** @description 按钮已禁用 */\n\t\t\tdisabled: computed(() => buttonRef.value?.disabled),\n\t\t\t/** @description 是否在两个字符之间插入空格 */\n\t\t\tshouldAddSpace: computed(() => buttonRef.value?.shouldAddSpace),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 按钮加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"names":["faButtonProps","buttonProps","loadingIcon","type","definePropType","String","Object","Function","default","Eleme","disabledLoading","Boolean","faButtonEmits","buttonEmits","click","event","done","MouseEvent","isFunction","Button","name","props","emits","slots","makeSlots","setup","attrs","emit","expose","state","reactive","loading","buttonRef","ref","showLoading","useOverlay","show","hideLoading","hide","watch","newValue","immediate","elButtonProps","useProps","useRender","_createVNode","ElButton","_mergeProps","value","class","onClick","withModifiers","handleClick","icon","useExpose","computed","size","disabled","shouldAddSpace","doLoading","loadingFunction","execFunction","then","catch","error","consoleError","finally"],"mappings":"qiBASO,MAAMA,EAAgB,IACzBC,EAKHC,YAAa,CACZC,KAAMC,EAAmC,CAACC,OAAQC,OAAQC,WAC1DC,QAASA,IAA0BC,GAGpCC,gBAAiBC,SAGLC,EAAgB,IACzBC,EAMHC,MAAOA,CAACC,EAAmBC,EAAmBA,SAAsBD,aAAiBE,YAAcC,EAAWF,IAY/GG,mBAA+B,CAC9BC,KAAM,WACNC,MAAOrB,EACPsB,MAAOV,EACPW,MAAOC,IACPC,KAAAA,CAAMJ,GAAOK,MAAEA,EAAAA,MAAOH,EAAAA,KAAOI,EAAAA,OAAMC,IAClC,MAAMC,EAAQC,EAAS,CACtBC,SAAS,IAGJC,EAAYC,IAEZC,EAAcA,KACnBL,EAAME,SAAU,EAEhBI,EAAWC,KAAK,IAGXC,EAAcA,KACnBR,EAAME,SAAU,EAChBI,EAAWG,QA6BZC,EACC,IAAMlB,EAAMU,QACXS,IACInB,EAAMX,kBACN8B,EACHN,IAEAG,MAGF,CACCI,WAAW,IAIb,MAAMC,EAAgBC,EAAStB,EAAOpB,EAAa,CAAC,YAkBpD,OAhBA2C,EAAU,IAAAC,EAAAC,EAAAC,EAEJL,EAAcM,MAAK,CAAAf,IAClBD,EAASiB,MAAA,YAAAlB,QAELF,EAAME,QAAOmB,QACbC,EAAepC,GArCLA,CAAAA,IAChBM,EAAMX,gBAETiB,EAAK,QAASZ,IAEdmB,IAEAP,EAAK,QAASZ,EAAOsB,KA8BoBe,CAAYrC,GAAsB,CAAC,cAAW,CAGtFP,QAASA,IAAMe,EAAMf,SAAWe,EAAMf,aAClCe,EAAMQ,SAAW,CAAEA,QAASA,IAAeR,EAAMQ,cACjDR,EAAM8B,MAAQ,CAAEA,KAAMA,IAAe9B,EAAM8B,WAK3CC,EAAU1B,EAAQ,CAExBK,IAAKsB,EAAS,IAAMvB,EAAUgB,OAAOf,KAErCuB,KAAMD,EAAS,IAAMvB,EAAUgB,OAAOQ,MAEtCrD,KAAMoD,EAAS,IAAMvB,EAAUgB,OAAO7C,MAEtCsD,SAAUF,EAAS,IAAMvB,EAAUgB,OAAOS,UAE1CC,eAAgBH,EAAS,IAAMvB,EAAUgB,OAAOU,gBAEhD3B,QAASwB,EAAS,IAAM1B,EAAME,SAE9B4B,UAzEsBC,IACtB/B,EAAME,SAAU,EAChB8B,EAAaD,GACXE,OACAC,MAAOC,IACPC,EAAa,WAAYD,KAEzBE,QAAQ,KACRrC,EAAME,SAAU,MAmEpB"}
@@ -1,2 +1,2 @@
1
- import{isVNode as e,defineComponent as l,reactive as a,computed as t,ref as r,inject as o,createVNode as u,Fragment as n,createTextVNode as i,mergeProps as p}from"vue";import{formContextKey as s,formItemContextKey as d,ElMessage as c,inputProps as m,ElPopover as v,ElButton as _,ElInput as f}from"element-plus";import{Back as b}from"@element-plus/icons-vue";import"../../../constants/index.mjs";import{useProps as h,useRender as g}from"@fast-china/utils";import{isString as y,isNull as C}from"lodash-unified";import{CarNumberArea as k,CarNumberDigit as w,CarNumberLetter as j}from"./common.mjs";import{useVModel as V}from"@vueuse/core";import{RegExps as x}from"../../../constants/regex.mjs";function B(l){return"function"==typeof l||"[object Object]"===Object.prototype.toString.call(l)&&!e(l)}const F=/* @__PURE__ */l({name:"FaCarNumber",props:{...m,modelValue:{type:String,default:void 0},placeholder:{type:String,default:"请选择"}},emits:{"update:modelValue":e=>y(e)||C(e),change:e=>y(e)||C(e)},setup(e,{attrs:l,slots:y,emit:C,expose:F}){const N=V(e,"modelValue",C,{passive:!0}),A=a({switchLetter:t(()=>N.value?.length>=1),disabledButton:t(()=>N.value?.length>=8)}),L=r(),S=o(s,void 0),$=o(d,void 0),O=e=>2===e.length?`${e} ● `:e.length>2?`${e.slice(0,2)} ● ${e.slice(2)}`:e,E=e=>{N.value??="",N.value+=e},U=()=>{0!==N.value?.length&&(N.value=N.value.substring(0,N.value.length-1))},q=()=>{let e=!1;7===N.value.length?e=x.CarNumber.test(N.value):8===N.value.length&&(e=x.NewEnergyCarNumber.test(N.value)),e?(C("change",N.value),$?.prop&&S?.validateField([$.prop])):$?.prop&&S?(C("change",N.value),S.validateField([$.prop])):c.error("车牌号格式不正确"),L.value?.hide()},z=()=>{N.value=null,C("change",null),$?.prop&&S?.validateField([$.prop])},D=h(e,m,["modelValue","readonly","formatter"]);g(()=>u(v,{ref:L,width:"auto",popperClass:"fa-car-number__popover",trigger:"click",showArrow:!1,showAfter:0,hideAfter:0},{reference:()=>u(f,p(D.value,{class:"fa-car-number__input",modelValue:N.value,"onUpdate:modelValue":e=>N.value=e,readonly:!0,formatter:O}),null),default:()=>u(n,null,[u("div",{class:["fa-car-number__popover__area",A.switchLetter?"fa-car-number__popover__hide":""]},[k.map(e=>u(_,{disabled:A.disabledButton,onClick:()=>E(e)},B(e)?e:{default:()=>[e]}))]),u("div",{class:["fa-car-number__popover__digit-letter",A.switchLetter?"":"fa-car-number__popover__hide"]},[w.map(e=>u(_,{disabled:A.disabledButton,onClick:()=>E(e)},B(e)?e:{default:()=>[e]})),j.map(e=>u(_,{disabled:A.disabledButton,onClick:()=>E(e)},B(e)?e:{default:()=>[e]}))]),u("div",{class:"fa-car-number__popover__btn"},[u(_,{class:"fa-car-number__popover__btn__clear",disabled:null===N.value||0===N.value.length,onClick:z},{default:()=>[i("清除")]}),u(_,{class:"fa-car-number__popover__btn__back",type:"danger",icon:b,disabled:null===N.value||0===N.value.length,onClick:U},null),u(_,{class:"fa-car-number__popover__btn__confirm",type:"primary",disabled:null===N.value||N.value.length<7,onClick:q},{default:()=>[i("确认")]})])])}))}});export{F as default};
1
+ import{isVNode as e,defineComponent as l,reactive as a,computed as t,ref as r,inject as o,createVNode as u,Fragment as n,createTextVNode as i,mergeProps as p}from"vue";import{formContextKey as s,formItemContextKey as d,ElMessage as c,inputProps as m,ElPopover as v,ElButton as _,ElInput as f}from"element-plus";import{Back as b}from"@element-plus/icons-vue";import"../../../constants/index.mjs";import{useProps as h,useRender as g}from"@fast-china/utils";import{useVModel as y}from"@vueuse/core";import{isString as C,isNull as k}from"lodash-unified";import{CarNumberArea as w,CarNumberDigit as j,CarNumberLetter as V}from"./common.mjs";import{RegExps as x}from"../../../constants/regex.mjs";function B(l){return"function"==typeof l||"[object Object]"===Object.prototype.toString.call(l)&&!e(l)}const F=/* @__PURE__ */l({name:"FaCarNumber",props:{...m,modelValue:{type:String,default:void 0},placeholder:{type:String,default:"请选择"}},emits:{"update:modelValue":e=>C(e)||k(e),change:e=>C(e)||k(e)},setup(e,{attrs:l,slots:C,emit:k,expose:F}){const N=y(e,"modelValue",k,{passive:!0}),A=a({switchLetter:t(()=>N.value?.length>=1),disabledButton:t(()=>N.value?.length>=8)}),L=r(),S=o(s,void 0),$=o(d,void 0),O=e=>2===e.length?`${e} ● `:e.length>2?`${e.slice(0,2)} ● ${e.slice(2)}`:e,E=e=>{N.value??="",N.value+=e},U=()=>{0!==N.value?.length&&(N.value=N.value.substring(0,N.value.length-1))},q=()=>{let e=!1;7===N.value.length?e=x.CarNumber.test(N.value):8===N.value.length&&(e=x.NewEnergyCarNumber.test(N.value)),e?(k("change",N.value),$?.prop&&S?.validateField([$.prop])):$?.prop&&S?(k("change",N.value),S.validateField([$.prop])):c.error("车牌号格式不正确"),L.value?.hide()},z=()=>{N.value=null,k("change",null),$?.prop&&S?.validateField([$.prop])},D=h(e,m,["modelValue","readonly","formatter"]);g(()=>u(v,{ref:L,width:"auto",popperClass:"fa-car-number__popover",trigger:"click",showArrow:!1,showAfter:0,hideAfter:0},{reference:()=>u(f,p(D.value,{class:"fa-car-number__input",modelValue:N.value,"onUpdate:modelValue":e=>N.value=e,readonly:!0,formatter:O}),null),default:()=>u(n,null,[u("div",{class:["fa-car-number__popover__area",A.switchLetter?"fa-car-number__popover__hide":""]},[w.map(e=>u(_,{disabled:A.disabledButton,onClick:()=>E(e)},B(e)?e:{default:()=>[e]}))]),u("div",{class:["fa-car-number__popover__digit-letter",A.switchLetter?"":"fa-car-number__popover__hide"]},[j.map(e=>u(_,{disabled:A.disabledButton,onClick:()=>E(e)},B(e)?e:{default:()=>[e]})),V.map(e=>u(_,{disabled:A.disabledButton,onClick:()=>E(e)},B(e)?e:{default:()=>[e]}))]),u("div",{class:"fa-car-number__popover__btn"},[u(_,{class:"fa-car-number__popover__btn__clear",disabled:null===N.value||0===N.value.length,onClick:z},{default:()=>[i("清除")]}),u(_,{class:"fa-car-number__popover__btn__back",type:"danger",icon:b,disabled:null===N.value||0===N.value.length,onClick:U},null),u(_,{class:"fa-car-number__popover__btn__confirm",type:"primary",disabled:null===N.value||N.value.length<7,onClick:q},{default:()=>[i("确认")]})])])}))}});export{F as default};
2
2
  //# sourceMappingURL=carNumber.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"carNumber.mjs","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","value","isString","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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FC,EAAgBP,IAAKQ,GAAMzB,EAAAmB,EAAA,CAAAC,SACPpD,EAAMK,eAAcgD,QAAWA,IAAMtC,EAAsB0C,IAAOtF,EACpFsF,GAAAA,EAAM,CAAAxE,QAAAA,IAAA,CAANwE,QAEDzB,EAAA,MAAA,CAAAW,MAAA,+BAAA,CAAAX,EAAAmB,EAAA,CAAAR,MAAA,qCAAAS,SAK8B,OAArBtE,EAAWO,OAA8C,IAA5BP,EAAWO,MAAMe,OAAYiD,QAC3DzB,GAAgB,CAAA3C,QAAAA,IAAA,CAAAyE,EAAA,SAAA1B,EAAAmB,EAAA,CAAAR,MAAA,oCAAA5D,KAAA,SAAA4E,KAOnBC,EAAIR,SACqB,OAArBtE,EAAWO,OAA8C,IAA5BP,EAAWO,MAAMe,OAAYiD,QAC3DrC,GAAe,MAAAgB,EAAAmB,EAAA,CAAAR,MAAA,uCAAA5D,KAAA,UAAAqE,SAKO,OAArBtE,EAAWO,OAAkBP,EAAWO,MAAMe,OAAS,EAACiD,QACzDnC,GAAkB,CAAAjC,QAAAA,IAAA,CAAAyE,EAAA,eAUnC"}
1
+ {"version":3,"file":"carNumber.mjs","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 { useVModel } from \"@vueuse/core\";\nimport { isNull, isString } from \"lodash-unified\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\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","value","isString","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":"mrBAO0E,SAAAA,EAAAC,GAAA,MAAA,mBAAAA,GAAA,oBAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,KAAAK,EAAAL,EAAA,CAG1E,MAAAM,mBAA+B,CAC9BC,KAAM,cACNC,MAAO,IACHC,EAEHC,WAAY,CACXC,KAAMC,OACNC,aAASC,GAGVC,YAAa,CACZJ,KA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AAWO,MAAMe,OAAYiD,QAC3DzB,GAAgB,CAAA3C,QAAAA,IAAA,CAAAyE,EAAA,SAAA1B,EAAAmB,EAAA,CAAAR,MAAA,oCAAA5D,KAAA,SAAA4E,KAOnBC,EAAIR,SACqB,OAArBtE,EAAWO,OAA8C,IAA5BP,EAAWO,MAAMe,OAAYiD,QAC3DrC,GAAe,MAAAgB,EAAAmB,EAAA,CAAAR,MAAA,uCAAA5D,KAAA,UAAAqE,SAKO,OAArBtE,EAAWO,OAAkBP,EAAWO,MAAMe,OAAS,EAACiD,QACzDnC,GAAkB,CAAAjC,QAAAA,IAAA,CAAAyE,EAAA,eAUnC"}
@@ -1,7 +1,7 @@
1
- import { TableProps } from 'element-plus';
2
- import { PropType } from 'vue';
3
1
  import { PagedInput, PagedResult } from '../../table';
4
2
  import { ElSelectorOutput } from '../../select/src/select.type';
3
+ import { TableProps } from 'element-plus';
4
+ import { PropType } from 'vue';
5
5
  export declare const faInputDialogPageProps: {
6
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 */
7
7
  rowKey: {
@@ -1,2 +1,2 @@
1
- import{defineComponent as e,reactive as l,ref as o,createVNode as t,computed as i}from"vue";import{ElInput as a,ElButtonGroup as n,ElButton as u}from"element-plus";import{Delete as s,Search as r}from"@element-plus/icons-vue";import{definePropType as d,withDefineType as c,useRender as m,useExpose as p,makeSlots as f}from"@fast-china/utils";import{isString as v,isNull as g,isNumber as w,isFunction as b}from"lodash-unified";import{FaTable as y}from"../../table/index.mjs";import{useVModel as h}from"@vueuse/core";import{FaDialog as S}from"../../dialog/index.mjs";const K={rowKey:{type:[String,Function],default:"id"},modelValue:[String,Number],label:String,placeholder:{type:String,default:"请选择"},disabled:Boolean,title:String,requestApi:{type:d(Function)},initParam:d([String,Number,Object]),labelKey:{type:String,default:"name"}},R={"update:modelValue":e=>v(e)||w(e)||g(e),"update:label":e=>v(e)||g(e),change:(e,l)=>!0},C=/* @__PURE__ */e({name:"FaInputDialogPage",props:K,emits:R,slots:f(),setup(e,{attrs:d,slots:f,emit:v,expose:g}){const w=h(e,"modelValue",v,{passive:!0}),K=h(e,"label",v,{passive:!0}),R=l({selectionRow:c()}),C=o(),k=o(),V=()=>{w.value=null,K.value=null,v("change",null)},x=()=>{C.value.open(()=>{if(R.selectionRow){k.value.selectedListIds.includes(b(e.rowKey)?e.rowKey(R.selectionRow):R.selectionRow[e.rowKey])||k.value.toggleRowSelection(R.selectionRow)}})},P=()=>{C.value.close(()=>{if(k.value.selected){const l=k.value.selectedList[0];w.value=b(e.rowKey)?e.rowKey(l):l[e.rowKey],K.value=l[e.labelKey],v("change",l,w.value)}else w.value=null,K.value=null,v("change",null,null)})},j=e=>{k.value.clearSelection(),k.value.toggleRowSelection(e),R.selectionRow=e,P()};return m(()=>t("div",{class:"fa-input-dialog-page"},[t(a,{modelValue:K.value,"onUpdate:modelValue":e=>K.value=e,placeholder:e.placeholder,disabled:e.disabled,readonly:!0},{append:()=>t(n,null,{default:()=>[t(u,{disabled:e.disabled,icon:s,onClick:V},null),t(u,{disabled:e.disabled,icon:r,onClick:x},null)]})}),t(S,{ref:C,style:"--height: 70%;",width:"50%",title:e.title,fullHeight:!0,disabledConfirmButton:!k.value?.selected,onConfirmClick:P},{default:()=>[t(y,{ref:k,rowKey:e.rowKey,requestApi:e.requestApi,initParam:e.initParam,single:!0,rowClickSelection:!0,hideSearchTime:!0,onRowDblclick:j},{default:()=>f.default&&f.default()})]})])),p(g,{selectionRow:i(()=>R.selectionRow),open:x,clear:V})}});export{C as default,R as faInputDialogPageEmits,K as faInputDialogPageProps};
1
+ import{defineComponent as e,reactive as l,ref as o,createVNode as t,computed as i}from"vue";import{ElInput as a,ElButtonGroup as n,ElButton as u}from"element-plus";import{Delete as s,Search as r}from"@element-plus/icons-vue";import{FaDialog as d}from"../../dialog/index.mjs";import{FaTable as c}from"../../table/index.mjs";import{definePropType as m,withDefineType as p,useRender as f,useExpose as v,makeSlots as g}from"@fast-china/utils";import{useVModel as w}from"@vueuse/core";import{isString as b,isNull as y,isNumber as h,isFunction as S}from"lodash-unified";const K={rowKey:{type:[String,Function],default:"id"},modelValue:[String,Number],label:String,placeholder:{type:String,default:"请选择"},disabled:Boolean,title:String,requestApi:{type:m(Function)},initParam:m([String,Number,Object]),labelKey:{type:String,default:"name"}},R={"update:modelValue":e=>b(e)||h(e)||y(e),"update:label":e=>b(e)||y(e),change:(e,l)=>!0},C=/* @__PURE__ */e({name:"FaInputDialogPage",props:K,emits:R,slots:g(),setup(e,{attrs:m,slots:g,emit:b,expose:y}){const h=w(e,"modelValue",b,{passive:!0}),K=w(e,"label",b,{passive:!0}),R=l({selectionRow:p()}),C=o(),k=o(),V=()=>{h.value=null,K.value=null,b("change",null)},x=()=>{C.value.open(()=>{if(R.selectionRow){k.value.selectedListIds.includes(S(e.rowKey)?e.rowKey(R.selectionRow):R.selectionRow[e.rowKey])||k.value.toggleRowSelection(R.selectionRow)}})},P=()=>{C.value.close(()=>{if(k.value.selected){const l=k.value.selectedList[0];h.value=S(e.rowKey)?e.rowKey(l):l[e.rowKey],K.value=l[e.labelKey],b("change",l,h.value)}else h.value=null,K.value=null,b("change",null,null)})},j=e=>{k.value.clearSelection(),k.value.toggleRowSelection(e),R.selectionRow=e,P()};return f(()=>t("div",{class:"fa-input-dialog-page"},[t(a,{modelValue:K.value,"onUpdate:modelValue":e=>K.value=e,placeholder:e.placeholder,disabled:e.disabled,readonly:!0},{append:()=>t(n,null,{default:()=>[t(u,{disabled:e.disabled,icon:s,onClick:V},null),t(u,{disabled:e.disabled,icon:r,onClick:x},null)]})}),t(d,{ref:C,style:"--height: 70%;",width:"50%",title:e.title,fullHeight:!0,disabledConfirmButton:!k.value?.selected,onConfirmClick:P},{default:()=>[t(c,{ref:k,rowKey:e.rowKey,requestApi:e.requestApi,initParam:e.initParam,single:!0,rowClickSelection:!0,hideSearchTime:!0,onRowDblclick:j},{default:()=>g.default&&g.default()})]})])),v(y,{selectionRow:i(()=>R.selectionRow),open:x,clear:V})}});export{C as default,R as faInputDialogPageEmits,K as faInputDialogPageProps};
2
2
  //# sourceMappingURL=inputDialogPage.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"inputDialogPage.mjs","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","isString","value","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":"ojBAYO,MAAMA,EAAyB,CAErCC,OAAQ,CACPC,KAAM,CAACC,OAAQC,UACfC,QAAS,MAGVC,WAAY,CAACH,OAAQI,QAErBC,MAAOL,OAEPM,YAAa,CACZP,KAAMC,OACNE,QAAS,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sourcesContent":["import { computed, defineComponent, reactive, ref } from \"vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport FaDialog from \"@fast-element-plus/components/dialog\";\nimport { FaTable, type FaTableInstance, type PagedInput, type PagedResult } from \"@fast-element-plus/components/table\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"@fast-china/utils\";\nimport { useVModel } from \"@vueuse/core\";\nimport { isFunction, isNull, isNumber, isString } from \"lodash-unified\";\nimport type { FaDialogInstance } from \"@fast-element-plus/components/dialog\";\nimport type { ElSelectorOutput } from \"@fast-element-plus/components/select/src/select.type\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\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): boolean => isString(value) || isNumber(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string): boolean => 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","isString","value","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":"ojBAaO,MAAMA,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,EAAsEV,WAG7EW,UAAWD,EAAsC,CAACX,OAAQI,OAAQS,SAElEC,SAAU,CACTf,KAAMC,OACNE,QAAS,SAIEa,EAAyB,CAErC,uBAA0DC,EAASC,IAAUC,EAASD,IAAUE,EA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AvCAQ,EAAU,IAAAC,EAAA,MAAA,CAAAC,MAAA,wBAAA,CAAAD,EAAAE,EAAA,CAAAzD,WAES+B,EAAcjB,MAAK,sBAAA4C,GAAnB3B,EAAcjB,MAAK4C,EAAAvD,YAAekB,EAAMlB,YAAWC,SAAYiB,EAAMjB,SAAQuD,UAAA,GAAA,CAE5FC,OAAQA,IAAAL,EAAAM,EAAA,KAAA,CAAA9D,QAAAA,IAAA,CAAAwD,EAAAO,EAAA,CAAA1D,SAEciB,EAAMjB,SAAQ2D,KAAQC,EAAMC,QAAW1B,GAAiB,MAAAgB,EAAAO,EAAA,CAAA1D,SACxDiB,EAAMjB,SAAQ2D,KAAQG,EAAMD,QAAWzB,GAAiB,WAE7Ee,EAAAY,EAAA,CAAA9B,IAIGD,EAAWgC,MAAA,iBAAAC,MAAA,MAAA/D,MAGTe,EAAMf,MAAKgE,YAAA,EAAAC,uBAEMjC,EAAWxB,OAAOkC,SAAQwB,eAClC1B,GAAkB,CAAA/C,QAAAA,IAAA,CAAAwD,EAAAkB,EAAA,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,EAAUlD,EAAQ,CAExBM,aAAc6C,EAAS,IAAM/C,EAAME,cAEnCO,KAAMD,EAENwC,MAAOzC,GAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"layoutGridItem.mjs","sources":["../../../../../packages/components/layoutGrid/src/layoutGridItem.tsx"],"sourcesContent":["import { computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"@fast-china/utils\";\nimport type { FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\nimport type { FaLayoutGridBreakPoint } from \"@fast-element-plus/components/layoutGrid\";\nimport type { Ref } from \"vue\";\nimport { isNumber } from \"lodash-unified\";\n\ntype FaLayoutGridItemSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n};\n\nexport default defineComponent({\n\tname: \"FaLayoutGridItem\",\n\tprops: {\n\t\t/** @description 偏移 */\n\t\toffset: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 0,\n\t\t},\n\t\t/** @description 占位 */\n\t\tspan: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 后缀 */\n\t\tsuffix: { type: Boolean, default: false },\n\t\t/** @description 响应式,小于480px屏幕配置 */\n\t\txs: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板竖屏配置 */\n\t\tsm: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板横屏配置 */\n\t\tmd: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,小型桌面配置 */\n\t\tlg: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,大型桌面配置 */\n\t\txl: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t},\n\tslots: makeSlots<FaLayoutGridItemSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tshow: true,\n\t\t});\n\n\t\tconst attrsObj = attrs as any;\n\n\t\t// 注入断点\n\t\tconst breakPoint = inject<Ref<FaLayoutGridBreakPoint>>(\"breakPoint\", ref(\"xl\"));\n\t\tconst shouldHiddenIndex = inject<Ref<number>>(\"shouldHiddenIndex\", ref(-1));\n\n\t\twatch(\n\t\t\t() => [shouldHiddenIndex.value, breakPoint.value],\n\t\t\t(n) => {\n\t\t\t\tif (~~attrsObj.index) {\n\t\t\t\t\tstate.show = !(n[0] !== -1 && parseInt(attrsObj.index) >= Number(n[0]));\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tconst gap = inject(\"gap\", 0);\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(5));\n\n\t\tconst style = computed(() => {\n\t\t\tconst breakPointObk = props[breakPoint.value] as FaLayoutGridItemResponsive;\n\t\t\tconst span = breakPointObk?.span ?? (isNumber(props.span) ? props.span : Number(props.span));\n\t\t\tconst offset = breakPointObk?.offset ?? (isNumber(props.offset) ? props.offset : Number(props.offset));\n\t\t\tif (props.suffix) {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumnStart: cols.value - span - offset + 1,\n\t\t\t\t\tgridColumnEnd: `span ${span + offset}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${\n\t\t\t\t\t\tspan + offset > cols.value ? cols.value : span + offset\n\t\t\t\t\t}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<div style={style.value} vShow={state.show}>\n\t\t\t\t{slots.default && slots.default()}\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\tshow: state.show,\n\t\t});\n\t},\n});\n"],"names":["LayoutGridItem","name","props","offset","type","String","Number","default","span","suffix","Boolean","xs","definePropType","Object","undefined","sm","md","lg","xl","slots","makeSlots","setup","attrs","emit","expose","state","reactive","show","attrsObj","breakPoint","inject","ref","shouldHiddenIndex","watch","value","n","index","parseInt","immediate","gap","cols","style","computed","breakPointObk","isNumber","gridColumnStart","gridColumnEnd","marginLeft","gridColumn","useRender","_withDirectives","_createVNode","_vShow","useExpose"],"mappings":"4RAYA,MAAAA,mBAA+B,CAC9BC,KAAM,mBACNC,MAAO,CAENC,OAAQ,CACPC,KAAM,CAACC,OAAQC,QACfC,QAAS,GAGVC,KAAM,CACLJ,KAAM,CAACC,OAAQC,QACfC,QAAS,GAGVE,OAAQ,CAAEL,KAAMM,QAASH,SAAS,GAElCI,GAAI,CACHP,KAAMQ,EAA2CC,QACjDN,aAASO,GAGVC,GAAI,CACHX,KAAMQ,EAA2CC,QACjDN,aAASO,GAGVE,GAAI,CACHZ,KAAMQ,EAA2CC,QACjDN,aAASO,GAGVG,GAAI,CACHb,KAAMQ,EAA2CC,QACjDN,aAASO,GAGVI,GAAI,CACHd,KAAMQ,EAA2CC,QACjDN,aAASO,IAGXK,MAAOC,IACPC,KAAAA,CAAMnB,GAAOoB,MAAEA,EAAAA,MAAOH,EAAAA,KAAOI,EAAAA,OAAMC,IAClC,MAAMC,EAAQC,EAAS,CACtBC,MAAM,IAGDC,EAAWN,EAGXO,EAAaC,EAAoC,aAAcC,EAAI,OACnEC,EAAoBF,EAAoB,oBAAqBC,OAEnEE,EACC,IAAM,CAACD,EAAkBE,MAAOL,EAAWK,OAC1CC,MACMP,EAASQ,QACdX,EAAME,QAAkB,IAATQ,EAAE,IAAaE,SAAST,EAASQ,QAAU9B,OAAO6B,EAAE,OAGrE,CAAEG,WAAW,IAGd,MAAMC,EAAMT,EAAO,MAAO,GACpBU,EAAOV,EAAoB,OAAQC,EAAI,IAEvCU,EAAQC,EAAS,KACtB,MAAMC,EAAgBzC,EAAM2B,EAAWK,OACjC1B,EAAOmC,GAAenC,OAASoC,EAAS1C,EAAMM,MAAQN,EAAMM,KAAOF,OAAOJ,EAAMM,OAChFL,EAASwC,GAAexC,SAAWyC,EAAS1C,EAAMC,QAAUD,EAAMC,OAASG,OAAOJ,EAAMC,SAC9F,OAAID,EAAMO,OACF,CACNoC,gBAAiBL,EAAKN,MAAQ1B,EAAOL,EAAS,EAC9C2C,cAAe,QAAQtC,EAAOL,IAC9B4C,WAAuB,IAAX5C,EAAe,iBAAiBoC,UAAY/B,EAAOL,QAAaA,KAAY,SAGlF,CACN6C,WAAY,QAAQxC,EAAOL,EAASqC,EAAKN,MAAQM,EAAKN,MAAQ1B,EAAOL,UACpEK,EAAOL,EAASqC,EAAKN,MAAQM,EAAKN,MAAQ1B,EAAOL,IAElD4C,WAAuB,IAAX5C,EAAe,iBAAiBoC,UAAY/B,EAAOL,QAAaA,KAAY,WAW3F,OANA8C,EAAU,IAAAC,EAAAC,EAAA,MAAA,CAAAV,MACGA,EAAMP,OAAK,CACrBf,EAAMZ,SAAWY,EAAMZ,YAAS,CAAA,CAAA6C,EADF3B,EAAME,SAKhC0B,EAAU7B,EAAQ,CACxBG,KAAMF,EAAME,MAEd"}
1
+ {"version":3,"file":"layoutGridItem.mjs","sources":["../../../../../packages/components/layoutGrid/src/layoutGridItem.tsx"],"sourcesContent":["import { computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"@fast-china/utils\";\nimport { isNumber } from \"lodash-unified\";\nimport type { FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\nimport type { FaLayoutGridBreakPoint } from \"@fast-element-plus/components/layoutGrid\";\nimport type { Ref } from \"vue\";\n\ntype FaLayoutGridItemSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n};\n\nexport default defineComponent({\n\tname: \"FaLayoutGridItem\",\n\tprops: {\n\t\t/** @description 偏移 */\n\t\toffset: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 0,\n\t\t},\n\t\t/** @description 占位 */\n\t\tspan: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 后缀 */\n\t\tsuffix: { type: Boolean, default: false },\n\t\t/** @description 响应式,小于480px屏幕配置 */\n\t\txs: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板竖屏配置 */\n\t\tsm: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板横屏配置 */\n\t\tmd: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,小型桌面配置 */\n\t\tlg: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,大型桌面配置 */\n\t\txl: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t},\n\tslots: makeSlots<FaLayoutGridItemSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tshow: true,\n\t\t});\n\n\t\tconst attrsObj = attrs as any;\n\n\t\t// 注入断点\n\t\tconst breakPoint = inject<Ref<FaLayoutGridBreakPoint>>(\"breakPoint\", ref(\"xl\"));\n\t\tconst shouldHiddenIndex = inject<Ref<number>>(\"shouldHiddenIndex\", ref(-1));\n\n\t\twatch(\n\t\t\t() => [shouldHiddenIndex.value, breakPoint.value],\n\t\t\t(n) => {\n\t\t\t\tif (~~attrsObj.index) {\n\t\t\t\t\tstate.show = !(n[0] !== -1 && parseInt(attrsObj.index) >= Number(n[0]));\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tconst gap = inject(\"gap\", 0);\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(5));\n\n\t\tconst style = computed(() => {\n\t\t\tconst breakPointObk = props[breakPoint.value] as FaLayoutGridItemResponsive;\n\t\t\tconst span = breakPointObk?.span ?? (isNumber(props.span) ? props.span : Number(props.span));\n\t\t\tconst offset = breakPointObk?.offset ?? (isNumber(props.offset) ? props.offset : Number(props.offset));\n\t\t\tif (props.suffix) {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumnStart: cols.value - span - offset + 1,\n\t\t\t\t\tgridColumnEnd: `span ${span + offset}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${\n\t\t\t\t\t\tspan + offset > cols.value ? cols.value : span + offset\n\t\t\t\t\t}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<div style={style.value} vShow={state.show}>\n\t\t\t\t{slots.default && slots.default()}\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\tshow: state.show,\n\t\t});\n\t},\n});\n"],"names":["LayoutGridItem","name","props","offset","type","String","Number","default","span","suffix","Boolean","xs","definePropType","Object","undefined","sm","md","lg","xl","slots","makeSlots","setup","attrs","emit","expose","state","reactive","show","attrsObj","breakPoint","inject","ref","shouldHiddenIndex","watch","value","n","index","parseInt","immediate","gap","cols","style","computed","breakPointObk","isNumber","gridColumnStart","gridColumnEnd","marginLeft","gridColumn","useRender","_withDirectives","_createVNode","_vShow","useExpose"],"mappings":"4RAYA,MAAAA,mBAA+B,CAC9BC,KAAM,mBACNC,MAAO,CAENC,OAAQ,CACPC,KAAM,CAACC,OAAQC,QACfC,QAAS,GAGVC,KAA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AAQM,EAAKN,MAAQ1B,EAAOL,UACpEK,EAAOL,EAASqC,EAAKN,MAAQM,EAAKN,MAAQ1B,EAAOL,IAElD4C,WAAuB,IAAX5C,EAAe,iBAAiBoC,UAAY/B,EAAOL,QAAaA,KAAY,WAW3F,OANA8C,EAAU,IAAAC,EAAAC,EAAA,MAAA,CAAAV,MACGA,EAAMP,OAAK,CACrBf,EAAMZ,SAAWY,EAAMZ,YAAS,CAAA,CAAA6C,EADF3B,EAAME,SAKhC0B,EAAU7B,EAAQ,CACxBG,KAAMF,EAAME,MAEd"}
package/es/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "1.0.15";
1
+ export declare const version = "1.0.16";
package/es/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const o="1.0.15";export{o as version};
1
+ const o="1.0.16";export{o as version};
2
2
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../packages/version.ts"],"sourcesContent":["export const version = \"1.0.15\";\n"],"names":["version"],"mappings":"AAAO,MAAMA,EAAU"}
1
+ {"version":3,"file":"version.mjs","sources":["../../packages/version.ts"],"sourcesContent":["export const version = \"1.0.16\";\n"],"names":["version"],"mappings":"AAAO,MAAMA,EAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../../../../packages/components/button/src/button.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref, watch, withModifiers } from \"vue\";\nimport { ElButton, buttonEmits, buttonProps } from \"element-plus\";\nimport { Eleme } from \"@element-plus/icons-vue\";\nimport { useOverlay } from \"@fast-element-plus/hooks\";\nimport { consoleError, definePropType, execFunction, makeSlots, useExpose, useProps, useRender } from \"@fast-china/utils\";\nimport { isFunction } from \"lodash-unified\";\nimport type { ButtonInstance } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\nexport const faButtonProps = {\n\t...buttonProps,\n\t/**\n\t * @description customize loading icon component\n\t * @default Eleme\n\t */\n\tloadingIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: (): string | Component => Eleme,\n\t},\n\t/** @description 禁用加载 */\n\tdisabledLoading: Boolean,\n};\n\nexport const faButtonEmits = {\n\t...buttonEmits,\n\t/**\n\t * @description 点击事件\n\t * @param done 需要手动隐藏Loading\n\t */\n\tclick: (event: MouseEvent, done: () => void = () => {}): boolean => event instanceof MouseEvent && isFunction(done),\n};\n\ntype FaButtonSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 自定义加载中组件 */\n\tloading: never;\n\t/** @description 自定义图标组件 */\n\ticon: never;\n};\n\nexport default defineComponent({\n\tname: \"FaButton\",\n\tprops: faButtonProps,\n\temits: faButtonEmits,\n\tslots: makeSlots<FaButtonSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t});\n\n\t\tconst buttonRef = ref<ButtonInstance>();\n\n\t\tconst showLoading = (): void => {\n\t\t\tstate.loading = true;\n\t\t\t// 这里默认透明\n\t\t\tuseOverlay.show(0);\n\t\t};\n\n\t\tconst hideLoading = (): void => {\n\t\t\tstate.loading = false;\n\t\t\tuseOverlay.hide();\n\t\t};\n\n\t\tconst handleLoading = (loadingFunction: () => void | Promise<void>): void => {\n\t\t\tstate.loading = true;\n\t\t\texecFunction(loadingFunction)\n\t\t\t\t.then()\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsoleError(\"FaButton\", error);\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tstate.loading = false;\n\t\t\t\t});\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent): void => {\n\t\t\tif (props.disabledLoading) {\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event);\n\t\t\t} else {\n\t\t\t\tshowLoading();\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event, hideLoading);\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * 监听外部 loading 的值\n\t\t */\n\t\twatch(\n\t\t\t() => props.loading,\n\t\t\t(newValue) => {\n\t\t\t\tif (props.disabledLoading) return;\n\t\t\t\tif (newValue) {\n\t\t\t\t\tshowLoading();\n\t\t\t\t} else {\n\t\t\t\t\thideLoading();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst elButtonProps = useProps(props, buttonProps, [\"loading\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElButton\n\t\t\t\t{...elButtonProps.value}\n\t\t\t\tref={buttonRef}\n\t\t\t\tclass=\"fa-button\"\n\t\t\t\tloading={state.loading}\n\t\t\t\tonClick={withModifiers((event: Event) => handleClick(event as MouseEvent), [\"prevent\"])}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () => slots.default && slots.default(),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading() }),\n\t\t\t\t\t...(slots.icon && { icon: (): VNode[] => slots.icon() }),\n\t\t\t\t}}\n\t\t\t</ElButton>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 按钮 html 元素 */\n\t\t\tref: computed(() => buttonRef.value?.ref),\n\t\t\t/** @description 按钮尺寸 */\n\t\t\tsize: computed(() => buttonRef.value?.size),\n\t\t\t/** @description 按钮类型 */\n\t\t\ttype: computed(() => buttonRef.value?.type),\n\t\t\t/** @description 按钮已禁用 */\n\t\t\tdisabled: computed(() => buttonRef.value?.disabled),\n\t\t\t/** @description 是否在两个字符之间插入空格 */\n\t\t\tshouldAddSpace: computed(() => buttonRef.value?.shouldAddSpace),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 按钮加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"names":["faButtonProps","buttonProps","loadingIcon","type","definePropType","String","Object","Function","default","Eleme","disabledLoading","Boolean","faButtonEmits","buttonEmits","click","event","done","MouseEvent","isFunction","Button","name","props","emits","slots","makeSlots","setup","attrs","emit","expose","state","reactive","loading","buttonRef","ref","showLoading","useOverlay","show","hideLoading","hide","watch","newValue","immediate","elButtonProps","useProps","useRender","_createVNode","ElButton","_mergeProps","value","class","onClick","withModifiers","handleClick","icon","useExpose","computed","size","disabled","shouldAddSpace","doLoading","loadingFunction","execFunction","then","catch","error","consoleError","finally"],"mappings":"uVASaA,EAAgB,IACzBC,EAAAA,YAKHC,YAAa,CACZC,KAAMC,EAAAA,eAAmC,CAACC,OAAQC,OAAQC,WAC1DC,QAASA,IAA0BC,EAAAA,OAGpCC,gBAAiBC,SAGLC,EAAgB,IACzBC,EAAAA,YAKHC,MAAOA,CAACC,EAAmBC,EAAmBA,SAAsBD,aAAiBE,YAAcC,EAAAA,WAAWF,IAY/GG,oBAA+B,CAC9BC,KAAM,WACNC,MAAOrB,EACPsB,MAAOV,EACPW,MAAOC,EAAAA,YACPC,KAAAA,CAAMJ,GAAOK,MAAEA,EAAAA,MAAOH,EAAAA,KAAOI,EAAAA,OAAMC,IAClC,MAAMC,EAAQC,EAAAA,SAAS,CACtBC,SAAS,IAGJC,EAAYC,EAAAA,MAEZC,EAAcA,KACnBL,EAAME,SAAU,EAEhBI,EAAAA,WAAWC,KAAK,IAGXC,EAAcA,KACnBR,EAAME,SAAU,EAChBI,EAAAA,WAAWG,QA6BZC,EAAAA,MACC,IAAMlB,EAAMU,QACXS,IACInB,EAAMX,kBACN8B,EACHN,IAEAG,MAGF,CACCI,WAAW,IAIb,MAAMC,EAAgBC,EAAAA,SAAStB,EAAOpB,EAAAA,YAAa,CAAC,YAkBpD,OAhBA2C,EAAAA,UAAU,IAAAC,EAAAA,YAAAC,EAAAA,SAAAC,EAAAA,WAEJL,EAAcM,MAAK,CAAAf,IAClBD,EAASiB,MAAA,YAAAlB,QAELF,EAAME,QAAOmB,QACbC,EAAAA,cAAepC,GArCLA,CAAAA,IAChBM,EAAMX,gBAETiB,EAAK,QAASZ,IAEdmB,IAEAP,EAAK,QAASZ,EAAOsB,KA8BoBe,CAAYrC,GAAsB,CAAC,cAAW,CAGtFP,QAASA,IAAMe,EAAMf,SAAWe,EAAMf,aAClCe,EAAMQ,SAAW,CAAEA,QAASA,IAAeR,EAAMQ,cACjDR,EAAM8B,MAAQ,CAAEA,KAAMA,IAAe9B,EAAM8B,WAK3CC,EAAAA,UAAU1B,EAAQ,CAExBK,IAAKsB,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOf,KAErCuB,KAAMD,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOQ,MAEtCrD,KAAMoD,EAAAA,SAAS,IAAMvB,EAAUgB,OAAO7C,MAEtCsD,SAAUF,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOS,UAE1CC,eAAgBH,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOU,gBAEhD3B,QAASwB,EAAAA,SAAS,IAAM1B,EAAME,SAE9B4B,UAzEsBC,IACtB/B,EAAME,SAAU,EAChB8B,EAAAA,aAAaD,GACXE,OACAC,MAAOC,IACPC,EAAAA,aAAa,WAAYD,KAEzBE,QAAQ,KACRrC,EAAME,SAAU,MAmEpB"}
1
+ {"version":3,"file":"button.js","sources":["../../../../../packages/components/button/src/button.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref, watch, withModifiers } from \"vue\";\nimport { ElButton, buttonEmits, buttonProps } from \"element-plus\";\nimport { Eleme } from \"@element-plus/icons-vue\";\nimport { useOverlay } from \"@fast-element-plus/hooks\";\nimport { consoleError, definePropType, execFunction, makeSlots, useExpose, useProps, useRender } from \"@fast-china/utils\";\nimport { isFunction } from \"lodash-unified\";\nimport type { ButtonInstance } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\nexport const faButtonProps = {\n\t...buttonProps,\n\t/**\n\t * @description customize loading icon component\n\t * @default Eleme\n\t */\n\tloadingIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: (): string | Component => Eleme,\n\t},\n\t/** @description 禁用加载 */\n\tdisabledLoading: Boolean,\n};\n\nexport const faButtonEmits = {\n\t...buttonEmits,\n\t/**\n\t * @description 点击事件\n\t * @param done 需要手动隐藏Loading\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tclick: (event: MouseEvent, done: () => void = () => {}): boolean => event instanceof MouseEvent && isFunction(done),\n};\n\ntype FaButtonSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 自定义加载中组件 */\n\tloading: never;\n\t/** @description 自定义图标组件 */\n\ticon: never;\n};\n\nexport default defineComponent({\n\tname: \"FaButton\",\n\tprops: faButtonProps,\n\temits: faButtonEmits,\n\tslots: makeSlots<FaButtonSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t});\n\n\t\tconst buttonRef = ref<ButtonInstance>();\n\n\t\tconst showLoading = (): void => {\n\t\t\tstate.loading = true;\n\t\t\t// 这里默认透明\n\t\t\tuseOverlay.show(0);\n\t\t};\n\n\t\tconst hideLoading = (): void => {\n\t\t\tstate.loading = false;\n\t\t\tuseOverlay.hide();\n\t\t};\n\n\t\tconst handleLoading = (loadingFunction: () => void | Promise<void>): void => {\n\t\t\tstate.loading = true;\n\t\t\texecFunction(loadingFunction)\n\t\t\t\t.then()\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsoleError(\"FaButton\", error);\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tstate.loading = false;\n\t\t\t\t});\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent): void => {\n\t\t\tif (props.disabledLoading) {\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event);\n\t\t\t} else {\n\t\t\t\tshowLoading();\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event, hideLoading);\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * 监听外部 loading 的值\n\t\t */\n\t\twatch(\n\t\t\t() => props.loading,\n\t\t\t(newValue) => {\n\t\t\t\tif (props.disabledLoading) return;\n\t\t\t\tif (newValue) {\n\t\t\t\t\tshowLoading();\n\t\t\t\t} else {\n\t\t\t\t\thideLoading();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst elButtonProps = useProps(props, buttonProps, [\"loading\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElButton\n\t\t\t\t{...elButtonProps.value}\n\t\t\t\tref={buttonRef}\n\t\t\t\tclass=\"fa-button\"\n\t\t\t\tloading={state.loading}\n\t\t\t\tonClick={withModifiers((event: Event) => handleClick(event as MouseEvent), [\"prevent\"])}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () => slots.default && slots.default(),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading() }),\n\t\t\t\t\t...(slots.icon && { icon: (): VNode[] => slots.icon() }),\n\t\t\t\t}}\n\t\t\t</ElButton>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 按钮 html 元素 */\n\t\t\tref: computed(() => buttonRef.value?.ref),\n\t\t\t/** @description 按钮尺寸 */\n\t\t\tsize: computed(() => buttonRef.value?.size),\n\t\t\t/** @description 按钮类型 */\n\t\t\ttype: computed(() => buttonRef.value?.type),\n\t\t\t/** @description 按钮已禁用 */\n\t\t\tdisabled: computed(() => buttonRef.value?.disabled),\n\t\t\t/** @description 是否在两个字符之间插入空格 */\n\t\t\tshouldAddSpace: computed(() => buttonRef.value?.shouldAddSpace),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 按钮加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"names":["faButtonProps","buttonProps","loadingIcon","type","definePropType","String","Object","Function","default","Eleme","disabledLoading","Boolean","faButtonEmits","buttonEmits","click","event","done","MouseEvent","isFunction","Button","name","props","emits","slots","makeSlots","setup","attrs","emit","expose","state","reactive","loading","buttonRef","ref","showLoading","useOverlay","show","hideLoading","hide","watch","newValue","immediate","elButtonProps","useProps","useRender","_createVNode","ElButton","_mergeProps","value","class","onClick","withModifiers","handleClick","icon","useExpose","computed","size","disabled","shouldAddSpace","doLoading","loadingFunction","execFunction","then","catch","error","consoleError","finally"],"mappings":"uVASaA,EAAgB,IACzBC,EAAAA,YAKHC,YAAa,CACZC,KAAMC,EAAAA,eAAmC,CAACC,OAAQC,OAAQC,WAC1DC,QAASA,IAA0BC,EAAAA,OAGpCC,gBAAiBC,SAGLC,EAAgB,IACzBC,EAAAA,YAMHC,MAAOA,CAACC,EAAmBC,EAAmBA,SAAsBD,aAAiBE,YAAcC,EAAAA,WAAWF,IAY/GG,oBAA+B,CAC9BC,KAAM,WACNC,MAAOrB,EACPsB,MAAOV,EACPW,MAAOC,EAAAA,YACPC,KAAAA,CAAMJ,GAAOK,MAAEA,EAAAA,MAAOH,EAAAA,KAAOI,EAAAA,OAAMC,IAClC,MAAMC,EAAQC,EAAAA,SAAS,CACtBC,SAAS,IAGJC,EAAYC,EAAAA,MAEZC,EAAcA,KACnBL,EAAME,SAAU,EAEhBI,EAAAA,WAAWC,KAAK,IAGXC,EAAcA,KACnBR,EAAME,SAAU,EAChBI,EAAAA,WAAWG,QA6BZC,EAAAA,MACC,IAAMlB,EAAMU,QACXS,IACInB,EAAMX,kBACN8B,EACHN,IAEAG,MAGF,CACCI,WAAW,IAIb,MAAMC,EAAgBC,EAAAA,SAAStB,EAAOpB,EAAAA,YAAa,CAAC,YAkBpD,OAhBA2C,EAAAA,UAAU,IAAAC,EAAAA,YAAAC,EAAAA,SAAAC,EAAAA,WAEJL,EAAcM,MAAK,CAAAf,IAClBD,EAASiB,MAAA,YAAAlB,QAELF,EAAME,QAAOmB,QACbC,EAAAA,cAAepC,GArCLA,CAAAA,IAChBM,EAAMX,gBAETiB,EAAK,QAASZ,IAEdmB,IAEAP,EAAK,QAASZ,EAAOsB,KA8BoBe,CAAYrC,GAAsB,CAAC,cAAW,CAGtFP,QAASA,IAAMe,EAAMf,SAAWe,EAAMf,aAClCe,EAAMQ,SAAW,CAAEA,QAASA,IAAeR,EAAMQ,cACjDR,EAAM8B,MAAQ,CAAEA,KAAMA,IAAe9B,EAAM8B,WAK3CC,EAAAA,UAAU1B,EAAQ,CAExBK,IAAKsB,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOf,KAErCuB,KAAMD,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOQ,MAEtCrD,KAAMoD,EAAAA,SAAS,IAAMvB,EAAUgB,OAAO7C,MAEtCsD,SAAUF,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOS,UAE1CC,eAAgBH,EAAAA,SAAS,IAAMvB,EAAUgB,OAAOU,gBAEhD3B,QAASwB,EAAAA,SAAS,IAAM1B,EAAME,SAE9B4B,UAzEsBC,IACtB/B,EAAME,SAAU,EAChB8B,EAAAA,aAAaD,GACXE,OACAC,MAAOC,IACPC,EAAAA,aAAa,WAAYD,KAEzBE,QAAQ,KACRrC,EAAME,SAAU,MAmEpB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("element-plus"),a=require("@element-plus/icons-vue");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;
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("@vueuse/core"),o=require("lodash-unified"),u=require("./common.js"),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=>o.isString(e)||o.isNull(e),change:e=>o.isString(e)||o.isNull(e)},setup(o,{attrs:s,slots:d,emit:c,expose:p}){const v=l.useVModel(o,"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(o,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":""]},[u.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"]},[u.CarNumberDigit.map(a=>e.createVNode(t.ElButton,{disabled:m.disabledButton,onClick:()=>h(a)},i(a)?a:{default:()=>[a]})),u.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, { 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,OACNC,QAAS,QAGXG,MAAO,CAEN,uBAAwCC,EAAAA,SAASC,IAAUC,EAAAA,OAAOD,GAElEE,UAA2BH,EAAAA,SAASC,IAAUC,EAAAA,OAAOD,IAEtDG,KAAAA,CAAMb,GAAOc,MAAEA,EAAAA,MAAOC,EAAAA,KAAOC,EAAAA,OAAMC,IAClC,MAAMf,EAAagB,EAAAA,UAAUlB,EAAO,aAAcgB,EAAM,CAAEG,SAAS,IAE7DC,EAAQC,EAAAA,SAAS,CACtBC,aAAcC,EAAAA,SAAS,IAClBrB,EAAWQ,OAAOc,QAAU,GAKjCC,eAAgBF,EAAAA,SAAS,IACpBrB,EAAWQ,OAAOc,QAAU,KAO5BE,EAAaC,EAAAA,MAEbC,EAAcC,EAAAA,OAAOC,EAAAA,oBAAgBxB,GAErCyB,EAAkBF,EAAAA,OAAOG,EAAAA,wBAAoB1B,GAE7C2B,EAAwBvB,GACR,IAAjBA,EAAMc,OACF,GAAGd,OACAA,EAAMc,OAAS,EAClB,GAAGd,EAAMwB,MAAM,EAAG,QAAQxB,EAAMwB,MAAM,KAEtCxB,EAIHyB,EAAyBzB,IAC9BR,EAAWQ,QAAU,GACrBR,EAAWQ,OAASA,GAGf0B,EAAkBA,KACU,IAA7BlC,EAAWQ,OAAOc,SACtBtB,EAAWQ,MAAQR,EAAWQ,MAAM2B,UAAU,EAAGnC,EAAWQ,MAAMc,OAAS,KAGtEc,EAAqBA,KAC1B,I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,QAAAA,IAAA,CAAJiE,QAEDlB,EAAAA,YAAA,MAAA,CAAAW,MAES,CAAC,uCAAwC3C,EAAME,aAAe,GAAK,iCAA+B,CAC5GoD,EAAAA,eAAeL,IAAKM,GAAKvB,EAAAA,YAAAmB,EAAAA,SAAA,CAAAC,SACLpD,EAAMK,eAAcgD,QAAWA,IAAMtC,EAAsBwC,IAAMpF,EACnFoF,GAAAA,EAAK,CAAAtE,QAAAA,IAAA,CAALsE,MAGFC,EAAAA,gBAAgBP,IAAKQ,GAAMzB,EAAAA,YAAAmB,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"}
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 { useVModel } from \"@vueuse/core\";\nimport { isNull, isString } from \"lodash-unified\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\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":"sYAO0E,SAAAA,EAAAC,GAAA,MAAA,mBAAAA,GAAA,oBAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,KAAAK,EAAAA,QAAAL,EAAA,CAG1E,MAAAM,oBAA+B,CAC9BC,KAAM,cACNC,MAAO,IACHC,EAAAA,WAEHC,WAAY,CACXC,KAAMC,OACNC,aAASC,GAGVC,YAAa,CACZJ,KAAMC,OACNC,QAAS,QAGXG,MAAO,CAEN,uBAAwCC,EAAAA,SAASC,IAAUC,EAAAA,OAAOD,GAElEE,UAA2BH,EAAAA,SAASC,IAAUC,EAAAA,OAAOD,IAEtDG,KAAAA,CAAMb,GAAOc,MAAEA,EAAAA,MAAOC,EAAAA,KAAOC,EAAAA,OAAMC,IAClC,MAAMf,EAAagB,EAAAA,UAAUlB,EAAO,aAAcgB,EAAM,CAAEG,SAAS,IAE7DC,EAAQC,EAAAA,SAAS,CACtBC,aAAcC,EAAAA,SAAS,IAClBrB,EAAWQ,OAAOc,QAAU,GAKjCC,eAAgBF,EAAAA,SAAS,IACpBrB,EAAWQ,OAAOc,QAAU,KAO5BE,EAAaC,EAAAA,MAEbC,EAAcC,EAAAA,OAAOC,EAAAA,oBAAgBxB,GAErCyB,EAAkBF,EAAAA,OAAOG,EAAAA,wBAAoB1B,GAE7C2B,EAAwBvB,GACR,IAAjBA,EAAMc,OACF,GAAGd,OACAA,EAAMc,OAAS,EAClB,GAAGd,EAAMwB,MAAM,EAAG,QAAQxB,EAAMwB,MAAM,KAEtCxB,EAIHyB,EAAyBzB,IAC9BR,EAAWQ,QAAU,GACrBR,EAAWQ,OAASA,GAGf0B,EAAkBA,KACU,IAA7BlC,EAAWQ,OAAOc,SACtBtB,EAAWQ,MAAQR,EAAWQ,MAAM2B,UAAU,EAAG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tC,EAAsBmC,IAAK/E,EAClF+E,GAAAA,EAAI,CAAAjE,QAAAA,IAAA,CAAJiE,QAEDlB,EAAAA,YAAA,MAAA,CAAAW,MAES,CAAC,uCAAwC3C,EAAME,aAAe,GAAK,iCAA+B,CAC5GoD,EAAAA,eAAeL,IAAKM,GAAKvB,EAAAA,YAAAmB,EAAAA,SAAA,CAAAC,SACLpD,EAAMK,eAAcgD,QAAWA,IAAMtC,EAAsBwC,IAAMpF,EACnFoF,GAAAA,EAAK,CAAAtE,QAAAA,IAAA,CAALsE,MAGFC,EAAAA,gBAAgBP,IAAKQ,GAAMzB,EAAAA,YAAAmB,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"}
@@ -1,7 +1,7 @@
1
- import { TableProps } from 'element-plus';
2
- import { PropType } from 'vue';
3
1
  import { PagedInput, PagedResult } from '../../table';
4
2
  import { ElSelectorOutput } from '../../select/src/select.type';
3
+ import { TableProps } from 'element-plus';
4
+ import { PropType } from 'vue';
5
5
  export declare const faInputDialogPageProps: {
6
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 */
7
7
  rowKey: {
@@ -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:(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;
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("../../dialog/index.js"),o=require("../../table/index.js"),a=require("@fast-china/utils"),u=require("@vueuse/core"),n=require("lodash-unified"),r={rowKey:{type:[String,Function],default:"id"},modelValue:[String,Number],label:String,placeholder:{type:String,default:"请选择"},disabled:Boolean,title:String,requestApi:{type:a.definePropType(Function)},initParam:a.definePropType([String,Number,Object]),labelKey:{type:String,default:"name"}},s={"update:modelValue":e=>n.isString(e)||n.isNumber(e)||n.isNull(e),"update:label":e=>n.isString(e)||n.isNull(e),change:(e,l)=>!0},d=e.defineComponent({name:"FaInputDialogPage",props:r,emits:s,slots:a.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:a.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(n.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=n.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 a.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(i.FaDialog,{ref:m,style:"--height: 70%;",width:"50%",title:r.title,fullHeight:!0,disabledConfirmButton:!w.value?.selected,onConfirmClick:S},{default:()=>[e.createVNode(o.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()})]})])),a.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\";\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,oBACN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AAAD,EAAAA,YAAAE,UAAA,CAAAzD,WAES+B,EAAclB,MAAK,sBAAA6C,GAAnB3B,EAAclB,MAAK6C,EAAAvD,YAAekB,EAAMlB,YAAWC,SAAYiB,EAAMjB,SAAQuD,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"}
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 FaDialog from \"@fast-element-plus/components/dialog\";\nimport { FaTable, type FaTableInstance, type PagedInput, type PagedResult } from \"@fast-element-plus/components/table\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"@fast-china/utils\";\nimport { useVModel } from \"@vueuse/core\";\nimport { isFunction, isNull, isNumber, isString } from \"lodash-unified\";\nimport type { FaDialogInstance } from \"@fast-element-plus/components/dialog\";\nimport type { ElSelectorOutput } from \"@fast-element-plus/components/select/src/select.type\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\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): boolean => isString(value) || isNumber(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string): boolean => 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":"4VAaaA,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,GAAoCC,EAAAA,SAASD,IAAUE,EAAAA,SAASF,IAAUG,EAAAA,OAAOH,GAEvG,kBAA4CC,EAAAA,SAASD,IAAUG,EAAAA,OAAOH,GAEtEI,OAAQA,CACPC,EACAL,KACa,GAQfM,oBAA+B,CAC9BC,KAAM,oBACNC,MAAO3B,EACP4B,MAAOV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A,CAAAzD,WAES+B,EAAclB,MAAK,sBAAA6C,GAAnB3B,EAAclB,MAAK6C,EAAAvD,YAAekB,EAAMlB,YAAWC,SAAYiB,EAAMjB,SAAQuD,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"layoutGridItem.js","sources":["../../../../../packages/components/layoutGrid/src/layoutGridItem.tsx"],"sourcesContent":["import { computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"@fast-china/utils\";\nimport type { FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\nimport type { FaLayoutGridBreakPoint } from \"@fast-element-plus/components/layoutGrid\";\nimport type { Ref } from \"vue\";\nimport { isNumber } from \"lodash-unified\";\n\ntype FaLayoutGridItemSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n};\n\nexport default defineComponent({\n\tname: \"FaLayoutGridItem\",\n\tprops: {\n\t\t/** @description 偏移 */\n\t\toffset: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 0,\n\t\t},\n\t\t/** @description 占位 */\n\t\tspan: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 后缀 */\n\t\tsuffix: { type: Boolean, default: false },\n\t\t/** @description 响应式,小于480px屏幕配置 */\n\t\txs: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板竖屏配置 */\n\t\tsm: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板横屏配置 */\n\t\tmd: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,小型桌面配置 */\n\t\tlg: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,大型桌面配置 */\n\t\txl: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t},\n\tslots: makeSlots<FaLayoutGridItemSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tshow: true,\n\t\t});\n\n\t\tconst attrsObj = attrs as any;\n\n\t\t// 注入断点\n\t\tconst breakPoint = inject<Ref<FaLayoutGridBreakPoint>>(\"breakPoint\", ref(\"xl\"));\n\t\tconst shouldHiddenIndex = inject<Ref<number>>(\"shouldHiddenIndex\", ref(-1));\n\n\t\twatch(\n\t\t\t() => [shouldHiddenIndex.value, breakPoint.value],\n\t\t\t(n) => {\n\t\t\t\tif (~~attrsObj.index) {\n\t\t\t\t\tstate.show = !(n[0] !== -1 && parseInt(attrsObj.index) >= Number(n[0]));\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tconst gap = inject(\"gap\", 0);\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(5));\n\n\t\tconst style = computed(() => {\n\t\t\tconst breakPointObk = props[breakPoint.value] as FaLayoutGridItemResponsive;\n\t\t\tconst span = breakPointObk?.span ?? (isNumber(props.span) ? props.span : Number(props.span));\n\t\t\tconst offset = breakPointObk?.offset ?? (isNumber(props.offset) ? props.offset : Number(props.offset));\n\t\t\tif (props.suffix) {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumnStart: cols.value - span - offset + 1,\n\t\t\t\t\tgridColumnEnd: `span ${span + offset}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${\n\t\t\t\t\t\tspan + offset > cols.value ? cols.value : span + offset\n\t\t\t\t\t}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<div style={style.value} vShow={state.show}>\n\t\t\t\t{slots.default && slots.default()}\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\tshow: state.show,\n\t\t});\n\t},\n});\n"],"names":["LayoutGridItem","name","props","offset","type","String","Number","default","span","suffix","Boolean","xs","definePropType","Object","undefined","sm","md","lg","xl","slots","makeSlots","setup","attrs","emit","expose","state","reactive","show","attrsObj","breakPoint","inject","ref","shouldHiddenIndex","watch","value","n","index","parseInt","immediate","gap","cols","style","computed","breakPointObk","isNumber","gridColumnStart","gridColumnEnd","marginLeft","gridColumn","useRender","_withDirectives","_createVNode","_vShow","useExpose"],"mappings":"8LAYAA,oBAA+B,CAC9BC,KAAM,mBACNC,MAAO,CAENC,OAAQ,CACPC,KAAM,CAACC,OAAQC,QACfC,QAAS,GAGVC,KAAM,CACLJ,KAAM,CAACC,OAAQC,QACfC,QAAS,GAGVE,OAAQ,CAAEL,KAAMM,QAASH,SAAS,GAElCI,GAAI,CACHP,KAAMQ,EAAAA,eAA2CC,QACjDN,aAASO,GAGVC,GAAI,CACHX,KAAMQ,EAAAA,eAA2CC,QACjDN,aAASO,GAGVE,GAAI,CACHZ,KAAMQ,EAAAA,eAA2CC,QACjDN,aAASO,GAGVG,GAAI,CACHb,KAAMQ,EAAAA,eAA2CC,QACjDN,aAASO,GAGVI,GAAI,CACHd,KAAMQ,EAAAA,eAA2CC,QACjDN,aAASO,IAGXK,MAAOC,EAAAA,YACPC,KAAAA,CAAMnB,GAAOoB,MAAEA,EAAAA,MAAOH,EAAAA,KAAOI,EAAAA,OAAMC,IAClC,MAAMC,EAAQC,EAAAA,SAAS,CACtBC,MAAM,IAGDC,EAAWN,EAGXO,EAAaC,EAAAA,OAAoC,aAAcC,EAAAA,IAAI,OACnEC,EAAoBF,EAAAA,OAAoB,oBAAqBC,EAAAA,SAEnEE,EAAAA,MACC,IAAM,CAACD,EAAkBE,MAAOL,EAAWK,OAC1CC,MACMP,EAASQ,QACdX,EAAME,QAAkB,IAATQ,EAAE,IAAaE,SAAST,EAASQ,QAAU9B,OAAO6B,EAAE,OAGrE,CAAEG,WAAW,IAGd,MAAMC,EAAMT,EAAAA,OAAO,MAAO,GACpBU,EAAOV,EAAAA,OAAoB,OAAQC,EAAAA,IAAI,IAEvCU,EAAQC,EAAAA,SAAS,KACtB,MAAMC,EAAgBzC,EAAM2B,EAAWK,OACjC1B,EAAOmC,GAAenC,OAASoC,EAAAA,SAAS1C,EAAMM,MAAQN,EAAMM,KAAOF,OAAOJ,EAAMM,OAChFL,EAASwC,GAAexC,SAAWyC,EAAAA,SAAS1C,EAAMC,QAAUD,EAAMC,OAASG,OAAOJ,EAAMC,SAC9F,OAAID,EAAMO,OACF,CACNoC,gBAAiBL,EAAKN,MAAQ1B,EAAOL,EAAS,EAC9C2C,cAAe,QAAQtC,EAAOL,IAC9B4C,WAAuB,IAAX5C,EAAe,iBAAiBoC,UAAY/B,EAAOL,QAAaA,KAAY,SAGlF,CACN6C,WAAY,QAAQxC,EAAOL,EAASqC,EAAKN,MAAQM,EAAKN,MAAQ1B,EAAOL,UACpEK,EAAOL,EAASqC,EAAKN,MAAQM,EAAKN,MAAQ1B,EAAOL,IAElD4C,WAAuB,IAAX5C,EAAe,iBAAiBoC,UAAY/B,EAAOL,QAAaA,KAAY,WAW3F,OANA8C,EAAAA,UAAU,IAAAC,EAAAA,eAAAC,EAAAA,YAAA,MAAA,CAAAV,MACGA,EAAMP,OAAK,CACrBf,EAAMZ,SAAWY,EAAMZ,YAAS,CAAA,CAAA6C,EAAAA,MADF3B,EAAME,SAKhC0B,EAAAA,UAAU7B,EAAQ,CACxBG,KAAMF,EAAME,MAEd"}
1
+ {"version":3,"file":"layoutGridItem.js","sources":["../../../../../packages/components/layoutGrid/src/layoutGridItem.tsx"],"sourcesContent":["import { computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"@fast-china/utils\";\nimport { isNumber } from \"lodash-unified\";\nimport type { FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\nimport type { FaLayoutGridBreakPoint } from \"@fast-element-plus/components/layoutGrid\";\nimport type { Ref } from \"vue\";\n\ntype FaLayoutGridItemSlots = {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n};\n\nexport default defineComponent({\n\tname: \"FaLayoutGridItem\",\n\tprops: {\n\t\t/** @description 偏移 */\n\t\toffset: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 0,\n\t\t},\n\t\t/** @description 占位 */\n\t\tspan: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 后缀 */\n\t\tsuffix: { type: Boolean, default: false },\n\t\t/** @description 响应式,小于480px屏幕配置 */\n\t\txs: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板竖屏配置 */\n\t\tsm: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,平板横屏配置 */\n\t\tmd: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,小型桌面配置 */\n\t\tlg: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t\t/** @description 响应式,大型桌面配置 */\n\t\txl: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined as FaLayoutGridItemResponsive,\n\t\t},\n\t},\n\tslots: makeSlots<FaLayoutGridItemSlots>(),\n\tsetup(props, { attrs, slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tshow: true,\n\t\t});\n\n\t\tconst attrsObj = attrs as any;\n\n\t\t// 注入断点\n\t\tconst breakPoint = inject<Ref<FaLayoutGridBreakPoint>>(\"breakPoint\", ref(\"xl\"));\n\t\tconst shouldHiddenIndex = inject<Ref<number>>(\"shouldHiddenIndex\", ref(-1));\n\n\t\twatch(\n\t\t\t() => [shouldHiddenIndex.value, breakPoint.value],\n\t\t\t(n) => {\n\t\t\t\tif (~~attrsObj.index) {\n\t\t\t\t\tstate.show = !(n[0] !== -1 && parseInt(attrsObj.index) >= Number(n[0]));\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tconst gap = inject(\"gap\", 0);\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(5));\n\n\t\tconst style = computed(() => {\n\t\t\tconst breakPointObk = props[breakPoint.value] as FaLayoutGridItemResponsive;\n\t\t\tconst span = breakPointObk?.span ?? (isNumber(props.span) ? props.span : Number(props.span));\n\t\t\tconst offset = breakPointObk?.offset ?? (isNumber(props.offset) ? props.offset : Number(props.offset));\n\t\t\tif (props.suffix) {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumnStart: cols.value - span - offset + 1,\n\t\t\t\t\tgridColumnEnd: `span ${span + offset}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${\n\t\t\t\t\t\tspan + offset > cols.value ? cols.value : span + offset\n\t\t\t\t\t}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<div style={style.value} vShow={state.show}>\n\t\t\t\t{slots.default && slots.default()}\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\tshow: state.show,\n\t\t});\n\t},\n});\n"],"names":["LayoutGridItem","name","props","offset","type","String","Number","default","span","suffix","Boolean","xs","definePropType","Object","undefined","sm","md","lg","xl","slots","makeSlots","setup","attrs","emit","expose","state","reactive","show","attrsObj","breakPoint","inject","ref","shouldHiddenIndex","watch","value","n","index","parseInt","immediate","gap","cols","style","computed","breakPointObk","isNumber","gridColumnStart","gridColumnEnd","marginLeft","gridColumn","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AAS1C,EAAMC,QAAUD,EAAMC,OAASG,OAAOJ,EAAMC,SAC9F,OAAID,EAAMO,OACF,CACNoC,gBAAiBL,EAAKN,MAAQ1B,EAAOL,EAAS,EAC9C2C,cAAe,QAAQtC,EAAOL,IAC9B4C,WAAuB,IAAX5C,EAAe,iBAAiBoC,UAAY/B,EAAOL,QAAaA,KAAY,SAGlF,CACN6C,WAAY,QAAQxC,EAAOL,EAASqC,EAAKN,MAAQM,EAAKN,MAAQ1B,EAAOL,UACpEK,EAAOL,EAASqC,EAAKN,MAAQM,EAAKN,MAAQ1B,EAAOL,IAElD4C,WAAuB,IAAX5C,EAAe,iBAAiBoC,UAAY/B,EAAOL,QAAaA,KAAY,WAW3F,OANA8C,EAAAA,UAAU,IAAAC,EAAAA,eAAAC,EAAAA,YAAA,MAAA,CAAAV,MACGA,EAAMP,OAAK,CACrBf,EAAMZ,SAAWY,EAAMZ,YAAS,CAAA,CAAA6C,EAAAA,MADF3B,EAAME,SAKhC0B,EAAAA,UAAU7B,EAAQ,CACxBG,KAAMF,EAAME,MAEd"}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "1.0.15";
1
+ export declare const version = "1.0.16";
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.version="1.0.15";
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.version="1.0.16";
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../packages/version.ts"],"sourcesContent":["export const version = \"1.0.15\";\n"],"names":[],"mappings":"gGAAuB"}
1
+ {"version":3,"file":"version.js","sources":["../../packages/version.ts"],"sourcesContent":["export const version = \"1.0.16\";\n"],"names":[],"mappings":"gGAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-element-plus",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Fast 组件库.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -104,7 +104,7 @@
104
104
  },
105
105
  "devDependencies": {
106
106
  "@element-plus/icons-vue": "^2.3",
107
- "@fast-china/eslint-config": "^1",
107
+ "@fast-china/eslint-config": "1.0.42",
108
108
  "@fast-china/utils": "^1",
109
109
  "@fast-element-plus/icons-vue": "^1",
110
110
  "@rollup/plugin-terser": "^0.4",