@dolusoft/vue3-datatable 1.7.83 → 1.7.85

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,82 +2998,47 @@ 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
+ 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
+ if (column) {
3015
+ if (column.type === "string" || column.type === "String") {
3016
+ column.value = typeof newValue === "string" ? newValue.trim() : newValue;
3017
+ } else {
3018
+ column.value = newValue;
3019
+ }
3020
+ emit("filterChange");
3021
+ }
3022
+ },
3023
+ { debounce: 300 }
3024
+ );
3025
+ }
3026
+ });
3027
+ };
3000
3028
  vue.watch(
3001
3029
  () => {
3002
3030
  var _a;
3003
3031
  return (_a = props.all) == null ? void 0 : _a.columns;
3004
3032
  },
3005
- () => {
3033
+ (newColumns) => {
3034
+ if (newColumns && newColumns.length > 0) {
3035
+ setupColumnWatches();
3036
+ }
3006
3037
  },
3007
3038
  { immediate: true, deep: true }
3008
3039
  );
3009
- vue.watch(
3010
- filterInputs,
3011
- (newVal) => {
3012
- console.log("🟡 [FILTER-INPUTS-CHANGED]", JSON.parse(JSON.stringify(newVal)));
3013
- },
3014
- { deep: true }
3015
- );
3016
3040
  vue.onMounted(() => {
3017
- var _a, _b, _c, _d, _e, _f;
3018
- console.log("🔍 [COLUMN-HEADER] onMounted", {
3019
- 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
- }))
3026
- });
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
- }
3041
+ setupColumnWatches();
3076
3042
  });
3077
3043
  const checkboxChange = () => {
3078
3044
  if (selectedAll.value) {
@@ -4090,10 +4056,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4090
4056
  }
4091
4057
  };
4092
4058
  const filterChange = () => {
4093
- console.log("🔍 [CUSTOM-TABLE] filterChange called", {
4094
- isServerMode: props.isServerMode,
4095
- currentPage: currentPage.value
4096
- });
4097
4059
  selectAll(false);
4098
4060
  if (props.isServerMode) {
4099
4061
  if (currentPage.value === 1) {
@@ -4167,10 +4129,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4167
4129
  }
4168
4130
  };
4169
4131
  const changeForServer = (changeType, isResetPage = false) => {
4170
- console.log(
4171
- "🔵 [CHANGE-FOR-SERVER] Props columns detail:",
4172
- props.columns.map((c) => ({ field: c.field, value: c.value, condition: c.condition }))
4173
- );
4174
4132
  if (props.isServerMode) {
4175
4133
  setDefaultCondition();
4176
4134
  const res = {
@@ -4183,10 +4141,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4183
4141
  column_filters: props.columns,
4184
4142
  change_type: changeType
4185
4143
  };
4186
- console.log(
4187
- "🔵 [EMITTING-CHANGE] Final column_filters:",
4188
- res.column_filters.map((c) => ({ field: c.field, value: c.value, condition: c.condition }))
4189
- );
4190
4144
  emit("change", res);
4191
4145
  }
4192
4146
  };
@@ -13,40 +13,40 @@
13
13
  }
