@luzmo/analytics-components-kit 1.3.0 → 1.4.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.
Files changed (118) hide show
  1. package/README.md +6 -3
  2. package/angular/components/add-to-dashboard.ts +20 -6
  3. package/angular/components/data-fields-select.ts +5 -0
  4. package/angular/components/interactive-viz-item.ts +87 -22
  5. package/angular/components/item-grid-item-actions-menu.ts +5 -0
  6. package/angular/components/item-grid.ts +7 -0
  7. package/angular/components/item-option-color-picker.ts +28 -28
  8. package/angular/components/item-option-guidelines.ts +22 -1
  9. package/angular/components/item-option-multi-language-field.ts +7 -7
  10. package/angular/components/item-option-number-field.ts +14 -14
  11. package/angular/components/item-option-positions-number-field.ts +14 -14
  12. package/angular/components/item-option-radio-button-group.ts +7 -7
  13. package/angular/components/item-option-text-field.ts +7 -7
  14. package/angular/components/item-slot-picker-panel.ts +1 -1
  15. package/angular/components/item-slot-picker.ts +7 -7
  16. package/angular/esm/components/add-to-dashboard.d.ts +8 -4
  17. package/angular/esm/components/add-to-dashboard.js +23 -7
  18. package/angular/esm/components/data-fields-select.d.ts +2 -0
  19. package/angular/esm/components/data-fields-select.js +4 -0
  20. package/angular/esm/components/interactive-viz-item.d.ts +30 -9
  21. package/angular/esm/components/interactive-viz-item.js +98 -27
  22. package/angular/esm/components/item-grid-item-actions-menu.d.ts +2 -0
  23. package/angular/esm/components/item-grid-item-actions-menu.js +4 -0
  24. package/angular/esm/components/item-grid.d.ts +3 -1
  25. package/angular/esm/components/item-grid.js +9 -1
  26. package/angular/esm/components/item-option-color-picker.d.ts +10 -10
  27. package/angular/esm/components/item-option-color-picker.js +34 -34
  28. package/angular/esm/components/item-option-guidelines.d.ts +8 -2
  29. package/angular/esm/components/item-option-guidelines.js +26 -2
  30. package/angular/esm/components/item-option-multi-language-field.d.ts +3 -3
  31. package/angular/esm/components/item-option-multi-language-field.js +10 -10
  32. package/angular/esm/components/item-option-number-field.d.ts +5 -5
  33. package/angular/esm/components/item-option-number-field.js +18 -18
  34. package/angular/esm/components/item-option-positions-number-field.d.ts +5 -5
  35. package/angular/esm/components/item-option-positions-number-field.js +18 -18
  36. package/angular/esm/components/item-option-radio-button-group.d.ts +3 -3
  37. package/angular/esm/components/item-option-radio-button-group.js +10 -10
  38. package/angular/esm/components/item-option-text-field.d.ts +3 -3
  39. package/angular/esm/components/item-option-text-field.js +10 -10
  40. package/angular/esm/components/item-slot-picker-panel.d.ts +1 -1
  41. package/angular/esm/components/item-slot-picker-panel.js +1 -1
  42. package/angular/esm/components/item-slot-picker.d.ts +3 -3
  43. package/angular/esm/components/item-slot-picker.js +9 -9
  44. package/angular/package.json +2 -2
  45. package/components/add-to-dashboard/dashboard-actions.d.ts +2 -1
  46. package/components/add-to-dashboard/index.cjs +1 -1
  47. package/components/add-to-dashboard/index.js +1 -1
  48. package/components/{add-to-dashboard-CzIuDtAq.cjs → add-to-dashboard-BtzTZdjN.cjs} +1 -1
  49. package/components/{add-to-dashboard-DGC0_hRB.js → add-to-dashboard-Bu6S3qVz.js} +125 -120
  50. package/components/chart-helpers-BHxQbLBw.cjs +20 -0
  51. package/components/{chart-helpers-Cbl3sRra.js → chart-helpers-BKeMLhov.js} +51 -38
  52. package/components/filters/index.cjs +1 -1
  53. package/components/filters/index.js +1 -1
  54. package/components/{filters-CxIzuI5q.js → filters-DEpmh9Nj.js} +113 -102
  55. package/components/filters-LDXhe1Bp.cjs +187 -0
  56. package/components/index.cjs +1 -1
  57. package/components/index.js +6 -6
  58. package/components/interactive-viz-item/helpers/chart-helpers.d.ts +2 -1
  59. package/components/interactive-viz-item/index.cjs +1 -1
  60. package/components/interactive-viz-item/index.js +3 -3
  61. package/components/interactive-viz-item/interactive-viz-item.d.ts +44 -0
  62. package/components/{interactive-viz-item-BKLOmawA.js → interactive-viz-item-Cc3Ix95e.js} +151 -110
  63. package/components/interactive-viz-item-SF12d97t.cjs +269 -0
  64. package/components/item-grid/item-grid.d.ts +1 -0
  65. package/components/item-slot-picker-panel/index.cjs +1 -1
  66. package/components/item-slot-picker-panel/index.js +1 -1
  67. package/components/item-slot-picker-panel/item-slot-picker-panel.d.ts +19 -1
  68. package/components/item-slot-picker-panel-Cw3UCK03.cjs +84 -0
  69. package/components/{item-slot-picker-panel-fJqEmxeD.js → item-slot-picker-panel-DprM9Rli.js} +64 -33
  70. package/custom-elements.json +3044 -2532
  71. package/grid-core/item-grid-base.d.ts +5 -4
  72. package/package.json +1 -1
  73. package/react/package.json +2 -2
  74. package/standalone/add-to-dashboard.js +1 -1
  75. package/standalone/chunks/{chart-helpers-CR-EUEPf.js → chart-helpers-DZsidiCl.js} +1 -1
  76. package/standalone/chunks/data-broker-DpSrH3IP.js +2 -0
  77. package/standalone/chunks/{display-settings-binning-BeLLxd3i.js → display-settings-binning-DhHlclWH.js} +1 -1
  78. package/standalone/chunks/{display-settings-datetime-BkeiKIVV.js → display-settings-datetime-C8xvOvi4.js} +1 -1
  79. package/standalone/chunks/{display-settings-grand-totals-BuhpQKJ6.js → display-settings-grand-totals-CUpigDcs.js} +1 -1
  80. package/standalone/chunks/{display-settings-numeric-m30IYI7I.js → display-settings-numeric-BLWF54Jx.js} +1 -1
  81. package/standalone/chunks/{display-settings-period-over-period-CqDlOSRn.js → display-settings-period-over-period-COd4tvUw.js} +1 -1
  82. package/standalone/chunks/en-DNsyAwgq.js +2 -0
  83. package/standalone/chunks/en-GB-Di3OzVdL.js +2 -0
  84. package/standalone/chunks/en-US-DNsyAwgq.js +2 -0
  85. package/standalone/chunks/{filters-CxgBXUF1.js → filters-lhg_WVDK.js} +72 -72
  86. package/standalone/chunks/{formula-codemirror-Cq94j3-f.js → formula-codemirror-DZMzLE2I.js} +1 -1
  87. package/standalone/chunks/{item-option-action-button-group-BoyqF9vt.js → item-option-action-button-group-Bl1HR1JK.js} +1 -1
  88. package/standalone/chunks/{item-option-base-CBcDT8MX.js → item-option-base-DF24wTyv.js} +1 -1
  89. package/standalone/chunks/{item-option-color-palette-picker-C9PGAv4V.js → item-option-color-palette-picker-MkIIn56p.js} +1 -1
  90. package/standalone/chunks/{item-option-color-picker-D4fVJlqF.js → item-option-color-picker-CxosMo_p.js} +1 -1
  91. package/standalone/chunks/{item-option-color-range-BlAdTguE.js → item-option-color-range-C7C70r4J.js} +1 -1
  92. package/standalone/chunks/{item-option-guidelines-DMsYsHDu.js → item-option-guidelines-iu8yWRzr.js} +1 -1
  93. package/standalone/chunks/{item-option-multi-language-field-NUbm1drg.js → item-option-multi-language-field-foanqCdr.js} +1 -1
  94. package/standalone/chunks/{item-option-number-field-DRp7kbHL.js → item-option-number-field-ByVD4oq0.js} +1 -1
  95. package/standalone/chunks/{item-option-panel-cXrRclzM.js → item-option-panel-Bya-K7HH.js} +2 -2
  96. package/standalone/chunks/{item-option-picker-Ba09L4Cs.js → item-option-picker-CqNNVIML.js} +1 -1
  97. package/standalone/chunks/{item-option-position-picker-GEGTnhjw.js → item-option-position-picker-BjCFVtDH.js} +1 -1
  98. package/standalone/chunks/{item-option-positions-number-field-n44s1k5v.js → item-option-positions-number-field-BJJtXZL-.js} +1 -1
  99. package/standalone/chunks/{item-option-radio-button-group-3s_b1NvR.js → item-option-radio-button-group-C5bxsD85.js} +1 -1
  100. package/standalone/chunks/{item-option-slider-DtY65Gxk.js → item-option-slider-DUXWz70B.js} +1 -1
  101. package/standalone/chunks/{item-option-switch-4sJaI0mx.js → item-option-switch-BHyJuOkP.js} +1 -1
  102. package/standalone/chunks/{item-option-text-field-Bt6Lj6kh.js → item-option-text-field-rBZY9OX4.js} +1 -1
  103. package/standalone/chunks/{item-slot-picker-panel-BOSVFBIy.js → item-slot-picker-panel-BM82vSXi.js} +74 -72
  104. package/standalone/chunks/load-data-fields-for-datasets-DS9O1oyy.js +25 -0
  105. package/standalone/chunks/localize-DLl7tgQp.js +2 -0
  106. package/standalone/interactive-viz-item.js +54 -53
  107. package/standalone/manifest.json +31 -31
  108. package/types.d.ts +1 -1
  109. package/components/chart-helpers-fMnqHRzC.cjs +0 -20
  110. package/components/filters-BPbPFOu5.cjs +0 -187
  111. package/components/interactive-viz-item-ojdH1uk0.cjs +0 -268
  112. package/components/item-slot-picker-panel-BhhN54IM.cjs +0 -82
  113. package/standalone/chunks/data-broker-DXDyIrj_.js +0 -2
  114. package/standalone/chunks/en-63f7j4v7.js +0 -2
  115. package/standalone/chunks/en-GB-QAmXQf8W.js +0 -2
  116. package/standalone/chunks/en-US-63f7j4v7.js +0 -2
  117. package/standalone/chunks/load-data-fields-for-datasets-CDlut-6S.js +0 -25
  118. package/standalone/chunks/localize-DXRmGRe-.js +0 -2
