@mjhls/mjh-framework 1.0.125 → 1.0.127

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.125
2
+ # mjh-framework v. 1.0.127
3
3
 
4
4
 
5
5
  > Foundation Framework
package/dist/index.es.js CHANGED
@@ -9158,6 +9158,35 @@ var main_47 = main.osName;
9158
9158
  var main_48 = main.osVersion;
9159
9159
  var main_49 = main.withOrientationChange;
9160
9160
 
9161
+ var asyncToGenerator = function (fn) {
9162
+ return function () {
9163
+ var gen = fn.apply(this, arguments);
9164
+ return new Promise(function (resolve, reject) {
9165
+ function step(key, arg) {
9166
+ try {
9167
+ var info = gen[key](arg);
9168
+ var value = info.value;
9169
+ } catch (error) {
9170
+ reject(error);
9171
+ return;
9172
+ }
9173
+
9174
+ if (info.done) {
9175
+ resolve(value);
9176
+ } else {
9177
+ return Promise.resolve(value).then(function (value) {
9178
+ step("next", value);
9179
+ }, function (err) {
9180
+ step("throw", err);
9181
+ });
9182
+ }
9183
+ }
9184
+
9185
+ return step("next");
9186
+ });
9187
+ };
9188
+ };
9189
+
9161
9190
  var classCallCheck = function (instance, Constructor) {
9162
9191
  if (!(instance instanceof Constructor)) {
9163
9192
  throw new TypeError("Cannot call a class as a function");
@@ -12685,43 +12714,57 @@ var MasterDeck = function (_React$Component) {
12685
12714
  to: to + per
12686
12715
  };
12687
12716
  }, _this.loadData);
12688
- }, 0), _this.loadData = function () {
12689
- var _this$state = _this.state,
12690
- from = _this$state.from,
12691
- to = _this$state.to,
12692
- data = _this$state.data,
12693
- query = _this$state.query,
12694
- page = _this$state.page;
12695
- var client = _this.props.client;
12717
+ }, 0), _this.loadData = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
12718
+ var _this$state, from, to, data, query, page, _this$props, client, dataHandler, params;
12696
12719
 
12720
+ return regeneratorRuntime.wrap(function _callee$(_context) {
12721
+ while (1) {
12722
+ switch (_context.prev = _context.next) {
12723
+ case 0:
12724
+ _this$state = _this.state, from = _this$state.from, to = _this$state.to, data = _this$state.data, query = _this$state.query, page = _this$state.page;
12725
+ _this$props = _this.props, client = _this$props.client, dataHandler = _this$props.dataHandler;
12726
+ params = _extends({}, _this.params, { from: from, to: to });
12697
12727
 
12698
- var params = _extends({}, _this.params, { from: from, to: to
12699
- // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
12700
- // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
12701
- });client.fetch(query, params).then(function (dataArr) {
12702
- if (_this.pointer && _this.pointerArray) {
12703
- var pointer = _this.pointer;
12704
- dataArr = dataArr[_this.pointerArray][pointer];
12705
- }
12706
- dataArr = dataArr.map(function (item) {
12707
- return _extends({}, item, {
12708
- pageNumber: page
12709
- });
12710
- });
12711
12728
 
12712
- _this.setState(function () {
12713
- if (dataArr.length > 0) {
12714
- return {
12715
- data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
12716
- scrolling: true
12717
- };
12718
- } else {
12719
- return {
12720
- scrolling: false
12721
- };
12729
+ if (dataHandler) {
12730
+ dataHandler.then(function (dataArr) {
12731
+ loadDataFinished(data, dataArr, page);
12732
+ });
12733
+ } else {
12734
+ client.fetch(query, params).then(function (dataArr) {
12735
+ loadDataFinished(data, dataArr, page);
12736
+ });
12737
+ }
12738
+
12739
+ case 4:
12740
+ case 'end':
12741
+ return _context.stop();
12722
12742
  }
12743
+ }
12744
+ }, _callee, _this2);
12745
+ })), _this.loadDataFinished = function (data, dataArr, page) {
12746
+ if (_this.pointer && _this.pointerArray) {
12747
+ var pointer = _this.pointer;
12748
+ dataArr = dataArr[_this.pointerArray][pointer];
12749
+ }
12750
+ dataArr = dataArr.map(function (item) {
12751
+ return _extends({}, item, {
12752
+ pageNumber: page
12723
12753
  });
12724
12754
  });
12755
+
12756
+ _this.setState(function () {
12757
+ if (dataArr.length > 0) {
12758
+ return {
12759
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
12760
+ scrolling: true
12761
+ };
12762
+ } else {
12763
+ return {
12764
+ scrolling: false
12765
+ };
12766
+ }
12767
+ });
12725
12768
  }, _this.urlFor = function (source) {
12726
12769
  var client = _this.props.client;
12727
12770
 
@@ -12738,10 +12781,10 @@ var MasterDeck = function (_React$Component) {
12738
12781
  }
12739
12782
  }, _this.changePageNumber = function (pageNumber) {
12740
12783
  console.log(pageNumber);
12741
- var _this$props = _this.props,
12742
- seoPaginate = _this$props.seoPaginate,
12743
- pageview = _this$props.pageview,
12744
- router = _this$props.router;
12784
+ var _this$props2 = _this.props,
12785
+ seoPaginate = _this$props2.seoPaginate,
12786
+ pageview = _this$props2.pageview,
12787
+ router = _this$props2.router;
12745
12788
  var currentPage = _this.state.currentPage;
12746
12789
 
12747
12790
  if (seoPaginate) {