@dolusoft/vue3-datatable 1.8.11 → 1.8.12

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.
@@ -2925,47 +2925,140 @@ function _sfc_render(_ctx, _cache) {
2925
2925
  const iconFilter = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
2926
2926
  const _hoisted_1$1 = { key: "hdrrow" };
2927
2927
  const _hoisted_2$1 = { class: "bh-checkbox" };
2928
- const _hoisted_3$1 = ["onClick"];
2929
- const _hoisted_4$1 = {
2928
+ const _hoisted_3$1 = {
2929
+ key: 0,
2930
+ class: "bh-filter bh-flex bh-justify-center"
2931
+ };
2932
+ const _hoisted_4$1 = ["disabled"];
2933
+ const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("svg", {
2934
+ width: "14",
2935
+ height: "14",
2936
+ viewBox: "0 0 24 24",
2937
+ fill: "none",
2938
+ stroke: "currentColor",
2939
+ "stroke-width": "2",
2940
+ "stroke-linecap": "round",
2941
+ "stroke-linejoin": "round"
2942
+ }, [
2943
+ /* @__PURE__ */ vue.createElementVNode("line", {
2944
+ x1: "18",
2945
+ y1: "6",
2946
+ x2: "6",
2947
+ y2: "18"
2948
+ }),
2949
+ /* @__PURE__ */ vue.createElementVNode("line", {
2950
+ x1: "6",
2951
+ y1: "6",
2952
+ x2: "18",
2953
+ y2: "18"
2954
+ })
2955
+ ], -1);
2956
+ const _hoisted_6$1 = [
2957
+ _hoisted_5$1
2958
+ ];
2959
+ const _hoisted_7$1 = {
2960
+ key: 0,
2961
+ class: "bh-filter bh-flex bh-justify-center"
2962
+ };
2963
+ const _hoisted_8$1 = ["disabled"];
2964
+ const _hoisted_9$1 = /* @__PURE__ */ vue.createElementVNode("svg", {
2965
+ width: "14",
2966
+ height: "14",
2967
+ viewBox: "0 0 24 24",
2968
+ fill: "none",
2969
+ stroke: "currentColor",
2970
+ "stroke-width": "2",
2971
+ "stroke-linecap": "round",
2972
+ "stroke-linejoin": "round"
2973
+ }, [
2974
+ /* @__PURE__ */ vue.createElementVNode("line", {
2975
+ x1: "18",
2976
+ y1: "6",
2977
+ x2: "6",
2978
+ y2: "18"
2979
+ }),
2980
+ /* @__PURE__ */ vue.createElementVNode("line", {
2981
+ x1: "6",
2982
+ y1: "6",
2983
+ x2: "18",
2984
+ y2: "18"
2985
+ })
2986
+ ], -1);
2987
+ const _hoisted_10$1 = [
2988
+ _hoisted_9$1
2989
+ ];
2990
+ const _hoisted_11$1 = {
2991
+ key: 1,
2992
+ class: "bh-filter bh-flex bh-justify-center"
2993
+ };
2994
+ const _hoisted_12$1 = ["disabled"];
2995
+ const _hoisted_13$1 = /* @__PURE__ */ vue.createElementVNode("svg", {
2996
+ width: "14",
2997
+ height: "14",
2998
+ viewBox: "0 0 24 24",
2999
+ fill: "none",
3000
+ stroke: "currentColor",
3001
+ "stroke-width": "2",
3002
+ "stroke-linecap": "round",
3003
+ "stroke-linejoin": "round"
3004
+ }, [
3005
+ /* @__PURE__ */ vue.createElementVNode("line", {
3006
+ x1: "18",
3007
+ y1: "6",
3008
+ x2: "6",
3009
+ y2: "18"
3010
+ }),
3011
+ /* @__PURE__ */ vue.createElementVNode("line", {
3012
+ x1: "6",
3013
+ y1: "6",
3014
+ x2: "18",
3015
+ y2: "18"
3016
+ })
3017
+ ], -1);
3018
+ const _hoisted_14$1 = [
3019
+ _hoisted_13$1
3020
+ ];
3021
+ const _hoisted_15$1 = ["onClick"];
3022
+ const _hoisted_16$1 = {
2930
3023
  width: "16",
2931
3024
  height: "16",
2932
3025
  viewBox: "0 0 14 14",
2933
3026
  fill: "none"
2934
3027
  };
2935
- const _hoisted_5$1 = {
3028
+ const _hoisted_17$1 = {
2936
3029
  key: 0,
2937
3030
  class: "bh-filter bh-relative"
2938
3031
  };
2939
- const _hoisted_6$1 = ["onUpdate:modelValue"];
2940
- const _hoisted_7$1 = ["onUpdate:modelValue"];
2941
- const _hoisted_8$1 = ["onUpdate:modelValue"];
2942
- const _hoisted_9$1 = ["onUpdate:modelValue"];
2943
- const _hoisted_10$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: void 0 }, "All", -1);
2944
- const _hoisted_11$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: true }, "True", -1);
2945
- const _hoisted_12$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: false }, "False", -1);
2946
- const _hoisted_13$1 = [
2947
- _hoisted_10$1,
2948
- _hoisted_11$1,
2949
- _hoisted_12$1
3032
+ const _hoisted_18$1 = ["onUpdate:modelValue"];
3033
+ const _hoisted_19$1 = ["onUpdate:modelValue"];
3034
+ const _hoisted_20$1 = ["onUpdate:modelValue"];
3035
+ const _hoisted_21$1 = ["onUpdate:modelValue"];
3036
+ const _hoisted_22$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: void 0 }, "All", -1);
3037
+ const _hoisted_23$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: true }, "True", -1);
3038
+ const _hoisted_24$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: false }, "False", -1);
3039
+ const _hoisted_25$1 = [
3040
+ _hoisted_22$1,
3041
+ _hoisted_23$1,
3042
+ _hoisted_24$1
2950
3043
  ];
2951
- const _hoisted_14$1 = {
3044
+ const _hoisted_26$1 = {
2952
3045
  key: 1,
2953
3046
  class: "bh-filter-input-wrapper"
2954
3047
  };
2955
- const _hoisted_15$1 = ["onUpdate:modelValue"];
2956
- const _hoisted_16$1 = ["onUpdate:modelValue"];
2957
- const _hoisted_17$1 = ["onUpdate:modelValue"];
2958
- const _hoisted_18$1 = ["onUpdate:modelValue"];
2959
- const _hoisted_19$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: void 0 }, "All", -1);
2960
- const _hoisted_20$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: true }, "True", -1);
2961
- const _hoisted_21$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: false }, "False", -1);
2962
- const _hoisted_22$1 = [
2963
- _hoisted_19$1,
2964
- _hoisted_20$1,
2965
- _hoisted_21$1
3048
+ const _hoisted_27$1 = ["onUpdate:modelValue"];
3049
+ const _hoisted_28$1 = ["onUpdate:modelValue"];
3050
+ const _hoisted_29$1 = ["onUpdate:modelValue"];
3051
+ const _hoisted_30$1 = ["onUpdate:modelValue"];
3052
+ const _hoisted_31$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: void 0 }, "All", -1);
3053
+ const _hoisted_32$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: true }, "True", -1);
3054
+ const _hoisted_33$1 = /* @__PURE__ */ vue.createElementVNode("option", { value: false }, "False", -1);
3055
+ const _hoisted_34$1 = [
3056
+ _hoisted_31$1,
3057
+ _hoisted_32$1,
3058
+ _hoisted_33$1
2966
3059
  ];
