@uniai-fe/uds-templates 0.3.0 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/uds-templates",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -45,7 +45,8 @@
45
45
  "module:typecheck": "pnpm typecheck",
46
46
  "module:build": "pnpm build",
47
47
  "design-templates:build": "pnpm run build",
48
- "design-templates:dev": "pnpm run dev"
48
+ "design-templates:dev": "pnpm run dev",
49
+ "publish:public": "bash ../../../scripts/npm-publish.sh"
49
50
  },
50
51
  "peerDependencies": {
51
52
  "@tanstack/react-query": "^5",
@@ -7,7 +7,7 @@ import {
7
7
  } from "./common/container";
8
8
  import AuthCompleteTemplate from "./common/complete/Template";
9
9
  import { AuthCodeTemplate } from "./common/auth-code";
10
- import { AuthLogin } from "./login";
10
+ import { AuthLogin } from "./login/markup";
11
11
  import { AuthSignup } from "./signup";
12
12
  import { FindAccount } from "./find-account";
13
13
  import { FindId } from "./find-id";
@@ -44,6 +44,7 @@ export * from "./find-id";
44
44
  export * from "./find-password";
45
45
  export { default as AuthCompleteTemplate } from "./common/complete/Template";
46
46
 
47
+ export * from "./login";
47
48
  export type * from "./login";
48
49
  export type * from "./signup";
49
50
  export type * from "./find-account";
@@ -2,11 +2,4 @@ import "./index.scss";
2
2
 
3
3
  export type * from "./types";
4
4
  export * from "./hooks";
5
-
6
- import AuthLoginContainer from "./markup/Container";
7
- import AuthLoginFormField from "./markup/FormField";
8
-
9
- export const AuthLogin = {
10
- Container: AuthLoginContainer,
11
- FormField: AuthLoginFormField,
12
- };
5
+ export * from "./jotai";
@@ -0,0 +1 @@
1
+ export * from "./user";
@@ -1,6 +1,6 @@
1
1
  import { jotaiStorage } from "@uniai-fe/util-jotai";
2
2
  import { atomWithStorage } from "jotai/utils";
3
- import type { API_Res_LoginData } from "../types";
3
+ import type { API_Res_LoginData, API_Res_LoginUserFarm } from "../types";
4
4
 
5
5
  /**
6
6
  * 로그인 사용자 정보 세션스토리지로 관리
@@ -11,3 +11,50 @@ export const userDataAtom = atomWithStorage<API_Res_LoginData | null>(
11
11
  null,
12
12
  jotaiStorage.session<API_Res_LoginData | null>(),
13
13
  );
14
+
15
+ /**
16
+ * 로그인 사용자의 계정 아이디
17
+ * @state
18
+ */
19
+ export const userAccountNameAtom = atomWithStorage<string>(
20
+ "userAccountName",
21
+ "",
22
+ jotaiStorage.session<string>(),
23
+ );
24
+
25
+ /**
26
+ * 로그인 사용자 이름
27
+ * @state
28
+ */
29
+ export const userOwnerNameAtom = atomWithStorage<string>(
30
+ "userOwnerName",
31
+ "",
32
+ jotaiStorage.session<string>(),
33
+ );
34
+
35
+ /**
36
+ * 로그인 사용자 접근가능한 농장 목록
37
+ */
38
+ export const userFarmListAtom = atomWithStorage<API_Res_LoginUserFarm[]>(
39
+ "userFarmList",
40
+ [],
41
+ jotaiStorage.session<API_Res_LoginUserFarm[]>(),
42
+ );
43
+
44
+ /**
45
+ * 현재 선택된 로그인 사용자 농장 정보
46
+ */
47
+ export const userFarmAtom = atomWithStorage<API_Res_LoginUserFarm | null>(
48
+ "userFarm",
49
+ null,
50
+ jotaiStorage.session<API_Res_LoginUserFarm | null>(),
51
+ );
52
+
53
+ /**
54
+ * 로그인 사용자 농장 id 코드
55
+ */
56
+ export const farmIdAtom = atomWithStorage<number>(
57
+ "farmId",
58
+ -1,
59
+ jotaiStorage.session<number>(),
60
+ );
@@ -0,0 +1,7 @@
1
+ import AuthLoginContainer from "./Container";
2
+ import AuthLoginFormField from "./FormField";
3
+
4
+ export const AuthLogin = {
5
+ Container: AuthLoginContainer,
6
+ FormField: AuthLoginFormField,
7
+ };
@@ -17,6 +17,36 @@ export interface API_Req_Login {
17
17
  password: string;
18
18
  }
19
19
 
20
+ /**
21
+ * 로그인 API; 응답 - 농장목록 정보
22
+ * @route /auth/user/login
23
+ * @property {number} id farm_id (농장 id)
24
+ * @property {string} name 농장명
25
+ * @property {string} farm_code 농장 식별번호
26
+ * @property {string} user_access_role 계정 권한/직책 코드 (OWNER: 농장주, EMPLOYEE: 농장직원, REGIONAL_MANAGER: 지역소장)
27
+ */
28
+ export interface API_Res_LoginUserFarm {
29
+ /**
30
+ * farm_id (농장 id)
31
+ */
32
+ id: number;
33
+ /**
34
+ * 농장명
35
+ */
36
+ name: string;
37
+ /**
38
+ * farm_code (농장 식별번호)
39
+ */
40
+ farm_code: string;
41
+ /**
42
+ * 계정 권한/직책 코드
43
+ * - OWNER: 농장주
44
+ * - EMPLOYEE: 농장직원
45
+ * - REGIONAL_MANAGER: 지역소장
46
+ */
47
+ user_access_role: string;
48
+ }
49
+
20
50
  /**
21
51
  * 로그인 API; 응답 - 유저 정보
22
52
  * @route /auth/user/login
@@ -26,11 +56,13 @@ export interface API_Req_Login {
26
56
  * @property {string} email 사용자 이메일
27
57
  * @property {string} full_name 사용자 이름
28
58
  * @property {number} gender 사용자 성별 (0: 남, 1: 여)
29
- * @property {string} birth_date 사용자 생년월일 (yyyy-MM-dd)
30
59
  * @property {number | string} phone_number 사용자 전화번호
60
+ * @property {string} birth_date 사용자 생년월일 (yyyy-MM-dd)
61
+ * @property {string} address 사용자 주소
62
+ * @property {API_Res_LoginUserFarm[]} user_farms 사용자가 접근 권한을 가진 농장 목록
31
63
  * @property {string} joined_at 가입일 (UTC; yyyy-MM-ddTHH:mm:ss)
32
64
  * @property {string | null} closed_at 사용자 탈퇴일 (UTC; yyyy-MM-ddTHH:mm:ss)
33
- * @property {number} status 가입 승인여부; 0: 승인, 1: 미승인
65
+ * @property {number} status 가입 승인여부; 0: 대기, 1: 승인, 2: 거절
34
66
  * @property {number} [use_sms] SMS 수신 여부; 0: 수신 안함, 1: 수신
35
67
  * @property {number} [user_type] 사용자 유형; 0: 일반 사용자, ..., 99: 관리자
36
68
  */
@@ -77,12 +109,13 @@ export interface API_Res_LoginUserInfo {
77
109
  */
78
110
  address: string;
79
111
  /**
80
- * 계정 권한/직책 코드
81
- * - OWNER: 농장주
82
- * - EMPLOYEE: 농장직원
83
- * - REGIONAL_MANAGER: 지역소장
112
+ * 사용자가 접근 권한을 가진 농장 목록
113
+ * @property {number} id farm_id (농장 id)
114
+ * @property {string} name 농장명
115
+ * @property {string} farm_code 농장 식별번호
116
+ * @property {string} user_access_role 계정 권한/직책 코드 (OWNER: 농장주, EMPLOYEE: 농장직원, REGIONAL_MANAGER: 지역소장)
84
117
  */
85
- user_access_role: string;
118
+ user_farms: API_Res_LoginUserFarm[];
86
119
  /**
87
120
  * 가입일 (UTC)
88
121
  * - yyyy-MM-ddTHH:mm:ss
@@ -95,8 +128,9 @@ export interface API_Res_LoginUserInfo {
95
128
  closed_at: string | null;
96
129
  /**
97
130
  * 가입 승인여부
98
- * - 0: 승인
99
- * - 1: 미승인
131
+ * - 0: 대기
132
+ * - 1: 승인
133
+ * - 2: 거절
100
134
  */
101
135
  status: number;
102
136
  /**
@@ -6,7 +6,10 @@ import { usePathname } from "next/navigation";
6
6
  import assetUrl from "../../../../../../asset-url";
7
7
  import clsx from "clsx";
8
8
  import { Dropdown } from "@uniai-fe/uds-primitives";
9
- import type { DropdownTemplateItem } from "@uniai-fe/uds-primitives";
9
+ import type {
10
+ DropdownTemplateChangePayload,
11
+ DropdownTemplateItem,
12
+ } from "@uniai-fe/uds-primitives";
10
13
  import { getClosestRoute } from "@uniai-fe/util-functions";
11
14
 
12
15
  import PageHeaderUtilityItem from "../Item";
@@ -61,11 +64,13 @@ export default function PageHeaderSettingButton({
61
64
 
62
65
  /**
63
66
  * dropdown 항목을 선택했을 때 routeKey에 대응하는 onSelect를 실행한다.
64
- * @param {DropdownTemplateItem} dropdownItem 선택된 dropdown 항목
67
+ * @param {DropdownTemplateChangePayload} payload 선택 결과 payload
65
68
  */
66
69
  const handleSelect = useCallback(
67
- (dropdownItem: DropdownTemplateItem) => {
68
- const target = menuItems.find(item => item.routeKey === dropdownItem.id);
70
+ (payload: DropdownTemplateChangePayload) => {
71
+ const target = menuItems.find(
72
+ item => item.routeKey === payload.currentItem.id,
73
+ );
69
74
  target?.onSelect?.();
70
75
  },
71
76
  [menuItems],
@@ -94,7 +99,8 @@ export default function PageHeaderSettingButton({
94
99
  width={170}
95
100
  size="small"
96
101
  selectedIds={selectedIds}
97
- onSelect={handleSelect}
102
+ // Dropdown.Template 신규 계약(onChange payload)을 우선 사용한다.
103
+ onChange={handleSelect}
98
104
  containerProps={{
99
105
  align: "end",
100
106
  sideOffset: 8,