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.
package/dist/index.cjs CHANGED
@@ -8462,27 +8462,32 @@ var TabbedTablePage = function TabbedTablePage(props) {
8462
8462
 
8463
8463
  React.useEffect(function () {
8464
8464
  try {
8465
- var _field = Object.values(schema).find(function (field) {
8466
- return field.tab && field.tab === true;
8467
- });
8468
-
8469
- var _tabs = _field.options.map(function (option) {
8470
- return Object.assign({}, option, {
8471
- field: _field.id
8465
+ var _temp3 = function _temp3() {
8466
+ var field = Object.values(schema).find(function (field) {
8467
+ return field.tab && field.tab === true;
8472
8468
  });
8473
- });
8469
+ var tabs = field.options.map(function (option) {
8470
+ return Object.assign({}, option, {
8471
+ field: field.id
8472
+ });
8473
+ });
8474
+ setTabs(tabs);
8475
+ context.changeTab(tabs[0]);
8476
+ setPageContext(context);
8477
+ };
8474
8478
 
8475
- setTabs(_tabs);
8476
- context.changeTab(_tabs[0]);
8477
- setPageContext(context);
8478
- return Promise.resolve();
8479
+ var _temp4 = function () {
8480
+ if (canQuery) return Promise.resolve(context.loadQueries(user)).then(function () {});
8481
+ }();
8482
+
8483
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
8479
8484
  } catch (e) {
8480
8485
  return Promise.reject(e);
8481
8486
  }
8482
8487
  }, []);
8483
8488
  React.useEffect(function () {
8484
8489
  try {
8485
- var _temp2 = function () {
8490
+ var _temp6 = function () {
8486
8491
  if (tab) {
8487
8492
  var _filter;
8488
8493
 
@@ -8493,7 +8498,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
8493
8498
  }
8494
8499
  }();
8495
8500
 
8496
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
8501
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
8497
8502
  } catch (e) {
8498
8503
  return Promise.reject(e);
8499
8504
  }
@@ -8823,6 +8828,15 @@ var TableQueries = function TableQueries(props) {
8823
8828
 
8824
8829
 
8825
8830
  var TableFilters = function TableFilters(props) {
8831
+ var reload = function reload() {
8832
+ try {
8833
+ return Promise.resolve(pageContext.load(form, likes)).then(function () {
8834
+ setPageContext(Object.assign({}, pageContext));
8835
+ });
8836
+ } catch (e) {
8837
+ return Promise.reject(e);
8838
+ }
8839
+ };
8826
8840
 
8827
8841
  var change = function change(next) {
8828
8842
  try {
@@ -8866,7 +8880,7 @@ var TableFilters = function TableFilters(props) {
8866
8880
  delete filterSchema.flows;
8867
8881
  return filterSchema;
8868
8882
  }, [schema]);
8869
- React.useMemo(function () {
8883
+ var likes = React.useMemo(function () {
8870
8884
  var fields = Object.values(schema);
8871
8885
  return fields.reduce(function (likes, field) {
8872
8886
  if (field.like === true) likes.push(field.id);
@@ -8874,13 +8888,10 @@ var TableFilters = function TableFilters(props) {
8874
8888
  }, []);
8875
8889
  }, [schema]);
8876
8890
  React.useEffect(function () {
8877
- if (filters && !equal__default["default"](filters, form)) setForm(filters);
8891
+ if (filters) setForm(filters);
8878
8892
  }, [filters]);
8879
8893
  React.useEffect(function () {
8880
- if (pageContext.changeFilters && !equal__default["default"](filters, form)) {
8881
- pageContext.changeFilters(form);
8882
- setPageContext(Object.assign({}, pageContext));
8883
- }
8894
+ reload();
8884
8895
  }, [form]);
8885
8896
 
8886
8897
  function clear() {
@@ -8949,7 +8960,7 @@ var TableEditor = function TableEditor(props) {
8949
8960
  var remove = function remove(id) {
8950
8961
  try {
8951
8962
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
8952
- var _temp5 = function () {
8963
+ var _temp7 = function () {
8953
8964
  if (confirm) {
8954
8965
  return Promise.resolve(pageContext.remove(id)).then(function () {
8955
8966
  pageContext.clear();
@@ -8958,7 +8969,7 @@ var TableEditor = function TableEditor(props) {
8958
8969
  }
8959
8970
  }();
8960
8971
 
8961
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
8972
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
8962
8973
  });
8963
8974
  } catch (e) {
8964
8975
  return Promise.reject(e);
@@ -8972,8 +8983,7 @@ var TableEditor = function TableEditor(props) {
8972
8983
  setPageContext = _useContext5[1];
8973
8984
 
8974
8985
  var _pageContext$all = pageContext.all,
8975
- all = _pageContext$all === void 0 ? [] : _pageContext$all,
8976
- filters = pageContext.filters;
8986
+ all = _pageContext$all === void 0 ? [] : _pageContext$all;
8977
8987
  var icon = props.icon,
8978
8988
  title = props.title,
8979
8989
  schema = props.schema,
@@ -8988,22 +8998,6 @@ var TableEditor = function TableEditor(props) {
8988
8998
  groupBy = _useState5[0],
8989
8999
  setGroupBy = _useState5[1];
8990
9000
 
8991
- React.useEffect(function () {
8992
- try {
8993
- var _temp4 = function () {
8994
- if (filters) {
8995
- return Promise.resolve(pageContext.load(filters)).then(function () {
8996
- setPageContext(Object.assign({}, pageContext));
8997
- });
8998
- }
8999
- }();
9000
-
9001
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
9002
- } catch (e) {
9003
- return Promise.reject(e);
9004
- }
9005
- }, [filters]);
9006
-
9007
9001
  function changeGroup(id, value) {
9008
9002
  setGroupBy(value);
9009
9003
  }
@@ -9186,7 +9180,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9186
9180
  try {
9187
9181
  var _this2 = this;
9188
9182
 
9189
- var _temp7 = _catch(function () {
9183
+ var _temp9 = _catch(function () {
9190
9184
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
9191
9185
  var field = filter[key];
9192
9186
 
@@ -9215,7 +9209,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9215
9209
  console.log(error);
9216
9210
  });
9217
9211
 
9218
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9212
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9219
9213
  } catch (e) {
9220
9214
  return Promise.reject(e);
9221
9215
  }
@@ -9253,7 +9247,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9253
9247
  try {
9254
9248
  var _this5 = this;
9255
9249
 
9256
- var _temp9 = _catch(function () {
9250
+ var _temp11 = _catch(function () {
9257
9251
  return Promise.resolve(API.create(form)).then(function () {
9258
9252
  return Promise.resolve(_this5.load({}, [])).then(function () {});
9259
9253
  });
@@ -9261,7 +9255,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9261
9255
  console.log(error);
9262
9256
  });
9263
9257
 
9264
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9258
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9265
9259
  } catch (e) {
9266
9260
  return Promise.reject(e);
9267
9261
  }
@@ -9270,7 +9264,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9270
9264
  try {
9271
9265
  var _this7 = this;
9272
9266
 
9273
- var _temp11 = _catch(function () {
9267
+ var _temp13 = _catch(function () {
9274
9268
  return Promise.resolve(API.update(form)).then(function () {
9275
9269
  return Promise.resolve(_this7.load()).then(function () {});
9276
9270
  });
@@ -9278,7 +9272,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9278
9272
  console.log(error);
9279
9273
  });
9280
9274
 
9281
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9275
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9282
9276
  } catch (e) {
9283
9277
  return Promise.reject(e);
9284
9278
  }
@@ -9287,7 +9281,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9287
9281
  try {
9288
9282
  var _this9 = this;
9289
9283
 
9290
- var _temp13 = _catch(function () {
9284
+ var _temp15 = _catch(function () {
9291
9285
  return Promise.resolve(API.remove(id)).then(function () {
9292
9286
  return Promise.resolve(_this9.load()).then(function () {});
9293
9287
  });
@@ -9295,7 +9289,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9295
9289
  console.log(error);
9296
9290
  });
9297
9291
 
9298
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9292
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9299
9293
  } catch (e) {
9300
9294
  return Promise.reject(e);
9301
9295
  }
@@ -9307,7 +9301,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9307
9301
  try {
9308
9302
  var _this11 = this;
9309
9303
 
9310
- var _temp15 = _catch(function () {
9304
+ var _temp17 = _catch(function () {
9311
9305
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
9312
9306
  _this11.queries = _API$queries;
9313
9307
  });
@@ -9315,7 +9309,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9315
9309
  console.log(error);
9316
9310
  });
9317
9311
 
9318
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9312
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9319
9313
  } catch (e) {
9320
9314
  return Promise.reject(e);
9321
9315
  }
@@ -9324,7 +9318,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9324
9318
  try {
9325
9319
  var _this13 = this;
9326
9320
 
9327
- var _temp17 = _catch(function () {
9321
+ var _temp19 = _catch(function () {
9328
9322
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
9329
9323
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
9330
9324
  });
@@ -9332,7 +9326,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9332
9326
  console.log(error);
9333
9327
  });
9334
9328
 
9335
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9329
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9336
9330
  } catch (e) {
9337
9331
  return Promise.reject(e);
9338
9332
  }
@@ -9341,7 +9335,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9341
9335
  try {
9342
9336
  var _this15 = this;
9343
9337
 
9344
- var _temp19 = _catch(function () {
9338
+ var _temp21 = _catch(function () {
9345
9339
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
9346
9340
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
9347
9341
  });
@@ -9349,7 +9343,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9349
9343
  console.log(error);
9350
9344
  });
9351
9345
 
9352
- return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9346
+ return Promise.resolve(_temp21 && _temp21.then ? _temp21.then(function () {}) : void 0);
9353
9347
  } catch (e) {
9354
9348
  return Promise.reject(e);
9355
9349
  }