2967
- const _hoisted_23$1 = ["onClick"];
2968
- const _hoisted_24$1 = ["onClick"];
3060
+ const _hoisted_35$1 = ["onClick"];
3061
+ const _hoisted_36$1 = ["onClick"];
2969
3062
  const __default__$1 = {
2970
3063
  name: "columnHeader"
2971
3064
  };
@@ -2980,7 +3073,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2980
3073
  "isFooter",
2981
3074
  "checkAll",
2982
3075
  "columnFilterLang",
2983
- "hasFilterDatetimeSlot"
3076
+ "hasFilterDatetimeSlot",
3077
+ "showClearAllButton",
3078
+ "hasAnyActiveFilter"
2984
3079
  ],
2985
3080
  emits: [
2986
3081
  "selectAll",
@@ -2988,12 +3083,19 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2988
3083
  "filterChange",
2989
3084
  "toggleFilterMenu",
2990
3085
  "clearColumnFilter",
2991
- "filterDatetimeUpdate"
3086
+ "filterDatetimeUpdate",
3087
+ "clearAllFilters"
2992
3088
  ],
2993
3089
  setup(__props, { emit: __emit }) {
2994
3090
  const selectedAll = vue.ref(null);
2995
3091
  const props = __props;
2996
3092
  const emit = __emit;
3093
+ const clearButtonLocation = vue.computed(() => {
3094
+ if (props.all.hasCheckbox) return "checkbox";
3095
+ if (props.all.hasRightPanel) return "rightpanel";
3096
+ if (props.all.hasSubtable) return "subtable";
3097
+ return "none";
3098
+ });
2997
3099
  const filterInputs = vue.ref({});
2998
3100
  const columnConditions = vue.ref({});
2999
3101
  const watchedFields = vue.ref(/* @__PURE__ */ new Set());
@@ -3043,6 +3145,15 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3043
3145
  }
3044
3146
  });
3045
3147
  };
3148
+ const handleClearAllFilters = () => {
3149
+ Object.keys(filterInputs.value).forEach((key) => {
3150
+ filterInputs.value[key] = "";
3151
+ });
3152
+ Object.keys(columnConditions.value).forEach((key) => {
3153
+ columnConditions.value[key] = "";
3154
+ });
3155
+ emit("clearAllFilters");
3156
+ };
3046
3157
  vue.watch(
3047
3158
  () => {
3048
3159
  var _a;
@@ -3139,7 +3250,19 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3139
3250
  vue.createVNode(iconCheck, { class: "check" }),
3140
3251
  vue.createVNode(iconDash, { class: "intermediate" })
3141
3252
  ])
3142
- ])
3253
+ ]),
3254
+ props.all.columnFilter && !props.isFooter && clearButtonLocation.value === "checkbox" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
3255
+ props.showClearAllButton ? (vue.openBlock(), vue.createElementBlock("button", {
3256
+ key: 0,
3257
+ type: "button",
3258
+ class: vue.normalizeClass(["bh-clear-all-button", {
3259
+ "bh-clear-all-button--active": props.hasAnyActiveFilter
3260
+ }]),
3261
+ disabled: !props.hasAnyActiveFilter,
3262
+ onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3263
+ title: "Clear all filters"
3264
+ }, _hoisted_6$1, 10, _hoisted_4$1)) : vue.createCommentVNode("", true)
3265
+ ])) : vue.createCommentVNode("", true)
3143
3266
  ], 6)) : vue.createCommentVNode("", true),
3144
3267
  props.all.hasRightPanel ? (vue.openBlock(), vue.createElementBlock("th", {
3145
3268
  key: 1,
@@ -3152,7 +3275,20 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3152
3275
  "bh-top-0": props.all.stickyHeader,
3153
3276
  "bh-left-0": props.all.stickyFirstColumn
3154
3277
  })
3155
- }, null, 6)) : vue.createCommentVNode("", true),
3278
+ }, [
3279
+ props.all.columnFilter && !props.isFooter && clearButtonLocation.value === "rightpanel" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
3280
+ props.showClearAllButton ? (vue.openBlock(), vue.createElementBlock("button", {
3281
+ key: 0,
3282
+ type: "button",
3283
+ class: vue.normalizeClass(["bh-clear-all-button", {
3284
+ "bh-clear-all-button--active": props.hasAnyActiveFilter
3285
+ }]),
3286
+ disabled: !props.hasAnyActiveFilter,
3287
+ onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3288
+ title: "Clear all filters"
3289
+ }, _hoisted_10$1, 10, _hoisted_8$1)) : vue.createCommentVNode("", true)
3290
+ ])) : vue.createCommentVNode("", true)
3291
+ ], 6)) : vue.createCommentVNode("", true),
3156
3292
  props.all.hasSubtable ? (vue.openBlock(), vue.createElementBlock("th", {
3157
3293
  key: 2,
3158
3294
  style: vue.normalizeStyle({
@@ -3164,7 +3300,19 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3164
3300
  key: 0,
3165
3301
  expandedrows: props.expandedrows,
3166
3302
  expandall: props.all.expandall
3167
- }, null, 8, ["expandedrows", "expandall"])) : vue.createCommentVNode("", true)
3303
+ }, null, 8, ["expandedrows", "expandall"])) : vue.createCommentVNode("", true),
3304
+ props.all.columnFilter && !props.isFooter && clearButtonLocation.value === "subtable" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$1, [
3305
+ props.showClearAllButton ? (vue.openBlock(), vue.createElementBlock("button", {
3306
+ key: 0,
3307
+ type: "button",
3308
+ class: vue.normalizeClass(["bh-clear-all-button", {
3309
+ "bh-clear-all-button--active": props.hasAnyActiveFilter
3310
+ }]),
3311
+ disabled: !props.hasAnyActiveFilter,
3312
+ onClick: vue.withModifiers(handleClearAllFilters, ["stop"]),
3313
+ title: "Clear all filters"
3314
+ }, _hoisted_14$1, 10, _hoisted_12$1)) : vue.createCommentVNode("", true)
3315
+ ])) : vue.createCommentVNode("", true)
3168
3316
  ], 4)) : vue.createCommentVNode("", true),
3169
3317
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.all.columns, (col, j) => {
3170
3318
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
@@ -3190,7 +3338,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3190
3338
  key: 0,
3191
3339
  class: vue.normalizeClass(["bh-ml-3 bh-sort bh-flex bh-items-center", [props.currentSortColumn, props.currentSortDirection]])
3192
3340
  }, [
3193
- (vue.openBlock(), vue.createElementBlock("svg", _hoisted_4$1, [
3341
+ (vue.openBlock(), vue.createElementBlock("svg", _hoisted_16$1, [
3194
3342
  vue.createElementVNode("polygon", {
3195
3343
  points: "3.11,6.25 10.89,6.25 7,1.75 ",
3196
3344
  fill: "currentColor",
@@ -3207,16 +3355,16 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3207
3355
  }, null, 2)
3208
3356
  ]))
3209
3357
  ], 2)) : vue.createCommentVNode("", true)
3210
- ], 10, _hoisted_3$1),
3358
+ ], 10, _hoisted_15$1),
3211
3359
  props.all.columnFilter && !props.isFooter ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3212