@@ -0,0 +1,269 @@
1
+ /*! * A kit of modern Luzmo Web Components for analytics in your web application.
2
+ *
3
+ * Copyright © 2026 Luzmo
4
+ * All rights reserved.
5
+ * Luzmo web components (“Luzmo Web Components”)
6
+ * must be used according to the Luzmo Terms of Service.
7
+ * This license allows users with a current active Luzmo account
8
+ * to use the Luzmo Web Components. This license terminates
9
+ * automatically if a user no longer has an active Luzmo account.
10
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ * SOFTWARE.
19
+ * */
20
+ require("./tokens-BWMfo_w4.cjs");const e=require("./base-CGDNY_7v.cjs"),t=require("./decorate-DCJt-2rt.cjs"),n=require("./localized-mixin-EoNvtTBG.cjs"),r=require("./is-same-option-value-Cf6BQcs7.cjs"),i=require("./chart-helpers-BHxQbLBw.cjs"),a=require("./create-lazy-loader-DYPgQh0L.cjs");let o=require("@luzmo/icons");require("@luzmo/lucero/action-button"),require("@luzmo/lucero/icon"),require("@luzmo/lucero/overlay"),require("@luzmo/lucero/popover");let s=require("lit"),c=require("lit/decorators.js"),l=require("@lit/localize");require("@luzmo/embed"),require("@luzmo/lucero/action-group"),require("@luzmo/lucero/field-label"),require("@luzmo/lucero/number-field"),require("@luzmo/lucero/picker"),require("@luzmo/lucero/progress-circle"),require("@luzmo/lucero/tabs");var u=`:host{box-sizing:border-box;display:block;container-type:inline-size}.answer{width:100%;display:block}.chart-actions-bar{justify-content:space-between;align-items:flex-start;gap:var(--luzmo-interactive-viz-item-actions-gap,var(--interactive-viz-item-actions-gap));padding-block:var(--luzmo-interactive-viz-item-actions-padding-block,var(--interactive-viz-item-actions-padding-block));flex-wrap:nowrap;margin-block-start:var(--luzmo-interactive-viz-item-actions-margin-block-start,var(--interactive-viz-item-actions-margin-block-start));display:flex}.chart-actions-bar[hidden]{display:none}.chart-actions-primary{gap:var(--luzmo-interactive-viz-item-actions-gap,var(--interactive-viz-item-actions-gap));flex-wrap:wrap;flex:1;align-items:center;min-width:0;display:flex}.ranking-content{gap:var(--luzmo-spacing-3);padding:var(--luzmo-spacing-3);flex-direction:column;display:flex}.ranking-row{gap:var(--luzmo-spacing-3);align-items:center;display:flex}.ranking-number{width:4rem}.icon-flipped{transform:scaleY(-1)}.chart-container{border-radius:var(--luzmo-interactive-viz-item-chart-border-radius,var(--interactive-viz-item-chart-border-radius));height:var(--luzmo-interactive-viz-item-chart-height,var(--interactive-viz-item-chart-height));overflow:hidden}.chart-container luzmo-embed-viz-item{width:100%;height:100%;display:block}.feedback-row{padding-block:var(--luzmo-interactive-viz-item-feedback-padding-block,var(--interactive-viz-item-feedback-padding-block));justify-content:space-between;align-items:center;display:flex}.rating-btn-positive{--luzmo-action-button-content-color-default-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-content-color-hover-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-content-color-down-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-content-color-focus-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-background-color-default-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-hover-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-down-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-focus-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background))}.rating-btn-negative{--luzmo-action-button-content-color-default-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-content-color-hover-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-content-color-down-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-content-color-focus-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-background-color-default-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-hover-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-down-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-focus-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background))}.config-toggle{--luzmo-action-button-border-radius:32px;margin-inline-start:auto}.sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.config-panel{border:1px solid var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color));border-radius:var(--luzmo-interactive-viz-item-config-panel-border-radius,var(--interactive-viz-item-config-panel-border-radius));padding:var(--luzmo-interactive-viz-item-config-panel-padding,var(--interactive-viz-item-config-panel-padding));background:var(--luzmo-interactive-viz-item-config-panel-background,var(--interactive-viz-item-config-panel-background));margin-block-start:var(--luzmo-spacing-2)}.config-panel luzmo-tab-panel[selected]{padding-block-start:var(--luzmo-spacing-4);display:block}.config-panel luzmo-item-option-panel,.config-panel luzmo-item-slot-picker-panel,.config-panel luzmo-filters{width:100%;max-height:15rem;scrollbar-width:thin;scrollbar-color:var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color)) transparent;padding-inline-end:var(--luzmo-spacing-3);overflow-y:auto}.edit-grid{min-height:12.5rem;display:flex}.edit-column{gap:var(--luzmo-spacing-3);flex-direction:column;display:flex}.edit-column:first-child{flex-shrink:0;max-width:15rem}.edit-column-filters{border-inline-start:1px solid var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color));flex:1;min-width:18.75rem;padding-inline-start:var(--luzmo-spacing-5)}@container (width<=520px){.edit-grid{flex-direction:column}.edit-column,.edit-column:first-child{width:100%;min-width:0;max-width:100%}.edit-column-filters{border-inline-start:none;border-block-start:1px solid var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color));min-width:0;margin-block-start:var(--luzmo-spacing-3);padding-block-start:var(--luzmo-spacing-4);padding-inline-start:0}}@container (width<=768px){.chart-container{height:calc(var(--luzmo-interactive-viz-item-chart-height,var(--interactive-viz-item-chart-height)) - var(--luzmo-interactive-viz-item-chart-narrow-offset,var(--interactive-viz-item-chart-narrow-offset)))}}:host{--interactive-viz-item-actions-gap:var(--luzmo-spacing-3);--interactive-viz-item-actions-padding-block:var(--luzmo-spacing-3);--interactive-viz-item-actions-margin-block-start:var(--luzmo-spacing-5);--interactive-viz-item-chart-height:20rem;--interactive-viz-item-chart-narrow-offset:2.5rem;--interactive-viz-item-chart-border-radius:var(--luzmo-border-radius);--interactive-viz-item-feedback-padding-block:var(--luzmo-spacing-4);--interactive-viz-item-config-panel-padding:var(--luzmo-spacing-5);--interactive-viz-item-config-panel-border-color:var(--luzmo-border-color);--interactive-viz-item-config-panel-border-radius:var(--luzmo-border-radius);--interactive-viz-item-config-panel-background:var(--luzmo-background-color);--interactive-viz-item-rating-positive-color:var(--luzmo-positive-color,#12855a);--interactive-viz-item-rating-negative-color:var(--luzmo-negative-color,#ca221c);--interactive-viz-item-rating-selected-background:var(--luzmo-background-color-focus,#0000000f)}:host([size=s]){--interactive-viz-item-chart-height:17.5rem}:host([size=l]){--interactive-viz-item-chart-height:22rem}:host([size=xl]){--interactive-viz-item-chart-height:24rem}`,d=a.t(()=>Promise.resolve().then(()=>require("./add-to-dashboard/index.cjs"))).load,f=[`luzmo-filters`,`luzmo-item-option-panel`,`luzmo-item-slot-picker-panel`],p=a.t(()=>Promise.all([Promise.resolve().then(()=>require("./filters/index.cjs")),Promise.resolve().then(()=>require("./item-option-panel/index.cjs")),Promise.resolve().then(()=>require("./item-slot-picker-panel/index.cjs"))])),m=p.load,h=()=>p.isLoaded()||f.every(e=>customElements.get(e)!==void 0),g=0,_={},v=(e,t)=>t!==null&&r.n(JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t))),y=class extends n.t(e.n(e.i,{validSizes:Object.values(e.t)})){constructor(...e){super(...e),this.chart=null,this.feedback=null,this.messageId=``,this.authKey=``,this.authToken=``,this.apiUrl=`https://api.luzmo.com`,this.appServer=`https://app.luzmo.com`,this.contentLanguage=``,this.hideActions=!1,this.hideFeedback=!1,this.hideConfigPanel=!1,this.hideConfigOptions=!1,this.slotSelects=`multiple`,this.slotGrows=!1,this.slotsConfiguration=null,this.customOptionsConfiguration=null,this.customTranslations=null,this.chartRenderOptions=null,this.addToDashboard=!1,this.dashboardActions=null,this.controlled=!1,this.liveInteractions=!1,this._configPanelOpen=!1,this._actionsSlotHasContent=!1,this._configPanelPending=!1,this._configPanelLoadFailed=!1,this._rankingTriggerId=`interactive-viz-item-ranking-${++g}`,this._interactionGeneration=0,this._openInteractions=new Map,this._ownCharts=[],this._handleActionsSlotChange=e=>{this._actionsSlotHasContent=e.target.assignedElements({flatten:!0}).length>0},this._handleSlotsChanged=e=>{this.chart&&this._emitChart({...this.chart,slots:e.detail.slotsContents})},this._handleFiltersChanged=e=>{this.chart&&this._emitChart({...this.chart,filters:e.detail.filters})},this._handleOptionsChanged=e=>{if(!this.chart)return;let{options:t,interaction:n}=e.detail;if(!t)return;if(n){let e=this._openInteractions.get(n.id);if(!e||!this._isCurrentContext(e)){e?.generation===this._interactionGeneration&&this._invalidateInteractions();return}}let r=this.chart.options.theme??{};this._emitChart({...this.chart,options:{...t,theme:r}},n)},this._handleInteractionStart=e=>{if(!this.chart)return;let t={chart:this.chart,generation:this._interactionGeneration,auth:this._auth};this._openInteractions.set(e.detail.id,t),this._dispatchInteraction(e,t)},this._handleInteractionClosed=e=>{let t=this._openInteractions.get(e.detail.id);this._openInteractions.delete(e.detail.id),this._openInteractions.size===0&&(this._ownCharts=this._ownCharts.slice(-1)),t&&this._dispatchInteraction(e,t)}}static get styles(){return[(0,s.unsafeCSS)(u)]}get _effectiveContentLanguage(){return this.contentLanguage||this.language}_dispatch(e,t){let n=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(n)}get _chartActions(){return this.chart?i.n(i.s(this.chart)):[]}get _rating(){return this.feedback?.rating??0}get _canShowConfigPanel(){return!this.chart||this.hideConfigPanel?!1:!this.chart.inlineData||i.i(i.s(this.chart).slots).length>0}async _toggleConfigPanel(){if(this._configPanelLoadFailed=!1,this._configPanelOpen)this.endInteraction(),this._configPanelOpen=!1;else if(!this._configPanelPending){if(!h()){this._configPanelPending=!0;try{await m()}catch(e){console.warn(`Failed to load the chart configuration panel:`,e),this._configPanelLoadFailed=!0;return}finally{this._configPanelPending=!1}}this.isConnected&&this._canShowConfigPanel&&(this._configPanelOpen=!0)}}async export(e){await this.updateComplete;let t=this._embed;if(this.chart&&t&&(t.chartElement||await this._waitForEmbedRendered(t)))return await t.export(e)}_waitForEmbedRendered(e){if(!this.isConnected)return Promise.resolve(!1);this._exportWaitAbort??=new AbortController;let t=this._exportWaitAbort.signal;return new Promise(n=>{let r=new AbortController,i=e=>{r.abort(),n(e)},{signal:a}=r;e.addEventListener(`rendered`,()=>i(!0),{signal:a}),e.addEventListener(`error`,()=>i(!1),{signal:a}),t.addEventListener(`abort`,()=>i(!1),{signal:a})})}_cancelExportWaits(){this._exportWaitAbort?.abort(),this._exportWaitAbort=void 0}endInteraction(){this.renderRoot?.querySelector(`luzmo-item-option-panel`)?.endInteraction?.()}disconnectedCallback(){super.disconnectedCallback(),this._cancelExportWaits()}willUpdate(e){super.willUpdate(e),e.has(`chart`)&&!this.chart&&this._cancelExportWaits(),this._openInteractions.size>0&&this._invalidatesInteractions(e)&&this._invalidateInteractions(),e.has(`addToDashboard`)&&this.addToDashboard&&d().catch(e=>console.warn(`Failed to load add to dashboard:`,e))}updated(e){super.updated(e),e.has(`hideConfigOptions`)&&this.hideConfigOptions&&this._configTabs&&(this._configTabs.selected=`data`)}_emitOptions(e){!this.controlled&&this.chart&&(this.chart={...this.chart,options:e}),this._dispatch(`luzmo-chart-options-changed`,{options:e})}_invalidatesInteractions(e){return e.has(`authKey`)||e.has(`authToken`)||e.has(`apiUrl`)||e.has(`hideConfigPanel`)?!0:e.has(`chart`)&&[...this._openInteractions.values()].some(e=>!this._isCurrentChart(e))}_invalidateInteractions(){this._interactionGeneration++,this.endInteraction()}get _auth(){return[this.authKey,this.authToken,this.apiUrl]}_isCurrentChart(e){let t=this.chart;return t===e.chart||this._ownCharts.some(e=>e===t)||[...this._ownCharts].reverse().some(e=>v(e,t))||v(e.chart,t)}_isCurrentContext(e){return e.generation===this._interactionGeneration&&e.auth.every((e,t)=>e===this._auth[t])&&this._isCurrentChart(e)}_emitChart(e,t){this._ownCharts=this._openInteractions.size>0?[...this._ownCharts,e]:[e],this.controlled||(this.chart=e),this._dispatch(`luzmo-chart-changed`,t?{chart:e,interaction:t}:{chart:e})}_handleDropdownChange(e,t){if(!this.chart)return;t.stopPropagation();let n=t.detail,r=typeof n==`string`?n:n?.value??t.target?.value;if(!r)return;let a=i.t({...i.s(this.chart),options:this.chart.options},{type:`chartAction`,actionType:e.mutationType,key:r});this._emitOptions(a.options)}_currentRanking(e){return e.ranking??{active:!1,number:5,direction:i.l.Top}}_currentSort(e){return e.sort??{direction:i.d.Desc,by:i.u.Measure}}_emitRankAndSort(e,t){this.chart&&this._emitOptions({...this.chart.options,ranking:e,sort:t})}_renderOptionDropdown(e){let t=e.values??[],n=e.currentValue||t[0]?.key||``;return s.html`
21
+ <luzmo-picker
22
+ size=${this.size}
23
+ variant="highlight"
24
+ value=${n}
25
+ @change=${t=>this._handleDropdownChange(e,t)}
26
+ >
27
+ ${t.map(e=>s.html`<luzmo-menu-item value=${e.key}>${e.label}</luzmo-menu-item>`)}
28
+ </luzmo-picker>
29
+ `}_renderRankingPicker(e){let t=this._currentRanking(e),n=this._currentSort(e);if(!t.active)return s.html`
30
+ <luzmo-action-button
31
+ size=${this.size}
32
+ @click=${()=>this._emitRankAndSort({active:!0,number:5,direction:i.l.Top},n)}
33
+ >
34
+ <luzmo-icon slot="icon" size="xs" .icon=${o.luzmoAlignLeft}></luzmo-icon>
35
+ ${(0,l.msg)(`Show top 5`,{desc:`Label to activate top-N ranking on a chart`})}
36
+ </luzmo-action-button>
37
+ `;let r=t.direction===i.l.Bottom?(0,l.msg)(`Bottom`,{desc:`Ranking direction: keep the lowest values`}):(0,l.msg)(`Top`,{desc:`Ranking direction: keep the highest values`});return s.html`
38
+ <luzmo-action-button size=${this.size} id=${this._rankingTriggerId}>
39
+ <luzmo-icon slot="icon" size="xs" .icon=${o.luzmoAlignLeft}></luzmo-icon>
40
+ ${r} ${t.number||5}
41
+ </luzmo-action-button>
42
+
43
+ <luzmo-overlay type="auto" placement="bottom-start" trigger=${`${this._rankingTriggerId}@click`}>
44
+ <luzmo-popover>
45
+ <div class="ranking-content">
46
+ <div class="ranking-row">
47
+ <luzmo-action-group
48
+ size=${this.size}
49
+ compact
50
+ selects="single"
51
+ .selected=${[t.direction]}
52
+ @change=${t=>this._handleDirectionChange(e,t)}
53
+ >
54
+ <luzmo-action-button value="top" emphasized
55
+ >${(0,l.msg)(`Top`,{desc:`Ranking direction: keep the highest values`})}</luzmo-action-button
56
+ >
57
+ <luzmo-action-button value="bottom" emphasized
58
+ >${(0,l.msg)(`Bottom`,{desc:`Ranking direction: keep the lowest values`})}</luzmo-action-button
59
+ >
60
+ </luzmo-action-group>
61
+
62
+ <luzmo-number-field
63
+ class="ranking-number"
64
+ size=${this.size}
65
+ hide-stepper
66
+ min="1"
67
+ max="100"
68
+ step="1"
69
+ .value=${t.number}
70
+ @change=${t=>this._handleNumberChange(e,t)}
71
+ @input=${t=>this._handleNumberChange(e,t)}
72
+ ></luzmo-number-field>
73
+ </div>
74
+
75
+ <div class="ranking-row">
76
+ <luzmo-action-group
77
+ size=${this.size}
78
+ compact
79
+ selects="single"
80
+ .selected=${[n.by]}
81
+ @change=${t=>this._handleSortByChange(e,t)}
82
+ >
83
+ <luzmo-action-button value="measure" emphasized>123</luzmo-action-button>
84
+ <luzmo-action-button value="category" emphasized>ABC</luzmo-action-button>
85
+ </luzmo-action-group>
86
+
87
+ <luzmo-action-group
88
+ size=${this.size}
89
+ compact
90
+ selects="single"
91
+ .selected=${[n.direction]}
92
+ @change=${t=>this._handleSortDirectionChange(e,t)}
93
+ >
94
+ <luzmo-action-button
95
+ value="desc"
96
+ emphasized
97
+ label=${(0,l.msg)(`Sort descending`,{desc:`Sort chart values in descending order`})}
98
+ >
99
+ <luzmo-icon slot="icon" size="xs" .icon=${o.luzmoAlignLeft}></luzmo-icon>
100
+ </luzmo-action-button>
101
+ <luzmo-action-button
102
+ value="asc"
103
+ emphasized
104
+ label=${(0,l.msg)(`Sort ascending`,{desc:`Sort chart values in ascending order`})}
105
+ >
106
+ <luzmo-icon slot="icon" size="xs" class="icon-flipped" .icon=${o.luzmoAlignLeft}></luzmo-icon>
107
+ </luzmo-action-button>
108
+ </luzmo-action-group>
109
+ </div>
110
+ </div>
111
+ </luzmo-popover>
112
+ </luzmo-overlay>
113
+ `}_handleDirectionChange(e,t){t.stopPropagation();let n=t.target?.selected;n?.length&&this._emitRankAndSort({...this._currentRanking(e),direction:n[0]},this._currentSort(e))}_handleNumberChange(e,t){t.stopPropagation();let n=t.target?.value,r=typeof n==`number`?n:Number.parseInt(String(n),10);!Number.isNaN(r)&&r>=1&&this._emitRankAndSort({...this._currentRanking(e),number:r},this._currentSort(e))}_handleSortByChange(e,t){t.stopPropagation();let n=t.target?.selected;n?.length&&this._emitRankAndSort(this._currentRanking(e),{...this._currentSort(e),by:n[0]})}_handleSortDirectionChange(e,t){t.stopPropagation();let n=t.target?.selected;n?.length&&this._emitRankAndSort(this._currentRanking(e),{...this._currentSort(e),direction:n[0]})}_renderAddToDashboard(){return this.addToDashboard?s.html`
114
+ <luzmo-add-to-dashboard
115
+ size=${this.size}
116
+ language=${this.language}
117
+ .chart=${this.chart}
118
+ .dashboardActions=${this.dashboardActions}
119
+ .authKey=${this.authKey}
120
+ .authToken=${this.authToken}
121
+ .apiUrl=${this.apiUrl}
122
+ ></luzmo-add-to-dashboard>
123
+ `:s.nothing}_renderActions(){let e=this.hideActions&&!this.addToDashboard&&!this._actionsSlotHasContent;return s.html`
124
+ <div class="chart-actions-bar" part="actions-bar" ?hidden=${e}>
125
+ <div class="chart-actions-primary" part="actions">
126
+ ${this.hideActions?s.nothing:this._chartActions.map(e=>e.type===`optionDropdown`?this._renderOptionDropdown(e):this._renderRankingPicker(e))}
127
+ </div>
128
+ <slot name="chart-actions-extra" @slotchange=${this._handleActionsSlotChange}></slot>
129
+ ${this._renderAddToDashboard()}
130
+ </div>
131
+ `}_renderChart(){if(!this.chart)return s.nothing;let e=i.s(this.chart);return s.html`
132
+ <div class="chart-container" part="chart-container">
133
+ <luzmo-embed-viz-item
134
+ .type=${e.type}
135
+ .options=${i.a(e.options,this.chartRenderOptions)}
136
+ .slots=${e.slots}
137
+ .filters=${e.filters??[]}
138
+ .inlineData=${e.inlineData}
139
+ .authKey=${this.authKey}
140
+ .authToken=${this.authToken}
141
+ .apiHost=${this.apiUrl}
142
+ .appServer=${this.appServer}
143
+ .language=${this._effectiveContentLanguage}
144
+ .canFilter=${this.canFilter??!1}
145
+ ></luzmo-embed-viz-item>
146
+ </div>
147
+ `}_renderFeedback(){let e=!this.hideFeedback&&!!this.messageId,t=this._canShowConfigPanel,n=(0,l.msg)(`Loading`,{desc:`Loading spinner label`});return!e&&!t?s.nothing:s.html`
148
+ <div class="feedback-row" part="footer">
149
+ ${e?s.html`
150
+ <luzmo-action-group quiet size=${this.size}>
151
+ <luzmo-action-button
152
+ class="rating-btn-positive"
153
+ value="positive"
154
+ quiet
155
+ label=${(0,l.msg)(`Good response`,{desc:`Accessible label for the positive feedback button`})}
156
+ ?selected=${this._rating===1}
157
+ @click=${()=>this._toggleRating(!0)}
158
+ >
159
+ <luzmo-icon slot="icon" size="s" .icon=${o.luzmoThumbsUp}></luzmo-icon>
160
+ </luzmo-action-button>
161
+ <luzmo-action-button
162
+ class="rating-btn-negative"
163
+ value="negative"
164
+ quiet
165
+ label=${(0,l.msg)(`Bad response`,{desc:`Accessible label for the negative feedback button`})}
166
+ ?selected=${this._rating===-1}
167
+ @click=${()=>this._toggleRating(!1)}
168
+ >
169
+ <luzmo-icon slot="icon" size="s" .icon=${o.luzmoThumbsDown}></luzmo-icon>
170
+ </luzmo-action-button>
171
+ </luzmo-action-group>
172
+ `:s.nothing}
173
+ ${t?s.html`
174
+ <luzmo-action-button
175
+ class="config-toggle"
176
+ size=${this.size}
177
+ quiet
178
+ ?selected=${this._configPanelOpen}
179
+ aria-expanded=${this._configPanelOpen}
180
+ aria-label=${this._configPanelPending?n:(0,l.msg)(`Configure chart`,{desc:`Accessible label for the chart config toggle`})}
181
+ @click=${()=>this._toggleConfigPanel()}
182
+ >
183
+ ${this._configPanelPending?s.html`<luzmo-progress-circle slot="icon" size="s" indeterminate .label=${n}></luzmo-progress-circle>`:s.html`<luzmo-icon slot="icon" size="s" .icon=${o.luzmoInfoCircle}></luzmo-icon>`}
184
+ </luzmo-action-button>
185
+ <span class="sr-only" role="status" aria-live="polite">${this._configPanelPending?n:``}</span>
186
+ <span class="sr-only" role="alert">${this._configPanelLoadFailed?(0,l.msg)(`Failed to load the chart configuration. Please try again.`,{desc:`Error message when the chart config panel fails to load`}):``}</span>
187
+ `:s.nothing}
188
+ </div>
189
+ `}_toggleRating(e){let t=e?1:-1,n=this._rating===t?0:t;this._dispatch(`luzmo-feedback-changed`,{rating:n,comment:this.feedback?.comment})}_renderFilters(e,t){return e.inlineData?s.nothing:s.html`
190
+ <div class="edit-column edit-column-filters">
191
+ <luzmo-field-label size=${this.size}
192
+ >${(0,l.msg)(`Filters`,{desc:`Label for the filters section`})}</luzmo-field-label
193
+ >
194
+ <luzmo-filters
195
+ size=${this.size}
196
+ .datasetIds=${t}
197
+ .filters=${e.filters??[]}
198
+ .authKey=${this.authKey}
199
+ .authToken=${this.authToken}
200
+ .apiUrl=${this.apiUrl}
201
+ .language=${this.language}
202
+ .contentLanguage=${this._effectiveContentLanguage}
203
+ @luzmo-filters-changed=${this._handleFiltersChanged}
204
+ ></luzmo-filters>
205
+ </div>
206
+ `}_renderConfigPanel(){if(!this.chart||!this._canShowConfigPanel||!this._configPanelOpen)return s.nothing;let e=this.chart,t=i.r(e.slots??[]),n=i.i(t),r=e.options.theme??_;return s.html`
207
+ <div class="config-panel" part="config-panel">
208
+ <luzmo-tabs selected="data" size=${this.size}>
209
+ <luzmo-tab value="data">${(0,l.msg)(`Data`,{desc:`Label for the data section`})}</luzmo-tab>
210
+ ${this.hideConfigOptions?s.nothing:s.html`<luzmo-tab value="options">${(0,l.msg)(`Options`,{desc:`Label for the options section`})}</luzmo-tab>`}
211
+
212
+ <luzmo-tab-panel value="data">
213
+ <div class="edit-grid">
214
+ <div class="edit-column">
215
+ <luzmo-item-slot-picker-panel
216
+ size=${this.size}
217
+ slot-menu-placement="bottom-end"
218
+ selects=${this.slotSelects}
219
+ ?grows=${this.slotGrows}
220
+ .itemType=${e.type}
221
+ .slotsConfiguration=${this.slotsConfiguration??void 0}
222
+ .slotsContents=${t}
223
+ .datasetIds=${n}
224
+ .authKey=${this.authKey}
225
+ .authToken=${this.authToken}
226
+ .apiUrl=${this.apiUrl}
227
+ .language=${this.language}
228
+ .contentLanguage=${this._effectiveContentLanguage}
229
+ @luzmo-slots-contents-changed=${this._handleSlotsChanged}
230
+ ></luzmo-item-slot-picker-panel>
231
+ </div>
232
+ ${this._renderFilters(e,n)}
233
+ </div>
234
+ </luzmo-tab-panel>
235
+
236
+ ${this.hideConfigOptions?s.nothing:s.html`
237
+ <luzmo-tab-panel value="options">
238
+ <luzmo-item-option-panel
239
+ size=${this.size}
240
+ .itemType=${e.type}
241
+ .options=${e.options||{}}
242
+ .slots=${t}
243
+ .customOptionsConfiguration=${this.customOptionsConfiguration??void 0}
244
+ .customTranslations=${this.customTranslations??void 0}
245
+ .theme=${r}
246
+ .authKey=${this.authKey}
247
+ .authToken=${this.authToken}
248
+ .apiUrl=${this.apiUrl}
249
+ .language=${this.language}
250
+ ?live-interactions=${this.liveInteractions}
251
+ @luzmo-options-changed=${this._handleOptionsChanged}
252
+ @luzmo-option-interaction-start=${this._handleInteractionStart}
253
+ @luzmo-option-interaction-end=${this._handleInteractionClosed}
254
+ @luzmo-option-interaction-cancel=${this._handleInteractionClosed}
255
+ ></luzmo-item-option-panel>
256
+ </luzmo-tab-panel>
257
+ `}
258
+ </luzmo-tabs>
259
+ </div>
260
+ `}_dispatchInteraction(e,{chart:t,generation:n}){e.stopPropagation(),this._dispatch(e.type,{...e.detail,chart:t,generation:n})}render(){return this.chart?s.html`
261
+ <div class="answer" part="container">
262
+ ${this._renderActions()} ${this._renderChart()} ${this._renderFeedback()} ${this._renderConfigPanel()}
263
+ </div>
264
+ `:s.html`
265
+ <div
266
+ class="answer"
267
+ part="container"
268
+ ></div>
269
+ `}};t.t([(0,c.property)({type:Object})],y.prototype,`chart`,void 0),t.t([(0,c.property)({type:Object})],y.prototype,`feedback`,void 0),t.t([(0,c.property)({type:String,attribute:`message-id`})],y.prototype,`messageId`,void 0),t.t([(0,c.property)({type:String,attribute:`auth-key`})],y.prototype,`authKey`,void 0),t.t([(0,c.property)({type:String,attribute:`auth-token`})],y.prototype,`authToken`,void 0),t.t([(0,c.property)({type:String,attribute:`api-url`})],y.prototype,`apiUrl`,void 0),t.t([(0,c.property)({type:String,attribute:`app-server`})],y.prototype,`appServer`,void 0),t.t([(0,c.property)({type:String,attribute:`content-language`})],y.prototype,`contentLanguage`,void 0),t.t([(0,c.property)({type:Boolean,attribute:`hide-actions`,reflect:!0})],y.prototype,`hideActions`,void 0),t.t([(0,c.property)({type:Boolean,attribute:`hide-feedback`,reflect:!0})],y.prototype,`hideFeedback`,void 0),t.t([(0,c.property)({type:Boolean,attribute:`hide-config-panel`,reflect:!0})],y.prototype,`hideConfigPanel`,void 0),t.t([(0,c.property)({type:Boolean,attribute:`hide-config-options`,reflect:!0})],y.prototype,`hideConfigOptions`,void 0),t.t([(0,c.property)({type:String,attribute:`slot-selects`,reflect:!0})],y.prototype,`slotSelects`,void 0),t.t([(0,c.property)({type:Boolean,attribute:`slot-grows`,reflect:!0})],y.prototype,`slotGrows`,void 0),t.t([(0,c.property)({attribute:!1})],y.prototype,`slotsConfiguration`,void 0),t.t([(0,c.property)({attribute:!1})],y.prototype,`customOptionsConfiguration`,void 0),t.t([(0,c.property)({attribute:!1})],y.prototype,`customTranslations`,void 0),t.t([(0,c.property)({attribute:!1})],y.prototype,`chartRenderOptions`,void 0),t.t([(0,c.property)({type:Boolean,attribute:`add-to-dashboard`,reflect:!0})],y.prototype,`addToDashboard`,void 0),t.t([(0,c.property)({attribute:!1})],y.prototype,`dashboardActions`,void 0),t.t([(0,c.property)({type:Boolean,reflect:!0})],y.prototype,`controlled`,void 0),t.t([(0,c.property)({attribute:`can-filter`,converter:{fromAttribute:e=>e===null?void 0:`all`}})],y.prototype,`canFilter`,void 0),t.t([(0,c.property)({type:Boolean,reflect:!0,attribute:`live-interactions`})],y.prototype,`liveInteractions`,void 0),t.t([(0,c.state)()],y.prototype,`_configPanelOpen`,void 0),t.t([(0,c.state)()],y.prototype,`_actionsSlotHasContent`,void 0),t.t([(0,c.query)(`luzmo-embed-viz-item`)],y.prototype,`_embed`,void 0),t.t([(0,c.query)(`luzmo-tabs`)],y.prototype,`_configTabs`,void 0),t.t([(0,c.state)()],y.prototype,`_configPanelPending`,void 0),t.t([(0,c.state)()],y.prototype,`_configPanelLoadFailed`,void 0),customElements.get(`luzmo-interactive-viz-item`)||customElements.define(`luzmo-interactive-viz-item`,y),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return y}});
@@ -51,6 +51,7 @@ export declare class LuzmoItemGrid extends ItemGridBase {
51
51
  /** Retains the public lifecycle hook from the original grid API. */
52
52
  firstUpdated(changedProperties?: PropertyValues): void;
53
53
  protected updated(changedProperties: PropertyValues): void;
54
+ /** The grid items paired with their rendered grid elements. */
54
55
  get gridItems(): GridItemLookup[];
55
56
  getGridItemById(id: string): GridItemLookup | undefined;
56
57
  }
