sales-frontend-components 0.0.73 → 0.0.75

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/index.d.ts CHANGED
@@ -247,13 +247,6 @@ interface JobSearchModalProps {
247
247
  }
248
248
  declare const JobSearchModal: React__default.FC<JobSearchModalProps>;
249
249
 
250
- interface Customer {
251
- id: string;
252
- name: string;
253
- birthdate: string;
254
- gender: '남성' | '여성';
255
- address?: string;
256
- }
257
250
  interface DspResponseCustomerListResponseDto {
258
251
  /** @description 성공여부 */
259
252
  isSuccess?: boolean;
@@ -285,11 +278,11 @@ interface CustomerDto {
285
278
  /** @description 성별코드 */
286
279
  genderCode?: string;
287
280
  }
288
-
289
281
  interface CustomerSearchProps {
290
282
  onSelect?: (customer: CustomerDto) => void;
291
283
  }
284
+
292
285
  declare const CustomerSearch: ({ onSelect }: CustomerSearchProps) => react_jsx_runtime.JSX.Element;
293
286
 
294
287
  export { Attachment, BankStockSearchModal, CustomerSearch, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobSearchModal, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useJobVehicleSearchModal, useSearchAddress };
295
- export type { AttachedPhoto, AttachmentProps, BankStockItem, BankStockSearchModalProps, Customer, CustomerDto, CustomerListResponseDto, DownloadProps, DspResponseCustomerListResponseDto, PaintProps, Pen, StepIndicatorProps, StepItem, cameraItemType, cameraOptions };
288
+ export type { AttachedPhoto, AttachmentProps, BankStockItem, BankStockSearchModalProps, CustomerDto, CustomerListResponseDto, CustomerSearchProps, DownloadProps, DspResponseCustomerListResponseDto, PaintProps, Pen, StepIndicatorProps, StepItem, cameraItemType, cameraOptions };
package/dist/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import { useController } from 'react-hook-form';
3
- import { CheckboxButton, Checkbox, DatePicker, DateRangePicker, Accordion, Radio, Table, Button, FormField, Select, Tab, useModalState, Modal, SegmentGroup, ModalUtils, Icon, FormCore, RadioGroup, useDropDown, List, ListItem } from 'sales-frontend-design-system';
3
+ import { CheckboxButton, Checkbox, DatePicker, DateRangePicker, Accordion, Radio, Table, Button, FormField, Select, Tab, useModalState, Modal, SegmentGroup, ModalUtils, FormCore, RadioGroup, useDropDown, List, ListItem } from 'sales-frontend-design-system';
4
4
  import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
5
5
  import { useSearchOccupationQuery, useSearchModalAddressQuery, useSearchVehicleQuery } from 'sales-frontend-api/method';
6
- import { IconMainUiSearch, IconGraphicsBankHsbc, IconGraphicsBankKebHana, IconGraphicsBankScJeil, IconGraphicsBankGyeongnam, IconGraphicsBankGwangju, IconGraphicsBankKukmin, IconGraphicsBankKiup, IconGraphicsBankJiyeokNonghyeop, IconGraphicsBankNhNonghyeop, IconGraphicsBankDaegu, IconGraphicsBankBusan, IconGraphicsBankSanlim, IconGraphicsBankSaneop, IconGraphicsBankSaemaulGeumgo, IconGraphicsBankSuhyeop, IconGraphicsBankSinhan, IconGraphicsBankSinhyeop, IconGraphicsBankOehwan, IconGraphicsBankWoori, IconGraphicsBankPost, IconGraphicsBankJeochuk, IconGraphicsBankJeonbuk, IconGraphicsBankJeju, IconGraphicsBankKakaoBank, IconGraphicsBankKBank, IconGraphicsBankHankookCity, IconGraphicsStockDbGeumyungTujajeungkwon, IconGraphicsStockKbJeungkwon, IconGraphicsStockNhWooriTujajeungkwon, IconGraphicsStockNhTujajeungkwon, IconGraphicsStockSkJeungkwon, IconGraphicsStockGyoboJeungkwon, IconGraphicsStockDaesinJeungkwon, IconGraphicsStockMeritzJeungkwon, IconGraphicsStockMiraeAssetJeungkwon, IconGraphicsStockBugukJeungkwon, IconGraphicsStockSamsungJeungkwon, IconGraphicsStockSinyeongJeungkwon, IconGraphicsStockSinhanTujajeungkwon, IconGraphicsStockYuantaJeungkwon, IconGraphicsStockYujinTujajeungkwon, IconGraphicsStockKiwoomJeungkwon, IconGraphicsStockHanaGeumyungTujajeungkwon, IconGraphicsStockHiTujajeungkwon, IconGraphicsStockHankookJeungkwonGeumyung, IconGraphicsStockHankookTujajeungkwon, IconGraphicsStockHanwhaTujajeungkwon, IconGraphicsStockHyundaiChaJeungkwon, IconGraphicsStockHochulEopsum, IconIllustGrade, IconIllustJob, IconSubUiArrowRight, IconIllustVehicle } from 'sales-frontend-assets';
6
+ import { IconMainUiSearch, IconIllustCamera, IconGraphicsBankHsbc, IconGraphicsBankKebHana, IconGraphicsBankScJeil, IconGraphicsBankGyeongnam, IconGraphicsBankGwangju, IconGraphicsBankKukmin, IconGraphicsBankKiup, IconGraphicsBankJiyeokNonghyeop, IconGraphicsBankNhNonghyeop, IconGraphicsBankDaegu, IconGraphicsBankBusan, IconGraphicsBankSanlim, IconGraphicsBankSaneop, IconGraphicsBankSaemaulGeumgo, IconGraphicsBankSuhyeop, IconGraphicsBankSinhan, IconGraphicsBankSinhyeop, IconGraphicsBankOehwan, IconGraphicsBankWoori, IconGraphicsBankPost, IconGraphicsBankJeochuk, IconGraphicsBankJeonbuk, IconGraphicsBankJeju, IconGraphicsBankKakaoBank, IconGraphicsBankKBank, IconGraphicsBankHankookCity, IconGraphicsStockDbGeumyungTujajeungkwon, IconGraphicsStockKbJeungkwon, IconGraphicsStockNhWooriTujajeungkwon, IconGraphicsStockNhTujajeungkwon, IconGraphicsStockSkJeungkwon, IconGraphicsStockGyoboJeungkwon, IconGraphicsStockDaesinJeungkwon, IconGraphicsStockMeritzJeungkwon, IconGraphicsStockMiraeAssetJeungkwon, IconGraphicsStockBugukJeungkwon, IconGraphicsStockSamsungJeungkwon, IconGraphicsStockSinyeongJeungkwon, IconGraphicsStockSinhanTujajeungkwon, IconGraphicsStockYuantaJeungkwon, IconGraphicsStockYujinTujajeungkwon, IconGraphicsStockKiwoomJeungkwon, IconGraphicsStockHanaGeumyungTujajeungkwon, IconGraphicsStockHiTujajeungkwon, IconGraphicsStockHankookJeungkwonGeumyung, IconGraphicsStockHankookTujajeungkwon, IconGraphicsStockHanwhaTujajeungkwon, IconGraphicsStockHyundaiChaJeungkwon, IconGraphicsStockHochulEopsum, IconIllustGrade, IconIllustJob, IconSubUiArrowRight, IconIllustVehicle } from 'sales-frontend-assets';
7
7
  import styles from './modal/pre-standard/job-search-modal/job-search-modal.module.scss';
8
8
  import styles$1 from './step-indicator/step-indicator.module.scss';
9
9
  import styles$2 from './camera/camera.module.scss';
@@ -57,12 +57,17 @@ const FormDatePicker = ({
57
57
  ...props
58
58
  }) => {
59
59
  const { field, fieldState } = useController({ name, control, disabled, defaultValue });
60
- const [initialDate, setInitialDate] = React.useState();
60
+ const [selected, setSelected] = React.useState();
61
61
  React.useEffect(() => {
62
62
  if (field.value) {
63
- setInitialDate(field.value);
63
+ setSelected(field.value);
64
64
  }
65
65
  }, [defaultValue]);
66
+ React.useEffect(() => {
67
+ if (field.value !== selected) {
68
+ setSelected(field.value);
69
+ }
70
+ }, [field.value]);
66
71
  return /* @__PURE__ */ jsx(
67
72
  DatePicker,
68
73
  {
@@ -71,7 +76,7 @@ const FormDatePicker = ({
71
76
  ...props,
72
77
  ...field,
73
78
  id: field.name,
74
- defaultValue: initialDate,
79
+ defaultValue: selected,
75
80
  error: fieldState.invalid,
76
81
  onValueChange: field.onChange
77
82
  }
@@ -87,12 +92,18 @@ const FormDateRangePicker = ({
87
92
  ...props
88
93
  }) => {
89
94
  const { field, fieldState } = useController({ name, control, disabled, defaultValue });
90
- const [initialDate, setInitialDate] = React.useState();
95
+ const [selected, setSelected] = React.useState();
91
96
  React.useEffect(() => {
92
97
  if (field.value) {
93
- setInitialDate(field.value);
98
+ setSelected(field.value);
94
99
  }
95
100
  }, [defaultValue]);
101
+ React.useEffect(() => {
102
+ if (selected && field.value.startDate.getTime() === selected.startDate?.getTime() && field.value.endDate.getTime() === selected.endDate?.getTime()) {
103
+ return;
104
+ }
105
+ setSelected(field.value);
106
+ }, [field.value]);
96
107
  return /* @__PURE__ */ jsx(
97
108
  DateRangePicker,
98
109
  {
@@ -101,13 +112,9 @@ const FormDateRangePicker = ({
101
112
  ...props,
102
113
  ...field,
103
114
  id: field.name,
104
- defaultValue: initialDate,
115
+ defaultValue: selected,
105
116
  error: fieldState.invalid,
106
- onValueChange: (selected) => {
107
- if (field.value !== selected) {
108
- field.onChange(selected);
109
- }
110
- }
117
+ onValueChange: field.onChange
111
118
  }
112
119
  }
113
120
  );
@@ -885,7 +892,7 @@ function Attachment({
885
892
  const renderPhotoSingle = () => {
886
893
  if (photos.length === 0) {
887
894
  return /* @__PURE__ */ jsx("div", { className: cx$5("single-photo-item", "add-photo-item"), children: /* @__PURE__ */ jsxs("button", { className: cx$5("add-photo-button-single"), onClick: handleAddPhoto, children: [
888
- /* @__PURE__ */ jsx(Icon, { name: "illust/camera" }),
895
+ /* @__PURE__ */ jsx(IconIllustCamera, {}),
889
896
  /* @__PURE__ */ jsx("span", { children: buttonText || "\uC0AC\uC9C4 \uCCA8\uBD80\uD558\uAE30" })
890
897
  ] }) });
891
898
  }
@@ -900,7 +907,7 @@ function Attachment({
900
907
  if (photos.length < maxPhotos) {
901
908
  gridItems.push(
902
909
  /* @__PURE__ */ jsx("div", { className: cx$5("photo-item", "add-photo-item"), children: /* @__PURE__ */ jsxs("button", { className: cx$5("add-photo-button"), onClick: handleAddPhoto, children: [
903
- /* @__PURE__ */ jsx(Icon, { name: "illust/camera" }),
910
+ /* @__PURE__ */ jsx(IconIllustCamera, {}),
904
911
  /* @__PURE__ */ jsx("span", { children: buttonText || "\uCCA8\uBD80\uD558\uAE30" }),
905
912
  /* @__PURE__ */ jsxs("span", { className: cx$5("photo-count"), children: [
906
913
  "(",
@@ -2030,7 +2037,11 @@ const useCustomerSearch = (onSelect) => {
2030
2037
  search,
2031
2038
  onClear,
2032
2039
  handleSelectItem,
2033
- selectedCustomer
2040
+ selectedCustomer,
2041
+ setSearchInput,
2042
+ setCustomerList,
2043
+ setSearchKeyword,
2044
+ setIsOpen
2034
2045
  };
2035
2046
  };
2036
2047
 
@@ -2078,7 +2089,7 @@ const CustomerSearch = ({ onSelect }) => {
2078
2089
  ref: triggerRef
2079
2090
  }
2080
2091
  ) }) }),
2081
- isOpen && /* @__PURE__ */ jsx(DropDown, { children: /* @__PURE__ */ jsx("div", { className: cx("result-container"), children: customerList.length > 0 && /* @__PURE__ */ jsx(List, { rootProps: { style: { width: "100%" } }, children: customerList.map((customer) => /* @__PURE__ */ jsx(ListItem, { onClick: () => handleSelectItem(customer), selectable: true, children: /* @__PURE__ */ jsxs("div", { className: cx("customer-item"), children: [
2092
+ isOpen && customerList.length > 0 && /* @__PURE__ */ jsx(DropDown, { children: /* @__PURE__ */ jsx("div", { className: cx("result-container"), children: /* @__PURE__ */ jsx(List, { children: customerList.map((customer) => /* @__PURE__ */ jsx(ListItem, { onClick: () => handleSelectItem(customer), selectable: true, children: /* @__PURE__ */ jsxs("div", { className: cx("customer-item"), children: [
2082
2093
  /* @__PURE__ */ jsx("div", { className: cx("name"), children: highlightOnSearchKeyword(customer.customerName || "", searchKeyword) }),
2083
2094
  /* @__PURE__ */ jsxs("div", { className: cx("details"), children: [
2084
2095
  /* @__PURE__ */ jsx("span", { children: customer.birthDate }),