@pitcher/canvas-ui 2026.1.5-123919-beta → 2026.1.5-141434

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
@@ -142456,6 +142456,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
142456
142456
  const themeVars = useThemeVars();
142457
142457
  const { mode, setComponentEditMode, updateNodeDataById } = useCanvas$1();
142458
142458
  const isAdminMode = computed(() => mode.value === CanvasBuilderMode.ADMIN);
142459
+ const confirmation = useConfirmation();
142459
142460
  const { crmShape } = useCrmShape();
142460
142461
  const { palette } = useCanvasTheme$1();
142461
142462
  let seriesIdCounter = 0;
@@ -143240,6 +143241,22 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
143240
143241
  return config;
143241
143242
  }
143242
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
+ }
143243
143260
  setComponentEditMode(false);
143244
143261
  }
143245
143262
  function onSave() {
@@ -143248,6 +143265,10 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
143248
143265
  setComponentEditMode(false);
143249
143266
  }
143250
143267
  const previewData = ref({});
143268
+ const isDirty = ref(false);
143269
+ function markDirty() {
143270
+ isDirty.value = true;
143271
+ }
143251
143272
  function updatePreview() {
143252
143273
  const config = createChartConfig();
143253
143274
  previewData.value = {
@@ -143269,6 +143290,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
143269
143290
  enableChartTypeSwitcher.value = false;
143270
143291
  }
143271
143292
  });
143293
+ let isInitialized = false;
143272
143294
  watch(
143273
143295
  [
143274
143296
  seriesList,
@@ -143290,17 +143312,23 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
143290
143312
  ],
143291
143313
  () => {
143292
143314
  updatePreview();
143315
+ if (isInitialized) {
143316
+ markDirty();
143317
+ }
143293
143318
  },
143294
143319
  { deep: true }
143295
143320
  );
143296
143321
  onMounted(() => {
143297
143322
  updatePreview();
143323
+ nextTick(() => {
143324
+ isInitialized = true;
143325
+ });
143298
143326
  });
143299
143327
  return (_ctx, _cache) => {
143300
143328
  return openBlock(), createBlock(unref(NModal), {
143301
143329
  bordered: false,
143302
143330
  class: "cb-data-charts-settings",
143303
- onEsc: () => unref(setComponentEditMode)(false),
143331
+ onEsc: onCancel,
143304
143332
  preset: "card",
143305
143333
  show: true,
143306
143334
  size: "huge",
@@ -143312,7 +143340,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
143312
143340
  "--n-padding-left": "16px"
143313
143341
  }]),
143314
143342
  title: unref(t)("canvasUI.canvasBuilder.dataCharts.editDataChartsComponent"),
143315
- onClose: _cache[16] || (_cache[16] = ($event) => unref(setComponentEditMode)(false))
143343
+ onClose: onCancel
143316
143344
  }, {
143317
143345
  footer: withCtx(() => [
143318
143346
  createElementVNode("div", _hoisted_110, [
@@ -143974,7 +144002,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
143974
144002
  min: 100,
143975
144003
  step: 10
143976
144004
  }, {
143977
- suffix: withCtx(() => _cache[17] || (_cache[17] = [
144005
+ suffix: withCtx(() => _cache[16] || (_cache[16] = [
143978
144006
  createTextVNode("px")
143979
144007
  ])),
143980
144008
  _: 1
@@ -143990,7 +144018,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
143990
144018
  min: 10,
143991
144019
  step: 5
143992
144020
  }, {
143993
- suffix: withCtx(() => _cache[18] || (_cache[18] = [
144021
+ suffix: withCtx(() => _cache[17] || (_cache[17] = [
143994
144022
  createTextVNode("%")
143995
144023
  ])),
143996
144024
  _: 1
@@ -144025,7 +144053,7 @@ const _sfc_main$2E = /* @__PURE__ */ defineComponent({
144025
144053
  }, 8, ["style"])
144026
144054
  ]),
144027
144055
  _: 1
144028
- }, 8, ["onEsc", "title"]);
144056
+ }, 8, ["title"]);
144029
144057
  };
144030
144058
  }
144031
144059
  });