pds-dev-kit-web 1.4.43 → 1.4.44

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.
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { Props as ChatListProps } from './ChatList';
3
- declare type Props = Pick<ChatListProps, 'scrollVisibleType' | 'children' | 'bodyMBtnText' | 'bodySpacingMode'> & {
3
+ declare const Body: React.ForwardRefExoticComponent<Pick<ChatListProps, "children" | "scrollVisibleType" | "bodyMBtnText" | "bodySpacingMode"> & {
4
4
  isSubmitted: boolean;
5
- };
6
- declare function Body({ scrollVisibleType, children, isSubmitted, bodyMBtnText, bodySpacingMode }: Props): JSX.Element;
5
+ callBackAfterScrollToBottom: () => void;
6
+ } & React.RefAttributes<HTMLDivElement>>;
7
7
  export default Body;
@@ -30,26 +30,34 @@ var react_1 = __importStar(require("react"));
30
30
  var styled_components_1 = __importStar(require("styled-components"));
31
31
  var MainButton_1 = require("../MainButton");
32
32
  var useAutoScrollToBottom_1 = __importDefault(require("./useAutoScrollToBottom"));
33
- function Body(_a) {
34
- var scrollVisibleType = _a.scrollVisibleType, children = _a.children, isSubmitted = _a.isSubmitted, bodyMBtnText = _a.bodyMBtnText, bodySpacingMode = _a.bodySpacingMode;
33
+ var Body = react_1.default.forwardRef(function (_a, ref) {
34
+ var scrollVisibleType = _a.scrollVisibleType, children = _a.children, isSubmitted = _a.isSubmitted, bodyMBtnText = _a.bodyMBtnText, bodySpacingMode = _a.bodySpacingMode, callBackAfterScrollToBottom = _a.callBackAfterScrollToBottom;
35
35
  var _b = (0, react_1.useState)(false), isButtonShow = _b[0], setIsButtonShow = _b[1];
36
36
  var _c = (0, useAutoScrollToBottom_1.default)(), triggerScrollToBottom = _c.triggerScrollToBottom, EndOfList = _c.EndOfList;
37
- var scrollRef = (0, react_1.useRef)(null);
38
- var childrenLength = react_1.default.Children.count(children);
39
37
  /**
40
- * @when 스크롤하지 않은 상태에서 chatMessages가 업데이트 될 때마다
38
+ * @when 페이지 진입
41
39
  * @expected 채팅 리스트의 맨 밑으로 스크롤 내린다.
42
40
  * @clear -
43
41
  */
44
42
  (0, react_1.useEffect)(function () {
45
- if (isButtonShow) {
43
+ if (!isButtonShow) {
44
+ triggerScrollToBottom();
45
+ }
46
+ }, [children, isButtonShow, triggerScrollToBottom]);
47
+ /**
48
+ * @when 스크롤을 하고 있지 않은 상황에서 chatMessages가 업데이트 될 때마다
49
+ * @expected 채팅 리스트의 맨 밑으로 스크롤 내린다.
50
+ * @clear -
51
+ */
52
+ (0, react_1.useEffect)(function () {
53
+ var handleTriggerScroll = function () {
46
54
  if (isSubmitted) {
55
+ callBackAfterScrollToBottom();
47
56
  triggerScrollToBottom();
48
57
  }
49
- return;
50
- }
51
- triggerScrollToBottom();
52
- }, [childrenLength, isButtonShow, isSubmitted]);
58
+ };
59
+ setTimeout(function () { return handleTriggerScroll(); }, 0);
60
+ }, [children, isButtonShow, isSubmitted, callBackAfterScrollToBottom]);
53
61
  var handleClickMBtn = function () {
54
62
  triggerScrollToBottom();
55
63
  };
@@ -62,12 +70,12 @@ function Body(_a) {
62
70
  setIsButtonShow(true);
63
71
  };
64
72
  return (react_1.default.createElement(S_Body, { bodySpacingMode: bodySpacingMode },
65
- react_1.default.createElement(S_ChatMessageBox, { id: "chatMessageBox", onScroll: handleScroll, ref: scrollRef, scrollVisibleType: scrollVisibleType },
73
+ react_1.default.createElement(S_ChatMessageBox, { id: "chatMessageBox", onScroll: handleScroll, scrollVisibleType: scrollVisibleType, ref: ref },
66
74
  children,
67
75
  react_1.default.createElement(EndOfList, null)),
68
76
  isButtonShow && (react_1.default.createElement(S_BottomButtonWrapper, null,
69
77
  react_1.default.createElement(MainButton_1.MainButton, { text: bodyMBtnText, size: "small", onClick: handleClickMBtn })))));
70
- }
78
+ });
71
79
  var bodySpacing = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n padding-right: ", ";\n padding-left: ", ";\n"], ["\n box-sizing: border-box;\n padding-right: ", ";\n padding-left: ", ";\n"])), function (_a) {
