easy-ep-ui 0.1.0

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.
Files changed (32) hide show
  1. package/README.md +86 -0
  2. package/dist/easy-ep-ui.js +1 -0
  3. package/dist/style.css +1 -0
  4. package/es/components/ee-dict-select/index.d.ts +2 -0
  5. package/es/components/ee-dict-select/src/index.vue.d.ts +25 -0
  6. package/es/components/ee-form-dialog/index.d.ts +2 -0
  7. package/es/components/ee-form-dialog/src/index.vue.d.ts +126 -0
  8. package/es/components/ee-form-table/index.d.ts +2 -0
  9. package/es/components/ee-form-table/src/index.vue.d.ts +1323 -0
  10. package/es/components/ee-search-bar/index.d.ts +2 -0
  11. package/es/components/ee-search-bar/src/index.vue.d.ts +124 -0
  12. package/es/components/ee-status-tag/index.d.ts +2 -0
  13. package/es/components/ee-status-tag/src/index.vue.d.ts +13 -0
  14. package/es/index.d.ts +13 -0
  15. package/es/index.mjs +544 -0
  16. package/es/style.css +1 -0
  17. package/es/utils/types.d.ts +48 -0
  18. package/lib/components/ee-dict-select/index.d.ts +2 -0
  19. package/lib/components/ee-dict-select/src/index.vue.d.ts +25 -0
  20. package/lib/components/ee-form-dialog/index.d.ts +2 -0
  21. package/lib/components/ee-form-dialog/src/index.vue.d.ts +126 -0
  22. package/lib/components/ee-form-table/index.d.ts +2 -0
  23. package/lib/components/ee-form-table/src/index.vue.d.ts +1323 -0
  24. package/lib/components/ee-search-bar/index.d.ts +2 -0
  25. package/lib/components/ee-search-bar/src/index.vue.d.ts +124 -0
  26. package/lib/components/ee-status-tag/index.d.ts +2 -0
  27. package/lib/components/ee-status-tag/src/index.vue.d.ts +13 -0
  28. package/lib/index.cjs +1 -0
  29. package/lib/index.d.ts +13 -0
  30. package/lib/style.css +1 -0
  31. package/lib/utils/types.d.ts +48 -0
  32. package/package.json +62 -0