- col.filter ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
3360
+ col.filter ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, [
3213
3361
  !props.all.showFloatingFilterLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3214
3362
  col.type === "string" || col.type === "String" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
3215
3363
  key: 0,
3216
3364
  "onUpdate:modelValue": ($event) => filterInputs.value[col.field] = $event,
3217
3365
  type: "text",
3218
3366
  class: "bh-form-control"
3219
- }, null, 8, _hoisted_6$1)), [
3367
+ }, null, 8, _hoisted_18$1)), [
3220
3368
  [vue.vModelText, filterInputs.value[col.field]]
3221
3369
  ]) : vue.createCommentVNode("", true),
3222
3370
  col.type === "number" || col.type === "integer" || col.type === "Integer" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
@@ -3224,7 +3372,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3224
3372
  "onUpdate:modelValue": ($event) => filterInputs.value[col.field] = $event,
3225
3373
  type: "number",
3226
3374
  class: "bh-form-control"
3227
- }, null, 8, _hoisted_7$1)), [
3375
+ }, null, 8, _hoisted_19$1)), [
3228
3376
  [
3229
3377
  vue.vModelText,
3230
3378
  filterInputs.value[col.field],
@@ -3245,7 +3393,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3245
3393
  "onUpdate:modelValue": ($event) => filterInputs.value[col.field] = $event,
3246
3394
  type: "date",
3247
3395
  class: "bh-form-control"
3248
- }, null, 8, _hoisted_8$1)), [
3396
+ }, null, 8, _hoisted_20$1)), [
3249
3397
  [vue.vModelText, filterInputs.value[col.field]]
3250
3398
  ])
3251
3399
  ], 64)) : col.type === "bool" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("select", {
@@ -3254,11 +3402,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3254
3402
  class: "bh-form-control",
3255
3403
  onClick: _cache[1] || (_cache[1] = //@ts-ignore
3256
3404
  (...args) => props.isOpenFilter && props.isOpenFilter(...args))
3257
- }, _hoisted_13$1, 8, _hoisted_9$1)), [
3405
+ }, _hoisted_25$1, 8, _hoisted_21$1)), [
3258
3406
  [vue.vModelSelect, filterInputs.value[col.field]]
3259
3407
  ]) : vue.createCommentVNode("", true)
3260
3408
  ], 64)) : vue.createCommentVNode("", true),
3261
- props.all.showFloatingFilterLabel ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$1, [
3409
+ props.all.showFloatingFilterLabel ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_26$1, [
3262
3410
  hasConditionSet(col) && props.all.useNewColumnFilter ? (vue.openBlock(), vue.createElementBlock("label", {
3263
3411
  key: 0,
3264
3412
  class: vue.normalizeClass(["bh-floating-label", {
@@ -3272,7 +3420,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3272
3420
  class: vue.normalizeClass(["bh-form-control", {
3273
3421
  "bh-form-control--with-label": hasConditionSet(col) && props.all.useNewColumnFilter
3274
3422
  }])
3275
- }, null, 10, _hoisted_15$1)), [
3423
+ }, null, 10, _hoisted_27$1)), [
3276
3424
  [vue.vModelText, filterInputs.value[col.field]]
3277
3425
  ]) : vue.createCommentVNode("", true),
3278
3426
  col.type === "number" || col.type === "integer" || col.type === "Integer" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
@@ -3282,7 +3430,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3282
3430
  class: vue.normalizeClass(["bh-form-control", {
3283
3431
  "bh-form-control--with-label": hasConditionSet(col) && props.all.useNewColumnFilter
3284
3432
  }])
3285
- }, null, 10, _hoisted_16$1)), [
3433
+ }, null, 10, _hoisted_28$1)), [
3286
3434
  [
3287
3435
  vue.vModelText,
3288
3436
  filterInputs.value[col.field],
@@ -3306,7 +3454,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3306
3454
  class: vue.normalizeClass(["bh-form-control", {
3307
3455
  "bh-form-control--with-label": hasConditionSet(col) && props.all.useNewColumnFilter
3308
3456
  }])
3309
- }, null, 10, _hoisted_17$1)), [
3457
+ }, null, 10, _hoisted_29$1)), [
3310
3458
  [vue.vModelText, filterInputs.value[col.field]]
3311
3459
  ])
3312
3460
  ], 64)) : col.type === "bool" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("select", {
@@ -3315,7 +3463,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3315
3463
  class: "bh-form-control",
3316
3464
  onClick: _cache[2] || (_cache[2] = //@ts-ignore
3317
3465
  (...args) => props.isOpenFilter && props.isOpenFilter(...args))
3318
- }, _hoisted_22$1, 8, _hoisted_18$1)), [
3466
+ }, _hoisted_34$1, 8, _hoisted_30$1)), [
3319
3467
  [vue.vModelSelect, filterInputs.value[col.field]]
3320
3468
  ]) : vue.createCommentVNode("", true)
3321
3469
  ])) : vue.createCommentVNode("", true),
@@ -3335,7 +3483,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3335
3483
  "bh-text-black/70 dark:bh-text-gray-300": !hasConditionSet(col)
3336
3484
  }])
3337
3485
  }, null, 8, ["class"])
3338
- ], 10, _hoisted_23$1)) : vue.createCommentVNode("", true),
3486
+ ], 10, _hoisted_35$1)) : vue.createCommentVNode("", true),
3339
3487
  !props.all.useNewColumnFilter ? vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$6, {
3340
3488
  key: 3,
3341
3489
  column: col,
@@ -3385,7 +3533,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3385
3533
  "bh-text-black/70 dark:bh-text-gray-300": !hasConditionSet(col)
3386
3534
  }])
3387
3535
  }, null, 8, ["class"])
3388
- ], 10, _hoisted_24$1)) : vue.createCommentVNode("", true)
3536
+ ], 10, _hoisted_36$1)) : vue.createCommentVNode("", true)
3389
3537
  ]),
3390
3538
  _: 2
3391
3539
  }, 1032, ["shown"])) : vue.createCommentVNode("", true)
@@ -3575,6 +3723,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3575
3723
  stickyFirstColumn: { type: Boolean, default: false },
3576
3724
  cloneHeaderInFooter: { type: Boolean, default: false },
3577
3725
  selectRowOnClick: { type: Boolean, default: false },
3726
+ showClearAllButton: { type: Boolean, default: false },
3578
3727
  enableleftmenu: { type: Boolean },
3579
3728
  enabletopmenu: { type: Boolean },
3580
3729
  enableHeaderArea: { type: Boolean, default: false },
@@ -3606,7 +3755,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3606
3755
  "rowDBClick",
3607
3756
  "currentTopMenuSize",
3608
3757
  "currentLeftMenuSize",
3609
- "rowRightPanelClick"
3758
+ "rowRightPanelClick",
3759
+ "clearAllFilters"
3610
3760
  ],
3611
3761
  setup(__props, { expose: __expose, emit: __emit }) {
3612
3762
  var _a, _b;
@@ -3670,6 +3820,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3670
3820
  const col = props.columns.find((d) => d.isUnique);
3671
3821
  return (col == null ? void 0 : col.field) || null;
3672
3822
  });
