@dolusoft/vue3-datatable 1.8.57 → 1.8.58

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.
@@ -5677,7 +5677,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
5677
5677
  const hasConditionValue = Object.values(columnConditions.value).some(
5678
5678
  (val) => val !== "" && val !== null && val !== void 0
5679
5679
  );
5680
- return hasInputValue || hasConditionValue;
5680
+ const hasSortActive = props.currentSortColumn !== "" && props.currentSortColumn !== void 0;
5681
+ return hasInputValue || hasConditionValue || hasSortActive;
5681
5682
  });
5682
5683
  vue.watch(
5683
5684
  () => {
@@ -5793,7 +5794,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
5793
5794
  col.parsedFilterRules = void 0;
5794
5795
  columnConditions.value[col.field] = "";
5795
5796
  if (props.currentSortColumn === col.field) {
5796
- emit("sortChange", props.all.sortColumn || col.field, "asc");
5797
+ emit("sortChange", "", "");
5797
5798
  }
5798
5799
  emit("filterChange");
5799
5800
  };
@@ -6653,15 +6654,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
6653
6654
  }
6654
6655
  rows = final;
6655
6656
  }
6656
- const isNumeric = ((_c = props.columns.find((col) => col.field == currentSortColumn.value)) == null ? void 0 : _c.type) === "number";
6657
- const collator = getCollator(isNumeric || false);
6658
- const sortOrder = currentSortDirection.value === "desc" ? -1 : 1;
6659
- rows.sort((a2, b2) => {
6660
- var _a3, _b3;
6661
- const valA = (_a3 = currentSortColumn.value) == null ? void 0 : _a3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], a2);
6662
- const valB = (_b3 = currentSortColumn.value) == null ? void 0 : _b3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], b2);
6663
- return collator.compare(valA, valB) * sortOrder;
6664
- });
6657
+ if (currentSortColumn.value) {
6658
+ const isNumeric = ((_c = props.columns.find((col) => col.field == currentSortColumn.value)) == null ? void 0 : _c.type) === "number";
6659
+ const collator = getCollator(isNumeric || false);
6660
+ const sortOrder = currentSortDirection.value === "desc" ? -1 : 1;
6661
+ rows.sort((a2, b2) => {
6662
+ var _a3, _b3;
6663
+ const valA = (_a3 = currentSortColumn.value) == null ? void 0 : _a3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], a2);
6664
+ const valB = (_b3 = currentSortColumn.value) == null ? void 0 : _b3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], b2);
6665
+ return collator.compare(valA, valB) * sortOrder;
6666
+ });
6667
+ }
6665
6668
  }
6666
6669
  return rows;
6667
6670
  });
@@ -6923,6 +6926,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
6923
6926
  };
6924
6927
  vue.watch(() => currentPageSize.value, changePageSize);
