vi-grid-builder 0.0.6 → 0.0.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vi-grid-builder",
3
3
  "main": "ViGridBuilderPlugin",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -102,6 +102,9 @@
102
102
  }
103
103
  }
104
104
  },
105
+ rowsNumber:{
106
+ type:[Number|String]
107
+ },
105
108
  disablePagination: {
106
109
  type: Boolean,
107
110
  default: false
@@ -137,7 +140,7 @@
137
140
  return this.fetchServerData!==undefined;
138
141
  },
139
142
  totalRows() {
140
- return this.pagination.totalRows ?? this.rows.length;
143
+ return this.rowsNumber ?? this.rows.length;
141
144
  },
142
145
  currentVisibleRows() {
143
146
  if (this.isServerSide || this.disablePagination) {
@@ -154,10 +157,21 @@
154
157
  }
155
158
  },
156
159
  methods: {
160
+ formatPagination(pagination){
161
+ return {
162
+ page: pagination.page,
163
+ rowsPerPage: pagination.rowsPerPage,
164
+ sortBy: pagination.sortBy
165
+ }
166
+ },
157
167
  fetchData({pagination, filter, search} = {}) {
168
+ const paginationData = pagination ?? this.pagination;
158
169
  this.isFetchingData = true;
159
170
  return this.fetchServerData({
160
- pagination: pagination ?? this.pagination,
171
+ ...paginationData && {
172
+ pagination: this.formatPagination(paginationData)
173
+ },
174
+
161
175
  filter: filter ?? this.filter,
162
176
  search: search ?? this.search,
163
177
  })
@@ -168,7 +182,7 @@
168
182
  ...this.pagination,
169
183
  ...pagination
170
184
  };
171
- this.$emit('pagination-change', newPagination);
185
+ this.$emit('pagination-change', this.formatPagination(newPagination));
172
186
  if (this.isServerSide) {
173
187
  this.fetchData({pagination: newPagination})
174
188
  }