@nubisco/ui 5.19.0 → 5.20.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.
- package/dist/{ActionGroup-CMuposow.cjs → ActionGroup-CUN48Qea.cjs} +1 -1
- package/dist/{ActionGroup-0u17QzT8.js → ActionGroup-lEopoloN.js} +1 -1
- package/dist/BarChart-Bnkibwcl.js +294 -0
- package/dist/BarChart-CjxY_3RM.cjs +1 -0
- package/dist/{Confirm-OMhu2Fuz.js → Confirm-Dh1H2PMh.js} +1 -1
- package/dist/{Confirm-DCkG5bUZ.cjs → Confirm-ue689l-w.cjs} +1 -1
- package/dist/DataTable-CQBI0wcg.js +412 -0
- package/dist/DataTable-DN4SbClx.cjs +1 -0
- package/dist/{DatePicker-MDaQ2l8I.js → DatePicker-ViTSDX6d.js} +162 -135
- package/dist/DatePicker-lv4wQxf8.cjs +1 -0
- package/dist/LineChart-Bol60gtX.cjs +1 -0
- package/dist/{LineChart-DG_ows6r.js → LineChart-CsBHPIUF.js} +25 -21
- package/dist/{Menu-D-zvh-SA.js → Menu-2Se8F81Q.js} +1 -1
- package/dist/Menu-CAZmNx60.cjs +1 -0
- package/dist/{MenuBarItem-BDqp9LzY.js → MenuBarItem-Cxxs8Dnr.js} +1 -1
- package/dist/{MenuBarItem-Dmutkr1p.cjs → MenuBarItem-dBEuTZ3Q.cjs} +1 -1
- package/dist/{Modal-C97dRTiP.js → Modal-BxSP1eyD.js} +2 -2
- package/dist/{Modal-BNgLfB88.cjs → Modal-sGlC__uQ.cjs} +1 -1
- package/dist/{Pagination-Br-k9zuG.js → Pagination-BveCRx-Z.js} +1 -1
- package/dist/{Pagination-CCMhqtoz.cjs → Pagination-DlTqW-zR.cjs} +1 -1
- package/dist/Select-D4Il1NaM.js +489 -0
- package/dist/Select-MwbDOqbP.cjs +1 -0
- package/dist/Tabs-Bmw1hFrN.cjs +1 -0
- package/dist/Tabs-CjXOZ3K6.js +196 -0
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +12 -12
- package/dist/components/ActionGroup.cjs +1 -1
- package/dist/components/ActionGroup.mjs +1 -1
- package/dist/components/Charts/BarChart.cjs +1 -1
- package/dist/components/Charts/BarChart.d.ts +8 -1
- package/dist/components/Charts/BarChart.mjs +1 -1
- package/dist/components/Charts/BarChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/LineChart.cjs +1 -1
- package/dist/components/Charts/LineChart.d.ts +8 -1
- package/dist/components/Charts/LineChart.mjs +1 -1
- package/dist/components/Charts/LineChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/shared/types.d.ts +7 -0
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Menu.cjs +1 -1
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/MenuBarItem.cjs +1 -1
- package/dist/components/MenuBarItem.mjs +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.d.ts +8 -0
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts +9 -7
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/Tabs.cjs +1 -1
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/Tabs.vue.d.ts.map +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +12 -12
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/BarChart.css +1 -1
- package/dist/styles/DataTable.css +1 -1
- package/dist/styles/LineChart.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/dist/styles/Select.css +1 -1
- package/dist/styles/Tabs.css +1 -1
- package/dist/ui.css +6 -6
- package/package.json +1 -1
- package/dist/BarChart-DTStA9jd.js +0 -290
- package/dist/BarChart-Dvrl4xeX.cjs +0 -1
- package/dist/DataTable-CWMlmjMi.cjs +0 -1
- package/dist/DataTable-DaNZAixf.js +0 -389
- package/dist/DatePicker-BgMtkY76.cjs +0 -1
- package/dist/LineChart-C5bQNxQ-.cjs +0 -1
- package/dist/Menu-BALfMobG.cjs +0 -1
- package/dist/Select-ClkEzw5T.cjs +0 -1
- package/dist/Select-DIw08nte.js +0 -437
- package/dist/Tabs-CrrG1hvh.cjs +0 -1
- package/dist/Tabs-D3pdOieX.js +0 -180
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-Cy2_8mLH.cjs`),n=require(`./ChartLegend-DGgW0yjG.cjs`),r=require(`./scales-4WxjhxBm.cjs`),i=require(`./useChartSize-C-BIN0vc.cjs`);let a=require(`vue`);var o=[`width`,`height`,`role`,`aria-label`],s={key:0},c=[`x1`,`x2`,`y1`,`y2`],l={class:`nb-chart__axis`},u=[`x`,`y`,`text-anchor`,`dominant-baseline`],d={class:`nb-chart__axis`},f=[`x`,`y`,`text-anchor`,`dominant-baseline`],p=[`x1`,`x2`,`y1`,`y2`],m=[`fill`,`tabindex`,`role`,`aria-label`,`onKeydown`],h={class:`nb-chart__hover-layer`},g=[`onMouseenter`,`onMousemove`,`onClick`],_=(0,a.defineComponent)({__name:`BarChart`,props:{series:{default:()=>[]},orientation:{default:`vertical`},stacked:{type:Boolean,default:!1},title:{default:void 0},subtitle:{default:void 0},height:{default:280},showLegend:{type:Boolean,default:!0},showTooltip:{type:Boolean,default:!0},showGrid:{type:Boolean,default:!0},colors:{default:()=>t.n}},emits:[`select`],setup(e,{emit:_}){let v=e,y=_,b=(0,a.ref)(null),x=i.t(b,{width:480,height:240}),S=(0,a.computed)(()=>v.orientation===`horizontal`),C=(0,a.computed)(()=>v.series.map((e,n)=>({name:e.name,data:e.data,color:e.color??t.i(n,v.colors)}))),w=(0,a.computed)(()=>(v.series[0]?.data??[]).map(e=>e.x)),T=(e,t)=>C.value[t]?.data[e]?.y??0,E=(e,t)=>{let n=T(e,t);if(!v.stacked)return[0,n];let r=0;for(let i=0;i<t;i+=1){let t=T(e,i);t>=0==n>=0&&(r+=t)}return[r,r+n]},D=(0,a.computed)(()=>{let e=[];return w.value.forEach((t,n)=>{C.value.forEach((t,r)=>{e.push(E(n,r)[1])})}),e.length?r.i(Math.min(0,...e),Math.max(0,...e),.05):[0,1]}),O=(0,a.computed)(()=>{if(!S.value)return{top:12,right:16,bottom:28,left:44};let e=w.value.reduce((e,t)=>Math.max(e,String(t).length),0),t=Math.max(44,Math.round(x.value.width*.4));return{top:12,right:16,bottom:28,left:Math.min(Math.max(44,Math.ceil(e*6.2)+12),t)}}),k=(0,a.computed)(()=>({x0:O.value.left,x1:Math.max(O.value.left,x.value.width-O.value.right),y0:O.value.top,y1:Math.max(O.value.top,x.value.height-O.value.bottom)})),A=(0,a.computed)(()=>r.t(w.value.map(e=>String(e)),S.value?[k.value.y0,k.value.y1]:[k.value.x0,k.value.x1],.2)),j=(0,a.computed)(()=>r.r(D.value,S.value?[k.value.x0,k.value.x1]:[k.value.y1,k.value.y0])),M=(0,a.computed)(()=>j.value.ticks(5)),N=e=>A.value(String(w.value[e])),P=e=>N(e)+A.value.bandwidth/2,F=(0,a.computed)(()=>{let e=C.value.length||1;return v.stacked?A.value.bandwidth:A.value.bandwidth/e}),I=(e,t)=>{let[n,r]=E(e,t),i=j.value(n),a=j.value(r),o=Math.max(0,F.value-2),s=N(e)+(v.stacked?0:t*F.value),c=Math.max(0,Math.abs(a-i));return S.value?{x:Math.min(i,a),y:s,width:c,height:o}:{x:s,y:Math.min(i,a),width:o,height:c}},L=e=>{let t=N(e),n=A.value.bandwidth;return S.value?{x:k.value.x0,y:t,width:Math.max(0,k.value.x1-k.value.x0),height:n}:{x:t,y:k.value.y0,width:n,height:Math.max(0,k.value.y1-k.value.y0)}},R=e=>Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),z=(0,a.getCurrentInstance)(),B=()=>!!z?.vnode.props?.onSelect,V=(e,t)=>{let n=C.value[t],r=R(T(e,t));return C.value.length>1?`${w.value[e]}, ${n?.name}: ${r}`:`${w.value[e]}: ${r}`},H=(e,t)=>{let n=C.value[t],r=n?.data[e];return{kind:`series`,x:r?.x??w.value[e],y:r?.y??0,seriesName:n?.name??``,seriesIndex:t,index:e,point:r??{x:w.value[e],y:0}}},U=e=>{let t=e.currentTarget.ownerSVGElement;if(!t)return null;let n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}},W=(e,t)=>{let n=C.value.length;if(n<=1)return 0;let r=U(e);if(!r)return 0;if(v.stacked){let e=S.value?r.x:r.y;for(let r=0;r<n;r+=1){let[n,i]=E(t,r),a=j.value(n),o=j.value(i);if(e>=Math.min(a,o)&&e<=Math.max(a,o))return r}return n-1}let i=(S.value?r.y:r.x)-N(t),a=Math.floor(i/(F.value||1));return Math.min(Math.max(a,0),n-1)},G=(e,t)=>{B()&&y(`select`,H(t,W(e,t)))},K=(e,t,n)=>{B()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),y(`select`,H(t,n))))},q=(0,a.ref)(null),J=(0,a.ref)({x:0,y:0}),Y=(e,t)=>{let n=U(e);n&&(J.value={x:n.x+12,y:n.y+12},q.value=t)},X=(0,a.computed)(()=>q.value===null?[]:C.value.map(e=>({label:e.name,value:R(e.data[q.value]?.y??0),color:e.color})));return(r,i)=>((0,a.openBlock)(),(0,a.createBlock)(t.u,{title:e.title,subtitle:e.subtitle,height:e.height,"show-legend":e.showLegend&&C.value.length>0},{legend:(0,a.withCtx)(()=>[(0,a.createVNode)(n.t,{items:C.value.map(e=>({label:e.name,color:e.color}))},null,8,[`items`])]),default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{ref_key:`root`,ref:b,class:`nb-bar-chart`},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{width:(0,a.unref)(x).width,height:(0,a.unref)(x).height,class:(0,a.normalizeClass)([`nb-chart__svg`,{"nb-chart__svg--selectable":B()}]),role:B()?`group`:`img`,"aria-label":e.title||`Bar chart`,onMouseleave:i[0]||=e=>q.value=null},[e.showGrid&&(0,a.unref)(x).width>0?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,s,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(M.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:`grid-${e}`,class:`nb-chart__gridline`,x1:S.value?j.value(e):k.value.x0,x2:S.value?j.value(e):k.value.x1,y1:S.value?k.value.y0:j.value(e),y2:S.value?k.value.y1:j.value(e)},null,8,c))),128))])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`g`,l,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(M.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`vt-${e}`,x:S.value?j.value(e):k.value.x0-6,y:S.value?k.value.y1+14:j.value(e),"text-anchor":S.value?`middle`:`end`,"dominant-baseline":S.value?`auto`:`middle`},(0,a.toDisplayString)(R(e)),9,u))),128))]),(0,a.createElementVNode)(`g`,d,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`ct-${t}`,x:S.value?k.value.x0-6:P(t),y:S.value?P(t):k.value.y1+14,"text-anchor":S.value?`end`:`middle`,"dominant-baseline":S.value?`middle`:`auto`},(0,a.toDisplayString)(e),9,f))),128))]),(0,a.createElementVNode)(`line`,{class:`nb-chart__axis-line`,x1:S.value?j.value(0):k.value.x0,x2:S.value?j.value(0):k.value.x1,y1:S.value?k.value.y0:j.value(0),y2:S.value?k.value.y1:j.value(0)},null,8,p),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`g`,{key:`g-${t}`},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(C.value,(e,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`${t}-${n}`,class:[`nb-chart__bar`,{"is-dim":q.value!==null&&q.value!==t}]},{ref_for:!0},I(t,n),{fill:e.color,tabindex:B()?0:void 0,role:B()?`button`:void 0,"aria-label":B()?V(t,n):void 0,onKeydown:e=>K(e,t,n)}),null,16,m))),128))]))),128)),(0,a.createElementVNode)(`g`,h,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`hover-${t}`},{ref_for:!0},L(t),{fill:`transparent`,onMouseenter:e=>q.value=t,onMousemove:e=>Y(e,t),onClick:e=>G(e,t)}),null,16,g))),128))])],42,o)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&q.value!==null,x:J.value.x,y:J.value.y,title:q.value===null?``:String(w.value[q.value]),rows:X.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),v=e.t(_,[[`__scopeId`,`data-v-6e97c73e`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Icon-C8R_r_In.cjs`),i=require(`./composables/useSurfaceLayer.composable.cjs`),a=require(`./composables/usePhoneLayout.composable.cjs`),o=require(`./Button-C0UUTgEB.cjs`),s=require(`./Grid-DiCxrPaO.cjs`),c=require(`./Checkbox-CZVNZ2pn.cjs`);let l=require(`vue`),u=require(`@nubisco/ui/icons/arrows-down-up`);u=e.n(u);let d=require(`@nubisco/ui/icons/arrow-up`);d=e.n(d);let f=require(`@nubisco/ui/icons/arrow-down`);f=e.n(f);var p={key:0,class:`nb-data-table__toolbar`},m=[`inert`,`aria-hidden`],h={key:0},g={key:0,class:`nb-data-table__title`},_={key:1,class:`nb-data-table__description`},v=[`inert`,`aria-hidden`],y={key:1,class:`nb-data-table__batch`,role:`region`,"aria-label":`Table batch actions`},ee={class:`nb-data-table__batch-count`},te={class:`nb-data-table__batch-actions`},ne={class:`nb-data-table__scroll`},re=[`role`,`aria-label`,`aria-busy`],ie={key:0,class:`nb-data-table__col-select`},ae={key:1,class:`nb-data-table__col-actions`},oe=[`role`],se=[`role`],ce={key:0,scope:`col`,class:`nb-data-table__th nb-data-table__select-cell`},le=[`aria-sort`],ue=[`onClick`],de={class:`nb-data-table__th-label`},fe={key:1,class:`nb-data-table__th-label`},pe={key:1,scope:`col`,class:`nb-data-table__th nb-data-table__actions-cell`},me=[`role`],he={key:0,class:`nb-data-table__td`},ge={key:1,class:`nb-data-table__td`},_e={key:1,class:`nb-data-table__state-row`},b=[`colspan`],x={key:2,class:`nb-data-table__state-row`},S=[`colspan`],C=[`role`,`aria-selected`,`onClick`],w=[`checked`,`aria-label`,`onChange`],T=[`role`,`data-label`],E={key:1,class:`nb-data-table__footer`},D=(0,l.defineComponent)({__name:`DataTable`,props:{columns:{},rows:{},rowKey:{},size:{default:n.r.Medium},sortState:{default:null},selectable:{default:`none`},selected:{default:()=>[]},loading:{type:Boolean,default:!1},skeletonRows:{default:5},error:{default:void 0},emptyMessage:{default:void 0},stickyHeader:{type:Boolean,default:!0},zebra:{type:Boolean,default:!1},fill:{type:Boolean,default:!1},title:{default:void 0},description:{default:void 0},ariaLabel:{default:void 0},stackOnPhone:{type:Boolean,default:!1}},emits:[`sort`,`update:selected`,`row-click`],setup(e,{emit:t}){let n=e,{layerProps:D}=i.useSurfaceLayer(),O=t,k=(0,l.useSlots)(),A=`nb-data-table-select-${(0,l.useId)()}`,j=(0,l.computed)(()=>n.size),M=(0,l.computed)(()=>n.columns.filter(e=>!e.hidden)),N=(0,l.computed)(()=>n.selectable!==`none`),P=(0,l.computed)(()=>!!k[`row-actions`]),F=(0,l.computed)(()=>M.value.length+(N.value?1:0)+(P.value?1:0)),{phone:I}=a.usePhoneLayout(),L=(0,l.computed)(()=>n.stackOnPhone&&I.value),ve=(0,l.computed)(()=>(M.value.find(e=>e.primary)??M.value.find(e=>!e.phoneHidden&&!e.phoneMeta))?.key);function ye(e){return e.phoneHidden?`nb-data-table__td--phone-hidden`:e.key===ve.value?`nb-data-table__td--primary`:e.phoneMeta?`nb-data-table__td--meta`:`nb-data-table__td--field`}let be=(0,l.computed)(()=>!n.loading&&!n.error&&n.rows.length>0&&(n.selectable===`multiple`||M.value.some(e=>e.sortable&&!e.phoneHidden)));function xe(e){if(e.width!=null)return{width:typeof e.width==`number`?`${e.width}px`:e.width}}function R(e,t){return t[e.key]}function Se(e){return e==null?``:String(e)}let z=e=>e.column.render?.(e.row,R(e.column,e.row),e.rowIndex)??null;z.props=[`column`,`row`,`rowIndex`];function B(e){let t=n.rowKey;return typeof t==`function`?t(e):e[t]}let V=(0,l.computed)(()=>new Set(n.selected)),Ce=(0,l.computed)(()=>n.selected),H=(0,l.computed)(()=>n.selected.length);function U(e){return V.value.has(B(e))}let W=(0,l.computed)(()=>n.rows.map(e=>B(e))),G=(0,l.computed)(()=>W.value.length>0&&W.value.every(e=>V.value.has(e))),we=(0,l.computed)(()=>!G.value&&W.value.some(e=>V.value.has(e))),K=(0,l.ref)(null),q=!1;function J(e){q=e.shiftKey}(0,l.watch)(W,()=>{K.value=null});function Te(e,t){let r=B(e),i=new Set(n.selected),a=!i.has(r),o=K.value,s=e=>{a?i.add(e):i.delete(e)};if(q&&o!==null&&o!==t){let e=Math.min(o,t),r=Math.max(o,t);for(let t=e;t<=r;t++){let e=n.rows[t];e&&s(B(e))}}else s(r),K.value=t;q=!1,O(`update:selected`,[...i])}function Ee(e){O(`update:selected`,[B(e)])}function De(){let e=new Set(n.selected);G.value?W.value.forEach(t=>e.delete(t)):W.value.forEach(t=>e.add(t)),O(`update:selected`,[...e])}function Y(){O(`update:selected`,[])}let X=(0,l.computed)(()=>n.selectable!==`none`&&!!k[`batch-actions`]),Z=(0,l.computed)(()=>X.value&&H.value>0),Oe=(0,l.computed)(()=>!!n.title||!!n.description||!!k.toolbar||!!k.search||!!k[`toolbar-actions`]),ke=(0,l.computed)(()=>Oe.value||X.value);function Q(e){return!!n.sortState&&n.sortState.key===e.key&&n.sortState.direction!==`none`}function Ae(e){return Q(e)?n.sortState.direction===`asc`?`ascending`:`descending`:`none`}function $(e){return Q(e)?n.sortState.direction===`asc`?d:f:u}function je(e){return e===`asc`?`desc`:e===`desc`?`none`:`asc`}function Me(e){let t=n.sortState&&n.sortState.key===e.key?n.sortState.direction:`none`;O(`sort`,{key:e.key,direction:je(t)})}let Ne=(0,l.getCurrentInstance)(),Pe=(0,l.computed)(()=>!!Ne?.vnode.props?.onRowClick);function Fe(e,t){O(`row-click`,e,t)}return(t,n)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,(0,l.mergeProps)({class:[`nb-data-table`,`nb-data-table--${e.size}`,{"nb-data-table--zebra":e.zebra},{"nb-data-table--sticky":e.stickyHeader},{"nb-data-table--fill":e.fill},{"nb-data-table--stacked":L.value},{"nb-data-table--stacked-headless":L.value&&!be.value}]},(0,l.unref)(D)),[ke.value?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,p,[(0,l.createElementVNode)(`div`,{class:`nb-data-table__toolbar-heading`,inert:Z.value||void 0,"aria-hidden":Z.value||void 0},[(0,l.renderSlot)(t.$slots,`toolbar`,{selectedCount:H.value},()=>[e.title||e.description?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,h,[e.title?((0,l.openBlock)(),(0,l.createElementBlock)(`h2`,g,(0,l.toDisplayString)(e.title),1)):(0,l.createCommentVNode)(``,!0),e.description?((0,l.openBlock)(),(0,l.createElementBlock)(`p`,_,(0,l.toDisplayString)(e.description),1)):(0,l.createCommentVNode)(``,!0)])):(0,l.createCommentVNode)(``,!0)],!0)],8,m),t.$slots.search||t.$slots[`toolbar-actions`]?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,{key:0,class:`nb-data-table__toolbar-tools`,inert:Z.value||void 0,"aria-hidden":Z.value||void 0},[(0,l.renderSlot)(t.$slots,`search`,{},void 0,!0),(0,l.renderSlot)(t.$slots,`toolbar-actions`,{},void 0,!0)],8,v)):(0,l.createCommentVNode)(``,!0),Z.value?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,y,[(0,l.createElementVNode)(`span`,ee,(0,l.toDisplayString)(H.value)+` selected `,1),(0,l.createElementVNode)(`div`,te,[(0,l.renderSlot)(t.$slots,`batch-actions`,{selectedKeys:Ce.value,clear:Y},void 0,!0)]),(0,l.createVNode)(o.t,{class:`nb-data-table__batch-cancel`,variant:`ghost`,size:j.value,onClick:Y},{default:(0,l.withCtx)(()=>[...n[2]||=[(0,l.createTextVNode)(` Cancel `,-1)]]),_:1},8,[`size`])])):(0,l.createCommentVNode)(``,!0)])):(0,l.createCommentVNode)(``,!0),(0,l.createElementVNode)(`div`,ne,[(0,l.createElementVNode)(`table`,{class:`nb-data-table__table`,role:L.value?`table`:void 0,"aria-label":e.ariaLabel||e.title||void 0,"aria-busy":e.loading||void 0},[(0,l.createElementVNode)(`colgroup`,null,[N.value?((0,l.openBlock)(),(0,l.createElementBlock)(`col`,ie)):(0,l.createCommentVNode)(``,!0),((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(M.value,e=>((0,l.openBlock)(),(0,l.createElementBlock)(`col`,{key:`col-${e.key}`,style:(0,l.normalizeStyle)(xe(e))},null,4))),128)),P.value?((0,l.openBlock)(),(0,l.createElementBlock)(`col`,ae)):(0,l.createCommentVNode)(``,!0)]),(0,l.createElementVNode)(`thead`,{class:`nb-data-table__head`,role:L.value?`rowgroup`:void 0},[(0,l.createElementVNode)(`tr`,{role:L.value?`row`:void 0},[N.value?((0,l.openBlock)(),(0,l.createElementBlock)(`th`,ce,[e.selectable===`multiple`?((0,l.openBlock)(),(0,l.createBlock)(c.t,{key:0,"model-value":G.value,indeterminate:we.value,"aria-label":`Select all rows`,"onUpdate:modelValue":De},null,8,[`model-value`,`indeterminate`])):(0,l.createCommentVNode)(``,!0)])):(0,l.createCommentVNode)(``,!0),((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(M.value,e=>((0,l.openBlock)(),(0,l.createElementBlock)(`th`,{key:`th-${e.key}`,scope:`col`,class:(0,l.normalizeClass)([`nb-data-table__th`,`nb-data-table__th--${e.align||`left`}`,{"nb-data-table__th--sortable":e.sortable},{"nb-data-table__th--sorted":Q(e)},L.value&&e.phoneHidden&&`nb-data-table__th--phone-hidden`]),"aria-sort":e.sortable?Ae(e):void 0},[e.sortable?((0,l.openBlock)(),(0,l.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-data-table__sort`,onClick:t=>Me(e)},[(0,l.createElementVNode)(`span`,de,[(0,l.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,l.createTextVNode)((0,l.toDisplayString)(e.header),1)],!0)]),(0,l.createVNode)(r.t,{name:$(e),class:`nb-data-table__sort-icon`,"aria-hidden":`true`},null,8,[`name`])],8,ue)):((0,l.openBlock)(),(0,l.createElementBlock)(`span`,fe,[(0,l.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,l.createTextVNode)((0,l.toDisplayString)(e.header),1)],!0)]))],10,le))),128)),P.value?((0,l.openBlock)(),(0,l.createElementBlock)(`th`,pe,[...n[3]||=[(0,l.createElementVNode)(`span`,{class:`nb-sr-only`},`Row actions`,-1)]])):(0,l.createCommentVNode)(``,!0)],8,se)],8,oe),(0,l.createElementVNode)(`tbody`,{class:`nb-data-table__body`,role:L.value?`rowgroup`:void 0},[e.loading?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:0},(0,l.renderList)(e.skeletonRows,e=>((0,l.openBlock)(),(0,l.createElementBlock)(`tr`,{key:`skeleton-${e}`,class:`nb-data-table__row nb-data-table__row--skeleton`},[N.value?((0,l.openBlock)(),(0,l.createElementBlock)(`td`,he,[...n[4]||=[(0,l.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,l.createCommentVNode)(``,!0),((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(M.value,t=>((0,l.openBlock)(),(0,l.createElementBlock)(`td`,{key:`sk-${e}-${t.key}`,class:`nb-data-table__td`},[...n[5]||=[(0,l.createElementVNode)(`span`,{class:`nb-data-table__skeleton`},null,-1)]]))),128)),P.value?((0,l.openBlock)(),(0,l.createElementBlock)(`td`,ge,[...n[6]||=[(0,l.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,l.createCommentVNode)(``,!0)]))),128)):e.error?((0,l.openBlock)(),(0,l.createElementBlock)(`tr`,_e,[(0,l.createElementVNode)(`td`,{colspan:F.value,class:`nb-data-table__state nb-data-table__state--error`},[(0,l.renderSlot)(t.$slots,`error`,{error:e.error},()=>[(0,l.createVNode)(s.t,{is:`span`,align:`center`,justify:`center`,gap:`xs`,class:`nb-data-table__state-inner`},{default:(0,l.withCtx)(()=>[(0,l.createVNode)(r.t,{name:`warning-circle-fill`,"aria-hidden":`true`}),(0,l.createElementVNode)(`span`,null,(0,l.toDisplayString)(e.error),1)]),_:1})],!0)],8,b)])):e.rows.length?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:3},(0,l.renderList)(e.rows,(r,i)=>((0,l.openBlock)(),(0,l.createElementBlock)(`tr`,{key:B(r),class:(0,l.normalizeClass)([`nb-data-table__row`,{"nb-data-table__row--selected":U(r)},{"nb-data-table__row--clickable":Pe.value}]),role:L.value?`row`:void 0,"aria-selected":e.selectable===`none`?void 0:U(r),onClick:e=>Fe(r,i)},[N.value?((0,l.openBlock)(),(0,l.createElementBlock)(`td`,{key:0,class:`nb-data-table__td nb-data-table__select-cell`,onClick:n[0]||=(0,l.withModifiers)(()=>{},[`stop`]),onMousedown:J,onKeydown:J},[e.selectable===`multiple`?((0,l.openBlock)(),(0,l.createBlock)(c.t,{key:0,"model-value":U(r),"aria-label":`Select row ${i+1}`,"onUpdate:modelValue":e=>Te(r,i)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])):((0,l.openBlock)(),(0,l.createElementBlock)(`input`,{key:1,type:`radio`,class:`nb-data-table__radio`,name:A,checked:U(r),"aria-label":`Select row ${i+1}`,onChange:e=>Ee(r)},null,40,w))],32)):(0,l.createCommentVNode)(``,!0),((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(M.value,n=>((0,l.openBlock)(),(0,l.createElementBlock)(`td`,{key:`td-${B(r)}-${n.key}`,class:(0,l.normalizeClass)([`nb-data-table__td`,`nb-data-table__td--${n.align||`left`}`,n.cellClass,L.value&&ye(n)]),role:L.value?`cell`:void 0,"data-label":e.stackOnPhone?n.header:void 0},[(0,l.renderSlot)(t.$slots,`cell-${n.key}`,{row:r,value:R(n,r),column:n,rowIndex:i},()=>[n.render?((0,l.openBlock)(),(0,l.createBlock)(z,{key:0,column:n,row:r,"row-index":i},null,8,[`column`,`row`,`row-index`])):((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:1},[(0,l.createTextVNode)((0,l.toDisplayString)(Se(R(n,r))),1)],64))],!0)],10,T))),128)),P.value?((0,l.openBlock)(),(0,l.createElementBlock)(`td`,{key:1,class:`nb-data-table__td nb-data-table__actions-cell`,onClick:n[1]||=(0,l.withModifiers)(()=>{},[`stop`])},[(0,l.renderSlot)(t.$slots,`row-actions`,{row:r,rowIndex:i},void 0,!0)])):(0,l.createCommentVNode)(``,!0)],10,C))),128)):((0,l.openBlock)(),(0,l.createElementBlock)(`tr`,x,[(0,l.createElementVNode)(`td`,{colspan:F.value,class:`nb-data-table__state nb-data-table__state--empty`},[(0,l.renderSlot)(t.$slots,`empty`,{},()=>[(0,l.createElementVNode)(`span`,null,(0,l.toDisplayString)(e.emptyMessage||`No data to display`),1)],!0)],8,S)]))],8,me)],8,re)]),t.$slots.footer?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,E,[(0,l.renderSlot)(t.$slots,`footer`,{},void 0,!0)])):(0,l.createCommentVNode)(``,!0)],16))}}),O=t.t(D,[[`__scopeId`,`data-v-a4bea523`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return O}});
|
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
|
-
import { r as t } from "./Size.d-Bah6vMl3.js";
|
|
3
|
-
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
|
-
import { useSurfaceLayer as r } from "./composables/useSurfaceLayer.composable.mjs";
|
|
5
|
-
import { usePhoneLayout as i } from "./composables/usePhoneLayout.composable.mjs";
|
|
6
|
-
import { t as a } from "./Button-IcCXOoCT.js";
|
|
7
|
-
import { t as o } from "./Grid-iox-7xyH.js";
|
|
8
|
-
import { t as s } from "./Checkbox-CXlovpPs.js";
|
|
9
|
-
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, getCurrentInstance as ee, mergeProps as te, normalizeClass as _, normalizeStyle as ne, openBlock as v, ref as re, renderList as y, renderSlot as b, toDisplayString as x, unref as ie, useId as ae, useSlots as oe, watch as se, withCtx as S, withModifiers as C } from "vue";
|
|
10
|
-
import * as ce from "@nubisco/ui/icons/arrows-down-up";
|
|
11
|
-
import * as le from "@nubisco/ui/icons/arrow-up";
|
|
12
|
-
import * as ue from "@nubisco/ui/icons/arrow-down";
|
|
13
|
-
//#region src/components/DataTable.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var de = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "nb-data-table__toolbar"
|
|
17
|
-
}, fe = ["inert", "aria-hidden"], pe = { key: 0 }, me = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "nb-data-table__title"
|
|
20
|
-
}, he = {
|
|
21
|
-
key: 1,
|
|
22
|
-
class: "nb-data-table__description"
|
|
23
|
-
}, ge = ["inert", "aria-hidden"], _e = {
|
|
24
|
-
key: 1,
|
|
25
|
-
class: "nb-data-table__batch",
|
|
26
|
-
role: "region",
|
|
27
|
-
"aria-label": "Table batch actions"
|
|
28
|
-
}, ve = { class: "nb-data-table__batch-count" }, ye = { class: "nb-data-table__batch-actions" }, be = { class: "nb-data-table__scroll" }, xe = [
|
|
29
|
-
"role",
|
|
30
|
-
"aria-label",
|
|
31
|
-
"aria-busy"
|
|
32
|
-
], Se = {
|
|
33
|
-
key: 0,
|
|
34
|
-
class: "nb-data-table__col-select"
|
|
35
|
-
}, Ce = {
|
|
36
|
-
key: 1,
|
|
37
|
-
class: "nb-data-table__col-actions"
|
|
38
|
-
}, we = ["role"], w = ["role"], T = {
|
|
39
|
-
key: 0,
|
|
40
|
-
scope: "col",
|
|
41
|
-
class: "nb-data-table__th nb-data-table__select-cell"
|
|
42
|
-
}, E = ["aria-sort"], D = ["onClick"], O = { class: "nb-data-table__th-label" }, k = {
|
|
43
|
-
key: 1,
|
|
44
|
-
class: "nb-data-table__th-label"
|
|
45
|
-
}, Te = {
|
|
46
|
-
key: 1,
|
|
47
|
-
scope: "col",
|
|
48
|
-
class: "nb-data-table__th nb-data-table__actions-cell"
|
|
49
|
-
}, Ee = ["role"], De = {
|
|
50
|
-
key: 0,
|
|
51
|
-
class: "nb-data-table__td"
|
|
52
|
-
}, Oe = {
|
|
53
|
-
key: 1,
|
|
54
|
-
class: "nb-data-table__td"
|
|
55
|
-
}, ke = {
|
|
56
|
-
key: 1,
|
|
57
|
-
class: "nb-data-table__state-row"
|
|
58
|
-
}, Ae = ["colspan"], je = {
|
|
59
|
-
key: 2,
|
|
60
|
-
class: "nb-data-table__state-row"
|
|
61
|
-
}, Me = ["colspan"], Ne = [
|
|
62
|
-
"role",
|
|
63
|
-
"aria-selected",
|
|
64
|
-
"onClick"
|
|
65
|
-
], Pe = [
|
|
66
|
-
"checked",
|
|
67
|
-
"aria-label",
|
|
68
|
-
"onChange"
|
|
69
|
-
], Fe = ["role", "data-label"], Ie = {
|
|
70
|
-
key: 1,
|
|
71
|
-
class: "nb-data-table__footer"
|
|
72
|
-
}, A = /* @__PURE__ */ e(/* @__PURE__ */ g({
|
|
73
|
-
__name: "DataTable",
|
|
74
|
-
props: {
|
|
75
|
-
columns: {},
|
|
76
|
-
rows: {},
|
|
77
|
-
rowKey: {},
|
|
78
|
-
size: { default: t.Medium },
|
|
79
|
-
sortState: { default: null },
|
|
80
|
-
selectable: { default: "none" },
|
|
81
|
-
selected: { default: () => [] },
|
|
82
|
-
loading: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: !1
|
|
85
|
-
},
|
|
86
|
-
skeletonRows: { default: 5 },
|
|
87
|
-
error: { default: void 0 },
|
|
88
|
-
emptyMessage: { default: void 0 },
|
|
89
|
-
stickyHeader: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
default: !0
|
|
92
|
-
},
|
|
93
|
-
zebra: {
|
|
94
|
-
type: Boolean,
|
|
95
|
-
default: !1
|
|
96
|
-
},
|
|
97
|
-
fill: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
default: !1
|
|
100
|
-
},
|
|
101
|
-
title: { default: void 0 },
|
|
102
|
-
description: { default: void 0 },
|
|
103
|
-
ariaLabel: { default: void 0 },
|
|
104
|
-
stackOnPhone: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
default: !1
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
emits: [
|
|
110
|
-
"sort",
|
|
111
|
-
"update:selected",
|
|
112
|
-
"row-click"
|
|
113
|
-
],
|
|
114
|
-
setup(e, { emit: t }) {
|
|
115
|
-
let g = e, { layerProps: A } = r(), j = t, M = oe(), Le = `nb-data-table-select-${ae()}`, Re = l(() => g.size), N = l(() => g.columns.filter((e) => !e.hidden)), P = l(() => g.selectable !== "none"), F = l(() => !!M["row-actions"]), I = l(() => N.value.length + (P.value ? 1 : 0) + (F.value ? 1 : 0)), { phone: ze } = i(), L = l(() => g.stackOnPhone && ze.value), Be = l(() => (N.value.find((e) => e.primary) ?? N.value.find((e) => !e.phoneHidden && !e.phoneMeta))?.key);
|
|
116
|
-
function Ve(e) {
|
|
117
|
-
return e.phoneHidden ? "nb-data-table__td--phone-hidden" : e.key === Be.value ? "nb-data-table__td--primary" : e.phoneMeta ? "nb-data-table__td--meta" : "nb-data-table__td--field";
|
|
118
|
-
}
|
|
119
|
-
let He = l(() => !g.loading && !g.error && g.rows.length > 0 && (g.selectable === "multiple" || N.value.some((e) => e.sortable && !e.phoneHidden)));
|
|
120
|
-
function Ue(e) {
|
|
121
|
-
if (e.width != null) return { width: typeof e.width == "number" ? `${e.width}px` : e.width };
|
|
122
|
-
}
|
|
123
|
-
function R(e, t) {
|
|
124
|
-
return t[e.key];
|
|
125
|
-
}
|
|
126
|
-
function We(e) {
|
|
127
|
-
return e == null ? "" : String(e);
|
|
128
|
-
}
|
|
129
|
-
let z = (e) => e.column.render?.(e.row, R(e.column, e.row), e.rowIndex) ?? null;
|
|
130
|
-
z.props = [
|
|
131
|
-
"column",
|
|
132
|
-
"row",
|
|
133
|
-
"rowIndex"
|
|
134
|
-
];
|
|
135
|
-
function B(e) {
|
|
136
|
-
let t = g.rowKey;
|
|
137
|
-
return typeof t == "function" ? t(e) : e[t];
|
|
138
|
-
}
|
|
139
|
-
let V = l(() => new Set(g.selected)), Ge = l(() => g.selected), H = l(() => g.selected.length);
|
|
140
|
-
function U(e) {
|
|
141
|
-
return V.value.has(B(e));
|
|
142
|
-
}
|
|
143
|
-
let W = l(() => g.rows.map((e) => B(e))), G = l(() => W.value.length > 0 && W.value.every((e) => V.value.has(e))), Ke = l(() => !G.value && W.value.some((e) => V.value.has(e))), K = re(null), q = !1;
|
|
144
|
-
function J(e) {
|
|
145
|
-
q = e.shiftKey;
|
|
146
|
-
}
|
|
147
|
-
se(W, () => {
|
|
148
|
-
K.value = null;
|
|
149
|
-
});
|
|
150
|
-
function qe(e, t) {
|
|
151
|
-
let n = B(e), r = new Set(g.selected), i = !r.has(n), a = K.value, o = (e) => {
|
|
152
|
-
i ? r.add(e) : r.delete(e);
|
|
153
|
-
};
|
|
154
|
-
if (q && a !== null && a !== t) {
|
|
155
|
-
let e = Math.min(a, t), n = Math.max(a, t);
|
|
156
|
-
for (let t = e; t <= n; t++) {
|
|
157
|
-
let e = g.rows[t];
|
|
158
|
-
e && o(B(e));
|
|
159
|
-
}
|
|
160
|
-
} else o(n), K.value = t;
|
|
161
|
-
q = !1, j("update:selected", [...r]);
|
|
162
|
-
}
|
|
163
|
-
function Je(e) {
|
|
164
|
-
j("update:selected", [B(e)]);
|
|
165
|
-
}
|
|
166
|
-
function Ye() {
|
|
167
|
-
let e = new Set(g.selected);
|
|
168
|
-
G.value ? W.value.forEach((t) => e.delete(t)) : W.value.forEach((t) => e.add(t)), j("update:selected", [...e]);
|
|
169
|
-
}
|
|
170
|
-
function Y() {
|
|
171
|
-
j("update:selected", []);
|
|
172
|
-
}
|
|
173
|
-
let X = l(() => g.selectable !== "none" && !!M["batch-actions"]), Z = l(() => X.value && H.value > 0), Q = l(() => !!g.title || !!g.description || !!M.toolbar || !!M.search || !!M["toolbar-actions"]), Xe = l(() => Q.value || X.value);
|
|
174
|
-
function $(e) {
|
|
175
|
-
return !!g.sortState && g.sortState.key === e.key && g.sortState.direction !== "none";
|
|
176
|
-
}
|
|
177
|
-
function Ze(e) {
|
|
178
|
-
return $(e) ? g.sortState.direction === "asc" ? "ascending" : "descending" : "none";
|
|
179
|
-
}
|
|
180
|
-
function Qe(e) {
|
|
181
|
-
return $(e) ? g.sortState.direction === "asc" ? le : ue : ce;
|
|
182
|
-
}
|
|
183
|
-
function $e(e) {
|
|
184
|
-
return e === "asc" ? "desc" : e === "desc" ? "none" : "asc";
|
|
185
|
-
}
|
|
186
|
-
function et(e) {
|
|
187
|
-
let t = g.sortState && g.sortState.key === e.key ? g.sortState.direction : "none";
|
|
188
|
-
j("sort", {
|
|
189
|
-
key: e.key,
|
|
190
|
-
direction: $e(t)
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
let tt = ee(), nt = l(() => !!tt?.vnode.props?.onRowClick);
|
|
194
|
-
function rt(e, t) {
|
|
195
|
-
j("row-click", e, t);
|
|
196
|
-
}
|
|
197
|
-
return (t, r) => (v(), f("div", te({ class: [
|
|
198
|
-
"nb-data-table",
|
|
199
|
-
`nb-data-table--${e.size}`,
|
|
200
|
-
{ "nb-data-table--zebra": e.zebra },
|
|
201
|
-
{ "nb-data-table--sticky": e.stickyHeader },
|
|
202
|
-
{ "nb-data-table--fill": e.fill },
|
|
203
|
-
{ "nb-data-table--stacked": L.value },
|
|
204
|
-
{ "nb-data-table--stacked-headless": L.value && !He.value }
|
|
205
|
-
] }, ie(A)), [
|
|
206
|
-
Xe.value ? (v(), f("div", de, [
|
|
207
|
-
p("div", {
|
|
208
|
-
class: "nb-data-table__toolbar-heading",
|
|
209
|
-
inert: Z.value || void 0,
|
|
210
|
-
"aria-hidden": Z.value || void 0
|
|
211
|
-
}, [b(t.$slots, "toolbar", { selectedCount: H.value }, () => [e.title || e.description ? (v(), f("div", pe, [e.title ? (v(), f("h2", me, x(e.title), 1)) : d("", !0), e.description ? (v(), f("p", he, x(e.description), 1)) : d("", !0)])) : d("", !0)], !0)], 8, fe),
|
|
212
|
-
t.$slots.search || t.$slots["toolbar-actions"] ? (v(), f("div", {
|
|
213
|
-
key: 0,
|
|
214
|
-
class: "nb-data-table__toolbar-tools",
|
|
215
|
-
inert: Z.value || void 0,
|
|
216
|
-
"aria-hidden": Z.value || void 0
|
|
217
|
-
}, [b(t.$slots, "search", {}, void 0, !0), b(t.$slots, "toolbar-actions", {}, void 0, !0)], 8, ge)) : d("", !0),
|
|
218
|
-
Z.value ? (v(), f("div", _e, [
|
|
219
|
-
p("span", ve, x(H.value) + " selected ", 1),
|
|
220
|
-
p("div", ye, [b(t.$slots, "batch-actions", {
|
|
221
|
-
selectedKeys: Ge.value,
|
|
222
|
-
clear: Y
|
|
223
|
-
}, void 0, !0)]),
|
|
224
|
-
h(a, {
|
|
225
|
-
class: "nb-data-table__batch-cancel",
|
|
226
|
-
variant: "ghost",
|
|
227
|
-
size: Re.value,
|
|
228
|
-
onClick: Y
|
|
229
|
-
}, {
|
|
230
|
-
default: S(() => [...r[2] ||= [m(" Cancel ", -1)]]),
|
|
231
|
-
_: 1
|
|
232
|
-
}, 8, ["size"])
|
|
233
|
-
])) : d("", !0)
|
|
234
|
-
])) : d("", !0),
|
|
235
|
-
p("div", be, [p("table", {
|
|
236
|
-
class: "nb-data-table__table",
|
|
237
|
-
role: L.value ? "table" : void 0,
|
|
238
|
-
"aria-label": e.ariaLabel || e.title || void 0,
|
|
239
|
-
"aria-busy": e.loading || void 0
|
|
240
|
-
}, [
|
|
241
|
-
p("colgroup", null, [
|
|
242
|
-
P.value ? (v(), f("col", Se)) : d("", !0),
|
|
243
|
-
(v(!0), f(c, null, y(N.value, (e) => (v(), f("col", {
|
|
244
|
-
key: `col-${e.key}`,
|
|
245
|
-
style: ne(Ue(e))
|
|
246
|
-
}, null, 4))), 128)),
|
|
247
|
-
F.value ? (v(), f("col", Ce)) : d("", !0)
|
|
248
|
-
]),
|
|
249
|
-
p("thead", {
|
|
250
|
-
class: "nb-data-table__head",
|
|
251
|
-
role: L.value ? "rowgroup" : void 0
|
|
252
|
-
}, [p("tr", { role: L.value ? "row" : void 0 }, [
|
|
253
|
-
P.value ? (v(), f("th", T, [e.selectable === "multiple" ? (v(), u(s, {
|
|
254
|
-
key: 0,
|
|
255
|
-
"model-value": G.value,
|
|
256
|
-
indeterminate: Ke.value,
|
|
257
|
-
"aria-label": "Select all rows",
|
|
258
|
-
"onUpdate:modelValue": Ye
|
|
259
|
-
}, null, 8, ["model-value", "indeterminate"])) : d("", !0)])) : d("", !0),
|
|
260
|
-
(v(!0), f(c, null, y(N.value, (e) => (v(), f("th", {
|
|
261
|
-
key: `th-${e.key}`,
|
|
262
|
-
scope: "col",
|
|
263
|
-
class: _([
|
|
264
|
-
"nb-data-table__th",
|
|
265
|
-
`nb-data-table__th--${e.align || "left"}`,
|
|
266
|
-
{ "nb-data-table__th--sortable": e.sortable },
|
|
267
|
-
{ "nb-data-table__th--sorted": $(e) },
|
|
268
|
-
L.value && e.phoneHidden && "nb-data-table__th--phone-hidden"
|
|
269
|
-
]),
|
|
270
|
-
"aria-sort": e.sortable ? Ze(e) : void 0
|
|
271
|
-
}, [e.sortable ? (v(), f("button", {
|
|
272
|
-
key: 0,
|
|
273
|
-
type: "button",
|
|
274
|
-
class: "nb-data-table__sort",
|
|
275
|
-
onClick: (t) => et(e)
|
|
276
|
-
}, [p("span", O, [b(t.$slots, `header-${e.key}`, { column: e }, () => [m(x(e.header), 1)], !0)]), h(n, {
|
|
277
|
-
name: Qe(e),
|
|
278
|
-
class: "nb-data-table__sort-icon",
|
|
279
|
-
"aria-hidden": "true"
|
|
280
|
-
}, null, 8, ["name"])], 8, D)) : (v(), f("span", k, [b(t.$slots, `header-${e.key}`, { column: e }, () => [m(x(e.header), 1)], !0)]))], 10, E))), 128)),
|
|
281
|
-
F.value ? (v(), f("th", Te, [...r[3] ||= [p("span", { class: "nb-sr-only" }, "Row actions", -1)]])) : d("", !0)
|
|
282
|
-
], 8, w)], 8, we),
|
|
283
|
-
p("tbody", {
|
|
284
|
-
class: "nb-data-table__body",
|
|
285
|
-
role: L.value ? "rowgroup" : void 0
|
|
286
|
-
}, [e.loading ? (v(!0), f(c, { key: 0 }, y(e.skeletonRows, (e) => (v(), f("tr", {
|
|
287
|
-
key: `skeleton-${e}`,
|
|
288
|
-
class: "nb-data-table__row nb-data-table__row--skeleton"
|
|
289
|
-
}, [
|
|
290
|
-
P.value ? (v(), f("td", De, [...r[4] ||= [p("span", { class: "nb-data-table__skeleton nb-data-table__skeleton--box" }, null, -1)]])) : d("", !0),
|
|
291
|
-
(v(!0), f(c, null, y(N.value, (t) => (v(), f("td", {
|
|
292
|
-
key: `sk-${e}-${t.key}`,
|
|
293
|
-
class: "nb-data-table__td"
|
|
294
|
-
}, [...r[5] ||= [p("span", { class: "nb-data-table__skeleton" }, null, -1)]]))), 128)),
|
|
295
|
-
F.value ? (v(), f("td", Oe, [...r[6] ||= [p("span", { class: "nb-data-table__skeleton nb-data-table__skeleton--box" }, null, -1)]])) : d("", !0)
|
|
296
|
-
]))), 128)) : e.error ? (v(), f("tr", ke, [p("td", {
|
|
297
|
-
colspan: I.value,
|
|
298
|
-
class: "nb-data-table__state nb-data-table__state--error"
|
|
299
|
-
}, [b(t.$slots, "error", { error: e.error }, () => [h(o, {
|
|
300
|
-
is: "span",
|
|
301
|
-
align: "center",
|
|
302
|
-
justify: "center",
|
|
303
|
-
gap: "xs",
|
|
304
|
-
class: "nb-data-table__state-inner"
|
|
305
|
-
}, {
|
|
306
|
-
default: S(() => [h(n, {
|
|
307
|
-
name: "warning-circle-fill",
|
|
308
|
-
"aria-hidden": "true"
|
|
309
|
-
}), p("span", null, x(e.error), 1)]),
|
|
310
|
-
_: 1
|
|
311
|
-
})], !0)], 8, Ae)])) : e.rows.length ? (v(!0), f(c, { key: 3 }, y(e.rows, (n, i) => (v(), f("tr", {
|
|
312
|
-
key: B(n),
|
|
313
|
-
class: _([
|
|
314
|
-
"nb-data-table__row",
|
|
315
|
-
{ "nb-data-table__row--selected": U(n) },
|
|
316
|
-
{ "nb-data-table__row--clickable": nt.value }
|
|
317
|
-
]),
|
|
318
|
-
role: L.value ? "row" : void 0,
|
|
319
|
-
"aria-selected": e.selectable === "none" ? void 0 : U(n),
|
|
320
|
-
onClick: (e) => rt(n, i)
|
|
321
|
-
}, [
|
|
322
|
-
P.value ? (v(), f("td", {
|
|
323
|
-
key: 0,
|
|
324
|
-
class: "nb-data-table__td nb-data-table__select-cell",
|
|
325
|
-
onClick: r[0] ||= C(() => {}, ["stop"]),
|
|
326
|
-
onMousedown: J,
|
|
327
|
-
onKeydown: J
|
|
328
|
-
}, [e.selectable === "multiple" ? (v(), u(s, {
|
|
329
|
-
key: 0,
|
|
330
|
-
"model-value": U(n),
|
|
331
|
-
"aria-label": `Select row ${i + 1}`,
|
|
332
|
-
"onUpdate:modelValue": (e) => qe(n, i)
|
|
333
|
-
}, null, 8, [
|
|
334
|
-
"model-value",
|
|
335
|
-
"aria-label",
|
|
336
|
-
"onUpdate:modelValue"
|
|
337
|
-
])) : (v(), f("input", {
|
|
338
|
-
key: 1,
|
|
339
|
-
type: "radio",
|
|
340
|
-
class: "nb-data-table__radio",
|
|
341
|
-
name: Le,
|
|
342
|
-
checked: U(n),
|
|
343
|
-
"aria-label": `Select row ${i + 1}`,
|
|
344
|
-
onChange: (e) => Je(n)
|
|
345
|
-
}, null, 40, Pe))], 32)) : d("", !0),
|
|
346
|
-
(v(!0), f(c, null, y(N.value, (r) => (v(), f("td", {
|
|
347
|
-
key: `td-${B(n)}-${r.key}`,
|
|
348
|
-
class: _([
|
|
349
|
-
"nb-data-table__td",
|
|
350
|
-
`nb-data-table__td--${r.align || "left"}`,
|
|
351
|
-
r.cellClass,
|
|
352
|
-
L.value && Ve(r)
|
|
353
|
-
]),
|
|
354
|
-
role: L.value ? "cell" : void 0,
|
|
355
|
-
"data-label": e.stackOnPhone ? r.header : void 0
|
|
356
|
-
}, [b(t.$slots, `cell-${r.key}`, {
|
|
357
|
-
row: n,
|
|
358
|
-
value: R(r, n),
|
|
359
|
-
column: r,
|
|
360
|
-
rowIndex: i
|
|
361
|
-
}, () => [r.render ? (v(), u(z, {
|
|
362
|
-
key: 0,
|
|
363
|
-
column: r,
|
|
364
|
-
row: n,
|
|
365
|
-
"row-index": i
|
|
366
|
-
}, null, 8, [
|
|
367
|
-
"column",
|
|
368
|
-
"row",
|
|
369
|
-
"row-index"
|
|
370
|
-
])) : (v(), f(c, { key: 1 }, [m(x(We(R(r, n))), 1)], 64))], !0)], 10, Fe))), 128)),
|
|
371
|
-
F.value ? (v(), f("td", {
|
|
372
|
-
key: 1,
|
|
373
|
-
class: "nb-data-table__td nb-data-table__actions-cell",
|
|
374
|
-
onClick: r[1] ||= C(() => {}, ["stop"])
|
|
375
|
-
}, [b(t.$slots, "row-actions", {
|
|
376
|
-
row: n,
|
|
377
|
-
rowIndex: i
|
|
378
|
-
}, void 0, !0)])) : d("", !0)
|
|
379
|
-
], 10, Ne))), 128)) : (v(), f("tr", je, [p("td", {
|
|
380
|
-
colspan: I.value,
|
|
381
|
-
class: "nb-data-table__state nb-data-table__state--empty"
|
|
382
|
-
}, [b(t.$slots, "empty", {}, () => [p("span", null, x(e.emptyMessage || "No data to display"), 1)], !0)], 8, Me)]))], 8, Ee)
|
|
383
|
-
], 8, xe)]),
|
|
384
|
-
t.$slots.footer ? (v(), f("div", Ie, [b(t.$slots, "footer", {}, void 0, !0)])) : d("", !0)
|
|
385
|
-
], 16));
|
|
386
|
-
}
|
|
387
|
-
}), [["__scopeId", "data-v-a4bea523"]]);
|
|
388
|
-
//#endregion
|
|
389
|
-
export { A as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`),t=require(`./composables/useSurfaceLayer.composable.cjs`),n=require(`./composables/usePhoneLayout.composable.cjs`),r=require(`./Label-CZhQEyoi.cjs`),i=require(`./Message-C44ftsaT.cjs`),a=require(`./Grid-DiCxrPaO.cjs`),o=require(`./composables/useMenuSurface.composable.cjs`),s=require(`./composables/useVisualViewportVar.composable.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/caret-right`),u=require(`@nubisco/ui/icons/calendar`),d=require(`@nubisco/ui/icons/caret-double-left`),ee=require(`@nubisco/ui/icons/caret-left`),te=require(`@nubisco/ui/icons/caret-double-right`);var ne={class:`nb-date-picker__col`},re=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`aria-invalid`,`aria-describedby`],ie=[`disabled`,`aria-label`],ae={key:0,class:`nb-date-picker__col`},oe=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`aria-invalid`,`aria-describedby`],se=[`disabled`,`aria-label`],ce={key:0,class:`nb-date-picker__inner-header`},le=[`for`],ue={key:0,class:`nb-date-picker__asterisk`,"aria-hidden":`true`},de={class:`nb-date-picker__fluid-row`},fe=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`aria-invalid`],pe=[`disabled`,`aria-label`],me={key:0,class:`nb-date-picker__inner-header`},he=[`for`],ge={key:0,class:`nb-date-picker__asterisk`,"aria-hidden":`true`},_e={class:`nb-date-picker__fluid-row`},ve=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`aria-invalid`],ye=[`disabled`,`aria-label`],be=[`aria-label`],xe={class:`nb-date-picker__cal-header`},Se=[`id`],Ce=[`aria-labelledby`],we={class:`nb-date-picker__cal-weekdays`},Te=[`abbr`],Ee=[`aria-selected`,`aria-disabled`],De=[`tabindex`,`disabled`,`aria-label`,`data-date`,`onClick`],f=(0,c.defineComponent)({inheritAttrs:!1,__name:`DatePicker`,props:{modelValue:{default:null},type:{default:`single`},endValue:{default:null},min:{default:void 0},max:{default:void 0},weekStart:{default:1},locale:{default:void 0},endPlaceholder:{default:``},endLabel:{default:``},endError:{default:``},endWarning:{default:``},disabledDates:{type:[Array,Function],default:void 0},readonly:{type:Boolean,default:!1},placeholder:{default:``},name:{default:``},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},id:{default:void 0},label:{default:``},error:{default:``},warning:{default:``},helper:{default:``},variant:{default:`default`},size:{default:`md`}},emits:[`update:modelValue`,`update:endValue`,`change`],setup(f,{expose:Oe,emit:ke}){let p=f,{layerProps:Ae}=t.useSurfaceLayer({overlay:!0}),m=ke,je=`nb-date-picker-${(0,c.useId)()}`,h=(0,c.computed)(()=>p.id??je),g=(0,c.computed)(()=>`${h.value}-end`),_=(0,c.computed)(()=>`${h.value}-helper`),Me=(0,c.computed)(()=>`${h.value}-message`),v=(0,c.computed)(()=>`${h.value}-end-message`),Ne=(0,c.computed)(()=>`${h.value}-cal-title`),y=(0,c.ref)(null),Pe=(0,c.computed)(()=>y.value!==null),b=(0,c.ref)(!1),x=(0,c.ref)($(new Date)),S=(0,c.ref)(null),C=(0,c.ref)(null),w=(0,c.ref)(null),T=(0,c.ref)(null);o.useMenuSurface(T);let{phone:E}=n.usePhoneLayout(),Fe=(0,c.ref)(null);s.useVisualViewportVar(()=>b.value);let Ie=(0,c.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:`9999`}),D=(0,c.ref)(`start`),O=(0,c.computed)(()=>p.locale||navigator.language||`pt-PT`),k=(0,c.computed)(()=>new Intl.DateTimeFormat(O.value).formatToParts(new Date(2e3,0,15)).map(e=>e.type===`day`?`dd`:e.type===`month`?`mm`:e.type===`year`?`yyyy`:e.value).join(``));function A(e){if(!e)return``;let t=new Date(e+`T00:00:00`);return isNaN(t.getTime())?e:t.toLocaleDateString(O.value)}function Le(e){return new Date(e+`T00:00:00`).toLocaleDateString(O.value,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`})}let Re=(0,c.computed)(()=>A(p.modelValue??null)),j=(0,c.computed)(()=>A(p.endValue??null)),M=(0,c.computed)(()=>p.error?{variant:`error`,text:p.error}:p.warning?{variant:`warning`,text:p.warning}:null),N=(0,c.computed)(()=>p.type===`range`?p.endError?{variant:`error`,text:p.endError}:p.endWarning?{variant:`warning`,text:p.endWarning}:null:null),P=(0,c.computed)(()=>M.value?M.value:p.helper?{variant:`helper`,text:p.helper}:null),ze=(0,c.computed)(()=>{if(p.variant===`default`)return M.value?Me.value:p.helper?_.value:void 0}),Be=(0,c.computed)(()=>{if(p.variant===`default`)return N.value?v.value:p.helper?_.value:void 0}),F=(0,c.computed)(()=>p.type===`range`&&!!p.endLabel),Ve=(0,c.computed)(()=>p.endLabel||p.endPlaceholder);function I(e){return p.min!=null&&e<p.min||p.max!=null&&e>p.max?!0:p.disabledDates?typeof p.disabledDates==`function`?p.disabledDates(e):p.disabledDates.includes(e):!1}function He(e){let t=e.trim();if(!t)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){let e=new Date(t+`T00:00:00`);return isNaN(e.getTime())?null:t}let n=new Date(t);return isNaN(n.getTime())?null:$(n)}function Ue(e){let t=e.target.value,n=He(t);n&&I(n)||(n||t===``)&&(m(`update:modelValue`,n),m(`change`,n))}function We(e){let t=e.target.value,n=He(t);n&&I(n)||(n||t===``)&&m(`update:endValue`,n)}function L(e){y.value=e.target===w.value?`end`:`start`,p.type!==`simple`&&!p.readonly&&(D.value=y.value,b.value?B():V())}function R(){y.value=null}function z(e){if(!(p.type===`simple`||p.readonly))switch(e.key){case`Escape`:b.value&&(H(),e.preventDefault());break;case`ArrowDown`:e.preventDefault(),b.value||V(),(0,c.nextTick)(W);break;case`Enter`:b.value||(e.preventDefault(),V(),(0,c.nextTick)(W));break}}function B(){let e=S.value?.querySelectorAll(`.nb-date-picker__input-wrapper`);if(!e?.length)return;let t=(D.value===`end`&&e.length>1?e[1]:e[0]).getBoundingClientRect();Ie.value={position:`fixed`,top:`${t.bottom+4}px`,left:`${t.left}px`,zIndex:`9999`}}function V(){if(p.disabled||p.readonly||p.type===`simple`||b.value)return;b.value=!0;let e=D.value===`end`&&p.endValue?p.endValue:p.modelValue,t=e?new Date(e+`T00:00:00`):new Date;X.value=t.getFullYear(),Z.value=t.getMonth(),x.value=e||$(new Date),B()}function H(){b.value&&(b.value=!1,(0,c.nextTick)(()=>{D.value===`end`&&w.value?w.value.focus():C.value?.focus()}))}function U(){b.value?H():(D.value=`start`,V(),(0,c.nextTick)(W))}function W(){(0,c.nextTick)(()=>{(T.value?.querySelector(`[data-date="${x.value}"]`))?.focus()})}function Ge(e){I(e)||(p.type===`range`?D.value===`start`?(m(`update:modelValue`,e),m(`change`,e),D.value=`end`,x.value=e,(0,c.nextTick)(()=>w.value?.focus())):(p.modelValue&&e<p.modelValue?(m(`update:endValue`,p.modelValue),m(`update:modelValue`,e),m(`change`,e)):m(`update:endValue`,e),H()):(m(`update:modelValue`,e),m(`change`,e),H()))}function Ke(e){let t=new Date(x.value+`T00:00:00`),n=!0;switch(e.key){case`ArrowRight`:G(t,1);break;case`ArrowLeft`:G(t,-1);break;case`ArrowDown`:G(t,7);break;case`ArrowUp`:G(t,-7);break;case`Home`:qe(t,`start`);break;case`End`:qe(t,`end`);break;case`PageUp`:e.shiftKey?K(t,-12):K(t,-1);break;case`PageDown`:e.shiftKey?K(t,12):K(t,1);break;case`Enter`:case` `:e.preventDefault(),Ge(x.value);return;case`Escape`:H();break;case`Tab`:H();return;default:n=!1}n&&e.preventDefault()}function G(e,t){let n=new Date(e);n.setDate(n.getDate()+t),q(n)}function qe(e,t){let n=e.getDay();p.weekStart===1&&(n=n===0?6:n-1);let r=t===`start`?-n:6-n,i=new Date(e);i.setDate(i.getDate()+r),q(i)}function K(e,t){let n=new Date(e);n.setMonth(n.getMonth()+t),n.getDate()!==e.getDate()&&n.setDate(0),q(n)}function q(e){let t=$(e);p.min!=null&&t<p.min||p.max!=null&&t>p.max||(x.value=t,X.value=e.getFullYear(),Z.value=e.getMonth(),W())}function J(e){let t=e.target,n=S.value?.contains(t)??!1,r=T.value?.contains(t)??!1,i=Fe.value?.contains(t)??!1;!n&&!r&&!i&&H()}function Y(){b.value&&B()}(0,c.watch)(b,e=>{e?(document.addEventListener(`mousedown`,J),window.addEventListener(`scroll`,Y,!0),window.addEventListener(`resize`,Y)):(document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y))}),(0,c.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y)});let X=(0,c.ref)(new Date().getFullYear()),Z=(0,c.ref)(new Date().getMonth());function Q(e){let t=X.value*12+Z.value+e;X.value=Math.floor(t/12),Z.value=(t%12+12)%12;let n=new Date(x.value+`T00:00:00`).getDate(),r=new Date(X.value,Z.value+1,0).getDate();x.value=$(new Date(X.value,Z.value,Math.min(n,r))),W()}let Je=()=>Q(-1),Ye=()=>Q(1),Xe=()=>Q(-12),Ze=()=>Q(12),Qe=(0,c.computed)(()=>{let e=new Date(X.value,Z.value,1).toLocaleDateString(O.value,{month:`long`,year:`numeric`});return e.charAt(0).toUpperCase()+e.slice(1)}),$e=(0,c.computed)(()=>{let e=[],t=new Date(2024,0,p.weekStart===0?7:1);for(let n=0;n<7;n++){let r=new Date(t);r.setDate(t.getDate()+n);let i=r.toLocaleDateString(O.value,{weekday:`narrow`}).toUpperCase(),a=r.toLocaleDateString(O.value,{weekday:`long`});e.push({narrow:i,full:a.charAt(0).toUpperCase()+a.slice(1)})}return e});function $(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}let et=(0,c.computed)(()=>$(new Date)),tt=(0,c.computed)(()=>{let e=X.value,t=Z.value,n=new Date(e,t,1),r=new Date(e,t+1,0),i=n.getDay();p.weekStart===1&&(i=i===0?6:i-1);let a=[],o=p.modelValue??null,s=p.endValue??null,c=o&&s?o<s?o:s:null,l=o&&s?o<s?s:o:null;function u(e,t){let n=$(e);return{key:n,date:n,day:e.getDate(),inMonth:t,isToday:n===et.value,isSelected:n===o||n===s,inRange:c!=null&&l!=null&&n>c&&n<l,isRangeStart:n===c&&l!=null,isRangeEnd:n===l&&c!=null,isDisabled:I(n)}}for(let n=i-1;n>=0;n--)a.push(u(new Date(e,t,-n),!1));for(let n=1;n<=r.getDate();n++)a.push(u(new Date(e,t,n),!0));let d=7-a.length%7;if(d<7)for(let n=1;n<=d;n++)a.push(u(new Date(e,t+1,n),!1));return a}),nt=(0,c.computed)(()=>{let e=[];for(let t=0;t<tt.value.length;t+=7)e.push(tt.value.slice(t,t+7));return e}),rt=(0,c.computed)(()=>[`nb-date-picker`,`nb-date-picker--${p.variant}`,`nb-date-picker--${p.size}`,`nb-date-picker--${p.type}`,{"nb-date-picker--focused":Pe.value,"nb-date-picker--open":b.value,"nb-date-picker--error":!!p.error||!!p.endError,"nb-date-picker--warning":!p.error&&!p.endError&&(!!p.warning||!!p.endWarning),"nb-date-picker--disabled":p.disabled,"nb-date-picker--readonly":p.readonly}]),it=(0,c.computed)(()=>({"nb-date-picker__input-wrapper--focused":y.value===`start`,"nb-date-picker__input-wrapper--error":!!p.error,"nb-date-picker__input-wrapper--warning":!p.error&&!!p.warning,"nb-date-picker__input-wrapper--disabled":p.disabled,"nb-date-picker__input-wrapper--readonly":p.readonly})),at=(0,c.computed)(()=>({"nb-date-picker__input-wrapper--focused":y.value===`end`,"nb-date-picker__input-wrapper--error":!!p.endError,"nb-date-picker__input-wrapper--warning":!p.endError&&!!p.endWarning,"nb-date-picker__input-wrapper--disabled":p.disabled,"nb-date-picker__input-wrapper--readonly":p.readonly}));return Oe({open:V,close:H,focus:()=>C.value?.focus()}),(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,null,[(0,c.createElementVNode)(`div`,{ref_key:`rootRef`,ref:S,class:(0,c.normalizeClass)(rt.value)},[f.variant===`default`?((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:0},[t.$slots.label?(0,c.renderSlot)(t.$slots,`label`,{key:0}):f.label&&!F.value?((0,c.openBlock)(),(0,c.createBlock)(r.t,{key:1,for:h.value,required:f.required,disabled:f.disabled},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(a.t,{dir:`row`,gap:f.type===`range`?`sm`:void 0,class:`nb-date-picker__fields`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`div`,ne,[F.value&&f.label?((0,c.openBlock)(),(0,c.createBlock)(r.t,{key:0,for:h.value,required:f.required,disabled:f.disabled},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`nb-date-picker__input-wrapper`,it.value])},[(0,c.createElementVNode)(`input`,(0,c.mergeProps)({id:h.value,ref_key:`inputRef`,ref:C},t.$attrs,{type:`text`,class:`nb-date-picker__field`,value:Re.value,placeholder:f.placeholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,name:f.name,"aria-invalid":f.error?!0:void 0,"aria-describedby":ze.value,onInput:n[0]||=e=>Ue(e),onFocus:L,onBlur:R,onKeydown:z}),null,16,re),f.type===`simple`?(0,c.createCommentVNode)(``,!0):((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.modelValue?`Change date, ${A(f.modelValue)}`:`Choose date`,onClick:U},[(0,c.createVNode)(e.t,{name:(0,c.unref)(u.regular),size:16},null,8,[`name`])],8,ie))],2)]),f.type===`range`?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ae,[F.value?((0,c.openBlock)(),(0,c.createBlock)(r.t,{key:0,for:g.value,required:f.required,disabled:f.disabled},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.endLabel),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`nb-date-picker__input-wrapper`,at.value])},[(0,c.createElementVNode)(`input`,{id:g.value,ref_key:`endInputRef`,ref:w,type:`text`,class:`nb-date-picker__field`,value:j.value,placeholder:f.endPlaceholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,"aria-invalid":f.endError?!0:void 0,"aria-describedby":Be.value,onInput:n[1]||=e=>We(e),onFocus:L,onBlur:R,onKeydown:z},null,40,oe),(0,c.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.endValue?`Change end date, ${A(f.endValue)}`:`Choose end date`,onClick:U},[(0,c.createVNode)(e.t,{name:(0,c.unref)(u.regular),size:16},null,8,[`name`])],8,se)],2)])):(0,c.createCommentVNode)(``,!0)]),_:1},8,[`gap`]),M.value?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:2,id:Me.value,variant:M.value.variant,class:`nb-date-picker__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(M.value.text),1)]),_:1},8,[`id`,`variant`])):(0,c.createCommentVNode)(``,!0),N.value?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:3,id:v.value,variant:N.value.variant,class:`nb-date-picker__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(N.value.text),1)]),_:1},8,[`id`,`variant`])):(0,c.createCommentVNode)(``,!0),!M.value&&!N.value&&f.helper?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:4,id:_.value,variant:`helper`,class:`nb-date-picker__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.helper),1)]),_:1},8,[`id`])):(0,c.createCommentVNode)(``,!0)],64)):f.variant===`fluid`?((0,c.openBlock)(),(0,c.createBlock)(a.t,{key:1,dir:`row`,gap:f.type===`range`?`sm`:void 0,class:`nb-date-picker__fields`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid`,it.value])},[f.label||t.$slots.label||P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ce,[t.$slots.label?(0,c.renderSlot)(t.$slots,`label`,{key:0}):((0,c.openBlock)(),(0,c.createElementBlock)(`label`,{key:1,for:h.value,class:`nb-date-picker__inner-label`},[(0,c.createTextVNode)((0,c.toDisplayString)(f.label)+` `,1),f.required?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ue,`*`)):(0,c.createCommentVNode)(``,!0)],8,le)),P.value?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:2,variant:P.value.variant,"icon-only":``,class:`nb-date-picker__inner-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(P.value.text),1)]),_:1},8,[`variant`])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,de,[(0,c.createElementVNode)(`input`,(0,c.mergeProps)({id:h.value,ref_key:`inputRef`,ref:C},t.$attrs,{type:`text`,class:`nb-date-picker__field`,value:Re.value,placeholder:f.placeholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,name:f.name,"aria-invalid":f.error?!0:void 0,onInput:n[2]||=e=>Ue(e),onFocus:L,onBlur:R,onKeydown:z}),null,16,fe),f.type===`simple`?(0,c.createCommentVNode)(``,!0):((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.modelValue?`Change date, ${A(f.modelValue)}`:`Choose date`,onClick:U},[(0,c.createVNode)(e.t,{name:(0,c.unref)(u.regular),size:16},null,8,[`name`])],8,pe))])],2),f.type===`range`?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:(0,c.normalizeClass)([`nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid`,at.value])},[Ve.value||N.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,me,[(0,c.createElementVNode)(`label`,{for:g.value,class:`nb-date-picker__inner-label`},[(0,c.createTextVNode)((0,c.toDisplayString)(Ve.value)+` `,1),f.required?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ge,`*`)):(0,c.createCommentVNode)(``,!0)],8,he),N.value?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:0,variant:N.value.variant,"icon-only":``,class:`nb-date-picker__inner-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(N.value.text),1)]),_:1},8,[`variant`])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,_e,[(0,c.createElementVNode)(`input`,{id:g.value,ref_key:`endInputRef`,ref:w,type:`text`,class:`nb-date-picker__field`,value:j.value,placeholder:f.endPlaceholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,"aria-invalid":f.endError?!0:void 0,onInput:n[3]||=e=>We(e),onFocus:L,onBlur:R,onKeydown:z},null,40,ve),(0,c.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.endValue?`Change end date, ${A(f.endValue)}`:`Choose end date`,onClick:U},[(0,c.createVNode)(e.t,{name:(0,c.unref)(u.regular),size:16},null,8,[`name`])],8,ye)])],2)):(0,c.createCommentVNode)(``,!0)]),_:3},8,[`gap`])):(0,c.createCommentVNode)(``,!0)],2),((0,c.openBlock)(),(0,c.createBlock)(c.Teleport,{to:`body`},[b.value&&(0,c.unref)(E)?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,ref_key:`scrimRef`,ref:Fe,class:`nb-date-picker__scrim`,"aria-hidden":`true`,onClick:H},null,512)):(0,c.createCommentVNode)(``,!0),b.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({key:1,ref_key:`calendarRef`,ref:T,role:`dialog`,"aria-modal":`true`,"aria-label":f.label?`${f.label} calendar`:`Date picker`,class:[`nb-date-picker__calendar`,{"nb-date-picker__calendar--sheet":(0,c.unref)(E)}]},(0,c.unref)(Ae),{style:(0,c.unref)(E)?void 0:Ie.value,onKeydown:Ke,onMousedown:n[4]||=(0,c.withModifiers)(()=>{},[`prevent`])}),[(0,c.createElementVNode)(`div`,xe,[(0,c.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Previous year`,onClick:Xe},[(0,c.createVNode)(e.t,{name:(0,c.unref)(d.regular),size:16},null,8,[`name`])]),(0,c.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Previous month`,onClick:Je},[(0,c.createVNode)(e.t,{name:(0,c.unref)(ee.regular),size:16},null,8,[`name`])]),(0,c.createElementVNode)(`span`,{id:Ne.value,class:`nb-date-picker__cal-title`,"aria-live":`polite`},(0,c.toDisplayString)(Qe.value),9,Se),(0,c.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Next month`,onClick:Ye},[(0,c.createVNode)(e.t,{name:(0,c.unref)(l.regular),size:16},null,8,[`name`])]),(0,c.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Next year`,onClick:Ze},[(0,c.createVNode)(e.t,{name:(0,c.unref)(te.regular),size:16},null,8,[`name`])])]),(0,c.createElementVNode)(`table`,{role:`grid`,"aria-labelledby":Ne.value,class:`nb-date-picker__cal-table`},[(0,c.createElementVNode)(`thead`,null,[(0,c.createElementVNode)(`tr`,we,[((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)($e.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`th`,{key:e.narrow,scope:`col`,class:`nb-date-picker__cal-weekday`,abbr:e.full},(0,c.toDisplayString)(e.narrow),9,Te))),128))])]),(0,c.createElementVNode)(`tbody`,null,[((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(nt.value,(e,t)=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:t},[((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(e,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:e.key,role:`gridcell`,"aria-selected":e.isSelected||void 0,"aria-disabled":e.isDisabled||void 0},[(0,c.createElementVNode)(`button`,{type:`button`,class:(0,c.normalizeClass)([`nb-date-picker__cal-day`,{"nb-date-picker__cal-day--outside":!e.inMonth,"nb-date-picker__cal-day--today":e.isToday,"nb-date-picker__cal-day--selected":e.isSelected,"nb-date-picker__cal-day--in-range":e.inRange,"nb-date-picker__cal-day--range-start":e.isRangeStart,"nb-date-picker__cal-day--range-end":e.isRangeEnd,"nb-date-picker__cal-day--disabled":e.isDisabled,"nb-date-picker__cal-day--focused":e.date===x.value}]),tabindex:e.date===x.value?0:-1,disabled:e.isDisabled,"aria-label":Le(e.date),"data-date":e.date,onClick:t=>Ge(e.date)},(0,c.toDisplayString)(e.day),11,De)],8,Ee))),128))]))),128))])],8,Ce)],16,be)):(0,c.createCommentVNode)(``,!0)]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-Cy2_8mLH.cjs`),n=require(`./ChartLegend-DGgW0yjG.cjs`),r=require(`./scales-4WxjhxBm.cjs`),i=require(`./useChartSize-C-BIN0vc.cjs`);let a=require(`vue`);var o=[`width`,`height`,`aria-label`],s={key:0},c=[`x1`,`x2`,`y1`,`y2`],l={class:`nb-chart__axis`},u=[`x`,`y`],d={class:`nb-chart__axis`},f=[`x`,`y`],p=[`x1`,`x2`,`y1`,`y2`],m=[`d`,`fill`],h=[`d`,`stroke`],g=[`cx`,`cy`,`r`,`fill`],_=[`x1`,`x2`,`y1`,`y2`],v=(0,a.defineComponent)({__name:`LineChart`,props:{series:{default:()=>[]},area:{type:Boolean,default:!1},points:{type:Boolean,default:!1},curve:{default:`smooth`},title:{default:void 0},subtitle:{default:void 0},height:{default:280},showLegend:{type:Boolean,default:!0},showTooltip:{type:Boolean,default:!0},showGrid:{type:Boolean,default:!0},colors:{default:()=>t.n}},setup(e){let v=e,y={top:12,right:16,bottom:28,left:44},b=(0,a.ref)(null),x=i.t(b,{width:480,height:240}),S=(0,a.computed)(()=>v.series.map((e,n)=>({name:e.name,data:e.data,color:e.color??t.i(n,v.colors)}))),C=(0,a.computed)(()=>(v.series[0]?.data??[]).map(e=>e.x)),w=(0,a.computed)(()=>{let e=v.series.flatMap(e=>e.data.map(e=>e.y));return e.length?r.i(Math.min(0,...e),Math.max(...e),.1):[0,1]}),T=(0,a.computed)(()=>r.r(w.value,[Math.max(y.top,x.value.height-y.bottom),y.top])),E=(0,a.computed)(()=>T.value.ticks(5)),D=(0,a.computed)(()=>Math.max(0,x.value.width-y.left-y.right)),O=e=>{let t=C.value.length;return t<=1?y.left+D.value/2:y.left+e/(t-1)*D.value},k=(0,a.computed)(()=>{let e=C.value,t=Math.max(1,Math.ceil(e.length/6)),n=[];for(let r=0;r<e.length;r+=t)n.push({index:r,value:e[r]});return e.length&&n[n.length-1].index!==e.length-1&&n.push({index:e.length-1,value:e[e.length-1]}),n}),A=e=>e.length?M(e.map((e,t)=>[O(t),T.value(e.y)]),v.curve):``,j=e=>{if(!e.length)return``;let t=e.map((e,t)=>[O(t),T.value(e.y)]),n=x.value.height-y.bottom;return`${M(t,v.curve)} L${t[t.length-1][0]},${n} L${t[0][0]},${n} Z`},M=(e,t)=>{if(!e.length)return``;if(e.length===1)return`M${e[0][0]},${e[0][1]}`;if(t===`linear`)return e.map((e,t)=>`${t===0?`M`:`L`}${e[0]},${e[1]}`).join(` `);if(t===`step`){let t=`M${e[0][0]},${e[0][1]}`;for(let n=1;n<e.length;n++){let[r,i]=e[n-1],[a,o]=e[n],s=(r+a)/2;t+=` L${s},${i} L${s},${o} L${a},${o}`}return t}let n=.2,r=`M${e[0][0]},${e[0][1]}`;for(let t=0;t<e.length-1;t++){let i=e[t-1]??e[t],a=e[t],o=e[t+1],s=e[t+2]??o,c=a[0]+(o[0]-i[0])*n,l=a[1]+(o[1]-i[1])*n,u=o[0]-(s[0]-a[0])*n,d=o[1]-(s[1]-a[1])*n;r+=` C${c},${l} ${u},${d} ${o[0]},${o[1]}`}return r},N=e=>Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(1),P=(0,a.ref)(null),F=(0,a.ref)({x:0,y:0}),I=e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=C.value.length;if(!r)return;let i=(n-y.left)/Math.max(1,D.value);P.value=Math.round(Math.min(1,Math.max(0,i))*(r-1)),F.value={x:e.clientX-t.left+12,y:e.clientY-t.top+12}},L=(0,a.computed)(()=>P.value===null?[]:S.value.map(e=>({label:e.name,value:N(e.data[P.value]?.y??0),color:e.color})));return(r,i)=>((0,a.openBlock)(),(0,a.createBlock)(t.u,{title:e.title,subtitle:e.subtitle,height:e.height,"show-legend":e.showLegend&&S.value.length>0},{legend:(0,a.withCtx)(()=>[(0,a.createVNode)(n.t,{items:S.value.map(e=>({label:e.name,color:e.color}))},null,8,[`items`])]),default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{ref_key:`root`,ref:b,class:`nb-line-chart`},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{width:(0,a.unref)(x).width,height:(0,a.unref)(x).height,class:`nb-chart__svg`,role:`img`,"aria-label":e.title||`Line chart`,onMouseleave:i[0]||=e=>P.value=null,onMousemove:I},[e.showGrid&&(0,a.unref)(x).width>0?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,s,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(E.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:`grid-${e}`,class:`nb-chart__gridline`,x1:y.left,x2:(0,a.unref)(x).width-y.right,y1:T.value(e),y2:T.value(e)},null,8,c))),128))])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`g`,l,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(E.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`yt-${e}`,x:y.left-6,y:T.value(e),"text-anchor":`end`,"dominant-baseline":`middle`},(0,a.toDisplayString)(N(e)),9,u))),128))]),(0,a.createElementVNode)(`g`,d,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(k.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`xt-${t}`,x:O(e.index),y:(0,a.unref)(x).height-y.bottom+14,"text-anchor":`middle`},(0,a.toDisplayString)(e.value),9,f))),128))]),(0,a.createElementVNode)(`line`,{class:`nb-chart__axis-line`,x1:y.left,x2:(0,a.unref)(x).width-y.right,y1:(0,a.unref)(x).height-y.bottom,y2:(0,a.unref)(x).height-y.bottom},null,8,p),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(S.value,(t,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`g`,{key:`s-${n}`},[e.area?((0,a.openBlock)(),(0,a.createElementBlock)(`path`,{key:0,class:`nb-chart__area`,d:j(t.data),fill:t.color,opacity:`0.18`},null,8,m)):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`path`,{class:`nb-chart__line`,d:A(t.data),stroke:t.color,fill:`none`,"stroke-width":`2`,"stroke-linejoin":`round`,"stroke-linecap":`round`},null,8,h),e.points?((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,{key:1},(0,a.renderList)(t.data,(e,r)=>((0,a.openBlock)(),(0,a.createElementBlock)(`circle`,{key:`p-${n}-${r}`,cx:O(r),cy:T.value(e.y),r:P.value===r?4:3,fill:t.color,class:`nb-chart__point`},null,8,g))),128)):(0,a.createCommentVNode)(``,!0)]))),128)),P.value===null?(0,a.createCommentVNode)(``,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:1,class:`nb-chart__hover-line`,x1:O(P.value),x2:O(P.value),y1:y.top,y2:(0,a.unref)(x).height-y.bottom},null,8,_))],40,o)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&P.value!==null,x:F.value.x,y:F.value.y,title:P.value===null?``:String(C.value[P.value]),rows:L.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),y=e.t(v,[[`__scopeId`,`data-v-728da300`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
|
package/dist/Menu-BALfMobG.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/usePhoneLayout.composable.cjs`);let t=require(`vue`);var n=(0,t.defineComponent)({__name:`Menu`,props:{open:{type:Boolean,default:!1},size:{default:`md`},minWidth:{default:160},maxWidth:{default:288}},emits:[`close`,`update:open`],setup(n,{expose:r,emit:i}){let a=n,o=i,s=(0,t.ref)(null),c=(0,t.ref)(-1),l=(0,t.reactive)([]),{phone:u}=e.usePhoneLayout();function d(e){return u.value?`min(${e}px, calc(100vw - 16px))`:`${e}px`}let f=(0,t.computed)(()=>({position:`fixed`,top:`${p.top}px`,left:`${p.left}px`,minWidth:d(a.minWidth),maxWidth:d(a.maxWidth),zIndex:u.value?`var(--nb-zindex-modal-dropdown)`:`var(--nb-zindex-menu)`})),p=(0,t.reactive)({top:0,left:0});function m(e){p.top=e.bottom,p.left=e.left,g()}function h(e,t){p.top=t,p.left=e,g()}function g(){a.open&&u.value&&(0,t.nextTick)(D)}function _(){o(`close`),o(`update:open`,!1)}function v(e){return l.includes(e)||l.push(e),l.indexOf(e)}function y(e){let t=l.indexOf(e);t>=0&&l.splice(t,1)}let b=new Set;function x(e){b.add(e)}function S(e){b.delete(e)}(0,t.provide)(`nb-menu`,{size:a.size,close:_,highlightedIndex:c.value,registerItem:v,unregisterItem:y,registerSurface:x,unregisterSurface:S});function C(){return s.value?Array.from(s.value.querySelectorAll(`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`)).filter(e=>!e.closest(`.nb-submenu`)):[]}function w(e){let t=C();e>=0&&e<t.length&&(c.value=e,t[e].focus())}function T(e){if(e.key===`Escape`){if(e.defaultPrevented)return;e.preventDefault(),e.stopPropagation(),_();return}let t=C();if(!t.length)return;let n=t.indexOf(document.activeElement);if(n>=0&&(c.value=n),e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let n=c.value+1;for(;n<t.length&&t[n]?.getAttribute(`aria-disabled`)===`true`;)n++;n<t.length&&w(n)}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let n=c.value-1;for(;n>=0&&t[n]?.getAttribute(`aria-disabled`)===`true`;)n--;n>=0&&w(n)}else e.key===`Tab`&&_()}function E(e){let t=e.target;if(!(!s.value||s.value.contains(t))){for(let e of b)if(e.contains(t))return;_()}}function D(){if(!s.value)return;let e=s.value.getBoundingClientRect();e.right>window.innerWidth&&(p.left=Math.max(8,window.innerWidth-e.width-8)),e.bottom>window.innerHeight&&(p.top=Math.max(8,window.innerHeight-e.height-8));let t=window.innerHeight-p.top-8;s.value.style.maxHeight=`${t}px`}return(0,t.watch)(()=>a.open,e=>{e?(c.value=-1,document.addEventListener(`mousedown`,E),(0,t.nextTick)(()=>{D(),C().length>0&&w(0)})):(c.value=-1,document.removeEventListener(`mousedown`,E))}),(0,t.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,E)}),r({setPosition:m,setPositionXY:h,close:_,el:s}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[(0,t.createVNode)(t.Transition,{name:`nb-menu`},{default:(0,t.withCtx)(()=>[n.open?((0,t.openBlock)(),(0,t.createElementBlock)(`ul`,{key:0,ref_key:`menuRef`,ref:s,role:`menu`,class:(0,t.normalizeClass)([`nb-menu`,`nb-menu--${n.size}`]),style:(0,t.normalizeStyle)(f.value),onKeydown:T},[(0,t.renderSlot)(e.$slots,`default`)],38)):(0,t.createCommentVNode)(``,!0)]),_:3})]))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
package/dist/Select-ClkEzw5T.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`),t=require(`./Label-CZhQEyoi.cjs`),n=require(`./Message-C44ftsaT.cjs`),r=require(`./Grid-DiCxrPaO.cjs`),i=require(`./composables/useMenuSurface.composable.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/caret-down`),s=require(`@nubisco/ui/icons/caret-up`);var c=[`id`,`aria-expanded`,`aria-disabled`,`aria-required`,`disabled`],l=[`id`,`aria-expanded`,`aria-disabled`,`aria-required`,`disabled`],u={key:1,class:`nb-select__inner-label`},d={key:0,class:`nb-select__asterisk`,"aria-hidden":`true`},f=[`aria-multiselectable`],p=[`aria-labelledby`],m=[`id`],h=[`aria-selected`,`aria-disabled`,`onMouseenter`,`onClick`],g={key:0,class:`nb-select__option-check`,"aria-hidden":`true`},_={key:0,viewBox:`0 0 10 8`,fill:`none`,width:`10`,height:`8`},v={class:`nb-select__option-label`},y={key:0,class:`nb-select__empty`},b=[`placeholder`,`onKeydown`],x=(0,a.defineComponent)({__name:`Select`,props:{modelValue:{default:null},options:{default:()=>[]},multiple:{type:Boolean,default:!1},creatable:{type:Boolean,default:!1},createPlaceholder:{default:``},placeholder:{default:`Select…`},name:{default:``},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},id:{default:void 0},label:{default:``},error:{default:``},warning:{default:``},helper:{default:``},variant:{default:`default`},size:{default:`md`}},emits:[`update:modelValue`,`change`,`create`],setup(x,{expose:S,emit:C}){let w=x,T=C,E=(0,a.ref)(``);function D(){let e=E.value.trim();e&&(T(`create`,e),E.value=``)}let O=(0,a.ref)(!1),k=(0,a.ref)(!1),A=(0,a.ref)(-1),j=(0,a.ref)(null),M=(0,a.ref)(null),N=(0,a.ref)(null);i.useMenuSurface(N);let P=(0,a.ref)({position:`fixed`,top:`0px`,left:`0px`,width:`0px`,zIndex:`9999`}),F=`nb-select-${(0,a.useId)()}`,I=(0,a.computed)(()=>w.id??F),L=(0,a.computed)(()=>w.modelValue==null?[]:Array.isArray(w.modelValue)?w.modelValue:[w.modelValue]),R=(0,a.computed)(()=>{if(!(w.multiple||L.value.length!==1))return(w.options??[]).find(e=>e.value===L.value[0])?.icon}),z=(0,a.computed)(()=>{if(L.value.length===0)return``;let e=w.options??[];return w.multiple?L.value.length===1?e.find(e=>e.value===L.value[0])?.label??String(L.value[0]):L.value.length===2?L.value.map(t=>e.find(e=>e.value===t)?.label??String(t)).join(`, `):`${L.value.length} selected`:e.find(e=>e.value===L.value[0])?.label??String(L.value[0])});function B(e){return L.value.includes(e)}let V=(0,a.computed)(()=>{let e=[];return(w.options??[]).forEach((t,n)=>{let r=e[e.length-1];(!r||r.name!==t.group)&&e.push({key:`${e.length}:${t.group??``}`,name:t.group,labelId:`${I.value}-group-${e.length}`,entries:[]}),e[e.length-1].entries.push({option:t,index:n})}),e});function H(e,t){let n=w.options??[];for(let r=e+t;r>=0&&r<n.length;r+=t)if(!n[r].disabled)return r;return e}function U(e){if(e.disabled)return;let t;if(w.multiple){let n=[...L.value],r=n.indexOf(e.value);r>=0?n.splice(r,1):n.push(e.value),t=n}else t=e.value,K();T(`update:modelValue`,t),T(`change`,t)}function W(){if(!M.value)return;let e=M.value.getBoundingClientRect(),t=N.value?.offsetHeight??0,n=window.innerHeight-e.bottom,r=e.top;P.value={position:`fixed`,top:t>0&&n<t&&r>n?`${e.top-t}px`:`${e.bottom}px`,left:`${e.left}px`,width:`${e.width}px`,zIndex:`9999`}}function G(){if(w.disabled)return;O.value=!0,W();let e=w.options??[];A.value=L.value.length>0?Math.max(0,e.findIndex(e=>e.value===L.value[0])):-1,(0,a.nextTick)(()=>{W(),Z()})}function K(){O.value=!1,A.value=-1}function q(){O.value?K():G()}function J(e){let t=e.target,n=j.value?.contains(t)??!1,r=N.value?.contains(t)??!1;!n&&!r&&K()}function Y(){O.value&&W()}(0,a.watch)(O,e=>{e?(document.addEventListener(`mousedown`,J),window.addEventListener(`scroll`,Y,!0),window.addEventListener(`resize`,Y)):(document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y))}),(0,a.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y)});function X(e){let t=w.options??[];if(!O.value){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),G());return}e.key===`Escape`?(K(),e.preventDefault()):e.key===`Tab`?K():e.key===`ArrowDown`?(e.preventDefault(),A.value=H(A.value,1),Z()):e.key===`ArrowUp`?(e.preventDefault(),A.value>0&&(A.value=H(A.value,-1)),Z()):(e.key===`Enter`||e.key===` `)&&A.value>=0&&(e.preventDefault(),U(t[A.value]))}function Z(){(0,a.nextTick)(()=>{!N.value||A.value<0||N.value.querySelectorAll(`.nb-select__option`)[A.value]?.scrollIntoView({block:`nearest`})})}let Q=(0,a.computed)(()=>[`nb-select`,`nb-select--${w.variant}`,`nb-select--${w.size}`,{"nb-select--open":O.value,"nb-select--focused":k.value&&!O.value,"nb-select--error":!!w.error,"nb-select--warning":!w.error&&!!w.warning,"nb-select--multiple":w.multiple}]);return S({open:G,close:K}),(i,S)=>((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,null,[(0,a.createElementVNode)(`div`,{ref_key:`rootRef`,ref:j,class:(0,a.normalizeClass)(Q.value),onKeydown:X},[x.variant===`default`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:0},[i.$slots.label?(0,a.renderSlot)(i.$slots,`label`,{key:0}):x.label?((0,a.openBlock)(),(0,a.createBlock)(t.t,{key:1,for:I.value,required:x.required,disabled:x.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`button`,{id:I.value,ref_key:`triggerRef`,ref:M,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":O.value,"aria-haspopup":`listbox`,"aria-disabled":x.disabled||void 0,"aria-required":x.required||void 0,disabled:x.disabled||void 0,onClick:q,onFocus:S[0]||=e=>k.value=!0,onBlur:S[1]||=e=>k.value=!1},[(0,a.createElementVNode)(`span`,{class:(0,a.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!z.value,"nb-select__value--with-icon":!!R.value}])},[R.value?((0,a.openBlock)(),(0,a.createBlock)(e.t,{key:0,class:`nb-select__value-icon`,name:R.value,size:16},null,8,[`name`])):(0,a.createCommentVNode)(``,!0),z.value?(0,a.renderSlot)(i.$slots,`value`,{key:1,values:L.value},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(z.value),1)]):((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:2},[(0,a.createTextVNode)((0,a.toDisplayString)(x.placeholder),1)],64))],2),x.error?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:0,variant:`error`,"icon-only":!0,class:`nb-select__status-icon`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.error),1)]),_:1})):x.warning?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:1,variant:`warning`,"icon-only":!0,class:`nb-select__status-icon`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.warning),1)]),_:1})):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(r.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,a.withCtx)(()=>[(0,a.createVNode)(e.t,{name:O.value?(0,a.unref)(s.regular):(0,a.unref)(o.regular),size:16},null,8,[`name`])]),_:1})],40,c),x.error?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:2,variant:`error`,class:`nb-select__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.error),1)]),_:1})):x.warning?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:3,variant:`warning`,class:`nb-select__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.warning),1)]),_:1})):x.helper?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:4,variant:`helper`,class:`nb-select__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.helper),1)]),_:1})):(0,a.createCommentVNode)(``,!0)],64)):x.variant===`fluid`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:1},[(0,a.createElementVNode)(`button`,{id:I.value,ref_key:`triggerRef`,ref:M,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":O.value,"aria-haspopup":`listbox`,"aria-disabled":x.disabled||void 0,"aria-required":x.required||void 0,disabled:x.disabled||void 0,onClick:q,onFocus:S[2]||=e=>k.value=!0,onBlur:S[3]||=e=>k.value=!1},[x.label||i.$slots.label?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:0,dir:`row`,align:`center`,gap:`xs`,class:`nb-select__inner-header`},{default:(0,a.withCtx)(()=>[i.$slots.label?(0,a.renderSlot)(i.$slots,`label`,{key:0}):((0,a.openBlock)(),(0,a.createElementBlock)(`label`,u,[(0,a.createTextVNode)((0,a.toDisplayString)(x.label)+` `,1),x.required?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,d,`*`)):(0,a.createCommentVNode)(``,!0)])),x.helper&&!x.error&&!x.warning?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:2,variant:`helper`,"icon-only":!0,class:`nb-select__inner-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.helper),1)]),_:1})):(0,a.createCommentVNode)(``,!0)]),_:3})):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(r.t,{dir:`row`,align:`end`,flex:``,class:`nb-select__value-row`},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`span`,{class:(0,a.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!z.value,"nb-select__value--with-icon":!!R.value}])},[R.value?((0,a.openBlock)(),(0,a.createBlock)(e.t,{key:0,class:`nb-select__value-icon`,name:R.value,size:16},null,8,[`name`])):(0,a.createCommentVNode)(``,!0),z.value?(0,a.renderSlot)(i.$slots,`value`,{key:1,values:L.value},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(z.value),1)]):((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:2},[(0,a.createTextVNode)((0,a.toDisplayString)(x.placeholder),1)],64))],2),(0,a.createVNode)(r.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,a.withCtx)(()=>[(0,a.createVNode)(e.t,{name:O.value?(0,a.unref)(s.regular):(0,a.unref)(o.regular),size:16},null,8,[`name`])]),_:1})]),_:3})],40,l),x.error?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:0,variant:`error`,class:`nb-select__fluid-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.error),1)]),_:1})):x.warning?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:1,variant:`warning`,class:`nb-select__fluid-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(x.warning),1)]),_:1})):(0,a.createCommentVNode)(``,!0)],64)):(0,a.createCommentVNode)(``,!0)],34),((0,a.openBlock)(),(0,a.createBlock)(a.Teleport,{to:`body`},[O.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,ref_key:`dropdownRef`,ref:N,class:`nb-select__dropdown`,style:(0,a.normalizeStyle)(P.value),role:`listbox`,"aria-multiselectable":x.multiple||void 0},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(V.value,t=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:t.key,class:`nb-select__group`,role:`group`,"aria-labelledby":t.name?t.labelId:void 0},[t.name?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,id:t.labelId,class:`nb-select__group-label`},(0,a.toDisplayString)(t.name),9,m)):(0,a.createCommentVNode)(``,!0),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(t.entries,t=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:t.option.value,class:(0,a.normalizeClass)([`nb-select__option`,{"nb-select__option--selected":B(t.option.value),"nb-select__option--highlighted":A.value===t.index,"nb-select__option--disabled":t.option.disabled}]),role:`option`,"aria-selected":B(t.option.value),"aria-disabled":t.option.disabled||void 0,onMouseenter:e=>A.value=t.index,onClick:e=>U(t.option)},[x.multiple?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,g,[B(t.option.value)?((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,_,[...S[7]||=[(0,a.createElementVNode)(`path`,{d:`M1 4l3 3 5-6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1)]])):(0,a.createCommentVNode)(``,!0)])):(0,a.createCommentVNode)(``,!0),t.option.icon?((0,a.openBlock)(),(0,a.createBlock)(e.t,{key:1,class:`nb-select__option-icon`,name:t.option.icon,size:16},null,8,[`name`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`span`,v,[(0,a.renderSlot)(i.$slots,`option`,{option:t.option},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(t.option.label),1)])])],42,h))),128))],8,p))),128)),!x.options||x.options.length===0?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,y,` No options `)):(0,a.createCommentVNode)(``,!0),x.creatable?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:1,class:`nb-select__create`,onMousedown:S[6]||=(0,a.withModifiers)(()=>{},[`prevent`])},[(0,a.withDirectives)((0,a.createElementVNode)(`input`,{"onUpdate:modelValue":S[4]||=e=>E.value=e,type:`text`,class:`nb-select__create-input`,placeholder:x.createPlaceholder||`Add new…`,onKeydown:[(0,a.withKeys)((0,a.withModifiers)(D,[`prevent`]),[`enter`]),S[5]||=(0,a.withModifiers)(()=>{},[`stop`])]},null,40,b),[[a.vModelText,E.value]])],32)):(0,a.createCommentVNode)(``,!0)],12,f)):(0,a.createCommentVNode)(``,!0)]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return x}});
|