@ballistix.digital/react-components 9.9.1 → 9.10.0

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.js CHANGED
@@ -2861,6 +2861,36 @@ var $95221514662ef6ef$export$2e2bcd8739ae039 = $95221514662ef6ef$var$PanelPagina
2861
2861
 
2862
2862
 
2863
2863
 
2864
+ const $def42fb278b4e54a$export$8a456ae7ab58d698 = (0, $iA2ta$tanstackreacttable.tableFeatures)({
2865
+ rowSortingFeature: $iA2ta$tanstackreacttable.rowSortingFeature,
2866
+ columnVisibilityFeature: $iA2ta$tanstackreacttable.columnVisibilityFeature,
2867
+ columnOrderingFeature: $iA2ta$tanstackreacttable.columnOrderingFeature,
2868
+ columnPinningFeature: $iA2ta$tanstackreacttable.columnPinningFeature,
2869
+ columnSizingFeature: $iA2ta$tanstackreacttable.columnSizingFeature,
2870
+ rowPaginationFeature: $iA2ta$tanstackreacttable.rowPaginationFeature,
2871
+ columnGroupingFeature: $iA2ta$tanstackreacttable.columnGroupingFeature,
2872
+ groupedRowModel: (0, $iA2ta$tanstackreacttable.createGroupedRowModel)(),
2873
+ rowExpandingFeature: $iA2ta$tanstackreacttable.rowExpandingFeature,
2874
+ expandedRowModel: (0, $iA2ta$tanstackreacttable.createExpandedRowModel)(),
2875
+ rowAggregationFeature: $iA2ta$tanstackreacttable.rowAggregationFeature,
2876
+ aggregationFns: {
2877
+ sum: (0, $iA2ta$tanstackreacttable.aggregationFn_sum),
2878
+ min: (0, $iA2ta$tanstackreacttable.aggregationFn_min),
2879
+ max: (0, $iA2ta$tanstackreacttable.aggregationFn_max),
2880
+ extent: (0, $iA2ta$tanstackreacttable.aggregationFn_extent),
2881
+ mean: (0, $iA2ta$tanstackreacttable.aggregationFn_mean),
2882
+ median: (0, $iA2ta$tanstackreacttable.aggregationFn_median),
2883
+ unique: (0, $iA2ta$tanstackreacttable.aggregationFn_unique),
2884
+ uniqueCount: (0, $iA2ta$tanstackreacttable.aggregationFn_uniqueCount),
2885
+ count: (0, $iA2ta$tanstackreacttable.aggregationFn_count),
2886
+ first: (0, $iA2ta$tanstackreacttable.aggregationFn_first),
2887
+ last: (0, $iA2ta$tanstackreacttable.aggregationFn_last)
2888
+ }
2889
+ });
2890
+ const $def42fb278b4e54a$export$4b44a5cb9651fe5e = ()=>(0, $iA2ta$tanstackreacttable.createColumnHelper)();
2891
+
2892
+
2893
+
2864
2894
 
