@etsoo/react 1.5.79 → 1.5.82

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.
Files changed (255) hide show
  1. package/README.md +7 -2
  2. package/__tests__/ReactUtils.ts +6 -0
  3. package/lib/{mu → components}/DnDList.d.ts +1 -14
  4. package/lib/{mu → components}/DnDList.js +1 -24
  5. package/lib/components/GridMethodRef.d.ts +11 -0
  6. package/lib/{mu → components}/GridMethodRef.js +0 -0
  7. package/lib/components/ScrollerGrid.d.ts +3 -3
  8. package/lib/components/ScrollerList.d.ts +3 -3
  9. package/lib/index.d.ts +2 -74
  10. package/lib/index.js +2 -75
  11. package/lib/notifier/Notifier.d.ts +2 -3
  12. package/lib/uses/useWindowScroll.d.ts +10 -0
  13. package/lib/uses/useWindowScroll.js +46 -0
  14. package/lib/uses/useWindowSize.js +11 -5
  15. package/package.json +9 -21
  16. package/src/{mu → components}/DnDList.tsx +11 -34
  17. package/src/components/GridMethodRef.ts +12 -0
  18. package/src/components/ScrollerGrid.tsx +3 -3
  19. package/src/components/ScrollerList.tsx +5 -3
  20. package/src/index.ts +2 -78
  21. package/src/notifier/Notifier.ts +2 -3
  22. package/src/uses/useWindowScroll.ts +60 -0
  23. package/src/uses/useWindowSize.ts +14 -5
  24. package/__tests__/mu/MUGlobalTests.tsx +0 -58
  25. package/__tests__/mu/NotifierMUTests.tsx +0 -213
  26. package/lib/app/CommonApp.d.ts +0 -39
  27. package/lib/app/CommonApp.js +0 -149
  28. package/lib/app/IServiceAppSettings.d.ts +0 -11
  29. package/lib/app/IServiceAppSettings.js +0 -1
  30. package/lib/app/IServicePage.d.ts +0 -6
  31. package/lib/app/IServicePage.js +0 -1
  32. package/lib/app/IServiceUser.d.ts +0 -14
  33. package/lib/app/IServiceUser.js +0 -1
  34. package/lib/app/ISmartERPUser.d.ts +0 -14
  35. package/lib/app/ISmartERPUser.js +0 -1
  36. package/lib/app/Labels.d.ts +0 -65
  37. package/lib/app/Labels.js +0 -62
  38. package/lib/app/ReactApp.d.ts +0 -194
  39. package/lib/app/ReactApp.js +0 -298
  40. package/lib/app/ServiceApp.d.ts +0 -78
  41. package/lib/app/ServiceApp.js +0 -244
  42. package/lib/components/ShowDataComparison.d.ts +0 -20
  43. package/lib/components/ShowDataComparison.js +0 -60
  44. package/lib/mu/AuditDisplay.d.ts +0 -33
  45. package/lib/mu/AuditDisplay.js +0 -52
  46. package/lib/mu/AutocompleteExtendedProps.d.ts +0 -64
  47. package/lib/mu/AutocompleteExtendedProps.js +0 -1
  48. package/lib/mu/BackButton.d.ts +0 -13
  49. package/lib/mu/BackButton.js +0 -33
  50. package/lib/mu/BridgeCloseButton.d.ts +0 -23
  51. package/lib/mu/BridgeCloseButton.js +0 -32
  52. package/lib/mu/ButtonLink.d.ts +0 -17
  53. package/lib/mu/ButtonLink.js +0 -19
  54. package/lib/mu/ComboBox.d.ts +0 -38
  55. package/lib/mu/ComboBox.js +0 -108
  56. package/lib/mu/CountdownButton.d.ts +0 -23
  57. package/lib/mu/CountdownButton.js +0 -81
  58. package/lib/mu/CustomFabProps.d.ts +0 -27
  59. package/lib/mu/CustomFabProps.js +0 -1
  60. package/lib/mu/DataGridEx.d.ts +0 -96
  61. package/lib/mu/DataGridEx.js +0 -331
  62. package/lib/mu/DataGridRenderers.d.ts +0 -22
  63. package/lib/mu/DataGridRenderers.js +0 -99
  64. package/lib/mu/DialogButton.d.ts +0 -54
  65. package/lib/mu/DialogButton.js +0 -45
  66. package/lib/mu/DraggablePaperComponent.d.ts +0 -8
  67. package/lib/mu/DraggablePaperComponent.js +0 -12
  68. package/lib/mu/EmailInput.d.ts +0 -11
  69. package/lib/mu/EmailInput.js +0 -15
  70. package/lib/mu/FabBox.d.ts +0 -21
  71. package/lib/mu/FabBox.js +0 -31
  72. package/lib/mu/FlexBox.d.ts +0 -14
  73. package/lib/mu/FlexBox.js +0 -18
  74. package/lib/mu/GridDataFormat.d.ts +0 -10
  75. package/lib/mu/GridDataFormat.js +0 -43
  76. package/lib/mu/GridMethodRef.d.ts +0 -11
  77. package/lib/mu/IconButtonLink.d.ts +0 -17
  78. package/lib/mu/IconButtonLink.js +0 -16
  79. package/lib/mu/InputField.d.ts +0 -21
  80. package/lib/mu/InputField.js +0 -39
  81. package/lib/mu/ItemList.d.ts +0 -56
  82. package/lib/mu/ItemList.js +0 -69
  83. package/lib/mu/ListItemRightIcon.d.ts +0 -4
  84. package/lib/mu/ListItemRightIcon.js +0 -8
  85. package/lib/mu/ListMoreDisplay.d.ts +0 -35
  86. package/lib/mu/ListMoreDisplay.js +0 -99
  87. package/lib/mu/LoadingButton.d.ts +0 -16
  88. package/lib/mu/LoadingButton.js +0 -41
  89. package/lib/mu/MUGlobal.d.ts +0 -102
  90. package/lib/mu/MUGlobal.js +0 -184
  91. package/lib/mu/MaskInput.d.ts +0 -34
  92. package/lib/mu/MaskInput.js +0 -43
  93. package/lib/mu/MobileListItemRenderer.d.ts +0 -17
  94. package/lib/mu/MobileListItemRenderer.js +0 -35
  95. package/lib/mu/MoreFab.d.ts +0 -45
  96. package/lib/mu/MoreFab.js +0 -95
  97. package/lib/mu/NotifierMU.d.ts +0 -47
  98. package/lib/mu/NotifierMU.js +0 -387
  99. package/lib/mu/NotifierPromptProps.d.ts +0 -22
  100. package/lib/mu/NotifierPromptProps.js +0 -1
  101. package/lib/mu/OptionGroup.d.ts +0 -58
  102. package/lib/mu/OptionGroup.js +0 -81
  103. package/lib/mu/PList.d.ts +0 -15
  104. package/lib/mu/PList.js +0 -12
  105. package/lib/mu/ProgressCount.d.ts +0 -44
  106. package/lib/mu/ProgressCount.js +0 -79
  107. package/lib/mu/PullToRefreshUI.d.ts +0 -9
  108. package/lib/mu/PullToRefreshUI.js +0 -18
  109. package/lib/mu/RLink.d.ts +0 -14
  110. package/lib/mu/RLink.js +0 -37
  111. package/lib/mu/ResponsibleContainer.d.ts +0 -89
  112. package/lib/mu/ResponsibleContainer.js +0 -159
  113. package/lib/mu/ScrollTopFab.d.ts +0 -7
  114. package/lib/mu/ScrollTopFab.js +0 -25
  115. package/lib/mu/ScrollerListEx.d.ts +0 -81
  116. package/lib/mu/ScrollerListEx.js +0 -167
  117. package/lib/mu/SearchBar.d.ts +0 -29
  118. package/lib/mu/SearchBar.js +0 -262
  119. package/lib/mu/SearchField.d.ts +0 -21
  120. package/lib/mu/SearchField.js +0 -39
  121. package/lib/mu/SearchOptionGroup.d.ts +0 -9
  122. package/lib/mu/SearchOptionGroup.js +0 -14
  123. package/lib/mu/SelectBool.d.ts +0 -13
  124. package/lib/mu/SelectBool.js +0 -22
  125. package/lib/mu/SelectEx.d.ts +0 -50
  126. package/lib/mu/SelectEx.js +0 -156
  127. package/lib/mu/Switch.d.ts +0 -29
  128. package/lib/mu/Switch.js +0 -34
  129. package/lib/mu/SwitchAnt.d.ts +0 -25
  130. package/lib/mu/SwitchAnt.js +0 -40
  131. package/lib/mu/TabBox.d.ts +0 -54
  132. package/lib/mu/TabBox.js +0 -31
  133. package/lib/mu/TableEx.d.ts +0 -66
  134. package/lib/mu/TableEx.js +0 -271
  135. package/lib/mu/TextFieldEx.d.ts +0 -101
  136. package/lib/mu/TextFieldEx.js +0 -127
  137. package/lib/mu/Tiplist.d.ts +0 -18
  138. package/lib/mu/Tiplist.js +0 -158
  139. package/lib/mu/TooltipClick.d.ts +0 -15
  140. package/lib/mu/TooltipClick.js +0 -40
  141. package/lib/mu/UserAvatar.d.ts +0 -24
  142. package/lib/mu/UserAvatar.js +0 -25
  143. package/lib/mu/UserAvatarEditor.d.ts +0 -53
  144. package/lib/mu/UserAvatarEditor.js +0 -129
  145. package/lib/mu/pages/CommonPage.d.ts +0 -11
  146. package/lib/mu/pages/CommonPage.js +0 -60
  147. package/lib/mu/pages/CommonPageProps.d.ts +0 -60
  148. package/lib/mu/pages/CommonPageProps.js +0 -1
  149. package/lib/mu/pages/DataGridPage.d.ts +0 -9
  150. package/lib/mu/pages/DataGridPage.js +0 -81
  151. package/lib/mu/pages/DataGridPageProps.d.ts +0 -17
  152. package/lib/mu/pages/DataGridPageProps.js +0 -1
  153. package/lib/mu/pages/EditPage.d.ts +0 -33
  154. package/lib/mu/pages/EditPage.js +0 -29
  155. package/lib/mu/pages/FixedListPage.d.ts +0 -15
  156. package/lib/mu/pages/FixedListPage.js +0 -72
  157. package/lib/mu/pages/ListPage.d.ts +0 -9
  158. package/lib/mu/pages/ListPage.js +0 -51
  159. package/lib/mu/pages/ListPageProps.d.ts +0 -7
  160. package/lib/mu/pages/ListPageProps.js +0 -1
  161. package/lib/mu/pages/ResponsivePage.d.ts +0 -9
  162. package/lib/mu/pages/ResponsivePage.js +0 -45
  163. package/lib/mu/pages/ResponsivePageProps.d.ts +0 -39
  164. package/lib/mu/pages/ResponsivePageProps.js +0 -1
  165. package/lib/mu/pages/SearchPageProps.d.ts +0 -30
  166. package/lib/mu/pages/SearchPageProps.js +0 -1
  167. package/lib/mu/pages/TablePage.d.ts +0 -9
  168. package/lib/mu/pages/TablePage.js +0 -71
  169. package/lib/mu/pages/TablePageProps.d.ts +0 -7
  170. package/lib/mu/pages/TablePageProps.js +0 -1
  171. package/lib/mu/pages/ViewPage.d.ts +0 -66
  172. package/lib/mu/pages/ViewPage.js +0 -105
  173. package/lib/mu/texts/DateText.d.ts +0 -34
  174. package/lib/mu/texts/DateText.js +0 -25
  175. package/lib/mu/texts/MoneyText.d.ts +0 -21
  176. package/lib/mu/texts/MoneyText.js +0 -14
  177. package/lib/mu/texts/NumberText.d.ts +0 -25
  178. package/lib/mu/texts/NumberText.js +0 -14
  179. package/src/app/CommonApp.ts +0 -225
  180. package/src/app/IServiceAppSettings.ts +0 -13
  181. package/src/app/IServicePage.ts +0 -6
  182. package/src/app/IServiceUser.ts +0 -17
  183. package/src/app/ISmartERPUser.ts +0 -16
  184. package/src/app/Labels.ts +0 -77
  185. package/src/app/ReactApp.ts +0 -500
  186. package/src/app/ServiceApp.ts +0 -353
  187. package/src/components/ShowDataComparison.tsx +0 -108
  188. package/src/mu/AuditDisplay.tsx +0 -117
  189. package/src/mu/AutocompleteExtendedProps.ts +0 -83
  190. package/src/mu/BackButton.tsx +0 -55
  191. package/src/mu/BridgeCloseButton.tsx +0 -69
  192. package/src/mu/ButtonLink.tsx +0 -32
  193. package/src/mu/ComboBox.tsx +0 -251
  194. package/src/mu/CountdownButton.tsx +0 -119
  195. package/src/mu/CustomFabProps.ts +0 -32
  196. package/src/mu/DataGridEx.tsx +0 -712
  197. package/src/mu/DataGridRenderers.tsx +0 -140
  198. package/src/mu/DialogButton.tsx +0 -163
  199. package/src/mu/DraggablePaperComponent.tsx +0 -19
  200. package/src/mu/EmailInput.tsx +0 -24
  201. package/src/mu/FabBox.tsx +0 -51
  202. package/src/mu/FlexBox.tsx +0 -20
  203. package/src/mu/GridDataFormat.tsx +0 -77
  204. package/src/mu/GridMethodRef.ts +0 -12
  205. package/src/mu/IconButtonLink.tsx +0 -29
  206. package/src/mu/InputField.tsx +0 -82
  207. package/src/mu/ItemList.tsx +0 -204
  208. package/src/mu/ListItemRightIcon.tsx +0 -9
  209. package/src/mu/ListMoreDisplay.tsx +0 -205
  210. package/src/mu/LoadingButton.tsx +0 -75
  211. package/src/mu/MUGlobal.ts +0 -220
  212. package/src/mu/MaskInput.tsx +0 -107
  213. package/src/mu/MobileListItemRenderer.tsx +0 -79
  214. package/src/mu/MoreFab.tsx +0 -211
  215. package/src/mu/NotifierMU.tsx +0 -654
  216. package/src/mu/NotifierPromptProps.ts +0 -26
  217. package/src/mu/OptionGroup.tsx +0 -223
  218. package/src/mu/PList.tsx +0 -27
  219. package/src/mu/ProgressCount.tsx +0 -166
  220. package/src/mu/PullToRefreshUI.tsx +0 -21
  221. package/src/mu/RLink.tsx +0 -64
  222. package/src/mu/ResponsibleContainer.tsx +0 -394
  223. package/src/mu/ScrollTopFab.tsx +0 -34
  224. package/src/mu/ScrollerListEx.tsx +0 -387
  225. package/src/mu/SearchBar.tsx +0 -398
  226. package/src/mu/SearchField.tsx +0 -82
  227. package/src/mu/SearchOptionGroup.tsx +0 -31
  228. package/src/mu/SelectBool.tsx +0 -33
  229. package/src/mu/SelectEx.tsx +0 -290
  230. package/src/mu/Switch.tsx +0 -94
  231. package/src/mu/SwitchAnt.tsx +0 -95
  232. package/src/mu/TabBox.tsx +0 -118
  233. package/src/mu/TableEx.tsx +0 -560
  234. package/src/mu/TextFieldEx.tsx +0 -250
  235. package/src/mu/Tiplist.tsx +0 -304
  236. package/src/mu/TooltipClick.tsx +0 -84
  237. package/src/mu/UserAvatar.tsx +0 -64
  238. package/src/mu/UserAvatarEditor.tsx +0 -287
  239. package/src/mu/pages/CommonPage.tsx +0 -128
  240. package/src/mu/pages/CommonPageProps.ts +0 -71
  241. package/src/mu/pages/DataGridPage.tsx +0 -137
  242. package/src/mu/pages/DataGridPageProps.ts +0 -24
  243. package/src/mu/pages/EditPage.tsx +0 -114
  244. package/src/mu/pages/FixedListPage.tsx +0 -135
  245. package/src/mu/pages/ListPage.tsx +0 -87
  246. package/src/mu/pages/ListPageProps.ts +0 -12
  247. package/src/mu/pages/ResponsivePage.tsx +0 -68
  248. package/src/mu/pages/ResponsivePageProps.ts +0 -57
  249. package/src/mu/pages/SearchPageProps.ts +0 -39
  250. package/src/mu/pages/TablePage.tsx +0 -120
  251. package/src/mu/pages/TablePageProps.ts +0 -12
  252. package/src/mu/pages/ViewPage.tsx +0 -285
  253. package/src/mu/texts/DateText.tsx +0 -74
  254. package/src/mu/texts/MoneyText.tsx +0 -49
  255. package/src/mu/texts/NumberText.tsx +0 -40
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # AppReact
2
- **TypeScript React framework for SmartERP**
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
@@ -0,0 +1,6 @@
1
+ import { ReactUtils } from '../src/app/ReactUtils';
2
+
3
+ test('Tests for ReactUtils.formatInputValue', () => {
4
+ expect(ReactUtils.formatInputValue([1, 'a'])).toEqual([1, 'a']);
5
+ expect(ReactUtils.formatInputValue(true)).toEqual('true');
6
+ });
@@ -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?: (index: number, isDragging: boolean) => CSSProperties;
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();
@@ -0,0 +1,11 @@
1
+ import { GridLoaderStates } from './GridLoader';
2
+ /**
3
+ * Grid method ref
4
+ */
5
+ export interface GridMethodRef<T> {
6
+ /**
7
+ * Reset
8
+ * @param add Additional data
9
+ */
10
+ reset(add?: Partial<GridLoaderStates<T>>): void;
11
+ }
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, ScrollerListRef {
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 './app/ServiceApp';
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?: Breakpoint | false;
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?: ButtonProps;
44
+ primaryButton?: {};
46
45
  }