14
14
  .splitpanes{display:flex;width:100%;height:100%}.splitpanes--vertical{flex-direction:row}.splitpanes--horizontal{flex-direction:column}.splitpanes--dragging .splitpanes__pane{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}.splitpanes__pane{width:100%;height:100%;overflow:hidden}.splitpanes--vertical .splitpanes__pane{transition:width .2s ease-out}.splitpanes--horizontal .splitpanes__pane{transition:height .2s ease-out}.splitpanes--dragging .splitpanes__pane{transition:none}.splitpanes__splitter{touch-action:none}.splitpanes--vertical>.splitpanes__splitter{min-width:1px;cursor:col-resize}.splitpanes--horizontal>.splitpanes__splitter{min-height:1px;cursor:row-resize}.splitpanes.default-theme .splitpanes__pane{background-color:#f2f2f2}.splitpanes.default-theme .splitpanes__splitter{background-color:#fff;box-sizing:border-box;position:relative;flex-shrink:0}.splitpanes.default-theme .splitpanes__splitter:before,.splitpanes.default-theme .splitpanes__splitter:after{content:"";position:absolute;top:50%;left:50%;background-color:#00000026;transition:background-color .3s}.splitpanes.default-theme .splitpanes__splitter:hover:before,.splitpanes.default-theme .splitpanes__splitter:hover:after{background-color:#00000040}.splitpanes.default-theme .splitpanes__splitter:first-child{cursor:auto}.default-theme.splitpanes .splitpanes .splitpanes__splitter{z-index:1}.default-theme.splitpanes--vertical>.splitpanes__splitter,.default-theme .splitpanes--vertical>.splitpanes__splitter{width:7px;border-left:1px solid #eee;margin-left:-1px}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{transform:translateY(-50%);width:1px;height:30px}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:before{margin-left:-2px}.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{margin-left:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter,.default-theme .splitpanes--horizontal>.splitpanes__splitter{height:7px;border-top:1px solid #eee;margin-top:-1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{transform:translate(-50%);width:30px;height:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before{margin-top:-2px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{margin-top:1px}
15
15
 
16
- .left-menu-container {
17
- position: relative;
16
+ .left-menu-container {
17
+ position: relative;
18
18
  flex-shrink: 0 !important;
19
19
  }
20
- .menu-resize-controls {
21
- position: absolute;
22
- right: 0;
23
- top: 50%;
24
- transform: translateY(-50%);
25
- z-index: 10;
26
- background: #f0f0f0;
27
- border-radius: 3px 0 0 3px;
20
+ .menu-resize-controls {
21
+ position: absolute;
22
+ right: 0;
23
+ top: 50%;
24
+ transform: translateY(-50%);
25
+ z-index: 10;
26
+ background: #f0f0f0;
27
+ border-radius: 3px 0 0 3px;
28
28
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
29
29
  }
30
- .menu-resize-controls button {
31
- width: 16px;
32
- height: 40px;
33
- display: flex;
34
- justify-content: center;
35
- align-items: center;
36
- border: none;
37
- background: transparent;
38
- cursor: pointer;
39
- -webkit-user-select: none;
40
- -moz-user-select: none;
30
+ .menu-resize-controls button {
31
+ width: 16px;
32
+ height: 40px;
33
+ display: flex;
34
+ justify-content: center;
35
+ align-items: center;
36
+ border: none;
37
+ background: transparent;
38
+ cursor: pointer;
39
+ -webkit-user-select: none;
40
+ -moz-user-select: none;
41
41
  user-select: none;
42
42
  }
43
- .bh-datatable thead {
43
+ .bh-datatable thead {
44
44
  z-index: 15 !important;
45
45
  }
46
- .bh-datatable tbody tr {
47
- position: relative;
46
+ .bh-datatable tbody tr {
47
+ position: relative;
48
48
  z-index: 1;
49
49
  }
50
- .bh-datatable tbody tr:has(td[colspan]) {
50
+ .bh-datatable tbody tr:has(td[colspan]) {
51
51
  z-index: 0;
52
- }
52
+ }
@@ -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,82 +2997,47 @@ 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
+ if (filterInputs.value[col.field] === void 0) {
3006
+ filterInputs.value[col.field] = col.value || "";
3007
+ }
3008
+ watchedFields.value.add(col.field);
3009
+ watchDebounced(
3010
+ () => filterInputs.value[col.field],
3011
+ (newValue) => {
3012
+ const column = columnsMap.value.get(col.field);
3013
+ if (column) {
3014
+ if (column.type === "string" || column.type === "String") {
3015
+ column.value = typeof newValue === "string" ? newValue.trim() : newValue;
3016
+ } else {
3017
+ column.value = newValue;
3018
+ }
3019
+ emit("filterChange");
3020
+ }
3021
+ },
3022
+ { debounce: 300 }
3023
+ );
3024
+ }
3025
+ });
3026
+ };
2999
3027
  watch(
3000
3028
  () => {
3001
3029
  var _a;
3002
3030
  return (_a = props.all) == null ? void 0 : _a.columns;
3003
3031
  },
3004
- () => {
3032
+ (newColumns) => {
3033
+ if (newColumns && newColumns.length > 0) {
3034
+ setupColumnWatches();
3035
+ }
3005
3036
  },
3006
3037
  { immediate: true, deep: true }
3007
3038
  );
3008
- watch(
3009
- filterInputs,
3010
- (newVal) => {
3011
- console.log("🟡 [FILTER-INPUTS-CHANGED]", JSON.parse(JSON.stringify(newVal)));
3012
- },
3013
- { deep: true }
3014
- );
3015
3039
  onMounted(() => {
3016
- var _a, _b, _c, _d, _e, _f;
3017
- console.log("🔍 [COLUMN-HEADER] onMounted", {
3018
- 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
- }))
3025
- });
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
- }
3040
+ setupColumnWatches();
3075
3041
  });
3076
3042
  const checkboxChange = () => {
3077
3043
  if (selectedAll.value) {
@@ -4089,10 +4055,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4089
4055
  }
4090
4056
  };
4091
4057
  const filterChange = () => {
4092
- console.log("🔍 [CUSTOM-TABLE] filterChange called", {
4093
- isServerMode: props.isServerMode,
4094
- currentPage: currentPage.value
4095
- });
4096
4058
  selectAll(false);
4097
4059
  if (props.isServerMode) {
4098
4060
  if (currentPage.value === 1) {
@@ -4166,10 +4128,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4166
4128
  }
4167
4129
  };
4168
4130
  const changeForServer = (changeType, isResetPage = false) => {
4169
- console.log(
4170
- "🔵 [CHANGE-FOR-SERVER] Props columns detail:",
4171
- props.columns.map((c) => ({ field: c.field, value: c.value, condition: c.condition }))
4172
- );
4173
4131
  if (props.isServerMode) {
4174
4132
  setDefaultCondition();
4175
4133
  const res = {
@@ -4182,10 +4140,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4182
4140
  column_filters: props.columns,
4183
4141
  change_type: changeType
4184
4142
  };
4185
- console.log(
4186
- "🔵 [EMITTING-CHANGE] Final column_filters:",
4187
- res.column_filters.map((c) => ({ field: c.field, value: c.value, condition: c.condition }))
4188
- );
4189
4143
  emit("change", res);
4190
4144
  }
4191
4145
  };
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.85",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",