2865
2895
  const $22d7e244b9ff5d8c$export$4564041bcff0e281 = ()=>{
2866
2896
  const handleFormatRow = (row)=>row.map((cell)=>({
@@ -2876,7 +2906,7 @@ const $22d7e244b9ff5d8c$export$4564041bcff0e281 = ()=>{
2876
2906
  const sheets = [];
2877
2907
  const columns = table.getAllColumns();
2878
2908
  const rows = exportData ?? table.getRowModel()?.flatRows?.map((row)=>row.original);
2879
- const order = table.getState().columnOrder;
2909
+ const order = table.state.columnOrder;
2880
2910
  const sortedColumns = (0, $iA2ta$lodash.filter)([
2881
2911
  ...columns
2882
2912
  ].sort((a, b)=>(0, $iA2ta$lodash.indexOf)(order, a.id ?? (0, $iA2ta$lodash.get)(a, 'accessorKey')) - (0, $iA2ta$lodash.indexOf)(order, b.id ?? (0, $iA2ta$lodash.get)(b, 'accessorKey'))), (column)=>typeof column?.columnDef?.header === 'string' && column?.getIsVisible());
@@ -3039,7 +3069,7 @@ const $77914cd9d098713a$var$styles = {
3039
3069
  var $77914cd9d098713a$export$2e2bcd8739ae039 = $77914cd9d098713a$var$styles;
3040
3070
 
3041
3071
 
3042
- const $0c769a920d1734cb$var$TableList = (props)=>{
3072
+ function $0c769a920d1734cb$var$TableList(props) {
3043
3073
  const { id: id, columns: columns, data: data, page: page, children: children, defaultOrder: defaultOrder, defaultVisibility: defaultVisibility, type: type = 'normal', isLoading: isLoading, isStriped: isStriped = false, hasStickyHeader: hasStickyHeader = false, hasVerticalSeparators: hasVerticalSeparators = false, areControlsVisible: areControlsVisible = true, customControls: customControls, exportFileName: exportFileName = 'table-export', styles: stylesOverrides, onChange: onChange, onPaginate: onPaginate } = props;
3044
3074
  const { generate: generate, write: write } = (0, $22d7e244b9ff5d8c$export$4564041bcff0e281)();
3045
3075
  const handleGenerateStyle = ()=>{
@@ -3054,8 +3084,8 @@ const $0c769a920d1734cb$var$TableList = (props)=>{
3054
3084
  const [sorting, setSorting] = (0, $iA2ta$react.useState)([]);
3055
3085
  const [visibility, setVisibility] = (0, $iA2ta$react.useState)({});
3056
3086
  const [order, setOrder] = (0, $iA2ta$react.useState)([]);
3057
- const table = (0, $iA2ta$tanstackreacttable.useReactTable)({
3058
- getCoreRowModel: (0, $iA2ta$tanstackreacttable.getCoreRowModel)(),
3087
+ const table = (0, $iA2ta$tanstackreacttable.useTable)({
3088
+ features: (0, $def42fb278b4e54a$export$8a456ae7ab58d698),
3059
3089
  columns: columns,
3060
3090
  data: data,
3061
3091
  state: {
@@ -3280,7 +3310,7 @@ const $0c769a920d1734cb$var$TableList = (props)=>{
3280
3310
  children: table?.getRowModel().rows.map((row, index)=>(0, $iA2ta$reactjsxruntime.jsx)("tr", {
3281
3311
  className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.row, isStriped && index % 2 === 0 && 'bg-gray-50'),
3282
3312
  children: row.getVisibleCells().map((cell)=>(0, $iA2ta$reactjsxruntime.jsx)("td", {
3283
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, hasStickyHeader && index !== table?.getState()?.pagination?.pageSize - 1 && 'border-b border-gray-200'),
3313
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, hasStickyHeader && index !== table.state.pagination.pageSize - 1 && 'border-b border-gray-200'),
3284
3314
  children: (0, $iA2ta$tanstackreacttable.flexRender)(cell.column.columnDef.cell, cell.getContext())
3285
3315
  }, cell.id))
3286
3316
  }, row.id))
@@ -3318,7 +3348,7 @@ const $0c769a920d1734cb$var$TableList = (props)=>{
3318
3348
  ]
3319
3349
  })
3320
3350
  });
3321
- };
3351
+ }
3322
3352
  var $0c769a920d1734cb$export$2e2bcd8739ae039 = $0c769a920d1734cb$var$TableList;
3323
3353
 
3324
3354
 
@@ -3365,6 +3395,7 @@ const $9ed0b3989f82e70a$var$isValidState = (state)=>{
3365
3395
 
3366
3396
 
3367
3397
 
3398
+
3368
3399
  const $ad4435d9ab2ba956$var$base = {
3369
3400
  container: '',
3370
3401
  head: '',
@@ -3373,15 +3404,15 @@ const $ad4435d9ab2ba956$var$base = {
3373
3404
  wrapper: 'flow-root relative',
3374
3405
  content: '',
3375
3406
  styleWrapper: 'flex overflow-x-scroll overflow-y-visible',
3376
- styleWrapperWithLeftSide: 'flex',
3407
+ styleWrapperWithStartSide: 'flex',
3377
3408
  tableWrapper: 'inline-block min-w-full align-middle',
3378
- tableWrapperWithLeftSide: 'w-full overflow-x-scroll',
3409
+ tableWrapperWithStartSide: 'w-full overflow-x-scroll',
3379
3410
  table: {
3380
3411
  container: 'min-w-full border-separate border-spacing-0',
3381
- containerWithLeftSide: 'border-separate border-spacing-0',
3412
+ containerWithStartSide: 'border-separate border-spacing-0',
3382
3413
  pinnedColumns: {
3383
- left: '-4px 0 4px -4px gray inset',
3384
- right: '4px 0 4px -4px gray inset'
3414
+ start: '4px 0 4px -4px gray inset',
3415
+ end: '-4px 0 4px -4px gray inset'
3385
3416
  },
3386
3417
  head: {
3387
3418
  container: '',
@@ -3431,7 +3462,7 @@ const $ad4435d9ab2ba956$var$base = {
3431
3462
  }
3432
3463
  },
3433
3464
  foot: '',
3434
- leftSide: 'text-sm text-gray-500'
3465
+ startSide: 'text-sm text-gray-500'
3435
3466
  };
3436
3467
  const $ad4435d9ab2ba956$var$styles = {
3437
3468
  base: $ad4435d9ab2ba956$var$base,
@@ -3449,7 +3480,7 @@ var $ad4435d9ab2ba956$export$2e2bcd8739ae039 = $ad4435d9ab2ba956$var$styles;
3449
3480
 
3450
3481
 
3451
3482
  const $51d5596368acf759$var$TableList2 = (props)=>{
3452
- const { id: id, table: config, head: head, foot: foot, leftSide: leftSide, renderSubComponent: renderSubComponent, isLoading: isLoading, onRowClick: onRowClick, onChange: onChange, styles: stylesOverrides, dragConfig: dragConfig } = props;
3483
+ const { id: id, table: config, head: head, foot: foot, startSide: startSide, renderSubComponent: renderSubComponent, isLoading: isLoading, onRowClick: onRowClick, onChange: onChange, styles: stylesOverrides, dragConfig: dragConfig } = props;
3453
3484
  const [columnVisibility, setColumnVisibility] = (0, $iA2ta$react.useState)({});
3454
3485
  const [columnOrder, setColumnOrder] = (0, $iA2ta$react.useState)([]);
3455
3486
  const [sorting, setSorting] = (0, $iA2ta$react.useState)(config.options?.defaultSorting ?? []);
@@ -3509,10 +3540,8 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3509
3540
  config.columns,
3510
3541
  config.options?.defaultVisibility
3511
3542
  ]);
3512
- const table = (0, $iA2ta$tanstackreacttable.useReactTable)({
3513
- getExpandedRowModel: (0, $iA2ta$tanstackreacttable.getExpandedRowModel)(),
3514
- getGroupedRowModel: (0, $iA2ta$tanstackreacttable.getGroupedRowModel)(),
3515
- getCoreRowModel: (0, $iA2ta$tanstackreacttable.getCoreRowModel)(),
3543
+ const table = (0, $iA2ta$tanstackreacttable.useTable)({
3544
+ features: (0, $def42fb278b4e54a$export$8a456ae7ab58d698),
3516
3545
  getSubRows: config.options?.getSubRows,
3517
3546
  autoResetExpanded: false,
3518
3547
  columns: isDraggable ? [
@@ -3544,8 +3573,8 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3544
3573
  ...config.options?.defaultOrder ?? []
3545
3574
  ] : config.options?.defaultOrder,
3546
3575
  columnPinning: {
3547
- left: (0, $iA2ta$lodash.map)(config.options?.columnPinning?.left, 'name') ?? [],
3548
- right: (0, $iA2ta$lodash.map)(config.options?.columnPinning?.right, 'name') ?? []
3576
+ start: (0, $iA2ta$lodash.map)(config.options?.columnPinning?.start, 'name') ?? [],
3577
+ end: (0, $iA2ta$lodash.map)(config.options?.columnPinning?.end, 'name') ?? []
3549
3578
  },
3550
3579
  grouping: config.options?.grouping?.defaultGrouping,
3551
3580
  expanded: config.options?.grouping?.defaultExpanded
@@ -3590,7 +3619,11 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3590
3619
  const savedVisibility = (0, $9ed0b3989f82e70a$export$63dc08f552326ce2)(id)?.columnVisibility;
3591
3620
  if (savedVisibility && !(0, $iA2ta$lodash.isEmpty)(Object.keys(savedVisibility))) setColumnVisibility(savedVisibility);
3592
3621
  else {
3593
- const columnKeys = (0, $iA2ta$lodash.map)(table?.getAllColumns(), (column)=>column.id ?? (0, $iA2ta$lodash.get)(column, 'accessorKey'));
3622
+ const mappedColumns = (0, $iA2ta$lodash.map)(config.columns, (column)=>column?.id ?? (0, $iA2ta$lodash.get)(column, 'accessorKey'));
3623
+ const columnKeys = isDraggable ? [
3624
+ 'drag-handle',
3625
+ ...mappedColumns
3626
+ ] : mappedColumns;
3594
3627
  const visibility = {};
3595
3628
  (0, $iA2ta$lodash.forEach)(columnKeys, (key)=>{
3596
3629
  (0, $iA2ta$lodash.assign)(visibility, {
@@ -3606,9 +3639,10 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3606
3639
  setColumnVisibility(visibility);
3607
3640
  }
3608
3641
  }, [
3642
+ config.columns,
3609
3643
  config?.options?.defaultVisibility,
3610
3644
  id,
3611
- table
3645
+ isDraggable
3612
3646
  ]);
3613
3647
  (0, $iA2ta$react.useEffect)(()=>{
3614
3648
  const savedOrder = (0, $9ed0b3989f82e70a$export$63dc08f552326ce2)(id)?.columnOrder;
@@ -3693,7 +3727,7 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3693
3727
  }, cell.id))
3694
3728
  })
3695
3729
  }) : (0, $iA2ta$lodash.map)(row.getVisibleCells(), (cell)=>(0, $iA2ta$reactjsxruntime.jsx)("td", {
3696
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, config?.options?.hasStickyHeader && index !== table?.getState()?.pagination?.pageSize - 1 && styles.body.table.body.sticky),
3730
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, config?.options?.hasStickyHeader && index !== table.state.pagination.pageSize - 1 && styles.body.table.body.sticky),
3697
3731
  style: {
3698
3732
  width: cell.column.getSize()
3699
3733
  },
@@ -3708,36 +3742,36 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3708
3742
  name: id
3709
3743
  });
3710
3744
  if (pinnedColumnIndex === -1) return null;
3711
- const startIndex = side === 'left' ? 0 : pinnedColumnIndex + 1;
3712
- const endIndex = side === 'left' ? pinnedColumnIndex : pinnedColumns.length - pinnedColumnIndex + 1;
3745
+ const startIndex = side === 'start' ? 0 : pinnedColumnIndex + 1;
3746
+ const endIndex = side === 'start' ? pinnedColumnIndex : pinnedColumns.length - pinnedColumnIndex + 1;
3713
3747
  return pinnedColumns.slice(startIndex, endIndex).reduce((acc, size)=>acc + size, 0);
3714
3748
  }, [
3715
3749
  config.options?.columnPinning
3716
3750
  ]);
3717
3751
  const getCommonPinningStyles = (0, $iA2ta$react.useCallback)((column)=>{
3718
3752
  const isPinned = column.getIsPinned();
3719
- const isLastLeftPinnedColumn = column.id == (0, $iA2ta$lodash.last)(config.options?.columnPinning?.left)?.name;
3720
- const isFirstRightPinnedColumn = column.id == (0, $iA2ta$lodash.first)(config.options?.columnPinning?.right)?.name;
3721
- const width = (0, $iA2ta$lodash.find)((0, $iA2ta$lodash.concat)(config.options?.columnPinning?.left, config.options?.columnPinning?.right), {
3753
+ const isLastStartPinnedColumn = column.id == (0, $iA2ta$lodash.last)(config.options?.columnPinning?.start)?.name;
3754
+ const isFirstEndPinnedColumn = column.id == (0, $iA2ta$lodash.first)(config.options?.columnPinning?.end)?.name;
3755
+ const width = (0, $iA2ta$lodash.find)((0, $iA2ta$lodash.concat)(config.options?.columnPinning?.start, config.options?.columnPinning?.end), {
3722
3756
  name: column.id
3723
3757
  })?.size;
3724
3758
  const customBoxShadow = config?.options?.columnPinning?.customShadow;
3725
- const boxShadow = isLastLeftPinnedColumn ? customBoxShadow ?? styles.body.table.pinnedColumns.left : isFirstRightPinnedColumn ? customBoxShadow ?? styles.body.table.pinnedColumns.right : undefined;
3759
+ const boxShadow = isLastStartPinnedColumn ? customBoxShadow ?? styles.body.table.pinnedColumns.start : isFirstEndPinnedColumn ? customBoxShadow ?? styles.body.table.pinnedColumns.end : undefined;
3726
3760
  return {
3727
3761
  width: width,
3728
3762
  maxWidth: width,
3729
3763
  minWidth: width,
3730
3764
  boxShadow: config.options?.columnPinning?.disableShadow ? undefined : boxShadow,
3731
- left: isPinned === 'left' ? `${getPinnedColumnsWidth('left', column.id)}px` : undefined,
3732
- right: isPinned === 'right' ? `${getPinnedColumnsWidth('right', column.id)}px` : undefined
3765
+ left: isPinned === 'end' ? `${getPinnedColumnsWidth('end', column.id)}px` : undefined,
3766
+ right: isPinned === 'start' ? `${getPinnedColumnsWidth('start', column.id)}px` : undefined
3733
3767
  };
3734
3768
  }, [
3735
3769
  config.options?.columnPinning?.customShadow,
3736
3770
  config.options?.columnPinning?.disableShadow,
3737
- config.options?.columnPinning?.left,
3738
- config.options?.columnPinning?.right,
3739
- styles.body.table.pinnedColumns.left,
3740
- styles.body.table.pinnedColumns.right,
3771
+ config.options?.columnPinning?.start,
3772
+ config.options?.columnPinning?.end,
3773
+ styles.body.table.pinnedColumns.start,
3774
+ styles.body.table.pinnedColumns.end,
3741
3775
  getPinnedColumnsWidth
3742
3776
  ]);
3743
3777
  const getSortIcon = (0, $iA2ta$react.useCallback)((column)=>{
@@ -3779,17 +3813,17 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3779
3813
  children: (0, $iA2ta$reactjsxruntime.jsx)("div", {
3780
3814
  className: styles.body.wrapper,
3781
3815
  children: (0, $iA2ta$reactjsxruntime.jsxs)("div", {
3782
- className: leftSide ? styles.body.styleWrapperWithLeftSide : styles.body.styleWrapper,
3816
+ className: startSide ? styles.body.styleWrapperWithStartSide : styles.body.styleWrapper,
3783
3817
  children: [
3784
- leftSide && (0, $iA2ta$reactjsxruntime.jsx)("div", {
3785
- className: styles.leftSide,
3786
- children: leftSide(state)
3818
+ startSide && (0, $iA2ta$reactjsxruntime.jsx)("div", {
3819
+ className: styles.startSide,
3820
+ children: startSide(state)
3787
3821
  }),
3788
3822
  (0, $iA2ta$reactjsxruntime.jsxs)("div", {
3789
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(leftSide ? styles.body.tableWrapperWithLeftSide : styles.body.tableWrapper),
3823
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(startSide ? styles.body.tableWrapperWithStartSide : styles.body.tableWrapper),
3790
3824
  children: [
3791
3825
  (0, $iA2ta$reactjsxruntime.jsxs)("table", {
3792
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(leftSide ? styles.body.table.container : styles.body.table.container),
3826
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(startSide ? styles.body.table.container : styles.body.table.container),
3793
3827
  children: [
3794
3828
  (0, $iA2ta$reactjsxruntime.jsx)("thead", {
3795
3829
  className: styles.body.table.head.container,
@@ -3855,7 +3889,7 @@ const $51d5596368acf759$var$TableList2 = (props)=>{
3855
3889
  children: (0, $iA2ta$lodash.map)(row.getVisibleCells(), (cell)=>(0, $iA2ta$reactjsxruntime.jsx)("td", {
3856
3890
  "data-column-id": cell.column.id,
3857
3891
  "data-row-id": row.id,
3858
- className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, config?.options?.hasStickyHeader && index !== table?.getState()?.pagination?.pageSize - 1 && styles.body.table.body.sticky, cell.column.getIsPinned() && styles.body.table.body.column.pinned.cell),
3892
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.body.table.body.cell, config?.options?.hasStickyHeader && index !== table.state.pagination.pageSize - 1 && styles.body.table.body.sticky, cell.column.getIsPinned() && styles.body.table.body.column.pinned.cell),
3859
3893
  style: {
3860
3894
  width: cell.column.getSize(),
3861
3895
  ...getCommonPinningStyles(cell.column)
@@ -3930,9 +3964,6 @@ var $51d5596368acf759$export$2e2bcd8739ae039 = $51d5596368acf759$var$TableList2;
3930
3964
 
3931
3965
 
3932
3966
 
3933
- const $def42fb278b4e54a$export$4b44a5cb9651fe5e = ()=>(0, $iA2ta$tanstackreacttable.createColumnHelper)();
3934
-
3935
-
3936
3967
 
3937
3968
 
3938
3969