3823
+ const hasAnyActiveFilter = vue.computed(() => {
3824
+ if (!props.columns) return false;
3825
+ return props.columns.some((col) => {
3826
+ return col.value !== void 0 && col.value !== null && col.value !== "";
3827
+ });
3828
+ });
3673
3829
  const rowKeys = vue.computed(() => {
3674
3830
  if (!uniqueKey.value) return null;
3675
3831
  return new Map(
@@ -3934,6 +4090,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3934
4090
  isLeftMenuMinimized.value = minimized;
3935
4091
  currentLeftMenuWidth.value = minimized ? props.leftmenuMinWidth : props.leftmenuDefaultWidth;
3936
4092
  updateLeftMenuStyle();
4093
+ },
4094
+ clearAllFilters() {
4095
+ clearAllFilters();
3937
4096
  }
3938
4097
  });
3939
4098
  vue.watch(
@@ -4260,6 +4419,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4260
4419
  expandedrows.value.set(key, false);
4261
4420
  });
4262
4421
  };
4422
+ const clearAllFilters = () => {
4423
+ var _a2;
4424
+ for (const col of props.columns) {
4425
+ if (col.filter) {
4426
+ col.value = "";
4427
+ col.condition = ((_a2 = col.type) == null ? void 0 : _a2.toLowerCase()) === "string" ? "Contains" : "Equal";
4428
+ }
4429
+ }
4430
+ filterChange();
4431
+ emit("clearAllFilters");
4432
+ };
4263
4433
  let extracolumnlength = 0;
4264
4434
  if (props.hasCheckbox) {
4265
4435
  extracolumnlength++;
@@ -4421,11 +4591,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4421
4591
  checkAll: selectedAll.value,
4422
4592
  columnFilterLang: props.columnFilterLang,
4423
4593
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
4594
+ showClearAllButton: props.showClearAllButton,
4595
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4424
4596
  onSelectAll: selectAll,
4425
4597
  onSortChange: sortChange,
4426
4598
  onFilterChange: filterChange,
4427
4599
  onToggleFilterMenu: toggleFilterMenu,
4428
- onClearColumnFilter: clearColumnFilter
4600
+ onClearColumnFilter: clearColumnFilter,
4601
+ onClearAllFilters: clearAllFilters
4429
4602
  }, vue.createSlots({ _: 2 }, [
4430
4603
  hasFilterDatetimeSlot.value ? {
4431
4604
  name: "filter-datetime",
@@ -4434,7 +4607,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4434
4607
  ]),
4435
4608
  key: "0"
4436
4609
  } : void 0
4437
- ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot"])
4610
+ ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4438
4611
  ], 2),
4439
4612
  vue.createElementVNode("tbody", null, [
4440
4613
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filterItems.value, (item, i) => {
@@ -4603,10 +4776,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4603
4776
  isFooter: true,
4604
4777
  checkAll: selectedAll.value,
4605
4778
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
4779
+ showClearAllButton: props.showClearAllButton,
4780
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4606
4781
  onSelectAll: selectAll,
4607
4782
  onSortChange: sortChange,
4608
4783
  onFilterChange: filterChange,
4609
- onToggleFilterMenu: toggleFilterMenu
4784
+ onToggleFilterMenu: toggleFilterMenu,
4785
+ onClearAllFilters: clearAllFilters
4610
4786
  }, vue.createSlots({ _: 2 }, [
4611
4787
  hasFilterDatetimeSlot.value ? {
4612
4788
  name: "filter-datetime",
@@ -4615,7 +4791,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4615
4791
  ]),
4616
4792
  key: "0"
4617
4793
  } : void 0
4618
- ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot"])
4794
+ ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4619
4795
  ], 2)) : vue.createCommentVNode("", true)
4620
4796
  ], 2),
4621
4797
  currentLoader.value && _ctx.enableloadinganimation ? (vue.openBlock(), vue.createElementBlock("div", {
@@ -4687,11 +4863,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4687
4863
  checkAll: selectedAll.value,
4688
4864
  columnFilterLang: props.columnFilterLang,
4689
4865
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
4866
+ showClearAllButton: props.showClearAllButton,
4867
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4690
4868
  onSelectAll: selectAll,
4691
4869
  onSortChange: sortChange,
4692
4870
  onFilterChange: filterChange,
4693
4871
  onToggleFilterMenu: toggleFilterMenu,
4694
- onClearColumnFilter: clearColumnFilter
4872
+ onClearColumnFilter: clearColumnFilter,
4873
+ onClearAllFilters: clearAllFilters
4695
4874
  }, vue.createSlots({ _: 2 }, [
4696
4875
  hasFilterDatetimeSlot.value ? {
4697
4876
  name: "filter-datetime",
@@ -4700,7 +4879,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4700
4879
  ]),
4701
4880
  key: "0"
4702
4881
  } : void 0
4703
- ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot"])
4882
+ ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4704
4883
  ], 2),
4705
4884
  vue.createElementVNode("tbody", null, [
4706
4885
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filterItems.value, (item, i) => {
@@ -4878,10 +5057,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4878
5057
  isFooter: true,
4879
5058
  checkAll: selectedAll.value,
4880
5059
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
5060
+ showClearAllButton: props.showClearAllButton,
5061
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4881
5062
  onSelectAll: selectAll,
4882
5063
  onSortChange: sortChange,
4883
5064
  onFilterChange: filterChange,
4884
- onToggleFilterMenu: toggleFilterMenu
5065
+ onToggleFilterMenu: toggleFilterMenu,
5066
+ onClearAllFilters: clearAllFilters
4885
5067
  }, vue.createSlots({ _: 2 }, [
4886
5068
  hasFilterDatetimeSlot.value ? {
4887
5069
  name: "filter-datetime",
@@ -4890,7 +5072,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4890
5072
  ]),
4891
5073
  key: "0"
4892
5074
  } : void 0
4893
- ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot"])
5075
+ ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4894
5076
  ], 2)) : vue.createCommentVNode("", true)
4895
5077
  ], 2),
