@teselagen/ui 0.5.23-beta.19 → 0.5.23-beta.20

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
@@ -48305,7 +48305,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48305
48305
  isTableParamsConnected,
48306
48306
  noForm,
48307
48307
  orderByFirstColumn,
48308
- schema: __schema,
48308
+ schema: _schema,
48309
48309
  showEmptyColumnsByDefault,
48310
48310
  tableParams: _tableParams,
48311
48311
  anyTouched,
@@ -48325,7 +48325,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48325
48325
  "anyTouched",
48326
48326
  "blur"
48327
48327
  ]);
48328
- var _a, _b, _c;
48328
+ var _a;
48329
48329
  if (isTableParamsConnected && _tableParams && !_tableParams.entities) {
48330
48330
  throw new Error(
48331
48331
  `No entities array detected in tableParams object (<DataTable {...tableParams}/>). You need to call withQuery() after withTableParams() like: compose(withTableParams(), withQuery(something)).`
@@ -48384,27 +48384,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48384
48384
  if (!isTableParamsConnected) {
48385
48385
  props = __spreadValues(__spreadValues({}, ownProps), _tableParams);
48386
48386
  }
48387
- props.defaults = useDeepEqualMemo(__spreadValues({
48388
- pageSize: controlled_pageSize || 25,
48389
- order: [],
48390
- // ["-name", "statusCode"] //an array of camelCase display names with - sign to denote reverse
48391
- searchTerm: "",
48392
- page: 1,
48393
- filters: [
48394
- // filters look like this:
48395
- // {
48396
- // selectedFilter: 'textContains', //camel case
48397
- // filterOn: ccDisplayName, //camel case display name
48398
- // filterValue: 'thomas',
48399
- // }
48400
- ]
48401
- }, props.defaults || {}));
48402
- const _schema = React$1.useMemo(() => {
48403
- if (isFunction$4(__schema))
48404
- return __schema(props);
48405
- else
48406
- return __schema;
48407
- }, [__schema, props]);
48408
48387
  const convertedSchema = React$1.useMemo(() => convertSchema(_schema), [_schema]);
48409
48388
  if (isLocalCall) {
48410
48389
  if (!noForm && (!formName || formName === "tgDataTable")) {
@@ -48413,10 +48392,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48413
48392
  _schema
48414
48393
  );
48415
48394
  }
48416
- if (orderByFirstColumn && !((_b = (_a = props.defaults) == null ? void 0 : _a.order) == null ? void 0 : _b.length)) {
48417
- const r2 = [getCCDisplayName(convertedSchema.fields[0])];
48418
- props.defaults.order = r2;
48419
- }
48420
48395
  } else {
48421
48396
  if (!formName || formName === "tgDataTable") {
48422
48397
  throw new Error(
@@ -48433,10 +48408,40 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48433
48408
  urlConnected,
48434
48409
  withSelectedEntities: withSelectedEntities2
48435
48410
  } = props;
48436
- if (!syncDisplayOptionsToDb && userSetPageSize) {
48437
- props.defaults = props.defaults || {};
48438
- props.defaults.pageSize = userSetPageSize;
48439
- }
48411
+ const defaults2 = React$1.useMemo(() => {
48412
+ var _a2;
48413
+ const _defaults = __spreadValues({
48414
+ pageSize: controlled_pageSize || 25,
48415
+ order: [],
48416
+ // ["-name", "statusCode"] //an array of camelCase display names with - sign to denote reverse
48417
+ searchTerm: "",
48418
+ page: 1,
48419
+ filters: [
48420
+ // filters look like this:
48421
+ // {
48422
+ // selectedFilter: 'textContains', //camel case
48423
+ // filterOn: ccDisplayName, //camel case display name
48424
+ // filterValue: 'thomas',
48425
+ // }
48426
+ ]
48427
+ }, props.defaults || {});
48428
+ if (isLocalCall && orderByFirstColumn && !((_a2 = _defaults == null ? void 0 : _defaults.order) == null ? void 0 : _a2.length)) {
48429
+ const r2 = [getCCDisplayName(convertedSchema.fields[0])];
48430
+ _defaults.order = r2;
48431
+ }
48432
+ if (!syncDisplayOptionsToDb && userSetPageSize) {
48433
+ _defaults.pageSize = userSetPageSize;
48434
+ }
48435
+ return _defaults;
48436
+ }, [
48437
+ controlled_pageSize,
48438
+ convertedSchema.fields,
48439
+ isLocalCall,
48440
+ orderByFirstColumn,
48441
+ props.defaults,
48442
+ syncDisplayOptionsToDb,
48443
+ userSetPageSize
48444
+ ]);
48440
48445
  const selectedEntities = withSelectedEntities2 ? getRecordsFromIdMap(reduxFormSelectedEntityIdMap) : void 0;
48441
48446
  props = __spreadValues(__spreadValues({}, props), withSelectedEntities2 && typeof withSelectedEntities2 === "string" && {
48442
48447
  [withSelectedEntities2]: selectedEntities
@@ -48459,7 +48464,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48459
48464
  const bindThese = makeDataTableHandlers({
48460
48465
  setNewParams: setNewParams2,
48461
48466
  updateSearch,
48462
- defaults: props.defaults,
48467
+ defaults: defaults2,
48463
48468
  onlyOneFilter: props.onlyOneFilter
48464
48469
  });
48465
48470
  const boundDispatchProps = {};
@@ -48483,9 +48488,9 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48483
48488
  _tableParams,
48484
48489
  change,
48485
48490
  currentParams,
48486
- history == null ? void 0 : history.replace,
48491
+ defaults2,
48492
+ history.replace,
48487
48493
  isTableParamsConnected,
48488
- props.defaults,
48489
48494
  props.onlyOneFilter,
48490
48495
  selectedEntities,
48491
48496
  urlConnected
@@ -48501,7 +48506,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48501
48506
  entities: props.entities,
48502
48507
  // for local table
48503
48508
  urlConnected,
48504
- defaults: props.defaults,
48509
+ defaults: defaults2,
48505
48510
  schema: convertedSchema,
48506
48511
  isInfinite,
48507
48512
  isLocalCall,
@@ -48681,7 +48686,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48681
48686
  withDisplayOptions
48682
48687
  ]);
48683
48688
  const schema = React$1.useMemo(() => {
48684
- const schema2 = convertedSchema;
48689
+ const schema2 = __spreadValues({}, convertedSchema);
48685
48690
  if (isViewable) {
48686
48691
  schema2.fields = [viewColumn, ...schema2.fields];
48687
48692
  }
@@ -48862,7 +48867,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48862
48867
  updateTableDisplayDensity: updateTableDisplayDensity2
48863
48868
  };
48864
48869
  }, [
48865
- (_c = currentUser == null ? void 0 : currentUser.user) == null ? void 0 : _c.id,
48870
+ (_a = currentUser == null ? void 0 : currentUser.user) == null ? void 0 : _a.id,
48866
48871
  deleteTableConfiguration,
48867
48872
  formName,
48868
48873
  schema.fields,
@@ -49802,8 +49807,8 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
49802
49807
  });
49803
49808
  }, "addEntitiesToSelection");
