@pitcher/canvas-ui 2025.12.9-123521-beta → 2025.12.9-130331-beta

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/canvas-ui.js CHANGED
@@ -94572,52 +94572,54 @@ const _hoisted_37$4 = {
94572
94572
  };
94573
94573
  const _hoisted_38$4 = { class: "flex-1 min-w-0" };
94574
94574
  const _hoisted_39$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
94575
- const _hoisted_40$4 = { class: "text-xs text-gray-500" };
94576
- const _hoisted_41$4 = { class: "text-xs text-gray-400" };
94577
- const _hoisted_42$4 = {
94575
+ const _hoisted_40$4 = ["innerHTML"];
94576
+ const _hoisted_41$4 = { class: "text-xs text-gray-500" };
94577
+ const _hoisted_42$4 = { class: "text-xs text-gray-400" };
94578
+ const _hoisted_43$4 = {
94578
94579
  key: 0,
94579
94580
  class: "px-0 py-0"
94580
94581
  };
94581
- const _hoisted_43$4 = { key: 1 };
94582
- const _hoisted_44$4 = { class: "flex items-center px-0 pt-2 pb-1" };
94583
- const _hoisted_45$4 = { class: "text-m font-semibold text-gray-900" };
94584
- const _hoisted_46$4 = { class: "ml-2 text-sm text-gray-500" };
94585
- const _hoisted_47$4 = ["data-result-selected", "onClick"];
94586
- const _hoisted_48$4 = { class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center" };
94587
- const _hoisted_49$4 = { class: "flex-1 min-w-0" };
94588
- const _hoisted_50$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
94589
- const _hoisted_51$3 = { class: "text-xs text-gray-500" };
94590
- const _hoisted_52$3 = { class: "text-xs text-gray-400" };
94591
- const _hoisted_53$3 = {
94582
+ const _hoisted_44$4 = { key: 1 };
94583
+ const _hoisted_45$4 = { class: "flex items-center px-0 pt-2 pb-1" };
94584
+ const _hoisted_46$4 = { class: "text-m font-semibold text-gray-900" };
94585
+ const _hoisted_47$4 = { class: "ml-2 text-sm text-gray-500" };
94586
+ const _hoisted_48$4 = ["data-result-selected", "onClick"];
94587
+ const _hoisted_49$4 = { class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center" };
94588
+ const _hoisted_50$4 = { class: "flex-1 min-w-0" };
94589
+ const _hoisted_51$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
94590
+ const _hoisted_52$2 = { class: "text-xs text-gray-500" };
94591
+ const _hoisted_53$2 = { class: "text-xs text-gray-400" };
94592
+ const _hoisted_54$1 = {
94592
94593
  key: 0,
94593
94594
  class: "px-0 py-0"
94594
94595
  };
94595
- const _hoisted_54$2 = {
94596
+ const _hoisted_55$1 = {
94596
94597
  key: 0,
94597
94598
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
94598
94599
  };
94599
- const _hoisted_55$2 = {
94600
+ const _hoisted_56$1 = {
94600
94601
  key: 2,
94601
94602
  class: "flex-1 overflow-y-auto bg-white w-full"
94602
94603
  };
94603
- const _hoisted_56$2 = { class: "w-full px-0" };
94604
- const _hoisted_57$2 = { class: "flex items-center px-0 pt-2 pb-1" };
94605
- const _hoisted_58$2 = { class: "text-m font-semibold text-gray-900" };
94606
- const _hoisted_59$2 = { class: "ml-2 text-sm text-gray-500" };
94607
- const _hoisted_60$2 = ["data-result-selected", "onClick"];
94608
- const _hoisted_61$2 = {
94604
+ const _hoisted_57$1 = { class: "w-full px-0" };
94605
+ const _hoisted_58$1 = { class: "flex items-center px-0 pt-2 pb-1" };
94606
+ const _hoisted_59$1 = { class: "text-m font-semibold text-gray-900" };
94607
+ const _hoisted_60$1 = { class: "ml-2 text-sm text-gray-500" };
94608
+ const _hoisted_61$1 = ["data-result-selected", "onClick"];
94609
+ const _hoisted_62$1 = {
94609
94610
  key: 1,
94610
94611
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
94611
94612
  };
94612
- const _hoisted_62$2 = { class: "flex-1 min-w-0" };
94613
- const _hoisted_63$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
94614
- const _hoisted_64$2 = { class: "text-xs text-gray-500" };
94615
- const _hoisted_65$2 = { class: "text-xs text-gray-400" };
94616
- const _hoisted_66$2 = {
94613
+ const _hoisted_63$1 = { class: "flex-1 min-w-0" };
94614
+ const _hoisted_64$1 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
94615
+ const _hoisted_65$1 = ["innerHTML"];
94616
+ const _hoisted_66$1 = { class: "text-xs text-gray-500" };
94617
+ const _hoisted_67$1 = { class: "text-xs text-gray-400" };
94618
+ const _hoisted_68$1 = {
94617
94619
  key: 0,
94618
94620
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
94619
94621
  };
94620
- const _hoisted_67$2 = {
94622
+ const _hoisted_69 = {
94621
94623
  key: 0,
94622
94624
  class: "flex flex-wrap line-height-6 pt-4 pb-2 px-6 border-t border-gray-200 gap-y-4 gap-x-4"
94623
94625
  };
@@ -95141,6 +95143,18 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95141
95143
  return t("canvasUI.CAlgoliaSearch.canvasFilters.saved");
95142
95144
  }
95143
95145
  };
95146
+ const getSnippet = (item) => {
95147
+ if (!searchQuery.value || searchQuery.value.trim() === "/") {
95148
+ return "";
95149
+ }
95150
+ if (!item._snippetResult?.searchable_content?.value) {
95151
+ return "";
95152
+ }
95153
+ if (item._highlightResult?.name?.matchLevel !== "none") {
95154
+ return "";
95155
+ }
95156
+ return item._snippetResult.searchable_content.value;
95157
+ };
95144
95158
  const toggleCanvasFilter = (filterType) => {
95145
95159
  if (selectedCanvasFilters.value.includes(filterType)) {
95146
95160
  selectedCanvasFilters.value.splice(selectedCanvasFilters.value.indexOf(filterType), 1);
@@ -95712,7 +95726,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95712
95726
  }, [
95713
95727
  item.type === "file" ? (openBlock(), createBlock(_sfc_main$6I, {
95714
95728
  key: 0,
95715
- class: "h-14 border-rounded-1 overflow-hidden flex-0 mr-4",
95729
+ class: "w-18 h-14 border-rounded-1 overflow-hidden flex-shrink-0 mr-4",
95716
95730
  cover: "",
95717
95731
  "file-data": item,
95718
95732
  "object-fit": "cover",
@@ -95727,13 +95741,18 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95727
95741
  ])),
95728
95742
  createElementVNode("div", _hoisted_38$4, [
95729
95743
  createElementVNode("h3", _hoisted_39$4, toDisplayString(item.name), 1),
95730
- createElementVNode("p", _hoisted_40$4, toDisplayString(item.type === "folder" ? "Folder" : item.content_type || "PDF"), 1)
95744
+ item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
95745
+ key: 0,
95746
+ class: "text-xs text-gray-600 mb-1",
95747
+ innerHTML: getSnippet(item)
95748
+ }, null, 8, _hoisted_40$4)) : createCommentVNode("", true),
95749
+ createElementVNode("p", _hoisted_41$4, toDisplayString(item.type === "folder" ? "Folder" : item.content_type || "PDF"), 1)
95731
95750
  ]),
95732
- createElementVNode("div", _hoisted_41$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
95751
+ createElementVNode("div", _hoisted_42$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
95733
95752
  ], 10, _hoisted_36$4);
95734
95753
  }), 128))
95735
95754
  ]),
95736
- filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_42$4, [
95755
+ filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_43$4, [
95737
95756
  createElementVNode("span", {
95738
95757
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
95739
95758
  onClick: _cache[13] || (_cache[13] = ($event) => searchType.value = "content")
@@ -95747,16 +95766,16 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95747
95766
  ])
95748
95767
  ])) : createCommentVNode("", true)
95749
95768
  ])) : createCommentVNode("", true),
95750
- filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_43$4, [
95751
- createElementVNode("div", _hoisted_44$4, [
95769
+ filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_44$4, [
95770
+ createElementVNode("div", _hoisted_45$4, [
95752
95771
  createVNode(CIcon, {
95753
95772
  class: "mr-2",
95754
95773
  color: "var(--p-text2)",
95755
95774
  icon: "presentation",
95756
95775
  size: "16"
95757
95776
  }),
95758
- createElementVNode("span", _hoisted_45$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
95759
- createElementVNode("span", _hoisted_46$4, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
95777
+ createElementVNode("span", _hoisted_46$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
95778
+ createElementVNode("span", _hoisted_47$4, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
95760
95779
  ]),
95761
95780
  createElementVNode("div", null, [
95762
95781
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredCanvasFiles.value.slice(0, 5), (item) => {
@@ -95770,22 +95789,22 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95770
95789
  "data-result-selected": isResultSelected(item),
95771
95790
  onClick: ($event) => handleResultClick(item, "canvas")
95772
95791
  }, [
95773
- createElementVNode("div", _hoisted_48$4, [
95792
+ createElementVNode("div", _hoisted_49$4, [
95774
95793
  createVNode(CIcon, {
95775
95794
  color: "var(--p-text2)",
95776
95795
  icon: "presentation",
95777
95796
  size: "32"
95778
95797
  })
95779
95798
  ]),
95780
- createElementVNode("div", _hoisted_49$4, [
95781
- createElementVNode("h3", _hoisted_50$4, toDisplayString(item.name), 1),
95782
- createElementVNode("p", _hoisted_51$3, toDisplayString(formatCanvasType(item.content_type)), 1)
95799
+ createElementVNode("div", _hoisted_50$4, [
95800
+ createElementVNode("h3", _hoisted_51$2, toDisplayString(item.name), 1),
95801
+ createElementVNode("p", _hoisted_52$2, toDisplayString(formatCanvasType(item.content_type)), 1)
95783
95802
  ]),
95784
- createElementVNode("div", _hoisted_52$3, toDisplayString(item.folder?.name || ""), 1)
95785
- ], 10, _hoisted_47$4);
95803
+ createElementVNode("div", _hoisted_53$2, toDisplayString(item.folder?.name || ""), 1)
95804
+ ], 10, _hoisted_48$4);
95786
95805
  }), 128))
95787
95806
  ]),
95788
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_53$3, [
95807
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_54$1, [
95789
95808
  createElementVNode("span", {
95790
95809
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
95791
95810
  onClick: _cache[14] || (_cache[14] = ($event) => searchType.value = "canvases")
@@ -95800,7 +95819,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95800
95819
  ])) : createCommentVNode("", true)
95801
95820
  ])) : createCommentVNode("", true)
95802
95821
  ]),
95803
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_54$2, [
95822
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_55$1, [
95804
95823
  createVNode(CIcon, {
95805
95824
  class: "text-6xl",
95806
95825
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -95811,9 +95830,9 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95811
95830
  class: normalizeClass(searchError.value ? "text-error font-semibold" : "text-text2")
95812
95831
  }, toDisplayString(searchError.value || unref(t)("canvasUI.CGlobalSearch.noResults")), 3)
95813
95832
  ])) : createCommentVNode("", true)
95814
- ])) : (openBlock(), createElementBlock("div", _hoisted_55$2, [
95815
- createElementVNode("div", _hoisted_56$2, [
95816
- createElementVNode("div", _hoisted_57$2, [
95833
+ ])) : (openBlock(), createElementBlock("div", _hoisted_56$1, [
95834
+ createElementVNode("div", _hoisted_57$1, [
95835
+ createElementVNode("div", _hoisted_58$1, [
95817
95836
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
95818
95837
  key: 0,
95819
95838
  class: "mr-2",
@@ -95827,8 +95846,8 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95827
95846
  icon: "presentation",
95828
95847
  size: "16"
95829
95848
  })),
95830
- createElementVNode("span", _hoisted_58$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
95831
- createElementVNode("span", _hoisted_59$2, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
95849
+ createElementVNode("span", _hoisted_59$1, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
95850
+ createElementVNode("span", _hoisted_60$1, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
95832
95851
  ]),
95833
95852
  createElementVNode("div", null, [
95834
95853
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -95847,13 +95866,13 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95847
95866
  }, [
95848
95867
  searchType.value === "content" && item.type === "file" ? (openBlock(), createBlock(_sfc_main$6I, {
95849
95868
  key: 0,
95850
- class: "h-14 border-rounded-1 overflow-hidden flex-0 mr-4",
95869
+ class: "w-18 h-14 border-rounded-1 overflow-hidden flex-shrink-0 mr-4",
95851
95870
  cover: "",
95852
95871
  "file-data": item,
95853
95872
  "object-fit": "cover",
95854
95873
  src: item.picture_url || "",
95855
95874
  width: "72"
95856
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_61$2, [
95875
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_62$1, [
95857
95876
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
95858
95877
  key: 0,
95859
95878
  color: "var(--p-text2)",
@@ -95866,15 +95885,20 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95866
95885
  size: "32"
95867
95886
  }))
95868
95887
  ])),
95869
- createElementVNode("div", _hoisted_62$2, [
95870
- createElementVNode("h3", _hoisted_63$2, toDisplayString(item.name), 1),
95871
- createElementVNode("p", _hoisted_64$2, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.content_type || "PDF" : formatCanvasType(item.content_type)), 1)
95888
+ createElementVNode("div", _hoisted_63$1, [
95889
+ createElementVNode("h3", _hoisted_64$1, toDisplayString(item.name), 1),
95890
+ searchType.value === "content" && item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
95891
+ key: 0,
95892
+ class: "text-xs text-gray-600 mb-1",
95893
+ innerHTML: getSnippet(item)
95894
+ }, null, 8, _hoisted_65$1)) : createCommentVNode("", true),
95895
+ createElementVNode("p", _hoisted_66$1, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.content_type || "PDF" : formatCanvasType(item.content_type)), 1)
95872
95896
  ]),
95873
- createElementVNode("div", _hoisted_65$2, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
95874
- ], 10, _hoisted_60$2);
95897
+ createElementVNode("div", _hoisted_67$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
95898
+ ], 10, _hoisted_61$1);
95875
95899
  }), 128))
95876
95900
  ]),
95877
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_66$2, [
95901
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_68$1, [
95878
95902
  createVNode(CIcon, {
95879
95903
  class: "text-6xl",
95880
95904
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -95888,7 +95912,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95888
95912
  ])
95889
95913
  ]))
95890
95914
  ]),
