@teselagen/ui 0.5.21-beta.4 → 0.5.21-beta.5

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/index.cjs.js CHANGED
@@ -48395,57 +48395,81 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48395
48395
  reduxFormSearchInput,
48396
48396
  urlConnected
48397
48397
  ]);
48398
- if (!isTableParamsConnected) {
48399
- const updateSearch = /* @__PURE__ */ __name((val) => {
48400
- change("reduxFormSearchInput", val || "");
48401
- }, "updateSearch");
48402
- const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
48403
- urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
48404
- change("reduxFormQueryParams", newParams);
48405
- }, "setNewParams2");
48406
- const bindThese = makeDataTableHandlers({
48407
- setNewParams: setNewParams2,
48408
- updateSearch,
48409
- defaults: props.defaults,
48410
- onlyOneFilter: props.onlyOneFilter
48411
- });
48412
- const boundDispatchProps = {};
48413
- Object.keys(bindThese).forEach(function(key) {
48414
- const action = bindThese[key];
48415
- boundDispatchProps[key] = function(...args) {
48416
- action(...args, currentParams);
48417
- };
48418
- });
48419
- const changeFormValue = /* @__PURE__ */ __name((...args) => change(...args), "changeFormValue");
48420
- props.tableParams = __spreadProps(__spreadValues(__spreadValues(__spreadValues({
48421
- changeFormValue,
48422
- selectedEntities
48423
- }, _tableParams), props), boundDispatchProps), {
48424
- isTableParamsConnected: true
48425
- //let the table know not to do local sorting/filtering etc.
48426
- });
48427
- }
48428
- props = __spreadValues(__spreadValues({}, props), props.tableParams);
48429
- if (!isTableParamsConnected) {
48430
- const additionalFilterToUse = typeof props.additionalFilter === "function" ? props.additionalFilter.bind(void 0, ownProps) : () => props.additionalFilter;
48431
- const additionalOrFilterToUse = typeof props.additionalOrFilter === "function" ? props.additionalOrFilter.bind(void 0, ownProps) : () => props.additionalOrFilter;
48432
- props = __spreadValues(__spreadValues({}, props), getQueryParams({
48433
- doNotCoercePageSize,
48434
- currentParams,
48435
- entities: props.entities,
48436
- // for local table
48437
- urlConnected,
48438
- defaults: props.defaults,
48439
- schema: convertedSchema,
48440
- isInfinite,
48441
- isLocalCall,
48442
- additionalFilter: additionalFilterToUse,
48443
- additionalOrFilter: additionalOrFilterToUse,
48444
- noOrderError: props.noOrderError,
48445
- isCodeModel: props.isCodeModel,
48446
- ownProps: props
48447
- }));
48448
- }
48398
+ const tableParams = React$1.useMemo(() => {
48399
+ if (!isTableParamsConnected) {
48400
+ const updateSearch = /* @__PURE__ */ __name((val) => {
48401
+ change("reduxFormSearchInput", val || "");
48402
+ }, "updateSearch");
48403
+ const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
48404
+ urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
48405
+ change("reduxFormQueryParams", newParams);
48406
+ }, "setNewParams2");
48407
+ const bindThese = makeDataTableHandlers({
48408
+ setNewParams: setNewParams2,
48409
+ updateSearch,
48410
+ defaults: props.defaults,
48411
+ onlyOneFilter: props.onlyOneFilter
48412
+ });
48413
+ const boundDispatchProps = {};
48414
+ Object.keys(bindThese).forEach(function(key) {
48415
+ const action = bindThese[key];
48416
+ boundDispatchProps[key] = function(...args) {
48417
+ action(...args, currentParams);
48418
+ };
48419
+ });
48420
+ const changeFormValue = /* @__PURE__ */ __name((...args) => change(...args), "changeFormValue");
48421
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
48422
+ changeFormValue,
48423
+ selectedEntities
48424
+ }, _tableParams), props), boundDispatchProps), {
48425
+ isTableParamsConnected: true
48426
+ //let the table know not to do local sorting/filtering etc.
48427
+ });
48428
+ }
48429
+ return _tableParams;
48430
+ }, [
48431
+ _tableParams,
48432
+ change,
48433
+ currentParams,
48434
+ history.replace,
48435
+ isTableParamsConnected,
48436
+ props,
48437
+ selectedEntities,
48438
+ urlConnected
48439
+ ]);
48440
+ props = __spreadValues(__spreadValues({}, props), tableParams);
48441
+ const queryParams = React$1.useMemo(() => {
48442
+ if (!isTableParamsConnected) {
48443
+ const additionalFilterToUse = typeof props.additionalFilter === "function" ? props.additionalFilter.bind(void 0, ownProps) : () => props.additionalFilter;
48444
+ const additionalOrFilterToUse = typeof props.additionalOrFilter === "function" ? props.additionalOrFilter.bind(void 0, ownProps) : () => props.additionalOrFilter;
48445
+ return getQueryParams({
48446
+ doNotCoercePageSize,
48447
+ currentParams,
48448
+ entities: props.entities,
48449
+ // for local table
48450
+ urlConnected,
48451
+ defaults: props.defaults,
48452
+ schema: convertedSchema,
48453
+ isInfinite,
48454
+ isLocalCall,
48455
+ additionalFilter: additionalFilterToUse,
48456
+ additionalOrFilter: additionalOrFilterToUse,
48457
+ noOrderError: props.noOrderError,
48458
+ isCodeModel: props.isCodeModel,
48459
+ ownProps: props
48460
+ });
48461
+ }
48462
+ return {};
48463
+ }, [
48464
+ convertedSchema,
48465
+ currentParams,
48466
+ doNotCoercePageSize,
48467
+ isInfinite,
48468
+ isLocalCall,
48469
+ isTableParamsConnected,
48470
+ urlConnected
48471
+ ]);
48472
+ props = __spreadValues(__spreadValues({}, props), queryParams);
48449
48473
  const {
48450
48474
  addFilters = noop$3,
48451
48475
  additionalFilters,
@@ -64431,22 +64455,13 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
64431
64455
  const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
64432
64456
  const { formName, urlConnected, history, defaults: defaults2, onlyOneFilter } = mergedOpts;
64433
64457
  function updateSearch(val) {
64434
- setTimeout(function() {
64435
- dispatch(reduxForm.change(formName, "reduxFormSearchInput", val || ""));
64436
- });
64458
+ dispatch(reduxForm.change(formName, "reduxFormSearchInput", val || ""));
64437
64459
  }
64438
64460
  __name(updateSearch, "updateSearch");
64439
- let setNewParams;
64440
- if (urlConnected) {
64441
- setNewParams = /* @__PURE__ */ __name(function(newParams) {
64442
- setCurrentParamsOnUrl(newParams, history.replace);
64443
- dispatch(reduxForm.change(formName, "reduxFormQueryParams", newParams));
64444
- }, "setNewParams");
64445
- } else {
64446
- setNewParams = /* @__PURE__ */ __name(function(newParams) {
64447
- dispatch(reduxForm.change(formName, "reduxFormQueryParams", newParams));
64448
- }, "setNewParams");
64449
- }
64461
+ const setNewParams = /* @__PURE__ */ __name((newParams) => {
64462
+ urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
64463
+ dispatch(reduxForm.change(formName, "reduxFormQueryParams", newParams));
64464
+ }, "setNewParams");
64450
64465
  return {
64451
64466
  bindThese: makeDataTableHandlers({
64452
64467
  setNewParams,
package/index.es.js CHANGED
@@ -48377,57 +48377,81 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48377
48377
  reduxFormSearchInput,
48378
48378
  urlConnected
48379
48379
  ]);
48380
- if (!isTableParamsConnected) {
48381
- const updateSearch = /* @__PURE__ */ __name((val) => {
48382
- change2("reduxFormSearchInput", val || "");
48383
- }, "updateSearch");
48384
- const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
48385
- urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
48386
- change2("reduxFormQueryParams", newParams);
48387
- }, "setNewParams2");
48388
- const bindThese = makeDataTableHandlers({
48389
- setNewParams: setNewParams2,
48390
- updateSearch,
48391
- defaults: props.defaults,
48392
- onlyOneFilter: props.onlyOneFilter
48393
- });
48394
- const boundDispatchProps = {};
48395
- Object.keys(bindThese).forEach(function(key) {
48396
- const action = bindThese[key];
48397
- boundDispatchProps[key] = function(...args) {
48398
- action(...args, currentParams);
48399
- };
48400
- });
48401
- const changeFormValue = /* @__PURE__ */ __name((...args) => change2(...args), "changeFormValue");
48402
- props.tableParams = __spreadProps(__spreadValues(__spreadValues(__spreadValues({
48403
- changeFormValue,
48404
- selectedEntities
48405
- }, _tableParams), props), boundDispatchProps), {
48406
- isTableParamsConnected: true
48407
- //let the table know not to do local sorting/filtering etc.
48408
- });
48409
- }
48410
- props = __spreadValues(__spreadValues({}, props), props.tableParams);
48411
- if (!isTableParamsConnected) {
48412
- const additionalFilterToUse = typeof props.additionalFilter === "function" ? props.additionalFilter.bind(void 0, ownProps) : () => props.additionalFilter;
48413
- const additionalOrFilterToUse = typeof props.additionalOrFilter === "function" ? props.additionalOrFilter.bind(void 0, ownProps) : () => props.additionalOrFilter;
48414
- props = __spreadValues(__spreadValues({}, props), getQueryParams({
48415
- doNotCoercePageSize,
48416
- currentParams,
48417
- entities: props.entities,
48418
- // for local table
48419
- urlConnected,
48420
- defaults: props.defaults,
48421
- schema: convertedSchema,
48422
- isInfinite,
48423
- isLocalCall,
48424
- additionalFilter: additionalFilterToUse,
48425
- additionalOrFilter: additionalOrFilterToUse,
48426
- noOrderError: props.noOrderError,
48427
- isCodeModel: props.isCodeModel,
48428
- ownProps: props
48429
- }));
48430
- }
48380
+ const tableParams = useMemo(() => {
48381
+ if (!isTableParamsConnected) {
48382
+ const updateSearch = /* @__PURE__ */ __name((val) => {
48383
+ change2("reduxFormSearchInput", val || "");
48384
+ }, "updateSearch");
48385
+ const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
48386
+ urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
48387
+ change2("reduxFormQueryParams", newParams);
48388
+ }, "setNewParams2");
48389
+ const bindThese = makeDataTableHandlers({
48390
+ setNewParams: setNewParams2,
48391
+ updateSearch,
48392
+ defaults: props.defaults,
48393
+ onlyOneFilter: props.onlyOneFilter
48394
+ });
48395
+ const boundDispatchProps = {};
48396
+ Object.keys(bindThese).forEach(function(key) {
48397
+ const action = bindThese[key];
48398
+ boundDispatchProps[key] = function(...args) {
48399
+ action(...args, currentParams);
48400
+ };
48401
+ });
48402
+ const changeFormValue = /* @__PURE__ */ __name((...args) => change2(...args), "changeFormValue");
48403
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
48404
+ changeFormValue,
48405
+ selectedEntities
48406
+ }, _tableParams), props), boundDispatchProps), {
48407
+ isTableParamsConnected: true
48408
+ //let the table know not to do local sorting/filtering etc.
48409
+ });
48410
+ }
48411
+ return _tableParams;
48412
+ }, [
48413
+ _tableParams,
48414
+ change2,
48415
+ currentParams,
48416
+ history.replace,
48417
+ isTableParamsConnected,
48418
+ props,
48419
+ selectedEntities,
48420
+ urlConnected
48421
+ ]);
48422
+ props = __spreadValues(__spreadValues({}, props), tableParams);
48423
+ const queryParams = useMemo(() => {
48424
+ if (!isTableParamsConnected) {
48425
+ const additionalFilterToUse = typeof props.additionalFilter === "function" ? props.additionalFilter.bind(void 0, ownProps) : () => props.additionalFilter;
48426
+ const additionalOrFilterToUse = typeof props.additionalOrFilter === "function" ? props.additionalOrFilter.bind(void 0, ownProps) : () => props.additionalOrFilter;
48427
+ return getQueryParams({
48428
+ doNotCoercePageSize,
48429
+ currentParams,
48430
+ entities: props.entities,
48431
+ // for local table
48432
+ urlConnected,
48433
+ defaults: props.defaults,
48434
+ schema: convertedSchema,
48435
+ isInfinite,
48436
+ isLocalCall,
48437
+ additionalFilter: additionalFilterToUse,
48438
+ additionalOrFilter: additionalOrFilterToUse,
48439
+ noOrderError: props.noOrderError,
48440
+ isCodeModel: props.isCodeModel,
48441
+ ownProps: props
48442
+ });
48443
+ }
48444
+ return {};
48445
+ }, [
48446
+ convertedSchema,
48447
+ currentParams,
48448
+ doNotCoercePageSize,
48449
+ isInfinite,
48450
+ isLocalCall,
48451
+ isTableParamsConnected,
48452
+ urlConnected
48453
+ ]);
48454
+ props = __spreadValues(__spreadValues({}, props), queryParams);
48431
48455
  const {
48432
48456
  addFilters = noop$3,
48433
48457
  additionalFilters,
@@ -64413,22 +64437,13 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
64413
64437
  const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
64414
64438
  const { formName, urlConnected, history, defaults: defaults2, onlyOneFilter } = mergedOpts;
64415
64439
  function updateSearch(val) {
64416
- setTimeout(function() {
64417
- dispatch(change(formName, "reduxFormSearchInput", val || ""));
64418
- });
64440
+ dispatch(change(formName, "reduxFormSearchInput", val || ""));
64419
64441
  }
64420
64442
  __name(updateSearch, "updateSearch");
64421
- let setNewParams;
64422
- if (urlConnected) {
64423
- setNewParams = /* @__PURE__ */ __name(function(newParams) {
64424
- setCurrentParamsOnUrl(newParams, history.replace);
64425
- dispatch(change(formName, "reduxFormQueryParams", newParams));
64426
- }, "setNewParams");
64427
- } else {
64428
- setNewParams = /* @__PURE__ */ __name(function(newParams) {
64429
- dispatch(change(formName, "reduxFormQueryParams", newParams));
64430
- }, "setNewParams");
64431
- }
64443
+ const setNewParams = /* @__PURE__ */ __name((newParams) => {
64444
+ urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
64445
+ dispatch(change(formName, "reduxFormQueryParams", newParams));
64446
+ }, "setNewParams");
64432
64447
  return {
64433
64448
  bindThese: makeDataTableHandlers({
64434
64449
  setNewParams,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.5.21-beta.4",
3
+ "version": "0.5.21-beta.5",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -278,63 +278,74 @@ const DataTable = ({
278
278
  urlConnected
279
279
  ]);
280
280
 
281
- if (!isTableParamsConnected) {
282
- const updateSearch = val => {
283
- change("reduxFormSearchInput", val || "");
284
- };
281
+ const tableParams = useMemo(() => {
282
+ if (!isTableParamsConnected) {
283
+ const updateSearch = val => {
284
+ change("reduxFormSearchInput", val || "");
285
+ };
285
286
 
286
- const setNewParams = newParams => {
287
- urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
288
- change("reduxFormQueryParams", newParams); //we always will update the redux params as a workaround for withRouter not always working if inside a redux-connected container https://github.com/ReactTraining/react-router/issues/5037
289
- };
287
+ const setNewParams = newParams => {
288
+ urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
289
+ change("reduxFormQueryParams", newParams); //we always will update the redux params as a workaround for withRouter not always working if inside a redux-connected container https://github.com/ReactTraining/react-router/issues/5037
290
+ };
290
291
 
291
- const bindThese = makeDataTableHandlers({
292
- setNewParams,
293
- updateSearch,
294
- defaults: props.defaults,
295
- onlyOneFilter: props.onlyOneFilter
296
- });
292
+ const bindThese = makeDataTableHandlers({
293
+ setNewParams,
294
+ updateSearch,
295
+ defaults: props.defaults,
296
+ onlyOneFilter: props.onlyOneFilter
297
+ });
297
298
 
298
- const boundDispatchProps = {};
299
- //bind currentParams to actions
300
- Object.keys(bindThese).forEach(function (key) {
301
- const action = bindThese[key];
302
- boundDispatchProps[key] = function (...args) {
303
- action(...args, currentParams);
304
- };
305
- });
299
+ const boundDispatchProps = {};
300
+ //bind currentParams to actions
301
+ Object.keys(bindThese).forEach(function (key) {
302
+ const action = bindThese[key];
303
+ boundDispatchProps[key] = function (...args) {
304
+ action(...args, currentParams);
305
+ };
306
+ });
306
307
 
307
- const changeFormValue = (...args) => change(...args);
308
+ const changeFormValue = (...args) => change(...args);
308
309
 
309
- props.tableParams = {
310
- changeFormValue,
311
- selectedEntities,
312
- ..._tableParams,
313
- ...props,
314
- ...boundDispatchProps,
315
- isTableParamsConnected: true //let the table know not to do local sorting/filtering etc.
316
- };
317
- }
310
+ return {
311
+ changeFormValue,
312
+ selectedEntities,
313
+ ..._tableParams,
314
+ ...props,
315
+ ...boundDispatchProps,
316
+ isTableParamsConnected: true //let the table know not to do local sorting/filtering etc.
317
+ };
318
+ }
319
+ return _tableParams;
320
+ }, [
321
+ _tableParams,
322
+ change,
323
+ currentParams,
324
+ history.replace,
325
+ isTableParamsConnected,
326
+ props,
327
+ selectedEntities,
328
+ urlConnected
329
+ ]);
318
330
 
319
331
  props = {
320
332
  ...props,
321
- ...props.tableParams
333
+ ...tableParams
322
334
  };
323
335
 
324
- if (!isTableParamsConnected) {
325
- const additionalFilterToUse =
326
- typeof props.additionalFilter === "function"
327
- ? props.additionalFilter.bind(this, ownProps)
328
- : () => props.additionalFilter;
336
+ const queryParams = useMemo(() => {
337
+ if (!isTableParamsConnected) {
338
+ const additionalFilterToUse =
339
+ typeof props.additionalFilter === "function"
340
+ ? props.additionalFilter.bind(this, ownProps)
341
+ : () => props.additionalFilter;
329
342
 
330
- const additionalOrFilterToUse =
331
- typeof props.additionalOrFilter === "function"
332
- ? props.additionalOrFilter.bind(this, ownProps)
333
- : () => props.additionalOrFilter;
343
+ const additionalOrFilterToUse =
344
+ typeof props.additionalOrFilter === "function"
345
+ ? props.additionalOrFilter.bind(this, ownProps)
346
+ : () => props.additionalOrFilter;
334
347
 
335
- props = {
336
- ...props,
337
- ...getQueryParams({
348
+ return getQueryParams({
338
349
  doNotCoercePageSize,
339
350
  currentParams,
340
351
  entities: props.entities, // for local table
@@ -348,9 +359,24 @@ const DataTable = ({
348
359
  noOrderError: props.noOrderError,
349
360
  isCodeModel: props.isCodeModel,
350
361
  ownProps: props
351
- })
352
- };
353
- }
362
+ });
363
+ }
364
+ return {};
365
+ // eslint-disable-next-line react-hooks/exhaustive-deps
366
+ }, [
367
+ convertedSchema,
368
+ currentParams,
369
+ doNotCoercePageSize,
370
+ isInfinite,
371
+ isLocalCall,
372
+ isTableParamsConnected,
373
+ urlConnected
374
+ ]);
375
+
376
+ props = {
377
+ ...props,
378
+ ...queryParams
379
+ };
354
380
 
355
381
  const {
356
382
  addFilters = noop,
@@ -182,22 +182,13 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
182
182
  mergedOpts;
183
183
 
184
184
  function updateSearch(val) {
185
- setTimeout(function () {
186
- dispatch(change(formName, "reduxFormSearchInput", val || ""));
187
- });
185
+ dispatch(change(formName, "reduxFormSearchInput", val || ""));
188
186
  }
189
187
 
190
- let setNewParams;
191
- if (urlConnected) {
192
- setNewParams = function (newParams) {
193
- setCurrentParamsOnUrl(newParams, history.replace);
194
- dispatch(change(formName, "reduxFormQueryParams", newParams)); //we always will update the redux params as a workaround for withRouter not always working if inside a redux-connected container https://github.com/ReactTraining/react-router/issues/5037
195
- };
196
- } else {
197
- setNewParams = function (newParams) {
198
- dispatch(change(formName, "reduxFormQueryParams", newParams));
199
- };
200
- }
188
+ const setNewParams = newParams => {
189
+ urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
190
+ dispatch(change(formName, "reduxFormQueryParams", newParams)); //we always will update the redux params as a workaround for withRouter not always working if inside a redux-connected container https://github.com/ReactTraining/react-router/issues/5037
191
+ };
201
192
  return {
202
193
  bindThese: makeDataTableHandlers({
203
194
  setNewParams,