ish-ui 1.0.44 → 1.0.46
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
|
}
|
|
@@ -274,6 +277,53 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
274
277
|
const rendered = placeholder;
|
|
275
278
|
return multiple && inputValue.length ? null : rendered;
|
|
276
279
|
}, [multiple, placeholder, isEditing, inputValue]);
|
|
280
|
+
const renderInput = useCallback((_a) => {
|
|
281
|
+
var { InputLabelProps, InputProps, inputProps } = _a, params = __rest(_a, ["InputLabelProps", "InputProps", "inputProps"]);
|
|
282
|
+
return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { variant: variant, key: input.name, name: input.name, value: (isEditing ? searchValue : (typeof displayedValue === 'string' ? 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,
|
|
283
|
+
disableUnderline, classes: {
|
|
284
|
+
underline: fieldClasses.underline,
|
|
285
|
+
input: clsx(disabled && classes.readonly, fieldClasses.text),
|
|
286
|
+
}, inputProps: Object.assign(Object.assign({}, inputProps), { 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
|
+
hideEditIcon,
|
|
316
|
+
renderIcons,
|
|
317
|
+
disableUnderline,
|
|
318
|
+
fieldClasses,
|
|
319
|
+
disabled,
|
|
320
|
+
isEditing,
|
|
321
|
+
searchValue,
|
|
322
|
+
displayedValue,
|
|
323
|
+
valueRenderer,
|
|
324
|
+
multiple,
|
|
325
|
+
isEditing
|
|
326
|
+
]);
|
|
277
327
|
return (React.createElement("div", { className: clsx(className, 'outline-none', inline && classes.inline), id: input === null || input === void 0 ? void 0 : input.name },
|
|
278
328
|
React.createElement(SelectContext.Provider, { value: {
|
|
279
329
|
rowHeight,
|
|
@@ -296,25 +346,6 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
296
346
|
option: 'w-100 text-pre',
|
|
297
347
|
popper: classes.popper,
|
|
298
348
|
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 }))));
|
|
349
|
+
}, 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
350
|
}
|
|
320
351
|
export default EditInPlaceSearchSelect;
|
|
@@ -21,7 +21,7 @@ function FormRadioButtons({ items, disabled, input: { value, onChange, name }, m
|
|
|
21
21
|
label,
|
|
22
22
|
labelAdornment)),
|
|
23
23
|
React.createElement(RadioGroup, Object.assign({ className: classes.group, value: value, onChange: (e) => onChange(e.target.value), row: row }, radioGroupProps), items
|
|
24
|
-
&& items.map((i, n) => (React.createElement(FormControlLabel, { key: n, value: i[valuePath], control: React.createElement(Radio, Object.assign({ color: color, id: `input-${n}-${name}`, name: name }, radioProps)), label: (React.createElement(Typography, { component: "span", variant: "body2" }, i[labelPath])), disabled: disabled
|
|
24
|
+
&& items.map((i, n) => (React.createElement(FormControlLabel, { key: n, value: i[valuePath], control: React.createElement(Radio, Object.assign({ color: color, id: `input-${n}-${name}`, name: name }, radioProps)), label: (React.createElement(Typography, { component: "span", variant: "body2" }, i[labelPath])), disabled: disabled })))),
|
|
25
25
|
React.createElement(FormHelperText, { classes: {
|
|
26
26
|
error: 'shakingError'
|
|
27
27
|
} }, error)));
|
|
@@ -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/dist/model/Fields.d.ts
CHANGED
|
@@ -219,6 +219,7 @@ export interface FormSwitchProps<IP> {
|
|
|
219
219
|
onClick?: AnyArgFunction;
|
|
220
220
|
}
|
|
221
221
|
export interface CheckboxFieldProps<IP> extends CheckboxProps {
|
|
222
|
+
inputRef?: MutableRefObject<any>;
|
|
222
223
|
input?: Partial<Omit<IP, 'onBlur'>> & {
|
|
223
224
|
onBlur?: AnyArgFunction;
|
|
224
225
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ish-ui",
|
|
3
|
-
"
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"version": "1.0.46",
|
|
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/"
|