@@ -17,4 +17,4 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../item-slot-picker-panel-BhhN54IM.cjs");Object.defineProperty(exports,"LuzmoItemSlotPickerPanel",{enumerable:!0,get:function(){return e.t}});
20
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../item-slot-picker-panel-Cw3UCK03.cjs");Object.defineProperty(exports,"LuzmoItemSlotPickerPanel",{enumerable:!0,get:function(){return e.t}});
@@ -17,4 +17,4 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- export { t as LuzmoItemSlotPickerPanel } from "../item-slot-picker-panel-fJqEmxeD.js";
20
+ export { t as LuzmoItemSlotPickerPanel } from "../item-slot-picker-panel-DprM9Rli.js";
@@ -46,6 +46,13 @@ export declare class LuzmoItemSlotPickerPanel extends LuzmoItemSlotPickerPanel_b
46
46
  * Loaded separately from the full dataset data using virtual infinite scroll.
47
47
  */
48
48
  private _datasetListItems;
49
+ /**
50
+ * Datasets matching the dataset picker search, fetched from the API so datasets beyond the loaded pages can be found.
51
+ */
52
+ private _datasetSearchItems;
53
+ private _datasetSearchValue;
54
+ private _datasetSearchRequestId;
55
+ private _datasetSearchDebounceTimer;
49
56
  /**
50
57
  * Whether the dataset list is being retrieved (for infinite scroll).
51
58
  */
