@nubisco/ui 5.17.0 → 5.18.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/{BarChart-BmDXIaf6.cjs → BarChart-B3B7wH20.cjs} +1 -1
- package/dist/{BarChart-CmYyd4IV.js → BarChart-DUy6vE_i.js} +4 -4
- package/dist/{BlueprintControls-CVQkxcMU.js → BlueprintControls-CuOAdppD.js} +1 -1
- package/dist/{BlueprintControls-IU6Dc5yv.cjs → BlueprintControls-LCIgk-cb.cjs} +1 -1
- package/dist/Board-6D49Yld8.js +524 -0
- package/dist/Board-Cp8XfgZm.cjs +1 -0
- package/dist/{Confirm-CLrRlOE6.cjs → Confirm-Br9VOB2-.cjs} +1 -1
- package/dist/{Confirm-DsB9n0sk.js → Confirm-DztLfQzB.js} +2 -2
- package/dist/{DataTable-D6hXgtDH.js → DataTable-8VaU0T7V.js} +1 -1
- package/dist/{DataTable-BJKfz59R.cjs → DataTable-Mq7v4Dyk.cjs} +1 -1
- package/dist/{FileUploader-CufMlD5X.cjs → FileUploader-DPIAWehF.cjs} +1 -1
- package/dist/{FileUploader-B2A1T1vb.js → FileUploader-OJJIlvmH.js} +1 -1
- package/dist/{GanttChart-Cekazr75.cjs → GanttChart-C6uVsNrq.cjs} +1 -1
- package/dist/{GanttChart-B6Np07RJ.js → GanttChart-asYYkfjM.js} +3 -3
- package/dist/{InterpolationChart-BF00hyiY.js → InterpolationChart-CdbT0AvE.js} +3 -3
- package/dist/{InterpolationChart-D_QPQOIS.cjs → InterpolationChart-w1GgDSDT.cjs} +1 -1
- package/dist/{LineChart-D21jFHa1.js → LineChart-BgnDKI8u.js} +4 -4
- package/dist/{LineChart-CgBvFTwd.cjs → LineChart-CmBBttxc.cjs} +1 -1
- package/dist/{Modal-BdjhNfG0.js → Modal-BvZulLj2.js} +1 -1
- package/dist/{Modal-eRotJIL5.cjs → Modal-Xa9TIGNi.cjs} +1 -1
- package/dist/{NotificationCenter-RIzKsxUf.cjs → NotificationCenter-B12PMiat.cjs} +1 -1
- package/dist/{NotificationCenter-BWNFq7Y_.js → NotificationCenter-B2kJXtA9.js} +1 -1
- package/dist/{Pagination-D69J9sA1.cjs → Pagination-Di4RPomA.cjs} +1 -1
- package/dist/{Pagination-CH2A6T3n.js → Pagination-JW-O2kLk.js} +1 -1
- package/dist/{PieChart-DajsvhAV.cjs → PieChart-CUckdHre.cjs} +1 -1
- package/dist/{PieChart-ByOhOTXU.js → PieChart-CpkjCb1W.js} +3 -3
- package/dist/{TableOfContents-BfR2Zyrv.cjs → TableOfContents-C6Qnq6aS.cjs} +1 -1
- package/dist/{TableOfContents-C6zgmnCg.js → TableOfContents-DwnnMxv5.js} +1 -1
- package/dist/{Tabs-BCCI2jAd.cjs → Tabs-B5crovQe.cjs} +1 -1
- package/dist/{Tabs-CxqDD--r.js → Tabs-DRrq4YCX.js} +1 -1
- package/dist/{Walkthrough-CDeBRQZb.cjs → Walkthrough-DRx76ziA.cjs} +1 -1
- package/dist/{Walkthrough-B_zZaq4y.js → Walkthrough-vAJctcje.js} +1 -1
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +32 -32
- package/dist/component-styles.json +2 -0
- package/dist/components/Avatar.cjs +1 -1
- package/dist/components/Avatar.mjs +1 -1
- package/dist/components/Badge.cjs +1 -1
- package/dist/components/Badge.mjs +1 -1
- package/dist/components/Banner.cjs +1 -1
- package/dist/components/Banner.mjs +1 -1
- package/dist/components/BlueprintControls.cjs +1 -1
- package/dist/components/BlueprintControls.mjs +1 -1
- package/dist/components/Board.cjs +1 -1
- package/dist/components/Board.d.ts +28 -0
- package/dist/components/Board.mjs +1 -1
- package/dist/components/Board.vue.d.ts +13 -1
- package/dist/components/Board.vue.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs.mjs +1 -1
- package/dist/components/Button.cjs +1 -1
- package/dist/components/Button.mjs +1 -1
- package/dist/components/Calendar.cjs +1 -1
- package/dist/components/Calendar.mjs +1 -1
- package/dist/components/Charts/BarChart.cjs +1 -1
- package/dist/components/Charts/BarChart.mjs +1 -1
- package/dist/components/Charts/GanttChart.cjs +1 -1
- package/dist/components/Charts/GanttChart.mjs +1 -1
- package/dist/components/Charts/InterpolationChart.cjs +1 -1
- package/dist/components/Charts/InterpolationChart.mjs +1 -1
- package/dist/components/Charts/LineChart.cjs +1 -1
- package/dist/components/Charts/LineChart.mjs +1 -1
- package/dist/components/Charts/PieChart.cjs +1 -1
- package/dist/components/Charts/PieChart.mjs +1 -1
- 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/DatePicker.vue.d.ts +1 -1
- package/dist/components/FileUploader.cjs +1 -1
- package/dist/components/FileUploader.mjs +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter.mjs +1 -1
- package/dist/components/NotificationCenter.vue.d.ts +1 -1
- package/dist/components/NotificationCenterItem.vue.d.ts +1 -1
- package/dist/components/NumberInput.vue.d.ts +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.vue.d.ts +1 -1
- package/dist/components/TableOfContents.cjs +1 -1
- package/dist/components/TableOfContents.mjs +1 -1
- package/dist/components/Tabs.cjs +1 -1
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/TextInput.vue.d.ts +1 -1
- package/dist/components/Walkthrough.cjs +1 -1
- package/dist/components/Walkthrough.mjs +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 +24 -24
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/Board.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/Board-6TUivitd.cjs +0 -1
- package/dist/Board-nLi96Obf.js +0 -420
- /package/dist/{Avatar-BmB57kGg.cjs → Avatar-CLL3i8dn.cjs} +0 -0
- /package/dist/{Avatar-ap4X6_kE.js → Avatar-uYRUtK1R.js} +0 -0
- /package/dist/{Badge-B1xoanmq.cjs → Badge-ouVFB318.cjs} +0 -0
- /package/dist/{Badge-CxBslbIp.js → Badge-wDtZdOfk.js} +0 -0
- /package/dist/{Banner-DzySrOrs.cjs → Banner-CtaMbfyG.cjs} +0 -0
- /package/dist/{Banner-D61pK-1n.js → Banner-DKMPZuXR.js} +0 -0
- /package/dist/{Breadcrumbs-BT3EvjKk.js → Breadcrumbs-BXsbR60g.js} +0 -0
- /package/dist/{Breadcrumbs-H9PvTXK0.cjs → Breadcrumbs-CPucjD0z.cjs} +0 -0
- /package/dist/{Button-CV2mm5ZB.js → Button-BAfC7ySK.js} +0 -0
- /package/dist/{Button-S8xZ0EGV.cjs → Button-BZn2lmMA.cjs} +0 -0
- /package/dist/{Calendar-DiYrR5ss.cjs → Calendar-D3ExPJ2t.cjs} +0 -0
- /package/dist/{Calendar-Bu8yA7-h.js → Calendar-DCoZLEcA.js} +0 -0
- /package/dist/{ChartLegend-ywCoTUbO.js → ChartLegend-B_Y9TNfO.js} +0 -0
- /package/dist/{ChartLegend-O2SYdHsd.cjs → ChartLegend-k-7LH8-7.cjs} +0 -0
- /package/dist/{palette-CS95-prq.js → palette-BVXsOJol.js} +0 -0
- /package/dist/{palette-BW0RLn76.cjs → palette-CP7R55wd.cjs} +0 -0
- /package/dist/{scales-BjSg0Ayo.js → scales-CsGzsNm7.js} +0 -0
- /package/dist/{scales-VtK6oMP0.cjs → scales-DJ_hCmZX.cjs} +0 -0
- /package/dist/{useChartSize-CBOK3yq5.js → useChartSize-6K6L_Xnm.js} +0 -0
- /package/dist/{useChartSize-BPqvq1te.cjs → useChartSize-DGUae61E.cjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-CP7R55wd.cjs`),n=require(`./ChartLegend-k-7LH8-7.cjs`),r=require(`./scales-DJ_hCmZX.cjs`),i=require(`./useChartSize-DGUae61E.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,8 +1,8 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
|
-
import { i as t, l as n, n as r, u as i } from "./palette-
|
|
3
|
-
import { t as a } from "./ChartLegend-
|
|
4
|
-
import { i as o, r as s, t as c } from "./scales-
|
|
5
|
-
import { t as ee } from "./useChartSize-
|
|
2
|
+
import { i as t, l as n, n as r, u as i } from "./palette-BVXsOJol.js";
|
|
3
|
+
import { t as a } from "./ChartLegend-B_Y9TNfO.js";
|
|
4
|
+
import { i as o, r as s, t as c } from "./scales-CsGzsNm7.js";
|
|
5
|
+
import { t as ee } from "./useChartSize-6K6L_Xnm.js";
|
|
6
6
|
import { Fragment as l, computed as u, createBlock as te, createCommentVNode as ne, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, getCurrentInstance as re, mergeProps as h, normalizeClass as ie, openBlock as g, ref as _, renderList as v, toDisplayString as y, unref as b, withCtx as x } from "vue";
|
|
7
7
|
//#region src/components/Charts/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var ae = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
2
|
import { r as t } from "./Size.d-Bah6vMl3.js";
|
|
3
|
-
import { t as n } from "./Button-
|
|
3
|
+
import { t as n } from "./Button-BAfC7ySK.js";
|
|
4
4
|
import { useBlueprint as r } from "./composables/useBlueprint.composable.mjs";
|
|
5
5
|
import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, openBlock as f, unref as p } from "vue";
|
|
6
6
|
import * as m from "@nubisco/ui/icons/magnifying-glass-plus";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Button-
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Button-BZn2lmMA.cjs`),i=require(`./composables/useBlueprint.composable.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/magnifying-glass-plus`);o=e.n(o);let s=require(`@nubisco/ui/icons/magnifying-glass-minus`);s=e.n(s);let c=require(`@nubisco/ui/icons/frame-corners`);c=e.n(c);let l=require(`@nubisco/ui/icons/crosshair`);l=e.n(l);let u=require(`@nubisco/ui/icons/tree-structure`);u=e.n(u);let d=require(`@nubisco/ui/icons/align-left`);d=e.n(d);let f=require(`@nubisco/ui/icons/align-center-horizontal`);f=e.n(f);let p=require(`@nubisco/ui/icons/align-right`);p=e.n(p);let m=require(`@nubisco/ui/icons/align-top`);m=e.n(m);let h=require(`@nubisco/ui/icons/align-center-vertical`);h=e.n(h);let g=require(`@nubisco/ui/icons/align-bottom`);g=e.n(g);let _=require(`@nubisco/ui/icons/arrows-out-line-horizontal`);_=e.n(_);let v=require(`@nubisco/ui/icons/arrows-out-line-vertical`);v=e.n(v);var y={class:`nb-blueprint-controls__group`},b={key:0,class:`nb-blueprint-controls__group`},x=(0,a.defineComponent)({__name:`BlueprintControls`,props:{position:{default:`bottom-right`},orientation:{default:`vertical`},show:{default:`always`},autoLayout:{type:Boolean,default:!0},alignment:{type:Boolean,default:!0}},setup(e){let t=n.r.Small,x=e,S=i.useBlueprint(),C=(0,a.computed)(()=>x.show===`always`||S.isEditMode.value),w=(0,a.computed)(()=>x.alignment&&S.selectedIds.value.size>=2);return(n,i)=>C.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,class:(0,a.normalizeClass)([`nb-blueprint-controls`,[`nb-blueprint-controls--${e.position}`,`is-${e.orientation}`]]),role:`toolbar`,"aria-label":`Blueprint controls`},[(0,a.createElementVNode)(`div`,y,[(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:o,title:`Zoom in`,"aria-label":`Zoom in`,onClick:i[0]||=e=>(0,a.unref)(S).zoomIn()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:s,title:`Zoom out`,"aria-label":`Zoom out`,onClick:i[1]||=e=>(0,a.unref)(S).zoomOut()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:c,title:`Fit to view`,"aria-label":`Fit to view`,onClick:i[2]||=e=>(0,a.unref)(S).fitToView()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:l,title:`Center`,"aria-label":`Center`,onClick:i[3]||=e=>(0,a.unref)(S).centerView()},null,8,[`size`]),e.autoLayout?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:0,variant:`ghost`,size:(0,a.unref)(t),icon:u,title:`Auto layout`,"aria-label":`Auto layout`,onClick:i[4]||=e=>(0,a.unref)(S).autoLayout()},null,8,[`size`])):(0,a.createCommentVNode)(``,!0)]),w.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,b,[(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:d,title:`Align left`,"aria-label":`Align left`,onClick:i[5]||=e=>(0,a.unref)(S).alignLeft()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:f,title:`Align horizontal center`,"aria-label":`Align horizontal center`,onClick:i[6]||=e=>(0,a.unref)(S).alignCenter()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:p,title:`Align right`,"aria-label":`Align right`,onClick:i[7]||=e=>(0,a.unref)(S).alignRight()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:m,title:`Align top`,"aria-label":`Align top`,onClick:i[8]||=e=>(0,a.unref)(S).alignTop()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:h,title:`Align vertical center`,"aria-label":`Align vertical center`,onClick:i[9]||=e=>(0,a.unref)(S).alignMiddle()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:g,title:`Align bottom`,"aria-label":`Align bottom`,onClick:i[10]||=e=>(0,a.unref)(S).alignBottom()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:_,title:`Distribute horizontally`,"aria-label":`Distribute horizontally`,onClick:i[11]||=e=>(0,a.unref)(S).distributeHorizontally()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:v,title:`Distribute vertically`,"aria-label":`Distribute vertically`,onClick:i[12]||=e=>(0,a.unref)(S).distributeVertically()},null,8,[`size`])])):(0,a.createCommentVNode)(``,!0)],2)):(0,a.createCommentVNode)(``,!0)}}),S=t.t(x,[[`__scopeId`,`data-v-5b86517c`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return S}});
|
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { useStableId as e } from "./composables/useStableId.composable.mjs";
|
|
2
|
+
import { useSurfaceLayer as t } from "./composables/useSurfaceLayer.composable.mjs";
|
|
3
|
+
import { t as n } from "./Button-BAfC7ySK.js";
|
|
4
|
+
import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, mergeProps as ee, nextTick as d, normalizeClass as f, normalizeStyle as te, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, withCtx as ne, withModifiers as y } from "vue";
|
|
5
|
+
//#region src/components/Board.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var re = [
|
|
7
|
+
"draggable",
|
|
8
|
+
"onDragstart",
|
|
9
|
+
"onDragover"
|
|
10
|
+
], ie = { class: "nb-board__col-title" }, ae = { class: "nb-board__col-count" }, oe = ["onClick"], se = ["aria-label"], ce = { class: "nb-board__lane-label" }, le = { class: "nb-board__lane-count" }, ue = ["onDragover", "onDrop"], de = ["aria-label"], fe = [
|
|
11
|
+
"data-item-id",
|
|
12
|
+
"aria-selected",
|
|
13
|
+
"aria-label",
|
|
14
|
+
"aria-describedby",
|
|
15
|
+
"onDragstart",
|
|
16
|
+
"onDragover",
|
|
17
|
+
"onKeydown",
|
|
18
|
+
"onClickCapture",
|
|
19
|
+
"onBlur"
|
|
20
|
+
], pe = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "nb-board__empty-cell",
|
|
23
|
+
"aria-hidden": "true"
|
|
24
|
+
}, me = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "nb-board__cell-footer"
|
|
27
|
+
}, he = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "nb-board__batch",
|
|
30
|
+
role: "region",
|
|
31
|
+
"aria-label": "Actions for the selected cards"
|
|
32
|
+
}, ge = { class: "nb-board__batch-count" }, _e = { class: "nb-board__batch-actions" }, ve = ["id"], ye = {
|
|
33
|
+
class: "nb-board__sr",
|
|
34
|
+
"aria-live": "assertive"
|
|
35
|
+
}, be = .5, xe = 44, Se = /* @__PURE__ */ u({
|
|
36
|
+
__name: "Board",
|
|
37
|
+
props: {
|
|
38
|
+
columns: {},
|
|
39
|
+
items: {},
|
|
40
|
+
lanes: { default: void 0 },
|
|
41
|
+
reorderableColumns: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
45
|
+
nestable: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
selectable: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: !1
|
|
52
|
+
},
|
|
53
|
+
selected: { default: void 0 }
|
|
54
|
+
},
|
|
55
|
+
emits: [
|
|
56
|
+
"move",
|
|
57
|
+
"nest",
|
|
58
|
+
"column-move",
|
|
59
|
+
"move-many",
|
|
60
|
+
"update:selected"
|
|
61
|
+
],
|
|
62
|
+
setup(u, { emit: Se }) {
|
|
63
|
+
let b = u, { layerProps: Ce } = t(), x = Se, S = i(() => b.selectable ? b.selected ?? [] : []), we = i(() => new Set(S.value)), C = null;
|
|
64
|
+
function w(e) {
|
|
65
|
+
return we.value.has(e);
|
|
66
|
+
}
|
|
67
|
+
function T(e) {
|
|
68
|
+
x("update:selected", e), U.value = e.length === 0 ? "Selection cleared" : `${e.length} ${e.length === 1 ? "card" : "cards"} selected`;
|
|
69
|
+
}
|
|
70
|
+
function E() {
|
|
71
|
+
C = null, T([]);
|
|
72
|
+
}
|
|
73
|
+
function D(e) {
|
|
74
|
+
C = e, T(w(e) ? S.value.filter((t) => t !== e) : [...S.value, e]);
|
|
75
|
+
}
|
|
76
|
+
function Te(e, t, n) {
|
|
77
|
+
let r = L(t, n), i = C ? r.findIndex((e) => e.id === C) : -1, a = r.findIndex((t) => t.id === e.id);
|
|
78
|
+
if (i === -1 || a === -1) return D(e.id);
|
|
79
|
+
let o = r.slice(Math.min(i, a), Math.max(i, a) + 1).map((e) => e.id);
|
|
80
|
+
T([...new Set([...S.value, ...o])]);
|
|
81
|
+
}
|
|
82
|
+
function Ee(e, t, n, r) {
|
|
83
|
+
b.selectable && (e.metaKey || e.ctrlKey || e.shiftKey) && (e.preventDefault(), e.stopPropagation(), e.shiftKey ? Te(t, N(n), r) : D(t.id));
|
|
84
|
+
}
|
|
85
|
+
function O() {
|
|
86
|
+
let e = [];
|
|
87
|
+
for (let t of b.columns) for (let n of M.value) for (let r of L(N(n), t.id)) w(r.id) && !e.includes(r.id) && e.push(r.id);
|
|
88
|
+
return e;
|
|
89
|
+
}
|
|
90
|
+
function k(e, t, n, r, i) {
|
|
91
|
+
let a = new Set(e), o = L(n, r).filter((e) => e.id !== t), s = null;
|
|
92
|
+
for (let e = Math.min(i, o.length) - 1; e >= 0; e--) if (!a.has(o[e].id)) {
|
|
93
|
+
s = o[e].id;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
let c = null;
|
|
97
|
+
for (let e = Math.max(i, 0); e < o.length; e++) if (!a.has(o[e].id)) {
|
|
98
|
+
c = o[e].id;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
x("move-many", {
|
|
102
|
+
itemIds: e,
|
|
103
|
+
toColumnId: r,
|
|
104
|
+
...b.lanes ? { toLaneId: n } : {},
|
|
105
|
+
beforeItemId: s,
|
|
106
|
+
afterItemId: c
|
|
107
|
+
});
|
|
108
|
+
let l = R(r);
|
|
109
|
+
U.value = `${e.length} cards moved to ${l?.label ?? r}`;
|
|
110
|
+
}
|
|
111
|
+
let A = e({}), j = m(null), De = i(() => ({ gridTemplateColumns: `repeat(${b.columns.length}, var(--nb-board-column-track, minmax(200px, 1fr)))` })), M = i(() => b.lanes && b.lanes.length > 0 ? b.lanes : [null]);
|
|
112
|
+
function N(e) {
|
|
113
|
+
return e ? e.id ?? null : null;
|
|
114
|
+
}
|
|
115
|
+
function P(e) {
|
|
116
|
+
return e ? I(e.id) : "__flat__";
|
|
117
|
+
}
|
|
118
|
+
function F(e) {
|
|
119
|
+
return b.items.filter((t) => t.columnId === e).length;
|
|
120
|
+
}
|
|
121
|
+
function I(e) {
|
|
122
|
+
return e ?? "__none__";
|
|
123
|
+
}
|
|
124
|
+
function Oe(e) {
|
|
125
|
+
return b.lanes ? b.items.filter((t) => (t.laneId ?? null) === e).length : 0;
|
|
126
|
+
}
|
|
127
|
+
function L(e, t) {
|
|
128
|
+
return !b.lanes || b.lanes.length === 0 ? b.items.filter((e) => e.columnId === t) : b.items.filter((n) => n.columnId === t && (n.laneId ?? null) === e);
|
|
129
|
+
}
|
|
130
|
+
function R(e) {
|
|
131
|
+
return b.columns.find((t) => t.id === e);
|
|
132
|
+
}
|
|
133
|
+
let z = m(/* @__PURE__ */ new Set());
|
|
134
|
+
function ke(e) {
|
|
135
|
+
let t = I(e), n = new Set(z.value);
|
|
136
|
+
n.has(t) ? n.delete(t) : n.add(t), z.value = n;
|
|
137
|
+
}
|
|
138
|
+
function B(e) {
|
|
139
|
+
return z.value.has(I(e));
|
|
140
|
+
}
|
|
141
|
+
function V(e) {
|
|
142
|
+
let t = e.label ?? e.name ?? e.title;
|
|
143
|
+
return typeof t == "string" ? t : `Item ${e.id}`;
|
|
144
|
+
}
|
|
145
|
+
function H(e, t) {
|
|
146
|
+
return e ? `${t.label}, ${e.label}` : t.label;
|
|
147
|
+
}
|
|
148
|
+
function Ae(e, t) {
|
|
149
|
+
return H(e, t);
|
|
150
|
+
}
|
|
151
|
+
function je(e, t, n) {
|
|
152
|
+
let r = L(N(t), n.id), i = r.findIndex((t) => t.id === e.id), a = `${V(e)}, ${i + 1} of ${r.length} in ${H(t, n)}`;
|
|
153
|
+
return Y.value?.item.id === e.id ? `${a}, picked up` : a;
|
|
154
|
+
}
|
|
155
|
+
let U = m("");
|
|
156
|
+
function W(e, t, n, r) {
|
|
157
|
+
let i = L(t, n).filter((t) => t.id !== e.item.id), a = Math.max(0, Math.min(r, i.length));
|
|
158
|
+
return e.fromColumnId === n && e.fromLaneId === t && a === L(t, n).findIndex((t) => t.id === e.item.id) ? !1 : (x("move", {
|
|
159
|
+
itemId: e.item.id,
|
|
160
|
+
fromColumnId: e.fromColumnId,
|
|
161
|
+
toColumnId: n,
|
|
162
|
+
fromLaneId: e.fromLaneId,
|
|
163
|
+
toLaneId: t,
|
|
164
|
+
toIndex: a,
|
|
165
|
+
beforeItemId: i[a - 1]?.id ?? null,
|
|
166
|
+
afterItemId: i[a]?.id ?? null
|
|
167
|
+
}), !0);
|
|
168
|
+
}
|
|
169
|
+
let G = m(null), K = m(null), q = m(null);
|
|
170
|
+
function Me(e, t, n) {
|
|
171
|
+
Y.value = null;
|
|
172
|
+
let r = w(e.id) && S.value.length > 1 ? O() : void 0;
|
|
173
|
+
G.value = {
|
|
174
|
+
item: e,
|
|
175
|
+
fromLaneId: N(t),
|
|
176
|
+
fromColumnId: n,
|
|
177
|
+
group: r
|
|
178
|
+
}, r && (U.value = `Moving ${r.length} cards`);
|
|
179
|
+
}
|
|
180
|
+
function Ne(e, t, n, r, i) {
|
|
181
|
+
if (!G.value) return;
|
|
182
|
+
let a = e.currentTarget.getBoundingClientRect();
|
|
183
|
+
if (b.nestable && !G.value.group && a.height >= xe) {
|
|
184
|
+
let r = (e.clientY - a.top) / a.height, o = (1 - be) / 2;
|
|
185
|
+
if (r > o && r < 1 - o && i.id !== G.value.item.id) {
|
|
186
|
+
q.value = {
|
|
187
|
+
laneId: N(t),
|
|
188
|
+
colId: n,
|
|
189
|
+
itemId: i.id
|
|
190
|
+
}, K.value = null;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
q.value = null;
|
|
195
|
+
let o = e.clientY >= a.top + a.height / 2;
|
|
196
|
+
K.value = {
|
|
197
|
+
laneId: N(t),
|
|
198
|
+
colId: n,
|
|
199
|
+
index: r + (o ? 1 : 0)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function Pe(e, t) {
|
|
203
|
+
if (!G.value) return;
|
|
204
|
+
let n = N(e);
|
|
205
|
+
K.value = {
|
|
206
|
+
laneId: n,
|
|
207
|
+
colId: t,
|
|
208
|
+
index: L(n, t).length
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function Fe() {
|
|
212
|
+
K.value = null, q.value = null;
|
|
213
|
+
}
|
|
214
|
+
function Ie() {
|
|
215
|
+
G.value = null, K.value = null, q.value = null;
|
|
216
|
+
}
|
|
217
|
+
function Le(e, t) {
|
|
218
|
+
return J(e, t) !== null;
|
|
219
|
+
}
|
|
220
|
+
function J(e, t) {
|
|
221
|
+
let n = N(e), r = K.value;
|
|
222
|
+
if (G.value && r && r.laneId === n && r.colId === t) return r.index;
|
|
223
|
+
let i = Y.value;
|
|
224
|
+
if (i && i.laneId === n && i.colId === t) {
|
|
225
|
+
let e = L(n, t).findIndex((e) => e.id === i.item.id);
|
|
226
|
+
return e !== -1 && e <= i.index ? i.index + 1 : i.index;
|
|
227
|
+
}
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
function Re(e, t, n) {
|
|
231
|
+
let r = q.value;
|
|
232
|
+
return r !== null && r.laneId === N(e) && r.colId === t && r.itemId === n.id;
|
|
233
|
+
}
|
|
234
|
+
function ze(e, t, n) {
|
|
235
|
+
return n === L(N(e), t).length - 1 && J(e, t) === n + 1;
|
|
236
|
+
}
|
|
237
|
+
function Be(e, t) {
|
|
238
|
+
if (Z.value !== null) return;
|
|
239
|
+
let n = K.value, r = q.value;
|
|
240
|
+
K.value = null, q.value = null;
|
|
241
|
+
let i = G.value;
|
|
242
|
+
if (G.value = null, !i) return;
|
|
243
|
+
if (r) {
|
|
244
|
+
x("nest", {
|
|
245
|
+
itemId: i.item.id,
|
|
246
|
+
ontoItemId: r.itemId,
|
|
247
|
+
fromColumnId: i.fromColumnId,
|
|
248
|
+
...b.lanes ? { fromLaneId: i.fromLaneId } : {}
|
|
249
|
+
}), U.value = `${V(i.item)} dropped onto ${V(b.items.find((e) => e.id === r.itemId) ?? i.item)}`;
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
let a = N(e), o = L(a, t), s = n && n.laneId === a && n.colId === t ? n.index : o.length, c = o.findIndex((e) => e.id === i.item.id), l = c !== -1 && c < s ? s - 1 : s;
|
|
253
|
+
if (i.group) {
|
|
254
|
+
k(i.group, i.item.id, a, t, l);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
W(i, a, t, l);
|
|
258
|
+
}
|
|
259
|
+
let Y = m(null);
|
|
260
|
+
function Ve(e, t, n, r) {
|
|
261
|
+
let i = N(n);
|
|
262
|
+
if (b.selectable && (e.key === "x" || e.key === "X") && !Y.value) {
|
|
263
|
+
e.preventDefault(), D(t.id);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (e.key === "Escape") {
|
|
267
|
+
if (!Y.value) {
|
|
268
|
+
b.selectable && S.value.length > 0 && (e.preventDefault(), E());
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
e.preventDefault(), Y.value = null, U.value = "Move cancelled";
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (e.key === " " || e.key === "Enter") {
|
|
275
|
+
if (e.preventDefault(), Y.value?.item.id !== t.id) {
|
|
276
|
+
He(t, i, r);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (b.nestable && e.shiftKey && Ke()) {
|
|
280
|
+
qe();
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
Je();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
[
|
|
287
|
+
"ArrowUp",
|
|
288
|
+
"ArrowDown",
|
|
289
|
+
"ArrowLeft",
|
|
290
|
+
"ArrowRight"
|
|
291
|
+
].includes(e.key) && (e.preventDefault(), Y.value?.item.id === t.id ? Ge(e.key) : Ye(e.key, t, i, r));
|
|
292
|
+
}
|
|
293
|
+
function He(e, t, n) {
|
|
294
|
+
Y.value = {
|
|
295
|
+
item: e,
|
|
296
|
+
fromLaneId: t,
|
|
297
|
+
fromColumnId: n,
|
|
298
|
+
laneId: t,
|
|
299
|
+
colId: n,
|
|
300
|
+
index: L(t, n).findIndex((t) => t.id === e.id)
|
|
301
|
+
}, U.value = `${V(e)} picked up, ${Ue()}`;
|
|
302
|
+
}
|
|
303
|
+
function Ue() {
|
|
304
|
+
let e = Y.value;
|
|
305
|
+
if (!e) return "";
|
|
306
|
+
let t = L(e.laneId, e.colId).filter((t) => t.id !== e.item.id), n = R(e.colId), r = b.lanes?.find((t) => (t.id ?? null) === e.laneId) ?? null, i = n ? H(r, n) : e.colId;
|
|
307
|
+
return `position ${e.index + 1} of ${t.length + 1} in ${i}`;
|
|
308
|
+
}
|
|
309
|
+
function We() {
|
|
310
|
+
return !b.lanes || b.lanes.length === 0 ? [null] : b.lanes.filter((e) => !B(e.id)).map((e) => e.id ?? null);
|
|
311
|
+
}
|
|
312
|
+
function Ge(e) {
|
|
313
|
+
let t = Y.value;
|
|
314
|
+
if (!t) return;
|
|
315
|
+
let n = L(t.laneId, t.colId).filter((e) => e.id !== t.item.id);
|
|
316
|
+
if (e === "ArrowUp" || e === "ArrowDown") {
|
|
317
|
+
let r = e === "ArrowUp" ? -1 : 1, i = t.index + r;
|
|
318
|
+
if (i >= 0 && i <= n.length) t.index = i;
|
|
319
|
+
else {
|
|
320
|
+
let e = We(), n = e.indexOf(t.laneId), i = n + r;
|
|
321
|
+
if (n === -1 || i < 0 || i >= e.length) return;
|
|
322
|
+
let a = e[i];
|
|
323
|
+
t.laneId = a, t.index = r === 1 ? 0 : L(a, t.colId).filter((e) => e.id !== t.item.id).length;
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
let n = e === "ArrowLeft" ? -1 : 1, r = b.columns.findIndex((e) => e.id === t.colId), i = b.columns[r + n];
|
|
327
|
+
if (r === -1 || !i) return;
|
|
328
|
+
t.colId = i.id;
|
|
329
|
+
let a = L(t.laneId, t.colId).filter((e) => e.id !== t.item.id);
|
|
330
|
+
t.index = Math.min(t.index, a.length);
|
|
331
|
+
}
|
|
332
|
+
U.value = `${V(t.item)}, ${Ue()}`;
|
|
333
|
+
}
|
|
334
|
+
function Ke() {
|
|
335
|
+
let e = Y.value;
|
|
336
|
+
if (!e) return null;
|
|
337
|
+
let t = L(e.laneId, e.colId).filter((t) => t.id !== e.item.id);
|
|
338
|
+
return t.length === 0 ? null : t[Math.min(e.index, t.length - 1)] ?? null;
|
|
339
|
+
}
|
|
340
|
+
function qe() {
|
|
341
|
+
let e = Y.value, t = Ke();
|
|
342
|
+
!e || !t || (Y.value = null, x("nest", {
|
|
343
|
+
itemId: e.item.id,
|
|
344
|
+
ontoItemId: t.id,
|
|
345
|
+
fromColumnId: e.fromColumnId,
|
|
346
|
+
...b.lanes ? { fromLaneId: e.fromLaneId } : {}
|
|
347
|
+
}), U.value = `${V(e.item)} dropped onto ${V(t)}`);
|
|
348
|
+
}
|
|
349
|
+
function Je() {
|
|
350
|
+
let e = Y.value;
|
|
351
|
+
if (!e) return;
|
|
352
|
+
if (Y.value = null, w(e.item.id) && S.value.length > 1) {
|
|
353
|
+
k(O(), e.item.id, e.laneId, e.colId, e.index), Xe(e.item.id);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
let t = W({
|
|
357
|
+
item: e.item,
|
|
358
|
+
fromLaneId: e.fromLaneId,
|
|
359
|
+
fromColumnId: e.fromColumnId
|
|
360
|
+
}, e.laneId, e.colId, e.index), n = R(e.colId), r = b.lanes?.find((t) => (t.id ?? null) === e.laneId) ?? null, i = n ? H(r, n) : e.colId;
|
|
361
|
+
U.value = t ? `${V(e.item)} dropped, position ${e.index + 1} in ${i}` : `${V(e.item)} dropped`, Xe(e.item.id);
|
|
362
|
+
}
|
|
363
|
+
function Ye(e, t, n, r) {
|
|
364
|
+
let i = L(n, r), a = i.findIndex((e) => e.id === t.id);
|
|
365
|
+
if (e === "ArrowUp" || e === "ArrowDown") {
|
|
366
|
+
let t = a + (e === "ArrowDown" ? 1 : -1);
|
|
367
|
+
t >= 0 && t < i.length && X(i[t].id);
|
|
368
|
+
} else {
|
|
369
|
+
let t = b.columns.findIndex((e) => e.id === r), i = b.columns[t + (e === "ArrowRight" ? 1 : -1)];
|
|
370
|
+
if (t === -1 || !i) return;
|
|
371
|
+
let o = L(n, i.id);
|
|
372
|
+
if (o.length === 0) return;
|
|
373
|
+
X(o[Math.min(a, o.length - 1)].id);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function X(e) {
|
|
377
|
+
let t = j.value?.querySelectorAll("[data-item-id]");
|
|
378
|
+
if (t) {
|
|
379
|
+
for (let n of t) if (n.dataset.itemId === e) {
|
|
380
|
+
n.focus();
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
async function Xe(e) {
|
|
386
|
+
await d(), await d(), X(e);
|
|
387
|
+
}
|
|
388
|
+
function Ze(e) {
|
|
389
|
+
Y.value?.item.id === e.id && (Y.value = null);
|
|
390
|
+
}
|
|
391
|
+
let Z = m(null), Q = m(null);
|
|
392
|
+
function Qe(e, t) {
|
|
393
|
+
if (!b.reorderableColumns) {
|
|
394
|
+
t.preventDefault();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
Z.value = e, Q.value = e;
|
|
398
|
+
}
|
|
399
|
+
function $e(e, t) {
|
|
400
|
+
if (Z.value === null) return;
|
|
401
|
+
t.preventDefault();
|
|
402
|
+
let n = t.currentTarget.getBoundingClientRect();
|
|
403
|
+
Q.value = t.clientX < n.left + n.width / 2 ? e : e + 1;
|
|
404
|
+
}
|
|
405
|
+
function et(e) {
|
|
406
|
+
let t = Z.value, n = Q.value;
|
|
407
|
+
if ($(), t === null || n === null) return;
|
|
408
|
+
e.preventDefault();
|
|
409
|
+
let r = n > t ? n - 1 : n;
|
|
410
|
+
r !== t && x("column-move", {
|
|
411
|
+
columnId: b.columns[t].id,
|
|
412
|
+
toIndex: r
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
function $() {
|
|
416
|
+
Z.value = null, Q.value = null;
|
|
417
|
+
}
|
|
418
|
+
return (e, t) => (p(), o("div", ee({
|
|
419
|
+
ref_key: "boardRef",
|
|
420
|
+
ref: j,
|
|
421
|
+
class: "nb-board"
|
|
422
|
+
}, v(Ce)), [
|
|
423
|
+
s("div", {
|
|
424
|
+
class: "nb-board__grid",
|
|
425
|
+
style: te(De.value)
|
|
426
|
+
}, [(p(!0), o(r, null, h(u.columns, (t, n) => (p(), o("div", {
|
|
427
|
+
key: t.id,
|
|
428
|
+
class: f(["nb-board__col-header", {
|
|
429
|
+
"nb-board__col-header--reorderable": u.reorderableColumns,
|
|
430
|
+
"nb-board__col-header--dragging": Z.value === n,
|
|
431
|
+
"nb-board__col-header--drop-before": Q.value === n,
|
|
432
|
+
"nb-board__col-header--drop-after": Q.value === n + 1 && n === u.columns.length - 1
|
|
433
|
+
}]),
|
|
434
|
+
style: te(t.color ? { borderTopColor: t.color } : void 0),
|
|
435
|
+
draggable: u.reorderableColumns || void 0,
|
|
436
|
+
onDragstart: (e) => Qe(n, e),
|
|
437
|
+
onDragover: (e) => $e(n, e),
|
|
438
|
+
onDrop: et,
|
|
439
|
+
onDragend: $
|
|
440
|
+
}, [g(e.$slots, "column-header", {
|
|
441
|
+
column: t,
|
|
442
|
+
count: F(t.id)
|
|
443
|
+
}, () => [s("span", ie, _(t.label), 1), s("span", ae, _(F(t.id)), 1)])], 46, re))), 128)), (p(!0), o(r, null, h(M.value, (t) => (p(), o(r, { key: P(t) }, [t ? (p(), o("div", {
|
|
444
|
+
key: 0,
|
|
445
|
+
class: "nb-board__lane-header",
|
|
446
|
+
onClick: (e) => ke(t.id)
|
|
447
|
+
}, [
|
|
448
|
+
s("button", {
|
|
449
|
+
class: "nb-board__collapse-btn",
|
|
450
|
+
"aria-label": B(t.id) ? "Expand" : "Collapse"
|
|
451
|
+
}, _(B(t.id) ? "▶" : "▼"), 9, se),
|
|
452
|
+
g(e.$slots, "lane-header", { lane: t }, () => [s("span", ce, _(t.label), 1)]),
|
|
453
|
+
s("span", le, _(Oe(t.id)), 1)
|
|
454
|
+
], 8, oe)) : a("", !0), !t || !B(t.id) ? (p(!0), o(r, { key: 1 }, h(u.columns, (n) => (p(), o("div", {
|
|
455
|
+
key: P(t) + "-" + n.id,
|
|
456
|
+
class: f(["nb-board__cell", { "nb-board__cell--drag-over": Le(t, n.id) }]),
|
|
457
|
+
onDragover: y((e) => Pe(t, n.id), ["prevent"]),
|
|
458
|
+
onDragleave: Fe,
|
|
459
|
+
onDrop: y((e) => Be(t, n.id), ["prevent"])
|
|
460
|
+
}, [s("div", {
|
|
461
|
+
class: "nb-board__cell-items",
|
|
462
|
+
role: "list",
|
|
463
|
+
"aria-label": Ae(t, n)
|
|
464
|
+
}, [(p(!0), o(r, null, h(L(N(t), n.id), (r, i) => (p(), o("div", {
|
|
465
|
+
key: r.id,
|
|
466
|
+
class: f(["nb-board__card", {
|
|
467
|
+
"nb-board__card--lifted": Y.value?.item.id === r.id,
|
|
468
|
+
"nb-board__card--selected": w(r.id),
|
|
469
|
+
"nb-board__card--carried": !!G.value?.group && w(r.id),
|
|
470
|
+
"nb-board__card--drop-before": J(t, n.id) === i,
|
|
471
|
+
"nb-board__card--drop-after": ze(t, n.id, i),
|
|
472
|
+
"nb-board__card--drop-into": Re(t, n.id, r)
|
|
473
|
+
}]),
|
|
474
|
+
role: "listitem",
|
|
475
|
+
tabindex: "0",
|
|
476
|
+
"data-item-id": r.id,
|
|
477
|
+
"aria-selected": u.selectable ? w(r.id) : void 0,
|
|
478
|
+
"aria-label": je(r, t, n),
|
|
479
|
+
"aria-describedby": `${v(A)}-hint`,
|
|
480
|
+
draggable: "true",
|
|
481
|
+
onDragstart: (e) => Me(r, t, n.id),
|
|
482
|
+
onDragover: y((e) => Ne(e, t, n.id, i, r), ["prevent", "stop"]),
|
|
483
|
+
onDragend: Ie,
|
|
484
|
+
onKeydown: (e) => Ve(e, r, t, n.id),
|
|
485
|
+
onClickCapture: (e) => Ee(e, r, t, n.id),
|
|
486
|
+
onBlur: (e) => Ze(r)
|
|
487
|
+
}, [g(e.$slots, "card", {
|
|
488
|
+
item: r,
|
|
489
|
+
column: n,
|
|
490
|
+
lane: t ?? void 0
|
|
491
|
+
})], 42, fe))), 128)), L(N(t), n.id).length === 0 ? (p(), o("div", pe)) : a("", !0)], 8, de), e.$slots["column-footer"] ? (p(), o("div", me, [g(e.$slots, "column-footer", {
|
|
492
|
+
column: n,
|
|
493
|
+
lane: t ?? void 0
|
|
494
|
+
})])) : a("", !0)], 42, ue))), 128)) : a("", !0)], 64))), 128))], 4),
|
|
495
|
+
u.selectable && S.value.length > 0 && e.$slots["batch-actions"] ? (p(), o("div", he, [
|
|
496
|
+
s("span", ge, _(S.value.length) + " selected ", 1),
|
|
497
|
+
s("div", _e, [g(e.$slots, "batch-actions", {
|
|
498
|
+
selected: S.value,
|
|
499
|
+
clear: E
|
|
500
|
+
})]),
|
|
501
|
+
l(n, {
|
|
502
|
+
class: "nb-board__batch-cancel",
|
|
503
|
+
variant: "ghost",
|
|
504
|
+
size: "sm",
|
|
505
|
+
onClick: E
|
|
506
|
+
}, {
|
|
507
|
+
default: ne(() => [...t[0] ||= [c(" Clear selection ", -1)]]),
|
|
508
|
+
_: 1
|
|
509
|
+
})
|
|
510
|
+
])) : a("", !0),
|
|
511
|
+
s("span", {
|
|
512
|
+
id: `${v(A)}-hint`,
|
|
513
|
+
class: "nb-board__sr"
|
|
514
|
+
}, [
|
|
515
|
+
t[1] ||= c(" Press Space or Enter to pick up, arrow keys to move, Space or Enter to drop, Escape to cancel.", -1),
|
|
516
|
+
u.nestable ? (p(), o(r, { key: 0 }, [c(" Shift with Space or Enter drops onto the card below instead, putting this one inside it.")], 64)) : a("", !0),
|
|
517
|
+
u.selectable ? (p(), o(r, { key: 1 }, [c(" X selects the card, or removes it from the selection. Picking up a selected card moves every selected card. Escape clears the selection.")], 64)) : a("", !0)
|
|
518
|
+
], 8, ve),
|
|
519
|
+
s("span", ye, _(U.value), 1)
|
|
520
|
+
], 16));
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
//#endregion
|
|
524
|
+
export { Se as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/useStableId.composable.cjs`),t=require(`./composables/useSurfaceLayer.composable.cjs`),n=require(`./Button-BZn2lmMA.cjs`);let r=require(`vue`);var i=[`draggable`,`onDragstart`,`onDragover`],a={class:`nb-board__col-title`},o={class:`nb-board__col-count`},s=[`onClick`],c=[`aria-label`],l={class:`nb-board__lane-label`},ee={class:`nb-board__lane-count`},u=[`onDragover`,`onDrop`],d=[`aria-label`],te=[`data-item-id`,`aria-selected`,`aria-label`,`aria-describedby`,`onDragstart`,`onDragover`,`onKeydown`,`onClickCapture`,`onBlur`],ne={key:0,class:`nb-board__empty-cell`,"aria-hidden":`true`},re={key:0,class:`nb-board__cell-footer`},ie={key:0,class:`nb-board__batch`,role:`region`,"aria-label":`Actions for the selected cards`},ae={class:`nb-board__batch-count`},oe={class:`nb-board__batch-actions`},se=[`id`],ce={class:`nb-board__sr`,"aria-live":`assertive`},le=.5,ue=44,f=(0,r.defineComponent)({__name:`Board`,props:{columns:{},items:{},lanes:{default:void 0},reorderableColumns:{type:Boolean,default:!1},nestable:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selected:{default:void 0}},emits:[`move`,`nest`,`column-move`,`move-many`,`update:selected`],setup(f,{emit:p}){let m=f,{layerProps:h}=t.useSurfaceLayer(),g=p,_=(0,r.computed)(()=>m.selectable?m.selected??[]:[]),de=(0,r.computed)(()=>new Set(_.value)),v=null;function y(e){return de.value.has(e)}function b(e){g(`update:selected`,e),z.value=e.length===0?`Selection cleared`:`${e.length} ${e.length===1?`card`:`cards`} selected`}function x(){v=null,b([])}function S(e){v=e,b(y(e)?_.value.filter(t=>t!==e):[..._.value,e])}function fe(e,t,n){let r=M(t,n),i=v?r.findIndex(e=>e.id===v):-1,a=r.findIndex(t=>t.id===e.id);if(i===-1||a===-1)return S(e.id);let o=r.slice(Math.min(i,a),Math.max(i,a)+1).map(e=>e.id);b([...new Set([..._.value,...o])])}function pe(e,t,n,r){m.selectable&&(e.metaKey||e.ctrlKey||e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?fe(t,O(n),r):S(t.id))}function C(){let e=[];for(let t of m.columns)for(let n of D.value)for(let r of M(O(n),t.id))y(r.id)&&!e.includes(r.id)&&e.push(r.id);return e}function w(e,t,n,r,i){let a=new Set(e),o=M(n,r).filter(e=>e.id!==t),s=null;for(let e=Math.min(i,o.length)-1;e>=0;e--)if(!a.has(o[e].id)){s=o[e].id;break}let c=null;for(let e=Math.max(i,0);e<o.length;e++)if(!a.has(o[e].id)){c=o[e].id;break}g(`move-many`,{itemIds:e,toColumnId:r,...m.lanes?{toLaneId:n}:{},beforeItemId:s,afterItemId:c});let l=N(r);z.value=`${e.length} cards moved to ${l?.label??r}`}let T=e.useStableId({}),E=(0,r.ref)(null),me=(0,r.computed)(()=>({gridTemplateColumns:`repeat(${m.columns.length}, var(--nb-board-column-track, minmax(200px, 1fr)))`})),D=(0,r.computed)(()=>m.lanes&&m.lanes.length>0?m.lanes:[null]);function O(e){return e?e.id??null:null}function k(e){return e?j(e.id):`__flat__`}function A(e){return m.items.filter(t=>t.columnId===e).length}function j(e){return e??`__none__`}function he(e){return m.lanes?m.items.filter(t=>(t.laneId??null)===e).length:0}function M(e,t){return!m.lanes||m.lanes.length===0?m.items.filter(e=>e.columnId===t):m.items.filter(n=>n.columnId===t&&(n.laneId??null)===e)}function N(e){return m.columns.find(t=>t.id===e)}let P=(0,r.ref)(new Set);function F(e){let t=j(e),n=new Set(P.value);n.has(t)?n.delete(t):n.add(t),P.value=n}function I(e){return P.value.has(j(e))}function L(e){let t=e.label??e.name??e.title;return typeof t==`string`?t:`Item ${e.id}`}function R(e,t){return e?`${t.label}, ${e.label}`:t.label}function ge(e,t){return R(e,t)}function _e(e,t,n){let r=M(O(t),n.id),i=r.findIndex(t=>t.id===e.id),a=`${L(e)}, ${i+1} of ${r.length} in ${R(t,n)}`;return G.value?.item.id===e.id?`${a}, picked up`:a}let z=(0,r.ref)(``);function B(e,t,n,r){let i=M(t,n).filter(t=>t.id!==e.item.id),a=Math.max(0,Math.min(r,i.length));return e.fromColumnId===n&&e.fromLaneId===t&&a===M(t,n).findIndex(t=>t.id===e.item.id)?!1:(g(`move`,{itemId:e.item.id,fromColumnId:e.fromColumnId,toColumnId:n,fromLaneId:e.fromLaneId,toLaneId:t,toIndex:a,beforeItemId:i[a-1]?.id??null,afterItemId:i[a]?.id??null}),!0)}let V=(0,r.ref)(null),H=(0,r.ref)(null),U=(0,r.ref)(null);function ve(e,t,n){G.value=null;let r=y(e.id)&&_.value.length>1?C():void 0;V.value={item:e,fromLaneId:O(t),fromColumnId:n,group:r},r&&(z.value=`Moving ${r.length} cards`)}function ye(e,t,n,r,i){if(!V.value)return;let a=e.currentTarget.getBoundingClientRect();if(m.nestable&&!V.value.group&&a.height>=ue){let r=(e.clientY-a.top)/a.height,o=(1-le)/2;if(r>o&&r<1-o&&i.id!==V.value.item.id){U.value={laneId:O(t),colId:n,itemId:i.id},H.value=null;return}}U.value=null;let o=e.clientY>=a.top+a.height/2;H.value={laneId:O(t),colId:n,index:r+(o?1:0)}}function be(e,t){if(!V.value)return;let n=O(e);H.value={laneId:n,colId:t,index:M(n,t).length}}function xe(){H.value=null,U.value=null}function Se(){V.value=null,H.value=null,U.value=null}function Ce(e,t){return W(e,t)!==null}function W(e,t){let n=O(e),r=H.value;if(V.value&&r&&r.laneId===n&&r.colId===t)return r.index;let i=G.value;if(i&&i.laneId===n&&i.colId===t){let e=M(n,t).findIndex(e=>e.id===i.item.id);return e!==-1&&e<=i.index?i.index+1:i.index}return null}function we(e,t,n){let r=U.value;return r!==null&&r.laneId===O(e)&&r.colId===t&&r.itemId===n.id}function Te(e,t,n){return n===M(O(e),t).length-1&&W(e,t)===n+1}function Ee(e,t){if(Z.value!==null)return;let n=H.value,r=U.value;H.value=null,U.value=null;let i=V.value;if(V.value=null,!i)return;if(r){g(`nest`,{itemId:i.item.id,ontoItemId:r.itemId,fromColumnId:i.fromColumnId,...m.lanes?{fromLaneId:i.fromLaneId}:{}}),z.value=`${L(i.item)} dropped onto ${L(m.items.find(e=>e.id===r.itemId)??i.item)}`;return}let a=O(e),o=M(a,t),s=n&&n.laneId===a&&n.colId===t?n.index:o.length,c=o.findIndex(e=>e.id===i.item.id),l=c!==-1&&c<s?s-1:s;if(i.group){w(i.group,i.item.id,a,t,l);return}B(i,a,t,l)}let G=(0,r.ref)(null);function De(e,t,n,r){let i=O(n);if(m.selectable&&(e.key===`x`||e.key===`X`)&&!G.value){e.preventDefault(),S(t.id);return}if(e.key===`Escape`){if(!G.value){m.selectable&&_.value.length>0&&(e.preventDefault(),x());return}e.preventDefault(),G.value=null,z.value=`Move cancelled`;return}if(e.key===` `||e.key===`Enter`){if(e.preventDefault(),G.value?.item.id!==t.id){Oe(t,i,r);return}if(m.nestable&&e.shiftKey&&q()){J();return}je();return}[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),G.value?.item.id===t.id?Ae(e.key):Me(e.key,t,i,r))}function Oe(e,t,n){G.value={item:e,fromLaneId:t,fromColumnId:n,laneId:t,colId:n,index:M(t,n).findIndex(t=>t.id===e.id)},z.value=`${L(e)} picked up, ${K()}`}function K(){let e=G.value;if(!e)return``;let t=M(e.laneId,e.colId).filter(t=>t.id!==e.item.id),n=N(e.colId),r=m.lanes?.find(t=>(t.id??null)===e.laneId)??null,i=n?R(r,n):e.colId;return`position ${e.index+1} of ${t.length+1} in ${i}`}function ke(){return!m.lanes||m.lanes.length===0?[null]:m.lanes.filter(e=>!I(e.id)).map(e=>e.id??null)}function Ae(e){let t=G.value;if(!t)return;let n=M(t.laneId,t.colId).filter(e=>e.id!==t.item.id);if(e===`ArrowUp`||e===`ArrowDown`){let r=e===`ArrowUp`?-1:1,i=t.index+r;if(i>=0&&i<=n.length)t.index=i;else{let e=ke(),n=e.indexOf(t.laneId),i=n+r;if(n===-1||i<0||i>=e.length)return;let a=e[i];t.laneId=a,t.index=r===1?0:M(a,t.colId).filter(e=>e.id!==t.item.id).length}}else{let n=e===`ArrowLeft`?-1:1,r=m.columns.findIndex(e=>e.id===t.colId),i=m.columns[r+n];if(r===-1||!i)return;t.colId=i.id;let a=M(t.laneId,t.colId).filter(e=>e.id!==t.item.id);t.index=Math.min(t.index,a.length)}z.value=`${L(t.item)}, ${K()}`}function q(){let e=G.value;if(!e)return null;let t=M(e.laneId,e.colId).filter(t=>t.id!==e.item.id);return t.length===0?null:t[Math.min(e.index,t.length-1)]??null}function J(){let e=G.value,t=q();!e||!t||(G.value=null,g(`nest`,{itemId:e.item.id,ontoItemId:t.id,fromColumnId:e.fromColumnId,...m.lanes?{fromLaneId:e.fromLaneId}:{}}),z.value=`${L(e.item)} dropped onto ${L(t)}`)}function je(){let e=G.value;if(!e)return;if(G.value=null,y(e.item.id)&&_.value.length>1){w(C(),e.item.id,e.laneId,e.colId,e.index),X(e.item.id);return}let t=B({item:e.item,fromLaneId:e.fromLaneId,fromColumnId:e.fromColumnId},e.laneId,e.colId,e.index),n=N(e.colId),r=m.lanes?.find(t=>(t.id??null)===e.laneId)??null,i=n?R(r,n):e.colId;z.value=t?`${L(e.item)} dropped, position ${e.index+1} in ${i}`:`${L(e.item)} dropped`,X(e.item.id)}function Me(e,t,n,r){let i=M(n,r),a=i.findIndex(e=>e.id===t.id);if(e===`ArrowUp`||e===`ArrowDown`){let t=a+(e===`ArrowDown`?1:-1);t>=0&&t<i.length&&Y(i[t].id)}else{let t=m.columns.findIndex(e=>e.id===r),i=m.columns[t+(e===`ArrowRight`?1:-1)];if(t===-1||!i)return;let o=M(n,i.id);if(o.length===0)return;Y(o[Math.min(a,o.length-1)].id)}}function Y(e){let t=E.value?.querySelectorAll(`[data-item-id]`);if(t){for(let n of t)if(n.dataset.itemId===e){n.focus();return}}}async function X(e){await(0,r.nextTick)(),await(0,r.nextTick)(),Y(e)}function Ne(e){G.value?.item.id===e.id&&(G.value=null)}let Z=(0,r.ref)(null),Q=(0,r.ref)(null);function Pe(e,t){if(!m.reorderableColumns){t.preventDefault();return}Z.value=e,Q.value=e}function Fe(e,t){if(Z.value===null)return;t.preventDefault();let n=t.currentTarget.getBoundingClientRect();Q.value=t.clientX<n.left+n.width/2?e:e+1}function Ie(e){let t=Z.value,n=Q.value;if($(),t===null||n===null)return;e.preventDefault();let r=n>t?n-1:n;r!==t&&g(`column-move`,{columnId:m.columns[t].id,toIndex:r})}function $(){Z.value=null,Q.value=null}return(e,t)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,(0,r.mergeProps)({ref_key:`boardRef`,ref:E,class:`nb-board`},(0,r.unref)(h)),[(0,r.createElementVNode)(`div`,{class:`nb-board__grid`,style:(0,r.normalizeStyle)(me.value)},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(f.columns,(t,n)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{key:t.id,class:(0,r.normalizeClass)([`nb-board__col-header`,{"nb-board__col-header--reorderable":f.reorderableColumns,"nb-board__col-header--dragging":Z.value===n,"nb-board__col-header--drop-before":Q.value===n,"nb-board__col-header--drop-after":Q.value===n+1&&n===f.columns.length-1}]),style:(0,r.normalizeStyle)(t.color?{borderTopColor:t.color}:void 0),draggable:f.reorderableColumns||void 0,onDragstart:e=>Pe(n,e),onDragover:e=>Fe(n,e),onDrop:Ie,onDragend:$},[(0,r.renderSlot)(e.$slots,`column-header`,{column:t,count:A(t.id)},()=>[(0,r.createElementVNode)(`span`,a,(0,r.toDisplayString)(t.label),1),(0,r.createElementVNode)(`span`,o,(0,r.toDisplayString)(A(t.id)),1)])],46,i))),128)),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(D.value,t=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:k(t)},[t?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{key:0,class:`nb-board__lane-header`,onClick:e=>F(t.id)},[(0,r.createElementVNode)(`button`,{class:`nb-board__collapse-btn`,"aria-label":I(t.id)?`Expand`:`Collapse`},(0,r.toDisplayString)(I(t.id)?`▶`:`▼`),9,c),(0,r.renderSlot)(e.$slots,`lane-header`,{lane:t},()=>[(0,r.createElementVNode)(`span`,l,(0,r.toDisplayString)(t.label),1)]),(0,r.createElementVNode)(`span`,ee,(0,r.toDisplayString)(he(t.id)),1)],8,s)):(0,r.createCommentVNode)(``,!0),!t||!I(t.id)?((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,{key:1},(0,r.renderList)(f.columns,n=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{key:k(t)+`-`+n.id,class:(0,r.normalizeClass)([`nb-board__cell`,{"nb-board__cell--drag-over":Ce(t,n.id)}]),onDragover:(0,r.withModifiers)(e=>be(t,n.id),[`prevent`]),onDragleave:xe,onDrop:(0,r.withModifiers)(e=>Ee(t,n.id),[`prevent`])},[(0,r.createElementVNode)(`div`,{class:`nb-board__cell-items`,role:`list`,"aria-label":ge(t,n)},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(M(O(t),n.id),(i,a)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{key:i.id,class:(0,r.normalizeClass)([`nb-board__card`,{"nb-board__card--lifted":G.value?.item.id===i.id,"nb-board__card--selected":y(i.id),"nb-board__card--carried":!!V.value?.group&&y(i.id),"nb-board__card--drop-before":W(t,n.id)===a,"nb-board__card--drop-after":Te(t,n.id,a),"nb-board__card--drop-into":we(t,n.id,i)}]),role:`listitem`,tabindex:`0`,"data-item-id":i.id,"aria-selected":f.selectable?y(i.id):void 0,"aria-label":_e(i,t,n),"aria-describedby":`${(0,r.unref)(T)}-hint`,draggable:`true`,onDragstart:e=>ve(i,t,n.id),onDragover:(0,r.withModifiers)(e=>ye(e,t,n.id,a,i),[`prevent`,`stop`]),onDragend:Se,onKeydown:e=>De(e,i,t,n.id),onClickCapture:e=>pe(e,i,t,n.id),onBlur:e=>Ne(i)},[(0,r.renderSlot)(e.$slots,`card`,{item:i,column:n,lane:t??void 0})],42,te))),128)),M(O(t),n.id).length===0?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,ne)):(0,r.createCommentVNode)(``,!0)],8,d),e.$slots[`column-footer`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,re,[(0,r.renderSlot)(e.$slots,`column-footer`,{column:n,lane:t??void 0})])):(0,r.createCommentVNode)(``,!0)],42,u))),128)):(0,r.createCommentVNode)(``,!0)],64))),128))],4),f.selectable&&_.value.length>0&&e.$slots[`batch-actions`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,ie,[(0,r.createElementVNode)(`span`,ae,(0,r.toDisplayString)(_.value.length)+` selected `,1),(0,r.createElementVNode)(`div`,oe,[(0,r.renderSlot)(e.$slots,`batch-actions`,{selected:_.value,clear:x})]),(0,r.createVNode)(n.t,{class:`nb-board__batch-cancel`,variant:`ghost`,size:`sm`,onClick:x},{default:(0,r.withCtx)(()=>[...t[0]||=[(0,r.createTextVNode)(` Clear selection `,-1)]]),_:1})])):(0,r.createCommentVNode)(``,!0),(0,r.createElementVNode)(`span`,{id:`${(0,r.unref)(T)}-hint`,class:`nb-board__sr`},[t[1]||=(0,r.createTextVNode)(` Press Space or Enter to pick up, arrow keys to move, Space or Enter to drop, Escape to cancel.`,-1),f.nestable?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:0},[(0,r.createTextVNode)(` Shift with Space or Enter drops onto the card below instead, putting this one inside it.`)],64)):(0,r.createCommentVNode)(``,!0),f.selectable?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createTextVNode)(` X selects the card, or removes it from the selection. Picking up a selected card moves every selected card. Escape clears the selection.`)],64)):(0,r.createCommentVNode)(``,!0)],8,se),(0,r.createElementVNode)(`span`,ce,(0,r.toDisplayString)(z.value),1)],16))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|