@mozaic-ds/vue 0.14.3-beta.0 → 0.14.3-beta.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozaic-ds/vue",
3
- "version": "0.14.3-beta.0",
3
+ "version": "0.14.3-beta.1",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build ./src/index.js",
@@ -465,6 +465,19 @@ export default {
465
465
  };
466
466
  },
467
467
 
468
+ checkIfPromise(promise) {
469
+ return !!promise && typeof promise.then === 'function';
470
+ },
471
+
472
+ setTotal() {
473
+ if (Array.isArray(this.source)) {
474
+ this.total = this.source.length;
475
+ }
476
+ else if (this.source instanceof Function && !this.checkIfPromise(this.source())) {
477
+ this.total = this.source().length;
478
+ }
479
+ },
480
+
468
481
  /** Load data. */
469
482
  async load() {
470
483
  this.loading = true;
@@ -474,7 +487,7 @@ export default {
474
487
  }
475
488
 
476
489
  try {
477
- this.total = Array.isArray(this.source) ? this.source.length : this.total;
490
+ this.setTotal();
478
491
 
479
492
  const options = buildOptions(
480
493
  this.pagingOptions.enabled,