@shtabapp/ui-kit 1.63.0 → 1.64.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/CHANGELOG.md +14 -2
- package/dist/SColorPicker-BRSi0Xhm.cjs +1 -0
- package/dist/{SColorPicker-BL-zrskU.js → SColorPicker-Djr-R81h.js} +2 -1
- package/dist/SDropdownMenu-2koPU6IG.js +38 -0
- package/dist/SDropdownMenu-k9SxaFVH.cjs +1 -0
- package/dist/SList-D0PDc8VN.cjs +1 -0
- package/dist/SList-D2K9dNsj.js +465 -0
- package/dist/SSelect-CRlkCLik.cjs +1 -0
- package/dist/SSelect-D6taevzT.js +650 -0
- package/dist/STable-NbCfen0n.cjs +1 -0
- package/dist/STable-aS1eGuVB.js +3445 -0
- package/dist/components/SList/SList.vue.d.ts.map +1 -1
- package/dist/components/SList/utils/resolveListItemFields.d.ts +1 -1
- package/dist/components/SList/utils/resolveListItemFields.d.ts.map +1 -1
- package/dist/components/STable/STable.types.d.ts +317 -0
- package/dist/components/STable/STable.types.d.ts.map +1 -0
- package/dist/components/STable/STable.vue.d.ts +154 -0
- package/dist/components/STable/STable.vue.d.ts.map +1 -0
- package/dist/components/STable/constants/tableSizes.d.ts +76 -0
- package/dist/components/STable/constants/tableSizes.d.ts.map +1 -0
- package/dist/components/STable/index.d.ts +4 -0
- package/dist/components/STable/index.d.ts.map +1 -0
- package/dist/components/STable/parts/STableCellText.vue.d.ts +23 -0
- package/dist/components/STable/parts/STableCellText.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STableCheckbox.vue.d.ts +17 -0
- package/dist/components/STable/parts/STableCheckbox.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STableContentRow.vue.d.ts +41 -0
- package/dist/components/STable/parts/STableContentRow.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STableGroupRow.vue.d.ts +55 -0
- package/dist/components/STable/parts/STableGroupRow.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STableHeaderCell.vue.d.ts +36 -0
- package/dist/components/STable/parts/STableHeaderCell.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STableHint.vue.d.ts +7 -0
- package/dist/components/STable/parts/STableHint.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STablePlaceholderRow.vue.d.ts +25 -0
- package/dist/components/STable/parts/STablePlaceholderRow.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STableRow.vue.d.ts +67 -0
- package/dist/components/STable/parts/STableRow.vue.d.ts.map +1 -0
- package/dist/components/STable/parts/STableSkeletonRow.vue.d.ts +27 -0
- package/dist/components/STable/parts/STableSkeletonRow.vue.d.ts.map +1 -0
- package/dist/components/STable/utils/tableDndShared.d.ts +17 -0
- package/dist/components/STable/utils/tableDndShared.d.ts.map +1 -0
- package/dist/components/STable/utils/useFlatTableRows.d.ts +62 -0
- package/dist/components/STable/utils/useFlatTableRows.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableCellPlans.d.ts +48 -0
- package/dist/components/STable/utils/useTableCellPlans.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableColumnDnd.d.ts +28 -0
- package/dist/components/STable/utils/useTableColumnDnd.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableColumnResize.d.ts +24 -0
- package/dist/components/STable/utils/useTableColumnResize.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableColumns.d.ts +86 -0
- package/dist/components/STable/utils/useTableColumns.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableGridFocus.d.ts +79 -0
- package/dist/components/STable/utils/useTableGridFocus.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableGridKeyboard.d.ts +36 -0
- package/dist/components/STable/utils/useTableGridKeyboard.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableRenderEntries.d.ts +56 -0
- package/dist/components/STable/utils/useTableRenderEntries.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableRowDnd.d.ts +37 -0
- package/dist/components/STable/utils/useTableRowDnd.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableRowHydration.d.ts +29 -0
- package/dist/components/STable/utils/useTableRowHydration.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableScrollScale.d.ts +34 -0
- package/dist/components/STable/utils/useTableScrollScale.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableSelection.d.ts +27 -0
- package/dist/components/STable/utils/useTableSelection.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableServiceRows.d.ts +57 -0
- package/dist/components/STable/utils/useTableServiceRows.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableSorting.d.ts +21 -0
- package/dist/components/STable/utils/useTableSorting.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableStickyRows.d.ts +38 -0
- package/dist/components/STable/utils/useTableStickyRows.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableStyleVars.d.ts +22 -0
- package/dist/components/STable/utils/useTableStyleVars.d.ts.map +1 -0
- package/dist/components/STable/utils/useTableVirtualRows.d.ts +56 -0
- package/dist/components/STable/utils/useTableVirtualRows.d.ts.map +1 -0
- package/dist/composables/treeKeyboardNavigation.d.ts +26 -0
- package/dist/composables/treeKeyboardNavigation.d.ts.map +1 -0
- package/dist/composables/useFlatTreeList.d.ts +1 -0
- package/dist/composables/useFlatTreeList.d.ts.map +1 -1
- package/dist/entries/color-picker.cjs +1 -1
- package/dist/entries/color-picker.js +1 -1
- package/dist/entries/list.cjs +1 -1
- package/dist/entries/list.js +1 -1
- package/dist/entries/select.cjs +1 -1
- package/dist/entries/select.js +1 -1
- package/dist/entries/table.cjs +1 -0
- package/dist/entries/table.d.ts +3 -0
- package/dist/entries/table.d.ts.map +1 -0
- package/dist/entries/table.js +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -108
- package/dist/treeKeyboardNavigation-BOz2SVus.cjs +1 -0
- package/dist/treeKeyboardNavigation-SmxTdnDz.js +131 -0
- package/dist/uikit-components.css +1 -1
- package/package.json +14 -3
- package/dist/SColorPicker-CvhpJEj1.cjs +0 -1
- package/dist/SList-C39LrsoS.js +0 -590
- package/dist/SList-Du0gqyFs.cjs +0 -1
- package/dist/SSelect-BkX3VuCr.js +0 -682
- package/dist/SSelect-CHWKMbB_.cjs +0 -1
- package/dist/components/SList/utils/treeKeyboardNavigation.d.ts +0 -16
- package/dist/components/SList/utils/treeKeyboardNavigation.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shtabapp/ui-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.64.0",
|
|
4
4
|
"description": "Vue 3 component library by Shtab — 30+ typed components, design tokens, light/dark themes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shtab",
|
|
@@ -258,6 +258,11 @@
|
|
|
258
258
|
"import": "./dist/entries/separator.js",
|
|
259
259
|
"require": "./dist/entries/separator.cjs"
|
|
260
260
|
},
|
|
261
|
+
"./table": {
|
|
262
|
+
"types": "./dist/entries/table.d.ts",
|
|
263
|
+
"import": "./dist/entries/table.js",
|
|
264
|
+
"require": "./dist/entries/table.cjs"
|
|
265
|
+
},
|
|
261
266
|
"./tokens": {
|
|
262
267
|
"types": "./dist/entries/tokens.d.ts",
|
|
263
268
|
"import": "./dist/entries/tokens.js",
|
|
@@ -269,10 +274,13 @@
|
|
|
269
274
|
"dependencies": {
|
|
270
275
|
"chart.js": "^4.5.0",
|
|
271
276
|
"vue-i18n": "^9.14.5",
|
|
272
|
-
"@shtabapp/ui-kit-primitives": "^1.
|
|
273
|
-
"@shtabapp/ui-kit-tokens": "^1.
|
|
277
|
+
"@shtabapp/ui-kit-primitives": "^1.32.0",
|
|
278
|
+
"@shtabapp/ui-kit-tokens": "^1.20.0"
|
|
274
279
|
},
|
|
275
280
|
"devDependencies": {
|
|
281
|
+
"@atlaskit/pragmatic-drag-and-drop": "^3.0.0",
|
|
282
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.1.0",
|
|
283
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.1.0",
|
|
276
284
|
"@storybook/vue3-vite": "^10.4.1",
|
|
277
285
|
"@tanstack/vue-virtual": "^3.13.25",
|
|
278
286
|
"@vueuse/core": "^14.2.1",
|
|
@@ -282,6 +290,9 @@
|
|
|
282
290
|
"@shtabapp/ui-kit-shared-config": "0.1.0"
|
|
283
291
|
},
|
|
284
292
|
"peerDependencies": {
|
|
293
|
+
"@atlaskit/pragmatic-drag-and-drop": "^3.0.0",
|
|
294
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.1.0",
|
|
295
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.1.0",
|
|
285
296
|
"@tanstack/vue-virtual": "^3.0.0",
|
|
286
297
|
"@vueuse/core": "^14.0.0",
|
|
287
298
|
"chart.js": "^4.4.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./contrastSurfaceTextColor-BRjRzXyZ.cjs"),t=require("./SColorPalette-CqIA4Qtp.cjs"),n=require("./colorValue-Dda7fKd3.cjs"),r=require("./SButton.types-UKroD-ev.cjs"),i=require("./SButton-9dLbCJvh.cjs"),a=require("./useFloatingOverlay-B1UCUYQQ.cjs"),o=require("./SDropdown-LNVnMol3.cjs"),s=require("./SSelect-CHWKMbB_.cjs");let c=require("vue"),l=require("@shtabapp/ui-kit-primitives"),u=require("@vueuse/core");var d=e=>Math.max(0,Math.min(255,Math.round(e))),f=e=>{let t=e%360;return t<0?t+360:t},p=e=>Math.max(0,Math.min(100,Math.round(e))),m=e=>{let t=e.slice(1);if(t.length===3){let e=t[0],n=t[1],r=t[2];return!e||!n||!r?void 0:`${e}${e}${n}${n}${r}${r}`}if(t.length===6||t.length===8)return t.slice(0,6)},h=e=>{let t=m(e);if(!t)return;let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);if(!(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i)))return{first:n,second:r,third:i}},g=e=>{let t=d(e.first),n=d(e.second),r=d(e.third);return`#${t.toString(16).padStart(2,`0`).toUpperCase()}${n.toString(16).padStart(2,`0`).toUpperCase()}${r.toString(16).padStart(2,`0`).toUpperCase()}`},_=e=>{let t=h(e);if(!t)return;let n=t.first/255,r=t.second/255,i=t.third/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=a-o,c=0,l=(a+o)/2;s!==0&&(c=a===n?((r-i)/s+(r<i?6:0))*60:a===r?((i-n)/s+2)*60:((n-r)/s+4)*60);let u=0;return s!==0&&(u=l>.5?s/(2-a-o):s/(a+o)),{first:Math.round(c),second:Math.round(u*100),third:Math.round(l*100)}},v=e=>{let t=f(e.first),n=p(e.second)/100,r=p(e.third)/100,i=e=>{let i=(t+e)/30;return d((r-n*Math.min(r,1-r)*Math.max(-1,Math.min(i%2-1,1)))*255)};return g({first:i(0),second:i(8),third:i(4)})},y=t=>{let n=t.toUpperCase(),r=n.startsWith(`#`)?n.slice(1):n;if(!/^[0-9A-F]{3}$/.test(r)&&!/^[0-9A-F]{6}$/.test(r))return;let i=`#${r}`;if(e.n(i))return g(h(i)??{first:0,second:0,third:0})},b=e=>e.slice(1).toUpperCase(),x=e=>{let t=e.first/255,n=e.second/255,r=e.third/255,i=Math.max(t,n,r),a=i-Math.min(t,n,r),o=0;a!==0&&(o=i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4,o=Math.round(o*60),o<0&&(o+=360));let s=i===0?0:a/i;return{hue:o,saturation:s,value:i}},S=e=>{let t=e.value*e.saturation,n=e.hue/60,r=t*(1-Math.abs(n%2-1)),i=e.value-t,a=0,o=0,s=0;return n>=0&&n<1?(a=t,o=r):n>=1&&n<2?(a=r,o=t):n>=2&&n<3?(o=t,s=r):n>=3&&n<4?(o=r,s=t):n>=4&&n<5?(a=r,s=t):(a=t,s=r),{first:d((a+i)*255),second:d((o+i)*255),third:d((s+i)*255)}},C=e=>{let t=h(e);if(t)return x(t)},w=e=>g(S(e)),T=[t.o.HEX,t.o.RGB,t.o.HSL],E={[t.o.HEX]:`Hex`,[t.o.RGB]:`RGB`,[t.o.HSL]:`HSL`},D=e=>{let t=getComputedStyle(e).backgroundColor.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!t)return;let n=Number.parseInt(t[1]??`0`,10),r=Number.parseInt(t[2]??`0`,10),i=Number.parseInt(t[3]??`0`,10);return`#${n.toString(16).padStart(2,`0`).toUpperCase()}${r.toString(16).padStart(2,`0`).toUpperCase()}${i.toString(16).padStart(2,`0`).toUpperCase()}`},O=(t,r)=>{if(n.n(t)&&e.n(t))return t;if(r)return D(r)},k=(e,n)=>n===t.o.HEX?b(e):n===t.o.RGB?h(e)??{first:0,second:0,third:0}:_(e)??{first:0,second:0,third:0},A=e=>{let t=Number.parseInt(e,10);if(!Number.isNaN(t))return t},j=(e,n)=>{if(e===t.o.HEX)return typeof n==`string`?y(n):void 0;if(typeof n==`string`)return;if(e===t.o.RGB){let e=g({first:A(String(n.first))??0,second:A(String(n.second))??0,third:A(String(n.third))??0});return h(e)?e:void 0}let r=v({first:A(String(n.first))??0,second:A(String(n.second))??0,third:A(String(n.third))??0});if(r&&_(r))return r},M=17,N=`#000000`,P=e=>e??N,F=({modelValue:e,getEditableHex:t,saturationAreaRef:n,hueSliderRef:r,disabled:i,readonly:a})=>{let o=C(P(t()))??{hue:0,saturation:0,value:0},s=(0,c.ref)(o.hue),l=(0,c.ref)(o.saturation),d=(0,c.ref)(o.value),f=(0,c.ref)(!1),p=(0,c.ref)(!1),m=(0,c.ref)(!1),h=(0,c.shallowRef)(null),g=(0,c.shallowRef)(null),_=(0,c.computed)(()=>w({hue:s.value,saturation:l.value,value:d.value})),v=(0,c.computed)(()=>w({hue:s.value,saturation:1,value:1})),y=e=>{s.value=Math.max(0,Math.min(360,e))},b=(e,t)=>{l.value=Math.max(0,Math.min(1,e)),d.value=Math.max(0,Math.min(1,t))},x=e=>{let t=C(P(e));t&&(f.value=!0,t.saturation>0&&(s.value=t.hue),l.value=t.saturation,d.value=t.value,f.value=!1)},S=()=>{let e=t();e&&e.toUpperCase()!==_.value.toUpperCase()&&x(e)},T=()=>{let n=_.value;t()?.toUpperCase()!==n.toUpperCase()&&(f.value=!0,e.value=n,f.value=!1)};(0,c.watch)([s,l,d],()=>{f.value||T()}),(0,c.watch)(e,()=>{f.value||S()}),(0,c.onMounted)(()=>{(0,c.nextTick)(()=>{E(),D(),S()})});let E=()=>{h.value=n.value?.getBoundingClientRect()??null},D=()=>{g.value=r.value?.getBoundingClientRect()??null},O=(0,c.computed)(()=>{let e=h.value;return e?{transform:`translate3d(calc(${l.value*e.width}px - 50%), calc(${(1-d.value)*e.height}px - 50%), 0)`}:{}}),k=(0,c.computed)(()=>{let e=g.value;return e?{transform:`translate3d(-50%, calc(${s.value/360*e.height}px - 50%), 0)`}:{}}),A=()=>!i.value&&!a.value,j=e=>{let t=h.value;if(!t)return;let n=Math.max(0,Math.min(e.clientX-t.left,t.width)),r=Math.max(0,Math.min(e.clientY-t.top,t.height));b(n/t.width,1-r/t.height)},M=e=>{let t=g.value;t&&y(Math.max(0,Math.min(e.clientY-t.top,t.height))/t.height*360)},N=e=>{A()&&(E(),p.value=!0,j(e),e.currentTarget instanceof HTMLElement&&e.currentTarget.setPointerCapture(e.pointerId))},F=e=>{A()&&(D(),m.value=!0,M(e),e.currentTarget instanceof HTMLElement&&e.currentTarget.setPointerCapture(e.pointerId))},I=()=>{p.value=!1},L=()=>{m.value=!1};return(0,u.useEventListener)(n,`pointermove`,e=>{p.value&&j(e)}),(0,u.useEventListener)(n,`pointerup`,I),(0,u.useEventListener)(n,`pointercancel`,I),(0,u.useEventListener)(n,`lostpointercapture`,I),(0,u.useEventListener)(r,`pointermove`,e=>{m.value&&M(e)}),(0,u.useEventListener)(r,`pointerup`,L),(0,u.useEventListener)(r,`pointercancel`,L),(0,u.useEventListener)(r,`lostpointercapture`,L),{hexColor:_,hueBackground:v,saturationPointerStyle:O,huePointerStyle:k,handleSaturationPointerDown:N,handleHuePointerDown:F,syncFromModelValue:S}},I=e=>{if(!e)return null;let t=e.$el;if(!(t instanceof HTMLElement))return null;let n=t.querySelector(`.s-ui-color-swatch__fill`);return n instanceof HTMLElement?n:null},L={class:`s-ui-color-area__canvas-row`},R=[`aria-label`],z=[`aria-label`,`aria-disabled`],B=(0,c.defineComponent)({__name:`SColorArea`,props:(0,c.mergeModels)({disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=(0,c.useModel)(e,`modelValue`),{t:r}=(0,l.useUiKitI18n)(),i=(0,c.useTemplateRef)(`colorResolutionSwatchRef`),a=(0,c.useTemplateRef)(`saturationAreaRef`),o=(0,c.useTemplateRef)(`hueSliderRef`),s=()=>O(t.value,I(i.value)),u=(0,c.computed)(()=>n.a(t.value)),{hexColor:d,hueBackground:f,saturationPointerStyle:p,huePointerStyle:m,handleSaturationPointerDown:h,handleHuePointerDown:g}=F({modelValue:t,getEditableHex:s,saturationAreaRef:a,hueSliderRef:o,disabled:(0,c.toRef)(()=>e.disabled),readonly:(0,c.toRef)(()=>e.readonly)});return(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({class:[`s-ui-color-area`,{"s-ui-color-area--disabled":e.disabled,"s-ui-color-area--readonly":e.readonly}]},t.$attrs),[(0,c.createVNode)((0,c.unref)(l.SColorSwatch),{ref_key:`colorResolutionSwatchRef`,ref:i,class:`s-ui-color-area__color-resolution`,color:u.value,size:(0,c.unref)(l.ESColorSwatchSize).SIZE_24,tabindex:`-1`,"aria-hidden":`true`},null,8,[`color`,`size`]),(0,c.createElementVNode)(`div`,L,[(0,c.createElementVNode)(`div`,{ref_key:`saturationAreaRef`,ref:a,class:`s-ui-color-area__canvas`,role:`img`,"aria-label":(0,c.unref)(r)(`colorArea.saturationBrightness`),style:(0,c.normalizeStyle)({"--s-ui-color-area-hue":(0,c.unref)(f)}),onPointerdown:n[0]||=(...e)=>(0,c.unref)(h)&&(0,c.unref)(h)(...e)},[(0,c.createElementVNode)(`div`,{class:`s-ui-color-area__canvas-pointer`,style:(0,c.normalizeStyle)({...(0,c.unref)(p),backgroundColor:(0,c.unref)(d)})},null,4)],44,R),(0,c.createElementVNode)(`div`,{ref_key:`hueSliderRef`,ref:o,class:`s-ui-color-area__hue`,role:`slider`,"aria-label":(0,c.unref)(r)(`colorArea.hue`),"aria-valuemin":`0`,"aria-valuemax":`360`,"aria-disabled":e.disabled||e.readonly,onPointerdown:n[1]||=(...e)=>(0,c.unref)(g)&&(0,c.unref)(g)(...e)},[(0,c.createElementVNode)(`div`,{class:`s-ui-color-area__hue-pointer`,style:(0,c.normalizeStyle)({...(0,c.unref)(m),backgroundColor:(0,c.unref)(f)})},null,4)],40,z)])],16))}}),V={class:`s-ui-color-values__left`},H={class:`s-ui-color-values__format`},U={class:`s-ui-color-values__value-group`},W={class:`s-ui-color-values__inputs`},G={key:0,class:`s-ui-color-values__input-wrap`},K=[`disabled`,`readonly`,`aria-label`],q={class:`s-ui-color-values__input-wrap`},J=[`disabled`,`readonly`,`aria-label`],Y={class:`s-ui-color-values__input-wrap`},X=[`disabled`,`readonly`,`aria-label`],Z={class:`s-ui-color-values__input-wrap`},Q=[`disabled`,`readonly`,`aria-label`],$=(0,c.defineComponent)({__name:`SColorValues`,props:(0,c.mergeModels)({disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},formats:{default:()=>T}},{modelValue:{required:!0},modelModifiers:{},format:{default:t.o.HEX},formatModifiers:{}}),emits:(0,c.mergeModels)([`formatDropdownOpen`,`formatDropdownClose`],[`update:modelValue`,`update:format`]),setup(e,{emit:a}){let{t:o}=(0,l.useUiKitI18n)(),u=(0,c.useModel)(e,`modelValue`),d=(0,c.useModel)(e,`format`),f=a,p=(0,c.useTemplateRef)(`previewSwatchRef`),m=(0,c.ref)(``),h=(0,c.ref)(`0`),g=(0,c.ref)(`0`),_=(0,c.ref)(`0`),v=(0,c.computed)(()=>(e.formats.length>0?e.formats:T).map(e=>({value:e,label:E[e]}))),y=(0,c.computed)(()=>n.a(u.value)),b=(0,c.computed)(()=>O(u.value,I(p.value))),x=(0,c.computed)(()=>d.value===t.o.RGB?o(`colorValues.redChannel`):o(`colorValues.hueChannel`)),S=(0,c.computed)(()=>d.value===t.o.RGB?o(`colorValues.greenChannel`):o(`colorValues.saturationChannel`)),C=(0,c.computed)(()=>d.value===t.o.RGB?o(`colorValues.blueChannel`):o(`colorValues.lightnessChannel`)),w=()=>{let e=b.value;if(!e)return;let n=k(e,d.value);if(d.value===t.o.HEX&&typeof n==`string`){m.value=n;return}typeof n==`object`&&(h.value=String(n.first),g.value=String(n.second),_.value=String(n.third))};(0,c.watch)([u,d,b],()=>{w()}),(0,c.onMounted)(()=>{(0,c.nextTick)(()=>{w()})});let D=()=>{if(e.disabled||e.readonly)return;if(d.value===t.o.HEX){let e=j(t.o.HEX,m.value);e&&(u.value=e),w();return}let n=j(d.value,{first:Number.parseInt(h.value,10),second:Number.parseInt(g.value,10),third:Number.parseInt(_.value,10)});n&&(u.value=n),w()},A=e=>{e.key===`Enter`&&(e.preventDefault(),D())};return(n,a)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({class:[`s-ui-color-values`,{"s-ui-color-values--disabled":e.disabled,"s-ui-color-values--readonly":e.readonly}]},n.$attrs),[(0,c.createElementVNode)(`div`,V,[(0,c.createVNode)((0,c.unref)(l.SColorSwatch),{ref_key:`previewSwatchRef`,ref:p,class:`s-ui-color-values__preview`,color:y.value,size:(0,c.unref)(l.ESColorSwatchSize).SIZE_32,disabled:e.disabled,tabindex:`-1`,"aria-hidden":`true`},null,8,[`color`,`size`,`disabled`]),(0,c.createElementVNode)(`div`,H,[(0,c.createVNode)((0,c.unref)(s.t),{modelValue:d.value,"onUpdate:modelValue":a[0]||=e=>d.value=e,class:`s-ui-color-values__format-select`,options:v.value,disabled:e.disabled,readonly:e.readonly,bordered:!0,clearable:!1,"close-on-select":!0,"fit-viewport":!1,"aria-label":(0,c.unref)(o)(`colorValues.format`),onOpen:a[1]||=e=>f(`formatDropdownOpen`),onClose:a[2]||=e=>f(`formatDropdownClose`)},null,8,[`modelValue`,`options`,`disabled`,`readonly`,`aria-label`])])]),(0,c.createElementVNode)(`div`,U,[(0,c.createVNode)((0,c.unref)(i.t),{class:`s-ui-color-values__pipette`,appearance:(0,c.unref)(r.t).BARE,variant:(0,c.unref)(r.r).NEUTRAL,size:(0,c.unref)(r.n).SMALL,icon:`pipette`,"aria-label":(0,c.unref)(o)(`colorValues.pickColor`),"aria-disabled":`true`,disabled:e.disabled,tabindex:`-1`},null,8,[`appearance`,`variant`,`size`,`aria-label`,`disabled`]),a[9]||=(0,c.createElementVNode)(`span`,{class:`s-ui-color-values__separator`,"aria-hidden":`true`},null,-1),(0,c.createElementVNode)(`div`,W,[d.value===(0,c.unref)(t.o).HEX?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,G,[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{"onUpdate:modelValue":a[3]||=e=>m.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`text`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":(0,c.unref)(o)(`colorValues.hexValue`),onBlur:D,onKeydown:A},null,40,K),[[c.vModelText,m.value]])])):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[(0,c.createElementVNode)(`div`,q,[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{"onUpdate:modelValue":a[4]||=e=>h.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`numeric`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":x.value,onBlur:D,onKeydown:A},null,40,J),[[c.vModelText,h.value]])]),a[7]||=(0,c.createElementVNode)(`span`,{class:`s-ui-color-values__separator`,"aria-hidden":`true`},null,-1),(0,c.createElementVNode)(`div`,Y,[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{"onUpdate:modelValue":a[5]||=e=>g.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`numeric`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":S.value,onBlur:D,onKeydown:A},null,40,X),[[c.vModelText,g.value]])]),a[8]||=(0,c.createElementVNode)(`span`,{class:`s-ui-color-values__separator`,"aria-hidden":`true`},null,-1),(0,c.createElementVNode)(`div`,Z,[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{"onUpdate:modelValue":a[6]||=e=>_.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`numeric`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":C.value,onBlur:D,onKeydown:A},null,40,Q),[[c.vModelText,_.value]])])],64))])])],16))}}),ee={class:`s-ui-color-picker__section`},te={class:`s-ui-color-picker__label`},ne={class:`s-ui-color-picker__section`},re={class:`s-ui-color-picker__label`},ie={class:`s-ui-color-picker__custom-editor`},ae={class:`s-ui-color-picker__custom-actions`},oe=(0,c.defineComponent)({__name:`SColorPicker`,props:(0,c.mergeModels)({disabled:{type:Boolean,default:!1},recommendedColors:{},recentColors:{default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:(0,c.mergeModels)([`select`,`customEditorOpen`,`customEditorClose`,`formatDropdownOpen`,`formatDropdownClose`],[`update:modelValue`]),setup(e,{emit:n}){let u=(0,c.useModel)(e,`modelValue`),d=n,{t:f}=(0,l.useUiKitI18n)(),p=(0,c.ref)(!1),m=(0,c.ref)(`#526DE3`),h=(0,c.ref)(t.o.HEX),g=(0,c.computed)(()=>e.recommendedColors&&e.recommendedColors.length>0?e.recommendedColors:t.r),_=(0,c.computed)(()=>e.recentColors.length<=17?e.recentColors:e.recentColors.slice(0,17)),v=()=>{if(u.value){m.value=u.value;return}m.value=`#526DE3`},y=e=>{d(`select`,e)},b=()=>{u.value=m.value,d(`select`,m.value),p.value=!1},x=()=>{p.value=!1};return(0,c.watch)(p,(e,t)=>{if(e&&!t){v(),d(`customEditorOpen`);return}!e&&t&&d(`customEditorClose`)}),(n,v)=>((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(s.r),(0,c.mergeProps)({width:336},n.$attrs),{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`s-ui-color-picker`,{"s-ui-color-picker--disabled":e.disabled}])},[(0,c.createElementVNode)(`section`,ee,[(0,c.createElementVNode)(`span`,te,(0,c.toDisplayString)((0,c.unref)(f)(`colorPicker.recommendedColors`)),1),(0,c.createVNode)((0,c.unref)(t.t),{modelValue:u.value,"onUpdate:modelValue":v[0]||=e=>u.value=e,class:`s-ui-color-picker__palette`,layout:(0,c.unref)(t.n).GRID,colors:g.value,size:(0,c.unref)(l.ESColorSwatchSize).SIZE_32,disabled:e.disabled,onSelect:y},null,8,[`modelValue`,`layout`,`colors`,`size`,`disabled`])]),(0,c.createElementVNode)(`section`,ne,[(0,c.createElementVNode)(`span`,re,(0,c.toDisplayString)((0,c.unref)(f)(`colorPicker.recentColors`)),1),(0,c.createVNode)((0,c.unref)(t.t),{modelValue:u.value,"onUpdate:modelValue":v[7]||=e=>u.value=e,class:`s-ui-color-picker__palette`,layout:(0,c.unref)(t.n).ROW,colors:_.value,size:(0,c.unref)(l.ESColorSwatchSize).SIZE_32,disabled:e.disabled,onSelect:y},{append:(0,c.withCtx)(()=>[(0,c.createVNode)((0,c.unref)(o.t),{modelValue:p.value,"onUpdate:modelValue":v[6]||=e=>p.value=e,placement:(0,c.unref)(a.i).RIGHT_START,offset:8,shift:!0,flip:!0,disabled:e.disabled,"dismiss-on-click-outside":!0,"dismiss-on-escape":!0},{trigger:(0,c.withCtx)(({toggle:t,triggerProps:n})=>[(0,c.createVNode)((0,c.unref)(i.t),(0,c.mergeProps)(n,{class:`s-ui-color-picker__add-button`,appearance:(0,c.unref)(r.t).OUTLINED,variant:(0,c.unref)(r.r).NEUTRAL,size:(0,c.unref)(r.n).SMALL,icon:`plus`,"aria-label":(0,c.unref)(f)(`colorPicker.addCustomColor`),disabled:e.disabled,onClick:t}),null,16,[`appearance`,`variant`,`size`,`aria-label`,`disabled`,`onClick`])]),content:(0,c.withCtx)(()=>[(0,c.createVNode)((0,c.unref)(s.r),{width:320},{footer:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`div`,ae,[(0,c.createVNode)((0,c.unref)(i.t),{class:`s-ui-color-picker__save-button`,appearance:(0,c.unref)(r.t).MAJOR,variant:(0,c.unref)(r.r).MAIN,size:(0,c.unref)(r.n).SMALL,disabled:e.disabled,onClick:b},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)((0,c.unref)(f)(`colorPicker.save`)),1)]),_:1},8,[`appearance`,`variant`,`size`,`disabled`]),(0,c.createVNode)((0,c.unref)(i.t),{class:`s-ui-color-picker__cancel-button`,appearance:(0,c.unref)(r.t).MINOR,variant:(0,c.unref)(r.r).NEUTRAL,size:(0,c.unref)(r.n).SMALL,disabled:e.disabled,onClick:x},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)((0,c.unref)(f)(`colorPicker.cancel`)),1)]),_:1},8,[`appearance`,`variant`,`size`,`disabled`])])]),default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`div`,ie,[(0,c.createVNode)(B,{modelValue:m.value,"onUpdate:modelValue":v[1]||=e=>m.value=e,disabled:e.disabled},null,8,[`modelValue`,`disabled`]),(0,c.createVNode)($,{modelValue:m.value,"onUpdate:modelValue":v[2]||=e=>m.value=e,format:h.value,"onUpdate:format":v[3]||=e=>h.value=e,disabled:e.disabled,onFormatDropdownOpen:v[4]||=e=>d(`formatDropdownOpen`),onFormatDropdownClose:v[5]||=e=>d(`formatDropdownClose`)},null,8,[`modelValue`,`format`,`disabled`])])]),_:1})]),_:1},8,[`modelValue`,`placement`,`disabled`])]),_:1},8,[`modelValue`,`layout`,`colors`,`size`,`disabled`])])],2)]),_:1},16))}});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return oe}});
|
package/dist/SList-C39LrsoS.js
DELETED
|
@@ -1,590 +0,0 @@
|
|
|
1
|
-
import { n as e, o as t, r as n, t as r } from "./useSelectionGroup-BCAmPf3R.js";
|
|
2
|
-
import { r as i, t as a } from "./SListItem-C1IeCv8M.js";
|
|
3
|
-
import { Fragment as o, computed as s, createBlock as c, createElementBlock as l, createElementVNode as u, createSlots as d, createVNode as f, defineComponent as p, mergeModels as m, mergeProps as h, nextTick as ee, normalizeClass as g, normalizeStyle as _, openBlock as v, provide as te, renderList as ne, renderSlot as y, toValue as b, unref as x, useId as re, useModel as S, useSlots as ie, useTemplateRef as ae, withCtx as C } from "vue";
|
|
4
|
-
import { ESIconName as w, SSpinner as T, useUiKitI18n as oe } from "@shtabapp/ui-kit-primitives";
|
|
5
|
-
import { useInfiniteScroll as E } from "@vueuse/core";
|
|
6
|
-
import { useVirtualizer as se } from "@tanstack/vue-virtual";
|
|
7
|
-
//#region src/composables/useFlatTreeList.ts
|
|
8
|
-
var D = (e, t) => {
|
|
9
|
-
if (typeof t == "function") return t(e);
|
|
10
|
-
let n = e[t];
|
|
11
|
-
return typeof n == "string" ? n : typeof n == "number" ? String(n) : "";
|
|
12
|
-
}, O = (e, t) => {
|
|
13
|
-
let n = e[t];
|
|
14
|
-
return Array.isArray(n) ? n.filter((e) => typeof e == "object" && !!e) : [];
|
|
15
|
-
}, k = (e, t) => {
|
|
16
|
-
if (!t) return !1;
|
|
17
|
-
let n = e[t];
|
|
18
|
-
return typeof n == "boolean" ? n : !1;
|
|
19
|
-
}, ce = "__s-ui-load-more:", A = (e) => `${ce}${e}`, j = "__s-ui-list-divider__", M = () => Object.create(null), N = (e) => e === void 0 ? /* @__PURE__ */ new Set() : typeof e == "string" ? new Set([e]) : new Set(e), P = (e, t, n, r) => {
|
|
20
|
-
O(e, n).forEach((e) => {
|
|
21
|
-
let i = D(e, t);
|
|
22
|
-
i && r.add(i), P(e, t, n, r);
|
|
23
|
-
});
|
|
24
|
-
}, F = (e, t, n, r) => {
|
|
25
|
-
for (let i of e) {
|
|
26
|
-
if (D(i, n) === t) return i;
|
|
27
|
-
let e = F(O(i, r), t, n, r);
|
|
28
|
-
if (e) return e;
|
|
29
|
-
}
|
|
30
|
-
}, I = (e, t, n, r, i, a, o, s) => {
|
|
31
|
-
e.forEach((e) => {
|
|
32
|
-
let c = D(e, t);
|
|
33
|
-
if (!c) return;
|
|
34
|
-
let l = O(e, n), u = l.length > 0, d = r.includes(c);
|
|
35
|
-
o.push({
|
|
36
|
-
key: c,
|
|
37
|
-
item: e,
|
|
38
|
-
depth: i,
|
|
39
|
-
flatIndex: o.length,
|
|
40
|
-
hasChildren: u,
|
|
41
|
-
expanded: d,
|
|
42
|
-
parentKey: a
|
|
43
|
-
}), u && d && I(l, t, n, r, i + 1, c, o, s), u && d && k(e, s) && o.push({
|
|
44
|
-
key: A(c),
|
|
45
|
-
item: e,
|
|
46
|
-
depth: i + 1,
|
|
47
|
-
flatIndex: o.length,
|
|
48
|
-
hasChildren: !1,
|
|
49
|
-
expanded: !1,
|
|
50
|
-
parentKey: c,
|
|
51
|
-
loadMoreForKey: c
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}, le = (e, t, n, r) => {
|
|
55
|
-
let i = N(r);
|
|
56
|
-
if (i.size === 0) return;
|
|
57
|
-
let a = [], o = [];
|
|
58
|
-
for (let r of e) {
|
|
59
|
-
if (O(r, n).length > 0) return;
|
|
60
|
-
i.has(D(r, t)) ? a.push(r) : o.push(r);
|
|
61
|
-
}
|
|
62
|
-
if (!(a.length === 0 || o.length === 0)) return {
|
|
63
|
-
selectedItems: a,
|
|
64
|
-
restItems: o
|
|
65
|
-
};
|
|
66
|
-
}, ue = ({ items: e, childrenKey: t, itemKey: n, expanded: r, hasMoreChildrenKey: i, selectedOnTop: a, selectedKeys: o }) => ({
|
|
67
|
-
flatRows: s(() => {
|
|
68
|
-
let s = [], c = b(e), l = b(t), u = b(n), d = b(i), f = b(a) ? le(c, u, l, b(o)) : void 0;
|
|
69
|
-
return f ? (I(f.selectedItems, u, l, r.value, 0, void 0, s, d), s.push({
|
|
70
|
-
key: j,
|
|
71
|
-
item: M(),
|
|
72
|
-
depth: 0,
|
|
73
|
-
flatIndex: s.length,
|
|
74
|
-
hasChildren: !1,
|
|
75
|
-
expanded: !1,
|
|
76
|
-
divider: !0
|
|
77
|
-
}), I(f.restItems, u, l, r.value, 0, void 0, s, d), s) : (I(c, u, l, r.value, 0, void 0, s, d), s);
|
|
78
|
-
}),
|
|
79
|
-
toggleExpanded: (i) => {
|
|
80
|
-
let a = b(e), o = b(t), s = b(n), c = new Set(r.value);
|
|
81
|
-
if (c.has(i)) {
|
|
82
|
-
c.delete(i);
|
|
83
|
-
let e = F(a, i, s, o);
|
|
84
|
-
if (e) {
|
|
85
|
-
let t = /* @__PURE__ */ new Set();
|
|
86
|
-
P(e, s, o, t), t.forEach((e) => {
|
|
87
|
-
c.delete(e);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
} else c.add(i);
|
|
91
|
-
r.value = [...c];
|
|
92
|
-
},
|
|
93
|
-
isExpanded: (e) => r.value.includes(e)
|
|
94
|
-
}), de = (e, t) => E(e, () => {
|
|
95
|
-
t.onEndReached();
|
|
96
|
-
}, {
|
|
97
|
-
distance: b(t.distance),
|
|
98
|
-
canLoadMore: () => t.canLoadMore === void 0 ? !0 : b(t.canLoadMore),
|
|
99
|
-
direction: "bottom"
|
|
100
|
-
}), L = /* @__PURE__ */ function(e) {
|
|
101
|
-
return e.NONE = "none", e.TWO_X_SMALL = "2x-small", e.X_SMALL = "x-small", e.SMALL = "small", e.MEDIUM = "medium", e.X_MEDIUM = "x-medium", e.LARGE = "large", e.X_LARGE = "x-large", e.TWO_X_LARGE = "2x-large", e;
|
|
102
|
-
}({}), R = L.TWO_X_SMALL, fe = {
|
|
103
|
-
[L.NONE]: "var(--s-ui-space-gap-none)",
|
|
104
|
-
[L.TWO_X_SMALL]: "var(--s-ui-space-gap-2x-small)",
|
|
105
|
-
[L.X_SMALL]: "var(--s-ui-space-gap-x-small)",
|
|
106
|
-
[L.SMALL]: "var(--s-ui-space-gap-small)",
|
|
107
|
-
[L.MEDIUM]: "var(--s-ui-space-gap-medium)",
|
|
108
|
-
[L.X_MEDIUM]: "var(--s-ui-space-gap-x-medium)",
|
|
109
|
-
[L.LARGE]: "var(--s-ui-space-gap-large)",
|
|
110
|
-
[L.X_LARGE]: "var(--s-ui-space-gap-x-large)",
|
|
111
|
-
[L.TWO_X_LARGE]: "var(--s-ui-space-gap-2x-large)"
|
|
112
|
-
}, pe = {
|
|
113
|
-
[L.NONE]: 0,
|
|
114
|
-
[L.TWO_X_SMALL]: 2,
|
|
115
|
-
[L.X_SMALL]: 4,
|
|
116
|
-
[L.SMALL]: 8,
|
|
117
|
-
[L.MEDIUM]: 12,
|
|
118
|
-
[L.X_MEDIUM]: 16,
|
|
119
|
-
[L.LARGE]: 20,
|
|
120
|
-
[L.X_LARGE]: 24,
|
|
121
|
-
[L.TWO_X_LARGE]: 32
|
|
122
|
-
}, me = (e, t) => `s-ui-list-option-${e}-${t}`, z = (e, t) => {
|
|
123
|
-
let n = e[t];
|
|
124
|
-
if (typeof n == "string") return n;
|
|
125
|
-
}, B = (e, t) => {
|
|
126
|
-
let n = e[t];
|
|
127
|
-
return typeof n == "boolean" ? n : !1;
|
|
128
|
-
}, V = (e) => e in w, H = (e, t) => {
|
|
129
|
-
let n = e[t];
|
|
130
|
-
if (typeof n == "string" && n.length > 0 && V(n)) return n;
|
|
131
|
-
}, U = (e, t) => typeof t == "string" && t ? t : Array.isArray(t) && t[0] ? t[0] : e, he = (e) => e.some((e) => e.hasChildren || e.parentKey), W = (e, t, n) => {
|
|
132
|
-
if (!e.hasChildren) return null;
|
|
133
|
-
if (!e.expanded) return {
|
|
134
|
-
type: "expand",
|
|
135
|
-
rowKey: t
|
|
136
|
-
};
|
|
137
|
-
let r = n.find((e) => e.parentKey === t);
|
|
138
|
-
return r ? {
|
|
139
|
-
type: "select",
|
|
140
|
-
rowKey: r.key
|
|
141
|
-
} : null;
|
|
142
|
-
}, G = (e, t) => e.hasChildren && e.expanded ? {
|
|
143
|
-
type: "collapse",
|
|
144
|
-
rowKey: t
|
|
145
|
-
} : e.parentKey ? {
|
|
146
|
-
type: "select",
|
|
147
|
-
rowKey: e.parentKey
|
|
148
|
-
} : null, ge = (e, t, n) => {
|
|
149
|
-
let r = n.find((e) => e.key === t);
|
|
150
|
-
return r ? e === "ArrowRight" ? W(r, t, n) : G(r, t) : null;
|
|
151
|
-
}, K = (e, t, n, r) => {
|
|
152
|
-
for (let i = t; i >= 0 && i < e.length; i += n) {
|
|
153
|
-
let t = e[i];
|
|
154
|
-
if (t && t.depth <= r) return t.key;
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
}, _e = (e, t, n) => {
|
|
158
|
-
let r = n.findIndex((e) => e.key === t);
|
|
159
|
-
if (r === -1) return null;
|
|
160
|
-
let i = n[r];
|
|
161
|
-
if (!i) return null;
|
|
162
|
-
let a = e === "ArrowDown" ? 1 : -1;
|
|
163
|
-
return K(n, r + a, a, i.depth);
|
|
164
|
-
}, ve = ["role", "aria-multiselectable"], ye = [
|
|
165
|
-
"aria-multiselectable",
|
|
166
|
-
"aria-activedescendant",
|
|
167
|
-
"tabindex"
|
|
168
|
-
], be = ["data-index"], xe = {
|
|
169
|
-
key: 0,
|
|
170
|
-
class: "s-ui-list__divider",
|
|
171
|
-
role: "separator"
|
|
172
|
-
}, Se = {
|
|
173
|
-
key: 0,
|
|
174
|
-
class: "s-ui-list__divider",
|
|
175
|
-
role: "separator"
|
|
176
|
-
}, Ce = {
|
|
177
|
-
key: 2,
|
|
178
|
-
class: "s-ui-list__static"
|
|
179
|
-
}, q = /* @__PURE__ */ p({
|
|
180
|
-
__name: "SList",
|
|
181
|
-
props: /*@__PURE__*/ m({
|
|
182
|
-
items: {},
|
|
183
|
-
itemKey: {
|
|
184
|
-
type: [String, Function],
|
|
185
|
-
default: "id"
|
|
186
|
-
},
|
|
187
|
-
childrenKey: { default: "children" },
|
|
188
|
-
titleKey: { default: "title" },
|
|
189
|
-
subtitleKey: { default: "subtitle" },
|
|
190
|
-
iconLeftKey: { default: "iconLeft" },
|
|
191
|
-
disabledKey: { default: "disabled" },
|
|
192
|
-
itemProps: { type: Function },
|
|
193
|
-
selectionMode: { default: () => e.NONE },
|
|
194
|
-
mandatory: {
|
|
195
|
-
type: Boolean,
|
|
196
|
-
default: !1
|
|
197
|
-
},
|
|
198
|
-
virtual: { type: Boolean },
|
|
199
|
-
gap: { default: () => R },
|
|
200
|
-
estimateItemSize: { default: 36 },
|
|
201
|
-
overscan: { default: 5 },
|
|
202
|
-
endReachedDistance: { default: 0 },
|
|
203
|
-
canLoadMore: { type: Function },
|
|
204
|
-
height: { default: 320 },
|
|
205
|
-
maxHeight: {},
|
|
206
|
-
revealRight: {
|
|
207
|
-
type: Boolean,
|
|
208
|
-
default: !1
|
|
209
|
-
},
|
|
210
|
-
expandOnClick: {
|
|
211
|
-
type: Boolean,
|
|
212
|
-
default: !1
|
|
213
|
-
},
|
|
214
|
-
selectedOnTop: {
|
|
215
|
-
type: Boolean,
|
|
216
|
-
default: !1
|
|
217
|
-
},
|
|
218
|
-
hasMoreChildrenKey: {},
|
|
219
|
-
loadingMoreChildrenKeys: { default: () => [] }
|
|
220
|
-
}, {
|
|
221
|
-
modelValue: {},
|
|
222
|
-
modelModifiers: {},
|
|
223
|
-
selected: {},
|
|
224
|
-
selectedModifiers: {},
|
|
225
|
-
expanded: { default: () => [] },
|
|
226
|
-
expandedModifiers: {}
|
|
227
|
-
}),
|
|
228
|
-
emits: /*@__PURE__*/ m([
|
|
229
|
-
"endReached",
|
|
230
|
-
"loadMoreChildren",
|
|
231
|
-
"itemClick"
|
|
232
|
-
], [
|
|
233
|
-
"update:modelValue",
|
|
234
|
-
"update:selected",
|
|
235
|
-
"update:expanded"
|
|
236
|
-
]),
|
|
237
|
-
setup(p, { expose: m, emit: b }) {
|
|
238
|
-
let w = S(p, "modelValue"), E = S(p, "selected"), D = S(p, "expanded"), O = b, k = ie(), ce = re(), A = ae("scrollElementRef"), j = ae("listRootElementRef"), M = s(() => pe[p.gap]), N = s(() => p.items !== void 0), P = s(() => N.value ? p.virtual === void 0 ? !0 : p.virtual : !1), { flatRows: F, toggleExpanded: I } = ue({
|
|
239
|
-
items: () => p.items ?? [],
|
|
240
|
-
childrenKey: () => p.childrenKey,
|
|
241
|
-
itemKey: () => p.itemKey,
|
|
242
|
-
expanded: D,
|
|
243
|
-
hasMoreChildrenKey: () => p.hasMoreChildrenKey,
|
|
244
|
-
selectedOnTop: () => p.selectedOnTop,
|
|
245
|
-
selectedKeys: () => E.value
|
|
246
|
-
}), { t: le } = oe(), L = s(() => new Set(p.loadingMoreChildrenKeys)), R = s(() => le("list.loadMore")), V = (e) => e.loadMoreForKey ? L.value.has(e.loadMoreForKey) : !1, W = (e, t) => {
|
|
247
|
-
L.value.has(e) || O("loadMoreChildren", {
|
|
248
|
-
key: e,
|
|
249
|
-
item: t
|
|
250
|
-
});
|
|
251
|
-
}, G = (e) => {
|
|
252
|
-
e.loadMoreForKey && W(e.loadMoreForKey, e.item);
|
|
253
|
-
}, K = (e) => ({
|
|
254
|
-
parentKey: e.loadMoreForKey ?? "",
|
|
255
|
-
parentItem: e.item,
|
|
256
|
-
depth: e.depth,
|
|
257
|
-
loading: V(e),
|
|
258
|
-
loadMore: () => {
|
|
259
|
-
G(e);
|
|
260
|
-
}
|
|
261
|
-
}), q = se(s(() => ({
|
|
262
|
-
count: F.value.length,
|
|
263
|
-
getScrollElement: () => A.value,
|
|
264
|
-
estimateSize: () => p.estimateItemSize,
|
|
265
|
-
gap: M.value,
|
|
266
|
-
overscan: p.overscan
|
|
267
|
-
}))), we = s(() => {
|
|
268
|
-
if (N.value) return F.value.reduce((e, t) => (t.divider || e.push(t.key), e), []);
|
|
269
|
-
}), Te = s(() => {
|
|
270
|
-
let e = /* @__PURE__ */ new Set();
|
|
271
|
-
for (let t of F.value) !t.loadMoreForKey && B(t.item, p.disabledKey) && e.add(t.key);
|
|
272
|
-
return e;
|
|
273
|
-
}), Ee = async (e) => {
|
|
274
|
-
if (!P.value) return;
|
|
275
|
-
let t = F.value.findIndex((t) => t.key === e);
|
|
276
|
-
t !== -1 && (q.value.scrollToIndex(t, { align: "auto" }), await new Promise((e) => {
|
|
277
|
-
requestAnimationFrame(() => {
|
|
278
|
-
e();
|
|
279
|
-
});
|
|
280
|
-
}), await ee());
|
|
281
|
-
}, De = (e) => me(ce, e), J = t({
|
|
282
|
-
modelValue: () => E.value,
|
|
283
|
-
onUpdateModelValue: (e) => {
|
|
284
|
-
E.value = e;
|
|
285
|
-
},
|
|
286
|
-
mode: () => p.selectionMode,
|
|
287
|
-
mandatory: () => p.mandatory,
|
|
288
|
-
orientation: () => n.VERTICAL,
|
|
289
|
-
enableTabNavigation: !0,
|
|
290
|
-
focusMode: () => P.value ? r.ACTIVE_DESCENDANT : r.DOM,
|
|
291
|
-
orderedValues: we,
|
|
292
|
-
isValueDisabled: (e) => Te.value.has(e),
|
|
293
|
-
onBeforeFocusItem: async (e) => {
|
|
294
|
-
await Ee(e);
|
|
295
|
-
},
|
|
296
|
-
onFocusGroup: () => {
|
|
297
|
-
A.value?.focus();
|
|
298
|
-
}
|
|
299
|
-
}), Oe = s(() => N.value && he(F.value)), Y = () => {
|
|
300
|
-
if (P.value) {
|
|
301
|
-
A.value?.focus();
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
j.value?.focus();
|
|
305
|
-
}, ke = () => {
|
|
306
|
-
J.focusedValue.value = void 0, w.value = void 0;
|
|
307
|
-
let e = document.activeElement;
|
|
308
|
-
e instanceof HTMLElement && e !== A.value && e.blur(), Y();
|
|
309
|
-
}, X = async (e) => {
|
|
310
|
-
P.value && await Ee(e);
|
|
311
|
-
}, Ae = async (e) => {
|
|
312
|
-
if (ke(), e.type === "expand" || e.type === "collapse") {
|
|
313
|
-
I(e.rowKey), J.select(e.rowKey, !1), await X(e.rowKey);
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
J.select(e.rowKey, !1), await X(e.rowKey);
|
|
317
|
-
}, je = async (e, t) => {
|
|
318
|
-
if (!Oe.value || e.key !== "ArrowUp" && e.key !== "ArrowDown") return !1;
|
|
319
|
-
let n = U(t, E.value), r = _e(e.key, n, F.value);
|
|
320
|
-
return r ? (e.preventDefault(), ke(), J.select(r, !1), await X(r), !0) : !1;
|
|
321
|
-
}, Me = async (e, t) => {
|
|
322
|
-
if (!Oe.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return !1;
|
|
323
|
-
let n = U(t, E.value), r = ge(e.key, n, F.value);
|
|
324
|
-
return r ? (e.preventDefault(), await Ae(r), !0) : !1;
|
|
325
|
-
}, Z = () => {
|
|
326
|
-
if (w.value) return w.value;
|
|
327
|
-
let e = U("", E.value);
|
|
328
|
-
if (e) return e;
|
|
329
|
-
let t = we.value;
|
|
330
|
-
if (t) {
|
|
331
|
-
for (let e of t) if (!Te.value.has(e)) return e;
|
|
332
|
-
}
|
|
333
|
-
}, Ne = () => Z(), Pe = async (e) => {
|
|
334
|
-
let t = Ne();
|
|
335
|
-
t && await Q(e, t);
|
|
336
|
-
}, Fe = [
|
|
337
|
-
"Enter",
|
|
338
|
-
" ",
|
|
339
|
-
"Spacebar"
|
|
340
|
-
], Ie = (e, t) => {
|
|
341
|
-
if (!Fe.includes(e.key)) return !1;
|
|
342
|
-
let n = F.value.find((e) => e.key === t);
|
|
343
|
-
return n?.loadMoreForKey ? (e.preventDefault(), W(n.loadMoreForKey, n.item), !0) : !1;
|
|
344
|
-
}, Q = async (e, t) => {
|
|
345
|
-
Ie(e, t) || await je(e, t) || await Me(e, t) || (await J.handleItemKeydown(e, t), w.value = J.focusedValue.value, !J.focusedValue.value && !P.value && Y());
|
|
346
|
-
}, Le = async (e) => {
|
|
347
|
-
let t = Z();
|
|
348
|
-
t && await Q(e, t);
|
|
349
|
-
}, Re = async (e) => {
|
|
350
|
-
if (P.value || e.target !== j.value) return;
|
|
351
|
-
let t = Z();
|
|
352
|
-
t && await Q(e, t);
|
|
353
|
-
}, ze = async () => {
|
|
354
|
-
let e = Z();
|
|
355
|
-
if (!e) {
|
|
356
|
-
Y();
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
await J.focusItem(e, !1);
|
|
360
|
-
};
|
|
361
|
-
te(i, {
|
|
362
|
-
mode: () => p.selectionMode,
|
|
363
|
-
isSelected: J.isSelected,
|
|
364
|
-
selectItem: J.toggle,
|
|
365
|
-
registerItem: J.registerItem,
|
|
366
|
-
getItemTabIndex: J.getItemTabIndex,
|
|
367
|
-
getGroupTabIndex: J.getGroupTabIndex,
|
|
368
|
-
handleItemKeydown: Q,
|
|
369
|
-
activeKey: () => w.value,
|
|
370
|
-
setActiveKey: (e) => {
|
|
371
|
-
w.value = e;
|
|
372
|
-
},
|
|
373
|
-
isExpanded: (e) => D.value.includes(e),
|
|
374
|
-
toggleExpanded: (e) => {
|
|
375
|
-
if (N.value) {
|
|
376
|
-
I(e);
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
let t = new Set(D.value);
|
|
380
|
-
t.has(e) ? t.delete(e) : t.add(e), D.value = [...t];
|
|
381
|
-
},
|
|
382
|
-
revealRight: () => p.revealRight,
|
|
383
|
-
expandOnClick: () => p.expandOnClick,
|
|
384
|
-
getItemOptionId: (e) => {
|
|
385
|
-
if (P.value) return De(e);
|
|
386
|
-
},
|
|
387
|
-
usesActiveDescendantNavigation: () => P.value,
|
|
388
|
-
handlesTreeKeyboardNavigation: () => N.value
|
|
389
|
-
});
|
|
390
|
-
let Be = s(() => q.value.getVirtualItems()), Ve = s(() => Be.value.flatMap((e) => {
|
|
391
|
-
let t = F.value[e.index];
|
|
392
|
-
return t ? [{
|
|
393
|
-
virtualRow: e,
|
|
394
|
-
flatRow: t
|
|
395
|
-
}] : [];
|
|
396
|
-
})), He = s(() => q.value.getTotalSize()), Ue = s(() => ({
|
|
397
|
-
height: `${He.value}px`,
|
|
398
|
-
position: "relative",
|
|
399
|
-
width: "100%"
|
|
400
|
-
})), We = s(() => {
|
|
401
|
-
let e = {};
|
|
402
|
-
return typeof p.height == "number" ? e.height = `${p.height}px` : p.height && (e.height = p.height), p.maxHeight && (typeof p.maxHeight == "number" ? e.maxHeight = `${p.maxHeight}px` : e.maxHeight = p.maxHeight), e;
|
|
403
|
-
}), Ge = s(() => ({
|
|
404
|
-
"s-ui-list--virtual": P.value,
|
|
405
|
-
"s-ui-list--static": !P.value
|
|
406
|
-
})), Ke = s(() => ({ "--s-ui-list-gap": fe[p.gap] })), qe = s(() => ({ "s-ui-list__scroll--flat": N.value && !P.value })), Je = s(() => {
|
|
407
|
-
if (p.selectionMode === e.MULTIPLE) return !0;
|
|
408
|
-
}), Ye = s(() => {
|
|
409
|
-
if (!P.value) return "listbox";
|
|
410
|
-
}), Xe = s(() => {
|
|
411
|
-
if (!P.value) return Je.value;
|
|
412
|
-
}), Ze = s(() => {
|
|
413
|
-
if (P.value) return J.getGroupTabIndex();
|
|
414
|
-
}), Qe = s(() => w.value ? w.value : U("", E.value)), $e = s(() => {
|
|
415
|
-
if (!P.value) return;
|
|
416
|
-
let e = Qe.value;
|
|
417
|
-
if (e) return De(e);
|
|
418
|
-
});
|
|
419
|
-
de(() => A.value, {
|
|
420
|
-
distance: () => p.endReachedDistance,
|
|
421
|
-
canLoadMore: () => p.canLoadMore ? p.canLoadMore() : !0,
|
|
422
|
-
onEndReached: () => {
|
|
423
|
-
O("endReached", { direction: "bottom" });
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
let et = (e) => ({
|
|
427
|
-
position: "absolute",
|
|
428
|
-
top: 0,
|
|
429
|
-
left: 0,
|
|
430
|
-
width: "100%",
|
|
431
|
-
transform: `translateY(${e.start}px)`
|
|
432
|
-
}), tt = (e) => {
|
|
433
|
-
e instanceof HTMLElement && q.value.measureElement(e);
|
|
434
|
-
}, nt = (e) => {
|
|
435
|
-
let t = e.item, n = {
|
|
436
|
-
rowKey: e.key,
|
|
437
|
-
depth: e.depth,
|
|
438
|
-
expandable: e.hasChildren,
|
|
439
|
-
expanded: e.expanded,
|
|
440
|
-
selected: J.isSelected(e.key),
|
|
441
|
-
active: w.value === e.key,
|
|
442
|
-
disabled: B(t, p.disabledKey),
|
|
443
|
-
title: z(t, p.titleKey),
|
|
444
|
-
subtitle: z(t, p.subtitleKey),
|
|
445
|
-
iconLeft: H(t, p.iconLeftKey),
|
|
446
|
-
revealRight: p.revealRight,
|
|
447
|
-
onClick: () => {
|
|
448
|
-
O("itemClick", {
|
|
449
|
-
key: e.key,
|
|
450
|
-
item: e.item
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
return p.itemProps ? {
|
|
455
|
-
...n,
|
|
456
|
-
...p.itemProps(t, e)
|
|
457
|
-
} : n;
|
|
458
|
-
}, $ = (e) => ({
|
|
459
|
-
...e,
|
|
460
|
-
revealRight: p.revealRight,
|
|
461
|
-
toggleExpanded: () => {
|
|
462
|
-
I(e.key);
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
return m({
|
|
466
|
-
focusNavigation: ze,
|
|
467
|
-
handleKeyboardNavigation: Le
|
|
468
|
-
}), (e, t) => (v(), l("div", {
|
|
469
|
-
ref_key: "listRootElementRef",
|
|
470
|
-
ref: j,
|
|
471
|
-
class: g(["s-ui-list", Ge.value]),
|
|
472
|
-
style: _(Ke.value),
|
|
473
|
-
role: Ye.value,
|
|
474
|
-
"aria-multiselectable": Xe.value,
|
|
475
|
-
tabindex: "-1",
|
|
476
|
-
onKeydown: Re
|
|
477
|
-
}, [N.value && P.value ? (v(), l("div", {
|
|
478
|
-
key: 0,
|
|
479
|
-
ref_key: "scrollElementRef",
|
|
480
|
-
ref: A,
|
|
481
|
-
class: g(["s-ui-list__scroll", qe.value]),
|
|
482
|
-
style: _(We.value),
|
|
483
|
-
role: "listbox",
|
|
484
|
-
"aria-multiselectable": Je.value,
|
|
485
|
-
"aria-activedescendant": $e.value,
|
|
486
|
-
tabindex: Ze.value,
|
|
487
|
-
onKeydown: Pe
|
|
488
|
-
}, [u("div", {
|
|
489
|
-
class: "s-ui-list__virtual-panel",
|
|
490
|
-
style: _(Ue.value)
|
|
491
|
-
}, [(v(!0), l(o, null, ne(Ve.value, (t) => (v(), l("div", {
|
|
492
|
-
key: t.virtualRow.index,
|
|
493
|
-
class: "s-ui-list__virtual-row",
|
|
494
|
-
"data-index": t.virtualRow.index,
|
|
495
|
-
ref_for: !0,
|
|
496
|
-
ref: tt,
|
|
497
|
-
style: _(et(t.virtualRow))
|
|
498
|
-
}, [t.flatRow.divider ? (v(), l("div", xe)) : t.flatRow.loadMoreForKey ? (v(), l(o, { key: 1 }, [x(k).loadMore ? y(e.$slots, "loadMore", h({
|
|
499
|
-
key: 0,
|
|
500
|
-
ref_for: !0
|
|
501
|
-
}, K(t.flatRow))) : (v(), c(x(a), {
|
|
502
|
-
key: 1,
|
|
503
|
-
"row-key": t.flatRow.key,
|
|
504
|
-
depth: t.flatRow.depth,
|
|
505
|
-
tiny: "",
|
|
506
|
-
title: R.value,
|
|
507
|
-
onClick: (e) => G(t.flatRow)
|
|
508
|
-
}, d({ _: 2 }, [V(t.flatRow) ? {
|
|
509
|
-
name: "icon-left",
|
|
510
|
-
fn: C(() => [f(x(T), { size: 16 })]),
|
|
511
|
-
key: "0"
|
|
512
|
-
} : void 0]), 1032, [
|
|
513
|
-
"row-key",
|
|
514
|
-
"depth",
|
|
515
|
-
"title",
|
|
516
|
-
"onClick"
|
|
517
|
-
]))], 64)) : (v(), l(o, { key: 2 }, [x(k).item ? y(e.$slots, "item", h({
|
|
518
|
-
key: 0,
|
|
519
|
-
ref_for: !0
|
|
520
|
-
}, $(t.flatRow))) : (v(), c(x(a), h({
|
|
521
|
-
key: 1,
|
|
522
|
-
ref_for: !0
|
|
523
|
-
}, nt(t.flatRow)), d({ _: 2 }, [
|
|
524
|
-
x(k).itemIconLeft ? {
|
|
525
|
-
name: "icon-left",
|
|
526
|
-
fn: C(() => [y(e.$slots, "itemIconLeft", h({ ref_for: !0 }, $(t.flatRow)))]),
|
|
527
|
-
key: "0"
|
|
528
|
-
} : void 0,
|
|
529
|
-
x(k).itemTitle ? {
|
|
530
|
-
name: "title",
|
|
531
|
-
fn: C(() => [y(e.$slots, "itemTitle", h({ ref_for: !0 }, $(t.flatRow)))]),
|
|
532
|
-
key: "1"
|
|
533
|
-
} : void 0,
|
|
534
|
-
x(k).itemSubtitle ? {
|
|
535
|
-
name: "subtitle",
|
|
536
|
-
fn: C(() => [y(e.$slots, "itemSubtitle", h({ ref_for: !0 }, $(t.flatRow)))]),
|
|
537
|
-
key: "2"
|
|
538
|
-
} : void 0
|
|
539
|
-
]), 1040))], 64))], 12, be))), 128))], 4)], 46, ye)) : N.value ? (v(), l("div", {
|
|
540
|
-
key: 1,
|
|
541
|
-
ref_key: "scrollElementRef",
|
|
542
|
-
ref: A,
|
|
543
|
-
class: g(["s-ui-list__scroll", qe.value]),
|
|
544
|
-
style: _(We.value)
|
|
545
|
-
}, [(v(!0), l(o, null, ne(x(F), (t) => (v(), l(o, { key: t.key }, [t.divider ? (v(), l("div", Se)) : t.loadMoreForKey ? (v(), l(o, { key: 1 }, [x(k).loadMore ? y(e.$slots, "loadMore", h({
|
|
546
|
-
key: 0,
|
|
547
|
-
ref_for: !0
|
|
548
|
-
}, K(t))) : (v(), c(x(a), {
|
|
549
|
-
key: 1,
|
|
550
|
-
"row-key": t.key,
|
|
551
|
-
depth: t.depth,
|
|
552
|
-
tiny: "",
|
|
553
|
-
title: R.value,
|
|
554
|
-
onClick: (e) => G(t)
|
|
555
|
-
}, d({ _: 2 }, [V(t) ? {
|
|
556
|
-
name: "icon-left",
|
|
557
|
-
fn: C(() => [f(x(T), { size: 16 })]),
|
|
558
|
-
key: "0"
|
|
559
|
-
} : void 0]), 1032, [
|
|
560
|
-
"row-key",
|
|
561
|
-
"depth",
|
|
562
|
-
"title",
|
|
563
|
-
"onClick"
|
|
564
|
-
]))], 64)) : (v(), l(o, { key: 2 }, [x(k).item ? y(e.$slots, "item", h({
|
|
565
|
-
key: 0,
|
|
566
|
-
ref_for: !0
|
|
567
|
-
}, $(t))) : (v(), c(x(a), h({
|
|
568
|
-
key: 1,
|
|
569
|
-
ref_for: !0
|
|
570
|
-
}, nt(t)), d({ _: 2 }, [
|
|
571
|
-
x(k).itemIconLeft ? {
|
|
572
|
-
name: "icon-left",
|
|
573
|
-
fn: C(() => [y(e.$slots, "itemIconLeft", h({ ref_for: !0 }, $(t)))]),
|
|
574
|
-
key: "0"
|
|
575
|
-
} : void 0,
|
|
576
|
-
x(k).itemTitle ? {
|
|
577
|
-
name: "title",
|
|
578
|
-
fn: C(() => [y(e.$slots, "itemTitle", h({ ref_for: !0 }, $(t)))]),
|
|
579
|
-
key: "1"
|
|
580
|
-
} : void 0,
|
|
581
|
-
x(k).itemSubtitle ? {
|
|
582
|
-
name: "subtitle",
|
|
583
|
-
fn: C(() => [y(e.$slots, "itemSubtitle", h({ ref_for: !0 }, $(t)))]),
|
|
584
|
-
key: "2"
|
|
585
|
-
} : void 0
|
|
586
|
-
]), 1040))], 64))], 64))), 128))], 6)) : (v(), l("div", Ce, [y(e.$slots, "default")]))], 46, ve));
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
//#endregion
|
|
590
|
-
export { L as a, z as i, B as n, de as o, H as r, ue as s, q as t };
|