@procore/data-table 14.4.2 → 14.5.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.
@@ -436,7 +436,7 @@ var require_checkPropTypes = __commonJS({
436
436
  if (process.env.NODE_ENV !== "production") {
437
437
  for (var typeSpecName in typeSpecs) {
438
438
  if (has(typeSpecs, typeSpecName)) {
439
- var error;
439
+ var error2;
440
440
  try {
441
441
  if (typeof typeSpecs[typeSpecName] !== "function") {
442
442
  var err = Error(
@@ -445,20 +445,20 @@ var require_checkPropTypes = __commonJS({
445
445
  err.name = "Invariant Violation";
446
446
  throw err;
447
447
  }
448
- error = typeSpecs[typeSpecName](values2, typeSpecName, componentName, location, null, ReactPropTypesSecret);
448
+ error2 = typeSpecs[typeSpecName](values2, typeSpecName, componentName, location, null, ReactPropTypesSecret);
449
449
  } catch (ex) {
450
- error = ex;
450
+ error2 = ex;
451
451
  }
452
- if (error && !(error instanceof Error)) {
452
+ if (error2 && !(error2 instanceof Error)) {
453
453
  printWarning(
454
- (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
454
+ (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error2 + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
455
455
  );
456
456
  }
457
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
458
- loggedTypeFailures[error.message] = true;
457
+ if (error2 instanceof Error && !(error2.message in loggedTypeFailures)) {
458
+ loggedTypeFailures[error2.message] = true;
459
459
  var stack = getStack ? getStack() : "";
460
460
  printWarning(
461
- "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
461
+ "Failed " + location + " type: " + error2.message + (stack != null ? stack : "")
462
462
  );
463
463
  }
464
464
  }
@@ -615,9 +615,9 @@ var require_factoryWithTypeCheckers = __commonJS({
615
615
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
616
616
  }
617
617
  for (var i = 0; i < propValue.length; i++) {
618
- var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
619
- if (error instanceof Error) {
620
- return error;
618
+ var error2 = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
619
+ if (error2 instanceof Error) {
620
+ return error2;
621
621
  }
622
622
  }
623
623
  return null;
@@ -700,9 +700,9 @@ var require_factoryWithTypeCheckers = __commonJS({
700
700
  }
701
701
  for (var key in propValue) {
702
702
  if (has(propValue, key)) {
703
- var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
704
- if (error instanceof Error) {
705
- return error;
703
+ var error2 = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
704
+ if (error2 instanceof Error) {
705
+ return error2;
706
706
  }
707
707
  }
708
708
  }
@@ -767,9 +767,9 @@ var require_factoryWithTypeCheckers = __commonJS({
767
767
  if (typeof checker !== "function") {
768
768
  return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
769
769
  }
770
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
771
- if (error) {
772
- return error;
770
+ var error2 = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
771
+ if (error2) {
772
+ return error2;
773
773
  }
774
774
  }
775
775
  return null;
@@ -794,9 +794,9 @@ var require_factoryWithTypeCheckers = __commonJS({
794
794
  "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
795
795
  );
796
796
  }
797
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
798
- if (error) {
799
- return error;
797
+ var error2 = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
798
+ if (error2) {
799
+ return error2;
800
800
  }
801
801
  }
802
802
  return null;
@@ -8226,6 +8226,28 @@ var Editor = React83.forwardRef(
8226
8226
  }
8227
8227
  );
8228
8228
  var CurrencyCellEditor = withDataTableEditor(Editor, "input");
8229
+
8230
+ // src/utils/logger.ts
8231
+ var log = (...args) => {
8232
+ if (process.env.NODE_ENV === "development") {
8233
+ console.log(...args);
8234
+ }
8235
+ };
8236
+ var warn = (...args) => {
8237
+ if (process.env.NODE_ENV === "development") {
8238
+ console.warn(...args);
8239
+ }
8240
+ };
8241
+ var error = (...args) => {
8242
+ if (process.env.NODE_ENV === "development") {
8243
+ console.error(...args);
8244
+ }
8245
+ };
8246
+ var logger = {
8247
+ log,
8248
+ warn,
8249
+ error
8250
+ };
8229
8251
  function getLabel(func, option) {
8230
8252
  return func?.(option) ?? option?.label ?? option?.name ?? option;
8231
8253
  }
@@ -8556,7 +8578,7 @@ var DateFilterRenderer = (props) => {
8556
8578
  if (onServerSideDataRequest) {
8557
8579
  return /* @__PURE__ */ React83.createElement(ServerSideDateSelectFilterRenderer, { ...props });
8558
8580
  }
8559
- console.error(
8581
+ logger.error(
8560
8582
  "Warning: Date Filters are currently only implemented for the serverside row model"
8561
8583
  );
8562
8584
  return null;
@@ -9385,14 +9407,14 @@ ModuleRegistry.areGridScopedModules = false;
9385
9407
 
9386
9408
  // ../../node_modules/@ag-grid-community/core/dist/esm/es6/context/context.mjs
9387
9409
  var Context = class {
9388
- constructor(params, logger) {
9410
+ constructor(params, logger2) {
9389
9411
  this.beanWrappers = {};
9390
9412
  this.destroyed = false;
9391
9413
  if (!params || !params.beanClasses) {
9392
9414
  return;
9393
9415
  }
9394
9416
  this.contextParams = params;
9395
- this.logger = logger;
9417
+ this.logger = logger2;
9396
9418
  this.logger.log(">> creating ag-Application Context");
9397
9419
  this.createBeans();
9398
9420
  const beanInstances = this.getBeanInstances();
@@ -52623,7 +52645,7 @@ var GridCoreCreator = class {
52623
52645
  debug: debug2,
52624
52646
  gridId
52625
52647
  };
52626
- const logger = new Logger("AG Grid", () => gridOptions.debug);
52648
+ const logger2 = new Logger("AG Grid", () => gridOptions.debug);
52627
52649
  const contextLogger = new Logger("Context", () => contextParams.debug);
52628
52650
  const context = new Context(contextParams, contextLogger);
52629
52651
  const beans = context.getBean("beans");
@@ -52635,7 +52657,7 @@ var GridCoreCreator = class {
52635
52657
  this.setColumnsAndData(beans);
52636
52658
  this.dispatchGridReadyEvent(beans);
52637
52659
  const isEnterprise = ModuleRegistry.__isRegistered(ModuleNames.EnterpriseCoreModule, gridId);
52638
- logger.log(`initialised successfully, enterprise = ${isEnterprise}`);
52660
+ logger2.log(`initialised successfully, enterprise = ${isEnterprise}`);
52639
52661
  });
52640
52662
  if (acceptChanges) {
52641
52663
  acceptChanges(context);
@@ -53955,7 +53977,7 @@ var LocationFilterRenderer = (props) => {
53955
53977
  if (onServerSideDataRequest) {
53956
53978
  return /* @__PURE__ */ React83.createElement(ServerSideLocationFilterRenderer, { ...props });
53957
53979
  }
53958
- console.error(
53980
+ logger.error(
53959
53981
  "Warning: Location Filters are currently only implemented for the serverside row model"
53960
53982
  );
53961
53983
  return null;
@@ -54144,7 +54166,7 @@ var MultiSelectFilterRenderer = (props) => {
54144
54166
  const { onServerSideDataRequest } = useInternalTableContext();
54145
54167
  const Renderer13 = onServerSideDataRequest ? ServerSideMultiSelectFilterRenderer : ClientSideMultiSelectFilterRenderer;
54146
54168
  if (isNumberFilterModel(value)) {
54147
- console.warn(
54169
+ logger.warn(
54148
54170
  "a value was set that is not compatible with this MultiSelectFilterRenderer"
54149
54171
  );
54150
54172
  return null;
@@ -54493,7 +54515,7 @@ var ServerSideFilter = ({
54493
54515
  value
54494
54516
  } = useServerSideFilter({ columnDefinition });
54495
54517
  if (columnDefinition === void 0 || columnDefinition === null) {
54496
- console.warn(
54518
+ logger.warn(
54497
54519
  `Unable to find the columnDefinition (${columnDefinition}) for fieldName: ${fieldName}`
54498
54520
  );
54499
54521
  return null;
@@ -56183,7 +56205,12 @@ var GenericHeaderRenderer = (props) => {
56183
56205
  const colDef = props.column.getColDef();
56184
56206
  const HeaderNode = colDef.headerComponentParams?.headerNode;
56185
56207
  const I18n = useI18nContext();
56186
- const { columnApi, tableRef, onServerSideDataRequest } = useInternalTableContext();
56208
+ const {
56209
+ columnApi,
56210
+ tableRef,
56211
+ onServerSideDataRequest,
56212
+ showExpandCollapseAllToggle
56213
+ } = useInternalTableContext();
56187
56214
  const onSSDR = Boolean(onServerSideDataRequest);
56188
56215
  const [sortOrder, setSortOrder] = React83.useState(props.column.getSort());
56189
56216
  const [isFirstColumn2, setIsFirstColumn] = React83.useState(false);
@@ -56273,11 +56300,11 @@ var GenericHeaderRenderer = (props) => {
56273
56300
  }, [props.column]);
56274
56301
  const [isExpandable, setIsExpandable] = React83.useState(false);
56275
56302
  React83.useEffect(() => {
56276
- if (onSSDR) {
56303
+ if (showExpandCollapseAllToggle === false) {
56277
56304
  return;
56278
56305
  }
56279
56306
  const hasExpandableNodes = !!findNode(
56280
- (node) => node.isExpandable(),
56307
+ (node) => !!(node.group && !node.footer),
56281
56308
  props.api
56282
56309
  );
56283
56310
  setIsExpandable(
@@ -56812,7 +56839,7 @@ var emptyArray2 = [];
56812
56839
  var emptyObj = {};
56813
56840
  function logNoOp(text, returns) {
56814
56841
  return function() {
56815
- console.log("No-op", text);
56842
+ logger.log("No-op", text);
56816
56843
  return returns;
56817
56844
  };
56818
56845
  }
@@ -57143,6 +57170,7 @@ var InternalTableContext = React83.createContext({
57143
57170
  },
57144
57171
  setRowHeight: () => {
57145
57172
  },
57173
+ showExpandCollapseAllToggle: false,
57146
57174
  tableRef: null,
57147
57175
  getColumnDefinition: () => void 0,
57148
57176
  setSelectedGroupIndex: () => {
@@ -57189,8 +57217,7 @@ var Analytics = class {
57189
57217
  };
57190
57218
 
57191
57219
  // src/Analytics/Analytics.tsx
57192
- var defaultTrackEvent = (e, params) => {
57193
- console.log("analytics::trackEvent", e, params);
57220
+ var noop3 = () => {
57194
57221
  };
57195
57222
  var AnalyticsContext = React83.createContext({});
57196
57223
  function AnalyticsProvider({
@@ -57200,7 +57227,7 @@ function AnalyticsProvider({
57200
57227
  return /* @__PURE__ */ React83.createElement(
57201
57228
  AnalyticsContext.Provider,
57202
57229
  {
57203
- value: { trackEvent: analytics?.trackEvent || defaultTrackEvent }
57230
+ value: { trackEvent: analytics?.trackEvent || noop3 }
57204
57231
  },
57205
57232
  children
57206
57233
  );
@@ -76455,7 +76482,7 @@ function RadioList({
76455
76482
  }
76456
76483
 
76457
76484
  // src/Panels/BulkEdit.tsx
76458
- function noop3() {
76485
+ function noop4() {
76459
76486
  }
76460
76487
  function parseValues(columns, values2) {
76461
76488
  return columns.reduce((updatedValues, column2) => {
@@ -76742,7 +76769,7 @@ var BulkEditInput = (props) => {
76742
76769
  }
76743
76770
  );
76744
76771
  } else {
76745
- console.warn(
76772
+ logger.warn(
76746
76773
  `@procore/data-table: Unable to find the field for ${props.editor}. Will fallback to a Form.Text.`
76747
76774
  );
76748
76775
  return defaultField;
@@ -76750,7 +76777,7 @@ var BulkEditInput = (props) => {
76750
76777
  }
76751
76778
  };
76752
76779
  var BulkEdit = React83.forwardRef(
76753
- ({ onReset = noop3 }, ref) => {
76780
+ ({ onReset = noop4 }, ref) => {
76754
76781
  const {
76755
76782
  analytics,
76756
76783
  columnApi,
@@ -76870,7 +76897,7 @@ var BulkEdit = React83.forwardRef(
76870
76897
  showToast.success(I18n.t("dataTable.bulkActions.success"));
76871
76898
  resetForm({});
76872
76899
  onReset();
76873
- } catch (error) {
76900
+ } catch (error2) {
76874
76901
  showToast.error(I18n.t("dataTable.bulkActions.error"));
76875
76902
  }
76876
76903
  }
@@ -77374,7 +77401,7 @@ function groupFiltersByGroupName(props) {
77374
77401
  const groupName = filterProps?.groupName;
77375
77402
  filterIndex++;
77376
77403
  if (groupName && !filterGroupNames?.includes(groupName)) {
77377
- console.warn(
77404
+ logger.warn(
77378
77405
  'filter "%s" is being associated with a filter group "%s" that does not exist',
77379
77406
  filterRecord.field,
77380
77407
  groupName
@@ -77441,7 +77468,7 @@ var StyledPanelSection = styled4(Panel.Section)`
77441
77468
  `;
77442
77469
 
77443
77470
  // src/Panels/Filters.tsx
77444
- function noop4() {
77471
+ function noop5() {
77445
77472
  }
77446
77473
  var cx19 = classnames.bind(styles_default);
77447
77474
  function isServerSideFilterGroups(_FiltersInGroup, isServerSideRowModel) {
@@ -77494,7 +77521,6 @@ function FilterListItems(props) {
77494
77521
  "data-qa": "data-table-possible-filters-list"
77495
77522
  },
77496
77523
  filtersInGroup.map((filterRecord) => {
77497
- console.log("filterRecord ", filterRecord);
77498
77524
  const { columnDefinition } = filterRecord;
77499
77525
  if (!columnDefinition) {
77500
77526
  return null;
@@ -77554,7 +77580,7 @@ function FiltersList(props) {
77554
77580
  },
77555
77581
  filterGroups?.map((group) => {
77556
77582
  if (!filterGroupsMap[group.name]) {
77557
- console.warn(
77583
+ logger.warn(
77558
77584
  'filters group "%s" is not associated with any filter',
77559
77585
  group.name
77560
77586
  );
@@ -77580,7 +77606,7 @@ function FiltersList(props) {
77580
77606
  var BaseFiltersPanel = ({
77581
77607
  children,
77582
77608
  className,
77583
- onClearAllFilters = noop4,
77609
+ onClearAllFilters = noop5,
77584
77610
  ...props
77585
77611
  }) => {
77586
77612
  const { contextPanel } = useInternalTableContext();
@@ -78281,7 +78307,7 @@ var buildDetailRowsConfig = ({
78281
78307
  return {};
78282
78308
  }
78283
78309
  if (detailRowConfigs.length > 1) {
78284
- console.warn(`
78310
+ logger.warn(`
78285
78311
  DataTable: "detailRowConfigs" of length ${detailRowConfigs.length} was provided, while it only supports an array of length 1.
78286
78312
  Please use "detailRowConfig", as "detailRowConfigs" is deprecated.
78287
78313
  `);
@@ -81327,6 +81353,7 @@ var DataTable = ({
81327
81353
  onBulkEditUpdate,
81328
81354
  onServerSideDataRequest,
81329
81355
  onTableConfigChange,
81356
+ showExpandCollapseAllToggle,
81330
81357
  translations: translations2 = {},
81331
81358
  enableCellTextSelection
81332
81359
  }) => {
@@ -81356,7 +81383,7 @@ var DataTable = ({
81356
81383
  const missingTranslation = internalI18n.missingTranslation.bind(internalI18n);
81357
81384
  internalI18n.missingTranslation = (scope2, options) => {
81358
81385
  if (scope2.match(/core\.dataTable/)) {
81359
- console.warn(`[DataTable] Missing Translation: ${scope2}`);
81386
+ logger.warn(`[DataTable] Missing Translation: ${scope2}`);
81360
81387
  return "";
81361
81388
  }
81362
81389
  if (dataTableTranslationKeys.includes(scope2)) {
@@ -81540,6 +81567,7 @@ var DataTable = ({
81540
81567
  setGridApi,
81541
81568
  setRowHeight: internalSetRowHeight,
81542
81569
  setSelectedGroupIndex,
81570
+ showExpandCollapseAllToggle: showExpandCollapseAllToggle ?? false,
81543
81571
  tableRef,
81544
81572
  totalRowCount,
81545
81573
  setTotalRowCount,
@@ -81806,7 +81834,7 @@ var Table = (props) => {
81806
81834
  ]);
81807
81835
  React83.useEffect(() => {
81808
81836
  if (frameworkComponentsInitialized.current === true) {
81809
- console.warn("Don't update custom cells after the initial render.");
81837
+ logger.warn("Don't update custom cells after the initial render.");
81810
81838
  setFrameworkComponents(
81811
81839
  getFrameworkComponents(
81812
81840
  headerMenuConfig,
@@ -82531,6 +82559,7 @@ var ClientSideDataTable = ({
82531
82559
  initialTableConfig: _initialTableConfig,
82532
82560
  onTableConfigChange,
82533
82561
  onBulkEditUpdate,
82562
+ showExpandCollapseAllToggle: true,
82534
82563
  translations: translations2,
82535
82564
  customBulkEditorFields,
82536
82565
  enableCellTextSelection
@@ -82799,7 +82828,7 @@ var QuickDateFilterRenderer = (props) => {
82799
82828
  if (onServerSideDataRequest) {
82800
82829
  return /* @__PURE__ */ React83.createElement(ServerSideQuickDateFilterRenderer, { ...props });
82801
82830
  }
82802
- console.error(
82831
+ logger.error(
82803
82832
  "Warning: Date Filters are currently only implemented for the serverside row model"
82804
82833
  );
82805
82834
  return null;
@@ -82897,7 +82926,7 @@ var LocationQuickFilterOverlay = React83.forwardRef(
82897
82926
  value
82898
82927
  }, ref) => {
82899
82928
  if (value && !Array.isArray(value)) {
82900
- console.warn(
82929
+ logger.warn(
82901
82930
  "a value was set that is not compatible with this LocationQuickFilterRenderer"
82902
82931
  );
82903
82932
  return null;
@@ -87923,6 +87952,7 @@ var ServerSideDataTable = ({
87923
87952
  onServerSideDataRequest,
87924
87953
  onTableConfigChange,
87925
87954
  enableCellTextSelection,
87955
+ showExpandCollapseAllToggle,
87926
87956
  translations: translations2 = {}
87927
87957
  }) => {
87928
87958
  return /* @__PURE__ */ React83.createElement(
@@ -87938,6 +87968,7 @@ var ServerSideDataTable = ({
87938
87968
  onTableConfigChange,
87939
87969
  onServerSideDataRequest,
87940
87970
  onBulkEditUpdate,
87971
+ showExpandCollapseAllToggle,
87941
87972
  translations: translations2,
87942
87973
  customBulkEditorFields,
87943
87974
  enableCellTextSelection
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@procore/data-table",
3
- "version": "14.4.2",
3
+ "version": "14.5.0",
4
4
  "description": "Complex data grid built on top of ag-grid, with DST components and styles.",
5
- "main": "dist/legacy/index.js",
6
- "module": "dist/legacy/index.mjs",
5
+ "main": "dist/modern/index.js",
6
+ "module": "dist/modern/index.mjs",
7
7
  "exports": {
8
8
  ".": {
9
9
  "import": {
@@ -11,13 +11,13 @@
11
11
  "default": "./dist/modern/index.mjs"
12
12
  },
13
13
  "require": {
14
- "types": "./dist/modern/index.d.ts",
15
- "default": "./dist/modern/index.js"
14
+ "types": "./dist/modern/index.d.mts",
15
+ "default": "./dist/modern/index.mjs"
16
16
  }
17
17
  },
18
18
  "./package.json": "./package.json"
19
19
  },
20
- "types": "dist/legacy/index.d.mts",
20
+ "types": "dist/modern/index.d.mts",
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },