@pitcher/canvas-ui 2026.1.2-75605 → 2026.1.5-131138-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/canvas-ui.js
CHANGED
|
@@ -142425,7 +142425,10 @@ const _hoisted_94 = { class: "flex flex-col gap-2" };
|
|
|
142425
142425
|
const _hoisted_95 = { class: "flex items-center gap-2" };
|
|
142426
142426
|
const _hoisted_96 = { class: "text-sm" };
|
|
142427
142427
|
const _hoisted_97 = { class: "text-sm" };
|
|
142428
|
-
const _hoisted_98 = {
|
|
142428
|
+
const _hoisted_98 = {
|
|
142429
|
+
key: 0,
|
|
142430
|
+
class: "flex items-center gap-2"
|
|
142431
|
+
};
|
|
142429
142432
|
const _hoisted_99 = { class: "text-sm" };
|
|
142430
142433
|
const _hoisted_100 = { class: "mb-4" };
|
|
142431
142434
|
const _hoisted_101 = { class: "block mb-2" };
|
|
@@ -142451,7 +142454,9 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
142451
142454
|
const props = __props;
|
|
142452
142455
|
const { t } = useI18n();
|
|
142453
142456
|
const themeVars = useThemeVars();
|
|
142454
|
-
const { setComponentEditMode, updateNodeDataById } = useCanvas$1();
|
|
142457
|
+
const { mode, setComponentEditMode, updateNodeDataById } = useCanvas$1();
|
|
142458
|
+
const isAdminMode = computed(() => mode.value === CanvasBuilderMode.ADMIN);
|
|
142459
|
+
const confirmation = useConfirmation();
|
|
142455
142460
|
const { crmShape } = useCrmShape();
|
|
142456
142461
|
const { palette } = useCanvasTheme$1();
|
|
142457
142462
|
let seriesIdCounter = 0;
|
|
@@ -142539,7 +142544,9 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
142539
142544
|
});
|
|
142540
142545
|
const chartType = computed(() => seriesList.value[0]?.chartType ?? "bar");
|
|
142541
142546
|
const primaryChartType = computed(() => seriesList.value[0]?.chartType ?? "bar");
|
|
142542
|
-
const
|
|
142547
|
+
const savedColorScheme = props.data?.color_scheme;
|
|
142548
|
+
const datasets = props.data?.data?.datasets;
|
|
142549
|
+
const backgroundColor = savedColorScheme ?? (datasets && datasets.length > 1 ? datasets.map((ds) => ds.background_color).filter(Boolean) : datasets?.[0]?.background_color);
|
|
142543
142550
|
const colorSchemeType = ref(props.data?.color_scheme_type ?? "theme");
|
|
142544
142551
|
const chartColors = ref([]);
|
|
142545
142552
|
const displayColors = computed(() => {
|
|
@@ -142574,7 +142581,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
142574
142581
|
const percentDisplay = ref(props.data?.percent_display ?? false);
|
|
142575
142582
|
const enableFullscreenBtn = ref(props.data?.view_controls?.enable_fullscreen_btn ?? false);
|
|
142576
142583
|
const enableChartTypeSwitcher = ref(props.data?.view_controls?.enable_chart_type_switcher ?? false);
|
|
142577
|
-
const enableDataEntry = ref(props.data?.view_controls?.enable_data_entry
|
|
142584
|
+
const enableDataEntry = ref(props.data?.view_controls?.enable_data_entry !== false);
|
|
142578
142585
|
const chartHeight = ref(props.data?.chart_height ?? 800);
|
|
142579
142586
|
const chartWidth = ref(props.data?.chart_width ?? 100);
|
|
142580
142587
|
const legendPositionOptions = [
|
|
@@ -143091,7 +143098,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143091
143098
|
return chartColors.value;
|
|
143092
143099
|
}
|
|
143093
143100
|
function createChartConfig() {
|
|
143094
|
-
const
|
|
143101
|
+
const datasets2 = [];
|
|
143095
143102
|
let allLabels = [];
|
|
143096
143103
|
const colorsForStorage = getSeriesColors(true);
|
|
143097
143104
|
const isSingleSeries = seriesList.value.length === 1;
|
|
@@ -143136,7 +143143,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143136
143143
|
if (processedData.labels.length > allLabels.length) {
|
|
143137
143144
|
allLabels = processedData.labels;
|
|
143138
143145
|
}
|
|
143139
|
-
|
|
143146
|
+
datasets2.push(datasetOptions);
|
|
143140
143147
|
});
|
|
143141
143148
|
const primaryType = seriesList.value[0].chartType;
|
|
143142
143149
|
let actualPrimaryType = primaryType;
|
|
@@ -143175,6 +143182,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143175
143182
|
const config = {
|
|
143176
143183
|
type: actualPrimaryType,
|
|
143177
143184
|
color_scheme_type: colorSchemeType.value,
|
|
143185
|
+
color_scheme: colorsForStorage,
|
|
143178
143186
|
percent_display: percentDisplay.value,
|
|
143179
143187
|
chart_height: chartHeight.value,
|
|
143180
143188
|
chart_width: chartWidth.value,
|
|
@@ -143185,7 +143193,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143185
143193
|
},
|
|
143186
143194
|
data: {
|
|
143187
143195
|
labels: allLabels,
|
|
143188
|
-
datasets
|
|
143196
|
+
datasets: datasets2
|
|
143189
143197
|
},
|
|
143190
143198
|
options: {
|
|
143191
143199
|
responsive: true,
|
|
@@ -143233,6 +143241,22 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143233
143241
|
return config;
|
|
143234
143242
|
}
|
|
143235
143243
|
function onCancel() {
|
|
143244
|
+
if (isDirty.value) {
|
|
143245
|
+
confirmation.warning({
|
|
143246
|
+
title: t("canvasUI.canvasBuilder.confirmationOnUnsavedChanges.title"),
|
|
143247
|
+
content: t("canvasUI.canvasBuilder.confirmationOnUnsavedChanges.content"),
|
|
143248
|
+
confirmText: t("canvasUI.canvasBuilder.confirmationOnUnsavedChanges.confirm"),
|
|
143249
|
+
exitText: t("canvasUI.canvasBuilder.confirmationOnUnsavedChanges.exit"),
|
|
143250
|
+
hasExit: true,
|
|
143251
|
+
onConfirm: () => {
|
|
143252
|
+
onSave();
|
|
143253
|
+
},
|
|
143254
|
+
onExit: () => {
|
|
143255
|
+
setComponentEditMode(false);
|
|
143256
|
+
}
|
|
143257
|
+
});
|
|
143258
|
+
return;
|
|
143259
|
+
}
|
|
143236
143260
|
setComponentEditMode(false);
|
|
143237
143261
|
}
|
|
143238
143262
|
function onSave() {
|
|
@@ -143241,6 +143265,10 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143241
143265
|
setComponentEditMode(false);
|
|
143242
143266
|
}
|
|
143243
143267
|
const previewData = ref({});
|
|
143268
|
+
const isDirty = ref(false);
|
|
143269
|
+
function markDirty() {
|
|
143270
|
+
isDirty.value = true;
|
|
143271
|
+
}
|
|
143244
143272
|
function updatePreview() {
|
|
143245
143273
|
const config = createChartConfig();
|
|
143246
143274
|
previewData.value = {
|
|
@@ -143262,6 +143290,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143262
143290
|
enableChartTypeSwitcher.value = false;
|
|
143263
143291
|
}
|
|
143264
143292
|
});
|
|
143293
|
+
let isInitialized = false;
|
|
143265
143294
|
watch(
|
|
143266
143295
|
[
|
|
143267
143296
|
seriesList,
|
|
@@ -143283,17 +143312,23 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143283
143312
|
],
|
|
143284
143313
|
() => {
|
|
143285
143314
|
updatePreview();
|
|
143315
|
+
if (isInitialized) {
|
|
143316
|
+
markDirty();
|
|
143317
|
+
}
|
|
143286
143318
|
},
|
|
143287
143319
|
{ deep: true }
|
|
143288
143320
|
);
|
|
143289
143321
|
onMounted(() => {
|
|
143290
143322
|
updatePreview();
|
|
143323
|
+
nextTick(() => {
|
|
143324
|
+
isInitialized = true;
|
|
143325
|
+
});
|
|
143291
143326
|
});
|
|
143292
143327
|
return (_ctx, _cache) => {
|
|
143293
143328
|
return openBlock(), createBlock(unref(NModal), {
|
|
143294
143329
|
bordered: false,
|
|
143295
143330
|
class: "cb-data-charts-settings",
|
|
143296
|
-
onEsc:
|
|
143331
|
+
onEsc: onCancel,
|
|
143297
143332
|
preset: "card",
|
|
143298
143333
|
show: true,
|
|
143299
143334
|
size: "huge",
|
|
@@ -143305,7 +143340,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143305
143340
|
"--n-padding-left": "16px"
|
|
143306
143341
|
}]),
|
|
143307
143342
|
title: unref(t)("canvasUI.canvasBuilder.dataCharts.editDataChartsComponent"),
|
|
143308
|
-
onClose:
|
|
143343
|
+
onClose: onCancel
|
|
143309
143344
|
}, {
|
|
143310
143345
|
footer: withCtx(() => [
|
|
143311
143346
|
createElementVNode("div", _hoisted_110, [
|
|
@@ -143945,13 +143980,13 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143945
143980
|
]),
|
|
143946
143981
|
_: 1
|
|
143947
143982
|
}, 8, ["disabled"]),
|
|
143948
|
-
|
|
143983
|
+
isAdminMode.value ? (openBlock(), createElementBlock("div", _hoisted_98, [
|
|
143949
143984
|
createVNode(unref(NSwitch), {
|
|
143950
143985
|
value: enableDataEntry.value,
|
|
143951
143986
|
"onUpdate:value": _cache[13] || (_cache[13] = ($event) => enableDataEntry.value = $event)
|
|
143952
143987
|
}, null, 8, ["value"]),
|
|
143953
143988
|
createElementVNode("span", _hoisted_99, toDisplayString(unref(t)("canvasUI.canvasBuilder.dataCharts.enableDataEntry")), 1)
|
|
143954
|
-
])
|
|
143989
|
+
])) : createCommentVNode("", true)
|
|
143955
143990
|
])
|
|
143956
143991
|
]),
|
|
143957
143992
|
createElementVNode("div", _hoisted_100, [
|
|
@@ -143967,7 +144002,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143967
144002
|
min: 100,
|
|
143968
144003
|
step: 10
|
|
143969
144004
|
}, {
|
|
143970
|
-
suffix: withCtx(() => _cache[
|
|
144005
|
+
suffix: withCtx(() => _cache[16] || (_cache[16] = [
|
|
143971
144006
|
createTextVNode("px")
|
|
143972
144007
|
])),
|
|
143973
144008
|
_: 1
|
|
@@ -143983,7 +144018,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
143983
144018
|
min: 10,
|
|
143984
144019
|
step: 5
|
|
143985
144020
|
}, {
|
|
143986
|
-
suffix: withCtx(() => _cache[
|
|
144021
|
+
suffix: withCtx(() => _cache[17] || (_cache[17] = [
|
|
143987
144022
|
createTextVNode("%")
|
|
143988
144023
|
])),
|
|
143989
144024
|
_: 1
|
|
@@ -144018,7 +144053,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
|
|
|
144018
144053
|
}, 8, ["style"])
|
|
144019
144054
|
]),
|
|
144020
144055
|
_: 1
|
|
144021
|
-
}, 8, ["
|
|
144056
|
+
}, 8, ["title"]);
|
|
144022
144057
|
};
|
|
144023
144058
|
}
|
|
144024
144059
|
});
|
|
@@ -144066,7 +144101,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
144066
144101
|
if (mode.value === CanvasBuilderMode.ADMIN) {
|
|
144067
144102
|
return true;
|
|
144068
144103
|
}
|
|
144069
|
-
return props.data?.view_controls?.enable_data_entry
|
|
144104
|
+
return props.data?.view_controls?.enable_data_entry !== false;
|
|
144070
144105
|
});
|
|
144071
144106
|
onMounted(() => {
|
|
144072
144107
|
if (justAddedComponentId.value === props.id) {
|