sales-frontend-bridge 0.0.21 → 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 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
- createReportEx(options) {
1787
+ createOZViewer(options) {
1788
1788
  return this.core.callToTarget(
1789
- "createReportEx",
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
- hideViewer() {
1803
- return this.core.callToTarget("hideViewer");
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
  {
@@ -2202,8 +2236,7 @@ function getFileListByGlobalIndex(index, data) {
2202
2236
  }
2203
2237
 
2204
2238
  // src/oz/use-create-report.ts
2205
- function useCreateReport({ documentInfo, extraData = {} }) {
2206
- const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
2239
+ function useCreateReport({ documentList, extraData = {} }) {
2207
2240
  const CreateReport = (0, import_react.useCallback)(async () => {
2208
2241
  if (documentList.length === 0) {
2209
2242
  throw new Error("\uBB38\uC11C\uBAA9\uB85D\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4");
@@ -2233,25 +2266,64 @@ function useCreateReport({ documentInfo, extraData = {} }) {
2233
2266
  ...fontParms,
2234
2267
  ...extraParams.flat(1)
2235
2268
  ];
2236
- Bridge.native.createReportEx({ param: params.join("\n") });
2269
+ Bridge.native.createOZViewer({ param: params.join("\n") });
2237
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]);
2238
2305
  return {
2306
+ setDocumentInfo,
2307
+ documentInfo,
2239
2308
  documentList,
2240
- CreateReport
2309
+ documentTemplateMap,
2310
+ documentIndexMap,
2311
+ nameTemplateMap,
2312
+ groupIndexes
2241
2313
  };
2242
2314
  }
2243
2315
 
2244
2316
  // src/oz/use-oz-event-listener.tsx
2245
- var import_react2 = __toESM(require_react());
2317
+ var import_react3 = __toESM(require_react());
2246
2318
  function useOzEventListener({ event, handler }) {
2247
- const handleEvent = (0, import_react2.useCallback)(
2319
+ const handleEvent = (0, import_react3.useCallback)(
2248
2320
  async (e) => {
2249
2321
  const customEvent = e;
2250
2322
  return await handler(customEvent);
2251
2323
  },
2252
2324
  [handler]
2253
2325
  );
2254
- (0, import_react2.useEffect)(() => {
2326
+ (0, import_react3.useEffect)(() => {
2255
2327
  window.addEventListener(event, handleEvent);
2256
2328
  return () => {
2257
2329
  window.removeEventListener(event, handleEvent);
@@ -2294,6 +2366,7 @@ exports.fetchDocument = fetchDocument;
2294
2366
  exports.fetchFont = fetchFont;
2295
2367
  exports.getFileListByGlobalIndex = getFileListByGlobalIndex;
2296
2368
  exports.useCreateReport = useCreateReport;
2369
+ exports.useDocumentInfo = useDocumentInfo;
2297
2370
  exports.useOzEventListener = useOzEventListener;
2298
2371
  exports.wrapperStyle = wrapperStyle;
2299
2372
  //# sourceMappingURL=index.cjs.map