6925
6928
  const sortChange = (field, specifiedDirection) => {
6929
+ if (!field) {
6930
+ currentSortColumn.value = "";
6931
+ currentSortDirection.value = "";
6932
+ selectAll(false);
6933
+ filterRows();
6934
+ if (props.isServerMode) {
6935
+ changeForServer("sort");
6936
+ } else {
6937
+ emit("sortChange", { offset: 0, limit: currentPageSize.value, field: "", direction: "" });
6938
+ }
6939
+ return;
6940
+ }
6926
6941
  let direction = specifiedDirection || "asc";
6927
6942
  if (!specifiedDirection) {
6928
6943
  if (field == currentSortColumn.value) {
@@ -7143,7 +7158,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
7143
7158
  currentSortColumn.value = "";
7144
7159
  currentSortDirection.value = "";
7145
7160
  updateHasAnyActiveFilter();
7146
- filterChange();
7161
+ if (props.isServerMode) {
7162
+ changeForServer("filter", true);
7163
+ } else {
7164
+ filterRows();
7165
+ emit("filterChange", props.columns);
7166
+ }
7147
7167
  emit("clearAllFilters");
7148
7168
  };
7149
7169
  const extracolumnlength = vue.computed(() => {
@@ -5676,7 +5676,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5676
5676
  const hasConditionValue = Object.values(columnConditions.value).some(
5677
5677
  (val) => val !== "" && val !== null && val !== void 0
5678
5678
  );
5679
- return hasInputValue || hasConditionValue;
5679
+ const hasSortActive = props.currentSortColumn !== "" && props.currentSortColumn !== void 0;
5680
+ return hasInputValue || hasConditionValue || hasSortActive;
5680
5681
  });
5681
5682
  watch(
5682
5683
  () => {
@@ -5792,7 +5793,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5792
5793
  col.parsedFilterRules = void 0;
5793
5794
  columnConditions.value[col.field] = "";
5794
5795
  if (props.currentSortColumn === col.field) {
5795
- emit("sortChange", props.all.sortColumn || col.field, "asc");
5796
+ emit("sortChange", "", "");
5796
5797
  }
5797
5798
  emit("filterChange");
5798
5799
  };
@@ -6652,15 +6653,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
6652
6653
  }
6653
6654
  rows = final;
6654
6655
  }
6655
- const isNumeric = ((_c = props.columns.find((col) => col.field == currentSortColumn.value)) == null ? void 0 : _c.type) === "number";
6656
- const collator = getCollator(isNumeric || false);
6657
- const sortOrder = currentSortDirection.value === "desc" ? -1 : 1;
6658
- rows.sort((a2, b2) => {
6659
- var _a3, _b3;
6660
- const valA = (_a3 = currentSortColumn.value) == null ? void 0 : _a3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], a2);
6661
- const valB = (_b3 = currentSortColumn.value) == null ? void 0 : _b3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], b2);
6662
- return collator.compare(valA, valB) * sortOrder;
6663
- });
6656
+ if (currentSortColumn.value) {
6657
+ const isNumeric = ((_c = props.columns.find((col) => col.field == currentSortColumn.value)) == null ? void 0 : _c.type) === "number";
6658
+ const collator = getCollator(isNumeric || false);
6659
+ const sortOrder = currentSortDirection.value === "desc" ? -1 : 1;
6660
+ rows.sort((a2, b2) => {
6661
+ var _a3, _b3;
6662
+ const valA = (_a3 = currentSortColumn.value) == null ? void 0 : _a3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], a2);
6663
+ const valB = (_b3 = currentSortColumn.value) == null ? void 0 : _b3.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], b2);
6664
+ return collator.compare(valA, valB) * sortOrder;
6665
+ });
6666
+ }
6664
6667
  }
6665
6668
  return rows;
6666
6669
  });
@@ -6922,6 +6925,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
6922
6925
  };
6923
6926
  watch(() => currentPageSize.value, changePageSize);
6924
6927
  const sortChange = (field, specifiedDirection) => {
6928
+ if (!field) {
6929
+ currentSortColumn.value = "";
6930
+ currentSortDirection.value = "";
6931
+ selectAll(false);
6932
+ filterRows();
6933
+ if (props.isServerMode) {
6934
+ changeForServer("sort");
6935
+ } else {
6936
+ emit("sortChange", { offset: 0, limit: currentPageSize.value, field: "", direction: "" });
6937
+ }
6938
+ return;
6939
+ }
6925
6940
  let direction = specifiedDirection || "asc";
6926
6941
  if (!specifiedDirection) {
6927
6942
  if (field == currentSortColumn.value) {
@@ -7142,7 +7157,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7142
7157
  currentSortColumn.value = "";
7143
7158
  currentSortDirection.value = "";
7144
7159
  updateHasAnyActiveFilter();
7145
- filterChange();
7160
+ if (props.isServerMode) {
7161
+ changeForServer("filter", true);
7162
+ } else {
7163
+ filterRows();
7164
+ emit("filterChange", props.columns);
7165
+ }
7146
7166
  emit("clearAllFilters");
7147
7167
  };
7148
7168
  const extracolumnlength = computed(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.8.57",
3
+ "version": "1.8.58",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",