@dolusoft/vue3-datatable 1.8.18 → 1.8.19

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.
@@ -29,9 +29,6 @@ function createFilterWrapper(filter, fn) {
29
29
  }
30
30
  return wrapper;
31
31
  }
32
- const bypassFilter = (invoke) => {
33
- return invoke();
34
- };
35
32
  function debounceFilter(ms, options = {}) {
36
33
  let timer;
37
34
  let maxTimer;
@@ -142,20 +139,6 @@ function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnC
142
139
  fn
143
140
  );
144
141
  }
145
- function watchWithFilter(source, cb, options = {}) {
146
- const {
147
- eventFilter = bypassFilter,
148
- ...watchOptions
149
- } = options;
150
- return vue.watch(
151
- source,
152
- createFilterWrapper(
153
- eventFilter,
154
- cb
155
- ),
156
- watchOptions
157
- );
158
- }
159
142
  function tryOnMounted(fn, sync = true, target) {
160
143
  const instance = getLifeCycleTarget();
161
144
  if (instance)
@@ -165,21 +148,6 @@ function tryOnMounted(fn, sync = true, target) {
165
148
  else
166
149
  vue.nextTick(fn);
167
150
  }
168
- function watchDebounced(source, cb, options = {}) {
169
- const {
170
- debounce = 0,
171
- maxWait = void 0,
172
- ...watchOptions
173
- } = options;
174
- return watchWithFilter(
175
- source,
176
- cb,
177
- {
178
- ...watchOptions,
179
- eventFilter: debounceFilter(debounce, { maxWait })
180
- }
181
- );
182
- }
183
151
  function unrefElement(elRef) {
184
152
  var _a;
185
153
  const plain = toValue(elRef);
@@ -3120,31 +3088,42 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3120
3088
  filterInputs.value[col.field] = col.value || "";
3121
3089
  }
3122
3090
  watchedFields.value.add(col.field);
3123
- watchDebounced(
3091
+ let debounceTimer = null;
3092
+ vue.watch(
3124
3093
  () => filterInputs.value[col.field],
3125
3094
  (newValue) => {
3126
3095
  const column = columnsMap.value.get(col.field);
3127
3096
  if (!column) return;
3128
3097
  const isEmpty = newValue === "" || newValue === null || newValue === void 0;
3129
- if (column.type === "string" || column.type === "String") {
3130
- column.value = isEmpty ? "" : typeof newValue === "string" ? newValue.trim() : newValue;
3131
- } else {
3132
- column.value = isEmpty ? "" : newValue;
3098
+ if (debounceTimer) {
3099
+ clearTimeout(debounceTimer);
3100
+ debounceTimer = null;
3133
3101
  }
3102
+ const processChange = () => {
3103
+ if (column.type === "string" || column.type === "String") {
3104
+ column.value = isEmpty ? "" : typeof newValue === "string" ? newValue.trim() : newValue;
3105
+ } else {
3106
+ column.value = isEmpty ? "" : newValue;
3107
+ }
3108
+ if (isEmpty) {
3109
+ column.condition = "";
3110
+ columnConditions.value[col.field] = "";
3111
+ console.log("🔴 [COLUMN-HEADER] CLEARED:", col.field, { value: column.value, condition: column.condition });
3112
+ } else if (!columnConditions.value[col.field]) {
3113
+ column.condition = "Equal";
3114
+ columnConditions.value[col.field] = "Equal";
3115
+ console.log("🟢 [COLUMN-HEADER] SET DEFAULT:", col.field, { value: column.value, condition: column.condition });
3116
+ } else {
3117
+ console.log("🟡 [COLUMN-HEADER] KEEP EXISTING:", col.field, { value: column.value, condition: column.condition });
3118
+ }
3119
+ emit("filterChange");
3120
+ };
3134
3121
  if (isEmpty) {
3135
- column.condition = "";
3136
- columnConditions.value[col.field] = "";
3137
- console.log("🔴 [COLUMN-HEADER] CLEARED:", col.field, { value: column.value, condition: column.condition });
3138
- } else if (!columnConditions.value[col.field]) {
3139
- column.condition = "Equal";
3140
- columnConditions.value[col.field] = "Equal";
3141
- console.log("🟢 [COLUMN-HEADER] SET DEFAULT:", col.field, { value: column.value, condition: column.condition });
3122
+ processChange();
3142
3123
  } else {
3143
- console.log("🟡 [COLUMN-HEADER] KEEP EXISTING:", col.field, { value: column.value, condition: column.condition });
3124
+ debounceTimer = setTimeout(processChange, 300);
3144
3125
  }
3145
- emit("filterChange");
3146
- },
3147
- { debounce: 300 }
3126
+ }
3148
3127
  );
3149
3128
  }
3150
3129
  });
@@ -1,4 +1,4 @@
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, createSlots, normalizeProps, guardReactiveProps, vModelCheckbox } from "vue";
1
+ import { isRef, onMounted, nextTick, getCurrentScope, onScopeDispose, unref, getCurrentInstance, computed, ref, watch, 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, createSlots, normalizeProps, guardReactiveProps, vModelCheckbox } from "vue";
2
2
  function tryOnScopeDispose(fn) {
3
3
  if (getCurrentScope()) {
4
4
  onScopeDispose(fn);
@@ -28,9 +28,6 @@ function createFilterWrapper(filter, fn) {
28
28
  }
29
29
  return wrapper;
30
30
  }
31
- const bypassFilter = (invoke) => {
32
- return invoke();
33
- };
34
31
  function debounceFilter(ms, options = {}) {
35
32
  let timer;
36
33
  let maxTimer;
@@ -141,20 +138,6 @@ function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnC
141
138
  fn
142
139
  );
143
140
  }
144
- function watchWithFilter(source, cb, options = {}) {
145
- const {
146
- eventFilter = bypassFilter,
147
- ...watchOptions
148
- } = options;
149
- return watch(
150
- source,
151
- createFilterWrapper(
152
- eventFilter,
153
- cb
154
- ),
155
- watchOptions
156
- );
157
- }
158
141
  function tryOnMounted(fn, sync = true, target) {
159
142
  const instance = getLifeCycleTarget();
160
143
  if (instance)
@@ -164,21 +147,6 @@ function tryOnMounted(fn, sync = true, target) {
164
147
  else
165
148
  nextTick(fn);
166
149
  }
167
- function watchDebounced(source, cb, options = {}) {
168
- const {
169
- debounce = 0,
170
- maxWait = void 0,
171
- ...watchOptions
172
- } = options;
173
- return watchWithFilter(
174
- source,
175
- cb,
176
- {
177
- ...watchOptions,
178
- eventFilter: debounceFilter(debounce, { maxWait })
179
- }
180
- );
181
- }
182
150
  function unrefElement(elRef) {
183
151
  var _a;
184
152
  const plain = toValue(elRef);
@@ -3119,31 +3087,42 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3119
3087
  filterInputs.value[col.field] = col.value || "";
3120
3088
  }
3121
3089
  watchedFields.value.add(col.field);
3122
- watchDebounced(
3090
+ let debounceTimer = null;
3091
+ watch(
3123
3092
  () => filterInputs.value[col.field],
3124
3093
  (newValue) => {
3125
3094
  const column = columnsMap.value.get(col.field);
3126
3095
  if (!column) return;
3127
3096
  const isEmpty = newValue === "" || newValue === null || newValue === void 0;
3128
- if (column.type === "string" || column.type === "String") {
3129
- column.value = isEmpty ? "" : typeof newValue === "string" ? newValue.trim() : newValue;
3130
- } else {
3131
- column.value = isEmpty ? "" : newValue;
3097
+ if (debounceTimer) {
3098
+ clearTimeout(debounceTimer);
3099
+ debounceTimer = null;
3132
3100
  }
3101
+ const processChange = () => {
3102
+ if (column.type === "string" || column.type === "String") {
3103
+ column.value = isEmpty ? "" : typeof newValue === "string" ? newValue.trim() : newValue;
3104
+ } else {
3105
+ column.value = isEmpty ? "" : newValue;
3106
+ }
3107
+ if (isEmpty) {
3108
+ column.condition = "";
3109
+ columnConditions.value[col.field] = "";
3110
+ console.log("🔴 [COLUMN-HEADER] CLEARED:", col.field, { value: column.value, condition: column.condition });
3111
+ } else if (!columnConditions.value[col.field]) {
3112
+ column.condition = "Equal";
3113
+ columnConditions.value[col.field] = "Equal";
3114
+ console.log("🟢 [COLUMN-HEADER] SET DEFAULT:", col.field, { value: column.value, condition: column.condition });
3115
+ } else {
3116
+ console.log("🟡 [COLUMN-HEADER] KEEP EXISTING:", col.field, { value: column.value, condition: column.condition });
3117
+ }
3118
+ emit("filterChange");
3119
+ };
3133
3120
  if (isEmpty) {
3134
- column.condition = "";
3135
- columnConditions.value[col.field] = "";
3136
- console.log("🔴 [COLUMN-HEADER] CLEARED:", col.field, { value: column.value, condition: column.condition });
3137
- } else if (!columnConditions.value[col.field]) {
3138
- column.condition = "Equal";
3139
- columnConditions.value[col.field] = "Equal";
3140
- console.log("🟢 [COLUMN-HEADER] SET DEFAULT:", col.field, { value: column.value, condition: column.condition });
3121
+ processChange();
3141
3122
  } else {
3142
- console.log("🟡 [COLUMN-HEADER] KEEP EXISTING:", col.field, { value: column.value, condition: column.condition });
3123
+ debounceTimer = setTimeout(processChange, 300);
3143
3124
  }
3144
- emit("filterChange");
3145
- },
3146
- { debounce: 300 }
3125
+ }
3147
3126
  );
3148
3127
  }
3149
3128
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.8.18",
3
+ "version": "1.8.19",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",