@selfeesas/shared-components 0.1.8 → 0.1.9
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),T={xs:18,sm:24,md:32,lg:38,xl:46},D={size:String};function H(e,t=T){return r.computed(()=>e.size!==void 0?{fontSize:e.size in t?`${t[e.size]}px`:e.size}:null)}function B(e){return r.markRaw(r.defineComponent(e))}function I(e,t){return e!==void 0&&e()||t}function S(e,t){return e!==void 0?t.concat(e()):t}const L="0 0 24 24",_=e=>e,$=e=>`ionicons ${e}`,O={"mdi-":e=>`mdi ${e}`,"icon-":_,"bt-":e=>`bt ${e}`,"eva-":e=>`eva ${e}`,"ion-md":$,"ion-ios":$,"ion-logo":$,"iconfont ":_,"ti-":e=>`themify-icon ${e}`,"bi-":e=>`bootstrap-icons ${e}`,"i-":_},M={o_:"-outlined",r_:"-round",s_:"-sharp"},j={sym_o_:"-outlined",sym_r_:"-rounded",sym_s_:"-sharp"},G=new RegExp("^("+Object.keys(O).join("|")+")"),U=new RegExp("^("+Object.keys(M).join("|")+")"),z=new RegExp("^("+Object.keys(j).join("|")+")"),J=/^[Mm]\s?[-+]?\.?\d/,W=/^img:/,X=/^svguse:/,Y=/^ion-/,Z=/^(fa-(classic|sharp|solid|regular|light|brands|duotone|thin)|[lf]a[srlbdk]?) /,N=B({name:"QIcon",props:{...D,tag:{type:String,default:"i"},name:String,color:String,left:Boolean,right:Boolean},setup(e,{slots:t}){const{proxy:{$q:s}}=r.getCurrentInstance(),a=H(e),o=r.computed(()=>"q-icon"+(e.left===!0?" on-left":"")+(e.right===!0?" on-right":"")+(e.color!==void 0?` text-${e.color}`:"")),c=r.computed(()=>{let l,n=e.name;if(n==="none"||!n)return{none:!0};if(s.iconMapFn!==null){const u=s.iconMapFn(n);if(u!==void 0)if(u.icon!==void 0){if(n=u.icon,n==="none"||!n)return{none:!0}}else return{cls:u.cls,content:u.content!==void 0?u.content:" "}}if(J.test(n)===!0){const[u,g=L]=n.split("|");return{svg:!0,viewBox:g,nodes:u.split("&&").map(d=>{const[i,h,b]=d.split("@@");return r.h("path",{style:h,d:i,transform:b})})}}if(W.test(n)===!0)return{img:!0,src:n.substring(4)};if(X.test(n)===!0){const[u,g=L]=n.split("|");return{svguse:!0,src:u.substring(7),viewBox:g}}let f=" ";const v=n.match(G);if(v!==null)l=O[v[1]](n);else if(Z.test(n)===!0)l=n;else if(Y.test(n)===!0)l=`ionicons ion-${s.platform.is.ios===!0?"ios":"md"}${n.substring(3)}`;else if(z.test(n)===!0){l="notranslate material-symbols";const u=n.match(z);u!==null&&(n=n.substring(6),l+=j[u[1]]),f=n}else{l="notranslate material-icons";const u=n.match(U);u!==null&&(n=n.substring(2),l+=M[u[1]]),f=n}return{cls:l,content:f}});return()=>{const l={class:o.value,style:a.value,"aria-hidden":"true"};return c.value.none===!0?r.h(e.tag,l,I(t.default)):c.value.img===!0?r.h(e.tag,l,S(t.default,[r.h("img",{src:c.value.src})])):c.value.svg===!0?r.h(e.tag,l,S(t.default,[r.h("svg",{viewBox:c.value.viewBox||"0 0 24 24"},c.value.nodes)])):c.value.svguse===!0?r.h(e.tag,l,S(t.default,[r.h("svg",{viewBox:c.value.viewBox},[r.h("use",{"xlink:href":c.value.src})])])):(c.value.cls!==void 0&&(l.class+=" "+c.value.cls),r.h(e.tag,l,S(t.default,[c.value.content])))}}});function V(e,t){typeof t.type=="symbol"?Array.isArray(t.children)===!0&&t.children.forEach(s=>{V(e,s)}):e.add(t)}function ee(e){const t=new Set;return e.forEach(s=>{V(t,s)}),Array.from(t)}function te(e){return e.appContext.config.globalProperties.$router!==void 0}function w(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}function F(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function re(e,t){for(const s in t){const a=t[s],o=e[s];if(typeof a=="string"){if(a!==o)return!1}else if(Array.isArray(o)===!1||o.length!==a.length||a.some((c,l)=>c!==o[l]))return!1}return!0}function q(e,t){return Array.isArray(t)===!0?e.length===t.length&&e.every((s,a)=>s===t[a]):e.length===1&&e[0]===t}function ae(e,t){return Array.isArray(e)===!0?q(e,t):Array.isArray(t)===!0?q(t,e):e===t}function ne(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(ae(e[s],t[s])===!1)return!1;return!0}const oe={to:[String,Object],replace:Boolean,href:String,target:String,disable:Boolean},le={...oe,exact:Boolean,activeClass:{type:String,default:"q-router-link--active"},exactActiveClass:{type:String,default:"q-router-link--exact-active"}};function ue({fallbackTag:e,useDisableForRouterLinkProps:t=!0}={}){const s=r.getCurrentInstance(),{props:a,proxy:o,emit:c}=s,l=te(s),n=r.computed(()=>a.disable!==!0&&a.href!==void 0),f=t===!0?r.computed(()=>l===!0&&a.disable!==!0&&n.value!==!0&&a.to!==void 0&&a.to!==null&&a.to!==""):r.computed(()=>l===!0&&n.value!==!0&&a.to!==void 0&&a.to!==null&&a.to!==""),v=r.computed(()=>f.value===!0?A(a.to):null),u=r.computed(()=>v.value!==null),g=r.computed(()=>n.value===!0||u.value===!0),d=r.computed(()=>a.type==="a"||g.value===!0?"a":a.tag||e||"div"),i=r.computed(()=>n.value===!0?{href:a.href,target:a.target}:u.value===!0?{href:v.value.href,target:a.target}:{}),h=r.computed(()=>{if(u.value===!1)return-1;const{matched:m}=v.value,{length:p}=m,k=m[p-1];if(k===void 0)return-1;const C=o.$route.matched;if(C.length===0)return-1;const x=C.findIndex(F.bind(null,k));if(x!==-1)return x;const E=w(m[p-2]);return p>1&&w(k)===E&&C[C.length-1].path!==E?C.findIndex(F.bind(null,m[p-2])):x}),b=r.computed(()=>u.value===!0&&h.value!==-1&&re(o.$route.params,v.value.params)),y=r.computed(()=>b.value===!0&&h.value===o.$route.matched.length-1&&ne(o.$route.params,v.value.params)),R=r.computed(()=>u.value===!0?y.value===!0?` ${a.exactActiveClass} ${a.activeClass}`:a.exact===!0?"":b.value===!0?` ${a.activeClass}`:"":"");function A(m){try{return o.$router.resolve(m)}catch{}return null}function P(m,{returnRouterError:p,to:k=a.to,replace:C=a.replace}={}){if(a.disable===!0)return m.preventDefault(),Promise.resolve(!1);if(m.metaKey||m.altKey||m.ctrlKey||m.shiftKey||m.button!==void 0&&m.button!==0||a.target==="_blank")return Promise.resolve(!1);m.preventDefault();const x=o.$router[C===!0?"replace":"push"](k);return p===!0?x:x.then(()=>{}).catch(()=>{})}function K(m){if(u.value===!0){const p=k=>P(m,k);c("click",m,p),m.defaultPrevented!==!0&&p()}else c("click",m)}return{hasRouterLink:u,hasHrefLink:n,hasLink:g,linkTag:d,resolvedLink:v,linkIsActive:b,linkIsExactActive:y,linkClass:R,linkAttrs:i,getLink:A,navigateToRouterLink:P,navigateOnClick:K}}const se=B({name:"QBreadcrumbsEl",props:{...le,label:String,icon:String,tag:{type:String,default:"span"}},emits:["click"],setup(e,{slots:t}){const{linkTag:s,linkAttrs:a,linkClass:o,navigateOnClick:c}=ue(),l=r.computed(()=>({class:"q-breadcrumbs__el q-link flex inline items-center relative-position "+(e.disable!==!0?"q-link--focusable"+o.value:"q-breadcrumbs__el--disable"),...a.value,onClick:c})),n=r.computed(()=>"q-breadcrumbs__el-icon"+(e.label!==void 0?" q-breadcrumbs__el-icon--with-label":""));return()=>{const f=[];return e.icon!==void 0&&f.push(r.h(N,{class:n.value,name:e.icon})),e.label!==void 0&&f.push(e.label),r.h(s.value,{...l.value},S(t.default,f))}}}),Q={left:"start",center:"center",right:"end",between:"between",around:"around",evenly:"evenly",stretch:"stretch"},ce=Object.keys(Q),ie={align:{type:String,validator:e=>ce.includes(e)}};function de(e){return r.computed(()=>{const t=e.align===void 0?e.vertical===!0?"stretch":"left":e.align;return`${e.vertical===!0?"items":"justify"}-${Q[t]}`})}const me=["",!0],ve=B({name:"QBreadcrumbs",props:{...ie,separator:{type:String,default:"/"},separatorColor:String,activeColor:{type:String,default:"primary"},gutter:{type:String,validator:e=>["none","xs","sm","md","lg","xl"].includes(e),default:"sm"}},setup(e,{slots:t}){const s=de(e),a=r.computed(()=>`flex items-center ${s.value}${e.gutter==="none"?"":` q-gutter-${e.gutter}`}`),o=r.computed(()=>e.separatorColor?` text-${e.separatorColor}`:""),c=r.computed(()=>` text-${e.activeColor}`);return()=>{if(t.default===void 0)return;const l=ee(I(t.default));if(l.length===0)return;let n=1;const f=[],v=l.filter(g=>{var d;return((d=g.type)==null?void 0:d.name)==="QBreadcrumbsEl"}).length,u=t.separator!==void 0?t.separator:()=>e.separator;return l.forEach(g=>{var d;if(((d=g.type)==null?void 0:d.name)==="QBreadcrumbsEl"){const i=n<v,h=g.props!==null&&me.includes(g.props.disable),b=(i===!0?"":" q-breadcrumbs--last")+(h!==!0&&i===!0?c.value:"");n++,f.push(r.h("div",{class:`flex items-center${b}`},[g])),i===!0&&f.push(r.h("div",{class:"q-breadcrumbs__separator"+o.value},u()))}else f.push(g)}),r.h("div",{class:"q-breadcrumbs"},[r.h("div",{class:a.value},f)])}}}),fe=r.defineComponent({inheritAttrs:!1,__name:"Breadcrumbs",props:{activeColor:{},separatorIcon:{},separatorSize:{},separatorColor:{},store:{},navStore:{},route:{},router:{},breadcrumbConfig:{},separator:{},gutter:{},align:{}},setup(e){const t=e,s=r.useAttrs(),a=r.computed(()=>{const{activeColor:d,separatorIcon:i,separatorSize:h,separatorColor:b,...y}=s;return y}),o=d=>({"data-cy":d.dataCy,class:"cursor-pointer text-h5",color:d.color}),c=r.computed(()=>t.activeColor||"primary"),l=r.computed(()=>t.separatorIcon||"chevron_right"),n=r.computed(()=>t.separatorSize||"2em"),f=r.computed(()=>t.separatorColor||"primary"),v=r.computed(()=>({store:t.store,route:t.route,navStore:t.navStore||{}})),u=r.computed(()=>{const d=[];return t.breadcrumbConfig.forEach(i=>{if(!i.shouldRender(v.value))return;const h=i.getLabel?i.getLabel(v.value):i.defaultLabel,b=i.getColor?i.getColor(v.value):"dark",y={name:i.routeName,...i.getRouteParams&&{params:i.getRouteParams(v.value)}},R=i.clearActions?i.clearActions.map(A=>()=>A(v.value)):[];d.push({label:h,dataCy:i.dataCy,color:b,route:y,clearActions:R})}),d}),g=d=>{d.clearActions&&d.clearActions.forEach(i=>i()),t.router.push(d.route)};return(d,i)=>(r.openBlock(),r.createBlock(ve,r.mergeProps({"active-color":c.value,class:"text-brown"},a.value),{separator:r.withCtx(()=>[r.createVNode(N,{size:n.value,name:l.value,color:f.value},null,8,["size","name","color"])]),default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.value,(h,b)=>(r.openBlock(),r.createBlock(se,r.mergeProps({key:b},{ref_for:!0},o(h),{label:h.label,onClick:y=>g(h)}),null,16,["label","onClick"]))),128))]),_:1},16,["active-color"]))}});function ge(e){var t,s;return{entity:e.entity,dataCy:e.dataCy,defaultLabel:e.defaultLabel,routeName:e.routeName,shouldRender:e.customShouldRender||(({store:a})=>e.storeField?!!a[e.storeField]:!0),getLabel:e.getLabel||(e.labelField?({store:a})=>{var o;return e.storeField&&((o=a[e.storeField])==null?void 0:o[e.labelField])||e.defaultLabel}:void 0),getColor:e.customGetColor||(({store:a})=>e.storeField&&a[e.storeField]?"primary":"dark"),getRouteParams:e.routeParamKey&&e.routeParamField?({store:a})=>{var o;return{[e.routeParamKey]:e.storeField&&((o=a[e.storeField])==null?void 0:o[e.routeParamField])}}:void 0,clearActions:[...((t=e.clearMethods)==null?void 0:t.map(a=>({store:o})=>{var c;return(c=o[a])==null?void 0:c.call(o)}))||[],...((s=e.navActions)==null?void 0:s.map(a=>({navStore:o})=>a(o)))||[]]}}exports.Breadcrumbs=fe;exports.createBreadcrumb=ge;
|
|
@@ -1,36 +1,68 @@
|
|
|
1
|
-
import { App } from 'vue';
|
|
2
1
|
import { ComponentOptionsMixin } from 'vue';
|
|
3
2
|
import { ComponentProvideOptions } from 'vue';
|
|
4
3
|
import { DefineComponent } from 'vue';
|
|
5
|
-
import { ExtractPropTypes } from 'vue';
|
|
6
4
|
import { PublicProps } from 'vue';
|
|
5
|
+
import { QBreadcrumbsProps } from 'quasar';
|
|
6
|
+
import { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
7
|
+
import { Router } from 'vue-router';
|
|
7
8
|
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
9
|
+
export declare interface BreadcrumbConfig {
|
|
10
|
+
entity: string;
|
|
11
|
+
dataCy: string;
|
|
12
|
+
defaultLabel: string;
|
|
13
|
+
routeName: string;
|
|
14
|
+
shouldRender: (context: Context) => boolean;
|
|
15
|
+
getLabel?: (context: Context) => string;
|
|
16
|
+
getColor?: (context: Context) => string;
|
|
17
|
+
getRouteParams?: (context: Context) => Record<string, any>;
|
|
18
|
+
clearActions?: Array<(context: Context) => void>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare interface BreadcrumbOptions {
|
|
22
|
+
entity: string;
|
|
23
|
+
dataCy: string;
|
|
24
|
+
defaultLabel: string;
|
|
25
|
+
routeName: string;
|
|
26
|
+
storeField?: string;
|
|
27
|
+
labelField?: string;
|
|
28
|
+
routeParamKey?: string;
|
|
29
|
+
routeParamField?: string;
|
|
30
|
+
clearMethods?: string[];
|
|
31
|
+
navActions?: Array<(navStore: NavStore) => void>;
|
|
32
|
+
customShouldRender?: (context: Context) => boolean;
|
|
33
|
+
customGetColor?: (context: Context) => string;
|
|
34
|
+
getLabel?: (context: Context) => string;
|
|
35
|
+
getRouteParams?: (context: Context) => Record<string, any>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export declare const Breadcrumbs: DefineComponent<CustomBreadcrumbsProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<CustomBreadcrumbsProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
39
|
+
|
|
40
|
+
export declare interface Context {
|
|
41
|
+
store: Store;
|
|
42
|
+
route: RouteLocationNormalizedLoaded;
|
|
43
|
+
navStore: NavStore;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export declare function createBreadcrumb(options: BreadcrumbOptions): BreadcrumbConfig;
|
|
47
|
+
|
|
48
|
+
declare interface CustomBreadcrumbsProps extends QBreadcrumbsProps {
|
|
49
|
+
activeColor?: string;
|
|
50
|
+
separatorIcon?: string;
|
|
51
|
+
separatorSize?: string;
|
|
52
|
+
separatorColor?: string;
|
|
53
|
+
store: Store;
|
|
54
|
+
navStore?: NavStore;
|
|
55
|
+
route: RouteLocationNormalizedLoaded;
|
|
56
|
+
router: Router;
|
|
57
|
+
breadcrumbConfig: BreadcrumbConfig[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare interface NavStore {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare interface Store {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
}
|
|
35
67
|
|
|
36
68
|
export { }
|