ywana-core8 0.0.576 → 0.0.577

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
@@ -7376,11 +7376,11 @@ var TablePage2 = function TablePage2(props) {
7376
7376
  children = props.children;
7377
7377
 
7378
7378
  var _useContext = React.useContext(PageContext),
7379
+ pageContext = _useContext[0],
7379
7380
  setPageContext = _useContext[1];
7380
7381
 
7381
7382
  var context = TableContext$1(url, field, host, urlQuery, params);
7382
- var _pageContext = pageContext,
7383
- selected = _pageContext.selected;
7383
+ var selected = pageContext.selected;
7384
7384
  var timer = React.useRef(null);
7385
7385
 
7386
7386
  var _useState = React.useState(selected),
@@ -7701,16 +7701,6 @@ var TableQueries$1 = function TableQueries(props) {
7701
7701
 
7702
7702
 
7703
7703
  var TableFilters$1 = function TableFilters(props) {
7704
- var reload = function reload() {
7705
- try {
7706
- return Promise.resolve(pageContext.load(form)).then(function () {
7707
- setPageContext(Object.assign({}, pageContext));
7708
- });
7709
- } catch (e) {
7710
- return Promise.reject(e);
7711
- }
7712
- };
7713
-
7714
7704
  var change = function change(next) {
7715
7705
  try {
7716
7706
  setForm(next);
@@ -7754,10 +7744,13 @@ var TableFilters$1 = function TableFilters(props) {
7754
7744
  return filterSchema;
7755
7745
  }, [schema]);
7756
7746
  React.useEffect(function () {
7757
- if (filters) setForm(filters);
7747
+ if (filters && !equal__default["default"](filters, form)) setForm(filters);
7758
7748
  }, [filters]);
7759
7749
  React.useEffect(function () {
7760
- reload();
7750
+ if (pageContext.changeFilters && !equal__default["default"](filters, form)) {
7751
+ pageContext.changeFilters(form);
7752
+ setPageContext(Object.assign({}, pageContext));
7753
+ }
7761
7754
  }, [form]);
7762
7755
 
7763
7756
  function clear() {
@@ -7826,7 +7819,7 @@ var TableEditor$1 = function TableEditor(props) {
7826
7819
  var remove = function remove(id) {
7827
7820
  try {
7828
7821
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
7829
- var _temp5 = function () {
7822
+ var _temp7 = function () {
7830
7823
  if (confirm) {
7831
7824
  return Promise.resolve(pageContext.remove(id)).then(function () {
7832
7825
  pageContext.clear();
@@ -7835,7 +7828,7 @@ var TableEditor$1 = function TableEditor(props) {
7835
7828
  }
7836
7829
  }();
7837
7830
 
7838
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
7831
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
7839
7832
  });
7840
7833
  } catch (e) {
7841
7834
  return Promise.reject(e);
@@ -7849,7 +7842,8 @@ var TableEditor$1 = function TableEditor(props) {
7849
7842
  setPageContext = _useContext5[1];
7850
7843
 
7851
7844
  var _pageContext$all = pageContext.all,
7852
- all = _pageContext$all === void 0 ? [] : _pageContext$all;
7845
+ all = _pageContext$all === void 0 ? [] : _pageContext$all,
7846
+ filters = pageContext.filters;
7853
7847
  var icon = props.icon,
7854
7848
  title = props.title,
7855
7849
  schema = props.schema,
@@ -7857,7 +7851,8 @@ var TableEditor$1 = function TableEditor(props) {
7857
7851
  canDelete = props.canDelete,
7858
7852
  filter = props.filter,
7859
7853
  actions = props.actions,
7860
- className = props.className;
7854
+ className = props.className,
7855
+ tabbedBy = props.tabbedBy;
7861
7856
 
7862
7857
  var _useState4 = React.useState(props.groupBy),
7863
7858
  groupBy = _useState4[0],
@@ -7869,6 +7864,21 @@ var TableEditor$1 = function TableEditor(props) {
7869
7864
  React.useEffect(function () {
7870
7865
  try {
7871
7866
  var _temp4 = function () {
7867
+ if (filters) {
7868
+ return Promise.resolve(pageContext.load(filters)).then(function () {
7869
+ setPageContext(Object.assign({}, pageContext));
7870
+ });
7871
+ }
7872
+ }();
7873
+
7874
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
7875
+ } catch (e) {
7876
+ return Promise.reject(e);
7877
+ }
7878
+ }, [filters]);
7879
+ React.useEffect(function () {
7880
+ try {
7881
+ var _temp6 = function () {
7872
7882
  if (tab) {
7873
7883
  var _filter2;
7874
7884
 
@@ -7880,7 +7890,7 @@ var TableEditor$1 = function TableEditor(props) {
7880
7890
  }
7881
7891
  }();
7882
7892
 
7883
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
7893
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
7884
7894
  } catch (e) {
7885
7895
  return Promise.reject(e);
7886
7896
  }
@@ -8075,7 +8085,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8075
8085
  try {
8076
8086
  var _this2 = this;
8077
8087
 
8078
- var _temp7 = _catch$1(function () {
8088
+ var _temp9 = _catch$1(function () {
8079
8089
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
8080
8090
  var field = filter[key];
8081
8091
 
@@ -8099,7 +8109,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8099
8109
  console.log(error);
8100
8110
  });
8101
8111
 
8102
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
8112
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
8103
8113
  } catch (e) {
8104
8114
  return Promise.reject(e);
8105
8115
  }
@@ -8134,7 +8144,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8134
8144
  try {
8135
8145
  var _this5 = this;
8136
8146
 
8137
- var _temp9 = _catch$1(function () {
8147
+ var _temp11 = _catch$1(function () {
8138
8148
  return Promise.resolve(API.create(form)).then(function () {
8139
8149
  return Promise.resolve(_this5.load()).then(function () {});
8140
8150
  });
@@ -8142,7 +8152,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8142
8152
  console.log(error);
8143
8153
  });
8144
8154
 
8145
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
8155
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
8146
8156
  } catch (e) {
8147
8157
  return Promise.reject(e);
8148
8158
  }
@@ -8151,7 +8161,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8151
8161
  try {
8152
8162
  var _this7 = this;
8153
8163
 
8154
- var _temp11 = _catch$1(function () {
8164
+ var _temp13 = _catch$1(function () {
8155
8165
  return Promise.resolve(API.update(form)).then(function () {
8156
8166
  return Promise.resolve(_this7.load()).then(function () {});
8157
8167
  });
@@ -8159,7 +8169,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8159
8169
  console.log(error);
8160
8170
  });
8161
8171
 
8162
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
8172
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
8163
8173
  } catch (e) {
8164
8174
  return Promise.reject(e);
8165
8175
  }
@@ -8168,7 +8178,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8168
8178
  try {
8169
8179
  var _this9 = this;
8170
8180
 
8171
- var _temp13 = _catch$1(function () {
8181
+ var _temp15 = _catch$1(function () {
8172
8182
  return Promise.resolve(API.remove(id)).then(function () {
8173
8183
  return Promise.resolve(_this9.load()).then(function () {});
8174
8184
  });
@@ -8176,7 +8186,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8176
8186
  console.log(error);
8177
8187
  });
8178
8188
 
8179
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
8189
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
8180
8190
  } catch (e) {
8181
8191
  return Promise.reject(e);
8182
8192
  }
@@ -8188,7 +8198,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8188
8198
  try {
8189
8199
  var _this11 = this;
8190
8200
 
8191
- var _temp15 = _catch$1(function () {
8201
+ var _temp17 = _catch$1(function () {
8192
8202
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
8193
8203
  _this11.queries = _API$queries;
8194
8204
  });
@@ -8196,7 +8206,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8196
8206
  console.log(error);
8197
8207
  });
8198
8208
 
8199
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
8209
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
8200
8210
  } catch (e) {
8201
8211
  return Promise.reject(e);
8202
8212
  }
@@ -8205,7 +8215,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8205
8215
  try {
8206
8216
  var _this13 = this;
8207
8217
 
8208
- var _temp17 = _catch$1(function () {
8218
+ var _temp19 = _catch$1(function () {
8209
8219
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
8210
8220
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
8211
8221
  });
@@ -8213,7 +8223,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8213
8223
  console.log(error);
8214
8224
  });
8215
8225
 
8216
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
8226
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
8217
8227
  } catch (e) {
8218
8228
  return Promise.reject(e);
8219
8229
  }
@@ -8222,7 +8232,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8222
8232
  try {
8223
8233
  var _this15 = this;
8224
8234
 
8225
- var _temp19 = _catch$1(function () {
8235
+ var _temp21 = _catch$1(function () {
8226
8236
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
8227
8237
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
8228
8238
  });
@@ -8230,7 +8240,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8230
8240
  console.log(error);
8231
8241
  });
8232
8242
 
8233
- return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
8243
+ return Promise.resolve(_temp21 && _temp21.then ? _temp21.then(function () {}) : void 0);
8234
8244
  } catch (e) {
8235
8245
  return Promise.reject(e);
8236
8246
  }
@@ -8265,7 +8275,7 @@ var TableAPI$1 = function TableAPI(url, host, params) {
8265
8275
  }, "");
8266
8276
  return query.concat(param);
8267
8277
  } else {
8268
- return query.concat(key + "=%" + filters[key] + "%&");
8278
+ return query.concat(key + "=" + filters[key] + "&");
8269
8279
  }
8270
8280
  }, "");
8271
8281
  queryParams = queryParams.concat(filterQuery);
@@ -8813,15 +8823,6 @@ var TableQueries = function TableQueries(props) {
8813
8823
 
8814
8824
 
8815
8825
  var TableFilters = function TableFilters(props) {
8816
- var reload = function reload() {
8817
- try {
8818
- return Promise.resolve(pageContext.load(form, likes)).then(function () {
8819
- setPageContext(Object.assign({}, pageContext));
8820
- });
8821
- } catch (e) {
8822
- return Promise.reject(e);
8823
- }
8824
- };
8825
8826
 
8826
8827
  var change = function change(next) {
8827
8828
  try {
@@ -8865,7 +8866,7 @@ var TableFilters = function TableFilters(props) {
8865
8866
  delete filterSchema.flows;
8866
8867
  return filterSchema;
8867
8868
  }, [schema]);
8868
- var likes = React.useMemo(function () {
8869
+ React.useMemo(function () {
8869
8870
  var fields = Object.values(schema);
8870
8871
  return fields.reduce(function (likes, field) {
8871
8872
  if (field.like === true) likes.push(field.id);
@@ -8873,10 +8874,13 @@ var TableFilters = function TableFilters(props) {
8873
8874
  }, []);
8874
8875
  }, [schema]);
8875
8876
  React.useEffect(function () {
8876
- if (filters) setForm(filters);
8877
+ if (filters && !equal__default["default"](filters, form)) setForm(filters);
8877
8878
  }, [filters]);
8878
8879
  React.useEffect(function () {
8879
- reload();
8880
+ if (pageContext.changeFilters && !equal__default["default"](filters, form)) {
8881
+ pageContext.changeFilters(form);
8882
+ setPageContext(Object.assign({}, pageContext));
8883
+ }
8880
8884
  }, [form]);
8881
8885
 
8882
8886
  function clear() {
@@ -8945,7 +8949,7 @@ var TableEditor = function TableEditor(props) {
8945
8949
  var remove = function remove(id) {
8946
8950
  try {
8947
8951
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
8948
- var _temp3 = function () {
8952
+ var _temp5 = function () {
8949
8953
  if (confirm) {
8950
8954
  return Promise.resolve(pageContext.remove(id)).then(function () {
8951
8955
  pageContext.clear();
@@ -8954,7 +8958,7 @@ var TableEditor = function TableEditor(props) {
8954
8958
  }
8955
8959
  }();
8956
8960
 
8957
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
8961
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
8958
8962
  });
8959
8963
  } catch (e) {
8960
8964
  return Promise.reject(e);
@@ -8968,7 +8972,8 @@ var TableEditor = function TableEditor(props) {
8968
8972
  setPageContext = _useContext5[1];
8969
8973
 
8970
8974
  var _pageContext$all = pageContext.all,
8971
- all = _pageContext$all === void 0 ? [] : _pageContext$all;
8975
+ all = _pageContext$all === void 0 ? [] : _pageContext$all,
8976
+ filters = pageContext.filters;
8972
8977
  var icon = props.icon,
8973
8978
  title = props.title,
8974
8979
  schema = props.schema,
@@ -8983,6 +8988,22 @@ var TableEditor = function TableEditor(props) {
8983
8988
  groupBy = _useState5[0],
8984
8989
  setGroupBy = _useState5[1];
8985
8990
 
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
+
8986
9007
  function changeGroup(id, value) {
8987
9008
  setGroupBy(value);
8988
9009
  }
@@ -9165,7 +9186,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9165
9186
  try {
9166
9187
  var _this2 = this;
9167
9188
 
9168
- var _temp5 = _catch(function () {
9189
+ var _temp7 = _catch(function () {
9169
9190
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
9170
9191
  var field = filter[key];
9171
9192
 
@@ -9194,7 +9215,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9194
9215
  console.log(error);
9195
9216
  });
9196
9217
 
9197
- return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
9218
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9198
9219
  } catch (e) {
9199
9220
  return Promise.reject(e);
9200
9221
  }
@@ -9232,7 +9253,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9232
9253
  try {
9233
9254
  var _this5 = this;
9234
9255
 
9235
- var _temp7 = _catch(function () {
9256
+ var _temp9 = _catch(function () {
9236
9257
  return Promise.resolve(API.create(form)).then(function () {
9237
9258
  return Promise.resolve(_this5.load({}, [])).then(function () {});
9238
9259
  });
@@ -9240,7 +9261,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9240
9261
  console.log(error);
9241
9262
  });
9242
9263
 
9243
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9264
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9244
9265
  } catch (e) {
9245
9266
  return Promise.reject(e);
9246
9267
  }
@@ -9249,7 +9270,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9249
9270
  try {
9250
9271
  var _this7 = this;
9251
9272
 
9252
- var _temp9 = _catch(function () {
9273
+ var _temp11 = _catch(function () {
9253
9274
  return Promise.resolve(API.update(form)).then(function () {
9254
9275
  return Promise.resolve(_this7.load()).then(function () {});
9255
9276
  });
@@ -9257,7 +9278,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9257
9278
  console.log(error);
9258
9279
  });
9259
9280
 
9260
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9281
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9261
9282
  } catch (e) {
9262
9283
  return Promise.reject(e);
9263
9284
  }
@@ -9266,7 +9287,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9266
9287
  try {
9267
9288
  var _this9 = this;
9268
9289
 
9269
- var _temp11 = _catch(function () {
9290
+ var _temp13 = _catch(function () {
9270
9291
  return Promise.resolve(API.remove(id)).then(function () {
9271
9292
  return Promise.resolve(_this9.load()).then(function () {});
9272
9293
  });
@@ -9274,7 +9295,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9274
9295
  console.log(error);
9275
9296
  });
9276
9297
 
9277
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9298
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9278
9299
  } catch (e) {
9279
9300
  return Promise.reject(e);
9280
9301
  }
@@ -9286,7 +9307,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9286
9307
  try {
9287
9308
  var _this11 = this;
9288
9309
 
9289
- var _temp13 = _catch(function () {
9310
+ var _temp15 = _catch(function () {
9290
9311
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
9291
9312
  _this11.queries = _API$queries;
9292
9313
  });
@@ -9294,7 +9315,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9294
9315
  console.log(error);
9295
9316
  });
9296
9317
 
9297
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9318
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9298
9319
  } catch (e) {
9299
9320
  return Promise.reject(e);
9300
9321
  }
@@ -9303,7 +9324,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9303
9324
  try {
9304
9325
  var _this13 = this;
9305
9326
 
9306
- var _temp15 = _catch(function () {
9327
+ var _temp17 = _catch(function () {
9307
9328
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
9308
9329
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
9309
9330
  });
@@ -9311,7 +9332,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9311
9332
  console.log(error);
9312
9333
  });
9313
9334
 
9314
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9335
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9315
9336
  } catch (e) {
9316
9337
  return Promise.reject(e);
9317
9338
  }
@@ -9320,7 +9341,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9320
9341
  try {
9321
9342
  var _this15 = this;
9322
9343
 
9323
- var _temp17 = _catch(function () {
9344
+ var _temp19 = _catch(function () {
9324
9345
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
9325
9346
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
9326
9347
  });
@@ -9328,7 +9349,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9328
9349
  console.log(error);
9329
9350
  });
9330
9351
 
9331
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9352
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9332
9353
  } catch (e) {
9333
9354
  return Promise.reject(e);
9334
9355
  }