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.
@@ -7368,11 +7368,11 @@ var TablePage2 = function TablePage2(props) {
7368
7368
  children = props.children;
7369
7369
 
7370
7370
  var _useContext = useContext(PageContext),
7371
+ pageContext = _useContext[0],
7371
7372
  setPageContext = _useContext[1];
7372
7373
 
7373
7374
  var context = TableContext$1(url, field, host, urlQuery, params);
7374
- var _pageContext = pageContext,
7375
- selected = _pageContext.selected;
7375
+ var selected = pageContext.selected;
7376
7376
  var timer = useRef(null);
7377
7377
 
7378
7378
  var _useState = useState(selected),
@@ -7693,16 +7693,6 @@ var TableQueries$1 = function TableQueries(props) {
7693
7693
 
7694
7694
 
7695
7695
  var TableFilters$1 = function TableFilters(props) {
7696
- var reload = function reload() {
7697
- try {
7698
- return Promise.resolve(pageContext.load(form)).then(function () {
7699
- setPageContext(Object.assign({}, pageContext));
7700
- });
7701
- } catch (e) {
7702
- return Promise.reject(e);
7703
- }
7704
- };
7705
-
7706
7696
  var change = function change(next) {
7707
7697
  try {
7708
7698
  setForm(next);
@@ -7746,10 +7736,13 @@ var TableFilters$1 = function TableFilters(props) {
7746
7736
  return filterSchema;
7747
7737
  }, [schema]);
7748
7738
  useEffect(function () {
7749
- if (filters) setForm(filters);
7739
+ if (filters && !equal(filters, form)) setForm(filters);
7750
7740
  }, [filters]);
7751
7741
  useEffect(function () {
7752
- reload();
7742
+ if (pageContext.changeFilters && !equal(filters, form)) {
7743
+ pageContext.changeFilters(form);
7744
+ setPageContext(Object.assign({}, pageContext));
7745
+ }
7753
7746
  }, [form]);
7754
7747
 
7755
7748
  function clear() {
@@ -7818,7 +7811,7 @@ var TableEditor$1 = function TableEditor(props) {
7818
7811
  var remove = function remove(id) {
7819
7812
  try {
7820
7813
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
7821
- var _temp5 = function () {
7814
+ var _temp7 = function () {
7822
7815
  if (confirm) {
7823
7816
  return Promise.resolve(pageContext.remove(id)).then(function () {
7824
7817
  pageContext.clear();
@@ -7827,7 +7820,7 @@ var TableEditor$1 = function TableEditor(props) {
7827
7820
  }
7828
7821
  }();
7829
7822
 
7830
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
7823
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
7831
7824
  });
7832
7825
  } catch (e) {
7833
7826
  return Promise.reject(e);
@@ -7841,7 +7834,8 @@ var TableEditor$1 = function TableEditor(props) {
7841
7834
  setPageContext = _useContext5[1];
7842
7835
 
7843
7836
  var _pageContext$all = pageContext.all,
7844
- all = _pageContext$all === void 0 ? [] : _pageContext$all;
7837
+ all = _pageContext$all === void 0 ? [] : _pageContext$all,
7838
+ filters = pageContext.filters;
7845
7839
  var icon = props.icon,
7846
7840
  title = props.title,
7847
7841
  schema = props.schema,
@@ -7849,7 +7843,8 @@ var TableEditor$1 = function TableEditor(props) {
7849
7843
  canDelete = props.canDelete,
7850
7844
  filter = props.filter,
7851
7845
  actions = props.actions,
7852
- className = props.className;
7846
+ className = props.className,
7847
+ tabbedBy = props.tabbedBy;
7853
7848
 
7854
7849
  var _useState4 = useState(props.groupBy),
7855
7850
  groupBy = _useState4[0],
@@ -7861,6 +7856,21 @@ var TableEditor$1 = function TableEditor(props) {
7861
7856
  useEffect(function () {
7862
7857
  try {
7863
7858
  var _temp4 = function () {
7859
+ if (filters) {
7860
+ return Promise.resolve(pageContext.load(filters)).then(function () {
7861
+ setPageContext(Object.assign({}, pageContext));
7862
+ });
7863
+ }
7864
+ }();
7865
+
7866
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
7867
+ } catch (e) {
7868
+ return Promise.reject(e);
7869
+ }
7870
+ }, [filters]);
7871
+ useEffect(function () {
7872
+ try {
7873
+ var _temp6 = function () {
7864
7874
  if (tab) {
7865
7875
  var _filter2;
7866
7876
 
@@ -7872,7 +7882,7 @@ var TableEditor$1 = function TableEditor(props) {
7872
7882
  }
7873
7883
  }();
7874
7884
 
7875
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
7885
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
7876
7886
  } catch (e) {
7877
7887
  return Promise.reject(e);
7878
7888
  }
@@ -8067,7 +8077,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8067
8077
  try {
8068
8078
  var _this2 = this;
8069
8079
 
8070
- var _temp7 = _catch$1(function () {
8080
+ var _temp9 = _catch$1(function () {
8071
8081
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
8072
8082
  var field = filter[key];
8073
8083
 
@@ -8091,7 +8101,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8091
8101
  console.log(error);
8092
8102
  });
8093
8103
 
8094
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
8104
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
8095
8105
  } catch (e) {
8096
8106
  return Promise.reject(e);
8097
8107
  }
@@ -8126,7 +8136,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8126
8136
  try {
8127
8137
  var _this5 = this;
8128
8138
 
8129
- var _temp9 = _catch$1(function () {
8139
+ var _temp11 = _catch$1(function () {
8130
8140
  return Promise.resolve(API.create(form)).then(function () {
8131
8141
  return Promise.resolve(_this5.load()).then(function () {});
8132
8142
  });
@@ -8134,7 +8144,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8134
8144
  console.log(error);
8135
8145
  });
8136
8146
 
8137
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
8147
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
8138
8148
  } catch (e) {
8139
8149
  return Promise.reject(e);
8140
8150
  }
@@ -8143,7 +8153,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8143
8153
  try {
8144
8154
  var _this7 = this;
8145
8155
 
8146
- var _temp11 = _catch$1(function () {
8156
+ var _temp13 = _catch$1(function () {
8147
8157
  return Promise.resolve(API.update(form)).then(function () {
8148
8158
  return Promise.resolve(_this7.load()).then(function () {});
8149
8159
  });
@@ -8151,7 +8161,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8151
8161
  console.log(error);
8152
8162
  });
8153
8163
 
8154
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
8164
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
8155
8165
  } catch (e) {
8156
8166
  return Promise.reject(e);
8157
8167
  }
@@ -8160,7 +8170,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8160
8170
  try {
8161
8171
  var _this9 = this;
8162
8172
 
8163
- var _temp13 = _catch$1(function () {
8173
+ var _temp15 = _catch$1(function () {
8164
8174
  return Promise.resolve(API.remove(id)).then(function () {
8165
8175
  return Promise.resolve(_this9.load()).then(function () {});
8166
8176
  });
@@ -8168,7 +8178,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8168
8178
  console.log(error);
8169
8179
  });
8170
8180
 
8171
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
8181
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
8172
8182
  } catch (e) {
8173
8183
  return Promise.reject(e);
8174
8184
  }
@@ -8180,7 +8190,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8180
8190
  try {
8181
8191
  var _this11 = this;
8182
8192
 
8183
- var _temp15 = _catch$1(function () {
8193
+ var _temp17 = _catch$1(function () {
8184
8194
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
8185
8195
  _this11.queries = _API$queries;
8186
8196
  });
@@ -8188,7 +8198,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8188
8198
  console.log(error);
8189
8199
  });
8190
8200
 
8191
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
8201
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
8192
8202
  } catch (e) {
8193
8203
  return Promise.reject(e);
8194
8204
  }
@@ -8197,7 +8207,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8197
8207
  try {
8198
8208
  var _this13 = this;
8199
8209
 
8200
- var _temp17 = _catch$1(function () {
8210
+ var _temp19 = _catch$1(function () {
8201
8211
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
8202
8212
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
8203
8213
  });
@@ -8205,7 +8215,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8205
8215
  console.log(error);
8206
8216
  });
8207
8217
 
8208
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
8218
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
8209
8219
  } catch (e) {
8210
8220
  return Promise.reject(e);
8211
8221
  }
@@ -8214,7 +8224,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8214
8224
  try {
8215
8225
  var _this15 = this;
8216
8226
 
8217
- var _temp19 = _catch$1(function () {
8227
+ var _temp21 = _catch$1(function () {
8218
8228
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
8219
8229
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
8220
8230
  });
@@ -8222,7 +8232,7 @@ var TableContext$1 = function TableContext(url, field, host, urlQuery, params) {
8222
8232
  console.log(error);
8223
8233
  });
8224
8234
 
8225
- return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
8235
+ return Promise.resolve(_temp21 && _temp21.then ? _temp21.then(function () {}) : void 0);
8226
8236
  } catch (e) {
8227
8237
  return Promise.reject(e);
8228
8238
  }
@@ -8257,7 +8267,7 @@ var TableAPI$1 = function TableAPI(url, host, params) {
8257
8267
  }, "");
8258
8268
  return query.concat(param);
8259
8269
  } else {
8260
- return query.concat(key + "=%" + filters[key] + "%&");
8270
+ return query.concat(key + "=" + filters[key] + "&");
8261
8271
  }
8262
8272
  }, "");
8263
8273
  queryParams = queryParams.concat(filterQuery);
@@ -8805,15 +8815,6 @@ var TableQueries = function TableQueries(props) {
8805
8815
 
8806
8816
 
8807
8817
  var TableFilters = function TableFilters(props) {
8808
- var reload = function reload() {
8809
- try {
8810
- return Promise.resolve(pageContext.load(form, likes)).then(function () {
8811
- setPageContext(Object.assign({}, pageContext));
8812
- });
8813
- } catch (e) {
8814
- return Promise.reject(e);
8815
- }
8816
- };
8817
8818
 
8818
8819
  var change = function change(next) {
8819
8820
  try {
@@ -8857,7 +8858,7 @@ var TableFilters = function TableFilters(props) {
8857
8858
  delete filterSchema.flows;
8858
8859
  return filterSchema;
8859
8860
  }, [schema]);
8860
- var likes = useMemo(function () {
8861
+ useMemo(function () {
8861
8862
  var fields = Object.values(schema);
8862
8863
  return fields.reduce(function (likes, field) {
8863
8864
  if (field.like === true) likes.push(field.id);
@@ -8865,10 +8866,13 @@ var TableFilters = function TableFilters(props) {
8865
8866
  }, []);
8866
8867
  }, [schema]);
8867
8868
  useEffect(function () {
8868
- if (filters) setForm(filters);
8869
+ if (filters && !equal(filters, form)) setForm(filters);
8869
8870
  }, [filters]);
8870
8871
  useEffect(function () {
8871
- reload();
8872
+ if (pageContext.changeFilters && !equal(filters, form)) {
8873
+ pageContext.changeFilters(form);
8874
+ setPageContext(Object.assign({}, pageContext));
8875
+ }
8872
8876
  }, [form]);
8873
8877
 
8874
8878
  function clear() {
@@ -8937,7 +8941,7 @@ var TableEditor = function TableEditor(props) {
8937
8941
  var remove = function remove(id) {
8938
8942
  try {
8939
8943
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
8940
- var _temp3 = function () {
8944
+ var _temp5 = function () {
8941
8945
  if (confirm) {
8942
8946
  return Promise.resolve(pageContext.remove(id)).then(function () {
8943
8947
  pageContext.clear();
@@ -8946,7 +8950,7 @@ var TableEditor = function TableEditor(props) {
8946
8950
  }
8947
8951
  }();
8948
8952
 
8949
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
8953
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
8950
8954
  });
8951
8955
  } catch (e) {
8952
8956
  return Promise.reject(e);
@@ -8960,7 +8964,8 @@ var TableEditor = function TableEditor(props) {
8960
8964
  setPageContext = _useContext5[1];
8961
8965
 
8962
8966
  var _pageContext$all = pageContext.all,
8963
- all = _pageContext$all === void 0 ? [] : _pageContext$all;
8967
+ all = _pageContext$all === void 0 ? [] : _pageContext$all,
8968
+ filters = pageContext.filters;
8964
8969
  var icon = props.icon,
8965
8970
  title = props.title,
8966
8971
  schema = props.schema,
@@ -8975,6 +8980,22 @@ var TableEditor = function TableEditor(props) {
8975
8980
  groupBy = _useState5[0],
8976
8981
  setGroupBy = _useState5[1];
8977
8982
 
8983
+ useEffect(function () {
8984
+ try {
8985
+ var _temp4 = function () {
8986
+ if (filters) {
8987
+ return Promise.resolve(pageContext.load(filters)).then(function () {
8988
+ setPageContext(Object.assign({}, pageContext));
8989
+ });
8990
+ }
8991
+ }();
8992
+
8993
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
8994
+ } catch (e) {
8995
+ return Promise.reject(e);
8996
+ }
8997
+ }, [filters]);
8998
+
8978
8999
  function changeGroup(id, value) {
8979
9000
  setGroupBy(value);
8980
9001
  }
@@ -9157,7 +9178,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9157
9178
  try {
9158
9179
  var _this2 = this;
9159
9180
 
9160
- var _temp5 = _catch(function () {
9181
+ var _temp7 = _catch(function () {
9161
9182
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
9162
9183
  var field = filter[key];
9163
9184
 
@@ -9186,7 +9207,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9186
9207
  console.log(error);
9187
9208
  });
9188
9209
 
9189
- return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
9210
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9190
9211
  } catch (e) {
9191
9212
  return Promise.reject(e);
9192
9213
  }
@@ -9224,7 +9245,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9224
9245
  try {
9225
9246
  var _this5 = this;
9226
9247
 
9227
- var _temp7 = _catch(function () {
9248
+ var _temp9 = _catch(function () {
9228
9249
  return Promise.resolve(API.create(form)).then(function () {
9229
9250
  return Promise.resolve(_this5.load({}, [])).then(function () {});
9230
9251
  });
@@ -9232,7 +9253,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9232
9253
  console.log(error);
9233
9254
  });
9234
9255
 
9235
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
9256
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9236
9257
  } catch (e) {
9237
9258
  return Promise.reject(e);
9238
9259
  }
@@ -9241,7 +9262,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9241
9262
  try {
9242
9263
  var _this7 = this;
9243
9264
 
9244
- var _temp9 = _catch(function () {
9265
+ var _temp11 = _catch(function () {
9245
9266
  return Promise.resolve(API.update(form)).then(function () {
9246
9267
  return Promise.resolve(_this7.load()).then(function () {});
9247
9268
  });
@@ -9249,7 +9270,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9249
9270
  console.log(error);
9250
9271
  });
9251
9272
 
9252
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
9273
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9253
9274
  } catch (e) {
9254
9275
  return Promise.reject(e);
9255
9276
  }
@@ -9258,7 +9279,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9258
9279
  try {
9259
9280
  var _this9 = this;
9260
9281
 
9261
- var _temp11 = _catch(function () {
9282
+ var _temp13 = _catch(function () {
9262
9283
  return Promise.resolve(API.remove(id)).then(function () {
9263
9284
  return Promise.resolve(_this9.load()).then(function () {});
9264
9285
  });
@@ -9266,7 +9287,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9266
9287
  console.log(error);
9267
9288
  });
9268
9289
 
9269
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
9290
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9270
9291
  } catch (e) {
9271
9292
  return Promise.reject(e);
9272
9293
  }
@@ -9278,7 +9299,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9278
9299
  try {
9279
9300
  var _this11 = this;
9280
9301
 
9281
- var _temp13 = _catch(function () {
9302
+ var _temp15 = _catch(function () {
9282
9303
  return Promise.resolve(API.queries(user, urlQuery)).then(function (_API$queries) {
9283
9304
  _this11.queries = _API$queries;
9284
9305
  });
@@ -9286,7 +9307,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9286
9307
  console.log(error);
9287
9308
  });
9288
9309
 
9289
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
9310
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9290
9311
  } catch (e) {
9291
9312
  return Promise.reject(e);
9292
9313
  }
@@ -9295,7 +9316,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9295
9316
  try {
9296
9317
  var _this13 = this;
9297
9318
 
9298
- var _temp15 = _catch(function () {
9319
+ var _temp17 = _catch(function () {
9299
9320
  return Promise.resolve(API.createQuery(query, urlQuery)).then(function () {
9300
9321
  return Promise.resolve(_this13.loadQueries(user)).then(function () {});
9301
9322
  });
@@ -9303,7 +9324,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9303
9324
  console.log(error);
9304
9325
  });
9305
9326
 
9306
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
9327
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9307
9328
  } catch (e) {
9308
9329
  return Promise.reject(e);
9309
9330
  }
@@ -9312,7 +9333,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9312
9333
  try {
9313
9334
  var _this15 = this;
9314
9335
 
9315
- var _temp17 = _catch(function () {
9336
+ var _temp19 = _catch(function () {
9316
9337
  return Promise.resolve(API.removeQuery(id, urlQuery)).then(function () {
9317
9338
  return Promise.resolve(_this15.loadQueries(user)).then(function () {});
9318
9339
  });
@@ -9320,7 +9341,7 @@ var TableContext = function TableContext(url, field, host, urlQuery) {
9320
9341
  console.log(error);
9321
9342
  });
9322
9343
 
9323
- return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
9344
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
9324
9345
  } catch (e) {
9325
9346
  return Promise.reject(e);
9326
9347
  }