@owp/core 2.5.1 → 2.5.3
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/_virtual/index10.js +2 -2
- package/dist/_virtual/index12.js +2 -2
- package/dist/_virtual/index13.js +2 -2
- package/dist/_virtual/index14.js +2 -2
- package/dist/_virtual/index15.js +2 -2
- package/dist/_virtual/index5.js +2 -2
- package/dist/components/{OwpFileUploadButton/OwpFileUploadButton.js → OwpFilePickerButton/OwpFilePickerButton.js} +15 -15
- package/dist/components/OwpFilePickerButton/OwpFilePickerButton.js.map +1 -0
- package/dist/components/OwpLanguageSwitcherSelect/OwpLanguageSwitcherSelect.js.map +1 -1
- package/dist/components/OwpMoreActionsButton/OwpMoreActionsButton.js +27 -27
- package/dist/components/OwpMoreActionsButton/OwpMoreActionsButton.js.map +1 -1
- package/dist/components/OwpMrtTable/OwpMrtTable.js +335 -317
- package/dist/components/OwpMrtTable/OwpMrtTable.js.map +1 -1
- package/dist/components/OwpPageBreadcrumb/OwpPageBreadcrumb.js +39 -32
- package/dist/components/OwpPageBreadcrumb/OwpPageBreadcrumb.js.map +1 -1
- package/dist/components/OwpTable/OwpDataTable.js +273 -251
- package/dist/components/OwpTable/OwpDataTable.js.map +1 -1
- package/dist/components/OwpTable/OwpTable.js +180 -159
- package/dist/components/OwpTable/OwpTable.js.map +1 -1
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js +267 -184
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
- package/dist/components/{OwpTreeGridExcelButton/OwpTreeGridExcelButton.js → OwpTreeGridExportExcelButton/OwpTreeGridExportExcelButton.js} +7 -7
- package/dist/components/OwpTreeGridExportExcelButton/OwpTreeGridExportExcelButton.js.map +1 -0
- package/dist/constants/gridTheme.js +28 -0
- package/dist/constants/gridTheme.js.map +1 -0
- package/dist/hooks/useFormDataUploadMutation.js +27 -0
- package/dist/hooks/useFormDataUploadMutation.js.map +1 -0
- package/dist/hooks.js +63 -61
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +28 -28
- package/dist/layout/components/navbar/NavbarToggleButton.js +21 -22
- package/dist/layout/components/navbar/NavbarToggleButton.js.map +1 -1
- package/dist/layout/components/navbar/style/NavbarStyle.js +41 -37
- package/dist/layout/components/navbar/style/NavbarStyle.js.map +1 -1
- package/dist/layout/components/toolbar/ToolbarLayout.js +57 -69
- package/dist/layout/components/toolbar/ToolbarLayout.js.map +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
- package/dist/owp-app.css +1 -1
- package/dist/types/components/{OwpFileUploadButton/OwpFileUploadButton.d.ts → OwpFilePickerButton/OwpFilePickerButton.d.ts} +4 -4
- package/dist/types/components/OwpFilePickerButton/index.d.ts +1 -0
- package/dist/types/components/OwpLanguageSwitcherSelect/OwpLanguageSwitcherSelect.d.ts +1 -1
- package/dist/types/components/OwpMoreActionsButton/OwpMoreActionsButton.d.ts +4 -4
- package/dist/types/components/OwpTable/OwpTable.d.ts +2 -0
- package/dist/types/components/OwpTreeGridExportExcelButton/OwpTreeGridExportExcelButton.d.ts +12 -0
- package/dist/types/components/OwpTreeGridExportExcelButton/index.d.ts +1 -0
- package/dist/types/constants/gridTheme.d.ts +30 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useFormDataUploadMutation.d.ts +30 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/types/OwpGridThemeTypes.d.ts +14 -0
- package/dist/types/types/OwpSettingsTypes.d.ts +2 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/utils/createFormDataBody.d.ts +20 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/zipUtil.d.ts +13 -0
- package/dist/utils/createFormDataBody.js +26 -0
- package/dist/utils/createFormDataBody.js.map +1 -0
- package/dist/utils/zipUtil.js +42 -29
- package/dist/utils/zipUtil.js.map +1 -1
- package/dist/utils.js +87 -82
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/OwpFileUploadButton/OwpFileUploadButton.js.map +0 -1
- package/dist/components/OwpTreeGridExcelButton/OwpTreeGridExcelButton.js.map +0 -1
- package/dist/types/components/OwpFileUploadButton/index.d.ts +0 -1
- package/dist/types/components/OwpTreeGridExcelButton/OwpTreeGridExcelButton.d.ts +0 -12
- package/dist/types/components/OwpTreeGridExcelButton/index.d.ts +0 -1
|
@@ -6,8 +6,21 @@ export interface SaveAsZipFileOptions {
|
|
|
6
6
|
type?: string;
|
|
7
7
|
fileExtension?: string;
|
|
8
8
|
fileTitle?: string;
|
|
9
|
+
archiveExtension?: string;
|
|
9
10
|
appendDatetime?: boolean;
|
|
10
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* ZIP 엔트리 텍스트 로드
|
|
14
|
+
* @param source ZIP 소스
|
|
15
|
+
* @param matcher 엔트리 식별자
|
|
16
|
+
*/
|
|
17
|
+
export declare const readZipEntryText: (source: Blob | ArrayBuffer, matcher: string | RegExp | ((fileName: string) => boolean)) => Promise<string | null>;
|
|
18
|
+
/**
|
|
19
|
+
* ZIP 엔트리 JSON 로드
|
|
20
|
+
* @param source ZIP 소스
|
|
21
|
+
* @param matcher 엔트리 식별자
|
|
22
|
+
*/
|
|
23
|
+
export declare const readZipEntryJson: <T>(source: Blob | ArrayBuffer, matcher: string | RegExp | ((fileName: string) => boolean)) => Promise<T | null>;
|
|
11
24
|
/**
|
|
12
25
|
* ZIP 파일 저장
|
|
13
26
|
* @param data 저장할 파일 데이터
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var o = (t, e) => i(t, "name", { value: e, configurable: !0 });
|
|
3
|
+
import { isObject as a } from "../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isObject.js";
|
|
4
|
+
import { isArray as c } from "../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isArray.js";
|
|
5
|
+
const f = "FILE_NAME", m = /* @__PURE__ */ o((t) => a(t) && !c(t), "isFormDataUploadBody"), s = /* @__PURE__ */ o((t, e) => {
|
|
6
|
+
if (e)
|
|
7
|
+
return e;
|
|
8
|
+
const r = t.PAGEID, n = t.TABLENAME;
|
|
9
|
+
return typeof r == "string" && r && typeof n == "string" && n ? `${r}_${n}` : f;
|
|
10
|
+
}, "resolveFileNameFieldName"), N = /* @__PURE__ */ o((t, e = {}) => {
|
|
11
|
+
const r = s(t, e.fileNameFieldName);
|
|
12
|
+
return t[r] != null ? t : {
|
|
13
|
+
...t,
|
|
14
|
+
[r]: t.file.name.normalize("NFC")
|
|
15
|
+
};
|
|
16
|
+
}, "normalizeFormDataUploadParams"), A = /* @__PURE__ */ o((t) => {
|
|
17
|
+
const e = new FormData();
|
|
18
|
+
return m(t) && Object.entries(t).forEach(([r, n]) => {
|
|
19
|
+
n !== void 0 && e.append(r, n instanceof Blob ? n : String(n));
|
|
20
|
+
}), e;
|
|
21
|
+
}, "createFormDataBody");
|
|
22
|
+
export {
|
|
23
|
+
A as createFormDataBody,
|
|
24
|
+
N as normalizeFormDataUploadParams
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=createFormDataBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFormDataBody.js","sources":["../../src/utils/createFormDataBody.ts"],"sourcesContent":["import { isArray, isObject } from 'es-toolkit/compat';\n\nexport type FormDataFieldValue = string | number | Blob | undefined;\nexport type TAdditionalFields = Record<string, FormDataFieldValue>;\n\nexport type FormDataUploadParams<TFields extends TAdditionalFields = TAdditionalFields> = {\n file: File;\n} & Omit<TFields, 'file'>;\n\nexport type FormDataUploadBody<TFields extends TAdditionalFields = TAdditionalFields> = Record<\n string,\n FormDataFieldValue\n> &\n FormDataUploadParams<TFields>;\n\nexport interface NormalizeFormDataUploadParamsOptions {\n fileNameFieldName?: string;\n}\n\nconst DEFAULT_FILE_NAME_FIELD_NAME = 'FILE_NAME';\n\nconst isFormDataUploadBody = (body: unknown): body is FormDataUploadBody =>\n isObject(body) && !isArray(body);\n\nconst resolveFileNameFieldName = <\n TFields extends TAdditionalFields = TAdditionalFields,\n>(\n params: FormDataUploadParams<TFields>,\n fileNameFieldName?: string,\n) => {\n if (fileNameFieldName) {\n return fileNameFieldName;\n }\n\n const pageId = params['PAGEID' as keyof typeof params];\n const tableName = params['TABLENAME' as keyof typeof params];\n\n if (typeof pageId === 'string' && pageId && typeof tableName === 'string' && tableName) {\n return `${pageId}_${tableName}`;\n }\n\n return DEFAULT_FILE_NAME_FIELD_NAME;\n};\n\n/**\n * FormData 업로드 파라미터 정규화\n * @param params 업로드 파라미터\n * @param options 파일명 필드 옵션\n */\nexport const normalizeFormDataUploadParams = <\n TFields extends TAdditionalFields = TAdditionalFields,\n>(\n params: FormDataUploadParams<TFields>,\n options: NormalizeFormDataUploadParamsOptions = {},\n) => {\n const nextFileNameFieldName = resolveFileNameFieldName(params, options.fileNameFieldName);\n\n if (params[nextFileNameFieldName as keyof typeof params] != null) {\n return params as FormDataUploadBody<TFields>;\n }\n\n return {\n ...params,\n [nextFileNameFieldName]: params.file.name.normalize('NFC'),\n } as FormDataUploadBody<TFields>;\n};\n\n/**\n * FormData body 생성\n * @param body flat body 객체\n */\nexport const createFormDataBody = (body: unknown) => {\n const formData = new FormData();\n\n if (!isFormDataUploadBody(body)) {\n return formData;\n }\n\n Object.entries(body).forEach(([name, value]) => {\n if (value === undefined) {\n return;\n }\n\n formData.append(name, value instanceof Blob ? value : String(value));\n });\n\n return formData;\n};\n"],"names":["DEFAULT_FILE_NAME_FIELD_NAME","isFormDataUploadBody","__name","body","isObject","isArray","resolveFileNameFieldName","params","fileNameFieldName","pageId","tableName","normalizeFormDataUploadParams","options","nextFileNameFieldName","createFormDataBody","formData","name","value"],"mappings":";;;;AAmBA,MAAMA,IAA+B,aAE/BC,IAAuB,gBAAAC,EAAA,CAACC,MAC5BC,EAASD,CAAI,KAAK,CAACE,EAAQF,CAAI,GADJ,yBAGvBG,IAA2B,gBAAAJ,EAAA,CAG/BK,GACAC,MACG;AACH,MAAIA;AACF,WAAOA;AAGT,QAAMC,IAASF,EAAO,QAChBG,IAAYH,EAAO;AAEzB,SAAI,OAAOE,KAAW,YAAYA,KAAU,OAAOC,KAAc,YAAYA,IACpE,GAAGD,CAAM,IAAIC,CAAS,KAGxBV;AACT,GAlBiC,6BAyBpBW,IAAgC,gBAAAT,EAAA,CAG3CK,GACAK,IAAgD,OAC7C;AACH,QAAMC,IAAwBP,EAAyBC,GAAQK,EAAQ,iBAAiB;AAExF,SAAIL,EAAOM,CAA4C,KAAK,OACnDN,IAGF;AAAA,IACL,GAAGA;AAAA,IACH,CAACM,CAAqB,GAAGN,EAAO,KAAK,KAAK,UAAU,KAAK;AAAA,EAAA;AAE7D,GAhB6C,kCAsBhCO,IAAqB,gBAAAZ,EAAA,CAACC,MAAkB;AACnD,QAAMY,IAAW,IAAI,SAAA;AAErB,SAAKd,EAAqBE,CAAI,KAI9B,OAAO,QAAQA,CAAI,EAAE,QAAQ,CAAC,CAACa,GAAMC,CAAK,MAAM;AAC9C,IAAIA,MAAU,UAIdF,EAAS,OAAOC,GAAMC,aAAiB,OAAOA,IAAQ,OAAOA,CAAK,CAAC;AAAA,EACrE,CAAC,GAEMF;AACT,GAhBkC;"}
|
package/dist/utils/zipUtil.js
CHANGED
|
@@ -1,56 +1,69 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
import
|
|
4
|
-
import { t as
|
|
5
|
-
import { enqueueSnackbar as
|
|
6
|
-
import { loadJSZip as
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var i = (e, t) => E(e, "name", { value: t, configurable: !0 });
|
|
3
|
+
import d from "dayjs";
|
|
4
|
+
import { t as m } from "i18next";
|
|
5
|
+
import { enqueueSnackbar as x } from "notistack";
|
|
6
|
+
import { loadJSZip as u } from "./jszipBrowser.js";
|
|
7
7
|
const l = {
|
|
8
8
|
type: "pdf",
|
|
9
9
|
fileExtension: "application/pdf",
|
|
10
10
|
fileTitle: "archive",
|
|
11
|
+
archiveExtension: "zip",
|
|
11
12
|
appendDatetime: !1
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}, y = /* @__PURE__ */ i((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "_"), "sanitizeFileName"), s = /* @__PURE__ */ i((e) => {
|
|
14
|
+
x(
|
|
15
|
+
m(`Message.${e}`, {
|
|
15
16
|
defaultValue: e
|
|
16
17
|
}),
|
|
17
18
|
{ variant: "warning" }
|
|
18
19
|
);
|
|
19
|
-
}, "showZipWarning"),
|
|
20
|
+
}, "showZipWarning"), o = /* @__PURE__ */ i((e) => ({
|
|
20
21
|
type: (e == null ? void 0 : e.type) ?? l.type,
|
|
21
22
|
fileExtension: (e == null ? void 0 : e.fileExtension) ?? l.fileExtension,
|
|
22
23
|
fileTitle: (e == null ? void 0 : e.fileTitle) ?? l.fileTitle,
|
|
24
|
+
archiveExtension: (e == null ? void 0 : e.archiveExtension) ?? l.archiveExtension,
|
|
23
25
|
appendDatetime: (e == null ? void 0 : e.appendDatetime) ?? l.appendDatetime
|
|
24
|
-
}), "normalizeZipOptions"),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
}), "normalizeZipOptions"), v = /* @__PURE__ */ i((e, t, n) => `${y(`${e + 1}_${t}`)}.${n}`, "createZipEntryFileName"), Z = /* @__PURE__ */ i((e) => e.replace(/^\.+/, "") || l.archiveExtension, "normalizeArchiveExtension"), w = /* @__PURE__ */ i((e, t, n) => `${y(e)}${t ? `-${d().format("YYYY_MM_DD_HH_mm_ss")}` : ""}.${Z(n)}`, "createArchiveFileName"), h = /* @__PURE__ */ i((e, t) => typeof t == "string" ? e === t : t instanceof RegExp ? t.test(e) : t(e), "isMatchedZipEntry"), $ = /* @__PURE__ */ i(async (e) => e instanceof Blob ? e.arrayBuffer() : e, "toZipArrayBuffer"), _ = /* @__PURE__ */ i(async (e, t) => {
|
|
27
|
+
const a = await (await u()).loadAsync(await $(e)), r = Object.values(a.files).find(
|
|
28
|
+
(c) => !c.dir && h(c.name, t)
|
|
29
|
+
);
|
|
30
|
+
return r ? r.async("string") : null;
|
|
31
|
+
}, "readZipEntryText"), A = /* @__PURE__ */ i(async (e, t) => {
|
|
32
|
+
const n = await _(e, t);
|
|
33
|
+
return n ? JSON.parse(n) : null;
|
|
34
|
+
}, "readZipEntryJson"), z = /* @__PURE__ */ i((e, t, n) => {
|
|
35
|
+
t.forEach(({ blob: a, fileName: r }, c) => {
|
|
36
|
+
a && e.file(
|
|
37
|
+
v(c, r, n.fileExtension),
|
|
38
|
+
new Blob([a], { type: n.type })
|
|
29
39
|
);
|
|
30
40
|
});
|
|
31
|
-
}, "appendZipFiles"),
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
34
|
-
|
|
41
|
+
}, "appendZipFiles"), S = /* @__PURE__ */ i(async (e, t) => {
|
|
42
|
+
const n = o(t);
|
|
43
|
+
if (!n.type) {
|
|
44
|
+
s("type 이 선언되지 않았습니다");
|
|
35
45
|
return;
|
|
36
46
|
}
|
|
37
|
-
if (!
|
|
38
|
-
|
|
47
|
+
if (!n.fileExtension) {
|
|
48
|
+
s("파일 확장자가 선언되지 않았습니다");
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
51
|
if (!e) {
|
|
42
|
-
|
|
52
|
+
s("다운로드할 데이터가 없습니다");
|
|
43
53
|
return;
|
|
44
54
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const c = await
|
|
48
|
-
f.href = p, f.download =
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
const a = await u(), r = new a();
|
|
56
|
+
z(r, e, n);
|
|
57
|
+
const c = await r.generateAsync({ type: "blob" }), p = URL.createObjectURL(c), f = document.createElement("a");
|
|
58
|
+
f.href = p, f.download = w(
|
|
59
|
+
n.fileTitle,
|
|
60
|
+
n.appendDatetime,
|
|
61
|
+
n.archiveExtension
|
|
51
62
|
), f.click(), URL.revokeObjectURL(p);
|
|
52
63
|
}, "saveAsZipFile");
|
|
53
64
|
export {
|
|
54
|
-
|
|
65
|
+
A as readZipEntryJson,
|
|
66
|
+
_ as readZipEntryText,
|
|
67
|
+
S as saveAsZipFile
|
|
55
68
|
};
|
|
56
69
|
//# sourceMappingURL=zipUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zipUtil.js","sources":["../../src/utils/zipUtil.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { t } from 'i18next';\nimport type JSZip from 'jszip';\nimport { enqueueSnackbar } from 'notistack';\nimport { loadJSZip } from './jszipBrowser';\n\ntype BlobInfoData = {\n blob: Blob;\n fileName: string;\n};\n\nexport interface SaveAsZipFileOptions {\n type?: string;\n fileExtension?: string;\n fileTitle?: string;\n appendDatetime?: boolean;\n}\n\nconst DEFAULT_ZIP_OPTIONS: Required<SaveAsZipFileOptions> = {\n type: 'pdf',\n fileExtension: 'application/pdf',\n fileTitle: 'archive',\n appendDatetime: false,\n};\n\n/**\n * 파일명 안전 문자 변환\n * @param fileName 원본 파일명\n */\nconst sanitizeFileName = (fileName: string) => fileName.replace(/[.*+?^${}()|[\\]\\\\]/g, '_');\n\n/**\n * ZIP 경고 메시지 출력\n * @param message 경고 메시지\n */\nconst showZipWarning = (message: string) => {\n enqueueSnackbar(\n t(`Message.${message}`, {\n defaultValue: message,\n }),\n { variant: 'warning' },\n );\n};\n\n/**\n * ZIP 저장 옵션 정규화\n * @param options 저장 옵션\n */\nconst normalizeZipOptions = (options?: SaveAsZipFileOptions) => {\n return {\n type: options?.type ?? DEFAULT_ZIP_OPTIONS.type,\n fileExtension: options?.fileExtension ?? DEFAULT_ZIP_OPTIONS.fileExtension,\n fileTitle: options?.fileTitle ?? DEFAULT_ZIP_OPTIONS.fileTitle,\n appendDatetime: options?.appendDatetime ?? DEFAULT_ZIP_OPTIONS.appendDatetime,\n };\n};\n\n/**\n * ZIP 내부 파일명 생성\n * @param index 파일 순서\n * @param fileName 파일명\n * @param fileExtension 파일 확장자\n */\nconst createZipEntryFileName = (index: number, fileName: string, fileExtension: string) => {\n return `${sanitizeFileName(`${index + 1}_${fileName}`)}.${fileExtension}`;\n};\n\n/**\n * ZIP 다운로드 파일명 생성\n * @param fileTitle 파일 제목\n * @param appendDatetime 일시 추가 여부\n */\nconst createArchiveFileName = (fileTitle: string
|
|
1
|
+
{"version":3,"file":"zipUtil.js","sources":["../../src/utils/zipUtil.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { t } from 'i18next';\nimport type JSZip from 'jszip';\nimport { enqueueSnackbar } from 'notistack';\nimport { loadJSZip } from './jszipBrowser';\n\ntype BlobInfoData = {\n blob: Blob;\n fileName: string;\n};\n\nexport interface SaveAsZipFileOptions {\n type?: string;\n fileExtension?: string;\n fileTitle?: string;\n archiveExtension?: string;\n appendDatetime?: boolean;\n}\n\nconst DEFAULT_ZIP_OPTIONS: Required<SaveAsZipFileOptions> = {\n type: 'pdf',\n fileExtension: 'application/pdf',\n fileTitle: 'archive',\n archiveExtension: 'zip',\n appendDatetime: false,\n};\n\n/**\n * 파일명 안전 문자 변환\n * @param fileName 원본 파일명\n */\nconst sanitizeFileName = (fileName: string) => fileName.replace(/[.*+?^${}()|[\\]\\\\]/g, '_');\n\n/**\n * ZIP 경고 메시지 출력\n * @param message 경고 메시지\n */\nconst showZipWarning = (message: string) => {\n enqueueSnackbar(\n t(`Message.${message}`, {\n defaultValue: message,\n }),\n { variant: 'warning' },\n );\n};\n\n/**\n * ZIP 저장 옵션 정규화\n * @param options 저장 옵션\n */\nconst normalizeZipOptions = (options?: SaveAsZipFileOptions) => {\n return {\n type: options?.type ?? DEFAULT_ZIP_OPTIONS.type,\n fileExtension: options?.fileExtension ?? DEFAULT_ZIP_OPTIONS.fileExtension,\n fileTitle: options?.fileTitle ?? DEFAULT_ZIP_OPTIONS.fileTitle,\n archiveExtension: options?.archiveExtension ?? DEFAULT_ZIP_OPTIONS.archiveExtension,\n appendDatetime: options?.appendDatetime ?? DEFAULT_ZIP_OPTIONS.appendDatetime,\n };\n};\n\n/**\n * ZIP 내부 파일명 생성\n * @param index 파일 순서\n * @param fileName 파일명\n * @param fileExtension 파일 확장자\n */\nconst createZipEntryFileName = (index: number, fileName: string, fileExtension: string) => {\n return `${sanitizeFileName(`${index + 1}_${fileName}`)}.${fileExtension}`;\n};\n\n/**\n * ZIP 다운로드 파일명 생성\n * @param fileTitle 파일 제목\n * @param appendDatetime 일시 추가 여부\n */\nconst normalizeArchiveExtension = (archiveExtension: string) => {\n return archiveExtension.replace(/^\\.+/, '') || DEFAULT_ZIP_OPTIONS.archiveExtension;\n};\n\n/**\n * ZIP 다운로드 파일명 생성\n * @param fileTitle 파일 제목\n * @param appendDatetime 일시 추가 여부\n * @param archiveExtension 아카이브 확장자\n */\nconst createArchiveFileName = (\n fileTitle: string,\n appendDatetime: boolean,\n archiveExtension: string,\n) => {\n return `${sanitizeFileName(fileTitle)}${appendDatetime ? `-${dayjs().format('YYYY_MM_DD_HH_mm_ss')}` : ''}.${normalizeArchiveExtension(archiveExtension)}`;\n};\n\n/**\n * ZIP 엔트리 일치 여부 확인\n * @param fileName ZIP 엔트리 파일명\n * @param matcher 엔트리 식별자\n */\nconst isMatchedZipEntry = (\n fileName: string,\n matcher: string | RegExp | ((fileName: string) => boolean),\n) => {\n if (typeof matcher === 'string') {\n return fileName === matcher;\n }\n\n if (matcher instanceof RegExp) {\n return matcher.test(fileName);\n }\n\n return matcher(fileName);\n};\n\n/**\n * ZIP 소스 ArrayBuffer 변환\n * @param source ZIP 소스\n */\nconst toZipArrayBuffer = async (source: Blob | ArrayBuffer) => {\n return source instanceof Blob ? source.arrayBuffer() : source;\n};\n\n/**\n * ZIP 엔트리 텍스트 로드\n * @param source ZIP 소스\n * @param matcher 엔트리 식별자\n */\nexport const readZipEntryText = async (\n source: Blob | ArrayBuffer,\n matcher: string | RegExp | ((fileName: string) => boolean),\n): Promise<string | null> => {\n const JSZip = await loadJSZip();\n const zip = await JSZip.loadAsync(await toZipArrayBuffer(source));\n const zipFile = Object.values(zip.files).find(\n (entry) => !entry.dir && isMatchedZipEntry(entry.name, matcher),\n );\n\n if (!zipFile) {\n return null;\n }\n\n return zipFile.async('string');\n};\n\n/**\n * ZIP 엔트리 JSON 로드\n * @param source ZIP 소스\n * @param matcher 엔트리 식별자\n */\nexport const readZipEntryJson = async <T>(\n source: Blob | ArrayBuffer,\n matcher: string | RegExp | ((fileName: string) => boolean),\n): Promise<T | null> => {\n const text = await readZipEntryText(source, matcher);\n\n if (!text) {\n return null;\n }\n\n return JSON.parse(text) as T;\n};\n\n/**\n * ZIP 파일 데이터 추가\n * @param zip ZIP 인스턴스\n * @param data 파일 데이터 목록\n * @param options ZIP 저장 옵션\n */\nconst appendZipFiles = (\n zip: JSZip,\n data: BlobInfoData[],\n options: Required<SaveAsZipFileOptions>,\n) => {\n data.forEach(({ blob, fileName }, index) => {\n if (!blob) {\n return;\n }\n\n zip.file(\n createZipEntryFileName(index, fileName, options.fileExtension),\n new Blob([blob], { type: options.type }),\n );\n });\n};\n\n/**\n * ZIP 파일 저장\n * @param data 저장할 파일 데이터\n * @param options 저장 옵션\n */\nexport const saveAsZipFile = async (\n data: BlobInfoData[],\n options?: SaveAsZipFileOptions,\n) => {\n const normalizedOptions = normalizeZipOptions(options);\n\n if (!normalizedOptions.type) {\n showZipWarning('type 이 선언되지 않았습니다');\n return;\n }\n\n if (!normalizedOptions.fileExtension) {\n showZipWarning('파일 확장자가 선언되지 않았습니다');\n return;\n }\n\n if (!data) {\n showZipWarning('다운로드할 데이터가 없습니다');\n return;\n }\n\n const JSZip = await loadJSZip();\n const zip = new JSZip();\n appendZipFiles(zip, data, normalizedOptions);\n\n const archiveFiles = await zip.generateAsync({ type: 'blob' });\n const url = URL.createObjectURL(archiveFiles);\n const link = document.createElement('a');\n link.href = url;\n link.download = createArchiveFileName(\n normalizedOptions.fileTitle,\n normalizedOptions.appendDatetime,\n normalizedOptions.archiveExtension,\n );\n link.click();\n URL.revokeObjectURL(url);\n};\n"],"names":["DEFAULT_ZIP_OPTIONS","sanitizeFileName","__name","fileName","showZipWarning","message","enqueueSnackbar","t","normalizeZipOptions","options","createZipEntryFileName","index","fileExtension","normalizeArchiveExtension","archiveExtension","createArchiveFileName","fileTitle","appendDatetime","dayjs","isMatchedZipEntry","matcher","toZipArrayBuffer","source","readZipEntryText","zip","loadJSZip","zipFile","entry","readZipEntryJson","text","appendZipFiles","data","blob","saveAsZipFile","normalizedOptions","JSZip","archiveFiles","url","link"],"mappings":"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"}
|
package/dist/utils.js
CHANGED
|
@@ -1,88 +1,93 @@
|
|
|
1
1
|
import { generateBarcodeUrl as o } from "./utils/barcodeUtil.js";
|
|
2
|
-
import { buildTreeGridEnumAttributesByCommonCodeList as d, transformCommonCodeBasedOnGroupId as
|
|
3
|
-
import { createDateRangeSearchParams as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
2
|
+
import { buildTreeGridEnumAttributesByCommonCodeList as d, transformCommonCodeBasedOnGroupId as a, transformGridEnumByCommonCodeList as m } from "./utils/commonCodeUtils.js";
|
|
3
|
+
import { createDateRangeSearchParams as s } from "./utils/createDateRangeSearchParams.js";
|
|
4
|
+
import { createFormDataBody as p, normalizeFormDataUploadParams as n } from "./utils/createFormDataBody.js";
|
|
5
|
+
import { createJsonBody as x } from "./utils/createJsonBody.js";
|
|
6
|
+
import { createJsonString as f } from "./utils/createJsonString.js";
|
|
7
|
+
import { exportExcelByBuffer as L, getIndexByLetters as g, getLettersByIndex as G, setCellValue as y, setMergeCells as C } from "./utils/excelUtil.js";
|
|
8
|
+
import { fetchFile as B } from "./utils/fetchFile.js";
|
|
9
|
+
import { formatDateToYmd as R, getTodayYmd as D } from "./utils/formatDateToYmd.js";
|
|
10
|
+
import { formatNumber as F } from "./utils/formatNumber.js";
|
|
11
|
+
import { getDisplayValue as O } from "./utils/getDisplayValue.js";
|
|
12
|
+
import { getEstimatedTextCellWidth as H } from "./utils/getEstimatedTextCellWidth.js";
|
|
13
|
+
import { getFormDefaultValues as h } from "./utils/getFormDefaultValues.js";
|
|
14
|
+
import { getStartPagePath as S } from "./utils/getStartPagePath.js";
|
|
15
|
+
import { getTrimmedValue as w } from "./utils/getTrimmedValue.js";
|
|
16
|
+
import { isEnterKeyEvent as M } from "./utils/isEnterKeyEvent.js";
|
|
17
|
+
import { getApiLanguageCode as J, getI18nextLanguageCode as W } from "./utils/language.js";
|
|
18
|
+
import { formatTimeInputToHourMinute as v, normalizeTimeToHourMinute as Y } from "./utils/normalizeTimeToHourMinute.js";
|
|
19
|
+
import { preloadOnIdle as Q } from "./utils/preloadOnIdle.js";
|
|
20
|
+
import { generateQrCodeUrl as k } from "./utils/qrCodeUtil.js";
|
|
21
|
+
import { rebuildValue as X } from "./utils/rebuildValue.js";
|
|
22
|
+
import { sanitizePasswordValue as ee, sanitizeUserIdValue as re } from "./utils/sanitizeAuthInputValue.js";
|
|
23
|
+
import { exportTreeGridExcel as te } from "./utils/treeGridExportExcelUtil.js";
|
|
24
|
+
import { addTreeGridRowById as ae, exportTreeGridToExcelById as me, getTreeGridById as ie, getTreeGridDataRowsById as se, getTreeGridRowChangesById as Te, getTreeGridSelectedRowsById as pe, highlightTreeGridCellById as ne, reloadTreeGridBodyById as le, resetTreeGridChangesById as xe, resetTreeGridChangesByIds as Ee, resetTreeGridSelectionById as fe, resetTreeGridSelectionsByIds as Ie, setTreeGridColumnEnumOptionsById as Le, setTreeGridColumnVisibilityById as ge } from "./utils/treeGridUtil.js";
|
|
25
|
+
import { readZipEntryJson as ye, readZipEntryText as Ce, saveAsZipFile as ue } from "./utils/zipUtil.js";
|
|
26
|
+
import { OwpUtils as _e } from "./utils/common/OwpUtils.js";
|
|
27
|
+
import { DEFAULT_CELL_ALIGNMENT as De, DEFAULT_HEADER_FILL as Ae, DEFAULT_HEADER_FONT as Fe, DEFAULT_THIN_BORDER as ce, DEFAULT_VALUE_FONT as Oe, DEFAULT_WRAP_CELL_ALIGNMENT as Ue } from "./constants/excel.js";
|
|
28
|
+
import { TREEGRID_CELL_HIGHLIGHT_CLASS as Ne, TREEGRID_CELL_HIGHLIGHT_COLOR as he, TREEGRID_INPUT_CELL_COLOR as Ve, TREEGRID_WARNING_CELL_COLOR as Se } from "./constants/treeGrid.js";
|
|
28
29
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
De as DEFAULT_CELL_ALIGNMENT,
|
|
31
|
+
Ae as DEFAULT_HEADER_FILL,
|
|
32
|
+
Fe as DEFAULT_HEADER_FONT,
|
|
33
|
+
ce as DEFAULT_THIN_BORDER,
|
|
34
|
+
Oe as DEFAULT_VALUE_FONT,
|
|
35
|
+
Ue as DEFAULT_WRAP_CELL_ALIGNMENT,
|
|
36
|
+
_e as OwpUtils,
|
|
37
|
+
Ne as TREEGRID_CELL_HIGHLIGHT_CLASS,
|
|
38
|
+
he as TREEGRID_CELL_HIGHLIGHT_COLOR,
|
|
39
|
+
Ve as TREEGRID_INPUT_CELL_COLOR,
|
|
40
|
+
Se as TREEGRID_WARNING_CELL_COLOR,
|
|
41
|
+
ae as addTreeGridRowById,
|
|
41
42
|
d as buildTreeGridEnumAttributesByCommonCodeList,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
te as
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
R as
|
|
51
|
-
|
|
43
|
+
s as createDateRangeSearchParams,
|
|
44
|
+
p as createFormDataBody,
|
|
45
|
+
x as createJsonBody,
|
|
46
|
+
f as createJsonString,
|
|
47
|
+
L as exportExcelByBuffer,
|
|
48
|
+
te as exportTreeGridExcel,
|
|
49
|
+
me as exportTreeGridToExcelById,
|
|
50
|
+
B as fetchFile,
|
|
51
|
+
R as formatDateToYmd,
|
|
52
|
+
F as formatNumber,
|
|
53
|
+
v as formatTimeInputToHourMinute,
|
|
52
54
|
o as generateBarcodeUrl,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Y as
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
xe as
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
55
|
+
k as generateQrCodeUrl,
|
|
56
|
+
J as getApiLanguageCode,
|
|
57
|
+
O as getDisplayValue,
|
|
58
|
+
H as getEstimatedTextCellWidth,
|
|
59
|
+
h as getFormDefaultValues,
|
|
60
|
+
W as getI18nextLanguageCode,
|
|
61
|
+
g as getIndexByLetters,
|
|
62
|
+
G as getLettersByIndex,
|
|
63
|
+
S as getStartPagePath,
|
|
64
|
+
D as getTodayYmd,
|
|
65
|
+
ie as getTreeGridById,
|
|
66
|
+
se as getTreeGridDataRowsById,
|
|
67
|
+
Te as getTreeGridRowChangesById,
|
|
68
|
+
pe as getTreeGridSelectedRowsById,
|
|
69
|
+
w as getTrimmedValue,
|
|
70
|
+
ne as highlightTreeGridCellById,
|
|
71
|
+
M as isEnterKeyEvent,
|
|
72
|
+
n as normalizeFormDataUploadParams,
|
|
73
|
+
Y as normalizeTimeToHourMinute,
|
|
74
|
+
Q as preloadOnIdle,
|
|
75
|
+
ye as readZipEntryJson,
|
|
76
|
+
Ce as readZipEntryText,
|
|
77
|
+
X as rebuildValue,
|
|
78
|
+
le as reloadTreeGridBodyById,
|
|
79
|
+
xe as resetTreeGridChangesById,
|
|
80
|
+
Ee as resetTreeGridChangesByIds,
|
|
81
|
+
fe as resetTreeGridSelectionById,
|
|
82
|
+
Ie as resetTreeGridSelectionsByIds,
|
|
83
|
+
ee as sanitizePasswordValue,
|
|
84
|
+
re as sanitizeUserIdValue,
|
|
85
|
+
ue as saveAsZipFile,
|
|
86
|
+
y as setCellValue,
|
|
87
|
+
C as setMergeCells,
|
|
88
|
+
Le as setTreeGridColumnEnumOptionsById,
|
|
89
|
+
ge as setTreeGridColumnVisibilityById,
|
|
90
|
+
a as transformCommonCodeBasedOnGroupId,
|
|
91
|
+
m as transformGridEnumByCommonCodeList
|
|
87
92
|
};
|
|
88
93
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OwpFileUploadButton.js","sources":["../../../src/components/OwpFileUploadButton/OwpFileUploadButton.tsx"],"sourcesContent":["import Button, { type ButtonProps } from '@mui/material/Button';\nimport { styled } from '@mui/material/styles';\nimport { type ChangeEvent, type ReactNode, useEffect, useRef } from 'react';\n\nexport interface OwpFileUploadButtonOwnProps {\n multiple?: boolean;\n accept?: string;\n title?: ReactNode;\n onChange?: (evt: ChangeEvent<HTMLInputElement>) => void;\n onCancel?: (evt: Event) => void;\n}\n\nexport type OwpFileUploadButtonProps = OwpFileUploadButtonOwnProps &\n Omit<ButtonProps, 'title'>;\n\nconst DEFAULT_ACCEPT = 'image/x-png,image/gif,image/jpeg,image/jpg';\n\nconst VisuallyHiddenInput = styled('input')({\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: 1,\n overflow: 'hidden',\n position: 'absolute',\n bottom: 0,\n left: 0,\n whiteSpace: 'nowrap',\n width: 1,\n});\n\n/**\n * OwpFileUploadButton 컴포넌트\n * @param title 제목\n * @param multiple multiple 값\n * @param onChange onChange 핸들러\n * @param onCancel onCancel 핸들러\n * @param accept accept 값\n */\nexport function OwpFileUploadButton({\n title,\n multiple,\n onChange,\n onCancel,\n accept,\n ...restProps\n}: OwpFileUploadButtonProps) {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const buttonProps = restProps as unknown as Omit<ButtonProps<'label'>, 'children' | 'component'>;\n\n useEffect(() => {\n const inputElement = inputRef.current;\n if (!inputElement || !onCancel) {\n return;\n }\n\n inputElement.addEventListener('cancel', onCancel);\n\n return () => {\n inputElement.removeEventListener('cancel', onCancel);\n };\n }, [onCancel]);\n\n return (\n <Button\n component=\"label\"\n role={undefined}\n variant=\"contained\"\n tabIndex={-1}\n {...buttonProps}\n >\n {title}\n <VisuallyHiddenInput\n ref={inputRef}\n type=\"file\"\n accept={accept ?? DEFAULT_ACCEPT}\n onClick={(event) => {\n event.currentTarget.value = '';\n }}\n onChange={(event) => onChange?.(event)}\n multiple={Boolean(multiple)}\n />\n </Button>\n );\n}\n"],"names":["DEFAULT_ACCEPT","VisuallyHiddenInput","styled","OwpFileUploadButton","title","multiple","onChange","onCancel","accept","restProps","inputRef","useRef","buttonProps","useEffect","inputElement","jsxs","Button","jsx","__name","event"],"mappings":";;;;;;AAeA,MAAMA,IAAiB,8CAEjBC,IAAsBC,EAAO,OAAO,EAAE;AAAA,EAC1C,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,OAAO;AACT,CAAC;AAUM,SAASC,EAAoB;AAAA,EAClC,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,GAA6B;AAC3B,QAAMC,IAAWC,EAAgC,IAAI,GAC/CC,IAAcH;AAEpB,SAAAI,EAAU,MAAM;AACd,UAAMC,IAAeJ,EAAS;AAC9B,QAAI,GAACI,KAAgB,CAACP;AAItB,aAAAO,EAAa,iBAAiB,UAAUP,CAAQ,GAEzC,MAAM;AACX,QAAAO,EAAa,oBAAoB,UAAUP,CAAQ;AAAA,MACrD;AAAA,EACF,GAAG,CAACA,CAAQ,CAAC,GAGX,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAQ;AAAA,MACR,UAAU;AAAA,MACT,GAAGJ;AAAA,MAEH,UAAA;AAAA,QAAAR;AAAA,QACD,gBAAAa;AAAA,UAAChB;AAAA,UAAA;AAAA,YACC,KAAKS;AAAA,YACL,MAAK;AAAA,YACL,QAAQF,KAAUR;AAAA,YAClB,SAAS,gBAAAkB,EAAA,CAACC,MAAU;AAClB,cAAAA,EAAM,cAAc,QAAQ;AAAA,YAC9B,GAFS;AAAA,YAGT,UAAU,gBAAAD,EAAA,CAACC,MAAUb,KAAA,gBAAAA,EAAWa,IAAtB;AAAA,YACV,UAAU,EAAQd;AAAA,UAAQ;AAAA,QAAA;AAAA,MAC5B;AAAA,IAAA;AAAA,EAAA;AAGN;AA7CgBa,EAAAf,GAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OwpTreeGridExcelButton.js","sources":["../../../src/components/OwpTreeGridExcelButton/OwpTreeGridExcelButton.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport { useTreeGridExcelExport } from '@/hooks/useTreeGridExcelExport';\nimport { Button, type ButtonProps } from '@mui/material';\nimport { type MouseEventHandler } from 'react';\n\nexport interface OwpTreeGridExcelButtonProps extends ButtonProps {\n gridId: string;\n exportName?: string;\n}\n\n/**\n * TreeGrid 엑셀 내보내기 버튼\n * @param gridId TreeGrid 인스턴스 ID\n * @param exportName 다운로드 파일명\n */\nconst OwpTreeGridExcelButton = ({\n gridId,\n exportName,\n children,\n loading,\n loadingPosition,\n onClick,\n ...buttonProps\n}: OwpTreeGridExcelButtonProps) => {\n const { t } = useOwpTranslation();\n const { exportByTreeGrid, isExporting } = useTreeGridExcelExport(gridId);\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n onClick?.(event);\n\n if (event.defaultPrevented || loading || isExporting) {\n return;\n }\n\n void exportByTreeGrid(exportName ?? gridId);\n };\n\n return (\n <Button\n variant=\"contained\"\n color=\"success\"\n {...buttonProps}\n loading={Boolean(loading || isExporting)}\n loadingPosition={loadingPosition ?? 'start'}\n onClick={handleClick}\n >\n {children ?? t('Button.엑셀 다운로드')}\n </Button>\n );\n};\n\nexport { OwpTreeGridExcelButton };\n"],"names":["OwpTreeGridExcelButton","__name","gridId","exportName","children","loading","loadingPosition","onClick","buttonProps","t","useOwpTranslation","exportByTreeGrid","isExporting","useTreeGridExcelExport","jsx","Button","event"],"mappings":";;;;;;AAeA,MAAMA,IAAyB,gBAAAC,EAAA,CAAC;AAAA,EAC9B,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,MAAmC;AACjC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,EAAE,kBAAAC,GAAkB,aAAAC,MAAgBC,EAAuBX,CAAM;AAYvE,SACE,gBAAAY;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,OAAM;AAAA,MACL,GAAGP;AAAA,MACJ,SAAS,GAAQH,KAAWO;AAAA,MAC5B,iBAAiBN,KAAmB;AAAA,MACpC,SAjBsD,gBAAAL,EAAA,CAACe,MAAU;AAGnE,QAFAT,KAAA,QAAAA,EAAUS,IAEN,EAAAA,EAAM,oBAAoBX,KAAWO,MAIpCD,EAAiBR,KAAcD,CAAM;AAAA,MAC5C,GAR0D;AAAA,MAmBrD,UAAAE,KAAYK,EAAE,gBAAgB;AAAA,IAAA;AAAA,EAAA;AAGrC,GAlC+B;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './OwpFileUploadButton';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ButtonProps } from '@mui/material';
|
|
2
|
-
export interface OwpTreeGridExcelButtonProps extends ButtonProps {
|
|
3
|
-
gridId: string;
|
|
4
|
-
exportName?: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* TreeGrid 엑셀 내보내기 버튼
|
|
8
|
-
* @param gridId TreeGrid 인스턴스 ID
|
|
9
|
-
* @param exportName 다운로드 파일명
|
|
10
|
-
*/
|
|
11
|
-
declare const OwpTreeGridExcelButton: ({ gridId, exportName, children, loading, loadingPosition, onClick, ...buttonProps }: OwpTreeGridExcelButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export { OwpTreeGridExcelButton };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './OwpTreeGridExcelButton';
|