@pitcher/canvas-ui 2025.12.9-123000-beta → 2025.12.9-123521-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
@@ -79026,7 +79026,7 @@ const _hoisted_1$55 = {
79026
79026
  class: "flex flex-col gap-4"
79027
79027
  };
79028
79028
  const _hoisted_2$3I = { key: 0 };
79029
- const _hoisted_3$2Z = { class: "flex flex-wrap gap-1" };
79029
+ const _hoisted_3$2Y = { class: "flex flex-wrap gap-1" };
79030
79030
  const _sfc_main$6C = /* @__PURE__ */ defineComponent({
79031
79031
  __name: "CTags",
79032
79032
  props: {
@@ -79212,7 +79212,7 @@ const _sfc_main$6C = /* @__PURE__ */ defineComponent({
79212
79212
  }, 8, ["disabled", "max", "value"]),
79213
79213
  _ctx.showSuggestedTags ? (openBlock(), createElementBlock("div", _hoisted_1$55, [
79214
79214
  _ctx.suggestedTagsTitle ? (openBlock(), createElementBlock("div", _hoisted_2$3I, toDisplayString(_ctx.suggestedTagsTitle), 1)) : createCommentVNode("", true),
79215
- createElementVNode("div", _hoisted_3$2Z, [
79215
+ createElementVNode("div", _hoisted_3$2Y, [
79216
79216
  (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option) => {
79217
79217
  return openBlock(), createBlock(_sfc_main$6D, {
79218
79218
  key: option.value,
@@ -79718,10 +79718,6 @@ var UserRoleEnum = /* @__PURE__ */ ((UserRoleEnum2) => {
79718
79718
 
79719
79719
  const _hoisted_1$54 = { class: "flex flex-col gap-2 w-full" };
79720
79720
  const _hoisted_2$3H = {
79721
- key: 0,
79722
- class: "color-error"
79723
- };
79724
- const _hoisted_3$2Y = {
79725
79721
  key: 1,
79726
79722
  class: "flex gap-4 w-full"
79727
79723
  };
@@ -79745,10 +79741,6 @@ const _sfc_main$6A = /* @__PURE__ */ defineComponent({
79745
79741
  });
79746
79742
  const { t } = useI18n();
79747
79743
  const { fetchSuggestedInstanceTags } = useSuggestedTags();
79748
- const pitcherSettings = inject(
79749
- "pitcherSettings",
79750
- computed(() => ({}))
79751
- );
79752
79744
  const editingField = ref(null);
79753
79745
  const showTagsComponent = ref(!props.showKeepAsIsPlaceholder);
79754
79746
  const labels = {
@@ -79764,21 +79756,11 @@ const _sfc_main$6A = /* @__PURE__ */ defineComponent({
79764
79756
  const datePickerShortcuts = {
79765
79757
  [t("canvasUI.browserApp.uploadFilesModal.expiresAt.today")]: dayjs().endOf("day").valueOf()
79766
79758
  };
79767
- const isFileExpirationMandatory = computed(() => pitcherSettings.value?.is_file_expiration_mandatory);
79768
- const expiresAtOptions = computed(() => {
79769
- const allOptions = [
79770
- { value: "never" /* Never */, label: t("canvasUI.browserApp.uploadFilesModal.expiresAt.options.never") },
79771
- { value: "at" /* At */, label: t("canvasUI.browserApp.uploadFilesModal.expiresAt.options.at") },
79772
- { value: "expired" /* Expired */, label: t("canvasUI.browserApp.uploadFilesModal.expiresAt.options.expired") }
79773
- ];
79774
- if (isFileExpirationMandatory.value) {
79775
- return allOptions.filter((option) => option.value !== "never" /* Never */);
79776
- }
79777
- return allOptions;
79778
- });
79779
- const datePickerActions = computed(
79780
- () => isFileExpirationMandatory.value ? ["confirm"] : ["clear", "confirm"]
79781
- );
79759
+ const expiresAtOptions = [
79760
+ { value: "never" /* Never */, label: t("canvasUI.browserApp.uploadFilesModal.expiresAt.options.never") },
79761
+ { value: "at" /* At */, label: t("canvasUI.browserApp.uploadFilesModal.expiresAt.options.at") },
79762
+ { value: "expired" /* Expired */, label: t("canvasUI.browserApp.uploadFilesModal.expiresAt.options.expired") }
79763
+ ];
79782
79764
  async function updateForm(updates) {
79783
79765
  emit("update:modelValue", { ...form.value, ...updates });
79784
79766
  }
@@ -79801,24 +79783,14 @@ const _sfc_main$6A = /* @__PURE__ */ defineComponent({
79801
79783
  updates.expiresAtDateTime = dayjs().add(7, "day").endOf("day").valueOf();
79802
79784
  }
79803
79785
  } else {
79804
- if (isFileExpirationMandatory.value) {
79805
- updates.expiresAtDateTime = dayjs().add(7, "day").endOf("day").valueOf();
79806
- updates.expiresAtOption = "at" /* At */;
79807
- } else {
79808
- updates.expiresAtDateTime = null;
79809
- }
79786
+ updates.expiresAtDateTime = null;
79810
79787
  }
79811
79788
  updateForm(updates);
79812
79789
  }
79813
79790
  function onChangeExpiresAtDateTime(value) {
79814
79791
  const updates = { expiresAtDateTime: value };
79815
79792
  if (value === null) {
79816
- if (isFileExpirationMandatory.value) {
79817
- updates.expiresAtDateTime = dayjs().add(7, "day").endOf("day").valueOf();
79818
- updates.expiresAtOption = "at" /* At */;
79819
- } else {
79820
- updates.expiresAtOption = "never" /* Never */;
79821
- }
79793
+ updates.expiresAtOption = "never" /* Never */;
79822
79794
  } else if (value < dayjs().valueOf()) {
79823
79795
  updates.expiresAtOption = "expired" /* Expired */;
79824
79796
  } else {
@@ -80020,19 +79992,14 @@ const _sfc_main$6A = /* @__PURE__ */ defineComponent({
80020
79992
  }, 8, ["label"])) : createCommentVNode("", true),
80021
79993
  _ctx.showExpirationSettings ? (openBlock(), createBlock(unref(NFormItemGridItem), {
80022
79994
  key: 2,
79995
+ label: labels.expiresAtDateTime,
80023
79996
  span: 2
80024
79997
  }, {
80025
- label: withCtx(() => [
80026
- createElementVNode("span", null, [
80027
- createTextVNode(toDisplayString(unref(t)("canvasUI.browserApp.uploadFilesModal.expiresAt.label")) + " ", 1),
80028
- isFileExpirationMandatory.value ? (openBlock(), createElementBlock("span", _hoisted_2$3H, "*")) : createCommentVNode("", true)
80029
- ])
80030
- ]),
80031
79998
  default: withCtx(() => [
80032
79999
  _ctx.showKeepAsIsPlaceholder && !isEditingFieldOrNonEmpty("expiresAtOption") ? (openBlock(), createBlock(CInputPlaceholder, {
80033
80000
  key: 0,
80034
80001
  onClick: _cache[6] || (_cache[6] = ($event) => enableEditing("expiresAtOption", unref(MetadataTemplateFieldTypeEnum).SELECT))
80035
- })) : (openBlock(), createElementBlock("div", _hoisted_3$2Y, [
80002
+ })) : (openBlock(), createElementBlock("div", _hoisted_2$3H, [
80036
80003
  createVNode(CSelect, {
80037
80004
  bordered: "",
80038
80005
  class: "w-50",
@@ -80044,14 +80011,14 @@ const _sfc_main$6A = /* @__PURE__ */ defineComponent({
80044
80011
  handleBlur("expiresAtOption");
80045
80012
  },
80046
80013
  "on-update:value": onChangeExpiresAtOption,
80047
- options: expiresAtOptions.value,
80014
+ options: expiresAtOptions,
80048
80015
  value: form.value.expiresAtOption,
80049
80016
  onBlur: _cache[7] || (_cache[7] = ($event) => handleBlur("expiresAtOption"))
80050
- }, null, 8, ["clearable", "filterable", "on-clear", "options", "value"]),
80017
+ }, null, 8, ["clearable", "filterable", "on-clear", "value"]),
80051
80018
  createVNode(unref(NDatePicker), {
80052
- actions: datePickerActions.value,
80019
+ actions: ["clear", "confirm"],
80053
80020
  class: "w-50",
80054
- clearable: !isFileExpirationMandatory.value,
80021
+ clearable: "",
80055
80022
  "data-field": "expiresAtDateTime",
80056
80023
  disabled: form.value.expiresAtOption !== "at" /* At */,
80057
80024
  "on-clear": async () => {
@@ -80063,11 +80030,11 @@ const _sfc_main$6A = /* @__PURE__ */ defineComponent({
80063
80030
  type: "datetime",
80064
80031
  value: form.value.expiresAtDateTime,
80065
80032
  onBlur: _cache[8] || (_cache[8] = ($event) => handleBlur("expiresAtDateTime"))
80066
- }, null, 8, ["actions", "clearable", "disabled", "on-clear", "value"])
80033
+ }, null, 8, ["disabled", "on-clear", "value"])
80067
80034
  ]))
80068
80035
  ]),
80069
80036
  _: 1
80070
- })) : createCommentVNode("", true)
80037
+ }, 8, ["label"])) : createCommentVNode("", true)
80071
80038
  ]),
80072
80039
  _: 1
80073
80040
  })
@@ -94619,38 +94586,38 @@ const _hoisted_47$4 = ["data-result-selected", "onClick"];
94619
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" };
94620
94587
  const _hoisted_49$4 = { class: "flex-1 min-w-0" };
94621
94588
  const _hoisted_50$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
94622
- const _hoisted_51$2 = { class: "text-xs text-gray-500" };
94623
- const _hoisted_52$2 = { class: "text-xs text-gray-400" };
94624
- const _hoisted_53$2 = {
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 = {
94625
94592
  key: 0,
94626
94593
  class: "px-0 py-0"
94627
94594
  };
94628
- const _hoisted_54$1 = {
94595
+ const _hoisted_54$2 = {
94629
94596
  key: 0,
94630
94597
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
94631
94598
  };
94632
- const _hoisted_55$1 = {
94599
+ const _hoisted_55$2 = {
94633
94600
  key: 2,
94634
94601
  class: "flex-1 overflow-y-auto bg-white w-full"
94635
94602
  };
94636
- const _hoisted_56$1 = { class: "w-full px-0" };
94637
- const _hoisted_57$1 = { class: "flex items-center px-0 pt-2 pb-1" };
94638
- const _hoisted_58$1 = { class: "text-m font-semibold text-gray-900" };
94639
- const _hoisted_59$1 = { class: "ml-2 text-sm text-gray-500" };
94640
- const _hoisted_60$1 = ["data-result-selected", "onClick"];
94641
- const _hoisted_61$1 = {
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 = {
94642
94609
  key: 1,
94643
94610
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
94644
94611
  };
94645
- const _hoisted_62$1 = { class: "flex-1 min-w-0" };
94646
- const _hoisted_63$1 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
94647
- const _hoisted_64$1 = { class: "text-xs text-gray-500" };
94648
- const _hoisted_65$1 = { class: "text-xs text-gray-400" };
94649
- const _hoisted_66$1 = {
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 = {
94650
94617
  key: 0,
94651
94618
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
94652
94619
  };
94653
- const _hoisted_67$1 = {
94620
+ const _hoisted_67$2 = {
94654
94621
  key: 0,
94655
94622
  class: "flex flex-wrap line-height-6 pt-4 pb-2 px-6 border-t border-gray-200 gap-y-4 gap-x-4"
94656
94623
  };
@@ -95812,13 +95779,13 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95812
95779
  ]),
95813
95780
  createElementVNode("div", _hoisted_49$4, [
95814
95781
  createElementVNode("h3", _hoisted_50$4, toDisplayString(item.name), 1),
95815
- createElementVNode("p", _hoisted_51$2, toDisplayString(formatCanvasType(item.content_type)), 1)
95782
+ createElementVNode("p", _hoisted_51$3, toDisplayString(formatCanvasType(item.content_type)), 1)
95816
95783
  ]),
95817
- createElementVNode("div", _hoisted_52$2, toDisplayString(item.folder?.name || ""), 1)
95784
+ createElementVNode("div", _hoisted_52$3, toDisplayString(item.folder?.name || ""), 1)
95818
95785
  ], 10, _hoisted_47$4);
95819
95786
  }), 128))
95820
95787
  ]),
95821
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_53$2, [
95788
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_53$3, [
95822
95789
  createElementVNode("span", {
95823
95790
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
95824
95791
  onClick: _cache[14] || (_cache[14] = ($event) => searchType.value = "canvases")
@@ -95833,7 +95800,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95833
95800
  ])) : createCommentVNode("", true)
95834
95801
  ])) : createCommentVNode("", true)
95835
95802
  ]),
95836
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_54$1, [
95803
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_54$2, [
95837
95804
  createVNode(CIcon, {
95838
95805
  class: "text-6xl",
95839
95806
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -95844,9 +95811,9 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95844
95811
  class: normalizeClass(searchError.value ? "text-error font-semibold" : "text-text2")
95845
95812
  }, toDisplayString(searchError.value || unref(t)("canvasUI.CGlobalSearch.noResults")), 3)
95846
95813
  ])) : createCommentVNode("", true)
95847
- ])) : (openBlock(), createElementBlock("div", _hoisted_55$1, [
95848
- createElementVNode("div", _hoisted_56$1, [
95849
- createElementVNode("div", _hoisted_57$1, [
95814
+ ])) : (openBlock(), createElementBlock("div", _hoisted_55$2, [
95815
+ createElementVNode("div", _hoisted_56$2, [
95816
+ createElementVNode("div", _hoisted_57$2, [
95850
95817
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
95851
95818
  key: 0,
95852
95819
  class: "mr-2",
@@ -95860,8 +95827,8 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95860
95827
  icon: "presentation",
95861
95828
  size: "16"
95862
95829
  })),
95863
- createElementVNode("span", _hoisted_58$1, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
95864
- createElementVNode("span", _hoisted_59$1, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
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)
95865
95832
  ]),
95866
95833
  createElementVNode("div", null, [
95867
95834
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -95886,7 +95853,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95886
95853
  "object-fit": "cover",
95887
95854
  src: item.picture_url || "",
95888
95855
  width: "72"
95889
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_61$1, [
95856
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_61$2, [
95890
95857
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
95891
95858
  key: 0,
95892
95859
  color: "var(--p-text2)",
@@ -95899,15 +95866,15 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95899
95866
  size: "32"
95900
95867
  }))
95901
95868
  ])),
95902
- createElementVNode("div", _hoisted_62$1, [
95903
- createElementVNode("h3", _hoisted_63$1, toDisplayString(item.name), 1),
95904
- createElementVNode("p", _hoisted_64$1, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.content_type || "PDF" : formatCanvasType(item.content_type)), 1)
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)
95905
95872
  ]),
95906
- createElementVNode("div", _hoisted_65$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
95907
- ], 10, _hoisted_60$1);
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);
95908
95875
  }), 128))
