@dolusoft/vue3-datatable 1.7.83 → 1.7.84

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.
@@ -2985,6 +2985,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2985
2985
  const emit = __emit;
2986
2986
  const filterInputs = vue.ref({});
2987
2987
  const columnConditions = vue.ref({});
2988
+ const watchedFields = vue.ref(/* @__PURE__ */ new Set());
2988
2989
  const columnsMap = vue.computed(() => {
2989
2990
  var _a;
2990
2991
  const map = /* @__PURE__ */ new Map();
@@ -2997,12 +2998,54 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2997
2998
  }
2998
2999
  return map;
2999
3000
  });
3001
+ const setupColumnWatches = () => {
3002
+ var _a;
3003
+ if (!((_a = props.all) == null ? void 0 : _a.columns)) return;
3004
+ props.all.columns.forEach((col) => {
3005
+ if (col.filter && col.field && !watchedFields.value.has(col.field)) {
3006
+ console.log("🔵 [WATCH-SETUP] Setting up watch for:", col.field);
3007
+ if (filterInputs.value[col.field] === void 0) {
3008
+ filterInputs.value[col.field] = col.value || "";
3009
+ }
3010
+ watchedFields.value.add(col.field);
3011
+ watchDebounced(
3012
+ () => filterInputs.value[col.field],
3013
+ (newValue) => {
3014
+ const column = columnsMap.value.get(col.field);
3015
+ console.log("🔴 [DEBOUNCE-FIRED]", {
3016
+ field: col.field,
3017
+ newValue,
3018
+ columnFromMap: !!column,
3019
+ columnValueBefore: column == null ? void 0 : column.value
3020
+ });
3021
+ if (column) {
3022
+ if (column.type === "string" || column.type === "String") {
3023
+ column.value = typeof newValue === "string" ? newValue.trim() : newValue;
3024
+ } else {
3025
+ column.value = newValue;
3026
+ }
3027
+ console.log("🟢 [AFTER-MUTATION]", {
3028
+ field: col.field,
3029
+ columnValueAfter: column.value
3030
+ });
3031
+ emit("filterChange");
3032
+ }
3033
+ },
3034
+ { debounce: 300 }
3035
+ );
3036
+ }
3037
+ });
3038
+ };
3000
3039
  vue.watch(
3001
3040
  () => {
3002
3041
  var _a;
3003
3042
  return (_a = props.all) == null ? void 0 : _a.columns;
3004
3043
  },
3005
- () => {
3044
+ (newColumns) => {
3045
+ if (newColumns && newColumns.length > 0) {
3046
+ console.log("🟡 [COLUMNS-CHANGED] Setting up watches for", newColumns.length, "columns");
3047
+ setupColumnWatches();
3048
+ }
3006
3049
  },
3007
3050
  { immediate: true, deep: true }
3008
3051
  );
@@ -3014,65 +3057,12 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3014
3057
  { deep: true }
3015
3058
  );
3016
3059
  vue.onMounted(() => {
3017
- var _a, _b, _c, _d, _e, _f;
3060
+ var _a, _b, _c;
3018
3061
  console.log("🔍 [COLUMN-HEADER] onMounted", {
3019
3062
  hasColumns: !!((_a = props.all) == null ? void 0 : _a.columns),
3020
- columnsCount: (_c = (_b = props.all) == null ? void 0 : _b.columns) == null ? void 0 : _c.length,
3021
- columns: (_e = (_d = props.all) == null ? void 0 : _d.columns) == null ? void 0 : _e.map((c) => ({
3022
- field: c.field,
3023
- filter: c.filter,
3024
- value: c.value
3025
- }))
3063
+ columnsCount: (_c = (_b = props.all) == null ? void 0 : _b.columns) == null ? void 0 : _c.length
3026
3064
  });
3027
- if ((_f = props.all) == null ? void 0 : _f.columns) {
3028
- props.all.columns.forEach((col) => {
3029
- if (col.filter && col.field) {
3030
- console.log("🔍 [WATCH-SETUP] Setting up watch for:", col.field);
3031
- filterInputs.value[col.field] = col.value || "";
3032
- watchDebounced(
3033
- () => filterInputs.value[col.field],
3034
- (newValue) => {
3035
- var _a2, _b2, _c2, _d2;
3036
- const column = columnsMap.value.get(col.field);
3037
- console.log("🔴 [DEBOUNCE-FIRED]", {
3038
- field: col.field,
3039
- newValue,
3040
- columnFromMap: column,
3041
- columnValueBefore: column == null ? void 0 : column.value,
3042
- propsColumnValue: (_a2 = props.all.columns.find(
3043
- (c) => c.field === col.field
3044
- )) == null ? void 0 : _a2.value,
3045
- isSameRef: column === props.all.columns.find((c) => c.field === col.field)
3046
- });
3047
- if (column) {
3048
- if (column.type === "string" || column.type === "String") {
3049
- column.value = typeof newValue === "string" ? newValue.trim() : newValue;
3050
- console.log("🔍 [AFTER-SET]", {
3051
- afterValue: column.value,
3052
- propsValue: (_b2 = props.all.columns.find((c) => c.field === col.field)) == null ? void 0 : _b2.value
3053
- });
3054
- } else {
3055
- column.value = newValue;
3056
- console.log("🔍 [AFTER-SET]", {
3057
- afterValue: column.value,
3058
- propsValue: (_c2 = props.all.columns.find((c) => c.field === col.field)) == null ? void 0 : _c2.value
3059
- });
3060
- }
3061
- emit("filterChange");
3062
- console.log("🔴 [AFTER-MUTATION]", {
3063
- columnValueAfter: (_d2 = columnsMap.value.get(col.field)) == null ? void 0 : _d2.value
3064
- });
3065
- }
3066
- },
3067
- { debounce: 300 }
3068
- );
3069
- } else {
3070
- console.warn("⚠️ [WATCH-SKIP] Skipped:", col.field, {
3071
- filter: col.filter
3072
- });
3073
- }
3074
- });
3075
- }
3065
+ setupColumnWatches();
3076
3066
  });
