@linzjs/step-ag-grid 29.12.0 → 29.14.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.css +26 -2
- package/dist/src/components/Grid.d.ts +37 -67
- package/dist/src/components/GridCell.d.ts +2 -19
- package/dist/src/components/GridCellFiller.d.ts +1 -1
- package/dist/src/components/GridCellMultiEditor.d.ts +1 -2
- package/dist/src/components/GridPopoverHook.d.ts +1 -1
- package/dist/src/components/GridRangeSelectContextMenu.d.ts +10 -0
- package/dist/src/components/gridFilter/GridFilterButtons.d.ts +1 -1
- package/dist/src/components/gridFilter/useGridFilter.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormMessage.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormMultiSelectGrid.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +3 -2
- package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +1 -1
- package/dist/src/components/gridHook/useGridContextMenu.d.ts +13 -8
- package/dist/src/components/gridHook/useGridCopy.d.ts +15 -0
- package/dist/src/components/gridHook/useGridCopySettings.d.ts +11 -0
- package/dist/src/components/gridHook/useGridRangeSelection.d.ts +25 -0
- package/dist/src/components/gridPopoverEdit/GridButton.d.ts +1 -2
- package/dist/src/components/gridPopoverEdit/GridEditBoolean.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +4 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +2 -2
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +1 -2
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/types.d.ts +27 -0
- package/dist/src/contexts/GridContext.d.ts +13 -12
- package/dist/src/contexts/GridPopoverContext.d.ts +1 -1
- package/dist/src/lui/timeoutHook.d.ts +0 -6
- package/dist/src/lui/tsUtils.d.ts +5 -0
- package/dist/src/utils/__tests__/random.ts +19 -0
- package/dist/src/utils/textValidator.d.ts +1 -1
- package/dist/src/utils/util.d.ts +1 -0
- package/dist/step-ag-grid.cjs +650 -242
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +651 -245
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +4 -2
- package/src/components/Grid.tsx +312 -221
- package/src/components/GridCell.tsx +1 -25
- package/src/components/GridCellFiller.tsx +1 -1
- package/src/components/GridCellMultiEditor.tsx +2 -2
- package/src/components/GridPopoverHook.tsx +1 -1
- package/src/components/GridRangeSelectContextMenu.tsx +73 -0
- package/src/components/gridFilter/GridFilterButtons.tsx +1 -1
- package/src/components/gridFilter/useGridFilter.ts +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +2 -4
- package/src/components/gridForm/GridFormEditBearing.tsx +1 -1
- package/src/components/gridForm/GridFormMessage.tsx +1 -1
- package/src/components/gridForm/GridFormMultiSelect.tsx +1 -1
- package/src/components/gridForm/GridFormMultiSelectGrid.tsx +1 -1
- package/src/components/gridForm/GridFormPopoverMenu.tsx +3 -2
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +1 -1
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +1 -1
- package/src/components/gridForm/GridFormTextArea.tsx +1 -1
- package/src/components/gridForm/GridFormTextInput.tsx +1 -1
- package/src/components/gridHook/useGridContextMenu.tsx +23 -10
- package/src/components/gridHook/useGridCopy.ts +279 -0
- package/src/components/gridHook/useGridCopySettings.ts +28 -0
- package/src/components/gridHook/useGridRangeSelection.ts +235 -0
- package/src/components/gridPopoverEdit/GridButton.tsx +2 -2
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +2 -2
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +2 -2
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.ts +2 -2
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +5 -2
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +2 -2
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +2 -2
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +2 -2
- package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +2 -2
- package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +2 -2
- package/src/components/gridRender/GridRenderGenericCell.tsx +1 -2
- package/src/components/index.ts +1 -0
- package/src/components/types.ts +34 -0
- package/src/contexts/GridContext.tsx +57 -148
- package/src/contexts/GridContextProvider.tsx +16 -13
- package/src/contexts/GridPopoverContext.tsx +1 -1
- package/src/contexts/GridPopoverContextProvider.tsx +1 -1
- package/src/lui/timeoutHook.tsx +0 -19
- package/src/lui/tsUtils.ts +8 -0
- package/src/react-menu3/components/MenuButton.tsx +2 -2
- package/src/react-menu3/hooks/useItemState.ts +1 -1
- package/src/stories/grid/GridCopy.stories.tsx +175 -0
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +4 -4
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +3 -3
- package/src/stories/grid/GridReadOnly.stories.tsx +4 -3
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +2 -2
- package/src/styles/ContextMenu.scss +61 -0
- package/src/styles/Grid.scss +26 -2
- package/src/utils/__tests__/random.ts +19 -0
- package/src/utils/bearing.ts +2 -2
- package/src/utils/textValidator.test.ts +1 -1
- package/src/utils/textValidator.ts +1 -1
- package/src/utils/util.ts +2 -0
|
@@ -51,8 +51,8 @@ interface ITestRow {
|
|
|
51
51
|
bearing: string | number | null;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const GridPopoverEditBearingTemplate: StoryFn<typeof Grid
|
|
55
|
-
const [
|
|
54
|
+
const GridPopoverEditBearingTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
|
|
55
|
+
const [externalSelectedIds, setExternalSelectedIds] = useState<number[]>([]);
|
|
56
56
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
57
57
|
() => [
|
|
58
58
|
GridCell({
|
|
@@ -111,8 +111,8 @@ const GridPopoverEditBearingTemplate: StoryFn<typeof Grid> = (props: GridProps)
|
|
|
111
111
|
data-testid={'bearingsTestTable'}
|
|
112
112
|
{...props}
|
|
113
113
|
readOnly={false}
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
externalSelectedIds={externalSelectedIds}
|
|
115
|
+
setExternalSelectedIds={setExternalSelectedIds}
|
|
116
116
|
columnDefs={columnDefs}
|
|
117
117
|
rowData={rowData}
|
|
118
118
|
domLayout={'autoHeight'}
|
|
@@ -66,7 +66,7 @@ interface ICode {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
const GridEditDropDownTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
|
|
69
|
-
const [
|
|
69
|
+
const [externalSelectedIds, setExternalSelectedIds] = useState<number[]>([]);
|
|
70
70
|
|
|
71
71
|
const optionsFn = useCallback(async (selectedRows: ITestRow[], filter?: string) => {
|
|
72
72
|
// eslint-disable-next-line no-console
|
|
@@ -312,8 +312,8 @@ const GridEditDropDownTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridPro
|
|
|
312
312
|
</GridFilters>
|
|
313
313
|
<Grid
|
|
314
314
|
{...props}
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
externalSelectedIds={externalSelectedIds}
|
|
316
|
+
setExternalSelectedIds={setExternalSelectedIds}
|
|
317
317
|
columnDefs={columnDefs}
|
|
318
318
|
rowData={rowData}
|
|
319
319
|
domLayout={'autoHeight'}
|
|
@@ -71,7 +71,7 @@ interface ITestRow {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const GridReadOnlyTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
|
|
74
|
-
const [
|
|
74
|
+
const [externalSelectedIds, setExternalSelectedIds] = useState<number[]>([]);
|
|
75
75
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
76
76
|
() => [
|
|
77
77
|
GridCell({
|
|
@@ -244,12 +244,13 @@ const GridReadOnlyTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<I
|
|
|
244
244
|
<Grid
|
|
245
245
|
data-testid={'readonly'}
|
|
246
246
|
{...props}
|
|
247
|
+
enableRangeSelection={true}
|
|
247
248
|
selectable={true}
|
|
248
249
|
enableClickSelection={true}
|
|
249
250
|
enableSelectionWithoutKeys={true}
|
|
250
251
|
autoSelectFirstRow={true}
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
externalSelectedIds={externalSelectedIds}
|
|
253
|
+
setExternalSelectedIds={setExternalSelectedIds}
|
|
253
254
|
columnDefs={columnDefs}
|
|
254
255
|
rowData={rowData}
|
|
255
256
|
/>
|
|
@@ -234,8 +234,8 @@ const GridKeyboardInteractionsTemplate: StoryFn<typeof Grid<ITestRow>> = (props:
|
|
|
234
234
|
);
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
-
export const
|
|
238
|
-
|
|
237
|
+
export const KeyboardInteractions: StoryFn<typeof Grid<ITestRow>> = GridKeyboardInteractionsTemplate.bind({});
|
|
238
|
+
KeyboardInteractions.play = async ({ canvasElement }) => {
|
|
239
239
|
const canvas = within(document.body);
|
|
240
240
|
|
|
241
241
|
multiEditAction.mockClear();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use '../../node_modules/@linzjs/lui/dist/scss/Core' as lui;
|
|
2
|
+
|
|
3
|
+
.GridContextMenu {
|
|
4
|
+
li.szh-menu__header {
|
|
5
|
+
color: lui.$fuscous;
|
|
6
|
+
text-transform: none;
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
font-weight: 600;
|
|
9
|
+
padding-left: 16px;
|
|
10
|
+
padding-right: 16px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
li.szh-menu__item {
|
|
14
|
+
padding-left: 16px;
|
|
15
|
+
padding-right: 16px;
|
|
16
|
+
|
|
17
|
+
.copyMenuMenuItem {
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: 8px;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.copyMenuMenuItem__text {
|
|
24
|
+
color: lui.$charcoal;
|
|
25
|
+
font-size: 16px;
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
width: 80px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.copyMenuMenuItem__buttonDefault {
|
|
31
|
+
display: flex;
|
|
32
|
+
background: none;
|
|
33
|
+
padding: 6px 6px;
|
|
34
|
+
border: 2px solid transparent;
|
|
35
|
+
|
|
36
|
+
&.copyMenuMenuItem__buttonDefault--hidden:hover {
|
|
37
|
+
border: 2px solid lui.$charcoal;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.copyMenuMenuItem__buttonDefault--hidden .LuiIcon {
|
|
42
|
+
fill: transparent;
|
|
43
|
+
}
|
|
44
|
+
.copyMenuMenuItem__buttonDefault--hidden:hover .LuiIcon {
|
|
45
|
+
fill: lui.$fuscous;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.LuiIcon {
|
|
49
|
+
fill: lui.$fuscous;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.LuiIcon[data-icon="ic_tick"] {
|
|
53
|
+
padding-left: 4px;
|
|
54
|
+
padding-right: 4px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
li.szh-menu__item--hover {
|
|
59
|
+
background-color: lui.$polar;
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/styles/Grid.scss
CHANGED
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
margin-right: auto;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.ag-
|
|
11
|
-
user-select: text
|
|
10
|
+
.ag-cell:not([col-id="ag-Grid-SelectionColumn"]) {
|
|
11
|
+
user-select: text;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.rangeSelectingMultiple .ag-cell {
|
|
15
|
+
user-select: none;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
.LabelPreferencesPanelGridCellAlignCenter .ag-cell-wrapper, .LabelPreferencesPanelGridCellAlignCenter .GridCell-container {
|
|
@@ -157,3 +161,23 @@ div.ag-ltr div.ag-header-cell-resize {
|
|
|
157
161
|
font-size: lui.$base-font-size;
|
|
158
162
|
@include lui.font-regular();
|
|
159
163
|
}
|
|
164
|
+
|
|
165
|
+
div.ag-row div.ag-cell.rangeSelect {
|
|
166
|
+
background-color: rgba(72, 160, 244, 0.2);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
div.ag-row div.ag-cell.rangeSelectLeft {
|
|
170
|
+
border-left: 3px solid #48a0f4;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
div.ag-row div.ag-cell.rangeSelectRight {
|
|
174
|
+
border-right: 3px solid #48a0f4;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
div.ag-row div.ag-cell.rangeSelectTop {
|
|
178
|
+
border-top: 3px solid #48a0f4;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
div.ag-row div.ag-cell.rangeSelectBottom {
|
|
182
|
+
border-bottom: 3px solid #48a0f4;
|
|
183
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class SeededRandomForTests {
|
|
2
|
+
value: number;
|
|
3
|
+
constructor(seed: number) {
|
|
4
|
+
this.value = seed % 2147483647;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
next(maxInc?: number) {
|
|
8
|
+
this.value = (this.value * 16807) % 2147483647;
|
|
9
|
+
const result = (this.value - 1) / 2147483646;
|
|
10
|
+
if (maxInc == null) {
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
return ((result * (maxInc + 1)) | 0) % (maxInc + 1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
fromArray<T>(arr: T[]): T {
|
|
17
|
+
return arr[this.next(arr.length - 1)];
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/utils/bearing.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const bearingValueFormatter = (value: any): string => {
|
|
2
2
|
const safeValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
3
|
-
if (safeValue == null) {
|
|
3
|
+
if (safeValue == null || Number.isNaN(safeValue)) {
|
|
4
4
|
return '–';
|
|
5
5
|
}
|
|
6
6
|
return convertDDToDMS(safeValue, false);
|
|
@@ -8,7 +8,7 @@ export const bearingValueFormatter = (value: any): string => {
|
|
|
8
8
|
|
|
9
9
|
export const bearingCorrectionValueFormatter = (value: any): string => {
|
|
10
10
|
const safeValue = value;
|
|
11
|
-
if (safeValue == null) {
|
|
11
|
+
if (safeValue == null || Number.isNaN(safeValue)) {
|
|
12
12
|
return '–';
|
|
13
13
|
}
|
|
14
14
|
if (typeof safeValue === 'string') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test, vi } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import { GridBaseRow } from '../components/
|
|
3
|
+
import { GridBaseRow } from '../components/types';
|
|
4
4
|
import { TextInputValidator, TextInputValidatorProps } from './textValidator';
|
|
5
5
|
|
|
6
6
|
describe('TextInputValidator', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
|
|
3
|
-
import { GridBaseRow } from '../components/
|
|
3
|
+
import { GridBaseRow } from '../components/types';
|
|
4
4
|
import { isFloat, stringByteLengthIsInvalid } from './util';
|
|
5
5
|
|
|
6
6
|
export interface TextInputValidatorProps<TData extends GridBaseRow> {
|