@oneb/ui-vue 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.js +50 -50
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.js +91 -88
- package/package.json +1 -1
package/dist/form/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w={id:{type:String,required:!1},validation:{type:Object,required:!1}},V={id:{type:String,required:!1},label:{type:String,required:!1},name:{type:String,required:!1},hint:{type:String,required:!1,default:""},errors:{type:Array,required:!1}},C={name:{type:String,required:!1},errors:{type:Array,required:!1}},F={label:{type:String,required:!1}},S={id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,default:""},icon:{type:[Function,Object]},type:{type:String,default:"text"},inputClass:{required:!1,type:[Array,String]},modelValue:{required:!1,type:[String,Number,Array,Boolean,Object,null]},autofocus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},large:{type:Boolean,default:!1},invalid:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!1,default:[]}},k=()=>e.inject("BaseForm",()=>({formId:e.computed(()=>{}),validation:e.computed(()=>{})}),!0),f=()=>e.inject("BaseFormField",()=>({inputId:e.computed(()=>{}),inputName:e.computed(()=>{}),hasError:e.computed(()=>!1)}),!0),$=["onSubmit","id"],N=e.defineComponent({__name:"OneForm",props:w,emits:["submit"],setup(a,{emit:l}){const o=a;e.provide("BaseForm",{formId:e.computed(()=>o.id),validation:e.computed(()=>o.validation)});const d=()=>{l("submit")};return(n,t)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(d,["prevent"]),id:n.id,class:"space-y-3"},[e.renderSlot(n.$slots,"default")],40,$))}}),q=["for"],v=e.defineComponent({__name:"OneFormLabel",props:F,setup(a){const{inputId:l}=f();return(o,d)=>(e.openBlock(),e.createElementBlock("label",{for:e.unref(l),class:"block text-sm font-medium text-primary-content select-none"},[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.label),1)])],8,q))}}),_={key:0,class:"text-danger-content text-xs space-y-1"},h=e.defineComponent({__name:"OneFormFeedback",props:C,setup(a){const l=a,{validation:o}=k(),{inputName:d}=f(),n=e.computed(()=>d.value==null&&l.name==null?l.errors??[]:o.value==null?l.errors??[]:(o.value??{})[l.name||d.value]??l.errors??[]);return(t,i)=>n.value.length>0?(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u},e.toDisplayString(u),1))),128))])):e.createCommentVNode("",!0)}});function O(a,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})])}function j(a,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})])}function I(a,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])}const L=["id","disabled"],M=["selected"],A=["selected","value"],D=["name","id","value","placeholder","disabled","readonly"],z={key:2,class:"flex w-full space-x-3 items-center"},P=["type","name","id","disabled","readonly","checked"],T=["for"],G={key:3,class:"w-full space-y-1"},H=["name","id","value","disabled","readonly","checked"],J=["for"],K={key:4,class:"relative"},Q={class:"absolute p-2 px-3 rounded-md h-full flex items-center select-none"},R=["type","name","id","value","placeholder","disabled","readonly"],b=e.defineComponent({__name:"OneFormInput",props:S,emits:["update:modelValue"],setup(a,{emit:l}){const o=a,{inputId:d,inputName:n,hasError:t}=f(),i=e.ref(null),u=e.ref(!1);e.onMounted(()=>{o.autofocus&&i.value&&i.value.focus()});const B=e.computed(()=>o.modelValue!=null&&o.modelValue!==""),c=e.computed(()=>{if(o.id)return o.id;const r=(d==null?void 0:d.value)||"";return o.name?`${r}-${o.name}`:r||""}),g=()=>{l("update:modelValue","")},E=e.computed(()=>{const r={"shadow-sm":o.type!=="range","border-danger-base":t.value||o.invalid,"pl-10":o.icon!=null,"pr-10":o.type==="password","rounded-full":o.rounded,"rounded-md":!o.rounded,"text-lg":o.large,"py-2.5":o.large,"py-2":!o.large};return o.inputClass!=null&&(typeof o.inputClass=="string"?r[o.inputClass]=!0:o.inputClass instanceof Array&&o.inputClass.forEach(m=>{r[m]=!0})),r}),p=r=>{o.type==="checkbox"?l("update:modelValue",r.target.checked):l("update:modelValue",r.target.value)};return(r,m)=>r.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,id:c.value,ref_key:"inputElement",ref:i,class:e.normalizeClass(["border border-primary-stroke px-3 w-full",{"border-danger-base":e.unref(t)||r.invalid,"text-secondary-content":r.modelValue===""||r.modelValue==null,"rounded-full":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),disabled:r.disabled},[r.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,selected:r.modelValue===""||r.modelValue==null,disabled:"",hidden:""},e.toDisplayString(r.placeholder),9,M)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,s=>(e.openBlock(),e.createElementBlock("option",{selected:s.key===r.modelValue,key:s.key,value:s.key},e.toDisplayString(s.value),9,A))),128))],10,L)):r.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,name:r.name||e.unref(n),id:c.value,value:r.modelValue,onInput:p,rows:"3",class:e.normalizeClass(["border border-primary-stroke px-3 w-full",{"border-danger-base":e.unref(t),"rounded-3xl":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,ref_key:"inputElement",ref:i},null,42,D)):r.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("input",{type:r.type,name:r.name||e.unref(n),id:c.value,value:!0,onInput:p,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(t)||r.invalid}]),checked:r.modelValue===!0,ref_key:"inputElement",ref:i},null,42,P),e.createElementVNode("label",{for:c.value,class:"text-primary-content select-none"},e.toDisplayString(r.placeholder),9,T)])):r.type==="radio"?(e.openBlock(),e.createElementBlock("div",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,(s,y)=>(e.openBlock(),e.createElementBlock("div",{key:s.key,class:"flex w-full space-x-3 items-center"},[e.createElementVNode("input",{type:"radio",name:r.name||e.unref(n),id:`${c.value}-${y}`,value:s.key,onInput:p,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(t)||r.invalid}]),checked:s.key===r.modelValue,ref_for:!0,ref_key:"inputElement",ref:i},null,42,H),e.createElementVNode("label",{for:`${c.value}-${y}`,class:"text-primary-content select-none"},e.toDisplayString(s.value),9,J)]))),128))])):(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",Q,[r.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.icon),{key:0,class:"w-5 h-5 text-primary-content"})):e.createCommentVNode("",!0)]),e.createElementVNode("input",{type:u.value?"text":r.type,name:r.name||e.unref(n),id:c.value,value:r.modelValue,onInput:p,placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["border border-primary-stroke w-full px-3",E.value]),ref_key:"inputElement",ref:i},null,42,R),r.clearable&&B.value?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:g,class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[e.createVNode(e.unref(I),{class:"w-5 h-5 text-secondary-content hover:text-primary-base"})])):r.type==="password"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:m[0]||(m[0]=s=>u.value=!u.value),class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[u.value?(e.openBlock(),e.createBlock(e.unref(j),{key:0,class:"w-5 h-5 text-primary-content hover:text-primary-base"})):(e.openBlock(),e.createBlock(e.unref(O),{key:1,class:"w-5 h-5 text-secondary-content hover:text-primary-base"}))])):e.createCommentVNode("",!0)]))}}),U={class:"space-y-1"},W={key:2,class:"text-xs text-secondary-content select-none"},X=e.defineComponent({__name:"OneFormField",props:V,setup(a){const l=a,{formId:o,validation:d}=k(),n=e.computed(()=>l.errors!=null&&l.errors.length>0?!0:l.name==null?!1:(d.value??{})[l.name]!=null);return e.provide("BaseFormField",{inputId:e.computed(()=>{const t=o.value||"form";if(l.id!=null)return`${t}-${l.id}`;if(l.name!=null)return`${t}-field-${l.name}`}),inputName:e.computed(()=>l.name),hasError:n}),(t,i)=>(e.openBlock(),e.createElementBlock("div",U,[t.label?(e.openBlock(),e.createBlock(v,{key:0,label:t.label},null,8,["label"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[e.createVNode(b)]),n.value?(e.openBlock(),e.createBlock(h,{key:1,errors:t.errors},null,8,["errors"])):t.hint.length>0?(e.openBlock(),e.createElementBlock("p",W,e.toDisplayString(t.hint),1)):e.createCommentVNode("",!0)]))}});exports.OneForm=N;exports.OneFormFeedback=h;exports.OneFormField=X;exports.OneFormInput=b;exports.OneFormLabel=v;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w={id:{type:String,required:!1},validation:{type:Object,required:!1}},V={id:{type:String,required:!1},label:{type:String,required:!1},name:{type:String,required:!1},hint:{type:String,required:!1,default:""},errors:{type:Array,required:!1}},C={name:{type:String,required:!1},errors:{type:Array,required:!1}},F={label:{type:String,required:!1}},S={id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,default:""},icon:{type:[Function,Object]},type:{type:String,default:"text"},inputClass:{required:!1,type:[Array,String]},modelValue:{required:!1,type:[String,Number,Array,Boolean,Object,null]},autofocus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},large:{type:Boolean,default:!1},invalid:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!1,default:[]}},k=()=>e.inject("BaseForm",()=>({formId:e.computed(()=>{}),validation:e.computed(()=>{})}),!0),f=()=>e.inject("BaseFormField",()=>({inputId:e.computed(()=>{}),inputName:e.computed(()=>{}),hasError:e.computed(()=>!1)}),!0),$=["onSubmit","id"],N=e.defineComponent({__name:"OneForm",props:w,emits:["submit"],setup(a,{emit:l}){const o=a;e.provide("BaseForm",{formId:e.computed(()=>o.id),validation:e.computed(()=>o.validation)});const d=()=>{l("submit")};return(n,t)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(d,["prevent"]),id:n.id,class:"space-y-3"},[e.renderSlot(n.$slots,"default")],40,$))}}),q=["for"],v=e.defineComponent({__name:"OneFormLabel",props:F,setup(a){const{inputId:l}=f();return(o,d)=>(e.openBlock(),e.createElementBlock("label",{for:e.unref(l),class:"block text-sm font-medium text-primary-content select-none"},[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.label),1)])],8,q))}}),_={key:0,class:"text-danger-content text-xs space-y-1"},h=e.defineComponent({__name:"OneFormFeedback",props:C,setup(a){const l=a,{validation:o}=k(),{inputName:d}=f(),n=e.computed(()=>d.value==null&&l.name==null?l.errors??[]:o.value==null?l.errors??[]:(o.value??{})[l.name||d.value]??l.errors??[]);return(t,i)=>n.value.length>0?(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u},e.toDisplayString(u),1))),128))])):e.createCommentVNode("",!0)}});function O(a,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})])}function j(a,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})])}function I(a,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])}const L=["id","disabled"],M=["selected"],A=["selected","value"],D=["name","id","value","placeholder","disabled","readonly"],z={key:2,class:"flex w-full space-x-3 items-center"},P=["type","name","id","disabled","readonly","checked"],T=["for"],G={key:3,class:"w-full space-y-1"},H=["name","id","value","disabled","readonly","checked"],J=["for"],K={key:4,class:"relative"},Q={class:"absolute p-2 px-3 rounded-md h-full flex items-center select-none"},R=["type","name","id","value","placeholder","disabled","readonly"],b=e.defineComponent({__name:"OneFormInput",props:S,emits:["update:modelValue"],setup(a,{emit:l}){const o=a,{inputId:d,inputName:n,hasError:t}=f(),i=e.ref(null),u=e.ref(!1);e.onMounted(()=>{o.autofocus&&i.value&&i.value.focus()});const B=e.computed(()=>o.modelValue!=null&&o.modelValue!==""),c=e.computed(()=>{if(o.id)return o.id;const r=(d==null?void 0:d.value)||"";return o.name?`${r}-${o.name}`:r||""}),g=()=>{l("update:modelValue","")},E=e.computed(()=>{const r={"shadow-sm":o.type!=="range","border-danger-base":t.value||o.invalid,"pl-10":o.icon!=null,"pr-10":o.type==="password","rounded-full":o.rounded,"rounded-md":!o.rounded,"text-lg":o.large,"py-2.5":o.large,"py-2":!o.large};return o.inputClass!=null&&(typeof o.inputClass=="string"?r[o.inputClass]=!0:o.inputClass instanceof Array&&o.inputClass.forEach(m=>{r[m]=!0})),r}),p=r=>{o.type==="checkbox"?l("update:modelValue",r.target.checked):l("update:modelValue",r.target.value)};return(r,m)=>r.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,id:c.value,ref_key:"inputElement",ref:i,class:e.normalizeClass(["border border-primary-stroke px-3 w-full",{"border-danger-base":e.unref(t)||r.invalid,"text-secondary-content":r.modelValue===""||r.modelValue==null,"rounded-full":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),disabled:r.disabled},[r.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,selected:r.modelValue===""||r.modelValue==null,disabled:"",hidden:""},e.toDisplayString(r.placeholder),9,M)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,s=>(e.openBlock(),e.createElementBlock("option",{selected:s.key===r.modelValue,key:s.key,value:s.key},e.toDisplayString(s.value),9,A))),128))],10,L)):r.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,name:r.name||e.unref(n),id:c.value,value:r.modelValue,onInput:p,rows:"3",class:e.normalizeClass(["border border-primary-stroke px-3 w-full placeholder-gray-400",{"border-danger-base":e.unref(t),"rounded-3xl":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,ref_key:"inputElement",ref:i},null,42,D)):r.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("input",{type:r.type,name:r.name||e.unref(n),id:c.value,value:!0,onInput:p,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(t)||r.invalid}]),checked:r.modelValue===!0,ref_key:"inputElement",ref:i},null,42,P),e.createElementVNode("label",{for:c.value,class:"text-primary-content select-none"},e.toDisplayString(r.placeholder),9,T)])):r.type==="radio"?(e.openBlock(),e.createElementBlock("div",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,(s,y)=>(e.openBlock(),e.createElementBlock("div",{key:s.key,class:"flex w-full space-x-3 items-center"},[e.createElementVNode("input",{type:"radio",name:r.name||e.unref(n),id:`${c.value}-${y}`,value:s.key,onInput:p,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(t)||r.invalid}]),checked:s.key===r.modelValue,ref_for:!0,ref_key:"inputElement",ref:i},null,42,H),e.createElementVNode("label",{for:`${c.value}-${y}`,class:"text-primary-content select-none"},e.toDisplayString(s.value),9,J)]))),128))])):(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",Q,[r.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.icon),{key:0,class:"w-5 h-5 text-primary-content"})):e.createCommentVNode("",!0)]),e.createElementVNode("input",{type:u.value?"text":r.type,name:r.name||e.unref(n),id:c.value,value:r.modelValue,onInput:p,placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["border border-primary-stroke w-full px-3 placeholder-gray-400",E.value]),ref_key:"inputElement",ref:i},null,42,R),r.clearable&&B.value?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:g,class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[e.createVNode(e.unref(I),{class:"w-5 h-5 text-secondary-content hover:text-primary-base"})])):r.type==="password"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:m[0]||(m[0]=s=>u.value=!u.value),class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[u.value?(e.openBlock(),e.createBlock(e.unref(j),{key:0,class:"w-5 h-5 text-primary-content hover:text-primary-base"})):(e.openBlock(),e.createBlock(e.unref(O),{key:1,class:"w-5 h-5 text-secondary-content hover:text-primary-base"}))])):e.createCommentVNode("",!0)]))}}),U={class:"space-y-1"},W={key:2,class:"text-xs text-secondary-content select-none"},X=e.defineComponent({__name:"OneFormField",props:V,setup(a){const l=a,{formId:o,validation:d}=k(),n=e.computed(()=>l.errors!=null&&l.errors.length>0?!0:l.name==null?!1:(d.value??{})[l.name]!=null);return e.provide("BaseFormField",{inputId:e.computed(()=>{const t=o.value||"form";if(l.id!=null)return`${t}-${l.id}`;if(l.name!=null)return`${t}-field-${l.name}`}),inputName:e.computed(()=>l.name),hasError:n}),(t,i)=>(e.openBlock(),e.createElementBlock("div",U,[t.label?(e.openBlock(),e.createBlock(v,{key:0,label:t.label},null,8,["label"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[e.createVNode(b)]),n.value?(e.openBlock(),e.createBlock(h,{key:1,errors:t.errors},null,8,["errors"])):t.hint.length>0?(e.openBlock(),e.createElementBlock("p",W,e.toDisplayString(t.hint),1)):e.createCommentVNode("",!0)]))}});exports.OneForm=N;exports.OneFormFeedback=h;exports.OneFormField=X;exports.OneFormInput=b;exports.OneFormLabel=v;
|
package/dist/form/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject as _, computed as t, defineComponent as g, provide as E, openBlock as l, createElementBlock as
|
|
1
|
+
import { inject as _, computed as t, defineComponent as g, provide as E, openBlock as l, createElementBlock as a, withModifiers as A, renderSlot as C, unref as d, createTextVNode as L, toDisplayString as h, Fragment as $, renderList as V, createCommentVNode as v, createElementVNode as c, ref as q, onMounted as P, normalizeClass as b, createBlock as k, resolveDynamicComponent as z, createVNode as O } from "vue";
|
|
2
2
|
const D = {
|
|
3
3
|
id: {
|
|
4
4
|
type: String,
|
|
@@ -125,7 +125,7 @@ const D = {
|
|
|
125
125
|
hasError: t(() => !1)
|
|
126
126
|
}),
|
|
127
127
|
!0
|
|
128
|
-
), K = ["onSubmit", "id"],
|
|
128
|
+
), K = ["onSubmit", "id"], he = /* @__PURE__ */ g({
|
|
129
129
|
__name: "OneForm",
|
|
130
130
|
props: D,
|
|
131
131
|
emits: ["submit"],
|
|
@@ -138,7 +138,7 @@ const D = {
|
|
|
138
138
|
const u = () => {
|
|
139
139
|
n("submit");
|
|
140
140
|
};
|
|
141
|
-
return (s,
|
|
141
|
+
return (s, o) => (l(), a("form", {
|
|
142
142
|
onSubmit: A(u, ["prevent"]),
|
|
143
143
|
id: s.id,
|
|
144
144
|
class: "space-y-3"
|
|
@@ -151,12 +151,12 @@ const D = {
|
|
|
151
151
|
props: H,
|
|
152
152
|
setup(i) {
|
|
153
153
|
const { inputId: n } = B();
|
|
154
|
-
return (r, u) => (l(),
|
|
154
|
+
return (r, u) => (l(), a("label", {
|
|
155
155
|
for: d(n),
|
|
156
156
|
class: "block text-sm font-medium text-primary-content select-none"
|
|
157
157
|
}, [
|
|
158
158
|
C(r.$slots, "default", {}, () => [
|
|
159
|
-
L(
|
|
159
|
+
L(h(r.label), 1)
|
|
160
160
|
])
|
|
161
161
|
], 8, Q));
|
|
162
162
|
}
|
|
@@ -168,13 +168,13 @@ const D = {
|
|
|
168
168
|
props: G,
|
|
169
169
|
setup(i) {
|
|
170
170
|
const n = i, { validation: r } = I(), { inputName: u } = B(), s = t(() => u.value == null && n.name == null ? n.errors ?? [] : r.value == null ? n.errors ?? [] : (r.value ?? {})[n.name || u.value] ?? n.errors ?? []);
|
|
171
|
-
return (
|
|
172
|
-
(l(!0),
|
|
173
|
-
])) :
|
|
171
|
+
return (o, m) => s.value.length > 0 ? (l(), a("div", U, [
|
|
172
|
+
(l(!0), a($, null, V(s.value, (f) => (l(), a("div", { key: f }, h(f), 1))), 128))
|
|
173
|
+
])) : v("", !0);
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
function X(i, n) {
|
|
177
|
-
return l(),
|
|
177
|
+
return l(), a("svg", {
|
|
178
178
|
xmlns: "http://www.w3.org/2000/svg",
|
|
179
179
|
fill: "none",
|
|
180
180
|
viewBox: "0 0 24 24",
|
|
@@ -195,7 +195,7 @@ function X(i, n) {
|
|
|
195
195
|
]);
|
|
196
196
|
}
|
|
197
197
|
function Y(i, n) {
|
|
198
|
-
return l(),
|
|
198
|
+
return l(), a("svg", {
|
|
199
199
|
xmlns: "http://www.w3.org/2000/svg",
|
|
200
200
|
fill: "none",
|
|
201
201
|
viewBox: "0 0 24 24",
|
|
@@ -211,7 +211,7 @@ function Y(i, n) {
|
|
|
211
211
|
]);
|
|
212
212
|
}
|
|
213
213
|
function Z(i, n) {
|
|
214
|
-
return l(),
|
|
214
|
+
return l(), a("svg", {
|
|
215
215
|
xmlns: "http://www.w3.org/2000/svg",
|
|
216
216
|
fill: "none",
|
|
217
217
|
viewBox: "0 0 24 24",
|
|
@@ -229,7 +229,7 @@ function Z(i, n) {
|
|
|
229
229
|
const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le = ["name", "id", "value", "placeholder", "disabled", "readonly"], ne = {
|
|
230
230
|
key: 2,
|
|
231
231
|
class: "flex w-full space-x-3 items-center"
|
|
232
|
-
},
|
|
232
|
+
}, ae = ["type", "name", "id", "disabled", "readonly", "checked"], oe = ["for"], te = {
|
|
233
233
|
key: 3,
|
|
234
234
|
class: "w-full space-y-1"
|
|
235
235
|
}, se = ["name", "id", "value", "disabled", "readonly", "checked"], de = ["for"], ie = {
|
|
@@ -240,7 +240,7 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
240
240
|
props: J,
|
|
241
241
|
emits: ["update:modelValue"],
|
|
242
242
|
setup(i, { emit: n }) {
|
|
243
|
-
const r = i, { inputId: u, inputName: s, hasError:
|
|
243
|
+
const r = i, { inputId: u, inputName: s, hasError: o } = B(), m = q(null), f = q(!1);
|
|
244
244
|
P(() => {
|
|
245
245
|
r.autofocus && m.value && m.value.focus();
|
|
246
246
|
});
|
|
@@ -254,7 +254,7 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
254
254
|
}, N = t(() => {
|
|
255
255
|
const e = {
|
|
256
256
|
"shadow-sm": r.type !== "range",
|
|
257
|
-
"border-danger-base":
|
|
257
|
+
"border-danger-base": o.value || r.invalid,
|
|
258
258
|
"pl-10": r.icon != null,
|
|
259
259
|
"pr-10": r.type === "password",
|
|
260
260
|
"rounded-full": r.rounded,
|
|
@@ -269,13 +269,13 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
269
269
|
}), w = (e) => {
|
|
270
270
|
r.type === "checkbox" ? n("update:modelValue", e.target.checked) : n("update:modelValue", e.target.value);
|
|
271
271
|
};
|
|
272
|
-
return (e, F) => e.type === "select" ? (l(),
|
|
272
|
+
return (e, F) => e.type === "select" ? (l(), a("select", {
|
|
273
273
|
key: 0,
|
|
274
274
|
id: y.value,
|
|
275
275
|
ref_key: "inputElement",
|
|
276
276
|
ref: m,
|
|
277
277
|
class: b(["border border-primary-stroke px-3 w-full", {
|
|
278
|
-
"border-danger-base": d(
|
|
278
|
+
"border-danger-base": d(o) || e.invalid,
|
|
279
279
|
"text-secondary-content": e.modelValue === "" || e.modelValue == null,
|
|
280
280
|
"rounded-full": e.rounded,
|
|
281
281
|
"rounded-md": !e.rounded,
|
|
@@ -285,26 +285,26 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
285
285
|
}]),
|
|
286
286
|
disabled: e.disabled
|
|
287
287
|
}, [
|
|
288
|
-
e.placeholder ? (l(),
|
|
288
|
+
e.placeholder ? (l(), a("option", {
|
|
289
289
|
key: 0,
|
|
290
290
|
selected: e.modelValue === "" || e.modelValue == null,
|
|
291
291
|
disabled: "",
|
|
292
292
|
hidden: ""
|
|
293
|
-
},
|
|
294
|
-
(l(!0),
|
|
293
|
+
}, h(e.placeholder), 9, ee)) : v("", !0),
|
|
294
|
+
(l(!0), a($, null, V(e.options, (p) => (l(), a("option", {
|
|
295
295
|
selected: p.key === e.modelValue,
|
|
296
296
|
key: p.key,
|
|
297
297
|
value: p.key
|
|
298
|
-
},
|
|
299
|
-
], 10, x)) : e.type === "textarea" ? (l(),
|
|
298
|
+
}, h(p.value), 9, re))), 128))
|
|
299
|
+
], 10, x)) : e.type === "textarea" ? (l(), a("textarea", {
|
|
300
300
|
key: 1,
|
|
301
301
|
name: e.name || d(s),
|
|
302
302
|
id: y.value,
|
|
303
303
|
value: e.modelValue,
|
|
304
304
|
onInput: w,
|
|
305
305
|
rows: "3",
|
|
306
|
-
class: b(["border border-primary-stroke px-3 w-full", {
|
|
307
|
-
"border-danger-base": d(
|
|
306
|
+
class: b(["border border-primary-stroke px-3 w-full placeholder-gray-400", {
|
|
307
|
+
"border-danger-base": d(o),
|
|
308
308
|
"rounded-3xl": e.rounded,
|
|
309
309
|
"rounded-md": !e.rounded,
|
|
310
310
|
"text-lg": e.large,
|
|
@@ -316,7 +316,7 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
316
316
|
readonly: e.readonly,
|
|
317
317
|
ref_key: "inputElement",
|
|
318
318
|
ref: m
|
|
319
|
-
}, null, 42, le)) : e.type === "checkbox" ? (l(),
|
|
319
|
+
}, null, 42, le)) : e.type === "checkbox" ? (l(), a("div", ne, [
|
|
320
320
|
c("input", {
|
|
321
321
|
type: e.type,
|
|
322
322
|
name: e.name || d(s),
|
|
@@ -326,18 +326,18 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
326
326
|
disabled: e.disabled,
|
|
327
327
|
readonly: e.readonly,
|
|
328
328
|
class: b(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm", {
|
|
329
|
-
"border-danger-base": d(
|
|
329
|
+
"border-danger-base": d(o) || e.invalid
|
|
330
330
|
}]),
|
|
331
331
|
checked: e.modelValue === !0,
|
|
332
332
|
ref_key: "inputElement",
|
|
333
333
|
ref: m
|
|
334
|
-
}, null, 42,
|
|
334
|
+
}, null, 42, ae),
|
|
335
335
|
c("label", {
|
|
336
336
|
for: y.value,
|
|
337
337
|
class: "text-primary-content select-none"
|
|
338
|
-
},
|
|
339
|
-
])) : e.type === "radio" ? (l(),
|
|
340
|
-
(l(!0),
|
|
338
|
+
}, h(e.placeholder), 9, oe)
|
|
339
|
+
])) : e.type === "radio" ? (l(), a("div", te, [
|
|
340
|
+
(l(!0), a($, null, V(e.options, (p, S) => (l(), a("div", {
|
|
341
341
|
key: p.key,
|
|
342
342
|
class: "flex w-full space-x-3 items-center"
|
|
343
343
|
}, [
|
|
@@ -350,7 +350,7 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
350
350
|
disabled: e.disabled,
|
|
351
351
|
readonly: e.readonly,
|
|
352
352
|
class: b(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm", {
|
|
353
|
-
"border-danger-base": d(
|
|
353
|
+
"border-danger-base": d(o) || e.invalid
|
|
354
354
|
}]),
|
|
355
355
|
checked: p.key === e.modelValue,
|
|
356
356
|
ref_for: !0,
|
|
@@ -360,14 +360,14 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
360
360
|
c("label", {
|
|
361
361
|
for: `${y.value}-${S}`,
|
|
362
362
|
class: "text-primary-content select-none"
|
|
363
|
-
},
|
|
363
|
+
}, h(p.value), 9, de)
|
|
364
364
|
]))), 128))
|
|
365
|
-
])) : (l(),
|
|
365
|
+
])) : (l(), a("div", ie, [
|
|
366
366
|
c("div", ue, [
|
|
367
367
|
e.icon ? (l(), k(z(e.icon), {
|
|
368
368
|
key: 0,
|
|
369
369
|
class: "w-5 h-5 text-primary-content"
|
|
370
|
-
})) :
|
|
370
|
+
})) : v("", !0)
|
|
371
371
|
]),
|
|
372
372
|
c("input", {
|
|
373
373
|
type: f.value ? "text" : e.type,
|
|
@@ -378,17 +378,17 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
378
378
|
placeholder: e.placeholder,
|
|
379
379
|
disabled: e.disabled,
|
|
380
380
|
readonly: e.readonly,
|
|
381
|
-
class: b(["border border-primary-stroke w-full px-3", N.value]),
|
|
381
|
+
class: b(["border border-primary-stroke w-full px-3 placeholder-gray-400", N.value]),
|
|
382
382
|
ref_key: "inputElement",
|
|
383
383
|
ref: m
|
|
384
384
|
}, null, 42, pe),
|
|
385
|
-
e.clearable && j.value ? (l(),
|
|
385
|
+
e.clearable && j.value ? (l(), a("div", {
|
|
386
386
|
key: 0,
|
|
387
387
|
onClick: M,
|
|
388
388
|
class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
|
|
389
389
|
}, [
|
|
390
390
|
O(d(Z), { class: "w-5 h-5 text-secondary-content hover:text-primary-base" })
|
|
391
|
-
])) : e.type === "password" ? (l(),
|
|
391
|
+
])) : e.type === "password" ? (l(), a("div", {
|
|
392
392
|
key: 1,
|
|
393
393
|
onClick: F[0] || (F[0] = (p) => f.value = !f.value),
|
|
394
394
|
class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
|
|
@@ -400,13 +400,13 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
400
400
|
key: 1,
|
|
401
401
|
class: "w-5 h-5 text-secondary-content hover:text-primary-base"
|
|
402
402
|
}))
|
|
403
|
-
])) :
|
|
403
|
+
])) : v("", !0)
|
|
404
404
|
]));
|
|
405
405
|
}
|
|
406
406
|
}), me = { class: "space-y-1" }, fe = {
|
|
407
407
|
key: 2,
|
|
408
408
|
class: "text-xs text-secondary-content select-none"
|
|
409
|
-
},
|
|
409
|
+
}, ve = /* @__PURE__ */ g({
|
|
410
410
|
__name: "OneFormField",
|
|
411
411
|
props: T,
|
|
412
412
|
setup(i) {
|
|
@@ -415,33 +415,33 @@ const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le
|
|
|
415
415
|
);
|
|
416
416
|
return E("BaseFormField", {
|
|
417
417
|
inputId: t(() => {
|
|
418
|
-
const
|
|
418
|
+
const o = r.value || "form";
|
|
419
419
|
if (n.id != null)
|
|
420
|
-
return `${
|
|
420
|
+
return `${o}-${n.id}`;
|
|
421
421
|
if (n.name != null)
|
|
422
|
-
return `${
|
|
422
|
+
return `${o}-field-${n.name}`;
|
|
423
423
|
}),
|
|
424
424
|
inputName: t(() => n.name),
|
|
425
425
|
hasError: s
|
|
426
|
-
}), (
|
|
427
|
-
|
|
426
|
+
}), (o, m) => (l(), a("div", me, [
|
|
427
|
+
o.label ? (l(), k(R, {
|
|
428
428
|
key: 0,
|
|
429
|
-
label:
|
|
430
|
-
}, null, 8, ["label"])) :
|
|
431
|
-
C(
|
|
429
|
+
label: o.label
|
|
430
|
+
}, null, 8, ["label"])) : v("", !0),
|
|
431
|
+
C(o.$slots, "default", {}, () => [
|
|
432
432
|
O(ce)
|
|
433
433
|
]),
|
|
434
434
|
s.value ? (l(), k(W, {
|
|
435
435
|
key: 1,
|
|
436
|
-
errors:
|
|
437
|
-
}, null, 8, ["errors"])) :
|
|
436
|
+
errors: o.errors
|
|
437
|
+
}, null, 8, ["errors"])) : o.hint.length > 0 ? (l(), a("p", fe, h(o.hint), 1)) : v("", !0)
|
|
438
438
|
]));
|
|
439
439
|
}
|
|
440
440
|
});
|
|
441
441
|
export {
|
|
442
|
-
|
|
442
|
+
he as OneForm,
|
|
443
443
|
W as OneFormFeedback,
|
|
444
|
-
|
|
444
|
+
ve as OneFormField,
|
|
445
445
|
ce as OneFormInput,
|
|
446
446
|
R as OneFormLabel
|
|
447
447
|
};
|
package/dist/layout/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),b=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-24874222.cjs");require("../common/index.cjs");const g={items:{required:!0,type:Array},slim:{type:Boolean,default:!0}},_={route:{required:!1,type:[Object,String]},routeName:{required:!1,type:String},handler:{required:!1,type:Function,default(){return()=>{}}},label:{type:String,required:!0},icon:{type:[Function,Object]},exact:{type:Boolean,required:!1,default:!1},slim:{type:Boolean,default:!0}},x={sidebarItems:g.items,logoSrc:{type:String},helpUrl:{type:String},app:{required:!0,type:Object},user:{type:Object,required:!0},labels:{type:Object},handlers:{type:Object}},N={class:"flex flex-nowrap items-center transition-all w-full h-[24px]"},B={class:"whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink pl-1.5 w-full"},V=e.defineComponent({__name:"OneSidebarLink",props:_,setup(r){const l=r,n=e.computed(()=>l.route!=null?l.route:l.routeName!=null?{name:l.routeName}:"/");return(o,s)=>{const t=e.resolveComponent("RouterLink");return e.openBlock(),e.createBlock(t,{to:n.value,class:e.normalizeClass(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content",[o.slim?"w-[44px] h-[44px] justify-center":"h-[44px] justify-start"]]),"active-class":o.exact?"":"bg-primary-10 !text-primary-base","exact-active-class":o.exact?"bg-primary-10 !text-primary-base":"",exact:o.exact},{default:e.withCtx(()=>[e.createElementVNode("div",N,[o.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{key:0,class:"w-[24px] h-[24px] flex-shrink-0 transition-all"})):e.createCommentVNode("",!0),e.createElementVNode("div",B,e.toDisplayString(o.label),1)])]),_:1},8,["to","active-class","exact-active-class","exact","class"])}}}),E={class:"space-y-2 p-2"},v=e.defineComponent({__name:"OneSidebar",props:g,setup(r){return(l,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,o=>(e.openBlock(),e.createBlock(V,{key:o.label,icon:o.icon,label:o.label,route:o.route,"route-name":o.routeName,exact:o.exact||!1,slim:l.slim},null,8,["icon","label","route","route-name","exact","slim"]))),128))])]))}});function C(r,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})])}function S(r,l){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})])}const O={class:"min-h-screen relative"},j={class:"header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-full"},L={class:"p-2 flex-shrink-0"},q={class:"w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0"},$=["src"],M={class:"whitespace-nowrap"},z={class:"text-xs whitespace-nowrap"},A={class:"w-full"},D={class:"w-full flex justify-end pr-2"},I={class:"flex items-center space-x-4"},P={key:0,class:"sm:block flex-shrink-0 hidden"},R=["href"],F={class:"body w-full h-full"},U=e.defineComponent({__name:"OneMainLayout",props:x,setup(r){const l=r,n=e.ref(window.localStorage.getItem("sidebar-slim")==="1");e.watch(n,t=>{window.localStorage.setItem("sidebar-slim",String(t?1:0))});const o=()=>{window.document.body.offsetWidth<1024&&!n.value&&(n.value=!0)},s=e.computed(()=>{var t,a;return{name:((t=l.app)==null?void 0:t.workspace)||"",photo_url:((a=l.app)==null?void 0:a.photo_url)||""}});return(t,a)=>{var c,i,p,u,d,m,h,f,k,w;const y=e.resolveComponent("RouterLink");return e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",j,[e.createElementVNode("div",L,[e.createElementVNode("button",{onClick:a[0]||(a[0]=H=>n.value=!n.value),class:"w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"},[e.createVNode(e.unref(C),{class:"w-[24px] h-[24px]"})])]),e.createElementVNode("div",q,[t.logoSrc!=null?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.logoSrc,class:"w-8 h-8 mx-auto",alt:"logo"},null,8,$)):e.createCommentVNode("",!0)]),t.app!=null?(e.openBlock(),e.createBlock(y,{key:0,to:"/",class:"pl-2 max-w-xs"},{default:e.withCtx(()=>[e.createElementVNode("div",M,e.toDisplayString(t.app.name),1),e.createElementVNode("div",z,e.toDisplayString(t.app.workspace),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.createElementVNode("div",D,[e.createElementVNode("div",I,[e.renderSlot(t.$slots,"before-header-menu"),t.helpUrl?(e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("a",{href:t.helpUrl,target:"_blank",title:"Help",class:"block btn-touch text-gray-dark"},[e.createVNode(e.unref(S),{class:"w-6 h-6 text-gray-600"})],8,R)])):e.createCommentVNode("",!0),e.createVNode(b._sfc_main$3,{workspace:s.value,apps:((c=t.app)==null?void 0:c.apps)||[],"change-label":((i=t.labels)==null?void 0:i.change)||"Change","apps-title":((p=t.labels)==null?void 0:p.apps)||"Apps","on-app":(u=t.handlers)==null?void 0:u.onApp,"on-change":(d=t.handlers)==null?void 0:d.onChange,onOpen:(m=t.handlers)==null?void 0:m.onBrowse},null,8,["workspace","apps","change-label","apps-title","on-app","on-change","onOpen"]),e.createVNode(b._sfc_main$2,{user:t.user,"account-label":((h=t.labels)==null?void 0:h.account)||"Account","logout-label":((f=t.labels)==null?void 0:f.logout)||"Logout","on-account":(k=t.handlers)==null?void 0:k.onAccount,"on-logout":(w=t.handlers)==null?void 0:w.onLogout},null,8,["user","account-label","logout-label","on-account","on-logout"])])])])]),e.createElementVNode("div",{class:e.normalizeClass(["sidebar absolute top-[56px] left-0 h-full overflow-hidden bg-white lg:bg-transparent transition-all z-50",[n.value?"w-0 lg:w-[60px]":"w-full lg:w-60"]]),onClick:o},[e.createVNode(v,{slim:n.value,items:t.sidebarItems},null,8,["slim","items"])],2),e.createElementVNode("div",F,[e.createElementVNode("div",{class:e.normalizeClass(["content transition-all pt-[56px]",[n.value?"pl-0 lg:pl-[60px]":"pl-0 lg:pl-60"]])},[e.renderSlot(t.$slots,"default")],2)])])}}});exports.OneMainLayout=U;exports.OneSidebar=v;
|
package/dist/layout/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as m, computed as
|
|
2
|
-
import { c as
|
|
1
|
+
import { defineComponent as m, computed as L, resolveComponent as $, openBlock as n, createBlock as u, normalizeClass as d, withCtx as B, createElementVNode as t, resolveDynamicComponent as M, createCommentVNode as p, toDisplayString as h, createElementBlock as r, Fragment as A, renderList as z, ref as I, watch as R, createVNode as c, unref as O, renderSlot as j } from "vue";
|
|
2
|
+
import { c as F, b as P } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-197489be.js";
|
|
3
3
|
import "../common/index.js";
|
|
4
|
-
const
|
|
4
|
+
const q = {
|
|
5
5
|
items: {
|
|
6
6
|
required: !0,
|
|
7
7
|
type: Array
|
|
@@ -10,7 +10,7 @@ const B = {
|
|
|
10
10
|
type: Boolean,
|
|
11
11
|
default: !0
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, U = {
|
|
14
14
|
route: {
|
|
15
15
|
required: !1,
|
|
16
16
|
type: [Object, String]
|
|
@@ -43,8 +43,8 @@ const B = {
|
|
|
43
43
|
type: Boolean,
|
|
44
44
|
default: !0
|
|
45
45
|
}
|
|
46
|
-
},
|
|
47
|
-
sidebarItems:
|
|
46
|
+
}, V = {
|
|
47
|
+
sidebarItems: q.items,
|
|
48
48
|
logoSrc: {
|
|
49
49
|
type: String
|
|
50
50
|
},
|
|
@@ -65,54 +65,54 @@ const B = {
|
|
|
65
65
|
handlers: {
|
|
66
66
|
type: Object
|
|
67
67
|
}
|
|
68
|
-
},
|
|
68
|
+
}, D = { class: "flex flex-nowrap items-center transition-all w-full h-[24px]" }, E = { class: "whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink pl-1.5 w-full" }, H = /* @__PURE__ */ m({
|
|
69
69
|
__name: "OneSidebarLink",
|
|
70
|
-
props:
|
|
71
|
-
setup(
|
|
72
|
-
const
|
|
73
|
-
return (
|
|
74
|
-
const
|
|
75
|
-
return
|
|
76
|
-
to:
|
|
77
|
-
class: d(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content", [
|
|
78
|
-
"active-class":
|
|
79
|
-
"exact-active-class":
|
|
80
|
-
exact:
|
|
70
|
+
props: U,
|
|
71
|
+
setup(a) {
|
|
72
|
+
const s = a, l = L(() => s.route != null ? s.route : s.routeName != null ? { name: s.routeName } : "/");
|
|
73
|
+
return (o, f) => {
|
|
74
|
+
const e = $("RouterLink");
|
|
75
|
+
return n(), u(e, {
|
|
76
|
+
to: l.value,
|
|
77
|
+
class: d(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content", [o.slim ? "w-[44px] h-[44px] justify-center" : "h-[44px] justify-start"]]),
|
|
78
|
+
"active-class": o.exact ? "" : "bg-primary-10 !text-primary-base",
|
|
79
|
+
"exact-active-class": o.exact ? "bg-primary-10 !text-primary-base" : "",
|
|
80
|
+
exact: o.exact
|
|
81
81
|
}, {
|
|
82
|
-
default:
|
|
83
|
-
t("div",
|
|
84
|
-
|
|
82
|
+
default: B(() => [
|
|
83
|
+
t("div", D, [
|
|
84
|
+
o.icon ? (n(), u(M(o.icon), {
|
|
85
85
|
key: 0,
|
|
86
|
-
class: "w-[24px] h-[24px] flex-shrink-0"
|
|
87
|
-
})) :
|
|
88
|
-
t("div",
|
|
86
|
+
class: "w-[24px] h-[24px] flex-shrink-0 transition-all"
|
|
87
|
+
})) : p("", !0),
|
|
88
|
+
t("div", E, h(o.label), 1)
|
|
89
89
|
])
|
|
90
90
|
]),
|
|
91
91
|
_: 1
|
|
92
92
|
}, 8, ["to", "active-class", "exact-active-class", "exact", "class"]);
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
}),
|
|
95
|
+
}), W = { class: "space-y-2 p-2" }, G = /* @__PURE__ */ m({
|
|
96
96
|
__name: "OneSidebar",
|
|
97
|
-
props:
|
|
98
|
-
setup(
|
|
99
|
-
return (
|
|
100
|
-
t("div",
|
|
101
|
-
(
|
|
102
|
-
key:
|
|
103
|
-
icon:
|
|
104
|
-
label:
|
|
105
|
-
route:
|
|
106
|
-
"route-name":
|
|
107
|
-
exact:
|
|
108
|
-
slim:
|
|
97
|
+
props: q,
|
|
98
|
+
setup(a) {
|
|
99
|
+
return (s, l) => (n(), r("div", null, [
|
|
100
|
+
t("div", W, [
|
|
101
|
+
(n(!0), r(A, null, z(s.items, (o) => (n(), u(H, {
|
|
102
|
+
key: o.label,
|
|
103
|
+
icon: o.icon,
|
|
104
|
+
label: o.label,
|
|
105
|
+
route: o.route,
|
|
106
|
+
"route-name": o.routeName,
|
|
107
|
+
exact: o.exact || !1,
|
|
108
|
+
slim: s.slim
|
|
109
109
|
}, null, 8, ["icon", "label", "route", "route-name", "exact", "slim"]))), 128))
|
|
110
110
|
])
|
|
111
111
|
]));
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
function J(
|
|
115
|
-
return
|
|
114
|
+
function J(a, s) {
|
|
115
|
+
return n(), r("svg", {
|
|
116
116
|
xmlns: "http://www.w3.org/2000/svg",
|
|
117
117
|
fill: "none",
|
|
118
118
|
viewBox: "0 0 24 24",
|
|
@@ -127,8 +127,8 @@ function J(i, l) {
|
|
|
127
127
|
})
|
|
128
128
|
]);
|
|
129
129
|
}
|
|
130
|
-
function K(
|
|
131
|
-
return
|
|
130
|
+
function K(a, s) {
|
|
131
|
+
return n(), r("svg", {
|
|
132
132
|
xmlns: "http://www.w3.org/2000/svg",
|
|
133
133
|
fill: "none",
|
|
134
134
|
viewBox: "0 0 24 24",
|
|
@@ -143,101 +143,104 @@ function K(i, l) {
|
|
|
143
143
|
})
|
|
144
144
|
]);
|
|
145
145
|
}
|
|
146
|
-
const Q = { class: "min-h-screen relative" }, T = { class: "header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-full" },
|
|
146
|
+
const Q = { class: "min-h-screen relative" }, T = { class: "header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-full" }, X = { class: "p-2 flex-shrink-0" }, Y = { class: "w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0" }, Z = ["src"], ee = { class: "whitespace-nowrap" }, te = { class: "text-xs whitespace-nowrap" }, oe = { class: "w-full" }, se = { class: "w-full flex justify-end pr-2" }, le = { class: "flex items-center space-x-4" }, ne = {
|
|
147
147
|
key: 0,
|
|
148
148
|
class: "sm:block flex-shrink-0 hidden"
|
|
149
|
-
}, re = ["href"],
|
|
149
|
+
}, re = ["href"], ae = { class: "body w-full h-full" }, de = /* @__PURE__ */ m({
|
|
150
150
|
__name: "OneMainLayout",
|
|
151
|
-
props:
|
|
152
|
-
setup(
|
|
153
|
-
const
|
|
154
|
-
|
|
151
|
+
props: V,
|
|
152
|
+
setup(a) {
|
|
153
|
+
const s = a, l = I(window.localStorage.getItem("sidebar-slim") === "1");
|
|
154
|
+
R(l, (e) => {
|
|
155
155
|
window.localStorage.setItem("sidebar-slim", String(e ? 1 : 0));
|
|
156
156
|
});
|
|
157
|
-
const
|
|
158
|
-
|
|
157
|
+
const o = () => {
|
|
158
|
+
window.document.body.offsetWidth < 1024 && !l.value && (l.value = !0);
|
|
159
|
+
}, f = L(() => {
|
|
160
|
+
var e, i;
|
|
159
161
|
return {
|
|
160
|
-
name: ((e =
|
|
161
|
-
photo_url: ((
|
|
162
|
+
name: ((e = s.app) == null ? void 0 : e.workspace) || "",
|
|
163
|
+
photo_url: ((i = s.app) == null ? void 0 : i.photo_url) || ""
|
|
162
164
|
};
|
|
163
165
|
});
|
|
164
|
-
return (e,
|
|
165
|
-
var
|
|
166
|
-
const
|
|
167
|
-
return
|
|
166
|
+
return (e, i) => {
|
|
167
|
+
var b, w, g, v, y, k, x, _, S, C;
|
|
168
|
+
const N = $("RouterLink");
|
|
169
|
+
return n(), r("div", Q, [
|
|
168
170
|
t("div", T, [
|
|
169
|
-
t("div",
|
|
171
|
+
t("div", X, [
|
|
170
172
|
t("button", {
|
|
171
|
-
onClick:
|
|
173
|
+
onClick: i[0] || (i[0] = (ie) => l.value = !l.value),
|
|
172
174
|
class: "w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"
|
|
173
175
|
}, [
|
|
174
|
-
|
|
176
|
+
c(O(J), { class: "w-[24px] h-[24px]" })
|
|
175
177
|
])
|
|
176
178
|
]),
|
|
177
|
-
t("div",
|
|
178
|
-
e.logoSrc != null ? (
|
|
179
|
+
t("div", Y, [
|
|
180
|
+
e.logoSrc != null ? (n(), r("img", {
|
|
179
181
|
key: 0,
|
|
180
182
|
src: e.logoSrc,
|
|
181
183
|
class: "w-8 h-8 mx-auto",
|
|
182
184
|
alt: "logo"
|
|
183
|
-
}, null, 8,
|
|
185
|
+
}, null, 8, Z)) : p("", !0)
|
|
184
186
|
]),
|
|
185
|
-
e.app != null ? (
|
|
187
|
+
e.app != null ? (n(), u(N, {
|
|
186
188
|
key: 0,
|
|
187
189
|
to: "/",
|
|
188
190
|
class: "pl-2 max-w-xs"
|
|
189
191
|
}, {
|
|
190
|
-
default:
|
|
191
|
-
t("div",
|
|
192
|
-
t("div",
|
|
192
|
+
default: B(() => [
|
|
193
|
+
t("div", ee, h(e.app.name), 1),
|
|
194
|
+
t("div", te, h(e.app.workspace), 1)
|
|
193
195
|
]),
|
|
194
196
|
_: 1
|
|
195
|
-
})) :
|
|
196
|
-
t("div",
|
|
197
|
+
})) : p("", !0),
|
|
198
|
+
t("div", oe, [
|
|
197
199
|
t("div", se, [
|
|
198
200
|
t("div", le, [
|
|
199
201
|
j(e.$slots, "before-header-menu"),
|
|
200
|
-
e.helpUrl ? (
|
|
202
|
+
e.helpUrl ? (n(), r("div", ne, [
|
|
201
203
|
t("a", {
|
|
202
204
|
href: e.helpUrl,
|
|
203
205
|
target: "_blank",
|
|
204
206
|
title: "Help",
|
|
205
207
|
class: "block btn-touch text-gray-dark"
|
|
206
208
|
}, [
|
|
207
|
-
|
|
209
|
+
c(O(K), { class: "w-6 h-6 text-gray-600" })
|
|
208
210
|
], 8, re)
|
|
209
|
-
])) :
|
|
210
|
-
|
|
211
|
-
workspace:
|
|
212
|
-
apps: ((
|
|
213
|
-
"change-label": ((
|
|
214
|
-
"apps-title": ((
|
|
215
|
-
"on-app": (
|
|
216
|
-
"on-change": (
|
|
217
|
-
onOpen: (
|
|
211
|
+
])) : p("", !0),
|
|
212
|
+
c(F, {
|
|
213
|
+
workspace: f.value,
|
|
214
|
+
apps: ((b = e.app) == null ? void 0 : b.apps) || [],
|
|
215
|
+
"change-label": ((w = e.labels) == null ? void 0 : w.change) || "Change",
|
|
216
|
+
"apps-title": ((g = e.labels) == null ? void 0 : g.apps) || "Apps",
|
|
217
|
+
"on-app": (v = e.handlers) == null ? void 0 : v.onApp,
|
|
218
|
+
"on-change": (y = e.handlers) == null ? void 0 : y.onChange,
|
|
219
|
+
onOpen: (k = e.handlers) == null ? void 0 : k.onBrowse
|
|
218
220
|
}, null, 8, ["workspace", "apps", "change-label", "apps-title", "on-app", "on-change", "onOpen"]),
|
|
219
|
-
|
|
221
|
+
c(P, {
|
|
220
222
|
user: e.user,
|
|
221
223
|
"account-label": ((x = e.labels) == null ? void 0 : x.account) || "Account",
|
|
222
|
-
"logout-label": ((
|
|
223
|
-
"on-account": (
|
|
224
|
-
"on-logout": (
|
|
224
|
+
"logout-label": ((_ = e.labels) == null ? void 0 : _.logout) || "Logout",
|
|
225
|
+
"on-account": (S = e.handlers) == null ? void 0 : S.onAccount,
|
|
226
|
+
"on-logout": (C = e.handlers) == null ? void 0 : C.onLogout
|
|
225
227
|
}, null, 8, ["user", "account-label", "logout-label", "on-account", "on-logout"])
|
|
226
228
|
])
|
|
227
229
|
])
|
|
228
230
|
])
|
|
229
231
|
]),
|
|
230
232
|
t("div", {
|
|
231
|
-
class: d(["sidebar absolute top-[56px] left-0 h-full overflow-hidden bg-white lg:bg-transparent transition-all z-50", [
|
|
233
|
+
class: d(["sidebar absolute top-[56px] left-0 h-full overflow-hidden bg-white lg:bg-transparent transition-all z-50", [l.value ? "w-0 lg:w-[60px]" : "w-full lg:w-60"]]),
|
|
234
|
+
onClick: o
|
|
232
235
|
}, [
|
|
233
|
-
|
|
234
|
-
slim:
|
|
236
|
+
c(G, {
|
|
237
|
+
slim: l.value,
|
|
235
238
|
items: e.sidebarItems
|
|
236
239
|
}, null, 8, ["slim", "items"])
|
|
237
240
|
], 2),
|
|
238
|
-
t("div",
|
|
241
|
+
t("div", ae, [
|
|
239
242
|
t("div", {
|
|
240
|
-
class: d(["content transition-all pt-[56px]", [
|
|
243
|
+
class: d(["content transition-all pt-[56px]", [l.value ? "pl-0 lg:pl-[60px]" : "pl-0 lg:pl-60"]])
|
|
241
244
|
}, [
|
|
242
245
|
j(e.$slots, "default")
|
|
243
246
|
], 2)
|
|
@@ -247,6 +250,6 @@ const Q = { class: "min-h-screen relative" }, T = { class: "header h-[56px] flex
|
|
|
247
250
|
}
|
|
248
251
|
});
|
|
249
252
|
export {
|
|
250
|
-
|
|
253
|
+
de as OneMainLayout,
|
|
251
254
|
G as OneSidebar
|
|
252
255
|
};
|