@etsoo/react 1.5.80 → 1.5.81
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/README.md +7 -2
- package/__tests__/ReactUtils.ts +6 -0
- package/lib/{mu → components}/DnDList.d.ts +1 -14
- package/lib/{mu → components}/DnDList.js +1 -24
- package/lib/components/GridMethodRef.d.ts +11 -0
- package/lib/{mu → components}/GridMethodRef.js +0 -0
- package/lib/components/ScrollerGrid.d.ts +3 -3
- package/lib/components/ScrollerList.d.ts +3 -3
- package/lib/index.d.ts +2 -74
- package/lib/index.js +2 -75
- package/lib/notifier/Notifier.d.ts +2 -3
- package/lib/uses/useWindowScroll.d.ts +10 -0
- package/lib/uses/useWindowScroll.js +46 -0
- package/lib/uses/useWindowSize.js +11 -5
- package/package.json +3 -15
- package/src/{mu → components}/DnDList.tsx +11 -34
- package/src/components/GridMethodRef.ts +12 -0
- package/src/components/ScrollerGrid.tsx +3 -3
- package/src/components/ScrollerList.tsx +5 -3
- package/src/index.ts +2 -78
- package/src/notifier/Notifier.ts +2 -3
- package/src/uses/useWindowScroll.ts +60 -0
- package/src/uses/useWindowSize.ts +14 -5
- package/__tests__/mu/ComboBox.tsx +0 -30
- package/__tests__/mu/MUGlobalTests.tsx +0 -58
- package/__tests__/mu/NotifierMUTests.tsx +0 -213
- package/__tests__/mu/SelectEx.tsx +0 -26
- package/lib/app/CommonApp.d.ts +0 -39
- package/lib/app/CommonApp.js +0 -149
- package/lib/app/IServiceAppSettings.d.ts +0 -11
- package/lib/app/IServiceAppSettings.js +0 -1
- package/lib/app/IServicePage.d.ts +0 -6
- package/lib/app/IServicePage.js +0 -1
- package/lib/app/IServiceUser.d.ts +0 -14
- package/lib/app/IServiceUser.js +0 -1
- package/lib/app/ISmartERPUser.d.ts +0 -14
- package/lib/app/ISmartERPUser.js +0 -1
- package/lib/app/Labels.d.ts +0 -65
- package/lib/app/Labels.js +0 -62
- package/lib/app/ReactApp.d.ts +0 -194
- package/lib/app/ReactApp.js +0 -298
- package/lib/app/ServiceApp.d.ts +0 -78
- package/lib/app/ServiceApp.js +0 -244
- package/lib/components/ShowDataComparison.d.ts +0 -20
- package/lib/components/ShowDataComparison.js +0 -60
- package/lib/mu/AuditDisplay.d.ts +0 -33
- package/lib/mu/AuditDisplay.js +0 -52
- package/lib/mu/AutocompleteExtendedProps.d.ts +0 -64
- package/lib/mu/AutocompleteExtendedProps.js +0 -1
- package/lib/mu/BackButton.d.ts +0 -13
- package/lib/mu/BackButton.js +0 -33
- package/lib/mu/BridgeCloseButton.d.ts +0 -23
- package/lib/mu/BridgeCloseButton.js +0 -32
- package/lib/mu/ButtonLink.d.ts +0 -17
- package/lib/mu/ButtonLink.js +0 -19
- package/lib/mu/ComboBox.d.ts +0 -38
- package/lib/mu/ComboBox.js +0 -108
- package/lib/mu/CountdownButton.d.ts +0 -23
- package/lib/mu/CountdownButton.js +0 -81
- package/lib/mu/CustomFabProps.d.ts +0 -27
- package/lib/mu/CustomFabProps.js +0 -1
- package/lib/mu/DataGridEx.d.ts +0 -96
- package/lib/mu/DataGridEx.js +0 -331
- package/lib/mu/DataGridRenderers.d.ts +0 -22
- package/lib/mu/DataGridRenderers.js +0 -99
- package/lib/mu/DialogButton.d.ts +0 -54
- package/lib/mu/DialogButton.js +0 -45
- package/lib/mu/DraggablePaperComponent.d.ts +0 -8
- package/lib/mu/DraggablePaperComponent.js +0 -12
- package/lib/mu/EmailInput.d.ts +0 -11
- package/lib/mu/EmailInput.js +0 -15
- package/lib/mu/FabBox.d.ts +0 -21
- package/lib/mu/FabBox.js +0 -31
- package/lib/mu/FlexBox.d.ts +0 -14
- package/lib/mu/FlexBox.js +0 -18
- package/lib/mu/GridDataFormat.d.ts +0 -10
- package/lib/mu/GridDataFormat.js +0 -43
- package/lib/mu/GridMethodRef.d.ts +0 -11
- package/lib/mu/IconButtonLink.d.ts +0 -17
- package/lib/mu/IconButtonLink.js +0 -16
- package/lib/mu/InputField.d.ts +0 -21
- package/lib/mu/InputField.js +0 -39
- package/lib/mu/ItemList.d.ts +0 -56
- package/lib/mu/ItemList.js +0 -69
- package/lib/mu/ListItemRightIcon.d.ts +0 -4
- package/lib/mu/ListItemRightIcon.js +0 -8
- package/lib/mu/ListMoreDisplay.d.ts +0 -35
- package/lib/mu/ListMoreDisplay.js +0 -99
- package/lib/mu/LoadingButton.d.ts +0 -16
- package/lib/mu/LoadingButton.js +0 -41
- package/lib/mu/MUGlobal.d.ts +0 -102
- package/lib/mu/MUGlobal.js +0 -184
- package/lib/mu/MaskInput.d.ts +0 -34
- package/lib/mu/MaskInput.js +0 -43
- package/lib/mu/MobileListItemRenderer.d.ts +0 -17
- package/lib/mu/MobileListItemRenderer.js +0 -35
- package/lib/mu/MoreFab.d.ts +0 -45
- package/lib/mu/MoreFab.js +0 -95
- package/lib/mu/NotifierMU.d.ts +0 -47
- package/lib/mu/NotifierMU.js +0 -387
- package/lib/mu/NotifierPromptProps.d.ts +0 -22
- package/lib/mu/NotifierPromptProps.js +0 -1
- package/lib/mu/OptionGroup.d.ts +0 -58
- package/lib/mu/OptionGroup.js +0 -81
- package/lib/mu/PList.d.ts +0 -15
- package/lib/mu/PList.js +0 -12
- package/lib/mu/ProgressCount.d.ts +0 -44
- package/lib/mu/ProgressCount.js +0 -79
- package/lib/mu/PullToRefreshUI.d.ts +0 -9
- package/lib/mu/PullToRefreshUI.js +0 -18
- package/lib/mu/RLink.d.ts +0 -14
- package/lib/mu/RLink.js +0 -37
- package/lib/mu/ResponsibleContainer.d.ts +0 -89
- package/lib/mu/ResponsibleContainer.js +0 -159
- package/lib/mu/ScrollTopFab.d.ts +0 -7
- package/lib/mu/ScrollTopFab.js +0 -25
- package/lib/mu/ScrollerListEx.d.ts +0 -81
- package/lib/mu/ScrollerListEx.js +0 -167
- package/lib/mu/SearchBar.d.ts +0 -29
- package/lib/mu/SearchBar.js +0 -262
- package/lib/mu/SearchField.d.ts +0 -21
- package/lib/mu/SearchField.js +0 -39
- package/lib/mu/SearchOptionGroup.d.ts +0 -9
- package/lib/mu/SearchOptionGroup.js +0 -14
- package/lib/mu/SelectBool.d.ts +0 -13
- package/lib/mu/SelectBool.js +0 -22
- package/lib/mu/SelectEx.d.ts +0 -50
- package/lib/mu/SelectEx.js +0 -156
- package/lib/mu/Switch.d.ts +0 -29
- package/lib/mu/Switch.js +0 -34
- package/lib/mu/SwitchAnt.d.ts +0 -25
- package/lib/mu/SwitchAnt.js +0 -40
- package/lib/mu/TabBox.d.ts +0 -54
- package/lib/mu/TabBox.js +0 -31
- package/lib/mu/TableEx.d.ts +0 -66
- package/lib/mu/TableEx.js +0 -271
- package/lib/mu/TextFieldEx.d.ts +0 -101
- package/lib/mu/TextFieldEx.js +0 -127
- package/lib/mu/Tiplist.d.ts +0 -18
- package/lib/mu/Tiplist.js +0 -158
- package/lib/mu/TooltipClick.d.ts +0 -15
- package/lib/mu/TooltipClick.js +0 -40
- package/lib/mu/UserAvatar.d.ts +0 -24
- package/lib/mu/UserAvatar.js +0 -25
- package/lib/mu/UserAvatarEditor.d.ts +0 -53
- package/lib/mu/UserAvatarEditor.js +0 -129
- package/lib/mu/pages/CommonPage.d.ts +0 -11
- package/lib/mu/pages/CommonPage.js +0 -60
- package/lib/mu/pages/CommonPageProps.d.ts +0 -60
- package/lib/mu/pages/CommonPageProps.js +0 -1
- package/lib/mu/pages/DataGridPage.d.ts +0 -9
- package/lib/mu/pages/DataGridPage.js +0 -81
- package/lib/mu/pages/DataGridPageProps.d.ts +0 -17
- package/lib/mu/pages/DataGridPageProps.js +0 -1
- package/lib/mu/pages/EditPage.d.ts +0 -33
- package/lib/mu/pages/EditPage.js +0 -29
- package/lib/mu/pages/FixedListPage.d.ts +0 -15
- package/lib/mu/pages/FixedListPage.js +0 -72
- package/lib/mu/pages/ListPage.d.ts +0 -9
- package/lib/mu/pages/ListPage.js +0 -51
- package/lib/mu/pages/ListPageProps.d.ts +0 -7
- package/lib/mu/pages/ListPageProps.js +0 -1
- package/lib/mu/pages/ResponsivePage.d.ts +0 -9
- package/lib/mu/pages/ResponsivePage.js +0 -45
- package/lib/mu/pages/ResponsivePageProps.d.ts +0 -39
- package/lib/mu/pages/ResponsivePageProps.js +0 -1
- package/lib/mu/pages/SearchPageProps.d.ts +0 -30
- package/lib/mu/pages/SearchPageProps.js +0 -1
- package/lib/mu/pages/TablePage.d.ts +0 -9
- package/lib/mu/pages/TablePage.js +0 -71
- package/lib/mu/pages/TablePageProps.d.ts +0 -7
- package/lib/mu/pages/TablePageProps.js +0 -1
- package/lib/mu/pages/ViewPage.d.ts +0 -66
- package/lib/mu/pages/ViewPage.js +0 -105
- package/lib/mu/texts/DateText.d.ts +0 -34
- package/lib/mu/texts/DateText.js +0 -25
- package/lib/mu/texts/MoneyText.d.ts +0 -21
- package/lib/mu/texts/MoneyText.js +0 -14
- package/lib/mu/texts/NumberText.d.ts +0 -25
- package/lib/mu/texts/NumberText.js +0 -14
- package/src/app/CommonApp.ts +0 -225
- package/src/app/IServiceAppSettings.ts +0 -13
- package/src/app/IServicePage.ts +0 -6
- package/src/app/IServiceUser.ts +0 -17
- package/src/app/ISmartERPUser.ts +0 -16
- package/src/app/Labels.ts +0 -77
- package/src/app/ReactApp.ts +0 -500
- package/src/app/ServiceApp.ts +0 -353
- package/src/components/ShowDataComparison.tsx +0 -108
- package/src/mu/AuditDisplay.tsx +0 -117
- package/src/mu/AutocompleteExtendedProps.ts +0 -83
- package/src/mu/BackButton.tsx +0 -55
- package/src/mu/BridgeCloseButton.tsx +0 -69
- package/src/mu/ButtonLink.tsx +0 -32
- package/src/mu/ComboBox.tsx +0 -251
- package/src/mu/CountdownButton.tsx +0 -119
- package/src/mu/CustomFabProps.ts +0 -32
- package/src/mu/DataGridEx.tsx +0 -712
- package/src/mu/DataGridRenderers.tsx +0 -140
- package/src/mu/DialogButton.tsx +0 -163
- package/src/mu/DraggablePaperComponent.tsx +0 -19
- package/src/mu/EmailInput.tsx +0 -24
- package/src/mu/FabBox.tsx +0 -51
- package/src/mu/FlexBox.tsx +0 -20
- package/src/mu/GridDataFormat.tsx +0 -77
- package/src/mu/GridMethodRef.ts +0 -12
- package/src/mu/IconButtonLink.tsx +0 -29
- package/src/mu/InputField.tsx +0 -82
- package/src/mu/ItemList.tsx +0 -204
- package/src/mu/ListItemRightIcon.tsx +0 -9
- package/src/mu/ListMoreDisplay.tsx +0 -205
- package/src/mu/LoadingButton.tsx +0 -75
- package/src/mu/MUGlobal.ts +0 -220
- package/src/mu/MaskInput.tsx +0 -107
- package/src/mu/MobileListItemRenderer.tsx +0 -79
- package/src/mu/MoreFab.tsx +0 -211
- package/src/mu/NotifierMU.tsx +0 -654
- package/src/mu/NotifierPromptProps.ts +0 -26
- package/src/mu/OptionGroup.tsx +0 -223
- package/src/mu/PList.tsx +0 -27
- package/src/mu/ProgressCount.tsx +0 -166
- package/src/mu/PullToRefreshUI.tsx +0 -21
- package/src/mu/RLink.tsx +0 -64
- package/src/mu/ResponsibleContainer.tsx +0 -394
- package/src/mu/ScrollTopFab.tsx +0 -34
- package/src/mu/ScrollerListEx.tsx +0 -387
- package/src/mu/SearchBar.tsx +0 -398
- package/src/mu/SearchField.tsx +0 -82
- package/src/mu/SearchOptionGroup.tsx +0 -31
- package/src/mu/SelectBool.tsx +0 -33
- package/src/mu/SelectEx.tsx +0 -290
- package/src/mu/Switch.tsx +0 -94
- package/src/mu/SwitchAnt.tsx +0 -95
- package/src/mu/TabBox.tsx +0 -118
- package/src/mu/TableEx.tsx +0 -560
- package/src/mu/TextFieldEx.tsx +0 -250
- package/src/mu/Tiplist.tsx +0 -304
- package/src/mu/TooltipClick.tsx +0 -84
- package/src/mu/UserAvatar.tsx +0 -64
- package/src/mu/UserAvatarEditor.tsx +0 -287
- package/src/mu/pages/CommonPage.tsx +0 -128
- package/src/mu/pages/CommonPageProps.ts +0 -71
- package/src/mu/pages/DataGridPage.tsx +0 -137
- package/src/mu/pages/DataGridPageProps.ts +0 -24
- package/src/mu/pages/EditPage.tsx +0 -114
- package/src/mu/pages/FixedListPage.tsx +0 -135
- package/src/mu/pages/ListPage.tsx +0 -87
- package/src/mu/pages/ListPageProps.ts +0 -12
- package/src/mu/pages/ResponsivePage.tsx +0 -68
- package/src/mu/pages/ResponsivePageProps.ts +0 -57
- package/src/mu/pages/SearchPageProps.ts +0 -39
- package/src/mu/pages/TablePage.tsx +0 -120
- package/src/mu/pages/TablePageProps.ts +0 -12
- package/src/mu/pages/ViewPage.tsx +0 -285
- package/src/mu/texts/DateText.tsx +0 -74
- package/src/mu/texts/MoneyText.tsx +0 -49
- package/src/mu/texts/NumberText.tsx +0 -40
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# AppReact
|
|
2
|
-
**TypeScript
|
|
2
|
+
**TypeScript ReactJs UI Independent Framework**
|
|
3
3
|
|
|
4
4
|
## Installing
|
|
5
5
|
|
|
@@ -13,4 +13,9 @@ Using yarn:
|
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
$ yarn add @etsoo/react
|
|
16
|
-
```
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## UI Implmentation
|
|
19
|
+
|
|
20
|
+
- @etsoo/materialui, targeting administration applications
|
|
21
|
+
- @etsoo/bootstrap, targeting websites
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { UniqueIdentifier } from '@dnd-kit/core';
|
|
2
2
|
import { DataTypes } from '@etsoo/shared';
|
|
3
|
-
import { Theme } from '@mui/material';
|
|
4
3
|
import React, { CSSProperties } from 'react';
|
|
5
|
-
/**
|
|
6
|
-
* DnD item default style
|
|
7
|
-
* @param index Item index
|
|
8
|
-
* @param isDragging Is dragging
|
|
9
|
-
* @param theme Theme
|
|
10
|
-
* @returns Style
|
|
11
|
-
*/
|
|
12
|
-
export declare const DnDItemStyle: (index: number, isDragging: boolean, theme: Theme) => {
|
|
13
|
-
padding: string;
|
|
14
|
-
zIndex: string | number;
|
|
15
|
-
background: string;
|
|
16
|
-
};
|
|
17
4
|
/**
|
|
18
5
|
* DnD list forward ref
|
|
19
6
|
*/
|
|
@@ -47,7 +34,7 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
47
34
|
/**
|
|
48
35
|
* Get list item style callback
|
|
49
36
|
*/
|
|
50
|
-
getItemStyle
|
|
37
|
+
getItemStyle: (index: number, isDragging: boolean) => CSSProperties;
|
|
51
38
|
/**
|
|
52
39
|
* Item renderer
|
|
53
40
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DndContext } from '@dnd-kit/core';
|
|
2
2
|
import { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
3
3
|
import { CSS } from '@dnd-kit/utilities';
|
|
4
|
-
import { useTheme } from '@mui/material';
|
|
5
4
|
import React from 'react';
|
|
6
5
|
function SortableItem(props) {
|
|
7
6
|
// Destruct
|
|
@@ -24,22 +23,6 @@ function SortableItem(props) {
|
|
|
24
23
|
};
|
|
25
24
|
return itemRenderer(nodeRef, actionNodeRef);
|
|
26
25
|
}
|
|
27
|
-
/**
|
|
28
|
-
* DnD item default style
|
|
29
|
-
* @param index Item index
|
|
30
|
-
* @param isDragging Is dragging
|
|
31
|
-
* @param theme Theme
|
|
32
|
-
* @returns Style
|
|
33
|
-
*/
|
|
34
|
-
export const DnDItemStyle = (index, isDragging, theme) => ({
|
|
35
|
-
padding: theme.spacing(1),
|
|
36
|
-
zIndex: isDragging ? 1 : 'auto',
|
|
37
|
-
background: isDragging
|
|
38
|
-
? theme.palette.primary.light
|
|
39
|
-
: index % 2 === 0
|
|
40
|
-
? theme.palette.grey[100]
|
|
41
|
-
: theme.palette.grey[50]
|
|
42
|
-
});
|
|
43
26
|
/**
|
|
44
27
|
* DnD (Drag and Drop) sortable list
|
|
45
28
|
* @param props Props
|
|
@@ -47,13 +30,7 @@ export const DnDItemStyle = (index, isDragging, theme) => ({
|
|
|
47
30
|
*/
|
|
48
31
|
export function DnDList(props) {
|
|
49
32
|
// Destruct
|
|
50
|
-
const { keyField, itemRenderer, labelField, mRef, onChange, onDragEnd } = props;
|
|
51
|
-
let getItemStyle = props.getItemStyle;
|
|
52
|
-
if (getItemStyle == null) {
|
|
53
|
-
// Theme
|
|
54
|
-
const theme = useTheme();
|
|
55
|
-
getItemStyle = (index, isDragging) => DnDItemStyle(index, isDragging, theme);
|
|
56
|
-
}
|
|
33
|
+
const { getItemStyle, keyField, itemRenderer, labelField, mRef, onChange, onDragEnd } = props;
|
|
57
34
|
// States
|
|
58
35
|
const [items, setItems] = React.useState([]);
|
|
59
36
|
const [activeId, setActiveId] = React.useState();
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Align, GridChildComponentProps, VariableSizeGridProps } from 'react-window';
|
|
4
|
-
import { GridMethodRef } from '../mu/GridMethodRef';
|
|
5
4
|
import { GridLoader, GridLoaderStates } from './GridLoader';
|
|
5
|
+
import { GridMethodRef } from './GridMethodRef';
|
|
6
6
|
export declare type ScrollerGridItemRendererProps<T> = Omit<GridChildComponentProps<T>, 'data'> & {
|
|
7
7
|
/**
|
|
8
8
|
* Selected items
|
|
@@ -41,7 +41,7 @@ export declare type ScrollerGridProps<T extends object, D extends DataTypes.Keys
|
|
|
41
41
|
/**
|
|
42
42
|
* Methods
|
|
43
43
|
*/
|
|
44
|
-
mRef?: React.Ref<ScrollerGridForwardRef
|
|
44
|
+
mRef?: React.Ref<ScrollerGridForwardRef<T>>;
|
|
45
45
|
/**
|
|
46
46
|
* On items select change
|
|
47
47
|
*/
|
|
@@ -54,7 +54,7 @@ export declare type ScrollerGridProps<T extends object, D extends DataTypes.Keys
|
|
|
54
54
|
/**
|
|
55
55
|
* Scroller grid forward ref
|
|
56
56
|
*/
|
|
57
|
-
export interface ScrollerGridForwardRef extends GridMethodRef {
|
|
57
|
+
export interface ScrollerGridForwardRef<T> extends GridMethodRef<T> {
|
|
58
58
|
/**
|
|
59
59
|
* Scroll to the specified offsets
|
|
60
60
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Align, ListChildComponentProps, ListProps } from 'react-window';
|
|
3
|
-
import { GridMethodRef } from '../mu/GridMethodRef';
|
|
4
3
|
import { GridLoader } from './GridLoader';
|
|
4
|
+
import { GridMethodRef } from './GridMethodRef';
|
|
5
5
|
/**
|
|
6
6
|
* Scroller vertical list props
|
|
7
7
|
*/
|
|
@@ -13,7 +13,7 @@ export interface ScrollerListProps<T extends object> extends GridLoader<T>, Omit
|
|
|
13
13
|
/**
|
|
14
14
|
* Methods ref
|
|
15
15
|
*/
|
|
16
|
-
mRef?: React.Ref<ScrollerListForwardRef
|
|
16
|
+
mRef?: React.Ref<ScrollerListForwardRef<T>>;
|
|
17
17
|
/**
|
|
18
18
|
* Outer div ref
|
|
19
19
|
*/
|
|
@@ -48,7 +48,7 @@ interface ScrollerListRef {
|
|
|
48
48
|
/**
|
|
49
49
|
* Scroller list forward ref
|
|
50
50
|
*/
|
|
51
|
-
export interface ScrollerListForwardRef extends GridMethodRef
|
|
51
|
+
export interface ScrollerListForwardRef<T> extends GridMethodRef<T>, ScrollerListRef {
|
|
52
52
|
/**
|
|
53
53
|
* Refresh latest page data
|
|
54
54
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -1,87 +1,14 @@
|
|
|
1
|
-
export * from './app/CommonApp';
|
|
2
1
|
export * from './app/CoreConstants';
|
|
3
2
|
export * from './app/InputDialogProps';
|
|
4
|
-
export * from './app/IServiceAppSettings';
|
|
5
|
-
export * from './app/IServicePage';
|
|
6
|
-
export * from './app/IServiceUser';
|
|
7
|
-
export * from './app/ISmartERPUser';
|
|
8
|
-
export * from './app/Labels';
|
|
9
|
-
export * from './app/ReactApp';
|
|
10
3
|
export * from './app/ReactUtils';
|
|
11
4
|
export * from './app/RefreshTokenRQ';
|
|
12
|
-
export * from './
|
|
5
|
+
export * from './components/DnDList';
|
|
13
6
|
export * from './components/GridColumn';
|
|
14
7
|
export * from './components/GridLoader';
|
|
15
8
|
export * from './components/HRouter';
|
|
16
9
|
export * from './components/ListItemReact';
|
|
17
10
|
export * from './components/ScrollerGrid';
|
|
18
11
|
export * from './components/ScrollerList';
|
|
19
|
-
export * from './components/ShowDataComparison';
|
|
20
|
-
export * from './mu/pages/CommonPage';
|
|
21
|
-
export * from './mu/pages/CommonPageProps';
|
|
22
|
-
export * from './mu/pages/DataGridPage';
|
|
23
|
-
export * from './mu/pages/DataGridPageProps';
|
|
24
|
-
export * from './mu/pages/EditPage';
|
|
25
|
-
export * from './mu/pages/FixedListPage';
|
|
26
|
-
export * from './mu/pages/ListPage';
|
|
27
|
-
export * from './mu/pages/ListPageProps';
|
|
28
|
-
export * from './mu/pages/ResponsivePage';
|
|
29
|
-
export * from './mu/pages/ResponsivePageProps';
|
|
30
|
-
export * from './mu/pages/SearchPageProps';
|
|
31
|
-
export * from './mu/pages/TablePage';
|
|
32
|
-
export * from './mu/pages/ViewPage';
|
|
33
|
-
export * from './mu/texts/DateText';
|
|
34
|
-
export * from './mu/texts/MoneyText';
|
|
35
|
-
export * from './mu/texts/NumberText';
|
|
36
|
-
export * from './mu/AuditDisplay';
|
|
37
|
-
export * from './mu/BackButton';
|
|
38
|
-
export * from './mu/BridgeCloseButton';
|
|
39
|
-
export * from './mu/ButtonLink';
|
|
40
|
-
export * from './mu/ComboBox';
|
|
41
|
-
export * from './mu/CountdownButton';
|
|
42
|
-
export * from './mu/CustomFabProps';
|
|
43
|
-
export * from './mu/DataGridEx';
|
|
44
|
-
export * from './mu/DataGridRenderers';
|
|
45
|
-
export * from './mu/DialogButton';
|
|
46
|
-
export * from './mu/DnDList';
|
|
47
|
-
export * from './mu/DraggablePaperComponent';
|
|
48
|
-
export * from './mu/EmailInput';
|
|
49
|
-
export * from './mu/FabBox';
|
|
50
|
-
export * from './mu/FlexBox';
|
|
51
|
-
export * from './mu/GridDataFormat';
|
|
52
|
-
export * from './mu/IconButtonLink';
|
|
53
|
-
export * from './mu/InputField';
|
|
54
|
-
export * from './mu/ItemList';
|
|
55
|
-
export * from './mu/ListItemRightIcon';
|
|
56
|
-
export * from './mu/ListMoreDisplay';
|
|
57
|
-
export * from './mu/LoadingButton';
|
|
58
|
-
export * from './mu/MaskInput';
|
|
59
|
-
export * from './mu/MobileListItemRenderer';
|
|
60
|
-
export * from './mu/MoreFab';
|
|
61
|
-
export * from './mu/MUGlobal';
|
|
62
|
-
export * from './mu/NotifierMU';
|
|
63
|
-
export * from './mu/OptionGroup';
|
|
64
|
-
export * from './mu/PList';
|
|
65
|
-
export * from './mu/ProgressCount';
|
|
66
|
-
export * from './mu/PullToRefreshUI';
|
|
67
|
-
export * from './mu/ResponsibleContainer';
|
|
68
|
-
export * from './mu/RLink';
|
|
69
|
-
export * from './mu/ScrollerListEx';
|
|
70
|
-
export * from './mu/ScrollTopFab';
|
|
71
|
-
export * from './mu/SearchBar';
|
|
72
|
-
export * from './mu/SearchField';
|
|
73
|
-
export * from './mu/SearchOptionGroup';
|
|
74
|
-
export * from './mu/SelectBool';
|
|
75
|
-
export * from './mu/SelectEx';
|
|
76
|
-
export * from './mu/Switch';
|
|
77
|
-
export * from './mu/SwitchAnt';
|
|
78
|
-
export * from './mu/TabBox';
|
|
79
|
-
export * from './mu/TableEx';
|
|
80
|
-
export * from './mu/TextFieldEx';
|
|
81
|
-
export * from './mu/Tiplist';
|
|
82
|
-
export * from './mu/TooltipClick';
|
|
83
|
-
export * from './mu/UserAvatar';
|
|
84
|
-
export * from './mu/UserAvatarEditor';
|
|
85
12
|
export * from './notifier/Notifier';
|
|
86
13
|
export * from '@etsoo/notificationbase';
|
|
87
14
|
export * from './states/CultureState';
|
|
@@ -94,4 +21,5 @@ export * from './uses/useDelayedExecutor';
|
|
|
94
21
|
export * from './uses/useDimensions';
|
|
95
22
|
export * from './uses/useParamsEx';
|
|
96
23
|
export * from './uses/useTimeout';
|
|
24
|
+
export * from './uses/useWindowScroll';
|
|
97
25
|
export * from './uses/useWindowSize';
|
package/lib/index.js
CHANGED
|
@@ -1,90 +1,16 @@
|
|
|
1
1
|
// app
|
|
2
|
-
export * from './app/CommonApp';
|
|
3
2
|
export * from './app/CoreConstants';
|
|
4
3
|
export * from './app/InputDialogProps';
|
|
5
|
-
export * from './app/IServiceAppSettings';
|
|
6
|
-
export * from './app/IServicePage';
|
|
7
|
-
export * from './app/IServiceUser';
|
|
8
|
-
export * from './app/ISmartERPUser';
|
|
9
|
-
export * from './app/Labels';
|
|
10
|
-
export * from './app/ReactApp';
|
|
11
4
|
export * from './app/ReactUtils';
|
|
12
5
|
export * from './app/RefreshTokenRQ';
|
|
13
|
-
export * from './app/ServiceApp';
|
|
14
6
|
// components
|
|
7
|
+
export * from './components/DnDList';
|
|
15
8
|
export * from './components/GridColumn';
|
|
16
9
|
export * from './components/GridLoader';
|
|
17
10
|
export * from './components/HRouter';
|
|
18
11
|
export * from './components/ListItemReact';
|
|
19
12
|
export * from './components/ScrollerGrid';
|
|
20
13
|
export * from './components/ScrollerList';
|
|
21
|
-
export * from './components/ShowDataComparison';
|
|
22
|
-
// mu
|
|
23
|
-
export * from './mu/pages/CommonPage';
|
|
24
|
-
export * from './mu/pages/CommonPageProps';
|
|
25
|
-
export * from './mu/pages/DataGridPage';
|
|
26
|
-
export * from './mu/pages/DataGridPageProps';
|
|
27
|
-
export * from './mu/pages/EditPage';
|
|
28
|
-
export * from './mu/pages/FixedListPage';
|
|
29
|
-
export * from './mu/pages/ListPage';
|
|
30
|
-
export * from './mu/pages/ListPageProps';
|
|
31
|
-
export * from './mu/pages/ResponsivePage';
|
|
32
|
-
export * from './mu/pages/ResponsivePageProps';
|
|
33
|
-
export * from './mu/pages/SearchPageProps';
|
|
34
|
-
export * from './mu/pages/TablePage';
|
|
35
|
-
export * from './mu/pages/ViewPage';
|
|
36
|
-
export * from './mu/texts/DateText';
|
|
37
|
-
export * from './mu/texts/MoneyText';
|
|
38
|
-
export * from './mu/texts/NumberText';
|
|
39
|
-
export * from './mu/AuditDisplay';
|
|
40
|
-
export * from './mu/BackButton';
|
|
41
|
-
export * from './mu/BridgeCloseButton';
|
|
42
|
-
export * from './mu/ButtonLink';
|
|
43
|
-
export * from './mu/ComboBox';
|
|
44
|
-
export * from './mu/CountdownButton';
|
|
45
|
-
export * from './mu/CustomFabProps';
|
|
46
|
-
export * from './mu/DataGridEx';
|
|
47
|
-
export * from './mu/DataGridRenderers';
|
|
48
|
-
export * from './mu/DialogButton';
|
|
49
|
-
export * from './mu/DnDList';
|
|
50
|
-
export * from './mu/DraggablePaperComponent';
|
|
51
|
-
export * from './mu/EmailInput';
|
|
52
|
-
export * from './mu/FabBox';
|
|
53
|
-
export * from './mu/FlexBox';
|
|
54
|
-
export * from './mu/GridDataFormat';
|
|
55
|
-
export * from './mu/IconButtonLink';
|
|
56
|
-
export * from './mu/InputField';
|
|
57
|
-
export * from './mu/ItemList';
|
|
58
|
-
export * from './mu/ListItemRightIcon';
|
|
59
|
-
export * from './mu/ListMoreDisplay';
|
|
60
|
-
export * from './mu/LoadingButton';
|
|
61
|
-
export * from './mu/MaskInput';
|
|
62
|
-
export * from './mu/MobileListItemRenderer';
|
|
63
|
-
export * from './mu/MoreFab';
|
|
64
|
-
export * from './mu/MUGlobal';
|
|
65
|
-
export * from './mu/NotifierMU';
|
|
66
|
-
export * from './mu/OptionGroup';
|
|
67
|
-
export * from './mu/PList';
|
|
68
|
-
export * from './mu/ProgressCount';
|
|
69
|
-
export * from './mu/PullToRefreshUI';
|
|
70
|
-
export * from './mu/ResponsibleContainer';
|
|
71
|
-
export * from './mu/RLink';
|
|
72
|
-
export * from './mu/ScrollerListEx';
|
|
73
|
-
export * from './mu/ScrollTopFab';
|
|
74
|
-
export * from './mu/SearchBar';
|
|
75
|
-
export * from './mu/SearchField';
|
|
76
|
-
export * from './mu/SearchOptionGroup';
|
|
77
|
-
export * from './mu/SelectBool';
|
|
78
|
-
export * from './mu/SelectEx';
|
|
79
|
-
export * from './mu/Switch';
|
|
80
|
-
export * from './mu/SwitchAnt';
|
|
81
|
-
export * from './mu/TabBox';
|
|
82
|
-
export * from './mu/TableEx';
|
|
83
|
-
export * from './mu/TextFieldEx';
|
|
84
|
-
export * from './mu/Tiplist';
|
|
85
|
-
export * from './mu/TooltipClick';
|
|
86
|
-
export * from './mu/UserAvatar';
|
|
87
|
-
export * from './mu/UserAvatarEditor';
|
|
88
14
|
// notifier
|
|
89
15
|
export * from './notifier/Notifier';
|
|
90
16
|
export * from '@etsoo/notificationbase';
|
|
@@ -100,4 +26,5 @@ export * from './uses/useDelayedExecutor';
|
|
|
100
26
|
export * from './uses/useDimensions';
|
|
101
27
|
export * from './uses/useParamsEx';
|
|
102
28
|
export * from './uses/useTimeout';
|
|
29
|
+
export * from './uses/useWindowScroll';
|
|
103
30
|
export * from './uses/useWindowSize';
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { INotificaseBase, INotification, INotifier, Notification, NotificationAlign, NotificationCallProps, NotificationContainer, NotificationRenderProps } from '@etsoo/notificationbase';
|
|
3
3
|
import { IAction } from '@etsoo/appscript';
|
|
4
4
|
import { IProviderProps } from '../states/IState';
|
|
5
|
-
import { Breakpoint, ButtonProps } from '@mui/material';
|
|
6
5
|
/**
|
|
7
6
|
* React notification call props
|
|
8
7
|
*/
|
|
@@ -22,7 +21,7 @@ export interface NotificationReactCallProps extends NotificationCallProps {
|
|
|
22
21
|
/**
|
|
23
22
|
* Max width
|
|
24
23
|
*/
|
|
25
|
-
maxWidth?:
|
|
24
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
26
25
|
/**
|
|
27
26
|
* OK label
|
|
28
27
|
*/
|
|
@@ -42,7 +41,7 @@ export interface NotificationReactCallProps extends NotificationCallProps {
|
|
|
42
41
|
/**
|
|
43
42
|
* Primary button props
|
|
44
43
|
*/
|
|
45
|
-
primaryButton?:
|
|
44
|
+
primaryButton?: {};
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
47
|
* React notification interface
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Detect window scroll
|
|
4
|
+
* @returns Scroll location
|
|
5
|
+
*/
|
|
6
|
+
export const useWindowScroll = () => {
|
|
7
|
+
// State
|
|
8
|
+
const [pos, setPos] = React.useState({
|
|
9
|
+
x: window.pageXOffset,
|
|
10
|
+
y: window.pageYOffset
|
|
11
|
+
});
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
let ticking = false;
|
|
14
|
+
let lastPos;
|
|
15
|
+
let requestAnimationFrameSeed = 0;
|
|
16
|
+
const scrollHandler = () => {
|
|
17
|
+
lastPos = {
|
|
18
|
+
x: window.pageXOffset,
|
|
19
|
+
y: window.pageYOffset
|
|
20
|
+
};
|
|
21
|
+
if (!ticking) {
|
|
22
|
+
requestAnimationFrameSeed = window.requestAnimationFrame(() => {
|
|
23
|
+
ticking = false;
|
|
24
|
+
requestAnimationFrameSeed = 0;
|
|
25
|
+
if (lastPos.x != lastPos.x || lastPos.y != lastPos.y) {
|
|
26
|
+
setPos(lastPos);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
ticking = true;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
window.addEventListener('scroll', scrollHandler, {
|
|
33
|
+
passive: true,
|
|
34
|
+
capture: false
|
|
35
|
+
});
|
|
36
|
+
return () => {
|
|
37
|
+
// Cancel animation frame
|
|
38
|
+
if (requestAnimationFrameSeed > 0)
|
|
39
|
+
window.cancelAnimationFrame(requestAnimationFrameSeed);
|
|
40
|
+
// Remove scroll event
|
|
41
|
+
window.removeEventListener('scroll', scrollHandler);
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
// Return
|
|
45
|
+
return pos;
|
|
46
|
+
};
|
|
@@ -11,28 +11,34 @@ export const useWindowSize = () => {
|
|
|
11
11
|
});
|
|
12
12
|
React.useEffect(() => {
|
|
13
13
|
let ticking = false;
|
|
14
|
-
let
|
|
14
|
+
let lastSize;
|
|
15
15
|
let requestAnimationFrameSeed = 0;
|
|
16
16
|
const resizeHandler = () => {
|
|
17
|
-
|
|
17
|
+
lastSize = {
|
|
18
18
|
width: document.documentElement.clientWidth,
|
|
19
19
|
height: document.documentElement.clientHeight
|
|
20
20
|
};
|
|
21
21
|
if (!ticking) {
|
|
22
22
|
requestAnimationFrameSeed = window.requestAnimationFrame(() => {
|
|
23
|
-
setSize(lastKnownSize);
|
|
24
23
|
ticking = false;
|
|
25
24
|
requestAnimationFrameSeed = 0;
|
|
25
|
+
if (lastSize.width != size.width ||
|
|
26
|
+
lastSize.height != size.height) {
|
|
27
|
+
setSize(lastSize);
|
|
28
|
+
}
|
|
26
29
|
});
|
|
27
30
|
ticking = true;
|
|
28
31
|
}
|
|
29
32
|
};
|
|
30
|
-
window.addEventListener('resize', resizeHandler
|
|
33
|
+
window.addEventListener('resize', resizeHandler, {
|
|
34
|
+
passive: true,
|
|
35
|
+
capture: false
|
|
36
|
+
});
|
|
31
37
|
return () => {
|
|
32
38
|
// Cancel animation frame
|
|
33
39
|
if (requestAnimationFrameSeed > 0)
|
|
34
40
|
window.cancelAnimationFrame(requestAnimationFrameSeed);
|
|
35
|
-
// Remove
|
|
41
|
+
// Remove resize event
|
|
36
42
|
window.removeEventListener('resize', resizeHandler);
|
|
37
43
|
};
|
|
38
44
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "TypeScript ReactJs
|
|
3
|
+
"version": "1.5.81",
|
|
4
|
+
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"React",
|
|
34
|
-
"MaterialUI",
|
|
35
34
|
"TypeScript",
|
|
36
35
|
"ETSOO",
|
|
37
36
|
"SmartERP",
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"青岛亿速思维",
|
|
40
39
|
"上海亿商"
|
|
41
40
|
],
|
|
42
|
-
"author": "
|
|
41
|
+
"author": "Etsoo",
|
|
43
42
|
"license": "MIT",
|
|
44
43
|
"bugs": {
|
|
45
44
|
"url": "https://github.com/ETSOO/AppReact/issues"
|
|
@@ -54,22 +53,11 @@
|
|
|
54
53
|
"@etsoo/appscript": "^1.2.85",
|
|
55
54
|
"@etsoo/notificationbase": "^1.1.7",
|
|
56
55
|
"@etsoo/shared": "^1.1.51",
|
|
57
|
-
"@mui/icons-material": "^5.10.2",
|
|
58
|
-
"@mui/material": "^5.10.2",
|
|
59
|
-
"@types/pica": "^9.0.1",
|
|
60
|
-
"@types/pulltorefreshjs": "^0.1.5",
|
|
61
56
|
"@types/react": "^18.0.17",
|
|
62
|
-
"@types/react-avatar-editor": "^13.0.0",
|
|
63
57
|
"@types/react-dom": "^18.0.6",
|
|
64
|
-
"@types/react-input-mask": "^3.0.1",
|
|
65
58
|
"@types/react-window": "^1.8.5",
|
|
66
|
-
"pica": "^9.0.1",
|
|
67
|
-
"pulltorefreshjs": "^0.1.22",
|
|
68
59
|
"react": "^18.2.0",
|
|
69
|
-
"react-avatar-editor": "^13.0.0",
|
|
70
60
|
"react-dom": "^18.2.0",
|
|
71
|
-
"react-draggable": "^4.4.5",
|
|
72
|
-
"react-imask": "^6.4.2",
|
|
73
61
|
"react-router-dom": "^6.3.0",
|
|
74
62
|
"react-window": "^1.8.7"
|
|
75
63
|
},
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
} from '@dnd-kit/sortable';
|
|
12
12
|
import { CSS } from '@dnd-kit/utilities';
|
|
13
13
|
import { DataTypes } from '@etsoo/shared';
|
|
14
|
-
import { Theme, useTheme } from '@mui/material';
|
|
15
14
|
import React, { CSSProperties } from 'react';
|
|
16
15
|
|
|
17
16
|
function SortableItem(props: {
|
|
@@ -55,27 +54,6 @@ function SortableItem(props: {
|
|
|
55
54
|
return itemRenderer(nodeRef, actionNodeRef);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
/**
|
|
59
|
-
* DnD item default style
|
|
60
|
-
* @param index Item index
|
|
61
|
-
* @param isDragging Is dragging
|
|
62
|
-
* @param theme Theme
|
|
63
|
-
* @returns Style
|
|
64
|
-
*/
|
|
65
|
-
export const DnDItemStyle = (
|
|
66
|
-
index: number,
|
|
67
|
-
isDragging: boolean,
|
|
68
|
-
theme: Theme
|
|
69
|
-
) => ({
|
|
70
|
-
padding: theme.spacing(1),
|
|
71
|
-
zIndex: isDragging ? 1 : 'auto',
|
|
72
|
-
background: isDragging
|
|
73
|
-
? theme.palette.primary.light
|
|
74
|
-
: index % 2 === 0
|
|
75
|
-
? theme.palette.grey[100]
|
|
76
|
-
: theme.palette.grey[50]
|
|
77
|
-
});
|
|
78
|
-
|
|
79
57
|
/**
|
|
80
58
|
* DnD list forward ref
|
|
81
59
|
*/
|
|
@@ -113,7 +91,7 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
113
91
|
/**
|
|
114
92
|
* Get list item style callback
|
|
115
93
|
*/
|
|
116
|
-
getItemStyle
|
|
94
|
+
getItemStyle: (index: number, isDragging: boolean) => CSSProperties;
|
|
117
95
|
|
|
118
96
|
/**
|
|
119
97
|
* Item renderer
|
|
@@ -169,16 +147,15 @@ export function DnDList<
|
|
|
169
147
|
>
|
|
170
148
|
>(props: DnDListPros<D, K>) {
|
|
171
149
|
// Destruct
|
|
172
|
-
const {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
150
|
+
const {
|
|
151
|
+
getItemStyle,
|
|
152
|
+
keyField,
|
|
153
|
+
itemRenderer,
|
|
154
|
+
labelField,
|
|
155
|
+
mRef,
|
|
156
|
+
onChange,
|
|
157
|
+
onDragEnd
|
|
158
|
+
} = props;
|
|
182
159
|
|
|
183
160
|
// States
|
|
184
161
|
const [items, setItems] = React.useState<D[]>([]);
|
|
@@ -326,7 +303,7 @@ export function DnDList<
|
|
|
326
303
|
<SortableItem
|
|
327
304
|
id={id}
|
|
328
305
|
key={id}
|
|
329
|
-
style={getItemStyle
|
|
306
|
+
style={getItemStyle(index, id === activeId)}
|
|
330
307
|
itemRenderer={(nodeRef, actionNodeRef) =>
|
|
331
308
|
itemRenderer(
|
|
332
309
|
item,
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
VariableSizeGrid,
|
|
8
8
|
VariableSizeGridProps
|
|
9
9
|
} from 'react-window';
|
|
10
|
-
import { GridMethodRef } from '../mu/GridMethodRef';
|
|
11
10
|
import { GridLoadDataProps, GridLoader, GridLoaderStates } from './GridLoader';
|
|
11
|
+
import { GridMethodRef } from './GridMethodRef';
|
|
12
12
|
|
|
13
13
|
export type ScrollerGridItemRendererProps<T> = Omit<
|
|
14
14
|
GridChildComponentProps<T>,
|
|
@@ -70,7 +70,7 @@ export type ScrollerGridProps<
|
|
|
70
70
|
/**
|
|
71
71
|
* Methods
|
|
72
72
|
*/
|
|
73
|
-
mRef?: React.Ref<ScrollerGridForwardRef
|
|
73
|
+
mRef?: React.Ref<ScrollerGridForwardRef<T>>;
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* On items select change
|
|
@@ -86,7 +86,7 @@ export type ScrollerGridProps<
|
|
|
86
86
|
/**
|
|
87
87
|
* Scroller grid forward ref
|
|
88
88
|
*/
|
|
89
|
-
export interface ScrollerGridForwardRef extends GridMethodRef {
|
|
89
|
+
export interface ScrollerGridForwardRef<T> extends GridMethodRef<T> {
|
|
90
90
|
/**
|
|
91
91
|
* Scroll to the specified offsets
|
|
92
92
|
*/
|