@procore/data-table 14.33.0 → 14.35.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.
@@ -10,6 +10,7 @@ import { formatNumber, formatCurrency, formatPercentage } from '@procore/labs-fi
10
10
  import styled4, { css as css$1 } from 'styled-components';
11
11
  import { format } from '@procore/labs-financials-utils/dist/format';
12
12
  import { detectPrng, factory } from 'ulid';
13
+ import { isCDNFeatureFlagEnabled, useRequestTranslations } from '@procore/cdn-translations';
13
14
  import { useToastAlertContext, ToastAlertProvider } from '@procore/toast-alert';
14
15
  import ReactDOM, { createPortal } from 'react-dom';
15
16
  import { renderToString, renderToStaticMarkup } from 'react-dom/server';
@@ -55348,15 +55349,12 @@ function getSelectedState(node, affectedRows) {
55348
55349
  const self = affectedRows[node.id];
55349
55350
  if (self?.selectedState === "selected") {
55350
55351
  return true;
55351
- } else if (node.parent && !isNodeRootLevelOfGrid(node.parent) && affectedRows[node.parent.id]?.selectedState === "selected") {
55352
- node.setSelected(true, void 0, self?.selectedState);
55353
- affectedRows[node.id] = {
55354
- node,
55355
- selectedState: "selected"
55356
- };
55352
+ } else if (node.isSelected()) {
55353
+ node.setSelected(true, void 0);
55354
+ affectedRows[node.id] = { node, selectedState: "selected" };
55357
55355
  return true;
55358
55356
  } else {
55359
- return !!node.isSelected();
55357
+ return false;
55360
55358
  }
55361
55359
  }
55362
55360
  function getCheckboxState(node, isServerSideDataRequest, rowSelectionRef) {
@@ -55885,7 +55883,12 @@ var DataTableCellRenderer = ({
55885
55883
  }),
55886
55884
  [column2, node]
55887
55885
  );