47
46
  /**
48
47
  * React notification interface
@@ -0,0 +1,10 @@
1
+ interface IScrollPos {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ /**
6
+ * Detect window scroll
7
+ * @returns Scroll location
8
+ */
9
+ export declare const useWindowScroll: () => IScrollPos;
10
+ export {};
@@ -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 lastKnownSize;
14
+ let lastSize;
15
15
  let requestAnimationFrameSeed = 0;
16
16
  const resizeHandler = () => {
17
- lastKnownSize = {
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 scroll event
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.79",
4
- "description": "TypeScript ReactJs framework",
3
+ "version": "1.5.82",
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": "Garry Xiao",
41
+ "author": "Etsoo",
43
42
  "license": "MIT",
44
43
  "bugs": {
45
44
  "url": "https://github.com/ETSOO/AppReact/issues"
@@ -51,25 +50,14 @@
51
50
  "@emotion/css": "^11.10.0",
52
51
  "@emotion/react": "^11.10.0",
53
52
  "@emotion/styled": "^11.10.0",
54
- "@etsoo/appscript": "^1.2.82",
53
+ "@etsoo/appscript": "^1.2.88",
55
54
  "@etsoo/notificationbase": "^1.1.7",
56
- "@etsoo/shared": "^1.1.48",
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",
55
+ "@etsoo/shared": "^1.1.51",
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
  },
@@ -79,17 +67,17 @@
79
67
  "@babel/plugin-transform-runtime": "^7.18.10",
80
68
  "@babel/preset-env": "^7.18.10",
81
69
  "@babel/runtime-corejs3": "^7.18.9",
70
+ "@testing-library/jest-dom": "^5.16.5",
71
+ "@testing-library/react": "^13.3.0",
82
72
  "@types/jest": "^28.1.8",
83
- "@types/react-test-renderer": "^18.0.0",
84
73
  "@typescript-eslint/eslint-plugin": "^5.35.1",
85
74
  "@typescript-eslint/parser": "^5.35.1",
86
- "eslint": "^8.22.0",
75
+ "eslint": "^8.23.0",
87
76
  "eslint-config-airbnb-base": "^15.0.0",
88
77
  "eslint-plugin-import": "^2.26.0",
89
- "eslint-plugin-react": "^7.31.0",
78
+ "eslint-plugin-react": "^7.31.1",
90
79
  "jest": "^28.1.3",
91
80
  "jest-environment-jsdom": "^28.1.3",
92
- "react-test-renderer": "^18.2.0",
93
81
  "ts-jest": "^28.0.8",
94
82
  "typescript": "^4.8.2"
95
83
  }
@@ -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?: (index: number, isDragging: boolean) => CSSProperties;
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 { keyField, itemRenderer, labelField, mRef, onChange, onDragEnd } =
173
- props;
174
-
175
- let getItemStyle = props.getItemStyle;
176
- if (getItemStyle == null) {
177
- // Theme
178
- const theme = useTheme();
179
- getItemStyle = (index, isDragging) =>
180
- DnDItemStyle(index, isDragging, theme);
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!(index, id === activeId)}
306
+ style={getItemStyle(index, id === activeId)}
330
307
  itemRenderer={(nodeRef, actionNodeRef) =>
331
308
  itemRenderer(
332
309
  item,
@@ -0,0 +1,12 @@
1
+ import { GridLoaderStates } from './GridLoader';
2
+
3
+ /**
4
+ * Grid method ref
5
+ */
6
+ export interface GridMethodRef<T> {
7
+ /**
8
+ * Reset
9
+ * @param add Additional data
10
+ */
11
+ reset(add?: Partial<GridLoaderStates<T>>): void;
12
+ }