95909
95876
  ]),
95910
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_66$1, [
95877
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_66$2, [
95911
95878
  createVNode(CIcon, {
95912
95879
  class: "text-6xl",
95913
95880
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -95921,7 +95888,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
95921
95888
  ])
95922
95889
  ]))
95923
95890
  ]),
95924
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_67$1, [
95891
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_67$2, [
95925
95892
  createVNode(CShortcut, null, {
95926
95893
  default: withCtx(() => [
95927
95894
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -140798,17 +140765,96 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
140798
140765
  }
140799
140766
  });
140800
140767
 
140801
- const _hoisted_1$24 = { class: "cb-data-charts-raw" };
140768
+ const _hoisted_1$24 = {
140769
+ key: 0,
140770
+ class: "cb-data-charts-raw__controls"
140771
+ };
140802
140772
  const _sfc_main$2F = /* @__PURE__ */ defineComponent({
140803
140773
  __name: "DataCharts.raw",
140804
140774
  props: {
140805
- data: {}
140775
+ data: {},
140776
+ isPreview: { type: Boolean },
140777
+ isEditMode: { type: Boolean }
140806
140778
  },
140807
140779
  setup(__props) {
140780
+ const { t } = useI18n();
140808
140781
  const chartRef = ref(null);
140782
+ const containerRef = ref(null);
140809
140783
  let chart = null;
140810
140784
  const isChartLoaded = ref(false);
140785
+ const isFullscreen = ref(false);
140786
+ const currentChartType = ref("");
140811
140787
  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
+ });
140812
140858
  const sectionListSectionInfo = inject(
140813
140859
  "sectionListSectionInfo",
140814
140860
  computed(() => null)
@@ -140839,41 +140885,191 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
140839
140885
  }
140840
140886
  return window._chartJsPromise;
140841
140887
  }
140842
- function processChartData(chartData, context) {
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;
140843
140910
  const processedData = {
140844
140911
  labels: [],
140845
140912
  values: []
140846
140913
  };
140847
- chartData.data_points?.forEach((point) => {
140914
+ const rawBubbleData = [];
140915
+ dataPoints?.forEach((point) => {
140848
140916
  let label = point.label;
140849
- let value = point.value;
140850
140917
  try {
140851
140918
  if (typeof label === "string") {
140852
140919
  label = renderTemplate(label, context);
140853
140920
  }
140854
- if (typeof value === "string") {
140855
- value = renderTemplate(value, context);
140856
- }
140857
- if (typeof label === "string" && label.includes(",") && typeof value === "string" && value.includes(",")) {
140858
- const labels = label.split(",");
140859
- const values = value.split(",");
140860
- labels.forEach((l, idx) => {
140861
- const v = values[idx];
140862
- if (v !== void 0) {
140863
- processedData.labels.push(l);
140864
- processedData.values.push(Number(v) || 0);
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 });
140865
140959
  }
140866
- });
140960
+ }
140867
140961
  } else {
140868
- processedData.labels.push(label);
140869
- processedData.values.push(Number(value) || 0);
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
+ }
140870
140980
  }
140871
140981
  } catch (err) {
140872
140982
  console.warn("Error processing chart data point:", err);
140873
- processedData.labels.push(label);
140874
- processedData.values.push(Number(value) || 0);
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
+ }
140875
140992
  }
140876
140993
  });
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);
140877
141073
  let backgroundColor = chartData.data?.datasets?.[0]?.background_color || [];
