ywana-core8 0.0.576 → 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
@@ -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);