@dolusoft/vue3-datatable 1.8.13 → 1.8.16

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.
@@ -3131,9 +3131,13 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3131
3131
  } else {
3132
3132
  column.value = newValue;
3133
3133
  }
3134
- if (currentCondition) {
3134
+ const isEmpty = newValue === "" || newValue === null || newValue === void 0;
3135
+ if (isEmpty) {
3136
+ column.condition = "";
3137
+ columnConditions.value[col.field] = "";
3138
+ } else if (currentCondition) {
3135
3139
  column.condition = currentCondition;
3136
- } else if (column.value) {
3140
+ } else {
3137
3141
  column.condition = "Equal";
3138
3142
  columnConditions.value[col.field] = column.condition;
3139
3143
  }
@@ -3146,14 +3150,32 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3146
3150
  });
3147
3151
  };
3148
3152
  const handleClearAllFilters = () => {
3153
+ var _a;
3149
3154
  Object.keys(filterInputs.value).forEach((key) => {
3150
3155
  filterInputs.value[key] = "";
3151
3156
  });
3152
3157
  Object.keys(columnConditions.value).forEach((key) => {
3153
3158
  columnConditions.value[key] = "";
3154
3159
  });
3160
+ if ((_a = props.all) == null ? void 0 : _a.columns) {
3161
+ props.all.columns.forEach((col) => {
3162
+ if (col.filter) {
3163
+ col.value = "";
3164
+ col.condition = "";
3165
+ }
3166
+ });
3167
+ }
3155
3168
  emit("clearAllFilters");
3156
3169
  };
3170
+ const hasAnyActiveFilterLocal = vue.computed(() => {
3171
+ const hasInputValue = Object.values(filterInputs.value).some(
3172
+ (val) => val !== "" && val !== null && val !== void 0
3173
+ );
3174
+ const hasConditionValue = Object.values(columnConditions.value).some(
3175
+ (val) => val !== "" && val !== null && val !== void 0
3176
+ );
3177
+ return hasInputValue || hasConditionValue;
3178
+ });
3157
3179
  vue.watch(
3158
3180
  () => {
3159
3181
  var _a;
@@ -3256,9 +3278,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3256
3278
  key: 0,
3257
3279
  type: "button",
3258
3280
  class: vue.normalizeClass(["bh-clear-all-button", {
3259
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3281
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3260
3282
  }]),
3261
- disabled: !props.hasAnyActiveFilter,
3283
+ disabled: !hasAnyActiveFilterLocal.value,
3262
3284
  onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3263
3285
  title: "Clear all filters"
3264
3286
  }, _hoisted_6$1, 10, _hoisted_4$1)) : vue.createCommentVNode("", true)
@@ -3281,9 +3303,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3281
3303
  key: 0,
3282
3304
  type: "button",
3283
3305
  class: vue.normalizeClass(["bh-clear-all-button", {
3284
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3306
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3285
3307
  }]),
3286
- disabled: !props.hasAnyActiveFilter,
3308
+ disabled: !hasAnyActiveFilterLocal.value,
3287
3309
  onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3288
3310
  title: "Clear all filters"
3289
3311
  }, _hoisted_10$1, 10, _hoisted_8$1)) : vue.createCommentVNode("", true)
@@ -3306,9 +3328,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3306
3328
  key: 0,
3307
3329
  type: "button",
3308
3330
  class: vue.normalizeClass(["bh-clear-all-button", {
3309
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3331
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3310
3332
  }]),
3311
- disabled: !props.hasAnyActiveFilter,
3333
+ disabled: !hasAnyActiveFilterLocal.value,
3312
3334
  onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3313
3335
  title: "Clear all filters"
3314
3336
  }, _hoisted_14$1, 10, _hoisted_12$1)) : vue.createCommentVNode("", true)
@@ -3130,9 +3130,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3130
3130
  } else {
3131
3131
  column.value = newValue;
3132
3132
  }
3133
- if (currentCondition) {
3133
+ const isEmpty = newValue === "" || newValue === null || newValue === void 0;
3134
+ if (isEmpty) {
3135
+ column.condition = "";
3136
+ columnConditions.value[col.field] = "";
3137
+ } else if (currentCondition) {
3134
3138
  column.condition = currentCondition;
3135
- } else if (column.value) {
3139
+ } else {
3136
3140
  column.condition = "Equal";
3137
3141
  columnConditions.value[col.field] = column.condition;
3138
3142
  }
@@ -3145,14 +3149,32 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3145
3149
  });
3146
3150
  };
3147
3151
  const handleClearAllFilters = () => {
3152
+ var _a;
3148
3153
  Object.keys(filterInputs.value).forEach((key) => {
3149
3154
  filterInputs.value[key] = "";
3150
3155
  });
3151
3156
  Object.keys(columnConditions.value).forEach((key) => {
3152
3157
  columnConditions.value[key] = "";
3153
3158
  });
3159
+ if ((_a = props.all) == null ? void 0 : _a.columns) {
3160
+ props.all.columns.forEach((col) => {
3161
+ if (col.filter) {
3162
+ col.value = "";
3163
+ col.condition = "";
3164
+ }
3165
+ });
3166
+ }
3154
3167
  emit("clearAllFilters");
3155
3168
  };
3169
+ const hasAnyActiveFilterLocal = computed(() => {
3170
+ const hasInputValue = Object.values(filterInputs.value).some(
3171
+ (val) => val !== "" && val !== null && val !== void 0
3172
+ );
3173
+ const hasConditionValue = Object.values(columnConditions.value).some(
3174
+ (val) => val !== "" && val !== null && val !== void 0
3175
+ );
3176
+ return hasInputValue || hasConditionValue;
3177
+ });
3156
3178
  watch(
3157
3179
  () => {
3158
3180
  var _a;
@@ -3255,9 +3277,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3255
3277
  key: 0,
3256
3278
  type: "button",
3257
3279
  class: normalizeClass(["bh-clear-all-button", {
3258
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3280
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3259
3281
  }]),
3260
- disabled: !props.hasAnyActiveFilter,
3282
+ disabled: !hasAnyActiveFilterLocal.value,
3261
3283
  onClick: withModifiers(handleClearAllFilters, ["stop"]),
3262
3284
  title: "Clear all filters"
3263
3285
  }, _hoisted_6$1, 10, _hoisted_4$1)) : createCommentVNode("", true)
@@ -3280,9 +3302,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3280
3302
  key: 0,
3281
3303
  type: "button",
3282
3304
  class: normalizeClass(["bh-clear-all-button", {
3283
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3305
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3284
3306
  }]),
3285
- disabled: !props.hasAnyActiveFilter,
3307
+ disabled: !hasAnyActiveFilterLocal.value,
3286
3308
  onClick: withModifiers(handleClearAllFilters, ["stop"]),
3287
3309
  title: "Clear all filters"
3288
3310
  }, _hoisted_10$1, 10, _hoisted_8$1)) : createCommentVNode("", true)
@@ -3305,9 +3327,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3305
3327
  key: 0,
3306
3328
  type: "button",
3307
3329
  class: normalizeClass(["bh-clear-all-button", {
3308
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3330
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3309
3331
  }]),
3310
- disabled: !props.hasAnyActiveFilter,
3332
+ disabled: !hasAnyActiveFilterLocal.value,
3311
3333
  onClick: withModifiers(handleClearAllFilters, ["stop"]),
3312
3334
  title: "Clear all filters"
3313
3335
  }, _hoisted_14$1, 10, _hoisted_12$1)) : createCommentVNode("", true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.8.13",
3
+ "version": "1.8.16",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",