sales-frontend-bridge 0.0.31 → 0.0.33
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 +218 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -50
- package/dist/index.d.ts +95 -50
- package/dist/index.js +214 -141
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2105,22 +2105,17 @@ var Bridge = {
|
|
|
2105
2105
|
iframeCore: new IframeBridgeCore()
|
|
2106
2106
|
};
|
|
2107
2107
|
|
|
2108
|
-
// src/oz/
|
|
2109
|
-
var
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
OZViewerEvent2["OZExportCommand"] = "OZExportCommand";
|
|
2118
|
-
OZViewerEvent2["OZBtnTouchEvent"] = "btnTouchEvent";
|
|
2119
|
-
OZViewerEvent2["OZReportCreated"] = "OZReportCreated";
|
|
2120
|
-
return OZViewerEvent2;
|
|
2121
|
-
})(OZViewerEvent || {});
|
|
2108
|
+
// src/oz/constant/comment-pen-param.ts
|
|
2109
|
+
var commentPenDefaultParam = [
|
|
2110
|
+
`comment.selectedpen=highlightpen`,
|
|
2111
|
+
`comment.highlightpen_thick=15`
|
|
2112
|
+
];
|
|
2113
|
+
var commentPenYellow = [...commentPenDefaultParam, `comment.highlightpen_color=ffd900`];
|
|
2114
|
+
var commentPenPink = [...commentPenDefaultParam, `comment.highlightpen_color=f48fb1`];
|
|
2115
|
+
var commentPenGreen = [...commentPenDefaultParam, `comment.highlightpen_color=81c784`];
|
|
2116
|
+
var commentPenEraser = [`comment.selectedpen=eraser`];
|
|
2122
2117
|
|
|
2123
|
-
// src/oz/constant.ts
|
|
2118
|
+
// src/oz/constant/oz-param.ts
|
|
2124
2119
|
var commonOzParam = [
|
|
2125
2120
|
`information.debug = true`,
|
|
2126
2121
|
`global.inheritparameter=true`,
|
|
@@ -2221,6 +2216,8 @@ var commonOzParam = [
|
|
|
2221
2216
|
`viewer.reportchangecommand=true`,
|
|
2222
2217
|
`viewer.pagebindcommandinterval=500`
|
|
2223
2218
|
];
|
|
2219
|
+
|
|
2220
|
+
// src/oz/constant/pdf-param.ts
|
|
2224
2221
|
var commonPdfExportParam = [
|
|
2225
2222
|
// `pdf.filename=${"test.pdf"}`,
|
|
2226
2223
|
// `export.pages=${i.startPage}-${i.endPage}`,
|
|
@@ -2233,30 +2230,117 @@ var commonPdfExportParam = [
|
|
|
2233
2230
|
// 폰트를 포함시킬때 사용하는 글자만 포함시킨다
|
|
2234
2231
|
`pdf.fontembedding_subset=true`
|
|
2235
2232
|
];
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
`comment.highlightpen_thick=15`
|
|
2239
|
-
];
|
|
2240
|
-
var commentPenYellow = [...commentPenDefaultParam, `comment.highlightpen_color=ffd900`];
|
|
2241
|
-
var commentPenPink = [...commentPenDefaultParam, `comment.highlightpen_color=f48fb1`];
|
|
2242
|
-
var commentPenGreen = [...commentPenDefaultParam, `comment.highlightpen_color=81c784`];
|
|
2243
|
-
var commentPenEraser = [`comment.selectedpen=eraser`];
|
|
2233
|
+
|
|
2234
|
+
// src/oz/constant/test-data.ts
|
|
2244
2235
|
var wrapperStyle = { display: "flex", flexFlow: "column", gap: "10px" };
|
|
2245
2236
|
var btnStyle = { border: "1px solid red", minHeight: "40px" };
|
|
2237
|
+
var DownloadDocumentList = [
|
|
2238
|
+
{ name: "[A0010]\uCCAD\uC57D\uC11C", file: ["A0010.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2239
|
+
{ name: "[A0100]\uBE44\uAD50\uC548\uB0B4\uD655\uC778\uC11C", file: ["A0100.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2240
|
+
{ name: "[A1500]\uCCAD\uC57D\uBD80\uC18D\uC815\uBCF4\uD655\uC778\uC11C", file: ["A1500.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2241
|
+
{ name: "[A2215]\uBCF4\uD5D8\uACC4\uC57D\uB300\uCD9C\uC774\uD589\uAD00\uB9AC\uB3D9\uC758\uC11C", file: ["A2215.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2242
|
+
{ name: "[A2800]\uACC4\uC57D\uC804\uC54C\uB9B4\uC758\uBB34", file: ["A2800.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2243
|
+
{ name: "[A3503]\uCCAD\uC57D\uC11C\uBCC4\uC9C0(\uBCC0\uC561\uC6A9)", file: ["A3503.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2244
|
+
{ name: "[B0101]\uBCF4\uD5D8\uACC4\uC57D\uCCB4\uACB0\uB3D9\uC758\uC11C", file: ["B0101.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2245
|
+
{ name: "[C0400]\uACC4\uC57D\uCCB4\uACB0\uC774\uD589\uB3D9\uC758\uC11C", file: ["C0400.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2246
|
+
{ name: "[C0401]\uC0C1\uD488\uC18C\uAC1C\uC0C1\uC138\uB3D9\uC758\uC11C", file: ["C0401.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2247
|
+
{ name: "[C1000]\uBCF4\uD5D8\uC0C1\uD488\uD310\uB9E4\uCCB4\uD06C\uB9AC\uC2A4\uD2B8", file: ["C1000.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2248
|
+
{ name: "[C1300]\uACC4\uC57D\uCCB4\uACB0\uACE0\uC9C0\uC758\uBB34\uD655\uC778\uC11C", file: ["C1300.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2249
|
+
{ name: "[C1400]\uBCF4\uD5D8\uC0C1\uD488\uBE44\uAD50\uC124\uBA85\uD655\uC778\uC11C", file: ["C1400.ozd"], complete: false, startPage: 0, endPage: 0, focus: false }
|
|
2250
|
+
];
|
|
2251
|
+
var ExtraData = {
|
|
2252
|
+
// 문서코드
|
|
2253
|
+
A0010: {
|
|
2254
|
+
// connection.inputjson으로 바인딩할 데이터
|
|
2255
|
+
inputJson: {
|
|
2256
|
+
// 계약자 성명 사인정보
|
|
2257
|
+
A0010_mynm_sg: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAABDUlEQVR4nOzSMQ0CQBQEUSAnAAU0iEAAPWKQgQU04gED10z1IXlPwWay6/78HH7P+3qZnrBxmh7wT8QKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECtZjvaY3bNzOx+kJG54ViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVfAMAAP//tD4Eb/yjIncAAAAASUVORK5CYII=",
|
|
2258
|
+
// 계약자 서명 사인정보
|
|
2259
|
+
A0010_mysg_sign: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAABDElEQVR4nOzSsQkCYRgEUZXDVgTtxdDIYgR7sFkTG/iTiT4P3qtgGXa7vp+H//M5PqYnLJymB+yJWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVjBdj9fpjcsvG7f6QkLnhWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBX8AgAA//9+7gTkg4AcBQAAAABJRU5ErkJggg=="
|
|
2260
|
+
},
|
|
2261
|
+
// 기타 공통으로 사용하지 않을 파라미터
|
|
2262
|
+
extraParam: [`viewer.zoom=137`]
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2246
2265
|
|
|
2247
|
-
// src/oz/use-
|
|
2266
|
+
// src/oz/hooks/use-document-info.tsx
|
|
2248
2267
|
var import_react = __toESM(require_react());
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
const
|
|
2253
|
-
|
|
2268
|
+
function useDocumentInfo(initialValue) {
|
|
2269
|
+
const [documentInfo, setDocumentInfo] = (0, import_react.useState)([...initialValue]);
|
|
2270
|
+
const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
|
|
2271
|
+
const documentIndexMap = documentList.reduce((acc, cur, index) => {
|
|
2272
|
+
acc[cur] = index;
|
|
2273
|
+
return acc;
|
|
2274
|
+
}, {});
|
|
2275
|
+
const documentTemplateMap = (0, import_react.useMemo)(() => documentInfo.reduce((map, doc) => {
|
|
2276
|
+
doc.file.forEach((file) => {
|
|
2277
|
+
map[file] = { ...doc };
|
|
2278
|
+
});
|
|
2279
|
+
return map;
|
|
2280
|
+
}, {}), [documentInfo]);
|
|
2281
|
+
const nameTemplateMap = documentInfo.reduce((acc, doc) => {
|
|
2282
|
+
acc[doc.name] = doc;
|
|
2283
|
+
return acc;
|
|
2284
|
+
}, {});
|
|
2285
|
+
const groupIndexes = (0, import_react.useMemo)(() => documentInfo.reduce((acc, item) => {
|
|
2286
|
+
item.file.forEach((file) => {
|
|
2287
|
+
const currentIndex = documentIndexMap[file];
|
|
2288
|
+
if (!acc[currentIndex]) {
|
|
2289
|
+
acc[currentIndex] = [];
|
|
2290
|
+
}
|
|
2291
|
+
item.file.forEach((groupFile) => {
|
|
2292
|
+
acc[currentIndex].push(documentIndexMap[groupFile]);
|
|
2293
|
+
});
|
|
2294
|
+
});
|
|
2295
|
+
return acc;
|
|
2296
|
+
}, []), [documentIndexMap, documentInfo]);
|
|
2297
|
+
const isAllComplete = (0, import_react.useMemo)(() => documentInfo.every((i) => i.complete), [documentInfo]);
|
|
2298
|
+
return {
|
|
2299
|
+
setDocumentInfo,
|
|
2300
|
+
documentInfo,
|
|
2301
|
+
documentList,
|
|
2302
|
+
documentTemplateMap,
|
|
2303
|
+
documentIndexMap,
|
|
2304
|
+
nameTemplateMap,
|
|
2305
|
+
groupIndexes,
|
|
2306
|
+
isAllComplete
|
|
2307
|
+
};
|
|
2254
2308
|
}
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2309
|
+
|
|
2310
|
+
// src/oz/hooks/use-oz-event-listener.tsx
|
|
2311
|
+
var import_react2 = __toESM(require_react());
|
|
2312
|
+
function useOzEventListener({ event, handler }) {
|
|
2313
|
+
const handleEvent = (0, import_react2.useCallback)(
|
|
2314
|
+
async (e) => {
|
|
2315
|
+
const customEvent = e;
|
|
2316
|
+
return await handler(customEvent);
|
|
2317
|
+
},
|
|
2318
|
+
[handler]
|
|
2319
|
+
);
|
|
2320
|
+
(0, import_react2.useEffect)(() => {
|
|
2321
|
+
window.addEventListener(event, handleEvent);
|
|
2322
|
+
return () => {
|
|
2323
|
+
window.removeEventListener(event, handleEvent);
|
|
2324
|
+
};
|
|
2325
|
+
}, [handleEvent, event]);
|
|
2259
2326
|
}
|
|
2327
|
+
|
|
2328
|
+
// src/oz/types/oz-event.types.ts
|
|
2329
|
+
var OZViewerEvent = /* @__PURE__ */ ((OZViewerEvent2) => {
|
|
2330
|
+
OZViewerEvent2["OZProgressCommand"] = "OZProgressCommand";
|
|
2331
|
+
OZViewerEvent2["OZErrorCommand"] = "OZErrorCommand";
|
|
2332
|
+
OZViewerEvent2["OZPageChangeCommand"] = "OZPageChangeCommand";
|
|
2333
|
+
OZViewerEvent2["OZReportChangeCommand"] = "OZReportChangeCommand";
|
|
2334
|
+
OZViewerEvent2["OZUserEvent"] = "OZUserEvent";
|
|
2335
|
+
OZViewerEvent2["OZPageBindCommand"] = "OZPageBindCommand";
|
|
2336
|
+
OZViewerEvent2["OZEFormInputEventCommand"] = "OZEFormInputEventCommand";
|
|
2337
|
+
OZViewerEvent2["OZExportCommand"] = "OZExportCommand";
|
|
2338
|
+
OZViewerEvent2["OZBtnTouchEvent"] = "btnTouchEvent";
|
|
2339
|
+
OZViewerEvent2["OZReportCreated"] = "OZReportCreated";
|
|
2340
|
+
return OZViewerEvent2;
|
|
2341
|
+
})(OZViewerEvent || {});
|
|
2342
|
+
|
|
2343
|
+
// src/oz/utils/common-util.ts
|
|
2260
2344
|
function categorizeByPageRange(data, pageCounts) {
|
|
2261
2345
|
let pageStart = 1;
|
|
2262
2346
|
const result = [];
|
|
@@ -2300,6 +2384,72 @@ function getFileListByGlobalIndex(index, data) {
|
|
|
2300
2384
|
}
|
|
2301
2385
|
return null;
|
|
2302
2386
|
}
|
|
2387
|
+
async function sleep(ms = 10) {
|
|
2388
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2389
|
+
}
|
|
2390
|
+
function PromiseWithResolvers() {
|
|
2391
|
+
let resolve;
|
|
2392
|
+
let reject;
|
|
2393
|
+
const promise = new Promise((res, rej) => {
|
|
2394
|
+
resolve = res;
|
|
2395
|
+
reject = rej;
|
|
2396
|
+
});
|
|
2397
|
+
return { promise, resolve, reject };
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
// src/oz/utils/bridge-util.ts
|
|
2401
|
+
async function CreateOzParam(documentList, extraData = {}) {
|
|
2402
|
+
if (documentList.length === 0) {
|
|
2403
|
+
throw new Error("\uBB38\uC11C\uBAA9\uB85D\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4");
|
|
2404
|
+
}
|
|
2405
|
+
const fontParms = await fetchFont();
|
|
2406
|
+
const connectionParams = documentList.map(
|
|
2407
|
+
(file, idx) => idx === 0 ? `connection.openfile=${file}` : `child${idx}.connection.openfile=${file}`
|
|
2408
|
+
);
|
|
2409
|
+
const childCount = documentList.length - 1;
|
|
2410
|
+
const extraParams = documentList.map((file, idx) => {
|
|
2411
|
+
const result = [];
|
|
2412
|
+
const docCode = file.replace(/^.*[\\/]|(\.[^/.]+)$/g, "");
|
|
2413
|
+
const prefix = idx === 0 ? "" : `child${idx}.`;
|
|
2414
|
+
const data = extraData[docCode] || {};
|
|
2415
|
+
if (data.inputJson) {
|
|
2416
|
+
result.push(`${prefix}connection.inputjson=${JSON.stringify(data.inputJson)}`);
|
|
2417
|
+
}
|
|
2418
|
+
if (data.extraParam) {
|
|
2419
|
+
result.push(data.extraParam.map((param) => `${prefix}${param}`).join("\n"));
|
|
2420
|
+
}
|
|
2421
|
+
return result;
|
|
2422
|
+
});
|
|
2423
|
+
const params = [
|
|
2424
|
+
...childCount > 0 ? [`viewer.childcount=${childCount}`] : [],
|
|
2425
|
+
...connectionParams,
|
|
2426
|
+
...commonOzParam,
|
|
2427
|
+
...fontParms,
|
|
2428
|
+
...extraParams.flat(1)
|
|
2429
|
+
];
|
|
2430
|
+
return params;
|
|
2431
|
+
}
|
|
2432
|
+
async function CreateOzViewer(ozParam) {
|
|
2433
|
+
const { promise, resolve } = PromiseWithResolvers();
|
|
2434
|
+
window.addEventListener(
|
|
2435
|
+
"OZReportCreated" /* OZReportCreated */,
|
|
2436
|
+
// OZReportCreated가 트리거되면 promise resolve 처리
|
|
2437
|
+
(e) => resolve(e),
|
|
2438
|
+
// 이벤트 리스너는 한 번만 실행되도록 설정
|
|
2439
|
+
{ once: true }
|
|
2440
|
+
);
|
|
2441
|
+
await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
|
|
2442
|
+
return await promise;
|
|
2443
|
+
}
|
|
2444
|
+
async function fetchDocument(options) {
|
|
2445
|
+
const { data } = await Bridge.native.downloadDocument({ data: options });
|
|
2446
|
+
return data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
|
|
2447
|
+
}
|
|
2448
|
+
async function fetchFont() {
|
|
2449
|
+
const { data: fontMap } = await Bridge.native.getOzFontParam();
|
|
2450
|
+
const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
|
|
2451
|
+
return fontParms;
|
|
2452
|
+
}
|
|
2303
2453
|
async function getReportCount() {
|
|
2304
2454
|
const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
|
|
2305
2455
|
return Number(data);
|
|
@@ -2323,9 +2473,6 @@ async function disableFocusOnValidation(reportCount) {
|
|
|
2323
2473
|
}
|
|
2324
2474
|
return;
|
|
2325
2475
|
}
|
|
2326
|
-
async function sleep(ms = 10) {
|
|
2327
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2328
|
-
}
|
|
2329
2476
|
async function triggerClickOnAllDocuments(reportCount) {
|
|
2330
2477
|
const count = reportCount ?? await getReportCount();
|
|
2331
2478
|
for (let i = 0; i < count; i++) {
|
|
@@ -2493,15 +2640,6 @@ async function PdfHandler({ type, btnID }) {
|
|
|
2493
2640
|
await Bridge.native.hideOZViewer();
|
|
2494
2641
|
}
|
|
2495
2642
|
}
|
|
2496
|
-
function PromiseWithResolvers() {
|
|
2497
|
-
let resolve;
|
|
2498
|
-
let reject;
|
|
2499
|
-
const promise = new Promise((res, rej) => {
|
|
2500
|
-
resolve = res;
|
|
2501
|
-
reject = rej;
|
|
2502
|
-
});
|
|
2503
|
-
return { promise, resolve, reject };
|
|
2504
|
-
}
|
|
2505
2643
|
async function SaveTotalPdf() {
|
|
2506
2644
|
const { promise, resolve } = PromiseWithResolvers();
|
|
2507
2645
|
window.addEventListener(
|
|
@@ -2525,104 +2663,39 @@ async function SaveTotalPdf() {
|
|
|
2525
2663
|
const filepath = await promise;
|
|
2526
2664
|
return filepath;
|
|
2527
2665
|
}
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
function
|
|
2531
|
-
|
|
2532
|
-
if (
|
|
2533
|
-
|
|
2666
|
+
var checkValidPageMemo = (() => {
|
|
2667
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2668
|
+
async function checkValidPage(page) {
|
|
2669
|
+
const cached = cache.get(page);
|
|
2670
|
+
if (cached) {
|
|
2671
|
+
return cached;
|
|
2534
2672
|
}
|
|
2535
|
-
const
|
|
2536
|
-
const
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
if (data.extraParam) {
|
|
2549
|
-
result.push(data.extraParam.map((param) => `${prefix}${param}`).join("\n"));
|
|
2550
|
-
}
|
|
2551
|
-
return result;
|
|
2552
|
-
});
|
|
2553
|
-
const params = [
|
|
2554
|
-
...childCount > 0 ? [`viewer.childcount=${childCount}`] : [],
|
|
2555
|
-
...connectionParams,
|
|
2556
|
-
...commonOzParam,
|
|
2557
|
-
...fontParms,
|
|
2558
|
-
...extraParams.flat(1)
|
|
2559
|
-
];
|
|
2560
|
-
Bridge.native.createOZViewer({ param: params.join("\n") });
|
|
2561
|
-
}, [documentList, extraData]);
|
|
2562
|
-
return { CreateReport };
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
// src/oz/use-document-info.tsx
|
|
2566
|
-
var import_react2 = __toESM(require_react());
|
|
2567
|
-
function useDocumentInfo(initialValue) {
|
|
2568
|
-
const [documentInfo, setDocumentInfo] = (0, import_react2.useState)([...initialValue]);
|
|
2569
|
-
const documentList = (0, import_react2.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
|
|
2570
|
-
const documentIndexMap = documentList.reduce((acc, cur, index) => {
|
|
2571
|
-
acc[cur] = index;
|
|
2572
|
-
return acc;
|
|
2573
|
-
}, {});
|
|
2574
|
-
const documentTemplateMap = (0, import_react2.useMemo)(() => documentInfo.reduce((map, doc) => {
|
|
2575
|
-
doc.file.forEach((file) => {
|
|
2576
|
-
map[file] = { ...doc };
|
|
2577
|
-
});
|
|
2578
|
-
return map;
|
|
2579
|
-
}, {}), [documentInfo]);
|
|
2580
|
-
const nameTemplateMap = documentInfo.reduce((acc, doc) => {
|
|
2581
|
-
acc[doc.name] = doc;
|
|
2582
|
-
return acc;
|
|
2583
|
-
}, {});
|
|
2584
|
-
const groupIndexes = (0, import_react2.useMemo)(() => documentInfo.reduce((acc, item) => {
|
|
2585
|
-
item.file.forEach((file) => {
|
|
2586
|
-
const currentIndex = documentIndexMap[file];
|
|
2587
|
-
if (!acc[currentIndex]) {
|
|
2588
|
-
acc[currentIndex] = [];
|
|
2673
|
+
const VALID = "valid";
|
|
2674
|
+
const command = `INPUT_CHECK_VALIDITY_PAGE_AT=${page}`;
|
|
2675
|
+
const promise = (async () => {
|
|
2676
|
+
try {
|
|
2677
|
+
const { data } = await Bridge.nativeOz.getInformation({ command });
|
|
2678
|
+
const isValid = data === VALID;
|
|
2679
|
+
if (!isValid) {
|
|
2680
|
+
cache.delete(page);
|
|
2681
|
+
}
|
|
2682
|
+
return isValid;
|
|
2683
|
+
} catch (err) {
|
|
2684
|
+
cache.delete(page);
|
|
2685
|
+
throw err;
|
|
2589
2686
|
}
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
const isAllComplete = (0, import_react2.useMemo)(() => documentInfo.every((i) => i.complete), [documentInfo]);
|
|
2597
|
-
return {
|
|
2598
|
-
setDocumentInfo,
|
|
2599
|
-
documentInfo,
|
|
2600
|
-
documentList,
|
|
2601
|
-
documentTemplateMap,
|
|
2602
|
-
documentIndexMap,
|
|
2603
|
-
nameTemplateMap,
|
|
2604
|
-
groupIndexes,
|
|
2605
|
-
isAllComplete
|
|
2687
|
+
})();
|
|
2688
|
+
cache.set(page, promise);
|
|
2689
|
+
return promise;
|
|
2690
|
+
}
|
|
2691
|
+
checkValidPage.clearCache = () => {
|
|
2692
|
+
cache.clear();
|
|
2606
2693
|
};
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
const handleEvent = (0, import_react3.useCallback)(
|
|
2613
|
-
async (e) => {
|
|
2614
|
-
const customEvent = e;
|
|
2615
|
-
return await handler(customEvent);
|
|
2616
|
-
},
|
|
2617
|
-
[handler]
|
|
2618
|
-
);
|
|
2619
|
-
(0, import_react3.useEffect)(() => {
|
|
2620
|
-
window.addEventListener(event, handleEvent);
|
|
2621
|
-
return () => {
|
|
2622
|
-
window.removeEventListener(event, handleEvent);
|
|
2623
|
-
};
|
|
2624
|
-
}, [handleEvent, event]);
|
|
2625
|
-
}
|
|
2694
|
+
checkValidPage.clearCacheByPage = (page) => {
|
|
2695
|
+
cache.delete(page);
|
|
2696
|
+
};
|
|
2697
|
+
return checkValidPage;
|
|
2698
|
+
})();
|
|
2626
2699
|
/*! Bundled license information:
|
|
2627
2700
|
|
|
2628
2701
|
react/cjs/react.production.js:
|
|
@@ -2651,6 +2724,10 @@ react/cjs/react.development.js:
|
|
|
2651
2724
|
exports.Bridge = Bridge;
|
|
2652
2725
|
exports.CategoryHandler = CategoryHandler;
|
|
2653
2726
|
exports.CommentHandler = CommentHandler;
|
|
2727
|
+
exports.CreateOzParam = CreateOzParam;
|
|
2728
|
+
exports.CreateOzViewer = CreateOzViewer;
|
|
2729
|
+
exports.DownloadDocumentList = DownloadDocumentList;
|
|
2730
|
+
exports.ExtraData = ExtraData;
|
|
2654
2731
|
exports.MovePage = MovePage;
|
|
2655
2732
|
exports.OZViewerEvent = OZViewerEvent;
|
|
2656
2733
|
exports.PdfHandler = PdfHandler;
|
|
@@ -2661,6 +2738,7 @@ exports.TopHandler = TopHandler;
|
|
|
2661
2738
|
exports.btnStyle = btnStyle;
|
|
2662
2739
|
exports.categorizeByPageRange = categorizeByPageRange;
|
|
2663
2740
|
exports.checkDocumentsValidityByIndex = checkDocumentsValidityByIndex;
|
|
2741
|
+
exports.checkValidPageMemo = checkValidPageMemo;
|
|
2664
2742
|
exports.commentPenEraser = commentPenEraser;
|
|
2665
2743
|
exports.commentPenGreen = commentPenGreen;
|
|
2666
2744
|
exports.commentPenPink = commentPenPink;
|
|
@@ -2683,7 +2761,6 @@ exports.setEnableCommentMode = setEnableCommentMode;
|
|
|
2683
2761
|
exports.sleep = sleep;
|
|
2684
2762
|
exports.triggerClickOnAllDocuments = triggerClickOnAllDocuments;
|
|
2685
2763
|
exports.triggerCropImageOnAllDocuments = triggerCropImageOnAllDocuments;
|
|
2686
|
-
exports.useCreateReport = useCreateReport;
|
|
2687
2764
|
exports.useDocumentInfo = useDocumentInfo;
|
|
2688
2765
|
exports.useOzEventListener = useOzEventListener;
|
|
2689
2766
|
exports.validateAllPages = validateAllPages;
|