@linzjs/step-ag-grid 2.1.3 → 2.2.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.
- package/dist/index.js +106 -14
- package/dist/index.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/lui/ActionButton.d.ts +15 -0
- package/dist/src/lui/reactUtils.d.ts +6 -0
- package/dist/src/lui/reactUtils.test.d.ts +1 -0
- package/dist/src/lui/stateDeferredHook.d.ts +4 -0
- package/dist/src/lui/timeoutHook.d.ts +8 -0
- package/dist/src/lui/timeoutHook.test.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +107 -16
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +2 -0
- package/src/lui/ActionButton.scss +32 -0
- package/src/lui/ActionButton.tsx +76 -0
- package/src/lui/reactUtils.test.tsx +47 -0
- package/src/lui/reactUtils.tsx +14 -0
- package/src/lui/stateDeferredHook.tsx +29 -0
- package/src/lui/timeoutHook.test.tsx +38 -0
- package/src/lui/timeoutHook.tsx +40 -0
- package/src/stories/components/ActionButton.stories.tsx +33 -0
- package/src/stories/{components → grid}/FormTest.scss +0 -0
- package/src/stories/{components → grid}/FormTest.tsx +0 -0
- package/src/stories/{components → grid}/GridPopoutBearing.stories.tsx +7 -10
- package/src/stories/{components → grid}/GridPopoutEditDropDown.stories.tsx +20 -23
- package/src/stories/{components → grid}/GridPopoutEditGeneric.stories.tsx +6 -9
- package/src/stories/{components → grid}/GridPopoutEditGenericTextArea.stories.tsx +57 -18
- package/src/stories/{components → grid}/GridPopoutEditMultiSelect.stories.tsx +6 -9
- package/src/stories/{components → grid}/GridReadOnly.stories.tsx +6 -8
- /package/src/stories/{components → react-menu}/ReactMenu.stories.tsx +0 -0
package/dist/index.js
CHANGED
|
@@ -2520,11 +2520,11 @@ function styleInject(css, ref) {
|
|
|
2520
2520
|
}
|
|
2521
2521
|
}
|
|
2522
2522
|
|
|
2523
|
-
var css_248z$
|
|
2524
|
-
styleInject(css_248z$
|
|
2523
|
+
var css_248z$7 = ".AgGridGenericCellRenderer-icon{margin-right:4px}.AgGridGenericCellRenderer-ic_infoIcon{fill:#3a7cdf;margin-right:4px}.AgGridGenericCellRenderer-ic_warningIcon{fill:#ea6a2e;margin-right:4px}";
|
|
2524
|
+
styleInject(css_248z$7);
|
|
2525
2525
|
|
|
2526
|
-
var css_248z$
|
|
2527
|
-
styleInject(css_248z$
|
|
2526
|
+
var css_248z$6 = ".GridLoadableCell-container{align-items:center;display:flex}";
|
|
2527
|
+
styleInject(css_248z$6);
|
|
2528
2528
|
|
|
2529
2529
|
var GridLoadableCell = function (props) {
|
|
2530
2530
|
if (props.isLoading) {
|
|
@@ -2746,11 +2746,11 @@ var GridRenderPopoutMenuCell = function (props) {
|
|
|
2746
2746
|
return (jsxRuntime.jsx(GridLoadableCell, __assign({ isLoading: isLoading, className: disabled ? "GridPopoutMenu-burgerDisabled" : "GridPopoutMenu-burger" }, { children: jsxRuntime.jsx(lui.LuiIcon, { name: "ic_more_vert", alt: "More actions", size: "md" }) })));
|
|
2747
2747
|
};
|
|
2748
2748
|
|
|
2749
|
-
var css_248z$
|
|
2750
|
-
styleInject(css_248z$
|
|
2749
|
+
var css_248z$5 = ".GridMultiSelect-containerSmall .GridFormMultiSelect-options{max-height:130px;overflow-y:auto}.GridMultiSelect-containerMedium .GridFormMultiSelect-options{max-height:190px;overflow-y:auto}.GridMultiSelect-containerLarge .GridFormMultiSelect-options{max-height:320px;overflow-y:auto}.GridMultiSelect-containerUnlimited .GridFormMultiSelect-options{overflow-y:auto}";
|
|
2750
|
+
styleInject(css_248z$5);
|
|
2751
2751
|
|
|
2752
|
-
var css_248z$
|
|
2753
|
-
styleInject(css_248z$
|
|
2752
|
+
var css_248z$4 = ".GridPopoverEditDropDown-containerSmall .GridFormDropDown-options{max-height:120px;overflow-y:auto}.GridPopoverEditDropDown-containerMedium .GridFormDropDown-options{max-height:200px;overflow-y:auto}.GridPopoverEditDropDown-containerLarge .GridFormDropDown-options{max-height:400px;overflow-y:auto}.GridPopoverEditDropDown-containerUnlimited .GridFormDropDown-options{overflow-y:auto}";
|
|
2753
|
+
styleInject(css_248z$4);
|
|
2754
2754
|
|
|
2755
2755
|
/* global setTimeout, clearTimeout */
|
|
2756
2756
|
|
|
@@ -3122,8 +3122,8 @@ var GridPopoutEditMultiSelect = function (colDef, props) {
|
|
|
3122
3122
|
return GridCell(__assign({ initialWidth: 65, maxWidth: 150 }, colDef), __assign(__assign({ editor: GridFormMultiSelect }, props), { editorParams: __assign({ className: "GridMultiSelect-containerMedium" }, props.editorParams) }));
|
|
3123
3123
|
};
|
|
3124
3124
|
|
|
3125
|
-
var css_248z$
|
|
3126
|
-
styleInject(css_248z$
|
|
3125
|
+
var css_248z$3 = ".GridPopoutMenu-burger{cursor:pointer}.GridPopoutMenu-burger svg{fill:#007198}.GridPopoutMenu-burgerDisabled svg{fill:#989189}";
|
|
3126
|
+
styleInject(css_248z$3);
|
|
3127
3127
|
|
|
3128
3128
|
/** Menu configuration types **/
|
|
3129
3129
|
var PopoutMenuSeparator = Object.freeze({ __isMenuSeparator__: true });
|
|
@@ -3286,11 +3286,11 @@ var convertDDToDMS = function (dd, showPositiveSymbol, addTrailingZeros) {
|
|
|
3286
3286
|
return dmsString;
|
|
3287
3287
|
};
|
|
3288
3288
|
|
|
3289
|
-
var css_248z$
|
|
3290
|
-
styleInject(css_248z$
|
|
3289
|
+
var css_248z$2 = ".GridFormEditBearing-input{width:320px}";
|
|
3290
|
+
styleInject(css_248z$2);
|
|
3291
3291
|
|
|
3292
|
-
var css_248z = ".LuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#beb9b4;line-height:48px;position:absolute;right:14px;top:0}";
|
|
3293
|
-
styleInject(css_248z);
|
|
3292
|
+
var css_248z$1 = ".LuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#beb9b4;line-height:48px;position:absolute;right:14px;top:0}";
|
|
3293
|
+
styleInject(css_248z$1);
|
|
3294
3294
|
|
|
3295
3295
|
var TextInputFormatted = function (props) {
|
|
3296
3296
|
return (jsxRuntime.jsxs("div", __assign({ className: clsx("LuiTextInput Grid-popoverContainer", props.error && "hasError", props.warning && "hasWarning", props.className) }, { children: [jsxRuntime.jsxs("span", __assign({ className: "LuiTextInput-inputWrapper" }, { children: [jsxRuntime.jsx("input", __assign({ type: "text", className: "LuiTextInput-input", min: "0", value: props.value, onChange: props.onChange }, props.inputProps)), jsxRuntime.jsx("span", __assign({ className: "LuiTextInput-formatted" }, { children: props.formatted }))] })), props.error && (jsxRuntime.jsxs("span", __assign({ className: "LuiTextInput-error" }, { children: [jsxRuntime.jsx(lui.LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextInput-error-icon", size: "sm", status: "error" }), props.error] }))), props.warning && (jsxRuntime.jsxs("span", __assign({ className: "LuiTextInput-warning" }, { children: [jsxRuntime.jsx(lui.LuiIcon, { alt: "warning", name: "ic_warning", className: "LuiTextInput-warning-icon", size: "sm", status: "warning" }), props.warning] })))] })));
|
|
@@ -3592,6 +3592,98 @@ var GridSubComponentTextArea = function (props) {
|
|
|
3592
3592
|
return (jsxRuntime.jsx("div", __assign({ className: "FreeTextInput LuiDeprecatedForms" }, { children: jsxRuntime.jsx("textarea", { autoFocus: true, maxLength: 10000, spellCheck: true, className: "free-text-input", onChange: function (e) { return setValue(e.target.value); }, defaultValue: value }) })));
|
|
3593
3593
|
};
|
|
3594
3594
|
|
|
3595
|
+
var css_248z = ".ActionButton{align-items:center;display:flex}.ActionButton .LuiIcon{margin:0 4px!important}.ActionButton-minimalArea{position:relative}.ActionButton-minimalAreaDisplay{position:absolute}.ActionButton-minimalAreaExpand{visibility:hidden}.ActionButton-inProgress{background-color:#e2f3f7!important;color:#007198!important;cursor:progress}.ActionButton-inProgress svg *{fill:#0000!important}";
|
|
3596
|
+
styleInject(css_248z);
|
|
3597
|
+
|
|
3598
|
+
/**
|
|
3599
|
+
* Track previous values of states.
|
|
3600
|
+
*
|
|
3601
|
+
* @param value Value to track.
|
|
3602
|
+
*/
|
|
3603
|
+
var usePrevious = function (value) {
|
|
3604
|
+
var ref = react.useRef();
|
|
3605
|
+
react.useEffect(function () {
|
|
3606
|
+
ref.current = value;
|
|
3607
|
+
}, [value]);
|
|
3608
|
+
return ref.current;
|
|
3609
|
+
};
|
|
3610
|
+
|
|
3611
|
+
/**
|
|
3612
|
+
* Cancels timeouts on scope being destroyed.
|
|
3613
|
+
*
|
|
3614
|
+
* This could almost be a debounce, but debounce tracks by function reference, this tracks by hook reference.
|
|
3615
|
+
* This could have been implemented using debounce if the callers function was wrapped in useCallback,
|
|
3616
|
+
* but there's no way to enforce that, so it would lead to bugs.
|
|
3617
|
+
*/
|
|
3618
|
+
var useTimeoutHook = function () {
|
|
3619
|
+
var timeout = react.useRef();
|
|
3620
|
+
/**
|
|
3621
|
+
* Clear any pending timeouts.
|
|
3622
|
+
*/
|
|
3623
|
+
var clearTimeouts = function () {
|
|
3624
|
+
if (timeout.current) {
|
|
3625
|
+
var tc = timeout.current;
|
|
3626
|
+
timeout.current = undefined;
|
|
3627
|
+
clearTimeout(tc);
|
|
3628
|
+
}
|
|
3629
|
+
};
|
|
3630
|
+
/**
|
|
3631
|
+
* Call this when your action has completed.
|
|
3632
|
+
*/
|
|
3633
|
+
var invoke = react.useCallback(function (fn, waitTimeMs) {
|
|
3634
|
+
clearTimeouts();
|
|
3635
|
+
timeout.current = setTimeout(fn, waitTimeMs);
|
|
3636
|
+
}, []);
|
|
3637
|
+
/**
|
|
3638
|
+
* Clear timeout on loss of scope.
|
|
3639
|
+
*/
|
|
3640
|
+
react.useEffect(function () {
|
|
3641
|
+
return function () { return clearTimeouts(); };
|
|
3642
|
+
}, []);
|
|
3643
|
+
return invoke;
|
|
3644
|
+
};
|
|
3645
|
+
|
|
3646
|
+
/**
|
|
3647
|
+
* Defers state change up to a minimum time since last state change.
|
|
3648
|
+
*/
|
|
3649
|
+
var useStateDeferred = function (initialValue) {
|
|
3650
|
+
var startTime = react.useRef(0);
|
|
3651
|
+
var timeoutHook = useTimeoutHook();
|
|
3652
|
+
var _a = react.useState(initialValue), value = _a[0], _setValue = _a[1];
|
|
3653
|
+
var setValue = react.useCallback(function (newValue) {
|
|
3654
|
+
startTime.current = Date.now();
|
|
3655
|
+
_setValue(newValue);
|
|
3656
|
+
}, []);
|
|
3657
|
+
var setValueDeferred = react.useCallback(function (newValue, minimumWaitTimeMs) {
|
|
3658
|
+
var waitTimeMs = Math.max(minimumWaitTimeMs - (Date.now() - startTime.current), 0);
|
|
3659
|
+
timeoutHook(function () { return _setValue(newValue); }, waitTimeMs);
|
|
3660
|
+
}, [timeoutHook]);
|
|
3661
|
+
return [value, setValue, setValueDeferred];
|
|
3662
|
+
};
|
|
3663
|
+
|
|
3664
|
+
// Kept this less than one second, so I don't have issues with waitFor as it defaults to 1s
|
|
3665
|
+
var minimumInProgressTimeMs = 950;
|
|
3666
|
+
var ActionButton = function (_a) {
|
|
3667
|
+
var _b;
|
|
3668
|
+
var _c;
|
|
3669
|
+
var icon = _a.icon, name = _a.name, inProgressName = _a.inProgressName, dataTestId = _a.dataTestId, inProgress = _a.inProgress, className = _a.className, title = _a.title, onClick = _a.onClick, _d = _a.size, size = _d === void 0 ? "sm" : _d;
|
|
3670
|
+
var lastInProgress = usePrevious(inProgress !== null && inProgress !== void 0 ? inProgress : false);
|
|
3671
|
+
var _e = useStateDeferred(!!inProgress), localInProgress = _e[0], setLocalInProgress = _e[1], setLocalInProgressDeferred = _e[2];
|
|
3672
|
+
react.useEffect(function () {
|
|
3673
|
+
if (inProgress == lastInProgress)
|
|
3674
|
+
return;
|
|
3675
|
+
inProgress ? setLocalInProgress(true) : setLocalInProgressDeferred(false, minimumInProgressTimeMs);
|
|
3676
|
+
}, [inProgress, lastInProgress, setLocalInProgress, setLocalInProgressDeferred]);
|
|
3677
|
+
return (jsxRuntime.jsxs(lui.LuiButton, __assign({ "data-testid": dataTestId, type: "button", level: "tertiary", title: title !== null && title !== void 0 ? title : name, "aria-label": name, className: clsx("lui-button-icon", "ActionButton", className, localInProgress && "ActionButton-inProgress"), size: "lg", onClick: onClick, disabled: localInProgress }, { children: [localInProgress ? (jsxRuntime.jsx(lui.LuiMiniSpinner, { size: 16, divProps: (_b = {
|
|
3678
|
+
"data-testid": "loading-spinner",
|
|
3679
|
+
style: { padding: 0, margin: 0, paddingRight: 8 },
|
|
3680
|
+
role: "status"
|
|
3681
|
+
},
|
|
3682
|
+
_b["aria-label"] = "Loading",
|
|
3683
|
+
_b) })) : (jsxRuntime.jsx(lui.LuiIcon, { name: icon, alt: name, size: size })), jsxRuntime.jsxs("span", __assign({ className: "ActionButton-minimalArea" }, { children: [jsxRuntime.jsx("span", __assign({ className: "ActionButton-minimalAreaDisplay" }, { children: (_c = (localInProgress ? inProgressName : name)) !== null && _c !== void 0 ? _c : name })), jsxRuntime.jsx("span", __assign({ className: "ActionButton-minimalAreaExpand" }, { children: name }))] }))] })));
|
|
3684
|
+
};
|
|
3685
|
+
|
|
3686
|
+
exports.ActionButton = ActionButton;
|
|
3595
3687
|
exports.ComponentLoadingWrapper = ComponentLoadingWrapper;
|
|
3596
3688
|
exports.ControlledMenu = ControlledMenu;
|
|
3597
3689
|
exports.FocusableItem = FocusableItem;
|