@junyiacademy/ui-test 1.6.5 → 1.6.7
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/README.md +66 -4
- package/dist/index.js.mjs +1479 -0
- package/dist/index.js.umd.js +2 -0
- package/dist/shared-utils/src/hooks/topic-filter/useGetTopicList.d.ts +14 -0
- package/dist/shared-utils/src/models/index.d.ts +2 -0
- package/dist/shared-utils/src/models/topic-tree/SubTree.d.ts +5 -0
- package/dist/shared-utils/src/models/topic-tree/Topic.d.ts +10 -0
- package/dist/shared-utils/src/models/user/UserProfile.d.ts +92 -0
- package/dist/shared-utils/src/utils/axios.d.ts +2 -0
- package/dist/shared-utils/src/utils/getCsrfToken.d.ts +7 -0
- package/dist/{index.d.ts → ui/src/index.d.ts} +7 -0
- package/dist/{interfaces → ui/src/interfaces}/index.d.ts +1 -9
- package/dist/ui/src/lib/Info-Popover/InfoPopover.d.ts +20 -0
- package/dist/ui/src/lib/MUI/Alert/Alert.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Avatar/Avatar.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Badge/Badge.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Checkbox/Checkbox.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Chip/Chip.d.ts +3 -0
- package/dist/ui/src/lib/MUI/CircularProgress/CircularProgress.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Divider/Divider.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Fab/Fab.d.ts +3 -0
- package/dist/ui/src/lib/MUI/LinearProgress/LinearProgress.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Link/Link.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Menu/Menu.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Menu/MenuItem.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Paper/Paper.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Rating/Rating.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Skeleton/Skeleton.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Slider/Slider.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Snackbar/Snackbar.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Switch/Switch.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Tooltip/Tooltip.d.ts +3 -0
- package/dist/ui/src/lib/MUI/Typography/Typography.d.ts +5 -0
- package/dist/ui/src/lib/button/Button.d.ts +10 -0
- package/dist/ui/src/lib/button/LoadingButton.d.ts +7 -0
- package/dist/ui/src/lib/button-group/ButtonGroup.d.ts +15 -0
- package/dist/ui/src/lib/chip/Chip.d.ts +9 -0
- package/dist/ui/src/lib/icon/Icon.d.ts +5 -0
- package/dist/{lib → ui/src/lib}/menu-item/SelectMenuItem.d.ts +1 -1
- package/dist/ui/src/lib/radio/Radio.d.ts +13 -0
- package/dist/ui/src/lib/select/OutlinedSelect.d.ts +3 -0
- package/dist/ui/src/lib/select/Select.d.ts +3 -0
- package/dist/ui/src/lib/select/StandardSelect.d.ts +3 -0
- package/dist/{lib → ui/src/lib}/text-field/TextField.d.ts +1 -1
- package/dist/ui/src/lib/topic-filter/TopicFilter.d.ts +13 -0
- package/dist/ui/src/lib/tutorial/Tutorial.d.ts +8 -0
- package/dist/ui/src/lib/tutorial/TutorialStep.d.ts +27 -0
- package/dist/ui/src/styles/colors.d.ts +11 -0
- package/dist/ui/src/styles/locales/dateTimePicker.d.ts +83 -0
- package/dist/ui/src/styles/theme.d.ts +77 -0
- package/dist/ui/src/utils/capitalize.d.ts +1 -0
- package/package.json +27 -12
- package/dist/index.js +0 -20
- package/dist/interfaces/index.js +0 -2
- package/dist/lib/button/Button.d.ts +0 -6
- package/dist/lib/button/Button.js +0 -73
- package/dist/lib/button-group/ButtonGroup.d.ts +0 -3
- package/dist/lib/button-group/ButtonGroup.js +0 -51
- package/dist/lib/menu-item/SelectMenuItem.js +0 -58
- package/dist/lib/radio/Radio.d.ts +0 -11
- package/dist/lib/radio/Radio.js +0 -76
- package/dist/lib/select/OutlinedSelect.d.ts +0 -3
- package/dist/lib/select/OutlinedSelect.js +0 -133
- package/dist/lib/select/Select.d.ts +0 -3
- package/dist/lib/select/Select.js +0 -40
- package/dist/lib/select/StandardSelect.d.ts +0 -3
- package/dist/lib/select/StandardSelect.js +0 -88
- package/dist/lib/text-field/TextField.js +0 -110
- package/dist/lib/topic-filter/TopicFilter.d.ts +0 -13
- package/dist/lib/topic-filter/TopicFilter.js +0 -151
- package/dist/styles/theme.d.ts +0 -24
- package/dist/styles/theme.js +0 -42
- package/dist/utils/Capitalize.d.ts +0 -1
- package/dist/utils/Capitalize.js +0 -6
- package/dist/utils/topicTree.d.ts +0 -2
- package/dist/utils/topicTree.js +0 -177
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
25
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
26
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
27
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
28
|
-
r[k] = a[j];
|
|
29
|
-
return r;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.OutlinedSelect = void 0;
|
|
36
|
-
var react_1 = __importDefault(require("react"));
|
|
37
|
-
var styles_1 = require("@mui/material/styles");
|
|
38
|
-
var material_1 = require("@mui/material");
|
|
39
|
-
var FormHelperText_1 = require("@mui/material/FormHelperText");
|
|
40
|
-
var InputLabel_1 = require("@mui/material/InputLabel");
|
|
41
|
-
var OutlinedInput_1 = require("@mui/material/OutlinedInput");
|
|
42
|
-
var InputBase_1 = require("@mui/material/InputBase");
|
|
43
|
-
var StyledInputLabel = styles_1.styled(material_1.InputLabel, {
|
|
44
|
-
shouldForwardProp: function (prop) { return prop !== 'color'; },
|
|
45
|
-
})(function (_a) {
|
|
46
|
-
var _b, _c;
|
|
47
|
-
var color = _a.color, theme = _a.theme;
|
|
48
|
-
return (_b = {
|
|
49
|
-
color: theme.palette.text.secondary
|
|
50
|
-
},
|
|
51
|
-
_b["&." + InputLabel_1.inputLabelClasses.outlined] = (_c = {},
|
|
52
|
-
_c["&:not(." + InputLabel_1.inputLabelClasses.disabled + ") ." + InputLabel_1.inputLabelClasses.focused] = {
|
|
53
|
-
color: theme.palette.action.active,
|
|
54
|
-
},
|
|
55
|
-
_c["&." + InputLabel_1.inputLabelClasses.sizeSmall + ":not(." + InputLabel_1.inputLabelClasses.shrink + ")"] = {
|
|
56
|
-
transform: 'translate(12px, 12px) scale(1)',
|
|
57
|
-
},
|
|
58
|
-
_c),
|
|
59
|
-
// eslint-disable-next-line
|
|
60
|
-
_b["&." + InputLabel_1.inputLabelClasses.shrink + ":not(." + InputLabel_1.inputLabelClasses.error + "):not(." + InputLabel_1.inputLabelClasses.disabled + ")." + InputLabel_1.inputLabelClasses.focused] = {
|
|
61
|
-
color: theme.palette[color].main,
|
|
62
|
-
},
|
|
63
|
-
_b["&." + InputLabel_1.inputLabelClasses.shrink] = {
|
|
64
|
-
backgroundColor: '#ffffff',
|
|
65
|
-
padding: '0 2px',
|
|
66
|
-
},
|
|
67
|
-
_b);
|
|
68
|
-
});
|
|
69
|
-
var StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(function (_a) {
|
|
70
|
-
var _b, _c;
|
|
71
|
-
var theme = _a.theme;
|
|
72
|
-
return (_b = {},
|
|
73
|
-
_b["&." + OutlinedInput_1.outlinedInputClasses.root] = (_c = {},
|
|
74
|
-
_c["&." + OutlinedInput_1.outlinedInputClasses.error + "." + OutlinedInput_1.outlinedInputClasses.focused + " ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
75
|
-
borderColor: "" + theme.palette.error.main,
|
|
76
|
-
},
|
|
77
|
-
_c["& ." + InputBase_1.inputBaseClasses.inputSizeSmall] = {
|
|
78
|
-
padding: '12.5px 15px 12.5px 12px',
|
|
79
|
-
},
|
|
80
|
-
_c),
|
|
81
|
-
_b["& ." + OutlinedInput_1.outlinedInputClasses.input] = {
|
|
82
|
-
color: theme.palette.text.primary,
|
|
83
|
-
'&:focus': {
|
|
84
|
-
background: 'rgba(0,0,0,0)',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
_b);
|
|
88
|
-
});
|
|
89
|
-
var OutlinedSelect = function (_a) {
|
|
90
|
-
var _b;
|
|
91
|
-
var label = _a.label, helperText = _a.helperText, _c = _a.FormControlProps, FormControlProps = _c === void 0 ? {} : _c, _d = _a.InputLabelProps, InputLabelProps = _d === void 0 ? {} : _d, _e = _a.InputProps, InputProps = _e === void 0 ? {} : _e, _f = _a.SelectProps, SelectProps = _f === void 0 ? {} : _f, _g = _a.FormHelperTextProps, FormHelperTextProps = _g === void 0 ? {} : _g, className = _a.className, children = _a.children, _h = _a.color, color = _h === void 0 ? 'primary' : _h, _j = _a.size, size = _j === void 0 ? 'small' : _j, _k = _a.paperMaxHeight, paperMaxHeight = _k === void 0 ? 'auto' : _k, _l = _a.error, error = _l === void 0 ? false : _l, _m = _a.hasLabel, hasLabel = _m === void 0 ? true : _m, _o = _a.hasShrink, hasShrink = _o === void 0 ? false : _o, _p = _a.value, value = _p === void 0 ? '' : _p, _q = _a.disabled, disabled = _q === void 0 ? false : _q;
|
|
92
|
-
var hasHelperText = !!helperText;
|
|
93
|
-
var _r = FormControlProps.sx, formControlSx = _r === void 0 ? [] : _r, otherFormControlProps = __rest(FormControlProps, ["sx"]);
|
|
94
|
-
var _s = FormHelperTextProps.sx, formHelperTextSx = _s === void 0 ? [] : _s, otherFormHelperTextProps = __rest(FormHelperTextProps, ["sx"]);
|
|
95
|
-
return (react_1.default.createElement(material_1.FormControl, __assign({ sx: __spreadArrays([
|
|
96
|
-
function (theme) {
|
|
97
|
-
var _a;
|
|
98
|
-
return ({
|
|
99
|
-
backgroundColor: 'white',
|
|
100
|
-
'&:hover': (_a = {},
|
|
101
|
-
// eslint-disable-next-line
|
|
102
|
-
_a["& :not(." + OutlinedInput_1.outlinedInputClasses.disabled + "):not(." + OutlinedInput_1.outlinedInputClasses.error + ") ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
103
|
-
borderColor: theme.palette[color].main,
|
|
104
|
-
},
|
|
105
|
-
_a),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
], (Array.isArray(formControlSx) ? formControlSx : [formControlSx])), size: size, disabled: disabled, error: error, color: color, className: className }, otherFormControlProps),
|
|
109
|
-
hasLabel && (react_1.default.createElement(StyledInputLabel, __assign({ color: color, shrink: hasShrink ? true : undefined }, InputLabelProps), label)),
|
|
110
|
-
react_1.default.createElement(material_1.Select, __assign({ value: value, label: hasLabel ? label : undefined, MenuProps: {
|
|
111
|
-
PaperProps: {
|
|
112
|
-
sx: {
|
|
113
|
-
maxHeight: paperMaxHeight,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
disableAutoFocusItem: true,
|
|
117
|
-
anchorOrigin: {
|
|
118
|
-
vertical: 2,
|
|
119
|
-
horizontal: 'left',
|
|
120
|
-
},
|
|
121
|
-
transformOrigin: {
|
|
122
|
-
vertical: 'top',
|
|
123
|
-
horizontal: 'left',
|
|
124
|
-
},
|
|
125
|
-
}, input: react_1.default.createElement(StyledOutlinedInput, __assign({ color: color, label: hasLabel ? label : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
|
|
126
|
-
hasHelperText && (react_1.default.createElement(material_1.FormHelperText, __assign({ sx: __assign((_b = {}, _b["&." + FormHelperText_1.formHelperTextClasses.root] = {
|
|
127
|
-
marginLeft: 0,
|
|
128
|
-
}, _b), (Array.isArray(formHelperTextSx)
|
|
129
|
-
? formHelperTextSx
|
|
130
|
-
: [formHelperTextSx])) }, otherFormHelperTextProps), helperText))));
|
|
131
|
-
};
|
|
132
|
-
exports.OutlinedSelect = OutlinedSelect;
|
|
133
|
-
exports.default = exports.OutlinedSelect;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.Select = void 0;
|
|
29
|
-
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var OutlinedSelect_1 = require("./OutlinedSelect");
|
|
31
|
-
var StandardSelect_1 = require("./StandardSelect");
|
|
32
|
-
function Select(_a) {
|
|
33
|
-
var variant = _a.variant, props = __rest(_a, ["variant"]);
|
|
34
|
-
if (variant === 'outlined') {
|
|
35
|
-
return react_1.default.createElement(OutlinedSelect_1.OutlinedSelect, __assign({}, props));
|
|
36
|
-
}
|
|
37
|
-
return react_1.default.createElement(StandardSelect_1.StandardSelect, __assign({}, props));
|
|
38
|
-
}
|
|
39
|
-
exports.Select = Select;
|
|
40
|
-
exports.default = Select;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { SelectProps as ISelectProps } from '../../interfaces';
|
|
2
|
-
export declare function StandardSelect({ label, helperText, FormControlProps, InputLabelProps, InputProps, SelectProps, FormHelperTextProps, className, children, color, size, paperMaxHeight, error, hasShrink, value, disabled, }: ISelectProps): JSX.Element;
|
|
3
|
-
export default StandardSelect;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.StandardSelect = void 0;
|
|
18
|
-
var react_1 = __importDefault(require("react"));
|
|
19
|
-
var styles_1 = require("@mui/material/styles");
|
|
20
|
-
var material_1 = require("@mui/material");
|
|
21
|
-
var InputLabel_1 = require("@mui/material/InputLabel");
|
|
22
|
-
var Input_1 = require("@mui/material/Input");
|
|
23
|
-
var StyledInputLabel = styles_1.styled(material_1.InputLabel, {
|
|
24
|
-
shouldForwardProp: function (prop) { return prop !== 'color'; },
|
|
25
|
-
})(function (_a) {
|
|
26
|
-
var _b;
|
|
27
|
-
var color = _a.color, theme = _a.theme;
|
|
28
|
-
return (_b = {},
|
|
29
|
-
_b["&." + InputLabel_1.inputLabelClasses.root] = {
|
|
30
|
-
color: theme.palette.text.disabled,
|
|
31
|
-
},
|
|
32
|
-
_b["&." + InputLabel_1.inputLabelClasses.focused] = {
|
|
33
|
-
color: theme.palette[color].main,
|
|
34
|
-
},
|
|
35
|
-
_b["&." + InputLabel_1.inputLabelClasses.error] = {
|
|
36
|
-
color: theme.palette.error.main,
|
|
37
|
-
},
|
|
38
|
-
_b);
|
|
39
|
-
});
|
|
40
|
-
var StyledInput = styles_1.styled(material_1.Input, {
|
|
41
|
-
shouldForwardProp: function (prop) { return prop !== 'color'; },
|
|
42
|
-
})(function (_a) {
|
|
43
|
-
var _b;
|
|
44
|
-
var color = _a.color, theme = _a.theme;
|
|
45
|
-
return (_b = {
|
|
46
|
-
color: theme.palette.text.primary
|
|
47
|
-
},
|
|
48
|
-
_b["& ." + Input_1.inputClasses.input] = {
|
|
49
|
-
'&:focus': {
|
|
50
|
-
background: 'rgba(0,0,0,0)',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
_b["&." + Input_1.inputClasses.underline + ":not(." + Input_1.inputClasses.disabled + "):not(." + Input_1.inputClasses.error + ")"] = {
|
|
54
|
-
'&:after,&:hover:before': {
|
|
55
|
-
borderBottomColor: theme.palette[color].main,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
_b["&." + Input_1.inputClasses.underline + "." + Input_1.inputClasses.error + ":not(." + Input_1.inputClasses.disabled + ")"] = {
|
|
59
|
-
'&:after,&:hover:before': {
|
|
60
|
-
borderBottomColor: theme.palette.error.main,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
_b);
|
|
64
|
-
});
|
|
65
|
-
function StandardSelect(_a) {
|
|
66
|
-
var label = _a.label, helperText = _a.helperText, _b = _a.FormControlProps, FormControlProps = _b === void 0 ? {} : _b, _c = _a.InputLabelProps, InputLabelProps = _c === void 0 ? {} : _c, _d = _a.InputProps, InputProps = _d === void 0 ? {} : _d, _e = _a.SelectProps, SelectProps = _e === void 0 ? {} : _e, _f = _a.FormHelperTextProps, FormHelperTextProps = _f === void 0 ? {} : _f, className = _a.className, children = _a.children, _g = _a.color, color = _g === void 0 ? 'primary' : _g, _h = _a.size, size = _h === void 0 ? 'small' : _h, _j = _a.paperMaxHeight, paperMaxHeight = _j === void 0 ? 'auto' : _j, _k = _a.error, error = _k === void 0 ? false : _k, _l = _a.hasShrink, hasShrink = _l === void 0 ? false : _l, _m = _a.value, value = _m === void 0 ? '' : _m, _o = _a.disabled, disabled = _o === void 0 ? false : _o;
|
|
67
|
-
var hasHelperText = !!helperText;
|
|
68
|
-
return (react_1.default.createElement(material_1.FormControl, __assign({ variant: "standard", color: color, size: size, disabled: disabled, error: error, className: className }, FormControlProps),
|
|
69
|
-
react_1.default.createElement(StyledInputLabel, __assign({ color: color, shrink: hasShrink ? true : undefined }, InputLabelProps), label),
|
|
70
|
-
react_1.default.createElement(material_1.Select, __assign({ label: label, value: value, MenuProps: {
|
|
71
|
-
PaperProps: {
|
|
72
|
-
sx: {
|
|
73
|
-
maxHeight: paperMaxHeight,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
anchorOrigin: {
|
|
77
|
-
vertical: 2,
|
|
78
|
-
horizontal: 'left',
|
|
79
|
-
},
|
|
80
|
-
transformOrigin: {
|
|
81
|
-
vertical: 'top',
|
|
82
|
-
horizontal: 'left',
|
|
83
|
-
},
|
|
84
|
-
}, input: react_1.default.createElement(StyledInput, __assign({ color: color }, InputProps)) }, SelectProps), children),
|
|
85
|
-
hasHelperText && (react_1.default.createElement(material_1.FormHelperText, __assign({}, FormHelperTextProps), helperText))));
|
|
86
|
-
}
|
|
87
|
-
exports.StandardSelect = StandardSelect;
|
|
88
|
-
exports.default = StandardSelect;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
25
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
26
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
27
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
28
|
-
r[k] = a[j];
|
|
29
|
-
return r;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.TextField = void 0;
|
|
36
|
-
var react_1 = __importDefault(require("react"));
|
|
37
|
-
var styles_1 = require("@mui/material/styles");
|
|
38
|
-
var material_1 = require("@mui/material");
|
|
39
|
-
var TextField_1 = require("@mui/material/TextField");
|
|
40
|
-
var Input_1 = require("@mui/material/Input");
|
|
41
|
-
var InputLabel_1 = require("@mui/material/InputLabel");
|
|
42
|
-
var OutlinedInput_1 = require("@mui/material/OutlinedInput");
|
|
43
|
-
var FormHelperText_1 = require("@mui/material/FormHelperText");
|
|
44
|
-
// utils
|
|
45
|
-
var Capitalize_1 = __importDefault(require("../../utils/Capitalize"));
|
|
46
|
-
// self-defined-components
|
|
47
|
-
var StyledTextField = styles_1.styled(material_1.TextField)(function (_a) {
|
|
48
|
-
var _b, _c, _d, _e;
|
|
49
|
-
var label = _a.label, _f = _a.color, color = _f === void 0 ? 'primary' : _f, theme = _a.theme;
|
|
50
|
-
return (_b = {},
|
|
51
|
-
_b["& ." + InputLabel_1.inputLabelClasses.error] = (_c = {},
|
|
52
|
-
_c["&:not(." + InputLabel_1.inputLabelClasses.shrink + ")"] = {
|
|
53
|
-
color: theme.palette.text.secondary,
|
|
54
|
-
},
|
|
55
|
-
_c["&." + InputLabel_1.inputLabelClasses.disabled] = {
|
|
56
|
-
color: theme.palette.text.disabled,
|
|
57
|
-
},
|
|
58
|
-
_c),
|
|
59
|
-
_b["& ." + InputLabel_1.inputLabelClasses.error + "." + InputLabel_1.inputLabelClasses.focused] = {
|
|
60
|
-
color: theme.palette.error.main,
|
|
61
|
-
},
|
|
62
|
-
// For variant: standard | filled
|
|
63
|
-
_b["& ." + Input_1.inputClasses.underline + ":not(." + Input_1.inputClasses.disabled + ")"] = (_d = {},
|
|
64
|
-
_d["&.MuiInputBase-color" + Capitalize_1.default(color) + ":hover:before"] = {
|
|
65
|
-
borderColor: theme.palette[color].main,
|
|
66
|
-
},
|
|
67
|
-
_d),
|
|
68
|
-
// For variant: outlined
|
|
69
|
-
_b["& ." + Input_1.inputClasses.disabled + " ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
70
|
-
borderStyle: 'dotted',
|
|
71
|
-
},
|
|
72
|
-
_b["& ." + Input_1.inputClasses.error + "." + Input_1.inputClasses.focused + " ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
73
|
-
borderColor: theme.palette.error.main,
|
|
74
|
-
},
|
|
75
|
-
_b["&." + TextField_1.textFieldClasses.root + " :not(." + Input_1.inputClasses.disabled + "):not(." + Input_1.inputClasses.error + ")"] = (_e = {},
|
|
76
|
-
_e["&.MuiInputBase-color" + Capitalize_1.default(color) + ":hover ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
77
|
-
borderColor: theme.palette[color].main,
|
|
78
|
-
},
|
|
79
|
-
_e),
|
|
80
|
-
_b["& ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
81
|
-
'& > legend': {
|
|
82
|
-
maxWidth: label === '' && 0,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
_b);
|
|
86
|
-
});
|
|
87
|
-
var TextField = function (props) {
|
|
88
|
-
var _a;
|
|
89
|
-
var hasEndAdornment = !!((_a = props === null || props === void 0 ? void 0 : props.InputProps) === null || _a === void 0 ? void 0 : _a.endAdornment);
|
|
90
|
-
var InputLabelProps = props.InputLabelProps, InputProps = props.InputProps, _b = props.FormHelperTextProps, FormHelperTextProps = _b === void 0 ? {} : _b, otherProps = __rest(props, ["InputLabelProps", "InputProps", "FormHelperTextProps"]);
|
|
91
|
-
var _c = FormHelperTextProps.sx, formHelperTextSx = _c === void 0 ? [] : _c, otherFormHelperTextProps = __rest(FormHelperTextProps, ["sx"]);
|
|
92
|
-
return (react_1.default.createElement(StyledTextField, __assign({ InputLabelProps: __assign(__assign({}, InputLabelProps), { shrink: hasEndAdornment ? true : undefined }), FormHelperTextProps: __assign({ sx: __spreadArrays([
|
|
93
|
-
function (theme) {
|
|
94
|
-
var _a, _b;
|
|
95
|
-
return (_a = {},
|
|
96
|
-
_a["&." + FormHelperText_1.formHelperTextClasses.root] = (_b = {
|
|
97
|
-
marginLeft: 0
|
|
98
|
-
},
|
|
99
|
-
_b["&." + Input_1.inputClasses.error] = {
|
|
100
|
-
color: theme.palette.error.main,
|
|
101
|
-
},
|
|
102
|
-
_b),
|
|
103
|
-
_a);
|
|
104
|
-
}
|
|
105
|
-
], (Array.isArray(formHelperTextSx)
|
|
106
|
-
? formHelperTextSx
|
|
107
|
-
: [formHelperTextSx])) }, otherFormHelperTextProps), InputProps: __assign({}, InputProps) }, otherProps)));
|
|
108
|
-
};
|
|
109
|
-
exports.TextField = TextField;
|
|
110
|
-
exports.default = exports.TextField;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ITopicTreeNode } from '../../interfaces';
|
|
2
|
-
export interface TopicFilterProps {
|
|
3
|
-
topicTree: ITopicTreeNode;
|
|
4
|
-
onTopicSelected: (topic: ITopicTreeNode, selectedInfo: {
|
|
5
|
-
layerNumber: number;
|
|
6
|
-
selectedTopicIds: string[];
|
|
7
|
-
}) => void;
|
|
8
|
-
isLastLayer: (topic: ITopicTreeNode) => boolean;
|
|
9
|
-
hasArrow: boolean;
|
|
10
|
-
initSelectedTopicIds: string[];
|
|
11
|
-
}
|
|
12
|
-
export declare const TopicFilter: ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSelectedTopicIds, }: TopicFilterProps) => JSX.Element;
|
|
13
|
-
export default TopicFilter;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
22
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
23
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
24
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
25
|
-
r[k] = a[j];
|
|
26
|
-
return r;
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.TopicFilter = void 0;
|
|
33
|
-
var react_1 = __importStar(require("react"));
|
|
34
|
-
var styles_1 = require("@mui/material/styles");
|
|
35
|
-
var ArrowRightRounded_1 = __importDefault(require("@mui/icons-material/ArrowRightRounded"));
|
|
36
|
-
var material_1 = require("@mui/material");
|
|
37
|
-
var Select_1 = __importDefault(require("../select/Select"));
|
|
38
|
-
var SelectMenuItem_1 = __importDefault(require("../menu-item/SelectMenuItem"));
|
|
39
|
-
// self-defined-configs
|
|
40
|
-
var LABEL = '請選擇';
|
|
41
|
-
var StyledSelect = styles_1.styled(Select_1.default)(function (_a) {
|
|
42
|
-
var theme = _a.theme;
|
|
43
|
-
return ({
|
|
44
|
-
width: 220,
|
|
45
|
-
margin: theme.spacing(1),
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
var TopicFilter = function (_a) {
|
|
49
|
-
var topicTree = _a.topicTree, onTopicSelected = _a.onTopicSelected, isLastLayer = _a.isLastLayer, hasArrow = _a.hasArrow, initSelectedTopicIds = _a.initSelectedTopicIds;
|
|
50
|
-
var _b = react_1.useState([]), selectedTopicIds = _b[0], setSelectedTopicIds = _b[1];
|
|
51
|
-
var _c = react_1.useState([]), layeredTopicList = _c[0], setLayeredTopicList = _c[1];
|
|
52
|
-
var _d = react_1.useState([]), isFocusedList = _d[0], setIsFocusedList = _d[1];
|
|
53
|
-
var initSelectedLayers = function () {
|
|
54
|
-
var newLayeredTopicList = initSelectedTopicIds.reduce(function (topicListAccumulator, topicId, index) {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
var selectedTopic = (_b = (_a = topicListAccumulator[index]) === null || _a === void 0 ? void 0 : _a.childTopics) === null || _b === void 0 ? void 0 : _b.find(function (childTopic) { return childTopic.id === topicId; });
|
|
57
|
-
if (!selectedTopic) {
|
|
58
|
-
return topicListAccumulator;
|
|
59
|
-
}
|
|
60
|
-
if (isLastLayer(selectedTopic)) {
|
|
61
|
-
return topicListAccumulator;
|
|
62
|
-
}
|
|
63
|
-
return __spreadArrays(topicListAccumulator, [selectedTopic]);
|
|
64
|
-
}, [topicTree]);
|
|
65
|
-
setLayeredTopicList(newLayeredTopicList);
|
|
66
|
-
setSelectedTopicIds(initSelectedTopicIds.slice(0, newLayeredTopicList.length));
|
|
67
|
-
setIsFocusedList(Array(newLayeredTopicList.length).fill(false));
|
|
68
|
-
};
|
|
69
|
-
var handleChange = function (e, layerNumber, layeredTopic) {
|
|
70
|
-
var selectedTopic = layeredTopic.childTopics.find(function (childTopic) { return childTopic.id === e.target.value; });
|
|
71
|
-
var newSelectedTopicIds = __spreadArrays(selectedTopicIds.slice(0, layerNumber), [
|
|
72
|
-
selectedTopic.id,
|
|
73
|
-
]);
|
|
74
|
-
setSelectedTopicIds(newSelectedTopicIds);
|
|
75
|
-
onTopicSelected(selectedTopic, {
|
|
76
|
-
layerNumber: layerNumber,
|
|
77
|
-
selectedTopicIds: newSelectedTopicIds,
|
|
78
|
-
});
|
|
79
|
-
if (isLastLayer(selectedTopic)) {
|
|
80
|
-
setLayeredTopicList(function (prevTopicList) {
|
|
81
|
-
return prevTopicList.slice(0, layerNumber + 1);
|
|
82
|
-
});
|
|
83
|
-
setIsFocusedList(function (prevList) { return prevList.slice(0, layerNumber + 1); });
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
setLayeredTopicList(function (prevTopicList) { return __spreadArrays(prevTopicList.slice(0, layerNumber + 1), [
|
|
87
|
-
selectedTopic,
|
|
88
|
-
]); });
|
|
89
|
-
setIsFocusedList(function (prevList) { return __spreadArrays(prevList.slice(0, layerNumber + 1), [
|
|
90
|
-
false,
|
|
91
|
-
]); });
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
react_1.useEffect(function () {
|
|
95
|
-
if (!topicTree || Object.keys(topicTree).length === 0) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (initSelectedTopicIds.length !== 0) {
|
|
99
|
-
initSelectedLayers();
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
setLayeredTopicList([topicTree]);
|
|
103
|
-
}, [topicTree]);
|
|
104
|
-
if (layeredTopicList.length === 0) {
|
|
105
|
-
return (react_1.default.createElement(StyledSelect, { variant: "outlined", size: "small", label: "\u8F09\u5165\u8CC7\u6599\u4E2D...", disabled: true }));
|
|
106
|
-
}
|
|
107
|
-
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
108
|
-
display: 'flex',
|
|
109
|
-
alignItems: 'center',
|
|
110
|
-
flexWrap: 'wrap',
|
|
111
|
-
} }, layeredTopicList.map(function (layeredTopic, layerNumber) {
|
|
112
|
-
var hasLabel = isFocusedList[layerNumber] || !selectedTopicIds[layerNumber];
|
|
113
|
-
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
114
|
-
display: 'flex',
|
|
115
|
-
alignItems: 'center',
|
|
116
|
-
}, key: layeredTopic.id },
|
|
117
|
-
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: {
|
|
118
|
-
'data-testid': "layered-topic-" + layerNumber,
|
|
119
|
-
}, InputProps: {
|
|
120
|
-
inputProps: {
|
|
121
|
-
'aria-label': "layered-topic-" + layerNumber,
|
|
122
|
-
},
|
|
123
|
-
onChange: function (e) {
|
|
124
|
-
handleChange(e, layerNumber, layeredTopic);
|
|
125
|
-
},
|
|
126
|
-
onFocus: function () {
|
|
127
|
-
setIsFocusedList(function (prevList) {
|
|
128
|
-
var newList = __spreadArrays(prevList);
|
|
129
|
-
newList[layerNumber] = true;
|
|
130
|
-
return newList;
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
onBlur: function () {
|
|
134
|
-
setIsFocusedList(function (prevList) {
|
|
135
|
-
var newList = __spreadArrays(prevList);
|
|
136
|
-
newList[layerNumber] = false;
|
|
137
|
-
return newList;
|
|
138
|
-
});
|
|
139
|
-
},
|
|
140
|
-
} },
|
|
141
|
-
react_1.default.createElement(SelectMenuItem_1.default, { disabled: true, value: "" }, LABEL),
|
|
142
|
-
layeredTopic.childTopics.map(function (childTopic) { return (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)); })),
|
|
143
|
-
hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(ArrowRightRounded_1.default, { sx: function (theme) { return ({
|
|
144
|
-
margin: theme.spacing(-1, -1.5),
|
|
145
|
-
fontSize: theme.spacing(7),
|
|
146
|
-
color: '#444',
|
|
147
|
-
}); }, fontSize: "large", "data-testid": "topic-filter-arrow" }))));
|
|
148
|
-
})));
|
|
149
|
-
};
|
|
150
|
-
exports.TopicFilter = TopicFilter;
|
|
151
|
-
exports.default = exports.TopicFilter;
|
package/dist/styles/theme.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Junyi Academy.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
declare module '@mui/material/styles/createPalette' {
|
|
8
|
-
interface Palette {
|
|
9
|
-
green: {
|
|
10
|
-
primary: Palette['primary'];
|
|
11
|
-
blueGreen: Palette['primary'];
|
|
12
|
-
grassGreen: Palette['primary'];
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
interface PaletteOptions {
|
|
16
|
-
green: {
|
|
17
|
-
primary: PaletteOptions['primary'];
|
|
18
|
-
blueGreen: PaletteOptions['primary'];
|
|
19
|
-
grassGreen: PaletteOptions['primary'];
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
declare const theme: import("@mui/material/styles").Theme;
|
|
24
|
-
export default theme;
|
package/dist/styles/theme.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2020 Junyi Academy.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
var styles_1 = require("@mui/material/styles");
|
|
10
|
-
// Create a theme instance.
|
|
11
|
-
var theme = styles_1.createTheme({
|
|
12
|
-
typography: {
|
|
13
|
-
fontFamily: ['Noto Sans TC', 'Helvetica', 'Arial', 'sans-serif'].join(','),
|
|
14
|
-
},
|
|
15
|
-
palette: {
|
|
16
|
-
primary: {
|
|
17
|
-
light: '#82C0FF',
|
|
18
|
-
main: '#4990E2',
|
|
19
|
-
dark: '#0063B0',
|
|
20
|
-
},
|
|
21
|
-
secondary: {
|
|
22
|
-
light: '#FFD759',
|
|
23
|
-
main: '#F5A623',
|
|
24
|
-
dark: '#BD7700',
|
|
25
|
-
contrastText: '#FFFFFF',
|
|
26
|
-
},
|
|
27
|
-
green: {
|
|
28
|
-
primary: {
|
|
29
|
-
light: '#9DD49E',
|
|
30
|
-
main: '#5CB85D',
|
|
31
|
-
dark: '#218838',
|
|
32
|
-
},
|
|
33
|
-
blueGreen: {
|
|
34
|
-
main: '#19A696',
|
|
35
|
-
},
|
|
36
|
-
grassGreen: {
|
|
37
|
-
main: '#80BB5A',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
exports.default = theme;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function capitalize(string: any): string;
|
package/dist/utils/Capitalize.js
DELETED