ish-ui 1.0.45 → 1.0.47
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.
|
@@ -19,7 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
20
20
|
import Popper from '@mui/material/Popper';
|
|
21
21
|
import { Autocomplete, IconButton, InputAdornment, Select } from '@mui/material';
|
|
22
|
-
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
22
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
23
23
|
import CloseIcon from '@mui/icons-material//Close';
|
|
24
24
|
import clsx from 'clsx';
|
|
25
25
|
import ExpandMore from '@mui/icons-material/ExpandMore';
|
|
@@ -232,6 +232,9 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
232
232
|
else {
|
|
233
233
|
response = getOptionLabel(selectedOption) || defaultValue || input.value;
|
|
234
234
|
}
|
|
235
|
+
if (multiple) {
|
|
236
|
+
response = '';
|
|
237
|
+
}
|
|
235
238
|
if (alwaysDisplayDefault) {
|
|
236
239
|
response = defaultValue;
|
|
237
240
|
}
|
|
@@ -271,9 +274,57 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
271
274
|
return input.value || null;
|
|
272
275
|
}, [input.value, multiple, selectValueMark, sortedItems]);
|
|
273
276
|
const renderedPlaceholder = useMemo(() => {
|
|
274
|
-
|
|
275
|
-
return multiple && inputValue.length ? null : rendered;
|
|
277
|
+
return multiple && inputValue.length ? null : placeholder;
|
|
276
278
|
}, [multiple, placeholder, isEditing, inputValue]);
|
|
279
|
+
const renderInput = useCallback((_a) => {
|
|
280
|
+
var { InputProps, inputProps } = _a, params = __rest(_a, ["InputProps", "inputProps"]);
|
|
281
|
+
const value = (isEditing ? searchValue : (typeof displayedValue === 'string' ? displayedValue : ''));
|
|
282
|
+
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,
|
|
283
|
+
disableUnderline, classes: {
|
|
284
|
+
underline: fieldClasses.underline,
|
|
285
|
+
input: clsx(disabled && classes.readonly, fieldClasses.text),
|
|
286
|
+
}, inputProps: Object.assign(Object.assign({}, inputProps), { value: multiple ? inputProps.value : value, className: clsx(fieldClasses.text, 'mr-auto', inputProps.className), ref: ref => {
|
|
287
|
+
inputProps.ref.current = ref;
|
|
288
|
+
inputNode.current = ref;
|
|
289
|
+
if (inputRef)
|
|
290
|
+
inputRef.current = ref;
|
|
291
|
+
} }) }), CustomInput: (valueRenderer && !multiple && !isEditing && input.value)
|
|
292
|
+
?
|
|
293
|
+
React.createElement(Select, Object.assign({}, InputProps, { inputRef: ref => {
|
|
294
|
+
inputProps.ref.current = ref === null || ref === void 0 ? void 0 : ref.node;
|
|
295
|
+
}, classes: {
|
|
296
|
+
select: clsx('cursor-text', fieldClasses.text)
|
|
297
|
+
}, onFocus: edit, value: (returnType === 'object' ? input.value[selectValueMark] : input.value) || '', endAdornment: React.createElement(InputAdornment, { position: "end", className: 'd-none' }, renderIcons), IconComponent: stubComponent }), renderValue)
|
|
298
|
+
: null })));
|
|
299
|
+
}, [
|
|
300
|
+
variant,
|
|
301
|
+
input,
|
|
302
|
+
displayedValue,
|
|
303
|
+
error,
|
|
304
|
+
hasError,
|
|
305
|
+
invalid,
|
|
306
|
+
inline,
|
|
307
|
+
label,
|
|
308
|
+
warning,
|
|
309
|
+
fieldClasses,
|
|
310
|
+
rightAligned,
|
|
311
|
+
label,
|
|
312
|
+
input,
|
|
313
|
+
labelAdornment,
|
|
314
|
+
renderedPlaceholder,
|
|
315
|
+
renderValue,
|
|
316
|
+
hideEditIcon,
|
|
317
|
+
renderIcons,
|
|
318
|
+
disableUnderline,
|
|
319
|
+
fieldClasses,
|
|
320
|
+
disabled,
|
|
321
|
+
isEditing,
|
|
322
|
+
searchValue,
|
|
323
|
+
displayedValue,
|
|
324
|
+
valueRenderer,
|
|
325
|
+
multiple,
|
|
326
|
+
isEditing
|
|
327
|
+
]);
|
|
277
328
|
return (React.createElement("div", { className: clsx(className, 'outline-none', inline && classes.inline), id: input === null || input === void 0 ? void 0 : input.name },
|
|
278
329
|
React.createElement(SelectContext.Provider, { value: {
|
|
279
330
|
rowHeight,
|
|
@@ -296,25 +347,6 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
296
347
|
option: 'w-100 text-pre',
|
|
297
348
|
popper: classes.popper,
|
|
298
349
|
groupUl: 'm-0'
|
|
299
|
-
}, groupBy: categoryKey && (option => option[categoryKey]), renderOption: renderOption, getOptionLabel: getOptionLabel, filterOptions: filterItems, ListboxComponent: inline || categoryKey ? null : ListBoxAdapter, PopperComponent: categoryKey ? null : PopperAdapter, renderInput:
|
|
300
|
-
var { InputLabelProps, InputProps, inputProps } = _a, params = __rest(_a, ["InputLabelProps", "InputProps", "inputProps"]);
|
|
301
|
-
return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { variant: variant, name: input.name, value: displayedValue, 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,
|
|
302
|
-
disableUnderline, classes: {
|
|
303
|
-
underline: fieldClasses.underline,
|
|
304
|
-
input: clsx(disabled && classes.readonly, fieldClasses.text),
|
|
305
|
-
}, inputProps: Object.assign(Object.assign({}, inputProps), { className: clsx(fieldClasses.text, 'mr-auto', inputProps.className), ref: ref => {
|
|
306
|
-
inputProps.ref.current = ref;
|
|
307
|
-
inputNode.current = ref;
|
|
308
|
-
if (inputRef)
|
|
309
|
-
inputRef.current = ref;
|
|
310
|
-
}, value: (isEditing ? searchValue : multiple ? '' : (typeof displayedValue === 'string' ? displayedValue : '')) }) }), CustomInput: (valueRenderer && !multiple && !isEditing && input.value)
|
|
311
|
-
?
|
|
312
|
-
React.createElement(Select, Object.assign({}, InputProps, { inputRef: ref => {
|
|
313
|
-
inputProps.ref.current = ref === null || ref === void 0 ? void 0 : ref.node;
|
|
314
|
-
}, classes: {
|
|
315
|
-
select: clsx('cursor-text', fieldClasses.text)
|
|
316
|
-
}, onFocus: edit, value: (returnType === 'object' ? input.value[selectValueMark] : input.value) || '', endAdornment: React.createElement(InputAdornment, { position: "end", className: 'd-none' }, renderIcons), IconComponent: stubComponent }), renderValue)
|
|
317
|
-
: null })));
|
|
318
|
-
}, disableListWrap: true, openOnFocus: true, fullWidth: true }))));
|
|
350
|
+
}, groupBy: categoryKey && (option => option[categoryKey]), renderOption: renderOption, getOptionLabel: getOptionLabel, filterOptions: filterItems, ListboxComponent: inline || categoryKey ? null : ListBoxAdapter, PopperComponent: categoryKey ? null : PopperAdapter, renderInput: renderInput, disableListWrap: true, openOnFocus: true, fullWidth: true }))));
|
|
319
351
|
}
|
|
320
352
|
export default EditInPlaceSearchSelect;
|
|
@@ -158,7 +158,7 @@ export const ListboxComponent = React.forwardRef((props, ref) => {
|
|
|
158
158
|
const isItemLoaded = index => index < (children.length + (selectAdornment ? 1 : 0));
|
|
159
159
|
return (React.createElement("div", { ref: ref },
|
|
160
160
|
React.createElement(OuterElementContext.Provider, { value: other },
|
|
161
|
-
React.createElement(InfiniteLoader, { isItemLoaded: isItemLoaded, itemCount: itemCount, loadMoreItems: loadMoreItems }, ({ onItemsRendered }) => (React.createElement(List, { height: getHeight() + 2 * 8, width: "100%", className: clsx(classes.menuList, fieldClasses.selectMenu), itemData: itemData, outerElementType: OuterElementType, onItemsRendered: onItemsRendered, itemSize: itemSize, itemCount: itemCount }, ListRow))))));
|
|
161
|
+
React.createElement(InfiniteLoader, { isItemLoaded: isItemLoaded, itemCount: itemCount, loadMoreItems: loadMoreItems }, ({ onItemsRendered, ref }) => (React.createElement(List, { ref: ref, height: getHeight() + 2 * 8, width: "100%", className: clsx(classes.menuList, fieldClasses.selectMenu), itemData: itemData, outerElementType: OuterElementType, onItemsRendered: onItemsRendered, itemSize: itemSize, itemCount: itemCount }, ListRow))))));
|
|
162
162
|
});
|
|
163
163
|
export const NoWrapOption = (content, data, search, parentProps) => (React.createElement("div", Object.assign({}, parentProps || {}),
|
|
164
164
|
React.createElement(Tooltip, { title: content },
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ish-ui",
|
|
3
|
-
"
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"version": "1.0.47",
|
|
4
5
|
"description": "UI elements for onCourse and other ish apps",
|
|
5
6
|
"main": "main.ts",
|
|
6
7
|
"devDependencies": {
|
|
@@ -39,13 +40,14 @@
|
|
|
39
40
|
"tsc-alias": "^1.8.7",
|
|
40
41
|
"typescript": "^5.1.6",
|
|
41
42
|
"webpack": "^5.74.0",
|
|
43
|
+
"webpack-bundle-analyzer": "^4.10.1",
|
|
42
44
|
"webpack-cli": "^4.10.0",
|
|
43
45
|
"webpack-dev-server": "^4.11.1"
|
|
44
46
|
},
|
|
45
47
|
"dependencies": {
|
|
46
|
-
"@ckeditor/ckeditor5-dev-utils": "^30.5.0",
|
|
47
48
|
"@ckeditor/ckeditor5-autoformat": "35.1.0",
|
|
48
49
|
"@ckeditor/ckeditor5-basic-styles": "35.1.0",
|
|
50
|
+
"@ckeditor/ckeditor5-dev-utils": "^30.5.0",
|
|
49
51
|
"@ckeditor/ckeditor5-editor-classic": "35.1.0",
|
|
50
52
|
"@ckeditor/ckeditor5-essentials": "35.1.0",
|
|
51
53
|
"@ckeditor/ckeditor5-heading": "35.1.0",
|
|
@@ -93,6 +95,7 @@
|
|
|
93
95
|
"scripts": {
|
|
94
96
|
"test": "exit 0",
|
|
95
97
|
"start": "cross-env NODE_ENV=development webpack serve --config tools/webpack/webpack.config.dev.js",
|
|
98
|
+
"start:prod": "cross-env NODE_ENV=development webpack serve --config tools/webpack/webpack.config.prod.js",
|
|
96
99
|
"build": "tsc -p tsconfig.prod.json && tsc-alias",
|
|
97
100
|
"serve": "cross-env NODE_ENV=production webpack --config tools/webpack/webpack.config.prod.js && cross-env serve dist/",
|
|
98
101
|
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/"
|