72
80
  var theme = _a.theme;
73
81
  return theme.spacing.spacingE;
@@ -96,4 +104,5 @@ var S_BottomButtonWrapper = styled_components_1.default.div(templateObject_6 ||
96
104
  return theme.spacing.spacingC;
97
105
  });
98
106
  exports.default = Body;
107
+ Body.displayName = 'Body';
99
108
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -41,5 +41,5 @@ export declare type Props = {
41
41
  onSubmit: (value: string) => void;
42
42
  onClickHeaderIBtn1?: () => void;
43
43
  };
44
- declare function ChatList({ styleTheme, headerMode, titleText, descText, captionText, titleStyleTheme, headerDisplayType, headerIBtn1IconName, headerIBtn1IconFillType, children, textFieldState, textFieldHintText, textFieldDefaultText, textFieldMaxLength, scrollVisibleType, footerChildren, submitIBtnState, bodyMBtnText, bodySpacingMode, onSubmit, onClickHeaderIBtn1, submitIBtnIconName, submitIBtnIconFillType, footerIBtn1State, footerIBtn1IconName, footerIBtn1IconFillType, footerIBtn1Type, onClickFooterIBtn1, footerIBtn2State, footerIBtn2IconName, footerIBtn2IconFillType, footerIBtn2Type, onClickFooterIBtn2, footerIBtn3State, footerIBtn3IconName, footerIBtn3IconFillType, footerIBtn3Type, footerIBtn3Accept, onClickFooterIBtn3 }: Props): JSX.Element;
44
+ declare const ChatList: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
45
45
  export default ChatList;
@@ -49,7 +49,7 @@ var baseBackgroundColors = {
49
49
  translucent: 'ui_cpnt_list_base_area_translucent',
50
50
  transparent: 'ui_cpnt_list_base_area_translucent'
51
51
  };
