sales-frontend-bridge 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +97 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -8
- package/dist/index.d.ts +39 -8
- package/dist/index.js +96 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1784,9 +1784,9 @@ var NativeBridge = class extends CommonBridge {
|
|
|
1784
1784
|
* Bridge.native.createReportEx({ param: "connection.openfile=sample.ozd" });
|
|
1785
1785
|
* ```
|
|
1786
1786
|
*/
|
|
1787
|
-
|
|
1787
|
+
createOZViewer(options) {
|
|
1788
1788
|
return this.core.callToTarget(
|
|
1789
|
-
"
|
|
1789
|
+
"createOZViewer",
|
|
1790
1790
|
Object.assign({ delimiter: "\n" }, options)
|
|
1791
1791
|
);
|
|
1792
1792
|
}
|
|
@@ -1799,8 +1799,8 @@ var NativeBridge = class extends CommonBridge {
|
|
|
1799
1799
|
* Bridge.native.hideViewer();
|
|
1800
1800
|
* ```
|
|
1801
1801
|
*/
|
|
1802
|
-
|
|
1803
|
-
return this.core.callToTarget("
|
|
1802
|
+
hideOZViewer() {
|
|
1803
|
+
return this.core.callToTarget("hideOZViewer");
|
|
1804
1804
|
}
|
|
1805
1805
|
/**
|
|
1806
1806
|
* ### Bridge for Oz
|
|
@@ -2019,6 +2019,28 @@ var NativeBridge = class extends CommonBridge {
|
|
|
2019
2019
|
async onAuthenticationResult(options) {
|
|
2020
2020
|
return this.core.callToTarget("onAuthenticationResult", options);
|
|
2021
2021
|
}
|
|
2022
|
+
/**
|
|
2023
|
+
* 로더 컴포넌트 show
|
|
2024
|
+
* @example
|
|
2025
|
+
* ```tsx
|
|
2026
|
+
* // 사용 예시
|
|
2027
|
+
* await Bridge.native.showLoader()
|
|
2028
|
+
* ```
|
|
2029
|
+
*/
|
|
2030
|
+
async showLoader() {
|
|
2031
|
+
return this.core.callToTarget("showLoader");
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* 로더 컴포넌트 hide
|
|
2035
|
+
* @example
|
|
2036
|
+
* ```tsx
|
|
2037
|
+
* // 사용 예시
|
|
2038
|
+
* await Bridge.native.hideLoader()
|
|
2039
|
+
* ```
|
|
2040
|
+
*/
|
|
2041
|
+
async hideLoader() {
|
|
2042
|
+
return this.core.callToTarget("hideLoader");
|
|
2043
|
+
}
|
|
2022
2044
|
// TODO: 필요 플러그인들 추가
|
|
2023
2045
|
};
|
|
2024
2046
|
|
|
@@ -2053,10 +2075,22 @@ var commonOzParam = [
|
|
|
2053
2075
|
`eform.signpad_type=embedded`,
|
|
2054
2076
|
// `eform.signpad_type=keypad`,
|
|
2055
2077
|
`eform.show_prev_next_input=true`,
|
|
2056
|
-
`eform.signpad_prev_next_iconposition=sign_top_left`,
|
|
2078
|
+
// `eform.signpad_prev_next_iconposition=sign_top_left`,
|
|
2079
|
+
`eform.signpad_prev_next_iconposition=sign_top`,
|
|
2080
|
+
`eform.inputcomponent_toolbar_button_json=${JSON.stringify({
|
|
2081
|
+
// 서명패드 버튼 배열 수정
|
|
2082
|
+
"all": {
|
|
2083
|
+
// 왼쪽에 이전, 확인 버튼
|
|
2084
|
+
"left_align": "prev,ok",
|
|
2085
|
+
// 오른쪽에 성명,서명 불러오기, 초가화, 다음
|
|
2086
|
+
"right_align": "reusablesign,clear,next"
|
|
2087
|
+
}
|
|
2088
|
+
})}`,
|
|
2057
2089
|
`eform.signpad_show_draw_erase_button=false`,
|
|
2090
|
+
`eform.signpad_viewtype=keepratioandfittoframe`,
|
|
2058
2091
|
`eform.radiobutton_type=ensurevisible_at_prev_next`,
|
|
2059
2092
|
`eform.checkbox_type=ensurevisible_at_prev_next`,
|
|
2093
|
+
// `eform.prev_next_constraint_rule=empty_only`,
|
|
2060
2094
|
`eform.imagepicker_id_info=${JSON.stringify({
|
|
2061
2095
|
ids: [
|
|
2062
2096
|
{
|
|
@@ -2189,10 +2223,20 @@ function extractFileName(filePath) {
|
|
|
2189
2223
|
}
|
|
2190
2224
|
return fileName;
|
|
2191
2225
|
}
|
|
2226
|
+
function getFileListByGlobalIndex(index, data) {
|
|
2227
|
+
let currentIndex = 0;
|
|
2228
|
+
for (const form of data) {
|
|
2229
|
+
const fileCount = form.file.length;
|
|
2230
|
+
if (index >= currentIndex && index < currentIndex + fileCount) {
|
|
2231
|
+
return form;
|
|
2232
|
+
}
|
|
2233
|
+
currentIndex += fileCount;
|
|
2234
|
+
}
|
|
2235
|
+
return null;
|
|
2236
|
+
}
|
|
2192
2237
|
|
|
2193
2238
|
// src/oz/use-create-report.ts
|
|
2194
|
-
function useCreateReport({
|
|
2195
|
-
const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
|
|
2239
|
+
function useCreateReport({ documentList, extraData = {} }) {
|
|
2196
2240
|
const CreateReport = (0, import_react.useCallback)(async () => {
|
|
2197
2241
|
if (documentList.length === 0) {
|
|
2198
2242
|
throw new Error("\uBB38\uC11C\uBAA9\uB85D\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4");
|
|
@@ -2222,25 +2266,64 @@ function useCreateReport({ documentInfo, extraData = {} }) {
|
|
|
2222
2266
|
...fontParms,
|
|
2223
2267
|
...extraParams.flat(1)
|
|
2224
2268
|
];
|
|
2225
|
-
Bridge.native.
|
|
2269
|
+
Bridge.native.createOZViewer({ param: params.join("\n") });
|
|
2226
2270
|
}, [documentList, extraData]);
|
|
2271
|
+
return { CreateReport };
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
// src/oz/use-document-info.tsx
|
|
2275
|
+
var import_react2 = __toESM(require_react());
|
|
2276
|
+
function useDocumentInfo(initialValue) {
|
|
2277
|
+
const [documentInfo, setDocumentInfo] = (0, import_react2.useState)([...initialValue]);
|
|
2278
|
+
const documentList = (0, import_react2.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
|
|
2279
|
+
const documentIndexMap = documentList.reduce((acc, cur, index) => {
|
|
2280
|
+
acc[cur] = index;
|
|
2281
|
+
return acc;
|
|
2282
|
+
}, {});
|
|
2283
|
+
const documentTemplateMap = (0, import_react2.useMemo)(() => documentInfo.reduce((map, doc) => {
|
|
2284
|
+
doc.file.forEach((file) => {
|
|
2285
|
+
map[file] = { ...doc };
|
|
2286
|
+
});
|
|
2287
|
+
return map;
|
|
2288
|
+
}, {}), [documentInfo]);
|
|
2289
|
+
const nameTemplateMap = documentInfo.reduce((acc, doc) => {
|
|
2290
|
+
acc[doc.name] = doc;
|
|
2291
|
+
return acc;
|
|
2292
|
+
}, {});
|
|
2293
|
+
const groupIndexes = (0, import_react2.useMemo)(() => documentInfo.reduce((acc, item) => {
|
|
2294
|
+
item.file.forEach((file) => {
|
|
2295
|
+
const currentIndex = documentIndexMap[file];
|
|
2296
|
+
if (!acc[currentIndex]) {
|
|
2297
|
+
acc[currentIndex] = [];
|
|
2298
|
+
}
|
|
2299
|
+
item.file.forEach((groupFile) => {
|
|
2300
|
+
acc[currentIndex].push(documentIndexMap[groupFile]);
|
|
2301
|
+
});
|
|
2302
|
+
});
|
|
2303
|
+
return acc;
|
|
2304
|
+
}, []), [documentIndexMap, documentInfo]);
|
|
2227
2305
|
return {
|
|
2306
|
+
setDocumentInfo,
|
|
2307
|
+
documentInfo,
|
|
2228
2308
|
documentList,
|
|
2229
|
-
|
|
2309
|
+
documentTemplateMap,
|
|
2310
|
+
documentIndexMap,
|
|
2311
|
+
nameTemplateMap,
|
|
2312
|
+
groupIndexes
|
|
2230
2313
|
};
|
|
2231
2314
|
}
|
|
2232
2315
|
|
|
2233
2316
|
// src/oz/use-oz-event-listener.tsx
|
|
2234
|
-
var
|
|
2317
|
+
var import_react3 = __toESM(require_react());
|
|
2235
2318
|
function useOzEventListener({ event, handler }) {
|
|
2236
|
-
const handleEvent = (0,
|
|
2319
|
+
const handleEvent = (0, import_react3.useCallback)(
|
|
2237
2320
|
async (e) => {
|
|
2238
2321
|
const customEvent = e;
|
|
2239
2322
|
return await handler(customEvent);
|
|
2240
2323
|
},
|
|
2241
2324
|
[handler]
|
|
2242
2325
|
);
|
|
2243
|
-
(0,
|
|
2326
|
+
(0, import_react3.useEffect)(() => {
|
|
2244
2327
|
window.addEventListener(event, handleEvent);
|
|
2245
2328
|
return () => {
|
|
2246
2329
|
window.removeEventListener(event, handleEvent);
|
|
@@ -2281,7 +2364,9 @@ exports.commonPdfExportParam = commonPdfExportParam;
|
|
|
2281
2364
|
exports.extractFileName = extractFileName;
|
|
2282
2365
|
exports.fetchDocument = fetchDocument;
|
|
2283
2366
|
exports.fetchFont = fetchFont;
|
|
2367
|
+
exports.getFileListByGlobalIndex = getFileListByGlobalIndex;
|
|
2284
2368
|
exports.useCreateReport = useCreateReport;
|
|
2369
|
+
exports.useDocumentInfo = useDocumentInfo;
|
|
2285
2370
|
exports.useOzEventListener = useOzEventListener;
|
|
2286
2371
|
exports.wrapperStyle = wrapperStyle;
|
|
2287
2372
|
//# sourceMappingURL=index.cjs.map
|