aloha-vue 1.0.2 → 1.0.3
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 +1 -1
- package/src/ATable/ATable.js +25 -19
package/package.json
CHANGED
package/src/ATable/ATable.js
CHANGED
|
@@ -85,6 +85,11 @@ export default {
|
|
|
85
85
|
required: false,
|
|
86
86
|
default: 0,
|
|
87
87
|
},
|
|
88
|
+
sortingStart: {
|
|
89
|
+
type: String,
|
|
90
|
+
required: false,
|
|
91
|
+
default: undefined,
|
|
92
|
+
},
|
|
88
93
|
data: {
|
|
89
94
|
type: [Array, Object, Promise],
|
|
90
95
|
required: false,
|
|
@@ -117,6 +122,14 @@ export default {
|
|
|
117
122
|
required: false,
|
|
118
123
|
default: () => [],
|
|
119
124
|
},
|
|
125
|
+
isPaginationOutside: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
required: false,
|
|
128
|
+
},
|
|
129
|
+
isSortingOutside: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
required: false,
|
|
132
|
+
},
|
|
120
133
|
},
|
|
121
134
|
emits: [
|
|
122
135
|
"update:modelColumnsOrder",
|
|
@@ -198,22 +211,18 @@ export default {
|
|
|
198
211
|
return {
|
|
199
212
|
resolved: undefined,
|
|
200
213
|
error: undefined,
|
|
201
|
-
modelSort:
|
|
202
|
-
rows: [],
|
|
214
|
+
modelSort: this.sortingStart,
|
|
203
215
|
limit: this.limitStart,
|
|
204
216
|
offset: this.offsetStart,
|
|
205
217
|
};
|
|
206
218
|
},
|
|
207
219
|
computed: {
|
|
208
220
|
rowsLocal() {
|
|
209
|
-
|
|
210
|
-
return this.dataPaginated;
|
|
211
|
-
}
|
|
212
|
-
return this.rows;
|
|
221
|
+
return this.dataPaginated;
|
|
213
222
|
},
|
|
214
223
|
|
|
215
224
|
dataPaginated() {
|
|
216
|
-
if (this.limit) {
|
|
225
|
+
if (this.limit && !this.isPaginationOutside) {
|
|
217
226
|
const DATA_SORTED = cloneDeep(this.dataSorted);
|
|
218
227
|
const INDEX_START = this.offset;
|
|
219
228
|
const INDEX_END = INDEX_START + this.limit;
|
|
@@ -223,7 +232,7 @@ export default {
|
|
|
223
232
|
},
|
|
224
233
|
|
|
225
234
|
dataSorted() {
|
|
226
|
-
if (this.modelSort) {
|
|
235
|
+
if (this.modelSort && !this.isSortingOutside) {
|
|
227
236
|
return orderBy(this.data, [this.sortOptions.model], [this.sortOptions.direction]);
|
|
228
237
|
}
|
|
229
238
|
return this.data;
|
|
@@ -244,18 +253,12 @@ export default {
|
|
|
244
253
|
}
|
|
245
254
|
},
|
|
246
255
|
|
|
247
|
-
isDataParent() {
|
|
248
|
-
return !!this.data;
|
|
249
|
-
},
|
|
250
|
-
|
|
251
256
|
totalRowsCountLocal() {
|
|
252
|
-
|
|
253
|
-
return this.totalRowsCount;
|
|
254
|
-
}
|
|
257
|
+
return this.totalRowsCount;
|
|
255
258
|
},
|
|
256
259
|
|
|
257
260
|
totalRowsCount() {
|
|
258
|
-
return this.data.length;
|
|
261
|
+
return !isNil(this.countAllRows) ? this.countAllRows : this.data.length;
|
|
259
262
|
},
|
|
260
263
|
|
|
261
264
|
countAllRowsLocal() {
|
|
@@ -291,7 +294,7 @@ export default {
|
|
|
291
294
|
if (this.modelColumnsOrdering.length) {
|
|
292
295
|
this.modelColumnsOrderingLocal = cloneDeep(this.modelColumnsOrdering);
|
|
293
296
|
} else {
|
|
294
|
-
this.modelColumnsOrderingLocal
|
|
297
|
+
this.changeColumnsOrdering({ modelColumnsOrderingLocal: getModelColumnsOrderingDefault(this.columns) });
|
|
295
298
|
}
|
|
296
299
|
},
|
|
297
300
|
|
|
@@ -299,7 +302,7 @@ export default {
|
|
|
299
302
|
if (this.modelColumnsVisible.length) {
|
|
300
303
|
this.modelColumnsVisibleLocal = cloneDeep(this.modelColumnsVisible);
|
|
301
304
|
} else {
|
|
302
|
-
this.
|
|
305
|
+
this.changeModelColumnsVisible(getModelColumnsVisibleDefault(this.columns));
|
|
303
306
|
}
|
|
304
307
|
},
|
|
305
308
|
|
|
@@ -326,12 +329,15 @@ export default {
|
|
|
326
329
|
this.offset = offset;
|
|
327
330
|
this.$emit("changeOffset", {
|
|
328
331
|
offset,
|
|
332
|
+
limit: this.limit,
|
|
329
333
|
});
|
|
330
334
|
},
|
|
331
335
|
|
|
332
336
|
changeLimit(limit) {
|
|
333
337
|
this.limit = limit;
|
|
338
|
+
this.offset = this.offsetStart;
|
|
334
339
|
this.$emit("changeLimit", {
|
|
340
|
+
offset: this.offset,
|
|
335
341
|
limit,
|
|
336
342
|
});
|
|
337
343
|
},
|
|
@@ -350,7 +356,7 @@ export default {
|
|
|
350
356
|
this.$emit("changeColumnsOrdering", {
|
|
351
357
|
columnIndexDraggable,
|
|
352
358
|
columnIndexOver,
|
|
353
|
-
modelColumnsOrdering: this.modelColumnsOrderingLocal,
|
|
359
|
+
modelColumnsOrdering: cloneDeep(this.modelColumnsOrderingLocal),
|
|
354
360
|
});
|
|
355
361
|
this.checkVisibleColumns();
|
|
356
362
|
},
|