@aquera/nile-elements 0.1.65 → 0.1.66
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 +4 -1
- package/dist/index.js +3 -2
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js.map +1 -1
- package/dist/nile-virtual-select/renderer.esm.js +13 -12
- package/dist/src/nile-virtual-select/renderer.js +3 -0
- package/dist/src/nile-virtual-select/renderer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-virtual-select/renderer.ts +3 -0
package/README.md
CHANGED
@@ -79,6 +79,9 @@ To run a local development server that serves the basic demo located in `demo/in
|
|
79
79
|
|
80
80
|
In this section, you can find the updates for each release of `nile-elements`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
|
81
81
|
|
82
|
+
#### Version 0.1.66
|
83
|
+
Nile Virtual Select: Provide option to pass class to `nile-option` [UIF-938]
|
84
|
+
|
82
85
|
#### Version 0.1.65
|
83
86
|
- Nile Option: Added a CSS Part (Technical Change) [UIF-937]
|
84
87
|
|
@@ -712,4 +715,4 @@ In this section, you can find the updates for each release of `nile-elements`. I
|
|
712
715
|
- Added: more support to new design
|
713
716
|
|
714
717
|
#### Version 0.0.57
|
715
|
-
- Added: more support to new design
|
718
|
+
- Added: more support to new design
|
package/dist/index.js
CHANGED
@@ -4338,12 +4338,13 @@ class Hi{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
4338
4338
|
`}
|
4339
4339
|
</div>
|
4340
4340
|
`}
|
4341
|
-
</div>`}static getItemRenderFunction(e,t,M,i,N,o){const s=N||t,n=o||(e=>e?.value||e),r=n(e),a=s(e),l=e.disabled||!1;let
|
4341
|
+
</div>`}static getItemRenderFunction(e,t,M,i,N,o){const s=N||t,n=o||(e=>e?.value||e),r=n(e),a=s(e),l=e.disabled||!1,D=e.className;let u=!1;return u=i?Array.isArray(M)&&M.includes(r):(Array.isArray(M)?M[0]:M)===r,R`
|
4342
4342
|
<nile-option
|
4343
4343
|
value=${r}
|
4344
|
-
.selected=${
|
4344
|
+
.selected=${u}
|
4345
4345
|
.disabled=${l}
|
4346
4346
|
.showCheckbox=${i}
|
4347
|
+
class=${Ze(D||void 0)}
|
4347
4348
|
>
|
4348
4349
|
${pe(a)}
|
4349
4350
|
</nile-option>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register(["lit","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var e,t,i,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,
|
1
|
+
System.register(["lit","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","lit/directives/if-defined.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var e,t,i,s,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,r;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 _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}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:[function(_lit){e=_lit.html;},function(_virtualize001CjsJs){t=_virtualize001CjsJs.v;},function(_litDirectivesUnsafeHtmlJs){i=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_litDirectivesIfDefinedJs){s=_litDirectivesIfDefinedJs.ifDefined;},function(_litDirectiveJs){},function(_litAsyncDirectiveJs){},function(_litDirectivesRepeatJs){}],execute:function execute(){_export("V",r=/*#__PURE__*/function(){function r(){_classCallCheck(this,r);}return _createClass(r,null,[{key:"getVirtualizedContent",value:function getVirtualizedContent(i,s,l,o,c,d,a,n,v,m){return e(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"select__options ","\">\n ","\n </div>"])),s?"select__options__search-enabled":"",n&&!m?e(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <div class=\"select__no-results\">\n ","\n </div>\n "])),v||"No results found"):e(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <div\n class=\"virtualized\"\n >\n ","\n </div>\n "])),r.shouldUseVirtualizer(i)?e(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n ","\n "])),t({items:i,renderItem:function renderItem(e){return r.getItemRenderFunction(e,l,o,c,d,a);},scroller:!0})):e(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n ","\n "])),i.map(function(e){return r.getItemRenderFunction(e,l,o,c,d,a);}))));}},{key:"getItemRenderFunction",value:function getItemRenderFunction(t,_r,l,o,c,d){var a=c||_r,n=d||function(e){return(e===null||e===void 0?void 0:e.value)||e;},v=n(t),m=a(t),u=t.disabled||!1,p=t.className;var $=!1;return $=o?Array.isArray(l)&&l.includes(v):(Array.isArray(l)?l[0]:l)===v,e(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-option \n value="," \n .selected="," \n .disabled=","\n .showCheckbox=","\n class=","\n >\n ","\n </nile-option>\n "])),v,$,u,o,s(p||void 0),i(m));}},{key:"shouldUseVirtualizer",value:function shouldUseVirtualizer(e){return e.length>=50;}}]);}());}};});
|
2
2
|
//# sourceMappingURL=renderer.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-virtual-select/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 { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n optionsLoading?: boolean\n ): TemplateResult {\n return html`\n <div class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n }\">\n ${showNoResults && !optionsLoading\n ? html`\n <div class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string\n ): TemplateResult {\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item.disabled || false;\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.includes(optionValue);\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n \n return html`\n <nile-option \n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n >\n ${unsafeHTML(displayText)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 50 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 50;\n }\n} \n"],"names":["VirtualSelectRenderer","
|
1
|
+
{"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-virtual-select/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 { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n optionsLoading?: boolean\n ): TemplateResult {\n return html`\n <div class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n }\">\n ${showNoResults && !optionsLoading\n ? html`\n <div class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string\n ): TemplateResult {\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item.disabled || false;\n const className = item.className;\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.includes(optionValue);\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n \n return html`\n <nile-option \n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${ifDefined(className || undefined)}\n >\n ${unsafeHTML(displayText)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 50 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 50;\n }\n} \n"],"names":["VirtualSelectRenderer","getVirtualizedContent","data","searchEnabled","renderItemFunction","value","multiple","getDisplayText","getItemValue","showNoResults","noResultsMessage","optionsLoading","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","shouldUseVirtualizer","_templateObject4","virtualize","items","renderItem","item","getItemRenderFunction","scroller","_templateObject5","map","key","displayTextFn","valueFn","optionValue","displayText","isDisabled","disabled","className","isSelected","Array","isArray","includes","_templateObject6","ifDefined","undefined","unsafeHTML","length"],"mappings":"47DAYaA,CAAAA,kCAAAA,EAAAA,EAAAA,eA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ACAC,CACAC,CAAAA,CAAAA,CACAC,CAEA,CAAA,CAAA,GAAMoB,CAAAA,CAAgBrB,CAAAA,CAAAA,EAAkBH,GAClCyB,CAAUrB,CAAAA,CAAAA,EAAkBc,SAAAA,CAAAA,QAAcA,CAAAA,CAAMjB,SAANiB,CAAMjB,iBAANiB,CAAMjB,CAAAA,KAAAA,GAASiB,IAEzDQ,CAAcD,CAAAA,CAAAA,CAAQP,CACtBS,CAAAA,CAAAA,CAAAA,CAAcH,CAAcN,CAAAA,CAAAA,CAAAA,CAC5BU,EAAaV,CAAKW,CAAAA,QAAAA,EAAAA,CAAY,CAC9BC,CAAAA,CAAAA,CAAYZ,CAAKY,CAAAA,SAAAA,CAEvB,GAAIC,CAAAA,CAAa,CAAA,CAAA,CAAA,CAOjB,MALEA,CAAAA,CAAAA,CADE7B,CACW8B,CAAAA,KAAAA,CAAMC,QAAQhC,CAAUA,CAAAA,EAAAA,CAAAA,CAAMiC,QAASR,CAAAA,CAAAA,CAAAA,CAAAA,CAEtCM,KAAMC,CAAAA,OAAAA,CAAQhC,GAASA,CAAM,CAAA,CAAA,CAAA,CAAKA,CAAWyB,IAAAA,CAAAA,CAGtDlB,CAAI,CAAA2B,gBAAA,GAAAA,gBAAA,CAAAzB,sBAAA,gMAECgB,CAAAA,CACIK,CAAAA,CACAH,CAAAA,CACI1B,CAAAA,CACRkC,CAAAA,CAAUN,CAAaO,EAAAA,IAAAA,EAAAA,CAAAA,CAE7BC,CAAWX,CAAAA,CAAAA,CAAAA,CAGlB,EAMO,GAAAJ,GAAA,wBAAAtB,KAAA,8BAAOY,CAAqBf,CAAAA,CAAAA,CAClC,MAAOA,CAAAA,CAAKyC,CAAAA,MAAAA,EAAU,EACvB"}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import{html as e}from"lit";import{v as t}from"../virtualize-a4a40d96.esm.js";import{unsafeHTML as i}from"lit/directives/unsafe-html.js";import"lit/directive.js";import"lit/async-directive.js";import"lit/directives/repeat.js";class
|
2
|
-
<div class="select__options ${
|
3
|
-
${
|
1
|
+
import{html as e}from"lit";import{v as t}from"../virtualize-a4a40d96.esm.js";import{unsafeHTML as i}from"lit/directives/unsafe-html.js";import{ifDefined as s}from"lit/directives/if-defined.js";import"lit/directive.js";import"lit/async-directive.js";import"lit/directives/repeat.js";class r{static getVirtualizedContent(i,s,l,o,d,a,c,n,m,v){return e`
|
2
|
+
<div class="select__options ${s?"select__options__search-enabled":""}">
|
3
|
+
${n&&!v?e`
|
4
4
|
<div class="select__no-results">
|
5
5
|
${m||"No results found"}
|
6
6
|
</div>
|
@@ -8,20 +8,21 @@ import{html as e}from"lit";import{v as t}from"../virtualize-a4a40d96.esm.js";imp
|
|
8
8
|
<div
|
9
9
|
class="virtualized"
|
10
10
|
>
|
11
|
-
${
|
12
|
-
${t({items:i,renderItem:e=>
|
11
|
+
${r.shouldUseVirtualizer(i)?e`
|
12
|
+
${t({items:i,renderItem:e=>r.getItemRenderFunction(e,l,o,d,a,c),scroller:!0})}
|
13
13
|
`:e`
|
14
|
-
${i.map((e=>
|
14
|
+
${i.map((e=>r.getItemRenderFunction(e,l,o,d,a,c)))}
|
15
15
|
`}
|
16
16
|
</div>
|
17
17
|
`}
|
18
|
-
</div>`}static getItemRenderFunction(t,
|
18
|
+
</div>`}static getItemRenderFunction(t,r,l,o,d,a){const c=d||r,n=a||(e=>e?.value||e),m=n(t),v=c(t),u=t.disabled||!1,p=t.className;let $=!1;return $=o?Array.isArray(l)&&l.includes(m):(Array.isArray(l)?l[0]:l)===m,e`
|
19
19
|
<nile-option
|
20
|
-
value=${
|
21
|
-
.selected=${
|
20
|
+
value=${m}
|
21
|
+
.selected=${$}
|
22
22
|
.disabled=${u}
|
23
|
-
.showCheckbox=${
|
23
|
+
.showCheckbox=${o}
|
24
|
+
class=${s(p||void 0)}
|
24
25
|
>
|
25
|
-
${i(
|
26
|
+
${i(v)}
|
26
27
|
</nile-option>
|
27
|
-
`}static shouldUseVirtualizer(e){return e.length>=50}}export{
|
28
|
+
`}static shouldUseVirtualizer(e){return e.length>=50}}export{r as V};
|
@@ -7,6 +7,7 @@
|
|
7
7
|
import { html } from 'lit';
|
8
8
|
import { virtualize } from '@lit-labs/virtualizer/virtualize.js';
|
9
9
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
10
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
10
11
|
export class VirtualSelectRenderer {
|
11
12
|
static getVirtualizedContent(data, searchEnabled, renderItemFunction, value, multiple, getDisplayText, getItemValue, showNoResults, noResultsMessage, optionsLoading) {
|
12
13
|
return html `
|
@@ -42,6 +43,7 @@ export class VirtualSelectRenderer {
|
|
42
43
|
const optionValue = valueFn(item);
|
43
44
|
const displayText = displayTextFn(item);
|
44
45
|
const isDisabled = item.disabled || false;
|
46
|
+
const className = item.className;
|
45
47
|
let isSelected = false;
|
46
48
|
if (multiple) {
|
47
49
|
isSelected = Array.isArray(value) && value.includes(optionValue);
|
@@ -55,6 +57,7 @@ export class VirtualSelectRenderer {
|
|
55
57
|
.selected=${isSelected}
|
56
58
|
.disabled=${isDisabled}
|
57
59
|
.showCheckbox=${multiple}
|
60
|
+
class=${ifDefined(className || undefined)}
|
58
61
|
>
|
59
62
|
${unsafeHTML(displayText)}
|
60
63
|
</nile-option>
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/nile-virtual-select/renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/nile-virtual-select/renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,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,IAAI,kBAAkB,CAAC;QAC3D,MAAM,OAAO,GAAG,YAAY,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC;QAErE,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,IAAI,UAAU,GAAG,KAAK,CAAC;QACvB,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAA;;gBAEC,WAAW;oBACP,UAAU;oBACV,UAAU;wBACN,QAAQ;gBAChB,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC;;UAEvC,UAAU,CAAC,WAAW,CAAC;;KAE5B,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,oBAAoB,CAAC,IAAW;QAC7C,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF","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 { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n optionsLoading?: boolean\n ): TemplateResult {\n return html`\n <div class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n }\">\n ${showNoResults && !optionsLoading\n ? html`\n <div class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string\n ): TemplateResult {\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item.disabled || false;\n const className = item.className;\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.includes(optionValue);\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n \n return html`\n <nile-option \n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${ifDefined(className || undefined)}\n >\n ${unsafeHTML(displayText)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 50 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 50;\n }\n} \n"]}
|