3077
3067
  const checkboxChange = () => {
3078
3068
  if (selectedAll.value) {
@@ -1,4 +1,4 @@
1
- import { isRef, watch, onMounted, nextTick, getCurrentScope, onScopeDispose, unref, getCurrentInstance, computed, ref, useSlots, onBeforeUnmount, provide, openBlock, createBlock, resolveDynamicComponent, inject, createElementBlock, normalizeStyle, renderSlot, h, defineComponent, toRef, Fragment, withModifiers, createVNode, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, withDirectives, renderList, vModelSelect, resolveComponent, createTextVNode, vModelText, vShow, withCtx, onUnmounted, vModelCheckbox } from "vue";
1
+ import { isRef, onMounted, nextTick, getCurrentScope, onScopeDispose, unref, getCurrentInstance, watch, computed, ref, useSlots, onBeforeUnmount, provide, openBlock, createBlock, resolveDynamicComponent, inject, createElementBlock, normalizeStyle, renderSlot, h, defineComponent, toRef, Fragment, withModifiers, createVNode, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, withDirectives, renderList, vModelSelect, resolveComponent, createTextVNode, vModelText, vShow, withCtx, onUnmounted, vModelCheckbox } from "vue";
2
2
  function tryOnScopeDispose(fn) {
3
3
  if (getCurrentScope()) {
4
4
  onScopeDispose(fn);
@@ -2984,6 +2984,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2984
2984
  const emit = __emit;
2985
2985
  const filterInputs = ref({});
2986
2986
  const columnConditions = ref({});
2987
+ const watchedFields = ref(/* @__PURE__ */ new Set());
2987
2988
  const columnsMap = computed(() => {
2988
2989
  var _a;
2989
2990
  const map = /* @__PURE__ */ new Map();
@@ -2996,12 +2997,54 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2996
2997
  }
2997
2998
  return map;
2998
2999
  });
3000
+ const setupColumnWatches = () => {
3001
+ var _a;
3002
+ if (!((_a = props.all) == null ? void 0 : _a.columns)) return;
3003
+ props.all.columns.forEach((col) => {
3004
+ if (col.filter && col.field && !watchedFields.value.has(col.field)) {
3005
+ console.log("🔵 [WATCH-SETUP] Setting up watch for:", col.field);
3006
+ if (filterInputs.value[col.field] === void 0) {
3007
+ filterInputs.value[col.field] = col.value || "";
3008
+ }
3009
+ watchedFields.value.add(col.field);
3010
+ watchDebounced(
3011
+ () => filterInputs.value[col.field],
3012
+ (newValue) => {
3013
+ const column = columnsMap.value.get(col.field);
3014
+ console.log("🔴 [DEBOUNCE-FIRED]", {
3015
+ field: col.field,
3016
+ newValue,
3017
+ columnFromMap: !!column,
3018
+ columnValueBefore: column == null ? void 0 : column.value
3019
+ });
3020
+ if (column) {
3021
+ if (column.type === "string" || column.type === "String") {
3022
+ column.value = typeof newValue === "string" ? newValue.trim() : newValue;
3023
+ } else {
3024
+ column.value = newValue;
3025
+ }
3026
+ console.log("🟢 [AFTER-MUTATION]", {
3027
+ field: col.field,
3028
+ columnValueAfter: column.value
3029
+ });
3030
+ emit("filterChange");
3031
+ }
3032
+ },
3033
+ { debounce: 300 }
3034
+ );
3035
+ }
3036
+ });
3037
+ };
2999
3038
  watch(
3000
3039
  () => {
3001
3040
  var _a;
3002
3041
  return (_a = props.all) == null ? void 0 : _a.columns;
3003
3042
  },
3004
- () => {
3043
+ (newColumns) => {
3044
+ if (newColumns && newColumns.length > 0) {
3045
+ console.log("🟡 [COLUMNS-CHANGED] Setting up watches for", newColumns.length, "columns");
3046
+ setupColumnWatches();
3047
+ }
3005
3048
  },
3006
3049
  { immediate: true, deep: true }
3007
3050
  );
@@ -3013,65 +3056,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3013
3056
  { deep: true }
3014
3057
  );
3015
3058
  onMounted(() => {
3016
- var _a, _b, _c, _d, _e, _f;
3059
+ var _a, _b, _c;
3017
3060
  console.log("🔍 [COLUMN-HEADER] onMounted", {
3018
3061
  hasColumns: !!((_a = props.all) == null ? void 0 : _a.columns),
3019
- columnsCount: (_c = (_b = props.all) == null ? void 0 : _b.columns) == null ? void 0 : _c.length,
3020
- columns: (_e = (_d = props.all) == null ? void 0 : _d.columns) == null ? void 0 : _e.map((c) => ({
3021
- field: c.field,
3022
- filter: c.filter,
3023
- value: c.value
3024
- }))
3062
+ columnsCount: (_c = (_b = props.all) == null ? void 0 : _b.columns) == null ? void 0 : _c.length
3025
3063
  });
3026
- if ((_f = props.all) == null ? void 0 : _f.columns) {
3027
- props.all.columns.forEach((col) => {
3028
- if (col.filter && col.field) {
3029
- console.log("🔍 [WATCH-SETUP] Setting up watch for:", col.field);
3030
- filterInputs.value[col.field] = col.value || "";
3031
- watchDebounced(
3032
- () => filterInputs.value[col.field],
3033
- (newValue) => {
3034
- var _a2, _b2, _c2, _d2;
3035
- const column = columnsMap.value.get(col.field);
3036
- console.log("🔴 [DEBOUNCE-FIRED]", {
3037
- field: col.field,
3038
- newValue,
3039
- columnFromMap: column,
3040
- columnValueBefore: column == null ? void 0 : column.value,
3041
- propsColumnValue: (_a2 = props.all.columns.find(
3042
- (c) => c.field === col.field
3043
- )) == null ? void 0 : _a2.value,
3044
- isSameRef: column === props.all.columns.find((c) => c.field === col.field)
3045
- });
3046
- if (column) {
3047
- if (column.type === "string" || column.type === "String") {
3048
- column.value = typeof newValue === "string" ? newValue.trim() : newValue;
3049
- console.log("🔍 [AFTER-SET]", {
3050
- afterValue: column.value,
3051
- propsValue: (_b2 = props.all.columns.find((c) => c.field === col.field)) == null ? void 0 : _b2.value
3052
- });
3053
- } else {
3054
- column.value = newValue;
3055
- console.log("🔍 [AFTER-SET]", {
3056
- afterValue: column.value,
3057
- propsValue: (_c2 = props.all.columns.find((c) => c.field === col.field)) == null ? void 0 : _c2.value
3058
- });
3059
- }
3060
- emit("filterChange");
3061
- console.log("🔴 [AFTER-MUTATION]", {
3062
- columnValueAfter: (_d2 = columnsMap.value.get(col.field)) == null ? void 0 : _d2.value
3063
- });
3064
- }
3065
- },
3066
- { debounce: 300 }
3067
- );
3068
- } else {
3069
- console.warn("⚠️ [WATCH-SKIP] Skipped:", col.field, {
3070
- filter: col.filter
3071
- });
3072
- }
3073
- });
3074
- }
3064
+ setupColumnWatches();
3075
3065
  });
3076
3066
  const checkboxChange = () => {
3077
3067
  if (selectedAll.value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.7.83",
3
+ "version": "1.7.84",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",