@aquera/nile-elements 1.7.0 → 1.7.2
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/README.md +6 -0
- package/demo/index.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1401 -424
- package/dist/nile-combobox/index.cjs.js +2 -0
- package/dist/nile-combobox/index.cjs.js.map +1 -0
- package/dist/nile-combobox/index.esm.js +1 -0
- package/dist/nile-combobox/nile-combobox.cjs.js +2 -0
- package/dist/nile-combobox/nile-combobox.cjs.js.map +1 -0
- package/dist/nile-combobox/nile-combobox.css.cjs.js +2 -0
- package/dist/nile-combobox/nile-combobox.css.cjs.js.map +1 -0
- package/dist/nile-combobox/nile-combobox.css.esm.js +642 -0
- package/dist/nile-combobox/nile-combobox.esm.js +233 -0
- package/dist/nile-combobox/portal-manager.cjs.js +2 -0
- package/dist/nile-combobox/portal-manager.cjs.js.map +1 -0
- package/dist/nile-combobox/portal-manager.esm.js +1 -0
- package/dist/nile-combobox/renderer.cjs.js +2 -0
- package/dist/nile-combobox/renderer.cjs.js.map +1 -0
- package/dist/nile-combobox/renderer.esm.js +105 -0
- package/dist/nile-combobox/search-manager.cjs.js +2 -0
- package/dist/nile-combobox/search-manager.cjs.js.map +1 -0
- package/dist/nile-combobox/search-manager.esm.js +1 -0
- package/dist/nile-combobox/selection-manager.cjs.js +2 -0
- package/dist/nile-combobox/selection-manager.cjs.js.map +1 -0
- package/dist/nile-combobox/selection-manager.esm.js +1 -0
- package/dist/nile-combobox/types.cjs.js +2 -0
- package/dist/nile-combobox/types.cjs.js.map +1 -0
- package/dist/nile-combobox/types.esm.js +1 -0
- package/dist/nile-nav-tab/nile-nav-tab.cjs.js +1 -1
- package/dist/nile-nav-tab/nile-nav-tab.cjs.js.map +1 -1
- package/dist/nile-nav-tab/nile-nav-tab.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-combobox/index.d.ts +1 -0
- package/dist/src/nile-combobox/index.js +2 -0
- package/dist/src/nile-combobox/index.js.map +1 -0
- package/dist/src/nile-combobox/nile-combobox.css.d.ts +9 -0
- package/dist/src/nile-combobox/nile-combobox.css.js +651 -0
- package/dist/src/nile-combobox/nile-combobox.css.js.map +1 -0
- package/dist/src/nile-combobox/nile-combobox.d.ts +287 -0
- package/dist/src/nile-combobox/nile-combobox.js +1602 -0
- package/dist/src/nile-combobox/nile-combobox.js.map +1 -0
- package/dist/src/nile-combobox/nile-combobox.test.d.ts +1 -0
- package/dist/src/nile-combobox/nile-combobox.test.js +551 -0
- package/dist/src/nile-combobox/nile-combobox.test.js.map +1 -0
- package/dist/src/nile-combobox/portal-manager.d.ts +26 -0
- package/dist/src/nile-combobox/portal-manager.js +218 -0
- package/dist/src/nile-combobox/portal-manager.js.map +1 -0
- package/dist/src/nile-combobox/renderer.d.ts +20 -0
- package/dist/src/nile-combobox/renderer.js +210 -0
- package/dist/src/nile-combobox/renderer.js.map +1 -0
- package/dist/src/nile-combobox/search-manager.d.ts +15 -0
- package/dist/src/nile-combobox/search-manager.js +41 -0
- package/dist/src/nile-combobox/search-manager.js.map +1 -0
- package/dist/src/nile-combobox/selection-manager.d.ts +12 -0
- package/dist/src/nile-combobox/selection-manager.js +44 -0
- package/dist/src/nile-combobox/selection-manager.js.map +1 -0
- package/dist/src/nile-combobox/types.d.ts +23 -0
- package/dist/src/nile-combobox/types.js +8 -0
- package/dist/src/nile-combobox/types.js.map +1 -0
- package/dist/src/nile-nav-tab/nile-nav-tab.js +1 -1
- package/dist/src/nile-nav-tab/nile-nav-tab.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
- package/rollup.config.js +4 -1
- package/src/index.ts +1 -0
- package/src/nile-combobox/index.ts +1 -0
- package/src/nile-combobox/nile-combobox.css.ts +653 -0
- package/src/nile-combobox/nile-combobox.test.ts +704 -0
- package/src/nile-combobox/nile-combobox.ts +1663 -0
- package/src/nile-combobox/portal-manager.ts +263 -0
- package/src/nile-combobox/renderer.ts +349 -0
- package/src/nile-combobox/search-manager.ts +53 -0
- package/src/nile-combobox/selection-manager.ts +57 -0
- package/src/nile-combobox/types.ts +27 -0
- package/src/nile-nav-tab/nile-nav-tab.ts +1 -1
- package/vscode-html-custom-data.json +306 -4
- package/web-dev-server.config.mjs +9 -0
- package/web-test-runner.config.mjs +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-combobox/renderer.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, type TemplateResult } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { VirtualItem } from '@tanstack/virtual-core';\n\nexport class ComboboxRenderer {\n\n static renderVirtualizedOptions(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n measureElement: (el: Element | null) => void,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const item = data[vItem.index];\n return ComboboxRenderer.renderMeasuredItem(\n item, vItem.index, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, measureElement, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n );\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderPlainOptions(\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && data.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${data.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderNoResults(noResultsMessage: string, noResultsSubtitle?: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-results\" class=\"combobox__no-results\">\n <div part=\"no-results-title\" class=\"combobox__no-results-title\">\n ${noResultsMessage || 'No result found'}\n </div>\n ${noResultsSubtitle\n ? html`<div part=\"no-results-subtitle\" class=\"combobox__no-results-subtitle\">${noResultsSubtitle}</div>`\n : ''}\n </div>\n </div>\n `;\n }\n\n static renderNoData(noDataMessage: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-data\" class=\"combobox__no-results\">\n <div part=\"no-data-title\" class=\"combobox__no-results-title\">\n ${noDataMessage || 'No data available'}\n </div>\n </div>\n </div>\n `;\n }\n\n private static renderMeasuredItem(\n item: any,\n index: number,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n measureElement: (el: Element | null) => void,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n data-index=${index}\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderItem(\n item: any,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderVirtualizedGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridColumns: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n gridColumnWidth?: number,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const colTemplate = gridColumnWidth\n ? `repeat(${gridColumns}, ${gridColumnWidth}px)`\n : `repeat(${gridColumns}, 1fr)`;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const rowStart = vItem.index * gridColumns;\n const rowItems = data.slice(rowStart, rowStart + gridColumns);\n return html`\n <div class=\"combobox__grid-row\" style=\"display:grid;grid-template-columns:${colTemplate};gap:4px;\">\n ${rowItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderHorizontalGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridRows: number,\n gridColumnWidth: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n ): TemplateResult {\n const offsetLeft = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const rowHeight = 38;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options combobox__options--horizontal ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;width:${totalSize}px;height:${rowHeight * gridRows}px;\">\n <div style=\"position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(${offsetLeft}px);\">\n ${repeat(\n virtualItems,\n (vCol) => vCol.key,\n (vCol) => {\n const colStart = vCol.index * gridRows;\n const colItems = data.slice(colStart, colStart + gridRows);\n return html`\n <div class=\"combobox__grid-col\" style=\"width:${gridColumnWidth}px;flex-shrink:0;display:flex;flex-direction:column;\">\n ${colItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderAddCustomOption(\n searchValue: string,\n multiple: boolean,\n ): TemplateResult {\n return html`\n <nile-option\n value=${searchValue}\n class=\"combobox__add-option\"\n .showCheckbox=${multiple}\n >\n + Add \"${searchValue}\"\n </nile-option>\n `;\n }\n\n static shouldUseVirtualizer(data: any[], gridColumns = 1): boolean {\n if (gridColumns > 1) return true;\n return data.length >= 5;\n }\n}\n"],"names":["ComboboxRenderer","renderVirtualizedOptions","virtualItems","totalSize","data","value","multiple","getDisplayText","getItemValue","isLoading","allowHtmlLabel","measureElement","getItemDescription","getItemPrefix","getItemSuffix","enableDescription","offsetTop","length","start","html","_templateObject","_taggedTemplateLiteral","repeat","vItem","key","item","index","renderMeasuredItem","renderPlainOptions","showNoResults","noResultsMessage","onScroll","noResultsSubtitle","renderNoResults","_templateObject2","map","renderItem","_templateObject3","_templateObject4","renderNoData","noDataMessage","_templateObject5","_s$description","_s$prefix","_s$suffix","_templateObject6","optionValue","displayText","isDisabled","disabled","className","description","prefix","suffix","isSelected","Array","isArray","some","v","String","_templateObject7","classMap","option","unsafeHTML","_s$description2","_s$prefix2","_s$suffix2","_templateObject8","_templateObject9","renderVirtualizedGrid","gridColumns","gridColumnWidth","colTemplate","_templateObject10","rowStart","rowItems","slice","_templateObject11","renderHorizontalGrid","gridRows","offsetLeft","_templateObject12","vCol","colStart","colItems","_templateObject13","renderAddCustomOption","searchValue","_templateObject14","shouldUseVirtualizer","arguments","undefined"],"mappings":"6jEAaaA,CAAAA,kCAAAA,EAAAA,EAAAA,eAAAA,MAAAA,CAAAA,UAAAA,YAAAA,CAAAA,CAAAA,QAAAA,GAAAA,4BAAAA,KAAAA,CAEX,iCAAOC,CACLC,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,GAEA,GAAMC,CAAAA,CAAAA,CAAYd,CAAae,CAAAA,MAAAA,CAAS,EAAIf,CAAa,CAAA,CAAA,CAAA,CAAGgB,KAAQ,CAAA,CAAA,CAEpE,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,oVAGoBZ,CAAAA,CAAY,SAAY,CAAA,EAAA,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"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import{html as t}from"lit";import{unsafeHTML as i}from"lit/directives/unsafe-html.js";import{classMap as o}from"lit/directives/class-map.js";import{repeat as s}from"lit/directives/repeat.js";class e{static renderVirtualizedOptions(i,o,r,n,l,a,d,c,p,$,v,b,u,m){const x=i.length>0?i[0].start:0;return t`
|
|
2
|
+
<div
|
|
3
|
+
part="select-options"
|
|
4
|
+
class="combobox__options ${c?"loading":""}"
|
|
5
|
+
>
|
|
6
|
+
<div style="position:relative;height:${o}px;width:100%;">
|
|
7
|
+
<div style="position:absolute;top:0;left:0;width:100%;transform:translateY(${x}px);">
|
|
8
|
+
${s(i,(t=>t.key),(t=>{const i=r[t.index];return e.renderMeasuredItem(i,t.index,n,l,a,d,p,$,v,b,u,m)}))}
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
`}static renderPlainOptions(i,o,s,r,n,l,a,d,c,p,$,v,b,u,m){return l&&!d&&0===i.length?e.renderNoResults(a,m):t`
|
|
13
|
+
<div
|
|
14
|
+
part="select-options"
|
|
15
|
+
class="combobox__options ${d?"loading":""}"
|
|
16
|
+
>
|
|
17
|
+
<div class="combobox__options-plain" @scroll=${c}>
|
|
18
|
+
${i.map((t=>e.renderItem(t,o,s,r,n,p,$,v,b,u)))}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
`}static renderNoResults(i,o){return t`
|
|
22
|
+
<div part="select-options" class="combobox__options">
|
|
23
|
+
<div part="no-results" class="combobox__no-results">
|
|
24
|
+
<div part="no-results-title" class="combobox__no-results-title">
|
|
25
|
+
${i||"No result found"}
|
|
26
|
+
</div>
|
|
27
|
+
${o?t`<div part="no-results-subtitle" class="combobox__no-results-subtitle">${o}</div>`:""}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
`}static renderNoData(i){return t`
|
|
31
|
+
<div part="select-options" class="combobox__options">
|
|
32
|
+
<div part="no-data" class="combobox__no-results">
|
|
33
|
+
<div part="no-data-title" class="combobox__no-results-title">
|
|
34
|
+
${i||"No data available"}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
`}static renderMeasuredItem(s,e,r,n,l,a,d,c,p,$,v,b){if(!s)return t``;const u=a(s),m=l(s),x=s?.disabled||!1,_=s?.className,h=p?p(s):s?.description??"",g=$?$(s):s?.prefix??"",f=v?v(s):s?.suffix??"";let y=!1;return y=n?Array.isArray(r)&&r.some((t=>String(t)===String(u))):String(Array.isArray(r)?r[0]:r)===String(u),t`
|
|
39
|
+
<nile-option
|
|
40
|
+
data-index=${e}
|
|
41
|
+
value=${u}
|
|
42
|
+
.selected=${y}
|
|
43
|
+
.disabled=${x}
|
|
44
|
+
.showCheckbox=${n}
|
|
45
|
+
class=${o({option:b??!1,[_??""]:!!_})}
|
|
46
|
+
.description=${h}
|
|
47
|
+
.isDescriptionEnabled=${b}
|
|
48
|
+
>
|
|
49
|
+
${i(g)}
|
|
50
|
+
${d?i(m):m}
|
|
51
|
+
${i(f)}
|
|
52
|
+
</nile-option>
|
|
53
|
+
`}static renderItem(s,e,r,n,l,a,d,c,p,$){if(!s)return t``;const v=l(s),b=n(s),u=s?.disabled||!1,m=s?.className,x=d?d(s):s?.description??"",_=c?c(s):s?.prefix??"",h=p?p(s):s?.suffix??"";let g=!1;return g=r?Array.isArray(e)&&e.some((t=>String(t)===String(v))):String(Array.isArray(e)?e[0]:e)===String(v),t`
|
|
54
|
+
<nile-option
|
|
55
|
+
value=${v}
|
|
56
|
+
.selected=${g}
|
|
57
|
+
.disabled=${u}
|
|
58
|
+
.showCheckbox=${r}
|
|
59
|
+
class=${o({option:$??!1,[m??""]:!!m})}
|
|
60
|
+
.description=${x}
|
|
61
|
+
.isDescriptionEnabled=${$}
|
|
62
|
+
>
|
|
63
|
+
${i(_)}
|
|
64
|
+
${a?i(b):b}
|
|
65
|
+
${i(h)}
|
|
66
|
+
</nile-option>
|
|
67
|
+
`}static renderVirtualizedGrid(i,o,r,n,l,a,d,c,p,$,v,b,u,m){const x=i.length>0?i[0].start:0,_=m?`repeat(${a}, ${m}px)`:`repeat(${a}, 1fr)`;return t`
|
|
68
|
+
<div
|
|
69
|
+
part="select-options"
|
|
70
|
+
class="combobox__options ${p?"loading":""}"
|
|
71
|
+
>
|
|
72
|
+
<div style="position:relative;height:${o}px;width:${m?"max-content":"100%"};min-width:100%;">
|
|
73
|
+
<div style="position:absolute;top:0;left:0;width:${m?"max-content":"100%"};min-width:100%;transform:translateY(${x}px);">
|
|
74
|
+
${s(i,(t=>t.key),(i=>{const o=i.index*a,s=r.slice(o,o+a);return t`
|
|
75
|
+
<div class="combobox__grid-row" style="display:grid;grid-template-columns:${_};gap:4px;">
|
|
76
|
+
${s.map((t=>e.renderItem(t,n,l,d,c,$,v,b,u)))}
|
|
77
|
+
</div>
|
|
78
|
+
`}))}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
`}static renderHorizontalGrid(i,o,r,n,l,a,d,c,p,$,v,b,u,m){const x=i.length>0?i[0].start:0;return t`
|
|
83
|
+
<div
|
|
84
|
+
part="select-options"
|
|
85
|
+
class="combobox__options combobox__options--horizontal ${$?"loading":""}"
|
|
86
|
+
>
|
|
87
|
+
<div style="position:relative;width:${o}px;height:${38*a}px;">
|
|
88
|
+
<div style="position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(${x}px);">
|
|
89
|
+
${s(i,(t=>t.key),(i=>{const o=i.index*a,s=r.slice(o,o+a);return t`
|
|
90
|
+
<div class="combobox__grid-col" style="width:${d}px;flex-shrink:0;display:flex;flex-direction:column;">
|
|
91
|
+
${s.map((t=>e.renderItem(t,n,l,c,p,v,b,u,m)))}
|
|
92
|
+
</div>
|
|
93
|
+
`}))}
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
`}static renderAddCustomOption(i,o){return t`
|
|
98
|
+
<nile-option
|
|
99
|
+
value=${i}
|
|
100
|
+
class="combobox__add-option"
|
|
101
|
+
.showCheckbox=${o}
|
|
102
|
+
>
|
|
103
|
+
+ Add "${i}"
|
|
104
|
+
</nile-option>
|
|
105
|
+
`}static shouldUseVirtualizer(t,i=1){return i>1||t.length>=5}}export{e as C};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register([],function(_export,_context){"use strict";var e;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}return{setters:[],execute:function execute(){_export("C",e=/*#__PURE__*/function(){function e(){_classCallCheck(this,e);this.debounceTimer=null;}return _createClass(e,[{key:"filter",value:function filter(_e,t,s){if(!t||0===t.length)return{filteredItems:[],showNoResults:!0};if(!_e||""===_e.trim())return{filteredItems:_toConsumableArray(t),showNoResults:!1};var i=_e.toLowerCase(),l=t.filter(function(_e2){return s(_e2).toLowerCase().includes(i);});return{filteredItems:l,showNoResults:0===l.length};}},{key:"debounceSearch",value:function debounceSearch(_e3,t,s){var _this=this;this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){_e3(t),_this.debounceTimer=null;},s);}},{key:"cancelDebounce",value:function cancelDebounce(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null);}}]);}());}};});
|
|
2
|
+
//# sourceMappingURL=search-manager.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-manager.cjs.js","sources":["../../../src/nile-combobox/search-manager.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport class ComboboxSearchManager {\n private debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n filter(\n searchValue: string,\n originalItems: any[],\n getSearchText: (item: any) => string,\n ): { filteredItems: any[]; showNoResults: boolean } {\n if (!originalItems || originalItems.length === 0) {\n return { filteredItems: [], showNoResults: true };\n }\n\n if (!searchValue || searchValue.trim() === '') {\n return { filteredItems: [...originalItems], showNoResults: false };\n }\n\n const needle = searchValue.toLowerCase();\n const filteredItems = originalItems.filter((item: any) => {\n const text = getSearchText(item);\n return text.toLowerCase().includes(needle);\n });\n\n return { filteredItems, showNoResults: filteredItems.length === 0 };\n }\n\n debounceSearch(\n callback: (query: string) => void,\n query: string,\n debounceMs: number,\n ): void {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer);\n }\n this.debounceTimer = setTimeout(() => {\n callback(query);\n this.debounceTimer = null;\n }, debounceMs);\n }\n\n cancelDebounce(): void {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = null;\n }\n }\n}\n"],"names":["ComboboxSearchManager","e","constructor","this","debounceTimer","_createClass","key","value","filter","searchValue","originalItems","getSearchText","length","filteredItems","showNoResults","trim","_toConsumableArray","needle","toLowerCase","item","includes","debounceSearch","callback","query","debounceMs","clearTimeout","setTimeout","cancelDebounce"],"mappings":"oqEAOaA,0BAAb,SAAAC,EAAA,CAAAC,CAAAA,eAAAA,MAAAA,CAAAA,EACUC,KAAaC,aAAyC,CAAA,IA4C/D,EA1CC,OAAAC,YAAA,CAAAJ,CAAA,GAAAK,GAAA,UAAAC,KAAA,UAAAC,MAAAA,CACEC,GACAC,CACAC,CAAAA,CAAAA,CAAAA,CAEA,IAAKD,CAA0C,EAAA,CAAA,GAAzBA,EAAcE,MAClC,CAAA,MAAO,CAAEC,aAAe,CAAA,EAAA,CAAIC,aAAe,CAAA,CAAA,CAAA,CAAA,CAG7C,IAAKL,EAAsC,EAAA,EAAA,GAAvBA,GAAYM,IAC9B,CAAA,CAAA,CAAA,MAAO,CAAEF,aAAe,CAAAG,kBAAA,CAAIN,GAAgBI,aAAe,CAAA,CAAA,CAAA,CAAA,CAG7D,GAAMG,CAAAA,CAASR,CAAAA,EAAAA,CAAYS,cACrBL,CAAgBH,CAAAA,CAAAA,CAAcF,OAAQW,SAAAA,GAC7BR,QAAAA,CAAAA,CAAAA,CAAcQ,GACfD,CAAAA,CAAAA,WAAAA,CAAAA,CAAAA,CAAcE,SAASH,CAGrC,CAAA,EAAA,CAAA,CAAA,MAAO,CAAEJ,aAAeC,CAAAA,CAAAA,CAAAA,aAAAA,CAAwC,IAAzBD,CAAcD,CAAAA,MAAAA,CACtD,EAED,GAAAN,GAAA,kBAAAC,KAAA,UAAAc,cAAAA,CACEC,IACAC,CACAC,CAAAA,CAAAA,CAAAA,KAAAA,KAAAA,MAEIrB,KAAKC,aACPqB,EAAAA,YAAAA,CAAatB,KAAKC,aAEpBD,CAAAA,CAAAA,IAAAA,CAAKC,aAAgBsB,CAAAA,UAAAA,CAAW,WAC9BJ,GAASC,CAAAA,CAAAA,CAAAA,CACTpB,MAAKC,aAAgB,CAAA,IAAI,GACxBoB,CACJ,CAAA,EAED,GAAAlB,GAAA,kBAAAC,KAAA,UAAAoB,cAAAA,CAAAA,CACMxB,CAAAA,IAAAA,CAAKC,gBACPqB,YAAatB,CAAAA,IAAAA,CAAKC,eAClBD,IAAKC,CAAAA,aAAAA,CAAgB,KAExB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class e{constructor(){this.debounceTimer=null}filter(e,t,s){if(!t||0===t.length)return{filteredItems:[],showNoResults:!0};if(!e||""===e.trim())return{filteredItems:[...t],showNoResults:!1};const i=e.toLowerCase(),l=t.filter((e=>s(e).toLowerCase().includes(i)));return{filteredItems:l,showNoResults:0===l.length}}debounceSearch(e,t,s){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{e(t),this.debounceTimer=null}),s)}cancelDebounce(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}}export{e as C};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register([],function(_export,_context){"use strict";var t;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}return{setters:[],execute:function execute(){_export("C",t=/*#__PURE__*/function(){function t(){_classCallCheck(this,t);}return _createClass(t,null,[{key:"createOptionsFromValues",value:function createOptionsFromValues(_t,r,e,n){if(!_t||Array.isArray(_t)&&0===_t.length)return[];var s=Array.isArray(_t)?_t:[_t],u=n||function(_t2){var _t2$value;return(_t2$value=_t2===null||_t2===void 0?void 0:_t2.value)!==null&&_t2$value!==void 0?_t2$value:_t2;};return s.map(function(_t3){var n=r.find(function(r){var e=u(r);return String(e)===String(_t3);}),s=n?e(n):_t3;return{value:_t3,selected:!0,getTextLabel:function getTextLabel(){if("string"==typeof s&&/<[^>]+>/.test(s)){var _t4=document.createElement("div");return _t4.innerHTML=s,_t4.textContent||_t4.innerText||"";}return s;}};});}},{key:"toggleMultiValue",value:function toggleMultiValue(_t5,r){return _t5.includes(r)?_t5.filter(function(_t6){return _t6!==r;}):[].concat(_toConsumableArray(_t5),[r]);}},{key:"removeValue",value:function removeValue(_t7,r){return _t7.filter(function(_t8){return _t8!==r;});}}]);}());}};});
|
|
2
|
+
//# sourceMappingURL=selection-manager.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-manager.cjs.js","sources":["../../../src/nile-combobox/selection-manager.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport type { ComboboxOption } from './types.js';\n\nexport class ComboboxSelectionManager {\n static createOptionsFromValues(\n value: string | string[],\n data: any[],\n getDisplayText: (item: any) => string,\n getItemValue?: (item: any) => string\n ): ComboboxOption[] {\n if (!value || (Array.isArray(value) && value.length === 0)) {\n return [];\n }\n\n const values = Array.isArray(value) ? value : [value];\n const valueFn = getItemValue || ((item: any) => item?.value ?? item);\n\n return values.map(valueItem => {\n const item = data.find((d: any) => {\n const iv = valueFn(d);\n return String(iv) === String(valueItem);\n });\n\n const displayText = item ? getDisplayText(item) : valueItem;\n\n return {\n value: valueItem,\n selected: true,\n getTextLabel: () => {\n if (typeof displayText === 'string' && /<[^>]+>/.test(displayText)) {\n const div = document.createElement('div');\n div.innerHTML = displayText;\n return div.textContent || div.innerText || '';\n }\n return displayText;\n },\n };\n });\n }\n\n static toggleMultiValue(currentValues: string[], optionValue: string): string[] {\n if (currentValues.includes(optionValue)) {\n return currentValues.filter(v => v !== optionValue);\n }\n return [...currentValues, optionValue];\n }\n\n static removeValue(currentValues: string[], removeValue: string): string[] {\n return currentValues.filter(v => v !== removeValue);\n }\n}\n"],"names":["ComboboxSelectionManager","createOptionsFromValues","value","data","getDisplayText","getItemValue","Array","isArray","length","values","valueFn","item","map","valueItem","find","d","iv","String","displayText","selected","getTextLabel","test","div","document","createElement","innerHTML","textContent","innerText","key","toggleMultiValue","currentValues","optionValue","includes","filter","v","removeValue"],"mappings":"oqEASaA,CAAAA,kCAAAA,EAAAA,EAAAA,eAAAA,MAAAA,CAAAA,UAAAA,YAAAA,CAAAA,CAAAA,QAAAA,GAAAA,2BAAAA,KAAAA,CACX,QAAOC,CAAAA,uBAAAA,CACLC,EACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CAAAA,CAEA,GAAKH,CAAAA,EAAAA,EAAUI,KAAMC,CAAAA,OAAAA,CAAQL,EAA2B,CAAA,EAAA,CAAA,GAAjBA,GAAMM,MAC3C,CAAA,MAAO,EAGT,CAAA,GAAMC,CAAAA,CAASH,CAAAA,KAAAA,CAAMC,OAAQL,CAAAA,EAAAA,CAAAA,CAASA,EAAQ,CAAA,CAACA,EACzCQ,CAAAA,CAAAA,CAAAA,CAAUL,GAAkBM,SAAAA,oCAAcA,GAAMT,SAANS,GAAMT,iBAANS,GAAMT,CAAAA,KAAAA,UAAAA,SAAAA,UAAAA,SAAAA,CAASS,GAE/D,EAAA,CAAA,MAAOF,CAAAA,CAAOG,CAAAA,GAAAA,CAAIC,SAAAA,GAChB,CAAA,CAAA,GAAMF,CAAAA,CAAOR,CAAAA,CAAAA,CAAKW,IAAMC,CAAAA,SAAAA,CAAAA,CAAAA,CACtB,GAAMC,CAAAA,CAAAA,CAAKN,CAAQK,CAAAA,CAAAA,CAAAA,CACnB,MAAOE,CAAAA,M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s=Array.isArray(t)?t:[t],u=n||(t=>t?.value??t);return s.map((t=>{const n=r.find((r=>{const e=u(r);return String(e)===String(t)})),s=n?e(n):t;return{value:t,selected:!0,getTextLabel:()=>{if("string"==typeof s&&/<[^>]+>/.test(s)){const t=document.createElement("div");return t.innerHTML=s,t.textContent||t.innerText||""}return s}}}))}static toggleMultiValue(t,r){return t.includes(r)?t.filter((t=>t!==r)):[...t,r]}static removeValue(t,r){return t.filter((t=>t!==r))}}export{t as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|