ish-ui 1.0.16 → 1.0.18

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 (223) hide show
  1. package/README.md +6 -6
  2. package/dist/Demo.d.ts +4 -0
  3. package/dist/Demo.js +41 -0
  4. package/dist/DemoField.d.ts +3 -0
  5. package/dist/DemoField.js +87 -0
  6. package/dist/actions/FieldProcessing.d.ts +10 -0
  7. package/dist/actions/FieldProcessing.js +17 -0
  8. package/dist/actions/index.d.ts +1 -0
  9. package/dist/actions/index.js +8 -0
  10. package/dist/appBar/AppBarHelpMenu.d.ts +3 -0
  11. package/dist/appBar/AppBarHelpMenu.js +77 -0
  12. package/dist/appBar/index.d.ts +2 -0
  13. package/dist/appBar/index.js +9 -0
  14. package/dist/buttons/AddButton.d.ts +14 -0
  15. package/dist/buttons/AddButton.js +9 -0
  16. package/dist/buttons/TimetableButton.d.ts +3 -0
  17. package/dist/buttons/TimetableButton.js +12 -0
  18. package/dist/buttons/index.d.ts +4 -0
  19. package/dist/buttons/index.js +11 -0
  20. package/dist/colorPicker/ColorPicker.d.ts +11 -0
  21. package/dist/colorPicker/ColorPicker.js +132 -0
  22. package/dist/colorPicker/index.d.ts +2 -0
  23. package/dist/colorPicker/index.js +9 -0
  24. package/dist/dev.d.ts +1 -0
  25. package/dist/dev.js +9 -0
  26. package/dist/dialog/BrowserWarning.d.ts +3 -0
  27. package/dist/dialog/BrowserWarning.js +16 -0
  28. package/dist/dialog/confirm/ConfirmBase.d.ts +7 -0
  29. package/dist/dialog/confirm/ConfirmBase.js +29 -0
  30. package/dist/dialog/index.d.ts +5 -0
  31. package/dist/dialog/index.js +12 -0
  32. package/dist/dialog/message/Message.d.ts +3 -0
  33. package/dist/dialog/message/Message.js +91 -0
  34. package/dist/documents/DocumentIconsChooser.d.ts +3 -0
  35. package/dist/documents/DocumentIconsChooser.js +51 -0
  36. package/dist/documents/index.d.ts +3 -0
  37. package/dist/documents/index.js +10 -0
  38. package/dist/documents/utils/index.d.ts +7 -0
  39. package/dist/documents/utils/index.js +61 -0
  40. package/dist/dynamicSizeList/DynamicSizeList.d.ts +17 -0
  41. package/dist/dynamicSizeList/DynamicSizeList.js +167 -0
  42. package/dist/dynamicSizeList/index.d.ts +2 -0
  43. package/dist/dynamicSizeList/index.js +9 -0
  44. package/dist/fieldMessage/ErrorMessage.d.ts +8 -0
  45. package/dist/fieldMessage/ErrorMessage.js +14 -0
  46. package/dist/fieldMessage/WarningMessage.d.ts +8 -0
  47. package/dist/fieldMessage/WarningMessage.js +14 -0
  48. package/dist/fieldMessage/index.d.ts +6 -0
  49. package/dist/fieldMessage/index.js +13 -0
  50. package/dist/fieldMessage/styles.d.ts +3 -0
  51. package/dist/fieldMessage/styles.js +18 -0
  52. package/dist/fileUploader/FileUploaderDialog.d.ts +15 -0
  53. package/dist/fileUploader/FileUploaderDialog.js +99 -0
  54. package/dist/fileUploader/index.d.ts +2 -0
  55. package/dist/fileUploader/index.js +9 -0
  56. package/dist/formFields/CheckboxField.d.ts +7 -0
  57. package/dist/formFields/CheckboxField.js +67 -0
  58. package/dist/formFields/CodeEditorField.d.ts +6 -0
  59. package/dist/formFields/CodeEditorField.js +69 -0
  60. package/dist/formFields/ColoredCheckBox.d.ts +3 -0
  61. package/dist/formFields/ColoredCheckBox.js +41 -0
  62. package/dist/formFields/DateTimeField.d.ts +2 -0
  63. package/dist/formFields/DateTimeField.js +27 -0
  64. package/dist/formFields/EditInPlaceDateTimeField.d.ts +10 -0
  65. package/dist/formFields/EditInPlaceDateTimeField.js +188 -0
  66. package/dist/formFields/EditInPlaceDurationField.d.ts +4 -0
  67. package/dist/formFields/EditInPlaceDurationField.js +63 -0
  68. package/dist/formFields/EditInPlaceField.d.ts +10 -0
  69. package/dist/formFields/EditInPlaceField.js +58 -0
  70. package/dist/formFields/EditInPlaceFieldBase.d.ts +28 -0
  71. package/dist/formFields/EditInPlaceFieldBase.js +123 -0
  72. package/dist/formFields/EditInPlaceFileField.d.ts +7 -0
  73. package/dist/formFields/EditInPlaceFileField.js +60 -0
  74. package/dist/formFields/EditInPlaceMoneyField.d.ts +9 -0
  75. package/dist/formFields/EditInPlaceMoneyField.js +37 -0
  76. package/dist/formFields/EditInPlacePhoneField.d.ts +4 -0
  77. package/dist/formFields/EditInPlacePhoneField.js +69 -0
  78. package/dist/formFields/EditInPlaceSearchSelect.d.ts +4 -0
  79. package/dist/formFields/EditInPlaceSearchSelect.js +321 -0
  80. package/dist/formFields/FieldAdornments.d.ts +13 -0
  81. package/dist/formFields/FieldAdornments.js +27 -0
  82. package/dist/formFields/FilePreview.d.ts +17 -0
  83. package/dist/formFields/FilePreview.js +77 -0
  84. package/dist/formFields/FormRadioButtons.d.ts +3 -0
  85. package/dist/formFields/FormRadioButtons.js +27 -0
  86. package/dist/formFields/SelectCustomComponents.d.ts +5 -0
  87. package/dist/formFields/SelectCustomComponents.js +182 -0
  88. package/dist/formFields/Switch.d.ts +7 -0
  89. package/dist/formFields/Switch.js +116 -0
  90. package/dist/formFields/TextField.d.ts +6 -0
  91. package/dist/formFields/TextField.js +42 -0
  92. package/dist/formFields/UneditableBase.d.ts +17 -0
  93. package/dist/formFields/UneditableBase.js +48 -0
  94. package/dist/formFields/index.d.ts +31 -0
  95. package/dist/formFields/index.js +38 -0
  96. package/dist/index.d.ts +18 -0
  97. package/dist/index.js +25 -0
  98. package/dist/layout/InfoPill.d.ts +7 -0
  99. package/dist/layout/InfoPill.js +26 -0
  100. package/dist/layout/index.d.ts +4 -0
  101. package/dist/layout/index.js +11 -0
  102. package/dist/layout/resizable/ResizableWrapper.d.ts +14 -0
  103. package/dist/layout/resizable/ResizableWrapper.js +42 -0
  104. package/dist/markdownEditor/HtmlEditor.d.ts +15 -0
  105. package/dist/markdownEditor/HtmlEditor.js +18 -0
  106. package/dist/markdownEditor/WysiwygEditor.d.ts +8 -0
  107. package/dist/markdownEditor/WysiwygEditor.js +98 -0
  108. package/dist/markdownEditor/index.d.ts +5 -0
  109. package/dist/markdownEditor/index.js +12 -0
  110. package/dist/markdownEditor/utils/index.d.ts +9 -0
  111. package/dist/markdownEditor/utils/index.js +38 -0
  112. package/dist/model/AppBar.d.ts +11 -0
  113. package/dist/model/AppBar.js +8 -0
  114. package/dist/model/CommomObjects.d.ts +5 -0
  115. package/dist/model/CommomObjects.js +1 -0
  116. package/dist/model/CommonFunctions.d.ts +8 -0
  117. package/dist/model/CommonFunctions.js +5 -0
  118. package/dist/model/Confirm.d.ts +16 -0
  119. package/dist/model/Confirm.js +8 -0
  120. package/dist/model/Fields.d.ts +250 -0
  121. package/dist/model/Fields.js +8 -0
  122. package/dist/model/NestedEntity.d.ts +9 -0
  123. package/dist/model/NestedEntity.js +5 -0
  124. package/dist/model/Theme.d.ts +34 -0
  125. package/dist/model/Theme.js +18 -0
  126. package/dist/model/index.d.ts +7 -0
  127. package/dist/model/index.js +14 -0
  128. package/dist/styles/GlobalStylesProvider.d.ts +3 -0
  129. package/dist/styles/GlobalStylesProvider.js +417 -0
  130. package/dist/styles/StylesProviderCustom.d.ts +3 -0
  131. package/dist/styles/StylesProviderCustom.js +6 -0
  132. package/dist/styles/animateStyles.d.ts +3 -0
  133. package/dist/styles/animateStyles.js +33 -0
  134. package/dist/styles/bootstrap.d.ts +491 -0
  135. package/dist/styles/bootstrap.js +496 -0
  136. package/dist/styles/hooks.d.ts +6 -0
  137. package/dist/styles/hooks.js +38 -0
  138. package/dist/styles/index.d.ts +11 -0
  139. package/dist/styles/index.js +18 -0
  140. package/dist/styles/makeStyles.d.ts +3 -0
  141. package/dist/styles/makeStyles.js +9 -0
  142. package/dist/styles/mixins/common.d.ts +8 -0
  143. package/dist/styles/mixins/common.js +32 -0
  144. package/dist/styles/mixins/keyframes.d.ts +3 -0
  145. package/dist/styles/mixins/keyframes.js +9 -0
  146. package/dist/styles/mixins/prefixer.d.ts +1 -0
  147. package/dist/styles/mixins/prefixer.js +23 -0
  148. package/dist/tagsInput/AddTagMenu.d.ts +12 -0
  149. package/dist/tagsInput/AddTagMenu.js +36 -0
  150. package/dist/tagsInput/AddTagMenuItem.d.ts +11 -0
  151. package/dist/tagsInput/AddTagMenuItem.js +29 -0
  152. package/dist/tagsInput/TagInputList.d.ts +4 -0
  153. package/dist/tagsInput/TagInputList.js +273 -0
  154. package/dist/tagsInput/index.d.ts +6 -0
  155. package/dist/tagsInput/index.js +6 -0
  156. package/dist/themes/appTheme.d.ts +4 -0
  157. package/dist/themes/appTheme.js +322 -0
  158. package/dist/themes/index.d.ts +2 -0
  159. package/dist/themes/index.js +9 -0
  160. package/dist/themes/ishTheme.d.ts +8 -0
  161. package/dist/themes/ishTheme.js +351 -0
  162. package/dist/timetable/datePeriodFilter/DayPeriodIcons.d.ts +8 -0
  163. package/dist/timetable/datePeriodFilter/DayPeriodIcons.js +27 -0
  164. package/dist/timetable/datePeriodFilter/index.d.ts +1 -0
  165. package/dist/timetable/datePeriodFilter/index.js +8 -0
  166. package/dist/timetable/index.d.ts +2 -0
  167. package/dist/timetable/index.js +9 -0
  168. package/dist/timetable/miniCalendar/CalendarDay.d.ts +15 -0
  169. package/dist/timetable/miniCalendar/CalendarDay.js +64 -0
  170. package/dist/timetable/miniCalendar/CalendarHeader.d.ts +10 -0
  171. package/dist/timetable/miniCalendar/CalendarHeader.js +22 -0
  172. package/dist/timetable/miniCalendar/CalendarWeekPanel.d.ts +8 -0
  173. package/dist/timetable/miniCalendar/CalendarWeekPanel.js +18 -0
  174. package/dist/timetable/miniCalendar/WeekDay.d.ts +10 -0
  175. package/dist/timetable/miniCalendar/WeekDay.js +25 -0
  176. package/dist/timetable/miniCalendar/index.d.ts +8 -0
  177. package/dist/timetable/miniCalendar/index.js +15 -0
  178. package/dist/utils/DOM/Links.d.ts +1 -0
  179. package/dist/utils/DOM/Links.js +12 -0
  180. package/dist/utils/DOM/getCaretCoordinates.d.ts +6 -0
  181. package/dist/utils/DOM/getCaretCoordinates.js +109 -0
  182. package/dist/utils/DOM/getOS.d.ts +2 -0
  183. package/dist/utils/DOM/getOS.js +32 -0
  184. package/dist/utils/DOM/index.d.ts +5 -0
  185. package/dist/utils/DOM/index.js +32 -0
  186. package/dist/utils/dates/datesNormalizing.d.ts +1 -0
  187. package/dist/utils/dates/datesNormalizing.js +3 -0
  188. package/dist/utils/dates/format.d.ts +24 -0
  189. package/dist/utils/dates/format.js +28 -0
  190. package/dist/utils/dates/formatRelative.d.ts +1 -0
  191. package/dist/utils/dates/formatRelative.js +14 -0
  192. package/dist/utils/dates/formatString.d.ts +2 -0
  193. package/dist/utils/dates/formatString.js +195 -0
  194. package/dist/utils/dates/formatTimezone.d.ts +2 -0
  195. package/dist/utils/dates/formatTimezone.js +35 -0
  196. package/dist/utils/dates/index.d.ts +6 -0
  197. package/dist/utils/dates/index.js +13 -0
  198. package/dist/utils/dates/timetable.d.ts +5 -0
  199. package/dist/utils/dates/timetable.js +38 -0
  200. package/dist/utils/events/index.d.ts +2 -0
  201. package/dist/utils/events/index.js +6 -0
  202. package/dist/utils/fields/index.d.ts +1 -0
  203. package/dist/utils/fields/index.js +20 -0
  204. package/dist/utils/formatting/PhoneMasks.d.ts +304 -0
  205. package/dist/utils/formatting/PhoneMasks.js +318 -0
  206. package/dist/utils/formatting/index.d.ts +2 -0
  207. package/dist/utils/formatting/index.js +10 -0
  208. package/dist/utils/hooks/index.d.ts +1 -0
  209. package/dist/utils/hooks/index.js +15 -0
  210. package/dist/utils/index.d.ts +9 -0
  211. package/dist/utils/index.js +16 -0
  212. package/dist/utils/numbers/decimalCalculation.d.ts +4 -0
  213. package/dist/utils/numbers/decimalCalculation.js +21 -0
  214. package/dist/utils/numbers/index.d.ts +2 -0
  215. package/dist/utils/numbers/index.js +9 -0
  216. package/dist/utils/numbers/numbersNormalizing.d.ts +10 -0
  217. package/dist/utils/numbers/numbersNormalizing.js +44 -0
  218. package/dist/utils/stubs/index.d.ts +3 -0
  219. package/dist/utils/stubs/index.js +10 -0
  220. package/dist/utils/tags/index.d.ts +3 -0
  221. package/dist/utils/tags/index.js +42 -0
  222. package/package.json +1 -1
  223. package/ish-ui.iml +0 -8
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ export * from './message/Message';
9
+ export * from './confirm/ConfirmBase';
10
+ export * from './BrowserWarning';
11
+ export { default as Message } from './message/Message';
12
+ export { default as ConfirmBase } from './confirm/ConfirmBase';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.JSXElementConstructor<Omit<any, "classes"> & (import("@mui/styles").StyledComponentProps<any> | (import("@mui/styles").StyledComponentProps<any> & object))>;
3
+ export default _default;
@@ -0,0 +1,91 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import React from 'react';
6
+ import clsx from 'clsx';
7
+ import { withStyles } from '@mui/styles';
8
+ import Snackbar from '@mui/material/Snackbar';
9
+ import IconButton from '@mui/material/IconButton';
10
+ import Alert from '@mui/material/Alert';
11
+ import CloseIcon from '@mui/icons-material/Close';
12
+ const styles = theme => ({
13
+ close: {
14
+ color: theme.palette.primary.contrastText,
15
+ width: theme.spacing(4),
16
+ height: theme.spacing(4),
17
+ padding: theme.spacing(0.5)
18
+ },
19
+ success: {
20
+ maxWidth: 'unset'
21
+ },
22
+ autoWidth: {
23
+ [theme.breakpoints.down('md')]: {
24
+ flexGrow: 'unset',
25
+ borderRadius: `${theme.shape.borderRadius}px`
26
+ }
27
+ },
28
+ autoWidthRoot: {
29
+ [theme.breakpoints.down('md')]: {
30
+ left: '24px',
31
+ right: 'auto',
32
+ bottom: '24px'
33
+ }
34
+ },
35
+ fullScreenMessage: {
36
+ maxHeight: 'calc(100vh - 90px)',
37
+ overflow: 'auto',
38
+ marginRight: theme.spacing(-2),
39
+ paddingRight: theme.spacing(2)
40
+ }
41
+ });
42
+ class Message extends React.Component {
43
+ constructor(props) {
44
+ super(props);
45
+ this.handleClose = () => {
46
+ if (!this.state.persist) {
47
+ this.props.clearMessage();
48
+ }
49
+ };
50
+ this.state = {
51
+ success: props.isSuccess,
52
+ text: props.text,
53
+ persist: props.persist
54
+ };
55
+ }
56
+ componentDidUpdate(prevProps) {
57
+ if (this.props.opened !== prevProps.opened) {
58
+ this.setState({
59
+ success: this.props.opened ? this.props.isSuccess : this.state.success,
60
+ text: this.props.opened ? this.props.text : this.state.text,
61
+ persist: this.props.opened ? this.props.persist : this.state.persist
62
+ });
63
+ }
64
+ }
65
+ render() {
66
+ const { classes, opened, clearMessage } = this.props;
67
+ const { success, text, persist } = this.state;
68
+ return (React.createElement(Snackbar, { open: opened, anchorOrigin: {
69
+ vertical: 'bottom',
70
+ horizontal: 'left'
71
+ }, classes: {
72
+ root: classes.autoWidthRoot
73
+ }, ContentProps: {
74
+ classes: {
75
+ root: clsx(classes.autoWidth, {
76
+ [classes.success]: success
77
+ }),
78
+ message: persist ? classes.fullScreenMessage : undefined
79
+ }
80
+ }, ClickAwayListenerProps: {
81
+ onClickAway: this.handleClose
82
+ }, autoHideDuration: persist ? null : 6000, onClose: this.handleClose, disableWindowBlurListener: persist },
83
+ React.createElement(Alert, { variant: "filled", severity: success ? 'success' : 'error', classes: {
84
+ message: 'text-pre-wrap',
85
+ standardError: 'errorBackgroundColor',
86
+ standardSuccess: 'successBackgroundColor'
87
+ }, action: (React.createElement(IconButton, { key: "close", "aria-label": "Close", color: "inherit", className: classes.close, onClick: clearMessage },
88
+ React.createElement(CloseIcon, null))) }, text)));
89
+ }
90
+ }
91
+ export default withStyles(styles)(Message);
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"preview" | "previewNormal" | "previewHoverIcon" | "previewHoverImage">>;
3
+ export default _default;
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ import * as React from 'react';
9
+ import createStyles from '@mui/styles/createStyles';
10
+ import withStyles from '@mui/styles/withStyles';
11
+ import clsx from 'clsx';
12
+ import { FileTypeIcon } from './utils';
13
+ const styles = theme => createStyles({
14
+ preview: {
15
+ backgroundSize: 'cover',
16
+ width: '36px',
17
+ height: '48px',
18
+ borderRadius: '4px',
19
+ marginRight: '16px',
20
+ color: 'rgba(0,0,0,.2)',
21
+ transition: 'color 200ms ease-in-out',
22
+ backgroundPosition: 'center'
23
+ },
24
+ previewNormal: {
25
+ width: '60px',
26
+ height: 'calc(100% - 16px)'
27
+ },
28
+ previewHoverIcon: {
29
+ '&:hover': {
30
+ color: theme.palette.primary.main
31
+ }
32
+ },
33
+ previewHoverImage: {
34
+ '&:hover': {
35
+ boxShadow: `0 0 1px 1px ${theme.palette.primary.main}`
36
+ }
37
+ }
38
+ });
39
+ const DocumentIconsChooser = props => {
40
+ const { type, thumbnail, classes, hovered = true, isHeader } = props;
41
+ return thumbnail ? (React.createElement("div", { style: {
42
+ backgroundImage: `url(data:image;base64,${thumbnail})`
43
+ }, className: clsx(classes.preview, {
44
+ [classes.previewHoverImage]: hovered,
45
+ [classes.previewNormal]: isHeader
46
+ }) })) : (React.createElement("div", { className: clsx(classes.preview, {
47
+ [classes.previewHoverIcon]: hovered
48
+ }) },
49
+ React.createElement(FileTypeIcon, { mimeType: type })));
50
+ };
51
+ export default withStyles(styles)(DocumentIconsChooser);
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './DocumentIconsChooser';
3
+ export { default as DocumentIconsChooser } from './DocumentIconsChooser';
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ export * from './utils';
9
+ export * from './DocumentIconsChooser';
10
+ export { default as DocumentIconsChooser } from './DocumentIconsChooser';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare const formatDocumentSize: (size: number) => string;
3
+ export declare const getDocumentContent: (file: File) => Promise<string>;
4
+ export declare const getDocumentThumbnail: (file: File) => Promise<string>;
5
+ export declare const FileTypeIcon: ({ mimeType }: {
6
+ mimeType: any;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2022.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ import React from 'react';
9
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
10
+ export const formatDocumentSize = (size) => {
11
+ if (size < Math.pow(1024, 2)) {
12
+ return `${Math.round(size / 1024)} kb`;
13
+ }
14
+ if (size < Math.pow(1024, 3)) {
15
+ return `${Math.round(size / 1024 / 1024)} Mb`;
16
+ }
17
+ if (size < Math.pow(1024, 4)) {
18
+ return `${Math.round(size / 1024 / 1024 / 1024)} Gb`;
19
+ }
20
+ return size.toString();
21
+ };
22
+ export const getDocumentContent = (file) => {
23
+ const reader = new FileReader();
24
+ return new Promise(resolve => {
25
+ reader.onload = () => resolve(reader.result);
26
+ reader.readAsDataURL(file);
27
+ }).then((result) => result.replace(`data:${file.type};base64,`, ''));
28
+ };
29
+ export const getDocumentThumbnail = (file) => {
30
+ if (file.type.match(/image/)) {
31
+ return getDocumentContent(file);
32
+ }
33
+ return new Promise(resolve => resolve(''));
34
+ };
35
+ const getIcon = type => {
36
+ switch (type) {
37
+ case 'image/tiff':
38
+ case 'image/bmp':
39
+ case 'image/png':
40
+ case 'image/gif':
41
+ case 'image/jpeg':
42
+ return 'file-image';
43
+ case 'application/pdf':
44
+ return 'file-pdf';
45
+ case 'application/msword':
46
+ return 'file-word';
47
+ case 'application/vnd.ms-excel':
48
+ return 'file-excel';
49
+ case 'application/vnd.ms-powerpoint':
50
+ return 'file-powerpoint';
51
+ case 'application/zip':
52
+ return 'file-archive';
53
+ case 'application/x-gzip':
54
+ return 'file-archive';
55
+ case 'application/txt':
56
+ return 'file-alt';
57
+ default:
58
+ return 'file';
59
+ }
60
+ };
61
+ export const FileTypeIcon = ({ mimeType }) => React.createElement(FontAwesomeIcon, { icon: getIcon(mimeType), fixedWidth: true, className: "w-100 h-100" });
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { VariableSizeListProps } from 'react-window';
3
+ interface Props extends Omit<VariableSizeListProps, 'itemSize'> {
4
+ listRef?: any;
5
+ }
6
+ declare class DynamicSizeList extends React.Component<Props> {
7
+ listRef: React.RefObject<any>;
8
+ rowSizes: any[];
9
+ componentDidMount(): void;
10
+ attachRefs: (node: any) => void;
11
+ render(): React.JSX.Element;
12
+ scrollToItem(index: any, align: any): void;
13
+ renderItem: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
14
+ handleNewMeasurements: (index: any, newSize: any) => void;
15
+ getItemSize: (index: any) => any;
16
+ }
17
+ export default DynamicSizeList;
@@ -0,0 +1,167 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2022.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ var __rest = (this && this.__rest) || function (s, e) {
9
+ var t = {};
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
11
+ t[p] = s[p];
12
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
13
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
14
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
15
+ t[p[i]] = s[p[i]];
16
+ }
17
+ return t;
18
+ };
19
+ import React from 'react';
20
+ import { VariableSizeList } from 'react-window';
21
+ class ItemMeasurer extends React.Component {
22
+ constructor() {
23
+ super(...arguments);
24
+ this._node = null;
25
+ this._resizeObserver = null;
26
+ this._measureItem = () => {
27
+ const { handleNewMeasurements, index } = this.props;
28
+ const node = this._node;
29
+ if (node) {
30
+ const { height, width } = node.getBoundingClientRect();
31
+ const isVisible = height > 0 || width > 0;
32
+ if (isVisible) {
33
+ const newSize = Math.ceil(height);
34
+ handleNewMeasurements(index, newSize);
35
+ }
36
+ }
37
+ };
38
+ this._refSetter = ref => {
39
+ if (this._resizeObserver !== null && this._node !== null) {
40
+ this._resizeObserver.unobserve(this._node);
41
+ }
42
+ if (ref) {
43
+ this._node = ref;
44
+ }
45
+ else {
46
+ this._node = null;
47
+ }
48
+ if (this._resizeObserver !== null && this._node !== null) {
49
+ this._resizeObserver.observe(this._node);
50
+ }
51
+ };
52
+ this._onResize = entries => {
53
+ const _this = this;
54
+ window.requestAnimationFrame(() => {
55
+ if (!Array.isArray(entries) || !entries.length) {
56
+ return;
57
+ }
58
+ _this._measureItem();
59
+ });
60
+ };
61
+ }
62
+ componentDidMount() {
63
+ this._measureItem();
64
+ // @ts-ignore
65
+ if (typeof window.ResizeObserver !== 'undefined') {
66
+ // @ts-ignore
67
+ this._resizeObserver = new window.ResizeObserver(this._onResize);
68
+ if (this._node !== null) {
69
+ this._resizeObserver.observe(this._node);
70
+ }
71
+ }
72
+ else {
73
+ //
74
+ }
75
+ }
76
+ componentWillUnmount() {
77
+ if (this._resizeObserver !== null) {
78
+ this._resizeObserver.disconnect();
79
+ this._resizeObserver = null;
80
+ }
81
+ }
82
+ render() {
83
+ return React.cloneElement(this.props.item, {
84
+ ref: this._refSetter
85
+ });
86
+ }
87
+ }
88
+ class DynamicSizeList extends React.Component {
89
+ constructor() {
90
+ super(...arguments);
91
+ this.listRef = React.createRef();
92
+ this.rowSizes = [];
93
+ this.attachRefs = node => {
94
+ const { listRef } = this.props;
95
+ if (node) {
96
+ if (!this.listRef.current) {
97
+ // @ts-ignore
98
+ this.listRef.current = node;
99
+ }
100
+ if (typeof listRef === 'function') {
101
+ listRef(node);
102
+ }
103
+ if (typeof listRef === 'object') {
104
+ listRef.current = node;
105
+ }
106
+ }
107
+ };
108
+ this.renderItem = props => {
109
+ // clear height
110
+ if (props.style.height !== undefined) {
111
+ props.style.height = undefined;
112
+ }
113
+ return React.createElement(ItemMeasurer, {
114
+ index: props.index,
115
+ // @ts-ignore
116
+ item: React.createElement(this.props.children, props),
117
+ handleNewMeasurements: this.handleNewMeasurements
118
+ });
119
+ };
120
+ this.handleNewMeasurements = (index, newSize) => {
121
+ const itemSizeDelta = newSize - this.getItemSize(index);
122
+ if (itemSizeDelta !== 0) {
123
+ this.rowSizes[index] = newSize;
124
+ const ref = this.listRef.current;
125
+ if (ref) {
126
+ const { isScrolling, scrollDirection } = ref.state;
127
+ if (isScrolling && scrollDirection === 'backward') {
128
+ ref._outerRef.scrollBy({
129
+ top: itemSizeDelta,
130
+ left: 0,
131
+ behavior: 'auto'
132
+ });
133
+ }
134
+ ref.resetAfterIndex(index, true);
135
+ }
136
+ }
137
+ };
138
+ this.getItemSize = index => {
139
+ // https://react-window.now.sh/#/api/VariableSizeList
140
+ const defaultEstimatedItemSize = 50;
141
+ return (this.rowSizes[index]
142
+ || this.props.estimatedItemSize
143
+ || defaultEstimatedItemSize);
144
+ };
145
+ }
146
+ componentDidMount() {
147
+ const ref = this.listRef.current;
148
+ if (ref) {
149
+ ref.resetAfterIndex(0, true);
150
+ }
151
+ }
152
+ render() {
153
+ const _a = this.props, { children } = _a, rest = __rest(_a, ["children"]);
154
+ return (React.createElement(VariableSizeList, Object.assign({}, rest, { ref: this.attachRefs, itemSize: this.getItemSize }), this.renderItem));
155
+ }
156
+ scrollToItem(index, align) {
157
+ const ref = this.listRef.current;
158
+ if (ref) {
159
+ ref.scrollToItem(index, align);
160
+ //
161
+ window.requestAnimationFrame(() => {
162
+ ref.scrollToItem(index, align);
163
+ });
164
+ }
165
+ }
166
+ }
167
+ export default DynamicSizeList;
@@ -0,0 +1,2 @@
1
+ export * from './DynamicSizeList';
2
+ export { default as DynamicSizeList } from './DynamicSizeList';
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ export * from './DynamicSizeList';
9
+ export { default as DynamicSizeList } from './DynamicSizeList';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ classes?: any;
4
+ className?: string;
5
+ message: string;
6
+ }
7
+ declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"root" | "icon">>;
8
+ export default _default;
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import React from 'react';
6
+ import Error from '@mui/icons-material/Error';
7
+ import Typography from '@mui/material/Typography';
8
+ import withStyles from '@mui/styles/withStyles';
9
+ import clsx from 'clsx';
10
+ import styles from './styles';
11
+ const ErrorMessage = ({ classes, className, message }) => (React.createElement("div", { className: clsx(classes.root, className) },
12
+ React.createElement(Error, { color: "error", className: classes.icon }),
13
+ React.createElement(Typography, { variant: "caption", className: "errorColor" }, message)));
14
+ export default withStyles(styles)(ErrorMessage);
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ classes?: any;
4
+ className?: string;
5
+ warning: string;
6
+ }
7
+ declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"root" | "icon">>;
8
+ export default _default;
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import React from 'react';
6
+ import Warning from '@mui/icons-material/Warning';
7
+ import Typography from '@mui/material/Typography';
8
+ import withStyles from '@mui/styles/withStyles';
9
+ import clsx from 'clsx';
10
+ import styles from './styles';
11
+ const WarningMessage = ({ classes, className, warning }) => (React.createElement("div", { className: clsx(classes.root, className) },
12
+ React.createElement(Warning, { className: clsx(classes.icon, 'warningColor') }),
13
+ React.createElement(Typography, { variant: "caption", className: "warningColor" }, warning)));
14
+ export default withStyles(styles)(WarningMessage);
@@ -0,0 +1,6 @@
1
+ export * from './styles';
2
+ export * from './ErrorMessage';
3
+ export * from './WarningMessage';
4
+ export { default as styles } from './styles';
5
+ export { default as ErrorMessage } from './ErrorMessage';
6
+ export { default as WarningMessage } from './WarningMessage';
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ export * from './styles';
9
+ export * from './ErrorMessage';
10
+ export * from './WarningMessage';
11
+ export { default as styles } from './styles';
12
+ export { default as ErrorMessage } from './ErrorMessage';
13
+ export { default as WarningMessage } from './WarningMessage';
@@ -0,0 +1,3 @@
1
+ import { AppTheme } from '../model';
2
+ declare const _default: (theme: AppTheme) => import("@mui/styles").StyleRules<{}, "root" | "icon">;
3
+ export default _default;
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+ import { createStyles } from '@mui/styles';
6
+ export default (theme) => createStyles({
7
+ root: {
8
+ marginTop: `-${theme.spacing(1)}`,
9
+ // @ts-ignore
10
+ paddingBottom: `${theme.spacing(2) - 3}`,
11
+ },
12
+ icon: {
13
+ fontSize: theme.spacing(2),
14
+ display: 'inline-block',
15
+ verticalAlign: 'middle',
16
+ marginRight: theme.spacing(0.5),
17
+ }
18
+ });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ fileRef?: any;
4
+ classes?: any;
5
+ opened?: boolean;
6
+ backdropEnabled?: boolean;
7
+ dialog?: boolean;
8
+ onChange?: (acceptedfiles: any[], fileRejections: any[]) => void;
9
+ disabled?: boolean;
10
+ accept?: string | string[];
11
+ onClose?: () => void;
12
+ isBackdropDragging?: boolean;
13
+ }
14
+ declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles").StyledComponentProps<never>>;
15
+ export default _default;