@@ -0,0 +1,2 @@
1
+ import { default as EeSearchBar } from './src/index.vue';
2
+ export default EeSearchBar;
@@ -0,0 +1,124 @@
1
+ import { SearchField } from '../../../utils/types';
2
+ type __VLS_Props = {
3
+ modelValue: Record<string, any>;
4
+ fields: SearchField[];
5
+ inline?: boolean;
6
+ labelWidth?: string | number;
7
+ collapsible?: boolean;
8
+ collapsedCount?: number;
9
+ };
10
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
11
+ "update:modelValue": (val: Record<string, any>) => any;
12
+ search: (val: Record<string, any>) => any;
13
+ reset: () => any;
14
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:modelValue"?: ((val: Record<string, any>) => any) | undefined;
16
+ onSearch?: ((val: Record<string, any>) => any) | undefined;
17
+ onReset?: (() => any) | undefined;
18
+ }>, {
19
+ inline: boolean;
20
+ labelWidth: string | number;
21
+ collapsible: boolean;
22
+ collapsedCount: number;
23
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
24
+ formRef: ({
25
+ $: import('vue').ComponentInternalInstance;
26
+ $data: {};
27
+ $props: {
28
+ readonly model?: Record<string, any> | undefined;
29
+ readonly rules?: import('element-plus').FormRules | undefined;
30
+ readonly labelPosition?: "left" | "right" | "top" | undefined;
31
+ readonly requireAsteriskPosition?: "left" | "right" | undefined;
32
+ readonly labelWidth?: string | number | undefined;
33
+ readonly labelSuffix?: string | undefined;
34
+ readonly inline?: boolean | undefined;
35
+ readonly inlineMessage?: boolean | undefined;
36
+ readonly statusIcon?: boolean | undefined;
37
+ readonly showMessage?: boolean | undefined;
38
+ readonly validateOnRuleChange?: boolean | undefined;
39
+ readonly hideRequiredAsterisk?: boolean | undefined;
40
+ readonly scrollToError?: boolean | undefined;
41
+ readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
42
+ readonly size?: import('element-plus').ComponentSize | undefined;
43
+ readonly disabled?: boolean | undefined;
44
+ readonly onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
45
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
46
+ $attrs: import('vue').Attrs;
47
+ $refs: {
48
+ [x: string]: unknown;
49
+ };
50
+ $slots: Readonly<{
51
+ [name: string]: import('vue').Slot<any> | undefined;
52
+ }>;
53
+ $root: import('vue').ComponentPublicInstance | null;
54
+ $parent: import('vue').ComponentPublicInstance | null;
55
+ $host: Element | null;
56
+ $emit: (event: "validate", prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
57
+ $el: any;
58
+ $options: import('vue').ComponentOptionsBase<Readonly<import('element-plus').FormProps> & Readonly<{
59
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
60
+ }>, {
61
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
62
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
63
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
64
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
65
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
66
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
67
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
68
+ setInitialValues: (initModel: Record<string, any>) => void;
69
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
70
+ validate: (prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
71
+ }, string, {
72
+ labelWidth: string | number;
73
+ labelPosition: "left" | "right" | "top";
74
+ requireAsteriskPosition: "left" | "right";
75
+ labelSuffix: string;
76
+ showMessage: boolean;
77
+ validateOnRuleChange: boolean;
78
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
79
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
80
+ beforeCreate?: (() => void) | (() => void)[];
81
+ created?: (() => void) | (() => void)[];
82
+ beforeMount?: (() => void) | (() => void)[];
83
+ mounted?: (() => void) | (() => void)[];
84
+ beforeUpdate?: (() => void) | (() => void)[];
85
+ updated?: (() => void) | (() => void)[];
86
+ activated?: (() => void) | (() => void)[];
87
+ deactivated?: (() => void) | (() => void)[];
88
+ beforeDestroy?: (() => void) | (() => void)[];
89
+ beforeUnmount?: (() => void) | (() => void)[];
90
+ destroyed?: (() => void) | (() => void)[];
91
+ unmounted?: (() => void) | (() => void)[];
92
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
93
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
94
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
95
+ };
96
+ $forceUpdate: () => void;
97
+ $nextTick: typeof import('vue').nextTick;
98
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
99
+ } & Readonly<{
100
+ labelWidth: string | number;
101
+ labelPosition: "left" | "right" | "top";
102
+ requireAsteriskPosition: "left" | "right";
103
+ labelSuffix: string;
104
+ showMessage: boolean;
105
+ validateOnRuleChange: boolean;
106
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
107
+ }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
108
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
109
+ }>, "fields" | "labelWidth" | "labelPosition" | "requireAsteriskPosition" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "setInitialValues"> & {
110
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
111
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
112
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
113
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
114
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
115
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
116
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
117
+ setInitialValues: (initModel: Record<string, any>) => void;
118
+ } & {} & import('vue').ComponentCustomProperties & {} & {
119
+ $slots: {
120
+ default?: (props: {}) => any;
121
+ };
122
+ }) | null;
123
+ }, HTMLDivElement>;
124
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { default as EeStatusTag } from './src/index.vue';
2
+ export default EeStatusTag;
@@ -0,0 +1,13 @@
1
+ import { StatusMapping } from '../../../utils/types';
2
+ type __VLS_Props = {
3
+ value: string | number;
4
+ mapping: StatusMapping[];
5
+ fallbackLabel?: string;
6
+ defaultType?: StatusMapping['type'];
7
+ defaultEffect?: StatusMapping['effect'];
8
+ };
9
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
+ defaultType: "primary" | "success" | "warning" | "danger" | "info";
11
+ defaultEffect: "dark" | "light" | "plain";
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
package/lib/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("element-plus"),h=e.defineComponent({name:"EeDictSelect",__name:"index",props:{modelValue:{},options:{},request:{},valueField:{default:"value"},labelField:{default:"label"}},emits:["update:modelValue","change","clear","focus","blur"],setup(l,{emit:k}){const u=l,m=k,s=e.ref(!1),i=e.ref([]),d=e.computed(()=>(u.options??i.value).map(c=>({value:String(c[u.valueField]??""),label:String(c[u.labelField]??""),disabled:c.disabled??!1})));async function a(){if(!u.options&&u.request){s.value=!0;try{i.value=await u.request()}finally{s.value=!1}}}return e.onMounted(a),e.watch(()=>u.request,a),(p,c)=>(e.openBlock(),e.createBlock(e.unref(n.ElSelect),e.mergeProps(p.$attrs,{"model-value":l.modelValue,loading:s.value,"onUpdate:modelValue":c[0]||(c[0]=t=>m("update:modelValue",t)),onChange:c[1]||(c[1]=t=>m("change",t)),onClear:c[2]||(c[2]=t=>m("clear")),onFocus:c[3]||(c[3]=t=>m("focus",t)),onBlur:c[4]||(c[4]=t=>m("blur",t))}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,t=>(e.openBlock(),e.createBlock(e.unref(n.ElOption),{key:t.value,label:t.label,value:t.value,disabled:t.disabled},null,8,["label","value","disabled"]))),128))]),_:1},16,["model-value","loading"]))}});h.install=l=>{l.component(h.name??"EeDictSelect",h)};const g=e.defineComponent({name:"EeStatusTag",__name:"index",props:{value:{},mapping:{},fallbackLabel:{},defaultType:{default:"info"},defaultEffect:{default:"light"}},setup(l){const k=l,u=e.computed(()=>k.mapping.find(m=>m.value===k.value));return(m,s)=>{var i,d;return e.openBlock(),e.createBlock(e.unref(n.ElTag),e.mergeProps(m.$attrs,{type:((i=u.value)==null?void 0:i.type)??l.defaultType,effect:((d=u.value)==null?void 0:d.effect)??l.defaultEffect}),{default:e.withCtx(()=>{var a;return[e.createTextVNode(e.toDisplayString(((a=u.value)==null?void 0:a.label)??l.fallbackLabel??l.value),1)]}),_:1},16,["type","effect"])}}});g.install=l=>{l.component(g.name??"EeStatusTag",g)};const v={class:"ee-search-bar"},C=e.defineComponent({name:"EeSearchBar",__name:"index",props:{modelValue:{},fields:{},inline:{type:Boolean,default:!0},labelWidth:{default:"auto"},collapsible:{type:Boolean,default:!1},collapsedCount:{default:3}},emits:["update:modelValue","search","reset"],setup(l,{emit:k}){const u=l,m=k,s=e.ref(),i=e.ref(!1),d=e.computed(()=>{const o=24-a.value.reduce((r,f)=>r+(f.span??6),0)%24;return o===24?6:o}),a=e.computed(()=>!u.collapsible||i.value?u.fields:u.fields.slice(0,u.collapsedCount));function p(){m("search",{...u.modelValue})}function c(){const t={};u.fields.forEach(o=>{t[o.prop]=""}),m("update:modelValue",t),m("reset")}return(t,o)=>(e.openBlock(),e.createElementBlock("div",v,[e.createVNode(e.unref(n.ElForm),e.mergeProps({ref_key:"formRef",ref:s,model:l.modelValue,inline:l.inline,"label-width":l.labelWidth},t.$attrs),{default:e.withCtx(()=>[e.createVNode(e.unref(n.ElRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,r=>(e.openBlock(),e.createBlock(e.unref(n.ElCol),{key:r.prop,span:r.span??6},{default:e.withCtx(()=>[e.createVNode(e.unref(n.ElFormItem),{label:r.label,prop:r.prop},{default:e.withCtx(()=>[(r.type??"input")==="input"?(e.openBlock(),e.createBlock(e.unref(n.ElInput),{key:0,modelValue:l.modelValue[r.prop],"onUpdate:modelValue":f=>l.modelValue[r.prop]=f,placeholder:r.placeholder??`请输入${r.label}`,clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(n.ElSelect),{key:1,modelValue:l.modelValue[r.prop],"onUpdate:modelValue":f=>l.modelValue[r.prop]=f,placeholder:r.placeholder??`请选择${r.label}`,clearable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options??[],f=>(e.openBlock(),e.createBlock(e.unref(n.ElOption),{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):r.type==="date"?(e.openBlock(),e.createBlock(e.unref(n.ElDatePicker),{key:2,modelValue:l.modelValue[r.prop],"onUpdate:modelValue":f=>l.modelValue[r.prop]=f,placeholder:r.placeholder??`请选择${r.label}`,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):r.type==="date-range"?(e.openBlock(),e.createBlock(e.unref(n.ElDatePicker),{key:3,modelValue:l.modelValue[r.prop],"onUpdate:modelValue":f=>l.modelValue[r.prop]=f,type:"daterange","range-separator":r.placeholder??"至","start-placeholder":r.placeholder??"开始日期","end-placeholder":r.placeholder??"结束日期",style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):r.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),{key:4,modelValue:l.modelValue[r.prop],"onUpdate:modelValue":f=>l.modelValue[r.prop]=f},null,8,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128)),e.createVNode(e.unref(n.ElCol),{span:d.value},{default:e.withCtx(()=>[e.createVNode(e.unref(n.ElFormItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.ElButton),{type:"primary",onClick:p},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode(" 搜索 ",-1)])]),_:1}),e.createVNode(e.unref(n.ElButton),{onClick:c},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode(" 重置 ",-1)])]),_:1}),l.collapsible&&l.fields.length>l.collapsedCount?(e.openBlock(),e.createBlock(e.unref(n.ElButton),{key:0,text:"",onClick:o[0]||(o[0]=r=>i.value=!i.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.value?"收起":"展开"),1)]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["span"])]),_:1})]),_:1},16,["model","inline","label-width"])]))}}),y=(l,k)=>{const u=l.__vccOpts||l;for(const[m,s]of k)u[m]=s;return u},V=y(C,[["__scopeId","data-v-64bb08e9"]]);V.install=l=>{l.component(V.name??"EeSearchBar",V)};const w={class:"ee-form-dialog-footer"},x=e.defineComponent({name:"EeFormDialog",__name:"index",props:{modelValue:{type:Boolean},title:{default:"表单"},formData:{},fields:{},rules:{},width:{default:"600px"},labelWidth:{default:"auto"},loading:{type:Boolean,default:!1}},emits:["update:modelValue","submit","cancel"],setup(l,{emit:k}){const u=l,m=k,s=e.ref(),i=e.computed(()=>{const p={};for(const c of Object.keys(u))["modelValue","title","formData","fields","rules","width","labelWidth","loading"].includes(c)||(p[c]=u[c]);return p});function d(){m("update:modelValue",!1),m("cancel")}async function a(){if(s.value)try{await s.value.validate(),m("submit",{...u.formData})}catch{}}return(p,c)=>(e.openBlock(),e.createBlock(e.unref(n.ElDialog),e.mergeProps(p.$attrs,{"model-value":l.modelValue,title:l.title,width:l.width,"onUpdate:modelValue":c[0]||(c[0]=t=>m("update:modelValue",t)),onClose:d}),{footer:e.withCtx(()=>[e.createElementVNode("span",w,[e.createVNode(e.unref(n.ElButton),{onClick:d},{default:e.withCtx(()=>[...c[1]||(c[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(n.ElButton),{type:"primary",loading:l.loading,onClick:a},{default:e.withCtx(()=>[...c[2]||(c[2]=[e.createTextVNode(" 确定 ",-1)])]),_:1},8,["loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(n.ElForm),e.mergeProps({ref_key:"formRef",ref:s,model:l.formData,rules:l.rules,"label-width":l.labelWidth},i.value),{default:e.withCtx(()=>[e.createVNode(e.unref(n.ElRow),{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.fields,t=>(e.openBlock(),e.createBlock(e.unref(n.ElCol),{key:t.prop,span:t.span??24},{default:e.withCtx(()=>[e.createVNode(e.unref(n.ElFormItem),{label:t.label,prop:t.prop},{default:e.withCtx(()=>[(t.type??"input")==="input"?(e.openBlock(),e.createBlock(e.unref(n.ElInput),{key:0,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o,placeholder:t.placeholder??`请输入${t.label}`},null,8,["modelValue","onUpdate:modelValue","placeholder"])):t.type==="textarea"?(e.openBlock(),e.createBlock(e.unref(n.ElInput),{key:1,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o,type:"textarea",placeholder:t.placeholder??`请输入${t.label}`,rows:3},null,8,["modelValue","onUpdate:modelValue","placeholder"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(n.ElSelect),{key:2,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o,placeholder:t.placeholder??`请选择${t.label}`,style:{width:"100%"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options??[],o=>(e.openBlock(),e.createBlock(e.unref(n.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):t.type==="radio"?(e.openBlock(),e.createBlock(e.unref(n.ElRadioGroup),{key:3,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options??[],o=>(e.openBlock(),e.createBlock(e.unref(n.ElRadio),{key:o.value,label:o.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):t.type==="checkbox"?(e.openBlock(),e.createBlock(e.unref(n.ElCheckboxGroup),{key:4,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options??[],o=>(e.openBlock(),e.createBlock(e.unref(n.ElCheckbox),{key:o.value,label:o.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(n.ElSwitch),{key:5,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o},null,8,["modelValue","onUpdate:modelValue"])):t.type==="date"?(e.openBlock(),e.createBlock(e.unref(n.ElDatePicker),{key:6,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o,placeholder:t.placeholder??`请选择${t.label}`,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):t.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component),{key:7,modelValue:l.formData[t.prop],"onUpdate:modelValue":o=>l.formData[t.prop]=o},null,8,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128))]),_:1})]),_:1},16,["model","rules","label-width"])]),_:1},16,["model-value","title","width"]))}}),b=y(x,[["__scopeId","data-v-0307e8cf"]]);b.install=l=>{l.component(b.name??"EeFormDialog",b)};const S={class:"ee-form-table"},D={key:1,class:"ee-form-table-toolbar"},N={key:2,class:"ee-form-table-pagination"},U=e.defineComponent({name:"EeFormTable",__name:"index",props:{data:{},columns:{},searchFields:{},pagination:{},loading:{type:Boolean,default:!1},showSelection:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},showPagination:{type:Boolean,default:!0},pageSizes:{default:()=>[10,20,50,100]},paginationLayout:{default:"total, sizes, prev, pager, next, jumper"},collapsible:{type:Boolean,default:!1},collapsedCount:{default:3}},emits:["search","reset","selection-change","sort-change","current-change","size-change"],setup(l,{emit:k}){const u=k,m=e.ref(),s=e.ref({});return(i,d)=>(e.openBlock(),e.createElementBlock("div",S,[l.searchFields&&l.searchFields.length?(e.openBlock(),e.createBlock(e.unref(V),{key:0,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=a=>s.value=a),fields:l.searchFields,collapsible:l.collapsible,"collapsed-count":l.collapsedCount,onSearch:d[1]||(d[1]=a=>u("search",a)),onReset:d[2]||(d[2]=a=>u("reset"))},null,8,["modelValue","fields","collapsible","collapsed-count"])):e.createCommentVNode("",!0),i.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",D,[e.renderSlot(i.$slots,"toolbar",{},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(e.unref(n.ElTable),e.mergeProps({ref_key:"tableRef",ref:m},i.$attrs,{data:l.data,loading:l.loading,onSelectionChange:d[3]||(d[3]=a=>u("selection-change",a)),onSortChange:d[4]||(d[4]=a=>u("sort-change",a))}),{default:e.withCtx(()=>[l.showSelection?(e.openBlock(),e.createBlock(e.unref(n.ElTableColumn),{key:0,type:"selection",width:"50",fixed:"left"})):e.createCommentVNode("",!0),l.showIndex?(e.openBlock(),e.createBlock(e.unref(n.ElTableColumn),{key:1,type:"index",label:"序号",width:"60",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.columns,a=>(e.openBlock(),e.createBlock(e.unref(n.ElTableColumn),{key:a.prop,prop:a.prop,label:a.label,width:a.width,"min-width":a.minWidth,fixed:a.fixed,sortable:a.sortable,align:a.align??"center"},{default:e.withCtx(p=>[e.renderSlot(i.$slots,a.prop,{row:p.row,index:p.$index},()=>[e.createElementVNode("span",null,e.toDisplayString(a.formatter?a.formatter(p.row,a,p.row[a.prop],p.$index):p.row[a.prop]),1)],!0)]),_:2},1032,["prop","label","width","min-width","fixed","sortable","align"]))),128)),e.renderSlot(i.$slots,"default",{},void 0,!0)]),_:3},16,["data","loading"]),l.showPagination?(e.openBlock(),e.createElementBlock("div",N,[e.createVNode(e.unref(n.ElPagination),{"current-page":l.pagination.current,"onUpdate:currentPage":d[5]||(d[5]=a=>l.pagination.current=a),"page-size":l.pagination.pageSize,"onUpdate:pageSize":d[6]||(d[6]=a=>l.pagination.pageSize=a),total:l.pagination.total,"page-sizes":l.pageSizes,layout:l.paginationLayout,background:"",onCurrentChange:d[7]||(d[7]=a=>u("current-change",a)),onSizeChange:d[8]||(d[8]=a=>u("size-change",a))},null,8,["current-page","page-size","total","page-sizes","layout"])])):e.createCommentVNode("",!0)]))}}),B=y(U,[["__scopeId","data-v-70d01eeb"]]);B.install=l=>{l.component(B.name??"EeFormTable",B)};const F=[h,g,V,b,B];function E(l){F.forEach(k=>{l.use(k)})}const $={install:E};exports.EeDictSelect=h;exports.EeFormDialog=b;exports.EeFormTable=B;exports.EeSearchBar=V;exports.EeStatusTag=g;exports.default=$;exports.install=E;
package/lib/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { App } from 'vue';
2
+ import { default as EeDictSelect } from './components/ee-dict-select';
3
+ import { default as EeStatusTag } from './components/ee-status-tag';
4
+ import { default as EeSearchBar } from './components/ee-search-bar';
5
+ import { default as EeFormDialog } from './components/ee-form-dialog';
6
+ import { default as EeFormTable } from './components/ee-form-table';
7
+ export type { DictOption, SearchField, TableColumn, FormField, Pagination, StatusMapping } from './utils/types';
8
+ export declare function install(app: App): void;
9
+ declare const EasyEpUI: {
10
+ install: typeof install;
11
+ };
12
+ export default EasyEpUI;
13
+ export { EeDictSelect, EeStatusTag, EeSearchBar, EeFormDialog, EeFormTable, };
package/lib/style.css ADDED
@@ -0,0 +1 @@
1
+ .ee-search-bar[data-v-64bb08e9]{margin-bottom:16px}.ee-search-bar .el-form-item[data-v-64bb08e9]{margin-bottom:0}.ee-form-dialog-footer[data-v-0307e8cf]{display:flex;justify-content:flex-end;gap:12px}.ee-form-table-toolbar[data-v-70d01eeb]{margin-bottom:16px;display:flex;align-items:center;gap:12px}.ee-form-table-pagination[data-v-70d01eeb]{margin-top:16px;display:flex;justify-content:flex-end}
@@ -0,0 +1,48 @@
1
+ import { VNode } from 'vue';
2
+ export interface DictOption {
3
+ value: string | number;
4
+ label: string;
5
+ disabled?: boolean;
6
+ [key: string]: unknown;
7
+ }
8
+ export interface SearchField {
9
+ prop: string;
10
+ label: string;
11
+ type?: 'input' | 'select' | 'date' | 'date-range' | 'cascader';
12
+ placeholder?: string;
13
+ options?: DictOption[];
14
+ span?: number;
15
+ component?: VNode;
16
+ }
17
+ export interface TableColumn {
18
+ prop: string;
19
+ label: string;
20
+ width?: string | number;
21
+ minWidth?: string | number;
22
+ fixed?: 'left' | 'right';
23
+ sortable?: boolean;
24
+ align?: 'left' | 'center' | 'right';
25
+ formatter?: (row: Record<string, unknown>, column: TableColumn, cellValue: unknown, index: number) => VNode | string;
26
+ [key: string]: unknown;
27
+ }
28
+ export interface FormField {
29
+ prop: string;
30
+ label: string;
31
+ type?: 'input' | 'textarea' | 'select' | 'radio' | 'checkbox' | 'date' | 'switch';
32
+ placeholder?: string;
33
+ rules?: Record<string, unknown>[];
34
+ options?: DictOption[];
35
+ span?: number;
36
+ component?: VNode;
37
+ }
38
+ export interface Pagination {
39
+ current: number;
40
+ pageSize: number;
41
+ total: number;
42
+ }
43
+ export interface StatusMapping {
44
+ value: string | number;
45
+ label: string;
46
+ type?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
47
+ effect?: 'dark' | 'light' | 'plain';
48
+ }
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "easy-ep-ui",
3
+ "version": "0.1.0",
4
+ "description": "Enterprise Element Plus 二次封装组件库 - Easy EP UI",
5
+ "type": "module",
6
+ "main": "lib/index.cjs",
7
+ "module": "es/index.mjs",
8
+ "types": "es/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "es",
12
+ "lib",
13
+ "README.md"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./es/index.d.ts",
18
+ "import": "./es/index.mjs",
19
+ "require": "./lib/index.cjs"
20
+ },
21
+ "./dist/*": "./dist/*",
22
+ "./es/*": "./es/*",
23
+ "./lib/*": "./lib/*"
24
+ },
25
+ "scripts": {
26
+ "dev": "vitepress dev docs",
27
+ "docs:dev": "vitepress dev docs",
28
+ "docs:build": "vitepress build docs",
29
+ "docs:serve": "vitepress serve docs",
30
+ "clean": "rm -rf dist es lib",
31
+ "build": "npm run build:es && npm run build:lib && npm run build:umd",
32
+ "build:es": "vite build --mode es",
33
+ "build:lib": "vite build --mode lib",
34
+ "build:umd": "vite build",
35
+ "pub:patch": "npm run build && npm version patch && npm publish",
36
+ "pub:minor": "npm run build && npm version minor && npm publish",
37
+ "pub:major": "npm run build && npm version major && npm publish",
38
+ "prepublishOnly": "npm run clean && npm run build"
39
+ },
40
+ "peerDependencies": {
41
+ "vue": "^3.4.0",
42
+ "element-plus": "^2.8.0"
43
+ },
44
+ "devDependencies": {
45
+ "@vitejs/plugin-vue": "^5.1.0",
46
+ "element-plus": "^2.8.0",
47
+ "typescript": "^5.5.0",
48
+ "vite": "^5.4.0",
49
+ "vite-plugin-dts": "^4.0.0",
50
+ "vitepress": "^1.3.0",
51
+ "vue": "^3.4.0"
52
+ },
53
+ "keywords": [
54
+ "vue3",
55
+ "element-plus",
56
+ "component-library",
57
+ "enterprise",
58
+ "easy-ep-ui"
59
+ ],
60
+ "license": "MIT",
61
+ "author": ""
62
+ }