ish-ui 1.2.8 → 1.3.0
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/appBar/AppBarHelpMenu.js +1 -1
- package/dist/colorPicker/ColorPicker.js +2 -2
- package/dist/dialog/BrowserWarning.js +1 -1
- package/dist/dialog/message/Message.js +21 -15
- package/dist/dynamicSizeList/DynamicSizeList.d.ts +21 -12
- package/dist/dynamicSizeList/DynamicSizeList.js +30 -157
- package/dist/fieldMessage/styles.d.ts +2 -2
- package/dist/fileUploader/FileUploaderDialog.js +8 -1
- package/dist/formFields/AutosizeInput.d.ts +14 -0
- package/dist/formFields/AutosizeInput.js +156 -0
- package/dist/formFields/CheckboxField.d.ts +4 -2
- package/dist/formFields/ColoredCheckBox.js +5 -2
- package/dist/formFields/EditInPlaceDateTimeField.js +35 -36
- package/dist/formFields/EditInPlaceField.js +8 -9
- package/dist/formFields/EditInPlaceFieldBase.d.ts +2 -3
- package/dist/formFields/EditInPlaceFieldBase.js +7 -14
- package/dist/formFields/EditInPlaceFileField.js +10 -2
- package/dist/formFields/EditInPlaceMoneyField.js +2 -2
- package/dist/formFields/EditInPlacePhoneField.js +13 -3
- package/dist/formFields/EditInPlaceSearchSelect.js +6 -3
- package/dist/formFields/SelectCustomComponents.d.ts +18 -4
- package/dist/formFields/SelectCustomComponents.js +36 -20
- package/dist/formFields/Switch.d.ts +3 -1
- package/dist/markdownEditor/WysiwygEditor.js +14 -16
- package/dist/markdownEditor/utils/index.d.ts +1 -1
- package/dist/model/Fields.d.ts +1 -6
- package/dist/styles/makeStyles.d.ts +8 -25
- package/dist/styles/makeStyles.js +9 -3
- package/dist/tagsInput/AddTagMenu.d.ts +2 -2
- package/dist/tagsInput/AddTagMenu.js +8 -5
- package/dist/tagsInput/AddTagMenuItem.d.ts +2 -2
- package/dist/tagsInput/AddTagMenuItem.js +1 -1
- package/dist/tagsInput/TagInputList.js +102 -155
- package/dist/themes/ishTheme.js +13 -3
- package/dist/utils/DOM/index.d.ts +0 -1
- package/dist/utils/DOM/index.js +0 -1
- package/dist/utils/dates/formatTimezone.js +3 -3
- package/dist/utils/formatting/index.d.ts +1 -1
- package/dist/utils/hooks/index.d.ts +16 -0
- package/dist/utils/hooks/index.js +31 -1
- package/dist/utils/tags/index.d.ts +1 -1
- package/dist/utils/tags/index.js +1 -1
- package/package.json +81 -71
- package/tsconfig.prod.json +3 -0
- package/dist/utils/DOM/getCaretCoordinates.d.ts +0 -6
- package/dist/utils/DOM/getCaretCoordinates.js +0 -109
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InputProps } from '@mui/material
|
|
2
|
+
import { FormControlTypeMap, InputProps } from '@mui/material';
|
|
3
3
|
import { FieldClasses } from '../model';
|
|
4
|
-
import { FormControlTypeMap } from '@mui/material/FormControl/FormControl';
|
|
5
4
|
interface Props {
|
|
6
5
|
name: string;
|
|
7
6
|
value: string;
|
|
@@ -24,5 +23,5 @@ interface Props {
|
|
|
24
23
|
hideArrows?: boolean;
|
|
25
24
|
variant?: FormControlTypeMap['props']['variant'];
|
|
26
25
|
}
|
|
27
|
-
declare const EditInPlaceFieldBase: ({
|
|
26
|
+
declare const EditInPlaceFieldBase: ({ invalid, className, inline, label, fieldClasses, rightAligned, shrink, name, disabled, labelAdornment, editIcon, error, placeholder, hideArrows, warning, endAdornmentClass, CustomInput, InputProps, variant }: Props) => React.JSX.Element;
|
|
28
27
|
export default EditInPlaceFieldBase;
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*
|
|
6
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
7
|
*/
|
|
8
|
-
import React, {
|
|
8
|
+
import React, { useMemo, useRef } from 'react';
|
|
9
9
|
import { FilledInput, FormControl, FormHelperText, Input, InputAdornment, InputLabel, OutlinedInput, } from '@mui/material';
|
|
10
10
|
import { makeAppStyles } from '../styles';
|
|
11
11
|
import WarningMessage from '../fieldMessage/WarningMessage';
|
|
12
|
-
import {
|
|
12
|
+
import { AutosizeInput } from '../formFields/AutosizeInput';
|
|
13
13
|
const useStyles = makeAppStyles()((theme, p, classes) => ({
|
|
14
14
|
label: {
|
|
15
15
|
whiteSpace: 'nowrap',
|
|
@@ -55,19 +55,13 @@ const useStyles = makeAppStyles()((theme, p, classes) => ({
|
|
|
55
55
|
pointerEvents: 'none'
|
|
56
56
|
}
|
|
57
57
|
}));
|
|
58
|
-
const EditInPlaceFieldBase = ({
|
|
59
|
-
const [inputWidth, setInputWidth] = useState();
|
|
58
|
+
const EditInPlaceFieldBase = ({ invalid, className, inline, label, fieldClasses = {}, rightAligned, shrink, name, disabled, labelAdornment, editIcon, error, placeholder, hideArrows, warning, endAdornmentClass, CustomInput, InputProps, variant = 'standard' }) => {
|
|
60
59
|
const { classes, cx } = useStyles();
|
|
61
|
-
const inputNode = useRef();
|
|
60
|
+
const inputNode = useRef(undefined);
|
|
62
61
|
const onAdornmentClick = () => {
|
|
63
62
|
var _a;
|
|
64
63
|
(_a = inputNode.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
65
64
|
};
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (inline && inputNode.current) {
|
|
68
|
-
setInputWidth(countWidth(value || placeholder, inputNode.current) + 1);
|
|
69
|
-
}
|
|
70
|
-
}, [value]);
|
|
71
65
|
const InputComp = useMemo(() => {
|
|
72
66
|
switch (variant) {
|
|
73
67
|
default:
|
|
@@ -86,21 +80,20 @@ const EditInPlaceFieldBase = ({ value, invalid, className, inline, label, fieldC
|
|
|
86
80
|
React.createElement("span", { className: classes.label }, label),
|
|
87
81
|
labelAdornment)),
|
|
88
82
|
CustomInput ||
|
|
89
|
-
React.createElement(InputComp, Object.assign({}, InputProps || {}, { inputRef: inputNode, inputProps: Object.assign({ placeholder,
|
|
83
|
+
React.createElement(InputComp, Object.assign({}, InputProps || {}, { inputComponent: inline ? AutosizeInput : undefined, inputRef: inputNode, inputProps: Object.assign({ placeholder,
|
|
90
84
|
disabled, className: cx(fieldClasses.text, {
|
|
91
85
|
[classes.inlineInput]: inline,
|
|
92
86
|
[classes.readonly]: disabled,
|
|
93
87
|
[classes.hideArrows]: hideArrows,
|
|
94
88
|
'text-end': rightAligned
|
|
95
|
-
}),
|
|
96
|
-
width: inline && !invalid ? inputWidth : undefined
|
|
97
|
-
} }, (InputProps === null || InputProps === void 0 ? void 0 : InputProps.inputProps) || {}), classes: {
|
|
89
|
+
}) }, (InputProps === null || InputProps === void 0 ? void 0 : InputProps.inputProps) || {}), classes: {
|
|
98
90
|
root: cx(fieldClasses.text, inline && classes.inlineInput),
|
|
99
91
|
underline: fieldClasses.underline
|
|
100
92
|
}, disabled: disabled, endAdornment: InputProps.endAdornment || (!disabled &&
|
|
101
93
|
React.createElement(InputAdornment, { position: "end", onClick: onAdornmentClick, className: cx(endAdornmentClass, {
|
|
102
94
|
['fsInherit']: inline,
|
|
103
95
|
['d-none']: (rightAligned || inline),
|
|
96
|
+
['ml-0']: inline,
|
|
104
97
|
['invisible']: variant !== 'outlined' && !(rightAligned || inline)
|
|
105
98
|
}) }, editIcon)), id: `input-${name}`, name: name })),
|
|
106
99
|
React.createElement(FormHelperText, { classes: {
|
|
@@ -21,14 +21,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
* */
|
|
22
22
|
import React, { useRef } from 'react';
|
|
23
23
|
import AttachmentIcon from '@mui/icons-material/Attachment';
|
|
24
|
+
import Close from '@mui/icons-material/Close';
|
|
24
25
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
25
26
|
import EditInPlaceField from './EditInPlaceField';
|
|
26
27
|
import { stubFunction } from '../utils';
|
|
28
|
+
import IconButton from '@mui/material/IconButton';
|
|
27
29
|
function EditInPlaceFileField(_a) {
|
|
28
30
|
var _b;
|
|
29
31
|
var { input } = _a, restProps = __rest(_a, ["input"]);
|
|
30
|
-
const inputRef = useRef();
|
|
31
|
-
const fileRef = useRef();
|
|
32
|
+
const inputRef = useRef(null);
|
|
33
|
+
const fileRef = useRef(null);
|
|
32
34
|
const handleFileSelect = e => {
|
|
33
35
|
if (e.target.files[0]) {
|
|
34
36
|
input.onChange(e.target.files[0]);
|
|
@@ -42,6 +44,9 @@ function EditInPlaceFileField(_a) {
|
|
|
42
44
|
inputRef.current.blur();
|
|
43
45
|
}, 200);
|
|
44
46
|
};
|
|
47
|
+
const onClear = () => {
|
|
48
|
+
input.onChange(null);
|
|
49
|
+
};
|
|
45
50
|
return (React.createElement(React.Fragment, null,
|
|
46
51
|
React.createElement("input", { type: "file", ref: fileRef, onChange: handleFileSelect, className: "d-none" }),
|
|
47
52
|
React.createElement(EditInPlaceField, Object.assign({}, restProps, { input: {
|
|
@@ -51,6 +56,9 @@ function EditInPlaceFileField(_a) {
|
|
|
51
56
|
}, InputProps: {
|
|
52
57
|
startAdornment: React.createElement(InputAdornment, { position: "start", className: (_b = restProps.fieldClasses) === null || _b === void 0 ? void 0 : _b.text },
|
|
53
58
|
React.createElement(AttachmentIcon, null)),
|
|
59
|
+
endAdornment: input.value && React.createElement(InputAdornment, { position: "end", className: "d-none" },
|
|
60
|
+
React.createElement(IconButton, { color: 'primary', size: 'small', onClick: onClear },
|
|
61
|
+
React.createElement(Close, null))),
|
|
54
62
|
onFocus,
|
|
55
63
|
inputProps: {
|
|
56
64
|
ref: inputRef
|
|
@@ -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 { NumericFormat } from 'react-number-format';
|
|
21
21
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
22
22
|
import EditInPlaceField from './EditInPlaceField';
|
|
23
23
|
import { formatCurrency, normalizeNumber } from '../utils';
|
|
@@ -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(NumericFormat, 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 { NumericFormat, PatternFormat } 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';
|
|
@@ -25,7 +25,7 @@ import EditInPlaceField from './EditInPlaceField';
|
|
|
25
25
|
import { getPhoneMask } from '../utils';
|
|
26
26
|
const NumberFormatCustom = React.forwardRef((props, ref) => {
|
|
27
27
|
const { onChange } = props, other = __rest(props, ["onChange"]);
|
|
28
|
-
const inputRef = useRef();
|
|
28
|
+
const inputRef = useRef(undefined);
|
|
29
29
|
const [format, setFormat] = useState(undefined);
|
|
30
30
|
const [prefix, setPrefix] = useState(undefined);
|
|
31
31
|
const processFormat = useCallback(debounce(data => {
|
|
@@ -59,7 +59,17 @@ const NumberFormatCustom = React.forwardRef((props, ref) => {
|
|
|
59
59
|
ref = input;
|
|
60
60
|
inputRef.current = input;
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
// react-number-format v5 split the old single NumberFormat component in two:
|
|
63
|
+
// PatternFormat requires a `format` mask, while NumericFormat covers the
|
|
64
|
+
// unmasked case and is the only one accepting `prefix`. The masks in
|
|
65
|
+
// PhoneMasks carry their own leading '+', so the prefix is only needed
|
|
66
|
+
// before a mask has been matched.
|
|
67
|
+
const commonProps = Object.assign(Object.assign({}, other), { getInputRef,
|
|
68
|
+
onKeyPress,
|
|
69
|
+
onValueChange, type: 'text' });
|
|
70
|
+
return format
|
|
71
|
+
? React.createElement(PatternFormat, Object.assign({}, commonProps, { format: format }))
|
|
72
|
+
: React.createElement(NumericFormat, Object.assign({}, commonProps, { prefix: prefix }));
|
|
63
73
|
});
|
|
64
74
|
function EditInPlacePhoneField(_a) {
|
|
65
75
|
var _b;
|
|
@@ -219,7 +219,7 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
219
219
|
if (typeof itemRenderer === 'function') {
|
|
220
220
|
return itemRenderer(getHighlightedPartLabel(getOptionLabel(data), searchValue), data, searchValue, optionProps);
|
|
221
221
|
}
|
|
222
|
-
return getHighlightedPartLabel(getOptionLabel(data), searchValue, optionProps
|
|
222
|
+
return [getHighlightedPartLabel(getOptionLabel(data), searchValue), optionProps];
|
|
223
223
|
};
|
|
224
224
|
const selectedOption = useMemo(() => sortedItems.find(i => multiple
|
|
225
225
|
? (input.value || []).includes(i[selectValueMark])
|
|
@@ -280,7 +280,7 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
280
280
|
return multiple && inputValue.length ? null : placeholder;
|
|
281
281
|
}, [multiple, placeholder, isEditing, inputValue]);
|
|
282
282
|
const renderInput = useCallback((_a) => {
|
|
283
|
-
var { InputProps, inputProps } = _a, params = __rest(_a, ["
|
|
283
|
+
var { slotProps: { input: InputProps, htmlInput: inputProps } } = _a, params = __rest(_a, ["slotProps"]);
|
|
284
284
|
const value = (isEditing ? searchValue : (typeof displayedValue === 'string' ? displayedValue : ''));
|
|
285
285
|
return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { variant: variant, key: input.name, name: input.name, value: value, error: error, invalid: hasError || invalid, inline: inline, label: label, warning: warning, fieldClasses: fieldClasses, rightAligned: rightAligned, shrink: Boolean(label || input.value), labelAdornment: labelAdornment, placeholder: renderedPlaceholder, editIcon: !hideEditIcon && renderIcons, InputProps: Object.assign(Object.assign({}, InputProps), { endAdornment: null, onChange: handleInputChange, onFocus: edit, onClick: onEditButtonFocus, onBlur,
|
|
286
286
|
disableUnderline, classes: {
|
|
@@ -350,6 +350,9 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
350
350
|
option: 'w-100 text-pre',
|
|
351
351
|
popper: classes.popper,
|
|
352
352
|
groupUl: 'm-0'
|
|
353
|
-
}, groupBy: categoryKey && (option => option[categoryKey]), renderOption: renderOption, getOptionLabel: getOptionLabel, filterOptions: filterItems,
|
|
353
|
+
}, groupBy: categoryKey && (option => option[categoryKey]), renderOption: renderOption, getOptionLabel: getOptionLabel, filterOptions: filterItems, slots: {
|
|
354
|
+
listbox: inline || categoryKey ? undefined : ListBoxAdapter,
|
|
355
|
+
popper: categoryKey ? undefined : PopperAdapter,
|
|
356
|
+
}, renderInput: renderInput, disableListWrap: true, openOnFocus: true, fullWidth: true }))));
|
|
354
357
|
}
|
|
355
358
|
export default EditInPlaceSearchSelect;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AppTheme } from '../model';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { AppTheme, EditInPlaceSearchSelectFieldProps } from '../model';
|
|
3
3
|
export declare const useSelectStyles: (params: void, muiStyleOverridesParams?: {
|
|
4
4
|
props: Record<string, unknown>;
|
|
5
5
|
ownerState?: Record<string, unknown> | undefined;
|
|
6
6
|
} | undefined) => {
|
|
7
|
-
classes: Record<"
|
|
7
|
+
classes: Record<"autoWidthSelect" | "bottomMargin" | "bottomPadding" | "editIcon" | "editable" | "emptySelect" | "error" | "expandIcon" | "hasClear" | "hasPopup" | "inline" | "inputWrapper" | "label" | "menuItem" | "menuItemActive" | "menuList" | "multiple" | "readonly" | "root" | "topMargin" | "valid" | "validUnderline", string>;
|
|
8
8
|
theme: AppTheme;
|
|
9
9
|
css: import("tss-react").Css;
|
|
10
10
|
cx: import("tss-react").Cx;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
interface ListRowProps {
|
|
13
|
+
data: {
|
|
14
|
+
children: [
|
|
15
|
+
[
|
|
16
|
+
React.ReactNode
|
|
17
|
+
],
|
|
18
|
+
React.HTMLAttributes<HTMLLIElement>
|
|
19
|
+
];
|
|
20
|
+
selectAdornment: EditInPlaceSearchSelectFieldProps<any, any>['selectAdornment'];
|
|
21
|
+
};
|
|
22
|
+
index: number;
|
|
23
|
+
style: CSSProperties;
|
|
24
|
+
}
|
|
25
|
+
export declare const ListRow: React.NamedExoticComponent<ListRowProps>;
|
|
13
26
|
export declare const ListboxComponent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
|
|
14
27
|
export declare const NoWrapOption: (content: any, data: any, search: any, parentProps: any) => React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
*
|
|
6
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
7
|
*/
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
8
17
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
9
18
|
var t = {};
|
|
10
19
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -20,8 +29,8 @@ import { useTheme } from '@mui/system';
|
|
|
20
29
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
21
30
|
import React from 'react';
|
|
22
31
|
import ListSubheader from '@mui/material/ListSubheader';
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
32
|
+
import { useInfiniteLoader } from 'react-window-infinite-loader';
|
|
33
|
+
import { List } from 'react-window';
|
|
25
34
|
import { green } from '@mui/material/colors';
|
|
26
35
|
import { ListItemButton } from '@mui/material';
|
|
27
36
|
import Tooltip from '@mui/material/Tooltip';
|
|
@@ -123,22 +132,14 @@ export const useSelectStyles = makeAppStyles()((theme, p, classes) => ({
|
|
|
123
132
|
}
|
|
124
133
|
},
|
|
125
134
|
}));
|
|
126
|
-
export const ListRow = React.memo(({ data: { children, selectAdornment }, index, style }) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
? selectAdornment.content
|
|
131
|
-
: children[index]));
|
|
132
|
-
}, areEqual);
|
|
133
|
-
const OuterElementContext = React.createContext({});
|
|
134
|
-
const OuterElementType = React.forwardRef((props, ref) => {
|
|
135
|
-
const outerProps = React.useContext(OuterElementContext);
|
|
136
|
-
return React.createElement("div", Object.assign({ ref: ref }, props, outerProps));
|
|
137
|
-
});
|
|
135
|
+
export const ListRow = React.memo(({ data: { children, selectAdornment }, index, style }) => React.createElement(ListItemButton, Object.assign({}, children[index][1], { selected: children[index][1]['aria-selected'], style: style, key: index }), (((selectAdornment === null || selectAdornment === void 0 ? void 0 : selectAdornment.position) === 'start' && index === 0)
|
|
136
|
+
|| ((selectAdornment === null || selectAdornment === void 0 ? void 0 : selectAdornment.position) === 'end' && index === children.length))
|
|
137
|
+
? selectAdornment.content
|
|
138
|
+
: children[index][0]));
|
|
138
139
|
export const ListboxComponent = React.forwardRef((props, ref) => {
|
|
139
|
-
const { children, rowHeight, remoteRowCount, loadMoreRows, classes, loading, selectAdornment, fieldClasses } = props, other = __rest(props, ["children", "rowHeight", "remoteRowCount", "loadMoreRows", "classes", "loading", "selectAdornment", "fieldClasses"]);
|
|
140
|
+
const { children, rowHeight, remoteRowCount, loadMoreRows, classes, loading, selectAdornment, fieldClasses, ownerState } = props, other = __rest(props, ["children", "rowHeight", "remoteRowCount", "loadMoreRows", "classes", "loading", "selectAdornment", "fieldClasses", "ownerState"]);
|
|
140
141
|
const { cx } = useStyles();
|
|
141
|
-
const itemData = { selectAdornment, children
|
|
142
|
+
const itemData = { selectAdornment, children };
|
|
142
143
|
const theme = useTheme();
|
|
143
144
|
const smUp = useMediaQuery(theme.breakpoints.up('sm'), { noSsr: true });
|
|
144
145
|
const itemSize = rowHeight || (smUp ? 36 : 48);
|
|
@@ -155,11 +156,26 @@ export const ListboxComponent = React.forwardRef((props, ref) => {
|
|
|
155
156
|
}
|
|
156
157
|
return itemData.children.map(getChildSize).reduce((a, b) => a + b, 0);
|
|
157
158
|
};
|
|
158
|
-
const
|
|
159
|
-
|
|
159
|
+
const isRowLoaded = index => index < (children.length + (selectAdornment ? 1 : 0));
|
|
160
|
+
// react-window-infinite-loader v2 replaces the render-prop component with a
|
|
161
|
+
// hook that returns the List's `onRowsRendered` callback.
|
|
162
|
+
const onRowsRendered = useInfiniteLoader({
|
|
163
|
+
isRowLoaded,
|
|
164
|
+
rowCount: itemCount,
|
|
165
|
+
loadMoreRows: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
166
|
+
if (!loading) {
|
|
167
|
+
yield loadMoreRows(itemData.children.length);
|
|
168
|
+
}
|
|
169
|
+
}),
|
|
170
|
+
});
|
|
171
|
+
// react-window v2 sizes itself from `style` rather than `height`/`width`
|
|
172
|
+
// props, and forwards unknown props to its root element — which makes the
|
|
173
|
+
// former outer-element context wrapper unnecessary.
|
|
160
174
|
return (React.createElement("div", { ref: ref },
|
|
161
|
-
React.createElement(
|
|
162
|
-
|
|
175
|
+
React.createElement(List, Object.assign({}, other, { className: cx(classes.menuList, fieldClasses.selectMenu), style: { height: getHeight(), width: '100%' },
|
|
176
|
+
// v2 types `rowComponent` as a plain function. ListRow stays memoised
|
|
177
|
+
// because it is part of the public API, so the cast bridges the two.
|
|
178
|
+
rowComponent: ListRow, rowProps: { data: itemData }, rowHeight: itemSize, rowCount: itemCount, onRowsRendered: onRowsRendered }))));
|
|
163
179
|
});
|
|
164
180
|
export const NoWrapOption = (content, data, search, parentProps) => (React.createElement("div", Object.assign({}, parentProps || {}),
|
|
165
181
|
React.createElement(Tooltip, { title: content },
|
|
@@ -3,5 +3,7 @@
|
|
|
3
3
|
* */
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { FieldInputProps, FormSwitchProps } from '../model';
|
|
6
|
-
|
|
6
|
+
declare const SwitchBase: (props: any) => React.JSX.Element;
|
|
7
|
+
export declare const Switch: typeof SwitchBase;
|
|
7
8
|
export declare function FormSwitch<InputProps extends FieldInputProps>({ input, color, disabled, stringValue, label, className, inline, onChangeHandler, onClick }: FormSwitchProps<InputProps>): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -6,22 +6,17 @@
|
|
|
6
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
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic
|
|
10
|
-
import EssentialsPlugin from '@ckeditor/ckeditor5-essentials
|
|
11
|
-
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat
|
|
12
|
-
import SourceEditing from '@ckeditor/ckeditor5-source-editing
|
|
13
|
-
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import TableToolbar from '@ckeditor/ckeditor5-table/src/tabletoolbar';
|
|
21
|
-
import Image from '@ckeditor/ckeditor5-image/src/image';
|
|
22
|
-
import LinkImage from '@ckeditor/ckeditor5-link/src/linkimage';
|
|
23
|
-
import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption';
|
|
24
|
-
import ImageStyle from '@ckeditor/ckeditor5-image/src/imagestyle';
|
|
9
|
+
import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';
|
|
10
|
+
import { Essentials as EssentialsPlugin } from '@ckeditor/ckeditor5-essentials';
|
|
11
|
+
import { Autoformat as AutoformatPlugin } from '@ckeditor/ckeditor5-autoformat';
|
|
12
|
+
import { SourceEditing } from '@ckeditor/ckeditor5-source-editing';
|
|
13
|
+
import { Bold as BoldPlugin, Italic as ItalicPlugin } from '@ckeditor/ckeditor5-basic-styles';
|
|
14
|
+
import { Heading as HeadingPlugin } from '@ckeditor/ckeditor5-heading';
|
|
15
|
+
import { Link as LinkPlugin, LinkImage } from '@ckeditor/ckeditor5-link';
|
|
16
|
+
import { List as ListPlugin } from '@ckeditor/ckeditor5-list';
|
|
17
|
+
import { Markdown } from '@ckeditor/ckeditor5-markdown-gfm';
|
|
18
|
+
import { Table, TableToolbar } from '@ckeditor/ckeditor5-table';
|
|
19
|
+
import { Image, ImageCaption, ImageStyle } from '@ckeditor/ckeditor5-image';
|
|
25
20
|
import { CKEditor } from '@ckeditor/ckeditor5-react';
|
|
26
21
|
import { createRoot } from 'react-dom/client';
|
|
27
22
|
import CodeIcon from '@mui/icons-material/Code';
|
|
@@ -29,6 +24,9 @@ import 'ace-builds/webpack-resolver';
|
|
|
29
24
|
const SourceEditingSwitch = () => (React.createElement("div", { className: "ck_source_edit_custom" },
|
|
30
25
|
React.createElement(CodeIcon, { className: "ck_code_icon_custom" })));
|
|
31
26
|
const config = {
|
|
27
|
+
// Mandatory since CKEditor 44. 'GPL' is the correct value for this AGPL
|
|
28
|
+
// project; without it the editor throws `license-key-missing` at mount.
|
|
29
|
+
licenseKey: 'GPL',
|
|
32
30
|
plugins: [
|
|
33
31
|
Markdown,
|
|
34
32
|
SourceEditing,
|
|
@@ -6,4 +6,4 @@ export declare const CONTENT_MODES: {
|
|
|
6
6
|
export declare const getContentMarker: (text: any) => any;
|
|
7
7
|
export declare const removeContentMarker: (text: any) => any;
|
|
8
8
|
export declare const addContentMarker: (text: any, contentMode: any) => string;
|
|
9
|
-
export declare const getEditorModeLabel: (mode: ContentMode) => "
|
|
9
|
+
export declare const getEditorModeLabel: (mode: ContentMode) => "HTML" | "LEGACY" | "RICH";
|
package/dist/model/Fields.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { ChangeEvent, DragEvent, FocusEvent, MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { Dispatch } from 'redux';
|
|
3
|
-
import { InputProps } from '@mui/material
|
|
3
|
+
import { CheckboxProps, FormControlTypeMap, InputProps, PopperPlacementType, RadioGroupProps, RadioProps } from '@mui/material';
|
|
4
4
|
import { AnyArgFunction } from '../model/CommonFunctions';
|
|
5
5
|
import { ShowConfirmCaller } from '../model/Confirm';
|
|
6
|
-
import { PopperPlacementType } from '@mui/material';
|
|
7
|
-
import { FormControlTypeMap } from '@mui/material/FormControl/FormControl';
|
|
8
|
-
import { RadioProps } from '@mui/material/Radio/Radio';
|
|
9
|
-
import { RadioGroupProps } from '@mui/material/RadioGroup/RadioGroup';
|
|
10
|
-
import { CheckboxProps } from '@mui/material/Checkbox/Checkbox';
|
|
11
6
|
export type EventHandler<Event> = (event: Event, name?: string) => void;
|
|
12
7
|
export interface EventOrValueHandler<Event> extends EventHandler<Event> {
|
|
13
8
|
(value: any): void;
|
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
import { AppTheme } from '../model';
|
|
2
|
-
|
|
3
|
-
<C extends keyof import("react").ReactHTML | import("tss-react/tools/ReactComponent").ReactComponent<any>, Props extends C extends import("tss-react/tools/ReactComponent").ReactComponent<infer P> ? P : C extends keyof import("react").ReactHTML ? import("react").ReactHTML[C] extends import("tss-react/tools/ReactComponent").ReactComponent<infer P_1> ? NonNullable<P_1> : never : never, CssObjectByRuleName extends Props extends {
|
|
4
|
-
classes?: Partial<infer ClassNameByRuleName> | undefined;
|
|
5
|
-
} ? { [RuleName in keyof ClassNameByRuleName]?: import("tss-react").CSSObject; } & {
|
|
6
|
-
[mediaQuery: `@media${string}`]: { [RuleName_1 in keyof ClassNameByRuleName]?: import("tss-react").CSSObject; };
|
|
7
|
-
} : {
|
|
8
|
-
root: import("tss-react").CSSObject;
|
|
9
|
-
} & {
|
|
10
|
-
[mediaQuery: `@media${string}`]: {
|
|
11
|
-
root: import("tss-react").CSSObject;
|
|
12
|
-
};
|
|
13
|
-
}>(Component: C, cssObjectByRuleNameOrGetCssObjectByRuleName: (CssObjectByRuleName & {
|
|
14
|
-
[mediaQuery: `@media${string}`]: { [Key in keyof CssObjectByRuleName]?: import("tss-react").CSSObject; };
|
|
15
|
-
}) | ((theme: AppTheme, props: Props, classes: Record<Exclude<keyof CssObjectByRuleName, `@media${string}`>, string>) => CssObjectByRuleName), params?: {
|
|
16
|
-
name?: string | Record<string, unknown> | undefined;
|
|
17
|
-
uniqId?: string | undefined;
|
|
18
|
-
} | undefined): C extends keyof import("react").ReactHTML ? import("react").ReactHTML[C] : C;
|
|
19
|
-
getClasses: <Classes>(props: {
|
|
20
|
-
className?: string | undefined;
|
|
21
|
-
classes?: Classes | undefined;
|
|
22
|
-
}) => Classes extends Record<string, unknown> ? Classes extends Partial<Record<infer K, any>> ? Record<K, string> : Classes : {
|
|
23
|
-
root: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
2
|
+
import { createMakeAndWithStyles } from 'tss-react';
|
|
26
3
|
export declare const makeAppStyles: <Params = void, RuleNameSubsetReferencableInNestedSelectors extends string = never>(params?: {
|
|
27
4
|
name?: string | Record<string, unknown> | undefined;
|
|
28
5
|
uniqId?: string | undefined;
|
|
@@ -35,4 +12,10 @@ export declare const makeAppStyles: <Params = void, RuleNameSubsetReferencableIn
|
|
|
35
12
|
css: import("tss-react").Css;
|
|
36
13
|
cx: import("tss-react").Cx;
|
|
37
14
|
};
|
|
38
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Annotated explicitly rather than inferred: tss-react's exports map does not
|
|
17
|
+
* expose `tss-react/tools/*`, so the inferred type of `withStyles` cannot be
|
|
18
|
+
* named in the emitted declarations. Referring to it through the factory's
|
|
19
|
+
* return type keeps the emitted `.d.ts` resolvable for consumers.
|
|
20
|
+
*/
|
|
21
|
+
export declare const withStyles: ReturnType<typeof createMakeAndWithStyles<AppTheme>>['withStyles'];
|
|
@@ -7,8 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { createMakeAndWithStyles } from 'tss-react';
|
|
9
9
|
import { useTheme } from '@mui/system';
|
|
10
|
-
const
|
|
10
|
+
const tss = createMakeAndWithStyles({
|
|
11
11
|
useTheme,
|
|
12
12
|
});
|
|
13
|
-
export const makeAppStyles = makeStyles;
|
|
14
|
-
|
|
13
|
+
export const makeAppStyles = tss.makeStyles;
|
|
14
|
+
/**
|
|
15
|
+
* Annotated explicitly rather than inferred: tss-react's exports map does not
|
|
16
|
+
* expose `tss-react/tools/*`, so the inferred type of `withStyles` cannot be
|
|
17
|
+
* named in the emitted declarations. Referring to it through the factory's
|
|
18
|
+
* return type keeps the emitted `.d.ts` resolvable for consumers.
|
|
19
|
+
*/
|
|
20
|
+
export const withStyles = tss.withStyles;
|
|
@@ -6,8 +6,8 @@ interface Props<T> {
|
|
|
6
6
|
hideColor?: boolean;
|
|
7
7
|
tags: MenuTag<T>[];
|
|
8
8
|
handleAdd: (tag: MenuTag<T>) => void;
|
|
9
|
-
activeTag:
|
|
10
|
-
setActiveTag: (arg: (
|
|
9
|
+
activeTag: number;
|
|
10
|
+
setActiveTag: (arg: (number | ((prevState: number) => number))) => void;
|
|
11
11
|
}
|
|
12
12
|
declare function AddTagMenu<T extends TagLike>({ classes, tags, hideColor, handleAdd, activeTag, setActiveTag, allowParentSelect }: Props<T>): React.JSX.Element;
|
|
13
13
|
declare const _default: typeof AddTagMenu;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { useStyles, withStyles } from 'tss-react/mui';
|
|
3
3
|
import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
|
|
4
4
|
import MenuItem from '@mui/material/MenuItem';
|
|
5
|
-
import List from '@mui/material/List';
|
|
6
5
|
import AddTagMenuItem from './AddTagMenuItem';
|
|
6
|
+
import MenuList from '@mui/material/MenuList';
|
|
7
|
+
import { getAllMenuTags } from '../utils';
|
|
7
8
|
const styles = theme => ({
|
|
8
9
|
listItem: {
|
|
9
10
|
padding: theme.spacing(0, 0.5, 0, 2)
|
|
@@ -22,15 +23,17 @@ const styles = theme => ({
|
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
function AddTagMenu({ classes, tags, hideColor, handleAdd, activeTag, setActiveTag, allowParentSelect }) {
|
|
26
|
+
const activeTagItem = useMemo(() => { var _a; return activeTag && ((_a = getAllMenuTags(tags)) === null || _a === void 0 ? void 0 : _a.find(t => t.tagBody.id === activeTag)); }, [activeTag, tags]);
|
|
25
27
|
const handleBack = () => {
|
|
26
|
-
|
|
28
|
+
var _a;
|
|
29
|
+
setActiveTag((_a = activeTagItem.parent) === null || _a === void 0 ? void 0 : _a.tagBody.id);
|
|
27
30
|
};
|
|
28
31
|
const { cx } = useStyles();
|
|
29
|
-
return (React.createElement(
|
|
32
|
+
return (React.createElement(MenuList, { className: classes.rootMenu },
|
|
30
33
|
activeTag && (React.createElement(MenuItem, { onClick: handleBack, className: classes.listItem },
|
|
31
34
|
React.createElement("span", { className: cx('d-flex textSecondaryColor', classes.backContainer) },
|
|
32
35
|
React.createElement(KeyboardArrowLeft, { color: "inherit" }),
|
|
33
36
|
"Back"))),
|
|
34
|
-
(
|
|
37
|
+
(activeTagItem ? activeTagItem.children : tags).map(t => (React.createElement(AddTagMenuItem, { key: t.tagBody.id, tag: t, classes: classes, setActiveTag: setActiveTag, handleAdd: handleAdd, allowParentSelect: allowParentSelect, hideColor: hideColor })))));
|
|
35
38
|
}
|
|
36
39
|
export default withStyles(AddTagMenu, styles);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MenuTag, TagLike } from '../model';
|
|
2
|
+
import { MenuTag, NumberArgFunction, TagLike } from '../model';
|
|
3
3
|
interface Props<T> {
|
|
4
4
|
classes: any;
|
|
5
|
-
setActiveTag:
|
|
5
|
+
setActiveTag: NumberArgFunction;
|
|
6
6
|
handleAdd: (tag: MenuTag<T>) => void;
|
|
7
7
|
tag: MenuTag<T>;
|
|
8
8
|
allowParentSelect?: boolean;
|
|
@@ -13,7 +13,7 @@ import { IconButton } from '@mui/material';
|
|
|
13
13
|
import { useStyles } from 'tss-react/mui';
|
|
14
14
|
function AddTagMenuItem({ setActiveTag, tag, classes, handleAdd, hideColor, allowParentSelect }) {
|
|
15
15
|
const openSubmenu = () => {
|
|
16
|
-
setActiveTag(tag);
|
|
16
|
+
setActiveTag(tag.tagBody.id);
|
|
17
17
|
};
|
|
18
18
|
const toggleChecked = (e) => {
|
|
19
19
|
e.stopPropagation();
|