@dolusoft/vue3-datatable 1.8.30 → 1.8.31

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.
@@ -3176,14 +3176,17 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3176
3176
  if (colState.field) {
3177
3177
  const currentInputValue = filterInputs.value[colState.field] ?? "";
3178
3178
  const newInputValue = colState.value ?? "";
3179
+ const hasValue = newInputValue !== "" && newInputValue !== null && newInputValue !== void 0;
3179
3180
  if (String(currentInputValue) !== String(newInputValue)) {
3180
3181
  filterInputs.value[colState.field] = newInputValue;
3181
3182
  }
3182
- if (colState.condition) {
3183
+ if (hasValue && colState.condition) {
3183
3184
  const currentCondition = columnConditions.value[colState.field] ?? "";
3184
3185
  if (currentCondition !== colState.condition) {
3185
3186
  columnConditions.value[colState.field] = colState.condition;
3186
3187
  }
3188
+ } else if (!hasValue) {
3189
+ columnConditions.value[colState.field] = "";
3187
3190
  }
3188
3191
  }
3189
3192
  });
@@ -3800,7 +3803,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3800
3803
  item.search = item.search !== void 0 ? item.search : true;
3801
3804
  item.sort = item.sort !== void 0 ? item.sort : true;
3802
3805
  item.html = item.html !== void 0 ? item.html : false;
3803
- item.condition = !type || type === "string" ? "Contains" : "Equal";
3806
+ if (item.value !== void 0 && item.value !== null && item.value !== "") {
3807
+ item.condition = item.condition || "Equal";
3808
+ } else {
3809
+ item.condition = "";
3810
+ }
3804
3811
  }
3805
3812
  const filterItems = vue.ref([]);
3806
3813
  const currentPage = vue.ref(props.page);
@@ -4136,20 +4143,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4136
4143
  * Set column filter value and optionally trigger filter
4137
4144
  * @param field - Column field name
4138
4145
  * @param value - Filter value
4139
- * @param condition - Filter condition (default: column type's default)
4146
+ * @param condition - Filter condition (default: Equal)
4140
4147
  * @param triggerFilter - Whether to trigger filterChange event (default: false)
4141
4148
  */
4142
4149
  setColumnFilter(field, value, condition, triggerFilter = false) {
4143
- var _a2;
4144
4150
  const column = props.columns.find((col) => col.field === field);
4145
4151
  if (column) {
4146
4152
  column.value = value;
4147
- if (condition) {
4148
- column.condition = condition;
4149
- } else {
4150
- const type = ((_a2 = column.type) == null ? void 0 : _a2.toLowerCase()) || "string";
4151
- column.condition = type === "string" ? "Contains" : "Equal";
4152
- }
4153
+ column.condition = condition || "Equal";
4153
4154
  updateHasAnyActiveFilter();
4154
4155
  if (triggerFilter) {
4155
4156
  filterChange();
@@ -3175,14 +3175,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3175
3175
  if (colState.field) {
3176
3176
  const currentInputValue = filterInputs.value[colState.field] ?? "";
3177
3177
  const newInputValue = colState.value ?? "";
3178
+ const hasValue = newInputValue !== "" && newInputValue !== null && newInputValue !== void 0;
3178
3179
  if (String(currentInputValue) !== String(newInputValue)) {
3179
3180
  filterInputs.value[colState.field] = newInputValue;
3180
3181
  }
3181
- if (colState.condition) {
3182
+ if (hasValue && colState.condition) {
3182
3183
  const currentCondition = columnConditions.value[colState.field] ?? "";
3183
3184
  if (currentCondition !== colState.condition) {
3184
3185
  columnConditions.value[colState.field] = colState.condition;
3185
3186
  }
3187
+ } else if (!hasValue) {
3188
+ columnConditions.value[colState.field] = "";
3186
3189
  }
3187
3190
  }
3188
3191
  });
@@ -3799,7 +3802,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3799
3802
  item.search = item.search !== void 0 ? item.search : true;
3800
3803
  item.sort = item.sort !== void 0 ? item.sort : true;
3801
3804
  item.html = item.html !== void 0 ? item.html : false;
3802
- item.condition = !type || type === "string" ? "Contains" : "Equal";
3805
+ if (item.value !== void 0 && item.value !== null && item.value !== "") {
3806
+ item.condition = item.condition || "Equal";
3807
+ } else {
3808
+ item.condition = "";
3809
+ }
3803
3810
  }
3804
3811
  const filterItems = ref([]);
3805
3812
  const currentPage = ref(props.page);
@@ -4135,20 +4142,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4135
4142
  * Set column filter value and optionally trigger filter
4136
4143
  * @param field - Column field name
4137
4144
  * @param value - Filter value
4138
- * @param condition - Filter condition (default: column type's default)
4145
+ * @param condition - Filter condition (default: Equal)
4139
4146
  * @param triggerFilter - Whether to trigger filterChange event (default: false)
4140
4147
  */
4141
4148
  setColumnFilter(field, value, condition, triggerFilter = false) {
4142
- var _a2;
4143
4149
  const column = props.columns.find((col) => col.field === field);
4144
4150
  if (column) {
4145
4151
  column.value = value;
4146
- if (condition) {
4147
- column.condition = condition;
4148
- } else {
4149
- const type = ((_a2 = column.type) == null ? void 0 : _a2.toLowerCase()) || "string";
4150
- column.condition = type === "string" ? "Contains" : "Equal";
4151
- }
4152
+ column.condition = condition || "Equal";
4152
4153
  updateHasAnyActiveFilter();
4153
4154
  if (triggerFilter) {
4154
4155
  filterChange();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.8.30",
3
+ "version": "1.8.31",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",