4896
5078
  currentLoader.value && _ctx.enableloadinganimation ? (vue.openBlock(), vue.createElementBlock("div", {
@@ -50,3 +50,42 @@
50
50
  .bh-datatable tbody tr:has(td[colspan]) {
51
51
  z-index: 0;
52
52
  }
53
+ /* Clear All Filters Button */
54
+ .bh-clear-all-button {
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ width: 28px;
59
+ height: 28px;
60
+ padding: 0;
61
+ border: 1px solid #e0e6ed;
62
+ border-radius: 4px;
63
+ background: #e0e6ed;
64
+ color: rgba(0, 0, 0, 0.4);
65
+ cursor: not-allowed;
66
+ transition: all 0.2s ease;
67
+ }
68
+ .bh-clear-all-button:disabled {
69
+ opacity: 0.5;
70
+ }
71
+ .bh-clear-all-button--active {
72
+ background: rgba(var(--primary-rgb, 59, 130, 246), 0.1);
73
+ border-color: var(--primary, #3b82f6);
74
+ color: var(--primary, #3b82f6);
75
+ cursor: pointer;
76
+ }
77
+ .bh-clear-all-button--active:hover {
78
+ background: rgba(var(--primary-rgb, 59, 130, 246), 0.2);
79
+ }
80
+
81
+ /* Dark mode */
82
+ .dark .bh-clear-all-button {
83
+ background: #374151;
84
+ border-color: #4b5563;
85
+ color: rgba(255, 255, 255, 0.4);
86
+ }
87
+ .dark .bh-clear-all-button--active {
88
+ background: rgba(var(--primary-rgb, 59, 130, 246), 0.2);
89
+ border-color: var(--primary, #3b82f6);
90
+ color: var(--primary, #3b82f6);
91
+ }
@@ -2924,47 +2924,140 @@ function _sfc_render(_ctx, _cache) {
2924
2924
  const iconFilter = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
2925
2925
  const _hoisted_1$1 = { key: "hdrrow" };
2926
2926
  const _hoisted_2$1 = { class: "bh-checkbox" };
2927
- const _hoisted_3$1 = ["onClick"];
2928
- const _hoisted_4$1 = {
2927
+ const _hoisted_3$1 = {
2928
+ key: 0,
2929
+ class: "bh-filter bh-flex bh-justify-center"
2930
+ };
2931
+ const _hoisted_4$1 = ["disabled"];
2932
+ const _hoisted_5$1 = /* @__PURE__ */ createElementVNode("svg", {
2933
+ width: "14",
2934
+ height: "14",
2935
+ viewBox: "0 0 24 24",
2936
+ fill: "none",
2937
+ stroke: "currentColor",
2938
+ "stroke-width": "2",
2939
+ "stroke-linecap": "round",
2940
+ "stroke-linejoin": "round"
2941
+ }, [
2942
+ /* @__PURE__ */ createElementVNode("line", {
2943
+ x1: "18",
2944
+ y1: "6",
2945
+ x2: "6",
2946
+ y2: "18"
2947
+ }),
2948
+ /* @__PURE__ */ createElementVNode("line", {
2949
+ x1: "6",
2950
+ y1: "6",
2951
+ x2: "18",
2952
+ y2: "18"
2953
+ })
2954
+ ], -1);
2955
+ const _hoisted_6$1 = [
2956
+ _hoisted_5$1
2957
+ ];
2958
+ const _hoisted_7$1 = {
2959
+ key: 0,
2960
+ class: "bh-filter bh-flex bh-justify-center"
2961
+ };
2962
+ const _hoisted_8$1 = ["disabled"];
2963
+ const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("svg", {
2964
+ width: "14",
2965
+ height: "14",
2966
+ viewBox: "0 0 24 24",
2967
+ fill: "none",
2968
+ stroke: "currentColor",
2969
+ "stroke-width": "2",
2970
+ "stroke-linecap": "round",
2971
+ "stroke-linejoin": "round"
2972
+ }, [
2973
+ /* @__PURE__ */ createElementVNode("line", {
2974
+ x1: "18",
2975
+ y1: "6",
2976
+ x2: "6",
2977
+ y2: "18"
2978
+ }),
2979
+ /* @__PURE__ */ createElementVNode("line", {
2980
+ x1: "6",
2981
+ y1: "6",
2982
+ x2: "18",
2983
+ y2: "18"
2984
+ })
2985
+ ], -1);
2986
+ const _hoisted_10$1 = [
2987
+ _hoisted_9$1
2988
+ ];
2989
+ const _hoisted_11$1 = {
2990
+ key: 1,
2991
+ class: "bh-filter bh-flex bh-justify-center"
2992
+ };
2993
+ const _hoisted_12$1 = ["disabled"];
2994
+ const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("svg", {
2995
+ width: "14",
2996
+ height: "14",
2997
+ viewBox: "0 0 24 24",
2998
+ fill: "none",
2999
+ stroke: "currentColor",
3000
+ "stroke-width": "2",
3001
+ "stroke-linecap": "round",
3002
+ "stroke-linejoin": "round"
3003
+ }, [
3004
+ /* @__PURE__ */ createElementVNode("line", {
3005
+ x1: "18",
3006
+ y1: "6",
3007
+ x2: "6",
3008
+ y2: "18"
3009
+ }),
3010
+ /* @__PURE__ */ createElementVNode("line", {
3011
+ x1: "6",
3012
+ y1: "6",
3013
+ x2: "18",
3014
+ y2: "18"
3015
+ })
3016
+ ], -1);
3017
+ const _hoisted_14$1 = [
3018
+ _hoisted_13$1
3019
+ ];
3020
+ const _hoisted_15$1 = ["onClick"];
3021
+ const _hoisted_16$1 = {
2929
3022
  width: "16",
2930
3023
  height: "16",
2931
3024
  viewBox: "0 0 14 14",
2932
3025
  fill: "none"
2933
3026
  };
2934
- const _hoisted_5$1 = {
3027
+ const _hoisted_17$1 = {
2935
3028
  key: 0,
2936
3029
  class: "bh-filter bh-relative"
2937
3030
  };
2938
- const _hoisted_6$1 = ["onUpdate:modelValue"];
2939
- const _hoisted_7$1 = ["onUpdate:modelValue"];
2940
- const _hoisted_8$1 = ["onUpdate:modelValue"];
2941
- const _hoisted_9$1 = ["onUpdate:modelValue"];
2942
- const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("option", { value: void 0 }, "All", -1);
2943
- const _hoisted_11$1 = /* @__PURE__ */ createElementVNode("option", { value: true }, "True", -1);
2944
- const _hoisted_12$1 = /* @__PURE__ */ createElementVNode("option", { value: false }, "False", -1);
2945
- const _hoisted_13$1 = [
2946
- _hoisted_10$1,
2947
- _hoisted_11$1,
2948
- _hoisted_12$1
3031
+ const _hoisted_18$1 = ["onUpdate:modelValue"];
3032
+ const _hoisted_19$1 = ["onUpdate:modelValue"];
3033
+ const _hoisted_20$1 = ["onUpdate:modelValue"];
3034
+ const _hoisted_21$1 = ["onUpdate:modelValue"];
3035
+ const _hoisted_22$1 = /* @__PURE__ */ createElementVNode("option", { value: void 0 }, "All", -1);
3036
+ const _hoisted_23$1 = /* @__PURE__ */ createElementVNode("option", { value: true }, "True", -1);
3037
+ const _hoisted_24$1 = /* @__PURE__ */ createElementVNode("option", { value: false }, "False", -1);
3038
+ const _hoisted_25$1 = [
3039
+ _hoisted_22$1,
3040
+ _hoisted_23$1,
3041
+ _hoisted_24$1
2949
3042
  ];
2950
- const _hoisted_14$1 = {
3043
+ const _hoisted_26$1 = {
2951
3044
  key: 1,
2952
3045
  class: "bh-filter-input-wrapper"
2953
3046
  };
2954
- const _hoisted_15$1 = ["onUpdate:modelValue"];
2955
- const _hoisted_16$1 = ["onUpdate:modelValue"];
2956
- const _hoisted_17$1 = ["onUpdate:modelValue"];
2957
- const _hoisted_18$1 = ["onUpdate:modelValue"];
2958
- const _hoisted_19$1 = /* @__PURE__ */ createElementVNode("option", { value: void 0 }, "All", -1);
2959
- const _hoisted_20$1 = /* @__PURE__ */ createElementVNode("option", { value: true }, "True", -1);
2960
- const _hoisted_21$1 = /* @__PURE__ */ createElementVNode("option", { value: false }, "False", -1);
2961
- const _hoisted_22$1 = [
2962
- _hoisted_19$1,
2963
- _hoisted_20$1,
2964
- _hoisted_21$1
3047
+ const _hoisted_27$1 = ["onUpdate:modelValue"];
3048
+ const _hoisted_28$1 = ["onUpdate:modelValue"];
3049
+ const _hoisted_29$1 = ["onUpdate:modelValue"];
3050
+ const _hoisted_30$1 = ["onUpdate:modelValue"];
3051
+ const _hoisted_31$1 = /* @__PURE__ */ createElementVNode("option", { value: void 0 }, "All", -1);
3052
+ const _hoisted_32$1 = /* @__PURE__ */ createElementVNode("option", { value: true }, "True", -1);
3053
+ const _hoisted_33$1 = /* @__PURE__ */ createElementVNode("option", { value: false }, "False", -1);
3054
+ const _hoisted_34$1 = [
3055
+ _hoisted_31$1,
3056
+ _hoisted_32$1,
3057
+ _hoisted_33$1
2965
3058
  ];
2966
- const _hoisted_23$1 = ["onClick"];
2967
- const _hoisted_24$1 = ["onClick"];
3059
+ const _hoisted_35$1 = ["onClick"];
3060
+ const _hoisted_36$1 = ["onClick"];
2968
3061
  const __default__$1 = {
2969
3062
  name: "columnHeader"
2970
3063
  };
@@ -2979,7 +3072,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2979
3072
  "isFooter",
2980
3073
  "checkAll",
2981
3074
  "columnFilterLang",
2982
- "hasFilterDatetimeSlot"
3075
+ "hasFilterDatetimeSlot",
3076
+ "showClearAllButton",
3077
+ "hasAnyActiveFilter"
2983
3078
  ],
2984
3079
  emits: [
2985
3080
  "selectAll",
@@ -2987,12 +3082,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2987
3082
  "filterChange",
2988
3083
  "toggleFilterMenu",
2989
3084
  "clearColumnFilter",
2990
- "filterDatetimeUpdate"
3085
+ "filterDatetimeUpdate",
3086
+ "clearAllFilters"
2991
3087
  ],
2992
3088
  setup(__props, { emit: __emit }) {
2993
3089
  const selectedAll = ref(null);
2994
3090
  const props = __props;
2995
3091
  const emit = __emit;
3092
+ const clearButtonLocation = computed(() => {
3093
+ if (props.all.hasCheckbox) return "checkbox";
3094
+ if (props.all.hasRightPanel) return "rightpanel";
3095
+ if (props.all.hasSubtable) return "subtable";
3096
+ return "none";
3097
+ });
2996
3098
  const filterInputs = ref({});
2997
3099
  const columnConditions = ref({});
2998
3100
  const watchedFields = ref(/* @__PURE__ */ new Set());
@@ -3042,6 +3144,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3042
3144
  }
3043
3145
  });
3044
3146
  };
3147
+ const handleClearAllFilters = () => {
3148
+ Object.keys(filterInputs.value).forEach((key) => {
3149
+ filterInputs.value[key] = "";
3150
+ });
3151
+ Object.keys(columnConditions.value).forEach((key) => {
3152
+ columnConditions.value[key] = "";
3153
+ });
3154
+ emit("clearAllFilters");
3155
+ };
3045
3156
  watch(
3046
3157
  () => {
3047
3158
  var _a;
@@ -3138,7 +3249,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3138
3249
  createVNode(iconCheck, { class: "check" }),
3139
3250
  createVNode(iconDash, { class: "intermediate" })
3140
3251
  ])
3141
- ])
3252
+ ]),
3253
+ props.all.columnFilter && !props.isFooter && clearButtonLocation.value === "checkbox" ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
3254
+ props.showClearAllButton ? (openBlock(), createElementBlock("button", {
3255
+ key: 0,
3256
+ type: "button",
3257
+ class: normalizeClass(["bh-clear-all-button", {
3258
+ "bh-clear-all-button--active": props.hasAnyActiveFilter
3259
+ }]),
3260
+ disabled: !props.hasAnyActiveFilter,
3261
+ onClick: withModifiers(handleClearAllFilters, ["stop"]),
3262
+ title: "Clear all filters"
3263
+ }, _hoisted_6$1, 10, _hoisted_4$1)) : createCommentVNode("", true)
3264
+ ])) : createCommentVNode("", true)
3142
3265
  ], 6)) : createCommentVNode("", true),
