@procore/data-table 13.2.2 → 13.3.1

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.
@@ -55217,7 +55217,7 @@ function ClientSideRowCheckbox(props) {
55217
55217
  "data-qa": "rowCheckbox",
55218
55218
  onClick: noop2,
55219
55219
  onChange: () => {
55220
- props.node.setSelected(!selected);
55220
+ props.node.setSelected(!selected, void 0, "checkboxSelected");
55221
55221
  }
55222
55222
  }
55223
55223
  ));
@@ -55254,7 +55254,13 @@ function ServerSideRowCheckbox(props) {
55254
55254
  "data-qa": "rowCheckbox",
55255
55255
  onClick: noop2,
55256
55256
  onChange: () => {
55257
- props.node.isSelected() ? tableRef?.current?.deselectRows([props.node.id]) : tableRef?.current?.selectRows([props.node.id]);
55257
+ props.node.isSelected() ? tableRef?.current?.deselectRows(
55258
+ [props.node.id],
55259
+ "checkboxSelected"
55260
+ ) : tableRef?.current?.selectRows(
55261
+ [props.node.id],
55262
+ "checkboxSelected"
55263
+ );
55258
55264
  }
55259
55265
  }
55260
55266
  ));
@@ -56372,8 +56378,12 @@ var GenericHeaderRenderer = (props) => {
56372
56378
  if (!onSSDR || !isFirstColumn2 || !props.selectionSSREnabled) {
56373
56379
  return;
56374
56380
  }
56375
- function updateSelectAllCheckbox() {
56376
- const currentRows = getCurrentRows(props.api);
56381
+ function updateSelectAllCheckbox(e) {
56382
+ if (e.source === "uiSelectAll") {
56383
+ return;
56384
+ }
56385
+ const isPagination = Boolean(props.api.paginationGetRowCount());
56386
+ const currentRows = getCurrentRows(props.api, isPagination);
56377
56387
  const isAllSelected = currentRows.length && currentRows.every(isRowSelected);
56378
56388
  const isPartialSelected = !isAllSelected && currentRows.some(isRowSelected);
56379
56389
  if (isAllSelected) {
@@ -56390,18 +56400,35 @@ var GenericHeaderRenderer = (props) => {
56390
56400
  props.api.removeEventListener(selectionChanged, updateSelectAllCheckbox);
56391
56401
  props.api.removeEventListener(paginationChanged, updateSelectAllCheckbox);
56392
56402
  };
56393
- }, [isFirstColumn2, selectAll, props.selectionSSREnabled]);
56394
- const toggleSelectAll = () => {
56403
+ }, [isFirstColumn2, props.selectionSSREnabled, props.api, onSSDR]);
56404
+ const toggleSelectAll = React82.useCallback(() => {
56395
56405
  const nextSelectedState = selectAll === "all" /* All */ ? "none" /* None */ : "all" /* All */;
56396
56406
  setSelectAll(nextSelectedState);
56397
56407
  props.onSelectAll?.(nextSelectedState);
56398
56408
  const isSelectAll = nextSelectedState == "all" /* All */;
56399
56409
  if (props.selectionSSREnabled) {
56400
- isSelectAll ? tableRef?.current?.selectAll() : tableRef?.current?.deselectAll();
56410
+ const isPagination = Boolean(props.api.paginationGetRowCount());
56411
+ const rowsIdsToSelectOrDeselect = getCurrentRows(
56412
+ props.api,
56413
+ isPagination
56414
+ ).map((node) => node.id);
56415
+ isSelectAll ? tableRef?.current?.selectRows(
56416
+ rowsIdsToSelectOrDeselect,
56417
+ "uiSelectAll"
56418
+ ) : tableRef?.current?.deselectRows(
56419
+ rowsIdsToSelectOrDeselect,
56420
+ "uiSelectAll"
56421
+ );
56401
56422
  } else {
56402
56423
  isSelectAll ? props.api.selectAllFiltered() : props.api.deselectAllFiltered();
56403
56424
  }
56404
- };
56425
+ }, [
56426
+ setSelectAll,
56427
+ selectAll,
56428
+ props.onSelectAll,
56429
+ props.selectionSSREnabled,
56430
+ props.api
56431
+ ]);
56405
56432
  return /* @__PURE__ */ React82.createElement(
56406
56433
  Flex,
56407
56434
  {
@@ -56437,9 +56464,7 @@ var GenericHeaderRenderer = (props) => {
56437
56464
  checked: selectAll === "all" /* All */,
56438
56465
  indeterminate: selectAll === "partial",
56439
56466
  onClick: (e) => e.stopPropagation(),
56440
- onChange: () => {
56441
- toggleSelectAll();
56442
- }
56467
+ onChange: toggleSelectAll
56443
56468
  }
56444
56469
  ),
56445
56470
  /* @__PURE__ */ React82.createElement("div", { className: "ag-header-cell-label" }, /* @__PURE__ */ React82.createElement(
@@ -56511,6 +56536,20 @@ function GenericColumnGroupHeader(props) {
56511
56536
  ));
56512
56537
  }
56513
56538
 
56539
+ // src/utils/pagination.ts
56540
+ var getPaginationPageStartEnd = ({
56541
+ activePage,
56542
+ items: totalItems,
56543
+ perPage
56544
+ }) => {
56545
+ const numPages = Math.ceil(totalItems / perPage);
56546
+ const actualActivePage = numPages === 0 ? 0 : activePage + 1;
56547
+ return {
56548
+ end: Math.min(actualActivePage * perPage, totalItems),
56549
+ start: Math.max((actualActivePage - 1) * perPage, 0)
56550
+ };
56551
+ };
56552
+
56514
56553
  // src/utils/cellHelpers.tsx
56515
56554
  function withDataTableEditor(Component4, editorType) {
56516
56555
  return React82.forwardRef(
@@ -56590,7 +56629,7 @@ function getFrameworkComponents(headerMenuConfig, onSelectAll, selectionSSREnabl
56590
56629
  DefaultFrameworkComponents["autoGroupCellRenderer"] = AutoGroupCellRenderer;
56591
56630
  return { ...DefaultFrameworkComponents, ...customFrameworkComponents };
56592
56631
  }
56593
- function getCurrentRows(gridApi) {
56632
+ function getCurrentRows(gridApi, useCurrentPageOnly) {
56594
56633
  let currentRows = [];
56595
56634
  if (gridApi?.getModel()?.getType() === "clientSide") {
56596
56635
  gridApi?.forEachNodeAfterFilterAndSort((rowNode) => {
@@ -56600,6 +56639,16 @@ function getCurrentRows(gridApi) {
56600
56639
  gridApi?.forEachNode((rowNode) => {
56601
56640
  currentRows.push(rowNode);
56602
56641
  });
56642
+ if (useCurrentPageOnly) {
56643
+ const { start, end } = getPaginationPageStartEnd({
56644
+ items: gridApi?.paginationGetRowCount() || 0,
56645
+ perPage: gridApi?.paginationGetPageSize() || 0,
56646
+ activePage: gridApi?.paginationGetCurrentPage() || 0
56647
+ });
56648
+ return currentRows.filter(
56649
+ (row2) => row2.rowIndex >= start && row2.rowIndex < end
56650
+ );
56651
+ }
56603
56652
  }
56604
56653
  return currentRows;
56605
56654
  }
@@ -58708,10 +58757,8 @@ var useRowSelectionState = () => {
58708
58757
  }
58709
58758
  selectionEventFunction();
58710
58759
  gridApi?.addEventListener("selectionChanged", selectionEventFunction);
58711
- gridApi?.addEventListener("paginationChanged", selectionEventFunction);
58712
58760
  return () => {
58713
58761
  gridApi?.removeEventListener("selectionChanged", selectionEventFunction);
58714
- gridApi?.removeEventListener("paginationChanged", selectionEventFunction);
58715
58762
  };
58716
58763
  }, [gridApi]);
58717
58764
  return selectedRows;
@@ -79644,6 +79691,150 @@ var is_IS_default = {
79644
79691
  }
79645
79692
  };
79646
79693
 
79694
+ // src/locales/ja-JP.json
79695
+ var ja_JP_default = {
79696
+ dataTable: {
79697
+ emptyState: {
79698
+ noFilteredResults: {
79699
+ description: "\u30B9\u30DA\u30EB\u3068\u30D5\u30A3\u30EB\u30BF\u30FC\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u78BA\u8A8D\u3059\u308B\u304B\u3001\u5225\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u691C\u7D22\u3057\u307E\u3059\u3002",
79700
+ title: "\u691C\u7D22\u306B\u4E00\u81F4\u3059\u308B\u9805\u76EE\u306F\u3042\u308A\u307E\u305B\u3093",
79701
+ itemsTitle: "\u691C\u7D22\u306B\u4E00\u81F4\u3059\u308B%{itemsLabel}\u306F\u3042\u308A\u307E\u305B\u3093"
79702
+ },
79703
+ noResults: {
79704
+ description: "\u30C1\u30FC\u30E0\u304C\u3053\u308C\u3089\u306E\u9805\u76EE\u3092\u4F5C\u6210\u3057\u305F\u3089\u3001\u3053\u3061\u3089\u3067\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u3059\u3002 ",
79705
+ title: "\u73FE\u5728\u3001\u8868\u793A\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093",
79706
+ itemsTitle: "\u73FE\u5728\u3001\u8868\u793A\u3059\u308B%{itemsLabel}\u304C\u3042\u308A\u307E\u305B\u3093",
79707
+ tooltip: "\u60C5\u5831\u3092%{tableName}\u306B\u8FFD\u52A0\u3059\u308B\u3068\u3001[%{featureName}]\u30DC\u30BF\u30F3\u304C\u6709\u52B9\u306B\u306A\u308A\u307E\u3059",
79708
+ featureFilter: "\u30D5\u30A3\u30EB\u30BF\u30FC",
79709
+ featureSearch: "\u691C\u7D22",
79710
+ featureGroupBy: "\u30B0\u30EB\u30FC\u30D7\u5316",
79711
+ featureConfigure: "\u69CB\u6210",
79712
+ tableNameFallback: "\u8868"
79713
+ }
79714
+ },
79715
+ bulkActions: {
79716
+ apply: "\u9069\u7528\u3059\u308B",
79717
+ bulkEdit: "\u4E00\u62EC\u7DE8\u96C6",
79718
+ cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB",
79719
+ editValues: "\u5024\u3092\u7DE8\u96C6\u3059\u308B",
79720
+ error: "\u7533\u3057\u8A33\u3042\u308A\u307E\u305B\u3093\u304C\u3001\u9805\u76EE\u3092\u66F4\u65B0\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
79721
+ placeholderForField: "%{fieldName}\u3092\u5165\u529B\u3059\u308B",
79722
+ selection: "%{count}%{number}\u3092\u9078\u629E\u3057\u307E\u3057\u305F",
79723
+ success: "\u9805\u76EE\u306F\u6B63\u5E38\u306B\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F\u3002",
79724
+ one: "\u9805\u76EE",
79725
+ many: "\u9805\u76EE"
79726
+ },
79727
+ exporting: "\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u4E2D...",
79728
+ filters: {
79729
+ filters: "\u30D5\u30A3\u30EB\u30BF\u30FC",
79730
+ moreFilters: "\u305D\u306E\u4ED6\u306E\u30D5\u30A3\u30EB\u30BF\u30FC",
79731
+ clearAllFilters: "\u3059\u3079\u3066\u306E\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u30AF\u30EA\u30A2",
79732
+ close: "\u9589\u3058\u308B",
79733
+ locationFilter: {
79734
+ selectAll: "\u3059\u3079\u3066\u3092\u9078\u629E\u3059\u308B",
79735
+ includeSublocations: "\u30B5\u30D6\u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u3092\u542B\u3081\u308B",
79736
+ searchLocations: "\u5834\u6240\u3092\u691C\u7D22",
79737
+ locations: "\u5834\u6240"
79738
+ },
79739
+ numberFilter: {
79740
+ labels: {
79741
+ and: "\u305D\u3057\u3066",
79742
+ input_placeholder: "\u5024\u3092\u5165\u529B",
79743
+ placeholder: "\u9805\u76EE\u3092\u9078\u629E\u3059\u308B"
79744
+ },
79745
+ options: {
79746
+ any_value: "\u4EFB\u610F\u306E\u5024",
79747
+ is_between: "\u9593\u306B\u3042\u308B",
79748
+ greater_than: "\u3088\u308A\u5927\u304D\u3044",
79749
+ greater_than_equal_to: "\u4EE5\u4E0A\u3067\u3042\u308B",
79750
+ less_than: "\u672A\u6E80\u3067\u3042\u308B",
79751
+ less_than_equal_to: "\u4EE5\u4E0B\u3067\u3059",
79752
+ no_value: "\u5024\u304C\u3042\u308A\u307E\u305B\u3093"
79753
+ }
79754
+ }
79755
+ },
79756
+ loading: {
79757
+ initial: "\u60C5\u5831\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u3002",
79758
+ secondary: "\u60C5\u5831\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u3002\u3057\u3070\u3089\u304F\u304A\u5F85\u3061\u304F\u3060\u3055\u3044\u3002"
79759
+ },
79760
+ menuOptions: {
79761
+ sortMenuItem: {
79762
+ label: "\u3053\u306E\u5217\u3067\u4E26\u3079\u66FF\u3048\u308B",
79763
+ sortAscItem: "\u5217\u3092\u6607\u9806\u306B\u4E26\u3079\u66FF\u3048\u308B",
79764
+ sortDescItem: "\u5217\u3092\u964D\u9806\u306B\u4E26\u3079\u66FF\u3048\u308B",
79765
+ sortResetItem: "\u5217\u306F\u4E26\u3079\u66FF\u3048\u3089\u308C\u3066\u3044\u307E\u305B\u3093"
79766
+ },
79767
+ expandAllGroups: "\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u5C55\u958B\u3059\u308B",
79768
+ collapseAllGroups: "\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u6298\u308A\u305F\u305F\u3080",
79769
+ pinColumn: "\u5217\u3092\u30D4\u30F3\u7559\u3081\u3059\u308B",
79770
+ pinLeft: "\u5DE6\u5074\u3092\u30D4\u30F3\u7559\u3081\u3059\u308B",
79771
+ pinRight: "\u53F3\u5074\u3092\u30D4\u30F3\u7559\u3081\u3059\u308B",
79772
+ noPin: "\u30D4\u30F3\u7559\u3081\u306F\u3042\u308A\u307E\u305B\u3093",
79773
+ autoSizeThisColumn: "\u3053\u306E\u5217\u3092\u81EA\u52D5\u30B5\u30A4\u30BA\u8ABF\u6574\u3059\u308B",
79774
+ autoSizeAllColumns: "\u3059\u3079\u3066\u306E\u5217\u3092\u81EA\u52D5\u30B5\u30A4\u30BA\u8ABF\u6574\u3059\u308B",
79775
+ resetColumns: "\u5217\u3092\u30EA\u30BB\u30C3\u30C8\u3059\u308B",
79776
+ unGroupBy: "{{label}}\u3067\u30B0\u30EB\u30FC\u30D7\u5316\u3092\u89E3\u9664\u3059\u308B",
79777
+ groupBy: "{{label}}\u3067\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B"
79778
+ },
79779
+ grandTotals: "\u5358\u7D14\u96C6\u8A08",
79780
+ search: "\u691C\u7D22",
79781
+ subtotals: "\u5C0F\u8A08",
79782
+ tableSettings: {
79783
+ configureColumns: "\u5217\u3092\u69CB\u6210",
79784
+ resetToDefault: "\u3059\u3079\u3066\u3092\u8868\u793A\u3059\u308B",
79785
+ rowHeight: "\u5217\u306E\u9AD8\u3055",
79786
+ small: "\u5C0F",
79787
+ medium: "\u4E2D",
79788
+ large: "\u5927",
79789
+ tableSettings: "\u8868\u306E\u8A2D\u5B9A",
79790
+ groupBy: "\u30B0\u30EB\u30FC\u30D7\u5316:",
79791
+ reset: "\u30EA\u30BB\u30C3\u30C8",
79792
+ selectColumnGroup: "\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\u5217\u3092\u9078\u629E"
79793
+ },
79794
+ rowGroupToggle: {
79795
+ expandTierOne: "\u8868\u306E\u6700\u521D\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u958B\u304D\u307E\u3059\u3002",
79796
+ expandAll: "\u8868\u306E\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u958B\u304D\u307E\u3059\u3002",
79797
+ collapseAll: "\u8868\u306E\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u9589\u3058\u307E\u3059\u3002"
79798
+ },
79799
+ columnGroupToggle: {
79800
+ collapse: "\u5217\u30B0\u30EB\u30FC\u30D7\u3092\u6298\u308A\u7573\u3080",
79801
+ expand: "\u5217\u30B0\u30EB\u30FC\u30D7\u3092\u5C55\u958B\u3059\u308B"
79802
+ },
79803
+ cells: {
79804
+ textCell: {
79805
+ placeholder: "\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B\u3059\u308B"
79806
+ },
79807
+ currencyCell: {
79808
+ placeholder: "\u901A\u8CA8\u3092\u5165\u529B\u3059\u308B"
79809
+ },
79810
+ numberCell: {
79811
+ placeholder: "\u756A\u53F7\u3092\u5165\u529B\u3059\u308B"
79812
+ },
79813
+ percentCell: {
79814
+ placeholder: "%\u3092\u5165\u529B"
79815
+ },
79816
+ pillCell: {
79817
+ placeholder: "{{label}}\u3092\u9078\u629E\u3059\u308B"
79818
+ },
79819
+ selectCell: {
79820
+ placeholder: "{{label}}\u3092\u9078\u629E\u3059\u308B"
79821
+ },
79822
+ booleanCell: {
79823
+ options: {
79824
+ yes: "\u306F\u3044",
79825
+ no: "\u3044\u3044\u3048"
79826
+ }
79827
+ }
79828
+ },
79829
+ filterRenders: {
79830
+ dateFilter: {
79831
+ single: "\u5358\u72EC",
79832
+ range: "\u7BC4\u56F2"
79833
+ }
79834
+ }
79835
+ }
79836
+ };
79837
+
79647
79838
  // src/locales/pt-BR.json
79648
79839
  var pt_BR_default = {
79649
79840
  dataTable: {
@@ -80088,6 +80279,7 @@ var translations = {
80088
80279
  "fr-CA": fr_CA_default,
80089
80280
  "fr-FR": fr_FR_default,
80090
80281
  "is-IS": is_IS_default,
80282
+ "ja-JP": ja_JP_default,
80091
80283
  "pt-BR": pt_BR_default,
80092
80284
  "th-TH": th_TH_default,
80093
80285
  "zh-SG": zh_SG_default
@@ -80690,24 +80882,24 @@ var useTableApi = ({
80690
80882
  });
80691
80883
  };
80692
80884
  const selectRows = React82.useCallback(
80693
- (rowIds) => {
80885
+ (rowIds, source) => {
80694
80886
  rowIds?.forEach((id) => {
80695
80887
  const rowNode = gridApi?.getRowNode(id.toString());
80696
80888
  if (!rowNode)
80697
80889
  return;
80698
- rowNode.setSelected(true);
80890
+ rowNode.setSelected(true, void 0, source);
80699
80891
  onSelectionChanged(rowNode);
80700
80892
  });
80701
80893
  },
80702
80894
  [gridApi]
80703
80895
  );
80704
80896
  const deselectRows = React82.useCallback(
80705
- (rowIds) => {
80897
+ (rowIds, source) => {
80706
80898
  rowIds?.forEach((id) => {
80707
80899
  const rowNode = gridApi?.getRowNode(id.toString());
80708
80900
  if (!rowNode)
80709
80901
  return;
80710
- rowNode.setSelected(false);
80902
+ rowNode.setSelected(false, void 0, source);
80711
80903
  onSelectionChanged(rowNode);
80712
80904
  });
80713
80905
  },
@@ -82050,7 +82242,6 @@ var TablePagination = ({
82050
82242
  page: 0,
82051
82243
  items: 0
82052
82244
  });
82053
- const { rowSelectionRef } = useInternalTableContext();
82054
82245
  React82.useEffect(() => {
82055
82246
  function onPaginationChanged(params) {
82056
82247
  if (gridApi && params.api.paginationGetCurrentPage() !== pagination.page || pagination.items !== params.api.paginationGetRowCount()) {
@@ -82058,10 +82249,6 @@ var TablePagination = ({
82058
82249
  page: params.api.paginationGetCurrentPage(),
82059
82250
  items: params.api.paginationGetRowCount()
82060
82251
  });
82061
- if (params.api.getModel().getType() === "serverSide") {
82062
- rowSelectionRef?.current?.affectedRows && (rowSelectionRef.current.affectedRows = {});
82063
- gridApi?.deselectAll();
82064
- }
82065
82252
  }
82066
82253
  }
82067
82254
  gridApi?.addEventListener("paginationChanged", onPaginationChanged);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/data-table",
3
- "version": "13.2.2",
3
+ "version": "13.3.1",
4
4
  "description": "Complex data grid built on top of ag-grid, with DST components and styles.",
5
5
  "main": "dist/legacy/index.js",
6
6
  "module": "dist/legacy/index.mjs",
@@ -103,7 +103,7 @@
103
103
  "@procore/core-css": "10.17.0",
104
104
  "@procore/core-icons": "12.0.0",
105
105
  "@procore/core-prettier": "10.2.0",
106
- "@procore/core-react": "11.31.0",
106
+ "@procore/core-react": "11.33.0",
107
107
  "@procore/eslint-config": "10.0.0",
108
108
  "@procore/labs-financials-utils": "3.0.1",
109
109
  "@procore/labs-procore-environment": "3.2.0",