@linzjs/step-ag-grid 32.2.0 → 32.4.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.
@@ -6,5 +6,6 @@ export interface LuiTextInputProps extends DetailedHTMLProps<InputHTMLAttributes
6
6
  error?: ReactElement | string | boolean | null;
7
7
  formatted?: string;
8
8
  allowTabToSave?: boolean;
9
+ validationSummary?: string;
9
10
  }
10
11
  export declare const TextInputFormatted: (props: LuiTextInputProps) => ReactElement;
@@ -0,0 +1 @@
1
+ export {};
@@ -16,3 +16,4 @@ export interface TextInputValidatorProps<TData extends GridBaseRow> {
16
16
  };
17
17
  }
18
18
  export declare const TextInputValidator: <TData extends GridBaseRow>(props: TextInputValidatorProps<TData>, value: string | null, data: TData, context: any) => string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
19
+ export declare const textInputValidatorPropsToSummary: <TData extends GridBaseRow>(props: TextInputValidatorProps<TData>) => string;
@@ -57824,6 +57824,15 @@ var AgGridReact = class extends React13.Component {
57824
57824
  }
57825
57825
  };
57826
57826
 
57827
+ function isChromatic(windowArgument) {
57828
+ const windowToCheck = (globalThis.window !== undefined && globalThis);
57829
+ return !!(
57830
+ windowToCheck &&
57831
+ (/Chromatic/.test(windowToCheck.navigator.userAgent) ||
57832
+ /chromatic=true/.test(windowToCheck.location.href))
57833
+ );
57834
+ }
57835
+
57827
57836
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
57828
57837
 
57829
57838
  const NoContext = () => {
@@ -61318,7 +61327,8 @@ const Grid = ({
61318
61327
  cellClassRules: {
61319
61328
  ...colDef.cellClassRules,
61320
61329
  "GridCell-readonly": (ccp) => !suppressReadOnlyStyle && !editable(ccp)
61321
- }
61330
+ },
61331
+ width: colDef.minWidth || 120
61322
61332
  };
61323
61333
  }
61324
61334
  },
@@ -61800,7 +61810,9 @@ const Grid = ({
61800
61810
  const onGridSizeChanged = React13.useCallback(
61801
61811
  (event) => {
61802
61812
  if (sizeColumns === "fit" || ["auto", "auto-skip-headers"].includes(sizeColumns) && hasSetContentSize.current) {
61803
- event.api.sizeColumnsToFit();
61813
+ if (!isChromatic()) {
61814
+ event.api.sizeColumnsToFit();
61815
+ }
61804
61816
  }
61805
61817
  },
61806
61818
  [sizeColumns]
@@ -63209,13 +63221,22 @@ const TextInputFormatted = (props) => {
63209
63221
  type: "text",
63210
63222
  spellCheck: true,
63211
63223
  defaultValue: props.value,
63212
- ...lodashEs.omit(props, ["error", "value", "helpText", "formatted", "className", "allowTabToSave"]),
63224
+ ...lodashEs.omit(props, [
63225
+ "error",
63226
+ "value",
63227
+ "helpText",
63228
+ "formatted",
63229
+ "className",
63230
+ "allowTabToSave",
63231
+ "validationSummary"
63232
+ ]),
63213
63233
  className: "LuiTextInput-input",
63214
63234
  onMouseEnter: (e) => {
63215
63235
  e.currentTarget.focus();
63216
63236
  props.onMouseEnter?.(e);
63217
63237
  },
63218
- "data-allowtabtosave": props.allowTabToSave
63238
+ "data-allowtabtosave": props.allowTabToSave,
63239
+ "data-validationsummary": props.validationSummary
63219
63240
  }
63220
63241
  ),
63221
63242
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "LuiTextInput-formatted", children: props.formatted })
@@ -63408,6 +63429,24 @@ const TextInputValidator = (props, value, data, context) => {
63408
63429
  }
63409
63430
  return null;
63410
63431
  };
63432
+ const textInputValidatorPropsToSummary = (props) => {
63433
+ const parts = [];
63434
+ if (props.required) parts.push("required");
63435
+ if (props.maxLength != null) parts.push(`maxLength=${props.maxLength}`);
63436
+ if (props.maxBytes != null) parts.push(`maxBytes=${props.maxBytes}`);
63437
+ if (props.invalid) parts.push("invalid");
63438
+ const nf = props.numberFormat;
63439
+ if (nf) {
63440
+ if (nf.precision != null) parts.push(`precision=${nf.precision}`);
63441
+ if (nf.scale != null) parts.push(`scale=${nf.scale}`);
63442
+ if (nf.gtMin != null) parts.push(`gtMin=${nf.gtMin}`);
63443
+ if (nf.geMin != null) parts.push(`geMin=${nf.geMin}`);
63444
+ if (nf.ltMax != null) parts.push(`ltMax=${nf.ltMax}`);
63445
+ if (nf.leMax != null) parts.push(`leMax=${nf.leMax}`);
63446
+ if (nf.notZero) parts.push("notZero");
63447
+ }
63448
+ return parts.join(",");
63449
+ };
63411
63450
 