3143
3266
  props.all.hasRightPanel ? (openBlock(), createElementBlock("th", {
3144
3267
  key: 1,
@@ -3151,7 +3274,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3151
3274
  "bh-top-0": props.all.stickyHeader,
3152
3275
  "bh-left-0": props.all.stickyFirstColumn
3153
3276
  })
3154
- }, null, 6)) : createCommentVNode("", true),
3277
+ }, [
3278
+ props.all.columnFilter && !props.isFooter && clearButtonLocation.value === "rightpanel" ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
3279
+ props.showClearAllButton ? (openBlock(), createElementBlock("button", {
3280
+ key: 0,
3281
+ type: "button",
3282
+ class: normalizeClass(["bh-clear-all-button", {
3283
+ "bh-clear-all-button--active": props.hasAnyActiveFilter
3284
+ }]),
3285
+ disabled: !props.hasAnyActiveFilter,
3286
+ onClick: withModifiers(handleClearAllFilters, ["stop"]),
3287
+ title: "Clear all filters"
3288
+ }, _hoisted_10$1, 10, _hoisted_8$1)) : createCommentVNode("", true)
3289
+ ])) : createCommentVNode("", true)
3290
+ ], 6)) : createCommentVNode("", true),
3155
3291
  props.all.hasSubtable ? (openBlock(), createElementBlock("th", {
3156
3292
  key: 2,
3157
3293
  style: normalizeStyle({
@@ -3163,7 +3299,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3163
3299
  key: 0,
3164
3300
  expandedrows: props.expandedrows,
3165
3301
  expandall: props.all.expandall
3166
- }, null, 8, ["expandedrows", "expandall"])) : createCommentVNode("", true)
3302
+ }, null, 8, ["expandedrows", "expandall"])) : createCommentVNode("", true),
3303
+ props.all.columnFilter && !props.isFooter && clearButtonLocation.value === "subtable" ? (openBlock(), createElementBlock("div", _hoisted_11$1, [
3304
+ props.showClearAllButton ? (openBlock(), createElementBlock("button", {
3305
+ key: 0,
3306
+ type: "button",
3307
+ class: normalizeClass(["bh-clear-all-button", {
3308
+ "bh-clear-all-button--active": props.hasAnyActiveFilter
3309
+ }]),
3310
+ disabled: !props.hasAnyActiveFilter,
3311
+ onClick: withModifiers(handleClearAllFilters, ["stop"]),
3312
+ title: "Clear all filters"
3313
+ }, _hoisted_14$1, 10, _hoisted_12$1)) : createCommentVNode("", true)
3314
+ ])) : createCommentVNode("", true)
3167
3315
  ], 4)) : createCommentVNode("", true),