52
- function ChatList(_a) {
52
+ var ChatList = react_1.default.forwardRef(function (_a, ref) {
53
53
  var _b = _a.styleTheme, styleTheme = _b === void 0 ? 'solid' : _b, _c = _a.headerMode, headerMode = _c === void 0 ? 'use' : _c, titleText = _a.titleText, descText = _a.descText, captionText = _a.captionText, _d = _a.titleStyleTheme, titleStyleTheme = _d === void 0 ? 'subTitleBold' : _d, _e = _a.headerDisplayType, headerDisplayType = _e === void 0 ? 'none' : _e, _f = _a.headerIBtn1IconName, headerIBtn1IconName = _f === void 0 ? 'ic_xmark' : _f, _g = _a.headerIBtn1IconFillType, headerIBtn1IconFillType = _g === void 0 ? 'line' : _g, children = _a.children, _h = _a.textFieldState, textFieldState = _h === void 0 ? 'normal' : _h, textFieldHintText = _a.textFieldHintText, textFieldDefaultText = _a.textFieldDefaultText, textFieldMaxLength = _a.textFieldMaxLength, _j = _a.scrollVisibleType, scrollVisibleType = _j === void 0 ? 'moving' : _j, footerChildren = _a.footerChildren, _k = _a.submitIBtnState, submitIBtnState = _k === void 0 ? 'normal' : _k, bodyMBtnText = _a.bodyMBtnText, _l = _a.bodySpacingMode, bodySpacingMode = _l === void 0 ? 'none' : _l, onSubmit = _a.onSubmit, onClickHeaderIBtn1 = _a.onClickHeaderIBtn1, submitIBtnIconName = _a.submitIBtnIconName, submitIBtnIconFillType = _a.submitIBtnIconFillType, _m = _a.footerIBtn1State, footerIBtn1State = _m === void 0 ? 'normal' : _m, footerIBtn1IconName = _a.footerIBtn1IconName, footerIBtn1IconFillType = _a.footerIBtn1IconFillType, _o = _a.footerIBtn1Type, footerIBtn1Type = _o === void 0 ? 'button' : _o, onClickFooterIBtn1 = _a.onClickFooterIBtn1, _p = _a.footerIBtn2State, footerIBtn2State = _p === void 0 ? 'normal' : _p, footerIBtn2IconName = _a.footerIBtn2IconName, footerIBtn2IconFillType = _a.footerIBtn2IconFillType, _q = _a.footerIBtn2Type, footerIBtn2Type = _q === void 0 ? 'button' : _q, onClickFooterIBtn2 = _a.onClickFooterIBtn2, _r = _a.footerIBtn3State, footerIBtn3State = _r === void 0 ? 'normal' : _r, footerIBtn3IconName = _a.footerIBtn3IconName, footerIBtn3IconFillType = _a.footerIBtn3IconFillType, _s = _a.footerIBtn3Type, footerIBtn3Type = _s === void 0 ? 'button' : _s, footerIBtn3Accept = _a.footerIBtn3Accept, onClickFooterIBtn3 = _a.onClickFooterIBtn3;
54
54
  var methods = (0, react_hook_form_1.useForm)({
55
55
  mode: 'onChange',
@@ -57,7 +57,17 @@ function ChatList(_a) {
57
57
  chat: ''
58
58
  }
59
59
  });
60
- var reset = methods.reset, handleSubmit = methods.handleSubmit, control = methods.control, _t = methods.formState, isSubmitted = _t.isSubmitted, isDirty = _t.isDirty, isValid = _t.isValid;
60
+ var reset = methods.reset, handleSubmit = methods.handleSubmit, control = methods.control, _t = methods.formState, isDirty = _t.isDirty, isValid = _t.isValid, isSubmitSuccessful = _t.isSubmitSuccessful;
61
+ /**
62
+ * @when 폼 submit이 성공적으로 완료 되었을 때
63
+ * @expected 폼을 초기화합니다.
64
+ * @clear -
65
+ */
66
+ (0, react_1.useEffect)(function () {
67
+ if (isSubmitSuccessful) {
68
+ reset();
69
+ }
70
+ }, [isSubmitSuccessful]);
61
71
  var inputValue = (0, react_hook_form_1.useWatch)({ name: 'chat', control: control });
62
72
  var isSubmitButtonActive = (0, react_1.useMemo)(function () {
63
73
  if (!submitIBtnState) {
@@ -71,20 +81,22 @@ function ChatList(_a) {
71
81
  return;
72
82
  }
73
83
  onSubmit(chat);
74
- reset({ chat: '' });
84
+ };
85
+ var callBackAfterScrollToBottom = function () {
86
+ reset();
75
87
  };
76
88
  return (react_1.default.createElement(S_ChatList, { backgroundColor: baseBackgroundColors[styleTheme], id: "chatList" },
77
89
  headerMode === 'use' && (react_1.default.createElement(react_1.default.Fragment, null,
78
90
  react_1.default.createElement(Header_1.default, { styleTheme: styleTheme, titleText: titleText, descText: descText, captionText: captionText, titleStyleTheme: titleStyleTheme, headerDisplayType: headerDisplayType, headerIBtn1IconName: headerIBtn1IconName, headerIBtn1IconFillType: headerIBtn1IconFillType, onClickHeaderIBtn1: onClickHeaderIBtn1 }),
79
91
  react_1.default.createElement(hybrid_1.Divider, null))),
80
- react_1.default.createElement(Body_1.default, { scrollVisibleType: scrollVisibleType, isSubmitted: isSubmitted, bodyMBtnText: bodyMBtnText, bodySpacingMode: bodySpacingMode }, children),
92
+ react_1.default.createElement(Body_1.default, { scrollVisibleType: scrollVisibleType, isSubmitted: isSubmitSuccessful, bodyMBtnText: bodyMBtnText, bodySpacingMode: bodySpacingMode, callBackAfterScrollToBottom: callBackAfterScrollToBottom, ref: ref }, children),
81
93
  react_1.default.createElement(hybrid_1.Divider, null),
82
94
  react_1.default.createElement(hybrid_1.Spacing, { size: "spacing_d" }),
83
95
  react_1.default.createElement(react_hook_form_1.FormProvider, __assign({}, methods),
84
96
  react_1.default.createElement("form", { onSubmit: handleSubmit(handleSubmitChat) },
85
97
  react_1.default.createElement(Footer_1.default, { textFieldDefaultText: textFieldDefaultText, textFieldHintText: textFieldHintText, textFieldState: textFieldState, textFieldMaxLength: textFieldMaxLength, footerChildren: footerChildren, isSubmitBtnActive: isSubmitButtonActive, submitIBtnIconName: submitIBtnIconName, submitIBtnIconFillType: submitIBtnIconFillType, footerIBtn1State: footerIBtn1State, footerIBtn1IconName: footerIBtn1IconName, footerIBtn1IconFillType: footerIBtn1IconFillType, footerIBtn1Type: footerIBtn1Type, onClickFooterIBtn1: onClickFooterIBtn1, footerIBtn2State: footerIBtn2State, footerIBtn2IconName: footerIBtn2IconName, footerIBtn2IconFillType: footerIBtn2IconFillType, footerIBtn2Type: footerIBtn2Type, onClickFooterIBtn2: onClickFooterIBtn2, footerIBtn3State: footerIBtn3State, footerIBtn3IconName: footerIBtn3IconName, footerIBtn3IconFillType: footerIBtn3IconFillType, footerIBtn3Type: footerIBtn3Type, footerIBtn3Accept: footerIBtn3Accept, onClickFooterIBtn3: onClickFooterIBtn3 }))),
86
98
  react_1.default.createElement(hybrid_1.Spacing, { size: "spacing_d" })));
87
- }
99
+ });
88
100
  var S_ChatList = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n display: flex;\n flex-direction: column;\n height: 100%;\n"], ["\n background-color: ", ";\n display: flex;\n flex-direction: column;\n height: 100%;\n"])), function (_a) {
89
101
  var backgroundColor = _a.backgroundColor, theme = _a.theme;
90
102
  return theme[backgroundColor];
@@ -32,11 +32,16 @@ function useAutoScrollToBottom(_a) {
32
32
  (0, react_1.useEffect)(function () {
33
33
  if (scrollRef.current) {
34
34
  scrollRef.current.scrollIntoView({ behavior: behavior });
35
+ // NOTE: 스크롤을 빠르게 하는 중에 scrollIntoView시 스크롤 영역만큼 렌더가 안되는 이슈에 대한 임시조치
36
+ setTimeout(function () {
37
+ var _a;
38
+ (_a = scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: behavior });
39
+ }, 100);
35
40
  }
36
41
  }, [scrollTrigger]);
37
- function triggerScrollToBottom() {
42
+ var triggerScrollToBottom = (0, react_1.useCallback)(function () {
38
43
  setScrollTrigger(function (prev) { return !prev; });
39
- }
44
+ }, []);
40
45
  function EndOfList() {
41
46
  return react_1.default.createElement("li", { style: { listStyle: 'none', height: heightOfEndOfList + "px" }, ref: scrollRef });
42
47
  }
@@ -9,7 +9,7 @@ declare type Props = {
9
9
  hintText?: TFunctionResult;
10
10
  maxHeightItemNumber?: number;
11
11
  defaultValue?: PDSValueOption;
12
- value?: PDSValueOption;
12
+ value?: PDSValueOption | null;
13
13
  responsiveMode?: 'none' | 'use';
14
14
  size?: 'large' | 'small';
15
15
  state?: 'normal' | 'read_only' | 'disabled';
@@ -37,17 +37,32 @@ function Dropdown(_a) {
37
37
  // selectionMode = 'single',
38
38
  size = _e === void 0 ? 'large' : _e, _f = _a.state, state = _f === void 0 ? 'normal' : _f, valueArray = _a.valueArray, customWidth = _a.customWidth, onChange = _a.onChange;
39
39
  var _g = (0, react_1.useState)(false), isFocused = _g[0], setIsFocused = _g[1];
40
- var _h = (0, react_1.useState)(defaultValue), selectedValue = _h[0], setSelectedValue = _h[1];
40
+ var _h = (0, react_1.useState)(null), selectedValue = _h[0], setSelectedValue = _h[1];
41
+ /**
42
+ * @when value 프롭의 값에 따라
43
+ * @expected 값이 null일 때 드롭다운을 초기화하고, 값이 있다면 해당 값으로 설정해줍니다.
44
+ * @clear -
45
+ */
41
46
  (0, react_1.useEffect)(function () {
42
- if (defaultValue) {
43
- setSelectedValue(defaultValue);
47
+ if (value === null) {
48
+ setSelectedValue(null);
49
+ return;
44
50
  }
45
- }, [defaultValue]);
46
- (0, react_1.useEffect)(function () {
47
51
  if (value) {
48
52
  setSelectedValue(value);
49
53
  }
50
54
  }, [value]);
55
+ /**
56
+ * @when defaultValue 프롭에 값이 있을 시
57
+ * @expected Dropdown의 초기값을 설정해줍니다.
58
+ * @clear -
59
+ */
60
+ (0, react_1.useEffect)(function () {
61
+ if (!defaultValue) {
62
+ return;
63
+ }
64
+ setSelectedValue(defaultValue);
65
+ }, [defaultValue]);
51
66
  var handleClick = function () {
52
67
  if (state === 'disabled' || state === 'read_only') {
53
68
  return;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { Props as ChatListProps } from './ChatList';
3
- declare type Props = Pick<ChatListProps, 'scrollVisibleType' | 'children' | 'bodyMBtnText' | 'bodySpacingMode'> & {
3
+ declare const Body: React.ForwardRefExoticComponent<Pick<ChatListProps, "children" | "scrollVisibleType" | "bodyMBtnText" | "bodySpacingMode"> & {
4
4
  isSubmitted: boolean;
5
- };
6
- declare function Body({ scrollVisibleType, children, isSubmitted, bodyMBtnText, bodySpacingMode }: Props): JSX.Element;
5
+ callBackAfterScrollToBottom: () => void;
6
+ } & React.RefAttributes<HTMLDivElement>>;
7
7
  export default Body;
@@ -30,49 +30,53 @@ var react_1 = __importStar(require("react"));
30
30
  var styled_components_1 = __importStar(require("styled-components"));
31
31
  var MainButton_1 = require("../MainButton");
32
32
  var useAutoScrollToBottom_1 = __importDefault(require("./useAutoScrollToBottom"));
33
- var useTimeout_1 = __importDefault(require("./useTimeout"));
34
- function Body(_a) {
35
- var scrollVisibleType = _a.scrollVisibleType, children = _a.children, isSubmitted = _a.isSubmitted, bodyMBtnText = _a.bodyMBtnText, bodySpacingMode = _a.bodySpacingMode;
33
+ var Body = react_1.default.forwardRef(function (_a, ref) {
34
+ var scrollVisibleType = _a.scrollVisibleType, children = _a.children, isSubmitted = _a.isSubmitted, bodyMBtnText = _a.bodyMBtnText, bodySpacingMode = _a.bodySpacingMode, callBackAfterScrollToBottom = _a.callBackAfterScrollToBottom;
36
35
  var _b = (0, react_1.useState)(false), isButtonShow = _b[0], setIsButtonShow = _b[1];
37
36
  var _c = (0, useAutoScrollToBottom_1.default)(), triggerScrollToBottom = _c.triggerScrollToBottom, EndOfList = _c.EndOfList;
38
- var scrollRef = (0, react_1.useRef)(null);
39
- var childrenLength = react_1.default.Children.count(children);
40
- var handleTriggerScroll = function () {
41
- if (isButtonShow) {
42
- if (isSubmitted) {
43
- triggerScrollToBottom();
44
- }
45
- return;
37
+ /**
38
+ * @when 페이지 진입 시
39
+ * @expected 채팅 리스트의 밑으로 스크롤 내린다.
40
+ * @clear -
41
+ */
42
+ (0, react_1.useEffect)(function () {
43
+ if (!isButtonShow) {
44
+ triggerScrollToBottom();
46
45
  }
47
- triggerScrollToBottom();
48
- };
46
+ }, [children, isButtonShow, triggerScrollToBottom]);
49
47
  /**
50
48
  * @when 스크롤을 하고 있지 않은 상황에서 chatMessages가 업데이트 될 때마다
51
49
  * @expected 채팅 리스트의 맨 밑으로 스크롤 내린다.
52
50
  * @clear -
53
51
  */
54
- (0, useTimeout_1.default)({ callback: handleTriggerScroll, target: childrenLength }, 200);
52
+ (0, react_1.useEffect)(function () {
53
+ var handleTriggerScroll = function () {
54
+ if (isSubmitted) {
55
+ callBackAfterScrollToBottom();
56
+ triggerScrollToBottom();
57
+ }
58
+ };
59
+ setTimeout(function () { return handleTriggerScroll(); }, 0);
60
+ }, [children, isButtonShow, isSubmitted, callBackAfterScrollToBottom]);
55
61
  var handleClickMBtn = function () {
56
62
  triggerScrollToBottom();
57
63
  };
58
- var handleScroll = function () {
59
- if (scrollRef.current) {
60
- var _a = scrollRef.current, scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
61
- var BUTTON_SHOW_UP_HEIGHT = 100;
62
- if (Math.ceil(scrollTop) + clientHeight + BUTTON_SHOW_UP_HEIGHT > scrollHeight) {
63
- setIsButtonShow(false);
64
- return;
65
- }
66
- setIsButtonShow(true);
64
+ var handleScroll = function (e) {
65
+ var _a = e.currentTarget, scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
66
+ var BUTTON_SHOW_UP_HEIGHT = 100;
67
+ if (Math.ceil(scrollTop) + clientHeight + BUTTON_SHOW_UP_HEIGHT > scrollHeight) {
68
+ setIsButtonShow(false);
69
+ return;
67
70
  }
71
+ setIsButtonShow(true);
68
72
  };
69
73
  return (react_1.default.createElement(S_Body, { bodySpacingMode: bodySpacingMode },
70
- react_1.default.createElement(S_ChatMessageBox, { onScroll: handleScroll, ref: scrollRef, scrollVisibleType: scrollVisibleType },
74
+ react_1.default.createElement(S_ChatMessageBox, { onScroll: handleScroll, ref: ref, scrollVisibleType: scrollVisibleType },
71
75
  children,
72
76
  react_1.default.createElement(EndOfList, null)),
73
77
  isButtonShow && (react_1.default.createElement(S_BottomButtonWrapper, null,
74
78
  react_1.default.createElement(MainButton_1.MainButton, { text: bodyMBtnText, size: "small", onClick: handleClickMBtn })))));
75
- }
79
+ });
76
80
  var bodySpacing = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n padding-right: ", ";\n padding-left: ", ";\n"], ["\n box-sizing: border-box;\n padding-right: ", ";\n padding-left: ", ";\n"])), function (_a) {
77
81
  var theme = _a.theme;
78
82
  return theme.spacing.spacingE;
@@ -101,4 +105,5 @@ var S_BottomButtonWrapper = styled_components_1.default.div(templateObject_6 ||
101
105
  return theme.spacing.spacingC;
102
106
  });
103
107
  exports.default = Body;
108
+ Body.displayName = 'Body';
104
109
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -41,5 +41,5 @@ export declare type Props = {
41
41
  onSubmit: (value: string) => void;
42
42
  onClickHeaderIBtn1?: () => void;
43
43
  };
44
- declare function ChatList({ styleTheme, headerMode, titleText, descText, captionText, titleStyleTheme, headerDisplayType, headerIBtn1IconName, headerIBtn1IconFillType, children, textFieldState, textFieldHintText, textFieldDefaultText, textFieldMaxLength, scrollVisibleType, footerChildren, submitIBtnState, bodyMBtnText, bodySpacingMode, onSubmit, onClickHeaderIBtn1, submitIBtnIconName, submitIBtnIconFillType, footerIBtn1State, footerIBtn1IconName, footerIBtn1IconFillType, footerIBtn1Type, onClickFooterIBtn1, footerIBtn2State, footerIBtn2IconName, footerIBtn2IconFillType, footerIBtn2Type, onClickFooterIBtn2, footerIBtn3State, footerIBtn3IconName, footerIBtn3IconFillType, footerIBtn3Type, footerIBtn3Accept, onClickFooterIBtn3 }: Props): JSX.Element;
44
+ declare const ChatList: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
45
45
  export default ChatList;
@@ -49,7 +49,7 @@ var baseBackgroundColors = {
49
49
  translucent: 'ui_cpnt_list_base_area_translucent',
50
50
  transparent: 'ui_cpnt_list_base_area_translucent'
51
51
  };
52
- function ChatList(_a) {
52
+ var ChatList = react_1.default.forwardRef(function (_a, ref) {
53
53
  var _b = _a.styleTheme, styleTheme = _b === void 0 ? 'solid' : _b, _c = _a.headerMode, headerMode = _c === void 0 ? 'use' : _c, titleText = _a.titleText, descText = _a.descText, captionText = _a.captionText, _d = _a.titleStyleTheme, titleStyleTheme = _d === void 0 ? 'subTitleBold' : _d, _e = _a.headerDisplayType, headerDisplayType = _e === void 0 ? 'none' : _e, _f = _a.headerIBtn1IconName, headerIBtn1IconName = _f === void 0 ? 'ic_xmark' : _f, _g = _a.headerIBtn1IconFillType, headerIBtn1IconFillType = _g === void 0 ? 'line' : _g, children = _a.children, _h = _a.textFieldState, textFieldState = _h === void 0 ? 'normal' : _h, textFieldHintText = _a.textFieldHintText, textFieldDefaultText = _a.textFieldDefaultText, textFieldMaxLength = _a.textFieldMaxLength, _j = _a.scrollVisibleType, scrollVisibleType = _j === void 0 ? 'moving' : _j, footerChildren = _a.footerChildren, _k = _a.submitIBtnState, submitIBtnState = _k === void 0 ? 'normal' : _k, bodyMBtnText = _a.bodyMBtnText, _l = _a.bodySpacingMode, bodySpacingMode = _l === void 0 ? 'none' : _l, onSubmit = _a.onSubmit, onClickHeaderIBtn1 = _a.onClickHeaderIBtn1, submitIBtnIconName = _a.submitIBtnIconName, submitIBtnIconFillType = _a.submitIBtnIconFillType, _m = _a.footerIBtn1State, footerIBtn1State = _m === void 0 ? 'normal' : _m, footerIBtn1IconName = _a.footerIBtn1IconName, footerIBtn1IconFillType = _a.footerIBtn1IconFillType, _o = _a.footerIBtn1Type, footerIBtn1Type = _o === void 0 ? 'button' : _o, onClickFooterIBtn1 = _a.onClickFooterIBtn1, _p = _a.footerIBtn2State, footerIBtn2State = _p === void 0 ? 'normal' : _p, footerIBtn2IconName = _a.footerIBtn2IconName, footerIBtn2IconFillType = _a.footerIBtn2IconFillType, _q = _a.footerIBtn2Type, footerIBtn2Type = _q === void 0 ? 'button' : _q, onClickFooterIBtn2 = _a.onClickFooterIBtn2, _r = _a.footerIBtn3State, footerIBtn3State = _r === void 0 ? 'normal' : _r, footerIBtn3IconName = _a.footerIBtn3IconName, footerIBtn3IconFillType = _a.footerIBtn3IconFillType, _s = _a.footerIBtn3Type, footerIBtn3Type = _s === void 0 ? 'button' : _s, footerIBtn3Accept = _a.footerIBtn3Accept, onClickFooterIBtn3 = _a.onClickFooterIBtn3;
54
54
  var methods = (0, react_hook_form_1.useForm)({
55
55
  mode: 'onChange',
@@ -57,7 +57,17 @@ function ChatList(_a) {
57
57
  chat: ''
58
58
  }
59
59
  });
60
- var reset = methods.reset, handleSubmit = methods.handleSubmit, control = methods.control, _t = methods.formState, isSubmitted = _t.isSubmitted, isValid = _t.isValid, isDirty = _t.isDirty;
60
+ var reset = methods.reset, handleSubmit = methods.handleSubmit, control = methods.control, _t = methods.formState, isValid = _t.isValid, isDirty = _t.isDirty, isSubmitSuccessful = _t.isSubmitSuccessful;
61
+ /**
62
+ * @when 폼 제출에 성공했을 시
63
+ * @expected 폼을 초기화합니다.
64
+ * @clear -
65
+ */
66
+ (0, react_1.useEffect)(function () {
67
+ if (isSubmitSuccessful) {
68
+ reset();
69
+ }
70
+ }, [isSubmitSuccessful]);
61
71
  var inputValue = (0, react_hook_form_1.useWatch)({ name: 'chat', control: control });
62
72
  var isSubmitButtonActive = (0, react_1.useMemo)(function () {
63
73
  if (!submitIBtnState) {
@@ -71,20 +81,22 @@ function ChatList(_a) {
71
81
  return;
72
82
  }
73
83
  onSubmit(chat);
74
- reset({ chat: '' });
84
+ };
85
+ var callBackAfterScrollToBottom = function () {
86
+ reset();
75
87
  };
76
88
  return (react_1.default.createElement(S_ChatList, { backgroundColor: baseBackgroundColors[styleTheme], id: "chatList" },
77
89
  headerMode === 'use' && (react_1.default.createElement(react_1.default.Fragment, null,
78
90
  react_1.default.createElement(Header_1.default, { styleTheme: styleTheme, titleText: titleText, descText: descText, captionText: captionText, titleStyleTheme: titleStyleTheme, headerDisplayType: headerDisplayType, headerIBtn1IconName: headerIBtn1IconName, headerIBtn1IconFillType: headerIBtn1IconFillType, onClickHeaderIBtn1: onClickHeaderIBtn1 }),
79
91
  react_1.default.createElement(hybrid_1.Divider, null))),
80
- react_1.default.createElement(Body_1.default, { scrollVisibleType: scrollVisibleType, isSubmitted: isSubmitted, bodyMBtnText: bodyMBtnText, bodySpacingMode: bodySpacingMode }, children),
92
+ react_1.default.createElement(Body_1.default, { scrollVisibleType: scrollVisibleType, isSubmitted: isSubmitSuccessful, bodyMBtnText: bodyMBtnText, bodySpacingMode: bodySpacingMode, callBackAfterScrollToBottom: callBackAfterScrollToBottom, ref: ref }, children),
81
93
  react_1.default.createElement(hybrid_1.Divider, null),
82
94
  react_1.default.createElement(hybrid_1.Spacing, { size: "spacing_d" }),
83
95
  react_1.default.createElement(react_hook_form_1.FormProvider, __assign({}, methods),
84
96
  react_1.default.createElement("form", { onSubmit: handleSubmit(handleSubmitChat) },
85
97
  react_1.default.createElement(Footer_1.default, { textFieldDefaultText: textFieldDefaultText, textFieldHintText: textFieldHintText, textFieldState: textFieldState, textFieldMaxLength: textFieldMaxLength, footerChildren: footerChildren, isSubmitBtnActive: isSubmitButtonActive, submitIBtnIconName: submitIBtnIconName, submitIBtnIconFillType: submitIBtnIconFillType, footerIBtn1State: footerIBtn1State, footerIBtn1IconName: footerIBtn1IconName, footerIBtn1IconFillType: footerIBtn1IconFillType, footerIBtn1Type: footerIBtn1Type, onClickFooterIBtn1: onClickFooterIBtn1, footerIBtn2State: footerIBtn2State, footerIBtn2IconName: footerIBtn2IconName, footerIBtn2IconFillType: footerIBtn2IconFillType, footerIBtn2Type: footerIBtn2Type, onClickFooterIBtn2: onClickFooterIBtn2, footerIBtn3State: footerIBtn3State, footerIBtn3IconName: footerIBtn3IconName, footerIBtn3IconFillType: footerIBtn3IconFillType, footerIBtn3Type: footerIBtn3Type, footerIBtn3Accept: footerIBtn3Accept, onClickFooterIBtn3: onClickFooterIBtn3 }))),
86
98
  react_1.default.createElement(hybrid_1.Spacing, { size: "spacing_d" })));
87
- }
99
+ });
88
100
  var S_ChatList = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n display: flex;\n flex-direction: column;\n height: 100%;\n"], ["\n background-color: ", ";\n display: flex;\n flex-direction: column;\n height: 100%;\n"])), function (_a) {
89
101
  var backgroundColor = _a.backgroundColor, theme = _a.theme;
90
102
  return theme[backgroundColor];
@@ -32,11 +32,16 @@ function useAutoScrollToBottom(_a) {
32
32
  (0, react_1.useEffect)(function () {
33
33
  if (scrollRef.current) {
34
34
  scrollRef.current.scrollIntoView({ behavior: behavior });
35
+ // NOTE: 스크롤을 빠르게 하는 중에 scrollIntoView시 스크롤 영역만큼 렌더가 안되는 이슈에 대한 임시조치
36
+ setTimeout(function () {
37
+ var _a;
38
+ (_a = scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: behavior });
39
+ }, 100);
35
40
  }
36
41
  }, [scrollTrigger]);
37
- function triggerScrollToBottom() {
42
+ var triggerScrollToBottom = (0, react_1.useCallback)(function () {
38
43
  setScrollTrigger(function (prev) { return !prev; });
39
- }
44
+ }, []);
40
45
  function EndOfList() {
41
46
  return react_1.default.createElement("li", { style: { listStyle: 'none', height: heightOfEndOfList + "px" }, ref: scrollRef });
42
47
  }
@@ -7,7 +7,7 @@ declare type DropDownValues = PDSValueOption & {
7
7
  declare type Props = {
8
8
  colorTheme?: 'none' | 'dark' | 'white';
9
9
  defaultValue?: PDSValueOption;
10
- value?: PDSValueOption;
10
+ value?: PDSValueOption | null;
11
11
  hintText?: TFunctionResult;
12
12
  maxHeightItemNumber?: number;
13
13
  responsiveMode?: 'none' | 'use';
@@ -37,17 +37,32 @@ function Dropdown(_a) {
37
37
  // selectionMode = 'single',
38
38
  size = _e === void 0 ? 'large' : _e, _f = _a.state, state = _f === void 0 ? 'normal' : _f, valueArray = _a.valueArray, customWidth = _a.customWidth, onChange = _a.onChange;
39
39
  var _g = (0, react_1.useState)(false), isFocused = _g[0], setIsFocused = _g[1];
40
- var _h = (0, react_1.useState)(defaultValue), selectedValue = _h[0], setSelectedValue = _h[1];
40
+ var _h = (0, react_1.useState)(null), selectedValue = _h[0], setSelectedValue = _h[1];
41
+ /**
42
+ * @when value 프롭의 값에 따라
43
+ * @expected 값이 null일 때 드롭다운을 초기화하고, 값이 있다면 해당 값으로 설정해줍니다.
44
+ * @clear -
45
+ */
41
46
  (0, react_1.useEffect)(function () {
42
- if (defaultValue) {
43
- setSelectedValue(defaultValue);
47
+ if (value === null) {
48
+ setSelectedValue(null);
49
+ return;
44
50
  }
45
- }, [defaultValue]);
46
- (0, react_1.useEffect)(function () {
47
51
  if (value) {
48
52
  setSelectedValue(value);
49
53
  }
50
54
  }, [value]);
55
+ /**
56
+ * @when defaultValue 프롭에 값이 있을 시
57
+ * @expected Dropdown의 초기값을 설정해줍니다.
58
+ * @clear -
59
+ */
60
+ (0, react_1.useEffect)(function () {
61
+ if (!defaultValue) {
62
+ return;
63
+ }
64
+ setSelectedValue(defaultValue);
65
+ }, [defaultValue]);
51
66
  var handleClick = function () {
52
67
  if (state === 'disabled' || state === 'read_only') {
53
68
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web",
3
- "version": "1.4.43",
3
+ "version": "1.4.44",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
package/release-note.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # PDS-DEV-KIT-WEB Release Notes
2
- ## [v1.4.43]
2
+ ## [v1.4.44]
3
3
 
4
4
  ### Component
5
- * BasicChatListItem
6
- * safari에서 우측 더보기 버튼이 간혈적으로 보이지 않는 이슈 해결
7
- * ChatBubbleListItem
8
- * safari에서 우측 더보기 버튼이 간혈적으로 보이지 않는 이슈 해결
9
- * UserDesktopNavBar
10
- * loginInfoMode가 profile일때 마우스 커서가 변하지 않는 이슈 해결
5
+ * ChatList
6
+ * body부분의 스크롤 이슈 수정
7
+ * Dropdown
8
+ * value를 null로 설정할 dropdown을 초기화하는 로직을 useEffect 내부에 추가
@@ -1,6 +0,0 @@
1
- declare type Props = {
2
- callback: () => void;
3
- target: unknown;
4
- };
5
- declare function useTimeout({ callback, target }: Props, delay: number): void;
6
- export default useTimeout;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- function useTimeout(_a, delay) {
5
- var callback = _a.callback, target = _a.target;
6
- (0, react_1.useEffect)(function () {
7
- var timeout = setTimeout(function () { return callback(); }, delay);
8
- return function () { return clearTimeout(timeout); };
9
- }, [target]);
10
- }
11
- exports.default = useTimeout;