@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.
@@ -55232,7 +55232,7 @@ function ClientSideRowCheckbox(props) {
55232
55232
  "data-qa": "rowCheckbox",
55233
55233
  onClick: noop2,
55234
55234
  onChange: () => {
55235
- props.node.setSelected(!selected);
55235
+ props.node.setSelected(!selected, void 0, "checkboxSelected");
55236
55236
  }
55237
55237
  }
55238
55238
  ));
@@ -55269,7 +55269,13 @@ function ServerSideRowCheckbox(props) {
55269
55269
  "data-qa": "rowCheckbox",
55270
55270
  onClick: noop2,
55271
55271
  onChange: () => {
55272
- props.node.isSelected() ? tableRef?.current?.deselectRows([props.node.id]) : tableRef?.current?.selectRows([props.node.id]);
55272
+ props.node.isSelected() ? tableRef?.current?.deselectRows(
55273
+ [props.node.id],
55274
+ "checkboxSelected"
55275
+ ) : tableRef?.current?.selectRows(
55276
+ [props.node.id],
55277
+ "checkboxSelected"
55278
+ );
55273
55279
  }
55274
55280
  }
55275
55281
  ));
@@ -56387,8 +56393,12 @@ var GenericHeaderRenderer = (props) => {
56387
56393
  if (!onSSDR || !isFirstColumn2 || !props.selectionSSREnabled) {
56388
56394
  return;
56389
56395
  }
56390
- function updateSelectAllCheckbox() {
56391
- const currentRows = getCurrentRows(props.api);
56396
+ function updateSelectAllCheckbox(e) {
56397
+ if (e.source === "uiSelectAll") {
56398
+ return;
56399
+ }
56400
+ const isPagination = Boolean(props.api.paginationGetRowCount());
56401
+ const currentRows = getCurrentRows(props.api, isPagination);
56392
56402
  const isAllSelected = currentRows.length && currentRows.every(isRowSelected);
56393
56403
  const isPartialSelected = !isAllSelected && currentRows.some(isRowSelected);
56394
56404
  if (isAllSelected) {
@@ -56405,18 +56415,35 @@ var GenericHeaderRenderer = (props) => {
56405
56415
  props.api.removeEventListener(selectionChanged, updateSelectAllCheckbox);
56406
56416
  props.api.removeEventListener(paginationChanged, updateSelectAllCheckbox);
56407
56417
  };
56408
- }, [isFirstColumn2, selectAll, props.selectionSSREnabled]);
56409
- const toggleSelectAll = () => {
56418
+ }, [isFirstColumn2, props.selectionSSREnabled, props.api, onSSDR]);
56419
+ const toggleSelectAll = React82__default.default.useCallback(() => {
56410
56420
  const nextSelectedState = selectAll === "all" /* All */ ? "none" /* None */ : "all" /* All */;
56411
56421
  setSelectAll(nextSelectedState);
56412
56422
  props.onSelectAll?.(nextSelectedState);
56413
56423
  const isSelectAll = nextSelectedState == "all" /* All */;
56414
56424
  if (props.selectionSSREnabled) {
56415
- isSelectAll ? tableRef?.current?.selectAll() : tableRef?.current?.deselectAll();
56425
+ const isPagination = Boolean(props.api.paginationGetRowCount());
56426
+ const rowsIdsToSelectOrDeselect = getCurrentRows(
56427
+ props.api,
56428
+ isPagination
56429
+ ).map((node) => node.id);
56430
+ isSelectAll ? tableRef?.current?.selectRows(
56431
+ rowsIdsToSelectOrDeselect,
56432
+ "uiSelectAll"
56433
+ ) : tableRef?.current?.deselectRows(
56434
+ rowsIdsToSelectOrDeselect,
56435
+ "uiSelectAll"
56436
+ );
56416
56437
  } else {
56417
56438
  isSelectAll ? props.api.selectAllFiltered() : props.api.deselectAllFiltered();
56418
56439
  }
56419
- };
56440
+ }, [
56441
+ setSelectAll,
56442
+ selectAll,
56443
+ props.onSelectAll,
56444
+ props.selectionSSREnabled,
56445
+ props.api
56446
+ ]);
56420
56447
  return /* @__PURE__ */ React82__default.default.createElement(
56421
56448
  coreReact.Flex,
56422
56449
  {
@@ -56452,9 +56479,7 @@ var GenericHeaderRenderer = (props) => {
56452
56479
  checked: selectAll === "all" /* All */,
56453
56480
  indeterminate: selectAll === "partial",
56454
56481
  onClick: (e) => e.stopPropagation(),
56455
- onChange: () => {
56456
- toggleSelectAll();
56457
- }
56482
+ onChange: toggleSelectAll
56458
56483
  }
56459
56484
  ),
56460
56485
  /* @__PURE__ */ React82__default.default.createElement("div", { className: "ag-header-cell-label" }, /* @__PURE__ */ React82__default.default.createElement(
@@ -56526,6 +56551,20 @@ function GenericColumnGroupHeader(props) {
56526
56551
  ));
56527
56552
  }
56528
56553
 
56554
+ // src/utils/pagination.ts
56555
+ var getPaginationPageStartEnd = ({
56556
+ activePage,
56557
+ items: totalItems,
56558
+ perPage
56559
+ }) => {
56560
+ const numPages = Math.ceil(totalItems / perPage);
56561
+ const actualActivePage = numPages === 0 ? 0 : activePage + 1;
56562
+ return {
56563
+ end: Math.min(actualActivePage * perPage, totalItems),
56564
+ start: Math.max((actualActivePage - 1) * perPage, 0)
56565
+ };
56566
+ };
56567
+
56529
56568
  // src/utils/cellHelpers.tsx
56530
56569
  function withDataTableEditor(Component4, editorType) {
56531
56570
  return React82__default.default.forwardRef(
@@ -56605,7 +56644,7 @@ function getFrameworkComponents(headerMenuConfig, onSelectAll, selectionSSREnabl
56605
56644
  DefaultFrameworkComponents["autoGroupCellRenderer"] = AutoGroupCellRenderer;
56606
56645
  return { ...DefaultFrameworkComponents, ...customFrameworkComponents };
56607
56646
  }
56608
- function getCurrentRows(gridApi) {
56647
+ function getCurrentRows(gridApi, useCurrentPageOnly) {
56609
56648
  let currentRows = [];
56610
56649
  if (gridApi?.getModel()?.getType() === "clientSide") {
56611
56650
  gridApi?.forEachNodeAfterFilterAndSort((rowNode) => {
@@ -56615,6 +56654,16 @@ function getCurrentRows(gridApi) {
56615
56654
  gridApi?.forEachNode((rowNode) => {
56616
56655
  currentRows.push(rowNode);
56617
56656
  });
56657
+ if (useCurrentPageOnly) {
56658
+ const { start, end } = getPaginationPageStartEnd({
56659
+ items: gridApi?.paginationGetRowCount() || 0,
56660
+ perPage: gridApi?.paginationGetPageSize() || 0,
56661
+ activePage: gridApi?.paginationGetCurrentPage() || 0
56662
+ });
56663
+ return currentRows.filter(
56664
+ (row2) => row2.rowIndex >= start && row2.rowIndex < end
56665
+ );
56666
+ }
56618
56667
  }
56619
56668
  return currentRows;
56620
56669
  }
@@ -58723,10 +58772,8 @@ var useRowSelectionState = () => {
58723
58772
  }
58724
58773
  selectionEventFunction();
58725
58774
  gridApi?.addEventListener("selectionChanged", selectionEventFunction);
58726
- gridApi?.addEventListener("paginationChanged", selectionEventFunction);
58727
58775
  return () => {
58728
58776
  gridApi?.removeEventListener("selectionChanged", selectionEventFunction);
58729
- gridApi?.removeEventListener("paginationChanged", selectionEventFunction);
58730
58777
  };
58731
58778
  }, [gridApi]);
58732
58779
  return selectedRows;
@@ -79659,6 +79706,150 @@ var is_IS_default = {
79659
79706
  }
79660
79707
  };
79661
79708
 
79709
+ // src/locales/ja-JP.json
79710
+ var ja_JP_default = {
79711
+ dataTable: {
79712
+ emptyState: {
79713
+ noFilteredResults: {
79714
+ 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",
79715
+ title: "\u691C\u7D22\u306B\u4E00\u81F4\u3059\u308B\u9805\u76EE\u306F\u3042\u308A\u307E\u305B\u3093",
79716
+ itemsTitle: "\u691C\u7D22\u306B\u4E00\u81F4\u3059\u308B%{itemsLabel}\u306F\u3042\u308A\u307E\u305B\u3093"
79717
+ },
79718
+ noResults: {
79719
+ 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 ",
79720
+ title: "\u73FE\u5728\u3001\u8868\u793A\u3059\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093",
79721
+ itemsTitle: "\u73FE\u5728\u3001\u8868\u793A\u3059\u308B%{itemsLabel}\u304C\u3042\u308A\u307E\u305B\u3093",
79722
+ tooltip: "\u60C5\u5831\u3092%{tableName}\u306B\u8FFD\u52A0\u3059\u308B\u3068\u3001[%{featureName}]\u30DC\u30BF\u30F3\u304C\u6709\u52B9\u306B\u306A\u308A\u307E\u3059",
79723
+ featureFilter: "\u30D5\u30A3\u30EB\u30BF\u30FC",
79724
+ featureSearch: "\u691C\u7D22",
79725
+ featureGroupBy: "\u30B0\u30EB\u30FC\u30D7\u5316",
79726
+ featureConfigure: "\u69CB\u6210",
79727
+ tableNameFallback: "\u8868"
79728
+ }
79729
+ },
79730
+ bulkActions: {
79731
+ apply: "\u9069\u7528\u3059\u308B",
79732
+ bulkEdit: "\u4E00\u62EC\u7DE8\u96C6",
79733
+ cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB",
79734
+ editValues: "\u5024\u3092\u7DE8\u96C6\u3059\u308B",
79735
+ 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",
79736
+ placeholderForField: "%{fieldName}\u3092\u5165\u529B\u3059\u308B",
79737
+ selection: "%{count}%{number}\u3092\u9078\u629E\u3057\u307E\u3057\u305F",
79738
+ success: "\u9805\u76EE\u306F\u6B63\u5E38\u306B\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F\u3002",
79739
+ one: "\u9805\u76EE",
79740
+ many: "\u9805\u76EE"
79741
+ },
79742
+ exporting: "\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u4E2D...",
79743
+ filters: {
79744
+ filters: "\u30D5\u30A3\u30EB\u30BF\u30FC",
79745
+ moreFilters: "\u305D\u306E\u4ED6\u306E\u30D5\u30A3\u30EB\u30BF\u30FC",
79746
+ clearAllFilters: "\u3059\u3079\u3066\u306E\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u30AF\u30EA\u30A2",
79747
+ close: "\u9589\u3058\u308B",
79748
+ locationFilter: {
79749
+ selectAll: "\u3059\u3079\u3066\u3092\u9078\u629E\u3059\u308B",
79750
+ includeSublocations: "\u30B5\u30D6\u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u3092\u542B\u3081\u308B",
79751
+ searchLocations: "\u5834\u6240\u3092\u691C\u7D22",
79752
+ locations: "\u5834\u6240"
79753
+ },
79754
+ numberFilter: {
79755
+ labels: {
79756
+ and: "\u305D\u3057\u3066",
79757
+ input_placeholder: "\u5024\u3092\u5165\u529B",
79758
+ placeholder: "\u9805\u76EE\u3092\u9078\u629E\u3059\u308B"
79759
+ },
79760
+ options: {
79761
+ any_value: "\u4EFB\u610F\u306E\u5024",
79762
+ is_between: "\u9593\u306B\u3042\u308B",
79763
+ greater_than: "\u3088\u308A\u5927\u304D\u3044",
79764
+ greater_than_equal_to: "\u4EE5\u4E0A\u3067\u3042\u308B",
79765
+ less_than: "\u672A\u6E80\u3067\u3042\u308B",
79766
+ less_than_equal_to: "\u4EE5\u4E0B\u3067\u3059",
79767
+ no_value: "\u5024\u304C\u3042\u308A\u307E\u305B\u3093"
79768
+ }
79769
+ }
79770
+ },
79771
+ loading: {
79772
+ initial: "\u60C5\u5831\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u3002",
79773
+ 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"
79774
+ },
79775
+ menuOptions: {
79776
+ sortMenuItem: {
79777
+ label: "\u3053\u306E\u5217\u3067\u4E26\u3079\u66FF\u3048\u308B",
79778
+ sortAscItem: "\u5217\u3092\u6607\u9806\u306B\u4E26\u3079\u66FF\u3048\u308B",
79779
+ sortDescItem: "\u5217\u3092\u964D\u9806\u306B\u4E26\u3079\u66FF\u3048\u308B",
79780
+ sortResetItem: "\u5217\u306F\u4E26\u3079\u66FF\u3048\u3089\u308C\u3066\u3044\u307E\u305B\u3093"
79781
+ },
79782
+ expandAllGroups: "\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u5C55\u958B\u3059\u308B",
79783
+ collapseAllGroups: "\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u6298\u308A\u305F\u305F\u3080",
79784
+ pinColumn: "\u5217\u3092\u30D4\u30F3\u7559\u3081\u3059\u308B",
79785
+ pinLeft: "\u5DE6\u5074\u3092\u30D4\u30F3\u7559\u3081\u3059\u308B",
79786
+ pinRight: "\u53F3\u5074\u3092\u30D4\u30F3\u7559\u3081\u3059\u308B",
79787
+ noPin: "\u30D4\u30F3\u7559\u3081\u306F\u3042\u308A\u307E\u305B\u3093",
79788
+ autoSizeThisColumn: "\u3053\u306E\u5217\u3092\u81EA\u52D5\u30B5\u30A4\u30BA\u8ABF\u6574\u3059\u308B",
79789
+ autoSizeAllColumns: "\u3059\u3079\u3066\u306E\u5217\u3092\u81EA\u52D5\u30B5\u30A4\u30BA\u8ABF\u6574\u3059\u308B",
79790
+ resetColumns: "\u5217\u3092\u30EA\u30BB\u30C3\u30C8\u3059\u308B",
79791
+ unGroupBy: "{{label}}\u3067\u30B0\u30EB\u30FC\u30D7\u5316\u3092\u89E3\u9664\u3059\u308B",
79792
+ groupBy: "{{label}}\u3067\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B"
79793
+ },
79794
+ grandTotals: "\u5358\u7D14\u96C6\u8A08",
79795
+ search: "\u691C\u7D22",
79796
+ subtotals: "\u5C0F\u8A08",
79797
+ tableSettings: {
79798
+ configureColumns: "\u5217\u3092\u69CB\u6210",
79799
+ resetToDefault: "\u3059\u3079\u3066\u3092\u8868\u793A\u3059\u308B",
79800
+ rowHeight: "\u5217\u306E\u9AD8\u3055",
79801
+ small: "\u5C0F",
79802
+ medium: "\u4E2D",
79803
+ large: "\u5927",
79804
+ tableSettings: "\u8868\u306E\u8A2D\u5B9A",
79805
+ groupBy: "\u30B0\u30EB\u30FC\u30D7\u5316:",
79806
+ reset: "\u30EA\u30BB\u30C3\u30C8",
79807
+ selectColumnGroup: "\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\u5217\u3092\u9078\u629E"
79808
+ },
79809
+ rowGroupToggle: {
79810
+ expandTierOne: "\u8868\u306E\u6700\u521D\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u958B\u304D\u307E\u3059\u3002",
79811
+ expandAll: "\u8868\u306E\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u958B\u304D\u307E\u3059\u3002",
79812
+ collapseAll: "\u8868\u306E\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u9589\u3058\u307E\u3059\u3002"
79813
+ },
79814
+ columnGroupToggle: {
79815
+ collapse: "\u5217\u30B0\u30EB\u30FC\u30D7\u3092\u6298\u308A\u7573\u3080",
79816
+ expand: "\u5217\u30B0\u30EB\u30FC\u30D7\u3092\u5C55\u958B\u3059\u308B"
79817
+ },
79818
+ cells: {
79819
+ textCell: {
79820
+ placeholder: "\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B\u3059\u308B"
79821
+ },
79822
+ currencyCell: {
79823
+ placeholder: "\u901A\u8CA8\u3092\u5165\u529B\u3059\u308B"
79824
+ },
79825
+ numberCell: {
79826
+ placeholder: "\u756A\u53F7\u3092\u5165\u529B\u3059\u308B"
79827
+ },
79828
+ percentCell: {
79829
+ placeholder: "%\u3092\u5165\u529B"
79830
+ },
79831
+ pillCell: {
79832
+ placeholder: "{{label}}\u3092\u9078\u629E\u3059\u308B"
79833
+ },
79834
+ selectCell: {
79835
+ placeholder: "{{label}}\u3092\u9078\u629E\u3059\u308B"
79836
+ },
79837
+ booleanCell: {
79838
+ options: {
79839
+ yes: "\u306F\u3044",
79840
+ no: "\u3044\u3044\u3048"
79841
+ }
79842
+ }
79843
+ },
79844
+ filterRenders: {
79845
+ dateFilter: {
79846
+ single: "\u5358\u72EC",
79847
+ range: "\u7BC4\u56F2"
79848
+ }
79849
+ }
79850
+ }
79851
+ };
79852
+
79662
79853
  // src/locales/pt-BR.json
79663
79854
  var pt_BR_default = {
79664
79855
  dataTable: {
@@ -80103,6 +80294,7 @@ var translations = {
80103
80294
  "fr-CA": fr_CA_default,
80104
80295
  "fr-FR": fr_FR_default,
80105
80296
  "is-IS": is_IS_default,
80297
+ "ja-JP": ja_JP_default,
80106
80298
  "pt-BR": pt_BR_default,
80107
80299
  "th-TH": th_TH_default,
80108
80300
  "zh-SG": zh_SG_default
@@ -80705,24 +80897,24 @@ var useTableApi = ({
80705
80897
  });
80706
80898
  };
80707
80899
  const selectRows = React82__default.default.useCallback(
80708
- (rowIds) => {
80900
+ (rowIds, source) => {
80709
80901
  rowIds?.forEach((id) => {
80710
80902
  const rowNode = gridApi?.getRowNode(id.toString());
80711
80903
  if (!rowNode)
80712
80904
  return;
80713
- rowNode.setSelected(true);
80905
+ rowNode.setSelected(true, void 0, source);
80714
80906
  onSelectionChanged(rowNode);
80715
80907
  });
80716
80908
  },
80717
80909
  [gridApi]
80718
80910
  );
80719
80911
  const deselectRows = React82__default.default.useCallback(
80720
- (rowIds) => {
80912
+ (rowIds, source) => {
80721
80913
  rowIds?.forEach((id) => {
80722
80914
  const rowNode = gridApi?.getRowNode(id.toString());
80723
80915
  if (!rowNode)
80724
80916
  return;
80725
- rowNode.setSelected(false);
80917
+ rowNode.setSelected(false, void 0, source);
80726
80918
  onSelectionChanged(rowNode);
80727
80919
  });
80728
80920
  },
@@ -82065,7 +82257,6 @@ var TablePagination = ({
82065
82257
  page: 0,
82066
82258
  items: 0
82067
82259
  });
82068
- const { rowSelectionRef } = useInternalTableContext();
82069
82260
  React82__default.default.useEffect(() => {
82070
82261
  function onPaginationChanged(params) {
82071
82262
  if (gridApi && params.api.paginationGetCurrentPage() !== pagination.page || pagination.items !== params.api.paginationGetRowCount()) {
@@ -82073,10 +82264,6 @@ var TablePagination = ({
82073
82264
  page: params.api.paginationGetCurrentPage(),
82074
82265
  items: params.api.paginationGetRowCount()
82075
82266
  });
82076
- if (params.api.getModel().getType() === "serverSide") {
82077
- rowSelectionRef?.current?.affectedRows && (rowSelectionRef.current.affectedRows = {});
82078
- gridApi?.deselectAll();
82079
- }
82080
82267
  }
82081
82268
  }
82082
82269
  gridApi?.addEventListener("paginationChanged", onPaginationChanged);