3168
3316
  (openBlock(true), createElementBlock(Fragment, null, renderList(props.all.columns, (col, j) => {
3169
3317
  return openBlock(), createElementBlock(Fragment, null, [
@@ -3189,7 +3337,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3189
3337
  key: 0,
3190
3338
  class: normalizeClass(["bh-ml-3 bh-sort bh-flex bh-items-center", [props.currentSortColumn, props.currentSortDirection]])
3191
3339
  }, [
3192
- (openBlock(), createElementBlock("svg", _hoisted_4$1, [
3340
+ (openBlock(), createElementBlock("svg", _hoisted_16$1, [
3193
3341
  createElementVNode("polygon", {
3194
3342
  points: "3.11,6.25 10.89,6.25 7,1.75 ",
3195
3343
  fill: "currentColor",
@@ -3206,16 +3354,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3206
3354
  }, null, 2)
3207
3355
  ]))
3208
3356
  ], 2)) : createCommentVNode("", true)
3209
- ], 10, _hoisted_3$1),
3357
+ ], 10, _hoisted_15$1),
3210
3358
  props.all.columnFilter && !props.isFooter ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3211
- col.filter ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
3359
+ col.filter ? (openBlock(), createElementBlock("div", _hoisted_17$1, [
3212
3360
  !props.all.showFloatingFilterLabel ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3213
3361
  col.type === "string" || col.type === "String" ? withDirectives((openBlock(), createElementBlock("input", {
3214
3362
  key: 0,
3215
3363
  "onUpdate:modelValue": ($event) => filterInputs.value[col.field] = $event,
3216
3364
  type: "text",
3217
3365
  class: "bh-form-control"
3218
- }, null, 8, _hoisted_6$1)), [
3366
+ }, null, 8, _hoisted_18$1)), [
3219
3367
  [vModelText, filterInputs.value[col.field]]
3220
3368
  ]) : createCommentVNode("", true),
3221
3369
  col.type === "number" || col.type === "integer" || col.type === "Integer" ? withDirectives((openBlock(), createElementBlock("input", {
@@ -3223,7 +3371,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3223
3371
  "onUpdate:modelValue": ($event) => filterInputs.value[col.field] = $event,
3224
3372
  type: "number",
3225
3373
  class: "bh-form-control"
3226
- }, null, 8, _hoisted_7$1)), [
3374
+ }, null, 8, _hoisted_19$1)), [
3227
3375
  [
3228
3376
  vModelText,
3229
3377
  filterInputs.value[col.field],
@@ -3244,7 +3392,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3244
3392
  "onUpdate:modelValue": ($event) => filterInputs.value[col.field] = $event,
3245
3393
  type: "date",
3246
3394
  class: "bh-form-control"
3247
- }, null, 8, _hoisted_8$1)), [
3395
+ }, null, 8, _hoisted_20$1)), [
3248
3396
  [vModelText, filterInputs.value[col.field]]
3249
3397
  ])
3250
3398
  ], 64)) : col.type === "bool" ? withDirectives((openBlock(), createElementBlock("select", {
@@ -3253,11 +3401,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3253
3401
  class: "bh-form-control",
3254
3402
  onClick: _cache[1] || (_cache[1] = //@ts-ignore
3255
3403
  (...args) => props.isOpenFilter && props.isOpenFilter(...args))
3256
- }, _hoisted_13$1, 8, _hoisted_9$1)), [
3404
+ }, _hoisted_25$1, 8, _hoisted_21$1)), [
3257
3405
  [vModelSelect, filterInputs.value[col.field]]
3258
3406
  ]) : createCommentVNode("", true)
3259
3407
  ], 64)) : createCommentVNode("", true),
3260
- props.all.showFloatingFilterLabel ? (openBlock(), createElementBlock("div", _hoisted_14$1, [
3408
+ props.all.showFloatingFilterLabel ? (openBlock(), createElementBlock("div", _hoisted_26$1, [
3261
3409
  hasConditionSet(col) && props.all.useNewColumnFilter ? (openBlock(), createElementBlock("label", {
3262
3410
  key: 0,
3263
3411
  class: normalizeClass(["bh-floating-label", {
@@ -3271,7 +3419,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3271
3419
  class: normalizeClass(["bh-form-control", {
3272
3420
  "bh-form-control--with-label": hasConditionSet(col) && props.all.useNewColumnFilter
3273
3421
  }])
3274
- }, null, 10, _hoisted_15$1)), [
3422
+ }, null, 10, _hoisted_27$1)), [
3275
3423
  [vModelText, filterInputs.value[col.field]]
3276
3424
  ]) : createCommentVNode("", true),
3277
3425
  col.type === "number" || col.type === "integer" || col.type === "Integer" ? withDirectives((openBlock(), createElementBlock("input", {
@@ -3281,7 +3429,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3281
3429
  class: normalizeClass(["bh-form-control", {
3282
3430
  "bh-form-control--with-label": hasConditionSet(col) && props.all.useNewColumnFilter
3283
3431
  }])
3284
- }, null, 10, _hoisted_16$1)), [
3432
+ }, null, 10, _hoisted_28$1)), [
3285
3433
  [
3286
3434
  vModelText,
3287
3435
  filterInputs.value[col.field],
@@ -3305,7 +3453,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3305
3453
  class: normalizeClass(["bh-form-control", {
3306
3454
  "bh-form-control--with-label": hasConditionSet(col) && props.all.useNewColumnFilter
3307
3455
  }])
3308
- }, null, 10, _hoisted_17$1)), [
3456
+ }, null, 10, _hoisted_29$1)), [
3309
3457
  [vModelText, filterInputs.value[col.field]]
3310
3458
  ])
3311
3459
  ], 64)) : col.type === "bool" ? withDirectives((openBlock(), createElementBlock("select", {
@@ -3314,7 +3462,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3314
3462
  class: "bh-form-control",
3315
3463
  onClick: _cache[2] || (_cache[2] = //@ts-ignore
3316
3464
  (...args) => props.isOpenFilter && props.isOpenFilter(...args))
3317
- }, _hoisted_22$1, 8, _hoisted_18$1)), [
3465
+ }, _hoisted_34$1, 8, _hoisted_30$1)), [
3318
3466
  [vModelSelect, filterInputs.value[col.field]]
3319
3467
  ]) : createCommentVNode("", true)
3320
3468
  ])) : createCommentVNode("", true),
@@ -3334,7 +3482,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3334
3482
  "bh-text-black/70 dark:bh-text-gray-300": !hasConditionSet(col)
3335
3483
  }])
3336
3484
  }, null, 8, ["class"])
3337
- ], 10, _hoisted_23$1)) : createCommentVNode("", true),
3485
+ ], 10, _hoisted_35$1)) : createCommentVNode("", true),
3338
3486
  !props.all.useNewColumnFilter ? withDirectives((openBlock(), createBlock(_sfc_main$6, {
3339
3487
  key: 3,
3340
3488
  column: col,
@@ -3384,7 +3532,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3384
3532
  "bh-text-black/70 dark:bh-text-gray-300": !hasConditionSet(col)
3385
3533
  }])
3386
3534
  }, null, 8, ["class"])
3387
- ], 10, _hoisted_24$1)) : createCommentVNode("", true)
3535
+ ], 10, _hoisted_36$1)) : createCommentVNode("", true)
3388
3536
  ]),
3389
3537
  _: 2
3390
3538
  }, 1032, ["shown"])) : createCommentVNode("", true)
@@ -3574,6 +3722,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3574
3722
  stickyFirstColumn: { type: Boolean, default: false },
3575
3723
  cloneHeaderInFooter: { type: Boolean, default: false },
3576
3724
  selectRowOnClick: { type: Boolean, default: false },
3725
+ showClearAllButton: { type: Boolean, default: false },
3577
3726
  enableleftmenu: { type: Boolean },
3578
3727
  enabletopmenu: { type: Boolean },
3579
3728
  enableHeaderArea: { type: Boolean, default: false },
@@ -3605,7 +3754,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3605
3754
  "rowDBClick",
3606
3755
  "currentTopMenuSize",
3607
3756
  "currentLeftMenuSize",
3608
- "rowRightPanelClick"
3757
+ "rowRightPanelClick",
3758
+ "clearAllFilters"
3609
3759
  ],
3610
3760
  setup(__props, { expose: __expose, emit: __emit }) {
3611
3761
  var _a, _b;
@@ -3669,6 +3819,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3669
3819
  const col = props.columns.find((d) => d.isUnique);
3670
3820
  return (col == null ? void 0 : col.field) || null;
3671
3821
  });
3822
+ const hasAnyActiveFilter = computed(() => {
3823
+ if (!props.columns) return false;
3824
+ return props.columns.some((col) => {
3825
+ return col.value !== void 0 && col.value !== null && col.value !== "";
3826
+ });
3827
+ });
3672
3828
  const rowKeys = computed(() => {
3673
3829
  if (!uniqueKey.value) return null;
3674
3830
  return new Map(
@@ -3933,6 +4089,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3933
4089
  isLeftMenuMinimized.value = minimized;
3934
4090
  currentLeftMenuWidth.value = minimized ? props.leftmenuMinWidth : props.leftmenuDefaultWidth;
3935
4091
  updateLeftMenuStyle();
4092
+ },
4093
+ clearAllFilters() {
4094
+ clearAllFilters();
3936
4095
  }
3937
4096
  });
3938
4097
  watch(
@@ -4259,6 +4418,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4259
4418
  expandedrows.value.set(key, false);
4260
4419
  });
4261
4420
  };
4421
+ const clearAllFilters = () => {
4422
+ var _a2;
4423
+ for (const col of props.columns) {
4424
+ if (col.filter) {
4425
+ col.value = "";
4426
+ col.condition = ((_a2 = col.type) == null ? void 0 : _a2.toLowerCase()) === "string" ? "Contains" : "Equal";
4427
+ }
4428
+ }
4429
+ filterChange();
4430
+ emit("clearAllFilters");
4431
+ };
4262
4432
  let extracolumnlength = 0;
4263
4433
  if (props.hasCheckbox) {
4264
4434
  extracolumnlength++;
@@ -4420,11 +4590,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4420
4590
  checkAll: selectedAll.value,
4421
4591
  columnFilterLang: props.columnFilterLang,
4422
4592
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
4593
+ showClearAllButton: props.showClearAllButton,
4594
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4423
4595
  onSelectAll: selectAll,
4424
4596
  onSortChange: sortChange,
4425
4597
  onFilterChange: filterChange,
4426
4598
  onToggleFilterMenu: toggleFilterMenu,
4427
- onClearColumnFilter: clearColumnFilter
4599
+ onClearColumnFilter: clearColumnFilter,
4600
+ onClearAllFilters: clearAllFilters
4428
4601
  }, createSlots({ _: 2 }, [
4429
4602
  hasFilterDatetimeSlot.value ? {
4430
4603
  name: "filter-datetime",
@@ -4433,7 +4606,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4433
4606
  ]),
4434
4607
  key: "0"
4435
4608
  } : void 0
4436
- ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot"])
4609
+ ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4437
4610
  ], 2),
4438
4611
  createElementVNode("tbody", null, [
4439
4612
  (openBlock(true), createElementBlock(Fragment, null, renderList(filterItems.value, (item, i) => {
@@ -4602,10 +4775,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4602
4775
  isFooter: true,
4603
4776
  checkAll: selectedAll.value,
4604
4777
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
4778
+ showClearAllButton: props.showClearAllButton,
4779
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4605
4780
  onSelectAll: selectAll,
4606
4781
  onSortChange: sortChange,
4607
4782
  onFilterChange: filterChange,
4608
- onToggleFilterMenu: toggleFilterMenu
4783
+ onToggleFilterMenu: toggleFilterMenu,
4784
+ onClearAllFilters: clearAllFilters
4609
4785
  }, createSlots({ _: 2 }, [
4610
4786
  hasFilterDatetimeSlot.value ? {
4611
4787
  name: "filter-datetime",
@@ -4614,7 +4790,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4614
4790
  ]),
4615
4791
  key: "0"
4616
4792
  } : void 0
4617
- ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot"])
4793
+ ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4618
4794
  ], 2)) : createCommentVNode("", true)
4619
4795
  ], 2),
4620
4796
  currentLoader.value && _ctx.enableloadinganimation ? (openBlock(), createElementBlock("div", {
@@ -4686,11 +4862,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4686
4862
  checkAll: selectedAll.value,
4687
4863
  columnFilterLang: props.columnFilterLang,
4688
4864
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
4865
+ showClearAllButton: props.showClearAllButton,
4866
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4689
4867
  onSelectAll: selectAll,
4690
4868
  onSortChange: sortChange,
4691
4869
  onFilterChange: filterChange,
4692
4870
  onToggleFilterMenu: toggleFilterMenu,
4693
- onClearColumnFilter: clearColumnFilter
4871
+ onClearColumnFilter: clearColumnFilter,
4872
+ onClearAllFilters: clearAllFilters
4694
4873
  }, createSlots({ _: 2 }, [
4695
4874
  hasFilterDatetimeSlot.value ? {
4696
4875
  name: "filter-datetime",
@@ -4699,7 +4878,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4699
4878
  ]),
4700
4879
  key: "0"
4701
4880
  } : void 0
4702
- ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot"])
4881
+ ]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4703
4882
  ], 2),
4704
4883
  createElementVNode("tbody", null, [
4705
4884
  (openBlock(true), createElementBlock(Fragment, null, renderList(filterItems.value, (item, i) => {
@@ -4877,10 +5056,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4877
5056
  isFooter: true,
4878
5057
  checkAll: selectedAll.value,
4879
5058
  hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
5059
+ showClearAllButton: props.showClearAllButton,
5060
+ hasAnyActiveFilter: hasAnyActiveFilter.value,
4880
5061
  onSelectAll: selectAll,
4881
5062
  onSortChange: sortChange,
4882
5063
  onFilterChange: filterChange,
4883
- onToggleFilterMenu: toggleFilterMenu
5064
+ onToggleFilterMenu: toggleFilterMenu,
5065
+ onClearAllFilters: clearAllFilters
4884
5066
  }, createSlots({ _: 2 }, [
4885
5067
  hasFilterDatetimeSlot.value ? {
4886
5068
  name: "filter-datetime",
@@ -4889,7 +5071,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4889
5071
  ]),
4890
5072
  key: "0"
4891
5073
  } : void 0
4892
- ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot"])
5074
+ ]), 1032, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
4893
5075
  ], 2)) : createCommentVNode("", true)
4894
5076
  ], 2),
4895
5077
  currentLoader.value && _ctx.enableloadinganimation ? (openBlock(), createElementBlock("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.8.11",
3
+ "version": "1.8.12",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",