@team-monolith/cds 1.55.2 → 1.55.3
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/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/Evaluation.js +2 -1
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormIconAndLabel.js +1 -4
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormLabel.d.ts +1 -2
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormLabel.js +7 -3
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormQuestion.d.ts +0 -1
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormQuestion.js +4 -2
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/SettingForm.js +1 -3
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import styled from "@emotion/styled";
|
|
4
4
|
import { css } from "@emotion/react";
|
|
5
5
|
import { ToggleButtonGroup, } from "../../../../../ToggleButtonGroup";
|
|
6
|
+
import _ from "lodash";
|
|
6
7
|
const TOGGLE_BUTTON_GROUP_WIDTH = 320;
|
|
7
8
|
/** 데이터를 받아 자기평가 항목들과 ToggleButtonGroup을 그리는 컴포넌트입니다.
|
|
8
9
|
* 비지니스 로직이 포함되어 있지 않습니다.
|
|
@@ -12,7 +13,7 @@ export function Evaluation(props) {
|
|
|
12
13
|
return (_jsxs(Container, Object.assign({ className: className, onClick: onClick }, { children: [_jsx(Header, { children: _jsx(LabelArea, { children: data.map(({ label }, index) => (_jsx(Label, { children: label }, index))) }) }), evaluations.map(({ question, selectedLabelIndex }, index) => (_jsxs(Item, { children: [_jsx(Index, { children: index + 1 }), _jsx(Question, { children: question.text }), _jsx(StyledToggleButtonGroup, { data: data, activeIndex: selectedLabelIndex, setActiveIndex: !onChange
|
|
13
14
|
? undefined
|
|
14
15
|
: (activeIndex) => {
|
|
15
|
-
const newEvaluations =
|
|
16
|
+
const newEvaluations = _.cloneDeep(evaluations);
|
|
16
17
|
newEvaluations[index].selectedLabelIndex = activeIndex;
|
|
17
18
|
onChange(newEvaluations);
|
|
18
19
|
} })] }, index)))] })));
|
|
@@ -30,10 +30,7 @@ export function FormIconAndLabel(props) {
|
|
|
30
30
|
return (_jsx(DropdownItem, { index: index, label: title, preserveIconColor: true, startIcon: startIcon, onClick: () => {
|
|
31
31
|
onChange(type);
|
|
32
32
|
} }, index));
|
|
33
|
-
}) })), Array.from({ length: labelsLength }).map((_, index) => (_jsxs(LabelLine, { children: [_jsx(Icon, { children: icons[index].onIcon }), _jsx(FormLabel, { control: control, index: index,
|
|
34
|
-
required: "필수 입력 항목입니다.",
|
|
35
|
-
maxLength: 12,
|
|
36
|
-
} })] }, index)))] }));
|
|
33
|
+
}) })), Array.from({ length: labelsLength }).map((_, index) => (_jsxs(LabelLine, { children: [_jsx(Icon, { children: icons[index].onIcon }), _jsx(FormLabel, { control: control, index: index })] }, index)))] }));
|
|
37
34
|
} }));
|
|
38
35
|
}
|
|
39
36
|
const LabelLine = styled.div `
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Control
|
|
1
|
+
import { Control } from "react-hook-form";
|
|
2
2
|
import { SettingFormData } from "../SettingForm";
|
|
3
3
|
/** 레이블을 설정하는 Form입니다. */
|
|
4
4
|
export declare function FormLabel(props: {
|
|
5
5
|
control: Control<SettingFormData, any>;
|
|
6
6
|
index: number;
|
|
7
|
-
rules?: Omit<RegisterOptions<SettingFormData, `labels.${number}`>, "valueAsNumber" | "valueAsDate" | "setValueAs" | "disabled">;
|
|
8
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,16 +3,20 @@ import { useController } from "react-hook-form";
|
|
|
3
3
|
import styled from "@emotion/styled";
|
|
4
4
|
import { css } from "@emotion/react";
|
|
5
5
|
import { FormInput } from "../../../../../Form";
|
|
6
|
+
const LABEL_RULES = {
|
|
7
|
+
required: "필수 입력 항목입니다.",
|
|
8
|
+
maxLength: 12,
|
|
9
|
+
};
|
|
6
10
|
/** 레이블을 설정하는 Form입니다. */
|
|
7
11
|
export function FormLabel(props) {
|
|
8
|
-
const { control, index
|
|
12
|
+
const { control, index } = props;
|
|
9
13
|
// endIcon에 들어갈 value, error를 사용하기 위해 useController를 사용합니다.
|
|
10
14
|
const { field: { value }, fieldState: { error }, } = useController({
|
|
11
15
|
control,
|
|
12
16
|
name: `labels.${index}`,
|
|
13
|
-
rules,
|
|
17
|
+
rules: LABEL_RULES,
|
|
14
18
|
});
|
|
15
|
-
return (_jsx(FormInput, { control: control, name: `labels.${index}`, rules:
|
|
19
|
+
return (_jsx(FormInput, { control: control, name: `labels.${index}`, rules: LABEL_RULES, size: "small", endIcon: _jsx(Counter, Object.assign({ error: Boolean(error) }, { children: value.length + "/" + LABEL_RULES.maxLength })), fullWidth: true }));
|
|
16
20
|
}
|
|
17
21
|
const Counter = styled.span(({ theme, error }) => css `
|
|
18
22
|
color: ${error
|
|
@@ -5,8 +5,10 @@ import { DeleteBinLineIcon, SquareButton } from "../../../../../../..";
|
|
|
5
5
|
import { FormInput } from "../../../../Form";
|
|
6
6
|
/** 평가 항목을 설정하는 Form입니다. */
|
|
7
7
|
export function FormQuestion(props) {
|
|
8
|
-
const { control, index,
|
|
9
|
-
return (_jsxs(Item, { children: [_jsx(Index, { children: index + 1 }), _jsx(FormInput, { control: control, name: `evaluations.${index}.question.text`, rules:
|
|
8
|
+
const { control, index, onDelete } = props;
|
|
9
|
+
return (_jsxs(Item, { children: [_jsx(Index, { children: index + 1 }), _jsx(FormInput, { control: control, name: `evaluations.${index}.question.text`, rules: {
|
|
10
|
+
required: "필수 입력 항목입니다.",
|
|
11
|
+
}, size: "small", placeholder: `${index + 1}번 평가 항목`, multiline: true, fullWidth: true }), onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete }))] }));
|
|
10
12
|
}
|
|
11
13
|
const Item = styled.div(({ theme }) => css `
|
|
12
14
|
display: flex;
|
|
@@ -41,9 +41,7 @@ export function SettingForm(props) {
|
|
|
41
41
|
return (_jsxs(Form, Object.assign({ className: className, onSubmit: handleSubmit(onSubmit) }, { children: [_jsxs(Title, { children: [_jsx(EmojiStickerLineIcon, { css: css `
|
|
42
42
|
width: 12px;
|
|
43
43
|
height: 12px;
|
|
44
|
-
` }), "3\uB2E8\uACC4 \uD3C9\uAC00"] }), _jsxs(Content, { children: [_jsxs(Left, { children: [_jsx(Label, { children: "\uD3C9\uAC00 \uD56D\uBAA9" }), fields.map((field, index) => (_jsx(FormQuestion, { index: index, control: control,
|
|
45
|
-
required: "필수 입력 항목입니다.",
|
|
46
|
-
}, onDelete: index !== 0
|
|
44
|
+
` }), "3\uB2E8\uACC4 \uD3C9\uAC00"] }), _jsxs(Content, { children: [_jsxs(Left, { children: [_jsx(Label, { children: "\uD3C9\uAC00 \uD56D\uBAA9" }), fields.map((field, index) => (_jsx(FormQuestion, { index: index, control: control, onDelete: index !== 0
|
|
47
45
|
? () => {
|
|
48
46
|
remove(index);
|
|
49
47
|
}
|