ywana-core8 0.0.575 → 0.0.578

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