@@ -128,7 +135,7 @@ export declare class LuzmoItemSlotPickerPanel extends LuzmoItemSlotPickerPanel_b
128
135
  datasetIds: string[];
129
136
  /**
130
137
  * The currently selected dataset ID.
131
- * If not provided, defaults to the first available dataset.
138
+ * If not provided, defaults to the first available dataset, except when the panel fetches the dataset list itself.
132
139
  */
133
140
  selectedDatasetId?: string;
134
141
  /**
@@ -200,6 +207,7 @@ export declare class LuzmoItemSlotPickerPanel extends LuzmoItemSlotPickerPanel_b
200
207
  * Get all dataset IDs currently used in slots
201
208
  */
202
209
  private _getUsedDatasetIds;
210
+ disconnectedCallback(): void;
203
211
  protected willUpdate(changedProperties: PropertyValues): void;
204
212
  private _updateCurrentDatasetId;
205
213
  /**
@@ -219,6 +227,16 @@ export declare class LuzmoItemSlotPickerPanel extends LuzmoItemSlotPickerPanel_b
219
227
  * Handle picker opened event - load initial data if needed.
220
228
  */
221
229
  private _handlePickerOpened;
230
+ /**
231
+ * Search the API for datasets when the panel fetches its own list, since the select only filters the loaded options.
232
+ */
233
+ private _handleDatasetSearch;
234
+ private _handleDatasetPickerClosed;
235
+ /**
236
+ * Drop search results except the selected dataset, so the picker keeps showing its name.
237
+ */
238
+ private _keepOnlySelectedSearchItem;
239
+ private _clearDatasetSearchTimer;
222
240
  /**
223
241
  * Handle dataset change from the picker
224
242
  */