95891
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_67$2, [
95915
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_69, [
95892
95916
  createVNode(CShortcut, null, {
95893
95917
  default: withCtx(() => [
95894
95918
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -95930,7 +95954,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95930
95954
  }
95931
95955
  });
95932
95956
 
95933
- const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5I, [["__scopeId", "data-v-b3a9f0d5"]]);
95957
+ const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5I, [["__scopeId", "data-v-d96d349f"]]);
95934
95958
 
95935
95959
  const BulletListExtended = BulletList.extend({
95936
95960
  addOptions() {
@@ -140765,96 +140789,17 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
140765
140789
  }
140766
140790
  });
140767
140791
 
140768
- const _hoisted_1$24 = {
140769
- key: 0,
140770
- class: "cb-data-charts-raw__controls"
140771
- };
140792
+ const _hoisted_1$24 = { class: "cb-data-charts-raw" };
140772
140793
  const _sfc_main$2F = /* @__PURE__ */ defineComponent({
140773
140794
  __name: "DataCharts.raw",
140774
140795
  props: {
140775
- data: {},
140776
- isPreview: { type: Boolean },
140777
- isEditMode: { type: Boolean }
140796
+ data: {}
140778
140797
  },
140779
140798
  setup(__props) {
140780
- const { t } = useI18n();
140781
140799
  const chartRef = ref(null);
140782
- const containerRef = ref(null);
140783
140800
  let chart = null;
140784
140801
  const isChartLoaded = ref(false);
140785
- const isFullscreen = ref(false);
140786
- const currentChartType = ref("");
140787
140802
  const props = __props;
140788
- const showViewControls = computed(() => {
140789
- if (props.isPreview || props.isEditMode) return false;
140790
- return props.data?.view_controls?.enable_fullscreen_btn || props.data?.view_controls?.enable_chart_type_switcher;
140791
- });
140792
- const containerStyle = computed(() => {
140793
- if (isFullscreen.value || props.isPreview) {
140794
- return {};
140795
- }
140796
- return {
140797
- height: props.data?.chart_height ? `${props.data.chart_height}px` : void 0,
140798
- width: props.data?.chart_width ? `${props.data.chart_width}%` : void 0,
140799
- minHeight: props.data?.chart_height ? `${props.data.chart_height}px` : void 0,
140800
- maxHeight: props.data?.chart_height ? `${props.data.chart_height}px` : void 0
140801
- };
140802
- });
140803
- const originalChartType = computed(() => {
140804
- return props.data?.type || props.data?._primary_chart_type || "bar";
140805
- });
140806
- const isScatterChart = computed(() => originalChartType.value === "scatter");
140807
- const isBubbleChart = computed(() => originalChartType.value === "bubble");
140808
- const labelValueChartTypes = [
140809
- { label: t("canvasUI.canvasBuilder.dataCharts.types.bar"), key: "bar" },
140810
- { label: t("canvasUI.canvasBuilder.dataCharts.types.line"), key: "line" },
140811
- { label: t("canvasUI.canvasBuilder.dataCharts.types.area"), key: "area" },
140812
- { label: t("canvasUI.canvasBuilder.dataCharts.types.pie"), key: "pie" },
140813
- { label: t("canvasUI.canvasBuilder.dataCharts.types.doughnut"), key: "doughnut" },
140814
- { label: t("canvasUI.canvasBuilder.dataCharts.types.polarArea"), key: "polarArea" },
140815
- { label: t("canvasUI.canvasBuilder.dataCharts.types.radar"), key: "radar" }
140816
- ];
140817
- const scatterChartTypes = [{ label: t("canvasUI.canvasBuilder.dataCharts.types.scatter"), key: "scatter" }];
140818
- const bubbleChartTypes = [{ label: t("canvasUI.canvasBuilder.dataCharts.types.bubble"), key: "bubble" }];
140819
- const chartTypeSwitcherOptions = computed(() => {
140820
- if (isBubbleChart.value) return bubbleChartTypes;
140821
- if (isScatterChart.value) return scatterChartTypes;
140822
- return labelValueChartTypes;
140823
- });
140824
- function toggleFullscreen() {
140825
- if (!containerRef.value) return;
140826
- if (!isFullscreen.value) {
140827
- isFullscreen.value = true;
140828
- } else {
140829
- isFullscreen.value = false;
140830
- }
140831
- nextTick(() => {
140832
- if (chart) {
140833
- chart.resize();
140834
- }
140835
- });
140836
- }
140837
- function handleChartTypeChange(newType) {
140838
- if (!chart || !props.data) return;
140839
- currentChartType.value = newType;
140840
- initChart(newType);
140841
- }
140842
- function handleKeydown(e) {
140843
- if (e.key === "Escape" && isFullscreen.value) {
140844
- isFullscreen.value = false;
140845
- nextTick(() => {
140846
- if (chart) {
140847
- chart.resize();
140848
- }
140849
- });
140850
- }
140851
- }
140852
- onMounted(() => {
140853
- window.addEventListener("keydown", handleKeydown);
140854
- });
140855
- onUnmounted(() => {
140856
- window.removeEventListener("keydown", handleKeydown);
140857
- });
140858
140803
  const sectionListSectionInfo = inject(
140859
140804
  "sectionListSectionInfo",
140860
140805
  computed(() => null)
@@ -140885,191 +140830,41 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
140885
140830
  }
140886
140831
  return window._chartJsPromise;
140887
140832
  }
140888
- function normalizeRValues(values, minRadius = 5, maxRadius = 40) {
140889
- if (values.length === 0) return [];
140890
- const rValues = values.map((v) => v.r);
140891
- const minR = Math.min(...rValues);
140892
- const maxR = Math.max(...rValues);
140893
- if (minR === maxR) {
140894
- return values.map((v) => ({
140895
- ...v,
140896
- r: (minRadius + maxRadius) / 2,
140897
- originalR: v.r
140898
- }));
140899
- }
140900
- return values.map((v) => ({
140901
- ...v,
140902
- r: minRadius + (v.r - minR) / (maxR - minR) * (maxRadius - minRadius),
140903
- originalR: v.r
140904
- }));
140905
- }
140906
- function processSeriesDataPoints(dataPoints, chartType, context) {
140907
- const isScatterChart2 = chartType === "scatter";
140908
- const isBubbleChart2 = chartType === "bubble";
140909
- const isXYChart = isScatterChart2 || isBubbleChart2;
140833
+ function processChartData(chartData, context) {
140910
140834
  const processedData = {
140911
140835
  labels: [],
140912
140836
  values: []
140913
140837
  };
140914
- const rawBubbleData = [];
140915
- dataPoints?.forEach((point) => {
140838
+ chartData.data_points?.forEach((point) => {
140916
140839
  let label = point.label;
140840
+ let value = point.value;
140917
140841
  try {
140918
140842
  if (typeof label === "string") {
140919
140843
  label = renderTemplate(label, context);
140920
140844
  }
140921
- if (isXYChart) {
140922
- let xValue = point.x_value ?? "0";
140923
- let yValue = point.y_value ?? "0";
140924
- let rValue = point.r_value ?? "10";
140925
- if (typeof xValue === "string") {
140926
- xValue = renderTemplate(xValue, context);
140927
- }
140928
- if (typeof yValue === "string") {
140929
- yValue = renderTemplate(yValue, context);
140930
- }
140931
- if (typeof rValue === "string") {
140932
- rValue = renderTemplate(rValue, context);
140933
- }
140934
- if (typeof label === "string" && label.includes(",") && typeof xValue === "string" && xValue.includes(",") && typeof yValue === "string" && yValue.includes(",")) {
140935
- const labels = label.split(",");
140936
- const xValues = xValue.split(",");
140937
- const yValues = yValue.split(",");
140938
- const rValues = typeof rValue === "string" && rValue.includes(",") ? rValue.split(",") : [];
140939
- labels.forEach((l, idx) => {
140940
- const x = Number(xValues[idx]) || 0;
140941
- const y = Number(yValues[idx]) || 0;
140942
- if (isBubbleChart2) {
140943
- const r = rValues[idx] ? Number(rValues[idx]) || 10 : 10;
140944
- rawBubbleData.push({ label: l, x, y, r: Math.abs(r) });
140945
- } else {
140946
- processedData.labels.push(l);
140947
- processedData.values.push({ x, y });
140948
- }
140949
- });
140950
- } else {
140951
- const x = Number(xValue) || 0;
140952
- const y = Number(yValue) || 0;
140953
- if (isBubbleChart2) {
140954
- const r = Number(rValue) || 10;
140955
- rawBubbleData.push({ label, x, y, r: Math.abs(r) });
140956
- } else {
140957
- processedData.labels.push(label);
140958
- processedData.values.push({ x, y });
140845
+ if (typeof value === "string") {
140846
+ value = renderTemplate(value, context);
140847
+ }
140848
+ if (typeof label === "string" && label.includes(",") && typeof value === "string" && value.includes(",")) {
140849
+ const labels = label.split(",");
140850
+ const values = value.split(",");
140851
+ labels.forEach((l, idx) => {
140852
+ const v = values[idx];
140853
+ if (v !== void 0) {
140854
+ processedData.labels.push(l);
140855
+ processedData.values.push(Number(v) || 0);
140959
140856
  }
140960
- }
140857
+ });
140961
140858
  } else {
140962
- let value = point.value;
140963
- if (typeof value === "string") {
140964
- value = renderTemplate(value, context);
140965
- }
140966
- if (typeof label === "string" && label.includes(",") && typeof value === "string" && value.includes(",")) {
140967
- const labels = label.split(",");
140968
- const values = value.split(",");
140969
- labels.forEach((l, idx) => {
140970
- const v = values[idx];
140971
- if (v !== void 0) {
140972
- processedData.labels.push(l);
140973
- processedData.values.push(Number(v) || 0);
140974
- }
140975
- });
140976
- } else {
140977
- processedData.labels.push(label);
140978
- processedData.values.push(Number(value) || 0);
140979
- }
140859
+ processedData.labels.push(label);
140860
+ processedData.values.push(Number(value) || 0);
140980
140861
  }
140981
140862
  } catch (err) {
140982
140863
  console.warn("Error processing chart data point:", err);
140983
- if (isBubbleChart2) {
140984
- rawBubbleData.push({ label, x: 0, y: 0, r: 10 });
140985
- } else if (isXYChart) {
140986
- processedData.labels.push(label);
140987
- processedData.values.push({ x: 0, y: 0 });
140988
- } else {
140989
- processedData.labels.push(label);
140990
- processedData.values.push(0);
140991
- }
140864
+ processedData.labels.push(label);
140865
+ processedData.values.push(Number(value) || 0);
140992
140866
  }
140993
140867
  });
140994
- if (isBubbleChart2 && rawBubbleData.length > 0) {
140995
- const bubbleValues = rawBubbleData.map((d) => ({ x: d.x, y: d.y, r: d.r }));
140996
- const normalizedValues = normalizeRValues(bubbleValues);
140997
- rawBubbleData.forEach((d, idx) => {
140998
- processedData.labels.push(d.label);
140999
- processedData.values.push(normalizedValues[idx]);
141000
- });
141001
- }
141002
- return processedData;
141003
- }
141004
- function processChartData(chartData, context, overrideType) {
141005
- if (chartData.series && Array.isArray(chartData.series) && chartData.series.length > 0) {
141006
- const datasets = [];
141007
- let allLabels = [];
141008
- const isSingleSeries = chartData.series.length === 1;
141009
- chartData.series.forEach((series, index) => {
141010
- const seriesChartType = overrideType || series.chart_type || chartData.type || "bar";
141011
- const processedData2 = processSeriesDataPoints(series.data_points || [], seriesChartType, context);
141012
- if (processedData2.labels.length > allLabels.length) {
141013
- allLabels = processedData2.labels;
141014
- }
141015
- const preBuiltDataset = chartData.data?.datasets?.[index];
141016
- let backgroundColor2 = preBuiltDataset?.background_color || preBuiltDataset?.backgroundColor;
141017
- let borderColor2 = preBuiltDataset?.border_color || preBuiltDataset?.borderColor;
141018
- if (isSingleSeries && Array.isArray(backgroundColor2)) {
141019
- const resolvedColors = backgroundColor2.map((color, i) => {
141020
- if (typeof color === "string" && color.startsWith("palette")) {
141021
- const paletteIndex = parseInt(color.replace("palette", ""));
141022
- const validIndex = paletteIndex >= 0 ? paletteIndex % palette.value.length : i;
141023
- return palette.value[validIndex];
141024
- }
141025
- return color;
141026
- });
141027
- const dataPointsCount = processedData2.values.length;
141028
- backgroundColor2 = Array.from({ length: dataPointsCount }, (_, i) => resolvedColors[i % resolvedColors.length]);
141029
- borderColor2 = [...backgroundColor2];
141030
- } else if (typeof backgroundColor2 === "string" && backgroundColor2.startsWith("palette")) {
141031
- const paletteIndex = parseInt(backgroundColor2.replace("palette", ""));
141032
- const validIndex = paletteIndex >= 0 ? paletteIndex % palette.value.length : index;
141033
- backgroundColor2 = palette.value[validIndex];
141034
- borderColor2 = backgroundColor2;
141035
- }
141036
- const datasetOptions = {
141037
- label: series.name,
141038
- data: processedData2.values,
141039
- backgroundColor: backgroundColor2 || palette.value[index % palette.value.length],
141040
- borderColor: borderColor2 || palette.value[index % palette.value.length],
141041
- borderWidth: 1
141042
- };
141043
- if (!isSingleSeries) {
141044
- if (series.chart_type === "area") {
141045
- datasetOptions.type = "line";
141046
- datasetOptions.fill = true;
141047
- datasetOptions.tension = 0.4;
141048
- } else {
141049
- datasetOptions.type = series.chart_type;
141050
- }
141051
- }
141052
- if (series.chart_type === "area") {
141053
- datasetOptions.fill = true;
141054
- datasetOptions.tension = 0.4;
141055
- }
141056
- if (["line", "area"].includes(series.chart_type)) {
141057
- datasetOptions.tension = 0.4;
141058
- }
141059
- datasets.push(datasetOptions);
141060
- });
141061
- return {
141062
- ...chartData,
141063
- type: chartData.type || chartData._primary_chart_type || "bar",
141064
- data: {
141065
- ...chartData.data,
141066
- labels: allLabels,
141067
- datasets
141068
- }
141069
- };
141070
- }
141071
- const chartType = overrideType || chartData.type || "bar";
141072
- const processedData = processSeriesDataPoints(chartData.data_points || [], chartType, context);
141073
140868
  let backgroundColor = chartData.data?.datasets?.[0]?.background_color || [];
141074
140869
  let borderColor = chartData.data?.datasets?.[0]?.border_color || [];
141075
140870
  if (chartData.color_scheme_type === "theme" && Array.isArray(backgroundColor)) {
@@ -141115,7 +140910,7 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
141115
140910
  }
141116
140911
  };
141117
140912
  }
141118
- function initChart(overrideType) {
140913
+ function initChart() {
141119
140914
  if (!props.data || !chartRef.value || !isChartLoaded.value) {
141120
140915
  return;
141121
140916
  }
@@ -141123,85 +140918,25 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
141123
140918
  chart.destroy();
141124
140919
  }
141125
140920
  const context = props.data.context ?? (!isEmpty(activeCanvas.value?.context) || isCanvas.value ? { ...crmShape.value, ...activeCanvas.value?.context } : crmShape.value);
141126
- const processedChartData = processChartData(props.data, context, overrideType);
141127
- let chartType = overrideType || currentChartType.value || processedChartData.type || "bar";
141128
- const isAreaChart = chartType === "area";
141129
- if (isAreaChart) {
141130
- chartType = "line";
141131
- }
140921
+ const processedChartData = processChartData(props.data, context);
141132
140922
  if (processedChartData.data?.datasets) {
141133
140923
  processedChartData.data.datasets = processedChartData.data.datasets.map((dataset) => {
141134
- const { background_color, border_color, point_style, fill, tension, show_line, ...rest } = dataset;
140924
+ const { background_color, border_color, point_style, ...rest } = dataset;
141135
140925
  return {
141136
140926
  ...rest,
141137
140927
  backgroundColor: dataset.backgroundColor || background_color || ["#000000"],
141138
140928
  borderColor: dataset.borderColor || border_color || ["#000000"],
141139
- pointStyle: point_style,
141140
- fill: isAreaChart ? true : fill,
141141
- tension: isAreaChart ? tension ?? 0.4 : tension,
141142
- showLine: show_line
140929
+ pointStyle: point_style
141143
140930
  };
141144
140931
  });
141145
140932
  }
141146
- let scales = processedChartData.options?.scales;
141147
- if (scales) {
141148
- const convertedScales = {};
141149
- if (scales.x) {
141150
- convertedScales.x = { ...scales.x };
141151
- }
141152
- if (scales.y) {
141153
- convertedScales.y = {
141154
- ...scales.y,
141155
- beginAtZero: scales.y.begin_at_zero
141156
- };
141157
- delete convertedScales.y.begin_at_zero;
141158
- }
141159
- if (scales.r) {
141160
- convertedScales.r = {
141161
- ...scales.r,
141162
- beginAtZero: scales.r.begin_at_zero,
141163
- ticks: scales.r.ticks ? {
141164
- stepSize: scales.r.ticks.step_size
141165
- } : void 0
141166
- };
141167
- }
141168
- scales = convertedScales;
141169
- }
141170
- if (["pie", "doughnut", "polarArea"].includes(chartType)) {
141171
- scales = void 0;
141172
- }
141173
- const tooltipCallbacks = {};
141174
- const isBubble = chartType === "bubble";
141175
- if (props.data.percent_display || isBubble) {
141176
- tooltipCallbacks.label = function(context2) {
141177
- const label = context2.dataset.label || "";
141178
- const value = context2.raw;
141179
- if (isBubble && typeof value === "object" && value !== null) {
141180
- const x = value.x;
141181
- const y = value.y;
141182
- const r = value.originalR !== void 0 ? value.originalR : value.r;
141183
- return `${label}${label ? ": " : ""}(${x}, ${y}, ${r})`;
141184
- }
141185
- if (props.data?.percent_display && typeof value === "number" && value >= 0 && value <= 1) {
141186
- return `${label}${label ? ": " : ""}${(value * 100).toFixed(2)}%`;
141187
- }
141188
- return `${label}${label ? ": " : ""}${value}`;
141189
- };
141190
- }
141191
140933
  const chartConfig = {
141192
140934
  ...processedChartData,
141193
- type: chartType,
140935
+ type: processedChartData.type,
141194
140936
  options: merge$1({}, processedChartData.options, {
141195
140937
  responsive: true,
141196
140938
  maintainAspectRatio: false,
141197
- indexAxis: processedChartData.options?.index_axis,
141198
- scales,
141199
- plugins: {
141200
- ...processedChartData.options?.plugins,
141201
- tooltip: props.data.percent_display || isBubble ? {
141202
- callbacks: tooltipCallbacks
141203
- } : void 0
141204
- }
140939
+ indexAxis: processedChartData.options?.index_axis
141205
140940
  })
141206
140941
  };
141207
140942
  chart = new window.Chart(chartRef.value, chartConfig);
@@ -141221,172 +140956,84 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
141221
140956
  isChartLoaded.value = true;
141222
140957
  });
141223
140958
  return (_ctx, _cache) => {
141224
- return openBlock(), createElementBlock("div", {
141225
- ref_key: "containerRef",
141226
- ref: containerRef,
141227
- class: normalizeClass(["cb-data-charts-raw", { "is-fullscreen": isFullscreen.value }]),
141228
- style: normalizeStyle(containerStyle.value)
141229
- }, [
141230
- showViewControls.value ? (openBlock(), createElementBlock("div", _hoisted_1$24, [
141231
- props.data?.view_controls?.enable_chart_type_switcher ? (openBlock(), createBlock(unref(NDropdown), {
141232
- key: 0,
141233
- options: chartTypeSwitcherOptions.value,
141234
- trigger: "click",
141235
- onSelect: handleChartTypeChange
141236
- }, {
141237
- default: withCtx(() => [
141238
- createVNode(CButton, {
141239
- quaternary: "",
141240
- size: "small"
141241
- }, {
141242
- icon: withCtx(() => [
141243
- createVNode(CIcon, { icon: "chart-bar" })
141244
- ]),
141245
- _: 1
141246
- })
141247
- ]),
141248
- _: 1
141249
- }, 8, ["options"])) : createCommentVNode("", true),
141250
- props.data?.view_controls?.enable_fullscreen_btn ? (openBlock(), createBlock(CButton, {
141251
- key: 1,
141252
- quaternary: "",
141253
- size: "small",
141254
- onClick: toggleFullscreen
141255
- }, {
141256
- icon: withCtx(() => [
141257
- createVNode(CIcon, {
141258
- icon: isFullscreen.value ? "compress" : "expand"
141259
- }, null, 8, ["icon"])
141260
- ]),
141261
- _: 1
141262
- })) : createCommentVNode("", true)
141263
- ])) : createCommentVNode("", true),
140959
+ return openBlock(), createElementBlock("div", _hoisted_1$24, [
141264
140960
  createElementVNode("canvas", {
141265
140961
  ref_key: "chartRef",
141266
140962
  ref: chartRef,
141267
140963
  class: "w-full h-full"
141268
140964
  }, null, 512)
141269
- ], 6);
140965
+ ]);
141270
140966
  };
141271
140967
  }
141272
140968
  });
141273
140969
 
141274
- const RawDataCharts = /* @__PURE__ */ _export_sfc(_sfc_main$2F, [["__scopeId", "data-v-7078dc66"]]);
141275
-
141276
- const STANDALONE_CHART_TYPES = ["pie", "doughnut", "radar", "polarArea"];
141277
- const ONE_D_CHART_TYPES = ["bar", "line", "area"];
141278
- const TWO_D_CHART_TYPES = ["scatter"];
141279
- const THREE_D_CHART_TYPES = ["bubble"];
141280
- const XY_CHART_TYPES = ["scatter"];
141281
- const XYR_CHART_TYPES = ["bubble"];
140970
+ const RawDataCharts = /* @__PURE__ */ _export_sfc(_sfc_main$2F, [["__scopeId", "data-v-e71330a8"]]);
141282
140971
 
141283
140972
  const _hoisted_1$23 = { class: "flex gap-4 h-[calc(80vh-120px)] w-full" };
141284
140973
  const _hoisted_2$1t = { class: "cb-data-charts-settings__card overflow-auto flex-1" };
141285
140974
  const _hoisted_3$17 = { class: "flex flex-col h-full" };
141286
140975
  const _hoisted_4$X = { class: "flex-grow overflow-y-auto overflow-x-hidden" };
141287
- const _hoisted_5$O = { class: "text-sm font-semibold mb-3 text-gray-600 dark:text-gray-400 uppercase tracking-wide" };
141288
- const _hoisted_6$H = { class: "flex items-end border-b border-gray-200 dark:border-gray-700 mb-4 -mx-4 px-4" };
141289
- const _hoisted_7$v = ["onClick"];
141290
- const _hoisted_8$q = { class: "text-sm font-medium truncate max-w-24" };
141291
- const _hoisted_9$m = ["onClick"];
141292
- const _hoisted_10$h = ["title"];
141293
- const _hoisted_11$f = {
140976
+ const _hoisted_5$O = { class: "mb-4" };
140977
+ const _hoisted_6$H = { class: "block mb-2" };
140978
+ const _hoisted_7$v = { class: "mb-4" };
140979
+ const _hoisted_8$q = { class: "block mb-2" };
140980
+ const _hoisted_9$m = { class: "mb-4" };
140981
+ const _hoisted_10$h = { class: "block mb-2" };
140982
+ const _hoisted_11$f = { class: "mb-4" };
140983
+ const _hoisted_12$b = { class: "block mb-2" };
140984
+ const _hoisted_13$a = {
141294
140985
  key: 0,
141295
140986
  class: "mb-4"
141296
140987
  };
141297
- const _hoisted_12$b = { class: "block mb-2" };
141298
- const _hoisted_13$a = { class: "mb-4" };
141299
140988
  const _hoisted_14$9 = { class: "block mb-2" };
141300
140989
  const _hoisted_15$8 = { class: "mb-4" };
141301
- const _hoisted_16$8 = { class: "flex justify-between items-center mb-2" };
141302
- const _hoisted_17$7 = { class: "block" };
141303
- const _hoisted_18$6 = ["onClick"];
141304
- const _hoisted_19$6 = { class: "p-4 min-w-[400px] max-h-[400px]" };
141305
- const _hoisted_20$5 = { class: "flex gap-4 h-full" };
141306
- const _hoisted_21$5 = { class: "flex-1 flex flex-col" };
141307
- const _hoisted_22$3 = { class: "text-sm mb-2" };
141308
- const _hoisted_23$3 = { class: "overflow-auto" };
141309
- const _hoisted_24$3 = {
140990
+ const _hoisted_16$8 = { class: "block mb-2" };
140991
+ const _hoisted_17$7 = {
140992
+ key: 1,
140993
+ class: "mb-4"
140994
+ };
140995
+ const _hoisted_18$6 = { class: "block mb-2" };
140996
+ const _hoisted_19$6 = { class: "mb-4" };
140997
+ const _hoisted_20$5 = { class: "flex justify-between items-center mb-2" };
140998
+ const _hoisted_21$5 = { class: "block" };
140999
+ const _hoisted_22$3 = { class: "flex gap-2 flex-1" };
141000
+ const _hoisted_23$3 = ["onClick"];
141001
+ const _hoisted_24$3 = { class: "p-4 min-w-[400px] max-h-[400px]" };
141002
+ const _hoisted_25$3 = { class: "flex gap-4 h-full" };
141003
+ const _hoisted_26$3 = { class: "flex-1 flex flex-col" };
141004
+ const _hoisted_27$3 = { class: "text-sm mb-2" };
141005
+ const _hoisted_28$3 = { class: "overflow-auto" };
141006
+ const _hoisted_29$3 = {
141310
141007
  key: 0,
141311
141008
  class: "flex-1 border-l pl-4"
141312
141009
  };
141313
- const _hoisted_25$3 = { class: "text-sm font-medium mb-2" };
141314
- const _hoisted_26$3 = { class: "flex flex-col gap-2" };
141315
- const _hoisted_27$3 = { class: "block mb-1 text-sm" };
141316
- const _hoisted_28$3 = { class: "block mb-1 text-sm" };
141317
- const _hoisted_29$3 = ["onClick"];
141318
- const _hoisted_30$3 = { class: "p-4 min-w-[400px] max-h-[400px]" };
141319
- const _hoisted_31$3 = { class: "flex gap-4 h-full" };
141320
- const _hoisted_32$3 = { class: "flex-1 flex flex-col" };
141321
- const _hoisted_33$3 = { class: "text-sm mb-2" };
141322
- const _hoisted_34$3 = { class: "overflow-auto" };
141323
- const _hoisted_35$3 = {
141010
+ const _hoisted_30$3 = { class: "text-sm font-medium mb-2" };
141011
+ const _hoisted_31$3 = { class: "flex flex-col gap-2" };
141012
+ const _hoisted_32$3 = { class: "block mb-1 text-sm" };
141013
+ const _hoisted_33$3 = { class: "block mb-1 text-sm" };
141014
+ const _hoisted_34$3 = ["onClick"];
141015
+ const _hoisted_35$3 = { class: "p-4 min-w-[400px] max-h-[400px]" };
141016
+ const _hoisted_36$3 = { class: "flex gap-4 h-full" };
141017
+ const _hoisted_37$3 = { class: "flex-1 flex flex-col" };
141018
+ const _hoisted_38$3 = { class: "text-sm mb-2" };
141019
+ const _hoisted_39$3 = { class: "overflow-auto" };
141020
+ const _hoisted_40$3 = {
141324
141021
  key: 0,
141325
141022
  class: "flex-1 border-l pl-4"
141326
141023
  };
141327
- const _hoisted_36$3 = { class: "text-sm font-medium mb-2" };
141328
- const _hoisted_37$3 = { class: "flex flex-col gap-2" };
141329
- const _hoisted_38$3 = { class: "block mb-1 text-sm" };
141330
- const _hoisted_39$3 = { class: "block mb-1 text-sm" };
141331
- const _hoisted_40$3 = { class: "block mb-1 text-sm" };
141332
- const _hoisted_41$3 = { key: 0 };
141333
- const _hoisted_42$3 = { class: "block mb-1 text-sm" };
141334
- const _hoisted_43$3 = ["onClick"];
141335
- const _hoisted_44$3 = { class: "p-4 min-w-[400px] max-h-[400px] overflow-auto" };
141336
- const _hoisted_45$3 = { class: "text-sm mb-2" };
141337
- const _hoisted_46$3 = ["onClick"];
141338
- const _hoisted_47$3 = { class: "p-4 min-w-[400px] max-h-[400px] overflow-auto" };
141339
- const _hoisted_48$3 = { class: "text-sm mb-2" };
141340
- const _hoisted_49$3 = { class: "flex justify-center mt-2" };
141341
- const _hoisted_50$3 = { class: "text-sm font-semibold mb-3 mt-6 text-gray-600 dark:text-gray-400 uppercase tracking-wide border-t border-gray-200 dark:border-gray-700 pt-6" };
141342
- const _hoisted_51$2 = { class: "mb-4" };
141343
- const _hoisted_52$2 = { class: "block mb-2" };
141344
- const _hoisted_53$2 = { class: "mb-4" };
141345
- const _hoisted_54$1 = { class: "block mb-2" };
141346
- const _hoisted_55$1 = { class: "mb-4" };
141347
- const _hoisted_56$1 = { class: "block mb-2" };
141348
- const _hoisted_57$1 = { class: "mb-4" };
141349
- const _hoisted_58$1 = { class: "block mb-2" };
141350
- const _hoisted_59$1 = {
141351
- key: 2,
141352
- class: "mb-4"
141353
- };
141354
- const _hoisted_60$1 = { class: "block mb-2" };
141355
- const _hoisted_61$1 = {
141356
- key: 3,
141357
- class: "mb-4"
141358
- };
141359
- const _hoisted_62$1 = { class: "block mb-2" };
141360
- const _hoisted_63$1 = { class: "mb-4" };
141361
- const _hoisted_64$1 = { class: "block mb-2" };
141362
- const _hoisted_65$1 = { class: "mb-4" };
141363
- const _hoisted_66$1 = { class: "block mb-2" };
141364
- const _hoisted_67$1 = { class: "mb-4" };
141365
- const _hoisted_68$1 = { class: "block mb-2" };
141366
- const _hoisted_69 = { class: "flex items-center gap-2" };
141367
- const _hoisted_70 = { class: "text-sm text-gray-500" };
141368
- const _hoisted_71 = { class: "mb-4" };
141369
- const _hoisted_72 = { class: "block mb-2" };
141370
- const _hoisted_73 = { class: "flex flex-col gap-2" };
141371
- const _hoisted_74 = { class: "flex items-center gap-2" };
141372
- const _hoisted_75 = { class: "text-sm" };
141373
- const _hoisted_76 = { class: "text-sm" };
141374
- const _hoisted_77 = { class: "flex items-center gap-2" };
141375
- const _hoisted_78 = { class: "text-sm" };
141376
- const _hoisted_79 = { class: "mb-4" };
141377
- const _hoisted_80 = { class: "block mb-2" };
141378
- const _hoisted_81 = { class: "flex flex-col gap-3" };
141379
- const _hoisted_82 = { class: "flex items-center gap-2" };
141380
- const _hoisted_83 = { class: "text-sm w-16" };
141381
- const _hoisted_84 = { class: "flex items-center gap-2" };
141382
- const _hoisted_85 = { class: "text-sm w-16" };
141383
- const _hoisted_86 = { class: "cb-data-charts-settings__preview flex-1 border-l border-[#eee] pl-4" };
141384
- const _hoisted_87 = { class: "text-sm font-medium mb-4" };
141385
- const _hoisted_88 = {
141024
+ const _hoisted_41$3 = { class: "flex flex-col gap-2" };
141025
+ const _hoisted_42$3 = { class: "flex justify-center mt-2" };
141026
+ const _hoisted_43$3 = { class: "mb-4" };
141027
+ const _hoisted_44$3 = { class: "block mb-2" };
141028
+ const _hoisted_45$3 = { class: "mb-4" };
141029
+ const _hoisted_46$3 = { class: "block mb-2" };
141030
+ const _hoisted_47$3 = { class: "cb-data-charts-settings__preview flex-1 border-l border-[#eee] pl-4" };
141031
+ const _hoisted_48$3 = { class: "text-sm font-medium mb-4" };
141032
+ const _hoisted_49$3 = {
141386
141033
  class: "preview-container",
141387
141034
  style: { "height": "300px" }
141388
141035
  };
141389
- const _hoisted_89 = { class: "flex justify-between gap-4" };
141036
+ const _hoisted_50$3 = { class: "flex justify-between gap-4" };
141390
141037
  const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141391
141038
  __name: "DataCharts.settings",
141392
141039
  props: {
@@ -141400,91 +141047,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141400
141047
  const { setComponentEditMode, updateNodeDataById } = useCanvas$1();
141401
141048
  const { crmShape } = useCrmShape();
141402
141049
  const { palette } = useCanvasTheme$1();
141403
- let seriesIdCounter = 0;
141404
- function generateSeriesId() {
141405
- return `series_${Date.now()}_${seriesIdCounter++}`;
141406
- }
141407
- function convertSavedSeriesToRuntime(savedSeries) {
141408
- return {
141409
- id: savedSeries.id || generateSeriesId(),
141410
- name: savedSeries.name || "Series 1",
141411
- chartType: savedSeries.chart_type || "bar",
141412
- dataPoints: (savedSeries.data_points || []).map((dp) => ({
141413
- label: dp.label || "",
141414
- value: dp.value || "",
141415
- xValue: dp.x_value ?? "",
141416
- yValue: dp.y_value ?? "",
141417
- rValue: dp.r_value ?? "",
141418
- dynamicValue: dp.dynamic_value,
141419
- dynamicXValue: dp.dynamic_x_value,
141420
- dynamicYValue: dp.dynamic_y_value,
141421
- dynamicRValue: dp.dynamic_r_value,
141422
- arrayConfig: dp.array_config
141423
- }))
141424
- };
141425
- }
141426
- function convertLegacyToSeries() {
141427
- const chartTypeValue = props.data?.type ?? props.data?._primary_chart_type ?? "bar";
141428
- const dataPoints = props.data?.data_points && Array.isArray(props.data.data_points) ? props.data.data_points.map((dp) => ({
141429
- label: dp.label,
141430
- value: dp.value,
141431
- xValue: dp.x_value ?? "",
141432
- yValue: dp.y_value ?? "",
141433
- dynamicValue: dp.dynamic_value,
141434
- dynamicXValue: dp.dynamic_x_value,
141435
- dynamicYValue: dp.dynamic_y_value,
141436
- arrayConfig: dp.array_config
141437
- })) : props.data?.data?.labels ? props.data.data.labels.map((label, index) => ({
141438
- label: String(label),
141439
- value: String(props.data?.data?.datasets?.[0]?.data?.[index] ?? 0),
141440
- xValue: "",
141441
- yValue: ""
141442
- })) : [];
141443
- return [
141444
- {
141445
- id: generateSeriesId(),
141446
- name: t("canvasUI.canvasBuilder.dataCharts.series") + " 1",
141447
- chartType: chartTypeValue,
141448
- dataPoints
141449
- }
141450
- ];
141451
- }
141452
- const seriesList = ref(
141453
- props.data?.series && Array.isArray(props.data.series) && props.data.series.length > 0 ? props.data.series.map((s) => convertSavedSeriesToRuntime(s)) : convertLegacyToSeries()
141454
- );
141455
- const activeSeriesIndex = ref(0);
141456
- const activeSeries = computed(() => seriesList.value[activeSeriesIndex.value]);
141457
- const isActiveSeriesXYChart = computed(() => XY_CHART_TYPES.includes(activeSeries.value?.chartType));
141458
- const isActiveSeriesXYRChart = computed(() => XYR_CHART_TYPES.includes(activeSeries.value?.chartType));
141459
- const isPrimaryStandalone = computed(() => STANDALONE_CHART_TYPES.includes(seriesList.value[0]?.chartType));
141460
- const isMultiSeries = computed(() => seriesList.value.length > 1);
141461
- const canAddSeries = computed(() => !isPrimaryStandalone.value);
141462
- const availableChartTypeOptions = computed(() => {
141463
- const allOptions = [
141464
- { label: t("canvasUI.canvasBuilder.dataCharts.types.bar"), value: "bar" },
141465
- { label: t("canvasUI.canvasBuilder.dataCharts.types.line"), value: "line" },
141466
- { label: t("canvasUI.canvasBuilder.dataCharts.types.pie"), value: "pie" },
141467
- { label: t("canvasUI.canvasBuilder.dataCharts.types.doughnut"), value: "doughnut" },
141468
- { label: t("canvasUI.canvasBuilder.dataCharts.types.polarArea"), value: "polarArea" },
141469
- { label: t("canvasUI.canvasBuilder.dataCharts.types.radar"), value: "radar" },
141470
- { label: t("canvasUI.canvasBuilder.dataCharts.types.scatter"), value: "scatter" },
141471
- { label: t("canvasUI.canvasBuilder.dataCharts.types.bubble"), value: "bubble" },
141472
- { label: t("canvasUI.canvasBuilder.dataCharts.types.area"), value: "area" }
141473
- ];
141474
- const primaryType = seriesList.value[0]?.chartType;
141475
- if (seriesList.value.length > 1 || activeSeriesIndex.value > 0) {
141476
- if (THREE_D_CHART_TYPES.includes(primaryType)) {
141477
- return allOptions.filter((opt) => THREE_D_CHART_TYPES.includes(opt.value));
141478
- }
141479
- if (TWO_D_CHART_TYPES.includes(primaryType)) {
141480
- return allOptions.filter((opt) => TWO_D_CHART_TYPES.includes(opt.value));
141481
- }
141482
- return allOptions.filter((opt) => ONE_D_CHART_TYPES.includes(opt.value));
141483
- }
141484
- return allOptions;
141485
- });
141486
- const chartType = computed(() => seriesList.value[0]?.chartType ?? "bar");
141487
- const primaryChartType = computed(() => seriesList.value[0]?.chartType ?? "bar");
141050
+ const chartType = ref(props.data?.type ?? "bar");
141488
141051
  const backgroundColor = props.data?.data?.datasets?.[0]?.background_color;
141489
141052
  const colorSchemeType = ref(props.data?.color_scheme_type ?? "theme");
141490
141053
  const chartColors = ref([]);
@@ -141513,16 +141076,24 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141513
141076
  const chartTitle = ref(props.data?.options?.plugins?.title?.text ?? "");
141514
141077
  const legendPosition = ref(props.data?.options?.plugins?.legend?.position ?? "top");
141515
141078
  const enableAnimation = ref((props.data?.options?.animation?.duration ?? 0) > 0);
141079
+ const dataPoints = ref(
141080
+ props.data?.data_points && Array.isArray(props.data.data_points) ? [...props.data.data_points] : props.data?.data?.labels ? props.data.data.labels.map((label, index) => ({
141081
+ label: String(label),
141082
+ value: String(props.data?.data?.datasets?.[0]?.data?.[index] ?? 0)
141083
+ })) : []
141084
+ );
141516
141085
  const xAxisLabel = ref(props.data?.options?.scales?.x?.title?.text ?? "");
141517
141086
  const yAxisLabel = ref(props.data?.options?.scales?.y?.title?.text ?? "");
141518
141087
  const orientation = ref(props.data?.options?.index_axis ?? "x");
141519
141088
  const pointStyle = ref(props.data?.data?.datasets?.[0]?.point_style ?? "circle");
141520
- const percentDisplay = ref(props.data?.percent_display ?? false);
141521
- const enableFullscreenBtn = ref(props.data?.view_controls?.enable_fullscreen_btn ?? false);
141522
- const enableChartTypeSwitcher = ref(props.data?.view_controls?.enable_chart_type_switcher ?? false);
141523
- const enableDataEntry = ref(props.data?.view_controls?.enable_data_entry ?? false);
141524
- const chartHeight = ref(props.data?.chart_height ?? 800);
141525
- const chartWidth = ref(props.data?.chart_width ?? 100);
141089
+ const chartTypeOptions = [
141090
+ { label: t("canvasUI.canvasBuilder.dataCharts.types.bar"), value: "bar" },
141091
+ { label: t("canvasUI.canvasBuilder.dataCharts.types.line"), value: "line" },
141092
+ { label: t("canvasUI.canvasBuilder.dataCharts.types.pie"), value: "pie" },
141093
+ { label: t("canvasUI.canvasBuilder.dataCharts.types.doughnut"), value: "doughnut" },
141094
+ { label: t("canvasUI.canvasBuilder.dataCharts.types.polarArea"), value: "polarArea" },
141095
+ { label: t("canvasUI.canvasBuilder.dataCharts.types.radar"), value: "radar" }
141096
+ ];
141526
141097
  const legendPositionOptions = [
141527
141098
  { label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.none"), value: "none" },
141528
141099
  { label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.top"), value: "top" },
@@ -141531,8 +141102,8 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141531
141102
  { label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.right"), value: "right" }
141532
141103
  ];
141533
141104
  const orientationOptions = [
141534
- { label: t("canvasUI.canvasBuilder.dataCharts.orientations.horizontal"), value: "y" },
141535
- { label: t("canvasUI.canvasBuilder.dataCharts.orientations.vertical"), value: "x" }
141105
+ { label: t("canvasUI.canvasBuilder.dataCharts.orientations.horizontal"), value: "x" },
141106
+ { label: t("canvasUI.canvasBuilder.dataCharts.orientations.vertical"), value: "y" }
141536
141107
  ];
141537
141108
  const pointStyleOptions = [
141538
141109
  { label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.circle"), value: "circle" },
@@ -141542,18 +141113,12 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141542
141113
  { label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.star"), value: "star" },
141543
141114
  { label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.triangle"), value: "triangle" }
141544
141115
  ];
141545
- const deleteButtonStyle = computed(() => ({
141546
- "--n-border": "1px solid transparent",
141547
- "--n-border-disabled": "1px solid transparent",
141548
- "--n-border-focus": "1px solid transparent",
141549
- "--n-border-hover": "1px solid transparent",
141550
- "--n-border-pressed": "1px solid transparent",
141551
- "--n-color-focus": themeVars.value.error2,
141552
- "--n-color-hover": themeVars.value.error2,
141553
- "--n-color-disabled": themeVars.value.error2,
141554
- "--n-color-pressed": themeVars.value.error2
141555
- }));
141556
- const activePopoverField = ref(null);
141116
+ function getColors() {
141117
+ if (colorSchemeType.value === "theme") {
141118
+ return chartColors.value.map((index) => `palette${index}`);
141119
+ }
141120
+ return chartColors.value;
141121
+ }
141557
141122
  function updateChartColors(newColors) {
141558
141123
  if (colorSchemeType.value === "theme") {
141559
141124
  chartColors.value = newColors.map((color, i) => {
@@ -141581,55 +141146,17 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141581
141146
  }
141582
141147
  }
141583
141148
  );
141584
- function closePopover() {
141585
- activePopoverPoint.value = null;
141586
- activePopoverField.value = null;
141587
- }
141588
- function addSeries() {
141589
- if (!canAddSeries.value) return;
141590
- const newIndex = seriesList.value.length;
141591
- const newSeries = {
141592
- id: generateSeriesId(),
141593
- name: `${t("canvasUI.canvasBuilder.dataCharts.series")} ${newIndex + 1}`,
141594
- chartType: seriesList.value[0].chartType,
141595
- // Default to same type as first series
141596
- dataPoints: []
141597
- };
141598
- seriesList.value.push(newSeries);
141599
- activeSeriesIndex.value = newIndex;
141600
- updatePreview();
141601
- }
141602
- function removeSeries(index) {
141603
- if (index === 0 || index >= seriesList.value.length) return;
141604
- seriesList.value.splice(index, 1);
141605
- if (activeSeriesIndex.value >= seriesList.value.length) {
141606
- activeSeriesIndex.value = seriesList.value.length - 1;
141607
- }
141608
- updatePreview();
141609
- }
141610
- function onChartTypeChange(newType) {
141611
- if (activeSeriesIndex.value === 0 && STANDALONE_CHART_TYPES.includes(newType)) {
141612
- seriesList.value = [seriesList.value[0]];
141613
- }
141614
- updatePreview();
141615
- }
141616
141149
  function addDataPoint() {
141617
- activeSeries.value.dataPoints.push({
141150
+ dataPoints.value.push({
141618
141151
  label: "",
141619
- xValue: "",
141620
- yValue: "",
141621
- rValue: "",
141622
141152
  value: ""
141623
141153
  });
141624
141154
  }
141625
141155
  function removeDataPoint(index) {
141626
- activeSeries.value.dataPoints.splice(index, 1);
141156
+ dataPoints.value.splice(index, 1);
141627
141157
  }
141628
141158
  function removeAllDataPoints() {
141629
- activeSeries.value.dataPoints = [];
141630
- }
141631
- function isArrayOrObject(value) {
141632
- return Array.isArray(value) || typeof value === "object" && value !== null;
141159
+ dataPoints.value = [];
141633
141160
  }
141634
141161
  function getFieldOptions(data) {
141635
141162
  if (!data || typeof data !== "object") return [];
@@ -141640,54 +141167,6 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141640
141167
  value: field
141641
141168
  }));
141642
141169
  }
141643
- function updateDynamicValueExpression(point) {
141644
- if (!point.selectedValue || !point.arrayConfig?.labelField || !point.arrayConfig?.valueField) {
141645
- return;
141646
- }
141647
- const path = point.dynamicValue?.path;
141648
- if (!path) {
141649
- return;
141650
- }
141651
- point.label = `{{#each ${path}}}{{lookup this "${point.arrayConfig.labelField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141652
- point.value = `{{#each ${path}}}{{lookup this "${point.arrayConfig.valueField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141653
- point.dynamicValue = {
141654
- path,
141655
- value: point.value
141656
- };
141657
- closePopover();
141658
- }
141659
- function updateXYDynamicValueExpression(point) {
141660
- if (!point.selectedXValue || !point.arrayConfig?.labelField || !point.arrayConfig?.xField || !point.arrayConfig?.yField) {
141661
- return;
141662
- }
141663
- const isBubble = isActiveSeriesXYRChart.value;
141664
- if (isBubble && !point.arrayConfig?.rField) {
141665
- return;
141666
- }
141667
- const path = point.dynamicXValue?.path;
141668
- if (!path) {
141669
- return;
141670
- }
141671
- point.label = `{{#each ${path}}}{{lookup this "${point.arrayConfig.labelField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141672
- point.xValue = `{{#each ${path}}}{{lookup this "${point.arrayConfig.xField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141673
- point.yValue = `{{#each ${path}}}{{lookup this "${point.arrayConfig.yField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141674
- point.dynamicXValue = {
141675
- path,
141676
- value: point.xValue
141677
- };
141678
- point.dynamicYValue = {
141679
- path,
141680
- value: point.yValue
141681
- };
141682
- if (isBubble && point.arrayConfig.rField) {
141683
- point.rValue = `{{#each ${path}}}{{lookup this "${point.arrayConfig.rField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141684
- point.dynamicRValue = {
141685
- path,
141686
- value: point.rValue
141687
- };
141688
- }
141689
- closePopover();
141690
- }
141691
141170
  const dynamicValueTreeData = computed(() => {
141692
141171
  function processObject(obj, path = []) {
141693
141172
  const result = [];
@@ -141738,59 +141217,24 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141738
141217
  return h("span", { class: "text-sm" }, { default: () => info.option.label || "" });
141739
141218
  }
141740
141219
  const activePopoverPoint = ref(null);
141741
- function handleDynamicValueClick(point, field = "value") {
141742
- if (activePopoverPoint.value === point && activePopoverField.value === field) {
141743
- closePopover();
141220
+ function handleDynamicValueClick(point) {
141221
+ if (activePopoverPoint.value === point) {
141222
+ activePopoverPoint.value = null;
141744
141223
  } else {
141745
- if (field === "value") {
141746
- point.selectedValue = void 0;
141747
- point.dynamicValue = void 0;
141748
- point.arrayConfig = void 0;
141749
- point.value = "";
141750
- } else if (field === "x") {
141751
- point.selectedXValue = void 0;
141752
- point.dynamicXValue = void 0;
141753
- point.dynamicYValue = void 0;
141754
- point.dynamicRValue = void 0;
141755
- point.arrayConfig = void 0;
141756
- point.xValue = "";
141757
- point.yValue = "";
141758
- point.rValue = "";
141759
- point.label = "";
141760
- } else if (field === "y") {
141761
- point.selectedYValue = void 0;
141762
- point.dynamicYValue = void 0;
141763
- point.yValue = "";
141764
- } else if (field === "r") {
141765
- point.selectedRValue = void 0;
141766
- point.dynamicRValue = void 0;
141767
- point.rValue = "";
141768
- }
141224
+ point.selectedValue = void 0;
141225
+ point.dynamicValue = void 0;
141226
+ point.arrayConfig = void 0;
141227
+ point.value = "";
141769
141228
  activePopoverPoint.value = point;
141770
- activePopoverField.value = field;
141771
141229
  }
141772
141230
  }
141773
- function handleDynamicValueSelect(keys, point, field = "value") {
141231
+ function handleDynamicValueSelect(keys, point) {
141774
141232
  const selectedKey = keys[0];
141775
141233
  if (!selectedKey) {
141776
- if (field === "value") {
141777
- point.dynamicValue = void 0;
141778
- point.selectedValue = void 0;
141779
- point.value = "";
141780
- } else if (field === "x") {
141781
- point.dynamicXValue = void 0;
141782
- point.selectedXValue = void 0;
141783
- point.xValue = "";
141784
- } else if (field === "y") {
141785
- point.dynamicYValue = void 0;
141786
- point.selectedYValue = void 0;
141787
- point.yValue = "";
141788
- } else if (field === "r") {
141789
- point.dynamicRValue = void 0;
141790
- point.selectedRValue = void 0;
141791
- point.rValue = "";
141792
- }
141793
- closePopover();
141234
+ point.dynamicValue = void 0;
141235
+ point.selectedValue = void 0;
141236
+ point.value = "";
141237
+ activePopoverPoint.value = null;
141794
141238
  return;
141795
141239
  }
141796
141240
  const pathParts = selectedKey.split(/\.(?![^[]*])/) || [];
@@ -141805,80 +141249,6 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141805
141249
  currentValue = currentValue?.[part];
141806
141250
  }
141807
141251
  }
141808
- if (field === "x") {
141809
- point.selectedXValue = currentValue;
141810
- if (Array.isArray(currentValue) || typeof currentValue === "object" && currentValue !== null) {
141811
- point.arrayConfig = {
141812
- labelField: "",
141813
- valueField: "",
141814
- xField: "",
141815
- yField: "",
141816
- rField: ""
141817
- };
141818
- point.dynamicXValue = {
141819
- path: selectedKey,
141820
- value: ""
141821
- };
141822
- return;
141823
- }
141824
- const rootPart = pathParts[0];
141825
- let expression = "";
141826
- if (pathParts.length === 1) {
141827
- expression = `{{${rootPart}}}`;
141828
- } else {
141829
- const restOfPath = pathParts.slice(1).map((part) => {
141830
- if (part.includes("[") && part.includes("]")) {
141831
- return part.split("[")[1].split("]")[0];
141832
- }
141833
- return part;
141834
- });
141835
- expression = `{{lookup (lookup ${rootPart} ${restOfPath[0]}) "${restOfPath[1]}"}}`;
141836
- }
141837
- point.dynamicXValue = { path: selectedKey, value: expression };
141838
- point.xValue = expression;
141839
- closePopover();
141840
- return;
141841
- }
141842
- if (field === "y") {
141843
- point.selectedYValue = currentValue;
141844
- const rootPart = pathParts[0];
141845
- let expression = "";
141846
- if (pathParts.length === 1) {
141847
- expression = `{{${rootPart}}}`;
141848
- } else {
141849
- const restOfPath = pathParts.slice(1).map((part) => {
141850
- if (part.includes("[") && part.includes("]")) {
141851
- return part.split("[")[1].split("]")[0];
141852
- }
141853
- return part;
141854
- });
141855
- expression = `{{lookup (lookup ${rootPart} ${restOfPath[0]}) "${restOfPath[1]}"}}`;
141856
- }
141857
- point.dynamicYValue = { path: selectedKey, value: expression };
141858
- point.yValue = expression;
141859
- closePopover();
141860
- return;
141861
- }
141862
- if (field === "r") {
141863
- point.selectedRValue = currentValue;
141864
- const rootPart = pathParts[0];
141865
- let expression = "";
141866
- if (pathParts.length === 1) {
141867
- expression = `{{${rootPart}}}`;
141868
- } else {
141869
- const restOfPath = pathParts.slice(1).map((part) => {
141870
- if (part.includes("[") && part.includes("]")) {
141871
- return part.split("[")[1].split("]")[0];
141872
- }
141873
- return part;
141874
- });
141875
- expression = `{{lookup (lookup ${rootPart} ${restOfPath[0]}) "${restOfPath[1]}"}}`;
141876
- }
141877
- point.dynamicRValue = { path: selectedKey, value: expression };
141878
- point.rValue = expression;
141879
- closePopover();
141880
- return;
141881
- }
141882
141252
  point.selectedValue = currentValue;
141883
141253
  if (Array.isArray(currentValue) || typeof currentValue === "object" && currentValue !== null) {
141884
141254
  point.arrayConfig = {
@@ -141908,189 +141278,79 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141908
141278
  value: expression
141909
141279
  };
141910
141280
  point.value = expression;
141911
- closePopover();
141912
- }
141913
- }
141914
- function normalizeRValues(values, minRadius = 5, maxRadius = 40) {
141915
- if (values.length === 0) return [];
141916
- const rValues = values.map((v) => v.r);
141917
- const minR = Math.min(...rValues);
141918
- const maxR = Math.max(...rValues);
141919
- if (minR === maxR) {
141920
- return values.map((v) => ({
141921
- ...v,
141922
- r: (minRadius + maxRadius) / 2,
141923
- originalR: v.r
141924
- }));
141281
+ activePopoverPoint.value = null;
141925
141282
  }
141926
- return values.map((v) => ({
141927
- ...v,
141928
- r: minRadius + (v.r - minR) / (maxR - minR) * (maxRadius - minRadius),
141929
- originalR: v.r
141930
- }));
141931
141283
  }
141932
- function processSeriesData(series) {
141933
- const isXY = XY_CHART_TYPES.includes(series.chartType);
141934
- const isXYR = XYR_CHART_TYPES.includes(series.chartType);
141935
- if (isXY || isXYR) {
141936
- const processedData2 = {
141937
- labels: [],
141938
- values: []
141939
- };
141940
- const rawBubbleData = [];
141941
- series.dataPoints.forEach((point) => {
141942
- const x = !isNaN(Number(point.xValue)) ? Number(point.xValue) : 0;
141943
- const y = !isNaN(Number(point.yValue)) ? Number(point.yValue) : 0;
141944
- if (series.chartType === "bubble") {
141945
- const r = point.rValue && !isNaN(Number(point.rValue)) ? Math.abs(Number(point.rValue)) : 10;
141946
- rawBubbleData.push({ label: point.label, x, y, r });
141947
- } else {
141948
- processedData2.labels.push(point.label);
141949
- processedData2.values.push({ x, y });
141950
- }
141951
- });
141952
- if (series.chartType === "bubble" && rawBubbleData.length > 0) {
141953
- const bubbleValues = rawBubbleData.map((d) => ({ x: d.x, y: d.y, r: d.r }));
141954
- const normalizedValues = normalizeRValues(bubbleValues);
141955
- rawBubbleData.forEach((d, idx) => {
141956
- processedData2.labels.push(d.label);
141957
- processedData2.values.push(normalizedValues[idx]);
141958
- });
141959
- }
141960
- return processedData2;
141284
+ function updateDynamicValueExpression(point) {
141285
+ if (!point.selectedValue || !point.arrayConfig?.labelField || !point.arrayConfig?.valueField) {
141286
+ return;
141961
141287
  }
141288
+ const path = point.dynamicValue?.path;
141289
+ if (!path) {
141290
+ return;
141291
+ }
141292
+ point.label = `{{#each ${path}}}{{lookup this "${point.arrayConfig.labelField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141293
+ point.value = `{{#each ${path}}}{{lookup this "${point.arrayConfig.valueField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141294
+ point.dynamicValue = {
141295
+ path,
141296
+ value: point.value
141297
+ };
141298
+ activePopoverPoint.value = null;
141299
+ }
141300
+ function processChartData() {
141962
141301
  const processedData = {
141963
141302
  labels: [],
141964
141303
  values: []
141965
141304
  };
141966
- series.dataPoints.forEach((point) => {
141305
+ dataPoints.value.forEach((point) => {
141967
141306
  processedData.labels.push(point.label);
141968
141307
  processedData.values.push(!isNaN(Number(point.value)) ? Number(point.value) : 0);
141969
141308
  });
141970
141309
  return processedData;
141971
141310
  }
141972
- function getSeriesColors(forStorage = false) {
141973
- if (colorSchemeType.value === "theme") {
141974
- if (forStorage) {
141975
- return chartColors.value.map((index) => `palette${index}`);
141976
- }
141977
- return chartColors.value.map((index) => {
141978
- const idx = parseInt(index);
141979
- return palette.value[idx % palette.value.length];
141980
- });
141981
- }
141982
- return chartColors.value;
141983
- }
141984
141311
  function createChartConfig() {
141985
- const datasets = [];
141986
- let allLabels = [];
141987
- const colorsForStorage = getSeriesColors(true);
141988
- const isSingleSeries = seriesList.value.length === 1;
141989
- seriesList.value.forEach((series, index) => {
141990
- const processedData = processSeriesData(series);
141991
- let backgroundColor2;
141992
- let borderColor;
141993
- if (isSingleSeries) {
141994
- backgroundColor2 = colorsForStorage;
141995
- borderColor = [...colorsForStorage];
141996
- } else {
141997
- const seriesColor = colorsForStorage[index % colorsForStorage.length];
141998
- backgroundColor2 = seriesColor;
141999
- borderColor = seriesColor;
142000
- }
142001
- const datasetOptions = {
142002
- label: series.name,
142003
- data: processedData.values,
142004
- background_color: backgroundColor2,
142005
- border_color: borderColor,
142006
- borderWidth: 1
142007
- };
142008
- if (!isSingleSeries) {
142009
- if (series.chartType === "area") {
142010
- datasetOptions.type = "line";
142011
- datasetOptions.fill = true;
142012
- datasetOptions.tension = 0.4;
142013
- } else {
142014
- datasetOptions.type = series.chartType;
142015
- }
142016
- }
142017
- if (series.chartType === "area") {
142018
- datasetOptions.fill = true;
142019
- datasetOptions.tension = 0.4;
142020
- }
142021
- if (["line", "scatter", "area"].includes(series.chartType)) {
142022
- datasetOptions.pointStyle = pointStyle.value;
142023
- }
142024
- if (["line", "area"].includes(series.chartType)) {
142025
- datasetOptions.tension = 0.4;
142026
- }
142027
- if (processedData.labels.length > allLabels.length) {
142028
- allLabels = processedData.labels;
142029
- }
142030
- datasets.push(datasetOptions);
142031
- });
142032
- const primaryType = seriesList.value[0].chartType;
142033
- let actualPrimaryType = primaryType;
142034
- if (primaryType === "area") {
142035
- actualPrimaryType = "line";
142036
- }
142037
- let scales = void 0;
142038
- const chartTypesWithScales = ["bar", "line", "scatter", "bubble", "area"];
142039
- if (chartTypesWithScales.includes(primaryType)) {
142040
- scales = {
142041
- x: {
142042
- title: {
142043
- display: !!xAxisLabel.value,
142044
- text: xAxisLabel.value
142045
- }
142046
- },
142047
- y: {
142048
- title: {
142049
- display: !!yAxisLabel.value,
142050
- text: yAxisLabel.value
142051
- },
142052
- begin_at_zero: true
142053
- }
142054
- };
142055
- } else if (["radar", "polarArea"].includes(primaryType)) {
142056
- scales = {
142057
- r: {
142058
- begin_at_zero: true,
142059
- ticks: {
142060
- step_size: 1
142061
- }
142062
- }
142063
- };
142064
- }
142065
- const showLegend = seriesList.value.length > 1 || legendPosition.value !== "none";
142066
141312
  const config = {
142067
- type: actualPrimaryType,
141313
+ type: chartType.value,
142068
141314
  color_scheme_type: colorSchemeType.value,
142069
- percent_display: percentDisplay.value,
142070
- chart_height: chartHeight.value,
142071
- chart_width: chartWidth.value,
142072
- view_controls: {
142073
- enable_fullscreen_btn: enableFullscreenBtn.value,
142074
- enable_chart_type_switcher: enableChartTypeSwitcher.value,
142075
- enable_data_entry: enableDataEntry.value
142076
- },
142077
141315
  data: {
142078
- labels: allLabels,
142079
- datasets
141316
+ labels: [],
141317
+ datasets: [
141318
+ {
141319
+ label: "Data Series",
141320
+ data: [],
141321
+ background_color: getColors(),
141322
+ border_color: getColors(),
141323
+ border_width: 1,
141324
+ point_style: ["line"].includes(chartType.value) ? pointStyle.value : void 0
141325
+ }
141326
+ ]
142080
141327
  },
142081
141328
  options: {
142082
141329
  responsive: true,
142083
141330
  maintainAspectRatio: false,
142084
- index_axis: ["bar", "line"].includes(primaryType) ? orientation.value : void 0,
142085
- scales,
141331
+ index_axis: ["bar", "line"].includes(chartType.value) ? orientation.value : void 0,
141332
+ scales: ["bar", "line"].includes(chartType.value) ? {
141333
+ x: {
141334
+ title: {
141335
+ display: !!xAxisLabel.value,
141336
+ text: xAxisLabel.value
141337
+ }
141338
+ },
141339
+ y: {
141340
+ title: {
141341
+ display: !!yAxisLabel.value,
141342
+ text: yAxisLabel.value
141343
+ }
141344
+ }
141345
+ } : void 0,
142086
141346
  plugins: {
142087
141347
  title: {
142088
141348
  display: !!chartTitle.value,
142089
141349
  text: chartTitle.value
142090
141350
  },
142091
141351
  legend: {
142092
- display: showLegend,
142093
- position: legendPosition.value !== "none" ? legendPosition.value : "top",
141352
+ display: legendPosition.value !== "none",
141353
+ position: legendPosition.value,
142094
141354
  labels: {
142095
141355
  usePointStyle: true
142096
141356
  }
@@ -142100,27 +141360,14 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142100
141360
  duration: enableAnimation.value ? 1e3 : 0
142101
141361
  }
142102
141362
  },
142103
- // Save series data for editing
142104
- series: seriesList.value.map((series) => ({
142105
- id: series.id,
142106
- name: series.name,
142107
- chart_type: series.chartType,
142108
- data_points: series.dataPoints.map((point) => ({
142109
- label: point.label,
142110
- value: point.value,
142111
- x_value: point.xValue,
142112
- y_value: point.yValue,
142113
- r_value: point.rValue,
142114
- dynamic_value: point.dynamicValue,
142115
- dynamic_x_value: point.dynamicXValue,
142116
- dynamic_y_value: point.dynamicYValue,
142117
- dynamic_r_value: point.dynamicRValue,
142118
- array_config: point.arrayConfig
142119
- }))
142120
- })),
142121
- // Store the primary chart type for reference
142122
- _primary_chart_type: primaryType
141363
+ data_points: dataPoints.value.map((point) => ({
141364
+ label: point.label,
141365
+ value: point.value
141366
+ }))
142123
141367
  };
141368
+ const processedData = processChartData();
141369
+ config.data.labels = processedData.labels;
141370
+ config.data.datasets[0].data = processedData.values;
142124
141371
  return config;
142125
141372
  }
142126
141373
  function onCancel() {
@@ -142148,14 +141395,9 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142148
141395
  },
142149
141396
  { immediate: true }
142150
141397
  );
142151
- watch(isMultiSeries, (multiSeries) => {
142152
- if (multiSeries) {
142153
- enableChartTypeSwitcher.value = false;
142154
- }
142155
- });
142156
141398
  watch(
142157
141399
  [
142158
- seriesList,
141400
+ chartType,
142159
141401
  chartColors,
142160
141402
  colorSchemeType,
142161
141403
  chartTitle,
@@ -142164,13 +141406,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142164
141406
  yAxisLabel,
142165
141407
  orientation,
142166
141408
  pointStyle,
142167
- percentDisplay,
142168
- enableAnimation,
142169
- enableFullscreenBtn,
142170
- enableChartTypeSwitcher,
142171
- enableDataEntry,
142172
- chartHeight,
142173
- chartWidth
141409
+ dataPoints
142174
141410
  ],
142175
141411
  () => {
142176
141412
  updatePreview();
@@ -142196,10 +141432,10 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142196
141432
  "--n-padding-left": "16px"
142197
141433
  }]),
142198
141434
  title: unref(t)("canvasUI.canvasBuilder.dataCharts.editDataChartsComponent"),
142199
- onClose: _cache[16] || (_cache[16] = ($event) => unref(setComponentEditMode)(false))
141435
+ onClose: _cache[11] || (_cache[11] = ($event) => unref(setComponentEditMode)(false))
142200
141436
  }, {
142201
141437
  footer: withCtx(() => [
142202
- createElementVNode("div", _hoisted_89, [
141438
+ createElementVNode("div", _hoisted_50$3, [
142203
141439
  createVNode(CButton, { onClick: onCancel }, {
142204
141440
  default: withCtx(() => [
142205
141441
  createTextVNode(toDisplayString(unref(t)("canvasUI.common.cancel")), 1)
@@ -142237,66 +141473,69 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142237
141473
  createElementVNode("div", _hoisted_2$1t, [
142238
141474
  createElementVNode("div", _hoisted_3$17, [
142239
141475
  createElementVNode("div", _hoisted_4$X, [
142240
- createElementVNode("div", _hoisted_5$O, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.dataSettings")), 1),
142241
- createElementVNode("div", _hoisted_6$H, [
142242
- (openBlock(true), createElementBlock(Fragment, null, renderList(seriesList.value, (series, index) => {
142243
- return openBlock(), createElementBlock("div", {
142244
- key: series.id,
142245
- class: normalizeClass(["series-tab flex items-center gap-1 px-3 py-2 h-9 cursor-pointer border border-b-0 rounded-t-lg mr-1 transition-colors", [
142246
- activeSeriesIndex.value === index ? "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 -mb-px" : "bg-gray-100 dark:bg-gray-900 border-transparent hover:bg-gray-200 dark:hover:bg-gray-700"
142247
- ]]),
142248
- onClick: ($event) => activeSeriesIndex.value = index
142249
- }, [
142250
- createElementVNode("span", _hoisted_8$q, toDisplayString(series.name), 1),
142251
- index > 0 ? (openBlock(), createElementBlock("div", {
142252
- key: 0,
142253
- class: "ml-1 p-0.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600",
142254
- onClick: withModifiers(($event) => removeSeries(index), ["stop"])
142255
- }, [
142256
- createVNode(CIcon, {
142257
- class: "text-gray-500",
142258
- icon: "times",
142259
- size: 10
142260
- })
142261
- ], 8, _hoisted_9$m)) : createCommentVNode("", true)
142262
- ], 10, _hoisted_7$v);
142263
- }), 128)),
142264
- canAddSeries.value ? (openBlock(), createElementBlock("button", {
142265
- key: 0,
142266
- class: "flex items-center justify-center w-8 h-8 mb-1 rounded bg-transparent border-none hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors cursor-pointer",
142267
- title: unref(t)("canvasUI.canvasBuilder.dataCharts.addSeries"),
142268
- onClick: addSeries
142269
- }, [
142270
- createVNode(CIcon, {
142271
- icon: "plus",
142272
- size: 14
142273
- })
142274
- ], 8, _hoisted_10$h)) : createCommentVNode("", true)
141476
+ createElementVNode("div", _hoisted_5$O, [
141477
+ createElementVNode("label", _hoisted_6$H, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartType")), 1),
141478
+ createVNode(unref(NSelect), {
141479
+ value: chartType.value,
141480
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => chartType.value = $event),
141481
+ options: chartTypeOptions
141482
+ }, null, 8, ["value"])
142275
141483
  ]),
142276
- seriesList.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_11$f, [
142277
- createElementVNode("label", _hoisted_12$b, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.seriesName")), 1),
141484
+ ["bar", "line"].includes(chartType.value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
141485
+ createElementVNode("div", _hoisted_7$v, [
141486
+ createElementVNode("label", _hoisted_8$q, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.xAxisLabel")), 1),
141487
+ createVNode(unref(NInput), {
141488
+ value: xAxisLabel.value,
141489
+ "onUpdate:value": _cache[1] || (_cache[1] = ($event) => xAxisLabel.value = $event),
141490
+ type: "text"
141491
+ }, null, 8, ["value"])
141492
+ ]),
141493
+ createElementVNode("div", _hoisted_9$m, [
141494
+ createElementVNode("label", _hoisted_10$h, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.yAxisLabel")), 1),
141495
+ createVNode(unref(NInput), {
141496
+ value: yAxisLabel.value,
141497
+ "onUpdate:value": _cache[2] || (_cache[2] = ($event) => yAxisLabel.value = $event),
141498
+ type: "text"
141499
+ }, null, 8, ["value"])
141500
+ ]),
141501
+ createElementVNode("div", _hoisted_11$f, [
141502
+ createElementVNode("label", _hoisted_12$b, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.orientation")), 1),
141503
+ createVNode(unref(NSelect), {
141504
+ value: orientation.value,
141505
+ "onUpdate:value": _cache[3] || (_cache[3] = ($event) => orientation.value = $event),
141506
+ options: orientationOptions
141507
+ }, null, 8, ["value"])
141508
+ ]),
141509
+ ["line", "radar"].includes(chartType.value) ? (openBlock(), createElementBlock("div", _hoisted_13$a, [
141510
+ createElementVNode("label", _hoisted_14$9, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.pointStyle")), 1),
141511
+ createVNode(unref(NSelect), {
141512
+ value: pointStyle.value,
141513
+ "onUpdate:value": _cache[4] || (_cache[4] = ($event) => pointStyle.value = $event),
141514
+ options: pointStyleOptions
141515
+ }, null, 8, ["value"])
141516
+ ])) : createCommentVNode("", true)
141517
+ ], 64)) : createCommentVNode("", true),
141518
+ createElementVNode("div", _hoisted_15$8, [
141519
+ createElementVNode("label", _hoisted_16$8, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartTitle")), 1),
142278
141520
  createVNode(unref(NInput), {
142279
- value: activeSeries.value.name,
142280
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => activeSeries.value.name = $event),
141521
+ value: chartTitle.value,
141522
+ "onUpdate:value": _cache[5] || (_cache[5] = ($event) => chartTitle.value = $event),
142281
141523
  type: "text"
142282
141524
  }, null, 8, ["value"])
142283
- ])) : createCommentVNode("", true),
142284
- createElementVNode("div", _hoisted_13$a, [
142285
- createElementVNode("label", _hoisted_14$9, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartType")), 1),
142286
- createVNode(unref(NSelect), {
142287
- value: activeSeries.value.chartType,
142288
- "onUpdate:value": [
142289
- _cache[1] || (_cache[1] = ($event) => activeSeries.value.chartType = $event),
142290
- onChartTypeChange
142291
- ],
142292
- options: availableChartTypeOptions.value
142293
- }, null, 8, ["value", "options"])
142294
141525
  ]),
142295
- createElementVNode("div", _hoisted_15$8, [
142296
- createElementVNode("div", _hoisted_16$8, [
142297
- createElementVNode("label", _hoisted_17$7, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.dataPoints")), 1),
141526
+ ["pie", "doughnut", "polarArea"].includes(chartType.value) ? (openBlock(), createElementBlock("div", _hoisted_17$7, [
141527
+ createElementVNode("label", _hoisted_18$6, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.legendPosition")), 1),
141528
+ createVNode(unref(NSelect), {
141529
+ value: legendPosition.value,
141530
+ "onUpdate:value": _cache[6] || (_cache[6] = ($event) => legendPosition.value = $event),
141531
+ options: legendPositionOptions
141532
+ }, null, 8, ["value"])
141533
+ ])) : createCommentVNode("", true),
141534
+ createElementVNode("div", _hoisted_19$6, [
141535
+ createElementVNode("div", _hoisted_20$5, [
141536
+ createElementVNode("label", _hoisted_21$5, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.dataPoints")), 1),
142298
141537
  createVNode(unref(Button), {
142299
- disabled: !activeSeries.value.dataPoints.length,
141538
+ disabled: !dataPoints.value.length,
142300
141539
  size: "small",
142301
141540
  onClick: removeAllDataPoints
142302
141541
  }, {
@@ -142306,301 +141545,205 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142306
141545
  _: 1
142307
141546
  }, 8, ["disabled"])
142308
141547
  ]),
142309
- !isActiveSeriesXYChart.value && !isActiveSeriesXYRChart.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(activeSeries.value.dataPoints, (point, index) => {
141548
+ (openBlock(true), createElementBlock(Fragment, null, renderList(dataPoints.value, (point, index) => {
142310
141549
  return openBlock(), createElementBlock("div", {
142311
141550
  key: index,
142312
141551
  class: "flex gap-2 mb-2"
142313
141552
  }, [
142314
- createVNode(unref(NInput), {
142315
- value: point.label,
142316
- "onUpdate:value": ($event) => point.label = $event,
142317
- class: "flex-1",
142318
- disabled: !!point.arrayConfig,
142319
- placeholder: "Label"
142320
- }, null, 8, ["value", "onUpdate:value", "disabled"]),
142321
- createVNode(unref(NInput), {
142322
- value: point.value,
142323
- "onUpdate:value": ($event) => point.value = $event,
142324
- class: "flex-1",
142325
- disabled: !!point.dynamicValue,
142326
- placeholder: "Value",
142327
- type: "text"
141553
+ point.selectedValue && (Array.isArray(point.selectedValue) || typeof point.selectedValue === "object" && point.selectedValue !== null) ? (openBlock(), createBlock(unref(NTooltip), {
141554
+ key: 0,
141555
+ trigger: "hover"
142328
141556
  }, {
142329
- suffix: withCtx(() => [
142330
- createVNode(unref(NPopover), {
142331
- placement: "bottom",
142332
- show: activePopoverPoint.value === point && activePopoverField.value === "value",
142333
- trigger: "manual",
142334
- onClickoutside: closePopover
142335
- }, {
142336
- trigger: withCtx(() => [
142337
- createElementVNode("div", {
142338
- class: "cursor-pointer flex items-center",
142339
- onClick: ($event) => handleDynamicValueClick(point, "value")
142340
- }, [
142341
- createVNode(CIcon, {
142342
- class: normalizeClass(point.dynamicValue ? "text-blue-500" : ""),
142343
- icon: "caret-down"
142344
- }, null, 8, ["class"])
142345
- ], 8, _hoisted_18$6)
142346
- ]),
142347
- default: withCtx(() => [
142348
- createElementVNode("div", _hoisted_19$6, [
142349
- createElementVNode("div", _hoisted_20$5, [
142350
- createElementVNode("div", _hoisted_21$5, [
142351
- createElementVNode("div", _hoisted_22$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
142352
- createElementVNode("div", _hoisted_23$3, [
142353
- createVNode(unref(NTree), {
142354
- "block-line": "",
142355
- class: "max-h-[300px]",
142356
- data: dynamicValueTreeData.value,
142357
- "render-label": renderDynamicValueTreeLabel,
142358
- "selected-keys": [point.dynamicValue?.path ?? ""],
142359
- "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point, "value")
142360
- }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
142361
- ])
142362
- ]),
142363
- point.selectedValue && point.arrayConfig && isArrayOrObject(point.selectedValue) ? (openBlock(), createElementBlock("div", _hoisted_24$3, [
142364
- createElementVNode("div", _hoisted_25$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.configureArrayObjectFields")), 1),
142365
- createElementVNode("div", _hoisted_26$3, [
142366
- createElementVNode("div", null, [
142367
- createElementVNode("label", _hoisted_27$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.labelField")), 1),
142368
- createVNode(unref(NSelect), {
142369
- value: point.arrayConfig.labelField,
142370
- "onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateDynamicValueExpression(point)],
142371
- options: getFieldOptions(point.selectedValue)
142372
- }, null, 8, ["value", "onUpdate:value", "options"])
142373
- ]),
142374
- createElementVNode("div", null, [
142375
- createElementVNode("label", _hoisted_28$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.valueField")), 1),
142376
- createVNode(unref(NSelect), {
142377
- value: point.arrayConfig.valueField,
142378
- "onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
142379
- options: getFieldOptions(point.selectedValue)
142380
- }, null, 8, ["value", "onUpdate:value", "options"])
142381
- ])
142382
- ])
142383
- ])) : createCommentVNode("", true)
142384
- ])
142385
- ])
142386
- ]),
142387
- _: 2
142388
- }, 1032, ["show"])
141557
+ trigger: withCtx(() => [
141558
+ createVNode(unref(NInput), {
141559
+ value: point.label,
141560
+ "onUpdate:value": ($event) => point.label = $event,
141561
+ class: "flex-1",
141562
+ disabled: true,
141563
+ placeholder: "Label"
141564
+ }, null, 8, ["value", "onUpdate:value"])
142389
141565
  ]),
142390
- _: 2
142391
- }, 1032, ["value", "onUpdate:value", "disabled"]),
142392
- createVNode(CButton, {
142393
- circle: "",
142394
- class: "bg-error2 self-center",
142395
- size: "small",
142396
- style: normalizeStyle(deleteButtonStyle.value),
142397
- type: "error",
142398
- onClick: ($event) => removeDataPoint(index)
142399
- }, {
142400
- icon: withCtx(() => [
142401
- createVNode(CIcon, {
142402
- class: "color-error",
142403
- "fa-type": "far",
142404
- icon: "trash",
142405
- size: 12
142406
- })
141566
+ default: withCtx(() => [
141567
+ createTextVNode(" " + toDisplayString(point.label), 1)
142407
141568
  ]),
142408
141569
  _: 2
142409
- }, 1032, ["style", "onClick"])
142410
- ]);
142411
- }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(activeSeries.value.dataPoints, (point, index) => {
142412
- return openBlock(), createElementBlock("div", {
142413
- key: index,
142414
- class: "flex gap-2 mb-2"
142415
- }, [
142416
- createVNode(unref(NInput), {
141570
+ }, 1024)) : (openBlock(), createBlock(unref(NInput), {
141571
+ key: 1,
142417
141572
  value: point.label,
142418
141573
  "onUpdate:value": ($event) => point.label = $event,
142419
141574
  class: "flex-1",
142420
- disabled: !!point.arrayConfig,
142421
141575
  placeholder: "Label"
142422
- }, null, 8, ["value", "onUpdate:value", "disabled"]),
142423
- createVNode(unref(NInput), {
142424
- value: point.xValue,
142425
- "onUpdate:value": ($event) => point.xValue = $event,
142426
- class: "flex-1",
142427
- disabled: !!point.dynamicXValue,
142428
- placeholder: "X Value",
142429
- type: "text"
142430
- }, {
142431
- suffix: withCtx(() => [
142432
- createVNode(unref(NPopover), {
142433
- placement: "bottom",
142434
- show: activePopoverPoint.value === point && activePopoverField.value === "x",
142435
- trigger: "manual",
142436
- onClickoutside: closePopover
142437
- }, {
142438
- trigger: withCtx(() => [
142439
- createElementVNode("div", {
142440
- class: "cursor-pointer flex items-center",
142441
- onClick: ($event) => handleDynamicValueClick(point, "x")
142442
- }, [
142443
- createVNode(CIcon, {
142444
- class: normalizeClass(point.dynamicXValue ? "text-blue-500" : ""),
142445
- icon: "caret-down"
142446
- }, null, 8, ["class"])
142447
- ], 8, _hoisted_29$3)
142448
- ]),
142449
- default: withCtx(() => [
142450
- createElementVNode("div", _hoisted_30$3, [
142451
- createElementVNode("div", _hoisted_31$3, [
142452
- createElementVNode("div", _hoisted_32$3, [
142453
- createElementVNode("div", _hoisted_33$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
142454
- createElementVNode("div", _hoisted_34$3, [
142455
- createVNode(unref(NTree), {
142456
- "block-line": "",
142457
- class: "max-h-[300px]",
142458
- data: dynamicValueTreeData.value,
142459
- "render-label": renderDynamicValueTreeLabel,
142460
- "selected-keys": [point.dynamicXValue?.path ?? ""],
142461
- "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point, "x")
142462
- }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
141576
+ }, null, 8, ["value", "onUpdate:value"])),
141577
+ createElementVNode("div", _hoisted_22$3, [
141578
+ point.dynamicValue ? (openBlock(), createBlock(unref(NTooltip), {
141579
+ key: 0,
141580
+ trigger: "hover"
141581
+ }, {
141582
+ trigger: withCtx(() => [
141583
+ createVNode(unref(NInput), {
141584
+ value: point.value,
141585
+ "onUpdate:value": ($event) => point.value = $event,
141586
+ class: "flex-1",
141587
+ disabled: !!point.dynamicValue,
141588
+ placeholder: "Value",
141589
+ type: "text"
141590
+ }, {
141591
+ suffix: withCtx(() => [
141592
+ createVNode(unref(NPopover), {
141593
+ placement: "bottom",
141594
+ show: activePopoverPoint.value === point,
141595
+ trigger: "manual",
141596
+ onClickoutside: _cache[7] || (_cache[7] = ($event) => activePopoverPoint.value = null)
141597
+ }, {
141598
+ trigger: withCtx(() => [
141599
+ createElementVNode("div", {
141600
+ class: "cursor-pointer flex items-center",
141601
+ onClick: ($event) => handleDynamicValueClick(point)
141602
+ }, [
141603
+ createVNode(CIcon, {
141604
+ class: normalizeClass(point.dynamicValue ? "text-blue-500" : ""),
141605
+ icon: "caret-down"
141606
+ }, null, 8, ["class"])
141607
+ ], 8, _hoisted_23$3)
141608
+ ]),
141609
+ default: withCtx(() => [
141610
+ createElementVNode("div", _hoisted_24$3, [
141611
+ createElementVNode("div", _hoisted_25$3, [
141612
+ createElementVNode("div", _hoisted_26$3, [
141613
+ createElementVNode("div", _hoisted_27$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
141614
+ createElementVNode("div", _hoisted_28$3, [
141615
+ createVNode(unref(NTree), {
141616
+ "block-line": "",
141617
+ class: "max-h-[300px]",
141618
+ data: dynamicValueTreeData.value,
141619
+ "render-label": renderDynamicValueTreeLabel,
141620
+ "selected-keys": [point.dynamicValue?.path ?? ""],
141621
+ "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point)
141622
+ }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
141623
+ ])
141624
+ ]),
141625
+ point.selectedValue && point.arrayConfig && (Array.isArray(point.selectedValue) || typeof point.selectedValue === "object" && point.selectedValue !== null) ? (openBlock(), createElementBlock("div", _hoisted_29$3, [
141626
+ createElementVNode("div", _hoisted_30$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.configureArrayObjectFields")), 1),
141627
+ createElementVNode("div", _hoisted_31$3, [
141628
+ createElementVNode("div", null, [
141629
+ createElementVNode("label", _hoisted_32$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.labelField")), 1),
141630
+ createVNode(unref(NSelect), {
141631
+ value: point.arrayConfig.labelField,
141632
+ "onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateDynamicValueExpression(point)],
141633
+ options: getFieldOptions(point.selectedValue)
141634
+ }, null, 8, ["value", "onUpdate:value", "options"])
141635
+ ]),
141636
+ createElementVNode("div", null, [
141637
+ createElementVNode("label", _hoisted_33$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.valueField")), 1),
141638
+ createVNode(unref(NSelect), {
141639
+ value: point.arrayConfig.valueField,
141640
+ "onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
141641
+ options: getFieldOptions(point.selectedValue)
141642
+ }, null, 8, ["value", "onUpdate:value", "options"])
141643
+ ])
141644
+ ])
141645
+ ])) : createCommentVNode("", true)
141646
+ ])
142463
141647
  ])
142464
141648
  ]),
142465
- point.selectedXValue && point.arrayConfig && isArrayOrObject(point.selectedXValue) ? (openBlock(), createElementBlock("div", _hoisted_35$3, [
142466
- createElementVNode("div", _hoisted_36$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.configureArrayObjectFields")), 1),
141649
+ _: 2
141650
+ }, 1032, ["show"])
141651
+ ]),
141652
+ _: 2
141653
+ }, 1032, ["value", "onUpdate:value", "disabled"])
141654
+ ]),
141655
+ default: withCtx(() => [
141656
+ createTextVNode(" " + toDisplayString(point.value), 1)
141657
+ ]),
141658
+ _: 2
141659
+ }, 1024)) : (openBlock(), createBlock(unref(NInput), {
141660
+ key: 1,
141661
+ value: point.value,
141662
+ "onUpdate:value": ($event) => point.value = $event,
141663
+ class: "flex-1",
141664
+ disabled: !!point.dynamicValue,
141665
+ placeholder: "Value",
141666
+ type: "text"
141667
+ }, {
141668
+ suffix: withCtx(() => [
141669
+ createVNode(unref(NPopover), {
141670
+ placement: "bottom",
141671
+ show: activePopoverPoint.value === point,
141672
+ trigger: "manual",
141673
+ onClickoutside: _cache[8] || (_cache[8] = ($event) => activePopoverPoint.value = null)
141674
+ }, {
141675
+ trigger: withCtx(() => [
141676
+ createElementVNode("div", {
141677
+ class: "cursor-pointer flex items-center",
141678
+ onClick: ($event) => handleDynamicValueClick(point)
141679
+ }, [
141680
+ createVNode(CIcon, {
141681
+ class: normalizeClass(point.dynamicValue ? "text-blue-500" : ""),
141682
+ icon: "caret-down"
141683
+ }, null, 8, ["class"])
141684
+ ], 8, _hoisted_34$3)
141685
+ ]),
141686
+ default: withCtx(() => [
141687
+ createElementVNode("div", _hoisted_35$3, [
141688
+ createElementVNode("div", _hoisted_36$3, [
142467
141689
  createElementVNode("div", _hoisted_37$3, [
142468
- createElementVNode("div", null, [
142469
- createElementVNode("label", _hoisted_38$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.labelField")), 1),
142470
- createVNode(unref(NSelect), {
142471
- value: point.arrayConfig.labelField,
142472
- "onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateXYDynamicValueExpression(point)],
142473
- options: getFieldOptions(point.selectedXValue)
142474
- }, null, 8, ["value", "onUpdate:value", "options"])
142475
- ]),
142476
- createElementVNode("div", null, [
142477
- createElementVNode("label", _hoisted_39$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.xValueField")), 1),
142478
- createVNode(unref(NSelect), {
142479
- value: point.arrayConfig.xField,
142480
- "onUpdate:value": [($event) => point.arrayConfig.xField = $event, ($event) => updateXYDynamicValueExpression(point)],
142481
- options: getFieldOptions(point.selectedXValue)
142482
- }, null, 8, ["value", "onUpdate:value", "options"])
142483
- ]),
142484
- createElementVNode("div", null, [
142485
- createElementVNode("label", _hoisted_40$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.yValueField")), 1),
142486
- createVNode(unref(NSelect), {
142487
- value: point.arrayConfig.yField,
142488
- "onUpdate:value": [($event) => point.arrayConfig.yField = $event, ($event) => updateXYDynamicValueExpression(point)],
142489
- options: getFieldOptions(point.selectedXValue)
142490
- }, null, 8, ["value", "onUpdate:value", "options"])
142491
- ]),
142492
- isActiveSeriesXYRChart.value ? (openBlock(), createElementBlock("div", _hoisted_41$3, [
142493
- createElementVNode("label", _hoisted_42$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.rValueField")), 1),
142494
- createVNode(unref(NSelect), {
142495
- value: point.arrayConfig.rField,
142496
- "onUpdate:value": [($event) => point.arrayConfig.rField = $event, ($event) => updateXYDynamicValueExpression(point)],
142497
- options: getFieldOptions(point.selectedXValue)
142498
- }, null, 8, ["value", "onUpdate:value", "options"])
142499
- ])) : createCommentVNode("", true)
142500
- ])
142501
- ])) : createCommentVNode("", true)
141690
+ createElementVNode("div", _hoisted_38$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
141691
+ createElementVNode("div", _hoisted_39$3, [
141692
+ createVNode(unref(NTree), {
141693
+ "block-line": "",
141694
+ class: "max-h-[300px]",
141695
+ data: dynamicValueTreeData.value,
141696
+ "render-label": renderDynamicValueTreeLabel,
141697
+ "selected-keys": [point.dynamicValue?.path ?? ""],
141698
+ "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point)
141699
+ }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
141700
+ ])
141701
+ ]),
141702
+ point.selectedValue && point.arrayConfig && (Array.isArray(point.selectedValue) || typeof point.selectedValue === "object" && point.selectedValue !== null) ? (openBlock(), createElementBlock("div", _hoisted_40$3, [
141703
+ _cache[14] || (_cache[14] = createElementVNode("div", { class: "text-sm font-medium mb-2" }, "Configure Array/Object Fields", -1)),
141704
+ createElementVNode("div", _hoisted_41$3, [
141705
+ createElementVNode("div", null, [
141706
+ _cache[12] || (_cache[12] = createElementVNode("label", { class: "block mb-1 text-sm" }, "Label Field", -1)),
141707
+ createVNode(unref(NSelect), {
141708
+ value: point.arrayConfig.labelField,
141709
+ "onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateDynamicValueExpression(point)],
141710
+ options: getFieldOptions(point.selectedValue)
141711
+ }, null, 8, ["value", "onUpdate:value", "options"])
141712
+ ]),
141713
+ createElementVNode("div", null, [
141714
+ _cache[13] || (_cache[13] = createElementVNode("label", { class: "block mb-1 text-sm" }, "Value Field", -1)),
141715
+ createVNode(unref(NSelect), {
141716
+ value: point.arrayConfig.valueField,
141717
+ "onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
141718
+ options: getFieldOptions(point.selectedValue)
141719
+ }, null, 8, ["value", "onUpdate:value", "options"])
141720
+ ])
141721
+ ])
141722
+ ])) : createCommentVNode("", true)
141723
+ ])
142502
141724
  ])
142503
- ])
142504
- ]),
142505
- _: 2
142506
- }, 1032, ["show"])
142507
- ]),
142508
- _: 2
142509
- }, 1032, ["value", "onUpdate:value", "disabled"]),
142510
- createVNode(unref(NInput), {
142511
- value: point.yValue,
142512
- "onUpdate:value": ($event) => point.yValue = $event,
142513
- class: "flex-1",
142514
- disabled: !!point.dynamicYValue,
142515
- placeholder: "Y Value",
142516
- type: "text"
142517
- }, {
142518
- suffix: withCtx(() => [
142519
- createVNode(unref(NPopover), {
142520
- placement: "bottom",
142521
- show: activePopoverPoint.value === point && activePopoverField.value === "y",
142522
- trigger: "manual",
142523
- onClickoutside: closePopover
142524
- }, {
142525
- trigger: withCtx(() => [
142526
- createElementVNode("div", {
142527
- class: "cursor-pointer flex items-center",
142528
- onClick: ($event) => handleDynamicValueClick(point, "y")
142529
- }, [
142530
- createVNode(CIcon, {
142531
- class: normalizeClass(point.dynamicYValue ? "text-blue-500" : ""),
142532
- icon: "caret-down"
142533
- }, null, 8, ["class"])
142534
- ], 8, _hoisted_43$3)
142535
- ]),
142536
- default: withCtx(() => [
142537
- createElementVNode("div", _hoisted_44$3, [
142538
- createElementVNode("div", _hoisted_45$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
142539
- createVNode(unref(NTree), {
142540
- "block-line": "",
142541
- class: "max-h-[300px]",
142542
- data: dynamicValueTreeData.value,
142543
- "render-label": renderDynamicValueTreeLabel,
142544
- "selected-keys": [point.dynamicYValue?.path ?? ""],
142545
- "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point, "y")
142546
- }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
142547
- ])
142548
- ]),
142549
- _: 2
142550
- }, 1032, ["show"])
142551
- ]),
142552
- _: 2
142553
- }, 1032, ["value", "onUpdate:value", "disabled"]),
142554
- isActiveSeriesXYRChart.value ? (openBlock(), createBlock(unref(NInput), {
142555
- key: 0,
142556
- value: point.rValue,
142557
- "onUpdate:value": ($event) => point.rValue = $event,
142558
- class: "flex-1",
142559
- disabled: !!point.dynamicRValue,
142560
- placeholder: "Size (R)",
142561
- type: "text"
142562
- }, {
142563
- suffix: withCtx(() => [
142564
- createVNode(unref(NPopover), {
142565
- placement: "bottom",
142566
- show: activePopoverPoint.value === point && activePopoverField.value === "r",
142567
- trigger: "manual",
142568
- onClickoutside: closePopover
142569
- }, {
142570
- trigger: withCtx(() => [
142571
- createElementVNode("div", {
142572
- class: "cursor-pointer flex items-center",
142573
- onClick: ($event) => handleDynamicValueClick(point, "r")
142574
- }, [
142575
- createVNode(CIcon, {
142576
- class: normalizeClass(point.dynamicRValue ? "text-blue-500" : ""),
142577
- icon: "caret-down"
142578
- }, null, 8, ["class"])
142579
- ], 8, _hoisted_46$3)
142580
- ]),
142581
- default: withCtx(() => [
142582
- createElementVNode("div", _hoisted_47$3, [
142583
- createElementVNode("div", _hoisted_48$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
142584
- createVNode(unref(NTree), {
142585
- "block-line": "",
142586
- class: "max-h-[300px]",
142587
- data: dynamicValueTreeData.value,
142588
- "render-label": renderDynamicValueTreeLabel,
142589
- "selected-keys": [point.dynamicRValue?.path ?? ""],
142590
- "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point, "r")
142591
- }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
142592
- ])
142593
- ]),
142594
- _: 2
142595
- }, 1032, ["show"])
142596
- ]),
142597
- _: 2
142598
- }, 1032, ["value", "onUpdate:value", "disabled"])) : createCommentVNode("", true),
141725
+ ]),
141726
+ _: 2
141727
+ }, 1032, ["show"])
141728
+ ]),
141729
+ _: 2
141730
+ }, 1032, ["value", "onUpdate:value", "disabled"]))
141731
+ ]),
142599
141732
  createVNode(CButton, {
142600
141733
  circle: "",
142601
141734
  class: "bg-error2 self-center",
142602
141735
  size: "small",
142603
- style: normalizeStyle(deleteButtonStyle.value),
141736
+ style: normalizeStyle({
141737
+ "--n-border": "1px solid transparent",
141738
+ "--n-border-disabled": "1px solid transparent",
141739
+ "--n-border-focus": "1px solid transparent",
141740
+ "--n-border-hover": "1px solid transparent",
141741
+ "--n-border-pressed": "1px solid transparent",
141742
+ "--n-color-focus": unref(themeVars).error2,
141743
+ "--n-color-hover": unref(themeVars).error2,
141744
+ "--n-color-disabled": unref(themeVars).error2,
141745
+ "--n-color-pressed": unref(themeVars).error2
141746
+ }),
142604
141747
  type: "error",
142605
141748
  onClick: ($event) => removeDataPoint(index)
142606
141749
  }, {
@@ -142616,7 +141759,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142616
141759
  }, 1032, ["style", "onClick"])
142617
141760
  ]);
142618
141761
  }), 128)),
142619
- createElementVNode("div", _hoisted_49$3, [
141762
+ createElementVNode("div", _hoisted_42$3, [
142620
141763
  createVNode(CButton, {
142621
141764
  class: "mt-2",
142622
141765
  "icon-placement": "left",
@@ -142636,62 +141779,11 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142636
141779
  })
142637
141780
  ])
142638
141781
  ]),
142639
- createElementVNode("div", _hoisted_50$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartSettings")), 1),
142640
- createElementVNode("div", _hoisted_51$2, [
142641
- createElementVNode("label", _hoisted_52$2, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartTitle")), 1),
142642
- createVNode(unref(NInput), {
142643
- value: chartTitle.value,
142644
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => chartTitle.value = $event),
142645
- type: "text"
142646
- }, null, 8, ["value"])
142647
- ]),
142648
- ["bar", "line"].includes(primaryChartType.value) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
142649
- createElementVNode("div", _hoisted_53$2, [
142650
- createElementVNode("label", _hoisted_54$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.xAxisLabel")), 1),
142651
- createVNode(unref(NInput), {
142652
- value: xAxisLabel.value,
142653
- "onUpdate:value": _cache[3] || (_cache[3] = ($event) => xAxisLabel.value = $event),
142654
- type: "text"
142655
- }, null, 8, ["value"])
142656
- ]),
142657
- createElementVNode("div", _hoisted_55$1, [
142658
- createElementVNode("label", _hoisted_56$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.yAxisLabel")), 1),
142659
- createVNode(unref(NInput), {
142660
- value: yAxisLabel.value,
142661
- "onUpdate:value": _cache[4] || (_cache[4] = ($event) => yAxisLabel.value = $event),
142662
- type: "text"
142663
- }, null, 8, ["value"])
142664
- ]),
142665
- createElementVNode("div", _hoisted_57$1, [
142666
- createElementVNode("label", _hoisted_58$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.orientation")), 1),
142667
- createVNode(unref(NSelect), {
142668
- value: orientation.value,
142669
- "onUpdate:value": _cache[5] || (_cache[5] = ($event) => orientation.value = $event),
142670
- options: orientationOptions
142671
- }, null, 8, ["value"])
142672
- ])
142673
- ], 64)) : createCommentVNode("", true),
142674
- ["pie", "doughnut", "polarArea"].includes(primaryChartType.value) ? (openBlock(), createElementBlock("div", _hoisted_59$1, [
142675
- createElementVNode("label", _hoisted_60$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.legendPosition")), 1),
142676
- createVNode(unref(NSelect), {
142677
- value: legendPosition.value,
142678
- "onUpdate:value": _cache[6] || (_cache[6] = ($event) => legendPosition.value = $event),
142679
- options: legendPositionOptions
142680
- }, null, 8, ["value"])
142681
- ])) : createCommentVNode("", true),
142682
- ["line", "scatter", "area"].includes(primaryChartType.value) ? (openBlock(), createElementBlock("div", _hoisted_61$1, [
142683
- createElementVNode("label", _hoisted_62$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.pointStyle")), 1),
142684
- createVNode(unref(NSelect), {
142685
- value: pointStyle.value,
142686
- "onUpdate:value": _cache[7] || (_cache[7] = ($event) => pointStyle.value = $event),
142687
- options: pointStyleOptions
142688
- }, null, 8, ["value"])
142689
- ])) : createCommentVNode("", true),
142690
- createElementVNode("div", _hoisted_63$1, [
142691
- createElementVNode("label", _hoisted_64$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.colorScheme")), 1),
141782
+ createElementVNode("div", _hoisted_43$3, [
141783
+ createElementVNode("label", _hoisted_44$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.colorScheme")), 1),
142692
141784
  createVNode(unref(NSelect), {
142693
141785
  value: colorSchemeType.value,
142694
- "onUpdate:value": _cache[8] || (_cache[8] = ($event) => colorSchemeType.value = $event),
141786
+ "onUpdate:value": _cache[9] || (_cache[9] = ($event) => colorSchemeType.value = $event),
142695
141787
  class: "mb-2",
142696
141788
  options: [
142697
141789
  { label: unref(t)("canvasUI.canvasBuilder.dataCharts.useThemeColors"), value: "theme" },
@@ -142708,106 +141800,19 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142708
141800
  "onUpdate:palette": updateChartColors
142709
141801
  }, null, 8, ["allow-add", "allow-delete", "allow-edit", "initial-palette"]))
142710
141802
  ]),
142711
- createElementVNode("div", _hoisted_65$1, [
142712
- createElementVNode("label", _hoisted_66$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.animation")), 1),
141803
+ createElementVNode("div", _hoisted_45$3, [
141804
+ createElementVNode("label", _hoisted_46$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.animation")), 1),
142713
141805
  createVNode(unref(NSwitch), {
142714
141806
  value: enableAnimation.value,
142715
- "onUpdate:value": _cache[9] || (_cache[9] = ($event) => enableAnimation.value = $event)
141807
+ "onUpdate:value": _cache[10] || (_cache[10] = ($event) => enableAnimation.value = $event)
142716
141808
  }, null, 8, ["value"])
142717
- ]),
142718
- createElementVNode("div", _hoisted_67$1, [
142719
- createElementVNode("label", _hoisted_68$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.percentDisplay")), 1),
142720
- createElementVNode("div", _hoisted_69, [
142721
- createVNode(unref(NSwitch), {
142722
- value: percentDisplay.value,
142723
- "onUpdate:value": _cache[10] || (_cache[10] = ($event) => percentDisplay.value = $event)
142724
- }, null, 8, ["value"]),
142725
- createElementVNode("span", _hoisted_70, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.percentDisplayHint")), 1)
142726
- ])
142727
- ]),
142728
- createElementVNode("div", _hoisted_71, [
142729
- createElementVNode("label", _hoisted_72, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.viewModeControls")), 1),
142730
- createElementVNode("div", _hoisted_73, [
142731
- createElementVNode("div", _hoisted_74, [
142732
- createVNode(unref(NSwitch), {
142733
- value: enableFullscreenBtn.value,
142734
- "onUpdate:value": _cache[11] || (_cache[11] = ($event) => enableFullscreenBtn.value = $event)
142735
- }, null, 8, ["value"]),
142736
- createElementVNode("span", _hoisted_75, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.enableFullscreenBtn")), 1)
142737
- ]),
142738
- createVNode(unref(NTooltip), {
142739
- disabled: !isMultiSeries.value,
142740
- trigger: "hover"
142741
- }, {
142742
- trigger: withCtx(() => [
142743
- createElementVNode("div", {
142744
- class: normalizeClass(["flex items-center gap-2", { "opacity-50 cursor-not-allowed": isMultiSeries.value }])
142745
- }, [
142746
- createVNode(unref(NSwitch), {
142747
- value: enableChartTypeSwitcher.value,
142748
- "onUpdate:value": _cache[12] || (_cache[12] = ($event) => enableChartTypeSwitcher.value = $event),
142749
- disabled: isMultiSeries.value
142750
- }, null, 8, ["value", "disabled"]),
142751
- createElementVNode("span", _hoisted_76, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.enableChartTypeSwitcher")), 1)
142752
- ], 2)
142753
- ]),
142754
- default: withCtx(() => [
142755
- createTextVNode(" " + toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartTypeSwitcherMultiSeriesDisabled")), 1)
142756
- ]),
142757
- _: 1
142758
- }, 8, ["disabled"]),
142759
- createElementVNode("div", _hoisted_77, [
142760
- createVNode(unref(NSwitch), {
142761
- value: enableDataEntry.value,
142762
- "onUpdate:value": _cache[13] || (_cache[13] = ($event) => enableDataEntry.value = $event)
142763
- }, null, 8, ["value"]),
142764
- createElementVNode("span", _hoisted_78, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.enableDataEntry")), 1)
142765
- ])
142766
- ])
142767
- ]),
142768
- createElementVNode("div", _hoisted_79, [
142769
- createElementVNode("label", _hoisted_80, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartSize")), 1),
142770
- createElementVNode("div", _hoisted_81, [
142771
- createElementVNode("div", _hoisted_82, [
142772
- createElementVNode("label", _hoisted_83, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.height")), 1),
142773
- createVNode(unref(NInputNumber), {
142774
- value: chartHeight.value,
142775
- "onUpdate:value": _cache[14] || (_cache[14] = ($event) => chartHeight.value = $event),
142776
- class: "flex-1",
142777
- max: 1e3,
142778
- min: 100,
142779
- step: 10
142780
- }, {
142781
- suffix: withCtx(() => _cache[17] || (_cache[17] = [
142782
- createTextVNode("px")
142783
- ])),
142784
- _: 1
142785
- }, 8, ["value"])
142786
- ]),
142787
- createElementVNode("div", _hoisted_84, [
142788
- createElementVNode("label", _hoisted_85, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.width")), 1),
142789
- createVNode(unref(NInputNumber), {
142790
- value: chartWidth.value,
142791
- "onUpdate:value": _cache[15] || (_cache[15] = ($event) => chartWidth.value = $event),
142792
- class: "flex-1",
142793
- max: 100,
142794
- min: 10,
142795
- step: 5
142796
- }, {
142797
- suffix: withCtx(() => _cache[18] || (_cache[18] = [
142798
- createTextVNode("%")
142799
- ])),
142800
- _: 1
142801
- }, 8, ["value"])
142802
- ])
142803
- ])
142804
141809
  ])
142805
141810
  ])
142806
141811
  ])
142807
141812
  ]),
142808
- createElementVNode("div", _hoisted_86, [
142809
- createElementVNode("div", _hoisted_87, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.preview")), 1),
142810
- createElementVNode("div", _hoisted_88, [
141813
+ createElementVNode("div", _hoisted_47$3, [
141814
+ createElementVNode("div", _hoisted_48$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.preview")), 1),
141815
+ createElementVNode("div", _hoisted_49$3, [
142811
141816
  createVNode(unref(NCard), { bordered: false }, {
142812
141817
  default: withCtx(() => [
142813
141818
  (openBlock(), createBlock(RawDataCharts, {
@@ -142815,8 +141820,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142815
141820
  data: {
142816
141821
  ...previewData.value,
142817
141822
  context: unref(crmShape)
142818
- },
142819
- "is-preview": ""
141823
+ }
142820
141824
  }, null, 8, ["data"]))
142821
141825
  ]),
142822
141826
  _: 1
@@ -142873,12 +141877,6 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
142873
141877
  usedInSectionId,
142874
141878
  when_used_in_section
142875
141879
  });
142876
- const canEditChart = computed(() => {
142877
- if (mode.value === CanvasBuilderMode.ADMIN) {
142878
- return true;
142879
- }
142880
- return props.data?.view_controls?.enable_data_entry ?? false;
142881
- });
142882
141880
  onMounted(() => {
142883
141881
  if (justAddedComponentId.value === props.id) {
142884
141882
  setComponentEditMode(ComponentTypes.DataCharts, props.id);
@@ -142890,7 +141888,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
142890
141888
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
142891
141889
  key: 0,
142892
141890
  name: _ctx.tracking_id
142893
- }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) && unref(componentPermissions).hasSomethingEditable && canEditChart.value ? (openBlock(), createBlock(_sfc_main$34, {
141891
+ }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) && unref(componentPermissions).hasSomethingEditable ? (openBlock(), createBlock(_sfc_main$34, {
142894
141892
  key: 1,
142895
141893
  id: unref(id),
142896
141894
  active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
@@ -142912,7 +141910,6 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
142912
141910
  key: key.value,
142913
141911
  class: "ma-1",
142914
141912
  data: _ctx.data,
142915
- "is-edit-mode": "",
142916
141913
  style: normalizeStyle(_ctx.style)
142917
141914
  }, null, 8, ["data", "style"])) : (openBlock(), createBlock(_sfc_main$2G, {
142918
141915
  key: 1,
@@ -142924,9 +141921,8 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
142924
141921
  }, 8, ["id", "active", "duplicate", "edit", "remove", "selected", "settings", "stylable"])) : (openBlock(), createBlock(RawDataCharts, {
142925
141922
  key: 2,
142926
141923
  data: _ctx.data,
142927
- "is-edit-mode": unref(isEditMode),
142928
141924
  style: normalizeStyle(_ctx.style)
142929
- }, null, 8, ["data", "is-edit-mode", "style"])),
141925
+ }, null, 8, ["data", "style"])),
142930
141926
  unref(componentEditMode) && unref(componentEditMode).id === unref(id) ? (openBlock(), createBlock(_sfc_main$2E, {
142931
141927
  key: 3,
142932
141928
  id: unref(id),