ish-ui 1.0.0-alpha.23 → 1.0.0-alpha.24
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/dist/model/Fields.d.ts
CHANGED
|
@@ -220,7 +220,6 @@ export interface CheckboxFieldProps<IP> {
|
|
|
220
220
|
export interface TagsFieldProps<T, IP, MP> extends EditInPlaceFieldProps<IP, MP> {
|
|
221
221
|
tags: T[];
|
|
222
222
|
showConfirm?: ShowConfirmCaller;
|
|
223
|
-
classes?: any;
|
|
224
223
|
validateEntity?: string;
|
|
225
224
|
}
|
|
226
225
|
export interface FormFieldBaseProps {
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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, fieldClasses }: TagsFieldProps<T, IP, MP>): React.JSX.Element;
|
|
4
|
+
export default TagInputList;
|
|
@@ -19,8 +19,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
20
|
import { InputAdornment, MenuItem, Select } from '@mui/material';
|
|
21
21
|
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
22
|
-
import createStyles from '@mui/styles/createStyles';
|
|
23
|
-
import withStyles from '@mui/styles/withStyles';
|
|
24
22
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
25
23
|
import clsx from 'clsx';
|
|
26
24
|
import { Edit } from '@mui/icons-material';
|
|
@@ -30,8 +28,8 @@ import EditInPlaceFieldBase from '../formFields/EditInPlaceFieldBase';
|
|
|
30
28
|
import { getAllMenuTags, getHighlightedPartLabel, getMenuTags } from '../utils';
|
|
31
29
|
import { stubComponent } from '../utils/stubs';
|
|
32
30
|
import getCaretCoordinates from '../utils/DOM/getCaretCoordinates';
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
import { makeAppStyles } from '../styles';
|
|
32
|
+
const useStyles = makeAppStyles((theme) => (Object.assign({ inputEndAdornment: {
|
|
35
33
|
visibility: 'hidden',
|
|
36
34
|
display: 'flex',
|
|
37
35
|
color: theme.palette.primary.main,
|
|
@@ -39,20 +37,16 @@ const styles = theme => createStyles({
|
|
|
39
37
|
alignSelf: 'flex-end',
|
|
40
38
|
marginBottom: '4px',
|
|
41
39
|
opacity: 0.5
|
|
42
|
-
},
|
|
43
|
-
tagColorDotSmall: {
|
|
40
|
+
}, tagColorDotSmall: {
|
|
44
41
|
width: theme.spacing(2),
|
|
45
42
|
minWidth: theme.spacing(2),
|
|
46
43
|
height: theme.spacing(2),
|
|
47
44
|
minHeight: theme.spacing(2),
|
|
48
45
|
background: 'red',
|
|
49
46
|
borderRadius: '100%'
|
|
50
|
-
},
|
|
51
|
-
listbox: {
|
|
47
|
+
}, listbox: {
|
|
52
48
|
whiteSpace: 'break-spaces'
|
|
53
|
-
},
|
|
54
|
-
invalid: {}
|
|
55
|
-
});
|
|
49
|
+
}, invalid: {} }, selectStyles(theme))));
|
|
56
50
|
const endTagRegex = /#\s*[^\w\d]*$/;
|
|
57
51
|
const getCurrentInputString = (input, formTagIds = [], allMenuTags = []) => {
|
|
58
52
|
let substr = input;
|
|
@@ -90,12 +84,13 @@ const getInputString = (tagIds, allTags) => ((tagIds === null || tagIds === void
|
|
|
90
84
|
return (tag ? `${acc}#${tag.name} ` : acc);
|
|
91
85
|
}, '')
|
|
92
86
|
: '');
|
|
93
|
-
function TagInputList({ input, tags,
|
|
87
|
+
function TagInputList({ input, tags, placeholder, labelAdornment, meta, label = 'Tags', disabled, className, warning, fieldClasses = {} }) {
|
|
94
88
|
const [menuIsOpen, setMenuIsOpen] = useState(false);
|
|
95
89
|
const [activeTag, setActiveTag] = useState(null);
|
|
96
90
|
const [isEditing, setIsEditing] = useState(false);
|
|
97
91
|
const [inputValue, setInputValue] = useState('');
|
|
98
92
|
const [currentInputString, setCurrentInputString] = useState('');
|
|
93
|
+
const classes = useStyles();
|
|
99
94
|
const InputValueForRender = useMemo(() => {
|
|
100
95
|
var _a;
|
|
101
96
|
if (!inputValue || !tags || !tags.length)
|
|
@@ -275,4 +270,4 @@ function TagInputList({ input, tags, classes, placeholder, labelAdornment, meta,
|
|
|
275
270
|
: null })));
|
|
276
271
|
}, popupIcon: stubComponent(), disableListWrap: true, openOnFocus: true }))));
|
|
277
272
|
}
|
|
278
|
-
export default
|
|
273
|
+
export default TagInputList;
|