140878
141074
  let borderColor = chartData.data?.datasets?.[0]?.border_color || [];
140879
141075
  if (chartData.color_scheme_type === "theme" && Array.isArray(backgroundColor)) {
@@ -140919,7 +141115,7 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
140919
141115
  }
140920
141116
  };
140921
141117
  }
140922
- function initChart() {
141118
+ function initChart(overrideType) {
140923
141119
  if (!props.data || !chartRef.value || !isChartLoaded.value) {
140924
141120
  return;
140925
141121
  }
@@ -140927,25 +141123,85 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
140927
141123
  chart.destroy();
140928
141124
  }
140929
141125
  const context = props.data.context ?? (!isEmpty(activeCanvas.value?.context) || isCanvas.value ? { ...crmShape.value, ...activeCanvas.value?.context } : crmShape.value);
140930
- const processedChartData = processChartData(props.data, context);
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
+ }
140931
141132
  if (processedChartData.data?.datasets) {
140932
141133
  processedChartData.data.datasets = processedChartData.data.datasets.map((dataset) => {
140933
- const { background_color, border_color, point_style, ...rest } = dataset;
141134
+ const { background_color, border_color, point_style, fill, tension, show_line, ...rest } = dataset;
140934
141135
  return {
140935
141136
  ...rest,
140936
141137
  backgroundColor: dataset.backgroundColor || background_color || ["#000000"],
140937
141138
  borderColor: dataset.borderColor || border_color || ["#000000"],
140938
- pointStyle: point_style
141139
+ pointStyle: point_style,
141140
+ fill: isAreaChart ? true : fill,
141141
+ tension: isAreaChart ? tension ?? 0.4 : tension,
141142
+ showLine: show_line
140939
141143
  };
140940
141144
  });
140941
141145
  }
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
+ }
140942
141191
  const chartConfig = {
140943
141192
  ...processedChartData,
140944
- type: processedChartData.type,
141193
+ type: chartType,
140945
141194
  options: merge$1({}, processedChartData.options, {
140946
141195
  responsive: true,
140947
141196
  maintainAspectRatio: false,
140948
- indexAxis: processedChartData.options?.index_axis
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
+ }
140949
141205
  })
140950
141206
  };
140951
141207
  chart = new window.Chart(chartRef.value, chartConfig);
@@ -140965,84 +141221,172 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
140965
141221
  isChartLoaded.value = true;
140966
141222
  });
140967
141223
  return (_ctx, _cache) => {
140968
- return openBlock(), createElementBlock("div", _hoisted_1$24, [
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),
140969
141264
  createElementVNode("canvas", {
140970
141265
  ref_key: "chartRef",
140971
141266
  ref: chartRef,
140972
141267
  class: "w-full h-full"
140973
141268
  }, null, 512)
140974
- ]);
141269
+ ], 6);
140975
141270
  };
140976
141271
  }
140977
141272
  });
140978
141273
 
140979
- const RawDataCharts = /* @__PURE__ */ _export_sfc(_sfc_main$2F, [["__scopeId", "data-v-e71330a8"]]);
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"];
140980
141282
 
140981
141283
  const _hoisted_1$23 = { class: "flex gap-4 h-[calc(80vh-120px)] w-full" };
140982
141284
  const _hoisted_2$1t = { class: "cb-data-charts-settings__card overflow-auto flex-1" };
140983
141285
  const _hoisted_3$17 = { class: "flex flex-col h-full" };
140984
141286
  const _hoisted_4$X = { class: "flex-grow overflow-y-auto overflow-x-hidden" };
