@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.
@@ -450,7 +450,7 @@ var require_checkPropTypes = __commonJS({
450
450
  if (process.env.NODE_ENV !== "production") {
451
451
  for (var typeSpecName in typeSpecs) {
452
452
  if (has(typeSpecs, typeSpecName)) {
453
- var error;
453
+ var error2;
454
454
  try {
455
455
  if (typeof typeSpecs[typeSpecName] !== "function") {
456
456
  var err = Error(
@@ -459,20 +459,20 @@ var require_checkPropTypes = __commonJS({
459
459
  err.name = "Invariant Violation";
460
460
  throw err;
461
461
  }
462
- error = typeSpecs[typeSpecName](values2, typeSpecName, componentName, location, null, ReactPropTypesSecret);
462
+ error2 = typeSpecs[typeSpecName](values2, typeSpecName, componentName, location, null, ReactPropTypesSecret);
463
463
  } catch (ex) {
464
- error = ex;
464
+ error2 = ex;
465
465
  }
466
- if (error && !(error instanceof Error)) {
466
+ if (error2 && !(error2 instanceof Error)) {
467
467
  printWarning(
468
- (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)."
468
+ (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)."
469
469
  );
470
470
  }
471
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
472
- loggedTypeFailures[error.message] = true;
471
+ if (error2 instanceof Error && !(error2.message in loggedTypeFailures)) {
472
+ loggedTypeFailures[error2.message] = true;
473
473
  var stack = getStack ? getStack() : "";
474
474
  printWarning(
475
- "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
475
+ "Failed " + location + " type: " + error2.message + (stack != null ? stack : "")
476
476
  );
477
477
  }
478
478
  }
@@ -629,9 +629,9 @@ var require_factoryWithTypeCheckers = __commonJS({
629
629
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
630
630
  }
631
631
  for (var i = 0; i < propValue.length; i++) {
632
- var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
633
- if (error instanceof Error) {
634
- return error;
632
+ var error2 = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
633
+ if (error2 instanceof Error) {
634
+ return error2;
635
635
  }
636
636
  }
637
637
  return null;
@@ -714,9 +714,9 @@ var require_factoryWithTypeCheckers = __commonJS({
714
714
  }
715
715
  for (var key in propValue) {
716
716
  if (has(propValue, key)) {
717
- var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
718
- if (error instanceof Error) {
719
- return error;
717
+ var error2 = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
718
+ if (error2 instanceof Error) {
719
+ return error2;
720
720
  }
721
721
  }
722
722
  }
@@ -781,9 +781,9 @@ var require_factoryWithTypeCheckers = __commonJS({
781
781
  if (typeof checker !== "function") {
782
782
  return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
783
783
  }
784
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
785
- if (error) {
786
- return error;
784
+ var error2 = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
785
+ if (error2) {
786
+ return error2;
787
787
  }
788
788
  }
789
789
  return null;
@@ -808,9 +808,9 @@ var require_factoryWithTypeCheckers = __commonJS({
808
808
  "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
809
809
  );
810
810
  }
811
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
812
- if (error) {
813
- return error;
811
+ var error2 = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
812
+ if (error2) {
813
+ return error2;
814
814
  }
815
815
  }
816
816
  return null;
@@ -8240,6 +8240,28 @@ var Editor = React83__default.default.forwardRef(
8240
8240
  }
8241
8241
  );
8242
8242
  var CurrencyCellEditor = withDataTableEditor(Editor, "input");
8243
+
8244
+ // src/utils/logger.ts
8245
+ var log = (...args) => {
8246
+ if (process.env.NODE_ENV === "development") {
8247
+ console.log(...args);
8248
+ }
8249
+ };
8250
+ var warn = (...args) => {
8251
+ if (process.env.NODE_ENV === "development") {
8252
+ console.warn(...args);
8253
+ }
8254
+ };
8255
+ var error = (...args) => {
8256
+ if (process.env.NODE_ENV === "development") {
8257
+ console.error(...args);
8258
+ }
8259
+ };
8260
+ var logger = {
8261
+ log,
8262
+ warn,
8263
+ error
8264
+ };
8243
8265
  function getLabel(func, option) {
8244
8266
  return func?.(option) ?? option?.label ?? option?.name ?? option;
8245
8267
  }
@@ -8570,7 +8592,7 @@ var DateFilterRenderer = (props) => {
8570
8592
  if (onServerSideDataRequest) {
8571
8593
  return /* @__PURE__ */ React83__default.default.createElement(ServerSideDateSelectFilterRenderer, { ...props });
8572
8594
  }
8573
- console.error(
8595
+ logger.error(
8574
8596
  "Warning: Date Filters are currently only implemented for the serverside row model"
8575
8597
  );
8576
8598
  return null;
@@ -9399,14 +9421,14 @@ ModuleRegistry.areGridScopedModules = false;
9399
9421
 
9400
9422
  // ../../node_modules/@ag-grid-community/core/dist/esm/es6/context/context.mjs
9401
9423
  var Context = class {
9402
- constructor(params, logger) {
9424
+ constructor(params, logger2) {
9403
9425
  this.beanWrappers = {};
9404
9426
  this.destroyed = false;
9405
9427
  if (!params || !params.beanClasses) {
9406
9428
  return;
9407
9429
  }
9408
9430
  this.contextParams = params;
9409
- this.logger = logger;
9431
+ this.logger = logger2;
9410
9432
  this.logger.log(">> creating ag-Application Context");
9411
9433
  this.createBeans();
9412
9434
  const beanInstances = this.getBeanInstances();
@@ -52637,7 +52659,7 @@ var GridCoreCreator = class {
52637
52659
  debug: debug2,
52638
52660
  gridId
52639
52661
  };
52640
- const logger = new Logger("AG Grid", () => gridOptions.debug);
52662
+ const logger2 = new Logger("AG Grid", () => gridOptions.debug);
52641
52663
  const contextLogger = new Logger("Context", () => contextParams.debug);
52642
52664
  const context = new Context(contextParams, contextLogger);
52643
52665
  const beans = context.getBean("beans");
@@ -52649,7 +52671,7 @@ var GridCoreCreator = class {
52649
52671
  this.setColumnsAndData(beans);
52650
52672
  this.dispatchGridReadyEvent(beans);
52651
52673
  const isEnterprise = ModuleRegistry.__isRegistered(ModuleNames.EnterpriseCoreModule, gridId);
52652
- logger.log(`initialised successfully, enterprise = ${isEnterprise}`);
52674
+ logger2.log(`initialised successfully, enterprise = ${isEnterprise}`);
52653
52675
  });
52654
52676
  if (acceptChanges) {
52655
52677
  acceptChanges(context);
@@ -53969,7 +53991,7 @@ var LocationFilterRenderer = (props) => {
53969
53991
  if (onServerSideDataRequest) {
53970
53992
  return /* @__PURE__ */ React83__default.default.createElement(ServerSideLocationFilterRenderer, { ...props });
53971
53993
  }
53972
- console.error(
53994
+ logger.error(
53973
53995
  "Warning: Location Filters are currently only implemented for the serverside row model"
53974
53996
  );
53975
53997
  return null;
@@ -54158,7 +54180,7 @@ var MultiSelectFilterRenderer = (props) => {
54158
54180
  const { onServerSideDataRequest } = useInternalTableContext();
54159
54181
  const Renderer13 = onServerSideDataRequest ? ServerSideMultiSelectFilterRenderer : ClientSideMultiSelectFilterRenderer;
54160
54182
  if (isNumberFilterModel(value)) {
54161
- console.warn(
54183
+ logger.warn(
54162
54184
  "a value was set that is not compatible with this MultiSelectFilterRenderer"
54163
54185
  );
54164
54186
  return null;
@@ -54507,7 +54529,7 @@ var ServerSideFilter = ({
54507
54529
  value
54508
54530
  } = useServerSideFilter({ columnDefinition });
54509
54531
  if (columnDefinition === void 0 || columnDefinition === null) {
54510
- console.warn(
54532
+ logger.warn(
54511
54533
  `Unable to find the columnDefinition (${columnDefinition}) for fieldName: ${fieldName}`
54512
54534
  );
54513
54535
  return null;
@@ -56197,7 +56219,12 @@ var GenericHeaderRenderer = (props) => {
56197
56219
  const colDef = props.column.getColDef();
56198
56220
  const HeaderNode = colDef.headerComponentParams?.headerNode;
56199
56221
  const I18n = coreReact.useI18nContext();
56200
- const { columnApi, tableRef, onServerSideDataRequest } = useInternalTableContext();
56222
+ const {
56223
+ columnApi,
56224
+ tableRef,
56225
+ onServerSideDataRequest,
56226
+ showExpandCollapseAllToggle
56227
+ } = useInternalTableContext();
56201
56228
  const onSSDR = Boolean(onServerSideDataRequest);
56202
56229
  const [sortOrder, setSortOrder] = React83__default.default.useState(props.column.getSort());
56203
56230
  const [isFirstColumn2, setIsFirstColumn] = React83__default.default.useState(false);
@@ -56287,11 +56314,11 @@ var GenericHeaderRenderer = (props) => {
56287
56314
  }, [props.column]);
56288
56315
  const [isExpandable, setIsExpandable] = React83__default.default.useState(false);
56289
56316
  React83__default.default.useEffect(() => {
56290
- if (onSSDR) {
56317
+ if (showExpandCollapseAllToggle === false) {
56291
56318
  return;
56292
56319
  }
56293
56320
  const hasExpandableNodes = !!findNode(
56294
- (node) => node.isExpandable(),
56321
+ (node) => !!(node.group && !node.footer),
56295
56322
  props.api
56296
56323
  );
56297
56324
  setIsExpandable(
@@ -56826,7 +56853,7 @@ var emptyArray2 = [];
56826
56853
  var emptyObj = {};
56827
56854
  function logNoOp(text, returns) {
56828
56855
  return function() {
56829
- console.log("No-op", text);
56856
+ logger.log("No-op", text);
56830
56857
  return returns;
56831
56858
  };
56832
56859
  }
@@ -57157,6 +57184,7 @@ var InternalTableContext = React83__default.default.createContext({
57157
57184
  },
57158
57185
  setRowHeight: () => {
57159
57186
  },
57187
+ showExpandCollapseAllToggle: false,
57160
57188
  tableRef: null,
57161
57189
  getColumnDefinition: () => void 0,
57162
57190
  setSelectedGroupIndex: () => {
@@ -57203,8 +57231,7 @@ var Analytics = class {
57203
57231
  };
57204
57232
 
57205
57233
  // src/Analytics/Analytics.tsx
57206
- var defaultTrackEvent = (e, params) => {
57207
- console.log("analytics::trackEvent", e, params);
57234
+ var noop3 = () => {
57208
57235
  };
57209
57236
  var AnalyticsContext = React83__default.default.createContext({});
57210
57237
  function AnalyticsProvider({
@@ -57214,7 +57241,7 @@ function AnalyticsProvider({
57214
57241
  return /* @__PURE__ */ React83__default.default.createElement(
57215
57242
  AnalyticsContext.Provider,
57216
57243
  {
57217
- value: { trackEvent: analytics?.trackEvent || defaultTrackEvent }
57244
+ value: { trackEvent: analytics?.trackEvent || noop3 }
57218
57245
  },
57219
57246
  children
57220
57247
  );
@@ -76469,7 +76496,7 @@ function RadioList({
76469
76496
  }
76470
76497
 
76471
76498
  // src/Panels/BulkEdit.tsx
76472
- function noop3() {
76499
+ function noop4() {
76473
76500
  }
76474
76501
  function parseValues(columns, values2) {
76475
76502
  return columns.reduce((updatedValues, column2) => {
@@ -76756,7 +76783,7 @@ var BulkEditInput = (props) => {
76756
76783
  }
76757
76784
  );
76758
76785
  } else {
76759
- console.warn(
76786
+ logger.warn(
76760
76787
  `@procore/data-table: Unable to find the field for ${props.editor}. Will fallback to a Form.Text.`
76761
76788
  );
76762
76789
  return defaultField;
@@ -76764,7 +76791,7 @@ var BulkEditInput = (props) => {
76764
76791
  }
76765
76792
  };
76766
76793
  var BulkEdit = React83__default.default.forwardRef(
76767
- ({ onReset = noop3 }, ref) => {
76794
+ ({ onReset = noop4 }, ref) => {
76768
76795
  const {
76769
76796
  analytics,
76770
76797
  columnApi,
@@ -76884,7 +76911,7 @@ var BulkEdit = React83__default.default.forwardRef(
76884
76911
  showToast.success(I18n.t("dataTable.bulkActions.success"));
76885
76912
  resetForm({});
76886
76913
  onReset();
76887
- } catch (error) {
76914
+ } catch (error2) {
76888
76915
  showToast.error(I18n.t("dataTable.bulkActions.error"));
76889
76916
  }
76890
76917
  }
@@ -77388,7 +77415,7 @@ function groupFiltersByGroupName(props) {
77388
77415
  const groupName = filterProps?.groupName;
77389
77416
  filterIndex++;
77390
77417
  if (groupName && !filterGroupNames?.includes(groupName)) {
77391
- console.warn(
77418
+ logger.warn(
77392
77419
  'filter "%s" is being associated with a filter group "%s" that does not exist',
77393
77420
  filterRecord.field,
77394
77421
  groupName
@@ -77455,7 +77482,7 @@ var StyledPanelSection = styled4__default.default(coreReact.Panel.Section)`
77455
77482
  `;
77456
77483
 
77457
77484
  // src/Panels/Filters.tsx
77458
- function noop4() {
77485
+ function noop5() {
77459
77486
  }
77460
77487
  var cx19 = classnames__default.default.bind(styles_default);
77461
77488
  function isServerSideFilterGroups(_FiltersInGroup, isServerSideRowModel) {
@@ -77508,7 +77535,6 @@ function FilterListItems(props) {
77508
77535
  "data-qa": "data-table-possible-filters-list"
77509
77536
  },
77510
77537
  filtersInGroup.map((filterRecord) => {
77511
- console.log("filterRecord ", filterRecord);
77512
77538
  const { columnDefinition } = filterRecord;
77513
77539
  if (!columnDefinition) {
77514
77540
  return null;
@@ -77568,7 +77594,7 @@ function FiltersList(props) {
77568
77594
  },
77569
77595
  filterGroups?.map((group) => {
77570
77596
  if (!filterGroupsMap[group.name]) {
77571
- console.warn(
77597
+ logger.warn(
77572
77598
  'filters group "%s" is not associated with any filter',
77573
77599
  group.name
77574
77600
  );
@@ -77594,7 +77620,7 @@ function FiltersList(props) {
77594
77620
  var BaseFiltersPanel = ({
77595
77621
  children,
77596
77622
  className,
77597
- onClearAllFilters = noop4,
77623
+ onClearAllFilters = noop5,
77598
77624
  ...props
77599
77625
  }) => {
77600
77626
  const { contextPanel } = useInternalTableContext();
@@ -78295,7 +78321,7 @@ var buildDetailRowsConfig = ({
78295
78321
  return {};
78296
78322
  }
78297
78323
  if (detailRowConfigs.length > 1) {
78298
- console.warn(`
78324
+ logger.warn(`
78299
78325
  DataTable: "detailRowConfigs" of length ${detailRowConfigs.length} was provided, while it only supports an array of length 1.
78300
78326
  Please use "detailRowConfig", as "detailRowConfigs" is deprecated.
78301
78327
  `);
@@ -81341,6 +81367,7 @@ var DataTable = ({
81341
81367
  onBulkEditUpdate,
81342
81368
  onServerSideDataRequest,
81343
81369
  onTableConfigChange,
81370
+ showExpandCollapseAllToggle,
81344
81371
  translations: translations2 = {},
81345
81372
  enableCellTextSelection
81346
81373
  }) => {
@@ -81370,7 +81397,7 @@ var DataTable = ({
81370
81397
  const missingTranslation = internalI18n.missingTranslation.bind(internalI18n);
81371
81398
  internalI18n.missingTranslation = (scope2, options) => {
81372
81399
  if (scope2.match(/core\.dataTable/)) {
81373
- console.warn(`[DataTable] Missing Translation: ${scope2}`);
81400
+ logger.warn(`[DataTable] Missing Translation: ${scope2}`);
81374
81401
  return "";
81375
81402
  }
81376
81403
  if (dataTableTranslationKeys.includes(scope2)) {
@@ -81554,6 +81581,7 @@ var DataTable = ({
81554
81581
  setGridApi,
81555
81582
  setRowHeight: internalSetRowHeight,
81556
81583
  setSelectedGroupIndex,
81584
+ showExpandCollapseAllToggle: showExpandCollapseAllToggle ?? false,
81557
81585
  tableRef,
81558
81586
  totalRowCount,
81559
81587
  setTotalRowCount,
@@ -81820,7 +81848,7 @@ var Table = (props) => {
81820
81848
  ]);
81821
81849
  React83__default.default.useEffect(() => {
81822
81850
  if (frameworkComponentsInitialized.current === true) {
81823
- console.warn("Don't update custom cells after the initial render.");
81851
+ logger.warn("Don't update custom cells after the initial render.");
81824
81852
  setFrameworkComponents(
81825
81853
  getFrameworkComponents(
81826
81854
  headerMenuConfig,
@@ -82545,6 +82573,7 @@ var ClientSideDataTable = ({
82545
82573
  initialTableConfig: _initialTableConfig,
82546
82574
  onTableConfigChange,
82547
82575
  onBulkEditUpdate,
82576
+ showExpandCollapseAllToggle: true,
82548
82577
  translations: translations2,
82549
82578
  customBulkEditorFields,
82550
82579
  enableCellTextSelection
@@ -82813,7 +82842,7 @@ var QuickDateFilterRenderer = (props) => {
82813
82842
  if (onServerSideDataRequest) {
82814
82843
  return /* @__PURE__ */ React83__default.default.createElement(ServerSideQuickDateFilterRenderer, { ...props });
82815
82844
  }
82816
- console.error(
82845
+ logger.error(
82817
82846
  "Warning: Date Filters are currently only implemented for the serverside row model"
82818
82847
  );
82819
82848
  return null;
@@ -82911,7 +82940,7 @@ var LocationQuickFilterOverlay = React83__default.default.forwardRef(
82911
82940
  value
82912
82941
  }, ref) => {
82913
82942
  if (value && !Array.isArray(value)) {
82914
- console.warn(
82943
+ logger.warn(
82915
82944
  "a value was set that is not compatible with this LocationQuickFilterRenderer"
82916
82945
  );
82917
82946
  return null;
@@ -87937,6 +87966,7 @@ var ServerSideDataTable = ({
87937
87966
  onServerSideDataRequest,
87938
87967
  onTableConfigChange,
87939
87968
  enableCellTextSelection,
87969
+ showExpandCollapseAllToggle,
87940
87970
  translations: translations2 = {}
87941
87971
  }) => {
87942
87972
  return /* @__PURE__ */ React83__default.default.createElement(
@@ -87952,6 +87982,7 @@ var ServerSideDataTable = ({
87952
87982
  onTableConfigChange,
87953
87983
  onServerSideDataRequest,
87954
87984
  onBulkEditUpdate,
87985
+ showExpandCollapseAllToggle,
87955
87986
  translations: translations2,
87956
87987
  customBulkEditorFields,
87957
87988
  enableCellTextSelection