63412
63451
  const GridFormInlineTextInput = (props) => {
63413
63452
  const { onSave } = props;
@@ -64133,7 +64172,8 @@ const GridFormSubComponentTextInput = (props) => {
64133
64172
  helpText,
64134
64173
  placeholder: props.placeholder,
64135
64174
  style: { width: "100%" },
64136
- allowTabToSave: true
64175
+ allowTabToSave: true,
64176
+ validationSummary: textInputValidatorPropsToSummary(props)
64137
64177
  }
64138
64178
  );
64139
64179
  };
@@ -64214,7 +64254,8 @@ const GridFormTextInput = (props) => {
64214
64254
  formatted: props.units,
64215
64255
  style: { width: props.width ?? 240 },
64216
64256
  placeholder: props.placeholder ?? "Type here",
64217
- helpText
64257
+ helpText,
64258
+ validationSummary: textInputValidatorPropsToSummary(props)
64218
64259
  }
64219
64260
  ) })
64220
64261
  );
@@ -64231,7 +64272,9 @@ const ButtonCellRenderer = (props) => {
64231
64272
  };
64232
64273
  api.addEventListener("cellFocused", checkFocus);
64233
64274
  return () => {
64234
- api.removeEventListener("cellFocused", checkFocus);
64275
+ if (!api.isDestroyed()) {
64276
+ api.removeEventListener("cellFocused", checkFocus);
64277
+ }
64235
64278
  };
64236
64279
  }, [api, column, node.rowIndex]);
64237
64280
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -64319,7 +64362,11 @@ const BooleanCellRenderer = (props) => {
64319
64362
  }
64320
64363
  };
64321
64364
  api.addEventListener("cellFocused", checkFocus);
64322
- return () => void api.removeEventListener("cellFocused", checkFocus);
64365
+ return () => {
64366
+ if (!api.isDestroyed()) {
64367
+ api.removeEventListener("cellFocused", checkFocus);
64368
+ }
64369
+ };
64323
64370
  }, [api, column, node.rowIndex]);
64324
64371
  const isDisabled = !fnOrVar(colDef?.editable, props);
64325
64372
  const toggleCheckbox = React13.useCallback(() => {
@@ -64883,6 +64930,9 @@ const GridContextProvider = (props) => {
64883
64930
  if (!gridApi || gridApi.isDestroyed() || !gridApi.getColumnState()) {
64884
64931
  return null;
64885
64932
  }
64933
+ if (isChromatic()) {
64934
+ return { width: lodashEs.sumBy(gridApi.getColumnState(), (colState) => colState.hide ? 0 : colState.width ?? 0) };
64935
+ }
64886
64936
  try {
64887
64937
  const colIdsSet = colIds instanceof Set ? colIds : new Set(colIds);
64888
64938
  const getVisibleColStates = () => {
@@ -64936,7 +64986,7 @@ const GridContextProvider = (props) => {
64936
64986
  );
64937
64987
  const sizeColumnsToFit = React13.useCallback(
64938
64988
  (paramsOrGridWidth) => {
64939
- if (gridApi && !gridApi?.isDestroyed()) {
64989
+ if (gridApi && !gridApi?.isDestroyed() && !isChromatic()) {
64940
64990
  gridApi.sizeColumnsToFit(paramsOrGridWidth);
64941
64991
  }
64942
64992
  },
@@ -65583,6 +65633,7 @@ exports.reorderRows = reorderRows;
65583
65633
  exports.sanitiseFileName = sanitiseFileName;
65584
65634
  exports.stringByteLengthIsInvalid = stringByteLengthIsInvalid;
65585
65635
  exports.suppressCellKeyboardEvents = suppressCellKeyboardEvents;
65636
+ exports.textInputValidatorPropsToSummary = textInputValidatorPropsToSummary;
65586
65637
  exports.textMatch = textMatch;
65587
65638
  exports.useDeferredPromise = useDeferredPromise;
65588
65639
  exports.useGridContext = useGridContext;