@quillsql/react 2.16.8 → 2.16.10

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.
package/dist/index.cjs CHANGED
@@ -16101,13 +16101,14 @@ async function generatePivotWithSQL({
16101
16101
  }
16102
16102
  }
16103
16103
  }
16104
- if (!pivot.sort) {
16104
+ if (!pivot.sort || pivot.sortField === pivot.rowField) {
16105
16105
  rows.sort((a, b) => {
16106
+ const direction = pivot.sort && pivot.sortDirection === "DESC" ? -1 : 1;
16106
16107
  if (a.__quillRawDate < b.__quillRawDate) {
16107
- return -1;
16108
+ return -1 * direction;
16108
16109
  }
16109
16110
  if (a.__quillRawDate > b.__quillRawDate) {
16110
- return 1;
16111
+ return 1 * direction;
16111
16112
  }
16112
16113
  return 0;
16113
16114
  });
@@ -35013,7 +35014,7 @@ function QuillTableDashboardComponent({
35013
35014
  const [theme] = (0, import_react29.useContext)(ThemeContext);
35014
35015
  const [initialLoad, setInitialLoad] = (0, import_react29.useState)(true);
35015
35016
  const { downloadCSV: downloadCSV2 } = useExport(report?.id);
35016
- const [page, setPage] = (0, import_react29.useState)(0);
35017
+ const [page, setPage] = (0, import_react29.useState)(report?.pagination?.page ?? 0);
35017
35018
  (0, import_react29.useEffect)(() => {
35018
35019
  if (!isLoading) {
35019
35020
  setInitialLoad(false);
@@ -35024,6 +35025,11 @@ function QuillTableDashboardComponent({
35024
35025
  setPage(0);
35025
35026
  }
35026
35027
  }, [rowCountIsLoading]);
35028
+ (0, import_react29.useEffect)(() => {
35029
+ if (typeof report?.pagination?.page === "number") {
35030
+ setPage(report.pagination.page);
35031
+ }
35032
+ }, [report?.pagination?.page]);
35027
35033
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
35028
35034
  "div",
35029
35035
  {
@@ -35106,7 +35112,7 @@ function QuillTableDashboardComponent({
35106
35112
  onSortChange: (sort) => {
35107
35113
  onSortChange && onSortChange(sort);
35108
35114
  },
35109
- currentPage: report?.pagination?.page ?? page,
35115
+ currentPage: page,
35110
35116
  sort: report?.sort
35111
35117
  }
35112
35118
  )
package/dist/index.js CHANGED
@@ -16138,13 +16138,14 @@ async function generatePivotWithSQL({
16138
16138
  }
16139
16139
  }
16140
16140
  }
16141
- if (!pivot.sort) {
16141
+ if (!pivot.sort || pivot.sortField === pivot.rowField) {
16142
16142
  rows.sort((a, b) => {
16143
+ const direction = pivot.sort && pivot.sortDirection === "DESC" ? -1 : 1;
16143
16144
  if (a.__quillRawDate < b.__quillRawDate) {
16144
- return -1;
16145
+ return -1 * direction;
16145
16146
  }
16146
16147
  if (a.__quillRawDate > b.__quillRawDate) {
16147
- return 1;
16148
+ return 1 * direction;
16148
16149
  }
16149
16150
  return 0;
16150
16151
  });
@@ -35098,7 +35099,7 @@ function QuillTableDashboardComponent({
35098
35099
  const [theme] = useContext15(ThemeContext);
35099
35100
  const [initialLoad, setInitialLoad] = useState17(true);
35100
35101
  const { downloadCSV: downloadCSV2 } = useExport(report?.id);
35101
- const [page, setPage] = useState17(0);
35102
+ const [page, setPage] = useState17(report?.pagination?.page ?? 0);
35102
35103
  useEffect15(() => {
35103
35104
  if (!isLoading) {
35104
35105
  setInitialLoad(false);
@@ -35109,6 +35110,11 @@ function QuillTableDashboardComponent({
35109
35110
  setPage(0);
35110
35111
  }
35111
35112
  }, [rowCountIsLoading]);
35113
+ useEffect15(() => {
35114
+ if (typeof report?.pagination?.page === "number") {
35115
+ setPage(report.pagination.page);
35116
+ }
35117
+ }, [report?.pagination?.page]);
35112
35118
  return /* @__PURE__ */ jsxs35(
35113
35119
  "div",
35114
35120
  {
@@ -35191,7 +35197,7 @@ function QuillTableDashboardComponent({
35191
35197
  onSortChange: (sort) => {
35192
35198
  onSortChange && onSortChange(sort);
35193
35199
  },
35194
- currentPage: report?.pagination?.page ?? page,
35200
+ currentPage: page,
35195
35201
  sort: report?.sort
35196
35202
  }
35197
35203
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.8",
3
+ "version": "2.16.10",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {