@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.
Files changed (257) 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 +3 -15
  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/ComboBox.tsx +0 -30
  25. package/__tests__/mu/MUGlobalTests.tsx +0 -58
  26. package/__tests__/mu/NotifierMUTests.tsx +0 -213
  27. package/__tests__/mu/SelectEx.tsx +0 -26
  28. package/lib/app/CommonApp.d.ts +0 -39
  29. package/lib/app/CommonApp.js +0 -149
  30. package/lib/app/IServiceAppSettings.d.ts +0 -11
  31. package/lib/app/IServiceAppSettings.js +0 -1
  32. package/lib/app/IServicePage.d.ts +0 -6
  33. package/lib/app/IServicePage.js +0 -1
  34. package/lib/app/IServiceUser.d.ts +0 -14
  35. package/lib/app/IServiceUser.js +0 -1
  36. package/lib/app/ISmartERPUser.d.ts +0 -14
  37. package/lib/app/ISmartERPUser.js +0 -1
  38. package/lib/app/Labels.d.ts +0 -65
  39. package/lib/app/Labels.js +0 -62
  40. package/lib/app/ReactApp.d.ts +0 -194
  41. package/lib/app/ReactApp.js +0 -298
  42. package/lib/app/ServiceApp.d.ts +0 -78
  43. package/lib/app/ServiceApp.js +0 -244
  44. package/lib/components/ShowDataComparison.d.ts +0 -20
  45. package/lib/components/ShowDataComparison.js +0 -60
  46. package/lib/mu/AuditDisplay.d.ts +0 -33
  47. package/lib/mu/AuditDisplay.js +0 -52
  48. package/lib/mu/AutocompleteExtendedProps.d.ts +0 -64
  49. package/lib/mu/AutocompleteExtendedProps.js +0 -1
  50. package/lib/mu/BackButton.d.ts +0 -13
  51. package/lib/mu/BackButton.js +0 -33
  52. package/lib/mu/BridgeCloseButton.d.ts +0 -23
  53. package/lib/mu/BridgeCloseButton.js +0 -32
  54. package/lib/mu/ButtonLink.d.ts +0 -17
  55. package/lib/mu/ButtonLink.js +0 -19
  56. package/lib/mu/ComboBox.d.ts +0 -38
  57. package/lib/mu/ComboBox.js +0 -108
  58. package/lib/mu/CountdownButton.d.ts +0 -23
  59. package/lib/mu/CountdownButton.js +0 -81
  60. package/lib/mu/CustomFabProps.d.ts +0 -27
  61. package/lib/mu/CustomFabProps.js +0 -1
  62. package/lib/mu/DataGridEx.d.ts +0 -96
  63. package/lib/mu/DataGridEx.js +0 -331
  64. package/lib/mu/DataGridRenderers.d.ts +0 -22
  65. package/lib/mu/DataGridRenderers.js +0 -99
  66. package/lib/mu/DialogButton.d.ts +0 -54
  67. package/lib/mu/DialogButton.js +0 -45
  68. package/lib/mu/DraggablePaperComponent.d.ts +0 -8
  69. package/lib/mu/DraggablePaperComponent.js +0 -12
  70. package/lib/mu/EmailInput.d.ts +0 -11
  71. package/lib/mu/EmailInput.js +0 -15
  72. package/lib/mu/FabBox.d.ts +0 -21
  73. package/lib/mu/FabBox.js +0 -31
  74. package/lib/mu/FlexBox.d.ts +0 -14
  75. package/lib/mu/FlexBox.js +0 -18
  76. package/lib/mu/GridDataFormat.d.ts +0 -10
  77. package/lib/mu/GridDataFormat.js +0 -43
  78. package/lib/mu/GridMethodRef.d.ts +0 -11
  79. package/lib/mu/IconButtonLink.d.ts +0 -17
  80. package/lib/mu/IconButtonLink.js +0 -16
  81. package/lib/mu/InputField.d.ts +0 -21
  82. package/lib/mu/InputField.js +0 -39
  83. package/lib/mu/ItemList.d.ts +0 -56
  84. package/lib/mu/ItemList.js +0 -69
  85. package/lib/mu/ListItemRightIcon.d.ts +0 -4
  86. package/lib/mu/ListItemRightIcon.js +0 -8
  87. package/lib/mu/ListMoreDisplay.d.ts +0 -35
  88. package/lib/mu/ListMoreDisplay.js +0 -99
  89. package/lib/mu/LoadingButton.d.ts +0 -16
  90. package/lib/mu/LoadingButton.js +0 -41
  91. package/lib/mu/MUGlobal.d.ts +0 -102
  92. package/lib/mu/MUGlobal.js +0 -184
  93. package/lib/mu/MaskInput.d.ts +0 -34
  94. package/lib/mu/MaskInput.js +0 -43
  95. package/lib/mu/MobileListItemRenderer.d.ts +0 -17
  96. package/lib/mu/MobileListItemRenderer.js +0 -35
  97. package/lib/mu/MoreFab.d.ts +0 -45
  98. package/lib/mu/MoreFab.js +0 -95
  99. package/lib/mu/NotifierMU.d.ts +0 -47
  100. package/lib/mu/NotifierMU.js +0 -387
  101. package/lib/mu/NotifierPromptProps.d.ts +0 -22
  102. package/lib/mu/NotifierPromptProps.js +0 -1
  103. package/lib/mu/OptionGroup.d.ts +0 -58
  104. package/lib/mu/OptionGroup.js +0 -81
  105. package/lib/mu/PList.d.ts +0 -15
  106. package/lib/mu/PList.js +0 -12
  107. package/lib/mu/ProgressCount.d.ts +0 -44
  108. package/lib/mu/ProgressCount.js +0 -79
  109. package/lib/mu/PullToRefreshUI.d.ts +0 -9
  110. package/lib/mu/PullToRefreshUI.js +0 -18
  111. package/lib/mu/RLink.d.ts +0 -14
  112. package/lib/mu/RLink.js +0 -37
  113. package/lib/mu/ResponsibleContainer.d.ts +0 -89
  114. package/lib/mu/ResponsibleContainer.js +0 -159
  115. package/lib/mu/ScrollTopFab.d.ts +0 -7
  116. package/lib/mu/ScrollTopFab.js +0 -25
  117. package/lib/mu/ScrollerListEx.d.ts +0 -81
  118. package/lib/mu/ScrollerListEx.js +0 -167
  119. package/lib/mu/SearchBar.d.ts +0 -29
  120. package/lib/mu/SearchBar.js +0 -262
  121. package/lib/mu/SearchField.d.ts +0 -21
  122. package/lib/mu/SearchField.js +0 -39
  123. package/lib/mu/SearchOptionGroup.d.ts +0 -9
  124. package/lib/mu/SearchOptionGroup.js +0 -14
  125. package/lib/mu/SelectBool.d.ts +0 -13
  126. package/lib/mu/SelectBool.js +0 -22
  127. package/lib/mu/SelectEx.d.ts +0 -50
  128. package/lib/mu/SelectEx.js +0 -156
  129. package/lib/mu/Switch.d.ts +0 -29
  130. package/lib/mu/Switch.js +0 -34
  131. package/lib/mu/SwitchAnt.d.ts +0 -25
  132. package/lib/mu/SwitchAnt.js +0 -40
  133. package/lib/mu/TabBox.d.ts +0 -54
  134. package/lib/mu/TabBox.js +0 -31
  135. package/lib/mu/TableEx.d.ts +0 -66
  136. package/lib/mu/TableEx.js +0 -271
  137. package/lib/mu/TextFieldEx.d.ts +0 -101
  138. package/lib/mu/TextFieldEx.js +0 -127
  139. package/lib/mu/Tiplist.d.ts +0 -18
  140. package/lib/mu/Tiplist.js +0 -158
  141. package/lib/mu/TooltipClick.d.ts +0 -15
  142. package/lib/mu/TooltipClick.js +0 -40
  143. package/lib/mu/UserAvatar.d.ts +0 -24
  144. package/lib/mu/UserAvatar.js +0 -25
  145. package/lib/mu/UserAvatarEditor.d.ts +0 -53
  146. package/lib/mu/UserAvatarEditor.js +0 -129
  147. package/lib/mu/pages/CommonPage.d.ts +0 -11
  148. package/lib/mu/pages/CommonPage.js +0 -60
  149. package/lib/mu/pages/CommonPageProps.d.ts +0 -60
  150. package/lib/mu/pages/CommonPageProps.js +0 -1
  151. package/lib/mu/pages/DataGridPage.d.ts +0 -9
  152. package/lib/mu/pages/DataGridPage.js +0 -81
  153. package/lib/mu/pages/DataGridPageProps.d.ts +0 -17
  154. package/lib/mu/pages/DataGridPageProps.js +0 -1
  155. package/lib/mu/pages/EditPage.d.ts +0 -33
  156. package/lib/mu/pages/EditPage.js +0 -29
  157. package/lib/mu/pages/FixedListPage.d.ts +0 -15
  158. package/lib/mu/pages/FixedListPage.js +0 -72
  159. package/lib/mu/pages/ListPage.d.ts +0 -9
  160. package/lib/mu/pages/ListPage.js +0 -51
  161. package/lib/mu/pages/ListPageProps.d.ts +0 -7
  162. package/lib/mu/pages/ListPageProps.js +0 -1
  163. package/lib/mu/pages/ResponsivePage.d.ts +0 -9
  164. package/lib/mu/pages/ResponsivePage.js +0 -45
  165. package/lib/mu/pages/ResponsivePageProps.d.ts +0 -39
  166. package/lib/mu/pages/ResponsivePageProps.js +0 -1
  167. package/lib/mu/pages/SearchPageProps.d.ts +0 -30
  168. package/lib/mu/pages/SearchPageProps.js +0 -1
  169. package/lib/mu/pages/TablePage.d.ts +0 -9
  170. package/lib/mu/pages/TablePage.js +0 -71
  171. package/lib/mu/pages/TablePageProps.d.ts +0 -7
  172. package/lib/mu/pages/TablePageProps.js +0 -1
  173. package/lib/mu/pages/ViewPage.d.ts +0 -66
  174. package/lib/mu/pages/ViewPage.js +0 -105
  175. package/lib/mu/texts/DateText.d.ts +0 -34
  176. package/lib/mu/texts/DateText.js +0 -25
  177. package/lib/mu/texts/MoneyText.d.ts +0 -21
  178. package/lib/mu/texts/MoneyText.js +0 -14
  179. package/lib/mu/texts/NumberText.d.ts +0 -25
  180. package/lib/mu/texts/NumberText.js +0 -14
  181. package/src/app/CommonApp.ts +0 -225
  182. package/src/app/IServiceAppSettings.ts +0 -13
  183. package/src/app/IServicePage.ts +0 -6
  184. package/src/app/IServiceUser.ts +0 -17
  185. package/src/app/ISmartERPUser.ts +0 -16
  186. package/src/app/Labels.ts +0 -77
  187. package/src/app/ReactApp.ts +0 -500
  188. package/src/app/ServiceApp.ts +0 -353
  189. package/src/components/ShowDataComparison.tsx +0 -108
  190. package/src/mu/AuditDisplay.tsx +0 -117
  191. package/src/mu/AutocompleteExtendedProps.ts +0 -83
  192. package/src/mu/BackButton.tsx +0 -55
  193. package/src/mu/BridgeCloseButton.tsx +0 -69
  194. package/src/mu/ButtonLink.tsx +0 -32
  195. package/src/mu/ComboBox.tsx +0 -251
  196. package/src/mu/CountdownButton.tsx +0 -119
  197. package/src/mu/CustomFabProps.ts +0 -32
  198. package/src/mu/DataGridEx.tsx +0 -712
  199. package/src/mu/DataGridRenderers.tsx +0 -140
  200. package/src/mu/DialogButton.tsx +0 -163
  201. package/src/mu/DraggablePaperComponent.tsx +0 -19
  202. package/src/mu/EmailInput.tsx +0 -24
  203. package/src/mu/FabBox.tsx +0 -51
  204. package/src/mu/FlexBox.tsx +0 -20
  205. package/src/mu/GridDataFormat.tsx +0 -77
  206. package/src/mu/GridMethodRef.ts +0 -12
  207. package/src/mu/IconButtonLink.tsx +0 -29
  208. package/src/mu/InputField.tsx +0 -82
  209. package/src/mu/ItemList.tsx +0 -204
  210. package/src/mu/ListItemRightIcon.tsx +0 -9
  211. package/src/mu/ListMoreDisplay.tsx +0 -205
  212. package/src/mu/LoadingButton.tsx +0 -75
  213. package/src/mu/MUGlobal.ts +0 -220
  214. package/src/mu/MaskInput.tsx +0 -107
  215. package/src/mu/MobileListItemRenderer.tsx +0 -79
  216. package/src/mu/MoreFab.tsx +0 -211
  217. package/src/mu/NotifierMU.tsx +0 -654
  218. package/src/mu/NotifierPromptProps.ts +0 -26
  219. package/src/mu/OptionGroup.tsx +0 -223
  220. package/src/mu/PList.tsx +0 -27
  221. package/src/mu/ProgressCount.tsx +0 -166
  222. package/src/mu/PullToRefreshUI.tsx +0 -21
  223. package/src/mu/RLink.tsx +0 -64
  224. package/src/mu/ResponsibleContainer.tsx +0 -394
  225. package/src/mu/ScrollTopFab.tsx +0 -34
  226. package/src/mu/ScrollerListEx.tsx +0 -387
  227. package/src/mu/SearchBar.tsx +0 -398
  228. package/src/mu/SearchField.tsx +0 -82
  229. package/src/mu/SearchOptionGroup.tsx +0 -31
  230. package/src/mu/SelectBool.tsx +0 -33
  231. package/src/mu/SelectEx.tsx +0 -290
  232. package/src/mu/Switch.tsx +0 -94
  233. package/src/mu/SwitchAnt.tsx +0 -95
  234. package/src/mu/TabBox.tsx +0 -118
  235. package/src/mu/TableEx.tsx +0 -560
  236. package/src/mu/TextFieldEx.tsx +0 -250
  237. package/src/mu/Tiplist.tsx +0 -304
  238. package/src/mu/TooltipClick.tsx +0 -84
  239. package/src/mu/UserAvatar.tsx +0 -64
  240. package/src/mu/UserAvatarEditor.tsx +0 -287
  241. package/src/mu/pages/CommonPage.tsx +0 -128
  242. package/src/mu/pages/CommonPageProps.ts +0 -71
  243. package/src/mu/pages/DataGridPage.tsx +0 -137
  244. package/src/mu/pages/DataGridPageProps.ts +0 -24
  245. package/src/mu/pages/EditPage.tsx +0 -114
  246. package/src/mu/pages/FixedListPage.tsx +0 -135
  247. package/src/mu/pages/ListPage.tsx +0 -87
  248. package/src/mu/pages/ListPageProps.ts +0 -12
  249. package/src/mu/pages/ResponsivePage.tsx +0 -68
  250. package/src/mu/pages/ResponsivePageProps.ts +0 -57
  251. package/src/mu/pages/SearchPageProps.ts +0 -39
  252. package/src/mu/pages/TablePage.tsx +0 -120
  253. package/src/mu/pages/TablePageProps.ts +0 -12
  254. package/src/mu/pages/ViewPage.tsx +0 -285
  255. package/src/mu/texts/DateText.tsx +0 -74
  256. package/src/mu/texts/MoneyText.tsx +0 -49
  257. package/src/mu/texts/NumberText.tsx +0 -40
@@ -1,33 +0,0 @@
1
- import { Theme } from '@mui/material';
2
- import React, { CSSProperties } from 'react';
3
- import { AuditLineUpdateData } from '../components/ShowDataComparison';
4
- import { ListMoreDisplayProps } from './ListMoreDisplay';
5
- /**
6
- * Audit line data model
7
- */
8
- export interface AuditLine {
9
- id: number;
10
- creation: Date;
11
- user: string;
12
- action: string;
13
- changes?: AuditLineUpdateData;
14
- }
15
- /**
16
- * Audit display props
17
- */
18
- export interface AuditDisplayProps extends Omit<ListMoreDisplayProps<AuditLine>, 'children'> {
19
- /**
20
- * Get list item style callback
21
- */
22
- getItemStyle?: (index: number, theme: Theme) => CSSProperties;
23
- /**
24
- * Item/line renderer
25
- */
26
- itemRenderer?: (data: AuditLine, index: number) => React.ReactNode;
27
- }
28
- /**
29
- * Audit display
30
- * @param props Props
31
- * @returns Component
32
- */
33
- export declare function AuditDisplay(props: AuditDisplayProps): JSX.Element;
@@ -1,52 +0,0 @@
1
- import { Utils } from '@etsoo/shared';
2
- import { Button, Divider, Typography, useTheme } from '@mui/material';
3
- import React from 'react';
4
- import { globalApp } from '..';
5
- import { ShowDataComparison } from '../components/ShowDataComparison';
6
- import { ListMoreDisplay } from './ListMoreDisplay';
7
- // Get label
8
- const getLabel = (key) => {
9
- var _a;
10
- return (_a = globalApp.get(Utils.formatInitial(key))) !== null && _a !== void 0 ? _a : key;
11
- };
12
- // Format date
13
- const formatDate = (date) => {
14
- if (typeof globalApp === 'undefined')
15
- return date.toUTCString();
16
- return globalApp.formatDate(date, 'ds');
17
- };
18
- /**
19
- * Audit display
20
- * @param props Props
21
- * @returns Component
22
- */
23
- export function AuditDisplay(props) {
24
- // Theme
25
- const theme = useTheme();
26
- // Title
27
- var title = getLabel('dataComparison');
28
- // Destruct
29
- const { getItemStyle = (index, theme) => ({
30
- padding: [theme.spacing(1.5), theme.spacing(1)].join(' '),
31
- background: index % 2 === 0
32
- ? theme.palette.grey[100]
33
- : theme.palette.grey[50]
34
- }), itemRenderer = (data) => {
35
- const changes = data.changes;
36
- return (React.createElement(React.Fragment, null,
37
- changes != null && (React.createElement(Button, { variant: "outlined", size: "small", onClick: () => ShowDataComparison(changes, title), sx: {
38
- marginLeft: theme.spacing(1),
39
- marginTop: theme.spacing(-0.5),
40
- float: 'right'
41
- } }, title)),
42
- React.createElement(Typography, null, formatDate(data.creation) +
43
- ', [' +
44
- getLabel(data.action) +
45
- '], ' +
46
- data.user)));
47
- }, headerTitle = (React.createElement(React.Fragment, null,
48
- React.createElement(Typography, null, getLabel('audits')),
49
- React.createElement(Divider, null))), ...rest } = props;
50
- // Layout
51
- return (React.createElement(ListMoreDisplay, { headerTitle: headerTitle, ...rest }, (data, index) => (React.createElement("div", { key: data.id, style: getItemStyle(index, theme) }, itemRenderer(data, index)))));
52
- }
@@ -1,64 +0,0 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { AutocompleteProps } from '@mui/material';
3
- import { ChangeEventHandler } from 'react';
4
- /**
5
- * Autocomplete extended props
6
- */
7
- export declare type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys<T>> = Omit<AutocompleteProps<T, undefined, false, false>, 'renderInput' | 'options'> & {
8
- /**
9
- * Id field
10
- */
11
- idField?: D;
12
- /**
13
- * Id value
14
- */
15
- idValue?: T[D];
16
- /**
17
- * Autocomplete for the input
18
- */
19
- inputAutoComplete?: string;
20
- /**
21
- * If `true`, the label is displayed in an error state.
22
- * @default false
23
- */
24
- inputError?: boolean;
25
- /**
26
- * The helper text content.
27
- */
28
- inputHelperText?: React.ReactNode;
29
- /**
30
- * If `dense` or `normal`, will adjust vertical spacing of this and contained components.
31
- * @default 'none'
32
- */
33
- inputMargin?: 'dense' | 'normal' | 'none';
34
- /**
35
- * Input onChange hanlder
36
- */
37
- inputOnChange?: ChangeEventHandler<HTMLInputElement> | undefined;
38
- /**
39
- * If `true`, the label will indicate that the `input` is required.
40
- * @default false
41
- */
42
- inputRequired?: boolean;
43
- /**
44
- * The variant to use.
45
- * @default 'outlined'
46
- */
47
- inputVariant?: 'standard' | 'outlined' | 'filled';
48
- /**
49
- * Label of the field
50
- */
51
- label: string;
52
- /**
53
- * Name of the field
54
- */
55
- name: string;
56
- /**
57
- * Is the field read only?
58
- */
59
- readOnly?: boolean;
60
- /**
61
- * Is search field?
62
- */
63
- search?: boolean;
64
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { IconButtonProps } from '@mui/material';
3
- /**
4
- * BackButton props
5
- */
6
- export interface BackButtonProps extends IconButtonProps {
7
- }
8
- /**
9
- * BackButton
10
- * @param props Props
11
- * @returns Component
12
- */
13
- export declare function BackButton(props: BackButtonProps): JSX.Element;
@@ -1,33 +0,0 @@
1
- import { IconButton, useTheme } from '@mui/material';
2
- import ArrowBackIcon from '@mui/icons-material/ArrowBack';
3
- import React from 'react';
4
- import { useNavigate } from 'react-router-dom';
5
- /**
6
- * BackButton
7
- * @param props Props
8
- * @returns Component
9
- */
10
- export function BackButton(props) {
11
- // Destruct
12
- const { color = 'primary', size = 'small', onClick, ...rest } = props;
13
- // Theme
14
- const theme = useTheme();
15
- // Navigate
16
- const navigate = useNavigate();
17
- // Color
18
- const pColor = color != 'inherit' && color != 'default' && color in theme.palette
19
- ? theme.palette[color]
20
- : theme.palette.primary;
21
- // Click handler
22
- const onClickLocal = async (event) => {
23
- if (onClick)
24
- onClick(event);
25
- // Navigate
26
- navigate(-1);
27
- };
28
- return (React.createElement(IconButton, { "aria-label": "Back", color: color, size: size, onClick: onClickLocal, sx: {
29
- backgroundColor: pColor.contrastText,
30
- border: `1px solid ${pColor.light}`
31
- }, ...rest },
32
- React.createElement(ArrowBackIcon, null)));
33
- }
@@ -1,23 +0,0 @@
1
- /// <reference types="react" />
2
- import { IBridgeHost } from '@etsoo/appscript';
3
- import { BoxProps, IconButtonProps } from '@mui/material';
4
- /**
5
- * Bridge close button props
6
- */
7
- export interface BridgeCloseButtonProps extends IconButtonProps {
8
- /**
9
- * Box props
10
- */
11
- boxProps?: BoxProps;
12
- /**
13
- * Validate the host
14
- * @param host Host
15
- */
16
- validate?(host: IBridgeHost): boolean;
17
- }
18
- /**
19
- * Bridge close button
20
- * @param props Props
21
- * @returns Component
22
- */
23
- export declare function BridgeCloseButton(props: BridgeCloseButtonProps): JSX.Element;
@@ -1,32 +0,0 @@
1
- import { BridgeUtils } from '@etsoo/appscript';
2
- import CloseIcon from '@mui/icons-material/Close';
3
- import { Box, IconButton } from '@mui/material';
4
- import React from 'react';
5
- import { globalApp } from '../app/ReactApp';
6
- /**
7
- * Bridge close button
8
- * @param props Props
9
- * @returns Component
10
- */
11
- export function BridgeCloseButton(props) {
12
- // Destruct
13
- const { boxProps, onClick, title = typeof globalApp === 'undefined'
14
- ? 'Close'
15
- : globalApp.get('close'), validate, ...rest } = props;
16
- // Host
17
- const host = BridgeUtils.host;
18
- if (host == null ||
19
- !host.closable() ||
20
- (validate && validate(host) === false)) {
21
- return React.createElement(React.Fragment, null);
22
- }
23
- // Click handler
24
- const onClickLocal = (event) => {
25
- if (onClick)
26
- onClick(event);
27
- host.exit();
28
- };
29
- return (React.createElement(Box, { ...boxProps },
30
- React.createElement(IconButton, { "aria-label": "close", onClick: onClickLocal, title: title, ...rest },
31
- React.createElement(CloseIcon, null))));
32
- }
@@ -1,17 +0,0 @@
1
- /// <reference types="react" />
2
- import { ButtonProps } from '@mui/material';
3
- /**
4
- * ButtonLink props
5
- */
6
- export declare type ButtonLinkProps = Omit<ButtonProps, 'href' | 'onClick'> & {
7
- /**
8
- * To href
9
- */
10
- href: string;
11
- };
12
- /**
13
- * ButtonLink
14
- * @param props Props
15
- * @returns Component
16
- */
17
- export declare function ButtonLink(props: ButtonLinkProps): JSX.Element;
@@ -1,19 +0,0 @@
1
- import { Button } from '@mui/material';
2
- import React from 'react';
3
- import { useNavigate } from 'react-router-dom';
4
- /**
5
- * ButtonLink
6
- * @param props Props
7
- * @returns Component
8
- */
9
- export function ButtonLink(props) {
10
- // Destruct
11
- const { href, ...rest } = props;
12
- // Navigate
13
- const navigate = useNavigate();
14
- const onClick = href.includes('://')
15
- ? () => window.open(href, '_blank')
16
- : () => navigate(href);
17
- // Layout
18
- return React.createElement(Button, { ...rest, onClick: onClick });
19
- }
@@ -1,38 +0,0 @@
1
- /// <reference types="react" />
2
- import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from '@etsoo/shared';
3
- import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
4
- /**
5
- * ComboBox props
6
- */
7
- export declare type ComboBoxProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> = AutocompleteExtendedProps<T, D> & {
8
- /**
9
- * Auto add blank item
10
- */
11
- autoAddBlankItem?: boolean;
12
- /**
13
- * Data readonly
14
- */
15
- dataReadonly?: boolean;
16
- /**
17
- * Label field
18
- */
19
- labelField?: L;
20
- /**
21
- * Load data callback
22
- */
23
- loadData?: () => PromiseLike<T[] | null | undefined>;
24
- /**
25
- * On load data handler
26
- */
27
- onLoadData?: (options: T[]) => void;
28
- /**
29
- * Array of options.
30
- */
31
- options?: ReadonlyArray<T>;
32
- };
33
- /**
34
- * ComboBox
35
- * @param props Props
36
- * @returns Component
37
- */
38
- export declare function ComboBox<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>>(props: ComboBoxProps<T, D, L>): JSX.Element;
@@ -1,108 +0,0 @@
1
- import { Keyboard } from '@etsoo/shared';
2
- import { Autocomplete } from '@mui/material';
3
- import React from 'react';
4
- import { Utils as SharedUtils } from '@etsoo/shared';
5
- import { InputField } from './InputField';
6
- import { SearchField } from './SearchField';
7
- import { ReactUtils } from '../app/ReactUtils';
8
- /**
9
- * ComboBox
10
- * @param props Props
11
- * @returns Component
12
- */
13
- export function ComboBox(props) {
14
- // Destruct
15
- const { search = false, autoAddBlankItem = search, idField = 'id', idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, defaultValue, label, labelField = 'label', loadData, onLoadData, name, inputAutoComplete = 'off', options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: '150px' }, ...rest } = props;
16
- // Value input ref
17
- const inputRef = React.createRef();
18
- // Options state
19
- const [localOptions, setOptions] = React.useState(options !== null && options !== void 0 ? options : []);
20
- const isMounted = React.useRef(true);
21
- // When options change
22
- // [options] will cause infinite loop
23
- const propertyWay = loadData == null;
24
- React.useEffect(() => {
25
- if (propertyWay && options != null)
26
- setOptions(options);
27
- }, [JSON.stringify(options), propertyWay]);
28
- // Local default value
29
- let localValue = idValue != null
30
- ? localOptions.find((o) => o[idField] === idValue)
31
- : defaultValue !== null && defaultValue !== void 0 ? defaultValue : value;
32
- if (localValue === undefined)
33
- localValue = null;
34
- // State
35
- // null for controlled
36
- const [stateValue, setStateValue] = React.useState(null);
37
- // Current id value
38
- // One time calculation for input's default value (uncontrolled)
39
- const localIdValue = stateValue && stateValue[idField];
40
- React.useEffect(() => {
41
- if (localValue != null)
42
- setStateValue(localValue);
43
- }, [localValue]);
44
- // Add readOnly
45
- const addReadOnly = (params) => {
46
- if (readOnly != null) {
47
- Object.assign(params, { readOnly });
48
- if (readOnly) {
49
- Object.assign(params.inputProps, { 'data-reset': true });
50
- }
51
- }
52
- if (dataReadonly) {
53
- params.inputProps.onKeyDown = (event) => {
54
- if (Keyboard.isTypingContent(event.key)) {
55
- event.preventDefault();
56
- }
57
- };
58
- }
59
- // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
60
- // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
61
- Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
62
- return params;
63
- };
64
- const setInputValue = (value) => {
65
- // Set state
66
- setStateValue(value);
67
- // Input value
68
- const input = inputRef.current;
69
- if (input) {
70
- // Update value
71
- const newValue = value != null ? `${value[idField]}` : '';
72
- if (newValue !== input.value) {
73
- // Different value, trigger change event
74
- ReactUtils.triggerChange(input, newValue, false);
75
- }
76
- }
77
- };
78
- // When value change
79
- React.useEffect(() => {
80
- if (loadData) {
81
- loadData().then((result) => {
82
- if (result == null || !isMounted.current)
83
- return;
84
- if (onLoadData)
85
- onLoadData(result);
86
- if (autoAddBlankItem) {
87
- SharedUtils.addBlankItem(result, idField, labelField);
88
- }
89
- setOptions(result);
90
- });
91
- }
92
- }, [localValue]);
93
- React.useEffect(() => {
94
- return () => {
95
- isMounted.current = false;
96
- };
97
- }, []);
98
- // Layout
99
- return (React.createElement("div", null,
100
- React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: 'none' }, name: name, value: `${localIdValue !== null && localIdValue !== void 0 ? localIdValue : ''}`, readOnly: true, onChange: inputOnChange }),
101
- React.createElement(Autocomplete, { value: stateValue, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
102
- // Set value
103
- setInputValue(value);
104
- // Custom
105
- if (onChange != null)
106
- onChange(event, value, reason, details);
107
- }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, name: name + 'Input', margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (React.createElement(InputField, { ...addReadOnly(params), label: label, name: name + 'Input', margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, ...rest })));
108
- }
@@ -1,23 +0,0 @@
1
- import { ButtonProps } from '@mui/material';
2
- import React from 'react';
3
- /**
4
- * Countdown button action
5
- */
6
- export interface CountdownButtonAction {
7
- (): Promise<number>;
8
- }
9
- /**
10
- * Countdown button props
11
- */
12
- export declare type CountdownButtonProps = Omit<ButtonProps, 'endIcon' | 'disabled'> & {
13
- /**
14
- * Action, required
15
- */
16
- onAction: CountdownButtonAction;
17
- };
18
- /**
19
- * Countdown button
20
- * @param props Props
21
- * @returns Button
22
- */
23
- export declare const CountdownButton: React.ForwardRefExoticComponent<Pick<CountdownButtonProps, "name" | "role" | "children" | "form" | "slot" | "title" | "value" | "type" | "fullWidth" | 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" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "href" | "size" | "startIcon" | "variant" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "onAction"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1,81 +0,0 @@
1
- import { Button, CircularProgress } from '@mui/material';
2
- import React from 'react';
3
- /**
4
- * Countdown button
5
- * @param props Props
6
- * @returns Button
7
- */
8
- export const CountdownButton = React.forwardRef((props, ref) => {
9
- // Destructure
10
- const { onAction, onClick, ...rest } = props;
11
- // State
12
- // 0 - normal
13
- // 1 - loading
14
- // 2 - countdown
15
- const [state, updateState] = React.useState(0);
16
- // Ignore seconds
17
- const seconds = 2;
18
- // Countdown length
19
- const [shared] = React.useState({ maxLength: 0 });
20
- const isMounted = React.useRef(true);
21
- // endIcon
22
- let endIcon;
23
- if (state === 0) {
24
- endIcon = undefined;
25
- }
26
- else if (state === 1) {
27
- endIcon = React.createElement(CircularProgress, { size: 12 });
28
- }
29
- else {
30
- const countdown = (state - seconds)
31
- .toString()
32
- .padStart(shared.maxLength, '0');
33
- endIcon = React.createElement("span", { style: { fontSize: 'smaller' } }, countdown);
34
- }
35
- // Disabled?
36
- const disabled = state > 0;
37
- // Action
38
- const doAction = (result) => {
39
- // Seconds to wait, 120
40
- if (result > seconds) {
41
- // Here 122
42
- result += seconds;
43
- updateState(result);
44
- // Update max length
45
- shared.maxLength = result.toString().length;
46
- const seed = setInterval(() => {
47
- // Mounted?
48
- if (!isMounted.current)
49
- return;
50
- // Last 1 second and then complete
51
- if (result > seconds + 1) {
52
- result--;
53
- updateState(result);
54
- }
55
- else {
56
- clearInterval(seed);
57
- updateState(0);
58
- }
59
- }, 1000);
60
- }
61
- else {
62
- updateState(0);
63
- }
64
- };
65
- // Local click
66
- const localClick = (event) => {
67
- // Show loading
68
- updateState(1);
69
- // Callback
70
- if (onClick != null)
71
- onClick(event);
72
- // Return any countdown
73
- onAction().then(doAction);
74
- };
75
- React.useEffect(() => {
76
- return () => {
77
- isMounted.current = false;
78
- };
79
- }, []);
80
- return (React.createElement(Button, { disabled: disabled, endIcon: endIcon, onClick: localClick, ref: ref, ...rest }));
81
- });
@@ -1,27 +0,0 @@
1
- import { FabPropsColorOverrides, PropTypes } from '@mui/material';
2
- import { OverridableStringUnion } from '@mui/types';
3
- /**
4
- * Custom fab size
5
- */
6
- export declare type CustomFabSize = 'small' | 'medium' | 'large';
7
- /**
8
- * Custom fab props
9
- */
10
- export interface CustomFabProps {
11
- /**
12
- * Color
13
- */
14
- color?: OverridableStringUnion<PropTypes.Color, FabPropsColorOverrides>;
15
- /**
16
- * Fab size
17
- */
18
- size?: CustomFabSize;
19
- /**
20
- * Scroll target
21
- */
22
- target?: any;
23
- /**
24
- * Fab title
25
- */
26
- title?: string;
27
- }
@@ -1 +0,0 @@
1
- export {};