@rhc-office/sdk 6.6.367 → 6.6.381
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/browser/document-viewer.js +1 -1
- package/dist/browser/document-viewer.js.map +1 -1
- package/dist/index.js +58 -53
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/viewer/DocumentSDK.d.ts +1 -0
- package/dist/viewer/DocumentSDK.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/viewer/DocumentSDK.ts +43 -12
package/dist/index.js
CHANGED
|
@@ -167,26 +167,26 @@ const U = "RIGHT_CENTER", N = "REGULAR_ESM", B = "auto", k = "__RHC_OFFICE_DIGIT
|
|
|
167
167
|
defaults: g(E),
|
|
168
168
|
overrides: {}
|
|
169
169
|
}), t[k];
|
|
170
|
-
},
|
|
170
|
+
}, ct = () => p().current, ht = () => {
|
|
171
171
|
const t = p();
|
|
172
172
|
return {
|
|
173
173
|
current: g(t.current),
|
|
174
174
|
defaults: g(t.defaults),
|
|
175
175
|
overrides: y(t.overrides)
|
|
176
176
|
};
|
|
177
|
-
},
|
|
177
|
+
}, gt = (t) => {
|
|
178
178
|
const n = p();
|
|
179
179
|
return n.defaults = g(t), n.current = V(n.defaults, n.overrides), n.current;
|
|
180
|
-
},
|
|
180
|
+
}, mt = (t) => {
|
|
181
181
|
const n = p();
|
|
182
182
|
return n.current = g(t), n.overrides = y(t), n.current;
|
|
183
|
-
},
|
|
183
|
+
}, pt = (t) => {
|
|
184
184
|
const n = p();
|
|
185
185
|
return n.overrides = X(n.overrides, y(t)), n.current = V(n.current, t), n.current;
|
|
186
|
-
},
|
|
186
|
+
}, bt = (t) => {
|
|
187
187
|
const n = p();
|
|
188
188
|
return t && (n.defaults = g(t)), n.overrides = {}, n.current = g(n.defaults), n.current;
|
|
189
|
-
},
|
|
189
|
+
}, St = {
|
|
190
190
|
EDGE_POSITION: U,
|
|
191
191
|
RSA_MODE: B,
|
|
192
192
|
SIGNATURE_TYPE: N
|
|
@@ -623,7 +623,7 @@ const Me = {
|
|
|
623
623
|
setSecuritySettings: { kind: "query" },
|
|
624
624
|
openSecuritySettingsDialog: { kind: "command" }
|
|
625
625
|
};
|
|
626
|
-
class
|
|
626
|
+
class Ie {
|
|
627
627
|
constructor(n) {
|
|
628
628
|
this.getSecuritySettings = () => this.adapter.getSecuritySettings(), this.setSecuritySettings = (e) => this.adapter.setSecuritySettings(e), this.isSecuritySettingsLocalEditable = () => this.adapter.isSecuritySettingsLocalEditable(), this.setSecuritySettingsLocalEditable = (e) => this.adapter.setSecuritySettingsLocalEditable(e), this.openSecuritySettingsDialog = () => this.adapter.openSecuritySettingsDialog(), this.adapter = d(
|
|
629
629
|
"security",
|
|
@@ -632,7 +632,7 @@ class we {
|
|
|
632
632
|
);
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
|
-
const
|
|
635
|
+
const we = {
|
|
636
636
|
setSignServer: { kind: "command" },
|
|
637
637
|
addSignServerAuthCallback: {
|
|
638
638
|
kind: "callbackRegister",
|
|
@@ -656,7 +656,7 @@ class _e {
|
|
|
656
656
|
constructor(n) {
|
|
657
657
|
this.setSignServer = (e) => this.adapter.setSignServer(e), this.addSignServerAuthCallback = (e) => this.adapter.addSignServerAuthCallback(e), this.setSignServerDefaultLogin = (e) => this.adapter.setSignServerDefaultLogin(e), this.setDefaultSignServerLogin = (e) => this.adapter.setDefaultSignServerLogin(e), this.setSignServerDefaultPassword = (e) => this.adapter.setSignServerDefaultPassword(e), this.setDefaultSignServerPassword = (e) => this.adapter.setDefaultSignServerPassword(e), this.loginNTKOSignServer = (e, i, r) => this.adapter.loginNTKOSignServer(e, i, r), this.loginSignServer = (e, i, r, a) => this.adapter.loginSignServer(e, i, r, a), this.signOutSignServer = () => this.adapter.signOutSignServer(), this.isAuthenticatedOnSignServer = () => this.adapter.isAuthenticatedOnSignServer(), this.setSignServerLoginFromUSBKey = (e, i) => this.adapter.setSignServerLoginFromUSBKey(e, i), this.setUserAuthSource = (e) => this.adapter.setUserAuthSource(e), this.adapter = d(
|
|
658
658
|
"signServer",
|
|
659
|
-
|
|
659
|
+
we,
|
|
660
660
|
n
|
|
661
661
|
);
|
|
662
662
|
}
|
|
@@ -947,7 +947,7 @@ class $e {
|
|
|
947
947
|
});
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
|
-
const
|
|
950
|
+
const I = {
|
|
951
951
|
annotationEnabled: !1,
|
|
952
952
|
documentModified: !1,
|
|
953
953
|
documentOpened: !1,
|
|
@@ -958,10 +958,10 @@ const w = {
|
|
|
958
958
|
};
|
|
959
959
|
class Xe {
|
|
960
960
|
constructor() {
|
|
961
|
-
this.state = { ...
|
|
961
|
+
this.state = { ...I };
|
|
962
962
|
}
|
|
963
963
|
reset() {
|
|
964
|
-
this.state = { ...
|
|
964
|
+
this.state = { ...I };
|
|
965
965
|
}
|
|
966
966
|
update(n) {
|
|
967
967
|
n && (this.state = {
|
|
@@ -985,7 +985,7 @@ class Xe {
|
|
|
985
985
|
};
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
|
-
const Je = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t : void 0, Q = (t) => typeof t == "object" && t !== null && !Array.isArray(t),
|
|
988
|
+
const Je = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t : void 0, Q = (t) => typeof t == "object" && t !== null && !Array.isArray(t), w = (t) => {
|
|
989
989
|
if (!Q(t))
|
|
990
990
|
return;
|
|
991
991
|
const n = {};
|
|
@@ -996,7 +996,7 @@ const Je = (t) => typeof t == "object" && t !== null && !Array.isArray(t) ? t :
|
|
|
996
996
|
success: !0,
|
|
997
997
|
status: "ok"
|
|
998
998
|
};
|
|
999
|
-
const n =
|
|
999
|
+
const n = w(t.state), e = w(t), i = typeof t.error == "string" ? t.error : void 0, r = typeof t.success == "boolean" ? t.success : !i, a = typeof t.status == "string" ? t.status : r ? "ok" : "error";
|
|
1000
1000
|
return {
|
|
1001
1001
|
success: r,
|
|
1002
1002
|
status: a,
|
|
@@ -1086,7 +1086,18 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
|
|
|
1086
1086
|
appUrl: n?.appUrl ?? null,
|
|
1087
1087
|
configuration: n,
|
|
1088
1088
|
element: t
|
|
1089
|
-
}), st = (t) => {
|
|
1089
|
+
}), st = (t, n) => {
|
|
1090
|
+
if (!t)
|
|
1091
|
+
return;
|
|
1092
|
+
const e = typeof t == "string" ? t.trim() : t.userName.trim();
|
|
1093
|
+
if (!e)
|
|
1094
|
+
return;
|
|
1095
|
+
const i = n == null ? "" : String(n).trim(), r = typeof t == "string" || t.userId === void 0 || t.userId === null ? "" : String(t.userId).trim(), a = i || r;
|
|
1096
|
+
return {
|
|
1097
|
+
sessionUser: e,
|
|
1098
|
+
...a ? { sessionUserId: a } : {}
|
|
1099
|
+
};
|
|
1100
|
+
}, ot = (t) => {
|
|
1090
1101
|
if (typeof t == "string") {
|
|
1091
1102
|
const n = document.getElementById(t);
|
|
1092
1103
|
if (!n)
|
|
@@ -1098,7 +1109,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
|
|
|
1098
1109
|
if (!(t instanceof HTMLDivElement))
|
|
1099
1110
|
throw new Error("Reader container must be a div element.");
|
|
1100
1111
|
return t;
|
|
1101
|
-
},
|
|
1112
|
+
}, dt = () => {
|
|
1102
1113
|
const t = typeof globalThis.matchMedia == "function";
|
|
1103
1114
|
return (t ? globalThis.matchMedia("(prefers-contrast: more)").matches : !1) ? "high-contrast" : (t ? globalThis.matchMedia("(prefers-color-scheme: dark)").matches : !1) ? "dark" : "light";
|
|
1104
1115
|
}, O = (t, n) => {
|
|
@@ -1115,7 +1126,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
|
|
|
1115
1126
|
return;
|
|
1116
1127
|
}
|
|
1117
1128
|
typeof e.removeListener == "function" && e.removeListener(n);
|
|
1118
|
-
},
|
|
1129
|
+
}, ut = (t) => {
|
|
1119
1130
|
t.style.display || (t.style.display = "block"), t.style.width || (t.style.width = "100%"), t.style.height || (t.style.height = "100%");
|
|
1120
1131
|
}, F = (t, n) => {
|
|
1121
1132
|
const e = n;
|
|
@@ -1124,7 +1135,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
|
|
|
1124
1135
|
if (e !== "auto")
|
|
1125
1136
|
return t.setAttribute("theme", e), null;
|
|
1126
1137
|
const i = () => {
|
|
1127
|
-
t.setAttribute("theme",
|
|
1138
|
+
t.setAttribute("theme", dt());
|
|
1128
1139
|
};
|
|
1129
1140
|
if (i(), typeof globalThis.matchMedia != "function")
|
|
1130
1141
|
return null;
|
|
@@ -1135,7 +1146,7 @@ const S = "__RHC_OFFICE_READER_RUNTIME__", tt = "__rhcOfficeReaderRuntimeConfig"
|
|
|
1135
1146
|
L(r, s), L(a, s);
|
|
1136
1147
|
};
|
|
1137
1148
|
};
|
|
1138
|
-
class
|
|
1149
|
+
class lt {
|
|
1139
1150
|
constructor(n) {
|
|
1140
1151
|
this.bridge = new $e(), this.callbacks = new et(), this.readerState = new Xe(), this.bridgeToolContext = {
|
|
1141
1152
|
bridge: this.bridge,
|
|
@@ -1143,7 +1154,7 @@ class ut {
|
|
|
1143
1154
|
debug: () => this.debugEnabled,
|
|
1144
1155
|
onAsyncError: (e) => this.reportAdapterError(e),
|
|
1145
1156
|
state: this.readerState
|
|
1146
|
-
}, this.documentTool = new ce(this.bridgeToolContext), this.uiTool = new xe(this.bridgeToolContext), this.pageTool = new Re(this.bridgeToolContext), this.pageArrangeTool = new ke(this.bridgeToolContext), this.findTool = new ge(this.bridgeToolContext), this.signServerTool = new _e(this.bridgeToolContext), this.digitalSignTool = new se(this.bridgeToolContext), this.symbologyTool = new Le(this.bridgeToolContext), this.annotationTool = new ne(this.bridgeToolContext), this.templateSignTool = new Ue(this.bridgeToolContext), this.pdfFormFiller = new ve(this.bridgeToolContext), this.networkingTool = new pe(this.bridgeToolContext), this.cryptoTool = new re(this.bridgeToolContext), this.securityTool = new
|
|
1157
|
+
}, this.documentTool = new ce(this.bridgeToolContext), this.uiTool = new xe(this.bridgeToolContext), this.pageTool = new Re(this.bridgeToolContext), this.pageArrangeTool = new ke(this.bridgeToolContext), this.findTool = new ge(this.bridgeToolContext), this.signServerTool = new _e(this.bridgeToolContext), this.digitalSignTool = new se(this.bridgeToolContext), this.symbologyTool = new Le(this.bridgeToolContext), this.annotationTool = new ne(this.bridgeToolContext), this.templateSignTool = new Ue(this.bridgeToolContext), this.pdfFormFiller = new ve(this.bridgeToolContext), this.networkingTool = new pe(this.bridgeToolContext), this.cryptoTool = new re(this.bridgeToolContext), this.securityTool = new Ie(this.bridgeToolContext), this.readyCallbacks = [], this.unloadCallbacks = [], this.debugEnabled = !1, this.isReady = !1, this.removed = !1, this.mountToken = 0, this.hostContainer = null, this.readerElement = null, this.readerId = null, this.normalizedConfiguration = null, this.runtimeRestoreState = null, this.nativeEventCleanupCallbacks = [], this.themeCleanup = null, this.enableDebug = (e) => {
|
|
1147
1158
|
this.debugEnabled = e;
|
|
1148
1159
|
}, this.changeLanguage = (e) => {
|
|
1149
1160
|
this.readerElement && this.readerElement.setAttribute("language", e);
|
|
@@ -1155,17 +1166,7 @@ class ut {
|
|
|
1155
1166
|
}, this.setSessionUser = (e) => {
|
|
1156
1167
|
this.sessionUser = e;
|
|
1157
1168
|
}, this.setSessionUserId = (e) => {
|
|
1158
|
-
|
|
1159
|
-
this.sessionUser = {
|
|
1160
|
-
userName: typeof this.sessionUser == "string" ? this.sessionUser : "",
|
|
1161
|
-
userId: e
|
|
1162
|
-
};
|
|
1163
|
-
return;
|
|
1164
|
-
}
|
|
1165
|
-
this.sessionUser = {
|
|
1166
|
-
...this.sessionUser,
|
|
1167
|
-
userId: e
|
|
1168
|
-
};
|
|
1169
|
+
this.sessionUserId = e;
|
|
1169
1170
|
}, this.setSessionData = (e) => {
|
|
1170
1171
|
this.sessionData = e;
|
|
1171
1172
|
}, this.isReaderReady = () => this.isReady, this.isReaderDestroyed = () => this.removed && !this.isReady, this.addReaderReadyCallback = (e) => {
|
|
@@ -1175,7 +1176,7 @@ class ut {
|
|
|
1175
1176
|
}, this.setReaderEventListener = (e) => {
|
|
1176
1177
|
this.readerEventListener = e;
|
|
1177
1178
|
}, this.embedReader = (e, i, r) => {
|
|
1178
|
-
const a =
|
|
1179
|
+
const a = ot(e), s = q(i);
|
|
1179
1180
|
z(s);
|
|
1180
1181
|
const o = Ge(s, r), u = this.mountToken + 1;
|
|
1181
1182
|
this.removeReader(), this.mountToken = u, this.removed = !1, this.hostContainer = a, this.normalizedConfiguration = o, this.mountReader(a, o, u);
|
|
@@ -1190,9 +1191,12 @@ class ut {
|
|
|
1190
1191
|
if (await ze(i.appUrl), this.mountToken !== r)
|
|
1191
1192
|
return;
|
|
1192
1193
|
const a = document.createElement(m), s = at();
|
|
1193
|
-
a.setAttribute(G, s), this.readerId = s, this.bridge.setReaderId(s),
|
|
1194
|
+
a.setAttribute(G, s), this.readerId = s, this.bridge.setReaderId(s), ut(a), this.applyReaderRuntimeConfig(a, i);
|
|
1194
1195
|
const o = i.compactViewer === !0 && i.keepPCMenu !== !0;
|
|
1195
|
-
if (a.toggleAttribute("data-sdk-compact-mode", o), a.
|
|
1196
|
+
if (a.toggleAttribute("data-sdk-compact-mode", o), a.toggleAttribute("data-sdk-ribbon-hidden", i.ribbonMenu === !1), a.toggleAttribute(
|
|
1197
|
+
"data-sdk-ribbon-title-hidden",
|
|
1198
|
+
i.ribbonTitle === !1
|
|
1199
|
+
), a.setAttribute("language", i.language ?? "zh_CN"), this.themeCleanup = F(a, i.theme), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
|
|
1196
1200
|
return;
|
|
1197
1201
|
const u = await this.bridge.waitForReady();
|
|
1198
1202
|
if (this.mountToken !== r)
|
|
@@ -1244,18 +1248,19 @@ class ut {
|
|
|
1244
1248
|
}
|
|
1245
1249
|
applyReaderRuntimeConfig(n, e) {
|
|
1246
1250
|
this.restoreReaderRuntimeConfig();
|
|
1247
|
-
const i = {
|
|
1251
|
+
const i = st(this.sessionUser, this.sessionUserId), r = {
|
|
1248
1252
|
hostKind: "server",
|
|
1249
1253
|
server: {
|
|
1250
1254
|
baseUrl: e.appUrl
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
+
},
|
|
1256
|
+
...i ? { identity: i } : {}
|
|
1257
|
+
}, a = n;
|
|
1258
|
+
a[tt] = r;
|
|
1259
|
+
const s = globalThis, o = s[S];
|
|
1255
1260
|
this.runtimeRestoreState = {
|
|
1256
|
-
hadPreviousRuntime:
|
|
1257
|
-
...
|
|
1258
|
-
},
|
|
1261
|
+
hadPreviousRuntime: o !== void 0,
|
|
1262
|
+
...o !== void 0 ? { previousRuntime: o } : {}
|
|
1263
|
+
}, s[S] = r;
|
|
1259
1264
|
}
|
|
1260
1265
|
restoreReaderRuntimeConfig() {
|
|
1261
1266
|
if (!this.runtimeRestoreState)
|
|
@@ -1264,14 +1269,14 @@ class ut {
|
|
|
1264
1269
|
this.runtimeRestoreState.hadPreviousRuntime ? n[S] = this.runtimeRestoreState.previousRuntime : Reflect.deleteProperty(n, S), this.runtimeRestoreState = null;
|
|
1265
1270
|
}
|
|
1266
1271
|
}
|
|
1267
|
-
const
|
|
1272
|
+
const kt = (t) => new lt(t);
|
|
1268
1273
|
export {
|
|
1269
1274
|
ne as AnnotationToolImpl,
|
|
1270
1275
|
re as CryptoToolImpl,
|
|
1271
|
-
|
|
1276
|
+
St as DIGITAL_SIGN_DEFAULTS,
|
|
1272
1277
|
Ae as DigitalSignOptions,
|
|
1273
1278
|
se as DigitalSignToolImpl,
|
|
1274
|
-
|
|
1279
|
+
lt as DocumentSDK,
|
|
1275
1280
|
ce as DocumentToolImpl,
|
|
1276
1281
|
ge as FindToolImpl,
|
|
1277
1282
|
De as KVField,
|
|
@@ -1279,18 +1284,18 @@ export {
|
|
|
1279
1284
|
ke as PageArrangeToolImpl,
|
|
1280
1285
|
Re as PageToolImpl,
|
|
1281
1286
|
ve as PdfFormFillerImpl,
|
|
1282
|
-
|
|
1287
|
+
Ie as SecurityToolImpl,
|
|
1283
1288
|
_e as SignServerToolImpl,
|
|
1284
1289
|
Le as SymbologyToolImpl,
|
|
1285
1290
|
Ue as TemplateSignToolImpl,
|
|
1286
1291
|
xe as UIToolImpl,
|
|
1287
1292
|
Y as WatermarkDisplay,
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1293
|
+
kt as createNewDocumentSdk,
|
|
1294
|
+
ct as getDigitalSignEnvironment,
|
|
1295
|
+
ht as getDigitalSignEnvironmentSource,
|
|
1296
|
+
gt as initializeDigitalSignEnvironment,
|
|
1297
|
+
pt as patchDigitalSignEnvironment,
|
|
1298
|
+
bt as resetDigitalSignEnvironment,
|
|
1299
|
+
mt as setDigitalSignEnvironment
|
|
1295
1300
|
};
|
|
1296
1301
|
//# sourceMappingURL=index.js.map
|