55888
- const tooltipProps = columnDefinition.cellRendererParams?.tooltipParams;
55886
+ const rawTooltipParams = columnDefinition.cellRendererParams?.tooltipParams;
55887
+ const tooltipProps = typeof rawTooltipParams === "function" ? rawTooltipParams({
55888
+ data,
55889
+ value,
55890
+ node: serializeNode(node)
55891
+ }) : rawTooltipParams;
55889
55892
  if (tooltipProps) {
55890
55893
  return /* @__PURE__ */ React80.createElement(CellTooltipWrapper, { tooltipProps }, /* @__PURE__ */ React80.createElement(
55891
55894
  CellContent,
@@ -104421,6 +104424,11 @@ var de_DE_default = {
104421
104424
  error: "Entschuldigung, die Elemente konnten nicht aktualisiert werden. Versuchen Sie es noch einmal.",
104422
104425
  placeholderForField: "%{fieldName} eingeben",
104423
104426
  selection: "%{count} %{number} ausgew\xE4hlt",
104427
+ selection_count: {
104428
+ zero: "%{count} Elemente ausgew\xE4hlt",
104429
+ one: "%{count} Element ausgew\xE4hlt",
104430
+ other: "%{count} Elemente ausgew\xE4hlt"
104431
+ },
104424
104432
  success: "Die Elemente wurden erfolgreich aktualisiert.",
104425
104433
  one: "Element",
104426
104434
  many: "Elemente"
@@ -104587,6 +104595,11 @@ var en_AU_default = {
104587
104595
  error: "Sorry, the items couldn't be updated. Try again.",
104588
104596
  placeholderForField: "Enter %{fieldName}",
104589
104597
  selection: "%{count} %{number} selected",
104598
+ selection_count: {
104599
+ zero: "%{count} items selected",
104600
+ one: "%{count} item selected",
104601
+ other: "%{count} items selected"
104602
+ },
104590
104603
  success: "The items were successfully updated.",
104591
104604
  one: "item",
104592
104605
  many: "items"
@@ -104753,6 +104766,11 @@ var en_CA_default = {
104753
104766
  error: "Sorry, the items couldn't be updated. Try again.",
104754
104767
  placeholderForField: "Enter %{fieldName}",
104755
104768
  selection: "%{count} %{number} selected",
104769
+ selection_count: {
104770
+ zero: "%{count} items selected",
104771
+ one: "%{count} item selected",
104772
+ other: "%{count} items selected"
104773
+ },
104756
104774
  success: "The items were successfully updated.",
104757
104775
  one: "item",
104758
104776
  many: "items"
@@ -104919,6 +104937,11 @@ var en_GB_default = {
104919
104937
  error: "Sorry, the items couldn't be updated. Try again.",
104920
104938
  placeholderForField: "Enter %{fieldName}",
104921
104939
  selection: "%{count} %{number} selected",
104940
+ selection_count: {
104941
+ zero: "%{count} items selected",
104942
+ one: "%{count} item selected",
104943
+ other: "%{count} items selected"
104944
+ },
104922
104945
  success: "The items were successfully updated.",
104923
104946
  one: "item",
104924
104947
  many: "items"
@@ -105256,6 +105279,11 @@ var es_ES_default = {
105256
105279
  error: "No se han podido actualizar los elementos. Int\xE9ntelo de nuevo.",
105257
105280
  placeholderForField: "Introducir %{fieldName}",
105258
105281
  selection: "%{count} %{number} seleccionados",
105282
+ selection_count: {
105283
+ zero: "%{count} elementos seleccionados",
105284
+ one: "%{count} elemento seleccionado",
105285
+ other: "%{count} elementos seleccionados"
105286
+ },
105259
105287
  success: "Los elementos se han actualizado correctamente.",
105260
105288
  one: "elemento",
105261
105289
  many: "elementos"
@@ -105422,6 +105450,11 @@ var es_default = {
105422
105450
  error: "Lo sentimos, no se pudieron actualizar los \xEDtems. Int\xE9ntelo de nuevo.",
105423
105451
  placeholderForField: "Ingrese %{fieldName}",
105424
105452
  selection: "%{count} %{number} seleccionado",
105453
+ selection_count: {
105454
+ zero: "%{count} \xEDtems seleccionados",
105455
+ one: "%{count} \xEDtem seleccionado",
105456
+ other: "%{count} \xEDtems seleccionados"
105457
+ },
105425
105458
  success: "Los \xEDtems se actualizaron correctamente.",
105426
105459
  one: "\xEDtem",
105427
105460
  many: "\xEDtems"
@@ -105588,6 +105621,11 @@ var fr_CA_default = {
105588
105621
  error: "D\xE9sol\xE9, les items n'ont pas pu \xEAtre mis \xE0 jour. Veuillez r\xE9essayer.",
105589
105622
  placeholderForField: "Entrez %{fieldName}",
105590
105623
  selection: "%{count} %{number} s\xE9lectionn\xE9",
105624
+ selection_count: {
105625
+ zero: "%{count}\xA0items s\xE9lectionn\xE9s",
105626
+ one: "%{count}\xA0item s\xE9lectionn\xE9",
105627
+ other: "%{count}\xA0items s\xE9lectionn\xE9s"
105628
+ },
105591
105629
  success: "Les items ont \xE9t\xE9 mis \xE0 jour avec succ\xE8s.",
105592
105630
  one: "Item",
105593
105631
  many: "items"
@@ -105754,6 +105792,11 @@ var fr_FR_default = {
105754
105792
  error: "D\xE9sol\xE9, les \xE9l\xE9ments n'ont pas pu \xEAtre mis \xE0 jour. Veuillez r\xE9essayer.",
105755
105793
  placeholderForField: "Saisissez %{fieldName}",
105756
105794
  selection: "%{count} %{number} s\xE9lectionn\xE9",
105795
+ selection_count: {
105796
+ zero: "%{count}\xA0\xE9l\xE9ments s\xE9lectionn\xE9s",
105797
+ one: "%{count}\xA0\xE9l\xE9ment s\xE9lectionn\xE9",
105798
+ other: "%{count}\xA0\xE9l\xE9ments s\xE9lectionn\xE9s"
105799
+ },
105757
105800
  success: "Les \xE9l\xE9ments ont bien \xE9t\xE9 mis \xE0 jour.",
105758
105801
  one: "\xE9l\xE9ment",
105759
105802
  many: "\xE9l\xE9ments"
@@ -105920,6 +105963,11 @@ var is_IS_default = {
105920
105963
  error: "\xDEv\xED mi\xF0ur var ekki h\xE6gt a\xF0 uppf\xE6ra atri\xF0in. Reyndu aftur.",
105921
105964
  placeholderForField: "Sl\xE1\xF0u inn %{fieldName}",
105922
105965
  selection: "%{count} %{number} valinn",
105966
+ selection_count: {
105967
+ zero: "%{count} atri\xF0i valin",
105968
+ one: "%{count} atri\xF0i vali\xF0",
105969
+ other: "%{count} atri\xF0i valin"
105970
+ },
105923
105971
  success: "Atri\xF0in voru uppf\xE6r\xF0.",
105924
105972
  one: "Atri\xF0i",
105925
105973
  many: "Hlutir"
@@ -106086,6 +106134,11 @@ var ja_JP_default = {
106086
106134
  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",
106087
106135
  placeholderForField: "%{fieldName}\u3092\u5165\u529B",
106088
106136
  selection: "%{count}%{number}\u3092\u9078\u629E\u3057\u307E\u3057\u305F",
106137
+ selection_count: {
106138
+ zero: "%{count}\u500B\u306E\u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F",
106139
+ one: "%{count}\u500B\u306E\u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F",
106140
+ other: "%{count}\u500B\u306E\u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F"
106141
+ },
106089
106142
  success: "\u9805\u76EE\u3092\u6B63\u5E38\u306B\u66F4\u65B0\u3057\u307E\u3057\u305F\u3002",
106090
106143
  one: "\u9805\u76EE",
106091
106144
  many: "\u9805\u76EE"
@@ -106252,6 +106305,11 @@ var pl_PL_default = {
106252
106305
  error: "Przepraszamy, nie mo\u017Cna zaktualizowa\u0107 pozycji. Spr\xF3buj ponownie.",
106253
106306
  placeholderForField: "Wprowad\u017A %{fieldName}",
106254
106307
  selection: "Wybrano %{count} %{number}",
106308
+ selection_count: {
106309
+ zero: "Wybrano pozycje: %{count}",
106310
+ one: "Wybrano pozycji: %{count}",
106311
+ other: "Wybrano pozycje: %{count}"
106312
+ },
106255
106313
  success: "Pozycje zosta\u0142y pomy\u015Blnie zaktualizowane.",
106256
106314
  one: "pozycja",
106257
106315
  many: "pozycje"
@@ -106589,6 +106647,11 @@ var pt_BR_default = {
106589
106647
  error: "Sentimos muito, mas n\xE3o foi poss\xEDvel atualizar os itens. Tente novamente.",
106590
106648
  placeholderForField: "Digite %{fieldName}",
106591
106649
  selection: "%{count} %{number} selecionado",
106650
+ selection_count: {
106651
+ zero: "%{count} itens selecionados",
106652
+ one: "%{count} item selecionado",
106653
+ other: "%{count} itens selecionados"
106654
+ },
106592
106655
  success: "Os itens foram atualizados com sucesso.",
106593
106656
  one: "item",
106594
106657
  many: "itens"
@@ -106755,6 +106818,11 @@ var th_TH_default = {
106755
106818
  error: "\u0E02\u0E2D\u0E2D\u0E20\u0E31\u0E22 \u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E2D\u0E31\u0E1B\u0E40\u0E14\u0E15\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E44\u0E14\u0E49 \u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07.",
106756
106819
  placeholderForField: "\u0E1B\u0E49\u0E2D\u0E19 %{fieldName}",
106757
106820
  selection: "%{count} %{number} \u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01",
106821
+ selection_count: {
106822
+ zero: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27 %{count} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",
106823
+ one: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27 %{count} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",
106824
+ other: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27 %{count} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"
106825
+ },
106758
106826
  success: "\u0E2D\u0E31\u0E1B\u0E40\u0E14\u0E15\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08\u0E41\u0E25\u0E49\u0E27",
106759
106827
  one: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",
106760
106828
  many: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"
@@ -106921,6 +106989,11 @@ var zh_SG_default = {
106921
106989
  error: "\u62B1\u6B49\uFF0C\u65E0\u6CD5\u66F4\u65B0\u6B64\u9879\u3002\u8BF7\u91CD\u8BD5\u3002",
106922
106990
  placeholderForField: "\u8F93\u5165 %{fieldName}",
106923
106991
  selection: "\u5DF2\u9009\u62E9 %{count} %{number}",
106992
+ selection_count: {
106993
+ zero: "\u5DF2\u9009\u62E9 %{count} \u9879",
106994
+ one: "\u5DF2\u9009\u62E9 %{count} \u9879",
106995
+ other: "\u5DF2\u9009\u62E9 %{count} \u9879"
106996
+ },
106924
106997
  success: "\u5DF2\u6210\u529F\u66F4\u65B0\u8FD9\u4E9B\u9879\u3002",
106925
106998
  one: "\u9879",
106926
106999
  many: "\u9879"
@@ -108040,7 +108113,8 @@ var DataTable = ({
108040
108113
  showExpandCollapseAllToggle,
108041
108114
  translations: translations2 = {},
108042
108115
  enableCellTextSelection,
108043
- localStoragePersistenceKey
108116
+ localStoragePersistenceKey,
108117
+ enableCDN
108044
108118
  }) => {
108045
108119
  const initialTableConfig = localStoragePersistenceKey && storage.local.getItem(localStoragePersistenceKey) || _initialTableConfig;
108046
108120
  const onServerSideDataRequestRef = React80.useRef(onServerSideDataRequest);
@@ -108052,14 +108126,28 @@ var DataTable = ({
108052
108126
  );
108053
108127
  const contextPanel = useContextPanel();
108054
108128
  const clientI18n = useI18nContext();
108129
+ const isCDNEnabled = isCDNFeatureFlagEnabled(clientI18n, enableCDN);
108130
+ const cdnTranslations = useRequestTranslations(
108131
+ {
108132
+ locale: clientI18n.locale,
108133
+ type: "file",
108134
+ absolute_file_path: (locale) => `core/packages/data-table/src/locales/${locale}.json`
108135
+ },
108136
+ { en: translations.en, pseudo: translations.pseudo },
108137
+ {
108138
+ oldTranslations: translations,
108139
+ enableCDN: isCDNEnabled
108140
+ }
108141
+ );
108055
108142
  const internalI18n = useI18n({
108056
- ...clientI18n,
108143
+ locale: clientI18n.locale,
108057
108144
  translations: mergeDeepLeft(
108058
108145
  mergeDeepLeft(clientI18n.translations, {
108059
108146
  [clientI18n.locale]: translations2
108060
108147
  }),
108061
- translations
108062
- )
108148
+ cdnTranslations.translations
108149
+ ),
108150
+ enableCDN: isCDNEnabled
108063
108151
  });
108064
108152
  const rowSelectionRef = React80.useRef({
108065
108153
  affectedRows: {},
@@ -109152,7 +109240,10 @@ var Table = (props) => {
109152
109240
  groupDefaultExpanded: props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded,
109153
109241
  groupIncludeFooter: !onSSDR && props.groupIncludeFooter === void 0 ? true : props.groupIncludeFooter,
109154
109242
  getGroupRowAgg: props.getGroupRowAgg ? getGroupRowAgg : void 0,
109155
- groupSelectsChildren: internalTableContext.totalRowCount > 0 && props.groupSelectsChildren || !onSSDR,
109243
+ groupSelectsChildren: (
109244
+ // Always true for client side, defaults to true for server side
109245
+ internalTableContext.totalRowCount > 0 && props.groupSelectsChildren !== false || !onSSDR
109246
+ ),
109156
109247
  groupSelectsFiltered: true,
109157
109248
  headerHeight: props.headerHeight,
109158
109249
  icons: tableIcons,
@@ -111243,7 +111334,8 @@ var ClientSideDataTable = ({
111243
111334
  onTableConfigChange,
111244
111335
  translations: translations2 = {},
111245
111336
  enableCellTextSelection,
111246
- localStoragePersistenceKey
111337
+ localStoragePersistenceKey,
111338
+ enableCDN
111247
111339
  }) => {
111248
111340
  return /* @__PURE__ */ React80.createElement(
111249
111341
  DataTable,
@@ -111261,7 +111353,8 @@ var ClientSideDataTable = ({
111261
111353
  translations: translations2,
111262
111354
  localStoragePersistenceKey,
111263
111355
  customBulkEditorFields,
111264
- enableCellTextSelection
111356
+ enableCellTextSelection,
111357
+ enableCDN
111265
111358
  },
111266
111359
  children
111267
111360
  );
@@ -115651,7 +115744,8 @@ var ServerSideDataTable = ({
115651
115744
  enableCellTextSelection,
115652
115745
  showExpandCollapseAllToggle,
115653
115746
  translations: translations2 = {},
115654
- localStoragePersistenceKey
115747
+ localStoragePersistenceKey,
115748
+ enableCDN
115655
115749
  }) => {
115656
115750
  return /* @__PURE__ */ React80.createElement(
115657
115751
  DataTable,
@@ -115670,7 +115764,8 @@ var ServerSideDataTable = ({
115670
115764
  translations: translations2,
115671
115765
  customBulkEditorFields,
115672
115766
  enableCellTextSelection,
115673
- localStoragePersistenceKey
115767
+ localStoragePersistenceKey,
115768
+ enableCDN
115674
115769
  },
115675
115770
  children
115676
115771
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/data-table",
3
- "version": "14.33.0",
3
+ "version": "14.35.0",
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",
@@ -74,9 +74,10 @@
74
74
  "styled-components": ">= 5.1.1 < 7"
75
75
  },
76
76
  "dependencies": {
77
+ "@procore/cdn-translations": "0.1.12",
77
78
  "@procore/error-pages": "^0.2.3",
78
79
  "@procore/labs-datetime-select": "^0.1.3",
79
- "@procore/labs-group-by-select": "^4.1.0",
80
+ "@procore/labs-group-by-select": "4.1.0",
80
81
  "@procore/toast-alert": "^5.1.1",
81
82
  "@procore/web-sdk-storage": "^0.1.0",
82
83
  "classnames": "2.5.1",
@@ -106,9 +107,9 @@
106
107
  "@dotenvx/dotenvx": "1.6.4",
107
108
  "@ngneat/falso": "6.4.0",
108
109
  "@procore/core-css": "10.17.0",
109
- "@procore/core-icons": "^12.7.0",
110
+ "@procore/core-icons": "^12.8.0",
110
111
  "@procore/core-prettier": "10.2.0",
111
- "@procore/core-react": "^12.22.0",
112
+ "@procore/core-react": "^12.24.0",
112
113
  "@procore/eslint-config": "10.0.0",
113
114
  "@procore/globalization-toolkit": "3.1.0",
114
115
  "@procore/labs-financials-utils": "4.3.1",