@majoo-ui/react 1.58.20-rc.1 → 1.58.20-rc.3

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.
@@ -1285,10 +1285,10 @@ export interface TableProps {
1285
1285
  */
1286
1286
  id?: string | null;
1287
1287
  /**
1288
- * Option for customise column to show in table <br />
1289
- * can be filled with boolean value or 'string' value
1288
+ * Option for customize column to show in table <br />
1289
+ * can be filled with 'string' value eg: 'product_table'
1290
1290
  */
1291
- customizableColumn?: boolean | string;
1291
+ customizableColumn?: string | null;
1292
1292
  }
1293
1293
  export declare function Table({ columns, data: rawData, keyId, pageIndex: controlledPageIndex, totalPage, totalData, fetchData, hideDataInfo, rowsPerPageOptions, emptyDataMessage, customEmptyDataProps: emptyDataProps, isLoading, css, headerCss, hideHeader, onSelectedChange, isInfiniteScroll, hasMoreItems, rowLimit, cellAlign, selectedIds, rowGroup, decoration, hiddenColumns, columnOrder, customRowsStyle, isMobileLayout, showDuplicatedData, onRowClick, hidePagination, searchQuery, additionalExceptionIds, onExpand, id, customizableColumn, }: TableProps): JSX.Element;
1294
1294
  export interface TableColumnProps {
@@ -1349,6 +1349,10 @@ export interface TableColumnProps {
1349
1349
  * If true, the column will be rendered on the bottom flex of mobile layout.
1350
1350
  */
1351
1351
  isAction?: boolean;
1352
+ /**
1353
+ * if true, the column that sticky will be styled with box shadow
1354
+ */
1355
+ shadow?: boolean;
1352
1356
  /**
1353
1357
  * Additional column header styles css.
1354
1358
  */
package/index.esm.js CHANGED
@@ -22299,6 +22299,7 @@ const TableContainer$3 = styled('div', {
22299
22299
  position: 'relative',
22300
22300
  height: '100%',
22301
22301
  overflow: 'auto',
22302
+ overflowY: 'hidden',
22302
22303
  variants: {
22303
22304
  decoration: {
22304
22305
  true: {
@@ -22542,58 +22543,16 @@ const defaultFetchDataParams = {
22542
22543
  pageIndex: 0,
22543
22544
  pageSize: 10
22544
22545
  };
22545
- const stickyPositionStyling = (column, groupHeaders, scrollerRef, customizableColumn) => {
22546
- const scrollAreaWidth = (scrollerRef === null || scrollerRef === void 0 ? void 0 : scrollerRef.scrollWidth) - (scrollerRef === null || scrollerRef === void 0 ? void 0 : scrollerRef.clientWidth);
22547
- const sticky = {
22548
- position: 'sticky',
22549
- zIndex: 1
22550
- };
22551
- const cssAfter = {
22552
- position: 'absolute',
22553
- top: 0,
22554
- bottom: 0,
22555
- width: 5,
22556
- transition: 'box-shadow 0.3s',
22557
- content: '',
22558
- pointerEvents: 'none',
22559
- boxSizing: 'border'
22560
- };
22561
- let smallestIndex = -1;
22562
- if (groupHeaders) {
22563
- for (let i = 0; i < groupHeaders.length; i++) {
22564
- if (typeof groupHeaders[i].Header === 'string') {
22565
- smallestIndex = i;
22566
- break;
22567
- }
22568
- }
22569
- }
22570
- if (customizableColumn && groupHeaders && groupHeaders.findIndex(val => val.id === column.id && val.Header === column.Header) === smallestIndex) {
22571
- return Object.assign(Object.assign({}, sticky), {
22572
- left: '65px !important',
22573
- '&::after': Object.assign(Object.assign({}, cssAfter), {
22574
- right: 0,
22575
- boxShadow: scrollAreaWidth && scrollAreaWidth <= 0 ? 'none' : 'inset 8px 0 10px -10px #00000026'
22576
- })
22577
- });
22578
- }
22546
+ const stickyPositionStyling = column => {
22579
22547
  if (typeof column.stickyPosition === 'number') {
22580
- return column.sticky === 'left' ? Object.assign(Object.assign({}, sticky), {
22548
+ return column.sticky === 'left' ? {
22549
+ position: 'sticky',
22581
22550
  left: `${column.stickyPosition}px !important`
22582
- }) : Object.assign(Object.assign({}, sticky), {
22551
+ } : {
22552
+ position: 'sticky',
22583
22553
  right: `${column.stickyPosition}px !important`
22584
- });
22585
- }
22586
- if (column === null || column === void 0 ? void 0 : column.isMobileHeader) {
22587
- return Object.assign(Object.assign({}, sticky), {
22588
- left: '10px !important'
22589
- });
22554
+ };
22590
22555
  }
22591
- if ((column === null || column === void 0 ? void 0 : column.id) === 'multiple-expander') return Object.assign(Object.assign({}, sticky), {
22592
- left: '10px !important'
22593
- });
22594
- if ((column === null || column === void 0 ? void 0 : column.id) === 'selection') return Object.assign(Object.assign({}, sticky), {
22595
- left: '30px !important'
22596
- });
22597
22556
  return {};
22598
22557
  };
22599
22558
  const cssAfter = {
@@ -22716,7 +22675,8 @@ function HeaderMenuOption(props) {
22716
22675
  children,
22717
22676
  headerGroups,
22718
22677
  id,
22719
- filterHeader: items
22678
+ filterHeader: items,
22679
+ rowData
22720
22680
  } = props;
22721
22681
  const {
22722
22682
  headers
@@ -22774,7 +22734,7 @@ function HeaderMenuOption(props) {
22774
22734
  }, {
22775
22735
  children: children
22776
22736
  }), void 0), jsx(PopoverContent, Object.assign({
22777
- portalled: false,
22737
+ portalled: true,
22778
22738
  isMobile: false,
22779
22739
  style: {
22780
22740
  right: '100%',
@@ -22789,9 +22749,10 @@ function HeaderMenuOption(props) {
22789
22749
  boxShadow: '$medium',
22790
22750
  backgroundColor: 'white',
22791
22751
  maxHeight: 440,
22752
+ height: rowData.length <= 5 ? 300 : 'fit-content',
22792
22753
  minWidth: 167,
22793
22754
  width: 'fit-content',
22794
- overflowY: visibleHeaders.filter(val => typeof val.Header === 'string').length > 7 ? 'scroll' : 'none'
22755
+ overflowY: visibleHeaders.filter(val => typeof val.Header === 'string').length > 7 || rowData.length <= 5 ? 'scroll' : 'none'
22795
22756
  }
22796
22757
  }, {
22797
22758
  children: jsx(CheckboxGroup, Object.assign({
@@ -22857,7 +22818,7 @@ function Table({
22857
22818
  additionalExceptionIds = [],
22858
22819
  onExpand,
22859
22820
  id = null,
22860
- customizableColumn = false
22821
+ customizableColumn = null
22861
22822
  }) {
22862
22823
  var _a, _b, _c, _d;
22863
22824
  const [openMenu, setOpen] = useState(false);
@@ -23288,7 +23249,7 @@ function Table({
23288
23249
  minWidth: column.colMinWidth
23289
23250
  }
23290
23251
  }]), {
23291
- css: Object.assign(Object.assign(Object.assign(Object.assign({}, cssTableCell), stickyPositionStyling(column, visibleHeaders, scrollerRef.current, customizableColumn)), stickyShadowStyling(column, tableScrollPosition, scrollAreaWidth)), column.headerCss)
23252
+ css: Object.assign(Object.assign(Object.assign(Object.assign({}, cssTableCell), stickyPositionStyling(column)), stickyShadowStyling(column, tableScrollPosition, scrollAreaWidth)), column.headerCss)
23292
23253
  }, {
23293
23254
  children: typeof headerRender === 'string' ? jsx(TableHeaderCellContainer, Object.assign({
23294
23255
  isSortedDesc: column.isSortedDesc,
@@ -23307,6 +23268,7 @@ function Table({
23307
23268
  css: cssBtnCustom
23308
23269
  }, {
23309
23270
  children: jsx(HeaderMenuOption, Object.assign({
23271
+ rowData: tableRowData,
23310
23272
  open: openMenu,
23311
23273
  id: customizableColumn,
23312
23274
  onOpenChange: setOpen,
@@ -23430,7 +23392,7 @@ function Table({
23430
23392
  padding: !isContextMenu || exceptionId ? collId === 'expander' || collId === 'multiple-expander' ? '20px 4px' : '20px 8px' : '',
23431
23393
  verticalAlign: cell.column.accessor ? cellAlign : 'center',
23432
23394
  cursor: onRowClick ? 'pointer' : 'unset'
23433
- }), stickyPositionStyling(cell.column, visibleHeaders, scrollerRef.current, customizableColumn)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)),
23395
+ }), stickyPositionStyling(cell.column)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)),
23434
23396
  onClick: () => {
23435
23397
  if (!exceptionId) {
23436
23398
  handleRowClick(row, i);
@@ -23467,12 +23429,7 @@ function Table({
23467
23429
  css: Object.assign(Object.assign({}, cssBtnCustom), {
23468
23430
  maxHeight: 100,
23469
23431
  '&::after': Object.assign(Object.assign({}, cssBtnCustom['&::after']), {
23470
- '@sm': {
23471
- height: 100
23472
- },
23473
- '@md': {
23474
- height: 'unset'
23475
- }
23432
+ height: 100
23476
23433
  })
23477
23434
  })
23478
23435
  }, void 0)]
package/index.umd.js CHANGED
@@ -22619,6 +22619,7 @@
22619
22619
  position: 'relative',
22620
22620
  height: '100%',
22621
22621
  overflow: 'auto',
22622
+ overflowY: 'hidden',
22622
22623
  variants: {
22623
22624
  decoration: {
22624
22625
  true: {
@@ -22862,60 +22863,16 @@
22862
22863
  pageIndex: 0,
22863
22864
  pageSize: 10
22864
22865
  };
22865
- var stickyPositionStyling = function stickyPositionStyling(column, groupHeaders, scrollerRef, customizableColumn) {
22866
- var scrollAreaWidth = (scrollerRef === null || scrollerRef === void 0 ? void 0 : scrollerRef.scrollWidth) - (scrollerRef === null || scrollerRef === void 0 ? void 0 : scrollerRef.clientWidth);
22867
- var sticky = {
22868
- position: 'sticky',
22869
- zIndex: 1
22870
- };
22871
- var cssAfter = {
22872
- position: 'absolute',
22873
- top: 0,
22874
- bottom: 0,
22875
- width: 5,
22876
- transition: 'box-shadow 0.3s',
22877
- content: '',
22878
- pointerEvents: 'none',
22879
- boxSizing: 'border'
22880
- };
22881
- var smallestIndex = -1;
22882
- if (groupHeaders) {
22883
- for (var i = 0; i < groupHeaders.length; i++) {
22884
- if (typeof groupHeaders[i].Header === 'string') {
22885
- smallestIndex = i;
22886
- break;
22887
- }
22888
- }
22889
- }
22890
- if (customizableColumn && groupHeaders && groupHeaders.findIndex(function (val) {
22891
- return val.id === column.id && val.Header === column.Header;
22892
- }) === smallestIndex) {
22893
- return __assign(__assign({}, sticky), {
22894
- left: '65px !important',
22895
- '&::after': __assign(__assign({}, cssAfter), {
22896
- right: 0,
22897
- boxShadow: scrollAreaWidth && scrollAreaWidth <= 0 ? 'none' : 'inset 8px 0 10px -10px #00000026'
22898
- })
22899
- });
22900
- }
22866
+ var stickyPositionStyling = function stickyPositionStyling(column) {
22901
22867
  if (typeof column.stickyPosition === 'number') {
22902
- return column.sticky === 'left' ? __assign(__assign({}, sticky), {
22868
+ return column.sticky === 'left' ? {
22869
+ position: 'sticky',
22903
22870
  left: "".concat(column.stickyPosition, "px !important")
22904
- }) : __assign(__assign({}, sticky), {
22871
+ } : {
22872
+ position: 'sticky',
22905
22873
  right: "".concat(column.stickyPosition, "px !important")
22906
- });
22907
- }
22908
- if (column === null || column === void 0 ? void 0 : column.isMobileHeader) {
22909
- return __assign(__assign({}, sticky), {
22910
- left: '10px !important'
22911
- });
22874
+ };
22912
22875
  }
22913
- if ((column === null || column === void 0 ? void 0 : column.id) === 'multiple-expander') return __assign(__assign({}, sticky), {
22914
- left: '10px !important'
22915
- });
22916
- if ((column === null || column === void 0 ? void 0 : column.id) === 'selection') return __assign(__assign({}, sticky), {
22917
- left: '30px !important'
22918
- });
22919
22876
  return {};
22920
22877
  };
22921
22878
  var cssAfter = {
@@ -23041,7 +22998,8 @@
23041
22998
  children = props.children,
23042
22999
  headerGroups = props.headerGroups;
23043
23000
  props.id;
23044
- var items = props.filterHeader;
23001
+ var items = props.filterHeader,
23002
+ rowData = props.rowData;
23045
23003
  var headers = (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups[0]).headers;
23046
23004
  var visibleHeaders = headers.filter(function (column) {
23047
23005
  return !column.isSubRow;
@@ -23108,7 +23066,7 @@
23108
23066
  }, {
23109
23067
  children: children
23110
23068
  }), void 0), jsxRuntime.jsx(PopoverContent, __assign({
23111
- portalled: false,
23069
+ portalled: true,
23112
23070
  isMobile: false,
23113
23071
  style: {
23114
23072
  right: '100%',
@@ -23123,11 +23081,12 @@
23123
23081
  boxShadow: '$medium',
23124
23082
  backgroundColor: 'white',
23125
23083
  maxHeight: 440,
23084
+ height: rowData.length <= 5 ? 300 : 'fit-content',
23126
23085
  minWidth: 167,
23127
23086
  width: 'fit-content',
23128
23087
  overflowY: visibleHeaders.filter(function (val) {
23129
23088
  return typeof val.Header === 'string';
23130
- }).length > 7 ? 'scroll' : 'none'
23089
+ }).length > 7 || rowData.length <= 5 ? 'scroll' : 'none'
23131
23090
  }
23132
23091
  }, {
23133
23092
  children: jsxRuntime.jsx(CheckboxGroup, __assign({
@@ -23217,7 +23176,7 @@
23217
23176
  onExpand = _a.onExpand;
23218
23177
  _a.id;
23219
23178
  var _v = _a.customizableColumn,
23220
- customizableColumn = _v === void 0 ? false : _v;
23179
+ customizableColumn = _v === void 0 ? null : _v;
23221
23180
  var _w = React.useState(false),
23222
23181
  openMenu = _w[0],
23223
23182
  setOpen = _w[1];
@@ -23695,7 +23654,7 @@
23695
23654
  }
23696
23655
  }];
23697
23656
  }), {
23698
- css: __assign(__assign(__assign(__assign({}, cssTableCell), stickyPositionStyling(column, visibleHeaders, scrollerRef.current, customizableColumn)), stickyShadowStyling(column, tableScrollPosition, scrollAreaWidth)), column.headerCss)
23657
+ css: __assign(__assign(__assign(__assign({}, cssTableCell), stickyPositionStyling(column)), stickyShadowStyling(column, tableScrollPosition, scrollAreaWidth)), column.headerCss)
23699
23658
  }, {
23700
23659
  children: typeof headerRender === 'string' ? jsxRuntime.jsx(TableHeaderCellContainer, __assign({
23701
23660
  isSortedDesc: column.isSortedDesc,
@@ -23714,6 +23673,7 @@
23714
23673
  css: cssBtnCustom
23715
23674
  }, {
23716
23675
  children: jsxRuntime.jsx(HeaderMenuOption, __assign({
23676
+ rowData: tableRowData,
23717
23677
  open: openMenu,
23718
23678
  id: customizableColumn,
23719
23679
  onOpenChange: setOpen,
@@ -23857,7 +23817,7 @@
23857
23817
  padding: !isContextMenu || exceptionId ? collId === 'expander' || collId === 'multiple-expander' ? '20px 4px' : '20px 8px' : '',
23858
23818
  verticalAlign: cell.column.accessor ? cellAlign : 'center',
23859
23819
  cursor: onRowClick ? 'pointer' : 'unset'
23860
- }), stickyPositionStyling(cell.column, visibleHeaders, scrollerRef.current, customizableColumn)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)),
23820
+ }), stickyPositionStyling(cell.column)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)),
23861
23821
  onClick: function () {
23862
23822
  if (!exceptionId) {
23863
23823
  handleRowClick(row, i);
@@ -23898,12 +23858,7 @@
23898
23858
  css: __assign(__assign({}, cssBtnCustom), {
23899
23859
  maxHeight: 100,
23900
23860
  '&::after': __assign(__assign({}, cssBtnCustom['&::after']), {
23901
- '@sm': {
23902
- height: 100
23903
- },
23904
- '@md': {
23905
- height: 'unset'
23906
- }
23861
+ height: 100
23907
23862
  })
23908
23863
  })
23909
23864
  }, void 0)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majoo-ui/react",
3
- "version": "1.58.20-rc.1",
3
+ "version": "1.58.20-rc.3",
4
4
  "dependencies": {
5
5
  "@majoo-ui/core": "^1.31.3",
6
6
  "@majoo-ui/helpers": "^1.30.5",