@arcgis/charts-components 5.2.0-next.46 → 5.2.0-next.47

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.
@@ -1,21 +1,24 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as d } from "../../chunks/runtime.js";
3
- import { keyed as m } from "lit/directives/keyed.js";
4
- import { u as p } from "../../chunks/useT9n.js";
5
- import { css as C, html as r } from "lit";
6
- import { LitElement as g, createEvent as o, safeClassMap as c, renderElement as f } from "@arcgis/lumina";
7
- import { repeat as v } from "lit/directives/repeat.js";
8
- import { g as u } from "../../chunks/chart-ui-utils.js";
9
- import { r as w } from "../../chunks/popover-ui-utils.js";
10
- const n = {
2
+ import { c as C } from "../../chunks/runtime.js";
3
+ import { keyed as g } from "lit/directives/keyed.js";
4
+ import { u as f } from "../../chunks/useT9n.js";
5
+ import { css as u, nothing as m, html as r } from "lit";
6
+ import { LitElement as v, createEvent as c, safeClassMap as n, renderElement as w } from "@arcgis/lumina";
7
+ import { repeat as $ } from "lit/directives/repeat.js";
8
+ import { g as R } from "../../chunks/chart-ui-utils.js";
9
+ import { r as I } from "../../chunks/popover-ui-utils.js";
10
+ import { ct as b } from "../../chunks/index2.js";
11
+ import { c as L } from "../../chunks/model-types.js";
12
+ import { M as s } from "../../chunks/common.js";
13
+ const h = {
11
14
  addChartContainer: "add-chart-container",
12
15
  viewChartComponent: "view-chart-component",
13
16
  header: "header",
14
17
  dropdownPopup: "dropdown-popup"
15
- }, I = C`.view-chart-component{width:var(--arcgis-charts-config-panel-width);height:var(--arcgis-charts-config-panel-height)}.add-chart-container{display:flex;justify-content:center;padding:2rem 0;background-color:var(--calcite-color-background)}.header{margin-left:1rem}.dropdown-popup{position:relative}`;
16
- class R extends g {
18
+ }, P = u`.view-chart-component{width:var(--arcgis-charts-config-panel-width);height:var(--arcgis-charts-config-panel-height)}.add-chart-container{display:flex;justify-content:center;padding:2rem 0;background-color:var(--calcite-color-background)}.header{margin-left:1rem}.dropdown-popup{position:relative}`;
19
+ class y extends v {
17
20
  constructor() {
18
- super(...arguments), this._messages = p(), this.chartRenamePopover = null, this.popoverClose = () => {
21
+ super(...arguments), this._messages = f(), this.chartRenamePopover = null, this.popoverClose = () => {
19
22
  const e = this.modelList?.find((t) => t.chartId === this.selectedChartId);
20
23
  this.chartTitle = e?.titleText ?? "", this.selectedActionChartId = "", this.removeChartRenamePopover();
21
24
  }, this.onChartRename = (e) => {
@@ -30,17 +33,17 @@ class R extends g {
30
33
  if (e.detail !== null && e.detail !== void 0) {
31
34
  const { newIndex: t, oldIndex: i } = e.detail;
32
35
  if (this.modelList !== void 0 && this.modelList?.length > 0) {
33
- const a = [...this.modelList], s = a?.[i], h = a?.[t];
34
- s && h && (a.splice(i, 1), a.splice(t, 0, s)), this.chartsOrderReorderCounter += 1, this.arcgisChartsConfigModelListReorder.emit({ modelList: a });
36
+ const a = [...this.modelList], o = a?.[i], l = a?.[t];
37
+ o && l && (a.splice(i, 1), a.splice(t, 0, o)), this.chartsOrderReorderCounter += 1, this.arcgisChartsConfigModelListReorder.emit({ modelList: a });
35
38
  }
36
39
  }
37
- }, this.isChartRenamePopoverOpen = !1, this.chartTitle = "", this.chartsOrderReorderCounter = 0, this.noGroup = !1, this.disableEditing = !1, this.arcgisChartsConfigModelListReorder = o(), this.arcgisChartsConfigViewChartAddChart = o(), this.arcgisChartsConfigViewChartDelete = o(), this.arcgisChartsConfigViewChartEdit = o(), this.arcgisChartsConfigViewChartSelect = o();
40
+ }, this.isChartRenamePopoverOpen = !1, this.chartTitle = "", this.chartsOrderReorderCounter = 0, this.noGroup = !1, this.disableEditing = !1, this.arcgisChartsConfigModelListReorder = c(), this.arcgisChartsConfigViewChartAddChart = c(), this.arcgisChartsConfigViewChartDelete = c(), this.arcgisChartsConfigViewChartEdit = c(), this.arcgisChartsConfigViewChartSelect = c();
38
41
  }
39
42
  static {
40
43
  this.properties = { isChartRenamePopoverOpen: 16, chartTitle: 16, selectedActionChartId: 16, chartsOrderReorderCounter: 16, messageOverrides: 0, selectedChartId: 1, layer: 0, modelList: 0, noGroup: 5, disableEditing: 5 };
41
44
  }
42
45
  static {
43
- this.styles = I;
46
+ this.styles = P;
44
47
  }
45
48
  willUpdate(e) {
46
49
  e.has("modelList") && this.modelListChange(this.modelList, e.get("modelList"));
@@ -62,12 +65,40 @@ class R extends g {
62
65
  layerType: this.layer?.type
63
66
  });
64
67
  }
68
+ buildTooltipLine(e, t) {
69
+ const i = typeof document < "u" && document.documentElement.dir.toLowerCase() === "rtl", a = `${b(i)} `;
70
+ return `${e}${a}${t}`;
71
+ }
72
+ getChartTypeLabel(e) {
73
+ switch (L(e.chartType)) {
74
+ case s.BarChart:
75
+ return this._messages.barChart ?? "";
76
+ case s.LineChart:
77
+ return this._messages.lineChart ?? "";
78
+ case s.PieChart:
79
+ return this._messages.pieChart ?? "";
80
+ case s.Histogram:
81
+ return this._messages.histogram ?? "";
82
+ case s.Scatterplot:
83
+ return this._messages.scatterplot ?? "";
84
+ case s.BoxPlot:
85
+ return this._messages.boxPlot ?? "";
86
+ case s.HeatChart:
87
+ return this._messages.calendarHeatChart ?? "";
88
+ default:
89
+ return "";
90
+ }
91
+ }
92
+ buildChartTooltip(e) {
93
+ const t = this.getChartTypeLabel(e);
94
+ return this.buildTooltipLine(this._messages.chartType ?? "", t ?? "");
95
+ }
65
96
  buildChartList() {
66
- const e = this.modelList ? v(this.modelList, (t) => t.chartId, (t, i) => {
67
- const a = t.chartId, s = t.titleText, h = u(t.config);
68
- return r`<calcite-list-item .label=${s ?? a ?? this._messages.chartTitle} .selected=${this.selectedChartId === (a?.toString() ?? i.toString())} .value=${a ?? i.toString()} @click=${this.onChartSelect}><calcite-icon slot=content-start .icon=${h}></calcite-icon>${this.disableEditing ? null : r`<calcite-dropdown slot=actions-end overlay-positioning=fixed placement=bottom-end .open=${this.selectedActionChartId === a} @calciteDropdownClose=${() => this.chartActionClosed(a ?? "")} @calciteDropdownOpen=${() => this.chartActionOpened(a ?? "")} class=${c(n.dropdownPopup)}><calcite-action scale=l .text=${this._messages.chartActions ?? ""} slot=trigger .active=${a === this.selectedActionChartId}><calcite-icon icon=ellipsis></calcite-icon></calcite-action><calcite-dropdown-group selection-mode=none><calcite-dropdown-item accesskey=edit @calciteDropdownItemSelect=${this.chartEditSelect}>${this._messages.edit}</calcite-dropdown-item><calcite-dropdown-item accesskey=rename @click=${(l) => l.stopPropagation()} @calciteDropdownItemSelect=${this.chartRenameSelect}>${this._messages.rename}</calcite-dropdown-item><calcite-dropdown-item accesskey=delete @calciteDropdownItemSelect=${this.chartDeleteSelect}>${this._messages.delete}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`}</calcite-list-item>`;
97
+ const e = this.modelList ? $(this.modelList, (t) => t.chartId, (t, i) => {
98
+ const a = t.chartId, o = t.titleText, l = R(t.config), d = this.buildChartTooltip(t);
99
+ return r`<calcite-list-item .label=${o ?? a ?? this._messages.chartTitle} title=${d ?? m} .selected=${this.selectedChartId === (a?.toString() ?? i.toString())} .value=${a ?? i.toString()} @click=${this.onChartSelect}><calcite-icon slot=content-start .icon=${l} title=${d ?? m}></calcite-icon>${this.disableEditing ? null : r`<calcite-dropdown slot=actions-end overlay-positioning=fixed placement=bottom-end .open=${this.selectedActionChartId === a} @calciteDropdownClose=${() => this.chartActionClosed(a ?? "")} @calciteDropdownOpen=${() => this.chartActionOpened(a ?? "")} class=${n(h.dropdownPopup)}><calcite-action scale=l .text=${this._messages.chartActions ?? ""} slot=trigger .active=${a === this.selectedActionChartId}><calcite-icon icon=ellipsis></calcite-icon></calcite-action><calcite-dropdown-group selection-mode=none><calcite-dropdown-item accesskey=edit @calciteDropdownItemSelect=${this.chartEditSelect}>${this._messages.edit}</calcite-dropdown-item><calcite-dropdown-item accesskey=rename @click=${(p) => p.stopPropagation()} @calciteDropdownItemSelect=${this.chartRenameSelect}>${this._messages.rename}</calcite-dropdown-item><calcite-dropdown-item accesskey=delete @calciteDropdownItemSelect=${this.chartDeleteSelect}>${this._messages.delete}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`}</calcite-list-item>`;
69
100
  }) : null;
70
- return this.layer ? r`<div>${this.noGroup ? null : r`<p class=${c(n.header)}>${this.layer.title ?? this.layer.id.toString()}</p>`}${m(this.chartsOrderReorderCounter, r`<calcite-list label .dragEnabled=${!this.disableEditing} selection-mode=single selection-appearance=border @calciteListOrderChange=${this.onCalciteListOrderChange}>${e}${this.disableEditing ? null : r`<div class=${c(n.addChartContainer)}><calcite-fab slot=fab appearance=outline-fill kind=neutral text-enabled .text=${this._messages.addChart} .label=${this._messages.addChart} @click=${this.onAddChartClick} scale=s></calcite-fab></div>`}</calcite-list>`)}</div>` : null;
101
+ return this.layer ? r`<div>${this.noGroup ? null : r`<p class=${n(h.header)}>${this.layer.title ?? this.layer.id.toString()}</p>`}${g(this.chartsOrderReorderCounter, r`<calcite-list label .dragEnabled=${!this.disableEditing} selection-mode=single selection-appearance=border @calciteListOrderChange=${this.onCalciteListOrderChange}>${e}${this.disableEditing ? null : r`<div class=${n(h.addChartContainer)}><calcite-fab slot=fab appearance=outline-fill kind=neutral text-enabled .text=${this._messages.addChart} .label=${this._messages.addChart} @click=${this.onAddChartClick} scale=s></calcite-fab></div>`}</calcite-list>`)}</div>` : null;
71
102
  }
72
103
  onChartSelect(e) {
73
104
  const t = e.currentTarget;
@@ -81,7 +112,7 @@ class R extends g {
81
112
  }
82
113
  chartRenameSelect(e) {
83
114
  if (!this.disableEditing) {
84
- const i = e.target.closest("calcite-list-item"), a = this.modelList?.find((s) => s.chartId === this.selectedActionChartId);
115
+ const i = e.target.closest("calcite-list-item"), a = this.modelList?.find((o) => o.chartId === this.selectedActionChartId);
85
116
  i !== null && (this.renameReferenceElement = i), this.arcgisChartsConfigViewChartSelect.emit({
86
117
  chartId: this.selectedActionChartId
87
118
  }), this.chartTitle = a?.titleText ?? "", this.setupRenamePopover();
@@ -99,16 +130,16 @@ class R extends g {
99
130
  this.selectedActionChartId = e;
100
131
  }
101
132
  setupRenamePopover() {
102
- this.isChartRenamePopoverOpen = !0, this.chartRenamePopover !== null && (this.chartRenamePopover.name = this.chartTitle, this.chartRenamePopover.referenceElement = this.renameReferenceElement), this.chartRenamePopover = f(r`<arcgis-charts-config-chart-rename-popover .name=${this.chartTitle} .referenceElement=${this.renameReferenceElement} .open=${this.isChartRenamePopoverOpen} @arcgisChartsConfigPopoverClose=${this.popoverClose} @arcgisChartsConfigChartRenamePopoverChange=${this.onChartRename}></arcgis-charts-config-chart-rename-popover>`), !document.body.contains(this.chartRenamePopover) && this.chartRenamePopover !== null && document.body.appendChild(this.chartRenamePopover);
133
+ this.isChartRenamePopoverOpen = !0, this.chartRenamePopover !== null && (this.chartRenamePopover.name = this.chartTitle, this.chartRenamePopover.referenceElement = this.renameReferenceElement), this.chartRenamePopover = w(r`<arcgis-charts-config-chart-rename-popover .name=${this.chartTitle} .referenceElement=${this.renameReferenceElement} .open=${this.isChartRenamePopoverOpen} @arcgisChartsConfigPopoverClose=${this.popoverClose} @arcgisChartsConfigChartRenamePopoverChange=${this.onChartRename}></arcgis-charts-config-chart-rename-popover>`), !document.body.contains(this.chartRenamePopover) && this.chartRenamePopover !== null && document.body.appendChild(this.chartRenamePopover);
103
134
  }
104
135
  removeChartRenamePopover() {
105
- this.chartRenamePopover !== null && (this.isChartRenamePopoverOpen = !1, this.chartRenamePopover = w(this.chartRenamePopover));
136
+ this.chartRenamePopover !== null && (this.isChartRenamePopoverOpen = !1, this.chartRenamePopover = I(this.chartRenamePopover));
106
137
  }
107
138
  render() {
108
- return r`<div class=${c(n.viewChartComponent)}>${this.buildChartList()}</div>`;
139
+ return r`<div class=${n(h.viewChartComponent)}>${this.buildChartList()}</div>`;
109
140
  }
110
141
  }
111
- d("arcgis-charts-config-view-charts", R);
142
+ C("arcgis-charts-config-view-charts", y);
112
143
  export {
113
- R as ArcgisChartsConfigViewCharts
144
+ y as ArcgisChartsConfigViewCharts
114
145
  };