@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.
@@ -54325,7 +54325,7 @@ function ServerSideNumberFilterRenderer({
54325
54325
  },
54326
54326
  {
54327
54327
  id: "isEqual",
54328
- label: I18n.t("options.isEqual", {
54328
+ label: I18n.t("options.is_equal_to", {
54329
54329
  defaultValue: "Is Equal To",
54330
54330
  scope: "dataTable.filters.numberFilter"
54331
54331
  })
@@ -54823,26 +54823,19 @@ function serializeNode(node) {
54823
54823
  rowPinned: node.rowPinned
54824
54824
  };
54825
54825
  }
54826
- function transformToColDef(colDefinition, enableGroupEditAndValidation, enableDynamicRowHeight) {
54826
+ function transformToColDef(colDefinition, tableOptions) {
54827
54827
  if (isNestedColumnDefinition(colDefinition)) {
54828
54828
  return {
54829
54829
  ...colDefinition,
54830
54830
  children: colDefinition.children.map(
54831
- (childColDefinition) => transformColumnDefinitionToColDef(
54832
- childColDefinition,
54833
- enableGroupEditAndValidation,
54834
- enableDynamicRowHeight
54835
- )
54831
+ (childColDefinition) => transformColumnDefinitionToColDef(childColDefinition, tableOptions)
54836
54832
  )
54837
54833
  };
54838
54834
  }
54839
- return transformColumnDefinitionToColDef(
54840
- colDefinition,
54841
- enableGroupEditAndValidation,
54842
- enableDynamicRowHeight
54843
- );
54835
+ return transformColumnDefinitionToColDef(colDefinition, tableOptions);
54844
54836
  }
54845
- function transformColumnDefinitionToColDef(dataTableColumnDefinition, enableGroupEditAndValidation, enableDynamicRowHeight) {
54837
+ function transformColumnDefinitionToColDef(dataTableColumnDefinition, tableOptions) {
54838
+ const { enableGroupEditAndValidation, enableDynamicRowHeight } = tableOptions;
54846
54839
  const {
54847
54840
  aggFunc,
54848
54841
  bulkEditable,
@@ -54885,7 +54878,8 @@ function transformColumnDefinitionToColDef(dataTableColumnDefinition, enableGrou
54885
54878
  };
54886
54879
  const cellClassRules = {
54887
54880
  "invalid-cell": function isValid(params) {
54888
- const shouldValidate = !params.node.group && params.data && !params.data.isAggData || enableGroupEditAndValidation && (params.node.footer || params.node.group && !params.node.expanded);
54881
+ const shouldValidateGroupHeader = tableOptions.enableGroupHeaderEdit && params.node.group;
54882
+ const shouldValidate = !params.node.group && params.data && !params.data.isAggData || enableGroupEditAndValidation && (params.node.footer || params.node.group && !params.node.expanded) || shouldValidateGroupHeader;
54889
54883
  return (shouldValidate && valueValidator && !valueValidator({
54890
54884
  columnDefinition: transformToColumnDefinition(params.colDef),
54891
54885
  data: params.data,
@@ -55228,12 +55222,8 @@ function addAutoGroupParams(columnDefinition, isRowSelectable, siblingGroupsRowS
55228
55222
  }
55229
55223
  };
55230
55224
  }
55231
- function getDecoratedAutoGroupColDef(columnDefinition, enableGroupEditAndValidation, enableDynamicRowHeight, isRowSelectable, siblingGroupsRowSelectionDisabled, groupsAlwaysExpanded, isDetailTable) {
55232
- const colDef = columnDefinition ? transformToColDef(
55233
- columnDefinition,
55234
- enableGroupEditAndValidation,
55235
- enableDynamicRowHeight
55236
- ) : DEFAULT_AUTO_GROUP_COLUMN_DEFINITION;
55225
+ function getDecoratedAutoGroupColDef(columnDefinition, tableOptions, isRowSelectable, siblingGroupsRowSelectionDisabled, groupsAlwaysExpanded, isDetailTable) {
55226
+ const colDef = columnDefinition ? transformToColDef(columnDefinition, tableOptions) : DEFAULT_AUTO_GROUP_COLUMN_DEFINITION;
55237
55227
  return addAutoGroupParams(
55238
55228
  colDef,
55239
55229
  isRowSelectable,
@@ -55244,12 +55234,12 @@ function getDecoratedAutoGroupColDef(columnDefinition, enableGroupEditAndValidat
55244
55234
  }
55245
55235
 
55246
55236
  // src/CellRenderers/AutoGroupCell.scss
55247
- var css5 = `._autoGroupCell_1qx8z_1 {
55237
+ var css5 = `._autoGroupCell_1h6pf_1 {
55248
55238
  height: 100%;
55249
55239
  width: 100%;
55250
55240
  }
55251
55241
 
55252
- ._indent_1qx8z_6 {
55242
+ ._indent_1h6pf_6 {
55253
55243
  border-right: 1px solid #d6dadc;
55254
55244
  background: #f4f5f6;
55255
55245
  position: absolute;
@@ -55257,45 +55247,69 @@ var css5 = `._autoGroupCell_1qx8z_1 {
55257
55247
  bottom: -1px;
55258
55248
  width: 12px;
55259
55249
  }
55260
- ._indent_1qx8z_6._innermostLastIndent_1qx8z_14 {
55250
+ ._indent_1h6pf_6._innermostLastIndent_1h6pf_14 {
55261
55251
  bottom: 0px;
55262
55252
  }
55263
55253
 
55264
- ._expandableCaret_1qx8z_18 {
55254
+ ._expandableCaret_1h6pf_18 {
55265
55255
  margin-left: -8px;
55266
55256
  margin-right: 4px;
55267
55257
  width: 24px;
55268
55258
  flex-shrink: 0;
55269
55259
  }
55270
55260
 
55271
- ._expandCaret_1qx8z_25 {
55261
+ ._expandableCaretButton_1h6pf_25 {
55262
+ display: inline-flex;
55263
+ align-items: center;
55264
+ justify-content: center;
55265
+ width: 24px;
55266
+ height: 24px;
55267
+ padding: 0;
55268
+ margin-left: -8px;
55269
+ margin-right: 4px;
55270
+ border: none;
55271
+ border-radius: 2px;
55272
+ background: transparent;
55273
+ cursor: pointer;
55274
+ flex-shrink: 0;
55275
+ }
55276
+ ._expandableCaretButton_1h6pf_25:focus-visible {
55277
+ outline: 2px solid #2066df;
55278
+ outline-offset: 1px;
55279
+ }
55280
+ ._expandableCaretButton_1h6pf_25:hover {
55281
+ background-color: rgba(0, 0, 0, 0.06);
55282
+ }
55283
+
55284
+ ._expandCaret_1h6pf_48 {
55272
55285
  color: #2066df;
55273
55286
  cursor: pointer;
55274
55287
  }
55275
55288
 
55276
- ._collapseCaret_1qx8z_30 {
55289
+ ._collapseCaret_1h6pf_53 {
55277
55290
  color: #75838a;
55278
55291
  cursor: pointer;
55279
55292
  }
55280
55293
 
55281
- ._value_1qx8z_35 {
55294
+ ._value_1h6pf_58 {
55282
55295
  overflow: hidden;
55283
55296
  text-overflow: ellipsis;
55284
55297
  font-size: 12px;
55285
55298
  }
55286
- ._value_1qx8z_35._footer_1qx8z_40 {
55299
+ ._value_1h6pf_58._footer_1h6pf_63 {
55287
55300
  color: #6a767c;
55288
55301
  }`;
55289
55302
  document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css5));
55290
55303
  var AutoGroupCell_default = {
55291
- "autoGroupCell": "_autoGroupCell_1qx8z_1",
55292
- "indent": "_indent_1qx8z_6",
55293
- "innermostLastIndent": "_innermostLastIndent_1qx8z_14",
55294
- "expandableCaret": "_expandableCaret_1qx8z_18",
55295
- "expandCaret": "_expandCaret_1qx8z_25",
55296
- "collapseCaret": "_collapseCaret_1qx8z_30",
55297
- "value": "_value_1qx8z_35",
55298
- "footer": "_footer_1qx8z_40"
55304
+ "autoGroupCell": "_autoGroupCell_1h6pf_1",
55305
+ "indent": "_indent_1h6pf_6",
55306
+ "innermostLastIndent": "_innermostLastIndent_1h6pf_14",
55307
+ "expandableCaret": "_expandableCaret_1h6pf_18",
55308
+ "expandableCaretButton": "_expandableCaretButton_1h6pf_25",
55309
+ "expandCaret": "_expandCaret_1h6pf_48",
55310
+ "collapseCaret": "_collapseCaret_1h6pf_53",
55311
+ "value": "_value_1h6pf_58",
55312
+ "footer": "_footer_1h6pf_63"
55299
55313
  };
55300
55314
 
55301
55315
  // src/utils/rowSelectionHelpers.ts
@@ -55560,6 +55574,7 @@ var LevelIndents = (props) => {
55560
55574
  };
55561
55575
  function GroupCaret(props) {
55562
55576
  const mounted = React80.useRef(false);
55577
+ const buttonRef = React80.useRef(null);
55563
55578
  const [expanded, setExpanded] = useState(props.node.expanded);
55564
55579
  const ExpandableCaret = expanded ? CaretDown : CaretRight;
55565
55580
  const I18n = useI18nContext();
@@ -55570,6 +55585,16 @@ function GroupCaret(props) {
55570
55585
  }, 0);
55571
55586
  }
55572
55587
  }
55588
+ const handleToggle = () => {
55589
+ props.api.setRowNodeExpanded(props.node, !expanded);
55590
+ };
55591
+ const handleKeyDown = (event) => {
55592
+ if (event.key === "Enter" || event.key === " ") {
55593
+ event.preventDefault();
55594
+ event.stopPropagation();
55595
+ handleToggle();
55596
+ }
55597
+ };
55573
55598
  useEffect(() => {
55574
55599
  mounted.current = true;
55575
55600
  props.api.addEventListener("rowGroupOpened", handleRowGroupToggle);
@@ -55582,20 +55607,47 @@ function GroupCaret(props) {
55582
55607
  );
55583
55608
  };
55584
55609
  }, []);
55610
+ useEffect(() => {
55611
+ var _a;
55612
+ if (!props.node.isExpandable()) return;
55613
+ const cell2 = (_a = buttonRef.current) == null ? void 0 : _a.closest(".ag-cell");
55614
+ if (!cell2) return;
55615
+ const handleCellKeyDown = (event) => {
55616
+ var _a2;
55617
+ if (event.key !== "Enter" && event.key !== " ") return;
55618
+ if (!event.isTrusted) return;
55619
+ const target = event.target;
55620
+ if (target.closest("button") || target.closest("input")) return;
55621
+ event.preventDefault();
55622
+ event.stopImmediatePropagation();
55623
+ (_a2 = buttonRef.current) == null ? void 0 : _a2.click();
55624
+ };
55625
+ cell2.addEventListener("keydown", handleCellKeyDown, { capture: true });
55626
+ return () => {
55627
+ cell2.removeEventListener("keydown", handleCellKeyDown, { capture: true });
55628
+ };
55629
+ }, []);
55630
+ if (!props.node.isExpandable()) {
55631
+ return /* @__PURE__ */ React80.createElement("div", { className: AutoGroupCell_default.expandableCaret });
55632
+ }
55585
55633
  return /* @__PURE__ */ React80.createElement(
55586
- Box,
55634
+ "button",
55587
55635
  {
55636
+ type: "button",
55637
+ ref: buttonRef,
55638
+ "aria-expanded": expanded,
55588
55639
  "aria-label": I18n.t(
55589
55640
  `dataTable.groupCell.${expanded ? "collapse" : "expand"}`
55590
55641
  ),
55591
- className: AutoGroupCell_default.expandableCaret,
55592
- role: "button"
55642
+ className: AutoGroupCell_default.expandableCaretButton,
55643
+ onClick: handleToggle,
55644
+ onKeyDown: handleKeyDown,
55645
+ "data-qa": "group-expand-collapse"
55593
55646
  },
55594
- props.node.isExpandable() && /* @__PURE__ */ React80.createElement(
55647
+ /* @__PURE__ */ React80.createElement(
55595
55648
  ExpandableCaret,
55596
55649
  {
55597
- className: expanded ? AutoGroupCell_default.collapseCaret : AutoGroupCell_default.expandCaret,
55598
- onClick: () => props.api.setRowNodeExpanded(props.node, !expanded)
55650
+ className: expanded ? AutoGroupCell_default.collapseCaret : AutoGroupCell_default.expandCaret
55599
55651
  }
55600
55652
  )
55601
55653
  );
@@ -56465,10 +56517,15 @@ var css7 = `.data-table-container .ag-header-cell .data-table-header-menu {
56465
56517
  align-items: center;
56466
56518
  justify-content: center;
56467
56519
  background-color: #e3e6e8;
56520
+ border: none;
56468
56521
  border-radius: 2px;
56469
56522
  cursor: pointer;
56470
56523
  margin-right: 8px;
56471
56524
  }
56525
+ .data-table-container .ag-header-cell .expand-button:focus-visible {
56526
+ outline: 2px solid #2066df;
56527
+ outline-offset: 1px;
56528
+ }
56472
56529
  .data-table-container .ag-header-group-cell-with-group .ag-header-cell-comp-wrapper {
56473
56530
  width: 100%;
56474
56531
  overflow: hidden;
@@ -56481,10 +56538,15 @@ var css7 = `.data-table-container .ag-header-cell .data-table-header-menu {
56481
56538
  align-items: center;
56482
56539
  justify-content: center;
56483
56540
  background-color: #e3e6e8;
56541
+ border: none;
56484
56542
  border-radius: 2px;
56485
56543
  cursor: pointer;
56486
56544
  margin-left: auto;
56487
56545
  }
56546
+ .data-table-container .ag-header-group-cell-with-group .expand-button:focus-visible {
56547
+ outline: 2px solid #2066df;
56548
+ outline-offset: 1px;
56549
+ }
56488
56550
  .data-table-container .auto-column-expand-tooltip-content {
56489
56551
  width: 96px;
56490
56552
  }
@@ -56634,6 +56696,7 @@ var GenericHeaderRenderer = (props) => {
56634
56696
  I18n
56635
56697
  );
56636
56698
  const headerCellRef = useRef(null);
56699
+ const expandButtonRef = useRef(null);
56637
56700
  const menuButtonRef = useRef(null);
56638
56701
  const headerCheckboxSelection = colDef.headerCheckboxSelection;
56639
56702
  const headerCheckboxSelectionEnabled = typeof headerCheckboxSelection === "function" ? headerCheckboxSelection({
@@ -56786,6 +56849,30 @@ var GenericHeaderRenderer = (props) => {
56786
56849
  );
56787
56850
  }
56788
56851
  React80.useEffect(updateExpandedState);
56852
+ React80.useEffect(() => {
56853
+ var _a2;
56854
+ if (!isExpandable) return;
56855
+ const headerCell = (_a2 = headerCellRef.current) == null ? void 0 : _a2.closest(".ag-header-cell");
56856
+ if (!headerCell) return;
56857
+ const handleExpandKeyDown = (event) => {
56858
+ var _a3;
56859
+ if (event.key !== "Enter" && event.key !== " ") return;
56860
+ if (!event.isTrusted) return;
56861
+ const target = event.target;
56862
+ if (target.closest("button") || target.closest("input")) return;
56863
+ event.preventDefault();
56864
+ event.stopImmediatePropagation();
56865
+ (_a3 = expandButtonRef.current) == null ? void 0 : _a3.click();
56866
+ };
56867
+ headerCell.addEventListener("keydown", handleExpandKeyDown, {
56868
+ capture: true
56869
+ });
56870
+ return () => {
56871
+ headerCell.removeEventListener("keydown", handleExpandKeyDown, {
56872
+ capture: true
56873
+ });
56874
+ };
56875
+ }, [isExpandable]);
56789
56876
  const [expansionVariant, setExpansionVariant] = React80.useState("closed");
56790
56877
  React80.useEffect(() => {
56791
56878
  var _a2;
@@ -57070,12 +57157,21 @@ var GenericHeaderRenderer = (props) => {
57070
57157
  overlay: /* @__PURE__ */ React80.createElement(Tooltip.Content, { className: "auto-column-expand-tooltip-content" }, tooltipText[expansionVariant])
57071
57158
  },
57072
57159
  /* @__PURE__ */ React80.createElement(
57073
- "div",
57160
+ "button",
57074
57161
  {
57162
+ type: "button",
57163
+ ref: expandButtonRef,
57164
+ "aria-expanded": expansionVariant !== "closed",
57075
57165
  "aria-label": tooltipText[expansionVariant],
57076
57166
  className: "expand-button",
57077
57167
  onClick: onExpandToggle,
57078
- role: "button",
57168
+ onKeyDown: (e) => {
57169
+ if (e.key === "Enter" || e.key === " ") {
57170
+ e.preventDefault();
57171
+ e.stopPropagation();
57172
+ onExpandToggle(e);
57173
+ }
57174
+ },
57079
57175
  "data-qa": "expand-or-collapse-all-button"
57080
57176
  },
57081
57177
  /* @__PURE__ */ React80.createElement(ExpansionVariantIcon, { size: "sm" })
@@ -104671,11 +104767,10 @@ var ConfigurationColumns = React80.forwardRef(
104671
104767
  return columnDefs;
104672
104768
  }
104673
104769
  const columnDefinitionsMappedToDefs = columnDefinitions.map(
104674
- (colDef) => transformToColDef(
104675
- colDef,
104770
+ (colDef) => transformToColDef(colDef, {
104676
104771
  enableGroupEditAndValidation,
104677
104772
  enableDynamicRowHeight
104678
- )
104773
+ })
104679
104774
  );
104680
104775
  return toGroupedCols(columnDefinitionsMappedToDefs);
104681
104776
  });
@@ -104983,8 +105078,10 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
104983
105078
  alwaysAggregateAtRootLevel: !isServerSideRowModel,
104984
105079
  autoGroupColumnDef: getDecoratedAutoGroupColDef(
104985
105080
  detailRowConfig.autoGroupColumnDefinition,
104986
- enableGroupEditAndValidation,
104987
- enableDynamicRowHeight,
105081
+ {
105082
+ enableGroupEditAndValidation,
105083
+ enableDynamicRowHeight
105084
+ },
104988
105085
  isRowSelectable,
104989
105086
  false,
104990
105087
  detailRowConfig.groupsAlwaysExpanded ?? false,
@@ -104996,11 +105093,10 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
104996
105093
  },
104997
105094
  columnDefs: toGroupedCols(
104998
105095
  detailRowConfig.columnDefinitions.map(
104999
- (colDef) => transformToColDef(
105000
- colDef,
105096
+ (colDef) => transformToColDef(colDef, {
105001
105097
  enableGroupEditAndValidation,
105002
- colDef.autoHeight ?? enableDynamicRowHeight
105003
- )
105098
+ enableDynamicRowHeight: colDef.autoHeight ?? enableDynamicRowHeight
105099
+ })
105004
105100
  )
105005
105101
  ),
105006
105102
  groupsAlwaysExpanded: detailRowConfig.groupsAlwaysExpanded ?? false,
@@ -110155,11 +110251,16 @@ function getServerSideDatasource(onServerSideDataRequestCallbackRef, onEmptyResp
110155
110251
  };
110156
110252
  }
110157
110253
  var minimumColumnWidth = 140;
110254
+ function resolveGroupIncludeFooter(props, onSSDR) {
110255
+ if (props.enableGroupHeaderEdit) return false;
110256
+ if (!onSSDR && props.groupIncludeFooter === void 0) return true;
110257
+ return props.groupIncludeFooter;
110258
+ }
110158
110259
  function useComputeAgGridProps(props) {
110159
110260
  const internalTableContext = useInternalTableContext();
110160
110261
  const onSSDR = internalTableContext.onServerSideDataRequest;
110161
110262
  return {
110162
- groupIncludeFooter: !onSSDR && props.groupIncludeFooter === void 0 ? true : props.groupIncludeFooter,
110263
+ groupIncludeFooter: resolveGroupIncludeFooter(props, !!onSSDR),
110163
110264
  rowDragManaged: onSSDR ? false : props.rowDragManaged ?? true,
110164
110265
  rowModelType: onSSDR ? "serverSide" : void 0,
110165
110266
  groupSelectsChildren: (
@@ -110235,11 +110336,11 @@ var Table = (props) => {
110235
110336
  () => {
110236
110337
  var _a2;
110237
110338
  return (_a2 = internalTableContext.columnDefinitions) == null ? void 0 : _a2.map((colDef) => {
110238
- const newColDef = transformToColDef(
110239
- colDef,
110240
- internalTableContext.enableGroupEditAndValidation,
110241
- internalTableContext.enableDynamicRowHeight
110242
- );
110339
+ const newColDef = transformToColDef(colDef, {
110340
+ enableGroupEditAndValidation: internalTableContext.enableGroupEditAndValidation,
110341
+ enableDynamicRowHeight: internalTableContext.enableDynamicRowHeight,
110342
+ enableGroupHeaderEdit: props.enableGroupHeaderEdit
110343
+ });
110243
110344
  return {
110244
110345
  ...newColDef,
110245
110346
  editable: overrideEditable(colDef.editable)
@@ -110541,8 +110642,10 @@ var Table = (props) => {
110541
110642
  const decoratedAutoGroupColDef = React80.useMemo(
110542
110643
  () => getDecoratedAutoGroupColDef(
110543
110644
  props == null ? void 0 : props.autoGroupColumnDefinition,
110544
- internalTableContext.enableGroupEditAndValidation,
110545
- internalTableContext.enableDynamicRowHeight,
110645
+ {
110646
+ enableGroupEditAndValidation: internalTableContext.enableGroupEditAndValidation,
110647
+ enableDynamicRowHeight: internalTableContext.enableDynamicRowHeight
110648
+ },
110546
110649
  isRowSelectable,
110547
110650
  props.siblingGroupsRowSelectionDisabled,
110548
110651
  props.groupsAlwaysExpanded ?? false,