ish-ui 1.0.14 → 1.0.16

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 (217) hide show
  1. package/README.md +2 -1
  2. package/ish-ui.iml +8 -0
  3. package/package.json +4 -7
  4. package/dist/actions/FieldProcessing.d.ts +0 -10
  5. package/dist/actions/FieldProcessing.js +0 -17
  6. package/dist/actions/index.d.ts +0 -1
  7. package/dist/actions/index.js +0 -8
  8. package/dist/appBar/AppBarHelpMenu.d.ts +0 -3
  9. package/dist/appBar/AppBarHelpMenu.js +0 -77
  10. package/dist/appBar/index.d.ts +0 -2
  11. package/dist/appBar/index.js +0 -9
  12. package/dist/buttons/AddButton.d.ts +0 -14
  13. package/dist/buttons/AddButton.js +0 -9
  14. package/dist/buttons/TimetableButton.d.ts +0 -3
  15. package/dist/buttons/TimetableButton.js +0 -12
  16. package/dist/buttons/index.d.ts +0 -4
  17. package/dist/buttons/index.js +0 -11
  18. package/dist/colorPicker/ColorPicker.d.ts +0 -11
  19. package/dist/colorPicker/ColorPicker.js +0 -132
  20. package/dist/colorPicker/index.d.ts +0 -2
  21. package/dist/colorPicker/index.js +0 -9
  22. package/dist/dialog/BrowserWarning.d.ts +0 -3
  23. package/dist/dialog/BrowserWarning.js +0 -16
  24. package/dist/dialog/confirm/ConfirmBase.d.ts +0 -7
  25. package/dist/dialog/confirm/ConfirmBase.js +0 -29
  26. package/dist/dialog/index.d.ts +0 -5
  27. package/dist/dialog/index.js +0 -12
  28. package/dist/dialog/message/Message.d.ts +0 -3
  29. package/dist/dialog/message/Message.js +0 -91
  30. package/dist/documents/DocumentIconsChooser.d.ts +0 -3
  31. package/dist/documents/DocumentIconsChooser.js +0 -51
  32. package/dist/documents/index.d.ts +0 -3
  33. package/dist/documents/index.js +0 -10
  34. package/dist/documents/utils/index.d.ts +0 -7
  35. package/dist/documents/utils/index.js +0 -61
  36. package/dist/dynamicSizeList/DynamicSizeList.d.ts +0 -17
  37. package/dist/dynamicSizeList/DynamicSizeList.js +0 -167
  38. package/dist/dynamicSizeList/index.d.ts +0 -2
  39. package/dist/dynamicSizeList/index.js +0 -9
  40. package/dist/fieldMessage/ErrorMessage.d.ts +0 -8
  41. package/dist/fieldMessage/ErrorMessage.js +0 -14
  42. package/dist/fieldMessage/WarningMessage.d.ts +0 -8
  43. package/dist/fieldMessage/WarningMessage.js +0 -14
  44. package/dist/fieldMessage/index.d.ts +0 -6
  45. package/dist/fieldMessage/index.js +0 -13
  46. package/dist/fieldMessage/styles.d.ts +0 -3
  47. package/dist/fieldMessage/styles.js +0 -18
  48. package/dist/fileUploader/FileUploaderDialog.d.ts +0 -15
  49. package/dist/fileUploader/FileUploaderDialog.js +0 -99
  50. package/dist/fileUploader/index.d.ts +0 -2
  51. package/dist/fileUploader/index.js +0 -9
  52. package/dist/formFields/CheckboxField.d.ts +0 -7
  53. package/dist/formFields/CheckboxField.js +0 -67
  54. package/dist/formFields/CodeEditorField.d.ts +0 -6
  55. package/dist/formFields/CodeEditorField.js +0 -69
  56. package/dist/formFields/ColoredCheckBox.d.ts +0 -3
  57. package/dist/formFields/ColoredCheckBox.js +0 -41
  58. package/dist/formFields/DateTimeField.d.ts +0 -2
  59. package/dist/formFields/DateTimeField.js +0 -27
  60. package/dist/formFields/EditInPlaceDateTimeField.d.ts +0 -10
  61. package/dist/formFields/EditInPlaceDateTimeField.js +0 -188
  62. package/dist/formFields/EditInPlaceDurationField.d.ts +0 -4
  63. package/dist/formFields/EditInPlaceDurationField.js +0 -63
  64. package/dist/formFields/EditInPlaceField.d.ts +0 -10
  65. package/dist/formFields/EditInPlaceField.js +0 -58
  66. package/dist/formFields/EditInPlaceFieldBase.d.ts +0 -28
  67. package/dist/formFields/EditInPlaceFieldBase.js +0 -123
  68. package/dist/formFields/EditInPlaceFileField.d.ts +0 -7
  69. package/dist/formFields/EditInPlaceFileField.js +0 -60
  70. package/dist/formFields/EditInPlaceMoneyField.d.ts +0 -9
  71. package/dist/formFields/EditInPlaceMoneyField.js +0 -37
  72. package/dist/formFields/EditInPlacePhoneField.d.ts +0 -4
  73. package/dist/formFields/EditInPlacePhoneField.js +0 -69
  74. package/dist/formFields/EditInPlaceSearchSelect.d.ts +0 -4
  75. package/dist/formFields/EditInPlaceSearchSelect.js +0 -321
  76. package/dist/formFields/FieldAdornments.d.ts +0 -13
  77. package/dist/formFields/FieldAdornments.js +0 -27
  78. package/dist/formFields/FilePreview.d.ts +0 -17
  79. package/dist/formFields/FilePreview.js +0 -77
  80. package/dist/formFields/FormRadioButtons.d.ts +0 -3
  81. package/dist/formFields/FormRadioButtons.js +0 -27
  82. package/dist/formFields/SelectCustomComponents.d.ts +0 -5
  83. package/dist/formFields/SelectCustomComponents.js +0 -182
  84. package/dist/formFields/Switch.d.ts +0 -7
  85. package/dist/formFields/Switch.js +0 -116
  86. package/dist/formFields/TextField.d.ts +0 -6
  87. package/dist/formFields/TextField.js +0 -42
  88. package/dist/formFields/UneditableBase.d.ts +0 -17
  89. package/dist/formFields/UneditableBase.js +0 -48
  90. package/dist/formFields/index.d.ts +0 -31
  91. package/dist/formFields/index.js +0 -38
  92. package/dist/index.d.ts +0 -18
  93. package/dist/index.js +0 -25
  94. package/dist/layout/InfoPill.d.ts +0 -7
  95. package/dist/layout/InfoPill.js +0 -26
  96. package/dist/layout/index.d.ts +0 -4
  97. package/dist/layout/index.js +0 -11
  98. package/dist/layout/resizable/ResizableWrapper.d.ts +0 -14
  99. package/dist/layout/resizable/ResizableWrapper.js +0 -42
  100. package/dist/markdownEditor/HtmlEditor.d.ts +0 -15
  101. package/dist/markdownEditor/HtmlEditor.js +0 -18
  102. package/dist/markdownEditor/WysiwygEditor.d.ts +0 -8
  103. package/dist/markdownEditor/WysiwygEditor.js +0 -100
  104. package/dist/markdownEditor/index.d.ts +0 -5
  105. package/dist/markdownEditor/index.js +0 -12
  106. package/dist/markdownEditor/utils/index.d.ts +0 -9
  107. package/dist/markdownEditor/utils/index.js +0 -38
  108. package/dist/model/AppBar.d.ts +0 -11
  109. package/dist/model/AppBar.js +0 -8
  110. package/dist/model/CommomObjects.d.ts +0 -5
  111. package/dist/model/CommomObjects.js +0 -1
  112. package/dist/model/CommonFunctions.d.ts +0 -8
  113. package/dist/model/CommonFunctions.js +0 -5
  114. package/dist/model/Confirm.d.ts +0 -16
  115. package/dist/model/Confirm.js +0 -8
  116. package/dist/model/Fields.d.ts +0 -250
  117. package/dist/model/Fields.js +0 -8
  118. package/dist/model/NestedEntity.d.ts +0 -9
  119. package/dist/model/NestedEntity.js +0 -5
  120. package/dist/model/Theme.d.ts +0 -34
  121. package/dist/model/Theme.js +0 -18
  122. package/dist/model/index.d.ts +0 -7
  123. package/dist/model/index.js +0 -14
  124. package/dist/styles/GlobalStylesProvider.d.ts +0 -3
  125. package/dist/styles/GlobalStylesProvider.js +0 -417
  126. package/dist/styles/StylesProviderCustom.d.ts +0 -3
  127. package/dist/styles/StylesProviderCustom.js +0 -6
  128. package/dist/styles/animateStyles.d.ts +0 -3
  129. package/dist/styles/animateStyles.js +0 -33
  130. package/dist/styles/bootstrap.d.ts +0 -491
  131. package/dist/styles/bootstrap.js +0 -496
  132. package/dist/styles/hooks.d.ts +0 -6
  133. package/dist/styles/hooks.js +0 -38
  134. package/dist/styles/index.d.ts +0 -11
  135. package/dist/styles/index.js +0 -18
  136. package/dist/styles/makeStyles.d.ts +0 -3
  137. package/dist/styles/makeStyles.js +0 -9
  138. package/dist/styles/mixins/common.d.ts +0 -8
  139. package/dist/styles/mixins/common.js +0 -32
  140. package/dist/styles/mixins/keyframes.d.ts +0 -3
  141. package/dist/styles/mixins/keyframes.js +0 -9
  142. package/dist/styles/mixins/prefixer.d.ts +0 -1
  143. package/dist/styles/mixins/prefixer.js +0 -23
  144. package/dist/tagsInput/AddTagMenu.d.ts +0 -12
  145. package/dist/tagsInput/AddTagMenu.js +0 -36
  146. package/dist/tagsInput/AddTagMenuItem.d.ts +0 -11
  147. package/dist/tagsInput/AddTagMenuItem.js +0 -29
  148. package/dist/tagsInput/TagInputList.d.ts +0 -4
  149. package/dist/tagsInput/TagInputList.js +0 -273
  150. package/dist/tagsInput/index.d.ts +0 -6
  151. package/dist/tagsInput/index.js +0 -6
  152. package/dist/themes/appTheme.d.ts +0 -4
  153. package/dist/themes/appTheme.js +0 -322
  154. package/dist/themes/index.d.ts +0 -2
  155. package/dist/themes/index.js +0 -9
  156. package/dist/themes/ishTheme.d.ts +0 -8
  157. package/dist/themes/ishTheme.js +0 -351
  158. package/dist/timetable/datePeriodFilter/DayPeriodIcons.d.ts +0 -8
  159. package/dist/timetable/datePeriodFilter/DayPeriodIcons.js +0 -27
  160. package/dist/timetable/datePeriodFilter/index.d.ts +0 -1
  161. package/dist/timetable/datePeriodFilter/index.js +0 -8
  162. package/dist/timetable/index.d.ts +0 -2
  163. package/dist/timetable/index.js +0 -9
  164. package/dist/timetable/miniCalendar/CalendarDay.d.ts +0 -15
  165. package/dist/timetable/miniCalendar/CalendarDay.js +0 -64
  166. package/dist/timetable/miniCalendar/CalendarHeader.d.ts +0 -10
  167. package/dist/timetable/miniCalendar/CalendarHeader.js +0 -22
  168. package/dist/timetable/miniCalendar/CalendarWeekPanel.d.ts +0 -8
  169. package/dist/timetable/miniCalendar/CalendarWeekPanel.js +0 -18
  170. package/dist/timetable/miniCalendar/WeekDay.d.ts +0 -10
  171. package/dist/timetable/miniCalendar/WeekDay.js +0 -25
  172. package/dist/timetable/miniCalendar/index.d.ts +0 -8
  173. package/dist/timetable/miniCalendar/index.js +0 -15
  174. package/dist/utils/DOM/Links.d.ts +0 -1
  175. package/dist/utils/DOM/Links.js +0 -12
  176. package/dist/utils/DOM/getCaretCoordinates.d.ts +0 -6
  177. package/dist/utils/DOM/getCaretCoordinates.js +0 -109
  178. package/dist/utils/DOM/getOS.d.ts +0 -2
  179. package/dist/utils/DOM/getOS.js +0 -32
  180. package/dist/utils/DOM/index.d.ts +0 -5
  181. package/dist/utils/DOM/index.js +0 -32
  182. package/dist/utils/dates/datesNormalizing.d.ts +0 -1
  183. package/dist/utils/dates/datesNormalizing.js +0 -3
  184. package/dist/utils/dates/format.d.ts +0 -24
  185. package/dist/utils/dates/format.js +0 -28
  186. package/dist/utils/dates/formatRelative.d.ts +0 -1
  187. package/dist/utils/dates/formatRelative.js +0 -14
  188. package/dist/utils/dates/formatString.d.ts +0 -2
  189. package/dist/utils/dates/formatString.js +0 -195
  190. package/dist/utils/dates/formatTimezone.d.ts +0 -2
  191. package/dist/utils/dates/formatTimezone.js +0 -35
  192. package/dist/utils/dates/index.d.ts +0 -6
  193. package/dist/utils/dates/index.js +0 -13
  194. package/dist/utils/dates/timetable.d.ts +0 -5
  195. package/dist/utils/dates/timetable.js +0 -38
  196. package/dist/utils/events/index.d.ts +0 -2
  197. package/dist/utils/events/index.js +0 -6
  198. package/dist/utils/fields/index.d.ts +0 -1
  199. package/dist/utils/fields/index.js +0 -20
  200. package/dist/utils/formatting/PhoneMasks.d.ts +0 -304
  201. package/dist/utils/formatting/PhoneMasks.js +0 -318
  202. package/dist/utils/formatting/index.d.ts +0 -2
  203. package/dist/utils/formatting/index.js +0 -10
  204. package/dist/utils/hooks/index.d.ts +0 -1
  205. package/dist/utils/hooks/index.js +0 -15
  206. package/dist/utils/index.d.ts +0 -9
  207. package/dist/utils/index.js +0 -16
  208. package/dist/utils/numbers/decimalCalculation.d.ts +0 -4
  209. package/dist/utils/numbers/decimalCalculation.js +0 -21
  210. package/dist/utils/numbers/index.d.ts +0 -2
  211. package/dist/utils/numbers/index.js +0 -9
  212. package/dist/utils/numbers/numbersNormalizing.d.ts +0 -10
  213. package/dist/utils/numbers/numbersNormalizing.js +0 -44
  214. package/dist/utils/stubs/index.d.ts +0 -3
  215. package/dist/utils/stubs/index.js +0 -10
  216. package/dist/utils/tags/index.d.ts +0 -3
  217. package/dist/utils/tags/index.js +0 -42
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
- import withStyles from '@mui/styles/withStyles';
4
- import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
5
- import MenuItem from '@mui/material/MenuItem';
6
- import List from '@mui/material/List';
7
- import AddTagMenuItem from './AddTagMenuItem';
8
- const styles = theme => ({
9
- listItem: {
10
- padding: theme.spacing(0, 0.5, 0, 2)
11
- },
12
- proceedIcon: {
13
- marginTop: '2px'
14
- },
15
- backContainer: {
16
- marginLeft: '-6px'
17
- },
18
- tagColorDotSmall: {
19
- width: theme.spacing(2),
20
- height: theme.spacing(2),
21
- background: 'red',
22
- borderRadius: '100%'
23
- }
24
- });
25
- function AddTagMenu({ classes, tags, handleAdd, activeTag, setActiveTag, allowParentSelect }) {
26
- const handleBack = () => {
27
- setActiveTag(prev => prev.parent);
28
- };
29
- return (React.createElement(List, { className: classes.rootMenu },
30
- activeTag && (React.createElement(MenuItem, { onClick: handleBack, className: classes.listItem },
31
- React.createElement("span", { className: clsx('d-flex textSecondaryColor', classes.backContainer) },
32
- React.createElement(KeyboardArrowLeft, { color: "inherit" }),
33
- "Back"))),
34
- (activeTag ? activeTag.children : tags).map(t => (React.createElement(AddTagMenuItem, { key: t.tagBody.id, tag: t, classes: classes, setActiveTag: setActiveTag, handleAdd: handleAdd, allowParentSelect: allowParentSelect })))));
35
- }
36
- export default withStyles(styles)(AddTagMenu);
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { MenuTag, TagLike } from '../model';
3
- interface Props<T> {
4
- classes: any;
5
- setActiveTag: (tag: MenuTag<T>) => void;
6
- handleAdd: (tag: MenuTag<T>) => void;
7
- tag: MenuTag<T>;
8
- allowParentSelect?: boolean;
9
- }
10
- declare function AddTagMenuItem<T extends TagLike>({ setActiveTag, tag, classes, handleAdd, allowParentSelect }: Props<T>): React.JSX.Element;
11
- export default AddTagMenuItem;
@@ -1,29 +0,0 @@
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 React from 'react';
9
- import clsx from 'clsx';
10
- import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight';
11
- import Checkbox from '@mui/material/Checkbox';
12
- import MenuItem from '@mui/material/MenuItem';
13
- import { IconButton } from '@mui/material';
14
- function AddTagMenuItem({ setActiveTag, tag, classes, handleAdd, allowParentSelect }) {
15
- const openSubmenu = () => {
16
- setActiveTag(tag);
17
- };
18
- const toggleChecked = () => {
19
- handleAdd(tag);
20
- };
21
- const hasChildren = Boolean(tag.children.length);
22
- return (React.createElement(MenuItem, { classes: { root: classes.listItem }, onClick: allowParentSelect ? null : (hasChildren ? openSubmenu : toggleChecked), disableRipple: allowParentSelect },
23
- React.createElement("div", { className: clsx(classes.tagColorDotSmall, 'mr-1'), style: { background: '#' + tag.tagBody.color } }),
24
- React.createElement("span", { className: "mr-2 flex-fill" }, tag.tagBody.name),
25
- (allowParentSelect || !hasChildren) && React.createElement(Checkbox, { onClick: toggleChecked, classes: { root: 'smallIconButton' }, checked: tag.active }),
26
- hasChildren && React.createElement(IconButton, { size: "small", onClick: openSubmenu },
27
- React.createElement(KeyboardArrowRight, { className: clsx('d-flex textSecondaryColor', classes.proceedIcon) }))));
28
- }
29
- export default AddTagMenuItem;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { FieldInputProps, FieldMetaProps, TagLike, TagsFieldProps } from '../model';
3
- declare function TagInputList<T extends TagLike, IP extends FieldInputProps, MP extends FieldMetaProps>({ input, tags, placeholder, labelAdornment, meta, label, disabled, className, warning, allowParentSelect, fieldClasses }: TagsFieldProps<T, IP, MP>): React.JSX.Element;
4
- export default TagInputList;
@@ -1,273 +0,0 @@
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
- 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, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20
- import { InputAdornment, MenuItem, Select } from '@mui/material';
21
- import ClickAwayListener from '@mui/material/ClickAwayListener';
22
- import Autocomplete from '@mui/material/Autocomplete';
23
- import clsx from 'clsx';
24
- import { Edit } from '@mui/icons-material';
25
- import { selectStyles } from '../formFields';
26
- import AddTagMenu from './AddTagMenu';
27
- import EditInPlaceFieldBase from '../formFields/EditInPlaceFieldBase';
28
- import { getAllMenuTags, getHighlightedPartLabel, getMenuTags } from '../utils';
29
- import { stubComponent } from '../utils/stubs';
30
- import getCaretCoordinates from '../utils/DOM/getCaretCoordinates';
31
- import { makeAppStyles } from '../styles';
32
- const useStyles = makeAppStyles((theme) => (Object.assign(Object.assign({}, selectStyles(theme)), { inputEndAdornment: {
33
- visibility: 'hidden',
34
- display: 'flex',
35
- color: theme.palette.primary.main,
36
- alignItems: 'flex-end',
37
- alignSelf: 'flex-end',
38
- marginBottom: '4px',
39
- opacity: 0.5
40
- }, tagColorDotSmall: {
41
- width: theme.spacing(2),
42
- minWidth: theme.spacing(2),
43
- height: theme.spacing(2),
44
- minHeight: theme.spacing(2),
45
- background: 'red',
46
- borderRadius: '100%'
47
- }, listbox: {
48
- whiteSpace: 'break-spaces'
49
- }, invalid: {} })));
50
- const endTagRegex = /#\s*[^\w\d]*$/;
51
- const getCurrentInputString = (input, formTagIds = [], allMenuTags = []) => {
52
- let substr = input;
53
- formTagIds === null || formTagIds === void 0 ? void 0 : formTagIds.forEach(id => {
54
- const tag = allMenuTags.find(t => t.tagBody.id === id);
55
- if (tag) {
56
- substr = substr.replace('#' + tag.tagBody.name, '').trim();
57
- }
58
- });
59
- if (substr) {
60
- return substr.trim().replace(/#/g, '');
61
- }
62
- return substr;
63
- };
64
- const getFullTag = (tagId, tags) => {
65
- let i = 0;
66
- let result;
67
- while (i < tags.length) {
68
- if (tagId === tags[i].id) {
69
- return tags[i];
70
- }
71
- if (result)
72
- break;
73
- if (tags[i].childTags.length) {
74
- result = getFullTag(tagId, tags[i].childTags);
75
- if (result)
76
- return result;
77
- }
78
- ++i;
79
- }
80
- };
81
- const getInputString = (tagIds, allTags) => ((tagIds === null || tagIds === void 0 ? void 0 : tagIds.length) && (allTags === null || allTags === void 0 ? void 0 : allTags.length)
82
- ? tagIds.reduce((acc, id) => {
83
- const tag = getFullTag(id, allTags);
84
- return (tag ? `${acc}#${tag.name} ` : acc);
85
- }, '')
86
- : '');
87
- function TagInputList({ input, tags, placeholder, labelAdornment, meta, label = 'Tags', disabled, className, warning, allowParentSelect, fieldClasses = {} }) {
88
- const [menuIsOpen, setMenuIsOpen] = useState(false);
89
- const [activeTag, setActiveTag] = useState(null);
90
- const [isEditing, setIsEditing] = useState(false);
91
- const [inputValue, setInputValue] = useState('');
92
- const [currentInputString, setCurrentInputString] = useState('');
93
- const classes = useStyles();
94
- const InputValueForRender = useMemo(() => {
95
- var _a;
96
- if (!inputValue || !tags || !tags.length)
97
- return '';
98
- const arrayOfTags = ((_a = input === null || input === void 0 ? void 0 : input.value) === null || _a === void 0 ? void 0 : _a.length)
99
- && input.value.map(id => getFullTag(id, tags)).filter(t => t);
100
- if (!(arrayOfTags === null || arrayOfTags === void 0 ? void 0 : arrayOfTags.length))
101
- return '';
102
- return arrayOfTags.map((tag, index) => (React.createElement("span", { key: tag.id, className: clsx('centeredFlex', index !== arrayOfTags.length - 1 ? 'pr-1' : '') },
103
- React.createElement("div", { key: tag.id, className: clsx(classes.tagColorDotSmall, 'mr-0-5'), style: { background: '#' + tag.color } }),
104
- React.createElement("span", { className: "text-nowrap" }, `#${tag.name} `))));
105
- }, [tags, input.value, inputValue]);
106
- const inputNode = useRef();
107
- const tagMenuNode = useRef();
108
- const menuTags = useMemo(() => (tags && input.value ? getMenuTags(tags.filter(t => t.childrenCount > 0), input.value.map(id => getFullTag(id, tags)).filter(t => t)) : []), [tags, input.value]);
109
- const allMenuTags = useMemo(() => getAllMenuTags(menuTags), [menuTags]);
110
- const synchronizeTags = () => {
111
- const inputString = getInputString(input.value, tags);
112
- if (inputString.trim() === inputValue.replace(endTagRegex, '').trim()) {
113
- return;
114
- }
115
- const updated = [];
116
- const current = inputValue.split('#').filter(i => i).map(i => i.trim());
117
- allMenuTags.forEach(t => {
118
- if (!t.children.length) {
119
- const index = current.findIndex(c => c === t.tagBody.name);
120
- if (index !== -1) {
121
- const addedTagsMatch = input.value.find(id => { var _a; return ((_a = getFullTag(id, tags)) === null || _a === void 0 ? void 0 : _a.name) === t.tagBody.name; });
122
- if (addedTagsMatch && addedTagsMatch !== t.tagBody.id) {
123
- return;
124
- }
125
- updated.push(t.tagBody.id);
126
- current.splice(index, 1);
127
- }
128
- }
129
- });
130
- input.onChange(updated);
131
- setInputValue(getInputString(updated, tags));
132
- };
133
- const onTagAdd = (tag) => {
134
- const updated = [...input.value];
135
- const index = updated.findIndex(id => id === tag.tagBody.id);
136
- if (index !== -1) {
137
- updated.splice(index, 1);
138
- }
139
- else {
140
- updated.push(tag.tagBody.id);
141
- }
142
- input.onChange(updated);
143
- setTimeout(() => {
144
- var _a;
145
- (_a = inputNode === null || inputNode === void 0 ? void 0 : inputNode.current) === null || _a === void 0 ? void 0 : _a.focus();
146
- }, 100);
147
- };
148
- const filterOptions = item => !item.children.length && !input.value.some(id => id === item.tagBody.id) && item.tagBody.name
149
- .toLowerCase()
150
- .trim()
151
- .startsWith(currentInputString.toLowerCase().trim());
152
- const filterOptionsInner = options => options.filter(filterOptions);
153
- const filteredOptions = allMenuTags.filter(filterOptions);
154
- const getOptionText = (option, optionProps, label) => (React.createElement("div", Object.assign({}, optionProps),
155
- `${option.path ? option.path + ' /' : ''}`,
156
- ' ',
157
- label));
158
- const getOptionLabel = op => op.path;
159
- const renderOption = (optionProps, option) => {
160
- var _a;
161
- const label = (_a = option === null || option === void 0 ? void 0 : option.tagBody) === null || _a === void 0 ? void 0 : _a.name;
162
- const highlightedLabel = getHighlightedPartLabel(label, currentInputString);
163
- return getOptionText(option, optionProps, highlightedLabel);
164
- };
165
- const handleInputChange = e => {
166
- setInputValue(e.target.value);
167
- };
168
- const edit = () => {
169
- setIsEditing(true);
170
- setTimeout(() => {
171
- var _a;
172
- (_a = inputNode === null || inputNode === void 0 ? void 0 : inputNode.current) === null || _a === void 0 ? void 0 : _a.focus();
173
- }, 50);
174
- };
175
- const exit = () => {
176
- setMenuIsOpen(false);
177
- setIsEditing(false);
178
- setActiveTag(null);
179
- if (endTagRegex.test(inputValue)) {
180
- setTimeout(() => {
181
- setInputValue(inputValue.replace(endTagRegex, '').trim());
182
- }, 100);
183
- }
184
- };
185
- const onFocus = () => {
186
- setMenuIsOpen(true);
187
- if (!endTagRegex.test(inputValue)) {
188
- setInputValue(inputValue + ' #');
189
- }
190
- };
191
- const onBlur = () => {
192
- if (currentInputString) {
193
- exit();
194
- synchronizeTags();
195
- }
196
- };
197
- const onTagListBlur = () => {
198
- setTimeout(() => {
199
- if (document.activeElement !== inputNode.current) {
200
- exit();
201
- synchronizeTags();
202
- }
203
- }, 60);
204
- };
205
- const handleChange = (e, value, action) => {
206
- if (action === 'selectOption') {
207
- onTagAdd(value);
208
- }
209
- };
210
- useEffect(() => {
211
- let inputString = getInputString(input.value, tags);
212
- if (document.activeElement === inputNode.current && !endTagRegex.test(inputString)) {
213
- inputString += ' #';
214
- }
215
- setInputValue(inputString);
216
- }, [input.value, tags]);
217
- useEffect(() => {
218
- setCurrentInputString(getCurrentInputString(inputValue, input.value || [], allMenuTags));
219
- }, [inputValue, input.value, allMenuTags]);
220
- useEffect(() => {
221
- if (meta.invalid && !isEditing) {
222
- setIsEditing(true);
223
- }
224
- }, [meta.invalid]);
225
- useEffect(() => {
226
- if (activeTag) {
227
- const activeUpdated = allMenuTags.find(t => t.tagBody.id === activeTag.tagBody.id);
228
- if (activeUpdated) {
229
- setActiveTag(activeUpdated);
230
- }
231
- }
232
- }, [allMenuTags]);
233
- const popperAdapter = useCallback(params => {
234
- if (currentInputString || !inputNode.current) {
235
- return React.createElement("div", Object.assign({}, params));
236
- }
237
- const coords = getCaretCoordinates(inputNode.current, inputValue.length);
238
- const position = tagMenuNode.current
239
- && coords.left > inputNode.current.clientWidth - tagMenuNode.current.clientWidth
240
- ? { right: 0 }
241
- : { left: coords.left };
242
- return (React.createElement("div", { id: "popper", style: Object.assign(Object.assign({}, position), { position: 'absolute', zIndex: 2 }) },
243
- React.createElement(ClickAwayListener, { onClickAway: onTagListBlur }, params.children)));
244
- }, [allMenuTags, inputValue, currentInputString, inputNode.current, tagMenuNode.current, input.value]);
245
- const listboxAdapter = useCallback(params => (React.createElement("div", { className: params.className, ref: tagMenuNode },
246
- React.createElement(AddTagMenu, { tags: menuTags, handleAdd: onTagAdd, activeTag: activeTag, setActiveTag: setActiveTag, allowParentSelect: allowParentSelect }))), [menuTags, activeTag, setActiveTag, onTagAdd]);
247
- return (React.createElement("div", { className: className, id: input.name },
248
- React.createElement("div", { className: clsx('relative', {
249
- 'pointer-events-none': disabled
250
- }) },
251
- React.createElement(Autocomplete, { value: null, open: menuIsOpen, options: filteredOptions, onChange: handleChange, renderOption: renderOption, filterOptions: filterOptionsInner, getOptionLabel: getOptionLabel, PopperComponent: currentInputString ? undefined : popperAdapter, ListboxComponent: currentInputString ? undefined : listboxAdapter, classes: {
252
- root: classes.root,
253
- hasPopupIcon: classes.hasPopup,
254
- hasClearIcon: classes.hasClear,
255
- listbox: clsx(classes.listbox, fieldClasses.listbox),
256
- inputRoot: classes.inputWrapper,
257
- noOptions: 'd-none'
258
- }, renderInput: (_a) => {
259
- var { InputLabelProps, InputProps, inputProps } = _a, params = __rest(_a, ["InputLabelProps", "InputProps", "inputProps"]);
260
- return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { name: input.name, value: input.value, error: meta.error, invalid: meta === null || meta === void 0 ? void 0 : meta.invalid, label: label, warning: warning, disabled: disabled, fieldClasses: fieldClasses, shrink: Boolean(label || input.value), labelAdornment: labelAdornment, placeholder: placeholder || 'No value', editIcon: React.createElement(Edit, { fontSize: "inherit" }), InputProps: Object.assign(Object.assign({}, InputProps), { onChange: handleInputChange, onFocus,
261
- onBlur, inputProps: Object.assign(Object.assign({}, inputProps), { ref: ref => {
262
- inputProps.ref.current = ref;
263
- inputNode.current = ref;
264
- }, value: inputValue }) }), CustomInput: !isEditing
265
- ? React.createElement(Select, { inputRef: ref => {
266
- inputProps.ref.current = ref === null || ref === void 0 ? void 0 : ref.node;
267
- }, onFocus: edit, value: "stub", className: classes.inputWrapper, classes: { select: 'd-flex flex-wrap cursor-text' }, endAdornment: React.createElement(InputAdornment, { position: "end", className: classes.inputEndAdornment },
268
- React.createElement(Edit, null)), IconComponent: stubComponent },
269
- React.createElement(MenuItem, { value: "stub" }, InputValueForRender || React.createElement("span", { className: "placeholderContent" }, placeholder || 'No value')))
270
- : null })));
271
- }, popupIcon: stubComponent(), disableListWrap: true, openOnFocus: true }))));
272
- }
273
- export default TagInputList;
@@ -1,6 +0,0 @@
1
- export * from './AddTagMenuItem';
2
- export * from './AddTagMenu';
3
- export * from './TagInputList';
4
- export { default as AddTagMenuItem } from './AddTagMenuItem';
5
- export { default as AddTagMenu } from './AddTagMenu';
6
- export { default as TagInputList } from './TagInputList';
@@ -1,6 +0,0 @@
1
- export * from './AddTagMenuItem';
2
- export * from './AddTagMenu';
3
- export * from './TagInputList';
4
- export { default as AddTagMenuItem } from './AddTagMenuItem';
5
- export { default as AddTagMenu } from './AddTagMenu';
6
- export { default as TagInputList } from './TagInputList';
@@ -1,4 +0,0 @@
1
- import { ThemeValues, AppTheme } from '../model';
2
- export declare const theme: {
3
- [K in ThemeValues]: Partial<AppTheme>;
4
- };