ish-ui 1.3.0 → 1.3.2
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.
|
@@ -35,6 +35,12 @@ const DynamicSizeList = React.forwardRef(({ children, itemCount, itemData, heigh
|
|
|
35
35
|
(_a = listApi.current) === null || _a === void 0 ? void 0 : _a.scrollToRow({ index, align });
|
|
36
36
|
},
|
|
37
37
|
}), []);
|
|
38
|
-
return (React.createElement(List, { className: className,
|
|
38
|
+
return (React.createElement(List, { className: className,
|
|
39
|
+
// react-window v2 defaults the container to `maxHeight: 100%`. Callers
|
|
40
|
+
// commonly wrap this in react-virtualized-auto-sizer, whose wrapper is
|
|
41
|
+
// `height: 0` and expects the child to overflow it, so that 100% would
|
|
42
|
+
// resolve to zero and the list would render nothing. An explicit height
|
|
43
|
+
// supersedes the cap; without one, v2's default is left alone.
|
|
44
|
+
style: Object.assign({ height, width }, (height == null ? {} : { maxHeight: 'none' })), listRef: attachRefs, rowComponent: children, rowProps: { data: itemData }, rowCount: itemCount, rowHeight: rowHeight, overscanCount: overscanCount }));
|
|
39
45
|
});
|
|
40
46
|
export default DynamicSizeList;
|
package/dist/model/Fields.d.ts
CHANGED
|
@@ -231,6 +231,7 @@ export interface TagsFieldProps<T, IP, MP> extends EditInPlaceFieldProps<IP, MP>
|
|
|
231
231
|
validateEntity?: string;
|
|
232
232
|
allowParentSelect?: boolean;
|
|
233
233
|
hideColor?: boolean;
|
|
234
|
+
trackCarretPosition?: boolean;
|
|
234
235
|
}
|
|
235
236
|
export interface FormFieldBaseProps {
|
|
236
237
|
required?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
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, editIcon, variant, hideColor }: TagsFieldProps<T, IP, MP>): React.JSX.Element;
|
|
3
|
+
declare function TagInputList<T extends TagLike, IP extends FieldInputProps, MP extends FieldMetaProps>({ input, tags, placeholder, labelAdornment, meta, label, disabled, className, warning, allowParentSelect, fieldClasses, editIcon, variant, hideColor, trackCarretPosition }: TagsFieldProps<T, IP, MP>): React.JSX.Element;
|
|
4
4
|
export default TagInputList;
|
|
@@ -16,17 +16,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
16
16
|
}
|
|
17
17
|
return t;
|
|
18
18
|
};
|
|
19
|
-
import
|
|
19
|
+
import { Edit, Tag } from '@mui/icons-material';
|
|
20
20
|
import { Chip } from '@mui/material';
|
|
21
21
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
22
|
-
import {
|
|
23
|
-
import { useSelectStyles } from '../formFields';
|
|
24
|
-
import AddTagMenu from './AddTagMenu';
|
|
25
|
-
import EditInPlaceFieldBase from '../formFields/EditInPlaceFieldBase';
|
|
26
|
-
import { getAllMenuTags, getHighlightedPartLabel, getMenuTags, stubComponent } from '../utils';
|
|
22
|
+
import React, { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
27
23
|
import { makeAppStyles } from '../styles';
|
|
24
|
+
import { EditInPlaceFieldBase, useSelectStyles } from '../formFields';
|
|
25
|
+
import { getAllMenuTags, getHighlightedPartLabel, getMenuTags, stubComponent } from '../utils';
|
|
26
|
+
import { AddTagMenu } from '../tagsInput/index';
|
|
28
27
|
import { useAppTheme } from '../themes';
|
|
29
|
-
const useStyles = makeAppStyles()(
|
|
28
|
+
const useStyles = makeAppStyles()(theme => ({
|
|
30
29
|
tagColorDotSmall: {
|
|
31
30
|
width: theme.spacing(2),
|
|
32
31
|
minWidth: theme.spacing(2),
|
|
@@ -99,7 +98,7 @@ const getFullTag = (tagId, tags) => {
|
|
|
99
98
|
++i;
|
|
100
99
|
}
|
|
101
100
|
};
|
|
102
|
-
function TagInputList({ input, tags, placeholder, labelAdornment, meta, label = 'Tags', disabled, className, warning, allowParentSelect, fieldClasses = {}, editIcon, variant, hideColor }) {
|
|
101
|
+
function TagInputList({ input, tags, placeholder, labelAdornment, meta, label = 'Tags', disabled, className, warning, allowParentSelect, fieldClasses = {}, editIcon, variant, hideColor, trackCarretPosition = true }) {
|
|
103
102
|
const [menuIsOpen, setMenuIsOpen] = useState(false);
|
|
104
103
|
const [activeTag, setActiveTag] = useState(null);
|
|
105
104
|
const [isEditing, setIsEditing] = useState(false);
|
|
@@ -191,7 +190,7 @@ function TagInputList({ input, tags, placeholder, labelAdornment, meta, label =
|
|
|
191
190
|
React.createElement("div", { className: cx('relative', {
|
|
192
191
|
'pointer-events-none': disabled
|
|
193
192
|
}) }, React.createElement(Autocomplete, { value: input.value, multiple: true, open: menuIsOpen, options: filteredOptions, onBlur: exit, onChange: handleChange, renderOption: renderOption, filterOptions: filterOptionsInner, getOptionLabel: getOptionLabel, slots: {
|
|
194
|
-
popper: inputValue ? undefined : popperAdapter,
|
|
193
|
+
popper: inputValue || !trackCarretPosition ? undefined : popperAdapter,
|
|
195
194
|
listbox: inputValue ? undefined : listboxAdapter
|
|
196
195
|
}, classes: {
|
|
197
196
|
root: classes.root,
|
|
@@ -202,7 +201,13 @@ function TagInputList({ input, tags, placeholder, labelAdornment, meta, label =
|
|
|
202
201
|
noOptions: 'd-none'
|
|
203
202
|
}, renderValue: (tagValue, getItemProps) => tagValue.map((option, index) => {
|
|
204
203
|
const tagProps = __rest(getItemProps({ index }), []);
|
|
205
|
-
const menuTag = allMenuTags.find(t => t.tagBody.id === option)
|
|
204
|
+
const menuTag = allMenuTags.find(t => t.tagBody.id === option) || {
|
|
205
|
+
tagBody: {
|
|
206
|
+
id: option,
|
|
207
|
+
color: theme.palette.error.main.replace('#', ''),
|
|
208
|
+
name: 'Error: Tag not found!'
|
|
209
|
+
}
|
|
210
|
+
};
|
|
206
211
|
const tagColors = theme.palette.augmentColor({
|
|
207
212
|
color: { main: `#${menuTag.tagBody.color}` }
|
|
208
213
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ish-ui",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"description": "UI elements for onCourse and other ish apps",
|
|
6
6
|
"main": "main.ts",
|
|
7
7
|
"devDependencies": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"style-loader": "^4.0.0",
|
|
30
30
|
"swc-loader": "^0.2.7",
|
|
31
31
|
"terser-webpack-plugin": "^5.6.1",
|
|
32
|
+
"ts-checker-rspack-plugin": "^1.6.1",
|
|
32
33
|
"tsc-alias": "^1.9.1",
|
|
33
34
|
"typescript": "^7.0.2",
|
|
34
35
|
"webpack": "^5.109.2",
|
|
@@ -84,8 +85,9 @@
|
|
|
84
85
|
},
|
|
85
86
|
"scripts": {
|
|
86
87
|
"test": "exit 0",
|
|
87
|
-
"start": "webpack serve --env
|
|
88
|
-
"start:prod": "webpack serve --env
|
|
88
|
+
"start": "webpack serve --config-node-env development --config tools/webpack/webpack.config.dev.js",
|
|
89
|
+
"start:prod": "webpack serve --config-node-env production --config tools/webpack/webpack.config.prod.js",
|
|
90
|
+
"analyze": "ANALYZE=1 webpack --config-node-env development --config tools/webpack/webpack.config.dev.js",
|
|
89
91
|
"build": "tsc -p tsconfig.prod.json && tsc-alias -p tsconfig.prod.json",
|
|
90
92
|
"lint": "oxlint src/",
|
|
91
93
|
"typecheck": "tsc --noEmit -p tsconfig.prod.json"
|
|
@@ -110,6 +112,7 @@
|
|
|
110
112
|
"react-beautiful-dnd-next": {
|
|
111
113
|
"react": "$react",
|
|
112
114
|
"react-dom": "$react-dom"
|
|
113
|
-
}
|
|
115
|
+
},
|
|
116
|
+
"uuid": "^11.1.1"
|
|
114
117
|
}
|
|
115
|
-
}
|
|
118
|
+
}
|