@procore/data-table 14.46.1 → 14.46.2

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.
@@ -54285,7 +54285,7 @@ function ServerSideNumberFilterRenderer({
54285
54285
  },
54286
54286
  {
54287
54287
  id: "isEqual",
54288
- label: I18n.t("options.isEqual", {
54288
+ label: I18n.t("options.is_equal_to", {
54289
54289
  defaultValue: "Is Equal To",
54290
54290
  scope: "dataTable.filters.numberFilter"
54291
54291
  })
@@ -54772,26 +54772,19 @@ function serializeNode(node) {
54772
54772
  rowPinned: node.rowPinned
54773
54773
  };
54774
54774
  }
54775
- function transformToColDef(colDefinition, enableGroupEditAndValidation, enableDynamicRowHeight) {
54775
+ function transformToColDef(colDefinition, tableOptions) {
54776
54776
  if (isNestedColumnDefinition(colDefinition)) {
54777
54777
  return {
54778
54778
  ...colDefinition,
54779
54779
  children: colDefinition.children.map(
54780
- (childColDefinition) => transformColumnDefinitionToColDef(
54781
- childColDefinition,
54782
- enableGroupEditAndValidation,
54783
- enableDynamicRowHeight
54784
- )
54780
+ (childColDefinition) => transformColumnDefinitionToColDef(childColDefinition, tableOptions)
54785
54781
  )
54786
54782
  };
54787
54783
  }
54788
- return transformColumnDefinitionToColDef(
54789
- colDefinition,
54790
- enableGroupEditAndValidation,
54791
- enableDynamicRowHeight
54792
- );
54784
+ return transformColumnDefinitionToColDef(colDefinition, tableOptions);
54793
54785
  }
54794
- function transformColumnDefinitionToColDef(dataTableColumnDefinition, enableGroupEditAndValidation, enableDynamicRowHeight) {
54786
+ function transformColumnDefinitionToColDef(dataTableColumnDefinition, tableOptions) {
54787
+ const { enableGroupEditAndValidation, enableDynamicRowHeight } = tableOptions;
54795
54788
  const {
54796
54789
  aggFunc,
54797
54790
  bulkEditable,
@@ -54834,7 +54827,8 @@ function transformColumnDefinitionToColDef(dataTableColumnDefinition, enableGrou
54834
54827
  };
54835
54828
  const cellClassRules = {
54836
54829
  "invalid-cell": function isValid(params) {
54837
- const shouldValidate = !params.node.group && params.data && !params.data.isAggData || enableGroupEditAndValidation && (params.node.footer || params.node.group && !params.node.expanded);
54830
+ const shouldValidateGroupHeader = tableOptions.enableGroupHeaderEdit && params.node.group;
54831
+ const shouldValidate = !params.node.group && params.data && !params.data.isAggData || enableGroupEditAndValidation && (params.node.footer || params.node.group && !params.node.expanded) || shouldValidateGroupHeader;
54838
54832
  return (shouldValidate && valueValidator && !valueValidator({
54839
54833
  columnDefinition: transformToColumnDefinition(params.colDef),
54840
54834
  data: params.data,
@@ -55171,12 +55165,8 @@ function addAutoGroupParams(columnDefinition, isRowSelectable, siblingGroupsRowS
55171
55165
  }
55172
55166
  };
55173
55167
  }
55174
- function getDecoratedAutoGroupColDef(columnDefinition, enableGroupEditAndValidation, enableDynamicRowHeight, isRowSelectable, siblingGroupsRowSelectionDisabled, groupsAlwaysExpanded, isDetailTable) {
55175
- const colDef = columnDefinition ? transformToColDef(
55176
- columnDefinition,
55177
- enableGroupEditAndValidation,
55178
- enableDynamicRowHeight
55179
- ) : DEFAULT_AUTO_GROUP_COLUMN_DEFINITION;
55168
+ function getDecoratedAutoGroupColDef(columnDefinition, tableOptions, isRowSelectable, siblingGroupsRowSelectionDisabled, groupsAlwaysExpanded, isDetailTable) {
55169
+ const colDef = columnDefinition ? transformToColDef(columnDefinition, tableOptions) : DEFAULT_AUTO_GROUP_COLUMN_DEFINITION;
55180
55170
  return addAutoGroupParams(
55181
55171
  colDef,
55182
55172
  isRowSelectable,
@@ -55187,12 +55177,12 @@ function getDecoratedAutoGroupColDef(columnDefinition, enableGroupEditAndValidat
55187
55177
  }
55188
55178
 
55189
55179
  // src/CellRenderers/AutoGroupCell.scss
55190
- var css5 = `._autoGroupCell_1qx8z_1 {
55180
+ var css5 = `._autoGroupCell_1h6pf_1 {
55191
55181
  height: 100%;
55192
55182
  width: 100%;
55193
55183
  }
55194
55184
 
55195
- ._indent_1qx8z_6 {
55185
+ ._indent_1h6pf_6 {
55196
55186
  border-right: 1px solid #d6dadc;
55197
55187
  background: #f4f5f6;
55198
55188
  position: absolute;
@@ -55200,45 +55190,69 @@ var css5 = `._autoGroupCell_1qx8z_1 {
55200
55190
  bottom: -1px;
55201
55191
  width: 12px;
55202
55192
  }
55203
- ._indent_1qx8z_6._innermostLastIndent_1qx8z_14 {
55193
+ ._indent_1h6pf_6._innermostLastIndent_1h6pf_14 {
55204
55194
  bottom: 0px;
55205
55195
  }
55206
55196
 
55207
- ._expandableCaret_1qx8z_18 {
55197
+ ._expandableCaret_1h6pf_18 {
55208
55198
  margin-left: -8px;
55209
55199
  margin-right: 4px;
55210
55200
  width: 24px;
55211
55201
  flex-shrink: 0;
55212
55202
  }
55213
55203
 
55214
- ._expandCaret_1qx8z_25 {
55204
+ ._expandableCaretButton_1h6pf_25 {
55205
+ display: inline-flex;
55206
+ align-items: center;
55207
+ justify-content: center;
55208
+ width: 24px;
55209
+ height: 24px;
55210
+ padding: 0;
55211
+ margin-left: -8px;
55212
+ margin-right: 4px;
55213
+ border: none;
55214
+ border-radius: 2px;
55215
+ background: transparent;
55216
+ cursor: pointer;
55217
+ flex-shrink: 0;
55218
+ }
55219
+ ._expandableCaretButton_1h6pf_25:focus-visible {
55220
+ outline: 2px solid #2066df;
55221
+ outline-offset: 1px;
55222
+ }
55223
+ ._expandableCaretButton_1h6pf_25:hover {
55224
+ background-color: rgba(0, 0, 0, 0.06);
55225
+ }
55226
+
55227
+ ._expandCaret_1h6pf_48 {
55215
55228
  color: #2066df;
55216
55229
  cursor: pointer;
55217
55230
  }
55218
55231
 
55219
- ._collapseCaret_1qx8z_30 {
55232
+ ._collapseCaret_1h6pf_53 {
55220
55233
  color: #75838a;
55221
55234
  cursor: pointer;
55222
55235
  }
55223
55236
 
55224
- ._value_1qx8z_35 {
55237
+ ._value_1h6pf_58 {
55225
55238
  overflow: hidden;
55226
55239
  text-overflow: ellipsis;
55227
55240
  font-size: 12px;
55228
55241
  }
55229
- ._value_1qx8z_35._footer_1qx8z_40 {
55242
+ ._value_1h6pf_58._footer_1h6pf_63 {
55230
55243
  color: #6a767c;
55231
55244
  }`;
55232
55245
  document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css5));
55233
55246
  var AutoGroupCell_default = {
55234
- "autoGroupCell": "_autoGroupCell_1qx8z_1",
55235
- "indent": "_indent_1qx8z_6",
55236
- "innermostLastIndent": "_innermostLastIndent_1qx8z_14",
55237
- "expandableCaret": "_expandableCaret_1qx8z_18",
55238
- "expandCaret": "_expandCaret_1qx8z_25",
55239
- "collapseCaret": "_collapseCaret_1qx8z_30",
55240
- "value": "_value_1qx8z_35",
55241
- "footer": "_footer_1qx8z_40"
55247
+ "autoGroupCell": "_autoGroupCell_1h6pf_1",
55248
+ "indent": "_indent_1h6pf_6",
55249
+ "innermostLastIndent": "_innermostLastIndent_1h6pf_14",
55250
+ "expandableCaret": "_expandableCaret_1h6pf_18",
55251
+ "expandableCaretButton": "_expandableCaretButton_1h6pf_25",
55252
+ "expandCaret": "_expandCaret_1h6pf_48",
55253
+ "collapseCaret": "_collapseCaret_1h6pf_53",
55254
+ "value": "_value_1h6pf_58",
55255
+ "footer": "_footer_1h6pf_63"
55242
55256
  };
55243
55257
 
55244
55258
  // src/utils/rowSelectionHelpers.ts
@@ -55495,6 +55509,7 @@ var LevelIndents = (props) => {
55495
55509
  };
55496
55510
  function GroupCaret(props) {
55497
55511
  const mounted = React80.useRef(false);
55512
+ const buttonRef = React80.useRef(null);
55498
55513
  const [expanded, setExpanded] = useState(props.node.expanded);
55499
55514
  const ExpandableCaret = expanded ? CaretDown : CaretRight;
55500
55515
  const I18n = useI18nContext();
@@ -55505,6 +55520,16 @@ function GroupCaret(props) {
55505
55520
  }, 0);
55506
55521
  }
55507
55522
  }
55523
+ const handleToggle = () => {
55524
+ props.api.setRowNodeExpanded(props.node, !expanded);
55525
+ };
55526
+ const handleKeyDown = (event) => {
55527
+ if (event.key === "Enter" || event.key === " ") {
55528
+ event.preventDefault();
55529
+ event.stopPropagation();
55530
+ handleToggle();
55531
+ }
55532
+ };
55508
55533
  useEffect(() => {
55509
55534
  mounted.current = true;
55510
55535
  props.api.addEventListener("rowGroupOpened", handleRowGroupToggle);
@@ -55517,20 +55542,45 @@ function GroupCaret(props) {
55517
55542
  );
55518
55543
  };
55519
55544
  }, []);
55545
+ useEffect(() => {
55546
+ if (!props.node.isExpandable()) return;
55547
+ const cell2 = buttonRef.current?.closest(".ag-cell");
55548
+ if (!cell2) return;
55549
+ const handleCellKeyDown = (event) => {
55550
+ if (event.key !== "Enter" && event.key !== " ") return;
55551
+ if (!event.isTrusted) return;
55552
+ const target = event.target;
55553
+ if (target.closest("button") || target.closest("input")) return;
55554
+ event.preventDefault();
55555
+ event.stopImmediatePropagation();
55556
+ buttonRef.current?.click();
55557
+ };
55558
+ cell2.addEventListener("keydown", handleCellKeyDown, { capture: true });
55559
+ return () => {
55560
+ cell2.removeEventListener("keydown", handleCellKeyDown, { capture: true });
55561
+ };
55562
+ }, []);
55563
+ if (!props.node.isExpandable()) {
55564
+ return /* @__PURE__ */ React80.createElement("div", { className: AutoGroupCell_default.expandableCaret });
55565
+ }
55520
55566
  return /* @__PURE__ */ React80.createElement(
55521
- Box,
55567
+ "button",
55522
55568
  {
55569
+ type: "button",
55570
+ ref: buttonRef,
55571
+ "aria-expanded": expanded,
55523
55572
  "aria-label": I18n.t(
55524
55573
  `dataTable.groupCell.${expanded ? "collapse" : "expand"}`
55525
55574
  ),
55526
- className: AutoGroupCell_default.expandableCaret,
55527
- role: "button"
55575
+ className: AutoGroupCell_default.expandableCaretButton,
55576
+ onClick: handleToggle,
55577
+ onKeyDown: handleKeyDown,
55578
+ "data-qa": "group-expand-collapse"
55528
55579
  },
55529
- props.node.isExpandable() && /* @__PURE__ */ React80.createElement(
55580
+ /* @__PURE__ */ React80.createElement(
55530
55581
  ExpandableCaret,
55531
55582
  {
55532
- className: expanded ? AutoGroupCell_default.collapseCaret : AutoGroupCell_default.expandCaret,
55533
- onClick: () => props.api.setRowNodeExpanded(props.node, !expanded)
55583
+ className: expanded ? AutoGroupCell_default.collapseCaret : AutoGroupCell_default.expandCaret
55534
55584
  }
55535
55585
  )
55536
55586
  );
@@ -56387,10 +56437,15 @@ var css7 = `.data-table-container .ag-header-cell .data-table-header-menu {
56387
56437
  align-items: center;
56388
56438
  justify-content: center;
56389
56439
  background-color: #e3e6e8;
56440
+ border: none;
56390
56441
  border-radius: 2px;
56391
56442
  cursor: pointer;
56392
56443
  margin-right: 8px;
56393
56444
  }
56445
+ .data-table-container .ag-header-cell .expand-button:focus-visible {
56446
+ outline: 2px solid #2066df;
56447
+ outline-offset: 1px;
56448
+ }
56394
56449
  .data-table-container .ag-header-group-cell-with-group .ag-header-cell-comp-wrapper {
56395
56450
  width: 100%;
56396
56451
  overflow: hidden;
@@ -56403,10 +56458,15 @@ var css7 = `.data-table-container .ag-header-cell .data-table-header-menu {
56403
56458
  align-items: center;
56404
56459
  justify-content: center;
56405
56460
  background-color: #e3e6e8;
56461
+ border: none;
56406
56462
  border-radius: 2px;
56407
56463
  cursor: pointer;
56408
56464
  margin-left: auto;
56409
56465
  }
56466
+ .data-table-container .ag-header-group-cell-with-group .expand-button:focus-visible {
56467
+ outline: 2px solid #2066df;
56468
+ outline-offset: 1px;
56469
+ }
56410
56470
  .data-table-container .auto-column-expand-tooltip-content {
56411
56471
  width: 96px;
56412
56472
  }
@@ -56554,6 +56614,7 @@ var GenericHeaderRenderer = (props) => {
56554
56614
  I18n
56555
56615
  );
56556
56616
  const headerCellRef = useRef(null);
56617
+ const expandButtonRef = useRef(null);
56557
56618
  const menuButtonRef = useRef(null);
56558
56619
  const headerCheckboxSelection = colDef.headerCheckboxSelection;
56559
56620
  const headerCheckboxSelectionEnabled = typeof headerCheckboxSelection === "function" ? headerCheckboxSelection({
@@ -56704,6 +56765,28 @@ var GenericHeaderRenderer = (props) => {
56704
56765
  );
56705
56766
  }
56706
56767
  React80.useEffect(updateExpandedState);
56768
+ React80.useEffect(() => {
56769
+ if (!isExpandable) return;
56770
+ const headerCell = headerCellRef.current?.closest(".ag-header-cell");
56771
+ if (!headerCell) return;
56772
+ const handleExpandKeyDown = (event) => {
56773
+ if (event.key !== "Enter" && event.key !== " ") return;
56774
+ if (!event.isTrusted) return;
56775
+ const target = event.target;
56776
+ if (target.closest("button") || target.closest("input")) return;
56777
+ event.preventDefault();
56778
+ event.stopImmediatePropagation();
56779
+ expandButtonRef.current?.click();
56780
+ };
56781
+ headerCell.addEventListener("keydown", handleExpandKeyDown, {
56782
+ capture: true
56783
+ });
56784
+ return () => {
56785
+ headerCell.removeEventListener("keydown", handleExpandKeyDown, {
56786
+ capture: true
56787
+ });
56788
+ };
56789
+ }, [isExpandable]);
56707
56790
  const [expansionVariant, setExpansionVariant] = React80.useState("closed");
56708
56791
  React80.useEffect(() => {
56709
56792
  const onExpandAllChange = (event) => {
@@ -56981,12 +57064,21 @@ var GenericHeaderRenderer = (props) => {
56981
57064
  overlay: /* @__PURE__ */ React80.createElement(Tooltip.Content, { className: "auto-column-expand-tooltip-content" }, tooltipText[expansionVariant])
56982
57065
  },
56983
57066
  /* @__PURE__ */ React80.createElement(
56984
- "div",
57067
+ "button",
56985
57068
  {
57069
+ type: "button",
57070
+ ref: expandButtonRef,
57071
+ "aria-expanded": expansionVariant !== "closed",
56986
57072
  "aria-label": tooltipText[expansionVariant],
56987
57073
  className: "expand-button",
56988
57074
  onClick: onExpandToggle,
56989
- role: "button",
57075
+ onKeyDown: (e) => {
57076
+ if (e.key === "Enter" || e.key === " ") {
57077
+ e.preventDefault();
57078
+ e.stopPropagation();
57079
+ onExpandToggle(e);
57080
+ }
57081
+ },
56990
57082
  "data-qa": "expand-or-collapse-all-button"
56991
57083
  },
56992
57084
  /* @__PURE__ */ React80.createElement(ExpansionVariantIcon, { size: "sm" })
@@ -104542,11 +104634,10 @@ var ConfigurationColumns = React80.forwardRef(
104542
104634
  return columnDefs;
104543
104635
  }
104544
104636
  const columnDefinitionsMappedToDefs = columnDefinitions.map(
104545
- (colDef) => transformToColDef(
104546
- colDef,
104637
+ (colDef) => transformToColDef(colDef, {
104547
104638
  enableGroupEditAndValidation,
104548
104639
  enableDynamicRowHeight
104549
- )
104640
+ })
104550
104641
  );
104551
104642
  return toGroupedCols(columnDefinitionsMappedToDefs);
104552
104643
  });
@@ -104845,8 +104936,10 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
104845
104936
  alwaysAggregateAtRootLevel: !isServerSideRowModel,
104846
104937
  autoGroupColumnDef: getDecoratedAutoGroupColDef(
104847
104938
  detailRowConfig.autoGroupColumnDefinition,
104848
- enableGroupEditAndValidation,
104849
- enableDynamicRowHeight,
104939
+ {
104940
+ enableGroupEditAndValidation,
104941
+ enableDynamicRowHeight
104942
+ },
104850
104943
  isRowSelectable,
104851
104944
  false,
104852
104945
  detailRowConfig.groupsAlwaysExpanded ?? false,
@@ -104858,11 +104951,10 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
104858
104951
  },
104859
104952
  columnDefs: toGroupedCols(
104860
104953
  detailRowConfig.columnDefinitions.map(
104861
- (colDef) => transformToColDef(
104862
- colDef,
104954
+ (colDef) => transformToColDef(colDef, {
104863
104955
  enableGroupEditAndValidation,
104864
- colDef.autoHeight ?? enableDynamicRowHeight
104865
- )
104956
+ enableDynamicRowHeight: colDef.autoHeight ?? enableDynamicRowHeight
104957
+ })
104866
104958
  )
104867
104959
  ),
104868
104960
  groupsAlwaysExpanded: detailRowConfig.groupsAlwaysExpanded ?? false,
@@ -109995,11 +110087,16 @@ function getServerSideDatasource(onServerSideDataRequestCallbackRef, onEmptyResp
109995
110087
  };
109996
110088
  }
109997
110089
  var minimumColumnWidth = 140;
110090
+ function resolveGroupIncludeFooter(props, onSSDR) {
110091
+ if (props.enableGroupHeaderEdit) return false;
110092
+ if (!onSSDR && props.groupIncludeFooter === void 0) return true;
110093
+ return props.groupIncludeFooter;
110094
+ }
109998
110095
  function useComputeAgGridProps(props) {
109999
110096
  const internalTableContext = useInternalTableContext();
110000
110097
  const onSSDR = internalTableContext.onServerSideDataRequest;
110001
110098
  return {
110002
- groupIncludeFooter: !onSSDR && props.groupIncludeFooter === void 0 ? true : props.groupIncludeFooter,
110099
+ groupIncludeFooter: resolveGroupIncludeFooter(props, !!onSSDR),
110003
110100
  rowDragManaged: onSSDR ? false : props.rowDragManaged ?? true,
110004
110101
  rowModelType: onSSDR ? "serverSide" : void 0,
110005
110102
  groupSelectsChildren: (
@@ -110072,11 +110169,11 @@ var Table = (props) => {
110072
110169
  });
110073
110170
  const decoratedColDefs = React80.useMemo(
110074
110171
  () => internalTableContext.columnDefinitions?.map((colDef) => {
110075
- const newColDef = transformToColDef(
110076
- colDef,
110077
- internalTableContext.enableGroupEditAndValidation,
110078
- internalTableContext.enableDynamicRowHeight
110079
- );
110172
+ const newColDef = transformToColDef(colDef, {
110173
+ enableGroupEditAndValidation: internalTableContext.enableGroupEditAndValidation,
110174
+ enableDynamicRowHeight: internalTableContext.enableDynamicRowHeight,
110175
+ enableGroupHeaderEdit: props.enableGroupHeaderEdit
110176
+ });
110080
110177
  return {
110081
110178
  ...newColDef,
110082
110179
  editable: overrideEditable(colDef.editable)
@@ -110362,8 +110459,10 @@ var Table = (props) => {
110362
110459
  const decoratedAutoGroupColDef = React80.useMemo(
110363
110460
  () => getDecoratedAutoGroupColDef(
110364
110461
  props?.autoGroupColumnDefinition,
110365
- internalTableContext.enableGroupEditAndValidation,
110366
- internalTableContext.enableDynamicRowHeight,
110462
+ {
110463
+ enableGroupEditAndValidation: internalTableContext.enableGroupEditAndValidation,
110464
+ enableDynamicRowHeight: internalTableContext.enableDynamicRowHeight
110465
+ },
110367
110466
  isRowSelectable,
110368
110467
  props.siblingGroupsRowSelectionDisabled,
110369
110468
  props.groupsAlwaysExpanded ?? false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/data-table",
3
- "version": "14.46.1",
3
+ "version": "14.46.2",
4
4
  "description": "Complex data grid built on top of ag-grid, with DST components and styles.",
5
5
  "author": "Procore Technologies",
6
6
  "homepage": "https://github.com/procore/core/tree/main/packages/data-table",
@@ -77,7 +77,7 @@
77
77
  "@procore/error-pages": "^0.2.3",
78
78
  "@procore/labs-datetime-select": "^0.2.2",
79
79
  "@procore/labs-group-by-select": "4.1.0",
80
- "@procore/toast-alert": "^5.1.2",
80
+ "@procore/toast-alert": "^5.1.3",
81
81
  "@procore/web-sdk-storage": "^0.1.0",
82
82
  "classnames": "2.5.1",
83
83
  "date-fns": "2.29.1",
@@ -108,7 +108,7 @@
108
108
  "@procore/core-css": "10.17.0",
109
109
  "@procore/core-icons": "^12.17.0",
110
110
  "@procore/core-prettier": "10.2.0",
111
- "@procore/core-react": "^12.47.1",
111
+ "@procore/core-react": "^12.48.2",
112
112
  "@procore/eslint-config": "10.0.0",
113
113
  "@procore/globalization-toolkit": "3.1.0",
114
114
  "@procore/labs-financials-utils": "4.3.1",
@@ -122,8 +122,8 @@
122
122
  "@testing-library/jest-dom": "5.16.4",
123
123
  "@testing-library/react": "16.3.0",
124
124
  "@testing-library/user-event": "13.1.5",
125
- "@types/lodash.debounce": "4.0.7",
126
- "@types/lodash.isequal": "4.5.0",
125
+ "@types/lodash.debounce": "4.0.9",
126
+ "@types/lodash.isequal": "4.5.8",
127
127
  "@types/ramda": "0.28.23",
128
128
  "@types/react": "18.3.1",
129
129
  "@types/react-dom": "18.3.1",