@bwg-ui/core 1.1.23 → 1.1.25
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/chunks/AuthContext-CXng9fj0.cjs.map +1 -1
- package/dist/chunks/{AuthContext-Ei2P-z4d.js → AuthContext-DrEpBrpB.js} +7 -3
- package/dist/chunks/AuthContext-DrEpBrpB.js.map +1 -0
- package/dist/chunks/{BwgSwitch-CAI-kEaM.cjs → BwgSwitch-DOlc57wi.cjs} +2 -2
- package/dist/chunks/BwgSwitch-DOlc57wi.cjs.map +1 -0
- package/dist/chunks/{BwgSwitch-B79pseQM.js → BwgSwitch-D_scwi9_.js} +18 -18
- package/dist/chunks/BwgSwitch-D_scwi9_.js.map +1 -0
- package/dist/chunks/{BwgUploader-DaNV2URT.cjs → BwgUploader-CkXwkcUL.cjs} +2 -2
- package/dist/chunks/BwgUploader-CkXwkcUL.cjs.map +1 -0
- package/dist/chunks/{BwgUploader-BcVlE61B.js → BwgUploader-DBFF9BPF.js} +327 -327
- package/dist/chunks/BwgUploader-DBFF9BPF.js.map +1 -0
- package/dist/chunks/LoadingOverlay-DAZJF5wg.js.map +1 -1
- package/dist/chunks/LoadingOverlay-DcmKvoZA.cjs.map +1 -1
- package/dist/chunks/{SSOHandler-DiW4Ft9i.cjs → SSOHandler-BY6LXMLc.cjs} +32 -32
- package/dist/chunks/SSOHandler-BY6LXMLc.cjs.map +1 -0
- package/dist/chunks/{SSOHandler-CkPcSHIm.js → SSOHandler-CxvxEBaH.js} +1977 -1930
- package/dist/chunks/SSOHandler-CxvxEBaH.js.map +1 -0
- package/dist/chunks/ScreenProtectContext-3my4PHFa.js.map +1 -1
- package/dist/chunks/ScreenProtectContext-CVuXrJm6.cjs.map +1 -1
- package/dist/chunks/SearchBoxContext-DwFDOyYG.cjs.map +1 -1
- package/dist/chunks/{SearchBoxContext-BCvEYyFk.js → SearchBoxContext-gWM7FHIw.js} +3 -5
- package/dist/chunks/SearchBoxContext-gWM7FHIw.js.map +1 -0
- package/dist/chunks/ViewContainer-Bhq22_B3.cjs.map +1 -1
- package/dist/chunks/{ViewContainer-CjpJqoGG.js → ViewContainer-D9SKBnrn.js} +40 -28
- package/dist/chunks/ViewContainer-D9SKBnrn.js.map +1 -0
- package/dist/chunks/apiUtils-BZ6s0_NI.cjs.map +1 -1
- package/dist/chunks/{apiUtils-DxzLqPhU.js → apiUtils-DSwE62oG.js} +14 -5
- package/dist/chunks/apiUtils-DSwE62oG.js.map +1 -0
- package/dist/chunks/{codeStore-CfI4Wh5M.js → codeStore-vPj4Y0TK.js} +2 -2
- package/dist/chunks/{codeStore-CfI4Wh5M.js.map → codeStore-vPj4Y0TK.js.map} +1 -1
- package/dist/chunks/{core-bHd8azE6.js → core-Dl0PdDdT.js} +2 -2
- package/dist/chunks/{core-bHd8azE6.js.map → core-Dl0PdDdT.js.map} +1 -1
- package/dist/chunks/{enc-base64-BQYwLKgk.js → enc-base64-D7t4BoUA.js} +3 -3
- package/dist/chunks/{enc-base64-BQYwLKgk.js.map → enc-base64-D7t4BoUA.js.map} +1 -1
- package/dist/chunks/{favoriteStore-Cemc-26t.js → favoriteStore-Bh1FuZm9.js} +2 -2
- package/dist/chunks/{favoriteStore-Cemc-26t.js.map → favoriteStore-Bh1FuZm9.js.map} +1 -1
- package/dist/chunks/{popupStore-Bi6o78lP.js → popupStore-BRRmB4zH.js} +2 -2
- package/dist/chunks/{popupStore-Bi6o78lP.js.map → popupStore-BRRmB4zH.js.map} +1 -1
- package/dist/chunks/{sha256-BZfJs28k.js → sha256-C2-s1oZe.js} +3 -3
- package/dist/chunks/{sha256-BZfJs28k.js.map → sha256-C2-s1oZe.js.map} +1 -1
- package/dist/chunks/usePopup-D2JEuDrO.cjs.map +1 -1
- package/dist/chunks/{usePopup-BSqsnSz7.js → usePopup-DarKTbRC.js} +3 -3
- package/dist/chunks/usePopup-DarKTbRC.js.map +1 -0
- package/dist/components/common/BookmarkMngModal.d.ts +1 -1
- package/dist/components/common/BookmarkMngModal.d.ts.map +1 -1
- package/dist/components/common/BookmarkPopver.d.ts +2 -2
- package/dist/components/common/BookmarkPopver.d.ts.map +1 -1
- package/dist/components/common/BwgButtonGroup.d.ts +5 -5
- package/dist/components/common/BwgButtonGroup.d.ts.map +1 -1
- package/dist/components/common/BwgCmptArea.d.ts +7 -7
- package/dist/components/common/BwgCmptArea.d.ts.map +1 -1
- package/dist/components/common/BwgCol.d.ts +2 -1
- package/dist/components/common/BwgCol.d.ts.map +1 -1
- package/dist/components/common/BwgConfigProvider.d.ts +2 -2
- package/dist/components/common/BwgConfigProvider.d.ts.map +1 -1
- package/dist/components/common/BwgDetail.d.ts +2 -1
- package/dist/components/common/BwgDetail.d.ts.map +1 -1
- package/dist/components/common/BwgDraggable.d.ts +5 -5
- package/dist/components/common/BwgDraggable.d.ts.map +1 -1
- package/dist/components/common/BwgDrawer.d.ts +2 -1
- package/dist/components/common/BwgDrawer.d.ts.map +1 -1
- package/dist/components/common/BwgEditor.d.ts +5 -5
- package/dist/components/common/BwgEditor.d.ts.map +1 -1
- package/dist/components/common/BwgGrid.d.ts +8 -8
- package/dist/components/common/BwgGrid.d.ts.map +1 -1
- package/dist/components/common/BwgInfoArea.d.ts +4 -4
- package/dist/components/common/BwgInfoArea.d.ts.map +1 -1
- package/dist/components/common/BwgPopup.d.ts +3 -3
- package/dist/components/common/BwgPopup.d.ts.map +1 -1
- package/dist/components/common/BwgRow.d.ts +2 -1
- package/dist/components/common/BwgRow.d.ts.map +1 -1
- package/dist/components/common/BwgTitleBox.d.ts +5 -4
- package/dist/components/common/BwgTitleBox.d.ts.map +1 -1
- package/dist/components/common/BwgView.d.ts +4 -4
- package/dist/components/common/BwgView.d.ts.map +1 -1
- package/dist/components/common/ContentBox.d.ts +3 -3
- package/dist/components/common/ContentBox.d.ts.map +1 -1
- package/dist/components/common/ContentLayOut.d.ts +6 -5
- package/dist/components/common/ContentLayOut.d.ts.map +1 -1
- package/dist/components/common/GlobalConfigProvider.d.ts +2 -2
- package/dist/components/common/GlobalConfigProvider.d.ts.map +1 -1
- package/dist/components/common/QuickServiceToggle.d.ts +4 -4
- package/dist/components/common/QuickServiceToggle.d.ts.map +1 -1
- package/dist/components/common/SSOHandler.d.ts +2 -1
- package/dist/components/common/SSOHandler.d.ts.map +1 -1
- package/dist/components/common/SearchBox.d.ts +5 -4
- package/dist/components/common/SearchBox.d.ts.map +1 -1
- package/dist/components/common/index.cjs +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/core/BwgButton.d.ts +3 -2
- package/dist/components/core/BwgButton.d.ts.map +1 -1
- package/dist/components/core/BwgDatePicker.d.ts +3 -3
- package/dist/components/core/BwgDatePicker.d.ts.map +1 -1
- package/dist/components/core/BwgDownload.d.ts +2 -2
- package/dist/components/core/BwgDownload.d.ts.map +1 -1
- package/dist/components/core/BwgForm.d.ts +2 -1
- package/dist/components/core/BwgForm.d.ts.map +1 -1
- package/dist/components/core/BwgFormItem.d.ts +3 -3
- package/dist/components/core/BwgFormItem.d.ts.map +1 -1
- package/dist/components/core/BwgInput.d.ts +2 -2
- package/dist/components/core/BwgInput.d.ts.map +1 -1
- package/dist/components/core/BwgLargeUploader.d.ts +2 -2
- package/dist/components/core/BwgLargeUploader.d.ts.map +1 -1
- package/dist/components/core/BwgMaskedInput.d.ts +2 -2
- package/dist/components/core/BwgMaskedInput.d.ts.map +1 -1
- package/dist/components/core/BwgMaskedPicker.d.ts +2 -2
- package/dist/components/core/BwgMaskedPicker.d.ts.map +1 -1
- package/dist/components/core/BwgRangePicker.d.ts +3 -3
- package/dist/components/core/BwgRangePicker.d.ts.map +1 -1
- package/dist/components/core/BwgSearch.d.ts +1 -1
- package/dist/components/core/BwgSearch.d.ts.map +1 -1
- package/dist/components/core/BwgUploader.d.ts +2 -2
- package/dist/components/core/BwgUploader.d.ts.map +1 -1
- package/dist/components/core/index.cjs +1 -1
- package/dist/components/core/index.js +2 -2
- package/dist/components/layout/ErrorBound.d.ts +3 -3
- package/dist/components/layout/ErrorBound.d.ts.map +1 -1
- package/dist/components/layout/LoadingOverlay.d.ts +3 -2
- package/dist/components/layout/LoadingOverlay.d.ts.map +1 -1
- package/dist/components/layout/PrivateProtectedOverlay.d.ts +3 -2
- package/dist/components/layout/PrivateProtectedOverlay.d.ts.map +1 -1
- package/dist/components/layout/ProgressOverlay.d.ts +2 -2
- package/dist/components/layout/ProgressOverlay.d.ts.map +1 -1
- package/dist/components/layout/ViewContainer.d.ts +3 -3
- package/dist/components/layout/ViewContainer.d.ts.map +1 -1
- package/dist/components/layout/index.js +1 -1
- package/dist/components/popup/MenuReport.d.ts +2 -2
- package/dist/components/popup/MenuReport.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +11 -11
- package/dist/provider/contexts/AuthContext.d.ts +3 -2
- package/dist/provider/contexts/AuthContext.d.ts.map +1 -1
- package/dist/provider/contexts/CommonCodeContext.d.ts +2 -2
- package/dist/provider/contexts/CommonCodeContext.d.ts.map +1 -1
- package/dist/provider/contexts/ScreenProtectContext.d.ts +5 -5
- package/dist/provider/contexts/ScreenProtectContext.d.ts.map +1 -1
- package/dist/provider/contexts/SearchBoxContext.d.ts +3 -3
- package/dist/provider/contexts/SearchBoxContext.d.ts.map +1 -1
- package/dist/provider/contexts/ServiceCodeContext.d.ts +2 -2
- package/dist/provider/contexts/ServiceCodeContext.d.ts.map +1 -1
- package/dist/provider/index.js +3 -3
- package/dist/stores/index.cjs.map +1 -1
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +6 -6
- package/dist/stores/index.js.map +1 -1
- package/dist/stores/menuViewStore.d.ts +6 -5
- package/dist/stores/menuViewStore.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/AuthContext-Ei2P-z4d.js.map +0 -1
- package/dist/chunks/BwgSwitch-B79pseQM.js.map +0 -1
- package/dist/chunks/BwgSwitch-CAI-kEaM.cjs.map +0 -1
- package/dist/chunks/BwgUploader-BcVlE61B.js.map +0 -1
- package/dist/chunks/BwgUploader-DaNV2URT.cjs.map +0 -1
- package/dist/chunks/SSOHandler-CkPcSHIm.js.map +0 -1
- package/dist/chunks/SSOHandler-DiW4Ft9i.cjs.map +0 -1
- package/dist/chunks/SearchBoxContext-BCvEYyFk.js.map +0 -1
- package/dist/chunks/ViewContainer-CjpJqoGG.js.map +0 -1
- package/dist/chunks/apiUtils-DxzLqPhU.js.map +0 -1
- package/dist/chunks/usePopup-BSqsnSz7.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthContext-CXng9fj0.cjs","sources":["../../src/provider/contexts/AuthContext.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"AuthContext-CXng9fj0.cjs","sources":["../../src/provider/contexts/AuthContext.tsx"],"sourcesContent":["import {\r\n createContext,\r\n FC,\r\n ReactNode,\r\n useContext,\r\n useMemo,\r\n useState,\r\n} from 'react';\r\n\r\ntype AuthContextValue = {\r\n authed: boolean;\r\n busy: boolean; // show global progress when true\r\n verifyWithToken: (token: string) => Promise<boolean>; // initial SSO\r\n reauthWithPin: (pin: string) => Promise<boolean>; // unlock SSO\r\n logout: () => void;\r\n};\r\n\r\nconst AuthContext = createContext<AuthContextValue | null>(null);\r\nexport const useAuth = () => {\r\n const ctx = useContext(AuthContext);\r\n if (!ctx) throw new Error('useAuth must be used within AuthProvider');\r\n return ctx;\r\n};\r\n\r\nexport const AuthProvider: FC<{ children: ReactNode }> = ({ children }) => {\r\n const [authed, setAuthed] = useState(false);\r\n const [busy, setBusy] = useState(false);\r\n\r\n // Heuristic text parser for JSP boolean responses\r\n const parseOk = async (res: Response) => {\r\n const text = (await res.text()).trim().toLowerCase();\r\n try {\r\n const j = JSON.parse(text);\r\n if (typeof j === 'object' && j && (j.ok === true || j.success === true))\r\n return true;\r\n } catch {}\r\n if (['true', 'ok', '1', 'y'].includes(text)) return true;\r\n return false;\r\n };\r\n\r\n const verifyWithToken = async (token: string) => {\r\n setBusy(true);\r\n try {\r\n // TODO: replace with your real endpoint\r\n const res = await fetch('/serviceEndpoint/sso_check.jsp', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\r\n body: 'token=' + encodeURIComponent(token),\r\n });\r\n const ok = res.ok && (await parseOk(res));\r\n setAuthed(ok);\r\n return ok;\r\n } catch (e) {\r\n return false;\r\n } finally {\r\n setBusy(false);\r\n }\r\n };\r\n\r\n const reauthWithPin = async (pin: string) => {\r\n setBusy(true);\r\n try {\r\n // TODO: replace with your real endpoint\r\n const res = await fetch('/serviceEndpoint/sso_reauth.jsp', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\r\n body: 'pin=' + encodeURIComponent(pin),\r\n });\r\n const ok = res.ok && (await parseOk(res));\r\n // Keep authed true only if reauth succeeds\r\n if (!ok) return false;\r\n setAuthed(true);\r\n return true;\r\n } catch (e) {\r\n return false;\r\n } finally {\r\n setBusy(false);\r\n }\r\n };\r\n\r\n const logout = () => {\r\n setAuthed(false);\r\n };\r\n\r\n const value = useMemo(\r\n () => ({ authed, busy, verifyWithToken, reauthWithPin, logout }),\r\n [authed, busy]\r\n );\r\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;\r\n};\r\n"],"names":["AuthContext","createContext","useAuth","ctx","useContext","AuthProvider","children","authed","setAuthed","useState","busy","setBusy","parseOk","res","text","j","verifyWithToken","token","ok","reauthWithPin","pin","logout","value","useMemo","jsx"],"mappings":"8EAiBMA,EAAcC,EAAAA,cAAuC,IAAI,EAClDC,EAAU,IAAM,CAC3B,MAAMC,EAAMC,EAAAA,WAAWJ,CAAW,EAClC,GAAI,CAACG,EAAK,MAAM,IAAI,MAAM,0CAA0C,EACpE,OAAOA,CACT,EAEaE,EAA4C,CAAC,CAAE,SAAAC,KAAe,CACzE,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAK,EACp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A,IAACxB,EAAY,SAAZ,CAAqB,MAAAsB,EAAe,SAAAhB,CAAA,CAAS,CACvD"}
|
|
@@ -9,7 +9,8 @@ const f = m(null), j = () => {
|
|
|
9
9
|
const t = (await o.text()).trim().toLowerCase();
|
|
10
10
|
try {
|
|
11
11
|
const e = JSON.parse(t);
|
|
12
|
-
if (typeof e == "object" && e && (e.ok === !0 || e.success === !0))
|
|
12
|
+
if (typeof e == "object" && e && (e.ok === !0 || e.success === !0))
|
|
13
|
+
return !0;
|
|
13
14
|
} catch {
|
|
14
15
|
}
|
|
15
16
|
return !!["true", "ok", "1", "y"].includes(t);
|
|
@@ -43,11 +44,14 @@ const f = m(null), j = () => {
|
|
|
43
44
|
}
|
|
44
45
|
}, d = () => {
|
|
45
46
|
n(!1);
|
|
46
|
-
}, p = x(
|
|
47
|
+
}, p = x(
|
|
48
|
+
() => ({ authed: u, busy: a, verifyWithToken: h, reauthWithPin: l, logout: d }),
|
|
49
|
+
[u, a]
|
|
50
|
+
);
|
|
47
51
|
return /* @__PURE__ */ y.jsx(f.Provider, { value: p, children: r });
|
|
48
52
|
};
|
|
49
53
|
export {
|
|
50
54
|
v as A,
|
|
51
55
|
j as u
|
|
52
56
|
};
|
|
53
|
-
//# sourceMappingURL=AuthContext-
|
|
57
|
+
//# sourceMappingURL=AuthContext-DrEpBrpB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthContext-DrEpBrpB.js","sources":["../../src/provider/contexts/AuthContext.tsx"],"sourcesContent":["import {\r\n createContext,\r\n FC,\r\n ReactNode,\r\n useContext,\r\n useMemo,\r\n useState,\r\n} from 'react';\r\n\r\ntype AuthContextValue = {\r\n authed: boolean;\r\n busy: boolean; // show global progress when true\r\n verifyWithToken: (token: string) => Promise<boolean>; // initial SSO\r\n reauthWithPin: (pin: string) => Promise<boolean>; // unlock SSO\r\n logout: () => void;\r\n};\r\n\r\nconst AuthContext = createContext<AuthContextValue | null>(null);\r\nexport const useAuth = () => {\r\n const ctx = useContext(AuthContext);\r\n if (!ctx) throw new Error('useAuth must be used within AuthProvider');\r\n return ctx;\r\n};\r\n\r\nexport const AuthProvider: FC<{ children: ReactNode }> = ({ children }) => {\r\n const [authed, setAuthed] = useState(false);\r\n const [busy, setBusy] = useState(false);\r\n\r\n // Heuristic text parser for JSP boolean responses\r\n const parseOk = async (res: Response) => {\r\n const text = (await res.text()).trim().toLowerCase();\r\n try {\r\n const j = JSON.parse(text);\r\n if (typeof j === 'object' && j && (j.ok === true || j.success === true))\r\n return true;\r\n } catch {}\r\n if (['true', 'ok', '1', 'y'].includes(text)) return true;\r\n return false;\r\n };\r\n\r\n const verifyWithToken = async (token: string) => {\r\n setBusy(true);\r\n try {\r\n // TODO: replace with your real endpoint\r\n const res = await fetch('/serviceEndpoint/sso_check.jsp', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\r\n body: 'token=' + encodeURIComponent(token),\r\n });\r\n const ok = res.ok && (await parseOk(res));\r\n setAuthed(ok);\r\n return ok;\r\n } catch (e) {\r\n return false;\r\n } finally {\r\n setBusy(false);\r\n }\r\n };\r\n\r\n const reauthWithPin = async (pin: string) => {\r\n setBusy(true);\r\n try {\r\n // TODO: replace with your real endpoint\r\n const res = await fetch('/serviceEndpoint/sso_reauth.jsp', {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\r\n body: 'pin=' + encodeURIComponent(pin),\r\n });\r\n const ok = res.ok && (await parseOk(res));\r\n // Keep authed true only if reauth succeeds\r\n if (!ok) return false;\r\n setAuthed(true);\r\n return true;\r\n } catch (e) {\r\n return false;\r\n } finally {\r\n setBusy(false);\r\n }\r\n };\r\n\r\n const logout = () => {\r\n setAuthed(false);\r\n };\r\n\r\n const value = useMemo(\r\n () => ({ authed, busy, verifyWithToken, reauthWithPin, logout }),\r\n [authed, busy]\r\n );\r\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;\r\n};\r\n"],"names":["AuthContext","createContext","useAuth","ctx","useContext","AuthProvider","children","authed","setAuthed","useState","busy","setBusy","parseOk","res","text","j","verifyWithToken","token","ok","reauthWithPin","pin","logout","value","useMemo","jsx"],"mappings":";;AAiBA,MAAMA,IAAcC,EAAuC,IAAI,GAClDC,IAAU,MAAM;AAC3B,QAAMC,IAAMC,EAAWJ,CAAW;AAClC,MAAI,CAACG,EAAK,OAAM,IAAI,MAAM,0CAA0C;AACpE,SAAOA;AACT,GAEaE,IAA4C,CAAC,EAAE,UAAAC,QAAe;AACzE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAMC,CAAO,IAAIF,EAAS,EAAK,GAGhCG,IAAU,OAAOC,MAAkB;AACvC,UAAMC,KAAQ,MAAMD,EAAI,QAAQ,KAAA,EAAO,YAAA;AACvC,QAAI;AACF,YAAME,IAAI,KAAK,MAAMD,CAAI;AACzB,UAAI,OAAOC,KAAM,YAAYA,MAAMA,EAAE,OAAO,MAAQA,EAAE,YAAY;AAChE,eAAO;AAAA,IACX,QAAQ;AAAA,IAAC;AACT,WAAI,GAAC,QAAQ,MAAM,KAAK,GAAG,EAAE,SAASD,CAAI;AAAA,EAE5C,GAEME,IAAkB,OAAOC,MAAkB;AAC/C,IAAAN,EAAQ,EAAI;AACZ,QAAI;AAEF,YAAME,IAAM,MAAM,MAAM,kCAAkC;AAAA,QACxD,QAAQ;AAAA,QACR,SAAS,EAAE,gBAAgB,oCAAA;AAAA,QAC3B,MAAM,WAAW,mBAAmBI,CAAK;AAAA,MAAA,CAC1C,GACKC,IAAKL,EAAI,MAAO,MAAMD,EAAQC,CAAG;AACvC,aAAAL,EAAUU,CAAE,GACLA;AAAA,IACT,QAAY;AACV,aAAO;AAAA,IACT,UAAA;AACE,MAAAP,EAAQ,EAAK;AAAA,IACf;AAAA,EACF,GAEMQ,IAAgB,OAAOC,MAAgB;AAC3C,IAAAT,EAAQ,EAAI;AACZ,QAAI;AAEF,YAAME,IAAM,MAAM,MAAM,mCAAmC;AAAA,QACzD,QAAQ;AAAA,QACR,SAAS,EAAE,gBAAgB,oCAAA;AAAA,QAC3B,MAAM,SAAS,mBAAmBO,CAAG;AAAA,MAAA,CACtC;AAGD,aAFWP,EAAI,MAAO,MAAMD,EAAQC,CAAG,KAGvCL,EAAU,EAAI,GACP,MAFS;AAAA,IAGlB,QAAY;AACV,aAAO;AAAA,IACT,UAAA;AACE,MAAAG,EAAQ,EAAK;AAAA,IACf;AAAA,EACF,GAEMU,IAAS,MAAM;AACnB,IAAAb,EAAU,EAAK;AAAA,EACjB,GAEMc,IAAQC;AAAA,IACZ,OAAO,EAAE,QAAAhB,GAAQ,MAAAG,GAAM,iBAAAM,GAAiB,eAAAG,GAAe,QAAAE,EAAA;AAAA,IACvD,CAACd,GAAQG,CAAI;AAAA,EAAA;AAEf,SAAOc,gBAAAA,EAAAA,IAACxB,EAAY,UAAZ,EAAqB,OAAAsB,GAAe,UAAAhB,EAAA,CAAS;AACvD;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const s=require("./jsx-runtime-CeSfJrVB.cjs"),l=require("antd"),
|
|
2
|
-
//# sourceMappingURL=BwgSwitch-
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-CeSfJrVB.cjs"),l=require("antd"),u=require("dayjs"),Y=require("react"),c=Y.memo(({children:a,label:t,name:o,rules:i,initialValue:e,style:m,...x})=>{const r={fontWeight:"bold"},d=Array.isArray(i)&&i.some(f=>f.required===!0),n=()=>typeof t=="string"?s.jsxRuntimeExports.jsxs("span",{style:r,children:[t,d&&s.jsxRuntimeExports.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}):s.jsxRuntimeExports.jsx("span",{style:r,children:t});return s.jsxRuntimeExports.jsx(l.Form.Item,{className:"bwg-form-item",label:t?n():void 0,labelAlign:"left",name:o,rules:i,colon:!1,initialValue:e,style:m,...x,children:a})}),F=({itemProps:a,inputProps:t={format:"YN"}})=>{const o=l.Form.useFormInstance(),i=e=>{t.format==="boolean"?o.setFieldValue(a?.name,e.target.checked):o.setFieldValue(a?.name,e.target.checked?"Y":"N"),t.onChange&&t.onChange(e)};return s.jsxRuntimeExports.jsx(c,{...a,getValueProps:e=>({checked:t.format==="boolean"?!!e:e==="Y"}),normalize:e=>typeof e=="boolean"?t.format==="boolean"?e:e?"Y":"N":t.format==="boolean"?!!e:e?"Y":"N",children:s.jsxRuntimeExports.jsx(l.Checkbox,{...t,onChange:i,children:t?.title})})},g={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},p=({itemProps:a,inputProps:t,type:o="date",returnType:i="string"})=>{const{displayFormat:e,outputFormat:m}=Y.useMemo(()=>g[o],[o]),x=Y.useMemo(()=>Object.values(g).map(r=>r.outputFormat).sort((r,d)=>{if(r.length===d.length){if(r===m)return-1;if(d===m)return 1}return d.length-r.length}),[m]);return s.jsxRuntimeExports.jsx(c,{...a,getValueProps:r=>({value:r?u.isDayjs(r)?r:u(r,x):null}),normalize:r=>r?i==="dayjs"?r:r.format(m):null,children:s.jsxRuntimeExports.jsx(l.DatePicker,{...t,picker:o==="datetime"?"date":o,showTime:t?.showTime??(o==="datetime"||o==="time"),format:e})})},j=Y.forwardRef(({children:a,labelCol:t,style:o,className:i,...e},m)=>s.jsxRuntimeExports.jsx(l.ConfigProvider,{form:{validateMessages:{required:"'${label}을(를) 입력해주세요.'"}},children:s.jsxRuntimeExports.jsx(l.Form,{ref:m,...e,requiredMark:!1,labelCol:t||{flex:"100px"},style:{padding:"10px",...o},className:`bwg-form ${i??""}`,children:a})}));j.displayName="BwgForm";const w=({itemProps:a,inputProps:t})=>s.jsxRuntimeExports.jsx(c,{...a,children:s.jsxRuntimeExports.jsx(l.Input,{...t})}),{RangePicker:M}=l.DatePicker,h={year:{displayFormat:"YYYY",outputFormat:"YYYY"},month:{displayFormat:"YYYY-MM",outputFormat:"YYYYMM"},date:{displayFormat:"YYYY-MM-DD",outputFormat:"YYYYMMDD"},time:{displayFormat:"HH:mm",outputFormat:"HHmm"},datetime:{displayFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYYMMDDHHmm"}},y=({itemProps:a,inputProps:t,type:o="date",minDate:i,maxDate:e,returnType:m="string"})=>{const{displayFormat:x,outputFormat:r}=Y.useMemo(()=>h[o],[o]),d=Y.useMemo(()=>Object.values(h).map(n=>n.outputFormat).sort((n,f)=>{if(n.length===f.length){if(n===r)return-1;if(f===r)return 1}return f.length-n.length}),[r]);return s.jsxRuntimeExports.jsx(c,{...a,getValueProps:n=>({value:n&&n.length>0?[n[0]?u.isDayjs(n[0])?n[0]:u(n[0],d):null,n[1]?u.isDayjs(n[1])?n[1]:u(n[1],d):null]:null}),normalize:n=>n?m==="dayjs"?[n[0]??void 0,n[1]??void 0]:[n[0]?n[0].format(r):void 0,n[1]?n[1].format(r):void 0]:[void 0,void 0],children:s.jsxRuntimeExports.jsx(M,{...t,order:!0,minDate:i?u(i,d):void 0,maxDate:e?u(e,d):void 0,picker:o==="datetime"?"date":o,showTime:t?.showTime??(o==="datetime"||o==="time"),format:x})})},R=({itemProps:a,selectProps:t={options:[],allowClear:!0}})=>{const o=l.Form.useFormInstance(),i=!!o,e=Y.useMemo(()=>t?.addField==="ALL"?[{label:"전체",value:""},...t?.options||[]]:t?.addField==="NULL"?[{label:"",value:""},...t?.options||[]]:t?.options||[],[t.options,t.addField]),m=d=>{t.onChange?.(d)},x={...t,allowClear:t.allowClear??!0,options:e,onChange:m,variant:t.variant},r=s.jsxRuntimeExports.jsx(l.Select,{...x,disabled:t.disabled});return t.copyable&&!i&&console.warn("BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."),t.copyable?s.jsxRuntimeExports.jsx(c,{...a,name:void 0,children:s.jsxRuntimeExports.jsxs(l.Space.Compact,{block:!0,children:[s.jsxRuntimeExports.jsx(l.Form.Item,{name:a?.name,rules:a?.rules,style:{width:"100%",marginBottom:0},validateStatus:"",help:"",children:r}),s.jsxRuntimeExports.jsx(l.Typography.Paragraph,{copyable:{text:i&&o?.getFieldValue(a?.name)?.toString()||"",tooltips:["코드복사","코드복사됨"]},style:{margin:0,backgroundColor:"#f5f5f5",borderRadius:"4px",border:"1px solid #d9d9d9",fontSize:"12px",color:"#666",display:"flex",alignItems:"center",height:"30px",padding:"0 8px"}})]})}):s.jsxRuntimeExports.jsx(c,{...a,children:r})},b=({itemProps:a,inputProps:t={format:"YN"}})=>{const o=l.Form.useFormInstance(),i=(e,m)=>{t.format==="boolean"?o.setFieldValue(a?.name,e):o.setFieldValue(a?.name,e?"Y":"N"),t.onChange&&t.onChange(e,m)};return s.jsxRuntimeExports.jsx(c,{...a,getValueProps:e=>({checked:t.format==="boolean"?!!e:e==="Y"}),normalize:e=>typeof e=="boolean"?t.format==="boolean"?e:e?"Y":"N":t.format==="boolean"?!!e:e?"Y":"N",children:s.jsxRuntimeExports.jsx(l.Switch,{...t,onChange:(e,m)=>i(e,m)})})};exports.BwgCheck=F;exports.BwgDatePicker=p;exports.BwgForm=j;exports.BwgFormItem=c;exports.BwgInput=w;exports.BwgRangePicker=y;exports.BwgSelect=R;exports.BwgSwitch=b;
|
|
2
|
+
//# sourceMappingURL=BwgSwitch-DOlc57wi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BwgSwitch-DOlc57wi.cjs","sources":["../../src/components/core/BwgFormItem.tsx","../../src/components/core/BwgCheck.tsx","../../src/components/core/BwgDatePicker.tsx","../../src/components/core/BwgForm.tsx","../../src/components/core/BwgInput.tsx","../../src/components/core/BwgRangePicker.tsx","../../src/components/core/BwgSelect.tsx","../../src/components/core/BwgSwitch.tsx"],"sourcesContent":["import { Form, FormItemProps } from 'antd';\r\nimport React, { memo, ReactNode } from 'react';\r\n\r\nexport interface BwgFormItemProps extends FormItemProps {\r\n /** 폼 아이템 이름 */\r\n name?: string | string[];\r\n /** 폼 아이템 라벨 */\r\n label?: string | ReactNode;\r\n /** 폼 아이템 규칙 */\r\n rules?: any;\r\n /** 폼 아이템 초기값 */\r\n initialValue?: any;\r\n /** 폼 아이템 자식 컴포넌트 */\r\n children?: ReactNode;\r\n}\r\n\r\n/** 입력 폼 아이템 컴포넌트 */\r\nconst BwgFormItem = memo(\r\n ({\r\n children,\r\n label,\r\n name,\r\n rules,\r\n initialValue,\r\n style,\r\n ...rest\r\n }: BwgFormItemProps) => {\r\n const labelStyle = {\r\n fontWeight: 'bold',\r\n };\r\n\r\n // rules에서 required 필드 확인\r\n const isRequired =\r\n Array.isArray(rules) && rules.some((rule: any) => rule.required === true);\r\n\r\n // 라벨 렌더링 함수\r\n const renderLabel = () => {\r\n if (typeof label === 'string') {\r\n return (\r\n <span style={labelStyle}>\r\n {label}\r\n {isRequired && (\r\n <span style={{ color: '#ff4d4f', marginLeft: '4px' }}>*</span>\r\n )}\r\n </span>\r\n );\r\n }\r\n return <span style={labelStyle}>{label}</span>;\r\n };\r\n\r\n return (\r\n <Form.Item\r\n className='bwg-form-item'\r\n label={label ? renderLabel() : undefined}\r\n labelAlign='left'\r\n name={name}\r\n rules={rules}\r\n colon={false}\r\n initialValue={initialValue}\r\n style={style}\r\n {...rest}\r\n >\r\n {children}\r\n </Form.Item>\r\n );\r\n }\r\n);\r\n\r\nexport default BwgFormItem;\r\n","import { Checkbox, CheckboxProps, Form } from 'antd';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport type BwgCheckBoxProps = CheckboxProps & {\r\n format?: 'boolean' | 'YN';\r\n};\r\n\r\nexport interface BwgCheckProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: BwgCheckBoxProps;\r\n}\r\n\r\n/**\r\n * 체크박스 컴포넌트\r\n * @param itemProps - BwgFormItemProps\r\n * @param inputProps - BwgCheckBoxProps\r\n * @returns \r\n * @example\r\n * <BwgCheck\r\n * itemProps={{ name: 'check' }}\r\n * inputProps={{ format: 'YN' }}\r\n * />\r\n */\r\nconst BwgCheck = ({\r\n itemProps,\r\n inputProps = {\r\n format: 'YN',\r\n },\r\n}: BwgCheckProps) => {\r\n const form = Form.useFormInstance();\r\n\r\n const handleChange = (e: any) => {\r\n //console.log('handleChange :: ', e.target.checked);\r\n if (inputProps.format === 'boolean') {\r\n form.setFieldValue(itemProps?.name, e.target.checked);\r\n } else {\r\n form.setFieldValue(itemProps?.name, e.target.checked ? 'Y' : 'N');\r\n }\r\n\r\n inputProps.onChange && inputProps.onChange(e);\r\n };\r\n\r\n return (\r\n <BwgFormItem\r\n {...itemProps}\r\n getValueProps={value => {\r\n //console.log('getValueProps :: ', value);\r\n const checked =\r\n inputProps.format === 'boolean'\r\n ? Boolean(value)\r\n : value === 'Y'\r\n ? true\r\n : false;\r\n return { checked }; // ✅ 수정: value 대신 checked 반환\r\n }}\r\n normalize={value => {\r\n //console.log('normalize :: ', value);\r\n // 체크박스의 경우 e.target.checked 값이 전달되므로 이를 처리\r\n if (typeof value === 'boolean') {\r\n if (inputProps.format === 'boolean') {\r\n return value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }\r\n // 문자열이나 다른 값의 경우 기존 로직 유지\r\n if (inputProps.format === 'boolean') {\r\n return !!value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }}\r\n >\r\n <Checkbox {...inputProps} onChange={handleChange}>\r\n {inputProps?.title}\r\n </Checkbox>\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgCheck;\r\n","import { DatePicker } from 'antd';\r\nimport { DatePickerProps } from 'antd/es/date-picker';\r\nimport dayjs, { Dayjs } from 'dayjs';\r\nimport { useMemo } from 'react';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport interface BwgDatePickerProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: DatePickerProps;\r\n type?: 'year' | 'month' | 'date' | 'time' | 'datetime';\r\n returnType?: 'dayjs' | 'string';\r\n}\r\n\r\nconst formatMap = {\r\n year: { displayFormat: 'YYYY', outputFormat: 'YYYY' },\r\n month: { displayFormat: 'YYYY-MM', outputFormat: 'YYYYMM' },\r\n date: { displayFormat: 'YYYY-MM-DD', outputFormat: 'YYYYMMDD' },\r\n time: { displayFormat: 'HH:mm', outputFormat: 'HHmm' },\r\n datetime: {\r\n displayFormat: 'YYYY-MM-DD HH:mm',\r\n outputFormat: 'YYYYMMDDHHmm',\r\n },\r\n};\r\n\r\nconst BwgDatePicker = ({\r\n itemProps,\r\n inputProps,\r\n type = 'date',\r\n returnType = 'string',\r\n}: BwgDatePickerProps) => {\r\n // type이 변경될 때 format이 업데이트되도록 useMemo를 사용합니다.\r\n const { displayFormat, outputFormat } = useMemo(\r\n () => formatMap[type],\r\n [type]\r\n );\r\n\r\n // 현재 type의 포맷을 우선순위로 두어 파싱 순서 결정\r\n const allOutputFormats = useMemo(\r\n () =>\r\n Object.values(formatMap)\r\n .map(f => f.outputFormat)\r\n .sort((a, b) => {\r\n if (a.length === b.length) {\r\n if (a === outputFormat) return -1; // 현재 포맷이면 우선순위를 높인다\r\n if (b === outputFormat) return 1;\r\n }\r\n return b.length - a.length;\r\n }),\r\n [outputFormat] // type(outputFormat)이 바뀔 때마다 재정렬\r\n );\r\n return (\r\n <BwgFormItem\r\n {...itemProps}\r\n getValueProps={value => ({\r\n // 폼에 저장된 값(문자열 또는 Dayjs)을 DatePicker가 요구하는 Dayjs로 변환\r\n value: value\r\n ? dayjs.isDayjs(value)\r\n ? (value as Dayjs)\r\n : dayjs(value as any, allOutputFormats)\r\n : null,\r\n })}\r\n normalize={value => {\r\n // DatePicker에서 넘어온 Dayjs를 returnType에 따라 반환\r\n if (!value) return null;\r\n if (returnType === 'dayjs') return value as Dayjs;\r\n return value.format(outputFormat);\r\n }}\r\n >\r\n <DatePicker\r\n {...inputProps}\r\n // antd DatePicker는 type 대신 picker와 showTime 속성을 사용합니다.\r\n picker={type === 'datetime' ? 'date' : type}\r\n showTime={\r\n inputProps?.showTime ?? (type === 'datetime' || type === 'time')\r\n }\r\n // useMask 속성 관련 로직이 불분명하고, displayFormat을 직접 사용하는 것이 더 확실합니다.\r\n format={displayFormat}\r\n // onChange 이벤트는 BwgFormItem의 normalize로 처리하므로 중복되는 handleChange를 제거합니다.\r\n ></DatePicker>\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgDatePicker;\r\n","import { ConfigProvider, Form, FormProps } from 'antd';\r\nimport { forwardRef, ReactNode } from 'react';\r\n\r\nexport interface BwgFormProps extends FormProps {\r\n children: ReactNode;\r\n}\r\n\r\nconst BwgForm = forwardRef<any, BwgFormProps>(\r\n ({ children, labelCol, style, className, ...props }, ref) => {\r\n return (\r\n <ConfigProvider\r\n form={{\r\n //기존 rule.message의 default message인 $name을를 입력해주세요를 변경\r\n validateMessages: { required: \"'${label}을(를) 입력해주세요.'\" },\r\n }}\r\n >\r\n <Form\r\n ref={ref}\r\n {...props}\r\n requiredMark={false}\r\n labelCol={labelCol || { flex: '100px' }}\r\n style={{ padding: '10px', ...style }}\r\n className={`bwg-form ${className ?? ''}`}\r\n >\r\n {children}\r\n </Form>\r\n </ConfigProvider>\r\n );\r\n }\r\n);\r\n\r\nBwgForm.displayName = 'BwgForm';\r\n\r\nexport default BwgForm;\r\n","import React, { FC } from 'react';\r\nimport { Input, InputProps } from 'antd';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport interface BwgInputProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: InputProps;\r\n}\r\n\r\nconst BwgInput: FC<BwgInputProps> = ({ itemProps, inputProps }) => {\r\n return (\r\n <BwgFormItem {...itemProps}>\r\n <Input {...inputProps} />\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgInput;\r\n","import { DatePicker } from 'antd';\r\nimport { RangePickerProps } from 'antd/es/date-picker';\r\nimport dayjs, { Dayjs } from 'dayjs';\r\nimport { useMemo } from 'react';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nconst { RangePicker } = DatePicker;\r\n\r\nexport interface BwgRangePickerProps {\r\n inputProps?: RangePickerProps;\r\n itemProps?: BwgFormItemProps;\r\n type?: 'year' | 'month' | 'date' | 'time' | 'datetime';\r\n minDate?: string;\r\n maxDate?: string;\r\n returnType?: 'dayjs' | 'string';\r\n}\r\n\r\nconst formatMap = {\r\n year: { displayFormat: 'YYYY', outputFormat: 'YYYY' },\r\n month: { displayFormat: 'YYYY-MM', outputFormat: 'YYYYMM' },\r\n date: { displayFormat: 'YYYY-MM-DD', outputFormat: 'YYYYMMDD' },\r\n time: { displayFormat: 'HH:mm', outputFormat: 'HHmm' },\r\n datetime: {\r\n displayFormat: 'YYYY-MM-DD HH:mm',\r\n outputFormat: 'YYYYMMDDHHmm',\r\n },\r\n};\r\n\r\nconst BwgRangePicker = ({\r\n itemProps,\r\n inputProps,\r\n type = 'date',\r\n minDate,\r\n maxDate,\r\n returnType = 'string',\r\n}: BwgRangePickerProps) => {\r\n // type이 변경될 때 format이 업데이트되도록 useMemo를 사용합니다.\r\n const { displayFormat, outputFormat } = useMemo(\r\n () => formatMap[type],\r\n [type]\r\n );\r\n\r\n // 현재 type의 포맷을 우선순위로 두어 파싱 순서 결정\r\n const allOutputFormats = useMemo(\r\n () =>\r\n Object.values(formatMap)\r\n .map(f => f.outputFormat)\r\n .sort((a, b) => {\r\n if (a.length === b.length) {\r\n if (a === outputFormat) return -1; // 현재 포맷이면 우선순위를 높인다\r\n if (b === outputFormat) return 1;\r\n }\r\n return b.length - a.length;\r\n }),\r\n [outputFormat] // type(outputFormat)이 바뀔 때마다 재정렬\r\n );\r\n return (\r\n <BwgFormItem\r\n {...itemProps}\r\n getValueProps={value => ({\r\n // 폼에 저장된 값(문자열 또는 Dayjs)을 RangePicker가 요구하는 Dayjs 배열로 변환\r\n value:\r\n value && value.length > 0\r\n ? [\r\n value[0]\r\n ? dayjs.isDayjs(value[0])\r\n ? (value[0] as Dayjs)\r\n : dayjs(value[0] as any, allOutputFormats)\r\n : null,\r\n value[1]\r\n ? dayjs.isDayjs(value[1])\r\n ? (value[1] as Dayjs)\r\n : dayjs(value[1] as any, allOutputFormats)\r\n : null,\r\n ]\r\n : null,\r\n })}\r\n normalize={(value: [Dayjs, Dayjs] | null) => {\r\n // RangePicker에서 넘어온 dayjs 객체 배열을 현재 type에 맞는 outputFormat으로 변환합니다.\r\n if (!value) {\r\n return [undefined, undefined];\r\n }\r\n if (returnType === 'dayjs') {\r\n return [value[0] ?? undefined, value[1] ?? undefined];\r\n }\r\n return [\r\n value[0] ? value[0].format(outputFormat) : undefined,\r\n value[1] ? value[1].format(outputFormat) : undefined,\r\n ];\r\n }}\r\n >\r\n <RangePicker\r\n {...inputProps}\r\n order={true}\r\n // minDate/maxDate도 모든 포맷으로 파싱하도록 수정\r\n minDate={minDate ? dayjs(minDate, allOutputFormats) : undefined}\r\n maxDate={maxDate ? dayjs(maxDate, allOutputFormats) : undefined}\r\n // antd DatePicker는 type 대신 picker와 showTime 속성을 사용합니다.\r\n picker={type === 'datetime' ? 'date' : type}\r\n showTime={\r\n inputProps?.showTime ?? (type === 'datetime' || type === 'time')\r\n }\r\n // useMask 속성 관련 로직이 불분명하고, displayFormat을 직접 사용하는 것이 더 확실합니다.\r\n format={displayFormat}\r\n // onChange 이벤트는 BwgFormItem의 normalize로 처리하므로 제거합니다.\r\n />\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgRangePicker;\r\n","import { Form, Select, Space, Typography } from 'antd';\r\nimport { SelectProps } from 'antd/es/select';\r\nimport { useMemo } from 'react';\r\nimport { SimpleCodeItem } from '../../stores/codeStore';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport type SelectBoxProps = SelectProps & {\r\n addField?: 'ALL' | 'NULL';\r\n options: SimpleCodeItem[];\r\n copyable?: boolean;\r\n};\r\n\r\nexport interface BwgSelectProps {\r\n /** 폼 아이템 속성 */\r\n itemProps?: BwgFormItemProps;\r\n selectProps?: SelectBoxProps;\r\n}\r\n\r\nconst BwgSelect = ({\r\n itemProps,\r\n selectProps = {\r\n options: [],\r\n allowClear: true,\r\n },\r\n}: BwgSelectProps) => {\r\n // Form 컨텍스트 체크\r\n const form = Form.useFormInstance();\r\n const isFormContext = !!form;\r\n\r\n // 옵션 리스트 메모이제이션\r\n const optionList = useMemo(() => {\r\n if (selectProps?.addField === 'ALL') {\r\n return [{ label: '전체', value: '' }, ...(selectProps?.options || [])];\r\n } else if (selectProps?.addField === 'NULL') {\r\n return [{ label: '', value: '' }, ...(selectProps?.options || [])];\r\n } else {\r\n return selectProps?.options || [];\r\n }\r\n }, [selectProps.options, selectProps.addField]);\r\n\r\n const handleChange = (newValue: string) => {\r\n selectProps.onChange?.(newValue);\r\n };\r\n\r\n // Select 컴포넌트에 전달할 props\r\n const selectComponentProps = {\r\n ...selectProps,\r\n allowClear: selectProps.allowClear ?? true,\r\n options: optionList,\r\n onChange: handleChange,\r\n variant: selectProps.variant,\r\n };\r\n\r\n // console.log(\"selectComponentProps :: \", selectComponentProps);\r\n\r\n const selectComponent = (\r\n <Select {...selectComponentProps} disabled={selectProps.disabled} />\r\n );\r\n\r\n // copyable일 때 Form 컨텍스트 체크\r\n if (selectProps.copyable && !isFormContext) {\r\n console.warn(\r\n 'BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다.'\r\n );\r\n }\r\n\r\n if (selectProps.copyable) {\r\n return (\r\n <BwgFormItem {...itemProps} name={undefined}>\r\n <Space.Compact block>\r\n <Form.Item\r\n name={itemProps?.name}\r\n rules={itemProps?.rules}\r\n style={{ width: '100%', marginBottom: 0 }}\r\n validateStatus=''\r\n help=''\r\n >\r\n {selectComponent}\r\n </Form.Item>\r\n <Typography.Paragraph\r\n copyable={{\r\n text: isFormContext\r\n ? form?.getFieldValue(itemProps?.name)?.toString() || ''\r\n : '',\r\n tooltips: ['코드복사', '코드복사됨'],\r\n }}\r\n style={{\r\n margin: 0,\r\n backgroundColor: '#f5f5f5',\r\n borderRadius: '4px',\r\n border: '1px solid #d9d9d9',\r\n fontSize: '12px',\r\n color: '#666',\r\n display: 'flex',\r\n alignItems: 'center',\r\n height: '30px',\r\n padding: '0 8px',\r\n }}\r\n />\r\n </Space.Compact>\r\n </BwgFormItem>\r\n );\r\n } else {\r\n return <BwgFormItem {...itemProps}>{selectComponent}</BwgFormItem>;\r\n }\r\n};\r\n\r\nexport default BwgSelect;\r\n","import { Form, Switch, SwitchProps } from \"antd\";\r\nimport BwgFormItem, { BwgFormItemProps } from \"./BwgFormItem\";\r\n\r\nexport type BwgSwitchItemProps = SwitchProps & {\r\n format?: 'boolean' | 'YN';\r\n };\r\n \r\n export interface BwgSwitchProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: BwgSwitchItemProps;\r\n }\r\n\r\n/**\r\n * 스위치 컴포넌트\r\n * @param itemProps - BwgFormItemProps\r\n * @param inputProps - BwgSwitchItemProps\r\n * @returns \r\n * @example\r\n * <BwgSwitch\r\n * itemProps={{ name: 'switch' }}\r\n * inputProps={{ format: 'YN' }}\r\n * />\r\n * @returns \r\n */\r\nconst BwgSwitch = ({\r\n itemProps,\r\n inputProps = {\r\n format: 'YN',\r\n },\r\n}: BwgSwitchProps) => {\r\n const form = Form.useFormInstance();\r\n \r\n const handleChange = (checked: boolean, e: any) => {\r\n if (inputProps.format === 'boolean') {\r\n form.setFieldValue(itemProps?.name, checked);\r\n } else {\r\n form.setFieldValue(itemProps?.name, checked ? 'Y' : 'N');\r\n }\r\n \r\n inputProps.onChange && inputProps.onChange(checked, e as any);\r\n };\r\n\r\n return <BwgFormItem {...itemProps} \r\n getValueProps={value => {\r\n const checked =\r\n inputProps.format === 'boolean'\r\n ? Boolean(value)\r\n : value === 'Y'\r\n ? true\r\n : false;\r\n return { checked };\r\n }}\r\n normalize={value => {\r\n //console.log('normalize :: ', value);\r\n // 체크박스의 경우 e.target.checked 값이 전달되므로 이를 처리\r\n if (typeof value === 'boolean') {\r\n if (inputProps.format === 'boolean') {\r\n return value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }\r\n // 문자열이나 다른 값의 경우 기존 로직 유지\r\n if (inputProps.format === 'boolean') {\r\n return !!value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }}\r\n >\r\n <Switch {...inputProps} onChange={(checked: boolean, e: any) => handleChange(checked, e)} />\r\n </BwgFormItem>;\r\n};\r\n\r\nexport default BwgSwitch;"],"names":["BwgFormItem","memo","children","label","name","rules","initialValue","style","rest","labelStyle","isRequired","rule","renderLabel","jsxs","jsx","Form","BwgCheck","itemProps","inputProps","form","handleChange","value","Checkbox","formatMap","BwgDatePicker","type","returnType","displayFormat","outputFormat","useMemo","allOutputFormats","f","a","b","dayjs","DatePicker","BwgForm","forwardRef","labelCol","className","props","ref","ConfigProvider","BwgInput","Input","RangePicker","BwgRangePicker","minDate","maxDate","BwgSelect","selectProps","isFormContext","optionList","newValue","selectComponentProps","selectComponent","Select","Space","Typography","BwgSwitch","checked","e","Switch"],"mappings":"mHAiBMA,EAAcC,EAAAA,KAClB,CAAC,CACC,SAAAC,EACA,MAAAC,EACA,KAAAC,EACA,MAAAC,EACA,aAAAC,EACA,MAAAC,EACA,GAAGC,CAAA,IACmB,CACtB,MAAMC,EAAa,CACjB,WAAY,MAAA,EAIRC,EACJ,MAAM,QAAQL,CAAK,GAAKA,EAAM,KAAMM,GAAcA,EAAK,WAAa,EAAI,EAGpEC,EAAc,IACd,OAAOT,GAAU,SAEjBU,EAAAA,kBAAAA,KAAC,OAAA,CAAK,MAAOJ,EACV,SAAA,CAAAN,EACAO,GACCI,EAAAA,kBAAAA,IAAC,OAAA,CAAK,MAAO,CAAE,MAAO,UAAW,WAAY,OAAS,SAAA,GAAA,CAAC,CAAA,EAE3D,EAGGA,EAAAA,kBAAAA,IAAC,OAAA,CA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M2C,CAAO,EAE3CzC,EAAK,cAAcF,GAAW,KAAM2C,EAAU,IAAM,GAAG,EAGzD1C,EAAW,UAAYA,EAAW,SAAS0C,EAASC,CAAQ,CAChE,EAEE,OAAO/C,EAAAA,kBAAAA,IAACd,EAAA,CAAa,GAAGiB,EACxB,cAAeI,IAOJ,CAAE,QALPH,EAAW,SAAW,UAClB,EAAQG,EACRA,IAAU,GAGP,GAEX,UAAWA,GAGL,OAAOA,GAAU,UACfH,EAAW,SAAW,UACjBG,EAEFA,EAAQ,IAAM,IAGnBH,EAAW,SAAW,UACjB,CAAC,CAACG,EAEJA,EAAQ,IAAM,IAGrB,SAAAP,EAAAA,kBAAAA,IAACgD,SAAA,CAAQ,GAAG5C,EAAY,SAAU,CAAC0C,EAAkBC,IAAWzC,EAAawC,EAASC,CAAC,CAAA,CAAG,CAAA,CAAA,CAElG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as m } from "./jsx-runtime-Dpn_P65e.js";
|
|
2
|
-
import { Form as
|
|
3
|
-
import D, { useMemo as g, forwardRef as H } from "react";
|
|
2
|
+
import { Form as f, Checkbox as j, DatePicker as x, ConfigProvider as y, Input as M, Select as b, Space as p, Typography as w, Switch as C } from "antd";
|
|
4
3
|
import d from "dayjs";
|
|
5
|
-
|
|
4
|
+
import { memo as D, useMemo as g, forwardRef as H } from "react";
|
|
5
|
+
const Y = D(
|
|
6
6
|
({
|
|
7
7
|
children: n,
|
|
8
8
|
label: t,
|
|
@@ -19,7 +19,7 @@ const f = D.memo(
|
|
|
19
19
|
s && /* @__PURE__ */ m.jsx("span", { style: { color: "#ff4d4f", marginLeft: "4px" }, children: "*" })
|
|
20
20
|
] }) : /* @__PURE__ */ m.jsx("span", { style: r, children: t });
|
|
21
21
|
return /* @__PURE__ */ m.jsx(
|
|
22
|
-
|
|
22
|
+
f.Item,
|
|
23
23
|
{
|
|
24
24
|
className: "bwg-form-item",
|
|
25
25
|
label: t ? a() : void 0,
|
|
@@ -40,11 +40,11 @@ const f = D.memo(
|
|
|
40
40
|
format: "YN"
|
|
41
41
|
}
|
|
42
42
|
}) => {
|
|
43
|
-
const o =
|
|
43
|
+
const o = f.useFormInstance(), l = (e) => {
|
|
44
44
|
t.format === "boolean" ? o.setFieldValue(n?.name, e.target.checked) : o.setFieldValue(n?.name, e.target.checked ? "Y" : "N"), t.onChange && t.onChange(e);
|
|
45
45
|
};
|
|
46
46
|
return /* @__PURE__ */ m.jsx(
|
|
47
|
-
|
|
47
|
+
Y,
|
|
48
48
|
{
|
|
49
49
|
...n,
|
|
50
50
|
getValueProps: (e) => ({ checked: t.format === "boolean" ? !!e : e === "Y" }),
|
|
@@ -82,7 +82,7 @@ const f = D.memo(
|
|
|
82
82
|
// type(outputFormat)이 바뀔 때마다 재정렬
|
|
83
83
|
);
|
|
84
84
|
return /* @__PURE__ */ m.jsx(
|
|
85
|
-
|
|
85
|
+
Y,
|
|
86
86
|
{
|
|
87
87
|
...n,
|
|
88
88
|
getValueProps: (r) => ({
|
|
@@ -110,7 +110,7 @@ const f = D.memo(
|
|
|
110
110
|
validateMessages: { required: "'${label}을(를) 입력해주세요.'" }
|
|
111
111
|
},
|
|
112
112
|
children: /* @__PURE__ */ m.jsx(
|
|
113
|
-
|
|
113
|
+
f,
|
|
114
114
|
{
|
|
115
115
|
ref: i,
|
|
116
116
|
...e,
|
|
@@ -125,7 +125,7 @@ const f = D.memo(
|
|
|
125
125
|
)
|
|
126
126
|
);
|
|
127
127
|
k.displayName = "BwgForm";
|
|
128
|
-
const z = ({ itemProps: n, inputProps: t }) => /* @__PURE__ */ m.jsx(
|
|
128
|
+
const z = ({ itemProps: n, inputProps: t }) => /* @__PURE__ */ m.jsx(Y, { ...n, children: /* @__PURE__ */ m.jsx(M, { ...t }) }), { RangePicker: B } = x, F = {
|
|
129
129
|
year: { displayFormat: "YYYY", outputFormat: "YYYY" },
|
|
130
130
|
month: { displayFormat: "YYYY-MM", outputFormat: "YYYYMM" },
|
|
131
131
|
date: { displayFormat: "YYYY-MM-DD", outputFormat: "YYYYMMDD" },
|
|
@@ -157,7 +157,7 @@ const z = ({ itemProps: n, inputProps: t }) => /* @__PURE__ */ m.jsx(f, { ...n,
|
|
|
157
157
|
// type(outputFormat)이 바뀔 때마다 재정렬
|
|
158
158
|
);
|
|
159
159
|
return /* @__PURE__ */ m.jsx(
|
|
160
|
-
|
|
160
|
+
Y,
|
|
161
161
|
{
|
|
162
162
|
...n,
|
|
163
163
|
getValueProps: (a) => ({
|
|
@@ -192,7 +192,7 @@ const z = ({ itemProps: n, inputProps: t }) => /* @__PURE__ */ m.jsx(f, { ...n,
|
|
|
192
192
|
allowClear: !0
|
|
193
193
|
}
|
|
194
194
|
}) => {
|
|
195
|
-
const o =
|
|
195
|
+
const o = f.useFormInstance(), l = !!o, e = g(() => t?.addField === "ALL" ? [{ label: "전체", value: "" }, ...t?.options || []] : t?.addField === "NULL" ? [{ label: "", value: "" }, ...t?.options || []] : t?.options || [], [t.options, t.addField]), i = (s) => {
|
|
196
196
|
t.onChange?.(s);
|
|
197
197
|
}, c = {
|
|
198
198
|
...t,
|
|
@@ -203,9 +203,9 @@ const z = ({ itemProps: n, inputProps: t }) => /* @__PURE__ */ m.jsx(f, { ...n,
|
|
|
203
203
|
}, r = /* @__PURE__ */ m.jsx(b, { ...c, disabled: t.disabled });
|
|
204
204
|
return t.copyable && !l && console.warn(
|
|
205
205
|
"BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다."
|
|
206
|
-
), t.copyable ? /* @__PURE__ */ m.jsx(
|
|
206
|
+
), t.copyable ? /* @__PURE__ */ m.jsx(Y, { ...n, name: void 0, children: /* @__PURE__ */ m.jsxs(p.Compact, { block: !0, children: [
|
|
207
207
|
/* @__PURE__ */ m.jsx(
|
|
208
|
-
|
|
208
|
+
f.Item,
|
|
209
209
|
{
|
|
210
210
|
name: n?.name,
|
|
211
211
|
rules: n?.rules,
|
|
@@ -236,18 +236,18 @@ const z = ({ itemProps: n, inputProps: t }) => /* @__PURE__ */ m.jsx(f, { ...n,
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
)
|
|
239
|
-
] }) }) : /* @__PURE__ */ m.jsx(
|
|
239
|
+
] }) }) : /* @__PURE__ */ m.jsx(Y, { ...n, children: r });
|
|
240
240
|
}, A = ({
|
|
241
241
|
itemProps: n,
|
|
242
242
|
inputProps: t = {
|
|
243
243
|
format: "YN"
|
|
244
244
|
}
|
|
245
245
|
}) => {
|
|
246
|
-
const o =
|
|
246
|
+
const o = f.useFormInstance(), l = (e, i) => {
|
|
247
247
|
t.format === "boolean" ? o.setFieldValue(n?.name, e) : o.setFieldValue(n?.name, e ? "Y" : "N"), t.onChange && t.onChange(e, i);
|
|
248
248
|
};
|
|
249
249
|
return /* @__PURE__ */ m.jsx(
|
|
250
|
-
|
|
250
|
+
Y,
|
|
251
251
|
{
|
|
252
252
|
...n,
|
|
253
253
|
getValueProps: (e) => ({ checked: t.format === "boolean" ? !!e : e === "Y" }),
|
|
@@ -260,10 +260,10 @@ export {
|
|
|
260
260
|
L as B,
|
|
261
261
|
R as a,
|
|
262
262
|
k as b,
|
|
263
|
-
|
|
263
|
+
Y as c,
|
|
264
264
|
z as d,
|
|
265
265
|
T as e,
|
|
266
266
|
q as f,
|
|
267
267
|
A as g
|
|
268
268
|
};
|
|
269
|
-
//# sourceMappingURL=BwgSwitch-
|
|
269
|
+
//# sourceMappingURL=BwgSwitch-D_scwi9_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BwgSwitch-D_scwi9_.js","sources":["../../src/components/core/BwgFormItem.tsx","../../src/components/core/BwgCheck.tsx","../../src/components/core/BwgDatePicker.tsx","../../src/components/core/BwgForm.tsx","../../src/components/core/BwgInput.tsx","../../src/components/core/BwgRangePicker.tsx","../../src/components/core/BwgSelect.tsx","../../src/components/core/BwgSwitch.tsx"],"sourcesContent":["import { Form, FormItemProps } from 'antd';\r\nimport React, { memo, ReactNode } from 'react';\r\n\r\nexport interface BwgFormItemProps extends FormItemProps {\r\n /** 폼 아이템 이름 */\r\n name?: string | string[];\r\n /** 폼 아이템 라벨 */\r\n label?: string | ReactNode;\r\n /** 폼 아이템 규칙 */\r\n rules?: any;\r\n /** 폼 아이템 초기값 */\r\n initialValue?: any;\r\n /** 폼 아이템 자식 컴포넌트 */\r\n children?: ReactNode;\r\n}\r\n\r\n/** 입력 폼 아이템 컴포넌트 */\r\nconst BwgFormItem = memo(\r\n ({\r\n children,\r\n label,\r\n name,\r\n rules,\r\n initialValue,\r\n style,\r\n ...rest\r\n }: BwgFormItemProps) => {\r\n const labelStyle = {\r\n fontWeight: 'bold',\r\n };\r\n\r\n // rules에서 required 필드 확인\r\n const isRequired =\r\n Array.isArray(rules) && rules.some((rule: any) => rule.required === true);\r\n\r\n // 라벨 렌더링 함수\r\n const renderLabel = () => {\r\n if (typeof label === 'string') {\r\n return (\r\n <span style={labelStyle}>\r\n {label}\r\n {isRequired && (\r\n <span style={{ color: '#ff4d4f', marginLeft: '4px' }}>*</span>\r\n )}\r\n </span>\r\n );\r\n }\r\n return <span style={labelStyle}>{label}</span>;\r\n };\r\n\r\n return (\r\n <Form.Item\r\n className='bwg-form-item'\r\n label={label ? renderLabel() : undefined}\r\n labelAlign='left'\r\n name={name}\r\n rules={rules}\r\n colon={false}\r\n initialValue={initialValue}\r\n style={style}\r\n {...rest}\r\n >\r\n {children}\r\n </Form.Item>\r\n );\r\n }\r\n);\r\n\r\nexport default BwgFormItem;\r\n","import { Checkbox, CheckboxProps, Form } from 'antd';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport type BwgCheckBoxProps = CheckboxProps & {\r\n format?: 'boolean' | 'YN';\r\n};\r\n\r\nexport interface BwgCheckProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: BwgCheckBoxProps;\r\n}\r\n\r\n/**\r\n * 체크박스 컴포넌트\r\n * @param itemProps - BwgFormItemProps\r\n * @param inputProps - BwgCheckBoxProps\r\n * @returns \r\n * @example\r\n * <BwgCheck\r\n * itemProps={{ name: 'check' }}\r\n * inputProps={{ format: 'YN' }}\r\n * />\r\n */\r\nconst BwgCheck = ({\r\n itemProps,\r\n inputProps = {\r\n format: 'YN',\r\n },\r\n}: BwgCheckProps) => {\r\n const form = Form.useFormInstance();\r\n\r\n const handleChange = (e: any) => {\r\n //console.log('handleChange :: ', e.target.checked);\r\n if (inputProps.format === 'boolean') {\r\n form.setFieldValue(itemProps?.name, e.target.checked);\r\n } else {\r\n form.setFieldValue(itemProps?.name, e.target.checked ? 'Y' : 'N');\r\n }\r\n\r\n inputProps.onChange && inputProps.onChange(e);\r\n };\r\n\r\n return (\r\n <BwgFormItem\r\n {...itemProps}\r\n getValueProps={value => {\r\n //console.log('getValueProps :: ', value);\r\n const checked =\r\n inputProps.format === 'boolean'\r\n ? Boolean(value)\r\n : value === 'Y'\r\n ? true\r\n : false;\r\n return { checked }; // ✅ 수정: value 대신 checked 반환\r\n }}\r\n normalize={value => {\r\n //console.log('normalize :: ', value);\r\n // 체크박스의 경우 e.target.checked 값이 전달되므로 이를 처리\r\n if (typeof value === 'boolean') {\r\n if (inputProps.format === 'boolean') {\r\n return value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }\r\n // 문자열이나 다른 값의 경우 기존 로직 유지\r\n if (inputProps.format === 'boolean') {\r\n return !!value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }}\r\n >\r\n <Checkbox {...inputProps} onChange={handleChange}>\r\n {inputProps?.title}\r\n </Checkbox>\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgCheck;\r\n","import { DatePicker } from 'antd';\r\nimport { DatePickerProps } from 'antd/es/date-picker';\r\nimport dayjs, { Dayjs } from 'dayjs';\r\nimport { useMemo } from 'react';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport interface BwgDatePickerProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: DatePickerProps;\r\n type?: 'year' | 'month' | 'date' | 'time' | 'datetime';\r\n returnType?: 'dayjs' | 'string';\r\n}\r\n\r\nconst formatMap = {\r\n year: { displayFormat: 'YYYY', outputFormat: 'YYYY' },\r\n month: { displayFormat: 'YYYY-MM', outputFormat: 'YYYYMM' },\r\n date: { displayFormat: 'YYYY-MM-DD', outputFormat: 'YYYYMMDD' },\r\n time: { displayFormat: 'HH:mm', outputFormat: 'HHmm' },\r\n datetime: {\r\n displayFormat: 'YYYY-MM-DD HH:mm',\r\n outputFormat: 'YYYYMMDDHHmm',\r\n },\r\n};\r\n\r\nconst BwgDatePicker = ({\r\n itemProps,\r\n inputProps,\r\n type = 'date',\r\n returnType = 'string',\r\n}: BwgDatePickerProps) => {\r\n // type이 변경될 때 format이 업데이트되도록 useMemo를 사용합니다.\r\n const { displayFormat, outputFormat } = useMemo(\r\n () => formatMap[type],\r\n [type]\r\n );\r\n\r\n // 현재 type의 포맷을 우선순위로 두어 파싱 순서 결정\r\n const allOutputFormats = useMemo(\r\n () =>\r\n Object.values(formatMap)\r\n .map(f => f.outputFormat)\r\n .sort((a, b) => {\r\n if (a.length === b.length) {\r\n if (a === outputFormat) return -1; // 현재 포맷이면 우선순위를 높인다\r\n if (b === outputFormat) return 1;\r\n }\r\n return b.length - a.length;\r\n }),\r\n [outputFormat] // type(outputFormat)이 바뀔 때마다 재정렬\r\n );\r\n return (\r\n <BwgFormItem\r\n {...itemProps}\r\n getValueProps={value => ({\r\n // 폼에 저장된 값(문자열 또는 Dayjs)을 DatePicker가 요구하는 Dayjs로 변환\r\n value: value\r\n ? dayjs.isDayjs(value)\r\n ? (value as Dayjs)\r\n : dayjs(value as any, allOutputFormats)\r\n : null,\r\n })}\r\n normalize={value => {\r\n // DatePicker에서 넘어온 Dayjs를 returnType에 따라 반환\r\n if (!value) return null;\r\n if (returnType === 'dayjs') return value as Dayjs;\r\n return value.format(outputFormat);\r\n }}\r\n >\r\n <DatePicker\r\n {...inputProps}\r\n // antd DatePicker는 type 대신 picker와 showTime 속성을 사용합니다.\r\n picker={type === 'datetime' ? 'date' : type}\r\n showTime={\r\n inputProps?.showTime ?? (type === 'datetime' || type === 'time')\r\n }\r\n // useMask 속성 관련 로직이 불분명하고, displayFormat을 직접 사용하는 것이 더 확실합니다.\r\n format={displayFormat}\r\n // onChange 이벤트는 BwgFormItem의 normalize로 처리하므로 중복되는 handleChange를 제거합니다.\r\n ></DatePicker>\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgDatePicker;\r\n","import { ConfigProvider, Form, FormProps } from 'antd';\r\nimport { forwardRef, ReactNode } from 'react';\r\n\r\nexport interface BwgFormProps extends FormProps {\r\n children: ReactNode;\r\n}\r\n\r\nconst BwgForm = forwardRef<any, BwgFormProps>(\r\n ({ children, labelCol, style, className, ...props }, ref) => {\r\n return (\r\n <ConfigProvider\r\n form={{\r\n //기존 rule.message의 default message인 $name을를 입력해주세요를 변경\r\n validateMessages: { required: \"'${label}을(를) 입력해주세요.'\" },\r\n }}\r\n >\r\n <Form\r\n ref={ref}\r\n {...props}\r\n requiredMark={false}\r\n labelCol={labelCol || { flex: '100px' }}\r\n style={{ padding: '10px', ...style }}\r\n className={`bwg-form ${className ?? ''}`}\r\n >\r\n {children}\r\n </Form>\r\n </ConfigProvider>\r\n );\r\n }\r\n);\r\n\r\nBwgForm.displayName = 'BwgForm';\r\n\r\nexport default BwgForm;\r\n","import React, { FC } from 'react';\r\nimport { Input, InputProps } from 'antd';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport interface BwgInputProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: InputProps;\r\n}\r\n\r\nconst BwgInput: FC<BwgInputProps> = ({ itemProps, inputProps }) => {\r\n return (\r\n <BwgFormItem {...itemProps}>\r\n <Input {...inputProps} />\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgInput;\r\n","import { DatePicker } from 'antd';\r\nimport { RangePickerProps } from 'antd/es/date-picker';\r\nimport dayjs, { Dayjs } from 'dayjs';\r\nimport { useMemo } from 'react';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nconst { RangePicker } = DatePicker;\r\n\r\nexport interface BwgRangePickerProps {\r\n inputProps?: RangePickerProps;\r\n itemProps?: BwgFormItemProps;\r\n type?: 'year' | 'month' | 'date' | 'time' | 'datetime';\r\n minDate?: string;\r\n maxDate?: string;\r\n returnType?: 'dayjs' | 'string';\r\n}\r\n\r\nconst formatMap = {\r\n year: { displayFormat: 'YYYY', outputFormat: 'YYYY' },\r\n month: { displayFormat: 'YYYY-MM', outputFormat: 'YYYYMM' },\r\n date: { displayFormat: 'YYYY-MM-DD', outputFormat: 'YYYYMMDD' },\r\n time: { displayFormat: 'HH:mm', outputFormat: 'HHmm' },\r\n datetime: {\r\n displayFormat: 'YYYY-MM-DD HH:mm',\r\n outputFormat: 'YYYYMMDDHHmm',\r\n },\r\n};\r\n\r\nconst BwgRangePicker = ({\r\n itemProps,\r\n inputProps,\r\n type = 'date',\r\n minDate,\r\n maxDate,\r\n returnType = 'string',\r\n}: BwgRangePickerProps) => {\r\n // type이 변경될 때 format이 업데이트되도록 useMemo를 사용합니다.\r\n const { displayFormat, outputFormat } = useMemo(\r\n () => formatMap[type],\r\n [type]\r\n );\r\n\r\n // 현재 type의 포맷을 우선순위로 두어 파싱 순서 결정\r\n const allOutputFormats = useMemo(\r\n () =>\r\n Object.values(formatMap)\r\n .map(f => f.outputFormat)\r\n .sort((a, b) => {\r\n if (a.length === b.length) {\r\n if (a === outputFormat) return -1; // 현재 포맷이면 우선순위를 높인다\r\n if (b === outputFormat) return 1;\r\n }\r\n return b.length - a.length;\r\n }),\r\n [outputFormat] // type(outputFormat)이 바뀔 때마다 재정렬\r\n );\r\n return (\r\n <BwgFormItem\r\n {...itemProps}\r\n getValueProps={value => ({\r\n // 폼에 저장된 값(문자열 또는 Dayjs)을 RangePicker가 요구하는 Dayjs 배열로 변환\r\n value:\r\n value && value.length > 0\r\n ? [\r\n value[0]\r\n ? dayjs.isDayjs(value[0])\r\n ? (value[0] as Dayjs)\r\n : dayjs(value[0] as any, allOutputFormats)\r\n : null,\r\n value[1]\r\n ? dayjs.isDayjs(value[1])\r\n ? (value[1] as Dayjs)\r\n : dayjs(value[1] as any, allOutputFormats)\r\n : null,\r\n ]\r\n : null,\r\n })}\r\n normalize={(value: [Dayjs, Dayjs] | null) => {\r\n // RangePicker에서 넘어온 dayjs 객체 배열을 현재 type에 맞는 outputFormat으로 변환합니다.\r\n if (!value) {\r\n return [undefined, undefined];\r\n }\r\n if (returnType === 'dayjs') {\r\n return [value[0] ?? undefined, value[1] ?? undefined];\r\n }\r\n return [\r\n value[0] ? value[0].format(outputFormat) : undefined,\r\n value[1] ? value[1].format(outputFormat) : undefined,\r\n ];\r\n }}\r\n >\r\n <RangePicker\r\n {...inputProps}\r\n order={true}\r\n // minDate/maxDate도 모든 포맷으로 파싱하도록 수정\r\n minDate={minDate ? dayjs(minDate, allOutputFormats) : undefined}\r\n maxDate={maxDate ? dayjs(maxDate, allOutputFormats) : undefined}\r\n // antd DatePicker는 type 대신 picker와 showTime 속성을 사용합니다.\r\n picker={type === 'datetime' ? 'date' : type}\r\n showTime={\r\n inputProps?.showTime ?? (type === 'datetime' || type === 'time')\r\n }\r\n // useMask 속성 관련 로직이 불분명하고, displayFormat을 직접 사용하는 것이 더 확실합니다.\r\n format={displayFormat}\r\n // onChange 이벤트는 BwgFormItem의 normalize로 처리하므로 제거합니다.\r\n />\r\n </BwgFormItem>\r\n );\r\n};\r\n\r\nexport default BwgRangePicker;\r\n","import { Form, Select, Space, Typography } from 'antd';\r\nimport { SelectProps } from 'antd/es/select';\r\nimport { useMemo } from 'react';\r\nimport { SimpleCodeItem } from '../../stores/codeStore';\r\nimport BwgFormItem, { BwgFormItemProps } from './BwgFormItem';\r\n\r\nexport type SelectBoxProps = SelectProps & {\r\n addField?: 'ALL' | 'NULL';\r\n options: SimpleCodeItem[];\r\n copyable?: boolean;\r\n};\r\n\r\nexport interface BwgSelectProps {\r\n /** 폼 아이템 속성 */\r\n itemProps?: BwgFormItemProps;\r\n selectProps?: SelectBoxProps;\r\n}\r\n\r\nconst BwgSelect = ({\r\n itemProps,\r\n selectProps = {\r\n options: [],\r\n allowClear: true,\r\n },\r\n}: BwgSelectProps) => {\r\n // Form 컨텍스트 체크\r\n const form = Form.useFormInstance();\r\n const isFormContext = !!form;\r\n\r\n // 옵션 리스트 메모이제이션\r\n const optionList = useMemo(() => {\r\n if (selectProps?.addField === 'ALL') {\r\n return [{ label: '전체', value: '' }, ...(selectProps?.options || [])];\r\n } else if (selectProps?.addField === 'NULL') {\r\n return [{ label: '', value: '' }, ...(selectProps?.options || [])];\r\n } else {\r\n return selectProps?.options || [];\r\n }\r\n }, [selectProps.options, selectProps.addField]);\r\n\r\n const handleChange = (newValue: string) => {\r\n selectProps.onChange?.(newValue);\r\n };\r\n\r\n // Select 컴포넌트에 전달할 props\r\n const selectComponentProps = {\r\n ...selectProps,\r\n allowClear: selectProps.allowClear ?? true,\r\n options: optionList,\r\n onChange: handleChange,\r\n variant: selectProps.variant,\r\n };\r\n\r\n // console.log(\"selectComponentProps :: \", selectComponentProps);\r\n\r\n const selectComponent = (\r\n <Select {...selectComponentProps} disabled={selectProps.disabled} />\r\n );\r\n\r\n // copyable일 때 Form 컨텍스트 체크\r\n if (selectProps.copyable && !isFormContext) {\r\n console.warn(\r\n 'BwgSelect: copyable 기능은 Form 컨텍스트 내에서만 사용 가능합니다.'\r\n );\r\n }\r\n\r\n if (selectProps.copyable) {\r\n return (\r\n <BwgFormItem {...itemProps} name={undefined}>\r\n <Space.Compact block>\r\n <Form.Item\r\n name={itemProps?.name}\r\n rules={itemProps?.rules}\r\n style={{ width: '100%', marginBottom: 0 }}\r\n validateStatus=''\r\n help=''\r\n >\r\n {selectComponent}\r\n </Form.Item>\r\n <Typography.Paragraph\r\n copyable={{\r\n text: isFormContext\r\n ? form?.getFieldValue(itemProps?.name)?.toString() || ''\r\n : '',\r\n tooltips: ['코드복사', '코드복사됨'],\r\n }}\r\n style={{\r\n margin: 0,\r\n backgroundColor: '#f5f5f5',\r\n borderRadius: '4px',\r\n border: '1px solid #d9d9d9',\r\n fontSize: '12px',\r\n color: '#666',\r\n display: 'flex',\r\n alignItems: 'center',\r\n height: '30px',\r\n padding: '0 8px',\r\n }}\r\n />\r\n </Space.Compact>\r\n </BwgFormItem>\r\n );\r\n } else {\r\n return <BwgFormItem {...itemProps}>{selectComponent}</BwgFormItem>;\r\n }\r\n};\r\n\r\nexport default BwgSelect;\r\n","import { Form, Switch, SwitchProps } from \"antd\";\r\nimport BwgFormItem, { BwgFormItemProps } from \"./BwgFormItem\";\r\n\r\nexport type BwgSwitchItemProps = SwitchProps & {\r\n format?: 'boolean' | 'YN';\r\n };\r\n \r\n export interface BwgSwitchProps {\r\n itemProps?: BwgFormItemProps;\r\n inputProps?: BwgSwitchItemProps;\r\n }\r\n\r\n/**\r\n * 스위치 컴포넌트\r\n * @param itemProps - BwgFormItemProps\r\n * @param inputProps - BwgSwitchItemProps\r\n * @returns \r\n * @example\r\n * <BwgSwitch\r\n * itemProps={{ name: 'switch' }}\r\n * inputProps={{ format: 'YN' }}\r\n * />\r\n * @returns \r\n */\r\nconst BwgSwitch = ({\r\n itemProps,\r\n inputProps = {\r\n format: 'YN',\r\n },\r\n}: BwgSwitchProps) => {\r\n const form = Form.useFormInstance();\r\n \r\n const handleChange = (checked: boolean, e: any) => {\r\n if (inputProps.format === 'boolean') {\r\n form.setFieldValue(itemProps?.name, checked);\r\n } else {\r\n form.setFieldValue(itemProps?.name, checked ? 'Y' : 'N');\r\n }\r\n \r\n inputProps.onChange && inputProps.onChange(checked, e as any);\r\n };\r\n\r\n return <BwgFormItem {...itemProps} \r\n getValueProps={value => {\r\n const checked =\r\n inputProps.format === 'boolean'\r\n ? Boolean(value)\r\n : value === 'Y'\r\n ? true\r\n : false;\r\n return { checked };\r\n }}\r\n normalize={value => {\r\n //console.log('normalize :: ', value);\r\n // 체크박스의 경우 e.target.checked 값이 전달되므로 이를 처리\r\n if (typeof value === 'boolean') {\r\n if (inputProps.format === 'boolean') {\r\n return value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }\r\n // 문자열이나 다른 값의 경우 기존 로직 유지\r\n if (inputProps.format === 'boolean') {\r\n return !!value;\r\n }\r\n return value ? 'Y' : 'N';\r\n }}\r\n >\r\n <Switch {...inputProps} onChange={(checked: boolean, e: any) => handleChange(checked, e)} />\r\n </BwgFormItem>;\r\n};\r\n\r\nexport default BwgSwitch;"],"names":["BwgFormItem","memo","children","label","name","rules","initialValue","style","rest","labelStyle","isRequired","rule","renderLabel","jsxs","jsx","Form","BwgCheck","itemProps","inputProps","form","handleChange","value","Checkbox","formatMap","BwgDatePicker","type","returnType","displayFormat","outputFormat","useMemo","allOutputFormats","f","a","b","dayjs","DatePicker","BwgForm","forwardRef","labelCol","className","props","ref","ConfigProvider","BwgInput","Input","RangePicker","BwgRangePicker","minDate","maxDate","BwgSelect","selectProps","isFormContext","optionList","newValue","selectComponentProps","selectComponent","Select","Space","Typography","BwgSwitch","checked","e","Switch"],"mappings":";;;;AAiBA,MAAMA,IAAcC;AAAA,EAClB,CAAC;AAAA,IACC,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,MACmB;AACtB,UAAMC,IAAa;AAAA,MACjB,YAAY;AAAA,IAAA,GAIRC,IACJ,MAAM,QAAQL,CAAK,KAAKA,EAAM,KAAK,CAACM,MAAcA,EAAK,aAAa,EAAI,GAGpEC,IAAc,MACd,OAAOT,KAAU,WAEjBU,gBAAAA,EAAAA,KAAC,QAAA,EAAK,OAAOJ,GACV,UAAA;AAAA,MAAAN;AAAA,MACAO,KACCI,gBAAAA,EAAAA,IAAC,QAAA,EAAK,OAAO,EAAE,OAAO,WAAW,YAAY,SAAS,UAAA,IA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