@dolusoft/vue3-datatable 1.8.12 → 1.8.14

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.
@@ -3146,14 +3146,32 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3146
3146
  });
3147
3147
  };
3148
3148
  const handleClearAllFilters = () => {
3149
+ var _a;
3149
3150
  Object.keys(filterInputs.value).forEach((key) => {
3150
3151
  filterInputs.value[key] = "";
3151
3152
  });
3152
3153
  Object.keys(columnConditions.value).forEach((key) => {
3153
3154
  columnConditions.value[key] = "";
3154
3155
  });
3156
+ if ((_a = props.all) == null ? void 0 : _a.columns) {
3157
+ props.all.columns.forEach((col) => {
3158
+ if (col.filter) {
3159
+ col.value = "";
3160
+ col.condition = "";
3161
+ }
3162
+ });
3163
+ }
3155
3164
  emit("clearAllFilters");
3156
3165
  };
3166
+ const hasAnyActiveFilterLocal = vue.computed(() => {
3167
+ const hasInputValue = Object.values(filterInputs.value).some(
3168
+ (val) => val !== "" && val !== null && val !== void 0
3169
+ );
3170
+ const hasConditionValue = Object.values(columnConditions.value).some(
3171
+ (val) => val !== "" && val !== null && val !== void 0
3172
+ );
3173
+ return hasInputValue || hasConditionValue;
3174
+ });
3157
3175
  vue.watch(
3158
3176
  () => {
3159
3177
  var _a;
@@ -3256,9 +3274,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3256
3274
  key: 0,
3257
3275
  type: "button",
3258
3276
  class: vue.normalizeClass(["bh-clear-all-button", {
3259
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3277
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3260
3278
  }]),
3261
- disabled: !props.hasAnyActiveFilter,
3279
+ disabled: !hasAnyActiveFilterLocal.value,
3262
3280
  onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3263
3281
  title: "Clear all filters"
3264
3282
  }, _hoisted_6$1, 10, _hoisted_4$1)) : vue.createCommentVNode("", true)
@@ -3281,9 +3299,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3281
3299
  key: 0,
3282
3300
  type: "button",
3283
3301
  class: vue.normalizeClass(["bh-clear-all-button", {
3284
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3302
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3285
3303
  }]),
3286
- disabled: !props.hasAnyActiveFilter,
3304
+ disabled: !hasAnyActiveFilterLocal.value,
3287
3305
  onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3288
3306
  title: "Clear all filters"
3289
3307
  }, _hoisted_10$1, 10, _hoisted_8$1)) : vue.createCommentVNode("", true)
@@ -3306,9 +3324,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3306
3324
  key: 0,
3307
3325
  type: "button",
3308
3326
  class: vue.normalizeClass(["bh-clear-all-button", {
3309
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3327
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3310
3328
  }]),
3311
- disabled: !props.hasAnyActiveFilter,
3329
+ disabled: !hasAnyActiveFilterLocal.value,
3312
3330
  onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3313
3331
  title: "Clear all filters"
3314
3332
  }, _hoisted_14$1, 10, _hoisted_12$1)) : vue.createCommentVNode("", true)
@@ -3820,12 +3838,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3820
3838
  const col = props.columns.find((d) => d.isUnique);
3821
3839
  return (col == null ? void 0 : col.field) || null;
3822
3840
  });
3823
- const hasAnyActiveFilter = vue.computed(() => {
3824
- if (!props.columns) return false;
3825
- return props.columns.some((col) => {
3841
+ const hasAnyActiveFilter = vue.ref(false);
3842
+ const updateHasAnyActiveFilter = () => {
3843
+ hasAnyActiveFilter.value = props.columns.some((col) => {
3826
3844
  return col.value !== void 0 && col.value !== null && col.value !== "";
3827
3845
  });
3828
- });
3846
+ };
3829
3847
  const rowKeys = vue.computed(() => {
3830
3848
  if (!uniqueKey.value) return null;
3831
3849
  return new Map(
@@ -4192,6 +4210,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4192
4210
  }
4193
4211
  selectAll(false);
4194
4212
  filterRows();
4213
+ updateHasAnyActiveFilter();
4195
4214
  };
4196
4215
  vue.watch(() => props.rows, changeRows);
4197
4216
  const setPageSize = (pagesize) => {
@@ -4257,6 +4276,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4257
4276
  };
4258
4277
  const filterChange = () => {
4259
4278
  selectAll(false);
4279
+ updateHasAnyActiveFilter();
4260
4280
  if (props.isServerMode) {
4261
4281
  if (currentPage.value === 1) {
4262
4282
  changeForServer("filter", true);
@@ -4420,13 +4440,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4420
4440
  });
4421
4441
  };
4422
4442
  const clearAllFilters = () => {
4423
- var _a2;
4424
4443
  for (const col of props.columns) {
4425
4444
  if (col.filter) {
4426
4445
  col.value = "";
4427
- col.condition = ((_a2 = col.type) == null ? void 0 : _a2.toLowerCase()) === "string" ? "Contains" : "Equal";
4446
+ col.condition = "";
4428
4447
  }
4429
4448
  }
4449
+ updateHasAnyActiveFilter();
4430
4450
  filterChange();
4431
4451
  emit("clearAllFilters");
4432
4452
  };
@@ -3145,14 +3145,32 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3145
3145
  });
3146
3146
  };
3147
3147
  const handleClearAllFilters = () => {
3148
+ var _a;
3148
3149
  Object.keys(filterInputs.value).forEach((key) => {
3149
3150
  filterInputs.value[key] = "";
3150
3151
  });
3151
3152
  Object.keys(columnConditions.value).forEach((key) => {
3152
3153
  columnConditions.value[key] = "";
3153
3154
  });
3155
+ if ((_a = props.all) == null ? void 0 : _a.columns) {
3156
+ props.all.columns.forEach((col) => {
3157
+ if (col.filter) {
3158
+ col.value = "";
3159
+ col.condition = "";
3160
+ }
3161
+ });
3162
+ }
3154
3163
  emit("clearAllFilters");
3155
3164
  };
3165
+ const hasAnyActiveFilterLocal = computed(() => {
3166
+ const hasInputValue = Object.values(filterInputs.value).some(
3167
+ (val) => val !== "" && val !== null && val !== void 0
3168
+ );
3169
+ const hasConditionValue = Object.values(columnConditions.value).some(
3170
+ (val) => val !== "" && val !== null && val !== void 0
3171
+ );
3172
+ return hasInputValue || hasConditionValue;
3173
+ });
3156
3174
  watch(
3157
3175
  () => {
3158
3176
  var _a;
@@ -3255,9 +3273,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3255
3273
  key: 0,
3256
3274
  type: "button",
3257
3275
  class: normalizeClass(["bh-clear-all-button", {
3258
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3276
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3259
3277
  }]),
3260
- disabled: !props.hasAnyActiveFilter,
3278
+ disabled: !hasAnyActiveFilterLocal.value,
3261
3279
  onClick: withModifiers(handleClearAllFilters, ["stop"]),
3262
3280
  title: "Clear all filters"
3263
3281
  }, _hoisted_6$1, 10, _hoisted_4$1)) : createCommentVNode("", true)
@@ -3280,9 +3298,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3280
3298
  key: 0,
3281
3299
  type: "button",
3282
3300
  class: normalizeClass(["bh-clear-all-button", {
3283
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3301
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3284
3302
  }]),
3285
- disabled: !props.hasAnyActiveFilter,
3303
+ disabled: !hasAnyActiveFilterLocal.value,
3286
3304
  onClick: withModifiers(handleClearAllFilters, ["stop"]),
3287
3305
  title: "Clear all filters"
3288
3306
  }, _hoisted_10$1, 10, _hoisted_8$1)) : createCommentVNode("", true)
@@ -3305,9 +3323,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3305
3323
  key: 0,
3306
3324
  type: "button",
3307
3325
  class: normalizeClass(["bh-clear-all-button", {
3308
- "bh-clear-all-button--active": props.hasAnyActiveFilter
3326
+ "bh-clear-all-button--active": hasAnyActiveFilterLocal.value
3309
3327
  }]),
3310
- disabled: !props.hasAnyActiveFilter,
3328
+ disabled: !hasAnyActiveFilterLocal.value,
3311
3329
  onClick: withModifiers(handleClearAllFilters, ["stop"]),
3312
3330
  title: "Clear all filters"
3313
3331
  }, _hoisted_14$1, 10, _hoisted_12$1)) : createCommentVNode("", true)
@@ -3819,12 +3837,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3819
3837
  const col = props.columns.find((d) => d.isUnique);
3820
3838
  return (col == null ? void 0 : col.field) || null;
3821
3839
  });
3822
- const hasAnyActiveFilter = computed(() => {
3823
- if (!props.columns) return false;
3824
- return props.columns.some((col) => {
3840
+ const hasAnyActiveFilter = ref(false);
3841
+ const updateHasAnyActiveFilter = () => {
3842
+ hasAnyActiveFilter.value = props.columns.some((col) => {
3825
3843
  return col.value !== void 0 && col.value !== null && col.value !== "";
3826
3844
  });
3827
- });
3845
+ };
3828
3846
  const rowKeys = computed(() => {
3829
3847
  if (!uniqueKey.value) return null;
3830
3848
  return new Map(
@@ -4191,6 +4209,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4191
4209
  }
4192
4210
  selectAll(false);
4193
4211
  filterRows();
4212
+ updateHasAnyActiveFilter();
4194
4213
  };
4195
4214
  watch(() => props.rows, changeRows);
4196
4215
  const setPageSize = (pagesize) => {
@@ -4256,6 +4275,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4256
4275
  };
4257
4276
  const filterChange = () => {
4258
4277
  selectAll(false);
4278
+ updateHasAnyActiveFilter();
4259
4279
  if (props.isServerMode) {
4260
4280
  if (currentPage.value === 1) {
4261
4281
  changeForServer("filter", true);
@@ -4419,13 +4439,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4419
4439
  });
4420
4440
  };
4421
4441
  const clearAllFilters = () => {
4422
- var _a2;
4423
4442
  for (const col of props.columns) {
4424
4443
  if (col.filter) {
4425
4444
  col.value = "";
4426
- col.condition = ((_a2 = col.type) == null ? void 0 : _a2.toLowerCase()) === "string" ? "Contains" : "Equal";
4445
+ col.condition = "";
4427
4446
  }
4428
4447
  }
4448
+ updateHasAnyActiveFilter();
4429
4449
  filterChange();
4430
4450
  emit("clearAllFilters");
4431
4451
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.8.12",
3
+ "version": "1.8.14",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",