@team-monolith/cds 1.51.1 → 1.52.0
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/icons/Custom.js +2 -2
- package/dist/icons/custom/worksheet-color.svg +5 -5
- package/dist/icons/custom/worksheet.svg +4 -4
- package/dist/patterns/LexicalEditor/LexicalEditor.d.ts +2 -0
- package/dist/patterns/LexicalEditor/LexicalEditor.js +6 -2
- package/dist/patterns/LexicalEditor/Plugins.d.ts +1 -0
- package/dist/patterns/LexicalEditor/Plugins.js +4 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/ProblemSelectNode.d.ts +1 -4
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxComponent.d.ts +1 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxEdit.d.ts +1 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxView.d.ts +1 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/FormSelection.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/InputComponent.d.ts +7 -0
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/InputComponent.js +79 -0
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.d.ts +11 -0
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.js +93 -0
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SheetInputNode.d.ts +33 -0
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SheetInputNode.js +77 -0
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/index.d.ts +2 -0
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/index.js +2 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxComponent.d.ts +18 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxComponent.js +80 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxEdit.d.ts +8 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxEdit.js +7 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxView.d.ts +9 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxView.js +22 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/index.d.ts +2 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/index.js +2 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent.d.ts +9 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent.js +81 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormAllowMultipleAnswers.d.ts +6 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormAllowMultipleAnswers.js +10 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormSelection.d.ts +11 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormSelection.js +86 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/SettingForm.d.ts +13 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/SettingForm.js +148 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/index.d.ts +1 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/index.js +1 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SheetSelectNode.d.ts +43 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SheetSelectNode.js +82 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/index.d.ts +2 -0
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/index.js +2 -0
- package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageDialog.d.ts +4 -1
- package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageDialog.js +4 -4
- package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUploadedDialogBody.d.ts +1 -1
- package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUploadedDialogBody.js +5 -5
- package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUriDialogBody.d.ts +1 -1
- package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUriDialogBody.js +4 -4
- package/dist/patterns/LexicalEditor/nodes/insertImageDialog/index.d.ts +1 -0
- package/dist/patterns/LexicalEditor/nodes/insertImageDialog/index.js +1 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdderPlugin.d.ts +1 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdderPlugin.js +6 -2
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/useContextMenuOptions.d.ts +1 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/useContextMenuOptions.js +8 -2
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.d.ts +2 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js +56 -4
- package/dist/patterns/LexicalEditor/plugins/SheetInputPlugin/index.d.ts +5 -0
- package/dist/patterns/LexicalEditor/plugins/SheetInputPlugin/index.js +20 -0
- package/dist/patterns/LexicalEditor/plugins/SheetSelectPlugin/index.d.ts +5 -0
- package/dist/patterns/LexicalEditor/plugins/SheetSelectPlugin/index.js +20 -0
- package/dist/patterns/LexicalEditor/theme.d.ts +2 -0
- package/dist/patterns/LexicalEditor/theme.js +14 -0
- package/package.json +1 -1
package/dist/icons/Custom.js
CHANGED
|
@@ -293,10 +293,10 @@ export const CustomBadgeColorIcon = forwardRef((props, ref) => {
|
|
|
293
293
|
import customeWorksheetSvgImport from "./custom/worksheet.svg";
|
|
294
294
|
export const customeWorksheetSvg = customeWorksheetSvgImport;
|
|
295
295
|
export const CustomWorksheetIcon = forwardRef((props, ref) => {
|
|
296
|
-
return (_jsxs("svg", Object.assign({}, props, { ref: ref,
|
|
296
|
+
return (_jsxs("svg", Object.assign({}, props, { ref: ref, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M3 19.5C3 18.6716 3.67157 18 4.5 18H19.5C20.3284 18 21 18.6716 21 19.5C21 20.3284 20.3284 21 19.5 21H4.5C3.67157 21 3 20.3284 3 19.5Z", fill: "currentColor" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5 3H19C20.1 3 21 3.9 21 5V15C21 16.1 20.1 17 19 17H5C3.9 17 3 16.1 3 15V5C3 3.9 3.9 3 5 3ZM8.13137 14.5L5.5 5.5H8.20107L9.5 11L10.937 5.5H13.063L14.5 11L15.7989 5.5H18.5L15.8686 14.5H13.5509L12 10L10.4491 14.5H8.13137Z", fill: "currentColor" })] })));
|
|
297
297
|
});
|
|
298
298
|
import customeWorksheetColorSvgImport from "./custom/worksheet-color.svg";
|
|
299
299
|
export const customeWorksheetColorSvg = customeWorksheetColorSvgImport;
|
|
300
300
|
export const CustomWorksheetColorIcon = forwardRef((props, ref) => {
|
|
301
|
-
return (_jsxs("svg", Object.assign({}, props, { ref: ref,
|
|
301
|
+
return (_jsxs("svg", Object.assign({}, props, { ref: ref, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M19 3H5C3.9 3 3 3.9 3 5V15C3 16.1 3.9 17 5 17H19C20.1 17 21 16.1 21 15V5C21 3.9 20.1 3 19 3Z", fill: "#874BFF" }), _jsx("path", { d: "M3 19.5C3 18.6716 3.67157 18 4.5 18H19.5C20.3284 18 21 18.6716 21 19.5C21 20.3284 20.3284 21 19.5 21H4.5C3.67157 21 3 20.3284 3 19.5Z", fill: "#EEE6FF" }), _jsx("path", { d: "M8.13137 14.5L5.5 5.5H8.20107L9.42091 11.0371H9.49062L10.937 5.5H13.063L14.5094 11.0547H14.5791L15.7989 5.5H18.5L15.8686 14.5H13.5509L12.0349 9.47266H11.9651L10.4491 14.5H8.13137Z", fill: "#EEE5FF" })] })));
|
|
302
302
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</svg>
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M19 3H5C3.9 3 3 3.9 3 5V15C3 16.1 3.9 17 5 17H19C20.1 17 21 16.1 21 15V5C21 3.9 20.1 3 19 3Z" fill="#874BFF" style="fill:#874BFF;fill:color(display-p3 0.5303 0.2954 1.0000);fill-opacity:1;"/>
|
|
3
|
+
<path d="M3 19.5C3 18.6716 3.67157 18 4.5 18H19.5C20.3284 18 21 18.6716 21 19.5C21 20.3284 20.3284 21 19.5 21H4.5C3.67157 21 3 20.3284 3 19.5Z" fill="#EEE6FF" style="fill:#EEE6FF;fill:color(display-p3 0.9333 0.9000 1.0000);fill-opacity:1;"/>
|
|
4
|
+
<path d="M8.13137 14.5L5.5 5.5H8.20107L9.42091 11.0371H9.49062L10.937 5.5H13.063L14.5094 11.0547H14.5791L15.7989 5.5H18.5L15.8686 14.5H13.5509L12.0349 9.47266H11.9651L10.4491 14.5H8.13137Z" fill="#EEE5FF" style="fill:#EEE5FF;fill:color(display-p3 0.9333 0.8980 1.0000);fill-opacity:1;"/>
|
|
5
|
+
</svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
</svg>
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3 19.5C3 18.6716 3.67157 18 4.5 18H19.5C20.3284 18 21 18.6716 21 19.5C21 20.3284 20.3284 21 19.5 21H4.5C3.67157 21 3 20.3284 3 19.5Z" fill="#363636" style="fill:#363636;fill:color(display-p3 0.2118 0.2118 0.2118);fill-opacity:1;"/>
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 3H19C20.1 3 21 3.9 21 5V15C21 16.1 20.1 17 19 17H5C3.9 17 3 16.1 3 15V5C3 3.9 3.9 3 5 3ZM8.13137 14.5L5.5 5.5H8.20107L9.5 11L10.937 5.5H13.063L14.5 11L15.7989 5.5H18.5L15.8686 14.5H13.5509L12 10L10.4491 14.5H8.13137Z" fill="#363636" style="fill:#363636;fill:color(display-p3 0.2118 0.2118 0.2118);fill-opacity:1;"/>
|
|
4
|
+
</svg>
|
|
@@ -14,6 +14,8 @@ export interface LexicalEditorProps {
|
|
|
14
14
|
freezeProblemNode?: boolean;
|
|
15
15
|
/** 퀴즈 정답이 공개되는지 여부. false가 default입니다. 공개하고자 하는곳에서 true로 설정해야 합니다. */
|
|
16
16
|
showQuizSolution?: boolean;
|
|
17
|
+
/** 활동지 노드가 허용되는지 여부. false가 디폴트이고, 전달하지 않아도 로컬스토리지 devMode로도 노출시킬 수 있습니다. */
|
|
18
|
+
isSheetEnabled?: boolean;
|
|
17
19
|
/** 퀴즈 노드가 허용되는지 여부. false가 디폴트이고, 전달하지 않아도 로컬스토리지 devMode로도 노출시킬 수 있습니다. */
|
|
18
20
|
isQuizEnabled?: boolean;
|
|
19
21
|
/** 외부에서 플러그인을 주입하는 경우 활용함 */
|
|
@@ -16,6 +16,8 @@ import { ProblemSelectNode } from "./nodes/ProblemSelectNode";
|
|
|
16
16
|
import { LayoutContainerNode } from "./nodes/LayoutContainerNode";
|
|
17
17
|
import { LayoutItemNode } from "./nodes/LayoutItemNode";
|
|
18
18
|
import _ from "lodash";
|
|
19
|
+
import { SheetSelectNode } from "./nodes/SheetSelectNode";
|
|
20
|
+
import { SheetInputNode } from "./nodes/SheetInputNode";
|
|
19
21
|
function validateValue(value) {
|
|
20
22
|
var _a, _b;
|
|
21
23
|
if (value && typeof value !== "object") {
|
|
@@ -52,7 +54,7 @@ function getCleanObject(obj) {
|
|
|
52
54
|
return newObj;
|
|
53
55
|
}
|
|
54
56
|
export function LexicalEditor(props) {
|
|
55
|
-
const { className, contentEditableClassName, value, onChange, editable = true, showQuizSolution = false, freezeProblemNode = false, isQuizEnabled = false, children, } = props;
|
|
57
|
+
const { className, contentEditableClassName, value, onChange, editable = true, showQuizSolution = false, freezeProblemNode = false, isSheetEnabled = false, isQuizEnabled = false, children, } = props;
|
|
56
58
|
const theme = useTheme();
|
|
57
59
|
const initialConfig = {
|
|
58
60
|
namespace: "CodleLexicalEditor",
|
|
@@ -76,6 +78,8 @@ export function LexicalEditor(props) {
|
|
|
76
78
|
ColoredQuoteNode,
|
|
77
79
|
LayoutContainerNode,
|
|
78
80
|
LayoutItemNode,
|
|
81
|
+
SheetSelectNode,
|
|
82
|
+
SheetInputNode,
|
|
79
83
|
{
|
|
80
84
|
replace: QuoteNode,
|
|
81
85
|
with: (_node) => {
|
|
@@ -100,5 +104,5 @@ export function LexicalEditor(props) {
|
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
: undefined;
|
|
103
|
-
return (_jsx(LexicalCustomConfigContext.Provider, Object.assign({ value: { freezeProblemNode, showQuizSolution } }, { children: _jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [_jsx(Plugins, { className: className, contentEditableClassName: contentEditableClassName, onChange: onChangeHandler, isQuizEnabled: isQuizEnabled }), _jsx(_Fragment, { children: children })] })) })));
|
|
107
|
+
return (_jsx(LexicalCustomConfigContext.Provider, Object.assign({ value: { freezeProblemNode, showQuizSolution } }, { children: _jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [_jsx(Plugins, { className: className, contentEditableClassName: contentEditableClassName, onChange: onChangeHandler, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(_Fragment, { children: children })] })) })));
|
|
104
108
|
}
|
|
@@ -8,6 +8,7 @@ export interface PluginsProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
contentEditableClassName?: string;
|
|
10
10
|
onChange?: (blocks: SerializedEditorState<SerializedLexicalNode>) => void;
|
|
11
|
+
isSheetEnabled: boolean;
|
|
11
12
|
isQuizEnabled: boolean;
|
|
12
13
|
}
|
|
13
14
|
export default function Plugins(props: PluginsProps): ReactElement;
|
|
@@ -30,8 +30,10 @@ import styled from "@emotion/styled";
|
|
|
30
30
|
import ProblemInputPlugin from "./plugins/ProblemInputPlugin";
|
|
31
31
|
import ProblemSelectPlugin from "./plugins/ProblemSelectPlugin";
|
|
32
32
|
import { LayoutPlugin } from "./plugins/LayoutPlugin";
|
|
33
|
+
import SheetSelectPlugin from "./plugins/SheetSelectPlugin";
|
|
34
|
+
import SheetInputPlugin from "./plugins/SheetInputPlugin";
|
|
33
35
|
export default function Plugins(props) {
|
|
34
|
-
const { className, contentEditableClassName, onChange, isQuizEnabled } = props;
|
|
36
|
+
const { className, contentEditableClassName, onChange, isSheetEnabled, isQuizEnabled, } = props;
|
|
35
37
|
const isEditable = useLexicalEditable();
|
|
36
38
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
37
39
|
const [isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
@@ -44,7 +46,7 @@ export default function Plugins(props) {
|
|
|
44
46
|
onChange === null || onChange === void 0 ? void 0 : onChange(editorState.toJSON());
|
|
45
47
|
},
|
|
46
48
|
// ignore 하지 않으면 Form에서 수정하지 않았는데 Dirty로 처리됨.
|
|
47
|
-
ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isQuizEnabled: isQuizEnabled }), _jsx(MarkdownShortcutPlugin, { transformers: CODLE_TRANSFORMERS }), _jsx(HistoryPlugin, {})] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem, isQuizEnabled: isQuizEnabled }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode })] })), !isEditable && _jsx(LexicalClickableLinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(ImagesPlugin, {}), _jsx(TablePlugin, {}), _jsx(LinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 5 }), _jsx(ProblemInputPlugin, {}), _jsx(ProblemSelectPlugin, {}), _jsx(LayoutPlugin, {})] }));
|
|
49
|
+
ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(MarkdownShortcutPlugin, { transformers: CODLE_TRANSFORMERS }), _jsx(HistoryPlugin, {})] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode })] })), !isEditable && _jsx(LexicalClickableLinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(ImagesPlugin, {}), _jsx(TablePlugin, {}), _jsx(LinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 5 }), _jsx(ProblemInputPlugin, {}), _jsx(ProblemSelectPlugin, {}), _jsx(LayoutPlugin, {}), _jsx(SheetSelectPlugin, {}), _jsx(SheetInputPlugin, {})] }));
|
|
48
50
|
}
|
|
49
51
|
const ScrollArea = styled.div `
|
|
50
52
|
min-height: 150px;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { DecoratorNode, EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from "lexical";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
src: string;
|
|
5
|
-
altText: string;
|
|
6
|
-
}
|
|
3
|
+
import { ImageProps } from "../insertImageDialog";
|
|
7
4
|
export interface SelectionWithoutSolution {
|
|
8
5
|
show: {
|
|
9
6
|
image: ImageProps | null;
|
package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxComponent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ImageProps } from "
|
|
2
|
+
import { ImageProps } from "../../insertImageDialog";
|
|
3
3
|
export type SelectBoxType = "primary" | "success" | "danger";
|
|
4
4
|
/** 비지니스 로직과 무관한 SelectBox를 그리는 공통 컴포넌트입니다. */
|
|
5
5
|
export declare function SelectBoxComponent(props: {
|
|
@@ -8,7 +8,7 @@ import { DeleteBinLineIcon, ErrorWarningFillIcon, ImageAddFillIcon, ImageEditFil
|
|
|
8
8
|
import SquareButton from "../../../../../components/SquareButton";
|
|
9
9
|
import Switch from "../../../../../components/Switch";
|
|
10
10
|
import { useState } from "react";
|
|
11
|
-
import { InsertImageDialog } from "
|
|
11
|
+
import { InsertImageDialog } from "../../insertImageDialog";
|
|
12
12
|
export function FormSelection(props) {
|
|
13
13
|
const { index, control, watch, rules, onDelete } = props;
|
|
14
14
|
const [imageOpen, setImageOpen] = useState(false);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import useLexicalEditable from "@lexical/react/useLexicalEditable";
|
|
5
|
+
import { $getNodeByKey } from "lexical";
|
|
6
|
+
import { useContext, useState } from "react";
|
|
7
|
+
import { LexicalCustomConfigContext } from "../../LexicalCustomConfigContext";
|
|
8
|
+
import styled from "@emotion/styled";
|
|
9
|
+
import { css } from "@emotion/react";
|
|
10
|
+
import { Input, Settings3FillIcon, SquareButton } from "../../../..";
|
|
11
|
+
import { SettingForm } from "./SettingForm";
|
|
12
|
+
import { $isSheetInputNode } from "./SheetInputNode";
|
|
13
|
+
export function InputComponent(props) {
|
|
14
|
+
const { multiline, value, placeholder, nodeKey } = props;
|
|
15
|
+
const [editor] = useLexicalComposerContext();
|
|
16
|
+
const [settingOpen, setSettingOpen] = useState(false);
|
|
17
|
+
const isEditable = useLexicalEditable();
|
|
18
|
+
const [focus, setFocus] = useState(false);
|
|
19
|
+
// SoT를 EditorState로 설정하는 경우 한글 입력시 문제가 생김.
|
|
20
|
+
// ex) "나비" 입력시 -> "ㄴ나납ㅂ비"
|
|
21
|
+
// SoT를 내부 State로 관리하고 EditorState를 따로 설정.
|
|
22
|
+
// 문제를 더 파악하고 추후 개선 필요.
|
|
23
|
+
const [valueInput, setValueInput] = useState(value);
|
|
24
|
+
const { freezeProblemNode } = useContext(LexicalCustomConfigContext);
|
|
25
|
+
const handleChange = (value) => {
|
|
26
|
+
setValueInput(value);
|
|
27
|
+
editor.update(() => {
|
|
28
|
+
const node = $getNodeByKey(nodeKey);
|
|
29
|
+
if (!$isSheetInputNode(node)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
node.setValue(value);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
// view
|
|
36
|
+
if (!isEditable) {
|
|
37
|
+
return (_jsx(Input, { multiline: multiline, css: css `
|
|
38
|
+
textarea {
|
|
39
|
+
// 100-8*2
|
|
40
|
+
max-height: 84px;
|
|
41
|
+
min-height: 84px;
|
|
42
|
+
// mui TextareaAutosize의 overflow: hidden을 무력화시킵니다.
|
|
43
|
+
overflow: auto !important;
|
|
44
|
+
}
|
|
45
|
+
`, inputProps: freezeProblemNode
|
|
46
|
+
? { readOnly: true }
|
|
47
|
+
: {
|
|
48
|
+
onFocus: () => setFocus(true),
|
|
49
|
+
onBlur: () => setFocus(false),
|
|
50
|
+
}, size: "small", color: focus ? "activePrimary" : "default", placeholder: placeholder || "여기에 입력하세요.", value: valueInput, onChange: (e) => {
|
|
51
|
+
handleChange(e.target.value);
|
|
52
|
+
}, fullWidth: true }));
|
|
53
|
+
}
|
|
54
|
+
// edit
|
|
55
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", Object.assign({ css: css `
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: 4px;
|
|
59
|
+
` }, { children: [_jsx(VirtualInput, Object.assign({ onClick: () => setSettingOpen((open) => !open), css: multiline &&
|
|
60
|
+
css `
|
|
61
|
+
height: 100px;
|
|
62
|
+
` }, { children: multiline ? "서술형 입력 칸" : "단답형 입력 칸" })), _jsx(SquareButton, { size: "small", color: "icon", icon: _jsx(Settings3FillIcon, {}), onClick: () => setSettingOpen((open) => !open) })] })), settingOpen && (_jsx(SettingForm, { multiline: multiline, placeholder: placeholder, nodeKey: nodeKey, onClose: () => setSettingOpen(false) }))] }));
|
|
63
|
+
}
|
|
64
|
+
const VirtualInput = styled.div(({ theme }) => css `
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
height: 36px;
|
|
67
|
+
width: 400px;
|
|
68
|
+
padding: 8px 16px;
|
|
69
|
+
align-items: center;
|
|
70
|
+
border-radius: 8px;
|
|
71
|
+
background: ${theme.color.background.neutralAlt};
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
74
|
+
font-family: ${theme.fontFamily.ui};
|
|
75
|
+
font-size: 14px;
|
|
76
|
+
font-style: normal;
|
|
77
|
+
font-weight: 400;
|
|
78
|
+
line-height: 20px; /* 142.857% */
|
|
79
|
+
`);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeKey } from "lexical";
|
|
2
|
+
export interface SettingFormData {
|
|
3
|
+
placeholder: string;
|
|
4
|
+
}
|
|
5
|
+
/** 활동지 활동의 입력칸 설정 컴포넌트입니다. */
|
|
6
|
+
export declare function SettingForm(props: {
|
|
7
|
+
multiline: boolean;
|
|
8
|
+
placeholder: string;
|
|
9
|
+
nodeKey: NodeKey;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { $getNodeByKey } from "lexical";
|
|
5
|
+
import { Controller, useForm } from "react-hook-form";
|
|
6
|
+
import styled from "@emotion/styled";
|
|
7
|
+
import { css } from "@emotion/react";
|
|
8
|
+
import { InputMethodLineIcon, QuestionFillIcon } from "../../../../icons";
|
|
9
|
+
import { Button, Input, shadows, Tooltip } from "../../../..";
|
|
10
|
+
import { $isSheetInputNode } from "./SheetInputNode";
|
|
11
|
+
/** 활동지 활동의 입력칸 설정 컴포넌트입니다. */
|
|
12
|
+
export function SettingForm(props) {
|
|
13
|
+
const { multiline, placeholder, nodeKey, onClose } = props;
|
|
14
|
+
const [editor] = useLexicalComposerContext();
|
|
15
|
+
const { control, handleSubmit } = useForm({
|
|
16
|
+
mode: "all",
|
|
17
|
+
defaultValues: {
|
|
18
|
+
placeholder,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const onSettingSubmit = (data) => {
|
|
22
|
+
editor.update(() => {
|
|
23
|
+
const node = $getNodeByKey(nodeKey);
|
|
24
|
+
if (!$isSheetInputNode(node)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
node.setPlaceholder(data.placeholder);
|
|
28
|
+
});
|
|
29
|
+
onClose();
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs(Form, Object.assign({ onSubmit: handleSubmit(onSettingSubmit) }, { children: [_jsxs(Title, { children: [_jsx(InputMethodLineIcon, { css: css `
|
|
32
|
+
width: 12px;
|
|
33
|
+
height: 12px;
|
|
34
|
+
` }), multiline ? "서술형 입력 칸" : "단답형 입력 칸"] }), _jsx(Content, { children: _jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC790\uB9AC \uD45C\uC2DC\uC790", _jsx(Tooltip, Object.assign({ text: _jsx("span", { children: "\uC785\uB825 \uCE78\uC5D0 \uAE30\uBCF8\uC73C\uB85C \uB178\uCD9C\uB418\uB294 \uD14D\uC2A4\uD2B8\uC785\uB2C8\uB2E4." }), placement: "top" }, { children: _jsx(QuestionFillIcon, { css: css `
|
|
35
|
+
width: 12px;
|
|
36
|
+
height: 12px;
|
|
37
|
+
` }) }))] }), _jsx(Controller, { name: "placeholder", control: control, render: ({ field: { value, onChange } }) => {
|
|
38
|
+
return (_jsx(Input, { size: "small", color: "default", value: value, onChange: onChange, placeholder: "\uC608) \uC5EC\uAE30\uC5D0 \uC785\uB825\uD558\uC138\uC694." }));
|
|
39
|
+
} })] }) }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: "\uB2EB\uAE30", onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: "\uC774\uB300\uB85C \uB123\uAE30", bold: true, type: "submit" })] })] })));
|
|
40
|
+
}
|
|
41
|
+
const Form = styled.form(({ theme }) => css `
|
|
42
|
+
display: flex;
|
|
43
|
+
width: 620px;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
border-radius: 6px;
|
|
46
|
+
border: 1px solid ${theme.color.background.neutralAltActive};
|
|
47
|
+
background: ${theme.color.background.neutralBase};
|
|
48
|
+
box-shadow: ${shadows.shadow08};
|
|
49
|
+
`);
|
|
50
|
+
const Title = styled.div(({ theme }) => css `
|
|
51
|
+
display: flex;
|
|
52
|
+
padding: 8px 12px;
|
|
53
|
+
gap: 4px;
|
|
54
|
+
align-items: center;
|
|
55
|
+
color: ${theme.color.foreground.neutralBase};
|
|
56
|
+
/* Default/Label/12px-Md */
|
|
57
|
+
font-family: ${theme.fontFamily.ui};
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
font-style: normal;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
line-height: 16px; /* 133.333% */
|
|
62
|
+
`);
|
|
63
|
+
const Content = styled.div(({ theme }) => css `
|
|
64
|
+
display: flex;
|
|
65
|
+
border-top: 1px solid ${theme.color.background.neutralAltActive};
|
|
66
|
+
border-bottom: 1px solid ${theme.color.background.neutralAltActive};
|
|
67
|
+
`);
|
|
68
|
+
const FormArea = styled.div `
|
|
69
|
+
width: 240px;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
gap: 8px;
|
|
73
|
+
padding: 12px;
|
|
74
|
+
`;
|
|
75
|
+
const Label = styled.div(({ theme }) => css `
|
|
76
|
+
display: flex;
|
|
77
|
+
gap: 4px;
|
|
78
|
+
align-items: center;
|
|
79
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
80
|
+
/* Default/Label/12px-Md */
|
|
81
|
+
font-family: ${theme.fontFamily.ui};
|
|
82
|
+
font-size: 12px;
|
|
83
|
+
font-style: normal;
|
|
84
|
+
font-weight: 500;
|
|
85
|
+
line-height: 16px; /* 133.333% */
|
|
86
|
+
`);
|
|
87
|
+
const Buttons = styled.div `
|
|
88
|
+
display: flex;
|
|
89
|
+
padding: 12px;
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
align-items: center;
|
|
92
|
+
gap: 8px;
|
|
93
|
+
`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DecoratorNode, EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from "lexical";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export interface SheetInputPayload {
|
|
4
|
+
multiline: boolean;
|
|
5
|
+
value: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
key?: NodeKey;
|
|
8
|
+
}
|
|
9
|
+
export type SerializedSheetInputNode = Spread<SheetInputPayload, SerializedLexicalNode>;
|
|
10
|
+
/**
|
|
11
|
+
* 입력칸을 나타내는 노드입니다.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SheetInputNode extends DecoratorNode<ReactNode> {
|
|
14
|
+
__multiline: boolean;
|
|
15
|
+
__value: string;
|
|
16
|
+
__placeholder: string;
|
|
17
|
+
isInline(): boolean;
|
|
18
|
+
static getType(): string;
|
|
19
|
+
getMultiline(): boolean;
|
|
20
|
+
getValue(): string;
|
|
21
|
+
getPlaceholder(): string;
|
|
22
|
+
setValue(value: string): void;
|
|
23
|
+
setPlaceholder(placeholder: string): void;
|
|
24
|
+
static clone(node: SheetInputNode): SheetInputNode;
|
|
25
|
+
constructor(multiline: boolean, value: string, placeholder: string, key?: NodeKey);
|
|
26
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
27
|
+
updateDOM(): boolean;
|
|
28
|
+
static importJSON(serializedNode: SerializedSheetInputNode): SheetInputNode;
|
|
29
|
+
exportJSON(): SerializedSheetInputNode;
|
|
30
|
+
decorate(): ReactNode;
|
|
31
|
+
}
|
|
32
|
+
export declare function $createSheetInputNode({ multiline, value, placeholder, key, }: SheetInputPayload): SheetInputNode;
|
|
33
|
+
export declare function $isSheetInputNode(node: LexicalNode | null | undefined): node is SheetInputNode;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { $applyNodeReplacement, DecoratorNode, } from "lexical";
|
|
3
|
+
import { addClassNamesToElement } from "@lexical/utils";
|
|
4
|
+
import { InputComponent } from "./InputComponent";
|
|
5
|
+
/**
|
|
6
|
+
* 입력칸을 나타내는 노드입니다.
|
|
7
|
+
*/
|
|
8
|
+
export class SheetInputNode extends DecoratorNode {
|
|
9
|
+
isInline() {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
static getType() {
|
|
13
|
+
return "sheet-input";
|
|
14
|
+
}
|
|
15
|
+
getMultiline() {
|
|
16
|
+
return this.__multiline;
|
|
17
|
+
}
|
|
18
|
+
getValue() {
|
|
19
|
+
return this.__value;
|
|
20
|
+
}
|
|
21
|
+
getPlaceholder() {
|
|
22
|
+
return this.__placeholder;
|
|
23
|
+
}
|
|
24
|
+
setValue(value) {
|
|
25
|
+
const self = this.getWritable();
|
|
26
|
+
self.__value = value;
|
|
27
|
+
}
|
|
28
|
+
setPlaceholder(placeholder) {
|
|
29
|
+
const self = this.getWritable();
|
|
30
|
+
self.__placeholder = placeholder;
|
|
31
|
+
}
|
|
32
|
+
static clone(node) {
|
|
33
|
+
return new SheetInputNode(node.__multiline, node.__value, node.__placeholder, node.__key);
|
|
34
|
+
}
|
|
35
|
+
constructor(multiline, value, placeholder, key) {
|
|
36
|
+
super(key);
|
|
37
|
+
this.__multiline = multiline;
|
|
38
|
+
this.__value = value;
|
|
39
|
+
this.__placeholder = placeholder;
|
|
40
|
+
}
|
|
41
|
+
createDOM(config) {
|
|
42
|
+
// Define the DOM element here
|
|
43
|
+
const root = document.createElement("div");
|
|
44
|
+
addClassNamesToElement(root, config.theme.sheetInput);
|
|
45
|
+
return root;
|
|
46
|
+
}
|
|
47
|
+
updateDOM() {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
static importJSON(serializedNode) {
|
|
51
|
+
const node = $createSheetInputNode({
|
|
52
|
+
key: serializedNode.key,
|
|
53
|
+
multiline: serializedNode.multiline,
|
|
54
|
+
value: serializedNode.value,
|
|
55
|
+
placeholder: serializedNode.placeholder,
|
|
56
|
+
});
|
|
57
|
+
return node;
|
|
58
|
+
}
|
|
59
|
+
exportJSON() {
|
|
60
|
+
return {
|
|
61
|
+
version: 1,
|
|
62
|
+
type: "sheet-input",
|
|
63
|
+
multiline: this.__multiline,
|
|
64
|
+
value: this.__value,
|
|
65
|
+
placeholder: this.__placeholder,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
decorate() {
|
|
69
|
+
return (_jsx(InputComponent, { multiline: this.__multiline, value: this.__value, placeholder: this.__placeholder, nodeKey: this.getKey() }));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function $createSheetInputNode({ multiline, value, placeholder, key, }) {
|
|
73
|
+
return $applyNodeReplacement(new SheetInputNode(multiline, value, placeholder, key));
|
|
74
|
+
}
|
|
75
|
+
export function $isSheetInputNode(node) {
|
|
76
|
+
return node instanceof SheetInputNode;
|
|
77
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ImageProps } from "../../insertImageDialog";
|
|
3
|
+
export declare const SelectBoxClasses: {
|
|
4
|
+
readonly container: "SheetSelectNode-SelectBox-container";
|
|
5
|
+
readonly index: "SheetSelectNode-SelectBox-index";
|
|
6
|
+
readonly content: "SheetSelectNode-SelectBox-content";
|
|
7
|
+
};
|
|
8
|
+
export type SelectBoxType = "primary" | "normal";
|
|
9
|
+
/** 비지니스 로직과 무관한 SelectBox를 그리는 공통 컴포넌트입니다. */
|
|
10
|
+
export declare function SelectBoxComponent(props: {
|
|
11
|
+
className?: string;
|
|
12
|
+
type: SelectBoxType;
|
|
13
|
+
index: React.ReactNode;
|
|
14
|
+
image?: ImageProps | null;
|
|
15
|
+
text: React.ReactNode;
|
|
16
|
+
/** 박스를 클릭할 때 실행될 콜백. 존재하지 않으면 cursor: pointer가 적용되지 않습니다. */
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css, useTheme } from "@emotion/react";
|
|
4
|
+
import styled from "@emotion/styled";
|
|
5
|
+
export const SelectBoxClasses = {
|
|
6
|
+
container: "SheetSelectNode-SelectBox-container",
|
|
7
|
+
index: "SheetSelectNode-SelectBox-index",
|
|
8
|
+
content: "SheetSelectNode-SelectBox-content",
|
|
9
|
+
};
|
|
10
|
+
const TYPE_TO_CONTAINER_STYLE = (theme, type) => ({
|
|
11
|
+
primary: css `
|
|
12
|
+
background: ${theme.color.container.blueContainer};
|
|
13
|
+
border: 1px solid ${theme.color.foreground.primary};
|
|
14
|
+
color: ${theme.color.container.blueOnContainer};
|
|
15
|
+
`,
|
|
16
|
+
normal: css `
|
|
17
|
+
background: ${theme.color.background.neutralAlt};
|
|
18
|
+
border: 1px solid transparent;
|
|
19
|
+
color: ${theme.color.foreground.neutralBase};
|
|
20
|
+
`,
|
|
21
|
+
})[type];
|
|
22
|
+
const TYPE_TO_INDEX_STYLE = (theme, type) => ({
|
|
23
|
+
primary: css `
|
|
24
|
+
background: ${theme.color.background.primary};
|
|
25
|
+
border: 1px solid ${theme.color.background.primary};
|
|
26
|
+
color: ${theme.color.foreground.neutralAlt};
|
|
27
|
+
`,
|
|
28
|
+
normal: css `
|
|
29
|
+
background: ${theme.color.background.neutralBase};
|
|
30
|
+
border: 1px solid ${theme.color.background.neutralAltActive};
|
|
31
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
32
|
+
`,
|
|
33
|
+
})[type];
|
|
34
|
+
/** 비지니스 로직과 무관한 SelectBox를 그리는 공통 컴포넌트입니다. */
|
|
35
|
+
export function SelectBoxComponent(props) {
|
|
36
|
+
const { className, type, index, image, text, onClick } = props;
|
|
37
|
+
const theme = useTheme();
|
|
38
|
+
return (_jsxs(Container, Object.assign({ className: `${className} ${SelectBoxClasses.container}`, css: TYPE_TO_CONTAINER_STYLE(theme, type), onClick: onClick }, { children: [_jsx(Index, Object.assign({ className: SelectBoxClasses.index, css: TYPE_TO_INDEX_STYLE(theme, type) }, { children: index })), _jsxs(Content, Object.assign({ className: SelectBoxClasses.content }, { children: [image && (_jsx("img", { src: image.src, alt: image.altText, css: css `
|
|
39
|
+
height: auto;
|
|
40
|
+
// 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
|
|
41
|
+
max-width: 100%;
|
|
42
|
+
width: fit-content;
|
|
43
|
+
border-radius: 6px;
|
|
44
|
+
` })), text] }))] })));
|
|
45
|
+
}
|
|
46
|
+
const Container = styled.div(({ onClick }) => css `
|
|
47
|
+
${onClick && "cursor: pointer;"}
|
|
48
|
+
display: flex;
|
|
49
|
+
width: 400px;
|
|
50
|
+
padding: 12px;
|
|
51
|
+
gap: 12px;
|
|
52
|
+
border-radius: 8px;
|
|
53
|
+
`);
|
|
54
|
+
const Index = styled.div(({ theme }) => css `
|
|
55
|
+
display: flex;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
width: 20px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
padding: 4px;
|
|
60
|
+
|
|
61
|
+
user-select: none; /* Standard syntax */
|
|
62
|
+
|
|
63
|
+
justify-content: center;
|
|
64
|
+
align-items: center;
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
font-family: ${theme.fontFamily.ui};
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
font-weight: 800;
|
|
69
|
+
line-height: 16px;
|
|
70
|
+
`);
|
|
71
|
+
const Content = styled.div(({ theme }) => css `
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 12px;
|
|
75
|
+
flex: 1;
|
|
76
|
+
font-family: ${theme.fontFamily.ui};
|
|
77
|
+
font-size: 16px;
|
|
78
|
+
font-weight: 400;
|
|
79
|
+
line-height: 20px;
|
|
80
|
+
`);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ImageProps } from "../../insertImageDialog";
|
|
2
|
+
/** SheetSelectNode의 하나의 선택지 edit모드 컴포넌트입니다. */
|
|
3
|
+
export declare function SelectBoxEdit(props: {
|
|
4
|
+
index: number;
|
|
5
|
+
image?: ImageProps | null;
|
|
6
|
+
text: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SelectBoxComponent } from "./SelectBoxComponent";
|
|
3
|
+
/** SheetSelectNode의 하나의 선택지 edit모드 컴포넌트입니다. */
|
|
4
|
+
export function SelectBoxEdit(props) {
|
|
5
|
+
const { index, image, text, onClick } = props;
|
|
6
|
+
return (_jsx(SelectBoxComponent, { index: index, type: "normal", image: image, text: text, onClick: onClick }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ImageProps } from "../../insertImageDialog";
|
|
2
|
+
/** SheetSelectNode의 하나의 선택지 view모드 컴포넌트입니다. */
|
|
3
|
+
export declare function SelectBoxView(props: {
|
|
4
|
+
index: number;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
image?: ImageProps | null;
|
|
7
|
+
text: string;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from "@emotion/react";
|
|
4
|
+
import { SelectBoxComponent } from "./SelectBoxComponent";
|
|
5
|
+
import { CheckFillIcon } from "../../../../../icons";
|
|
6
|
+
function getIndexIcon(type, index) {
|
|
7
|
+
return {
|
|
8
|
+
primary: (_jsx(CheckFillIcon, { css: css `
|
|
9
|
+
width: 12px;
|
|
10
|
+
height: 12px;
|
|
11
|
+
` })),
|
|
12
|
+
normal: index,
|
|
13
|
+
}[type];
|
|
14
|
+
}
|
|
15
|
+
/** SheetSelectNode의 하나의 선택지 view모드 컴포넌트입니다. */
|
|
16
|
+
export function SelectBoxView(props) {
|
|
17
|
+
const { index, isSelected, image, text, onClick } = props;
|
|
18
|
+
const selectBoxType = isSelected ? "primary" : "normal";
|
|
19
|
+
return (_jsx(SelectBoxComponent, { css: css `
|
|
20
|
+
width: 100%;
|
|
21
|
+
`, type: selectBoxType, index: getIndexIcon(selectBoxType, index), image: image, text: text, onClick: onClick }));
|
|
22
|
+
}
|