49804
49809
  const refocusTable = React$1.useCallback(() => {
49805
- var _a2, _b2;
49806
- const table2 = (_b2 = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b2.closest(
49810
+ var _a2, _b;
49811
+ const table2 = (_b = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b.closest(
49807
49812
  ".data-table-container>div"
49808
49813
  );
49809
49814
  table2 == null ? void 0 : table2.focus();
@@ -50645,8 +50650,8 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
50645
50650
  });
50646
50651
  const scrollToTop = React$1.useCallback(
50647
50652
  () => {
50648
- var _a2, _b2, _c2, _d, _e, _f;
50649
- return (_f = (_e = (_d = (_c2 = (_b2 = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b2.children) == null ? void 0 : _c2[0]) == null ? void 0 : _d.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.scrollIntoView();
50653
+ var _a2, _b, _c, _d, _e, _f;
50654
+ return (_f = (_e = (_d = (_c = (_b = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b.children) == null ? void 0 : _c[0]) == null ? void 0 : _d.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.scrollIntoView();
50650
50655
  },
50651
50656
  []
50652
50657
  );
@@ -50745,7 +50750,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
50745
50750
  }, isCellEditable && {
50746
50751
  tabIndex: -1,
50747
50752
  onKeyDown: (e2) => {
50748
- var _a2, _b2, _c2, _d, _e, _f, _g, _h;
50753
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
50749
50754
  const isTabKey = e2.key === "Tab";
50750
50755
  const isArrowKey = e2.key.startsWith("Arrow");
50751
50756
  if (isArrowKey && ((_a2 = e2.target) == null ? void 0 : _a2.tagName) !== "INPUT" || isTabKey) {
@@ -50768,9 +50773,9 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
50768
50773
  const [rowId3, columnPath2] = cellIdToUse.split(":");
50769
50774
  const columnIndex2 = pathToIndex[columnPath2];
50770
50775
  const indexToPath = invert(pathToIndex);
50771
- if (firstCellIndex === columnIndex2 && firstRowIndex === ((_b2 = entityMap[rowId3]) == null ? void 0 : _b2.i)) {
50776
+ if (firstCellIndex === columnIndex2 && firstRowIndex === ((_b = entityMap[rowId3]) == null ? void 0 : _b.i)) {
50772
50777
  cellIdToUse = `${entities[lastRowIndex].id}:${indexToPath[lastCellIndex]}`;
50773
- } else if (firstCellIndex === columnIndex2 && lastRowIndex === ((_c2 = entityMap[rowId3]) == null ? void 0 : _c2.i)) {
50778
+ } else if (firstCellIndex === columnIndex2 && lastRowIndex === ((_c = entityMap[rowId3]) == null ? void 0 : _c.i)) {
50774
50779
  cellIdToUse = `${entities[firstRowIndex].id}:${indexToPath[lastCellIndex]}`;
50775
50780
  } else if (lastCellIndex === columnIndex2 && firstRowIndex === ((_d = entityMap[rowId3]) == null ? void 0 : _d.i)) {
50776
50781
  cellIdToUse = `${entities[lastRowIndex].id}:${indexToPath[firstCellIndex]}`;
@@ -64414,6 +64419,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
64414
64419
  entities,
64415
64420
  formName = "tgDataTable",
64416
64421
  history,
64422
+ initialValues,
64417
64423
  isCodeModel,
64418
64424
  isInfinite,
64419
64425
  isLocalCall = false,
@@ -64586,6 +64592,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
64586
64592
  selectedEntities
64587
64593
  }, _tableParams), {
64588
64594
  formName,
64595
+ initialValues,
64589
64596
  isLocalCall,
64590
64597
  schema,
64591
64598
  currentParams,
@@ -64603,6 +64610,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
64603
64610
  dispatch,
64604
64611
  formName,
64605
64612
  history == null ? void 0 : history.replace,
64613
+ initialValues,
64606
64614
  isLocalCall,
64607
64615
  onlyOneFilter,
64608
64616
  queryParams,
package/index.es.js CHANGED
@@ -48287,7 +48287,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48287
48287
  isTableParamsConnected,
48288
48288
  noForm,
48289
48289
  orderByFirstColumn,
48290
- schema: __schema,
48290
+ schema: _schema,
48291
48291
  showEmptyColumnsByDefault,
48292
48292
  tableParams: _tableParams,
48293
48293
  anyTouched,
@@ -48307,7 +48307,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48307
48307
  "anyTouched",
48308
48308
  "blur"
48309
48309
  ]);
48310
- var _a, _b, _c;
48310
+ var _a;
48311
48311
  if (isTableParamsConnected && _tableParams && !_tableParams.entities) {
48312
48312
  throw new Error(
48313
48313
  `No entities array detected in tableParams object (<DataTable {...tableParams}/>). You need to call withQuery() after withTableParams() like: compose(withTableParams(), withQuery(something)).`
@@ -48366,27 +48366,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48366
48366
  if (!isTableParamsConnected) {
48367
48367
  props = __spreadValues(__spreadValues({}, ownProps), _tableParams);
48368
48368
  }
48369
- props.defaults = useDeepEqualMemo(__spreadValues({
48370
- pageSize: controlled_pageSize || 25,
48371
- order: [],
48372
- // ["-name", "statusCode"] //an array of camelCase display names with - sign to denote reverse
48373
- searchTerm: "",
48374
- page: 1,
48375
- filters: [
48376
- // filters look like this:
48377
- // {
48378
- // selectedFilter: 'textContains', //camel case
48379
- // filterOn: ccDisplayName, //camel case display name
48380
- // filterValue: 'thomas',
48381
- // }
48382
- ]
48383
- }, props.defaults || {}));
48384
- const _schema = useMemo(() => {
48385
- if (isFunction$4(__schema))
48386
- return __schema(props);
48387
- else
48388
- return __schema;
48389
- }, [__schema, props]);
48390
48369
  const convertedSchema = useMemo(() => convertSchema(_schema), [_schema]);
48391
48370
  if (isLocalCall) {
48392
48371
  if (!noForm && (!formName || formName === "tgDataTable")) {
@@ -48395,10 +48374,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48395
48374
  _schema
48396
48375
  );
48397
48376
  }
48398
- if (orderByFirstColumn && !((_b = (_a = props.defaults) == null ? void 0 : _a.order) == null ? void 0 : _b.length)) {
48399
- const r2 = [getCCDisplayName(convertedSchema.fields[0])];
48400
- props.defaults.order = r2;
48401
- }
48402
48377
  } else {
48403
48378
  if (!formName || formName === "tgDataTable") {
48404
48379
  throw new Error(
@@ -48415,10 +48390,40 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48415
48390
  urlConnected,
48416
48391
  withSelectedEntities: withSelectedEntities2
48417
48392
  } = props;
48418
- if (!syncDisplayOptionsToDb && userSetPageSize) {
48419
- props.defaults = props.defaults || {};
48420
- props.defaults.pageSize = userSetPageSize;
48421
- }
48393
+ const defaults2 = useMemo(() => {
48394
+ var _a2;
48395
+ const _defaults = __spreadValues({
48396
+ pageSize: controlled_pageSize || 25,
48397
+ order: [],
48398
+ // ["-name", "statusCode"] //an array of camelCase display names with - sign to denote reverse
48399
+ searchTerm: "",
48400
+ page: 1,
48401
+ filters: [
48402
+ // filters look like this:
48403
+ // {
48404
+ // selectedFilter: 'textContains', //camel case
48405
+ // filterOn: ccDisplayName, //camel case display name
48406
+ // filterValue: 'thomas',
48407
+ // }
48408
+ ]
48409
+ }, props.defaults || {});
48410
+ if (isLocalCall && orderByFirstColumn && !((_a2 = _defaults == null ? void 0 : _defaults.order) == null ? void 0 : _a2.length)) {
48411
+ const r2 = [getCCDisplayName(convertedSchema.fields[0])];
48412
+ _defaults.order = r2;
48413
+ }
48414
+ if (!syncDisplayOptionsToDb && userSetPageSize) {
48415
+ _defaults.pageSize = userSetPageSize;
48416
+ }
48417
+ return _defaults;
48418
+ }, [
48419
+ controlled_pageSize,
48420
+ convertedSchema.fields,
48421
+ isLocalCall,
48422
+ orderByFirstColumn,
48423
+ props.defaults,
48424
+ syncDisplayOptionsToDb,
48425
+ userSetPageSize
48426
+ ]);
48422
48427
  const selectedEntities = withSelectedEntities2 ? getRecordsFromIdMap(reduxFormSelectedEntityIdMap) : void 0;
48423
48428
  props = __spreadValues(__spreadValues({}, props), withSelectedEntities2 && typeof withSelectedEntities2 === "string" && {
48424
48429
  [withSelectedEntities2]: selectedEntities
@@ -48441,7 +48446,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48441
48446
  const bindThese = makeDataTableHandlers({
48442
48447
  setNewParams: setNewParams2,
48443
48448
  updateSearch,
48444
- defaults: props.defaults,
48449
+ defaults: defaults2,
48445
48450
  onlyOneFilter: props.onlyOneFilter
48446
48451
  });
48447
48452
  const boundDispatchProps = {};
@@ -48465,9 +48470,9 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48465
48470
  _tableParams,
48466
48471
  change$1,
48467
48472
  currentParams,
48468
- history == null ? void 0 : history.replace,
48473
+ defaults2,
48474
+ history.replace,
48469
48475
  isTableParamsConnected,
48470
- props.defaults,
48471
48476
  props.onlyOneFilter,
48472
48477
  selectedEntities,
48473
48478
  urlConnected
@@ -48483,7 +48488,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48483
48488
  entities: props.entities,
48484
48489
  // for local table
48485
48490
  urlConnected,
48486
- defaults: props.defaults,
48491
+ defaults: defaults2,
48487
48492
  schema: convertedSchema,
48488
48493
  isInfinite,
48489
48494
  isLocalCall,
@@ -48663,7 +48668,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48663
48668
  withDisplayOptions
48664
48669
  ]);
48665
48670
  const schema = useMemo(() => {
48666
- const schema2 = convertedSchema;
48671
+ const schema2 = __spreadValues({}, convertedSchema);
48667
48672
  if (isViewable) {
48668
48673
  schema2.fields = [viewColumn, ...schema2.fields];
48669
48674
  }
@@ -48844,7 +48849,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
48844
48849
  updateTableDisplayDensity: updateTableDisplayDensity2
48845
48850
  };
48846
48851
  }, [
48847
- (_c = currentUser == null ? void 0 : currentUser.user) == null ? void 0 : _c.id,
48852
+ (_a = currentUser == null ? void 0 : currentUser.user) == null ? void 0 : _a.id,
48848
48853
  deleteTableConfiguration,
48849
48854
  formName,
48850
48855
  schema.fields,
@@ -49784,8 +49789,8 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
49784
49789
  });
49785
49790
  }, "addEntitiesToSelection");
49786
49791
  const refocusTable = useCallback(() => {
49787
- var _a2, _b2;
49788
- const table2 = (_b2 = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b2.closest(
49792
+ var _a2, _b;
49793
+ const table2 = (_b = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b.closest(
49789
49794
  ".data-table-container>div"
49790
49795
  );
49791
49796
  table2 == null ? void 0 : table2.focus();
@@ -50627,8 +50632,8 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
50627
50632
  });
50628
50633
  const scrollToTop = useCallback(
50629
50634
  () => {
50630
- var _a2, _b2, _c2, _d, _e, _f;
50631
- return (_f = (_e = (_d = (_c2 = (_b2 = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b2.children) == null ? void 0 : _c2[0]) == null ? void 0 : _d.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.scrollIntoView();
50635
+ var _a2, _b, _c, _d, _e, _f;
50636
+ return (_f = (_e = (_d = (_c = (_b = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b.children) == null ? void 0 : _c[0]) == null ? void 0 : _d.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.scrollIntoView();
50632
50637
  },
50633
50638
  []
50634
50639
  );
@@ -50727,7 +50732,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
50727
50732
  }, isCellEditable && {
50728
50733
  tabIndex: -1,
50729
50734
  onKeyDown: (e2) => {
50730
- var _a2, _b2, _c2, _d, _e, _f, _g, _h;
50735
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
50731
50736
  const isTabKey = e2.key === "Tab";
50732
50737
  const isArrowKey = e2.key.startsWith("Arrow");
50733
50738
  if (isArrowKey && ((_a2 = e2.target) == null ? void 0 : _a2.tagName) !== "INPUT" || isTabKey) {
@@ -50750,9 +50755,9 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
50750
50755
  const [rowId3, columnPath2] = cellIdToUse.split(":");
50751
50756
  const columnIndex2 = pathToIndex[columnPath2];
50752
50757
  const indexToPath = invert(pathToIndex);
50753
- if (firstCellIndex === columnIndex2 && firstRowIndex === ((_b2 = entityMap[rowId3]) == null ? void 0 : _b2.i)) {
50758
+ if (firstCellIndex === columnIndex2 && firstRowIndex === ((_b = entityMap[rowId3]) == null ? void 0 : _b.i)) {
50754
50759
  cellIdToUse = `${entities[lastRowIndex].id}:${indexToPath[lastCellIndex]}`;
50755
- } else if (firstCellIndex === columnIndex2 && lastRowIndex === ((_c2 = entityMap[rowId3]) == null ? void 0 : _c2.i)) {
50760
+ } else if (firstCellIndex === columnIndex2 && lastRowIndex === ((_c = entityMap[rowId3]) == null ? void 0 : _c.i)) {
50756
50761
  cellIdToUse = `${entities[firstRowIndex].id}:${indexToPath[lastCellIndex]}`;
50757
50762
  } else if (lastCellIndex === columnIndex2 && firstRowIndex === ((_d = entityMap[rowId3]) == null ? void 0 : _d.i)) {
50758
50763
  cellIdToUse = `${entities[lastRowIndex].id}:${indexToPath[firstCellIndex]}`;
@@ -64396,6 +64401,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
64396
64401
  entities,
64397
64402
  formName = "tgDataTable",
64398
64403
  history,
64404
+ initialValues,
64399
64405
  isCodeModel,
64400
64406
  isInfinite,
64401
64407
  isLocalCall = false,
@@ -64568,6 +64574,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
64568
64574
  selectedEntities
64569
64575
  }, _tableParams), {
64570
64576
  formName,
64577
+ initialValues,
64571
64578
  isLocalCall,
64572
64579
  schema,
64573
64580
  currentParams,
@@ -64585,6 +64592,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
64585
64592
  dispatch,
64586
64593
  formName,
64587
64594
  history == null ? void 0 : history.replace,
64595
+ initialValues,
64588
64596
  isLocalCall,
64589
64597
  onlyOneFilter,
64590
64598
  queryParams,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.5.23-beta.19",
3
+ "version": "0.5.23-beta.20",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -120,7 +120,7 @@ const DataTable = ({
120
120
  isTableParamsConnected,
121
121
  noForm,
122
122
  orderByFirstColumn,
123
- schema: __schema,
123
+ schema: _schema,
124
124
  showEmptyColumnsByDefault,
125
125
  tableParams: _tableParams,
126
126
  anyTouched,
@@ -199,27 +199,6 @@ const DataTable = ({
199
199
  };
200
200
  }
201
201
 
202
- props.defaults = useDeepEqualMemo({
203
- pageSize: controlled_pageSize || 25,
204
- order: [], // ["-name", "statusCode"] //an array of camelCase display names with - sign to denote reverse
205
- searchTerm: "",
206
- page: 1,
207
- filters: [
208
- // filters look like this:
209
- // {
210
- // selectedFilter: 'textContains', //camel case
211
- // filterOn: ccDisplayName, //camel case display name
212
- // filterValue: 'thomas',
213
- // }
214
- ],
215
- ...(props.defaults || {})
216
- });
217
-
218
- const _schema = useMemo(() => {
219
- if (isFunction(__schema)) return __schema(props);
220
- else return __schema;
221
- }, [__schema, props]);
222
-
223
202
  const convertedSchema = useMemo(() => convertSchema(_schema), [_schema]);
224
203
 
225
204
  if (isLocalCall) {
@@ -229,10 +208,6 @@ const DataTable = ({
229
208
  _schema
230
209
  );
231
210
  }
232
- if (orderByFirstColumn && !props.defaults?.order?.length) {
233
- const r = [getCCDisplayName(convertedSchema.fields[0])];
234
- props.defaults.order = r;
235
- }
236
211
  } else {
237
212
  //in user instantiated withTableParams() call
238
213
  if (!formName || formName === "tgDataTable") {
@@ -252,10 +227,41 @@ const DataTable = ({
252
227
  withSelectedEntities
253
228
  } = props;
254
229
 
255
- if (!syncDisplayOptionsToDb && userSetPageSize) {
256
- props.defaults = props.defaults || {};
257
- props.defaults.pageSize = userSetPageSize;
258
- }
230
+ const defaults = useMemo(() => {
231
+ const _defaults = {
232
+ pageSize: controlled_pageSize || 25,
233
+ order: [], // ["-name", "statusCode"] //an array of camelCase display names with - sign to denote reverse
234
+ searchTerm: "",
235
+ page: 1,
236
+ filters: [
237
+ // filters look like this:
238
+ // {
239
+ // selectedFilter: 'textContains', //camel case
240
+ // filterOn: ccDisplayName, //camel case display name
241
+ // filterValue: 'thomas',
242
+ // }
243
+ ],
244
+ ...(props.defaults || {})
245
+ };
246
+ if (isLocalCall && orderByFirstColumn && !_defaults?.order?.length) {
247
+ const r = [getCCDisplayName(convertedSchema.fields[0])];
248
+ _defaults.order = r;
249
+ }
250
+
251
+ if (!syncDisplayOptionsToDb && userSetPageSize) {
252
+ _defaults.pageSize = userSetPageSize;
253
+ }
254
+
255
+ return _defaults;
256
+ }, [
257
+ controlled_pageSize,
258
+ convertedSchema.fields,
259
+ isLocalCall,
260
+ orderByFirstColumn,
261
+ props.defaults,
262
+ syncDisplayOptionsToDb,
263
+ userSetPageSize
264
+ ]);
259
265
 
260
266
  const selectedEntities = withSelectedEntities
261
267
  ? getRecordsFromIdMap(reduxFormSelectedEntityIdMap)
@@ -295,7 +301,7 @@ const DataTable = ({
295
301
  const bindThese = makeDataTableHandlers({
296
302
  setNewParams,
297
303
  updateSearch,
298
- defaults: props.defaults,
304
+ defaults,
299
305
  onlyOneFilter: props.onlyOneFilter
300
306
  });
301
307
 
@@ -323,9 +329,9 @@ const DataTable = ({
323
329
  _tableParams,
324
330
  change,
325
331
  currentParams,
326
- history?.replace,
332
+ defaults,
333
+ history.replace,
327
334
  isTableParamsConnected,
328
- props.defaults,
329
335
  props.onlyOneFilter,
330
336
  selectedEntities,
331
337
  urlConnected
@@ -353,7 +359,7 @@ const DataTable = ({
353
359
  currentParams,
354
360
  entities: props.entities, // for local table
355
361
  urlConnected,
356
- defaults: props.defaults,
362
+ defaults,
357
363
  schema: convertedSchema,
358
364
  isInfinite,
359
365
  isLocalCall,
@@ -550,7 +556,7 @@ const DataTable = ({
550
556
  ]);
551
557
 
552
558
  const schema = useMemo(() => {
553
- const schema = convertedSchema;
559
+ const schema = { ...convertedSchema };
554
560
  if (isViewable) {
555
561
  schema.fields = [viewColumn, ...schema.fields];
556
562
  }
@@ -39,6 +39,7 @@ export const useTableParams = props => {
39
39
  entities,
40
40
  formName = "tgDataTable",
41
41
  history,
42
+ initialValues,
42
43
  isCodeModel,
43
44
  isInfinite,
44
45
  isLocalCall = false,
@@ -252,6 +253,7 @@ export const useTableParams = props => {
252
253
  selectedEntities,
253
254
  ..._tableParams,
254
255
  formName,
256
+ initialValues,
255
257
  isLocalCall,
256
258
  schema,
257
259
  currentParams,
@@ -268,6 +270,7 @@ export const useTableParams = props => {
268
270
  dispatch,
269
271
  formName,
270
272
  history?.replace,
273
+ initialValues,
271
274
  isLocalCall,
272
275
  onlyOneFilter,
273
276
  queryParams,