@procore/data-table 14.13.0 → 14.15.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.
@@ -9,6 +9,7 @@ var coreIcons = require('@procore/core-icons');
9
9
  var classNames = require('classnames');
10
10
  var dateFns = require('date-fns');
11
11
  var labsFinancialsUtils = require('@procore/labs-financials-utils');
12
+ var format = require('@procore/labs-financials-utils/dist/format');
12
13
  var ulid$1 = require('ulid');
13
14
  var toastAlert = require('@procore/toast-alert');
14
15
  var ReactDOM = require('react-dom');
@@ -1423,7 +1424,7 @@ ag-grid, ag-grid-angular, ag-grid-ng2, ag-grid-polymer, ag-grid-aurelia {
1423
1424
  animation-iteration-count: infinite;
1424
1425
  animation-name: ag-shake-left-to-right;
1425
1426
  }
1426
- @keyframes _ag-shake-left-to-right_1c24o_369 {
1427
+ @keyframes _ag-shake-left-to-right_ye2ai_369 {
1427
1428
  from {
1428
1429
  padding-left: 6px;
1429
1430
  padding-right: 2px;
@@ -5424,7 +5425,7 @@ input[class^=ag-][type=button]:focus, button[class^=ag-]:focus {
5424
5425
  animation-iteration-count: infinite;
5425
5426
  animation-timing-function: linear;
5426
5427
  }
5427
- @keyframes _spin_1c24o_1 {
5428
+ @keyframes _spin_ye2ai_1 {
5428
5429
  from {
5429
5430
  transform: rotate(0deg);
5430
5431
  }
@@ -7509,10 +7510,15 @@ input[class^=ag-][type=range]:disabled {
7509
7510
  }
7510
7511
  .ag-theme-alpine.ag-theme-alpine .ag-row--dt-active {
7511
7512
  background-color: #e4ecfb;
7512
- border-left: 4px solid #2066df;
7513
7513
  }
7514
- .ag-theme-alpine.ag-theme-alpine .ag-row--dt-active > .ag-cell {
7515
- padding-left: 12px;
7514
+ .ag-theme-alpine.ag-theme-alpine .ag-row--dt-active::before {
7515
+ background-color: #2066df;
7516
+ content: "";
7517
+ width: 4px;
7518
+ height: 100%;
7519
+ position: absolute;
7520
+ top: 0;
7521
+ left: 0;
7516
7522
  }
7517
7523
  .ag-theme-alpine.ag-theme-alpine .ag-row--dt-overdue span {
7518
7524
  color: #e61920;
@@ -7924,7 +7930,7 @@ input[class^=ag-][type=range]:disabled {
7924
7930
  padding-left: 16px;
7925
7931
  }
7926
7932
 
7927
- div._contextPanel_1c24o_7148 {
7933
+ div._contextPanel_ye2ai_7153 {
7928
7934
  width: 400px;
7929
7935
  transition: all ease 500ms;
7930
7936
  flex: 0 0 auto;
@@ -7933,7 +7939,7 @@ div._contextPanel_1c24o_7148 {
7933
7939
  border: 1px solid #d6dadc;
7934
7940
  display: flex;
7935
7941
  }
7936
- div._contextPanel--hidden_1c24o_7157 {
7942
+ div._contextPanel--hidden_ye2ai_7162 {
7937
7943
  border: none;
7938
7944
  overflow: hidden;
7939
7945
  padding: 0px;
@@ -7941,50 +7947,50 @@ div._contextPanel--hidden_1c24o_7157 {
7941
7947
  width: 0px;
7942
7948
  }
7943
7949
 
7944
- ._contextPanelWrapper_1c24o_7165 {
7950
+ ._contextPanelWrapper_ye2ai_7170 {
7945
7951
  position: relative;
7946
7952
  flex-grow: 1;
7947
7953
  }
7948
7954
 
7949
- ._contextPanelBody_1c24o_7170 {
7955
+ ._contextPanelBody_ye2ai_7175 {
7950
7956
  width: clamp(380px, 400px, 100%);
7951
7957
  }
7952
7958
 
7953
- ._contextPanel-stickyHeader_1c24o_7174 {
7959
+ ._contextPanel-stickyHeader_ye2ai_7179 {
7954
7960
  background-color: #ffffff;
7955
7961
  position: sticky;
7956
7962
  top: 0;
7957
7963
  z-index: 5;
7958
7964
  }
7959
7965
 
7960
- ._filters-list_1c24o_7181 {
7966
+ ._filters-list_ye2ai_7186 {
7961
7967
  padding: 0;
7962
7968
  margin: 0;
7963
7969
  }
7964
- ._filters-list_1c24o_7181 ol {
7970
+ ._filters-list_ye2ai_7186 ol {
7965
7971
  padding: 0;
7966
7972
  margin: 0;
7967
7973
  }
7968
7974
 
7969
- ._col-drag-column-icon_1c24o_7190 {
7975
+ ._col-drag-column-icon_ye2ai_7195 {
7970
7976
  color: #6a767c;
7971
7977
  }
7972
7978
 
7973
- ._tabular-nums_1c24o_7194 {
7979
+ ._tabular-nums_ye2ai_7199 {
7974
7980
  font-variant-numeric: tabular-nums;
7975
7981
  }`;
7976
7982
  document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css));
7977
7983
  var styles_default = {
7978
- "contextPanel": "_contextPanel_1c24o_7148",
7979
- "contextPanel--hidden": "_contextPanel--hidden_1c24o_7157",
7980
- "contextPanelWrapper": "_contextPanelWrapper_1c24o_7165",
7981
- "contextPanelBody": "_contextPanelBody_1c24o_7170",
7982
- "contextPanel-stickyHeader": "_contextPanel-stickyHeader_1c24o_7174",
7983
- "filters-list": "_filters-list_1c24o_7181",
7984
- "col-drag-column-icon": "_col-drag-column-icon_1c24o_7190",
7985
- "tabular-nums": "_tabular-nums_1c24o_7194",
7986
- "ag-shake-left-to-right": "_ag-shake-left-to-right_1c24o_369",
7987
- "spin": "_spin_1c24o_1"
7984
+ "contextPanel": "_contextPanel_ye2ai_7153",
7985
+ "contextPanel--hidden": "_contextPanel--hidden_ye2ai_7162",
7986
+ "contextPanelWrapper": "_contextPanelWrapper_ye2ai_7170",
7987
+ "contextPanelBody": "_contextPanelBody_ye2ai_7175",
7988
+ "contextPanel-stickyHeader": "_contextPanel-stickyHeader_ye2ai_7179",
7989
+ "filters-list": "_filters-list_ye2ai_7186",
7990
+ "col-drag-column-icon": "_col-drag-column-icon_ye2ai_7195",
7991
+ "tabular-nums": "_tabular-nums_ye2ai_7199",
7992
+ "ag-shake-left-to-right": "_ag-shake-left-to-right_ye2ai_369",
7993
+ "spin": "_spin_ye2ai_1"
7988
7994
  };
7989
7995
 
7990
7996
  // src/utils/getCellValueTypographyProps.ts
@@ -8665,12 +8671,12 @@ var DateCellValue = ({
8665
8671
  value
8666
8672
  }) => {
8667
8673
  var _a, _b;
8668
- const { format } = coreReact.useDateTime();
8674
+ const { format: format2 } = coreReact.useDateTime();
8669
8675
  if (isGroup || isEmptyValue(value)) {
8670
8676
  return null;
8671
8677
  }
8672
8678
  const parsedValue = getDateObject(value);
8673
- const internalValue = parsedValue ? format(
8679
+ const internalValue = parsedValue ? format2(
8674
8680
  parsedValue,
8675
8681
  ((_a = columnDefinition.cellRendererParams) == null ? void 0 : _a.dateFormatType) || "numeric-date"
8676
8682
  ) : void 0;
@@ -8739,12 +8745,12 @@ var DateTimeCellValue = ({
8739
8745
  value
8740
8746
  }) => {
8741
8747
  var _a, _b;
8742
- const { format } = coreReact.useDateTime();
8748
+ const { format: format2 } = coreReact.useDateTime();
8743
8749
  if (isGroup || isEmptyValue(value)) {
8744
8750
  return null;
8745
8751
  }
8746
8752
  const parsedValue = getDateObject2(value);
8747
- const internalValue = parsedValue ? format(
8753
+ const internalValue = parsedValue ? format2(
8748
8754
  parsedValue,
8749
8755
  ((_a = columnDefinition.cellRendererParams) == null ? void 0 : _a.dateFormatType) || "abbr-weekday-abbr-date-at-time"
8750
8756
  ) : void 0;
@@ -16667,7 +16673,7 @@ var calculateOrdinal = (value) => {
16667
16673
  }
16668
16674
  return "th";
16669
16675
  };
16670
- function dateToFormattedString(date, format = "YYYY-MM-DD") {
16676
+ function dateToFormattedString(date, format2 = "YYYY-MM-DD") {
16671
16677
  const fullYear = padStartWidthZeros(date.getFullYear(), 4);
16672
16678
  const months = [
16673
16679
  "January",
@@ -16711,7 +16717,7 @@ function dateToFormattedString(date, format = "YYYY-MM-DD") {
16711
16717
  d: () => `${date.getDay()}`
16712
16718
  };
16713
16719
  const regexp = new RegExp(Object.keys(replace).join("|"), "g");
16714
- return format.replace(regexp, (match) => {
16720
+ return format2.replace(regexp, (match) => {
16715
16721
  if (match in replace) {
16716
16722
  return replace[match]();
16717
16723
  }
@@ -21354,14 +21360,14 @@ var DateFilterModelFormatter = class extends SimpleFilterModelFormatter {
21354
21360
  const isRange = type == SimpleFilter.IN_RANGE || numberOfInputs === 2;
21355
21361
  const dateFrom = parseDateTimeFromString(condition.dateFrom);
21356
21362
  const dateTo = parseDateTimeFromString(condition.dateTo);
21357
- const format = this.dateFilterParams.inRangeFloatingFilterDateFormat;
21363
+ const format2 = this.dateFilterParams.inRangeFloatingFilterDateFormat;
21358
21364
  if (isRange) {
21359
- const formattedFrom = dateFrom !== null ? dateToFormattedString(dateFrom, format) : "null";
21360
- const formattedTo = dateTo !== null ? dateToFormattedString(dateTo, format) : "null";
21365
+ const formattedFrom = dateFrom !== null ? dateToFormattedString(dateFrom, format2) : "null";
21366
+ const formattedTo = dateTo !== null ? dateToFormattedString(dateTo, format2) : "null";
21361
21367
  return `${formattedFrom}-${formattedTo}`;
21362
21368
  }
21363
21369
  if (dateFrom != null) {
21364
- return dateToFormattedString(dateFrom, format);
21370
+ return dateToFormattedString(dateFrom, format2);
21365
21371
  }
21366
21372
  return `${type}`;
21367
21373
  }
@@ -52984,7 +52990,27 @@ var InternalLinkCellRenderer = ({ columnDefinition, isGroup, data, rowHeight, va
52984
52990
  if (isGroup) {
52985
52991
  return /* @__PURE__ */ React76__default.default.createElement(coreReact.Typography, { ...typographyProps, className, weight: "semibold" }, value);
52986
52992
  }
52993
+ const isExternalLink = columnDefinition.cellRendererParams.isExternalLink ?? false;
52987
52994
  const URL = columnDefinition.cellRendererParams.getURL(value, data);
52995
+ if (isExternalLink && value && URL) {
52996
+ return /* @__PURE__ */ React76__default.default.createElement(
52997
+ coreReact.Typography,
52998
+ {
52999
+ ...typographyProps,
53000
+ className,
53001
+ style: { display: "flex", alignItems: "center", gap: "5px" }
53002
+ },
53003
+ internalValue,
53004
+ /* @__PURE__ */ React76__default.default.createElement(
53005
+ coreIcons.ExternalLink,
53006
+ {
53007
+ cursor: "pointer",
53008
+ size: "sm",
53009
+ onClick: () => window.open(URL, "_blank")
53010
+ }
53011
+ )
53012
+ );
53013
+ }
52988
53014
  return URL ? /* @__PURE__ */ React76__default.default.createElement(coreReact.Typography, { ...typographyProps, className }, /* @__PURE__ */ React76__default.default.createElement(coreReact.Link, { href: URL }, internalValue)) : /* @__PURE__ */ React76__default.default.createElement(coreReact.Typography, { ...typographyProps }, internalValue);
52989
53015
  };
52990
53016
  var LinkCellRenderer = withDataTableRenderer(
@@ -53013,9 +53039,10 @@ var InternalNumberCellRenderer = ({ columnDefinition, rowPinned, isGroup, value
53013
53039
  }
53014
53040
  return /* @__PURE__ */ React76__default.default.createElement(React76__default.default.Fragment, null);
53015
53041
  }
53016
- const internalValue = labsFinancialsUtils.formatNumber(value, {
53042
+ const internalValue = format.format(value, {
53017
53043
  maxDecimalPrecision: 15,
53018
53044
  minDecimalPrecision: 0,
53045
+ shouldUseGtk: true,
53019
53046
  symbol: "",
53020
53047
  ...(_d = columnDefinition.cellRendererParams) == null ? void 0 : _d.formatConfig
53021
53048
  });
@@ -53407,7 +53434,7 @@ var Renderer9 = ({
53407
53434
  rowPinned
53408
53435
  }) => {
53409
53436
  var _a, _b, _c, _d;
53410
- const { getColor } = columnDefinition.cellRendererParams;
53437
+ const { getColor, displayAsPill } = columnDefinition.cellRendererParams;
53411
53438
  const I18n = coreReact.useI18nContext();
53412
53439
  if (isEmptyValue(value)) {
53413
53440
  if (isGroup) {
@@ -53433,10 +53460,10 @@ var Renderer9 = ({
53433
53460
  const typographyProps = getCellValueTypographyProps(
53434
53461
  (_d = columnDefinition.cellRendererParams) == null ? void 0 : _d.typographyProps
53435
53462
  );
53436
- if (isGroup || rowPinned && columnDefinition.aggFunc) {
53463
+ if ((isGroup || rowPinned && columnDefinition.aggFunc) && !displayAsPill) {
53437
53464
  return /* @__PURE__ */ React76__default.default.createElement(coreReact.Typography, { ...typographyProps, weight: "semibold" }, label);
53438
53465
  }
53439
- return /* @__PURE__ */ React76__default.default.createElement(coreReact.Pill, { color: getColor(value), className: cx10("pill-cell") }, label == null ? void 0 : label.toUpperCase());
53466
+ return /* @__PURE__ */ React76__default.default.createElement(coreReact.Pill, { color: getColor(value), className: cx10("pill-cell") }, label);
53440
53467
  };
53441
53468
  var PillCellRenderer = withDataTableRenderer(Renderer9, "select");
53442
53469
  var Editor5 = React76__default.default.forwardRef(
@@ -53473,7 +53500,7 @@ var Editor5 = React76__default.default.forwardRef(
53473
53500
  function getLabel3(item) {
53474
53501
  var _a2;
53475
53502
  const unformattedLabel = ((_a2 = columnDefinition.getStringFormattedValue) == null ? void 0 : _a2.call(columnDefinition, item)) || "";
53476
- return unformattedLabel.toUpperCase();
53503
+ return unformattedLabel;
53477
53504
  }
53478
53505
  return /* @__PURE__ */ React76__default.default.createElement(
53479
53506
  coreReact.PillSelect,
@@ -54872,8 +54899,8 @@ function transformToExcelStyles(excelDataFormats) {
54872
54899
  if (excelDataFormats === void 0) {
54873
54900
  return void 0;
54874
54901
  }
54875
- return excelDataFormats.map((format) => {
54876
- const { id, ...rest } = format;
54902
+ return excelDataFormats.map((format2) => {
54903
+ const { id, ...rest } = format2;
54877
54904
  return {
54878
54905
  id: toExcelCellClass(id),
54879
54906
  ...rest
@@ -55914,7 +55941,7 @@ var DataTableCellRenderer = ({
55914
55941
  value,
55915
55942
  setValue
55916
55943
  }) => {
55917
- var _a, _b, _c;
55944
+ var _a, _b, _c, _d, _e, _f;
55918
55945
  const { columnApi } = useInternalTableContext();
55919
55946
  const columnDefinition = transformToColumnDefinition(colDef);
55920
55947
  const validationOutput = ((_a = colDef.valueValidator) == null ? void 0 : _a.call(colDef, {
@@ -55949,6 +55976,8 @@ var DataTableCellRenderer = ({
55949
55976
  value
55950
55977
  };
55951
55978
  const hasValue = value !== void 0 && value !== null && value !== "";
55979
+ const isSelectCellComponent = ((_c = (_b = columnDefinition.cellEditor) == null ? void 0 : _b.render) == null ? void 0 : _c.displayName) === "SelectCellEditor";
55980
+ const URL = isSelectCellComponent && ((_d = columnDefinition == null ? void 0 : columnDefinition.cellRendererParams) == null ? void 0 : _d.getURL) ? columnDefinition.cellRendererParams.getURL(value) : null;
55952
55981
  const startEditing = React76.useCallback(
55953
55982
  () => api.startEditingCell({
55954
55983
  rowIndex: node.rowIndex,
@@ -55956,34 +55985,54 @@ var DataTableCellRenderer = ({
55956
55985
  }),
55957
55986
  [column2, node]
55958
55987
  );
55959
- return /* @__PURE__ */ React76__default.default.createElement(React76__default.default.Fragment, null, shouldDisplayRowCheckbox(columnApi, column2, node) && /* @__PURE__ */ React76__default.default.createElement(coreReact.Box, { paddingLeft: "sm" }, /* @__PURE__ */ React76__default.default.createElement(RowCheckbox, { api, data, node })), columnDefinition.editable ? /* @__PURE__ */ React76__default.default.createElement(
55960
- PseudoInlineEditorWrapper,
55961
- {
55962
- showArrow: editorType === "select",
55963
- onClick: startEditing,
55964
- onClear: ((_b = columnDefinition.cellEditorParams) == null ? void 0 : _b.clearable) && hasValue ? () => {
55965
- setValue == null ? void 0 : setValue(null);
55966
- } : void 0,
55967
- showCalendar: editorType === "date",
55968
- rightAligned: colDef.type === "rightAligned",
55969
- hasValue,
55970
- alwaysShowEditors: (_c = columnDefinition.cellEditorParams) == null ? void 0 : _c.alwaysShowPseudoEditors,
55971
- ...validationOutput
55972
- },
55973
- /* @__PURE__ */ React76__default.default.createElement(Component4, { ...componentParams })
55974
- ) : /* @__PURE__ */ React76__default.default.createElement(
55975
- NonEditorWrapper,
55988
+ return /* @__PURE__ */ React76__default.default.createElement(React76__default.default.Fragment, null, shouldDisplayRowCheckbox(columnApi, column2, node) && /* @__PURE__ */ React76__default.default.createElement(coreReact.Box, { paddingLeft: "sm" }, /* @__PURE__ */ React76__default.default.createElement(RowCheckbox, { api, data, node })), /* @__PURE__ */ React76__default.default.createElement(
55989
+ coreReact.Flex,
55976
55990
  {
55977
- rightAligned: colDef.type === "rightAligned",
55978
- ...validationOutput,
55979
- rowPinned: Boolean(componentParams.rowPinned),
55980
- isGroup: Boolean(componentParams.isGroup)
55991
+ gap: "5px",
55992
+ alignItems: "center",
55993
+ justifyContent: "center",
55994
+ style: { width: "100%" }
55981
55995
  },
55982
- /* @__PURE__ */ React76__default.default.createElement(
55983
- Component4,
55996
+ columnDefinition.editable ? /* @__PURE__ */ React76__default.default.createElement(
55997
+ PseudoInlineEditorWrapper,
55998
+ {
55999
+ showArrow: editorType === "select",
56000
+ onClick: startEditing,
56001
+ onClear: ((_e = columnDefinition.cellEditorParams) == null ? void 0 : _e.clearable) && hasValue ? () => {
56002
+ setValue == null ? void 0 : setValue(null);
56003
+ } : void 0,
56004
+ showCalendar: editorType === "date",
56005
+ rightAligned: colDef.type === "rightAligned",
56006
+ hasValue,
56007
+ alwaysShowEditors: (_f = columnDefinition.cellEditorParams) == null ? void 0 : _f.alwaysShowPseudoEditors,
56008
+ ...validationOutput
56009
+ },
56010
+ /* @__PURE__ */ React76__default.default.createElement(Component4, { ...componentParams })
56011
+ ) : /* @__PURE__ */ React76__default.default.createElement(
56012
+ NonEditorWrapper,
56013
+ {
56014
+ rightAligned: colDef.type === "rightAligned",
56015
+ ...validationOutput,
56016
+ rowPinned: Boolean(componentParams.rowPinned),
56017
+ isGroup: Boolean(componentParams.isGroup)
56018
+ },
56019
+ /* @__PURE__ */ React76__default.default.createElement(
56020
+ Component4,
56021
+ {
56022
+ ...componentParams,
56023
+ tableRef: columnDefinition.cellRendererParams.tableRef
56024
+ }
56025
+ )
56026
+ ),
56027
+ URL && /* @__PURE__ */ React76__default.default.createElement(
56028
+ coreIcons.ExternalLink,
55984
56029
  {
55985
- ...componentParams,
55986
- tableRef: columnDefinition.cellRendererParams.tableRef
56030
+ cursor: "pointer",
56031
+ size: "sm",
56032
+ onClick: (e) => {
56033
+ e.stopPropagation();
56034
+ window.open(URL, "_blank");
56035
+ }
55987
56036
  }
55988
56037
  )
55989
56038
  ));
@@ -56625,9 +56674,10 @@ var GenericHeaderRenderer = (props) => {
56625
56674
  props.api.addEventListener("columnRowGroupChanged", updateExpandedState);
56626
56675
  return () => {
56627
56676
  props.column.removeEventListener("sortChanged", onSortChanged);
56628
- props.api.removeEventListener(
56677
+ removeEventListenerFromGrid(
56629
56678
  "columnRowGroupChanged",
56630
- updateExpandedState
56679
+ updateExpandedState,
56680
+ props.api
56631
56681
  );
56632
56682
  };
56633
56683
  }, [props.column]);
@@ -57722,6 +57772,7 @@ var InternalTableContext = React76__default.default.createContext({
57722
57772
  getRowHeight: () => () => rowSize.md,
57723
57773
  grandTotalsLabelInnerRenderer: void 0,
57724
57774
  gridApi: void 0,
57775
+ localStoragePersistenceKey: void 0,
57725
57776
  onBulkEditUpdate: () => Promise.resolve(),
57726
57777
  onServerSideDataRequest: void 0,
57727
57778
  onTableConfigChange: () => {
@@ -57738,6 +57789,7 @@ var InternalTableContext = React76__default.default.createContext({
57738
57789
  setRowHeight: () => {
57739
57790
  },
57740
57791
  showExpandCollapseAllToggle: false,
57792
+ expandCollapseStateRef: null,
57741
57793
  tableRef: null,
57742
57794
  getColumnDefinition: () => void 0,
57743
57795
  setSelectedGroupIndex: () => {
@@ -61560,14 +61612,14 @@ var protection_default = protection;
61560
61612
  // ../../node_modules/@ag-grid-enterprise/excel-export/dist/esm/es6/excelExport/files/xml/styles/numberFormat.mjs
61561
61613
  var numberFormat = {
61562
61614
  getTemplate(styleProperties) {
61563
- const { format } = styleProperties.numberFormat;
61615
+ const { format: format2 } = styleProperties.numberFormat;
61564
61616
  return {
61565
61617
  name: "NumberFormat",
61566
61618
  properties: {
61567
61619
  prefixedAttributes: [{
61568
61620
  prefix: "ss:",
61569
61621
  map: {
61570
- Format: format
61622
+ Format: format2
61571
61623
  }
61572
61624
  }]
61573
61625
  }
@@ -63518,15 +63570,15 @@ var registerFill = (fill) => {
63518
63570
  }
63519
63571
  return pos;
63520
63572
  };
63521
- var registerNumberFmt = (format) => {
63522
- format = _.utf8_encode(format);
63523
- if (numberFormatMap[format]) {
63524
- return numberFormatMap[format];
63573
+ var registerNumberFmt = (format2) => {
63574
+ format2 = _.utf8_encode(format2);
63575
+ if (numberFormatMap[format2]) {
63576
+ return numberFormatMap[format2];
63525
63577
  }
63526
- let pos = registeredNumberFmts.findIndex((currentFormat) => currentFormat.formatCode === format);
63578
+ let pos = registeredNumberFmts.findIndex((currentFormat) => currentFormat.formatCode === format2);
63527
63579
  if (pos === -1) {
63528
63580
  pos = registeredNumberFmts.length + 164;
63529
- registeredNumberFmts.push({ formatCode: format, numFmtId: pos });
63581
+ registeredNumberFmts.push({ formatCode: format2, numFmtId: pos });
63530
63582
  } else {
63531
63583
  pos = registeredNumberFmts[pos].numFmtId;
63532
63584
  }
@@ -78185,6 +78237,63 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
78185
78237
  };
78186
78238
  };
78187
78239
 
78240
+ // src/utils/expandRows.ts
78241
+ var getGroupRowState = (gridApi, groupDefaultExpanded = 0) => {
78242
+ const expandedRoutes = [];
78243
+ const collapsedRoutes = [];
78244
+ if (gridApi) {
78245
+ gridApi.forEachNode((node) => {
78246
+ const route = node.getRoute();
78247
+ if (route) {
78248
+ const routePath = route.join(",");
78249
+ const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
78250
+ if (node.level > defaultExpandLevel - 1) {
78251
+ if (node.expanded) {
78252
+ expandedRoutes.push(routePath);
78253
+ }
78254
+ } else if (!node.expanded) {
78255
+ collapsedRoutes.push(routePath);
78256
+ }
78257
+ }
78258
+ });
78259
+ }
78260
+ return { expandedRoutes, collapsedRoutes };
78261
+ };
78262
+ var setExpandCollapseRow = (gridApi, tableConfig, groupDefaultExpanded = 0) => {
78263
+ var _a, _b;
78264
+ const expandedRoutes = ((_a = tableConfig.groupRowState) == null ? void 0 : _a.expandedRoutes) ?? [];
78265
+ const collapsedRoutes = ((_b = tableConfig.groupRowState) == null ? void 0 : _b.collapsedRoutes) ?? [];
78266
+ gridApi.forEachNode((node) => {
78267
+ const route = node.getRoute();
78268
+ if (route) {
78269
+ const routePath = route.join(",");
78270
+ const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
78271
+ if (node.level > defaultExpandLevel - 1) {
78272
+ if (expandedRoutes.includes(routePath)) {
78273
+ node.setExpanded(true);
78274
+ }
78275
+ } else if (collapsedRoutes.includes(routePath)) {
78276
+ node.setExpanded(false);
78277
+ }
78278
+ }
78279
+ });
78280
+ };
78281
+ var isRowOpenedByDefault = (node, tableConfig, groupDefaultExpanded = 0) => {
78282
+ var _a, _b;
78283
+ const expandedRoutes = ((_a = tableConfig == null ? void 0 : tableConfig.groupRowState) == null ? void 0 : _a.expandedRoutes) ?? [];
78284
+ const collapsedRoutes = ((_b = tableConfig == null ? void 0 : tableConfig.groupRowState) == null ? void 0 : _b.collapsedRoutes) ?? [];
78285
+ const route = node.getRoute();
78286
+ if (!route) {
78287
+ return false;
78288
+ }
78289
+ const routePath = route.join(",");
78290
+ const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
78291
+ if (node.level > defaultExpandLevel - 1) {
78292
+ return expandedRoutes.includes(routePath);
78293
+ } else
78294
+ return !collapsedRoutes.includes(routePath);
78295
+ };
78296
+
78188
78297
  // src/utils/getRootRowNode.ts
78189
78298
  function getRootRowNode(rowNode) {
78190
78299
  return rowNode.level > 0 && rowNode.parent ? getRootRowNode(rowNode.parent) : rowNode;
@@ -80546,6 +80655,7 @@ function generateHTMLString({
80546
80655
  clearTimeout(exportTimeoutId);
80547
80656
  }
80548
80657
  exportTimeoutId = setTimeout(() => {
80658
+ var _a2, _b2;
80549
80659
  const exportedDocument = document.implementation.createHTMLDocument();
80550
80660
  const printStylesElement = exportedDocument.createElement("style");
80551
80661
  tableContainer.querySelectorAll(
@@ -80624,44 +80734,73 @@ function generateHTMLString({
80624
80734
  if (exportedDocument.querySelector(".ag-header-container") && showTableHeaderOnEveryPage) {
80625
80735
  const tableHeaderStylesElement = exportedDocument.createElement("style");
80626
80736
  tableHeaderStylesElement.innerHTML = `
80737
+ /* Original header styles */
80627
80738
  .ag-header-container {
80628
80739
  height: ${TABLE_HEADER_HEIGHT}px;
80629
80740
  background: ${coreReact.colors.gray96};
80630
80741
  border-bottom: 1px solid #d6dadc;
80631
- break-before: page;
80742
+ }
80743
+ /* Cloned header styles */
80744
+ .paginated-header {
80745
+ height: ${TABLE_HEADER_HEIGHT}px;
80746
+ background: ${coreReact.colors.gray96};
80747
+ border-bottom: 1px solid #d6dadc;
80748
+ /* Ensure cloned headers start on a new page */
80749
+ page-break-before: always;
80632
80750
  }
80633
80751
  `;
80634
80752
  exportedDocument.head.appendChild(tableHeaderStylesElement);
80635
- const tableHeader = exportedDocument.querySelector(".ag-header-container").cloneNode(true);
80753
+ const tableHeaderElement = exportedDocument.querySelector(
80754
+ ".ag-header-container"
80755
+ );
80756
+ if (!tableHeaderElement) {
80757
+ return reject(new Error("Table header container not found."));
80758
+ }
80759
+ const tableHeader = tableHeaderElement.cloneNode(true);
80760
+ tableHeader.classList.add("paginated-header");
80636
80761
  const tableRowsContainer = exportedDocument.querySelector(
80637
80762
  ".ag-center-cols-container"
80638
80763
  );
80639
- const totalRows = tableRowsContainer.children.length;
80640
- const maxPageContentHeight = pageHeight - pageFormat.marginInPixels.top - pageFormat.marginInPixels.bottom;
80641
- let pageContentHeight = TABLE_HEADER_HEIGHT;
80642
- let currentPage = 1;
80643
- for (let index = 0; index < totalRows; index++) {
80644
- const getScaledRowHeight = (row3) => {
80645
- const scale = pageHeight / tableWidth;
80646
- let rowHeight2 = Number(row3.style.height.replace("px", ""));
80647
- if (scale < 1) {
80648
- rowHeight2 *= scale;
80764
+ if (!tableRowsContainer) {
80765
+ console.error("Table rows container not found.");
80766
+ return;
80767
+ }
80768
+ const allRows = Array.from(
80769
+ tableRowsContainer.children
80770
+ );
80771
+ tableRowsContainer.innerHTML = "";
80772
+ const maxPageContentHeight = pageHeight - (((_a2 = pageFormat.marginInPixels) == null ? void 0 : _a2.top) ?? DEFAULT_PAGE_MARGIN) - (((_b2 = pageFormat.marginInPixels) == null ? void 0 : _b2.bottom) ?? DEFAULT_PAGE_MARGIN) - TABLE_HEADER_HEIGHT;
80773
+ let currentPageContentHeight = 0;
80774
+ let rowsInCurrentPage = [];
80775
+ let isFirstPage = true;
80776
+ const appendPage = () => {
80777
+ if (rowsInCurrentPage.length > 0) {
80778
+ if (!isFirstPage) {
80779
+ tableRowsContainer.appendChild(tableHeader.cloneNode(true));
80780
+ } else {
80781
+ isFirstPage = false;
80649
80782
  }
80650
- return rowHeight2;
80651
- };
80652
- const row2 = tableRowsContainer.children[index + currentPage - 1];
80653
- const rowHeight = getScaledRowHeight(row2);
80654
- if (pageContentHeight + rowHeight >= maxPageContentHeight) {
80655
- tableRowsContainer.insertBefore(
80656
- tableHeader.cloneNode(true),
80657
- row2
80783
+ rowsInCurrentPage.forEach(
80784
+ (row2) => tableRowsContainer.appendChild(row2)
80658
80785
  );
80659
- currentPage += 1;
80660
- pageContentHeight = TABLE_HEADER_HEIGHT;
80661
- } else {
80662
- pageContentHeight += rowHeight;
80786
+ rowsInCurrentPage = [];
80787
+ currentPageContentHeight = 0;
80663
80788
  }
80664
- }
80789
+ };
80790
+ allRows.forEach((row2) => {
80791
+ let rowHeight = parseFloat(row2.style.height.replace("px", "")) || row2.offsetHeight;
80792
+ const scale = pageHeight / tableWidth;
80793
+ if (scale < 1) {
80794
+ rowHeight *= scale;
80795
+ }
80796
+ if (currentPageContentHeight + rowHeight > maxPageContentHeight) {
80797
+ appendPage();
80798
+ isFirstPage = false;
80799
+ }
80800
+ rowsInCurrentPage.push(row2);
80801
+ currentPageContentHeight += rowHeight;
80802
+ });
80803
+ appendPage();
80665
80804
  }
80666
80805
  resolve(exportedDocument.getElementsByTagName("html")[0].outerHTML);
80667
80806
  }, 2e3);
@@ -80707,6 +80846,7 @@ var useTableApi = ({
80707
80846
  columnApi,
80708
80847
  columnDefinitions,
80709
80848
  gridApi,
80849
+ groupDefaultExpanded,
80710
80850
  setLoadingStatus,
80711
80851
  wrapperRef
80712
80852
  }) => {
@@ -80900,10 +81040,33 @@ var useTableApi = ({
80900
81040
  const setSearchValue = React76__default.default.useCallback(
80901
81041
  (value) => {
80902
81042
  gridApi == null ? void 0 : gridApi.setQuickFilter(value);
81043
+ gridApi == null ? void 0 : gridApi.forEachNodeAfterFilterAndSort((node) => {
81044
+ if (node.id) {
81045
+ const currentNode = rowSelectionRef == null ? void 0 : rowSelectionRef.current.affectedRows[node.id];
81046
+ if (currentNode && currentNode.selectedState === rowSelectionState.selected) {
81047
+ node.setSelected(true, false, "checkboxSelected");
81048
+ }
81049
+ }
81050
+ });
80903
81051
  resetPagination();
81052
+ gridApi == null ? void 0 : gridApi.redrawRows();
80904
81053
  },
80905
- [gridApi]
81054
+ [gridApi, rowSelectionRef.current]
80906
81055
  );
81056
+ React76__default.default.useEffect(() => {
81057
+ function handleRowSelection(event) {
81058
+ if (event.node.displayed && event.node.id) {
81059
+ rowSelectionRef.current.affectedRows[event.node.id] = {
81060
+ node: event.node,
81061
+ selectedState: event.node.isSelected() ? rowSelectionState.selected : rowSelectionState.unselected
81062
+ };
81063
+ }
81064
+ }
81065
+ (gridApi == null ? void 0 : gridApi.addEventListener) && gridApi.addEventListener("rowSelected", handleRowSelection);
81066
+ return () => {
81067
+ removeEventListenerFromGrid("rowSelected", handleRowSelection, gridApi);
81068
+ };
81069
+ }, [gridApi]);
80907
81070
  const setLoading = React76__default.default.useCallback((loading, message = "") => {
80908
81071
  setLoadingStatus({
80909
81072
  loading,
@@ -80965,6 +81128,7 @@ var useTableApi = ({
80965
81128
  adjustRowDragIcon(gridApi, columnApi);
80966
81129
  });
80967
81130
  }
81131
+ setExpandCollapseRow(gridApi, config, groupDefaultExpanded);
80968
81132
  },
80969
81133
  [columnApi, gridApi, internalSetRowHeight, filterStorage.setSelectedFilters]
80970
81134
  );
@@ -81058,7 +81222,8 @@ var useTableApi = ({
81058
81222
  columnApi,
81059
81223
  rowHeight,
81060
81224
  filterStorage,
81061
- rowSelectionRef
81225
+ rowSelectionRef,
81226
+ groupDefaultExpanded
81062
81227
  }),
81063
81228
  [columnApi, gridApi, rowHeight, filterStorage]
81064
81229
  );
@@ -81332,7 +81497,6 @@ function buildPartialTableApi({
81332
81497
  focusField && (gridApi == null ? void 0 : gridApi.setFocusedCell(rowIndex, focusField));
81333
81498
  };
81334
81499
  return {
81335
- getVisibleRowNodes,
81336
81500
  applyTransaction,
81337
81501
  applyServerSideTransaction,
81338
81502
  collapseAll,
@@ -81347,6 +81511,7 @@ function buildPartialTableApi({
81347
81511
  getSelectedRows: getSelectedRows2,
81348
81512
  getServerSideSelectionState,
81349
81513
  getTableConfiguration,
81514
+ getVisibleRowNodes,
81350
81515
  refreshCells,
81351
81516
  setPinnedBottomRowData,
81352
81517
  setRowData,
@@ -81464,6 +81629,12 @@ var DataTable = ({
81464
81629
  const [rowHeight, setRowHeight] = React76__default.default.useState(
81465
81630
  (initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
81466
81631
  );
81632
+ const expandCollapseStateRef = React76__default.default.useRef(
81633
+ (initialTableConfig == null ? void 0 : initialTableConfig.groupRowState) || {
81634
+ expandedRoutes: [],
81635
+ collapsedRoutes: []
81636
+ }
81637
+ );
81467
81638
  const rowHeightRef = React76__default.default.useRef(
81468
81639
  (initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
81469
81640
  );
@@ -81511,12 +81682,14 @@ var DataTable = ({
81511
81682
  if (localStoragePersistenceKey) {
81512
81683
  webSdkStorage.storage.local.setItem(localStoragePersistenceKey, {
81513
81684
  ...config,
81685
+ groupRowState: expandCollapseStateRef.current,
81514
81686
  rowHeight: rowHeightRef.current,
81515
81687
  serverFilters: filterStorage.filtersState
81516
81688
  });
81517
81689
  }
81518
81690
  onTableConfigChange == null ? void 0 : onTableConfigChange({
81519
81691
  ...config,
81692
+ groupRowState: expandCollapseStateRef.current,
81520
81693
  rowHeight: rowHeightRef.current,
81521
81694
  serverFilters: filterStorage.filtersState
81522
81695
  });
@@ -81627,6 +81800,7 @@ var DataTable = ({
81627
81800
  onServerSideDataRequest,
81628
81801
  onTableConfigChange: internalOnTableConfigChange,
81629
81802
  rowSelectionRef,
81803
+ expandCollapseStateRef,
81630
81804
  rowHeight,
81631
81805
  searchStorage,
81632
81806
  selectedGroupIndex,
@@ -81687,7 +81861,7 @@ function getServerSideDatasource(onServerSideDataRequestCallbackRef, onEmptyResp
81687
81861
  }
81688
81862
  var minimumColumnWidth = 140;
81689
81863
  var Table = (props) => {
81690
- var _a, _b;
81864
+ var _a, _b, _c;
81691
81865
  const { suppressColumnVirtualisation = true, rowActionsConfig = {} } = props;
81692
81866
  const I18n = coreReact.useI18nContext();
81693
81867
  const internalTableContext = useInternalTableContext();
@@ -81729,8 +81903,10 @@ var Table = (props) => {
81729
81903
  columnDefinitions: internalTableContext.columnDefinitions,
81730
81904
  gridApi,
81731
81905
  setLoadingStatus,
81732
- wrapperRef
81906
+ wrapperRef,
81907
+ groupDefaultExpanded: props.groupDefaultExpanded
81733
81908
  });
81909
+ const initialTableConfig = internalTableContext.initialTableConfig;
81734
81910
  React76__default.default.useImperativeHandle(internalTableContext.tableRef, () => tableApi, [
81735
81911
  tableApi
81736
81912
  ]);
@@ -82044,8 +82220,8 @@ var Table = (props) => {
82044
82220
  );
82045
82221
  const onColumnGroupOpened = React76__default.default.useCallback(
82046
82222
  (event) => {
82047
- var _a2, _b2, _c;
82048
- (_c = internalTableContext.analytics) == null ? void 0 : _c.client.addEvent(
82223
+ var _a2, _b2, _c2;
82224
+ (_c2 = internalTableContext.analytics) == null ? void 0 : _c2.client.addEvent(
82049
82225
  "design_system.data_table.column.expand_toggled",
82050
82226
  {
82051
82227
  client: internalTableContext.analytics.clientName,
@@ -82062,14 +82238,14 @@ var Table = (props) => {
82062
82238
  );
82063
82239
  const onColumnPinned = React76__default.default.useCallback(
82064
82240
  (event) => {
82065
- var _a2, _b2, _c, _d;
82241
+ var _a2, _b2, _c2, _d;
82066
82242
  (_d = internalTableContext.analytics) == null ? void 0 : _d.client.addEvent(
82067
82243
  "design_system.data_table.column.pinned",
82068
82244
  {
82069
82245
  client: internalTableContext.analytics.clientName,
82070
82246
  column: (_a2 = event.column) == null ? void 0 : _a2.getColId(),
82071
82247
  side: (_b2 = event.column) == null ? void 0 : _b2.getPinned(),
82072
- position: (_c = columnApi == null ? void 0 : columnApi.getColumns()) == null ? void 0 : _c.findIndex(
82248
+ position: (_c2 = columnApi == null ? void 0 : columnApi.getColumns()) == null ? void 0 : _c2.findIndex(
82073
82249
  (col) => {
82074
82250
  var _a3;
82075
82251
  return col.getId() === ((_a3 = event.column) == null ? void 0 : _a3.getColId());
@@ -82168,7 +82344,7 @@ var Table = (props) => {
82168
82344
  const onDragStopped = React76__default.default.useCallback(
82169
82345
  // eslint-disable-next-line complexity
82170
82346
  (event) => {
82171
- var _a2, _b2, _c;
82347
+ var _a2, _b2, _c2;
82172
82348
  if (event.target.className.includes("ag-header-cell")) {
82173
82349
  internalTableContext.onTableConfigChange();
82174
82350
  }
@@ -82186,7 +82362,7 @@ var Table = (props) => {
82186
82362
  const firstVisibleColumnIndex = allColumns.findIndex(
82187
82363
  (col) => col.isVisible()
82188
82364
  );
82189
- if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((_c = moveColumnEvent.column) == null ? void 0 : _c.getColDef().rowDrag)) {
82365
+ if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((_c2 = moveColumnEvent.column) == null ? void 0 : _c2.getColDef().rowDrag)) {
82190
82366
  adjustRowDragIcon(event.api, event.columnApi);
82191
82367
  }
82192
82368
  }
@@ -82265,27 +82441,55 @@ var Table = (props) => {
82265
82441
  (_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
82266
82442
  );
82267
82443
  }, [setViewportWidth]);
82444
+ const isClientSideGroupOpenByDefault = React76__default.default.useCallback(
82445
+ (params) => {
82446
+ const node = params.rowNode;
82447
+ if (!node) {
82448
+ return false;
82449
+ }
82450
+ return isRowOpenedByDefault(
82451
+ node,
82452
+ initialTableConfig,
82453
+ props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded
82454
+ );
82455
+ },
82456
+ [initialTableConfig, props.groupDefaultExpanded]
82457
+ );
82458
+ const isServerSideGroupOpenByDefault = React76__default.default.useCallback(
82459
+ (params) => {
82460
+ const node = params.rowNode;
82461
+ if (!node) {
82462
+ return false;
82463
+ }
82464
+ return isRowOpenedByDefault(
82465
+ node,
82466
+ initialTableConfig,
82467
+ props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded
82468
+ );
82469
+ },
82470
+ [initialTableConfig, props.groupDefaultExpanded]
82471
+ );
82268
82472
  const onGridReady = (params) => {
82269
- var _a2, _b2, _c;
82473
+ var _a2, _b2, _c2;
82270
82474
  internalTableContext.setGridApi(params.api);
82271
82475
  internalTableContext.setColumnApi(params.columnApi);
82272
82476
  setViewportWidth(
82273
82477
  (_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
82274
82478
  );
82275
- (_c = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c.call(_b2, params);
82479
+ (_c2 = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c2.call(_b2, params);
82276
82480
  };
82277
82481
  const postProcessPopup = (params) => {
82278
82482
  params.ePopup.style.top = `${HEADER_HEIGHT}px`;
82279
82483
  };
82280
82484
  const internalOnRowSelected = (event) => {
82281
- var _a2, _b2, _c;
82485
+ var _a2, _b2, _c2;
82282
82486
  (_a2 = props.onRowSelected) == null ? void 0 : _a2.call(props, event);
82283
82487
  if (props.siblingGroupsRowSelectionDisabled) {
82284
82488
  const rootRowNode = getRootRowNode(event.node);
82285
82489
  if (!event.node.isSelected() && internalTableContext.selectedGroupIndex !== null && (rootRowNode == null ? void 0 : rootRowNode.id) === internalTableContext.selectedGroupIndex && event.api.getSelectedNodes().length === 0) {
82286
82490
  (_b2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _b2.call(internalTableContext, null);
82287
82491
  } else {
82288
- (_c = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _c.call(internalTableContext, (prevState) => {
82492
+ (_c2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _c2.call(internalTableContext, (prevState) => {
82289
82493
  return prevState ?? (rootRowNode == null ? void 0 : rootRowNode.id) ?? null;
82290
82494
  });
82291
82495
  }
@@ -82294,13 +82498,26 @@ var Table = (props) => {
82294
82498
  const internalRowGroupOpened = React76__default.default.useCallback(
82295
82499
  (event) => {
82296
82500
  var _a2;
82501
+ if (internalTableContext.expandCollapseStateRef) {
82502
+ internalTableContext.expandCollapseStateRef.current = getGroupRowState(
82503
+ gridApi,
82504
+ props.groupDefaultExpanded
82505
+ );
82506
+ }
82507
+ internalTableContext.onTableConfigChange();
82297
82508
  (_a2 = props.onRowGroupOpened) == null ? void 0 : _a2.call(props, {
82298
82509
  expanded: event.expanded,
82299
82510
  node: serializeNode(event.node),
82300
82511
  rowIndex: event.rowIndex
82301
82512
  });
82302
82513
  },
82303
- [props.onRowGroupOpened]
82514
+ [
82515
+ props.onRowGroupOpened,
82516
+ internalTableContext.onTableConfigChange,
82517
+ tableApi == null ? void 0 : tableApi.getTableConfiguration(),
82518
+ (_c = internalTableContext.expandCollapseStateRef) == null ? void 0 : _c.current,
82519
+ gridApi
82520
+ ]
82304
82521
  );
82305
82522
  const getGroupRowAgg = React76__default.default.useCallback(
82306
82523
  (params) => {
@@ -82453,6 +82670,8 @@ var Table = (props) => {
82453
82670
  alwaysAggregateAtRootLevel: !onSSDR,
82454
82671
  autoGroupColumnDef: decoratedAutoGroupColDef,
82455
82672
  cacheBlockSize: props.paginationPageSize || defaultPaginationPageSize,
82673
+ isGroupOpenByDefault: isClientSideGroupOpenByDefault,
82674
+ isServerSideGroupOpenByDefault,
82456
82675
  defaultColDef,
82457
82676
  enableGroupEdit: internalTableContext.enableGroupEditAndValidation,
82458
82677
  enableCellTextSelection: internalTableContext.enableCellTextSelection,