@linzjs/step-ag-grid 23.0.1 → 24.0.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/src/components/ComponentLoadingWrapper.d.ts +1 -1
- package/dist/src/components/Grid.d.ts +17 -17
- package/dist/src/components/GridCell.d.ts +9 -9
- package/dist/src/components/GridCellFiller.d.ts +2 -2
- package/dist/src/components/GridCellMultiEditor.d.ts +6 -6
- package/dist/src/components/GridCellMultiSelectClassRules.d.ts +1 -1
- package/dist/src/components/GridIcon.d.ts +2 -2
- package/dist/src/components/GridNoRowsOverlay.d.ts +1 -1
- package/dist/src/components/GridPopoverHook.d.ts +2 -2
- package/dist/src/components/GridWrapper.d.ts +1 -1
- package/dist/src/components/PostSortRowsHook.d.ts +1 -1
- package/dist/src/components/clickInputWhenContainingCellClicked.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterButtons.d.ts +5 -5
- package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterHeaderIconButton.d.ts +2 -2
- package/dist/src/components/gridFilter/GridFilters.d.ts +1 -1
- package/dist/src/components/gridFilter/index.d.ts +7 -7
- package/dist/src/components/gridFilter/useGridFilter.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +8 -8
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormMessage.d.ts +3 -3
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormMultiSelectGrid.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +5 -5
- package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +3 -3
- package/dist/src/components/gridForm/index.d.ts +10 -10
- package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +1 -1
- package/dist/src/components/gridHeader/index.d.ts +1 -1
- package/dist/src/components/gridHook/index.d.ts +1 -1
- package/dist/src/components/gridHook/useGridContextMenu.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridButton.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridEditBoolean.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/index.d.ts +11 -11
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +5 -5
- package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +1 -1
- package/dist/src/components/gridRender/index.d.ts +2 -2
- package/dist/src/components/gridUtil.d.ts +1 -1
- package/dist/src/components/index.d.ts +19 -19
- package/dist/src/contexts/GridContext.d.ts +4 -4
- package/dist/src/contexts/GridContextProvider.d.ts +3 -3
- package/dist/src/contexts/GridPopoverContext.d.ts +3 -3
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +4 -4
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +1 -1
- package/dist/src/index.d.ts +17 -17
- package/dist/src/lui/ActionButton.d.ts +9 -9
- package/dist/src/lui/FormError.d.ts +2 -2
- package/dist/src/lui/TextAreaInput.d.ts +1 -1
- package/dist/src/lui/TextInputFormatted.d.ts +2 -2
- package/dist/src/lui/reactUtils.d.ts +1 -1
- package/dist/src/lui/stateDeferredHook.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +2 -2
- package/dist/src/react-menu3/components/FocusableItem.d.ts +3 -3
- package/dist/src/react-menu3/components/Menu.d.ts +3 -3
- package/dist/src/react-menu3/components/MenuButton.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuDivider.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuHeader.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuItem.d.ts +3 -3
- package/dist/src/react-menu3/components/MenuList.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/SubMenu.d.ts +5 -5
- package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/MenuListContext.d.ts +2 -2
- package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/SettingsContext.d.ts +2 -2
- package/dist/src/react-menu3/hooks/index.d.ts +9 -9
- package/dist/src/react-menu3/hooks/useBEM.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItemEffect.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItemState.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItems.d.ts +2 -2
- package/dist/src/react-menu3/hooks/useMenuChange.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useMenuState.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +1 -1
- package/dist/src/react-menu3/index.d.ts +11 -11
- package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/index.d.ts +3 -3
- package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +4 -4
- package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +5 -5
- package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +2 -2
- package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +5 -5
- package/dist/src/react-menu3/style-utils/index.d.ts +1 -1
- package/dist/src/react-menu3/types.d.ts +15 -15
- package/dist/src/react-menu3/utils/constants.d.ts +1 -1
- package/dist/src/react-menu3/utils/index.d.ts +3 -3
- package/dist/src/react-menu3/utils/utils.d.ts +5 -5
- package/dist/src/react-menu3/utils/withHovering.d.ts +1 -1
- package/dist/src/utils/testQuick.d.ts +2 -2
- package/dist/src/utils/testUtil.d.ts +2 -2
- package/dist/src/utils/textValidator.d.ts +2 -2
- package/dist/step-ag-grid.cjs.js +966 -952
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +968 -954
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +26 -41
- package/src/components/ComponentLoadingWrapper.tsx +5 -6
- package/src/components/Grid.tsx +85 -83
- package/src/components/GridCell.test.tsx +15 -15
- package/src/components/GridCell.tsx +46 -44
- package/src/components/GridCellFiller.tsx +5 -4
- package/src/components/GridCellMultiEditor.tsx +7 -7
- package/src/components/GridCellMultiSelectClassRules.tsx +3 -3
- package/src/components/GridIcon.tsx +6 -7
- package/src/components/GridLoadableCell.tsx +2 -2
- package/src/components/GridNoRowsOverlay.tsx +8 -8
- package/src/components/GridPopoverHook.tsx +16 -16
- package/src/components/GridWrapper.tsx +2 -2
- package/src/components/PostSortRowsHook.ts +11 -11
- package/src/components/clickInputWhenContainingCellClicked.tsx +5 -5
- package/src/components/gridFilter/GridFilterButtons.tsx +8 -9
- package/src/components/gridFilter/GridFilterColumnsToggle.tsx +25 -26
- package/src/components/gridFilter/GridFilterDownloadCsvButton.tsx +12 -13
- package/src/components/gridFilter/GridFilterHeaderIconButton.tsx +9 -10
- package/src/components/gridFilter/GridFilterQuick.tsx +6 -6
- package/src/components/gridFilter/GridFilters.tsx +1 -1
- package/src/components/gridFilter/index.ts +7 -7
- package/src/components/gridFilter/useGridFilter.ts +3 -3
- package/src/components/gridForm/GridFormDropDown.tsx +56 -52
- package/src/components/gridForm/GridFormEditBearing.tsx +12 -12
- package/src/components/gridForm/GridFormMessage.tsx +10 -10
- package/src/components/gridForm/GridFormMultiSelect.tsx +53 -51
- package/src/components/gridForm/GridFormMultiSelectGrid.tsx +25 -26
- package/src/components/gridForm/GridFormPopoverMenu.tsx +32 -29
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +10 -10
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +8 -8
- package/src/components/gridForm/GridFormTextArea.tsx +11 -11
- package/src/components/gridForm/GridFormTextInput.tsx +11 -11
- package/src/components/gridForm/index.ts +10 -10
- package/src/components/gridHeader/GridHeaderSelect.tsx +9 -9
- package/src/components/gridHeader/index.ts +1 -1
- package/src/components/gridHook/index.ts +1 -1
- package/src/components/gridHook/useGridContextMenu.tsx +7 -7
- package/src/components/gridPopoverEdit/GridButton.tsx +13 -12
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +19 -18
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +7 -6
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.ts +7 -6
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +9 -9
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +8 -7
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +6 -6
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +4 -4
- package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +4 -4
- package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +4 -4
- package/src/components/gridPopoverEdit/index.ts +11 -11
- package/src/components/gridRender/GridRenderGenericCell.tsx +5 -5
- package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +8 -9
- package/src/components/gridRender/index.ts +2 -2
- package/src/components/gridUtil.ts +3 -3
- package/src/components/index.ts +19 -19
- package/src/contexts/GridContext.tsx +52 -46
- package/src/contexts/GridContextProvider.test.tsx +14 -14
- package/src/contexts/GridContextProvider.tsx +42 -41
- package/src/contexts/GridPopoverContext.tsx +10 -7
- package/src/contexts/GridPopoverContextProvider.tsx +12 -10
- package/src/contexts/GridSubComponentContext.ts +6 -5
- package/src/contexts/GridUpdatingContext.tsx +5 -4
- package/src/contexts/GridUpdatingContextProvider.tsx +3 -3
- package/src/index.ts +17 -21
- package/src/lui/ActionButton.tsx +42 -41
- package/src/lui/FormError.tsx +4 -4
- package/src/lui/TextAreaInput.tsx +9 -9
- package/src/lui/TextInputFormatted.tsx +11 -11
- package/src/lui/reactUtils.test.tsx +8 -8
- package/src/lui/reactUtils.tsx +2 -2
- package/src/lui/stateDeferredHook.tsx +3 -5
- package/src/lui/timeoutHook.test.tsx +5 -5
- package/src/lui/timeoutHook.tsx +1 -1
- package/src/react-app-env.d.ts +1 -1
- package/src/react-menu3/components/ControlledMenu.tsx +48 -48
- package/src/react-menu3/components/FocusableItem.tsx +7 -7
- package/src/react-menu3/components/Menu.tsx +11 -11
- package/src/react-menu3/components/MenuButton.tsx +4 -4
- package/src/react-menu3/components/MenuDivider.tsx +4 -4
- package/src/react-menu3/components/MenuGroup.tsx +5 -5
- package/src/react-menu3/components/MenuHeader.tsx +4 -4
- package/src/react-menu3/components/MenuItem.tsx +14 -14
- package/src/react-menu3/components/MenuList.tsx +55 -55
- package/src/react-menu3/components/MenuRadioGroup.tsx +7 -7
- package/src/react-menu3/components/SubMenu.tsx +24 -24
- package/src/react-menu3/contexts/EventHandlersContext.ts +2 -2
- package/src/react-menu3/contexts/HoverItemContext.ts +1 -1
- package/src/react-menu3/contexts/ItemSettingsContext.ts +1 -1
- package/src/react-menu3/contexts/MenuListContext.ts +2 -2
- package/src/react-menu3/contexts/MenuListItemContext.ts +2 -2
- package/src/react-menu3/contexts/RadioGroupContext.ts +2 -2
- package/src/react-menu3/contexts/SettingsContext.ts +2 -2
- package/src/react-menu3/hooks/index.ts +9 -9
- package/src/react-menu3/hooks/useBEM.ts +4 -4
- package/src/react-menu3/hooks/useCombinedRef.ts +2 -2
- package/src/react-menu3/hooks/useIsomorphicLayoutEffect.ts +4 -4
- package/src/react-menu3/hooks/useItemEffect.ts +3 -3
- package/src/react-menu3/hooks/useItemState.ts +5 -5
- package/src/react-menu3/hooks/useItems.ts +8 -8
- package/src/react-menu3/hooks/useMenuChange.ts +3 -3
- package/src/react-menu3/hooks/useMenuState.ts +5 -5
- package/src/react-menu3/hooks/useMenuStateAndFocus.ts +4 -4
- package/src/react-menu3/index.ts +11 -11
- package/src/react-menu3/positionUtils/getPositionHelpers.ts +2 -2
- package/src/react-menu3/positionUtils/index.ts +3 -3
- package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +1 -1
- package/src/react-menu3/positionUtils/placeArrowVertical.ts +1 -1
- package/src/react-menu3/positionUtils/placeLeftorRight.ts +13 -13
- package/src/react-menu3/positionUtils/placeToporBottom.ts +15 -15
- package/src/react-menu3/positionUtils/positionContextMenu.ts +4 -4
- package/src/react-menu3/positionUtils/positionMenu.ts +14 -14
- package/src/react-menu3/style-utils/index.ts +24 -24
- package/src/react-menu3/types.ts +15 -15
- package/src/react-menu3/utils/constants.ts +33 -33
- package/src/react-menu3/utils/index.ts +3 -4
- package/src/react-menu3/utils/propTypes2.ts +10 -10
- package/src/react-menu3/utils/utils.ts +14 -14
- package/src/react-menu3/utils/withHovering.tsx +3 -3
- package/src/stories/components/ActionButton.stories.tsx +23 -24
- package/src/stories/grid/FormTest.tsx +15 -16
- package/src/stories/grid/GridDragRow.stories.tsx +33 -34
- package/src/stories/grid/GridFilterButtons.stories.tsx +32 -33
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +9 -10
- package/src/stories/grid/GridNonEditableRow.stories.tsx +40 -41
- package/src/stories/grid/GridPinnedRow.stories.tsx +25 -26
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +33 -32
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +21 -22
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +18 -19
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +50 -49
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +25 -26
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +93 -94
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +62 -63
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +28 -28
- package/src/stories/grid/GridReadOnly.stories.tsx +66 -67
- package/src/stories/grid/GridViewList.stories.tsx +37 -38
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +37 -38
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +25 -26
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +25 -26
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +31 -31
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +47 -48
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +44 -45
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +19 -20
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +21 -22
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +40 -41
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +14 -15
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +14 -15
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +10 -11
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +20 -21
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +16 -17
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +13 -14
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +13 -14
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +68 -71
- package/src/stories/react-menu/ReactMenu.stories.tsx +26 -26
- package/src/utils/bearing.test.ts +44 -44
- package/src/utils/bearing.ts +20 -20
- package/src/utils/deferredPromise.ts +1 -1
- package/src/utils/storybookTestUtil.ts +2 -2
- package/src/utils/testQuick.ts +15 -14
- package/src/utils/testUtil.ts +31 -36
- package/src/utils/textMatcher.test.ts +9 -9
- package/src/utils/textMatcher.ts +8 -8
- package/src/utils/textValidator.test.ts +56 -56
- package/src/utils/textValidator.ts +11 -11
- package/src/utils/util.test.ts +20 -20
- package/src/utils/util.ts +7 -7
package/src/react-menu3/types.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
//
|
|
2
2
|
// base types
|
|
3
3
|
// ----------------------------------------------------------------------
|
|
4
|
-
import { ForwardedRef, MutableRefObject } from
|
|
4
|
+
import { ForwardedRef, MutableRefObject } from 'react';
|
|
5
5
|
|
|
6
|
-
export type MenuState =
|
|
7
|
-
export type MenuAlign =
|
|
8
|
-
export type MenuDirection =
|
|
9
|
-
export type MenuPosition =
|
|
10
|
-
export type MenuOverflow =
|
|
11
|
-
export type MenuReposition =
|
|
12
|
-
export type MenuViewScroll =
|
|
13
|
-
export type MenuItemTypeProp =
|
|
14
|
-
export type CloseReason =
|
|
6
|
+
export type MenuState = 'opening' | 'open' | 'closing' | 'closed';
|
|
7
|
+
export type MenuAlign = 'start' | 'center' | 'end';
|
|
8
|
+
export type MenuDirection = 'left' | 'right' | 'top' | 'bottom';
|
|
9
|
+
export type MenuPosition = 'auto' | 'anchor' | 'initial';
|
|
10
|
+
export type MenuOverflow = 'auto' | 'visible' | 'hidden';
|
|
11
|
+
export type MenuReposition = 'auto' | 'initial';
|
|
12
|
+
export type MenuViewScroll = 'auto' | 'close' | 'initial';
|
|
13
|
+
export type MenuItemTypeProp = 'checkbox' | 'radio';
|
|
14
|
+
export type CloseReason = 'click' | 'cancel' | 'blur' | 'scroll';
|
|
15
15
|
/**
|
|
16
16
|
* - `'first'` focus the first item in the menu.
|
|
17
17
|
* - `'last'` focus the last item in the menu.
|
|
18
18
|
* - `number` focus item at the specific position (zero-based).
|
|
19
19
|
*/
|
|
20
|
-
export type FocusPosition =
|
|
20
|
+
export type FocusPosition = 'first' | 'last' | number;
|
|
21
21
|
|
|
22
22
|
export type ClassNameProp<M = undefined> = string | ((modifiers: M) => string);
|
|
23
23
|
|
|
24
24
|
export type RenderProp<M, R = React.ReactNode> = R | ((modifiers: M) => R);
|
|
25
25
|
|
|
26
|
-
export interface BaseProps<M = undefined> extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
26
|
+
export interface BaseProps<M = undefined> extends Omit<React.HTMLAttributes<HTMLElement>, 'className' | 'children'> {
|
|
27
27
|
ref?: React.Ref<any>;
|
|
28
28
|
/**
|
|
29
29
|
* Can be a string or a function which receives a modifier object and returns a CSS `class` string.
|
|
@@ -31,7 +31,7 @@ export interface BaseProps<M = undefined> extends Omit<React.HTMLAttributes<HTML
|
|
|
31
31
|
className?: ClassNameProp<M>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export interface BasePropsWithChildren<M = undefined> extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
34
|
+
export interface BasePropsWithChildren<M = undefined> extends Omit<React.HTMLAttributes<HTMLElement>, 'className'> {
|
|
35
35
|
ref?: React.Ref<any>;
|
|
36
36
|
/**
|
|
37
37
|
* Can be a string or a function which receives a modifier object and returns a CSS `class` string.
|
|
@@ -157,7 +157,7 @@ export interface Hoverable {
|
|
|
157
157
|
/**
|
|
158
158
|
* Common props for `Menu`, `SubMenu` and `ControlledMenu`
|
|
159
159
|
*/
|
|
160
|
-
interface BaseMenuProps extends Omit<BaseProps,
|
|
160
|
+
interface BaseMenuProps extends Omit<BaseProps, 'style'> {
|
|
161
161
|
/**
|
|
162
162
|
* Can be a string or a function which receives a modifier object and returns a CSS `class` string.
|
|
163
163
|
*/
|
|
@@ -310,7 +310,7 @@ export interface RootMenuProps extends BaseMenuProps, MenuStateOptions {
|
|
|
310
310
|
/**
|
|
311
311
|
* Properties of this object are spread to the root DOM element containing the menu.
|
|
312
312
|
*/
|
|
313
|
-
containerProps?: Omit<React.HTMLAttributes<HTMLElement>,
|
|
313
|
+
containerProps?: Omit<React.HTMLAttributes<HTMLElement>, 'className'>;
|
|
314
314
|
/**
|
|
315
315
|
* A ref object attached to a DOM element within which menu will be positioned.
|
|
316
316
|
* If not provided, the nearest ancestor which has CSS `overflow` set to a value
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { MenuState } from
|
|
1
|
+
import { MenuState } from '../types';
|
|
2
2
|
|
|
3
|
-
export const menuContainerClass =
|
|
4
|
-
export const menuClass =
|
|
5
|
-
export const menuButtonClass =
|
|
6
|
-
export const menuArrowClass =
|
|
7
|
-
export const menuItemClass =
|
|
8
|
-
export const menuDividerClass =
|
|
9
|
-
export const menuHeaderClass =
|
|
10
|
-
export const menuGroupClass =
|
|
11
|
-
export const subMenuClass =
|
|
12
|
-
export const radioGroupClass =
|
|
3
|
+
export const menuContainerClass = 'szh-menu-container';
|
|
4
|
+
export const menuClass = 'szh-menu';
|
|
5
|
+
export const menuButtonClass = 'szh-menu-button';
|
|
6
|
+
export const menuArrowClass = 'arrow';
|
|
7
|
+
export const menuItemClass = 'item';
|
|
8
|
+
export const menuDividerClass = 'divider';
|
|
9
|
+
export const menuHeaderClass = 'header';
|
|
10
|
+
export const menuGroupClass = 'group';
|
|
11
|
+
export const subMenuClass = 'submenu';
|
|
12
|
+
export const radioGroupClass = 'radio-group';
|
|
13
13
|
|
|
14
14
|
export interface RMEvent {
|
|
15
15
|
value: any;
|
|
@@ -21,16 +21,16 @@ export interface RMEvent {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const Keys = Object.freeze({
|
|
24
|
-
ENTER:
|
|
25
|
-
TAB:
|
|
26
|
-
ESC:
|
|
27
|
-
SPACE:
|
|
28
|
-
HOME:
|
|
29
|
-
END:
|
|
30
|
-
LEFT:
|
|
31
|
-
RIGHT:
|
|
32
|
-
UP:
|
|
33
|
-
DOWN:
|
|
24
|
+
ENTER: 'Enter',
|
|
25
|
+
TAB: 'Tab',
|
|
26
|
+
ESC: 'Escape',
|
|
27
|
+
SPACE: ' ',
|
|
28
|
+
HOME: 'Home',
|
|
29
|
+
END: 'End',
|
|
30
|
+
LEFT: 'ArrowLeft',
|
|
31
|
+
RIGHT: 'ArrowRight',
|
|
32
|
+
UP: 'ArrowUp',
|
|
33
|
+
DOWN: 'ArrowDown',
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
export const HoverActionTypes = Object.freeze({
|
|
@@ -45,22 +45,22 @@ export const HoverActionTypes = Object.freeze({
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
export const CloseReason = Object.freeze({
|
|
48
|
-
CLICK:
|
|
49
|
-
CANCEL:
|
|
50
|
-
BLUR:
|
|
51
|
-
SCROLL:
|
|
52
|
-
TAB_FORWARD:
|
|
53
|
-
TAB_BACKWARD:
|
|
48
|
+
CLICK: 'click',
|
|
49
|
+
CANCEL: 'cancel',
|
|
50
|
+
BLUR: 'blur',
|
|
51
|
+
SCROLL: 'scroll',
|
|
52
|
+
TAB_FORWARD: 'tab_forward',
|
|
53
|
+
TAB_BACKWARD: 'tab_backward',
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
export const FocusPositions = Object.freeze({
|
|
57
|
-
FIRST:
|
|
58
|
-
LAST:
|
|
57
|
+
FIRST: 'first',
|
|
58
|
+
LAST: 'last',
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
export const MenuStateMap: Record<string, MenuState> = Object.freeze({
|
|
62
|
-
entering:
|
|
63
|
-
entered:
|
|
64
|
-
exiting:
|
|
65
|
-
exited:
|
|
62
|
+
entering: 'opening',
|
|
63
|
+
entered: 'open',
|
|
64
|
+
exiting: 'closing',
|
|
65
|
+
exited: 'closed',
|
|
66
66
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
|
|
4
|
-
export { withHovering } from "./withHovering";
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './utils';
|
|
3
|
+
export { withHovering } from './withHovering';
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { bool, exact, func, number, object, oneOf, oneOfType, string } from
|
|
1
|
+
import { bool, exact, func, number, object, oneOf, oneOfType, string } from 'prop-types';
|
|
2
2
|
|
|
3
3
|
export const stylePropTypes = (name?: string) => ({
|
|
4
|
-
[name ? `${name}ClassName` :
|
|
4
|
+
[name ? `${name}ClassName` : 'className']: oneOfType([string, func]),
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
export const Direction = oneOf([
|
|
7
|
+
export const Direction = oneOf(['left', 'right', 'top', 'bottom']);
|
|
8
8
|
|
|
9
9
|
// Menu, SubMenu and ControlledMenu
|
|
10
10
|
export const menuPropTypes = {
|
|
11
11
|
className: string,
|
|
12
|
-
...stylePropTypes(
|
|
13
|
-
...stylePropTypes(
|
|
12
|
+
...stylePropTypes('menu'),
|
|
13
|
+
...stylePropTypes('arrow'),
|
|
14
14
|
menuStyle: object,
|
|
15
15
|
arrowStyle: object,
|
|
16
16
|
arrow: bool,
|
|
17
17
|
setDownOverflow: bool,
|
|
18
18
|
offsetX: number,
|
|
19
19
|
offsetY: number,
|
|
20
|
-
align: oneOf([
|
|
20
|
+
align: oneOf(['start', 'center', 'end']),
|
|
21
21
|
direction: Direction,
|
|
22
|
-
position: oneOf([
|
|
23
|
-
overflow: oneOf([
|
|
22
|
+
position: oneOf(['auto', 'anchor', 'initial']),
|
|
23
|
+
overflow: oneOf(['auto', 'visible', 'hidden']),
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// Menu and ControlledMenu
|
|
@@ -40,9 +40,9 @@ export const rootMenuPropTypes = {
|
|
|
40
40
|
transitionTimeout: number,
|
|
41
41
|
boundingBoxRef: object,
|
|
42
42
|
boundingBoxPadding: string,
|
|
43
|
-
reposition: oneOf([
|
|
43
|
+
reposition: oneOf(['auto', 'initial']),
|
|
44
44
|
repositionFlag: oneOfType([string, number]),
|
|
45
|
-
viewScroll: oneOf([
|
|
45
|
+
viewScroll: oneOf(['auto', 'close', 'initial']),
|
|
46
46
|
submenuOpenDelay: number,
|
|
47
47
|
submenuCloseDelay: number,
|
|
48
48
|
portal: oneOfType([
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { findIndex } from
|
|
2
|
-
import { unstable_batchedUpdates } from
|
|
1
|
+
import { findIndex } from 'lodash-es';
|
|
2
|
+
import { unstable_batchedUpdates } from 'react-dom';
|
|
3
3
|
|
|
4
|
-
import { MenuButtonProps } from
|
|
5
|
-
import { MenuState, MenuStateOptions } from
|
|
4
|
+
import { MenuButtonProps } from '../components/MenuButton';
|
|
5
|
+
import { MenuState, MenuStateOptions } from '../types';
|
|
6
6
|
|
|
7
|
-
export const isMenuOpen = (state?: MenuState) => !!state && state[0] ===
|
|
7
|
+
export const isMenuOpen = (state?: MenuState) => !!state && state[0] === 'o';
|
|
8
8
|
export const batchedUpdates = unstable_batchedUpdates || ((callback: () => any) => callback());
|
|
9
9
|
export const values = Object.values || ((obj: { [x: string]: any }) => Object.keys(obj).map((key) => obj[key]));
|
|
10
10
|
export const floatEqual = (a: number, b: number, diff = 0.0001) => Math.abs(a - b) < diff;
|
|
@@ -14,17 +14,17 @@ export type TransitionMap = {
|
|
|
14
14
|
close?: boolean;
|
|
15
15
|
item?: boolean;
|
|
16
16
|
};
|
|
17
|
-
export const getTransition = (transition: MenuStateOptions[
|
|
17
|
+
export const getTransition = (transition: MenuStateOptions['transition'], name: keyof TransitionMap) =>
|
|
18
18
|
transition === true || !!(transition && transition[name]);
|
|
19
19
|
|
|
20
20
|
export function safeCall<T, R>(fn: (arg?: T) => R, arg?: T): R;
|
|
21
21
|
export function safeCall<T, R>(fn: T, arg: R): T;
|
|
22
22
|
export function safeCall<T, R>(fn: (arg?: T) => R, arg?: T): T | R {
|
|
23
|
-
return typeof fn ===
|
|
23
|
+
return typeof fn === 'function' ? fn(arg) : fn;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const internalKey =
|
|
27
|
-
export const getName = (component: Record<string, any
|
|
26
|
+
const internalKey = '_szhsinMenu';
|
|
27
|
+
export const getName = (component: Record<string, any>) => component[internalKey];
|
|
28
28
|
//export const defineName = <T extends any[]>(name: string, component: (...args: T) => ReactElement) =>
|
|
29
29
|
// Object.defineProperty(component, internalKey, { value: name });
|
|
30
30
|
|
|
@@ -38,7 +38,7 @@ export const mergeProps = (target: any, source: any) => {
|
|
|
38
38
|
Object.keys(source).forEach((key) => {
|
|
39
39
|
const targetProp = target[key];
|
|
40
40
|
const sourceProp = source[key];
|
|
41
|
-
if (typeof sourceProp ===
|
|
41
|
+
if (typeof sourceProp === 'function' && targetProp) {
|
|
42
42
|
target[key] = (...arg: any[]) => {
|
|
43
43
|
sourceProp(...arg);
|
|
44
44
|
targetProp(...arg);
|
|
@@ -81,7 +81,7 @@ export const getScrollAncestor = (node: Node | null): Element | null => {
|
|
|
81
81
|
|
|
82
82
|
export function commonProps(isDisabled?: boolean, isHovering?: boolean) {
|
|
83
83
|
return {
|
|
84
|
-
|
|
84
|
+
'aria-disabled': isDisabled || undefined,
|
|
85
85
|
tabIndex: isHovering ? 0 : -1,
|
|
86
86
|
};
|
|
87
87
|
}
|
|
@@ -90,15 +90,15 @@ export const indexOfNode = (nodeList: NodeListOf<Node>, node: Node) => findIndex
|
|
|
90
90
|
|
|
91
91
|
export const focusFirstInput = (container: any) => {
|
|
92
92
|
// We can't use instanceof Element in portals, so I use querySelectorAll as a proxy here
|
|
93
|
-
if (!container || !(
|
|
93
|
+
if (!container || !('querySelectorAll' in container)) return false;
|
|
94
94
|
const inputs = container.querySelectorAll("input[type='text'],input:not([type]),textarea");
|
|
95
95
|
const input = inputs[0];
|
|
96
96
|
// Using focus as proxy for HTMLElement
|
|
97
|
-
if (!input || !(
|
|
97
|
+
if (!input || !('focus' in input)) return false;
|
|
98
98
|
input.focus();
|
|
99
99
|
// Text areas should start at end
|
|
100
100
|
// this is a proxy for instanceof HTMLTextAreaElement
|
|
101
|
-
if ([
|
|
101
|
+
if (['textarea', 'text'].includes(input.type)) {
|
|
102
102
|
input.setSelectionRange(0, input.value.length);
|
|
103
103
|
}
|
|
104
104
|
return true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { forwardRef, memo, MutableRefObject, PropsWithRef, ReactElement, useContext, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { HoverItemContext } from
|
|
3
|
+
import { HoverItemContext } from '../contexts/HoverItemContext';
|
|
4
4
|
|
|
5
5
|
export interface withHoveringResultProps {
|
|
6
6
|
isHovering?: boolean;
|
|
@@ -18,7 +18,7 @@ export const withHovering = <X extends Record<string, any>, T extends PropsWithR
|
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
|
-
{/* @ts-
|
|
21
|
+
{/* @ts-expect-error Can't work out what the ref issue is here */}
|
|
22
22
|
<Component
|
|
23
23
|
{...props}
|
|
24
24
|
menuItemRef={menuItemRef}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@linzjs/lui/dist/scss/base.scss';
|
|
2
|
+
import '@linzjs/lui/dist/fonts';
|
|
2
3
|
|
|
3
|
-
import { Meta, StoryFn } from
|
|
4
|
-
import { useCallback } from
|
|
4
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
5
|
+
import { useCallback } from 'react';
|
|
5
6
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { ActionButton } from "../../lui/ActionButton";
|
|
9
|
-
import { wait } from "../../utils/util";
|
|
7
|
+
import { ActionButton } from '../../lui/ActionButton';
|
|
8
|
+
import { wait } from '../../utils/util';
|
|
10
9
|
|
|
11
10
|
export default {
|
|
12
|
-
title:
|
|
11
|
+
title: 'Components / ActionButton',
|
|
13
12
|
component: ActionButton,
|
|
14
13
|
args: {},
|
|
15
14
|
} as Meta<typeof ActionButton>;
|
|
@@ -20,35 +19,35 @@ const ActionButtonTemplate: StoryFn<typeof ActionButton> = () => {
|
|
|
20
19
|
}, []);
|
|
21
20
|
return (
|
|
22
21
|
<>
|
|
23
|
-
<ActionButton icon={
|
|
22
|
+
<ActionButton icon={'ic_add'} name={'Add new row'} inProgressName={'Adding...'} onClick={performAction} />
|
|
24
23
|
<br />
|
|
25
|
-
<ActionButton icon={
|
|
24
|
+
<ActionButton icon={'ic_add'} aria-label={'Add new row'} onClick={performAction} level={'primary'} />
|
|
26
25
|
<br />
|
|
27
26
|
<ActionButton
|
|
28
|
-
icon={
|
|
29
|
-
aria-label={
|
|
27
|
+
icon={'ic_add'}
|
|
28
|
+
aria-label={'Add new row'}
|
|
30
29
|
onClick={performAction}
|
|
31
|
-
level={
|
|
32
|
-
className={
|
|
30
|
+
level={'primary'}
|
|
31
|
+
className={'ActionButton-tight'}
|
|
33
32
|
/>
|
|
34
33
|
<br />
|
|
35
34
|
<ActionButton
|
|
36
|
-
icon={
|
|
37
|
-
name={
|
|
35
|
+
icon={'ic_arrow_forward_right'}
|
|
36
|
+
name={'Continue'}
|
|
38
37
|
onClick={performAction}
|
|
39
|
-
iconPosition={
|
|
40
|
-
level={
|
|
41
|
-
className={
|
|
38
|
+
iconPosition={'right'}
|
|
39
|
+
level={'secondary'}
|
|
40
|
+
className={'ActionButton-fill'}
|
|
42
41
|
style={{ maxWidth: 160 }}
|
|
43
42
|
/>
|
|
44
43
|
<br />
|
|
45
44
|
<ActionButton
|
|
46
|
-
icon={
|
|
47
|
-
name={
|
|
45
|
+
icon={'ic_arrow_forward_right'}
|
|
46
|
+
name={'Disabled'}
|
|
48
47
|
onClick={performAction}
|
|
49
|
-
iconPosition={
|
|
50
|
-
level={
|
|
51
|
-
className={
|
|
48
|
+
iconPosition={'right'}
|
|
49
|
+
level={'secondary'}
|
|
50
|
+
className={'ActionButton-fill'}
|
|
52
51
|
style={{ maxWidth: 160 }}
|
|
53
52
|
disabled={true}
|
|
54
53
|
/>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './FormTest.scss';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { LuiAlertModal, LuiAlertModalButtons, LuiButton, LuiTextInput } from '@linzjs/lui';
|
|
4
|
+
import { ReactElement, useCallback, useState } from 'react';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { CellEditorCommon, FormError, useGridPopoverContext, useGridPopoverHook, wait } from "../..";
|
|
6
|
+
import { CellEditorCommon, FormError, useGridPopoverContext, useGridPopoverHook, wait } from '../..';
|
|
8
7
|
|
|
9
8
|
export interface IFormTestRow {
|
|
10
9
|
id: number;
|
|
@@ -18,17 +17,17 @@ export interface IFormTestRow {
|
|
|
18
17
|
|
|
19
18
|
export const FormTest = (props: CellEditorCommon): ReactElement => {
|
|
20
19
|
const { value } = useGridPopoverContext<IFormTestRow>();
|
|
21
|
-
const [v1, ...v2] = value.split(
|
|
20
|
+
const [v1, ...v2] = value.split(' ');
|
|
22
21
|
|
|
23
22
|
const [nameType, setNameType] = useState(v1);
|
|
24
|
-
const [numba, setNumba] = useState(v2.join(
|
|
23
|
+
const [numba, setNumba] = useState(v2.join(' '));
|
|
25
24
|
|
|
26
25
|
const save = useCallback(
|
|
27
26
|
async (selectedRows: IFormTestRow[]): Promise<boolean> => {
|
|
28
27
|
// eslint-disable-next-line no-console
|
|
29
|
-
console.log(
|
|
28
|
+
console.log('onSave', selectedRows, nameType, numba);
|
|
30
29
|
|
|
31
|
-
selectedRows.forEach((row) => (row.name = [nameType, numba].join(
|
|
30
|
+
selectedRows.forEach((row) => (row.name = [nameType, numba].join(' ')));
|
|
32
31
|
await wait(1000);
|
|
33
32
|
|
|
34
33
|
// Close form
|
|
@@ -38,7 +37,7 @@ export const FormTest = (props: CellEditorCommon): ReactElement => {
|
|
|
38
37
|
);
|
|
39
38
|
|
|
40
39
|
const invalid = useCallback(() => {
|
|
41
|
-
if (numba.length < 3) return
|
|
40
|
+
if (numba.length < 3) return 'Number should be at least 3 characters';
|
|
42
41
|
return null;
|
|
43
42
|
}, [numba.length]);
|
|
44
43
|
|
|
@@ -79,7 +78,7 @@ export const FormTest = (props: CellEditorCommon): ReactElement => {
|
|
|
79
78
|
level="primary"
|
|
80
79
|
onClick={() => {
|
|
81
80
|
setShowModal(false);
|
|
82
|
-
triggerSave()
|
|
81
|
+
void triggerSave();
|
|
83
82
|
}}
|
|
84
83
|
data-testid="WarningAlertWithButtons-ok"
|
|
85
84
|
>
|
|
@@ -88,13 +87,13 @@ export const FormTest = (props: CellEditorCommon): ReactElement => {
|
|
|
88
87
|
</LuiAlertModalButtons>
|
|
89
88
|
</LuiAlertModal>
|
|
90
89
|
)}
|
|
91
|
-
<div className={
|
|
90
|
+
<div className={'Grid-popoverContainer'}>
|
|
92
91
|
<div className="FormTest">
|
|
93
|
-
<div className={
|
|
94
|
-
<LuiTextInput label={
|
|
92
|
+
<div className={'FormTest-textInput'}>
|
|
93
|
+
<LuiTextInput label={'Name type'} value={nameType} onChange={(e) => setNameType(e.target.value)} />
|
|
95
94
|
</div>
|
|
96
|
-
<div className={
|
|
97
|
-
<LuiTextInput label={
|
|
95
|
+
<div className={'FormTest-textInput'}>
|
|
96
|
+
<LuiTextInput label={'Number'} value={numba} onChange={(e) => setNumba(e.target.value)} />
|
|
98
97
|
</div>
|
|
99
98
|
<div style={{ marginTop: 25 }}>
|
|
100
99
|
<input
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import '../../styles/GridTheme.scss';
|
|
2
|
+
import '../../styles/index.scss';
|
|
3
|
+
import '@linzjs/lui/dist/scss/base.scss';
|
|
4
|
+
import '@linzjs/lui/dist/fonts';
|
|
4
5
|
|
|
5
|
-
import { Meta, StoryFn } from
|
|
6
|
-
import { useMemo, useState } from
|
|
7
|
-
|
|
8
|
-
import "@linzjs/lui/dist/fonts";
|
|
6
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
7
|
+
import { useMemo, useState } from 'react';
|
|
9
8
|
|
|
10
9
|
import {
|
|
11
10
|
ColDefT,
|
|
@@ -15,30 +14,30 @@ import {
|
|
|
15
14
|
GridProps,
|
|
16
15
|
GridUpdatingContextProvider,
|
|
17
16
|
GridWrapper,
|
|
18
|
-
} from
|
|
19
|
-
import { waitForGridReady } from
|
|
17
|
+
} from '../..';
|
|
18
|
+
import { waitForGridReady } from '../../utils/storybookTestUtil';
|
|
20
19
|
|
|
21
20
|
export default {
|
|
22
|
-
title:
|
|
21
|
+
title: 'Components / Grids',
|
|
23
22
|
component: Grid,
|
|
24
23
|
args: {
|
|
25
24
|
quickFilter: true,
|
|
26
|
-
quickFilterValue:
|
|
27
|
-
quickFilterPlaceholder:
|
|
25
|
+
quickFilterValue: '',
|
|
26
|
+
quickFilterPlaceholder: 'Quick filter...',
|
|
28
27
|
selectable: false,
|
|
29
|
-
rowSelection:
|
|
28
|
+
rowSelection: 'single',
|
|
30
29
|
},
|
|
31
30
|
// Storybook hangs otherwise
|
|
32
31
|
parameters: {
|
|
33
32
|
docs: {
|
|
34
33
|
source: {
|
|
35
|
-
type:
|
|
34
|
+
type: 'code',
|
|
36
35
|
},
|
|
37
36
|
},
|
|
38
37
|
},
|
|
39
38
|
decorators: [
|
|
40
39
|
(Story) => (
|
|
41
|
-
<div style={{ maxWidth: 1024, height: 400, display:
|
|
40
|
+
<div style={{ maxWidth: 1024, height: 400, display: 'flex', flexDirection: 'column' }}>
|
|
42
41
|
<GridUpdatingContextProvider>
|
|
43
42
|
<GridContextProvider>
|
|
44
43
|
<Story />
|
|
@@ -62,29 +61,29 @@ const GridDragRowTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
|
62
61
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
63
62
|
() => [
|
|
64
63
|
GridCell({
|
|
65
|
-
field:
|
|
66
|
-
headerName:
|
|
64
|
+
field: 'id',
|
|
65
|
+
headerName: 'Id',
|
|
67
66
|
lockVisible: true,
|
|
68
67
|
}),
|
|
69
|
-
GridCell<ITestRow, ITestRow[
|
|
70
|
-
field:
|
|
71
|
-
headerName:
|
|
68
|
+
GridCell<ITestRow, ITestRow['position']>({
|
|
69
|
+
field: 'position',
|
|
70
|
+
headerName: 'Position',
|
|
72
71
|
cellRendererParams: {
|
|
73
|
-
warning: ({ value }) => value ===
|
|
74
|
-
info: ({ value }) => value ===
|
|
72
|
+
warning: ({ value }) => value === 'Tester' && 'Testers are testing',
|
|
73
|
+
info: ({ value }) => value === 'Developer' && 'Developers are awesome',
|
|
75
74
|
},
|
|
76
75
|
}),
|
|
77
76
|
GridCell({
|
|
78
|
-
field:
|
|
79
|
-
headerName:
|
|
77
|
+
field: 'age',
|
|
78
|
+
headerName: 'Age',
|
|
80
79
|
}),
|
|
81
80
|
GridCell({
|
|
82
|
-
field:
|
|
83
|
-
headerName:
|
|
81
|
+
field: 'height',
|
|
82
|
+
headerName: 'Height',
|
|
84
83
|
}),
|
|
85
84
|
GridCell({
|
|
86
|
-
field:
|
|
87
|
-
headerName:
|
|
85
|
+
field: 'desc',
|
|
86
|
+
headerName: 'Description',
|
|
88
87
|
flex: 1,
|
|
89
88
|
}),
|
|
90
89
|
],
|
|
@@ -92,16 +91,16 @@ const GridDragRowTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
|
92
91
|
);
|
|
93
92
|
|
|
94
93
|
const [rowData, setRowData] = useState([
|
|
95
|
-
{ id: 1000, position:
|
|
96
|
-
{ id: 1001, position:
|
|
97
|
-
{ id: 1002, position:
|
|
98
|
-
{ id: 1003, position:
|
|
94
|
+
{ id: 1000, position: 'Tester', age: 30, height: `6'4"`, desc: 'Tests application', dd: '1' },
|
|
95
|
+
{ id: 1001, position: 'Developer', age: 12, height: `5'3"`, desc: 'Develops application', dd: '2' },
|
|
96
|
+
{ id: 1002, position: 'Manager', age: 65, height: `5'9"`, desc: 'Manages', dd: '3' },
|
|
97
|
+
{ id: 1003, position: 'BA', age: 42, height: `5'7"`, desc: 'BAs', dd: '4' },
|
|
99
98
|
]);
|
|
100
99
|
|
|
101
100
|
return (
|
|
102
101
|
<GridWrapper maxHeight={300}>
|
|
103
102
|
<Grid
|
|
104
|
-
data-testid={
|
|
103
|
+
data-testid={'readonly'}
|
|
105
104
|
{...props}
|
|
106
105
|
selectable={true}
|
|
107
106
|
rowSelection="multiple"
|
|
@@ -109,7 +108,7 @@ const GridDragRowTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
|
109
108
|
columnDefs={columnDefs}
|
|
110
109
|
defaultColDef={{ sortable: false }}
|
|
111
110
|
rowData={rowData}
|
|
112
|
-
onRowDragEnd={
|
|
111
|
+
onRowDragEnd={(movedRow, targetRow, _targetIndex) => {
|
|
113
112
|
setRowData(
|
|
114
113
|
rowData.map((r) => {
|
|
115
114
|
if (r.id === movedRow.id) return targetRow;
|