@linzjs/step-ag-grid 34.0.0 → 34.0.2
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.
- package/dist/src/lui/TextInputFormatted.d.ts +1 -0
- package/dist/step-ag-grid.cjs +25 -8
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +25 -8
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +9 -5
- package/src/components/gridForm/GridFormTextInput.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +1 -1
- package/src/lui/TextInputFormatted.tsx +25 -2
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +1 -0
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -61170,7 +61170,7 @@ const Grid = ({
|
|
|
61170
61170
|
// ─── Spread Remaining Params ──────────────────
|
|
61171
61171
|
...params
|
|
61172
61172
|
}) => {
|
|
61173
|
-
if (isChromatic()) {
|
|
61173
|
+
if (isChromatic() && sizeColumns !== "fit") {
|
|
61174
61174
|
sizeColumns = "none";
|
|
61175
61175
|
}
|
|
61176
61176
|
const {
|
|
@@ -61405,13 +61405,15 @@ const Grid = ({
|
|
|
61405
61405
|
...colDef.cellClassRules,
|
|
61406
61406
|
"GridCell-readonly": (ccp) => !suppressReadOnlyStyle && !editable(ccp)
|
|
61407
61407
|
},
|
|
61408
|
-
// If chromatic we fix the size to minWidth if set otherwise 120px
|
|
61409
|
-
//
|
|
61410
|
-
|
|
61408
|
+
// If chromatic we fix the size to minWidth if set otherwise 120px, so non-deterministic
|
|
61409
|
+
// content measurement doesn't affect the snapshot - except under 'fit', which sizes via
|
|
61410
|
+
// flex (proportional to the container) rather than measured content, so it's already
|
|
61411
|
+
// deterministic and must keep the user's configured width.
|
|
61412
|
+
width: isChromatic() && sizeColumns !== "fit" ? colDef.minWidth || 120 : colDef.width
|
|
61411
61413
|
};
|
|
61412
61414
|
}
|
|
61413
61415
|
},
|
|
61414
|
-
[params.defaultColDef?.editable, params.loading, params.readOnly, suppressReadOnlyStyle]
|
|
61416
|
+
[params.defaultColDef?.editable, params.loading, params.readOnly, suppressReadOnlyStyle, sizeColumns]
|
|
61415
61417
|
);
|
|
61416
61418
|
const columnDefs = useMemo(() => {
|
|
61417
61419
|
return params.columnDefs.map(mapColDef);
|
|
@@ -63206,7 +63208,18 @@ const GridFormDropDown = (props) => {
|
|
|
63206
63208
|
var css_248z$1 = ".LuiTextInput.GridLuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#6b6966;line-height:48px;position:absolute;right:14px;top:0}";
|
|
63207
63209
|
styleInject(css_248z$1);
|
|
63208
63210
|
|
|
63211
|
+
const FORMATTED_GAP = 8;
|
|
63209
63212
|
const TextInputFormatted = (props) => {
|
|
63213
|
+
const formattedRef = useRef(null);
|
|
63214
|
+
const [formattedPadding, setFormattedPadding] = useState(void 0);
|
|
63215
|
+
useLayoutEffect(() => {
|
|
63216
|
+
if (!props.formatted) {
|
|
63217
|
+
setFormattedPadding(void 0);
|
|
63218
|
+
return;
|
|
63219
|
+
}
|
|
63220
|
+
const formattedWidth = formattedRef.current?.offsetWidth ?? 0;
|
|
63221
|
+
setFormattedPadding(formattedWidth + 14 + FORMATTED_GAP);
|
|
63222
|
+
}, [props.formatted]);
|
|
63210
63223
|
return /* @__PURE__ */ jsxs(
|
|
63211
63224
|
"div",
|
|
63212
63225
|
{
|
|
@@ -63215,6 +63228,7 @@ const TextInputFormatted = (props) => {
|
|
|
63215
63228
|
props.error && "hasError",
|
|
63216
63229
|
props.className
|
|
63217
63230
|
),
|
|
63231
|
+
style: { width: props.width, ...props.style },
|
|
63218
63232
|
children: [
|
|
63219
63233
|
/* @__PURE__ */ jsxs("span", { className: "LuiTextInput-inputWrapper", children: [
|
|
63220
63234
|
/* @__PURE__ */ jsx(
|
|
@@ -63225,14 +63239,17 @@ const TextInputFormatted = (props) => {
|
|
|
63225
63239
|
defaultValue: props.value,
|
|
63226
63240
|
...omit(props, [
|
|
63227
63241
|
"error",
|
|
63242
|
+
"width",
|
|
63228
63243
|
"value",
|
|
63229
63244
|
"helpText",
|
|
63230
63245
|
"formatted",
|
|
63231
63246
|
"className",
|
|
63232
63247
|
"allowTabToSave",
|
|
63233
|
-
"validationSummary"
|
|
63248
|
+
"validationSummary",
|
|
63249
|
+
"style"
|
|
63234
63250
|
]),
|
|
63235
63251
|
className: "LuiTextInput-input",
|
|
63252
|
+
style: formattedPadding != null ? { paddingRight: formattedPadding } : void 0,
|
|
63236
63253
|
onMouseEnter: (e) => {
|
|
63237
63254
|
e.currentTarget.focus();
|
|
63238
63255
|
props.onMouseEnter?.(e);
|
|
@@ -63241,7 +63258,7 @@ const TextInputFormatted = (props) => {
|
|
|
63241
63258
|
"data-validationsummary": props.validationSummary
|
|
63242
63259
|
}
|
|
63243
63260
|
),
|
|
63244
|
-
/* @__PURE__ */ jsx("span", { className: "LuiTextInput-formatted", children: props.formatted })
|
|
63261
|
+
/* @__PURE__ */ jsx("span", { className: "LuiTextInput-formatted", ref: formattedRef, children: props.formatted })
|
|
63245
63262
|
] }),
|
|
63246
63263
|
/* @__PURE__ */ jsx(FormError, { error: props.error, helpText: props.helpText })
|
|
63247
63264
|
]
|
|
@@ -64265,8 +64282,8 @@ const GridFormTextInput = (props) => {
|
|
|
64265
64282
|
setValue(e.target.value);
|
|
64266
64283
|
},
|
|
64267
64284
|
error: invalid(),
|
|
64285
|
+
width: props.width ?? 264,
|
|
64268
64286
|
formatted: props.units,
|
|
64269
|
-
style: { width: props.width ?? 240 },
|
|
64270
64287
|
placeholder: props.placeholder ?? "Type here",
|
|
64271
64288
|
helpText,
|
|
64272
64289
|
validationSummary: textInputValidatorPropsToSummary(props)
|