@junyiacademy/ui-test 1.5.2 → 1.5.6
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/declarations/libs/ui/src/interfaces/index.d.ts +0 -1
- package/declarations/libs/ui/src/lib/select/OutlinedSelect.d.ts +1 -1
- package/declarations/libs/ui/src/lib/select/StandardSelect.d.ts +1 -1
- package/dist/libs/ui/src/lib/select/OutlinedSelect.js +5 -5
- package/dist/libs/ui/src/lib/select/StandardSelect.js +3 -4
- package/dist/libs/ui/src/lib/topic-filter/TopicFilter.js +4 -4
- package/package.json +1 -1
|
@@ -9,7 +9,6 @@ export interface ITopicTreeNode {
|
|
|
9
9
|
title: string;
|
|
10
10
|
}
|
|
11
11
|
export interface SelectProps extends MuiSelectProp {
|
|
12
|
-
placeholder: string;
|
|
13
12
|
helperText?: string;
|
|
14
13
|
InputProps?: (Partial<OutlinedInputProps> & {
|
|
15
14
|
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SelectProps } from '../../interfaces';
|
|
2
|
-
export declare const OutlinedSelect: ({
|
|
2
|
+
export declare const OutlinedSelect: ({ label, helperText, InputProps, SelectProps, className, children, color, size, paperMaxHeight, error, hasLabel, hasShrink, value, disabled, }: SelectProps) => JSX.Element;
|
|
3
3
|
export default OutlinedSelect;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SelectProps } from '../../interfaces';
|
|
2
|
-
export declare function StandardSelect({
|
|
2
|
+
export declare function StandardSelect({ label, helperText, InputProps, SelectProps, className, children, color, size, paperMaxHeight, error, hasShrink, value, disabled, }: SelectProps): JSX.Element;
|
|
3
3
|
export default StandardSelect;
|
|
@@ -52,16 +52,16 @@ const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }
|
|
|
52
52
|
},
|
|
53
53
|
[`& .${OutlinedInput_1.outlinedInputClasses.input}`]: {
|
|
54
54
|
color: theme.palette.text.primary,
|
|
55
|
-
|
|
55
|
+
'&:focus': {
|
|
56
56
|
background: 'rgba(0,0,0,0)',
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
}));
|
|
60
|
-
const OutlinedSelect = ({
|
|
60
|
+
const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
|
|
61
61
|
const hasHelperText = !!helperText;
|
|
62
62
|
return (react_1.default.createElement(StyledFormControl, { size: size, disabled: disabled, error: error, color: color, className: className },
|
|
63
|
-
hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color,
|
|
64
|
-
react_1.default.createElement(material_1.Select, Object.assign({
|
|
63
|
+
hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, label)),
|
|
64
|
+
react_1.default.createElement(material_1.Select, Object.assign({ value: value, label: hasLabel ? label : undefined, MenuProps: {
|
|
65
65
|
PaperProps: {
|
|
66
66
|
sx: {
|
|
67
67
|
maxHeight: paperMaxHeight,
|
|
@@ -76,7 +76,7 @@ const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, clas
|
|
|
76
76
|
vertical: 'top',
|
|
77
77
|
horizontal: 'left',
|
|
78
78
|
},
|
|
79
|
-
}, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ?
|
|
79
|
+
}, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? label : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
|
|
80
80
|
hasHelperText && react_1.default.createElement(material_1.FormHelperText, null, helperText)));
|
|
81
81
|
};
|
|
82
82
|
exports.OutlinedSelect = OutlinedSelect;
|
|
@@ -40,15 +40,14 @@ const StyledInput = styles_1.styled(material_1.Input, {
|
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
}));
|
|
43
|
-
function StandardSelect({
|
|
43
|
+
function StandardSelect({ label, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
|
|
44
44
|
const hasHelperText = !!helperText;
|
|
45
45
|
return (react_1.default.createElement(material_1.FormControl, { variant: 'standard', color: color, size: size, disabled: disabled, error: error, className: className },
|
|
46
|
-
react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined },
|
|
47
|
-
react_1.default.createElement(material_1.Select, Object.assign({ label:
|
|
46
|
+
react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, label),
|
|
47
|
+
react_1.default.createElement(material_1.Select, Object.assign({ label: label, value: value, MenuProps: {
|
|
48
48
|
PaperProps: {
|
|
49
49
|
sx: {
|
|
50
50
|
maxHeight: paperMaxHeight,
|
|
51
|
-
top: '30px !important',
|
|
52
51
|
},
|
|
53
52
|
},
|
|
54
53
|
anchorOrigin: {
|
|
@@ -9,7 +9,7 @@ const material_1 = require("@mui/material");
|
|
|
9
9
|
const Select_1 = tslib_1.__importDefault(require("../select/Select"));
|
|
10
10
|
const SelectMenuItem_1 = tslib_1.__importDefault(require("../menu-item/SelectMenuItem"));
|
|
11
11
|
// self-defined-configs
|
|
12
|
-
const
|
|
12
|
+
const LABEL = '請選擇';
|
|
13
13
|
const StyledSelect = styles_1.styled(Select_1.default)(({ theme }) => ({
|
|
14
14
|
width: 220,
|
|
15
15
|
margin: theme.spacing(1),
|
|
@@ -71,7 +71,7 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
|
|
|
71
71
|
setLayeredTopicList([topicTree]);
|
|
72
72
|
}, [topicTree]);
|
|
73
73
|
if (layeredTopicList.length === 0) {
|
|
74
|
-
return (react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small',
|
|
74
|
+
return (react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', label: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
|
|
75
75
|
}
|
|
76
76
|
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
77
77
|
display: 'flex',
|
|
@@ -83,7 +83,7 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
|
|
|
83
83
|
display: 'flex',
|
|
84
84
|
alignItems: 'center',
|
|
85
85
|
}, key: layeredTopic.id },
|
|
86
|
-
react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', label:
|
|
86
|
+
react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', label: LABEL, paperMaxHeight: 412, hasLabel: hasLabel, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
|
|
87
87
|
'data-testid': `layered-topic-${layerNumber}`,
|
|
88
88
|
}, InputProps: {
|
|
89
89
|
inputProps: {
|
|
@@ -107,7 +107,7 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
|
|
|
107
107
|
});
|
|
108
108
|
},
|
|
109
109
|
} },
|
|
110
|
-
react_1.default.createElement(SelectMenuItem_1.default, { disabled: true },
|
|
110
|
+
react_1.default.createElement(SelectMenuItem_1.default, { disabled: true, value: '' }, LABEL),
|
|
111
111
|
layeredTopic.childTopics.map((childTopic) => (react_1.default.createElement(SelectMenuItem_1.default, { key: childTopic.id, value: childTopic.id, "data-testid": `layered-menuitem-${layerNumber}`, "data-is-content-topic": childTopic.isContentTopic }, childTopic.title)))),
|
|
112
112
|
hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(ArrowRightRounded_1.default, { sx: (theme) => ({
|
|
113
113
|
margin: theme.spacing(-1, -1.5),
|