ish-ui 1.0.0-alpha.22 → 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.
|
@@ -17,7 +17,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
17
17
|
return t;
|
|
18
18
|
};
|
|
19
19
|
import React, { useCallback } from 'react';
|
|
20
|
-
import
|
|
20
|
+
import NumberFormat from 'react-number-format';
|
|
21
21
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
22
22
|
import clsx from 'clsx';
|
|
23
23
|
import EditInPlaceField from './EditInPlaceField';
|
|
@@ -27,7 +27,7 @@ const NumberFormatCustom = React.forwardRef((props, ref) => {
|
|
|
27
27
|
const onValueChange = useCallback(values => {
|
|
28
28
|
onChange(normalizeNumber(values.value));
|
|
29
29
|
}, []);
|
|
30
|
-
return (React.createElement(
|
|
30
|
+
return (React.createElement(NumberFormat, Object.assign({}, other, { getInputRef: ref, onValueChange: onValueChange, allowNegative: allowNegative, decimalScale: 2, thousandSeparator: true })));
|
|
31
31
|
});
|
|
32
32
|
const preformatDisplayValue = value => value || value === 0 ? formatCurrency(value, '') : value;
|
|
33
33
|
function EditInPlaceMoneyField(_a) {
|
|
@@ -17,7 +17,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
17
17
|
return t;
|
|
18
18
|
};
|
|
19
19
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
20
|
-
import
|
|
20
|
+
import NumberFormat from 'react-number-format';
|
|
21
21
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
22
22
|
import PhoneIcon from '@mui/icons-material/Phone';
|
|
23
23
|
import debounce from 'lodash.debounce';
|
|
@@ -59,7 +59,7 @@ const NumberFormatCustom = React.forwardRef((props, ref) => {
|
|
|
59
59
|
ref = input;
|
|
60
60
|
inputRef.current = input;
|
|
61
61
|
};
|
|
62
|
-
return (React.createElement(
|
|
62
|
+
return (React.createElement(NumberFormat, Object.assign({}, other, { getInputRef: getInputRef, onKeyPress: onKeyPress, prefix: prefix, onValueChange: onValueChange, format: format, type: "text" })));
|
|
63
63
|
});
|
|
64
64
|
function EditInPlacePhoneField(_a) {
|
|
65
65
|
var { InputProps, className } = _a, restProps = __rest(_a, ["InputProps", "className"]);
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ish-ui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.24",
|
|
4
4
|
"description": "UI elements for onCourse and other ish apps",
|
|
5
5
|
"main": "main.ts",
|
|
6
6
|
"devDependencies": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react-color": "^2.19.3",
|
|
82
82
|
"react-dom": "^18.2.0",
|
|
83
83
|
"react-dropzone": "^14.2.3",
|
|
84
|
-
"react-number-format": "
|
|
84
|
+
"react-number-format": "4.9.3",
|
|
85
85
|
"react-window": "^1.8.9",
|
|
86
86
|
"react-window-infinite-loader": "^1.0.9",
|
|
87
87
|
"redux": "^4.2.1"
|