@@ -0,0 +1,84 @@
1
+ /*! * A kit of modern Luzmo Web Components for analytics in your web application.
2
+ *
3
+ * Copyright © 2026 Luzmo
4
+ * All rights reserved.
5
+ * Luzmo web components (“Luzmo Web Components”)
6
+ * must be used according to the Luzmo Terms of Service.
7
+ * This license allows users with a current active Luzmo account
8
+ * to use the Luzmo Web Components. This license terminates
9
+ * automatically if a user no longer has an active Luzmo account.
10
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ * SOFTWARE.
19
+ * */
20
+ require("./tokens-BWMfo_w4.cjs");const e=require("./base-CGDNY_7v.cjs"),t=require("./decorate-DCJt-2rt.cjs"),n=require("./localized-mixin-EoNvtTBG.cjs"),r=require("./data-broker-DCghLjhq.cjs"),i=require("./type-check-BehV9ZL1.cjs"),a=require("./localize-D3i4Epy_.cjs"),o=require("./slots-config-B6AOo19R.cjs"),s=require("./slot-labels.config-DKnxOncr.cjs");require("./item-slot-picker-O9HKr3mv.cjs");let c=require("lit"),l=require("lit/decorators.js"),u=require("@lit/localize");require("@luzmo/lucero/select"),require("@luzmo/lucero/field-label");let d=require("lit/directives/if-defined.js"),f=require("@lit/task");var p=`:host{font-size:var(--luzmo-item-slot-picker-panel-font-size,var(--luzmo-font-size));font-family:var(--luzmo-font-family,sans-serif);color:var(--luzmo-font-color,inherit);display:block}:host([size=s]){font-size:var(--luzmo-item-slot-picker-panel-font-size-s,var(--luzmo-font-size-s))}:host([size=l]){font-size:var(--luzmo-item-slot-picker-panel-font-size-l,var(--luzmo-font-size-l))}:host([size=xl]){font-size:var(--luzmo-item-slot-picker-panel-font-size-xl,var(--luzmo-font-size-xl))}.container{flex-direction:column;align-items:flex-start;display:flex}.dataset-picker{align-self:stretch;align-items:flex-start;gap:var(--luzmo-item-slot-picker-panel-dataset-picker-gap,var(--luzmo-spacing-2));border-bottom-style:solid;border-bottom-width:var(--luzmo-item-slot-picker-panel-dataset-picker-border-width,1px);border-bottom-color:var(--luzmo-item-slot-picker-panel-dataset-picker-border-color,var(--luzmo-border-color));flex-direction:column;flex-shrink:0;margin-block-end:var(--luzmo-item-slot-picker-panel-dataset-picker-margin-block-end,var(--luzmo-spacing-4));padding-block-end:var(--luzmo-item-slot-picker-panel-dataset-picker-padding-block-end,var(--luzmo-spacing-4));display:flex}.slots-panel{gap:var(--luzmo-item-slot-picker-panel-gap,var(--luzmo-spacing-5));flex-direction:column;display:flex}.slot-container{gap:var(--luzmo-item-slot-picker-panel-slot-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}luzmo-field-label{margin:0}luzmo-item-slot-picker{display:block}:host([grows]) .container{align-items:stretch;width:100%}:host([grows]) .dataset-picker{align-items:stretch}:host([grows]) .dataset-picker luzmo-select{width:100%}`,m,h=50,g=400,_=(m=class extends n.t(e.n(e.i,{validSizes:[`s`,`m`,`l`,`xl`],noDefaultSize:!0})){constructor(...e){super(...e),this._loadSlotsConfig=new f.Task(this,{task:async([e])=>{if(e&&e!==this._itemTypeLoaded){this._itemTypeLoaded=e;let t=await o.t(e);return this._slotsConfig=t??[],this._slotsConfig}return this._slotsConfig},args:()=>[this.itemType,this.language]}),this._slotsConfig=[],this._datasetListItems=[],this._datasetSearchItems=[],this._datasetSearchValue=``,this._datasetSearchRequestId=0,this._datasetSearchDebounceTimer=null,this._datasetListRetrieving=!1,this._datasetListPending=!1,this._datasetNamesFetchAttempted=!1,this._hasMoreDatasets=!0,this._fetchedDatasetsDataFields=[],this._failedDatasetIds=new Set,this._loadDataFieldsTask=new f.Task(this,{args:()=>[this._currentDatasetId,this.apiUrl,this.authKey,this.authToken,this.datasetsDataFields.length],task:async([e,t,n,a,o])=>{if(o>0||!e)return null;if(!i.s(e))return console.warn(`[LuzmoItemSlotPickerPanel] Invalid dataset ID provided (not a valid UUID): ${e}`),this._failedDatasetIds.add(e),null;if(this._failedDatasetIds.has(e))return null;let s=this._fetchedDatasetsDataFields.find(t=>t.id===e);if(s&&s.columns&&s.columns.length>0)return s;try{let t=await r.n.fetchDatasetsWithColumnsAndFormulas([e]);if(t.length===0)return this._failedDatasetIds.add(e),null;let n=t[0],i=this._fetchedDatasetsDataFields.findIndex(t=>t.id===e);return i===-1?this._fetchedDatasetsDataFields=[...this._fetchedDatasetsDataFields,n]:this._fetchedDatasetsDataFields[i]=n,n}catch(t){return console.warn(`Failed to fetch dataset data fields:`,t),this._failedDatasetIds.add(e),null}}}),this.contentLanguage=`en`,this.slotsContents=[],this.selects=`multiple`,this.dataFieldsSearch=`auto`,this.datasetSearch=`auto`,this.icons=`menu-only`,this.datasetsDataFields=[],this.datasetIds=[],this.datasetPicker=!1,this.apiUrl=`https://api.luzmo.com`,this.placement=`bottom-start`,this.slotMenuPlacement=`bottom-end`,this.slotMenuMode=`overlay`,this.constraintMode=`auto`,this.grows=!1,this._currentSlotsContents=[],this._createSlotChangeHandler=e=>t=>{t.preventDefault(),t.stopPropagation();let n=t.detail.slotContents??[],r=this._applySlotConstraints(e,n);r!==null&&(this._currentSlotsContents=r,this.slotsContents=structuredClone(r),this.dispatchEvent(new CustomEvent(`luzmo-slots-contents-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotsContents:r}})))}}get _availableDatasets(){if(this.datasetsDataFields.length>0)return this.datasetsDataFields;if(this.datasetIds.length>0)return this.datasetIds.map(e=>{let t=this._datasetListItems.find(t=>t.id===e);return t?{id:t.id,name:t.name,description:t.description}:{id:e,name:{en:e}}});let e=[...this._datasetListItems,...this._datasetSearchItems.filter(e=>!this._datasetListItems.some(t=>t.id===e.id))];return e.length>0?e.map(e=>({id:e.id,name:e.name,description:e.description})):[]}get _currentDatasetsDataFields(){if(this.datasetsDataFields.length>0){if(!this._currentDatasetId)return this.datasetsDataFields;let e=this.datasetsDataFields.find(e=>e.id===this._currentDatasetId);return e?[e]:this.datasetsDataFields}let e=this._loadDataFieldsTask.value;if(e)return[{id:e.id,name:e.name,description:e.description,columns:e.columns??[],formulas:e.formulas??[]}];if(this._fetchedDatasetsDataFields.length>0&&this._currentDatasetId){let e=this._fetchedDatasetsDataFields.find(e=>e.id===this._currentDatasetId);if(e)return[{id:e.id,name:e.name,description:e.description,columns:e.columns??[],formulas:e.formulas??[]}]}return[]}get _shouldFetchDatasetList(){return this.datasetPicker&&this.datasetsDataFields.length===0}_areDatasetsLinked(e,t){return e===t}_getUsedDatasetIds(){let e=new Set;for(let t of this._currentSlotsContents)for(let n of t.content)n.datasetId&&e.add(n.datasetId);return[...e]}disconnectedCallback(){super.disconnectedCallback(),this._clearDatasetSearchTimer()}willUpdate(e){super.willUpdate(e),e.has(`slotsContents`)&&(this._currentSlotsContents=structuredClone(this.slotsContents??[]));let t=e.has(`selectedDatasetId`),n=e.has(`datasetsDataFields`),i=e.has(`datasetIds`),a=e.has(`datasetPicker`),o=e.has(`authKey`),s=e.has(`authToken`),c=e.has(`apiUrl`);(i||o||s||c)&&(this._datasetListItems=[],this._datasetSearchItems=[],this._datasetSearchValue=``,this._datasetSearchRequestId++,this._clearDatasetSearchTimer(),this._hasMoreDatasets=!0,this._datasetNamesFetchAttempted=!1,this._fetchedDatasetsDataFields=[],this._failedDatasetIds.clear(),r.n.configure({apiUrl:this.apiUrl,authKey:this.authKey??``,authToken:this.authToken??``})),n&&this.datasetsDataFields.length>0&&(this._datasetListItems=[],this._hasMoreDatasets=!0,this._fetchedDatasetsDataFields=[],this._failedDatasetIds.clear()),(t||n||i)&&this._updateCurrentDatasetId(),(i||o||s||c||a)&&this.datasetIds.length>0&&this.datasetPicker&&this.datasetsDataFields.length===0&&this._datasetListItems.length===0&&this._fetchDatasetNamesForPicker()}_updateCurrentDatasetId(){let e=this._availableDatasets;this._currentDatasetId=this.selectedDatasetId&&e.some(e=>e.id===this.selectedDatasetId)||this.selectedDatasetId&&this.datasetIds.includes(this.selectedDatasetId)?this.selectedDatasetId:e.length>0?e[0].id:void 0}async _fetchDatasetNamesForPicker(){if(this.datasetIds.length!==0){this._datasetListPending=!0;try{let e=await r.n.fetchDatasetNames(this.datasetIds);this._datasetListItems=e}catch(e){console.warn(`Failed to fetch dataset names:`,e)}finally{this._datasetListPending=!1,this._datasetNamesFetchAttempted=!0}}}async _loadMoreDatasets(e){if(!this._datasetListRetrieving&&this._hasMoreDatasets){this._datasetListRetrieving=!0,e&&(e.retrieving=!0);try{let e=this._datasetListItems.length,t=await r.n.fetchAllDatasets({offset:e,limit:h});if(this._datasetListItems=[...this._datasetListItems,...t.data],this._hasMoreDatasets=e+h<(t.pagination?.total??0),!this._currentDatasetId){let e=this.selectedDatasetId??this._getUsedDatasetIds()[0];e&&this._datasetListItems.some(t=>t.id===e)&&(this._currentDatasetId=e)}}catch(e){console.warn(`Failed to load dataset list:`,e),this._hasMoreDatasets=!1}finally{this._datasetListRetrieving=!1,e&&(e.retrieving=!1)}}}_handlePickerScrolled(e){if(this.datasetIds.length>0||this._datasetSearchValue)return;let t=e.target,{last:n}=e.detail;n>=this._datasetListItems.length-10&&this._hasMoreDatasets&&this._loadMoreDatasets(t)}async _handlePickerOpened(e){let t=e.target;this._datasetListItems.length===0&&this._shouldFetchDatasetList&&this.datasetIds.length===0&&this._hasMoreDatasets&&await this._loadMoreDatasets(t)}_handleDatasetSearch(e){if(!this._shouldFetchDatasetList||this.datasetIds.length>0)return;let t=e.target,n=(e.detail?.string??``).trim();if(n===this._datasetSearchValue)return;this._datasetSearchValue=n,this._clearDatasetSearchTimer();let i=++this._datasetSearchRequestId;n?(t.retrieving=!0,this._datasetSearchDebounceTimer=window.setTimeout(async()=>{this._datasetSearchDebounceTimer=null;try{let e=await r.n.searchDatasets(n,{limit:h});i===this._datasetSearchRequestId&&(this._keepOnlySelectedSearchItem(),this._datasetSearchItems=[...this._datasetSearchItems,...e.data.filter(e=>!this._datasetSearchItems.some(t=>t.id===e.id))])}catch(e){console.warn(`Failed to search datasets:`,e)}finally{i===this._datasetSearchRequestId&&(t.retrieving=!1)}},g)):(this._keepOnlySelectedSearchItem(),t.retrieving=!1)}_handleDatasetPickerClosed(e){this._clearDatasetSearchTimer(),this._datasetSearchRequestId++,this._datasetSearchValue=``,e.target.retrieving=!1,this._keepOnlySelectedSearchItem()}_keepOnlySelectedSearchItem(){this._datasetSearchItems=this._datasetSearchItems.filter(e=>e.id===this._currentDatasetId)}_clearDatasetSearchTimer(){this._datasetSearchDebounceTimer!==null&&(clearTimeout(this._datasetSearchDebounceTimer),this._datasetSearchDebounceTimer=null)}_handleDatasetChange(e){let t=e.detail?.value?.[0];if(!t||t===this._currentDatasetId)return;let n=this._getUsedDatasetIds(),r=this._currentSlotsContents.some(e=>e.content.length>0),i=n.every(e=>this._areDatasetsLinked(e,t));if(r&&!i){if(this.constraintMode===`event-only`){this.dispatchEvent(new CustomEvent(`luzmo-dataset-constraint-triggered`,{bubbles:!0,composed:!0,detail:{previousDatasetId:this._currentDatasetId,newDatasetId:t,currentSlotsContents:structuredClone(this._currentSlotsContents),wouldClearSlots:!0}}));return}this._currentSlotsContents=[],this.slotsContents=[],this.dispatchEvent(new CustomEvent(`luzmo-slots-contents-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotsContents:[]}}))}this._currentDatasetId=t,this.dispatchEvent(new CustomEvent(`luzmo-dataset-changed`,{bubbles:!0,composed:!0,detail:{datasetId:t}}))}_getSlotContents(e){return this._currentSlotsContents?.find(t=>t.name===e)?.content??[]}_applySlotConstraints(e,t){let n=this.slotsConfiguration??this._slotsConfig,r=structuredClone(this._currentSlotsContents),i=structuredClone(this._currentSlotsContents),a=i.findIndex(t=>t.name===e);a===-1?i.push({name:e,content:t}):i[a].content=t;let o=[];for(let r of n){if(r.keepOnlyFirstWhenOtherSlotFilled?.includes(e)&&t.length>0){let t=i.findIndex(e=>e.name===r.name);t!==-1&&i[t].content.length>1&&(o.push({type:`keepOnlyFirstWhenOtherSlotFilled`,affectedSlotName:r.name,triggeredBySlotName:e}),i[t].content=[i[t].content[0]])}if(r.clearWhenOtherSlotHasMultipleItems?.includes(e)&&t.length>1){let t=i.findIndex(e=>e.name===r.name);t!==-1&&i[t].content.length>0&&(o.push({type:`clearWhenOtherSlotHasMultipleItems`,affectedSlotName:r.name,triggeredBySlotName:e}),i[t].content=[])}}if(this.constraintMode===`event-only`&&o.length>0){let n={triggerSlotName:e,proposedTriggerContents:t,originalSlotsContents:r,proposedSlotsContents:i,constraints:o};return this.dispatchEvent(new CustomEvent(`luzmo-slot-constraint-triggered`,{detail:n,bubbles:!0,composed:!0})),null}return i}_getTranslatedLabel(e){let t=(typeof e.label==`string`?e.label:e.label?a.t(e.label,this.language):void 0)??e.name;return s.t[t]?s.t[t]():t}_renderDatasetPicker(){if(!this.datasetPicker)return c.nothing;let e=this._availableDatasets,t=e.length>1,n=this.datasetIds.length>0,r=this._shouldFetchDatasetList;if(!t&&!n&&!r)return c.nothing;let i=this._datasetListPending||this.datasetIds.length>0&&this._datasetListItems.length===0&&this.datasetsDataFields.length===0&&!this._datasetNamesFetchAttempted,o=i?[]:e.map(e=>({value:e.id,label:a.t(e.name,this.contentLanguage)||e.id})),s=i?[]:this._currentDatasetId?[this._currentDatasetId]:[],l=i?(0,u.msg)(`Loading datasets...`):(0,u.msg)(`Select dataset...`);return c.html`
21
+ <div class="dataset-picker" part="dataset-picker">
22
+ <luzmo-field-label part="dataset-field-label" size=${this.size}>
23
+ ${this.datasetPickerLabel??(0,u.msg)(`Dataset`)}
24
+ </luzmo-field-label>
25
+ <luzmo-select
26
+ selects="single"
27
+ variant="highlight"
28
+ search=${(0,d.ifDefined)(this.datasetSearch)}
29
+ placement=${this.placement}
30
+ .size=${this.size}
31
+ .options=${o}
32
+ .value=${s}
33
+ .label=${l}
34
+ ?pending=${i}
35
+ @change=${this._handleDatasetChange}
36
+ @luzmo-opened=${this._handlePickerOpened}
37
+ @luzmo-scrolled=${this._handlePickerScrolled}
38
+ @luzmo-search=${this._handleDatasetSearch}
39
+ @luzmo-closed=${this._handleDatasetPickerClosed}
40
+ ></luzmo-select>
41
+ </div>
42
+ `}_renderSlot(e){let t=this._getSlotContents(e.name),n=this._createSlotChangeHandler(e.name),r=this._getTranslatedLabel(e);return c.html`
43
+ <div class="slot-container" part="slot-container">
44
+ <luzmo-field-label part="field-label" size=${this.size}>
45
+ ${r}
46
+ </luzmo-field-label>
47
+ <luzmo-item-slot-picker
48
+ part="item-slot-picker"
49
+ item-type=${(0,d.ifDefined)(this.itemType)}
50
+ slot-name=${e.name}
51
+ language=${this.language}
52
+ content-language=${this.contentLanguage}
53
+ api-url=${(0,d.ifDefined)(this.apiUrl)}
54
+ auth-key=${(0,d.ifDefined)(this.authKey)}
55
+ auth-token=${(0,d.ifDefined)(this.authToken)}
56
+ size=${this.size}
57
+ selects=${this.selects}
58
+ search=${(0,d.ifDefined)(this.dataFieldsSearch)}
59
+ icons=${(0,d.ifDefined)(this.icons)}
60
+ placement=${this.placement}
61
+ slot-menu-placement=${this.slotMenuPlacement}
62
+ slot-menu-mode=${this.slotMenuMode}
63
+ ?grows=${this.grows}
64
+ aria-required=${e.isRequired?`true`:c.nothing}
65
+ .slotConfiguration=${e}
66
+ .slotContents=${t}
67
+ .datasetsDataFields=${this._currentDatasetsDataFields}
68
+ @luzmo-slot-contents-changed=${n}
69
+ ></luzmo-item-slot-picker>
70
+ </div>
71
+ `}_renderSlots(e){let t=e.map(e=>this._renderSlot(e));return c.html`
72
+ <div class="slots-panel" part="slots-panel">
73
+ ${t}
74
+ </div>
75
+ `}_renderContent(e){return c.html`
76
+ <div class="container" part="container">
77
+ ${this._renderDatasetPicker()}
78
+ ${this._renderSlots(e)}
79
+ </div>
80
+ `}render(){return this.slotsConfiguration&&this.slotsConfiguration.length>0?this._renderContent(this.slotsConfiguration):this._loadSlotsConfig.render({pending:()=>c.html`
81
+ <p role="status">Loading...</p>
82
+ `,complete:e=>!e||e.length===0?c.html`<p>No slots configuration found for ${this.itemType}</p>`:this._renderContent(e),error:e=>c.html`
83
+ <div role="alert">Could not load slots configuration for '${this.itemType}': ${e}.</div>
84
+ `})}},m.styles=(0,c.unsafeCSS)(p),m);t.t([(0,l.state)()],_.prototype,`_datasetListItems`,void 0),t.t([(0,l.state)()],_.prototype,`_datasetSearchItems`,void 0),t.t([(0,l.state)()],_.prototype,`_datasetListRetrieving`,void 0),t.t([(0,l.state)()],_.prototype,`_datasetListPending`,void 0),t.t([(0,l.state)()],_.prototype,`_currentDatasetId`,void 0),t.t([(0,l.state)()],_.prototype,`_fetchedDatasetsDataFields`,void 0),t.t([(0,l.property)({type:String,reflect:!0,attribute:`item-type`})],_.prototype,`itemType`,void 0),t.t([(0,l.property)({type:String,attribute:`content-language`,reflect:!0})],_.prototype,`contentLanguage`,void 0),t.t([(0,l.property)({type:Array})],_.prototype,`slotsConfiguration`,void 0),t.t([(0,l.property)({type:Array})],_.prototype,`slotsContents`,void 0),t.t([(0,l.property)({type:String,reflect:!0})],_.prototype,`selects`,void 0),t.t([(0,l.property)({type:String,reflect:!0,attribute:`data-fields-search`})],_.prototype,`dataFieldsSearch`,void 0),t.t([(0,l.property)({type:String,reflect:!0,attribute:`dataset-search`})],_.prototype,`datasetSearch`,void 0),t.t([(0,l.property)({type:String,reflect:!0})],_.prototype,`icons`,void 0),t.t([(0,l.property)({type:Array,reflect:!1})],_.prototype,`datasetsDataFields`,void 0),t.t([(0,l.property)({type:Array,attribute:`dataset-ids`})],_.prototype,`datasetIds`,void 0),t.t([(0,l.property)({type:String,attribute:`selected-dataset-id`,reflect:!0})],_.prototype,`selectedDatasetId`,void 0),t.t([(0,l.property)({type:Boolean,attribute:`dataset-picker`,reflect:!0})],_.prototype,`datasetPicker`,void 0),t.t([(0,l.property)({type:String,attribute:`dataset-picker-label`})],_.prototype,`datasetPickerLabel`,void 0),t.t([(0,l.property)({type:String,attribute:`api-url`})],_.prototype,`apiUrl`,void 0),t.t([(0,l.property)({type:String,attribute:`auth-key`})],_.prototype,`authKey`,void 0),t.t([(0,l.property)({type:String,attribute:`auth-token`})],_.prototype,`authToken`,void 0),t.t([(0,l.property)({type:String,reflect:!0})],_.prototype,`placement`,void 0),t.t([(0,l.property)({type:String,reflect:!0,attribute:`slot-menu-placement`})],_.prototype,`slotMenuPlacement`,void 0),t.t([(0,l.property)({type:String,reflect:!0,attribute:`slot-menu-mode`})],_.prototype,`slotMenuMode`,void 0),t.t([(0,l.property)({type:String,reflect:!0,attribute:`constraint-mode`})],_.prototype,`constraintMode`,void 0),t.t([(0,l.property)({type:Boolean,reflect:!0})],_.prototype,`grows`,void 0),t.t([(0,l.state)()],_.prototype,`_currentSlotsContents`,void 0),_=t.t([(0,u.localized)()],_),customElements.get(`luzmo-item-slot-picker-panel`)||customElements.define(`luzmo-item-slot-picker-panel`,_),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});