ish-ui 1.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -0
- package/assets/fonts/inter/Inter-Italic.var.woff2 +0 -0
- package/assets/fonts/inter/Inter-Roman.var.woff2 +0 -0
- package/assets/fonts/inter/LICENSE.txt +92 -0
- package/assets/fonts/inter/index.d.ts +10 -0
- package/assets/fonts/inter/inter.scss +17 -0
- package/dist/actions/FieldProcessing.d.ts +10 -0
- package/dist/actions/FieldProcessing.js +17 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +8 -0
- package/dist/appBar/AppBarHelpMenu.d.ts +3 -0
- package/dist/appBar/AppBarHelpMenu.js +77 -0
- package/dist/appBar/index.d.ts +2 -0
- package/dist/appBar/index.js +9 -0
- package/dist/buttons/AddButton.d.ts +14 -0
- package/dist/buttons/AddButton.js +9 -0
- package/dist/buttons/TimetableButton.d.ts +3 -0
- package/dist/buttons/TimetableButton.js +12 -0
- package/dist/buttons/index.d.ts +4 -0
- package/dist/buttons/index.js +11 -0
- package/dist/colorPicker/ColorPicker.d.ts +11 -0
- package/dist/colorPicker/ColorPicker.js +132 -0
- package/dist/colorPicker/index.d.ts +2 -0
- package/dist/colorPicker/index.js +9 -0
- package/dist/dialog/BrowserWarning.d.ts +3 -0
- package/dist/dialog/BrowserWarning.js +16 -0
- package/dist/dialog/confirm/ConfirmBase.d.ts +7 -0
- package/dist/dialog/confirm/ConfirmBase.js +29 -0
- package/dist/dialog/index.d.ts +5 -0
- package/dist/dialog/index.js +12 -0
- package/dist/dialog/message/Message.d.ts +3 -0
- package/dist/dialog/message/Message.js +91 -0
- package/dist/documents/DocumentIconsChooser.d.ts +3 -0
- package/dist/documents/DocumentIconsChooser.js +51 -0
- package/dist/documents/index.d.ts +3 -0
- package/dist/documents/index.js +10 -0
- package/dist/documents/utils/index.d.ts +7 -0
- package/dist/documents/utils/index.js +61 -0
- package/dist/dynamicSizeList/DynamicSizeList.d.ts +21 -0
- package/dist/dynamicSizeList/DynamicSizeList.js +169 -0
- package/dist/dynamicSizeList/index.d.ts +2 -0
- package/dist/dynamicSizeList/index.js +9 -0
- package/dist/fieldMessage/ErrorMessage.d.ts +8 -0
- package/dist/fieldMessage/ErrorMessage.js +14 -0
- package/dist/fieldMessage/WarningMessage.d.ts +8 -0
- package/dist/fieldMessage/WarningMessage.js +14 -0
- package/dist/fieldMessage/index.d.ts +6 -0
- package/dist/fieldMessage/index.js +13 -0
- package/dist/fieldMessage/styles.d.ts +3 -0
- package/dist/fieldMessage/styles.js +18 -0
- package/dist/fileUploader/FileUploaderDialog.d.ts +15 -0
- package/dist/fileUploader/FileUploaderDialog.js +99 -0
- package/dist/fileUploader/index.d.ts +2 -0
- package/dist/fileUploader/index.js +9 -0
- package/dist/formFields/CheckboxField.d.ts +7 -0
- package/dist/formFields/CheckboxField.js +67 -0
- package/dist/formFields/CodeEditorField.d.ts +6 -0
- package/dist/formFields/CodeEditorField.js +69 -0
- package/dist/formFields/ColoredCheckBox.d.ts +3 -0
- package/dist/formFields/ColoredCheckBox.js +41 -0
- package/dist/formFields/DateTimeField.d.ts +2 -0
- package/dist/formFields/DateTimeField.js +27 -0
- package/dist/formFields/EditInPlaceDateTimeField.d.ts +10 -0
- package/dist/formFields/EditInPlaceDateTimeField.js +188 -0
- package/dist/formFields/EditInPlaceDurationField.d.ts +4 -0
- package/dist/formFields/EditInPlaceDurationField.js +63 -0
- package/dist/formFields/EditInPlaceField.d.ts +10 -0
- package/dist/formFields/EditInPlaceField.js +58 -0
- package/dist/formFields/EditInPlaceFieldBase.d.ts +28 -0
- package/dist/formFields/EditInPlaceFieldBase.js +123 -0
- package/dist/formFields/EditInPlaceFileField.d.ts +7 -0
- package/dist/formFields/EditInPlaceFileField.js +60 -0
- package/dist/formFields/EditInPlaceMoneyField.d.ts +9 -0
- package/dist/formFields/EditInPlaceMoneyField.js +37 -0
- package/dist/formFields/EditInPlacePhoneField.d.ts +4 -0
- package/dist/formFields/EditInPlacePhoneField.js +69 -0
- package/dist/formFields/EditInPlaceSearchSelect.d.ts +4 -0
- package/dist/formFields/EditInPlaceSearchSelect.js +321 -0
- package/dist/formFields/FieldAdornments.d.ts +13 -0
- package/dist/formFields/FieldAdornments.js +27 -0
- package/dist/formFields/FilePreview.d.ts +17 -0
- package/dist/formFields/FilePreview.js +77 -0
- package/dist/formFields/FormRadioButtons.d.ts +3 -0
- package/dist/formFields/FormRadioButtons.js +27 -0
- package/dist/formFields/SelectCustomComponents.d.ts +5 -0
- package/dist/formFields/SelectCustomComponents.js +182 -0
- package/dist/formFields/Switch.d.ts +7 -0
- package/dist/formFields/Switch.js +116 -0
- package/dist/formFields/TextField.d.ts +6 -0
- package/dist/formFields/TextField.js +42 -0
- package/dist/formFields/UneditableBase.d.ts +17 -0
- package/dist/formFields/UneditableBase.js +48 -0
- package/dist/formFields/index.d.ts +31 -0
- package/dist/formFields/index.js +38 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +25 -0
- package/dist/layout/InfoPill.d.ts +7 -0
- package/dist/layout/InfoPill.js +26 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +11 -0
- package/dist/layout/resizable/ResizableWrapper.d.ts +14 -0
- package/dist/layout/resizable/ResizableWrapper.js +42 -0
- package/dist/markdownEditor/HtmlEditor.d.ts +15 -0
- package/dist/markdownEditor/HtmlEditor.js +18 -0
- package/dist/markdownEditor/WysiwygEditor.d.ts +8 -0
- package/dist/markdownEditor/WysiwygEditor.js +100 -0
- package/dist/markdownEditor/index.d.ts +5 -0
- package/dist/markdownEditor/index.js +12 -0
- package/dist/markdownEditor/utils/index.d.ts +9 -0
- package/dist/markdownEditor/utils/index.js +38 -0
- package/dist/model/AppBar.d.ts +11 -0
- package/dist/model/AppBar.js +8 -0
- package/dist/model/CommomObjects.d.ts +5 -0
- package/dist/model/CommomObjects.js +1 -0
- package/dist/model/CommonFunctions.d.ts +8 -0
- package/dist/model/CommonFunctions.js +5 -0
- package/dist/model/Confirm.d.ts +16 -0
- package/dist/model/Confirm.js +8 -0
- package/dist/model/Fields.d.ts +250 -0
- package/dist/model/Fields.js +8 -0
- package/dist/model/NestedEntity.d.ts +9 -0
- package/dist/model/NestedEntity.js +5 -0
- package/dist/model/Theme.d.ts +34 -0
- package/dist/model/Theme.js +18 -0
- package/dist/model/index.d.ts +7 -0
- package/dist/model/index.js +14 -0
- package/dist/styles/GlobalStylesProvider.d.ts +3 -0
- package/dist/styles/GlobalStylesProvider.js +417 -0
- package/dist/styles/StylesProviderCustom.d.ts +3 -0
- package/dist/styles/StylesProviderCustom.js +6 -0
- package/dist/styles/animateStyles.d.ts +3 -0
- package/dist/styles/animateStyles.js +33 -0
- package/dist/styles/bootstrap.d.ts +491 -0
- package/dist/styles/bootstrap.js +496 -0
- package/dist/styles/hooks.d.ts +6 -0
- package/dist/styles/hooks.js +38 -0
- package/dist/styles/index.d.ts +11 -0
- package/dist/styles/index.js +18 -0
- package/dist/styles/makeStyles.d.ts +3 -0
- package/dist/styles/makeStyles.js +9 -0
- package/dist/styles/mixins/common.d.ts +8 -0
- package/dist/styles/mixins/common.js +32 -0
- package/dist/styles/mixins/keyframes.d.ts +3 -0
- package/dist/styles/mixins/keyframes.js +9 -0
- package/dist/styles/mixins/prefixer.d.ts +1 -0
- package/dist/styles/mixins/prefixer.js +23 -0
- package/dist/tagsInput/AddTagMenu.d.ts +11 -0
- package/dist/tagsInput/AddTagMenu.js +36 -0
- package/dist/tagsInput/AddTagMenuItem.d.ts +10 -0
- package/dist/tagsInput/AddTagMenuItem.js +26 -0
- package/dist/tagsInput/TagInputList.d.ts +2 -0
- package/dist/tagsInput/TagInputList.js +278 -0
- package/dist/tagsInput/index.d.ts +6 -0
- package/dist/tagsInput/index.js +6 -0
- package/dist/themes/appTheme.d.ts +4 -0
- package/dist/themes/appTheme.js +322 -0
- package/dist/themes/index.d.ts +2 -0
- package/dist/themes/index.js +9 -0
- package/dist/themes/ishTheme.d.ts +8 -0
- package/dist/themes/ishTheme.js +351 -0
- package/dist/timetable/datePeriodFilter/DayPeriodIcons.d.ts +8 -0
- package/dist/timetable/datePeriodFilter/DayPeriodIcons.js +27 -0
- package/dist/timetable/datePeriodFilter/index.d.ts +1 -0
- package/dist/timetable/datePeriodFilter/index.js +8 -0
- package/dist/timetable/index.d.ts +2 -0
- package/dist/timetable/index.js +9 -0
- package/dist/timetable/miniCalendar/CalendarDay.d.ts +15 -0
- package/dist/timetable/miniCalendar/CalendarDay.js +64 -0
- package/dist/timetable/miniCalendar/CalendarHeader.d.ts +10 -0
- package/dist/timetable/miniCalendar/CalendarHeader.js +22 -0
- package/dist/timetable/miniCalendar/CalendarWeekPanel.d.ts +8 -0
- package/dist/timetable/miniCalendar/CalendarWeekPanel.js +18 -0
- package/dist/timetable/miniCalendar/WeekDay.d.ts +10 -0
- package/dist/timetable/miniCalendar/WeekDay.js +25 -0
- package/dist/timetable/miniCalendar/index.d.ts +8 -0
- package/dist/timetable/miniCalendar/index.js +15 -0
- package/dist/utils/DOM/Links.d.ts +1 -0
- package/dist/utils/DOM/Links.js +12 -0
- package/dist/utils/DOM/getCaretCoordinates.d.ts +6 -0
- package/dist/utils/DOM/getCaretCoordinates.js +109 -0
- package/dist/utils/DOM/getOS.d.ts +2 -0
- package/dist/utils/DOM/getOS.js +32 -0
- package/dist/utils/DOM/index.d.ts +5 -0
- package/dist/utils/DOM/index.js +32 -0
- package/dist/utils/dates/datesNormalizing.d.ts +1 -0
- package/dist/utils/dates/datesNormalizing.js +3 -0
- package/dist/utils/dates/format.d.ts +24 -0
- package/dist/utils/dates/format.js +28 -0
- package/dist/utils/dates/formatRelative.d.ts +1 -0
- package/dist/utils/dates/formatRelative.js +14 -0
- package/dist/utils/dates/formatString.d.ts +2 -0
- package/dist/utils/dates/formatString.js +195 -0
- package/dist/utils/dates/formatTimezone.d.ts +2 -0
- package/dist/utils/dates/formatTimezone.js +35 -0
- package/dist/utils/dates/index.d.ts +6 -0
- package/dist/utils/dates/index.js +13 -0
- package/dist/utils/dates/timetable.d.ts +5 -0
- package/dist/utils/dates/timetable.js +38 -0
- package/dist/utils/events/index.d.ts +2 -0
- package/dist/utils/events/index.js +6 -0
- package/dist/utils/fields/index.d.ts +1 -0
- package/dist/utils/fields/index.js +20 -0
- package/dist/utils/formatting/PhoneMasks.d.ts +304 -0
- package/dist/utils/formatting/PhoneMasks.js +318 -0
- package/dist/utils/formatting/index.d.ts +2 -0
- package/dist/utils/formatting/index.js +10 -0
- package/dist/utils/hooks/index.d.ts +1 -0
- package/dist/utils/hooks/index.js +15 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +14 -0
- package/dist/utils/numbers/decimalCalculation.d.ts +4 -0
- package/dist/utils/numbers/decimalCalculation.js +21 -0
- package/dist/utils/numbers/index.d.ts +2 -0
- package/dist/utils/numbers/index.js +9 -0
- package/dist/utils/numbers/numbersNormalizing.d.ts +10 -0
- package/dist/utils/numbers/numbersNormalizing.js +44 -0
- package/dist/utils/stubs/index.d.ts +3 -0
- package/dist/utils/stubs/index.js +10 -0
- package/dist/utils/tags/index.d.ts +3 -0
- package/dist/utils/tags/index.js +42 -0
- package/index.ts +10 -0
- package/package.json +108 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './actions';
|
|
2
|
+
export * from './appBar';
|
|
3
|
+
export * from './buttons';
|
|
4
|
+
export * from './colorPicker';
|
|
5
|
+
export * from './dialog';
|
|
6
|
+
export * from './documents';
|
|
7
|
+
export * from './dynamicSizeList';
|
|
8
|
+
export * from './fieldMessage';
|
|
9
|
+
export * from './fileUploader';
|
|
10
|
+
export * from './formFields';
|
|
11
|
+
export * from './layout';
|
|
12
|
+
export * from './markdownEditor';
|
|
13
|
+
export * from './model';
|
|
14
|
+
export * from './styles';
|
|
15
|
+
export * from './tagsInput';
|
|
16
|
+
export * from './themes';
|
|
17
|
+
export * from './utils';
|
|
18
|
+
export * from './timetable';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 './actions';
|
|
9
|
+
export * from './appBar';
|
|
10
|
+
export * from './buttons';
|
|
11
|
+
export * from './colorPicker';
|
|
12
|
+
export * from './dialog';
|
|
13
|
+
export * from './documents';
|
|
14
|
+
export * from './dynamicSizeList';
|
|
15
|
+
export * from './fieldMessage';
|
|
16
|
+
export * from './fileUploader';
|
|
17
|
+
export * from './formFields';
|
|
18
|
+
export * from './layout';
|
|
19
|
+
export * from './markdownEditor';
|
|
20
|
+
export * from './model';
|
|
21
|
+
export * from './styles';
|
|
22
|
+
export * from './tagsInput';
|
|
23
|
+
export * from './themes';
|
|
24
|
+
export * from './utils';
|
|
25
|
+
export * from './timetable';
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { Chip } from '@mui/material';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { alpha } from '@mui/material/styles';
|
|
11
|
+
import { makeAppStyles } from '../styles';
|
|
12
|
+
const useStyles = makeAppStyles(theme => ({
|
|
13
|
+
chip: {
|
|
14
|
+
textTransform: 'uppercase',
|
|
15
|
+
fontWeight: 600,
|
|
16
|
+
fontSize: '12px',
|
|
17
|
+
marginLeft: theme.spacing(1),
|
|
18
|
+
color: ({ color }) => theme.palette[color].light,
|
|
19
|
+
backgroundColor: ({ color }) => alpha(theme.palette[color].light, 0.15)
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
const InfoPill = ({ label, color = label === 'custom' ? 'primary' : 'success' }) => {
|
|
23
|
+
const classes = useStyles({ label, color });
|
|
24
|
+
return React.createElement(Chip, { className: classes.chip, label: label, size: "small" });
|
|
25
|
+
};
|
|
26
|
+
export default InfoPill;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 './resizable/ResizableWrapper';
|
|
9
|
+
export { default as ResizableWrapper } from './resizable/ResizableWrapper';
|
|
10
|
+
export * from './InfoPill';
|
|
11
|
+
export { default as InfoPill } from './InfoPill';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
sidebarWidth: number;
|
|
4
|
+
minWidth?: number | string;
|
|
5
|
+
maxWidth?: number | string;
|
|
6
|
+
onResizeStop?: any;
|
|
7
|
+
onResize?: any;
|
|
8
|
+
classes?: any;
|
|
9
|
+
className?: any;
|
|
10
|
+
ignoreScreenWidth?: boolean;
|
|
11
|
+
children?: any;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.FC<Props>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Resizable } from 're-resizable';
|
|
3
|
+
import { withStyles, createStyles } from '@mui/styles';
|
|
4
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
const LIST_SIDE_BAR_DEFAULT_WIDTH = 265;
|
|
7
|
+
const styles = (theme) => createStyles({
|
|
8
|
+
sideBar: {
|
|
9
|
+
borderRight: `1px solid ${theme.palette.divider}`,
|
|
10
|
+
display: 'flex',
|
|
11
|
+
paddingRight: '1px',
|
|
12
|
+
'&.d-none': {
|
|
13
|
+
display: 'none'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
sideBarWrapper: {
|
|
17
|
+
overflowX: 'hidden',
|
|
18
|
+
overflowY: 'auto',
|
|
19
|
+
flex: 1
|
|
20
|
+
},
|
|
21
|
+
line: {
|
|
22
|
+
height: '100%',
|
|
23
|
+
width: '2px',
|
|
24
|
+
transition: 'background 120ms ease-in-out',
|
|
25
|
+
},
|
|
26
|
+
resizeLine: {
|
|
27
|
+
zIndex: theme.zIndex.drawer,
|
|
28
|
+
display: 'flex',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
'&:active $line, &:hover $line': {
|
|
31
|
+
background: `${theme.palette.secondary.main}`,
|
|
32
|
+
overflow: 'visible'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const ResizableWrapper = (props) => {
|
|
37
|
+
const { classes, onResizeStop, onResize, sidebarWidth, minWidth, maxWidth, children, className, ignoreScreenWidth } = props;
|
|
38
|
+
return useMediaQuery('(min-width:992px)') || ignoreScreenWidth ? (React.createElement(Resizable, { size: { width: sidebarWidth, height: '100%' }, minWidth: minWidth || LIST_SIDE_BAR_DEFAULT_WIDTH, maxWidth: maxWidth, onResizeStop: onResizeStop, onResize: onResize, enable: { right: true }, className: clsx(classes.sideBar, className), handleClasses: { right: classes.resizeLine }, handleComponent: { right: React.createElement("div", { className: props.classes.line }) } },
|
|
39
|
+
React.createElement("div", { className: classes.sideBarWrapper }, children))) : (children);
|
|
40
|
+
};
|
|
41
|
+
const wrapped = withStyles(styles)(ResizableWrapper);
|
|
42
|
+
export default wrapped;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'ace-builds/webpack-resolver';
|
|
3
|
+
import 'ace-builds/src-noconflict/mode-html';
|
|
4
|
+
import 'ace-builds/src-noconflict/mode-textile';
|
|
5
|
+
import 'ace-builds/src-noconflict/theme-tomorrow';
|
|
6
|
+
import 'ace-builds/src-noconflict/ext-language_tools';
|
|
7
|
+
import 'ace-builds/src-noconflict/snippets/html';
|
|
8
|
+
import 'ace-builds/src-noconflict/snippets/textile';
|
|
9
|
+
interface Props {
|
|
10
|
+
value?: string;
|
|
11
|
+
mode?: string;
|
|
12
|
+
onChange?: (html: any) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: React.FunctionComponent<Props>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import AceEditor from 'react-ace';
|
|
3
|
+
import 'ace-builds/webpack-resolver';
|
|
4
|
+
import 'ace-builds/src-noconflict/mode-html';
|
|
5
|
+
import 'ace-builds/src-noconflict/mode-textile';
|
|
6
|
+
import 'ace-builds/src-noconflict/theme-tomorrow';
|
|
7
|
+
import 'ace-builds/src-noconflict/ext-language_tools';
|
|
8
|
+
import 'ace-builds/src-noconflict/snippets/html';
|
|
9
|
+
import 'ace-builds/src-noconflict/snippets/textile';
|
|
10
|
+
const HtmlEditor = props => {
|
|
11
|
+
const { value, onChange, mode = 'html' } = props;
|
|
12
|
+
return (React.createElement(AceEditor, { mode: mode, theme: "tomorrow", fontSize: 14, height: "200px", showGutter: false, width: "100%", wrapEnabled: true, highlightActiveLine: true, enableLiveAutocompletion: mode === 'html', enableBasicAutocompletion: mode === 'html', setOptions: {
|
|
13
|
+
enableSnippets: true,
|
|
14
|
+
showLineNumbers: true,
|
|
15
|
+
tabSize: 2,
|
|
16
|
+
}, editorProps: { $blockScrolling: Infinity }, defaultValue: value, onChange: onChange }));
|
|
17
|
+
};
|
|
18
|
+
export default HtmlEditor;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
|
|
10
|
+
import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials';
|
|
11
|
+
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat';
|
|
12
|
+
import SourceEditing from '@ckeditor/ckeditor5-source-editing/src/sourceediting';
|
|
13
|
+
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
|
|
14
|
+
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
|
|
15
|
+
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
|
|
16
|
+
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
|
|
17
|
+
import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
|
|
18
|
+
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
19
|
+
import Markdown from '@ckeditor/ckeditor5-markdown-gfm/src/markdown';
|
|
20
|
+
import Table from '@ckeditor/ckeditor5-table/src/table';
|
|
21
|
+
import TableToolbar from '@ckeditor/ckeditor5-table/src/tabletoolbar';
|
|
22
|
+
import Image from '@ckeditor/ckeditor5-image/src/image';
|
|
23
|
+
import LinkImage from '@ckeditor/ckeditor5-link/src/linkimage';
|
|
24
|
+
import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption';
|
|
25
|
+
import ImageStyle from '@ckeditor/ckeditor5-image/src/imagestyle';
|
|
26
|
+
import { CKEditor } from '@ckeditor/ckeditor5-react/dist/ckeditor';
|
|
27
|
+
import { createRoot } from 'react-dom/client';
|
|
28
|
+
import CodeIcon from '@mui/icons-material/Code';
|
|
29
|
+
const SourceEditingSwitch = () => (React.createElement("div", { className: "ck_source_edit_custom" },
|
|
30
|
+
React.createElement(CodeIcon, { className: "ck_code_icon_custom" })));
|
|
31
|
+
const config = {
|
|
32
|
+
plugins: [
|
|
33
|
+
Markdown,
|
|
34
|
+
SourceEditing,
|
|
35
|
+
EssentialsPlugin,
|
|
36
|
+
AutoformatPlugin,
|
|
37
|
+
BoldPlugin,
|
|
38
|
+
ItalicPlugin,
|
|
39
|
+
HeadingPlugin,
|
|
40
|
+
LinkPlugin,
|
|
41
|
+
ListPlugin,
|
|
42
|
+
ParagraphPlugin,
|
|
43
|
+
Table,
|
|
44
|
+
TableToolbar,
|
|
45
|
+
Image,
|
|
46
|
+
LinkImage,
|
|
47
|
+
ImageStyle,
|
|
48
|
+
ImageCaption,
|
|
49
|
+
],
|
|
50
|
+
toolbar: [
|
|
51
|
+
'heading',
|
|
52
|
+
'bold',
|
|
53
|
+
'italic',
|
|
54
|
+
'link',
|
|
55
|
+
'bulletedList',
|
|
56
|
+
'numberedList',
|
|
57
|
+
'insertTable',
|
|
58
|
+
'sourceEditing',
|
|
59
|
+
],
|
|
60
|
+
table: {
|
|
61
|
+
defaultHeadings: { rows: 1 },
|
|
62
|
+
contentToolbar: ['tableColumn', 'tableRow']
|
|
63
|
+
},
|
|
64
|
+
heading: {
|
|
65
|
+
options: [
|
|
66
|
+
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
|
|
67
|
+
{
|
|
68
|
+
model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
const WysiwygEditor = ({ value, onChange, wysiwygRef }) => {
|
|
83
|
+
const onReady = editor => {
|
|
84
|
+
wysiwygRef.current = editor;
|
|
85
|
+
const sourceEdit = document.querySelector('.ck-source-editing-button');
|
|
86
|
+
sourceEdit.dataset.ckeTooltipText = 'Edit source';
|
|
87
|
+
sourceEdit.dataset.ckeTooltipPosition = 's';
|
|
88
|
+
const root = createRoot(sourceEdit);
|
|
89
|
+
root.render(React.createElement(SourceEditingSwitch, null));
|
|
90
|
+
editor.plugins.get('SourceEditing').on('change:isSourceEditingMode', () => {
|
|
91
|
+
const sourceEdit = document.querySelector('.ck-source-editing-button');
|
|
92
|
+
if (sourceEdit) {
|
|
93
|
+
root.render(React.createElement(SourceEditingSwitch, null));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const onChangeHandler = (e, editor) => onChange(editor.getData());
|
|
98
|
+
return (React.createElement(CKEditor, { editor: ClassicEditor, config: config, data: value, onChange: onChangeHandler, onReady: onReady }));
|
|
99
|
+
};
|
|
100
|
+
export default WysiwygEditor;
|
|
@@ -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 './utils/index';
|
|
9
|
+
export * from './HtmlEditor';
|
|
10
|
+
export * from './WysiwygEditor';
|
|
11
|
+
export { default as HtmlEditor } from './HtmlEditor';
|
|
12
|
+
export { default as WysiwygEditor } from './WysiwygEditor';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ContentMode = 'textile' | 'html' | 'md';
|
|
2
|
+
export declare const CONTENT_MODES: {
|
|
3
|
+
id: ContentMode;
|
|
4
|
+
title: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const getContentMarker: (text: any) => any;
|
|
7
|
+
export declare const removeContentMarker: (text: any) => any;
|
|
8
|
+
export declare const addContentMarker: (text: any, contentMode: any) => string;
|
|
9
|
+
export declare const getEditorModeLabel: (mode: ContentMode) => "RICH" | "HTML" | "LEGACY";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright ish group pty ltd 2020.
|
|
3
|
+
*
|
|
4
|
+
* This program is free software: you can redistribute it and/or modify it under the terms of the
|
|
5
|
+
* GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
*
|
|
7
|
+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
8
|
+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
* See the GNU Affero General Public License for more details.
|
|
10
|
+
*/
|
|
11
|
+
export const CONTENT_MODES = [
|
|
12
|
+
{ id: 'md', title: 'rich text' },
|
|
13
|
+
{ id: 'textile', title: 'legacy' },
|
|
14
|
+
{ id: 'html', title: 'advanced (html)' }
|
|
15
|
+
];
|
|
16
|
+
export const getContentMarker = text => {
|
|
17
|
+
if (!text)
|
|
18
|
+
return CONTENT_MODES[0].id;
|
|
19
|
+
const match = text.match(/\s*{render:"(.*)"}/, '');
|
|
20
|
+
return match && match[1] ? match[1] : CONTENT_MODES[1].id;
|
|
21
|
+
};
|
|
22
|
+
export const removeContentMarker = text => {
|
|
23
|
+
if (!text)
|
|
24
|
+
return text;
|
|
25
|
+
return text.replace(/\s*{render:.*/g, '');
|
|
26
|
+
};
|
|
27
|
+
export const addContentMarker = (text, contentMode) => (`${text}
|
|
28
|
+
{render:"${contentMode}"}`);
|
|
29
|
+
export const getEditorModeLabel = (mode) => {
|
|
30
|
+
switch (mode) {
|
|
31
|
+
case 'md':
|
|
32
|
+
return 'RICH';
|
|
33
|
+
case 'html':
|
|
34
|
+
return 'HTML';
|
|
35
|
+
case 'textile':
|
|
36
|
+
return 'LEGACY';
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AnyArgFunction } from '../model/CommonFunctions';
|
|
3
|
+
export interface AppBarAction {
|
|
4
|
+
action: AnyArgFunction;
|
|
5
|
+
icon: ReactNode;
|
|
6
|
+
tooltip: string;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
confirmButtonText?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
tooltipError?: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type StringArgFunction = (arg: string) => void;
|
|
2
|
+
export type BooleanArgFunction = (arg: boolean) => void;
|
|
3
|
+
export type NumberArgFunction = (arg: number) => void;
|
|
4
|
+
export type HTMLTagArgFunction = (arg: HTMLElement) => void;
|
|
5
|
+
export type DateArgFunction = (arg: Date) => void;
|
|
6
|
+
export type AnyArgFunction<R = void, A = any> = (...args: A[]) => R;
|
|
7
|
+
export type NoArgFunction = () => void;
|
|
8
|
+
export type PromiseReturnFunction = (...args: any[]) => Promise<any>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AnyArgFunction } from '../model/CommonFunctions';
|
|
3
|
+
export interface ConfirmProps {
|
|
4
|
+
onCancel?: AnyArgFunction;
|
|
5
|
+
onConfirm?: AnyArgFunction;
|
|
6
|
+
title?: string;
|
|
7
|
+
confirmMessage?: ReactNode;
|
|
8
|
+
cancelButtonText?: string;
|
|
9
|
+
confirmButtonText?: string;
|
|
10
|
+
onCancelCustom?: AnyArgFunction;
|
|
11
|
+
confirmCustomComponent?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface ConfirmState extends ConfirmProps {
|
|
14
|
+
open: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type ShowConfirmCaller = (props: ConfirmProps) => any;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 {};
|