ywana-core8 0.0.578 → 0.0.581

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
@@ -206,18 +206,25 @@ var Accordion = function Accordion(props) {
206
206
  sections = _props$sections === void 0 ? [] : _props$sections,
207
207
  onCheck = props.onCheck;
208
208
 
209
- var _useState = React.useState(sections.map(function (section) {
210
- return section.open;
211
- })),
209
+ var _useState = React.useState([]),
212
210
  openSections = _useState[0],
213
211
  setOpenSections = _useState[1];
214
212
 
215
- var _useState2 = React.useState(sections.map(function (section) {
216
- return section.checked;
217
- })),
213
+ var _useState2 = React.useState([]),
218
214
  checkedSections = _useState2[0],
219
215
  setCheckedSections = _useState2[1];
220
216
 
217
+ React.useEffect(function () {
218
+ var openSections = sections.map(function (section) {
219
+ return section.open;
220
+ });
221
+ var checkedSections = sections.map(function (section) {
222
+ return section.checked;
223
+ });
224
+ setOpenSections(openSections);
225
+ setCheckedSections(checkedSections);
226
+ }, [sections]);
227
+
221
228
  function toggle(index) {
222
229
  var next = openSections.map(function (open, i) {
223
230
  return i === index ? !open : open;
@@ -8462,27 +8469,32 @@ var TabbedTablePage = function TabbedTablePage(props) {
8462
8469
 
8463
8470
  React.useEffect(function () {
8464
8471
  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
8472
+ var _temp3 = function _temp3() {
8473
+ var field = Object.values(schema).find(function (field) {
8474
+ return field.tab && field.tab === true;
8472
8475
  });
8473
- });
8476
+ var tabs = field.options.map(function (option) {
8477
+ return Object.assign({}, option, {
8478
+ field: field.id
8479
+ });
8480
+ });
8481
+ setTabs(tabs);
8482
+ context.changeTab(tabs[0]);
8483
+ setPageContext(context);
8484
+ };
8474
8485
 
8475
- setTabs(_tabs);
8476
- context.changeTab(_tabs[0]);
8477
- setPageContext(context);
8478
- return Promise.resolve();
8486
+ var _temp4 = function () {
8487
+ if (canQuery) return Promise.resolve(context.loadQueries(user)).then(function () {});
8488
+ }();
8489
+
8490
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
8479
8491
  } catch (e) {
8480
8492
  return Promise.reject(e);
8481
8493
  }
8482
8494
  }, []);
8483
8495
  React.useEffect(function () {
8484
8496
  try {
8485
- var _temp2 = function () {
8497
+ var _temp6 = function () {
8486
8498
  if (tab) {
8487
8499
  var _filter;
8488
8500
 
@@ -8493,7 +8505,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
8493
8505
  }
8494
8506
  }();
8495
8507
 
8496
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
8508
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
8497
8509
  } catch (e) {
8498
8510
  return Promise.reject(e);
8499
8511
  }
@@ -8823,6 +8835,16 @@ var TableQueries = function TableQueries(props) {
8823
8835
 
8824
8836
 
8825
8837
  var TableFilters = function TableFilters(props) {
8838
+ var reload = function reload() {
8839
+ try {
8840
+ return Promise.resolve(pageContext.load(form, likes)).then(function () {
8841
+ setPageContext(Object.assign({}, pageContext));
8842
+ });
8843
+ } catch (e) {
8844
+ return Promise.reject(e);
8845
+ }
8846
+ };
8847
+
8826
8848
  var change = function change(next) {
8827
8849
  try {
8828
8850
  setForm(next);
@@ -8865,7 +8887,7 @@ var TableFilters = function TableFilters(props) {
8865
8887
  delete filterSchema.flows;
8866
8888
  return filterSchema;
8867
8889
  }, [schema]);
8868
- React.useMemo(function () {
8890
+ var likes = React.useMemo(function () {
8869
8891
  var fields = Object.values(schema);
8870
8892
  return fields.reduce(function (likes, field) {
8871
8893
  if (field.like === true) likes.push(field.id);
@@ -8873,13 +8895,10 @@ var TableFilters = function TableFilters(props) {
8873
8895
  }, []);
8874
8896
  }, [schema]);
8875
8897
  React.useEffect(function () {
8876
- if (filters && !equal__default["default"](filters, form)) setForm(filters);
8898
+ if (filters) setForm(filters);
8877
8899
  }, [filters]);
8878
8900
  React.useEffect(function () {
8879
- if (pageContext.changeFilters && !equal__default["default"](filters, form)) {
8880
- pageContext.changeFilters(form);
8881
- setPageContext(Object.assign({}, pageContext));
8882
- }
8901
+ reload();
8883
8902
  }, [form]);
8884
8903
 
8885
8904
  function clear() {
@@ -8948,7 +8967,7 @@ var TableEditor = function TableEditor(props) {
8948
8967
  var remove = function remove(id) {
8949
8968
  try {
8950
8969
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
8951
- var _temp5 = function () {
8970
+ var _temp7 = function () {
8952
8971
  if (confirm) {
8953
8972
  return Promise.resolve(pageContext.remove(id)).then(function () {
8954
8973
  pageContext.clear();
@@ -8957,7 +8976,7 @@ var TableEditor = function TableEditor(props) {
8957
8976
  }
8958
8977
  }();
8959
8978
 
8960
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
8979
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
8961
8980
  });
8962
8981
  } catch (e) {
8963
8982
  return Promise.reject(e);
@@ -8971,8 +8990,7 @@ var TableEditor = function TableEditor(props) {
8971
8990
  setPageContext = _useContext5[1];
8972
8991
 
8973
8992
  var _pageContext$all = pageContext.all,
8974
- all = _pageContext$all === void 0 ? [] : _pageContext$all,
8975
- filters = pageContext.filters;
8993
+ all = _pageContext$all === void 0 ? [] : _pageContext$all;
8976
8994
  var icon = props.icon,
8977
8995
  title = props.title,
8978
8996
  schema = props.schema,
@@ -8987,22 +9005,6 @@ var TableEditor = function TableEditor(props) {
8987
9005
  groupBy = _useState5[0],
8988
9006
  setGroupBy = _useState5[1];
8989
9007
 
8990
- React.useEffect(function () {
8991
- try {
8992
- var _temp4 = function () {
8993
- if (filters) {
8994
- return Promise.resolve(pageContext.load(filters)).then(function () {
8995
- setPageContext(Object.assign({}, pageContext));
8996
- });
8997
- }
8998
- }();
8999
-
9000
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
9001
- } catch (e) {
9002
- return Promise.reject(e);
9003
- }
9004
- }, [filters]);
9005
-
9006
9008
  function changeGroup(id, value) {
9007
9009
  setGroupBy(value);
9008
9010
  }
@@ -9185,7 +9187,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9185
9187
  try {
9186
9188
  var _this2 = this;
9187
9189
 
9188
- var _temp7 = _catch(function () {
9190
+ var _temp9 = _catch(function () {
9189
9191
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
9190
9192
  var field = filter[key];
9191
9193
 
@@ -9214,7 +9216,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9214
9216
  console.log(error);
9215
9217
  });
9216
9218
 
9217
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9219
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9218
9220
  } catch (e) {
9219
9221
  return Promise.reject(e);
9220
9222
  }
@@ -9252,7 +9254,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9252
9254
  try {
9253
9255
  var _this5 = this;
9254
9256
 
9255
- var _temp9 = _catch(function () {
9257
+ var _temp11 = _catch(function () {
9256
9258
  return Promise.resolve(API.create(form)).then(function () {
9257
9259
  return Promise.resolve(_this5.load({}, [])).then(function () {});
9258
9260
  });
@@ -9260,7 +9262,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9260
9262
  console.log(error);
9261
9263
  });
9262
9264
 
9263
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9265
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9264
9266
  } catch (e) {
9265
9267
  return Promise.reject(e);
9266
9268
  }
@@ -9269,7 +9271,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9269
9271
  try {
9270
9272
  var _this7 = this;
9271
9273
 
9272
- var _temp11 = _catch(function () {
9274
+ var _temp13 = _catch(function () {
9273
9275
  return Promise.resolve(API.update(form)).then(function () {
9274
9276
  return Promise.resolve(_this7.load()).then(function () {});
9275
9277
  });
@@ -9277,7 +9279,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9277
9279
  console.log(error);
9278
9280
  });
9279
9281
 
9280
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9282
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9281
9283
  } catch (e) {
9282
9284
  return Promise.reject(e);
9283
9285
  }
@@ -9286,7 +9288,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9286
9288
  try {
9287
9289
  var _this9 = this;
9288
9290
 
9289
- var _temp13 = _catch(function () {
9291
+ var _temp15 = _catch(function () {
9290
9292
  return Promise.resolve(API.remove(id)).then(function () {
9291
9293
  return Promise.resolve(_this9.load()).then(function () {});
9292
9294
  });
@@ -9294,7 +9296,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9294
9296
  console.log(error);
9295
9297
  });
9296
9298
 
9297
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9299
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9298
9300
  } catch (e) {
9299
9301
  return Promise.reject(e);
9300
9302
  }
@@ -9306,7 +9308,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9306
9308
  try {
9307
9309
  var _this11 = this;
9308
9310
 
9309
- var _temp15 = _catch(function () {
9311
+ var _temp17 = _catch(function () {
9310
9312
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
9311
9313
  _this11.queries = _API$queries;
9312
9314
  });
@@ -9314,7 +9316,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9314
9316
  console.log(error);
9315
9317
  });
9316
9318
 
9317
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9319
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9318
9320
  } catch (e) {
9319
9321
  return Promise.reject(e);
9320
9322
  }
@@ -9323,7 +9325,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9323
9325
  try {
9324
9326
  var _this13 = this;
9325
9327
 
9326
- var _temp17 = _catch(function () {
9328
+ var _temp19 = _catch(function () {
9327
9329
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
9328
9330
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
9329
9331
  });
@@ -9331,7 +9333,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9331
9333
  console.log(error);
9332
9334
  });
9333
9335
 
9334
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9336
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9335
9337
  } catch (e) {
9336
9338
  return Promise.reject(e);
9337
9339
  }
@@ -9340,7 +9342,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9340
9342
  try {
9341
9343
  var _this15 = this;
9342
9344
 
9343
- var _temp19 = _catch(function () {
9345
+ var _temp21 = _catch(function () {
9344
9346
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
9345
9347
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
9346
9348
  });
@@ -9348,7 +9350,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9348
9350
  console.log(error);
9349
9351
  });
9350
9352
 
9351
- return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9353
+ return Promise.resolve(_temp21 && _temp21.then ? _temp21.then(function () {}) : void 0);
9352
9354
  } catch (e) {
9353
9355
  return Promise.reject(e);
9354
9356
  }