140985
- const _hoisted_5$O = { class: "mb-4" };
140986
- const _hoisted_6$H = { class: "block mb-2" };
140987
- const _hoisted_7$v = { class: "mb-4" };
140988
- const _hoisted_8$q = { class: "block mb-2" };
140989
- const _hoisted_9$m = { class: "mb-4" };
140990
- const _hoisted_10$h = { class: "block mb-2" };
140991
- const _hoisted_11$f = { class: "mb-4" };
140992
- const _hoisted_12$b = { class: "block mb-2" };
140993
- const _hoisted_13$a = {
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 = {
140994
141294
  key: 0,
140995
141295
  class: "mb-4"
140996
141296
  };
141297
+ const _hoisted_12$b = { class: "block mb-2" };
141298
+ const _hoisted_13$a = { class: "mb-4" };
140997
141299
  const _hoisted_14$9 = { class: "block mb-2" };
140998
141300
  const _hoisted_15$8 = { class: "mb-4" };
140999
- const _hoisted_16$8 = { class: "block mb-2" };
141000
- const _hoisted_17$7 = {
141001
- key: 1,
141002
- class: "mb-4"
141003
- };
141004
- const _hoisted_18$6 = { class: "block mb-2" };
141005
- const _hoisted_19$6 = { class: "mb-4" };
141006
- const _hoisted_20$5 = { class: "flex justify-between items-center mb-2" };
141007
- const _hoisted_21$5 = { class: "block" };
141008
- const _hoisted_22$3 = { class: "flex gap-2 flex-1" };
141009
- const _hoisted_23$3 = ["onClick"];
141010
- const _hoisted_24$3 = { class: "p-4 min-w-[400px] max-h-[400px]" };
141011
- const _hoisted_25$3 = { class: "flex gap-4 h-full" };
141012
- const _hoisted_26$3 = { class: "flex-1 flex flex-col" };
141013
- const _hoisted_27$3 = { class: "text-sm mb-2" };
141014
- const _hoisted_28$3 = { class: "overflow-auto" };
141015
- const _hoisted_29$3 = {
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 = {
141016
141310
  key: 0,
141017
141311
  class: "flex-1 border-l pl-4"
141018
141312
  };
141019
- const _hoisted_30$3 = { class: "text-sm font-medium mb-2" };
141020
- const _hoisted_31$3 = { class: "flex flex-col gap-2" };
141021
- const _hoisted_32$3 = { class: "block mb-1 text-sm" };
141022
- const _hoisted_33$3 = { class: "block mb-1 text-sm" };
141023
- const _hoisted_34$3 = ["onClick"];
141024
- const _hoisted_35$3 = { class: "p-4 min-w-[400px] max-h-[400px]" };
141025
- const _hoisted_36$3 = { class: "flex gap-4 h-full" };
141026
- const _hoisted_37$3 = { class: "flex-1 flex flex-col" };
141027
- const _hoisted_38$3 = { class: "text-sm mb-2" };
141028
- const _hoisted_39$3 = { class: "overflow-auto" };
141029
- const _hoisted_40$3 = {
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 = {
141030
141324
  key: 0,
141031
141325
  class: "flex-1 border-l pl-4"
141032
141326
  };
141033
- const _hoisted_41$3 = { class: "flex flex-col gap-2" };
141034
- const _hoisted_42$3 = { class: "flex justify-center mt-2" };
141035
- const _hoisted_43$3 = { class: "mb-4" };
141036
- const _hoisted_44$3 = { class: "block mb-2" };
141037
- const _hoisted_45$3 = { class: "mb-4" };
141038
- const _hoisted_46$3 = { class: "block mb-2" };
141039
- const _hoisted_47$3 = { class: "cb-data-charts-settings__preview flex-1 border-l border-[#eee] pl-4" };
141040
- const _hoisted_48$3 = { class: "text-sm font-medium mb-4" };
141041
- const _hoisted_49$3 = {
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 = {
141042
141386
  class: "preview-container",
141043
141387
  style: { "height": "300px" }
141044
141388
  };
141045
- const _hoisted_50$3 = { class: "flex justify-between gap-4" };
141389
+ const _hoisted_89 = { class: "flex justify-between gap-4" };
141046
141390
  const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141047
141391
  __name: "DataCharts.settings",
141048
141392
  props: {
@@ -141056,7 +141400,91 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141056
141400
  const { setComponentEditMode, updateNodeDataById } = useCanvas$1();
141057
141401
  const { crmShape } = useCrmShape();
141058
141402
  const { palette } = useCanvasTheme$1();
141059
- const chartType = ref(props.data?.type ?? "bar");
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");
141060
141488
  const backgroundColor = props.data?.data?.datasets?.[0]?.background_color;
141061
141489
  const colorSchemeType = ref(props.data?.color_scheme_type ?? "theme");
141062
141490
  const chartColors = ref([]);
@@ -141085,24 +141513,16 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141085
141513
  const chartTitle = ref(props.data?.options?.plugins?.title?.text ?? "");
141086
141514
  const legendPosition = ref(props.data?.options?.plugins?.legend?.position ?? "top");
141087
141515
  const enableAnimation = ref((props.data?.options?.animation?.duration ?? 0) > 0);
141088
- const dataPoints = ref(
141089
- 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) => ({
141090
- label: String(label),
141091
- value: String(props.data?.data?.datasets?.[0]?.data?.[index] ?? 0)
141092
- })) : []
141093
- );
141094
141516
  const xAxisLabel = ref(props.data?.options?.scales?.x?.title?.text ?? "");
141095
141517
  const yAxisLabel = ref(props.data?.options?.scales?.y?.title?.text ?? "");
141096
141518
  const orientation = ref(props.data?.options?.index_axis ?? "x");
141097
141519
  const pointStyle = ref(props.data?.data?.datasets?.[0]?.point_style ?? "circle");
141098
- const chartTypeOptions = [
141099
- { label: t("canvasUI.canvasBuilder.dataCharts.types.bar"), value: "bar" },
141100
- { label: t("canvasUI.canvasBuilder.dataCharts.types.line"), value: "line" },
141101
- { label: t("canvasUI.canvasBuilder.dataCharts.types.pie"), value: "pie" },
141102
- { label: t("canvasUI.canvasBuilder.dataCharts.types.doughnut"), value: "doughnut" },
141103
- { label: t("canvasUI.canvasBuilder.dataCharts.types.polarArea"), value: "polarArea" },
141104
- { label: t("canvasUI.canvasBuilder.dataCharts.types.radar"), value: "radar" }
141105
- ];
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);
141106
141526
  const legendPositionOptions = [
141107
141527
  { label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.none"), value: "none" },
141108
141528
  { label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.top"), value: "top" },
@@ -141111,8 +141531,8 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141111
141531
  { label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.right"), value: "right" }
141112
141532
  ];
141113
141533
  const orientationOptions = [
141114
- { label: t("canvasUI.canvasBuilder.dataCharts.orientations.horizontal"), value: "x" },
141115
- { label: t("canvasUI.canvasBuilder.dataCharts.orientations.vertical"), value: "y" }
141534
+ { label: t("canvasUI.canvasBuilder.dataCharts.orientations.horizontal"), value: "y" },
141535
+ { label: t("canvasUI.canvasBuilder.dataCharts.orientations.vertical"), value: "x" }
141116
141536
  ];
141117
141537
  const pointStyleOptions = [
141118
141538
  { label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.circle"), value: "circle" },
@@ -141122,12 +141542,18 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141122
141542
  { label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.star"), value: "star" },
141123
141543
  { label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.triangle"), value: "triangle" }
141124
141544
  ];
141125
- function getColors() {
141126
- if (colorSchemeType.value === "theme") {
141127
- return chartColors.value.map((index) => `palette${index}`);
141128
- }
141129
- return chartColors.value;
141130
- }
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);
141131
141557
  function updateChartColors(newColors) {
141132
141558
  if (colorSchemeType.value === "theme") {
141133
141559
  chartColors.value = newColors.map((color, i) => {
@@ -141155,17 +141581,55 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141155
141581
  }
141156
141582
  }
141157
141583
  );
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
+ }
141158
141616
  function addDataPoint() {
141159
- dataPoints.value.push({
141617
+ activeSeries.value.dataPoints.push({
141160
141618
  label: "",
141619
+ xValue: "",
141620
+ yValue: "",
141621
+ rValue: "",
141161
141622
  value: ""
141162
141623
  });
141163
141624
  }
141164
141625
  function removeDataPoint(index) {
141165
- dataPoints.value.splice(index, 1);
141626
+ activeSeries.value.dataPoints.splice(index, 1);
141166
141627
  }
141167
141628
  function removeAllDataPoints() {
141168
- dataPoints.value = [];
141629
+ activeSeries.value.dataPoints = [];
141630
+ }
141631
+ function isArrayOrObject(value) {
141632
+ return Array.isArray(value) || typeof value === "object" && value !== null;
141169
141633
  }
141170
141634
  function getFieldOptions(data) {
141171
141635
  if (!data || typeof data !== "object") return [];
@@ -141176,6 +141640,54 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141176
141640
  value: field
141177
141641
  }));
141178
141642
  }
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
+ }
141179
141691
  const dynamicValueTreeData = computed(() => {
141180
141692
  function processObject(obj, path = []) {
141181
141693
  const result = [];
@@ -141226,24 +141738,59 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141226
141738
  return h("span", { class: "text-sm" }, { default: () => info.option.label || "" });
141227
141739
  }
141228
141740
  const activePopoverPoint = ref(null);
141229
- function handleDynamicValueClick(point) {
141230
- if (activePopoverPoint.value === point) {
141231
- activePopoverPoint.value = null;
141741
+ function handleDynamicValueClick(point, field = "value") {
141742
+ if (activePopoverPoint.value === point && activePopoverField.value === field) {
141743
+ closePopover();
141232
141744
  } else {
141233
- point.selectedValue = void 0;
141234
- point.dynamicValue = void 0;
141235
- point.arrayConfig = void 0;
141236
- point.value = "";
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
+ }
141237
141769
  activePopoverPoint.value = point;
141770
+ activePopoverField.value = field;
141238
141771
  }
141239
141772
  }
141240
- function handleDynamicValueSelect(keys, point) {
141773
+ function handleDynamicValueSelect(keys, point, field = "value") {
141241
141774
  const selectedKey = keys[0];
141242
141775
  if (!selectedKey) {
141243
- point.dynamicValue = void 0;
141244
- point.selectedValue = void 0;
141245
- point.value = "";
141246
- activePopoverPoint.value = null;
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();
141247
141794
  return;
141248
141795
  }
141249
141796
  const pathParts = selectedKey.split(/\.(?![^[]*])/) || [];
@@ -141258,6 +141805,80 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141258
141805
  currentValue = currentValue?.[part];
141259
141806
  }
141260
141807
  }
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
+ }
141261
141882
  point.selectedValue = currentValue;
141262
141883
  if (Array.isArray(currentValue) || typeof currentValue === "object" && currentValue !== null) {
141263
141884
  point.arrayConfig = {
@@ -141287,79 +141908,189 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141287
141908
  value: expression
141288
141909
  };
141289
141910
  point.value = expression;
141290
- activePopoverPoint.value = null;
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
+ }));
141291
141925
  }
141926
+ return values.map((v) => ({
141927
+ ...v,
141928
+ r: minRadius + (v.r - minR) / (maxR - minR) * (maxRadius - minRadius),
141929
+ originalR: v.r
141930
+ }));
141292
141931
  }
141293
- function updateDynamicValueExpression(point) {
141294
- if (!point.selectedValue || !point.arrayConfig?.labelField || !point.arrayConfig?.valueField) {
141295
- return;
141296
- }
141297
- const path = point.dynamicValue?.path;
141298
- if (!path) {
141299
- return;
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;
141300
141961
  }
141301
- point.label = `{{#each ${path}}}{{lookup this "${point.arrayConfig.labelField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141302
- point.value = `{{#each ${path}}}{{lookup this "${point.arrayConfig.valueField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
141303
- point.dynamicValue = {
141304
- path,
141305
- value: point.value
141306
- };
141307
- activePopoverPoint.value = null;
141308
- }
141309
- function processChartData() {
141310
141962
  const processedData = {
141311
141963
  labels: [],
141312
141964
  values: []
141313
141965
  };
141314
- dataPoints.value.forEach((point) => {
141966
+ series.dataPoints.forEach((point) => {
141315
141967
  processedData.labels.push(point.label);
141316
141968
  processedData.values.push(!isNaN(Number(point.value)) ? Number(point.value) : 0);
141317
141969
  });
141318
141970
  return processedData;
141319
141971
  }
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
+ }
141320
141984
  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";
141321
142066
  const config = {
141322
- type: chartType.value,
142067
+ type: actualPrimaryType,
141323
142068
  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
+ },
141324
142077
  data: {
141325
- labels: [],
141326
- datasets: [
141327
- {
141328
- label: "Data Series",
141329
- data: [],
141330
- background_color: getColors(),
141331
- border_color: getColors(),
141332
- border_width: 1,
141333
- point_style: ["line"].includes(chartType.value) ? pointStyle.value : void 0
141334
- }
141335
- ]
142078
+ labels: allLabels,
142079
+ datasets
141336
142080
  },
141337
142081
  options: {
141338
142082
  responsive: true,
141339
142083
  maintainAspectRatio: false,
141340
- index_axis: ["bar", "line"].includes(chartType.value) ? orientation.value : void 0,
141341
- scales: ["bar", "line"].includes(chartType.value) ? {
141342
- x: {
141343
- title: {
141344
- display: !!xAxisLabel.value,
141345
- text: xAxisLabel.value
141346
- }
141347
- },
141348
- y: {
141349
- title: {
141350
- display: !!yAxisLabel.value,
141351
- text: yAxisLabel.value
141352
- }
141353
- }
141354
- } : void 0,
142084
+ index_axis: ["bar", "line"].includes(primaryType) ? orientation.value : void 0,
142085
+ scales,
141355
142086
  plugins: {
141356
142087
  title: {
141357
142088
  display: !!chartTitle.value,
141358
142089
  text: chartTitle.value
141359
142090
  },
141360
142091
  legend: {
141361
- display: legendPosition.value !== "none",
141362
- position: legendPosition.value,
142092
+ display: showLegend,
142093
+ position: legendPosition.value !== "none" ? legendPosition.value : "top",
141363
142094
  labels: {
141364
142095
  usePointStyle: true
141365
142096
  }
@@ -141369,14 +142100,27 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141369
142100
  duration: enableAnimation.value ? 1e3 : 0
141370
142101
  }
141371
142102
  },
141372
- data_points: dataPoints.value.map((point) => ({
141373
- label: point.label,
141374
- value: point.value
141375
- }))
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
141376
142123
  };
141377
- const processedData = processChartData();
141378
- config.data.labels = processedData.labels;
141379
- config.data.datasets[0].data = processedData.values;
141380
142124
  return config;
141381
142125
  }
141382
142126
  function onCancel() {
@@ -141404,9 +142148,14 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141404
142148
  },
141405
142149
  { immediate: true }
141406
142150
  );
142151
+ watch(isMultiSeries, (multiSeries) => {
142152
+ if (multiSeries) {
142153
+ enableChartTypeSwitcher.value = false;
142154
+ }
142155
+ });
141407
142156
  watch(
141408
142157
  [
141409
- chartType,
142158
+ seriesList,
141410
142159
  chartColors,
141411
142160
  colorSchemeType,
141412
142161
  chartTitle,
@@ -141415,7 +142164,13 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141415
142164
  yAxisLabel,
141416
142165
  orientation,
141417
142166
  pointStyle,
141418
- dataPoints
142167
+ percentDisplay,
142168
+ enableAnimation,
142169
+ enableFullscreenBtn,
142170
+ enableChartTypeSwitcher,
142171
+ enableDataEntry,
142172
+ chartHeight,
142173
+ chartWidth
141419
142174
  ],
141420
142175
  () => {
141421
142176
  updatePreview();
@@ -141441,10 +142196,10 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141441
142196
  "--n-padding-left": "16px"
141442
142197
  }]),
141443
142198
  title: unref(t)("canvasUI.canvasBuilder.dataCharts.editDataChartsComponent"),
141444
- onClose: _cache[11] || (_cache[11] = ($event) => unref(setComponentEditMode)(false))
142199
+ onClose: _cache[16] || (_cache[16] = ($event) => unref(setComponentEditMode)(false))
141445
142200
  }, {
141446
142201
  footer: withCtx(() => [
141447
- createElementVNode("div", _hoisted_50$3, [
142202
+ createElementVNode("div", _hoisted_89, [
141448
142203
  createVNode(CButton, { onClick: onCancel }, {
141449
142204
  default: withCtx(() => [
141450
142205
  createTextVNode(toDisplayString(unref(t)("canvasUI.common.cancel")), 1)
@@ -141482,69 +142237,66 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141482
142237
  createElementVNode("div", _hoisted_2$1t, [
141483
142238
  createElementVNode("div", _hoisted_3$17, [
141484
142239
  createElementVNode("div", _hoisted_4$X, [
141485
- createElementVNode("div", _hoisted_5$O, [
141486
- createElementVNode("label", _hoisted_6$H, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartType")), 1),
141487
- createVNode(unref(NSelect), {
141488
- value: chartType.value,
141489
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => chartType.value = $event),
141490
- options: chartTypeOptions
141491
- }, null, 8, ["value"])
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)
141492
142275
  ]),
141493
- ["bar", "line"].includes(chartType.value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
141494
- createElementVNode("div", _hoisted_7$v, [
141495
- createElementVNode("label", _hoisted_8$q, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.xAxisLabel")), 1),
141496
- createVNode(unref(NInput), {
141497
- value: xAxisLabel.value,
141498
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => xAxisLabel.value = $event),
141499
- type: "text"
141500
- }, null, 8, ["value"])
141501
- ]),
141502
- createElementVNode("div", _hoisted_9$m, [
141503
- createElementVNode("label", _hoisted_10$h, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.yAxisLabel")), 1),
141504
- createVNode(unref(NInput), {
141505
- value: yAxisLabel.value,
141506
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => yAxisLabel.value = $event),
141507
- type: "text"
141508
- }, null, 8, ["value"])
141509
- ]),
141510
- createElementVNode("div", _hoisted_11$f, [
141511
- createElementVNode("label", _hoisted_12$b, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.orientation")), 1),
141512
- createVNode(unref(NSelect), {
141513
- value: orientation.value,
141514
- "onUpdate:value": _cache[3] || (_cache[3] = ($event) => orientation.value = $event),
141515
- options: orientationOptions
141516
- }, null, 8, ["value"])
141517
- ]),
141518
- ["line", "radar"].includes(chartType.value) ? (openBlock(), createElementBlock("div", _hoisted_13$a, [
141519
- createElementVNode("label", _hoisted_14$9, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.pointStyle")), 1),
141520
- createVNode(unref(NSelect), {
141521
- value: pointStyle.value,
141522
- "onUpdate:value": _cache[4] || (_cache[4] = ($event) => pointStyle.value = $event),
141523
- options: pointStyleOptions
141524
- }, null, 8, ["value"])
141525
- ])) : createCommentVNode("", true)
141526
- ], 64)) : createCommentVNode("", true),
141527
- createElementVNode("div", _hoisted_15$8, [
141528
- createElementVNode("label", _hoisted_16$8, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartTitle")), 1),
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),
141529
142278
  createVNode(unref(NInput), {
141530
- value: chartTitle.value,
141531
- "onUpdate:value": _cache[5] || (_cache[5] = ($event) => chartTitle.value = $event),
142279
+ value: activeSeries.value.name,
142280
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => activeSeries.value.name = $event),
141532
142281
  type: "text"
141533
142282
  }, null, 8, ["value"])
141534
- ]),
141535
- ["pie", "doughnut", "polarArea"].includes(chartType.value) ? (openBlock(), createElementBlock("div", _hoisted_17$7, [
141536
- createElementVNode("label", _hoisted_18$6, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.legendPosition")), 1),
141537
- createVNode(unref(NSelect), {
141538
- value: legendPosition.value,
141539
- "onUpdate:value": _cache[6] || (_cache[6] = ($event) => legendPosition.value = $event),
141540
- options: legendPositionOptions
141541
- }, null, 8, ["value"])
141542
142283
  ])) : createCommentVNode("", true),
141543
- createElementVNode("div", _hoisted_19$6, [
141544
- createElementVNode("div", _hoisted_20$5, [
141545
- createElementVNode("label", _hoisted_21$5, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.dataPoints")), 1),
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
+ ]),
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),
141546
142298
  createVNode(unref(Button), {
141547
- disabled: !dataPoints.value.length,
142299
+ disabled: !activeSeries.value.dataPoints.length,
141548
142300
  size: "small",
141549
142301
  onClick: removeAllDataPoints
141550
142302
  }, {
@@ -141554,205 +142306,301 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141554
142306
  _: 1
141555
142307
  }, 8, ["disabled"])
141556
142308
  ]),
141557
- (openBlock(true), createElementBlock(Fragment, null, renderList(dataPoints.value, (point, index) => {
142309
+ !isActiveSeriesXYChart.value && !isActiveSeriesXYRChart.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(activeSeries.value.dataPoints, (point, index) => {
141558
142310
  return openBlock(), createElementBlock("div", {
141559
142311
  key: index,
141560
142312
  class: "flex gap-2 mb-2"
141561
142313
  }, [
141562
- point.selectedValue && (Array.isArray(point.selectedValue) || typeof point.selectedValue === "object" && point.selectedValue !== null) ? (openBlock(), createBlock(unref(NTooltip), {
141563
- key: 0,
141564
- trigger: "hover"
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"
141565
142328
  }, {
141566
- trigger: withCtx(() => [
141567
- createVNode(unref(NInput), {
141568
- value: point.label,
141569
- "onUpdate:value": ($event) => point.label = $event,
141570
- class: "flex-1",
141571
- disabled: true,
141572
- placeholder: "Label"
141573
- }, null, 8, ["value", "onUpdate:value"])
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"])
141574
142389
  ]),
141575
- default: withCtx(() => [
141576
- createTextVNode(" " + toDisplayString(point.label), 1)
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
+ })
141577
142407
  ]),
141578
142408
  _: 2
141579
- }, 1024)) : (openBlock(), createBlock(unref(NInput), {
141580
- key: 1,
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), {
141581
142417
  value: point.label,
141582
142418
  "onUpdate:value": ($event) => point.label = $event,
141583
142419
  class: "flex-1",
142420
+ disabled: !!point.arrayConfig,
141584
142421
  placeholder: "Label"
141585
- }, null, 8, ["value", "onUpdate:value"])),
141586
- createElementVNode("div", _hoisted_22$3, [
141587
- point.dynamicValue ? (openBlock(), createBlock(unref(NTooltip), {
141588
- key: 0,
141589
- trigger: "hover"
141590
- }, {
141591
- trigger: withCtx(() => [
141592
- createVNode(unref(NInput), {
141593
- value: point.value,
141594
- "onUpdate:value": ($event) => point.value = $event,
141595
- class: "flex-1",
141596
- disabled: !!point.dynamicValue,
141597
- placeholder: "Value",
141598
- type: "text"
141599
- }, {
141600
- suffix: withCtx(() => [
141601
- createVNode(unref(NPopover), {
141602
- placement: "bottom",
141603
- show: activePopoverPoint.value === point,
141604
- trigger: "manual",
141605
- onClickoutside: _cache[7] || (_cache[7] = ($event) => activePopoverPoint.value = null)
141606
- }, {
141607
- trigger: withCtx(() => [
141608
- createElementVNode("div", {
141609
- class: "cursor-pointer flex items-center",
141610
- onClick: ($event) => handleDynamicValueClick(point)
141611
- }, [
141612
- createVNode(CIcon, {
141613
- class: normalizeClass(point.dynamicValue ? "text-blue-500" : ""),
141614
- icon: "caret-down"
141615
- }, null, 8, ["class"])
141616
- ], 8, _hoisted_23$3)
141617
- ]),
141618
- default: withCtx(() => [
141619
- createElementVNode("div", _hoisted_24$3, [
141620
- createElementVNode("div", _hoisted_25$3, [
141621
- createElementVNode("div", _hoisted_26$3, [
141622
- createElementVNode("div", _hoisted_27$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
141623
- createElementVNode("div", _hoisted_28$3, [
141624
- createVNode(unref(NTree), {
141625
- "block-line": "",
141626
- class: "max-h-[300px]",
141627
- data: dynamicValueTreeData.value,
141628
- "render-label": renderDynamicValueTreeLabel,
141629
- "selected-keys": [point.dynamicValue?.path ?? ""],
141630
- "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point)
141631
- }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
141632
- ])
141633
- ]),
141634
- point.selectedValue && point.arrayConfig && (Array.isArray(point.selectedValue) || typeof point.selectedValue === "object" && point.selectedValue !== null) ? (openBlock(), createElementBlock("div", _hoisted_29$3, [
141635
- createElementVNode("div", _hoisted_30$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.configureArrayObjectFields")), 1),
141636
- createElementVNode("div", _hoisted_31$3, [
141637
- createElementVNode("div", null, [
141638
- createElementVNode("label", _hoisted_32$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.labelField")), 1),
141639
- createVNode(unref(NSelect), {
141640
- value: point.arrayConfig.labelField,
141641
- "onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateDynamicValueExpression(point)],
141642
- options: getFieldOptions(point.selectedValue)
141643
- }, null, 8, ["value", "onUpdate:value", "options"])
141644
- ]),
141645
- createElementVNode("div", null, [
141646
- createElementVNode("label", _hoisted_33$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.valueField")), 1),
141647
- createVNode(unref(NSelect), {
141648
- value: point.arrayConfig.valueField,
141649
- "onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
141650
- options: getFieldOptions(point.selectedValue)
141651
- }, null, 8, ["value", "onUpdate:value", "options"])
141652
- ])
141653
- ])
141654
- ])) : createCommentVNode("", true)
141655
- ])
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"])
141656
142463
  ])
141657
142464
  ]),
141658
- _: 2
141659
- }, 1032, ["show"])
141660
- ]),
141661
- _: 2
141662
- }, 1032, ["value", "onUpdate:value", "disabled"])
141663
- ]),
141664
- default: withCtx(() => [
141665
- createTextVNode(" " + toDisplayString(point.value), 1)
141666
- ]),
141667
- _: 2
141668
- }, 1024)) : (openBlock(), createBlock(unref(NInput), {
141669
- key: 1,
141670
- value: point.value,
141671
- "onUpdate:value": ($event) => point.value = $event,
141672
- class: "flex-1",
141673
- disabled: !!point.dynamicValue,
141674
- placeholder: "Value",
141675
- type: "text"
141676
- }, {
141677
- suffix: withCtx(() => [
141678
- createVNode(unref(NPopover), {
141679
- placement: "bottom",
141680
- show: activePopoverPoint.value === point,
141681
- trigger: "manual",
141682
- onClickoutside: _cache[8] || (_cache[8] = ($event) => activePopoverPoint.value = null)
141683
- }, {
141684
- trigger: withCtx(() => [
141685
- createElementVNode("div", {
141686
- class: "cursor-pointer flex items-center",
141687
- onClick: ($event) => handleDynamicValueClick(point)
141688
- }, [
141689
- createVNode(CIcon, {
141690
- class: normalizeClass(point.dynamicValue ? "text-blue-500" : ""),
141691
- icon: "caret-down"
141692
- }, null, 8, ["class"])
141693
- ], 8, _hoisted_34$3)
141694
- ]),
141695
- default: withCtx(() => [
141696
- createElementVNode("div", _hoisted_35$3, [
141697
- createElementVNode("div", _hoisted_36$3, [
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),
141698
142467
  createElementVNode("div", _hoisted_37$3, [
141699
- createElementVNode("div", _hoisted_38$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
141700
- createElementVNode("div", _hoisted_39$3, [
141701
- createVNode(unref(NTree), {
141702
- "block-line": "",
141703
- class: "max-h-[300px]",
141704
- data: dynamicValueTreeData.value,
141705
- "render-label": renderDynamicValueTreeLabel,
141706
- "selected-keys": [point.dynamicValue?.path ?? ""],
141707
- "onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point)
141708
- }, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
141709
- ])
141710
- ]),
141711
- point.selectedValue && point.arrayConfig && (Array.isArray(point.selectedValue) || typeof point.selectedValue === "object" && point.selectedValue !== null) ? (openBlock(), createElementBlock("div", _hoisted_40$3, [
141712
- _cache[14] || (_cache[14] = createElementVNode("div", { class: "text-sm font-medium mb-2" }, "Configure Array/Object Fields", -1)),
141713
- createElementVNode("div", _hoisted_41$3, [
141714
- createElementVNode("div", null, [
141715
- _cache[12] || (_cache[12] = createElementVNode("label", { class: "block mb-1 text-sm" }, "Label Field", -1)),
141716
- createVNode(unref(NSelect), {
141717
- value: point.arrayConfig.labelField,
141718
- "onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateDynamicValueExpression(point)],
141719
- options: getFieldOptions(point.selectedValue)
141720
- }, null, 8, ["value", "onUpdate:value", "options"])
141721
- ]),
141722
- createElementVNode("div", null, [
141723
- _cache[13] || (_cache[13] = createElementVNode("label", { class: "block mb-1 text-sm" }, "Value Field", -1)),
141724
- createVNode(unref(NSelect), {
141725
- value: point.arrayConfig.valueField,
141726
- "onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
141727
- options: getFieldOptions(point.selectedValue)
141728
- }, null, 8, ["value", "onUpdate:value", "options"])
141729
- ])
141730
- ])
141731
- ])) : createCommentVNode("", true)
141732
- ])
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)
141733
142502
  ])
141734
- ]),
141735
- _: 2
141736
- }, 1032, ["show"])
141737
- ]),
141738
- _: 2
141739
- }, 1032, ["value", "onUpdate:value", "disabled"]))
141740
- ]),
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),
141741
142599
  createVNode(CButton, {
141742
142600
  circle: "",
141743
142601
  class: "bg-error2 self-center",
141744
142602
  size: "small",
141745
- style: normalizeStyle({
141746
- "--n-border": "1px solid transparent",
141747
- "--n-border-disabled": "1px solid transparent",
141748
- "--n-border-focus": "1px solid transparent",
141749
- "--n-border-hover": "1px solid transparent",
141750
- "--n-border-pressed": "1px solid transparent",
141751
- "--n-color-focus": unref(themeVars).error2,
141752
- "--n-color-hover": unref(themeVars).error2,
141753
- "--n-color-disabled": unref(themeVars).error2,
141754
- "--n-color-pressed": unref(themeVars).error2
141755
- }),
142603
+ style: normalizeStyle(deleteButtonStyle.value),
141756
142604
  type: "error",
141757
142605
  onClick: ($event) => removeDataPoint(index)
141758
142606
  }, {
@@ -141768,7 +142616,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141768
142616
  }, 1032, ["style", "onClick"])
141769
142617
  ]);
141770
142618
  }), 128)),
141771
- createElementVNode("div", _hoisted_42$3, [
142619
+ createElementVNode("div", _hoisted_49$3, [
141772
142620
  createVNode(CButton, {
141773
142621
  class: "mt-2",
141774
142622
  "icon-placement": "left",
@@ -141788,11 +142636,62 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141788
142636
  })
141789
142637
  ])
141790
142638
  ]),
141791
- createElementVNode("div", _hoisted_43$3, [
141792
- createElementVNode("label", _hoisted_44$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.colorScheme")), 1),
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),
141793
142692
  createVNode(unref(NSelect), {
141794
142693
  value: colorSchemeType.value,
141795
- "onUpdate:value": _cache[9] || (_cache[9] = ($event) => colorSchemeType.value = $event),
142694
+ "onUpdate:value": _cache[8] || (_cache[8] = ($event) => colorSchemeType.value = $event),
141796
142695
  class: "mb-2",
141797
142696
  options: [
141798
142697
  { label: unref(t)("canvasUI.canvasBuilder.dataCharts.useThemeColors"), value: "theme" },
@@ -141809,19 +142708,106 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141809
142708
  "onUpdate:palette": updateChartColors
141810
142709
  }, null, 8, ["allow-add", "allow-delete", "allow-edit", "initial-palette"]))
141811
142710
  ]),
141812
- createElementVNode("div", _hoisted_45$3, [
141813
- createElementVNode("label", _hoisted_46$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.animation")), 1),
142711
+ createElementVNode("div", _hoisted_65$1, [
142712
+ createElementVNode("label", _hoisted_66$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.animation")), 1),
141814
142713
  createVNode(unref(NSwitch), {
141815
142714
  value: enableAnimation.value,
141816
- "onUpdate:value": _cache[10] || (_cache[10] = ($event) => enableAnimation.value = $event)
142715
+ "onUpdate:value": _cache[9] || (_cache[9] = ($event) => enableAnimation.value = $event)
141817
142716
  }, 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
+ ])
141818
142804
  ])
141819
142805
  ])
141820
142806
  ])
141821
142807
  ]),
141822
- createElementVNode("div", _hoisted_47$3, [
141823
- createElementVNode("div", _hoisted_48$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.preview")), 1),
141824
- createElementVNode("div", _hoisted_49$3, [
142808
+ createElementVNode("div", _hoisted_86, [
142809
+ createElementVNode("div", _hoisted_87, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.preview")), 1),
142810
+ createElementVNode("div", _hoisted_88, [
141825
142811
  createVNode(unref(NCard), { bordered: false }, {
141826
142812
  default: withCtx(() => [
141827
142813
  (openBlock(), createBlock(RawDataCharts, {
@@ -141829,7 +142815,8 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
141829
142815
  data: {
141830
142816
  ...previewData.value,
141831
142817
  context: unref(crmShape)
141832
- }
142818
+ },
142819
+ "is-preview": ""
141833
142820
  }, null, 8, ["data"]))
141834
142821
  ]),
141835
142822
  _: 1
@@ -141886,6 +142873,12 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
141886
142873
  usedInSectionId,
141887
142874
  when_used_in_section
141888
142875
  });
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
+ });
141889
142882
  onMounted(() => {
141890
142883
  if (justAddedComponentId.value === props.id) {
141891
142884
  setComponentEditMode(ComponentTypes.DataCharts, props.id);
@@ -141897,7 +142890,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
141897
142890
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
141898
142891
  key: 0,
141899
142892
  name: _ctx.tracking_id
141900
- }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) && unref(componentPermissions).hasSomethingEditable ? (openBlock(), createBlock(_sfc_main$34, {
142893
+ }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) && unref(componentPermissions).hasSomethingEditable && canEditChart.value ? (openBlock(), createBlock(_sfc_main$34, {
141901
142894
  key: 1,
141902
142895
  id: unref(id),
141903
142896
  active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
@@ -141919,6 +142912,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
141919
142912
  key: key.value,
141920
142913
  class: "ma-1",
141921
142914
  data: _ctx.data,
142915
+ "is-edit-mode": "",
141922
142916
  style: normalizeStyle(_ctx.style)
141923
142917
  }, null, 8, ["data", "style"])) : (openBlock(), createBlock(_sfc_main$2G, {
141924
142918
  key: 1,
@@ -141930,8 +142924,9 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
141930
142924
  }, 8, ["id", "active", "duplicate", "edit", "remove", "selected", "settings", "stylable"])) : (openBlock(), createBlock(RawDataCharts, {
141931
142925
  key: 2,
141932
142926
  data: _ctx.data,
142927
+ "is-edit-mode": unref(isEditMode),
141933
142928
  style: normalizeStyle(_ctx.style)
141934
- }, null, 8, ["data", "style"])),
142929
+ }, null, 8, ["data", "is-edit-mode", "style"])),
141935
142930
  unref(componentEditMode) && unref(componentEditMode).id === unref(id) ? (openBlock(), createBlock(_sfc_main$2E, {
141936
142931
  key: 3,
141937
142932
  id: unref(id),
@@ -175703,8 +176698,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
175703
176698
  can_share: true
175704
176699
  },
175705
176700
  tags: [],
175706
- expiresAtDateTime: pitcherSettings.value?.is_file_expiration_mandatory ? dayjs().add(7, "day").endOf("day").valueOf() : null,
175707
- expiresAtOption: pitcherSettings.value?.is_file_expiration_mandatory ? "at" /* At */ : "never" /* Never */,
176701
+ expiresAtDateTime: null,
176702
+ expiresAtOption: "never" /* Never */,
175708
176703
  accessType: appName.value === "admin" ? AccessTypeEnum.PUBLIC : AccessTypeEnum.RESTRICTED,
175709
176704
  collaborations: [],
175710
176705
  metadata: {}
@@ -175726,13 +176721,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
175726
176721
  await nextTick();
175727
176722
  await validateMetadata();
175728
176723
  }
175729
- const isExpirationValid = computed(() => {
175730
- const isMandatory = pitcherSettings.value?.is_file_expiration_mandatory;
175731
- if (isMandatory) {
175732
- return form.value.expiresAtDateTime !== null && form.value.expiresAtDateTime !== void 0;
175733
- }
175734
- return true;
175735
- });
175736
176724
  function onAddFiles() {
175737
176725
  fileInputRef.value?.onClick();
175738
176726
  }
@@ -175879,7 +176867,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
175879
176867
  }, 8, ["on-item-header-click"])
175880
176868
  ]),
175881
176869
  createVNode(_sfc_main$j, {
175882
- disableDone: !areMetadataValid.value || unref(uploadSelectedFiles).length === 0 || !isExpirationValid.value,
176870
+ disableDone: !areMetadataValid.value || unref(uploadSelectedFiles).length === 0,
175883
176871
  onCancel: cancel,
175884
176872
  onUpload: upload
175885
176873
  }, null, 8, ["disableDone"])