@linzjs/step-ag-grid 3.0.2 → 4.0.1
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 +283 -217
- package/dist/index.js.map +1 -1
- package/dist/src/components/GridPopoverHook.d.ts +13 -1
- package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +11 -0
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +8 -8
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +3 -4
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +3 -4
- package/dist/src/index.d.ts +1 -1
- package/dist/src/lui/TextAreaInput.d.ts +4 -5
- package/dist/src/lui/TextInputFormatted.d.ts +4 -10
- package/dist/src/utils/textValidator.d.ts +6 -0
- package/dist/step-ag-grid.esm.js +283 -217
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +2 -2
- package/src/components/GridCell.tsx +5 -0
- package/src/components/GridPopoverHook.tsx +79 -1
- package/src/components/gridForm/GridFormDropDown.tsx +63 -56
- package/src/components/gridForm/GridFormEditBearing.tsx +7 -8
- package/src/components/gridForm/GridFormMultiSelect.tsx +6 -10
- package/src/components/gridForm/GridFormPopoverMenu.tsx +7 -10
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +58 -0
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +48 -55
- package/src/components/gridForm/GridFormTextArea.tsx +10 -18
- package/src/components/gridForm/GridFormTextInput.tsx +12 -25
- package/src/contexts/GridPopoverContextProvider.tsx +11 -4
- package/src/index.ts +1 -1
- package/src/lui/TextAreaInput.tsx +34 -18
- package/src/lui/TextInputFormatted.tsx +19 -35
- package/src/react-menu3/components/MenuItem.tsx +5 -2
- package/src/stories/grid/FormTest.tsx +16 -3
- package/src/stories/grid/GridPopoutEditDropDown.stories.tsx +20 -17
- package/src/stories/grid/GridPopoutEditMultiSelect.stories.tsx +2 -2
- package/src/stories/grid/GridReadOnly.stories.tsx +15 -3
- package/src/utils/textValidator.ts +24 -0
- package/dist/src/components/GridSubComponentTextArea.d.ts +0 -10
- package/src/components/GridSubComponentTextArea.tsx +0 -62
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -1685,7 +1685,10 @@ var MenuItemFr = function (_a) {
|
|
|
1685
1685
|
safeCall(radioGroup.onRadioChange, event);
|
|
1686
1686
|
eventHandlers.handleClick(event, isCheckBox || isRadio);
|
|
1687
1687
|
};
|
|
1688
|
-
|
|
1688
|
+
/**
|
|
1689
|
+
* Keyboard events are triggered on up, otherwise sub-components get spaces and enters typed in them
|
|
1690
|
+
*/
|
|
1691
|
+
var handleKeyUp = function (e) {
|
|
1689
1692
|
if (!isHovering)
|
|
1690
1693
|
return;
|
|
1691
1694
|
switch (e.key) {
|
|
@@ -1707,7 +1710,7 @@ var MenuItemFr = function (_a) {
|
|
|
1707
1710
|
checked: isChecked,
|
|
1708
1711
|
anchor: isAnchor
|
|
1709
1712
|
}); }, [type, isDisabled, isHovering, isChecked, isAnchor]);
|
|
1710
|
-
var mergedProps = mergeProps(__assign(__assign({}, restStateProps), { onPointerDown: setHover,
|
|
1713
|
+
var mergedProps = mergeProps(__assign(__assign({}, restStateProps), { onPointerDown: setHover, onKeyUp: handleKeyUp, onClick: handleClick }), restProps);
|
|
1711
1714
|
// Order of props overriding (same in all components):
|
|
1712
1715
|
// 1. Preset props adhering to WAI-ARIA Authoring Practices.
|
|
1713
1716
|
// 2. Merged outer and local props
|
|
@@ -2201,7 +2204,7 @@ var useGridPopoverContext = function () {
|
|
|
2201
2204
|
var GridPopoverContextProvider = function (_a) {
|
|
2202
2205
|
var _b, _c, _d;
|
|
2203
2206
|
var props = _a.props, children = _a.children;
|
|
2204
|
-
var _e = useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells;
|
|
2207
|
+
var _e = useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells, stopEditing = _e.stopEditing;
|
|
2205
2208
|
var anchorRef = useRef(props.eGridCell);
|
|
2206
2209
|
var _f = useState(false), saving = _f[0], setSaving = _f[1];
|
|
2207
2210
|
var colDef = props.colDef;
|
|
@@ -2210,18 +2213,23 @@ var GridPopoverContextProvider = function (_a) {
|
|
|
2210
2213
|
// Then item that is clicked on will always be first in the list
|
|
2211
2214
|
var selectedRows = useMemo(function () { return (multiEdit ? sortBy(getSelectedRows(), function (row) { return row.id !== props.data.id; }) : [props.data]); }, [getSelectedRows, multiEdit, props.data]);
|
|
2212
2215
|
var field = (_d = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.field) !== null && _d !== void 0 ? _d : "";
|
|
2213
|
-
var updateValue = useCallback(function (saveFn) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2216
|
+
var updateValue = useCallback(function (saveFn) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2217
|
+
var result;
|
|
2218
|
+
return __generator(this, function (_a) {
|
|
2219
|
+
switch (_a.label) {
|
|
2220
|
+
case 0:
|
|
2221
|
+
result = false;
|
|
2222
|
+
if (!!saving) return [3 /*break*/, 2];
|
|
2223
|
+
return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving)];
|
|
2224
|
+
case 1:
|
|
2225
|
+
result = _a.sent();
|
|
2226
|
+
if (result)
|
|
2227
|
+
stopEditing();
|
|
2228
|
+
_a.label = 2;
|
|
2229
|
+
case 2: return [2 /*return*/, result];
|
|
2230
|
+
}
|
|
2231
|
+
});
|
|
2232
|
+
}); }, [field, saving, selectedRows, stopEditing, updatingCells]);
|
|
2225
2233
|
return (jsx(GridPopoverContext.Provider, __assign({ value: {
|
|
2226
2234
|
anchorRef: anchorRef,
|
|
2227
2235
|
saving: saving,
|
|
@@ -2620,7 +2628,7 @@ var Grid = function (params) {
|
|
|
2620
2628
|
startCellEditing(event);
|
|
2621
2629
|
}
|
|
2622
2630
|
}, [startCellEditing]);
|
|
2623
|
-
var
|
|
2631
|
+
var onCellKeyPress = useCallback(function (e) {
|
|
2624
2632
|
if (e.event.key === "Enter")
|
|
2625
2633
|
startCellEditing(e);
|
|
2626
2634
|
}, [startCellEditing]);
|
|
@@ -2638,7 +2646,7 @@ var Grid = function (params) {
|
|
|
2638
2646
|
}, [columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.length, sizeColumnsToFit]);
|
|
2639
2647
|
return (jsxs("div", __assign({ "data-testid": params.dataTestId, className: clsx("Grid-container", "ag-theme-alpine", staleGrid && "Grid-sortIsStale") }, { children: [params.quickFilter && (jsx("div", __assign({ className: "Grid-quickFilter" }, { children: jsx("input", { "aria-label": "Search", className: "lui-margin-top-xxs lui-margin-bottom-xxs Grid-quickFilterBox", type: "text", placeholder: (_a = params.quickFilterPlaceholder) !== null && _a !== void 0 ? _a : "Search...", value: internalQuickFilter, onChange: function (event) {
|
|
2640
2648
|
setInternalQuickFilter(event.target.value);
|
|
2641
|
-
} }) }))), jsx(AgGridReact, { getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true,
|
|
2649
|
+
} }) }))), jsx(AgGridReact, { getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, onCellEditingStopped: onCellEditingStopped, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_b = params.postSortRows) !== null && _b !== void 0 ? _b : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection })] })));
|
|
2642
2650
|
};
|
|
2643
2651
|
|
|
2644
2652
|
var GenericMultiEditCellClass = function (props) {
|
|
@@ -2681,12 +2689,12 @@ function styleInject(css, ref) {
|
|
|
2681
2689
|
}
|
|
2682
2690
|
}
|
|
2683
2691
|
|
|
2684
|
-
var css_248z$
|
|
2685
|
-
styleInject(css_248z$8);
|
|
2686
|
-
|
|
2687
|
-
var css_248z$7 = ".GridLoadableCell-container{align-items:center;display:flex}";
|
|
2692
|
+
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}";
|
|
2688
2693
|
styleInject(css_248z$7);
|
|
2689
2694
|
|
|
2695
|
+
var css_248z$6 = ".GridLoadableCell-container{align-items:center;display:flex}";
|
|
2696
|
+
styleInject(css_248z$6);
|
|
2697
|
+
|
|
2690
2698
|
var GridLoadableCell = function (props) {
|
|
2691
2699
|
if (props.isLoading) {
|
|
2692
2700
|
return (jsx("div", __assign({ style: { display: "flex", alignItems: "center" } }, { children: jsx(LuiMiniSpinner, { size: 22, divProps: { role: "status", "aria-label": "Loading", style: { marginBottom: 4 } } }) })));
|
|
@@ -2732,11 +2740,15 @@ var GridCellRenderer = function (props) {
|
|
|
2732
2740
|
*/
|
|
2733
2741
|
var GridCell = function (props, custom) {
|
|
2734
2742
|
var _a;
|
|
2735
|
-
return __assign(__assign(__assign(__assign(__assign({ colId: props.field, sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true }, ((custom === null || custom === void 0 ? void 0 : custom.editor) && {
|
|
2743
|
+
return __assign(__assign(__assign(__assign(__assign(__assign({ colId: props.field, sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true }, ((custom === null || custom === void 0 ? void 0 : custom.editor) && {
|
|
2736
2744
|
cellClass: (custom === null || custom === void 0 ? void 0 : custom.multiEdit) ? GenericMultiEditCellClass : undefined,
|
|
2737
2745
|
editable: (_a = props.editable) !== null && _a !== void 0 ? _a : true,
|
|
2738
2746
|
cellEditor: GenericCellEditorComponentWrapper(custom)
|
|
2739
|
-
})),
|
|
2747
|
+
})), { suppressKeyboardEvent: function (e) {
|
|
2748
|
+
// It's important that aggrid doesn't trigger edit on enter
|
|
2749
|
+
// as the incorrect selected rows will be returned
|
|
2750
|
+
return e.event.key === "Enter";
|
|
2751
|
+
} }), ((custom === null || custom === void 0 ? void 0 : custom.editorParams) && {
|
|
2740
2752
|
cellEditorParams: __assign(__assign({}, custom.editorParams), { multiEdit: custom.multiEdit })
|
|
2741
2753
|
})), {
|
|
2742
2754
|
// Default value formatter, otherwise react freaks out on objects
|
|
@@ -2805,8 +2817,77 @@ var useGridPopoverHook = function (props) {
|
|
|
2805
2817
|
}
|
|
2806
2818
|
});
|
|
2807
2819
|
}); }, [props.save, stopEditing, updateValue]);
|
|
2820
|
+
var onlyInputKeyboardEventHandlers = {
|
|
2821
|
+
onKeyUp: function (e) {
|
|
2822
|
+
var isTextArea = e.currentTarget.type === "textarea";
|
|
2823
|
+
if (e.key === "Enter" && !isTextArea) {
|
|
2824
|
+
e.preventDefault();
|
|
2825
|
+
e.stopPropagation();
|
|
2826
|
+
triggerSave().then();
|
|
2827
|
+
}
|
|
2828
|
+
else if (e.key === "Tab") {
|
|
2829
|
+
e.preventDefault();
|
|
2830
|
+
e.stopPropagation();
|
|
2831
|
+
}
|
|
2832
|
+
},
|
|
2833
|
+
onKeyDown: function (e) {
|
|
2834
|
+
var isTextArea = e.currentTarget.type === "textarea";
|
|
2835
|
+
if (e.key === "Enter" && !isTextArea) {
|
|
2836
|
+
e.preventDefault();
|
|
2837
|
+
e.stopPropagation();
|
|
2838
|
+
}
|
|
2839
|
+
else if (e.key === "Tab") {
|
|
2840
|
+
e.preventDefault();
|
|
2841
|
+
e.stopPropagation();
|
|
2842
|
+
!e.shiftKey && triggerSave().then();
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
};
|
|
2846
|
+
var firstInputKeyboardEventHandlers = {
|
|
2847
|
+
onKeyUp: function (e) {
|
|
2848
|
+
if (e.key === "Tab" && e.shiftKey) {
|
|
2849
|
+
e.preventDefault();
|
|
2850
|
+
e.stopPropagation();
|
|
2851
|
+
}
|
|
2852
|
+
},
|
|
2853
|
+
onKeyDown: function (e) {
|
|
2854
|
+
if (e.key === "Tab" && e.shiftKey) {
|
|
2855
|
+
e.preventDefault();
|
|
2856
|
+
e.stopPropagation();
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
};
|
|
2860
|
+
var lastInputKeyboardEventHandlers = {
|
|
2861
|
+
onKeyUp: function (e) {
|
|
2862
|
+
var isTextArea = e.currentTarget.type === "textarea";
|
|
2863
|
+
if (e.key === "Enter" && !isTextArea) {
|
|
2864
|
+
e.preventDefault();
|
|
2865
|
+
e.stopPropagation();
|
|
2866
|
+
triggerSave().then();
|
|
2867
|
+
}
|
|
2868
|
+
else if (e.key === "Tab" && !e.shiftKey) {
|
|
2869
|
+
e.preventDefault();
|
|
2870
|
+
e.stopPropagation();
|
|
2871
|
+
}
|
|
2872
|
+
},
|
|
2873
|
+
onKeyDown: function (e) {
|
|
2874
|
+
var isTextArea = e.currentTarget.type === "textarea";
|
|
2875
|
+
if (e.key === "Enter" && !isTextArea) {
|
|
2876
|
+
e.preventDefault();
|
|
2877
|
+
e.stopPropagation();
|
|
2878
|
+
}
|
|
2879
|
+
else if (e.key === "Tab" && !e.shiftKey) {
|
|
2880
|
+
e.preventDefault();
|
|
2881
|
+
e.stopPropagation();
|
|
2882
|
+
triggerSave().then();
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
};
|
|
2808
2886
|
var popoverWrapper = useCallback(function (children) {
|
|
2809
2887
|
return (jsx(Fragment$1, { children: anchorRef.current && (jsxs(ControlledMenu, __assign({ state: isOpen ? "open" : "closed", portal: true, unmountOnClose: true, anchorRef: anchorRef, saveButtonRef: saveButtonRef, menuClassName: "step-ag-grid-react-menu", onClose: function (event) {
|
|
2888
|
+
// Prevent menu from closing when modals are invoked
|
|
2889
|
+
if (event.reason === "blur")
|
|
2890
|
+
return;
|
|
2810
2891
|
triggerSave(event.reason).then();
|
|
2811
2892
|
}, viewScroll: "auto", dontShrinkIfDirectionIsTop: true, className: props.className, closeMenuExclusionClassName: "ReactModal__Content" }, { children: [saving && ( // This is the overlay that prevents editing when the editor is saving
|
|
2812
2893
|
jsx("div", { style: {
|
|
@@ -2821,7 +2902,10 @@ var useGridPopoverHook = function (props) {
|
|
|
2821
2902
|
}, [anchorRef, isOpen, props.className, saving, triggerSave]);
|
|
2822
2903
|
return {
|
|
2823
2904
|
popoverWrapper: popoverWrapper,
|
|
2824
|
-
triggerSave: triggerSave
|
|
2905
|
+
triggerSave: triggerSave,
|
|
2906
|
+
onlyInputKeyboardEventHandlers: onlyInputKeyboardEventHandlers,
|
|
2907
|
+
firstInputKeyboardEventHandlers: firstInputKeyboardEventHandlers,
|
|
2908
|
+
lastInputKeyboardEventHandlers: lastInputKeyboardEventHandlers
|
|
2825
2909
|
};
|
|
2826
2910
|
};
|
|
2827
2911
|
|
|
@@ -2844,12 +2928,12 @@ var GridRenderPopoutMenuCell = function (props) {
|
|
|
2844
2928
|
return (jsx(GridLoadableCell, __assign({ isLoading: isLoading, className: disabled ? "GridPopoutMenu-burgerDisabled" : "GridPopoutMenu-burger" }, { children: jsx(LuiIcon, { name: "ic_more_vert", alt: "More actions", size: "md" }) })));
|
|
2845
2929
|
};
|
|
2846
2930
|
|
|
2847
|
-
var css_248z$
|
|
2848
|
-
styleInject(css_248z$6);
|
|
2849
|
-
|
|
2850
|
-
var css_248z$5 = ".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}";
|
|
2931
|
+
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}";
|
|
2851
2932
|
styleInject(css_248z$5);
|
|
2852
2933
|
|
|
2934
|
+
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}";
|
|
2935
|
+
styleInject(css_248z$4);
|
|
2936
|
+
|
|
2853
2937
|
/* global setTimeout, clearTimeout */
|
|
2854
2938
|
|
|
2855
2939
|
var dist = function debounce(fn) {
|
|
@@ -2937,9 +3021,13 @@ var GridFormDropDown = function (props) {
|
|
|
2937
3021
|
var _c = useState([]), filteredValues = _c[0], setFilteredValues = _c[1];
|
|
2938
3022
|
var optionsInitialising = useRef(false);
|
|
2939
3023
|
var _d = useState(null), options = _d[0], setOptions = _d[1];
|
|
2940
|
-
var
|
|
3024
|
+
var subComponentIsValid = useRef(false);
|
|
3025
|
+
var _e = useState(), subSelectedValue = _e[0], setSubSelectedValue = _e[1];
|
|
3026
|
+
var _f = useState(), selectedSubComponent = _f[0], setSelectedSubComponent = _f[1];
|
|
2941
3027
|
var selectItemHandler = useCallback(function (value, subComponentValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2942
3028
|
return __generator(this, function (_a) {
|
|
3029
|
+
if (subComponentValue !== undefined && !subComponentIsValid.current)
|
|
3030
|
+
return [2 /*return*/, false];
|
|
2943
3031
|
return [2 /*return*/, updateValue(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2944
3032
|
var hasChanged;
|
|
2945
3033
|
return __generator(this, function (_a) {
|
|
@@ -3082,48 +3170,58 @@ var GridFormDropDown = function (props) {
|
|
|
3082
3170
|
}
|
|
3083
3171
|
});
|
|
3084
3172
|
}); }, [filteredValues, options, selectItemHandler, selectFilterHandler, stopEditing, filter, props]);
|
|
3085
|
-
var
|
|
3173
|
+
var save = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3174
|
+
return __generator(this, function (_a) {
|
|
3175
|
+
switch (_a.label) {
|
|
3176
|
+
case 0:
|
|
3177
|
+
// Handler for sub-selected value
|
|
3178
|
+
if (!selectedSubComponent)
|
|
3179
|
+
return [2 /*return*/, true];
|
|
3180
|
+
if (!subComponentIsValid.current)
|
|
3181
|
+
return [2 /*return*/, false];
|
|
3182
|
+
return [4 /*yield*/, selectItemHandler(selectedSubComponent.value, subSelectedValue)];
|
|
3183
|
+
case 1:
|
|
3184
|
+
_a.sent();
|
|
3185
|
+
return [2 /*return*/, true];
|
|
3186
|
+
}
|
|
3187
|
+
});
|
|
3188
|
+
}); }, [selectItemHandler, selectedSubComponent, subSelectedValue]);
|
|
3189
|
+
var popoverWrapper = useGridPopoverHook({ className: props.className, save: save }).popoverWrapper;
|
|
3086
3190
|
return popoverWrapper(jsxs(Fragment$1, { children: [props.filtered && (jsxs("div", __assign({ className: "GridFormDropDown-filter" }, { children: [jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
|
|
3087
3191
|
var _b;
|
|
3088
3192
|
var ref = _a.ref;
|
|
3089
3193
|
return (jsx("div", __assign({ style: { display: "flex", width: "100%" } }, { children: jsx("input", { autoFocus: true, className: "free-text-input", style: { border: "0px" }, ref: ref, type: "text", placeholder: (_b = props.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: filter, onChange: function (e) { return setFilter(e.target.value.toLowerCase()); }, onKeyDown: function (e) { return onFilterKeyDown(e); } }) })));
|
|
3090
3194
|
} })), jsx(MenuDivider, {}, "$$divider_filter")] }))), jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxs(Fragment$1, { children: [options && options.length == (filteredValues === null || filteredValues === void 0 ? void 0 : filteredValues.length) && (jsx(MenuItem, { children: "[Empty]" }, "".concat(fieldToString(field), "-empty"))), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
|
|
3091
3195
|
var _a;
|
|
3092
|
-
return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : filteredValues.includes(item.value) ? null : (
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
var subComponentValueIndex = localSubComponentValues.findIndex(function (_a) {
|
|
3098
|
-
var optionValue = _a.optionValue;
|
|
3099
|
-
return optionValue === item.value;
|
|
3100
|
-
});
|
|
3101
|
-
if (subComponentValueIndex !== -1) {
|
|
3102
|
-
localSubComponentValues[subComponentValueIndex].subComponentValue = value;
|
|
3196
|
+
return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxs("div", { children: [jsx(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function (e) {
|
|
3197
|
+
if (item.subComponent) {
|
|
3198
|
+
if (selectedSubComponent === item) {
|
|
3199
|
+
setSelectedSubComponent(null);
|
|
3200
|
+
subComponentIsValid.current = true;
|
|
3103
3201
|
}
|
|
3104
3202
|
else {
|
|
3105
|
-
|
|
3106
|
-
subComponentValue: value,
|
|
3107
|
-
optionValue: item.value
|
|
3108
|
-
});
|
|
3203
|
+
setSelectedSubComponent(item);
|
|
3109
3204
|
}
|
|
3110
|
-
|
|
3111
|
-
}
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3205
|
+
e.keepOpen = true;
|
|
3206
|
+
}
|
|
3207
|
+
else {
|
|
3208
|
+
selectItemHandler(item.value).then();
|
|
3209
|
+
}
|
|
3210
|
+
} }, { children: (_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)) }), "".concat(fieldToString(field), "-").concat(index)), item.subComponent && selectedSubComponent === item && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) { return (jsx(GridSubComponentContext.Provider, __assign({ value: {
|
|
3211
|
+
value: subSelectedValue,
|
|
3212
|
+
setValue: function (value) {
|
|
3213
|
+
setSubSelectedValue(value);
|
|
3214
|
+
},
|
|
3215
|
+
setValid: function (valid) {
|
|
3216
|
+
subComponentIsValid.current = valid;
|
|
3217
|
+
},
|
|
3218
|
+
triggerSave: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3219
|
+
return __generator(this, function (_a) {
|
|
3120
3220
|
ref.closeMenu();
|
|
3121
|
-
return
|
|
3221
|
+
return [2 /*return*/];
|
|
3122
3222
|
});
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
} }, "".concat(fieldToString(field), "-").concat(index, "_subcomponent_inner")));
|
|
3126
|
-
} }), "".concat(fieldToString(field), "-").concat(index, "_subcomponent"))) }, "menu-wrapper-".concat(index)));
|
|
3223
|
+
}); }
|
|
3224
|
+
} }, { children: item.subComponent && (jsx(item.subComponent, {}, "".concat(fieldToString(field), "-").concat(index, "_subcomponent_inner"))) }))); } }), "".concat(item.label, "_subcomponent")))] }, "menu-wrapper-".concat(index)));
|
|
3127
3225
|
})] }) }))] }));
|
|
3128
3226
|
};
|
|
3129
3227
|
|
|
@@ -3231,7 +3329,10 @@ var GridFormMultiSelect = function (props) {
|
|
|
3231
3329
|
setSelectedValues(__assign(__assign({}, selectedValues), (_a = {}, _a["".concat(item.value)] = null, _a)));
|
|
3232
3330
|
}
|
|
3233
3331
|
}, [selectedValues]);
|
|
3234
|
-
var _e = useGridPopoverHook({
|
|
3332
|
+
var _e = useGridPopoverHook({
|
|
3333
|
+
className: props.className,
|
|
3334
|
+
save: save
|
|
3335
|
+
}), popoverWrapper = _e.popoverWrapper, lastInputKeyboardEventHandlers = _e.lastInputKeyboardEventHandlers, triggerSave = _e.triggerSave;
|
|
3235
3336
|
return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormMultiSelect-container" }, { children: jsxs(Fragment$1, { children: [options && props.filtered && (jsxs(Fragment$1, { children: [jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
|
|
3236
3337
|
var _b;
|
|
3237
3338
|
var ref = _a.ref;
|
|
@@ -3241,18 +3342,7 @@ var GridFormMultiSelect = function (props) {
|
|
|
3241
3342
|
return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxs("div", { children: [jsx(MenuItem, __assign({ onClick: function (e) {
|
|
3242
3343
|
e.keepOpen = true;
|
|
3243
3344
|
toggleValue(item);
|
|
3244
|
-
},
|
|
3245
|
-
return __generator(this, function (_a) {
|
|
3246
|
-
if (e.key === "Enter")
|
|
3247
|
-
triggerSave().then();
|
|
3248
|
-
else if (e.key === " ") {
|
|
3249
|
-
toggleValue(item);
|
|
3250
|
-
e.preventDefault();
|
|
3251
|
-
e.stopPropagation();
|
|
3252
|
-
}
|
|
3253
|
-
return [2 /*return*/];
|
|
3254
|
-
});
|
|
3255
|
-
}); } }, { children: jsx(LuiCheckboxInput, { isChecked: "".concat(item.value) in selectedValues, value: "".concat(item.value), label: (_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), inputProps: {
|
|
3345
|
+
} }, lastInputKeyboardEventHandlers, { children: jsx(LuiCheckboxInput, { isChecked: "".concat(item.value) in selectedValues, value: "".concat(item.value), label: (_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), inputProps: {
|
|
3256
3346
|
onClick: function (e) {
|
|
3257
3347
|
e.preventDefault();
|
|
3258
3348
|
e.stopPropagation();
|
|
@@ -3280,8 +3370,8 @@ var GridPopoutEditMultiSelect = function (colDef, props) {
|
|
|
3280
3370
|
return GridCell(colDef, __assign(__assign({ editor: GridFormMultiSelect }, props), { editorParams: __assign({ className: "GridMultiSelect-containerMedium" }, props.editorParams) }));
|
|
3281
3371
|
};
|
|
3282
3372
|
|
|
3283
|
-
var css_248z$
|
|
3284
|
-
styleInject(css_248z$
|
|
3373
|
+
var css_248z$3 = ".GridPopoutMenu-burger{cursor:pointer}.GridPopoutMenu-burger svg{fill:#007198}.GridPopoutMenu-burgerDisabled svg{fill:#989189}";
|
|
3374
|
+
styleInject(css_248z$3);
|
|
3285
3375
|
|
|
3286
3376
|
/** Menu configuration types **/
|
|
3287
3377
|
var PopoutMenuSeparator = Object.freeze({ __isMenuSeparator__: true });
|
|
@@ -3379,8 +3469,8 @@ var GridFormPopoverMenu = function (props) {
|
|
|
3379
3469
|
e.keepOpen = true;
|
|
3380
3470
|
}
|
|
3381
3471
|
else {
|
|
3382
|
-
setSubComponentSelected(null);
|
|
3383
3472
|
actionClick(item).then();
|
|
3473
|
+
e.keepOpen = true;
|
|
3384
3474
|
}
|
|
3385
3475
|
}, [actionClick, subComponentSelected]);
|
|
3386
3476
|
var selectedRowCount = selectedRows.length;
|
|
@@ -3397,21 +3487,16 @@ var GridFormPopoverMenu = function (props) {
|
|
|
3397
3487
|
return [4 /*yield*/, actionClick(subComponentSelected)];
|
|
3398
3488
|
case 1:
|
|
3399
3489
|
_a.sent();
|
|
3400
|
-
|
|
3401
|
-
case 2:
|
|
3490
|
+
return [2 /*return*/, false];
|
|
3491
|
+
case 2:
|
|
3492
|
+
// Otherwise assume it's a cancel, either way we close the menu
|
|
3493
|
+
return [2 /*return*/, true];
|
|
3402
3494
|
}
|
|
3403
3495
|
});
|
|
3404
3496
|
}); }, [actionClick, subComponentSelected]);
|
|
3405
3497
|
var _e = useGridPopoverHook({ className: props.className, save: save }), popoverWrapper = _e.popoverWrapper, triggerSave = _e.triggerSave;
|
|
3406
|
-
var localTriggerSave = function (reason) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3407
|
-
return __generator(this, function (_a) {
|
|
3408
|
-
if (!subComponentIsValid.current)
|
|
3409
|
-
return [2 /*return*/];
|
|
3410
|
-
return [2 /*return*/, triggerSave(reason)];
|
|
3411
|
-
});
|
|
3412
|
-
}); };
|
|
3413
3498
|
return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !filteredOptions, className: "GridFormPopupMenu" }, { children: jsx(Fragment$1, { children: options === null || options === void 0 ? void 0 : options.map(function (item, index) {
|
|
3414
|
-
return item.label === PopoutMenuSeparator ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : (!item.hidden && (jsxs(Fragment
|
|
3499
|
+
return item.label === PopoutMenuSeparator ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : (!item.hidden && (jsxs(Fragment, { children: [jsx(MenuItem, __assign({ onClick: function (e) { return onMenuItemClick(e, item); }, disabled: !!item.disabled || !(filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.includes(item)), title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "" }, { children: item.label }), "".concat(item.label)), item.subComponent && subComponentSelected === item && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (_) {
|
|
3415
3500
|
return item.subComponent && (jsx(GridSubComponentContext.Provider, __assign({ value: {
|
|
3416
3501
|
value: subSelectedValue,
|
|
3417
3502
|
setValue: function (value) {
|
|
@@ -3420,9 +3505,9 @@ var GridFormPopoverMenu = function (props) {
|
|
|
3420
3505
|
setValid: function (valid) {
|
|
3421
3506
|
subComponentIsValid.current = valid;
|
|
3422
3507
|
},
|
|
3423
|
-
triggerSave:
|
|
3508
|
+
triggerSave: triggerSave
|
|
3424
3509
|
} }, { children: jsx(item.subComponent, {}) })));
|
|
3425
|
-
} }), "".concat(item.label, "_subcomponent")))] })));
|
|
3510
|
+
} }), "".concat(item.label, "_subcomponent")))] }, "".concat(item.label))));
|
|
3426
3511
|
}) }) })));
|
|
3427
3512
|
};
|
|
3428
3513
|
|
|
@@ -3514,16 +3599,19 @@ var convertDDToDMS = function (dd, showPositiveSymbol, addTrailingZeros) {
|
|
|
3514
3599
|
return dmsString;
|
|
3515
3600
|
};
|
|
3516
3601
|
|
|
3517
|
-
var css_248z$
|
|
3518
|
-
styleInject(css_248z$3);
|
|
3519
|
-
|
|
3520
|
-
var css_248z$2 = ".LuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#beb9b4;line-height:48px;position:absolute;right:14px;top:0}";
|
|
3602
|
+
var css_248z$2 = ".GridFormEditBearing-input{width:320px}";
|
|
3521
3603
|
styleInject(css_248z$2);
|
|
3522
3604
|
|
|
3605
|
+
var css_248z$1 = ".LuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#beb9b4;line-height:48px;position:absolute;right:14px;top:0}";
|
|
3606
|
+
styleInject(css_248z$1);
|
|
3607
|
+
|
|
3523
3608
|
var TextInputFormatted = function (props) {
|
|
3524
|
-
return (jsxs("div", __assign({ className: clsx("LuiTextInput Grid-popoverContainer", props.error && "hasError", props.
|
|
3609
|
+
return (jsxs("div", __assign({ className: clsx("LuiTextInput Grid-popoverContainer", props.error && "hasError", props.className) }, { children: [jsxs("span", __assign({ className: "LuiTextInput-inputWrapper" }, { children: [jsx("input", __assign({ type: "text", spellCheck: true, defaultValue: props.value }, omit(props, ["error", "value", "helpText", "formatted", "className"]), { className: "LuiTextInput-input", onMouseEnter: function (e) {
|
|
3525
3610
|
e.currentTarget.focus();
|
|
3526
|
-
|
|
3611
|
+
props.onMouseEnter && props.onMouseEnter(e);
|
|
3612
|
+
} })), jsx("span", __assign({ className: "LuiTextInput-formatted" }, { children: props.formatted }))] })), props.error && (jsxs("span", __assign({ className: "LuiTextInput-error" }, { children: [jsx(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextInput-error-icon", size: "sm", status: "error" }), props.error] }))), props.helpText && !props.error && (jsx("span", __assign({ style: {
|
|
3613
|
+
fontSize: "0.7rem"
|
|
3614
|
+
} }, { children: props.helpText })))] })));
|
|
3527
3615
|
};
|
|
3528
3616
|
|
|
3529
3617
|
var GridFormEditBearing = function (props) {
|
|
@@ -3558,18 +3646,13 @@ var GridFormEditBearing = function (props) {
|
|
|
3558
3646
|
}
|
|
3559
3647
|
});
|
|
3560
3648
|
}); }, [field, initialValue, props, value]);
|
|
3561
|
-
var _c = useGridPopoverHook({
|
|
3562
|
-
|
|
3649
|
+
var _c = useGridPopoverHook({
|
|
3650
|
+
className: props.className,
|
|
3651
|
+
save: save
|
|
3652
|
+
}), popoverWrapper = _c.popoverWrapper, onlyInputKeyboardEventHandlers = _c.onlyInputKeyboardEventHandlers;
|
|
3653
|
+
return popoverWrapper(jsx("div", __assign({ className: "GridFormEditBearing-input Grid-popoverContainer" }, { children: jsx(TextInputFormatted, __assign({ value: value !== null && value !== void 0 ? value : "", onChange: function (e) {
|
|
3563
3654
|
setValue(e.target.value.trim());
|
|
3564
|
-
},
|
|
3565
|
-
autoFocus: true,
|
|
3566
|
-
placeholder: props.placeHolder,
|
|
3567
|
-
disabled: false,
|
|
3568
|
-
maxLength: 16,
|
|
3569
|
-
onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3570
|
-
return [2 /*return*/, e.key === "Enter" && triggerSave().then()];
|
|
3571
|
-
}); }); }
|
|
3572
|
-
}, formatted: bearingStringValidator(value, props.range) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, props.range) }) })));
|
|
3655
|
+
}, autoFocus: true, placeholder: props.placeHolder }, onlyInputKeyboardEventHandlers, { formatted: bearingStringValidator(value, props.range) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, props.range) })) })));
|
|
3573
3656
|
};
|
|
3574
3657
|
|
|
3575
3658
|
var GridPopoverEditBearingLike = function (colDef, props) {
|
|
@@ -3706,32 +3789,44 @@ var useGenerateOrDefaultId = function (idFromProps) {
|
|
|
3706
3789
|
return id;
|
|
3707
3790
|
};
|
|
3708
3791
|
var TextAreaInput = function (props) {
|
|
3709
|
-
var _a
|
|
3710
|
-
var id = useGenerateOrDefaultId(
|
|
3711
|
-
return (jsxs("div", __assign({ className: clsx("LuiTextAreaInput Grid-popoverContainer",
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3792
|
+
var _a;
|
|
3793
|
+
var id = useGenerateOrDefaultId(props === null || props === void 0 ? void 0 : props.id);
|
|
3794
|
+
return (jsxs("div", __assign({ className: clsx("LuiTextAreaInput Grid-popoverContainer", props.disabled ? "isDisabled" : "", props.error ? "hasError" : "", props.className) }, { children: [jsxs("label", __assign({ htmlFor: id }, { children: [props.mandatory != null && jsx("span", __assign({ className: "LuiTextAreaInput-mandatory" }, { children: "*" })), props.label != null && jsx("span", __assign({ className: "LuiTextAreaInput-label" }, { children: props.label })), jsx("div", __assign({ className: "LuiTextAreaInput-wrapper" }, { children: jsx("textarea", __assign({ rows: 5 }, omit(props, ["error", "value", "helpText", "formatted", "className"]), { id: id, value: (_a = props.value) !== null && _a !== void 0 ? _a : "", spellCheck: true, onMouseEnter: function (e) {
|
|
3795
|
+
if (document.activeElement != e.currentTarget) {
|
|
3796
|
+
e.currentTarget.focus();
|
|
3797
|
+
e.currentTarget.selectionStart = e.currentTarget.value.length;
|
|
3798
|
+
}
|
|
3799
|
+
props.onMouseEnter && props.onMouseEnter(e);
|
|
3800
|
+
} }, { children: props.value })) }))] })), props.error && (jsxs("span", __assign({ className: "LuiTextAreaInput-error" }, { children: [jsx(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextAreaInput-error-icon", size: "sm", status: "error" }), props.error] }))), props.helpText && !props.error && (jsx("span", __assign({ style: {
|
|
3801
|
+
fontSize: "0.7rem"
|
|
3802
|
+
} }, { children: props.helpText })))] })));
|
|
3717
3803
|
};
|
|
3718
3804
|
|
|
3719
|
-
var
|
|
3720
|
-
|
|
3721
|
-
var _b = useGridPopoverContext(), field = _b.field, initialVale = _b.value;
|
|
3722
|
-
var _c = useState(initialVale != null ? "".concat(initialVale) : ""), value = _c[0], setValue = _c[1];
|
|
3723
|
-
var invalid = useCallback(function () {
|
|
3724
|
-
if (props.required && value.length == 0) {
|
|
3725
|
-
return "Some text is required";
|
|
3726
|
-
}
|
|
3727
|
-
if (props.maxLength && value.length > props.maxLength) {
|
|
3728
|
-
return "Text must be no longer than ".concat(props.maxLength, " characters");
|
|
3729
|
-
}
|
|
3730
|
-
if (props.validate) {
|
|
3731
|
-
return props.validate(value);
|
|
3732
|
-
}
|
|
3805
|
+
var TextInputValidator = function (props, value) {
|
|
3806
|
+
if (value == null)
|
|
3733
3807
|
return null;
|
|
3734
|
-
|
|
3808
|
+
// This can happen because subcomponent is invoked without type safety
|
|
3809
|
+
if (typeof value !== "string") {
|
|
3810
|
+
console.error("Value is not a string", value);
|
|
3811
|
+
}
|
|
3812
|
+
if (props.required && value.length === 0) {
|
|
3813
|
+
return "Some text is required";
|
|
3814
|
+
}
|
|
3815
|
+
if (props.maxLength && value.length > props.maxLength) {
|
|
3816
|
+
return "Text must be no longer than ".concat(props.maxLength, " characters");
|
|
3817
|
+
}
|
|
3818
|
+
if (props.validate) {
|
|
3819
|
+
return props.validate(value);
|
|
3820
|
+
}
|
|
3821
|
+
return null;
|
|
3822
|
+
};
|
|
3823
|
+
|
|
3824
|
+
var GridFormTextArea = function (props) {
|
|
3825
|
+
var _a, _b;
|
|
3826
|
+
var _c = useGridPopoverContext(), field = _c.field, initialVale = _c.value;
|
|
3827
|
+
var _d = useState(initialVale != null ? "".concat(initialVale) : ""), value = _d[0], setValue = _d[1];
|
|
3828
|
+
var helpText = (_a = props.helpText) !== null && _a !== void 0 ? _a : "Press tab to save";
|
|
3829
|
+
var invalid = useCallback(function () { return TextInputValidator(props, value); }, [props, value]);
|
|
3735
3830
|
var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3736
3831
|
return __generator(this, function (_a) {
|
|
3737
3832
|
switch (_a.label) {
|
|
@@ -3755,30 +3850,19 @@ var GridFormTextArea = function (props) {
|
|
|
3755
3850
|
}
|
|
3756
3851
|
});
|
|
3757
3852
|
}); }, [invalid, initialVale, value, props, field]);
|
|
3758
|
-
var
|
|
3759
|
-
return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (
|
|
3853
|
+
var _e = useGridPopoverHook({ className: props.className, save: save }), popoverWrapper = _e.popoverWrapper, onlyInputKeyboardEventHandlers = _e.onlyInputKeyboardEventHandlers;
|
|
3854
|
+
return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (_b = props.width) !== null && _b !== void 0 ? _b : 240 } }, { children: jsx(TextAreaInput, __assign({ value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), placeholder: props.placeholder, helpText: helpText }, onlyInputKeyboardEventHandlers)) })));
|
|
3760
3855
|
};
|
|
3761
3856
|
|
|
3762
3857
|
var GridPopoverTextArea = function (colDef, params) { return GridCell(colDef, __assign({ editor: GridFormTextArea }, params)); };
|
|
3763
3858
|
|
|
3764
3859
|
var GridFormTextInput = function (props) {
|
|
3765
|
-
var _a;
|
|
3766
|
-
var
|
|
3860
|
+
var _a, _b;
|
|
3861
|
+
var _c = useGridPopoverContext(), field = _c.field, initialVale = _c.value;
|
|
3862
|
+
var helpText = (_a = props.helpText) !== null && _a !== void 0 ? _a : "Press enter or tab to save";
|
|
3767
3863
|
var initValue = initialVale == null ? "" : "".concat(initialVale);
|
|
3768
|
-
var
|
|
3769
|
-
var invalid = useCallback(function () {
|
|
3770
|
-
var trimmedValue = value.trim();
|
|
3771
|
-
if (props.required && trimmedValue.length == 0) {
|
|
3772
|
-
return "Some text is required";
|
|
3773
|
-
}
|
|
3774
|
-
if (props.maxLength && trimmedValue.length > props.maxLength) {
|
|
3775
|
-
return "Text must be no longer than ".concat(props.maxLength, " characters");
|
|
3776
|
-
}
|
|
3777
|
-
if (props.validate) {
|
|
3778
|
-
return props.validate(trimmedValue, data);
|
|
3779
|
-
}
|
|
3780
|
-
return null;
|
|
3781
|
-
}, [data, props, value]);
|
|
3864
|
+
var _d = useState(initValue), value = _d[0], setValue = _d[1];
|
|
3865
|
+
var invalid = useCallback(function () { return TextInputValidator(props, value); }, [props, value]);
|
|
3782
3866
|
var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3783
3867
|
var trimmedValue;
|
|
3784
3868
|
return __generator(this, function (_a) {
|
|
@@ -3804,90 +3888,72 @@ var GridFormTextInput = function (props) {
|
|
|
3804
3888
|
}
|
|
3805
3889
|
});
|
|
3806
3890
|
}); }, [invalid, value, initValue, props, field]);
|
|
3807
|
-
var
|
|
3808
|
-
return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (
|
|
3809
|
-
style: { width: "100%" },
|
|
3810
|
-
placeholder: props.placeholder,
|
|
3811
|
-
onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3812
|
-
return [2 /*return*/, e.key === "Enter" && triggerSave().then()];
|
|
3813
|
-
}); }); }
|
|
3814
|
-
} }) })));
|
|
3891
|
+
var _e = useGridPopoverHook({ className: props.className, save: save }), popoverWrapper = _e.popoverWrapper, onlyInputKeyboardEventHandlers = _e.onlyInputKeyboardEventHandlers;
|
|
3892
|
+
return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (_b = props.width) !== null && _b !== void 0 ? _b : 240 }, className: "FormTest" }, { children: jsx(TextInputFormatted, __assign({ value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), formatted: props.units, style: { width: "100%" }, placeholder: props.placeholder }, onlyInputKeyboardEventHandlers, { helpText: helpText })) })));
|
|
3815
3893
|
};
|
|
3816
3894
|
|
|
3817
3895
|
var GridPopoverTextInput = function (colDef, params) {
|
|
3818
3896
|
return GridCell(colDef, __assign({ editor: GridFormTextInput }, params));
|
|
3819
3897
|
};
|
|
3820
3898
|
|
|
3821
|
-
var
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
var
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
fontSize: "0.7rem"
|
|
3854
|
-
} }, { children: helpText }))] })));
|
|
3899
|
+
var GridFormSubComponentTextInput = function (props) {
|
|
3900
|
+
var _a;
|
|
3901
|
+
var _b = useContext(GridSubComponentContext), value = _b.value, setValue = _b.setValue, setValid = _b.setValid, triggerSave = _b.triggerSave;
|
|
3902
|
+
var helpText = (_a = props.helpText) !== null && _a !== void 0 ? _a : "Press enter or tab to save";
|
|
3903
|
+
// If is not initialised yet as it's just been created then set the default value
|
|
3904
|
+
useEffect(function () {
|
|
3905
|
+
if (value == null)
|
|
3906
|
+
setValue(props.defaultValue);
|
|
3907
|
+
}, [props.defaultValue, setValue, value]);
|
|
3908
|
+
var invalid = useCallback(function () { return TextInputValidator(props, value); }, [props, value]);
|
|
3909
|
+
useEffect(function () {
|
|
3910
|
+
setValid(value != null && invalid() == null);
|
|
3911
|
+
}, [setValid, invalid, value]);
|
|
3912
|
+
return (jsx(TextInputFormatted, { value: value, error: invalid(), onChange: function (e) { return setValue(e.target.value); }, helpText: helpText, autoFocus: true, onKeyDown: function (e) {
|
|
3913
|
+
if (e.key === "Tab" || e.key === "Enter") {
|
|
3914
|
+
e.preventDefault();
|
|
3915
|
+
e.stopPropagation();
|
|
3916
|
+
}
|
|
3917
|
+
}, onKeyUp: function (e) {
|
|
3918
|
+
if (e.key === "Tab") {
|
|
3919
|
+
e.preventDefault();
|
|
3920
|
+
e.stopPropagation();
|
|
3921
|
+
!e.shiftKey && triggerSave().then();
|
|
3922
|
+
}
|
|
3923
|
+
else if (e.key === "Enter") {
|
|
3924
|
+
triggerSave().then();
|
|
3925
|
+
e.preventDefault();
|
|
3926
|
+
e.stopPropagation();
|
|
3927
|
+
}
|
|
3928
|
+
}, placeholder: props.placeholder, style: {
|
|
3929
|
+
width: "100%"
|
|
3930
|
+
} }));
|
|
3855
3931
|
};
|
|
3856
3932
|
|
|
3857
|
-
var
|
|
3858
|
-
var _a
|
|
3933
|
+
var GridFormSubComponentTextArea = function (props) {
|
|
3934
|
+
var _a;
|
|
3935
|
+
var _b = useContext(GridSubComponentContext), value = _b.value, setValue = _b.setValue, setValid = _b.setValid, triggerSave = _b.triggerSave;
|
|
3936
|
+
var helpText = (_a = props.helpText) !== null && _a !== void 0 ? _a : "Press tab to save";
|
|
3859
3937
|
// If is not initialised yet as it's just been created then set the default value
|
|
3860
3938
|
useEffect(function () {
|
|
3861
3939
|
if (value == null)
|
|
3862
3940
|
setValue(props.defaultValue);
|
|
3863
3941
|
}, [props.defaultValue, setValue, value]);
|
|
3864
|
-
var
|
|
3865
|
-
if (value == null)
|
|
3866
|
-
return null;
|
|
3867
|
-
// This can happen because subcomponent is invoked without type safety
|
|
3868
|
-
if (typeof value !== "string") {
|
|
3869
|
-
console.error("Value is not a string", value);
|
|
3870
|
-
}
|
|
3871
|
-
if (props.required && value.length === 0) {
|
|
3872
|
-
return "Some text is required";
|
|
3873
|
-
}
|
|
3874
|
-
if (props.maxLength && value.length > props.maxLength) {
|
|
3875
|
-
return "Text must be no longer than ".concat(props.maxLength, " characters");
|
|
3876
|
-
}
|
|
3877
|
-
if (props.validate) {
|
|
3878
|
-
return props.validate(value);
|
|
3879
|
-
}
|
|
3880
|
-
return null;
|
|
3881
|
-
}, [props]);
|
|
3942
|
+
var invalid = useCallback(function () { return TextInputValidator(props, value); }, [props, value]);
|
|
3882
3943
|
useEffect(function () {
|
|
3883
|
-
setValid(value != null &&
|
|
3884
|
-
}, [setValid,
|
|
3885
|
-
return (jsx("div", __assign({ className: "FreeTextInput LuiDeprecatedForms" }, { children: jsx(
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3944
|
+
setValid(value != null && invalid() == null);
|
|
3945
|
+
}, [setValid, invalid, value]);
|
|
3946
|
+
return (jsx("div", __assign({ className: clsx("FreeTextInput LuiDeprecatedForms", props.className) }, { children: jsx(TextAreaInput, { className: "free-text-input", value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), helpText: helpText, autoFocus: true, placeholder: props.placeholder, onKeyDown: function (e) {
|
|
3947
|
+
if (e.key === "Tab") {
|
|
3948
|
+
e.preventDefault();
|
|
3949
|
+
e.stopPropagation();
|
|
3950
|
+
}
|
|
3951
|
+
}, onKeyUp: function (e) {
|
|
3952
|
+
if (e.key === "Tab") {
|
|
3953
|
+
e.preventDefault();
|
|
3954
|
+
e.stopPropagation();
|
|
3955
|
+
!e.shiftKey && triggerSave().then();
|
|
3956
|
+
}
|
|
3891
3957
|
} }) })));
|
|
3892
3958
|
};
|
|
3893
3959
|
|
|
@@ -4003,5 +4069,5 @@ var ActionButton = function (_a) {
|
|
|
4003
4069
|
} })) : (jsx(LuiIcon, { name: icon, alt: (_c = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : name) !== null && _c !== void 0 ? _c : "", size: size })), jsxs("span", __assign({ className: "ActionButton-minimalArea" }, { children: [jsx("span", __assign({ className: "ActionButton-minimalAreaDisplay" }, { children: (_d = (localInProgress ? inProgressName : name)) !== null && _d !== void 0 ? _d : name })), jsx("span", __assign({ className: "ActionButton-minimalAreaExpand" }, { children: name }))] }))] })));
|
|
4004
4070
|
};
|
|
4005
4071
|
|
|
4006
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, GenericMultiEditCellClass, Grid, GridCell, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentContext,
|
|
4072
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, GenericMultiEditCellClass, Grid, GridCell, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, convertDDToDMS, hasParentClass, isFloat, isNotEmpty, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
4007
4073
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|