@etsoo/react 1.5.78 → 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.
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 +6 -6
  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 +6 -6
  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 -66
  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 -40
  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 -55
  82. package/lib/mu/ItemList.js +0 -77
  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 -62
  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 -14
  124. package/lib/mu/SelectBool.js +0 -22
  125. package/lib/mu/SelectEx.d.ts +0 -54
  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 -68
  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 -84
  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 -244
  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 -201
  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 -218
  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 -25
  228. package/src/mu/SelectBool.tsx +0 -40
  229. package/src/mu/SelectEx.tsx +0 -285
  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 -561
  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 -134
  245. package/src/mu/pages/ListPage.tsx +0 -86
  246. package/src/mu/pages/ListPageProps.ts +0 -11
  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 -119
  251. package/src/mu/pages/TablePageProps.ts +0 -11
  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
@@ -1,79 +0,0 @@
1
- import { Box, CircularProgress, LinearProgress, Typography } from '@mui/material';
2
- import React from 'react';
3
- /**
4
- * Progress count
5
- * @param props Props
6
- * @returns Component
7
- */
8
- export function ProgressCount(props) {
9
- // Destruct
10
- const { countdown = true, linear = true, minWidth = 36, onComplete, onProgress, seconds, valueUnit = '' } = props;
11
- // Progress value
12
- const [value, setValue] = React.useState(countdown ? seconds : 0);
13
- // Variant
14
- const [variant, setVariant] = React.useState('determinate');
15
- // Progress value
16
- const progressValue = (100.0 * value) / seconds;
17
- React.useEffect(() => {
18
- const timer = setInterval(() => {
19
- setValue((prev) => {
20
- const newValue = countdown
21
- ? prev === 0
22
- ? seconds
23
- : prev - 1
24
- : prev === seconds
25
- ? 0
26
- : prev + 1;
27
- if (countdown) {
28
- if (newValue === 0) {
29
- if (onComplete) {
30
- const result = onComplete();
31
- // Finish
32
- if (result === false) {
33
- clearInterval(timer);
34
- setVariant('indeterminate');
35
- }
36
- }
37
- }
38
- }
39
- else {
40
- if (newValue === seconds) {
41
- if (onComplete) {
42
- const result = onComplete();
43
- // Finish
44
- if (result === false) {
45
- clearInterval(timer);
46
- setVariant('indeterminate');
47
- }
48
- }
49
- }
50
- }
51
- if (onProgress)
52
- onProgress(newValue);
53
- return newValue;
54
- });
55
- }, 1000);
56
- return () => {
57
- clearInterval(timer);
58
- };
59
- }, []);
60
- if (linear)
61
- return (React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', width: '100%' } },
62
- React.createElement(Box, { sx: { width: '100%', mr: 1 } },
63
- React.createElement(LinearProgress, { variant: variant, value: progressValue })),
64
- React.createElement(Box, { sx: { minWidth } },
65
- React.createElement(Typography, { variant: "body2", color: "text.secondary" }, `${value}${valueUnit}`))));
66
- return (React.createElement(Box, { sx: { position: 'relative', display: 'inline-flex' } },
67
- React.createElement(CircularProgress, { variant: variant, value: progressValue }),
68
- React.createElement(Box, { sx: {
69
- top: 0,
70
- left: 0,
71
- bottom: 0,
72
- right: 0,
73
- position: 'absolute',
74
- display: 'flex',
75
- alignItems: 'center',
76
- justifyContent: 'center'
77
- } },
78
- React.createElement(Typography, { variant: "caption", component: "div", color: "text.secondary" }, `${value}${valueUnit}`))));
79
- }
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { Options } from 'pulltorefreshjs';
3
- /**
4
- * PullToRefresh UI
5
- * Use hammerjs or touchemulator to simulate browser as mobile device
6
- * @param props Props
7
- * @returns Component
8
- */
9
- export declare function PullToRefreshUI(props: Options): JSX.Element;
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import PullToRefresh from 'pulltorefreshjs';
3
- /**
4
- * PullToRefresh UI
5
- * Use hammerjs or touchemulator to simulate browser as mobile device
6
- * @param props Props
7
- * @returns Component
8
- */
9
- export function PullToRefreshUI(props) {
10
- // Ready
11
- React.useEffect(() => {
12
- PullToRefresh.init(props);
13
- return () => {
14
- PullToRefresh.destroyAll();
15
- };
16
- }, [props]);
17
- return React.createElement(React.Fragment, null);
18
- }
package/lib/mu/RLink.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { LinkProps } from '@mui/material';
2
- import React from 'react';
3
- /**
4
- * Router Link properties
5
- */
6
- export declare type RLinkProps = LinkProps & {
7
- delay?: number;
8
- };
9
- /**
10
- * Router Link
11
- * @param props Props
12
- * @returns Component
13
- */
14
- export declare const RLink: React.ForwardRefExoticComponent<Pick<RLinkProps, "role" | "children" | "p" | "slot" | "title" | "type" | "maxWidth" | keyof import("@mui/material/OverridableComponent").CommonProps | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "href" | "variant" | "key" | "underline" | "media" | "target" | "hrefLang" | "referrerPolicy" | "rel" | "download" | "ping" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "TypographyClasses" | "delay"> & React.RefAttributes<HTMLAnchorElement>>;
package/lib/mu/RLink.js DELETED
@@ -1,37 +0,0 @@
1
- import { Link } from '@mui/material';
2
- import React from 'react';
3
- import { globalApp } from '../app/ReactApp';
4
- import { useDelayedExecutor } from '../uses/useDelayedExecutor';
5
- /**
6
- * Router Link
7
- * @param props Props
8
- * @returns Component
9
- */
10
- export const RLink = React.forwardRef((props, ref) => {
11
- // Destruct
12
- const { delay = 0, href, target, onClick, ...rest } = props;
13
- const delayed = useDelayedExecutor((href) => {
14
- // Router push
15
- globalApp.history.push(href);
16
- }, delay);
17
- // Click handler
18
- const onClickLocl = (event) => {
19
- if (onClick)
20
- onClick(event);
21
- if (!event.isDefaultPrevented() &&
22
- href &&
23
- (!target || target === '_self') && // Let browser handle "target=_blank" etc
24
- globalApp) {
25
- // Prevent href action
26
- event.preventDefault();
27
- // Delayed excution
28
- delayed.call(undefined, href);
29
- }
30
- };
31
- // Clear when exit
32
- React.useEffect(() => {
33
- return () => delayed.clear();
34
- }, [delayed]);
35
- // Component
36
- return (React.createElement(Link, { ...rest, onClick: onClickLocl, href: href, target: target, ref: ref }));
37
- });
@@ -1,89 +0,0 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { SxProps, Theme } from '@mui/material';
3
- import React from 'react';
4
- import { ListChildComponentProps } from 'react-window';
5
- import { GridColumn } from '../components/GridColumn';
6
- import { GridJsonData } from '../components/GridLoader';
7
- import { DataGridExProps } from './DataGridEx';
8
- import { GridMethodRef } from './GridMethodRef';
9
- import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from './ScrollerListEx';
10
- /**
11
- * ResponsibleContainer props
12
- */
13
- export declare type ResponsibleContainerProps<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = DataTypes.Keys<T>> = Omit<DataGridExProps<T, D>, 'height' | 'itemKey' | 'loadData' | 'mRef' | 'onScroll' | 'onItemsRendered'> & {
14
- /**
15
- * Height will be deducted
16
- * @param height Current calcuated height
17
- */
18
- adjustHeight?: (height: number) => number;
19
- /**
20
- * Columns
21
- */
22
- columns: GridColumn<T>[];
23
- /**
24
- * Container box SX (dataGrid determines the case)
25
- */
26
- containerBoxSx?: (paddings: Record<string, string | number>, hasFields: boolean, dataGrid?: boolean) => SxProps<Theme>;
27
- /**
28
- * Min width to show Datagrid
29
- */
30
- dataGridMinWidth?: number;
31
- /**
32
- * Search fields
33
- */
34
- fields?: React.ReactElement[];
35
- /**
36
- * Search field template
37
- */
38
- fieldTemplate?: F;
39
- /**
40
- * Grid height
41
- */
42
- height?: number;
43
- /**
44
- * Inner item renderer
45
- */
46
- innerItemRenderer: (props: ScrollerListExInnerItemRendererProps<T>) => React.ReactNode;
47
- /**
48
- * Item renderer
49
- */
50
- itemRenderer?: (props: ListChildComponentProps<T>) => React.ReactElement;
51
- /**
52
- * Item size, a function indicates its a variable size list
53
- */
54
- itemSize: ScrollerListExItemSize;
55
- /**
56
- * Load data callback
57
- */
58
- loadData: (data: GridJsonData & DataTypes.BasicTemplateType<F>) => PromiseLike<T[] | null | undefined>;
59
- /**
60
- * Methods
61
- */
62
- mRef?: React.MutableRefObject<GridMethodRef | undefined>;
63
- /**
64
- * Element ready callback
65
- */
66
- elementReady?: (element: HTMLElement, isDataGrid: boolean) => void;
67
- /**
68
- * Paddings
69
- */
70
- paddings?: Record<string, string | number>;
71
- /**
72
- * Pull to refresh data
73
- */
74
- pullToRefresh?: boolean;
75
- /**
76
- * Quick action for double click or click under mobile
77
- */
78
- quickAction?: (data: T) => void;
79
- /**
80
- * Size ready to read miliseconds span
81
- */
82
- sizeReadyMiliseconds?: number;
83
- };
84
- /**
85
- * Responsible container
86
- * @param props Props
87
- * @returns Layout
88
- */
89
- export declare function ResponsibleContainer<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = DataTypes.Keys<T>>(props: ResponsibleContainerProps<T, F, D>): JSX.Element;
@@ -1,159 +0,0 @@
1
- import { Box, Stack } from '@mui/material';
2
- import React from 'react';
3
- import { Labels } from '../app/Labels';
4
- import { ReactUtils } from '../app/ReactUtils';
5
- import { GridDataGet } from '../components/GridLoader';
6
- import useCombinedRefs from '../uses/useCombinedRefs';
7
- import { useDimensions } from '../uses/useDimensions';
8
- import { DataGridEx, DataGridExCalColumns } from './DataGridEx';
9
- import { MUGlobal } from './MUGlobal';
10
- import { PullToRefreshUI } from './PullToRefreshUI';
11
- import { ScrollerListEx } from './ScrollerListEx';
12
- import { SearchBar } from './SearchBar';
13
- function defaultContainerBoxSx(paddings, hasField, _dataGrid) {
14
- const half = MUGlobal.half(paddings);
15
- return {
16
- '& .SearchBox': {
17
- marginBottom: hasField ? half : 0
18
- }
19
- };
20
- }
21
- /**
22
- * Responsible container
23
- * @param props Props
24
- * @returns Layout
25
- */
26
- export function ResponsibleContainer(props) {
27
- // Destruct
28
- const { adjustHeight, columns, containerBoxSx = defaultContainerBoxSx, dataGridMinWidth = Math.max(576, DataGridExCalColumns(columns).total), elementReady, fields, fieldTemplate, height, loadData, mRef, paddings = MUGlobal.pagePaddings, pullToRefresh = true, quickAction, sizeReadyMiliseconds = 0, ...rest } = props;
29
- // Labels
30
- const labels = Labels.CommonPage;
31
- // Refs
32
- const refs = React.useRef({});
33
- const state = refs.current;
34
- const mRefs = useCombinedRefs(mRef, (ref) => {
35
- if (ref == null)
36
- return;
37
- state.ref = ref;
38
- });
39
- // Update mounted state
40
- React.useEffect(() => {
41
- return () => {
42
- state.mounted = false;
43
- };
44
- }, []);
45
- // Has fields
46
- const hasFields = fields != null && fields.length > 0;
47
- // Load data
48
- const localLoadData = (props) => {
49
- state.mounted = true;
50
- const data = GridDataGet(props, fieldTemplate);
51
- return loadData(data);
52
- };
53
- // On submit callback
54
- const onSubmit = (data, _reset) => {
55
- if (data == null || state.ref == null)
56
- return;
57
- state.ref.reset({ data });
58
- };
59
- // Watch container
60
- const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds, (_preRect, rect) => {
61
- // Check
62
- if (rect == null)
63
- return true;
64
- // Last rect
65
- const lastRect = state.rect;
66
- // 32 = scroll bar width
67
- if (lastRect != null &&
68
- state.mounted !== true &&
69
- Math.abs(rect.width - lastRect.width) <= 32 &&
70
- Math.abs(rect.height - lastRect.height) <= 32)
71
- return true;
72
- // Hold the new rect
73
- state.rect = rect;
74
- return false;
75
- });
76
- // Rect
77
- const rect = dimensions[0][2];
78
- // Create list
79
- const [list, showDataGrid] = (() => {
80
- // No layout
81
- if (rect == null)
82
- return [null, undefined];
83
- // Width
84
- const width = rect.width;
85
- // Show DataGrid or List dependng on width
86
- const showDataGrid = width >= dataGridMinWidth;
87
- // Height
88
- let heightLocal;
89
- if (height != null) {
90
- heightLocal = height;
91
- }
92
- else {
93
- // Auto calculation
94
- heightLocal =
95
- document.documentElement.clientHeight -
96
- Math.round(rect.bottom + 1);
97
- const style = window.getComputedStyle(dimensions[0][1]);
98
- const boxMargin = parseFloat(style.marginBottom);
99
- if (!isNaN(boxMargin))
100
- heightLocal -= 3 * boxMargin; // 1 - Box, 2 - Page bottom
101
- if (adjustHeight != null) {
102
- heightLocal -= adjustHeight(heightLocal);
103
- }
104
- }
105
- if (showDataGrid) {
106
- // Delete
107
- delete rest.itemRenderer;
108
- return [
109
- React.createElement(Box, { className: "DataGridBox" },
110
- React.createElement(DataGridEx, { autoLoad: !hasFields, height: heightLocal, width: rect.width, loadData: localLoadData, mRef: mRefs, onDoubleClick: (_, data) => quickAction && quickAction(data), outerRef: (element) => {
111
- if (element != null && elementReady)
112
- elementReady(element, true);
113
- }, columns: columns, ...rest })),
114
- true
115
- ];
116
- }
117
- // Delete
118
- delete rest.checkable;
119
- delete rest.borderRowsCount;
120
- delete rest.bottomHeight;
121
- delete rest.footerItemRenderer;
122
- delete rest.headerHeight;
123
- delete rest.hideFooter;
124
- delete rest.hoverColor;
125
- delete rest.selectable;
126
- return [
127
- React.createElement(Box, { className: "ListBox", sx: { height: heightLocal } },
128
- React.createElement(ScrollerListEx, { autoLoad: !hasFields, height: heightLocal, loadData: localLoadData, mRef: mRefs, onClick: (event, data) => quickAction &&
129
- ReactUtils.isSafeClick(event) &&
130
- quickAction(data), oRef: (element) => {
131
- if (element != null && elementReady)
132
- elementReady(element, false);
133
- }, ...rest })),
134
- false
135
- ];
136
- })();
137
- const searchBar = React.useMemo(() => {
138
- if (!hasFields || showDataGrid == null)
139
- return;
140
- return (React.createElement(SearchBar, { fields: fields, onSubmit: onSubmit, className: `searchBar${showDataGrid ? 'Grid' : 'List'}` }));
141
- }, [showDataGrid, hasFields]);
142
- // Pull container
143
- const pullContainer = showDataGrid == null
144
- ? undefined
145
- : showDataGrid
146
- ? '.DataGridEx-Body'
147
- : '.ScrollerListEx-Body';
148
- // Layout
149
- return (React.createElement(Box, { sx: containerBoxSx == null
150
- ? undefined
151
- : containerBoxSx(paddings, hasFields, showDataGrid) },
152
- React.createElement(Stack, null,
153
- React.createElement(Box, { ref: dimensions[0][0], className: "SearchBox", sx: { height: hasFields ? 40 : 0 } }, searchBar),
154
- list),
155
- pullToRefresh && pullContainer && (React.createElement(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => { var _a; return (_a = state.ref) === null || _a === void 0 ? void 0 : _a.reset(); }, shouldPullToRefresh: () => {
156
- const container = document.querySelector(pullContainer);
157
- return !(container === null || container === void 0 ? void 0 : container.scrollTop);
158
- } }))));
159
- }
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import { CustomFabProps } from './CustomFabProps';
3
- /**
4
- * Scroll to top fab
5
- * @returns Component
6
- */
7
- export declare function ScrollTopFab(props: CustomFabProps): JSX.Element;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { Fab, useScrollTrigger, Zoom } from '@mui/material';
3
- import VerticalAlignTopIcon from '@mui/icons-material/VerticalAlignTop';
4
- /**
5
- * Scroll to top fab
6
- * @returns Component
7
- */
8
- export function ScrollTopFab(props) {
9
- // Destruct
10
- const { color, size, target, title } = props;
11
- // Scroll trigger
12
- const trigger = useScrollTrigger({
13
- target,
14
- disableHysteresis: true,
15
- threshold: 120
16
- });
17
- // Icon click handler
18
- // behavior: 'smooth'
19
- const handleClick = () => {
20
- target.scrollTo({ top: 0 });
21
- };
22
- return (React.createElement(Zoom, { in: trigger },
23
- React.createElement(Fab, { color: color, size: size, title: title, onClick: handleClick },
24
- React.createElement(VerticalAlignTopIcon, null))));
25
- }
@@ -1,81 +0,0 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import React from 'react';
3
- import { ListChildComponentProps } from 'react-window';
4
- import { ScrollerListProps } from '../components/ScrollerList';
5
- import { MouseEventWithDataHandler } from './MUGlobal';
6
- /**
7
- * Extended ScrollerList inner item renderer props
8
- */
9
- export interface ScrollerListExInnerItemRendererProps<T> extends ListChildComponentProps<T> {
10
- /**
11
- * Item selected
12
- */
13
- selected: boolean;
14
- /**
15
- * Item height
16
- */
17
- itemHeight: number;
18
- /**
19
- * Item space
20
- */
21
- space: number;
22
- /**
23
- * Default margins
24
- */
25
- margins: object;
26
- }
27
- /**
28
- * Extended ScrollerList ItemSize type
29
- * 1. Callback function
30
- * 2. Static sets
31
- * 3. Dynamic calculation
32
- */
33
- export declare type ScrollerListExItemSize = ((index: number) => [number, number] | [number, number, object]) | [number, number] | [number, object, boolean?];
34
- /**
35
- * Extended ScrollerList Props
36
- */
37
- export declare type ScrollerListExProps<T extends object, D extends DataTypes.Keys<T> = DataTypes.Keys<T>> = Omit<ScrollerListProps<T>, 'itemRenderer' | 'itemSize'> & {
38
- /**
39
- * Alternating colors for odd/even rows
40
- */
41
- alternatingColors?: [string?, string?];
42
- /**
43
- * Inner item renderer
44
- */
45
- innerItemRenderer: (props: ScrollerListExInnerItemRendererProps<T>) => React.ReactNode;
46
- /**
47
- * Item renderer
48
- */
49
- itemRenderer?: (props: ListChildComponentProps<T>) => React.ReactElement;
50
- /**
51
- * Id field
52
- * Failed: D extends { id: DataTypes.IdType } ? { idField?: D } : { idField: D }
53
- */
54
- idField?: D;
55
- /**
56
- * Item size, a function indicates its a variable size list
57
- */
58
- itemSize: ScrollerListExItemSize;
59
- /**
60
- * Double click handler
61
- */
62
- onDoubleClick?: MouseEventWithDataHandler<T>;
63
- /**
64
- * Click handler
65
- */
66
- onClick?: MouseEventWithDataHandler<T>;
67
- /**
68
- * On items select change
69
- */
70
- onSelectChange?: (selectedItems: T[]) => void;
71
- /**
72
- * Selected color
73
- */
74
- selectedColor?: string;
75
- };
76
- /**
77
- * Extended ScrollerList
78
- * @param props Props
79
- * @returns Component
80
- */
81
- export declare function ScrollerListEx<T extends object, D extends DataTypes.Keys<T> = DataTypes.Keys<T>>(props: ScrollerListExProps<T, D>): JSX.Element;