ywana-core8 0.0.578 → 0.0.579

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
@@ -8823,6 +8823,16 @@ var TableQueries = function TableQueries(props) {
8823
8823
 
8824
8824
 
8825
8825
  var TableFilters = function TableFilters(props) {
8826
+ var reload = function reload() {
8827
+ try {
8828
+ return Promise.resolve(pageContext.load(form, likes)).then(function () {
8829
+ setPageContext(Object.assign({}, pageContext));
8830
+ });
8831
+ } catch (e) {
8832
+ return Promise.reject(e);
8833
+ }
8834
+ };
8835
+
8826
8836
  var change = function change(next) {
8827
8837
  try {
8828
8838
  setForm(next);
@@ -8865,7 +8875,7 @@ var TableFilters = function TableFilters(props) {
8865
8875
  delete filterSchema.flows;
8866
8876
  return filterSchema;
8867
8877
  }, [schema]);
8868
- React.useMemo(function () {
8878
+ var likes = React.useMemo(function () {
8869
8879
  var fields = Object.values(schema);
8870
8880
  return fields.reduce(function (likes, field) {
8871
8881
  if (field.like === true) likes.push(field.id);
@@ -8873,13 +8883,10 @@ var TableFilters = function TableFilters(props) {
8873
8883
  }, []);
8874
8884
  }, [schema]);
8875
8885
  React.useEffect(function () {
8876
- if (filters && !equal__default["default"](filters, form)) setForm(filters);
8886
+ if (filters) setForm(filters);
8877
8887
  }, [filters]);
8878
8888
  React.useEffect(function () {
8879
- if (pageContext.changeFilters && !equal__default["default"](filters, form)) {
8880
- pageContext.changeFilters(form);
8881
- setPageContext(Object.assign({}, pageContext));
8882
- }
8889
+ reload();
8883
8890
  }, [form]);
8884
8891
 
8885
8892
  function clear() {
@@ -8948,7 +8955,7 @@ var TableEditor = function TableEditor(props) {
8948
8955
  var remove = function remove(id) {
8949
8956
  try {
8950
8957
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
8951
- var _temp5 = function () {
8958
+ var _temp3 = function () {
8952
8959
  if (confirm) {
8953
8960
  return Promise.resolve(pageContext.remove(id)).then(function () {
8954
8961
  pageContext.clear();
@@ -8957,7 +8964,7 @@ var TableEditor = function TableEditor(props) {
8957
8964
  }
8958
8965
  }();
8959
8966
 
8960
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
8967
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
8961
8968
  });
8962
8969
  } catch (e) {
8963
8970
  return Promise.reject(e);
@@ -8971,8 +8978,7 @@ var TableEditor = function TableEditor(props) {
8971
8978
  setPageContext = _useContext5[1];
8972
8979
 
8973
8980
  var _pageContext$all = pageContext.all,
8974
- all = _pageContext$all === void 0 ? [] : _pageContext$all,
8975
- filters = pageContext.filters;
8981
+ all = _pageContext$all === void 0 ? [] : _pageContext$all;
8976
8982
  var icon = props.icon,
8977
8983
  title = props.title,
8978
8984
  schema = props.schema,
@@ -8987,22 +8993,6 @@ var TableEditor = function TableEditor(props) {
8987
8993
  groupBy = _useState5[0],
8988
8994
  setGroupBy = _useState5[1];
8989
8995
 
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
8996
  function changeGroup(id, value) {
9007
8997
  setGroupBy(value);
9008
8998
  }
@@ -9185,7 +9175,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9185
9175
  try {
9186
9176
  var _this2 = this;
9187
9177
 
9188
- var _temp7 = _catch(function () {
9178
+ var _temp5 = _catch(function () {
9189
9179
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
9190
9180
  var field = filter[key];
9191
9181
 
@@ -9214,7 +9204,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9214
9204
  console.log(error);
9215
9205
  });
9216
9206
 
9217
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9207
+ return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
9218
9208
  } catch (e) {
9219
9209
  return Promise.reject(e);
9220
9210
  }
@@ -9252,7 +9242,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9252
9242
  try {
9253
9243
  var _this5 = this;
9254
9244
 
9255
- var _temp9 = _catch(function () {
9245
+ var _temp7 = _catch(function () {
9256
9246
  return Promise.resolve(API.create(form)).then(function () {
9257
9247
  return Promise.resolve(_this5.load({}, [])).then(function () {});
9258
9248
  });
@@ -9260,7 +9250,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9260
9250
  console.log(error);
9261
9251
  });
9262
9252
 
9263
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9253
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9264
9254
  } catch (e) {
9265
9255
  return Promise.reject(e);
9266
9256
  }
@@ -9269,7 +9259,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9269
9259
  try {
9270
9260
  var _this7 = this;
9271
9261
 
9272
- var _temp11 = _catch(function () {
9262
+ var _temp9 = _catch(function () {
9273
9263
  return Promise.resolve(API.update(form)).then(function () {
9274
9264
  return Promise.resolve(_this7.load()).then(function () {});
9275
9265
  });
@@ -9277,7 +9267,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9277
9267
  console.log(error);
9278
9268
  });
9279
9269
 
9280
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9270
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9281
9271
  } catch (e) {
9282
9272
  return Promise.reject(e);
9283
9273
  }
@@ -9286,7 +9276,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9286
9276
  try {
9287
9277
  var _this9 = this;
9288
9278
 
9289
- var _temp13 = _catch(function () {
9279
+ var _temp11 = _catch(function () {
9290
9280
  return Promise.resolve(API.remove(id)).then(function () {
9291
9281
  return Promise.resolve(_this9.load()).then(function () {});
9292
9282
  });
@@ -9294,7 +9284,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9294
9284
  console.log(error);
9295
9285
  });
9296
9286
 
9297
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9287
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9298
9288
  } catch (e) {
9299
9289
  return Promise.reject(e);
9300
9290
  }
@@ -9306,7 +9296,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9306
9296
  try {
9307
9297
  var _this11 = this;
9308
9298
 
9309
- var _temp15 = _catch(function () {
9299
+ var _temp13 = _catch(function () {
9310
9300
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
9311
9301
  _this11.queries = _API$queries;
9312
9302
  });
@@ -9314,7 +9304,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9314
9304
  console.log(error);
9315
9305
  });
9316
9306
 
9317
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9307
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9318
9308
  } catch (e) {
9319
9309
  return Promise.reject(e);
9320
9310
  }
@@ -9323,7 +9313,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9323
9313
  try {
9324
9314
  var _this13 = this;
9325
9315
 
9326
- var _temp17 = _catch(function () {
9316
+ var _temp15 = _catch(function () {
9327
9317
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
9328
9318
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
9329
9319
  });
@@ -9331,7 +9321,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9331
9321
  console.log(error);
9332
9322
  });
9333
9323
 
9334
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9324
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9335
9325
  } catch (e) {
9336
9326
  return Promise.reject(e);
9337
9327
  }
@@ -9340,7 +9330,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9340
9330
  try {
9341
9331
  var _this15 = this;
9342
9332
 
9343
- var _temp19 = _catch(function () {
9333
+ var _temp17 = _catch(function () {
9344
9334
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
9345
9335
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
9346
9336
  });
@@ -9348,7 +9338,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9348
9338
  console.log(error);
9349
9339
  });
9350
9340
 
9351
- return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9341
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9352
9342
  } catch (e) {
9353
9343
  return Promise.reject(e);
9354
9344
  }