ywana-core8 0.0.577 → 0.0.580

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.
@@ -8454,27 +8454,32 @@ var TabbedTablePage = function TabbedTablePage(props) {
8454
8454
 
8455
8455
  useEffect(function () {
8456
8456
  try {
8457
- var _field = Object.values(schema).find(function (field) {
8458
- return field.tab && field.tab === true;
8459
- });
8460
-
8461
- var _tabs = _field.options.map(function (option) {
8462
- return Object.assign({}, option, {
8463
- field: _field.id
8457
+ var _temp3 = function _temp3() {
8458
+ var field = Object.values(schema).find(function (field) {
8459
+ return field.tab && field.tab === true;
8464
8460
  });
8465
- });
8461
+ var tabs = field.options.map(function (option) {
8462
+ return Object.assign({}, option, {
8463
+ field: field.id
8464
+ });
8465
+ });
8466
+ setTabs(tabs);
8467
+ context.changeTab(tabs[0]);
8468
+ setPageContext(context);
8469
+ };
8466
8470
 
8467
- setTabs(_tabs);
8468
- context.changeTab(_tabs[0]);
8469
- setPageContext(context);
8470
- return Promise.resolve();
8471
+ var _temp4 = function () {
8472
+ if (canQuery) return Promise.resolve(context.loadQueries(user)).then(function () {});
8473
+ }();
8474
+
8475
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
8471
8476
  } catch (e) {
8472
8477
  return Promise.reject(e);
8473
8478
  }
8474
8479
  }, []);
8475
8480
  useEffect(function () {
8476
8481
  try {
8477
- var _temp2 = function () {
8482
+ var _temp6 = function () {
8478
8483
  if (tab) {
8479
8484
  var _filter;
8480
8485
 
@@ -8485,7 +8490,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
8485
8490
  }
8486
8491
  }();
8487
8492
 
8488
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
8493
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
8489
8494
  } catch (e) {
8490
8495
  return Promise.reject(e);
8491
8496
  }
@@ -8815,6 +8820,15 @@ var TableQueries = function TableQueries(props) {
8815
8820
 
8816
8821
 
8817
8822
  var TableFilters = function TableFilters(props) {
8823
+ var reload = function reload() {
8824
+ try {
8825
+ return Promise.resolve(pageContext.load(form, likes)).then(function () {
8826
+ setPageContext(Object.assign({}, pageContext));
8827
+ });
8828
+ } catch (e) {
8829
+ return Promise.reject(e);
8830
+ }
8831
+ };
8818
8832
 
8819
8833
  var change = function change(next) {
8820
8834
  try {
@@ -8858,7 +8872,7 @@ var TableFilters = function TableFilters(props) {
8858
8872
  delete filterSchema.flows;
8859
8873
  return filterSchema;
8860
8874
  }, [schema]);
8861
- useMemo(function () {
8875
+ var likes = useMemo(function () {
8862
8876
  var fields = Object.values(schema);
8863
8877
  return fields.reduce(function (likes, field) {
8864
8878
  if (field.like === true) likes.push(field.id);
@@ -8866,13 +8880,10 @@ var TableFilters = function TableFilters(props) {
8866
8880
  }, []);
8867
8881
  }, [schema]);
8868
8882
  useEffect(function () {
8869
- if (filters && !equal(filters, form)) setForm(filters);
8883
+ if (filters) setForm(filters);
8870
8884
  }, [filters]);
8871
8885
  useEffect(function () {
8872
- if (pageContext.changeFilters && !equal(filters, form)) {
8873
- pageContext.changeFilters(form);
8874
- setPageContext(Object.assign({}, pageContext));
8875
- }
8886
+ reload();
8876
8887
  }, [form]);
8877
8888
 
8878
8889
  function clear() {
@@ -8941,7 +8952,7 @@ var TableEditor = function TableEditor(props) {
8941
8952
  var remove = function remove(id) {
8942
8953
  try {
8943
8954
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
8944
- var _temp5 = function () {
8955
+ var _temp7 = function () {
8945
8956
  if (confirm) {
8946
8957
  return Promise.resolve(pageContext.remove(id)).then(function () {
8947
8958
  pageContext.clear();
@@ -8950,7 +8961,7 @@ var TableEditor = function TableEditor(props) {
8950
8961
  }
8951
8962
  }();
8952
8963
 
8953
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
8964
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
8954
8965
  });
8955
8966
  } catch (e) {
8956
8967
  return Promise.reject(e);
@@ -8964,8 +8975,7 @@ var TableEditor = function TableEditor(props) {
8964
8975
  setPageContext = _useContext5[1];
8965
8976
 
8966
8977
  var _pageContext$all = pageContext.all,
8967
- all = _pageContext$all === void 0 ? [] : _pageContext$all,
8968
- filters = pageContext.filters;
8978
+ all = _pageContext$all === void 0 ? [] : _pageContext$all;
8969
8979
  var icon = props.icon,
8970
8980
  title = props.title,
8971
8981
  schema = props.schema,
@@ -8980,22 +8990,6 @@ var TableEditor = function TableEditor(props) {
8980
8990
  groupBy = _useState5[0],
8981
8991
  setGroupBy = _useState5[1];
8982
8992
 
8983
- useEffect(function () {
8984
- try {
8985
- var _temp4 = function () {
8986
- if (filters) {
8987
- return Promise.resolve(pageContext.load(filters)).then(function () {
8988
- setPageContext(Object.assign({}, pageContext));
8989
- });
8990
- }
8991
- }();
8992
-
8993
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
8994
- } catch (e) {
8995
- return Promise.reject(e);
8996
- }
8997
- }, [filters]);
8998
-
8999
8993
  function changeGroup(id, value) {
9000
8994
  setGroupBy(value);
9001
8995
  }
@@ -9178,7 +9172,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9178
9172
  try {
9179
9173
  var _this2 = this;
9180
9174
 
9181
- var _temp7 = _catch(function () {
9175
+ var _temp9 = _catch(function () {
9182
9176
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
9183
9177
  var field = filter[key];
9184
9178
 
@@ -9207,7 +9201,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9207
9201
  console.log(error);
9208
9202
  });
9209
9203
 
9210
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9204
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9211
9205
  } catch (e) {
9212
9206
  return Promise.reject(e);
9213
9207
  }
@@ -9245,7 +9239,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9245
9239
  try {
9246
9240
  var _this5 = this;
9247
9241
 
9248
- var _temp9 = _catch(function () {
9242
+ var _temp11 = _catch(function () {
9249
9243
  return Promise.resolve(API.create(form)).then(function () {
9250
9244
  return Promise.resolve(_this5.load({}, [])).then(function () {});
9251
9245
  });
@@ -9253,7 +9247,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9253
9247
  console.log(error);
9254
9248
  });
9255
9249
 
9256
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9250
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9257
9251
  } catch (e) {
9258
9252
  return Promise.reject(e);
9259
9253
  }
@@ -9262,7 +9256,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9262
9256
  try {
9263
9257
  var _this7 = this;
9264
9258
 
9265
- var _temp11 = _catch(function () {
9259
+ var _temp13 = _catch(function () {
9266
9260
  return Promise.resolve(API.update(form)).then(function () {
9267
9261
  return Promise.resolve(_this7.load()).then(function () {});
9268
9262
  });
@@ -9270,7 +9264,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9270
9264
  console.log(error);
9271
9265
  });
9272
9266
 
9273
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9267
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9274
9268
  } catch (e) {
9275
9269
  return Promise.reject(e);
9276
9270
  }
@@ -9279,7 +9273,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9279
9273
  try {
9280
9274
  var _this9 = this;
9281
9275
 
9282
- var _temp13 = _catch(function () {
9276
+ var _temp15 = _catch(function () {
9283
9277
  return Promise.resolve(API.remove(id)).then(function () {
9284
9278
  return Promise.resolve(_this9.load()).then(function () {});
9285
9279
  });
@@ -9287,7 +9281,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9287
9281
  console.log(error);
9288
9282
  });
9289
9283
 
9290
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9284
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9291
9285
  } catch (e) {
9292
9286
  return Promise.reject(e);
9293
9287
  }
@@ -9299,7 +9293,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9299
9293
  try {
9300
9294
  var _this11 = this;
9301
9295
 
9302
- var _temp15 = _catch(function () {
9296
+ var _temp17 = _catch(function () {
9303
9297
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
9304
9298
  _this11.queries = _API$queries;
9305
9299
  });
@@ -9307,7 +9301,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9307
9301
  console.log(error);
9308
9302
  });
9309
9303
 
9310
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9304
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9311
9305
  } catch (e) {
9312
9306
  return Promise.reject(e);
9313
9307
  }
@@ -9316,7 +9310,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9316
9310
  try {
9317
9311
  var _this13 = this;
9318
9312
 
9319
- var _temp17 = _catch(function () {
9313
+ var _temp19 = _catch(function () {
9320
9314
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
9321
9315
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
9322
9316
  });
@@ -9324,7 +9318,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9324
9318
  console.log(error);
9325
9319
  });
9326
9320
 
9327
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9321
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9328
9322
  } catch (e) {
9329
9323
  return Promise.reject(e);
9330
9324
  }
@@ -9333,7 +9327,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9333
9327
  try {
9334
9328
  var _this15 = this;
9335
9329
 
9336
- var _temp19 = _catch(function () {
9330
+ var _temp21 = _catch(function () {
9337
9331
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
9338
9332
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
9339
9333
  });
@@ -9341,7 +9335,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9341
9335
  console.log(error);
9342
9336
  });
9343
9337
 
9344
- return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9338
+ return Promise.resolve(_temp21 && _temp21.then ? _temp21.then(function () {}) : void 0);
9345
9339
  } catch (e) {
9346
9340
  return Promise.reject(e);
9347
9341
  }