@pitcher/canvas-ui 2025.12.8-134939 → 2025.12.9-103004-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.css +25 -2
- package/canvas-ui.js +1272 -450
- package/canvas-ui.js.map +1 -1
- package/lib/apps/canvas-builder/components/ui/DataCharts/DataCharts.raw.vue.d.ts +4 -0
- package/lib/apps/canvas-builder/components/ui/DataCharts/types.d.ts +73 -8
- package/locale/de.json +22 -2
- package/locale/el.json +22 -2
- package/locale/en.json +22 -2
- package/locale/es.json +22 -2
- package/locale/fr.json +23 -3
- package/locale/it.json +61 -41
- package/locale/ja.json +58 -38
- package/locale/nl.json +61 -41
- package/locale/pl.json +22 -2
- package/locale/pt-br.json +33 -13
- package/locale/pt.json +22 -2
- package/locale/th.json +26 -6
- package/locale/tr.json +22 -2
- package/locale/zh.json +58 -38
- package/package.json +1 -1
package/canvas-ui.js
CHANGED
|
@@ -94586,38 +94586,38 @@ const _hoisted_47$4 = ["data-result-selected", "onClick"];
|
|
|
94586
94586
|
const _hoisted_48$4 = { class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center" };
|
|
94587
94587
|
const _hoisted_49$4 = { class: "flex-1 min-w-0" };
|
|
94588
94588
|
const _hoisted_50$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
|
|
94589
|
-
const _hoisted_51$
|
|
94590
|
-
const _hoisted_52$
|
|
94591
|
-
const _hoisted_53$
|
|
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 = {
|
|
94592
94592
|
key: 0,
|
|
94593
94593
|
class: "px-0 py-0"
|
|
94594
94594
|
};
|
|
94595
|
-
const _hoisted_54$
|
|
94595
|
+
const _hoisted_54$2 = {
|
|
94596
94596
|
key: 0,
|
|
94597
94597
|
class: "flex flex-col items-center justify-center text-center p-8 gap-4"
|
|
94598
94598
|
};
|
|
94599
|
-
const _hoisted_55$
|
|
94599
|
+
const _hoisted_55$2 = {
|
|
94600
94600
|
key: 2,
|
|
94601
94601
|
class: "flex-1 overflow-y-auto bg-white w-full"
|
|
94602
94602
|
};
|
|
94603
|
-
const _hoisted_56$
|
|
94604
|
-
const _hoisted_57$
|
|
94605
|
-
const _hoisted_58$
|
|
94606
|
-
const _hoisted_59$
|
|
94607
|
-
const _hoisted_60$
|
|
94608
|
-
const _hoisted_61$
|
|
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 = {
|
|
94609
94609
|
key: 1,
|
|
94610
94610
|
class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
|
|
94611
94611
|
};
|
|
94612
|
-
const _hoisted_62$
|
|
94613
|
-
const _hoisted_63$
|
|
94614
|
-
const _hoisted_64$
|
|
94615
|
-
const _hoisted_65$
|
|
94616
|
-
const _hoisted_66$
|
|
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 = {
|
|
94617
94617
|
key: 0,
|
|
94618
94618
|
class: "flex flex-col items-center justify-center text-center p-8 gap-4"
|
|
94619
94619
|
};
|
|
94620
|
-
const _hoisted_67$
|
|
94620
|
+
const _hoisted_67$2 = {
|
|
94621
94621
|
key: 0,
|
|
94622
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"
|
|
94623
94623
|
};
|
|
@@ -95779,13 +95779,13 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
|
|
|
95779
95779
|
]),
|
|
95780
95780
|
createElementVNode("div", _hoisted_49$4, [
|
|
95781
95781
|
createElementVNode("h3", _hoisted_50$4, toDisplayString(item.name), 1),
|
|
95782
|
-
createElementVNode("p", _hoisted_51$
|
|
95782
|
+
createElementVNode("p", _hoisted_51$3, toDisplayString(formatCanvasType(item.content_type)), 1)
|
|
95783
95783
|
]),
|
|
95784
|
-
createElementVNode("div", _hoisted_52$
|
|
95784
|
+
createElementVNode("div", _hoisted_52$3, toDisplayString(item.folder?.name || ""), 1)
|
|
95785
95785
|
], 10, _hoisted_47$4);
|
|
95786
95786
|
}), 128))
|
|
95787
95787
|
]),
|
|
95788
|
-
filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_53$
|
|
95788
|
+
filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_53$3, [
|
|
95789
95789
|
createElementVNode("span", {
|
|
95790
95790
|
class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
|
|
95791
95791
|
onClick: _cache[14] || (_cache[14] = ($event) => searchType.value = "canvases")
|
|
@@ -95800,7 +95800,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
|
|
|
95800
95800
|
])) : createCommentVNode("", true)
|
|
95801
95801
|
])) : createCommentVNode("", true)
|
|
95802
95802
|
]),
|
|
95803
|
-
searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_54$
|
|
95803
|
+
searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_54$2, [
|
|
95804
95804
|
createVNode(CIcon, {
|
|
95805
95805
|
class: "text-6xl",
|
|
95806
95806
|
color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
|
|
@@ -95811,9 +95811,9 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
|
|
|
95811
95811
|
class: normalizeClass(searchError.value ? "text-error font-semibold" : "text-text2")
|
|
95812
95812
|
}, toDisplayString(searchError.value || unref(t)("canvasUI.CGlobalSearch.noResults")), 3)
|
|
95813
95813
|
])) : createCommentVNode("", true)
|
|
95814
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_55$
|
|
95815
|
-
createElementVNode("div", _hoisted_56$
|
|
95816
|
-
createElementVNode("div", _hoisted_57$
|
|
95814
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_55$2, [
|
|
95815
|
+
createElementVNode("div", _hoisted_56$2, [
|
|
95816
|
+
createElementVNode("div", _hoisted_57$2, [
|
|
95817
95817
|
searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
|
|
95818
95818
|
key: 0,
|
|
95819
95819
|
class: "mr-2",
|
|
@@ -95827,8 +95827,8 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
|
|
|
95827
95827
|
icon: "presentation",
|
|
95828
95828
|
size: "16"
|
|
95829
95829
|
})),
|
|
95830
|
-
createElementVNode("span", _hoisted_58$
|
|
95831
|
-
createElementVNode("span", _hoisted_59$
|
|
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)
|
|
95832
95832
|
]),
|
|
95833
95833
|
createElementVNode("div", null, [
|
|
95834
95834
|
(openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
|
|
@@ -95853,7 +95853,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
|
|
|
95853
95853
|
"object-fit": "cover",
|
|
95854
95854
|
src: item.picture_url || "",
|
|
95855
95855
|
width: "72"
|
|
95856
|
-
}, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_61$
|
|
95856
|
+
}, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_61$2, [
|
|
95857
95857
|
searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
|
|
95858
95858
|
key: 0,
|
|
95859
95859
|
color: "var(--p-text2)",
|
|
@@ -95866,15 +95866,15 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
|
|
|
95866
95866
|
size: "32"
|
|
95867
95867
|
}))
|
|
95868
95868
|
])),
|
|
95869
|
-
createElementVNode("div", _hoisted_62$
|
|
95870
|
-
createElementVNode("h3", _hoisted_63$
|
|
95871
|
-
createElementVNode("p", _hoisted_64$
|
|
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)
|
|
95872
95872
|
]),
|
|
95873
|
-
createElementVNode("div", _hoisted_65$
|
|
95874
|
-
], 10, _hoisted_60$
|
|
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);
|
|
95875
95875
|
}), 128))
|
|
95876
95876
|
]),
|
|
95877
|
-
searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_66$
|
|
95877
|
+
searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_66$2, [
|
|
95878
95878
|
createVNode(CIcon, {
|
|
95879
95879
|
class: "text-6xl",
|
|
95880
95880
|
color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
|
|
@@ -95888,7 +95888,7 @@ const _sfc_main$5I = /* @__PURE__ */ defineComponent({
|
|
|
95888
95888
|
])
|
|
95889
95889
|
]))
|
|
95890
95890
|
]),
|
|
95891
|
-
!showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_67$
|
|
95891
|
+
!showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_67$2, [
|
|
95892
95892
|
createVNode(CShortcut, null, {
|
|
95893
95893
|
default: withCtx(() => [
|
|
95894
95894
|
createVNode(CShortcutIcon, { icon: "arrow-up" }),
|
|
@@ -140765,17 +140765,84 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
|
|
|
140765
140765
|
}
|
|
140766
140766
|
});
|
|
140767
140767
|
|
|
140768
|
-
const _hoisted_1$24 = {
|
|
140768
|
+
const _hoisted_1$24 = {
|
|
140769
|
+
key: 0,
|
|
140770
|
+
class: "cb-data-charts-raw__controls"
|
|
140771
|
+
};
|
|
140769
140772
|
const _sfc_main$2F = /* @__PURE__ */ defineComponent({
|
|
140770
140773
|
__name: "DataCharts.raw",
|
|
140771
140774
|
props: {
|
|
140772
|
-
data: {}
|
|
140775
|
+
data: {},
|
|
140776
|
+
isPreview: { type: Boolean },
|
|
140777
|
+
isEditMode: { type: Boolean }
|
|
140773
140778
|
},
|
|
140774
140779
|
setup(__props) {
|
|
140780
|
+
const { t } = useI18n();
|
|
140775
140781
|
const chartRef = ref(null);
|
|
140782
|
+
const containerRef = ref(null);
|
|
140776
140783
|
let chart = null;
|
|
140777
140784
|
const isChartLoaded = ref(false);
|
|
140785
|
+
const isFullscreen = ref(false);
|
|
140786
|
+
const currentChartType = ref("");
|
|
140778
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 chartTypeSwitcherOptions = computed(() => [
|
|
140804
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.bar"), key: "bar" },
|
|
140805
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.line"), key: "line" },
|
|
140806
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.pie"), key: "pie" },
|
|
140807
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.doughnut"), key: "doughnut" },
|
|
140808
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.polarArea"), key: "polarArea" },
|
|
140809
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.radar"), key: "radar" },
|
|
140810
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.scatter"), key: "scatter" }
|
|
140811
|
+
]);
|
|
140812
|
+
function toggleFullscreen() {
|
|
140813
|
+
if (!containerRef.value) return;
|
|
140814
|
+
if (!isFullscreen.value) {
|
|
140815
|
+
isFullscreen.value = true;
|
|
140816
|
+
} else {
|
|
140817
|
+
isFullscreen.value = false;
|
|
140818
|
+
}
|
|
140819
|
+
nextTick(() => {
|
|
140820
|
+
if (chart) {
|
|
140821
|
+
chart.resize();
|
|
140822
|
+
}
|
|
140823
|
+
});
|
|
140824
|
+
}
|
|
140825
|
+
function handleChartTypeChange(newType) {
|
|
140826
|
+
if (!chart || !props.data) return;
|
|
140827
|
+
currentChartType.value = newType;
|
|
140828
|
+
initChart(newType);
|
|
140829
|
+
}
|
|
140830
|
+
function handleKeydown(e) {
|
|
140831
|
+
if (e.key === "Escape" && isFullscreen.value) {
|
|
140832
|
+
isFullscreen.value = false;
|
|
140833
|
+
nextTick(() => {
|
|
140834
|
+
if (chart) {
|
|
140835
|
+
chart.resize();
|
|
140836
|
+
}
|
|
140837
|
+
});
|
|
140838
|
+
}
|
|
140839
|
+
}
|
|
140840
|
+
onMounted(() => {
|
|
140841
|
+
window.addEventListener("keydown", handleKeydown);
|
|
140842
|
+
});
|
|
140843
|
+
onUnmounted(() => {
|
|
140844
|
+
window.removeEventListener("keydown", handleKeydown);
|
|
140845
|
+
});
|
|
140779
140846
|
const sectionListSectionInfo = inject(
|
|
140780
140847
|
"sectionListSectionInfo",
|
|
140781
140848
|
computed(() => null)
|
|
@@ -140806,41 +140873,151 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
|
|
|
140806
140873
|
}
|
|
140807
140874
|
return window._chartJsPromise;
|
|
140808
140875
|
}
|
|
140809
|
-
function
|
|
140876
|
+
function processSeriesDataPoints(dataPoints, chartType, context) {
|
|
140877
|
+
const isXYChart = ["scatter", "bubble"].includes(chartType);
|
|
140810
140878
|
const processedData = {
|
|
140811
140879
|
labels: [],
|
|
140812
140880
|
values: []
|
|
140813
140881
|
};
|
|
140814
|
-
|
|
140882
|
+
dataPoints?.forEach((point) => {
|
|
140815
140883
|
let label = point.label;
|
|
140816
|
-
let value = point.value;
|
|
140817
140884
|
try {
|
|
140818
140885
|
if (typeof label === "string") {
|
|
140819
140886
|
label = renderTemplate(label, context);
|
|
140820
140887
|
}
|
|
140821
|
-
if (
|
|
140822
|
-
|
|
140823
|
-
|
|
140824
|
-
|
|
140825
|
-
|
|
140826
|
-
|
|
140827
|
-
|
|
140828
|
-
|
|
140829
|
-
|
|
140888
|
+
if (isXYChart) {
|
|
140889
|
+
let xValue = point.x_value ?? "0";
|
|
140890
|
+
let yValue = point.y_value ?? "0";
|
|
140891
|
+
if (typeof xValue === "string") {
|
|
140892
|
+
xValue = renderTemplate(xValue, context);
|
|
140893
|
+
}
|
|
140894
|
+
if (typeof yValue === "string") {
|
|
140895
|
+
yValue = renderTemplate(yValue, context);
|
|
140896
|
+
}
|
|
140897
|
+
if (typeof label === "string" && label.includes(",") && typeof xValue === "string" && xValue.includes(",") && typeof yValue === "string" && yValue.includes(",")) {
|
|
140898
|
+
const labels = label.split(",");
|
|
140899
|
+
const xValues = xValue.split(",");
|
|
140900
|
+
const yValues = yValue.split(",");
|
|
140901
|
+
labels.forEach((l, idx) => {
|
|
140902
|
+
const x = Number(xValues[idx]) || 0;
|
|
140903
|
+
const y = Number(yValues[idx]) || 0;
|
|
140830
140904
|
processedData.labels.push(l);
|
|
140831
|
-
|
|
140905
|
+
if (chartType === "bubble") {
|
|
140906
|
+
processedData.values.push({ x, y, r: Math.max(5, Math.abs(y) / 2) });
|
|
140907
|
+
} else {
|
|
140908
|
+
processedData.values.push({ x, y });
|
|
140909
|
+
}
|
|
140910
|
+
});
|
|
140911
|
+
} else {
|
|
140912
|
+
const x = Number(xValue) || 0;
|
|
140913
|
+
const y = Number(yValue) || 0;
|
|
140914
|
+
processedData.labels.push(label);
|
|
140915
|
+
if (chartType === "bubble") {
|
|
140916
|
+
processedData.values.push({ x, y, r: Math.max(5, Math.abs(y) / 2) });
|
|
140917
|
+
} else {
|
|
140918
|
+
processedData.values.push({ x, y });
|
|
140832
140919
|
}
|
|
140833
|
-
}
|
|
140920
|
+
}
|
|
140834
140921
|
} else {
|
|
140835
|
-
|
|
140836
|
-
|
|
140922
|
+
let value = point.value;
|
|
140923
|
+
if (typeof value === "string") {
|
|
140924
|
+
value = renderTemplate(value, context);
|
|
140925
|
+
}
|
|
140926
|
+
if (typeof label === "string" && label.includes(",") && typeof value === "string" && value.includes(",")) {
|
|
140927
|
+
const labels = label.split(",");
|
|
140928
|
+
const values = value.split(",");
|
|
140929
|
+
labels.forEach((l, idx) => {
|
|
140930
|
+
const v = values[idx];
|
|
140931
|
+
if (v !== void 0) {
|
|
140932
|
+
processedData.labels.push(l);
|
|
140933
|
+
processedData.values.push(Number(v) || 0);
|
|
140934
|
+
}
|
|
140935
|
+
});
|
|
140936
|
+
} else {
|
|
140937
|
+
processedData.labels.push(label);
|
|
140938
|
+
processedData.values.push(Number(value) || 0);
|
|
140939
|
+
}
|
|
140837
140940
|
}
|
|
140838
140941
|
} catch (err) {
|
|
140839
140942
|
console.warn("Error processing chart data point:", err);
|
|
140840
140943
|
processedData.labels.push(label);
|
|
140841
|
-
|
|
140944
|
+
if (isXYChart) {
|
|
140945
|
+
processedData.values.push({ x: 0, y: 0 });
|
|
140946
|
+
} else {
|
|
140947
|
+
processedData.values.push(0);
|
|
140948
|
+
}
|
|
140842
140949
|
}
|
|
140843
140950
|
});
|
|
140951
|
+
return processedData;
|
|
140952
|
+
}
|
|
140953
|
+
function processChartData(chartData, context) {
|
|
140954
|
+
if (chartData.series && Array.isArray(chartData.series) && chartData.series.length > 0) {
|
|
140955
|
+
const datasets = [];
|
|
140956
|
+
let allLabels = [];
|
|
140957
|
+
const isSingleSeries = chartData.series.length === 1;
|
|
140958
|
+
chartData.series.forEach((series, index) => {
|
|
140959
|
+
const seriesChartType = series.chart_type || chartData.type || "bar";
|
|
140960
|
+
const processedData2 = processSeriesDataPoints(series.data_points || [], seriesChartType, context);
|
|
140961
|
+
if (processedData2.labels.length > allLabels.length) {
|
|
140962
|
+
allLabels = processedData2.labels;
|
|
140963
|
+
}
|
|
140964
|
+
const preBuiltDataset = chartData.data?.datasets?.[index];
|
|
140965
|
+
let backgroundColor2 = preBuiltDataset?.background_color || preBuiltDataset?.backgroundColor;
|
|
140966
|
+
let borderColor2 = preBuiltDataset?.border_color || preBuiltDataset?.borderColor;
|
|
140967
|
+
if (isSingleSeries && Array.isArray(backgroundColor2)) {
|
|
140968
|
+
const resolvedColors = backgroundColor2.map((color, i) => {
|
|
140969
|
+
if (typeof color === "string" && color.startsWith("palette")) {
|
|
140970
|
+
const paletteIndex = parseInt(color.replace("palette", ""));
|
|
140971
|
+
const validIndex = paletteIndex >= 0 ? paletteIndex % palette.value.length : i;
|
|
140972
|
+
return palette.value[validIndex];
|
|
140973
|
+
}
|
|
140974
|
+
return color;
|
|
140975
|
+
});
|
|
140976
|
+
const dataPointsCount = processedData2.values.length;
|
|
140977
|
+
backgroundColor2 = Array.from({ length: dataPointsCount }, (_, i) => resolvedColors[i % resolvedColors.length]);
|
|
140978
|
+
borderColor2 = [...backgroundColor2];
|
|
140979
|
+
} else if (typeof backgroundColor2 === "string" && backgroundColor2.startsWith("palette")) {
|
|
140980
|
+
const paletteIndex = parseInt(backgroundColor2.replace("palette", ""));
|
|
140981
|
+
const validIndex = paletteIndex >= 0 ? paletteIndex % palette.value.length : index;
|
|
140982
|
+
backgroundColor2 = palette.value[validIndex];
|
|
140983
|
+
borderColor2 = backgroundColor2;
|
|
140984
|
+
}
|
|
140985
|
+
const datasetOptions = {
|
|
140986
|
+
label: series.name,
|
|
140987
|
+
data: processedData2.values,
|
|
140988
|
+
backgroundColor: backgroundColor2 || palette.value[index % palette.value.length],
|
|
140989
|
+
borderColor: borderColor2 || palette.value[index % palette.value.length],
|
|
140990
|
+
borderWidth: 1
|
|
140991
|
+
};
|
|
140992
|
+
if (!isSingleSeries) {
|
|
140993
|
+
if (series.chart_type === "area") {
|
|
140994
|
+
datasetOptions.type = "line";
|
|
140995
|
+
datasetOptions.fill = true;
|
|
140996
|
+
datasetOptions.tension = 0.4;
|
|
140997
|
+
} else {
|
|
140998
|
+
datasetOptions.type = series.chart_type;
|
|
140999
|
+
}
|
|
141000
|
+
}
|
|
141001
|
+
if (series.chart_type === "area") {
|
|
141002
|
+
datasetOptions.fill = true;
|
|
141003
|
+
datasetOptions.tension = 0.4;
|
|
141004
|
+
}
|
|
141005
|
+
if (["line", "area"].includes(series.chart_type)) {
|
|
141006
|
+
datasetOptions.tension = 0.4;
|
|
141007
|
+
}
|
|
141008
|
+
datasets.push(datasetOptions);
|
|
141009
|
+
});
|
|
141010
|
+
return {
|
|
141011
|
+
...chartData,
|
|
141012
|
+
type: chartData.type || chartData._primary_chart_type || "bar",
|
|
141013
|
+
data: {
|
|
141014
|
+
...chartData.data,
|
|
141015
|
+
labels: allLabels,
|
|
141016
|
+
datasets
|
|
141017
|
+
}
|
|
141018
|
+
};
|
|
141019
|
+
}
|
|
141020
|
+
const processedData = processSeriesDataPoints(chartData.data_points || [], chartData.type, context);
|
|
140844
141021
|
let backgroundColor = chartData.data?.datasets?.[0]?.background_color || [];
|
|
140845
141022
|
let borderColor = chartData.data?.datasets?.[0]?.border_color || [];
|
|
140846
141023
|
if (chartData.color_scheme_type === "theme" && Array.isArray(backgroundColor)) {
|
|
@@ -140886,7 +141063,7 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
|
|
|
140886
141063
|
}
|
|
140887
141064
|
};
|
|
140888
141065
|
}
|
|
140889
|
-
function initChart() {
|
|
141066
|
+
function initChart(overrideType) {
|
|
140890
141067
|
if (!props.data || !chartRef.value || !isChartLoaded.value) {
|
|
140891
141068
|
return;
|
|
140892
141069
|
}
|
|
@@ -140895,24 +141072,73 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
|
|
|
140895
141072
|
}
|
|
140896
141073
|
const context = props.data.context ?? (!isEmpty(activeCanvas.value?.context) || isCanvas.value ? { ...crmShape.value, ...activeCanvas.value?.context } : crmShape.value);
|
|
140897
141074
|
const processedChartData = processChartData(props.data, context);
|
|
141075
|
+
const chartType = overrideType || currentChartType.value || processedChartData.type || "bar";
|
|
140898
141076
|
if (processedChartData.data?.datasets) {
|
|
140899
141077
|
processedChartData.data.datasets = processedChartData.data.datasets.map((dataset) => {
|
|
140900
|
-
const { background_color, border_color, point_style, ...rest } = dataset;
|
|
141078
|
+
const { background_color, border_color, point_style, fill, tension, show_line, ...rest } = dataset;
|
|
140901
141079
|
return {
|
|
140902
141080
|
...rest,
|
|
140903
141081
|
backgroundColor: dataset.backgroundColor || background_color || ["#000000"],
|
|
140904
141082
|
borderColor: dataset.borderColor || border_color || ["#000000"],
|
|
140905
|
-
pointStyle: point_style
|
|
141083
|
+
pointStyle: point_style,
|
|
141084
|
+
fill,
|
|
141085
|
+
tension,
|
|
141086
|
+
showLine: show_line
|
|
140906
141087
|
};
|
|
140907
141088
|
});
|
|
140908
141089
|
}
|
|
141090
|
+
let scales = processedChartData.options?.scales;
|
|
141091
|
+
if (scales) {
|
|
141092
|
+
const convertedScales = {};
|
|
141093
|
+
if (scales.x) {
|
|
141094
|
+
convertedScales.x = { ...scales.x };
|
|
141095
|
+
}
|
|
141096
|
+
if (scales.y) {
|
|
141097
|
+
convertedScales.y = {
|
|
141098
|
+
...scales.y,
|
|
141099
|
+
beginAtZero: scales.y.begin_at_zero
|
|
141100
|
+
};
|
|
141101
|
+
delete convertedScales.y.begin_at_zero;
|
|
141102
|
+
}
|
|
141103
|
+
if (scales.r) {
|
|
141104
|
+
convertedScales.r = {
|
|
141105
|
+
...scales.r,
|
|
141106
|
+
beginAtZero: scales.r.begin_at_zero,
|
|
141107
|
+
ticks: scales.r.ticks ? {
|
|
141108
|
+
stepSize: scales.r.ticks.step_size
|
|
141109
|
+
} : void 0
|
|
141110
|
+
};
|
|
141111
|
+
}
|
|
141112
|
+
scales = convertedScales;
|
|
141113
|
+
}
|
|
141114
|
+
if (["pie", "doughnut", "polarArea"].includes(chartType)) {
|
|
141115
|
+
scales = void 0;
|
|
141116
|
+
}
|
|
141117
|
+
const tooltipCallbacks = {};
|
|
141118
|
+
if (props.data.percent_display) {
|
|
141119
|
+
tooltipCallbacks.label = function(context2) {
|
|
141120
|
+
const label = context2.dataset.label || "";
|
|
141121
|
+
const value = context2.raw;
|
|
141122
|
+
if (typeof value === "number" && value <= 1 && value > 0) {
|
|
141123
|
+
return `${label}${label ? ": " : ""}${(value * 100).toFixed(2)}%`;
|
|
141124
|
+
}
|
|
141125
|
+
return `${label}${label ? ": " : ""}${value}`;
|
|
141126
|
+
};
|
|
141127
|
+
}
|
|
140909
141128
|
const chartConfig = {
|
|
140910
141129
|
...processedChartData,
|
|
140911
|
-
type:
|
|
141130
|
+
type: chartType,
|
|
140912
141131
|
options: merge$1({}, processedChartData.options, {
|
|
140913
141132
|
responsive: true,
|
|
140914
141133
|
maintainAspectRatio: false,
|
|
140915
|
-
indexAxis: processedChartData.options?.index_axis
|
|
141134
|
+
indexAxis: processedChartData.options?.index_axis,
|
|
141135
|
+
scales,
|
|
141136
|
+
plugins: {
|
|
141137
|
+
...processedChartData.options?.plugins,
|
|
141138
|
+
tooltip: props.data.percent_display ? {
|
|
141139
|
+
callbacks: tooltipCallbacks
|
|
141140
|
+
} : void 0
|
|
141141
|
+
}
|
|
140916
141142
|
})
|
|
140917
141143
|
};
|
|
140918
141144
|
chart = new window.Chart(chartRef.value, chartConfig);
|
|
@@ -140932,84 +141158,164 @@ const _sfc_main$2F = /* @__PURE__ */ defineComponent({
|
|
|
140932
141158
|
isChartLoaded.value = true;
|
|
140933
141159
|
});
|
|
140934
141160
|
return (_ctx, _cache) => {
|
|
140935
|
-
return openBlock(), createElementBlock("div",
|
|
141161
|
+
return openBlock(), createElementBlock("div", {
|
|
141162
|
+
ref_key: "containerRef",
|
|
141163
|
+
ref: containerRef,
|
|
141164
|
+
class: normalizeClass(["cb-data-charts-raw", { "is-fullscreen": isFullscreen.value }]),
|
|
141165
|
+
style: normalizeStyle(containerStyle.value)
|
|
141166
|
+
}, [
|
|
141167
|
+
showViewControls.value ? (openBlock(), createElementBlock("div", _hoisted_1$24, [
|
|
141168
|
+
props.data?.view_controls?.enable_chart_type_switcher ? (openBlock(), createBlock(unref(NDropdown), {
|
|
141169
|
+
key: 0,
|
|
141170
|
+
options: chartTypeSwitcherOptions.value,
|
|
141171
|
+
trigger: "click",
|
|
141172
|
+
onSelect: handleChartTypeChange
|
|
141173
|
+
}, {
|
|
141174
|
+
default: withCtx(() => [
|
|
141175
|
+
createVNode(CButton, {
|
|
141176
|
+
quaternary: "",
|
|
141177
|
+
size: "small"
|
|
141178
|
+
}, {
|
|
141179
|
+
icon: withCtx(() => [
|
|
141180
|
+
createVNode(CIcon, { icon: "chart-bar" })
|
|
141181
|
+
]),
|
|
141182
|
+
_: 1
|
|
141183
|
+
})
|
|
141184
|
+
]),
|
|
141185
|
+
_: 1
|
|
141186
|
+
}, 8, ["options"])) : createCommentVNode("", true),
|
|
141187
|
+
props.data?.view_controls?.enable_fullscreen_btn ? (openBlock(), createBlock(CButton, {
|
|
141188
|
+
key: 1,
|
|
141189
|
+
quaternary: "",
|
|
141190
|
+
size: "small",
|
|
141191
|
+
onClick: toggleFullscreen
|
|
141192
|
+
}, {
|
|
141193
|
+
icon: withCtx(() => [
|
|
141194
|
+
createVNode(CIcon, {
|
|
141195
|
+
icon: isFullscreen.value ? "compress" : "expand"
|
|
141196
|
+
}, null, 8, ["icon"])
|
|
141197
|
+
]),
|
|
141198
|
+
_: 1
|
|
141199
|
+
})) : createCommentVNode("", true)
|
|
141200
|
+
])) : createCommentVNode("", true),
|
|
140936
141201
|
createElementVNode("canvas", {
|
|
140937
141202
|
ref_key: "chartRef",
|
|
140938
141203
|
ref: chartRef,
|
|
140939
141204
|
class: "w-full h-full"
|
|
140940
141205
|
}, null, 512)
|
|
140941
|
-
]);
|
|
141206
|
+
], 6);
|
|
140942
141207
|
};
|
|
140943
141208
|
}
|
|
140944
141209
|
});
|
|
140945
141210
|
|
|
140946
|
-
const RawDataCharts = /* @__PURE__ */ _export_sfc(_sfc_main$2F, [["__scopeId", "data-v-
|
|
141211
|
+
const RawDataCharts = /* @__PURE__ */ _export_sfc(_sfc_main$2F, [["__scopeId", "data-v-23a3b44c"]]);
|
|
141212
|
+
|
|
141213
|
+
const STANDALONE_CHART_TYPES = ["pie", "doughnut", "radar", "polarArea"];
|
|
141214
|
+
const MIXABLE_CHART_TYPES = ["bar", "line", "scatter", "bubble", "area"];
|
|
141215
|
+
const XY_CHART_TYPES = ["scatter", "bubble"];
|
|
140947
141216
|
|
|
140948
141217
|
const _hoisted_1$23 = { class: "flex gap-4 h-[calc(80vh-120px)] w-full" };
|
|
140949
141218
|
const _hoisted_2$1t = { class: "cb-data-charts-settings__card overflow-auto flex-1" };
|
|
140950
141219
|
const _hoisted_3$17 = { class: "flex flex-col h-full" };
|
|
140951
141220
|
const _hoisted_4$X = { class: "flex-grow overflow-y-auto overflow-x-hidden" };
|
|
140952
|
-
const _hoisted_5$O = { class: "mb-
|
|
140953
|
-
const _hoisted_6$H = { class: "
|
|
140954
|
-
const _hoisted_7$v =
|
|
140955
|
-
const _hoisted_8$q = { class: "
|
|
140956
|
-
const _hoisted_9$m =
|
|
140957
|
-
const _hoisted_10$h =
|
|
140958
|
-
const _hoisted_11$f = {
|
|
140959
|
-
const _hoisted_12$b = { class: "block mb-2" };
|
|
140960
|
-
const _hoisted_13$a = {
|
|
141221
|
+
const _hoisted_5$O = { class: "text-sm font-semibold mb-3 text-gray-600 dark:text-gray-400 uppercase tracking-wide" };
|
|
141222
|
+
const _hoisted_6$H = { class: "flex items-end border-b border-gray-200 dark:border-gray-700 mb-4 -mx-4 px-4" };
|
|
141223
|
+
const _hoisted_7$v = ["onClick"];
|
|
141224
|
+
const _hoisted_8$q = { class: "text-sm font-medium truncate max-w-24" };
|
|
141225
|
+
const _hoisted_9$m = ["onClick"];
|
|
141226
|
+
const _hoisted_10$h = ["title"];
|
|
141227
|
+
const _hoisted_11$f = {
|
|
140961
141228
|
key: 0,
|
|
140962
141229
|
class: "mb-4"
|
|
140963
141230
|
};
|
|
141231
|
+
const _hoisted_12$b = { class: "block mb-2" };
|
|
141232
|
+
const _hoisted_13$a = { class: "mb-4" };
|
|
140964
141233
|
const _hoisted_14$9 = { class: "block mb-2" };
|
|
140965
141234
|
const _hoisted_15$8 = { class: "mb-4" };
|
|
140966
|
-
const _hoisted_16$8 = { class: "
|
|
140967
|
-
const _hoisted_17$7 = {
|
|
140968
|
-
|
|
140969
|
-
|
|
140970
|
-
};
|
|
140971
|
-
const
|
|
140972
|
-
const
|
|
140973
|
-
const
|
|
140974
|
-
const
|
|
140975
|
-
const _hoisted_22$3 = { class: "flex gap-2 flex-1" };
|
|
140976
|
-
const _hoisted_23$3 = ["onClick"];
|
|
140977
|
-
const _hoisted_24$3 = { class: "p-4 min-w-[400px] max-h-[400px]" };
|
|
140978
|
-
const _hoisted_25$3 = { class: "flex gap-4 h-full" };
|
|
140979
|
-
const _hoisted_26$3 = { class: "flex-1 flex flex-col" };
|
|
140980
|
-
const _hoisted_27$3 = { class: "text-sm mb-2" };
|
|
140981
|
-
const _hoisted_28$3 = { class: "overflow-auto" };
|
|
140982
|
-
const _hoisted_29$3 = {
|
|
141235
|
+
const _hoisted_16$8 = { class: "flex justify-between items-center mb-2" };
|
|
141236
|
+
const _hoisted_17$7 = { class: "block" };
|
|
141237
|
+
const _hoisted_18$6 = ["onClick"];
|
|
141238
|
+
const _hoisted_19$6 = { class: "p-4 min-w-[400px] max-h-[400px]" };
|
|
141239
|
+
const _hoisted_20$5 = { class: "flex gap-4 h-full" };
|
|
141240
|
+
const _hoisted_21$5 = { class: "flex-1 flex flex-col" };
|
|
141241
|
+
const _hoisted_22$3 = { class: "text-sm mb-2" };
|
|
141242
|
+
const _hoisted_23$3 = { class: "overflow-auto" };
|
|
141243
|
+
const _hoisted_24$3 = {
|
|
140983
141244
|
key: 0,
|
|
140984
141245
|
class: "flex-1 border-l pl-4"
|
|
140985
141246
|
};
|
|
140986
|
-
const
|
|
140987
|
-
const
|
|
140988
|
-
const
|
|
140989
|
-
const
|
|
140990
|
-
const
|
|
140991
|
-
const
|
|
140992
|
-
const
|
|
140993
|
-
const
|
|
140994
|
-
const
|
|
140995
|
-
const
|
|
140996
|
-
const
|
|
141247
|
+
const _hoisted_25$3 = { class: "text-sm font-medium mb-2" };
|
|
141248
|
+
const _hoisted_26$3 = { class: "flex flex-col gap-2" };
|
|
141249
|
+
const _hoisted_27$3 = { class: "block mb-1 text-sm" };
|
|
141250
|
+
const _hoisted_28$3 = { class: "block mb-1 text-sm" };
|
|
141251
|
+
const _hoisted_29$3 = ["onClick"];
|
|
141252
|
+
const _hoisted_30$3 = { class: "p-4 min-w-[400px] max-h-[400px]" };
|
|
141253
|
+
const _hoisted_31$3 = { class: "flex gap-4 h-full" };
|
|
141254
|
+
const _hoisted_32$3 = { class: "flex-1 flex flex-col" };
|
|
141255
|
+
const _hoisted_33$3 = { class: "text-sm mb-2" };
|
|
141256
|
+
const _hoisted_34$3 = { class: "overflow-auto" };
|
|
141257
|
+
const _hoisted_35$3 = {
|
|
140997
141258
|
key: 0,
|
|
140998
141259
|
class: "flex-1 border-l pl-4"
|
|
140999
141260
|
};
|
|
141000
|
-
const
|
|
141001
|
-
const
|
|
141002
|
-
const
|
|
141003
|
-
const
|
|
141004
|
-
const
|
|
141005
|
-
const
|
|
141006
|
-
const
|
|
141007
|
-
const
|
|
141008
|
-
const
|
|
141261
|
+
const _hoisted_36$3 = { class: "text-sm font-medium mb-2" };
|
|
141262
|
+
const _hoisted_37$3 = { class: "flex flex-col gap-2" };
|
|
141263
|
+
const _hoisted_38$3 = { class: "block mb-1 text-sm" };
|
|
141264
|
+
const _hoisted_39$3 = { class: "block mb-1 text-sm" };
|
|
141265
|
+
const _hoisted_40$3 = { class: "block mb-1 text-sm" };
|
|
141266
|
+
const _hoisted_41$3 = ["onClick"];
|
|
141267
|
+
const _hoisted_42$3 = { class: "p-4 min-w-[400px] max-h-[400px] overflow-auto" };
|
|
141268
|
+
const _hoisted_43$3 = { class: "text-sm mb-2" };
|
|
141269
|
+
const _hoisted_44$3 = { class: "flex justify-center mt-2" };
|
|
141270
|
+
const _hoisted_45$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" };
|
|
141271
|
+
const _hoisted_46$3 = { class: "mb-4" };
|
|
141272
|
+
const _hoisted_47$3 = { class: "block mb-2" };
|
|
141273
|
+
const _hoisted_48$3 = { class: "mb-4" };
|
|
141274
|
+
const _hoisted_49$3 = { class: "block mb-2" };
|
|
141275
|
+
const _hoisted_50$3 = { class: "mb-4" };
|
|
141276
|
+
const _hoisted_51$2 = { class: "block mb-2" };
|
|
141277
|
+
const _hoisted_52$2 = { class: "mb-4" };
|
|
141278
|
+
const _hoisted_53$2 = { class: "block mb-2" };
|
|
141279
|
+
const _hoisted_54$1 = {
|
|
141280
|
+
key: 2,
|
|
141281
|
+
class: "mb-4"
|
|
141282
|
+
};
|
|
141283
|
+
const _hoisted_55$1 = { class: "block mb-2" };
|
|
141284
|
+
const _hoisted_56$1 = {
|
|
141285
|
+
key: 3,
|
|
141286
|
+
class: "mb-4"
|
|
141287
|
+
};
|
|
141288
|
+
const _hoisted_57$1 = { class: "block mb-2" };
|
|
141289
|
+
const _hoisted_58$1 = { class: "mb-4" };
|
|
141290
|
+
const _hoisted_59$1 = { class: "block mb-2" };
|
|
141291
|
+
const _hoisted_60$1 = { class: "mb-4" };
|
|
141292
|
+
const _hoisted_61$1 = { class: "block mb-2" };
|
|
141293
|
+
const _hoisted_62$1 = { class: "mb-4" };
|
|
141294
|
+
const _hoisted_63$1 = { class: "block mb-2" };
|
|
141295
|
+
const _hoisted_64$1 = { class: "flex items-center gap-2" };
|
|
141296
|
+
const _hoisted_65$1 = { class: "text-sm text-gray-500" };
|
|
141297
|
+
const _hoisted_66$1 = { class: "mb-4" };
|
|
141298
|
+
const _hoisted_67$1 = { class: "block mb-2" };
|
|
141299
|
+
const _hoisted_68$1 = { class: "flex flex-col gap-2" };
|
|
141300
|
+
const _hoisted_69 = { class: "flex items-center gap-2" };
|
|
141301
|
+
const _hoisted_70 = { class: "text-sm" };
|
|
141302
|
+
const _hoisted_71 = { class: "text-sm" };
|
|
141303
|
+
const _hoisted_72 = { class: "flex items-center gap-2" };
|
|
141304
|
+
const _hoisted_73 = { class: "text-sm" };
|
|
141305
|
+
const _hoisted_74 = { class: "mb-4" };
|
|
141306
|
+
const _hoisted_75 = { class: "block mb-2" };
|
|
141307
|
+
const _hoisted_76 = { class: "flex flex-col gap-3" };
|
|
141308
|
+
const _hoisted_77 = { class: "flex items-center gap-2" };
|
|
141309
|
+
const _hoisted_78 = { class: "text-sm w-16" };
|
|
141310
|
+
const _hoisted_79 = { class: "flex items-center gap-2" };
|
|
141311
|
+
const _hoisted_80 = { class: "text-sm w-16" };
|
|
141312
|
+
const _hoisted_81 = { class: "cb-data-charts-settings__preview flex-1 border-l border-[#eee] pl-4" };
|
|
141313
|
+
const _hoisted_82 = { class: "text-sm font-medium mb-4" };
|
|
141314
|
+
const _hoisted_83 = {
|
|
141009
141315
|
class: "preview-container",
|
|
141010
141316
|
style: { "height": "300px" }
|
|
141011
141317
|
};
|
|
141012
|
-
const
|
|
141318
|
+
const _hoisted_84 = { class: "flex justify-between gap-4" };
|
|
141013
141319
|
const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
141014
141320
|
__name: "DataCharts.settings",
|
|
141015
141321
|
props: {
|
|
@@ -141023,7 +141329,84 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141023
141329
|
const { setComponentEditMode, updateNodeDataById } = useCanvas$1();
|
|
141024
141330
|
const { crmShape } = useCrmShape();
|
|
141025
141331
|
const { palette } = useCanvasTheme$1();
|
|
141026
|
-
|
|
141332
|
+
let seriesIdCounter = 0;
|
|
141333
|
+
function generateSeriesId() {
|
|
141334
|
+
return `series_${Date.now()}_${seriesIdCounter++}`;
|
|
141335
|
+
}
|
|
141336
|
+
function convertSavedSeriesToRuntime(savedSeries) {
|
|
141337
|
+
return {
|
|
141338
|
+
id: savedSeries.id || generateSeriesId(),
|
|
141339
|
+
name: savedSeries.name || "Series 1",
|
|
141340
|
+
chartType: savedSeries.chart_type || "bar",
|
|
141341
|
+
dataPoints: (savedSeries.data_points || []).map((dp) => ({
|
|
141342
|
+
label: dp.label || "",
|
|
141343
|
+
value: dp.value || "",
|
|
141344
|
+
xValue: dp.x_value ?? "",
|
|
141345
|
+
yValue: dp.y_value ?? "",
|
|
141346
|
+
dynamicValue: dp.dynamic_value,
|
|
141347
|
+
dynamicXValue: dp.dynamic_x_value,
|
|
141348
|
+
dynamicYValue: dp.dynamic_y_value,
|
|
141349
|
+
arrayConfig: dp.array_config
|
|
141350
|
+
}))
|
|
141351
|
+
};
|
|
141352
|
+
}
|
|
141353
|
+
function convertLegacyToSeries() {
|
|
141354
|
+
const chartTypeValue = props.data?.type ?? props.data?._primary_chart_type ?? "bar";
|
|
141355
|
+
const dataPoints = props.data?.data_points && Array.isArray(props.data.data_points) ? props.data.data_points.map((dp) => ({
|
|
141356
|
+
label: dp.label,
|
|
141357
|
+
value: dp.value,
|
|
141358
|
+
xValue: dp.x_value ?? "",
|
|
141359
|
+
yValue: dp.y_value ?? "",
|
|
141360
|
+
dynamicValue: dp.dynamic_value,
|
|
141361
|
+
dynamicXValue: dp.dynamic_x_value,
|
|
141362
|
+
dynamicYValue: dp.dynamic_y_value,
|
|
141363
|
+
arrayConfig: dp.array_config
|
|
141364
|
+
})) : props.data?.data?.labels ? props.data.data.labels.map((label, index) => ({
|
|
141365
|
+
label: String(label),
|
|
141366
|
+
value: String(props.data?.data?.datasets?.[0]?.data?.[index] ?? 0),
|
|
141367
|
+
xValue: "",
|
|
141368
|
+
yValue: ""
|
|
141369
|
+
})) : [];
|
|
141370
|
+
return [
|
|
141371
|
+
{
|
|
141372
|
+
id: generateSeriesId(),
|
|
141373
|
+
name: t("canvasUI.canvasBuilder.dataCharts.series") + " 1",
|
|
141374
|
+
chartType: chartTypeValue,
|
|
141375
|
+
dataPoints
|
|
141376
|
+
}
|
|
141377
|
+
];
|
|
141378
|
+
}
|
|
141379
|
+
const seriesList = ref(
|
|
141380
|
+
props.data?.series && Array.isArray(props.data.series) && props.data.series.length > 0 ? props.data.series.map((s) => convertSavedSeriesToRuntime(s)) : convertLegacyToSeries()
|
|
141381
|
+
);
|
|
141382
|
+
const activeSeriesIndex = ref(0);
|
|
141383
|
+
const activeSeries = computed(() => seriesList.value[activeSeriesIndex.value]);
|
|
141384
|
+
const isActiveSeriesXYChart = computed(() => XY_CHART_TYPES.includes(activeSeries.value?.chartType));
|
|
141385
|
+
const isPrimaryStandalone = computed(() => STANDALONE_CHART_TYPES.includes(seriesList.value[0]?.chartType));
|
|
141386
|
+
const isMultiSeries = computed(() => seriesList.value.length > 1);
|
|
141387
|
+
const canAddSeries = computed(() => !isPrimaryStandalone.value);
|
|
141388
|
+
const availableChartTypeOptions = computed(() => {
|
|
141389
|
+
const allOptions = [
|
|
141390
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.bar"), value: "bar" },
|
|
141391
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.line"), value: "line" },
|
|
141392
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.pie"), value: "pie" },
|
|
141393
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.doughnut"), value: "doughnut" },
|
|
141394
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.polarArea"), value: "polarArea" },
|
|
141395
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.radar"), value: "radar" },
|
|
141396
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.scatter"), value: "scatter" },
|
|
141397
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.bubble"), value: "bubble" },
|
|
141398
|
+
{ label: t("canvasUI.canvasBuilder.dataCharts.types.area"), value: "area" }
|
|
141399
|
+
];
|
|
141400
|
+
if (activeSeriesIndex.value === 0 && seriesList.value.length > 1) {
|
|
141401
|
+
return allOptions.filter((opt) => MIXABLE_CHART_TYPES.includes(opt.value));
|
|
141402
|
+
}
|
|
141403
|
+
if (activeSeriesIndex.value > 0) {
|
|
141404
|
+
return allOptions.filter((opt) => MIXABLE_CHART_TYPES.includes(opt.value));
|
|
141405
|
+
}
|
|
141406
|
+
return allOptions;
|
|
141407
|
+
});
|
|
141408
|
+
const chartType = computed(() => seriesList.value[0]?.chartType ?? "bar");
|
|
141409
|
+
const primaryChartType = computed(() => seriesList.value[0]?.chartType ?? "bar");
|
|
141027
141410
|
const backgroundColor = props.data?.data?.datasets?.[0]?.background_color;
|
|
141028
141411
|
const colorSchemeType = ref(props.data?.color_scheme_type ?? "theme");
|
|
141029
141412
|
const chartColors = ref([]);
|
|
@@ -141052,24 +141435,16 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141052
141435
|
const chartTitle = ref(props.data?.options?.plugins?.title?.text ?? "");
|
|
141053
141436
|
const legendPosition = ref(props.data?.options?.plugins?.legend?.position ?? "top");
|
|
141054
141437
|
const enableAnimation = ref((props.data?.options?.animation?.duration ?? 0) > 0);
|
|
141055
|
-
const dataPoints = ref(
|
|
141056
|
-
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) => ({
|
|
141057
|
-
label: String(label),
|
|
141058
|
-
value: String(props.data?.data?.datasets?.[0]?.data?.[index] ?? 0)
|
|
141059
|
-
})) : []
|
|
141060
|
-
);
|
|
141061
141438
|
const xAxisLabel = ref(props.data?.options?.scales?.x?.title?.text ?? "");
|
|
141062
141439
|
const yAxisLabel = ref(props.data?.options?.scales?.y?.title?.text ?? "");
|
|
141063
141440
|
const orientation = ref(props.data?.options?.index_axis ?? "x");
|
|
141064
141441
|
const pointStyle = ref(props.data?.data?.datasets?.[0]?.point_style ?? "circle");
|
|
141065
|
-
const
|
|
141066
|
-
|
|
141067
|
-
|
|
141068
|
-
|
|
141069
|
-
|
|
141070
|
-
|
|
141071
|
-
{ label: t("canvasUI.canvasBuilder.dataCharts.types.radar"), value: "radar" }
|
|
141072
|
-
];
|
|
141442
|
+
const percentDisplay = ref(props.data?.percent_display ?? false);
|
|
141443
|
+
const enableFullscreenBtn = ref(props.data?.view_controls?.enable_fullscreen_btn ?? false);
|
|
141444
|
+
const enableChartTypeSwitcher = ref(props.data?.view_controls?.enable_chart_type_switcher ?? false);
|
|
141445
|
+
const enableDataEntry = ref(props.data?.view_controls?.enable_data_entry ?? false);
|
|
141446
|
+
const chartHeight = ref(props.data?.chart_height ?? 800);
|
|
141447
|
+
const chartWidth = ref(props.data?.chart_width ?? 100);
|
|
141073
141448
|
const legendPositionOptions = [
|
|
141074
141449
|
{ label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.none"), value: "none" },
|
|
141075
141450
|
{ label: t("canvasUI.canvasBuilder.dataCharts.legendPositions.top"), value: "top" },
|
|
@@ -141089,12 +141464,18 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141089
141464
|
{ label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.star"), value: "star" },
|
|
141090
141465
|
{ label: t("canvasUI.canvasBuilder.dataCharts.pointStyles.triangle"), value: "triangle" }
|
|
141091
141466
|
];
|
|
141092
|
-
|
|
141093
|
-
|
|
141094
|
-
|
|
141095
|
-
|
|
141096
|
-
|
|
141097
|
-
|
|
141467
|
+
const deleteButtonStyle = computed(() => ({
|
|
141468
|
+
"--n-border": "1px solid transparent",
|
|
141469
|
+
"--n-border-disabled": "1px solid transparent",
|
|
141470
|
+
"--n-border-focus": "1px solid transparent",
|
|
141471
|
+
"--n-border-hover": "1px solid transparent",
|
|
141472
|
+
"--n-border-pressed": "1px solid transparent",
|
|
141473
|
+
"--n-color-focus": themeVars.value.error2,
|
|
141474
|
+
"--n-color-hover": themeVars.value.error2,
|
|
141475
|
+
"--n-color-disabled": themeVars.value.error2,
|
|
141476
|
+
"--n-color-pressed": themeVars.value.error2
|
|
141477
|
+
}));
|
|
141478
|
+
const activePopoverField = ref(null);
|
|
141098
141479
|
function updateChartColors(newColors) {
|
|
141099
141480
|
if (colorSchemeType.value === "theme") {
|
|
141100
141481
|
chartColors.value = newColors.map((color, i) => {
|
|
@@ -141122,17 +141503,54 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141122
141503
|
}
|
|
141123
141504
|
}
|
|
141124
141505
|
);
|
|
141506
|
+
function closePopover() {
|
|
141507
|
+
activePopoverPoint.value = null;
|
|
141508
|
+
activePopoverField.value = null;
|
|
141509
|
+
}
|
|
141510
|
+
function addSeries() {
|
|
141511
|
+
if (!canAddSeries.value) return;
|
|
141512
|
+
const newIndex = seriesList.value.length;
|
|
141513
|
+
const newSeries = {
|
|
141514
|
+
id: generateSeriesId(),
|
|
141515
|
+
name: `${t("canvasUI.canvasBuilder.dataCharts.series")} ${newIndex + 1}`,
|
|
141516
|
+
chartType: seriesList.value[0].chartType,
|
|
141517
|
+
// Default to same type as first series
|
|
141518
|
+
dataPoints: []
|
|
141519
|
+
};
|
|
141520
|
+
seriesList.value.push(newSeries);
|
|
141521
|
+
activeSeriesIndex.value = newIndex;
|
|
141522
|
+
updatePreview();
|
|
141523
|
+
}
|
|
141524
|
+
function removeSeries(index) {
|
|
141525
|
+
if (index === 0 || index >= seriesList.value.length) return;
|
|
141526
|
+
seriesList.value.splice(index, 1);
|
|
141527
|
+
if (activeSeriesIndex.value >= seriesList.value.length) {
|
|
141528
|
+
activeSeriesIndex.value = seriesList.value.length - 1;
|
|
141529
|
+
}
|
|
141530
|
+
updatePreview();
|
|
141531
|
+
}
|
|
141532
|
+
function onChartTypeChange(newType) {
|
|
141533
|
+
if (activeSeriesIndex.value === 0 && STANDALONE_CHART_TYPES.includes(newType)) {
|
|
141534
|
+
seriesList.value = [seriesList.value[0]];
|
|
141535
|
+
}
|
|
141536
|
+
updatePreview();
|
|
141537
|
+
}
|
|
141125
141538
|
function addDataPoint() {
|
|
141126
|
-
|
|
141539
|
+
activeSeries.value.dataPoints.push({
|
|
141127
141540
|
label: "",
|
|
141541
|
+
xValue: "",
|
|
141542
|
+
yValue: "",
|
|
141128
141543
|
value: ""
|
|
141129
141544
|
});
|
|
141130
141545
|
}
|
|
141131
141546
|
function removeDataPoint(index) {
|
|
141132
|
-
|
|
141547
|
+
activeSeries.value.dataPoints.splice(index, 1);
|
|
141133
141548
|
}
|
|
141134
141549
|
function removeAllDataPoints() {
|
|
141135
|
-
|
|
141550
|
+
activeSeries.value.dataPoints = [];
|
|
141551
|
+
}
|
|
141552
|
+
function isArrayOrObject(value) {
|
|
141553
|
+
return Array.isArray(value) || typeof value === "object" && value !== null;
|
|
141136
141554
|
}
|
|
141137
141555
|
function getFieldOptions(data) {
|
|
141138
141556
|
if (!data || typeof data !== "object") return [];
|
|
@@ -141143,6 +141561,43 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141143
141561
|
value: field
|
|
141144
141562
|
}));
|
|
141145
141563
|
}
|
|
141564
|
+
function updateDynamicValueExpression(point) {
|
|
141565
|
+
if (!point.selectedValue || !point.arrayConfig?.labelField || !point.arrayConfig?.valueField) {
|
|
141566
|
+
return;
|
|
141567
|
+
}
|
|
141568
|
+
const path = point.dynamicValue?.path;
|
|
141569
|
+
if (!path) {
|
|
141570
|
+
return;
|
|
141571
|
+
}
|
|
141572
|
+
point.label = `{{#each ${path}}}{{lookup this "${point.arrayConfig.labelField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
|
|
141573
|
+
point.value = `{{#each ${path}}}{{lookup this "${point.arrayConfig.valueField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
|
|
141574
|
+
point.dynamicValue = {
|
|
141575
|
+
path,
|
|
141576
|
+
value: point.value
|
|
141577
|
+
};
|
|
141578
|
+
closePopover();
|
|
141579
|
+
}
|
|
141580
|
+
function updateXYDynamicValueExpression(point) {
|
|
141581
|
+
if (!point.selectedXValue || !point.arrayConfig?.labelField || !point.arrayConfig?.xField || !point.arrayConfig?.yField) {
|
|
141582
|
+
return;
|
|
141583
|
+
}
|
|
141584
|
+
const path = point.dynamicXValue?.path;
|
|
141585
|
+
if (!path) {
|
|
141586
|
+
return;
|
|
141587
|
+
}
|
|
141588
|
+
point.label = `{{#each ${path}}}{{lookup this "${point.arrayConfig.labelField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
|
|
141589
|
+
point.xValue = `{{#each ${path}}}{{lookup this "${point.arrayConfig.xField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
|
|
141590
|
+
point.yValue = `{{#each ${path}}}{{lookup this "${point.arrayConfig.yField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
|
|
141591
|
+
point.dynamicXValue = {
|
|
141592
|
+
path,
|
|
141593
|
+
value: point.xValue
|
|
141594
|
+
};
|
|
141595
|
+
point.dynamicYValue = {
|
|
141596
|
+
path,
|
|
141597
|
+
value: point.yValue
|
|
141598
|
+
};
|
|
141599
|
+
closePopover();
|
|
141600
|
+
}
|
|
141146
141601
|
const dynamicValueTreeData = computed(() => {
|
|
141147
141602
|
function processObject(obj, path = []) {
|
|
141148
141603
|
const result = [];
|
|
@@ -141193,24 +141648,49 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141193
141648
|
return h("span", { class: "text-sm" }, { default: () => info.option.label || "" });
|
|
141194
141649
|
}
|
|
141195
141650
|
const activePopoverPoint = ref(null);
|
|
141196
|
-
function handleDynamicValueClick(point) {
|
|
141197
|
-
if (activePopoverPoint.value === point) {
|
|
141198
|
-
|
|
141651
|
+
function handleDynamicValueClick(point, field = "value") {
|
|
141652
|
+
if (activePopoverPoint.value === point && activePopoverField.value === field) {
|
|
141653
|
+
closePopover();
|
|
141199
141654
|
} else {
|
|
141200
|
-
|
|
141201
|
-
|
|
141202
|
-
|
|
141203
|
-
|
|
141655
|
+
if (field === "value") {
|
|
141656
|
+
point.selectedValue = void 0;
|
|
141657
|
+
point.dynamicValue = void 0;
|
|
141658
|
+
point.arrayConfig = void 0;
|
|
141659
|
+
point.value = "";
|
|
141660
|
+
} else if (field === "x") {
|
|
141661
|
+
point.selectedXValue = void 0;
|
|
141662
|
+
point.dynamicXValue = void 0;
|
|
141663
|
+
point.dynamicYValue = void 0;
|
|
141664
|
+
point.arrayConfig = void 0;
|
|
141665
|
+
point.xValue = "";
|
|
141666
|
+
point.yValue = "";
|
|
141667
|
+
point.label = "";
|
|
141668
|
+
} else if (field === "y") {
|
|
141669
|
+
point.selectedYValue = void 0;
|
|
141670
|
+
point.dynamicYValue = void 0;
|
|
141671
|
+
point.yValue = "";
|
|
141672
|
+
}
|
|
141204
141673
|
activePopoverPoint.value = point;
|
|
141674
|
+
activePopoverField.value = field;
|
|
141205
141675
|
}
|
|
141206
141676
|
}
|
|
141207
|
-
function handleDynamicValueSelect(keys, point) {
|
|
141677
|
+
function handleDynamicValueSelect(keys, point, field = "value") {
|
|
141208
141678
|
const selectedKey = keys[0];
|
|
141209
141679
|
if (!selectedKey) {
|
|
141210
|
-
|
|
141211
|
-
|
|
141212
|
-
|
|
141213
|
-
|
|
141680
|
+
if (field === "value") {
|
|
141681
|
+
point.dynamicValue = void 0;
|
|
141682
|
+
point.selectedValue = void 0;
|
|
141683
|
+
point.value = "";
|
|
141684
|
+
} else if (field === "x") {
|
|
141685
|
+
point.dynamicXValue = void 0;
|
|
141686
|
+
point.selectedXValue = void 0;
|
|
141687
|
+
point.xValue = "";
|
|
141688
|
+
} else if (field === "y") {
|
|
141689
|
+
point.dynamicYValue = void 0;
|
|
141690
|
+
point.selectedYValue = void 0;
|
|
141691
|
+
point.yValue = "";
|
|
141692
|
+
}
|
|
141693
|
+
closePopover();
|
|
141214
141694
|
return;
|
|
141215
141695
|
}
|
|
141216
141696
|
const pathParts = selectedKey.split(/\.(?![^[]*])/) || [];
|
|
@@ -141225,6 +141705,59 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141225
141705
|
currentValue = currentValue?.[part];
|
|
141226
141706
|
}
|
|
141227
141707
|
}
|
|
141708
|
+
if (field === "x") {
|
|
141709
|
+
point.selectedXValue = currentValue;
|
|
141710
|
+
if (Array.isArray(currentValue) || typeof currentValue === "object" && currentValue !== null) {
|
|
141711
|
+
point.arrayConfig = {
|
|
141712
|
+
labelField: "",
|
|
141713
|
+
valueField: "",
|
|
141714
|
+
xField: "",
|
|
141715
|
+
yField: ""
|
|
141716
|
+
};
|
|
141717
|
+
point.dynamicXValue = {
|
|
141718
|
+
path: selectedKey,
|
|
141719
|
+
value: ""
|
|
141720
|
+
};
|
|
141721
|
+
return;
|
|
141722
|
+
}
|
|
141723
|
+
const rootPart = pathParts[0];
|
|
141724
|
+
let expression = "";
|
|
141725
|
+
if (pathParts.length === 1) {
|
|
141726
|
+
expression = `{{${rootPart}}}`;
|
|
141727
|
+
} else {
|
|
141728
|
+
const restOfPath = pathParts.slice(1).map((part) => {
|
|
141729
|
+
if (part.includes("[") && part.includes("]")) {
|
|
141730
|
+
return part.split("[")[1].split("]")[0];
|
|
141731
|
+
}
|
|
141732
|
+
return part;
|
|
141733
|
+
});
|
|
141734
|
+
expression = `{{lookup (lookup ${rootPart} ${restOfPath[0]}) "${restOfPath[1]}"}}`;
|
|
141735
|
+
}
|
|
141736
|
+
point.dynamicXValue = { path: selectedKey, value: expression };
|
|
141737
|
+
point.xValue = expression;
|
|
141738
|
+
closePopover();
|
|
141739
|
+
return;
|
|
141740
|
+
}
|
|
141741
|
+
if (field === "y") {
|
|
141742
|
+
point.selectedYValue = currentValue;
|
|
141743
|
+
const rootPart = pathParts[0];
|
|
141744
|
+
let expression = "";
|
|
141745
|
+
if (pathParts.length === 1) {
|
|
141746
|
+
expression = `{{${rootPart}}}`;
|
|
141747
|
+
} else {
|
|
141748
|
+
const restOfPath = pathParts.slice(1).map((part) => {
|
|
141749
|
+
if (part.includes("[") && part.includes("]")) {
|
|
141750
|
+
return part.split("[")[1].split("]")[0];
|
|
141751
|
+
}
|
|
141752
|
+
return part;
|
|
141753
|
+
});
|
|
141754
|
+
expression = `{{lookup (lookup ${rootPart} ${restOfPath[0]}) "${restOfPath[1]}"}}`;
|
|
141755
|
+
}
|
|
141756
|
+
point.dynamicYValue = { path: selectedKey, value: expression };
|
|
141757
|
+
point.yValue = expression;
|
|
141758
|
+
closePopover();
|
|
141759
|
+
return;
|
|
141760
|
+
}
|
|
141228
141761
|
point.selectedValue = currentValue;
|
|
141229
141762
|
if (Array.isArray(currentValue) || typeof currentValue === "object" && currentValue !== null) {
|
|
141230
141763
|
point.arrayConfig = {
|
|
@@ -141254,79 +141787,160 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141254
141787
|
value: expression
|
|
141255
141788
|
};
|
|
141256
141789
|
point.value = expression;
|
|
141257
|
-
|
|
141790
|
+
closePopover();
|
|
141258
141791
|
}
|
|
141259
141792
|
}
|
|
141260
|
-
function
|
|
141261
|
-
|
|
141262
|
-
|
|
141263
|
-
|
|
141264
|
-
|
|
141265
|
-
|
|
141266
|
-
|
|
141793
|
+
function processSeriesData(series) {
|
|
141794
|
+
const isXY = XY_CHART_TYPES.includes(series.chartType);
|
|
141795
|
+
if (isXY) {
|
|
141796
|
+
const processedData2 = {
|
|
141797
|
+
labels: [],
|
|
141798
|
+
values: []
|
|
141799
|
+
};
|
|
141800
|
+
series.dataPoints.forEach((point) => {
|
|
141801
|
+
const x = !isNaN(Number(point.xValue)) ? Number(point.xValue) : 0;
|
|
141802
|
+
const y = !isNaN(Number(point.yValue)) ? Number(point.yValue) : 0;
|
|
141803
|
+
processedData2.labels.push(point.label);
|
|
141804
|
+
if (series.chartType === "bubble") {
|
|
141805
|
+
processedData2.values.push({ x, y, r: Math.max(5, Math.abs(y) / 2) });
|
|
141806
|
+
} else {
|
|
141807
|
+
processedData2.values.push({ x, y });
|
|
141808
|
+
}
|
|
141809
|
+
});
|
|
141810
|
+
return processedData2;
|
|
141267
141811
|
}
|
|
141268
|
-
point.label = `{{#each ${path}}}{{lookup this "${point.arrayConfig.labelField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
|
|
141269
|
-
point.value = `{{#each ${path}}}{{lookup this "${point.arrayConfig.valueField}"}}{{#unless @last}},{{/unless}}{{/each}}`;
|
|
141270
|
-
point.dynamicValue = {
|
|
141271
|
-
path,
|
|
141272
|
-
value: point.value
|
|
141273
|
-
};
|
|
141274
|
-
activePopoverPoint.value = null;
|
|
141275
|
-
}
|
|
141276
|
-
function processChartData() {
|
|
141277
141812
|
const processedData = {
|
|
141278
141813
|
labels: [],
|
|
141279
141814
|
values: []
|
|
141280
141815
|
};
|
|
141281
|
-
dataPoints.
|
|
141816
|
+
series.dataPoints.forEach((point) => {
|
|
141282
141817
|
processedData.labels.push(point.label);
|
|
141283
141818
|
processedData.values.push(!isNaN(Number(point.value)) ? Number(point.value) : 0);
|
|
141284
141819
|
});
|
|
141285
141820
|
return processedData;
|
|
141286
141821
|
}
|
|
141822
|
+
function getSeriesColors(forStorage = false) {
|
|
141823
|
+
if (colorSchemeType.value === "theme") {
|
|
141824
|
+
if (forStorage) {
|
|
141825
|
+
return chartColors.value.map((index) => `palette${index}`);
|
|
141826
|
+
}
|
|
141827
|
+
return chartColors.value.map((index) => {
|
|
141828
|
+
const idx = parseInt(index);
|
|
141829
|
+
return palette.value[idx % palette.value.length];
|
|
141830
|
+
});
|
|
141831
|
+
}
|
|
141832
|
+
return chartColors.value;
|
|
141833
|
+
}
|
|
141287
141834
|
function createChartConfig() {
|
|
141835
|
+
const datasets = [];
|
|
141836
|
+
let allLabels = [];
|
|
141837
|
+
const colorsForStorage = getSeriesColors(true);
|
|
141838
|
+
const isSingleSeries = seriesList.value.length === 1;
|
|
141839
|
+
seriesList.value.forEach((series, index) => {
|
|
141840
|
+
const processedData = processSeriesData(series);
|
|
141841
|
+
let backgroundColor2;
|
|
141842
|
+
let borderColor;
|
|
141843
|
+
if (isSingleSeries) {
|
|
141844
|
+
backgroundColor2 = colorsForStorage;
|
|
141845
|
+
borderColor = [...colorsForStorage];
|
|
141846
|
+
} else {
|
|
141847
|
+
const seriesColor = colorsForStorage[index % colorsForStorage.length];
|
|
141848
|
+
backgroundColor2 = seriesColor;
|
|
141849
|
+
borderColor = seriesColor;
|
|
141850
|
+
}
|
|
141851
|
+
const datasetOptions = {
|
|
141852
|
+
label: series.name,
|
|
141853
|
+
data: processedData.values,
|
|
141854
|
+
background_color: backgroundColor2,
|
|
141855
|
+
border_color: borderColor,
|
|
141856
|
+
borderWidth: 1
|
|
141857
|
+
};
|
|
141858
|
+
if (!isSingleSeries) {
|
|
141859
|
+
if (series.chartType === "area") {
|
|
141860
|
+
datasetOptions.type = "line";
|
|
141861
|
+
datasetOptions.fill = true;
|
|
141862
|
+
datasetOptions.tension = 0.4;
|
|
141863
|
+
} else {
|
|
141864
|
+
datasetOptions.type = series.chartType;
|
|
141865
|
+
}
|
|
141866
|
+
}
|
|
141867
|
+
if (series.chartType === "area") {
|
|
141868
|
+
datasetOptions.fill = true;
|
|
141869
|
+
datasetOptions.tension = 0.4;
|
|
141870
|
+
}
|
|
141871
|
+
if (["line", "scatter", "area"].includes(series.chartType)) {
|
|
141872
|
+
datasetOptions.pointStyle = pointStyle.value;
|
|
141873
|
+
}
|
|
141874
|
+
if (["line", "area"].includes(series.chartType)) {
|
|
141875
|
+
datasetOptions.tension = 0.4;
|
|
141876
|
+
}
|
|
141877
|
+
if (processedData.labels.length > allLabels.length) {
|
|
141878
|
+
allLabels = processedData.labels;
|
|
141879
|
+
}
|
|
141880
|
+
datasets.push(datasetOptions);
|
|
141881
|
+
});
|
|
141882
|
+
const primaryType = seriesList.value[0].chartType;
|
|
141883
|
+
let actualPrimaryType = primaryType;
|
|
141884
|
+
if (primaryType === "area") {
|
|
141885
|
+
actualPrimaryType = "line";
|
|
141886
|
+
}
|
|
141887
|
+
let scales = void 0;
|
|
141888
|
+
const chartTypesWithScales = ["bar", "line", "scatter", "bubble", "area"];
|
|
141889
|
+
if (chartTypesWithScales.includes(primaryType)) {
|
|
141890
|
+
scales = {
|
|
141891
|
+
x: {
|
|
141892
|
+
title: {
|
|
141893
|
+
display: !!xAxisLabel.value,
|
|
141894
|
+
text: xAxisLabel.value
|
|
141895
|
+
}
|
|
141896
|
+
},
|
|
141897
|
+
y: {
|
|
141898
|
+
title: {
|
|
141899
|
+
display: !!yAxisLabel.value,
|
|
141900
|
+
text: yAxisLabel.value
|
|
141901
|
+
},
|
|
141902
|
+
begin_at_zero: true
|
|
141903
|
+
}
|
|
141904
|
+
};
|
|
141905
|
+
} else if (["radar", "polarArea"].includes(primaryType)) {
|
|
141906
|
+
scales = {
|
|
141907
|
+
r: {
|
|
141908
|
+
begin_at_zero: true,
|
|
141909
|
+
ticks: {
|
|
141910
|
+
step_size: 1
|
|
141911
|
+
}
|
|
141912
|
+
}
|
|
141913
|
+
};
|
|
141914
|
+
}
|
|
141915
|
+
const showLegend = seriesList.value.length > 1 || legendPosition.value !== "none";
|
|
141288
141916
|
const config = {
|
|
141289
|
-
type:
|
|
141917
|
+
type: actualPrimaryType,
|
|
141290
141918
|
color_scheme_type: colorSchemeType.value,
|
|
141919
|
+
percent_display: percentDisplay.value,
|
|
141920
|
+
chart_height: chartHeight.value,
|
|
141921
|
+
chart_width: chartWidth.value,
|
|
141922
|
+
view_controls: {
|
|
141923
|
+
enable_fullscreen_btn: enableFullscreenBtn.value,
|
|
141924
|
+
enable_chart_type_switcher: enableChartTypeSwitcher.value,
|
|
141925
|
+
enable_data_entry: enableDataEntry.value
|
|
141926
|
+
},
|
|
141291
141927
|
data: {
|
|
141292
|
-
labels:
|
|
141293
|
-
datasets
|
|
141294
|
-
{
|
|
141295
|
-
label: "Data Series",
|
|
141296
|
-
data: [],
|
|
141297
|
-
background_color: getColors(),
|
|
141298
|
-
border_color: getColors(),
|
|
141299
|
-
border_width: 1,
|
|
141300
|
-
point_style: ["line"].includes(chartType.value) ? pointStyle.value : void 0
|
|
141301
|
-
}
|
|
141302
|
-
]
|
|
141928
|
+
labels: allLabels,
|
|
141929
|
+
datasets
|
|
141303
141930
|
},
|
|
141304
141931
|
options: {
|
|
141305
141932
|
responsive: true,
|
|
141306
141933
|
maintainAspectRatio: false,
|
|
141307
|
-
index_axis: ["bar", "line"].includes(
|
|
141308
|
-
scales
|
|
141309
|
-
x: {
|
|
141310
|
-
title: {
|
|
141311
|
-
display: !!xAxisLabel.value,
|
|
141312
|
-
text: xAxisLabel.value
|
|
141313
|
-
}
|
|
141314
|
-
},
|
|
141315
|
-
y: {
|
|
141316
|
-
title: {
|
|
141317
|
-
display: !!yAxisLabel.value,
|
|
141318
|
-
text: yAxisLabel.value
|
|
141319
|
-
}
|
|
141320
|
-
}
|
|
141321
|
-
} : void 0,
|
|
141934
|
+
index_axis: ["bar", "line"].includes(primaryType) ? orientation.value : void 0,
|
|
141935
|
+
scales,
|
|
141322
141936
|
plugins: {
|
|
141323
141937
|
title: {
|
|
141324
141938
|
display: !!chartTitle.value,
|
|
141325
141939
|
text: chartTitle.value
|
|
141326
141940
|
},
|
|
141327
141941
|
legend: {
|
|
141328
|
-
display:
|
|
141329
|
-
position: legendPosition.value,
|
|
141942
|
+
display: showLegend,
|
|
141943
|
+
position: legendPosition.value !== "none" ? legendPosition.value : "top",
|
|
141330
141944
|
labels: {
|
|
141331
141945
|
usePointStyle: true
|
|
141332
141946
|
}
|
|
@@ -141336,14 +141950,25 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141336
141950
|
duration: enableAnimation.value ? 1e3 : 0
|
|
141337
141951
|
}
|
|
141338
141952
|
},
|
|
141339
|
-
|
|
141340
|
-
|
|
141341
|
-
|
|
141342
|
-
|
|
141953
|
+
// Save series data for editing
|
|
141954
|
+
series: seriesList.value.map((series) => ({
|
|
141955
|
+
id: series.id,
|
|
141956
|
+
name: series.name,
|
|
141957
|
+
chart_type: series.chartType,
|
|
141958
|
+
data_points: series.dataPoints.map((point) => ({
|
|
141959
|
+
label: point.label,
|
|
141960
|
+
value: point.value,
|
|
141961
|
+
x_value: point.xValue,
|
|
141962
|
+
y_value: point.yValue,
|
|
141963
|
+
dynamic_value: point.dynamicValue,
|
|
141964
|
+
dynamic_x_value: point.dynamicXValue,
|
|
141965
|
+
dynamic_y_value: point.dynamicYValue,
|
|
141966
|
+
array_config: point.arrayConfig
|
|
141967
|
+
}))
|
|
141968
|
+
})),
|
|
141969
|
+
// Store the primary chart type for reference
|
|
141970
|
+
_primary_chart_type: primaryType
|
|
141343
141971
|
};
|
|
141344
|
-
const processedData = processChartData();
|
|
141345
|
-
config.data.labels = processedData.labels;
|
|
141346
|
-
config.data.datasets[0].data = processedData.values;
|
|
141347
141972
|
return config;
|
|
141348
141973
|
}
|
|
141349
141974
|
function onCancel() {
|
|
@@ -141371,9 +141996,14 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141371
141996
|
},
|
|
141372
141997
|
{ immediate: true }
|
|
141373
141998
|
);
|
|
141999
|
+
watch(isMultiSeries, (multiSeries) => {
|
|
142000
|
+
if (multiSeries) {
|
|
142001
|
+
enableChartTypeSwitcher.value = false;
|
|
142002
|
+
}
|
|
142003
|
+
});
|
|
141374
142004
|
watch(
|
|
141375
142005
|
[
|
|
141376
|
-
|
|
142006
|
+
seriesList,
|
|
141377
142007
|
chartColors,
|
|
141378
142008
|
colorSchemeType,
|
|
141379
142009
|
chartTitle,
|
|
@@ -141382,7 +142012,12 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141382
142012
|
yAxisLabel,
|
|
141383
142013
|
orientation,
|
|
141384
142014
|
pointStyle,
|
|
141385
|
-
|
|
142015
|
+
percentDisplay,
|
|
142016
|
+
enableFullscreenBtn,
|
|
142017
|
+
enableChartTypeSwitcher,
|
|
142018
|
+
enableDataEntry,
|
|
142019
|
+
chartHeight,
|
|
142020
|
+
chartWidth
|
|
141386
142021
|
],
|
|
141387
142022
|
() => {
|
|
141388
142023
|
updatePreview();
|
|
@@ -141408,10 +142043,10 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141408
142043
|
"--n-padding-left": "16px"
|
|
141409
142044
|
}]),
|
|
141410
142045
|
title: unref(t)("canvasUI.canvasBuilder.dataCharts.editDataChartsComponent"),
|
|
141411
|
-
onClose: _cache[
|
|
142046
|
+
onClose: _cache[16] || (_cache[16] = ($event) => unref(setComponentEditMode)(false))
|
|
141412
142047
|
}, {
|
|
141413
142048
|
footer: withCtx(() => [
|
|
141414
|
-
createElementVNode("div",
|
|
142049
|
+
createElementVNode("div", _hoisted_84, [
|
|
141415
142050
|
createVNode(CButton, { onClick: onCancel }, {
|
|
141416
142051
|
default: withCtx(() => [
|
|
141417
142052
|
createTextVNode(toDisplayString(unref(t)("canvasUI.common.cancel")), 1)
|
|
@@ -141449,69 +142084,66 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141449
142084
|
createElementVNode("div", _hoisted_2$1t, [
|
|
141450
142085
|
createElementVNode("div", _hoisted_3$17, [
|
|
141451
142086
|
createElementVNode("div", _hoisted_4$X, [
|
|
141452
|
-
createElementVNode("div", _hoisted_5$O,
|
|
141453
|
-
|
|
141454
|
-
|
|
141455
|
-
|
|
141456
|
-
|
|
141457
|
-
|
|
141458
|
-
|
|
142087
|
+
createElementVNode("div", _hoisted_5$O, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.dataSettings")), 1),
|
|
142088
|
+
createElementVNode("div", _hoisted_6$H, [
|
|
142089
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(seriesList.value, (series, index) => {
|
|
142090
|
+
return openBlock(), createElementBlock("div", {
|
|
142091
|
+
key: series.id,
|
|
142092
|
+
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", [
|
|
142093
|
+
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"
|
|
142094
|
+
]]),
|
|
142095
|
+
onClick: ($event) => activeSeriesIndex.value = index
|
|
142096
|
+
}, [
|
|
142097
|
+
createElementVNode("span", _hoisted_8$q, toDisplayString(series.name), 1),
|
|
142098
|
+
index > 0 ? (openBlock(), createElementBlock("div", {
|
|
142099
|
+
key: 0,
|
|
142100
|
+
class: "ml-1 p-0.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600",
|
|
142101
|
+
onClick: withModifiers(($event) => removeSeries(index), ["stop"])
|
|
142102
|
+
}, [
|
|
142103
|
+
createVNode(CIcon, {
|
|
142104
|
+
class: "text-gray-500",
|
|
142105
|
+
icon: "times",
|
|
142106
|
+
size: 10
|
|
142107
|
+
})
|
|
142108
|
+
], 8, _hoisted_9$m)) : createCommentVNode("", true)
|
|
142109
|
+
], 10, _hoisted_7$v);
|
|
142110
|
+
}), 128)),
|
|
142111
|
+
canAddSeries.value ? (openBlock(), createElementBlock("button", {
|
|
142112
|
+
key: 0,
|
|
142113
|
+
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",
|
|
142114
|
+
title: unref(t)("canvasUI.canvasBuilder.dataCharts.addSeries"),
|
|
142115
|
+
onClick: addSeries
|
|
142116
|
+
}, [
|
|
142117
|
+
createVNode(CIcon, {
|
|
142118
|
+
icon: "plus",
|
|
142119
|
+
size: 14
|
|
142120
|
+
})
|
|
142121
|
+
], 8, _hoisted_10$h)) : createCommentVNode("", true)
|
|
141459
142122
|
]),
|
|
141460
|
-
|
|
141461
|
-
createElementVNode("
|
|
141462
|
-
createElementVNode("label", _hoisted_8$q, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.xAxisLabel")), 1),
|
|
141463
|
-
createVNode(unref(NInput), {
|
|
141464
|
-
value: xAxisLabel.value,
|
|
141465
|
-
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => xAxisLabel.value = $event),
|
|
141466
|
-
type: "text"
|
|
141467
|
-
}, null, 8, ["value"])
|
|
141468
|
-
]),
|
|
141469
|
-
createElementVNode("div", _hoisted_9$m, [
|
|
141470
|
-
createElementVNode("label", _hoisted_10$h, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.yAxisLabel")), 1),
|
|
141471
|
-
createVNode(unref(NInput), {
|
|
141472
|
-
value: yAxisLabel.value,
|
|
141473
|
-
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => yAxisLabel.value = $event),
|
|
141474
|
-
type: "text"
|
|
141475
|
-
}, null, 8, ["value"])
|
|
141476
|
-
]),
|
|
141477
|
-
createElementVNode("div", _hoisted_11$f, [
|
|
141478
|
-
createElementVNode("label", _hoisted_12$b, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.orientation")), 1),
|
|
141479
|
-
createVNode(unref(NSelect), {
|
|
141480
|
-
value: orientation.value,
|
|
141481
|
-
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => orientation.value = $event),
|
|
141482
|
-
options: orientationOptions
|
|
141483
|
-
}, null, 8, ["value"])
|
|
141484
|
-
]),
|
|
141485
|
-
["line", "radar"].includes(chartType.value) ? (openBlock(), createElementBlock("div", _hoisted_13$a, [
|
|
141486
|
-
createElementVNode("label", _hoisted_14$9, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.pointStyle")), 1),
|
|
141487
|
-
createVNode(unref(NSelect), {
|
|
141488
|
-
value: pointStyle.value,
|
|
141489
|
-
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => pointStyle.value = $event),
|
|
141490
|
-
options: pointStyleOptions
|
|
141491
|
-
}, null, 8, ["value"])
|
|
141492
|
-
])) : createCommentVNode("", true)
|
|
141493
|
-
], 64)) : createCommentVNode("", true),
|
|
141494
|
-
createElementVNode("div", _hoisted_15$8, [
|
|
141495
|
-
createElementVNode("label", _hoisted_16$8, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartTitle")), 1),
|
|
142123
|
+
seriesList.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_11$f, [
|
|
142124
|
+
createElementVNode("label", _hoisted_12$b, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.seriesName")), 1),
|
|
141496
142125
|
createVNode(unref(NInput), {
|
|
141497
|
-
value:
|
|
141498
|
-
"onUpdate:value": _cache[
|
|
142126
|
+
value: activeSeries.value.name,
|
|
142127
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => activeSeries.value.name = $event),
|
|
141499
142128
|
type: "text"
|
|
141500
142129
|
}, null, 8, ["value"])
|
|
141501
|
-
]),
|
|
141502
|
-
["pie", "doughnut", "polarArea"].includes(chartType.value) ? (openBlock(), createElementBlock("div", _hoisted_17$7, [
|
|
141503
|
-
createElementVNode("label", _hoisted_18$6, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.legendPosition")), 1),
|
|
141504
|
-
createVNode(unref(NSelect), {
|
|
141505
|
-
value: legendPosition.value,
|
|
141506
|
-
"onUpdate:value": _cache[6] || (_cache[6] = ($event) => legendPosition.value = $event),
|
|
141507
|
-
options: legendPositionOptions
|
|
141508
|
-
}, null, 8, ["value"])
|
|
141509
142130
|
])) : createCommentVNode("", true),
|
|
141510
|
-
createElementVNode("div",
|
|
141511
|
-
createElementVNode("
|
|
141512
|
-
|
|
142131
|
+
createElementVNode("div", _hoisted_13$a, [
|
|
142132
|
+
createElementVNode("label", _hoisted_14$9, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartType")), 1),
|
|
142133
|
+
createVNode(unref(NSelect), {
|
|
142134
|
+
value: activeSeries.value.chartType,
|
|
142135
|
+
"onUpdate:value": [
|
|
142136
|
+
_cache[1] || (_cache[1] = ($event) => activeSeries.value.chartType = $event),
|
|
142137
|
+
onChartTypeChange
|
|
142138
|
+
],
|
|
142139
|
+
options: availableChartTypeOptions.value
|
|
142140
|
+
}, null, 8, ["value", "options"])
|
|
142141
|
+
]),
|
|
142142
|
+
createElementVNode("div", _hoisted_15$8, [
|
|
142143
|
+
createElementVNode("div", _hoisted_16$8, [
|
|
142144
|
+
createElementVNode("label", _hoisted_17$7, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.dataPoints")), 1),
|
|
141513
142145
|
createVNode(unref(Button), {
|
|
141514
|
-
disabled: !
|
|
142146
|
+
disabled: !activeSeries.value.dataPoints.length,
|
|
141515
142147
|
size: "small",
|
|
141516
142148
|
onClick: removeAllDataPoints
|
|
141517
142149
|
}, {
|
|
@@ -141521,205 +142153,248 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141521
142153
|
_: 1
|
|
141522
142154
|
}, 8, ["disabled"])
|
|
141523
142155
|
]),
|
|
141524
|
-
(openBlock(true), createElementBlock(Fragment,
|
|
142156
|
+
!isActiveSeriesXYChart.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(activeSeries.value.dataPoints, (point, index) => {
|
|
141525
142157
|
return openBlock(), createElementBlock("div", {
|
|
141526
142158
|
key: index,
|
|
141527
142159
|
class: "flex gap-2 mb-2"
|
|
141528
142160
|
}, [
|
|
141529
|
-
|
|
141530
|
-
|
|
141531
|
-
|
|
142161
|
+
createVNode(unref(NInput), {
|
|
142162
|
+
value: point.label,
|
|
142163
|
+
"onUpdate:value": ($event) => point.label = $event,
|
|
142164
|
+
class: "flex-1",
|
|
142165
|
+
disabled: !!point.arrayConfig,
|
|
142166
|
+
placeholder: "Label"
|
|
142167
|
+
}, null, 8, ["value", "onUpdate:value", "disabled"]),
|
|
142168
|
+
createVNode(unref(NInput), {
|
|
142169
|
+
value: point.value,
|
|
142170
|
+
"onUpdate:value": ($event) => point.value = $event,
|
|
142171
|
+
class: "flex-1",
|
|
142172
|
+
disabled: !!point.dynamicValue,
|
|
142173
|
+
placeholder: "Value",
|
|
142174
|
+
type: "text"
|
|
141532
142175
|
}, {
|
|
141533
|
-
|
|
141534
|
-
createVNode(unref(
|
|
141535
|
-
|
|
141536
|
-
|
|
141537
|
-
|
|
141538
|
-
|
|
141539
|
-
|
|
141540
|
-
|
|
142176
|
+
suffix: withCtx(() => [
|
|
142177
|
+
createVNode(unref(NPopover), {
|
|
142178
|
+
placement: "bottom",
|
|
142179
|
+
show: activePopoverPoint.value === point && activePopoverField.value === "value",
|
|
142180
|
+
trigger: "manual",
|
|
142181
|
+
onClickoutside: closePopover
|
|
142182
|
+
}, {
|
|
142183
|
+
trigger: withCtx(() => [
|
|
142184
|
+
createElementVNode("div", {
|
|
142185
|
+
class: "cursor-pointer flex items-center",
|
|
142186
|
+
onClick: ($event) => handleDynamicValueClick(point, "value")
|
|
142187
|
+
}, [
|
|
142188
|
+
createVNode(CIcon, {
|
|
142189
|
+
class: normalizeClass(point.dynamicValue ? "text-blue-500" : ""),
|
|
142190
|
+
icon: "caret-down"
|
|
142191
|
+
}, null, 8, ["class"])
|
|
142192
|
+
], 8, _hoisted_18$6)
|
|
142193
|
+
]),
|
|
142194
|
+
default: withCtx(() => [
|
|
142195
|
+
createElementVNode("div", _hoisted_19$6, [
|
|
142196
|
+
createElementVNode("div", _hoisted_20$5, [
|
|
142197
|
+
createElementVNode("div", _hoisted_21$5, [
|
|
142198
|
+
createElementVNode("div", _hoisted_22$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
|
|
142199
|
+
createElementVNode("div", _hoisted_23$3, [
|
|
142200
|
+
createVNode(unref(NTree), {
|
|
142201
|
+
"block-line": "",
|
|
142202
|
+
class: "max-h-[300px]",
|
|
142203
|
+
data: dynamicValueTreeData.value,
|
|
142204
|
+
"render-label": renderDynamicValueTreeLabel,
|
|
142205
|
+
"selected-keys": [point.dynamicValue?.path ?? ""],
|
|
142206
|
+
"onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point, "value")
|
|
142207
|
+
}, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
|
|
142208
|
+
])
|
|
142209
|
+
]),
|
|
142210
|
+
point.selectedValue && point.arrayConfig && isArrayOrObject(point.selectedValue) ? (openBlock(), createElementBlock("div", _hoisted_24$3, [
|
|
142211
|
+
createElementVNode("div", _hoisted_25$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.configureArrayObjectFields")), 1),
|
|
142212
|
+
createElementVNode("div", _hoisted_26$3, [
|
|
142213
|
+
createElementVNode("div", null, [
|
|
142214
|
+
createElementVNode("label", _hoisted_27$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.labelField")), 1),
|
|
142215
|
+
createVNode(unref(NSelect), {
|
|
142216
|
+
value: point.arrayConfig.labelField,
|
|
142217
|
+
"onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateDynamicValueExpression(point)],
|
|
142218
|
+
options: getFieldOptions(point.selectedValue)
|
|
142219
|
+
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
142220
|
+
]),
|
|
142221
|
+
createElementVNode("div", null, [
|
|
142222
|
+
createElementVNode("label", _hoisted_28$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.valueField")), 1),
|
|
142223
|
+
createVNode(unref(NSelect), {
|
|
142224
|
+
value: point.arrayConfig.valueField,
|
|
142225
|
+
"onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
|
|
142226
|
+
options: getFieldOptions(point.selectedValue)
|
|
142227
|
+
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
142228
|
+
])
|
|
142229
|
+
])
|
|
142230
|
+
])) : createCommentVNode("", true)
|
|
142231
|
+
])
|
|
142232
|
+
])
|
|
142233
|
+
]),
|
|
142234
|
+
_: 2
|
|
142235
|
+
}, 1032, ["show"])
|
|
141541
142236
|
]),
|
|
141542
|
-
|
|
141543
|
-
|
|
142237
|
+
_: 2
|
|
142238
|
+
}, 1032, ["value", "onUpdate:value", "disabled"]),
|
|
142239
|
+
createVNode(CButton, {
|
|
142240
|
+
circle: "",
|
|
142241
|
+
class: "bg-error2 self-center",
|
|
142242
|
+
size: "small",
|
|
142243
|
+
style: normalizeStyle(deleteButtonStyle.value),
|
|
142244
|
+
type: "error",
|
|
142245
|
+
onClick: ($event) => removeDataPoint(index)
|
|
142246
|
+
}, {
|
|
142247
|
+
icon: withCtx(() => [
|
|
142248
|
+
createVNode(CIcon, {
|
|
142249
|
+
class: "color-error",
|
|
142250
|
+
"fa-type": "far",
|
|
142251
|
+
icon: "trash",
|
|
142252
|
+
size: 12
|
|
142253
|
+
})
|
|
141544
142254
|
]),
|
|
141545
142255
|
_: 2
|
|
141546
|
-
},
|
|
141547
|
-
|
|
142256
|
+
}, 1032, ["style", "onClick"])
|
|
142257
|
+
]);
|
|
142258
|
+
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(activeSeries.value.dataPoints, (point, index) => {
|
|
142259
|
+
return openBlock(), createElementBlock("div", {
|
|
142260
|
+
key: index,
|
|
142261
|
+
class: "flex gap-2 mb-2"
|
|
142262
|
+
}, [
|
|
142263
|
+
createVNode(unref(NInput), {
|
|
141548
142264
|
value: point.label,
|
|
141549
142265
|
"onUpdate:value": ($event) => point.label = $event,
|
|
141550
142266
|
class: "flex-1",
|
|
142267
|
+
disabled: !!point.arrayConfig,
|
|
141551
142268
|
placeholder: "Label"
|
|
141552
|
-
}, null, 8, ["value", "onUpdate:value"])
|
|
141553
|
-
|
|
141554
|
-
point.
|
|
141555
|
-
|
|
141556
|
-
|
|
141557
|
-
|
|
141558
|
-
|
|
141559
|
-
|
|
141560
|
-
|
|
141561
|
-
|
|
141562
|
-
|
|
141563
|
-
|
|
141564
|
-
|
|
141565
|
-
|
|
141566
|
-
|
|
141567
|
-
|
|
141568
|
-
|
|
141569
|
-
|
|
141570
|
-
|
|
141571
|
-
|
|
141572
|
-
|
|
141573
|
-
|
|
141574
|
-
|
|
141575
|
-
|
|
141576
|
-
|
|
141577
|
-
|
|
141578
|
-
|
|
141579
|
-
|
|
141580
|
-
|
|
141581
|
-
|
|
141582
|
-
|
|
141583
|
-
|
|
141584
|
-
|
|
141585
|
-
|
|
141586
|
-
|
|
141587
|
-
|
|
141588
|
-
|
|
141589
|
-
|
|
141590
|
-
|
|
141591
|
-
|
|
141592
|
-
|
|
141593
|
-
class: "max-h-[300px]",
|
|
141594
|
-
data: dynamicValueTreeData.value,
|
|
141595
|
-
"render-label": renderDynamicValueTreeLabel,
|
|
141596
|
-
"selected-keys": [point.dynamicValue?.path ?? ""],
|
|
141597
|
-
"onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point)
|
|
141598
|
-
}, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
|
|
141599
|
-
])
|
|
141600
|
-
]),
|
|
141601
|
-
point.selectedValue && point.arrayConfig && (Array.isArray(point.selectedValue) || typeof point.selectedValue === "object" && point.selectedValue !== null) ? (openBlock(), createElementBlock("div", _hoisted_29$3, [
|
|
141602
|
-
createElementVNode("div", _hoisted_30$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.configureArrayObjectFields")), 1),
|
|
141603
|
-
createElementVNode("div", _hoisted_31$3, [
|
|
141604
|
-
createElementVNode("div", null, [
|
|
141605
|
-
createElementVNode("label", _hoisted_32$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.labelField")), 1),
|
|
141606
|
-
createVNode(unref(NSelect), {
|
|
141607
|
-
value: point.arrayConfig.labelField,
|
|
141608
|
-
"onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateDynamicValueExpression(point)],
|
|
141609
|
-
options: getFieldOptions(point.selectedValue)
|
|
141610
|
-
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
141611
|
-
]),
|
|
141612
|
-
createElementVNode("div", null, [
|
|
141613
|
-
createElementVNode("label", _hoisted_33$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.valueField")), 1),
|
|
141614
|
-
createVNode(unref(NSelect), {
|
|
141615
|
-
value: point.arrayConfig.valueField,
|
|
141616
|
-
"onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
|
|
141617
|
-
options: getFieldOptions(point.selectedValue)
|
|
141618
|
-
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
141619
|
-
])
|
|
141620
|
-
])
|
|
141621
|
-
])) : createCommentVNode("", true)
|
|
141622
|
-
])
|
|
142269
|
+
}, null, 8, ["value", "onUpdate:value", "disabled"]),
|
|
142270
|
+
createVNode(unref(NInput), {
|
|
142271
|
+
value: point.xValue,
|
|
142272
|
+
"onUpdate:value": ($event) => point.xValue = $event,
|
|
142273
|
+
class: "flex-1",
|
|
142274
|
+
disabled: !!point.dynamicXValue,
|
|
142275
|
+
placeholder: "X Value",
|
|
142276
|
+
type: "text"
|
|
142277
|
+
}, {
|
|
142278
|
+
suffix: withCtx(() => [
|
|
142279
|
+
createVNode(unref(NPopover), {
|
|
142280
|
+
placement: "bottom",
|
|
142281
|
+
show: activePopoverPoint.value === point && activePopoverField.value === "x",
|
|
142282
|
+
trigger: "manual",
|
|
142283
|
+
onClickoutside: closePopover
|
|
142284
|
+
}, {
|
|
142285
|
+
trigger: withCtx(() => [
|
|
142286
|
+
createElementVNode("div", {
|
|
142287
|
+
class: "cursor-pointer flex items-center",
|
|
142288
|
+
onClick: ($event) => handleDynamicValueClick(point, "x")
|
|
142289
|
+
}, [
|
|
142290
|
+
createVNode(CIcon, {
|
|
142291
|
+
class: normalizeClass(point.dynamicXValue ? "text-blue-500" : ""),
|
|
142292
|
+
icon: "caret-down"
|
|
142293
|
+
}, null, 8, ["class"])
|
|
142294
|
+
], 8, _hoisted_29$3)
|
|
142295
|
+
]),
|
|
142296
|
+
default: withCtx(() => [
|
|
142297
|
+
createElementVNode("div", _hoisted_30$3, [
|
|
142298
|
+
createElementVNode("div", _hoisted_31$3, [
|
|
142299
|
+
createElementVNode("div", _hoisted_32$3, [
|
|
142300
|
+
createElementVNode("div", _hoisted_33$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
|
|
142301
|
+
createElementVNode("div", _hoisted_34$3, [
|
|
142302
|
+
createVNode(unref(NTree), {
|
|
142303
|
+
"block-line": "",
|
|
142304
|
+
class: "max-h-[300px]",
|
|
142305
|
+
data: dynamicValueTreeData.value,
|
|
142306
|
+
"render-label": renderDynamicValueTreeLabel,
|
|
142307
|
+
"selected-keys": [point.dynamicXValue?.path ?? ""],
|
|
142308
|
+
"onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point, "x")
|
|
142309
|
+
}, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
|
|
141623
142310
|
])
|
|
141624
142311
|
]),
|
|
141625
|
-
|
|
141626
|
-
|
|
141627
|
-
]),
|
|
141628
|
-
_: 2
|
|
141629
|
-
}, 1032, ["value", "onUpdate:value", "disabled"])
|
|
141630
|
-
]),
|
|
141631
|
-
default: withCtx(() => [
|
|
141632
|
-
createTextVNode(" " + toDisplayString(point.value), 1)
|
|
141633
|
-
]),
|
|
141634
|
-
_: 2
|
|
141635
|
-
}, 1024)) : (openBlock(), createBlock(unref(NInput), {
|
|
141636
|
-
key: 1,
|
|
141637
|
-
value: point.value,
|
|
141638
|
-
"onUpdate:value": ($event) => point.value = $event,
|
|
141639
|
-
class: "flex-1",
|
|
141640
|
-
disabled: !!point.dynamicValue,
|
|
141641
|
-
placeholder: "Value",
|
|
141642
|
-
type: "text"
|
|
141643
|
-
}, {
|
|
141644
|
-
suffix: withCtx(() => [
|
|
141645
|
-
createVNode(unref(NPopover), {
|
|
141646
|
-
placement: "bottom",
|
|
141647
|
-
show: activePopoverPoint.value === point,
|
|
141648
|
-
trigger: "manual",
|
|
141649
|
-
onClickoutside: _cache[8] || (_cache[8] = ($event) => activePopoverPoint.value = null)
|
|
141650
|
-
}, {
|
|
141651
|
-
trigger: withCtx(() => [
|
|
141652
|
-
createElementVNode("div", {
|
|
141653
|
-
class: "cursor-pointer flex items-center",
|
|
141654
|
-
onClick: ($event) => handleDynamicValueClick(point)
|
|
141655
|
-
}, [
|
|
141656
|
-
createVNode(CIcon, {
|
|
141657
|
-
class: normalizeClass(point.dynamicValue ? "text-blue-500" : ""),
|
|
141658
|
-
icon: "caret-down"
|
|
141659
|
-
}, null, 8, ["class"])
|
|
141660
|
-
], 8, _hoisted_34$3)
|
|
141661
|
-
]),
|
|
141662
|
-
default: withCtx(() => [
|
|
141663
|
-
createElementVNode("div", _hoisted_35$3, [
|
|
141664
|
-
createElementVNode("div", _hoisted_36$3, [
|
|
142312
|
+
point.selectedXValue && point.arrayConfig && isArrayOrObject(point.selectedXValue) ? (openBlock(), createElementBlock("div", _hoisted_35$3, [
|
|
142313
|
+
createElementVNode("div", _hoisted_36$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.configureArrayObjectFields")), 1),
|
|
141665
142314
|
createElementVNode("div", _hoisted_37$3, [
|
|
141666
|
-
createElementVNode("div",
|
|
141667
|
-
|
|
141668
|
-
createVNode(unref(
|
|
141669
|
-
|
|
141670
|
-
|
|
141671
|
-
|
|
141672
|
-
|
|
141673
|
-
|
|
141674
|
-
|
|
141675
|
-
|
|
141676
|
-
|
|
141677
|
-
|
|
141678
|
-
|
|
141679
|
-
|
|
141680
|
-
|
|
141681
|
-
|
|
141682
|
-
|
|
141683
|
-
|
|
141684
|
-
|
|
141685
|
-
|
|
141686
|
-
|
|
141687
|
-
|
|
141688
|
-
])
|
|
141689
|
-
createElementVNode("div", null, [
|
|
141690
|
-
_cache[13] || (_cache[13] = createElementVNode("label", { class: "block mb-1 text-sm" }, "Value Field", -1)),
|
|
141691
|
-
createVNode(unref(NSelect), {
|
|
141692
|
-
value: point.arrayConfig.valueField,
|
|
141693
|
-
"onUpdate:value": [($event) => point.arrayConfig.valueField = $event, ($event) => updateDynamicValueExpression(point)],
|
|
141694
|
-
options: getFieldOptions(point.selectedValue)
|
|
141695
|
-
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
141696
|
-
])
|
|
142315
|
+
createElementVNode("div", null, [
|
|
142316
|
+
createElementVNode("label", _hoisted_38$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.labelField")), 1),
|
|
142317
|
+
createVNode(unref(NSelect), {
|
|
142318
|
+
value: point.arrayConfig.labelField,
|
|
142319
|
+
"onUpdate:value": [($event) => point.arrayConfig.labelField = $event, ($event) => updateXYDynamicValueExpression(point)],
|
|
142320
|
+
options: getFieldOptions(point.selectedXValue)
|
|
142321
|
+
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
142322
|
+
]),
|
|
142323
|
+
createElementVNode("div", null, [
|
|
142324
|
+
createElementVNode("label", _hoisted_39$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.xValueField")), 1),
|
|
142325
|
+
createVNode(unref(NSelect), {
|
|
142326
|
+
value: point.arrayConfig.xField,
|
|
142327
|
+
"onUpdate:value": [($event) => point.arrayConfig.xField = $event, ($event) => updateXYDynamicValueExpression(point)],
|
|
142328
|
+
options: getFieldOptions(point.selectedXValue)
|
|
142329
|
+
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
142330
|
+
]),
|
|
142331
|
+
createElementVNode("div", null, [
|
|
142332
|
+
createElementVNode("label", _hoisted_40$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.yValueField")), 1),
|
|
142333
|
+
createVNode(unref(NSelect), {
|
|
142334
|
+
value: point.arrayConfig.yField,
|
|
142335
|
+
"onUpdate:value": [($event) => point.arrayConfig.yField = $event, ($event) => updateXYDynamicValueExpression(point)],
|
|
142336
|
+
options: getFieldOptions(point.selectedXValue)
|
|
142337
|
+
}, null, 8, ["value", "onUpdate:value", "options"])
|
|
141697
142338
|
])
|
|
141698
|
-
])
|
|
141699
|
-
])
|
|
142339
|
+
])
|
|
142340
|
+
])) : createCommentVNode("", true)
|
|
141700
142341
|
])
|
|
141701
|
-
])
|
|
141702
|
-
|
|
141703
|
-
|
|
141704
|
-
])
|
|
141705
|
-
|
|
141706
|
-
|
|
141707
|
-
]),
|
|
142342
|
+
])
|
|
142343
|
+
]),
|
|
142344
|
+
_: 2
|
|
142345
|
+
}, 1032, ["show"])
|
|
142346
|
+
]),
|
|
142347
|
+
_: 2
|
|
142348
|
+
}, 1032, ["value", "onUpdate:value", "disabled"]),
|
|
142349
|
+
createVNode(unref(NInput), {
|
|
142350
|
+
value: point.yValue,
|
|
142351
|
+
"onUpdate:value": ($event) => point.yValue = $event,
|
|
142352
|
+
class: "flex-1",
|
|
142353
|
+
disabled: !!point.dynamicYValue,
|
|
142354
|
+
placeholder: "Y Value",
|
|
142355
|
+
type: "text"
|
|
142356
|
+
}, {
|
|
142357
|
+
suffix: withCtx(() => [
|
|
142358
|
+
createVNode(unref(NPopover), {
|
|
142359
|
+
placement: "bottom",
|
|
142360
|
+
show: activePopoverPoint.value === point && activePopoverField.value === "y",
|
|
142361
|
+
trigger: "manual",
|
|
142362
|
+
onClickoutside: closePopover
|
|
142363
|
+
}, {
|
|
142364
|
+
trigger: withCtx(() => [
|
|
142365
|
+
createElementVNode("div", {
|
|
142366
|
+
class: "cursor-pointer flex items-center",
|
|
142367
|
+
onClick: ($event) => handleDynamicValueClick(point, "y")
|
|
142368
|
+
}, [
|
|
142369
|
+
createVNode(CIcon, {
|
|
142370
|
+
class: normalizeClass(point.dynamicYValue ? "text-blue-500" : ""),
|
|
142371
|
+
icon: "caret-down"
|
|
142372
|
+
}, null, 8, ["class"])
|
|
142373
|
+
], 8, _hoisted_41$3)
|
|
142374
|
+
]),
|
|
142375
|
+
default: withCtx(() => [
|
|
142376
|
+
createElementVNode("div", _hoisted_42$3, [
|
|
142377
|
+
createElementVNode("div", _hoisted_43$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.selectDynamicValue")), 1),
|
|
142378
|
+
createVNode(unref(NTree), {
|
|
142379
|
+
"block-line": "",
|
|
142380
|
+
class: "max-h-[300px]",
|
|
142381
|
+
data: dynamicValueTreeData.value,
|
|
142382
|
+
"render-label": renderDynamicValueTreeLabel,
|
|
142383
|
+
"selected-keys": [point.dynamicYValue?.path ?? ""],
|
|
142384
|
+
"onUpdate:selectedKeys": (keys) => handleDynamicValueSelect(keys, point, "y")
|
|
142385
|
+
}, null, 8, ["data", "selected-keys", "onUpdate:selectedKeys"])
|
|
142386
|
+
])
|
|
142387
|
+
]),
|
|
142388
|
+
_: 2
|
|
142389
|
+
}, 1032, ["show"])
|
|
142390
|
+
]),
|
|
142391
|
+
_: 2
|
|
142392
|
+
}, 1032, ["value", "onUpdate:value", "disabled"]),
|
|
141708
142393
|
createVNode(CButton, {
|
|
141709
142394
|
circle: "",
|
|
141710
142395
|
class: "bg-error2 self-center",
|
|
141711
142396
|
size: "small",
|
|
141712
|
-
style: normalizeStyle(
|
|
141713
|
-
"--n-border": "1px solid transparent",
|
|
141714
|
-
"--n-border-disabled": "1px solid transparent",
|
|
141715
|
-
"--n-border-focus": "1px solid transparent",
|
|
141716
|
-
"--n-border-hover": "1px solid transparent",
|
|
141717
|
-
"--n-border-pressed": "1px solid transparent",
|
|
141718
|
-
"--n-color-focus": unref(themeVars).error2,
|
|
141719
|
-
"--n-color-hover": unref(themeVars).error2,
|
|
141720
|
-
"--n-color-disabled": unref(themeVars).error2,
|
|
141721
|
-
"--n-color-pressed": unref(themeVars).error2
|
|
141722
|
-
}),
|
|
142397
|
+
style: normalizeStyle(deleteButtonStyle.value),
|
|
141723
142398
|
type: "error",
|
|
141724
142399
|
onClick: ($event) => removeDataPoint(index)
|
|
141725
142400
|
}, {
|
|
@@ -141735,7 +142410,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141735
142410
|
}, 1032, ["style", "onClick"])
|
|
141736
142411
|
]);
|
|
141737
142412
|
}), 128)),
|
|
141738
|
-
createElementVNode("div",
|
|
142413
|
+
createElementVNode("div", _hoisted_44$3, [
|
|
141739
142414
|
createVNode(CButton, {
|
|
141740
142415
|
class: "mt-2",
|
|
141741
142416
|
"icon-placement": "left",
|
|
@@ -141755,11 +142430,62 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141755
142430
|
})
|
|
141756
142431
|
])
|
|
141757
142432
|
]),
|
|
141758
|
-
createElementVNode("div",
|
|
141759
|
-
|
|
142433
|
+
createElementVNode("div", _hoisted_45$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartSettings")), 1),
|
|
142434
|
+
createElementVNode("div", _hoisted_46$3, [
|
|
142435
|
+
createElementVNode("label", _hoisted_47$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartTitle")), 1),
|
|
142436
|
+
createVNode(unref(NInput), {
|
|
142437
|
+
value: chartTitle.value,
|
|
142438
|
+
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => chartTitle.value = $event),
|
|
142439
|
+
type: "text"
|
|
142440
|
+
}, null, 8, ["value"])
|
|
142441
|
+
]),
|
|
142442
|
+
["bar", "line"].includes(primaryChartType.value) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
142443
|
+
createElementVNode("div", _hoisted_48$3, [
|
|
142444
|
+
createElementVNode("label", _hoisted_49$3, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.xAxisLabel")), 1),
|
|
142445
|
+
createVNode(unref(NInput), {
|
|
142446
|
+
value: xAxisLabel.value,
|
|
142447
|
+
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => xAxisLabel.value = $event),
|
|
142448
|
+
type: "text"
|
|
142449
|
+
}, null, 8, ["value"])
|
|
142450
|
+
]),
|
|
142451
|
+
createElementVNode("div", _hoisted_50$3, [
|
|
142452
|
+
createElementVNode("label", _hoisted_51$2, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.yAxisLabel")), 1),
|
|
142453
|
+
createVNode(unref(NInput), {
|
|
142454
|
+
value: yAxisLabel.value,
|
|
142455
|
+
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => yAxisLabel.value = $event),
|
|
142456
|
+
type: "text"
|
|
142457
|
+
}, null, 8, ["value"])
|
|
142458
|
+
]),
|
|
142459
|
+
createElementVNode("div", _hoisted_52$2, [
|
|
142460
|
+
createElementVNode("label", _hoisted_53$2, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.orientation")), 1),
|
|
142461
|
+
createVNode(unref(NSelect), {
|
|
142462
|
+
value: orientation.value,
|
|
142463
|
+
"onUpdate:value": _cache[5] || (_cache[5] = ($event) => orientation.value = $event),
|
|
142464
|
+
options: orientationOptions
|
|
142465
|
+
}, null, 8, ["value"])
|
|
142466
|
+
])
|
|
142467
|
+
], 64)) : createCommentVNode("", true),
|
|
142468
|
+
["pie", "doughnut", "polarArea"].includes(primaryChartType.value) ? (openBlock(), createElementBlock("div", _hoisted_54$1, [
|
|
142469
|
+
createElementVNode("label", _hoisted_55$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.legendPosition")), 1),
|
|
142470
|
+
createVNode(unref(NSelect), {
|
|
142471
|
+
value: legendPosition.value,
|
|
142472
|
+
"onUpdate:value": _cache[6] || (_cache[6] = ($event) => legendPosition.value = $event),
|
|
142473
|
+
options: legendPositionOptions
|
|
142474
|
+
}, null, 8, ["value"])
|
|
142475
|
+
])) : createCommentVNode("", true),
|
|
142476
|
+
["line", "scatter", "area"].includes(primaryChartType.value) ? (openBlock(), createElementBlock("div", _hoisted_56$1, [
|
|
142477
|
+
createElementVNode("label", _hoisted_57$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.pointStyle")), 1),
|
|
142478
|
+
createVNode(unref(NSelect), {
|
|
142479
|
+
value: pointStyle.value,
|
|
142480
|
+
"onUpdate:value": _cache[7] || (_cache[7] = ($event) => pointStyle.value = $event),
|
|
142481
|
+
options: pointStyleOptions
|
|
142482
|
+
}, null, 8, ["value"])
|
|
142483
|
+
])) : createCommentVNode("", true),
|
|
142484
|
+
createElementVNode("div", _hoisted_58$1, [
|
|
142485
|
+
createElementVNode("label", _hoisted_59$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.colorScheme")), 1),
|
|
141760
142486
|
createVNode(unref(NSelect), {
|
|
141761
142487
|
value: colorSchemeType.value,
|
|
141762
|
-
"onUpdate:value": _cache[
|
|
142488
|
+
"onUpdate:value": _cache[8] || (_cache[8] = ($event) => colorSchemeType.value = $event),
|
|
141763
142489
|
class: "mb-2",
|
|
141764
142490
|
options: [
|
|
141765
142491
|
{ label: unref(t)("canvasUI.canvasBuilder.dataCharts.useThemeColors"), value: "theme" },
|
|
@@ -141776,19 +142502,106 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141776
142502
|
"onUpdate:palette": updateChartColors
|
|
141777
142503
|
}, null, 8, ["allow-add", "allow-delete", "allow-edit", "initial-palette"]))
|
|
141778
142504
|
]),
|
|
141779
|
-
createElementVNode("div",
|
|
141780
|
-
createElementVNode("label",
|
|
142505
|
+
createElementVNode("div", _hoisted_60$1, [
|
|
142506
|
+
createElementVNode("label", _hoisted_61$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.animation")), 1),
|
|
141781
142507
|
createVNode(unref(NSwitch), {
|
|
141782
142508
|
value: enableAnimation.value,
|
|
141783
|
-
"onUpdate:value": _cache[
|
|
142509
|
+
"onUpdate:value": _cache[9] || (_cache[9] = ($event) => enableAnimation.value = $event)
|
|
141784
142510
|
}, null, 8, ["value"])
|
|
142511
|
+
]),
|
|
142512
|
+
createElementVNode("div", _hoisted_62$1, [
|
|
142513
|
+
createElementVNode("label", _hoisted_63$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.percentDisplay")), 1),
|
|
142514
|
+
createElementVNode("div", _hoisted_64$1, [
|
|
142515
|
+
createVNode(unref(NSwitch), {
|
|
142516
|
+
value: percentDisplay.value,
|
|
142517
|
+
"onUpdate:value": _cache[10] || (_cache[10] = ($event) => percentDisplay.value = $event)
|
|
142518
|
+
}, null, 8, ["value"]),
|
|
142519
|
+
createElementVNode("span", _hoisted_65$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.percentDisplayHint")), 1)
|
|
142520
|
+
])
|
|
142521
|
+
]),
|
|
142522
|
+
createElementVNode("div", _hoisted_66$1, [
|
|
142523
|
+
createElementVNode("label", _hoisted_67$1, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.viewModeControls")), 1),
|
|
142524
|
+
createElementVNode("div", _hoisted_68$1, [
|
|
142525
|
+
createElementVNode("div", _hoisted_69, [
|
|
142526
|
+
createVNode(unref(NSwitch), {
|
|
142527
|
+
value: enableFullscreenBtn.value,
|
|
142528
|
+
"onUpdate:value": _cache[11] || (_cache[11] = ($event) => enableFullscreenBtn.value = $event)
|
|
142529
|
+
}, null, 8, ["value"]),
|
|
142530
|
+
createElementVNode("span", _hoisted_70, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.enableFullscreenBtn")), 1)
|
|
142531
|
+
]),
|
|
142532
|
+
createVNode(unref(NTooltip), {
|
|
142533
|
+
disabled: !isMultiSeries.value,
|
|
142534
|
+
trigger: "hover"
|
|
142535
|
+
}, {
|
|
142536
|
+
trigger: withCtx(() => [
|
|
142537
|
+
createElementVNode("div", {
|
|
142538
|
+
class: normalizeClass(["flex items-center gap-2", { "opacity-50 cursor-not-allowed": isMultiSeries.value }])
|
|
142539
|
+
}, [
|
|
142540
|
+
createVNode(unref(NSwitch), {
|
|
142541
|
+
value: enableChartTypeSwitcher.value,
|
|
142542
|
+
"onUpdate:value": _cache[12] || (_cache[12] = ($event) => enableChartTypeSwitcher.value = $event),
|
|
142543
|
+
disabled: isMultiSeries.value
|
|
142544
|
+
}, null, 8, ["value", "disabled"]),
|
|
142545
|
+
createElementVNode("span", _hoisted_71, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.enableChartTypeSwitcher")), 1)
|
|
142546
|
+
], 2)
|
|
142547
|
+
]),
|
|
142548
|
+
default: withCtx(() => [
|
|
142549
|
+
createTextVNode(" " + toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartTypeSwitcherMultiSeriesDisabled")), 1)
|
|
142550
|
+
]),
|
|
142551
|
+
_: 1
|
|
142552
|
+
}, 8, ["disabled"]),
|
|
142553
|
+
createElementVNode("div", _hoisted_72, [
|
|
142554
|
+
createVNode(unref(NSwitch), {
|
|
142555
|
+
value: enableDataEntry.value,
|
|
142556
|
+
"onUpdate:value": _cache[13] || (_cache[13] = ($event) => enableDataEntry.value = $event)
|
|
142557
|
+
}, null, 8, ["value"]),
|
|
142558
|
+
createElementVNode("span", _hoisted_73, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.enableDataEntry")), 1)
|
|
142559
|
+
])
|
|
142560
|
+
])
|
|
142561
|
+
]),
|
|
142562
|
+
createElementVNode("div", _hoisted_74, [
|
|
142563
|
+
createElementVNode("label", _hoisted_75, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.chartSize")), 1),
|
|
142564
|
+
createElementVNode("div", _hoisted_76, [
|
|
142565
|
+
createElementVNode("div", _hoisted_77, [
|
|
142566
|
+
createElementVNode("label", _hoisted_78, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.height")), 1),
|
|
142567
|
+
createVNode(unref(NInputNumber), {
|
|
142568
|
+
value: chartHeight.value,
|
|
142569
|
+
"onUpdate:value": _cache[14] || (_cache[14] = ($event) => chartHeight.value = $event),
|
|
142570
|
+
class: "flex-1",
|
|
142571
|
+
max: 1e3,
|
|
142572
|
+
min: 100,
|
|
142573
|
+
step: 10
|
|
142574
|
+
}, {
|
|
142575
|
+
suffix: withCtx(() => _cache[17] || (_cache[17] = [
|
|
142576
|
+
createTextVNode("px")
|
|
142577
|
+
])),
|
|
142578
|
+
_: 1
|
|
142579
|
+
}, 8, ["value"])
|
|
142580
|
+
]),
|
|
142581
|
+
createElementVNode("div", _hoisted_79, [
|
|
142582
|
+
createElementVNode("label", _hoisted_80, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.width")), 1),
|
|
142583
|
+
createVNode(unref(NInputNumber), {
|
|
142584
|
+
value: chartWidth.value,
|
|
142585
|
+
"onUpdate:value": _cache[15] || (_cache[15] = ($event) => chartWidth.value = $event),
|
|
142586
|
+
class: "flex-1",
|
|
142587
|
+
max: 100,
|
|
142588
|
+
min: 10,
|
|
142589
|
+
step: 5
|
|
142590
|
+
}, {
|
|
142591
|
+
suffix: withCtx(() => _cache[18] || (_cache[18] = [
|
|
142592
|
+
createTextVNode("%")
|
|
142593
|
+
])),
|
|
142594
|
+
_: 1
|
|
142595
|
+
}, 8, ["value"])
|
|
142596
|
+
])
|
|
142597
|
+
])
|
|
141785
142598
|
])
|
|
141786
142599
|
])
|
|
141787
142600
|
])
|
|
141788
142601
|
]),
|
|
141789
|
-
createElementVNode("div",
|
|
141790
|
-
createElementVNode("div",
|
|
141791
|
-
createElementVNode("div",
|
|
142602
|
+
createElementVNode("div", _hoisted_81, [
|
|
142603
|
+
createElementVNode("div", _hoisted_82, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.preview")), 1),
|
|
142604
|
+
createElementVNode("div", _hoisted_83, [
|
|
141792
142605
|
createVNode(unref(NCard), { bordered: false }, {
|
|
141793
142606
|
default: withCtx(() => [
|
|
141794
142607
|
(openBlock(), createBlock(RawDataCharts, {
|
|
@@ -141796,7 +142609,8 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
141796
142609
|
data: {
|
|
141797
142610
|
...previewData.value,
|
|
141798
142611
|
context: unref(crmShape)
|
|
141799
|
-
}
|
|
142612
|
+
},
|
|
142613
|
+
"is-preview": ""
|
|
141800
142614
|
}, null, 8, ["data"]))
|
|
141801
142615
|
]),
|
|
141802
142616
|
_: 1
|
|
@@ -141853,6 +142667,12 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
141853
142667
|
usedInSectionId,
|
|
141854
142668
|
when_used_in_section
|
|
141855
142669
|
});
|
|
142670
|
+
const canEditChart = computed(() => {
|
|
142671
|
+
if (mode.value === CanvasBuilderMode.ADMIN) {
|
|
142672
|
+
return true;
|
|
142673
|
+
}
|
|
142674
|
+
return props.data?.view_controls?.enable_data_entry ?? false;
|
|
142675
|
+
});
|
|
141856
142676
|
onMounted(() => {
|
|
141857
142677
|
if (justAddedComponentId.value === props.id) {
|
|
141858
142678
|
setComponentEditMode(ComponentTypes.DataCharts, props.id);
|
|
@@ -141864,7 +142684,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
141864
142684
|
unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
|
|
141865
142685
|
key: 0,
|
|
141866
142686
|
name: _ctx.tracking_id
|
|
141867
|
-
}, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) && unref(componentPermissions).hasSomethingEditable ? (openBlock(), createBlock(_sfc_main$34, {
|
|
142687
|
+
}, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) && unref(componentPermissions).hasSomethingEditable && canEditChart.value ? (openBlock(), createBlock(_sfc_main$34, {
|
|
141868
142688
|
key: 1,
|
|
141869
142689
|
id: unref(id),
|
|
141870
142690
|
active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
|
|
@@ -141886,6 +142706,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
141886
142706
|
key: key.value,
|
|
141887
142707
|
class: "ma-1",
|
|
141888
142708
|
data: _ctx.data,
|
|
142709
|
+
"is-edit-mode": "",
|
|
141889
142710
|
style: normalizeStyle(_ctx.style)
|
|
141890
142711
|
}, null, 8, ["data", "style"])) : (openBlock(), createBlock(_sfc_main$2G, {
|
|
141891
142712
|
key: 1,
|
|
@@ -141897,8 +142718,9 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
141897
142718
|
}, 8, ["id", "active", "duplicate", "edit", "remove", "selected", "settings", "stylable"])) : (openBlock(), createBlock(RawDataCharts, {
|
|
141898
142719
|
key: 2,
|
|
141899
142720
|
data: _ctx.data,
|
|
142721
|
+
"is-edit-mode": unref(isEditMode),
|
|
141900
142722
|
style: normalizeStyle(_ctx.style)
|
|
141901
|
-
}, null, 8, ["data", "style"])),
|
|
142723
|
+
}, null, 8, ["data", "is-edit-mode", "style"])),
|
|
141902
142724
|
unref(componentEditMode) && unref(componentEditMode).id === unref(id) ? (openBlock(), createBlock(_sfc_main$2E, {
|
|
141903
142725
|
key: 3,
|
|
141904
142726
|
id: unref(id),
|