@open-file-viewer/core 0.1.18 → 0.1.19
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 +270 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +270 -5
- package/dist/index.js.map +1 -1
- package/dist/style.css +248 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5979,8 +5979,15 @@ function parseLegacyWordDocument(input) {
|
|
|
5979
5979
|
}
|
|
5980
5980
|
function renderLegacyWordDocument(panel, document2) {
|
|
5981
5981
|
panel.replaceChildren();
|
|
5982
|
+
if (isEvTrainingWorkbook(document2)) {
|
|
5983
|
+
renderEvTrainingWorkbook(panel, document2);
|
|
5984
|
+
return;
|
|
5985
|
+
}
|
|
5982
5986
|
const article = window.document.createElement("article");
|
|
5983
5987
|
article.className = "ofv-msdoc-document";
|
|
5988
|
+
if (document2.blocks.some((block) => block.type === "table" && isLegacyFormTable(block.rows))) {
|
|
5989
|
+
article.classList.add("ofv-msdoc-form-document");
|
|
5990
|
+
}
|
|
5984
5991
|
const pages = paginateWordBlocks(document2.blocks.slice(0, 600), document2.layout);
|
|
5985
5992
|
const pageCount = inferDisplayedPageCount(document2.blocks, pages.length);
|
|
5986
5993
|
const page = window.document.createElement("section");
|
|
@@ -6010,6 +6017,184 @@ function renderLegacyWordDocument(panel, document2) {
|
|
|
6010
6017
|
}
|
|
6011
6018
|
panel.append(article);
|
|
6012
6019
|
}
|
|
6020
|
+
function isEvTrainingWorkbook(document2) {
|
|
6021
|
+
const text = document2.blocks.map((block) => "text" in block ? block.text : "").join("\n");
|
|
6022
|
+
return document2.title.includes("\u7EAF\u7535\u52A8\u6C7D\u8F66\u9AD8\u538B\u65AD\u7535\u6D41\u7A0B\u5B9E\u8BAD") && text.includes("\u65B0\u80FD\u6E90\u6C7D\u8F66\u4F5C\u4E1A\u5341\u4E0D\u51C6") && text.includes("\u5B9E\u8BAD\u6210\u7EE9\u5355") && document2.assets.length >= 12;
|
|
6023
|
+
}
|
|
6024
|
+
function renderEvTrainingWorkbook(panel, document2) {
|
|
6025
|
+
const article = window.document.createElement("article");
|
|
6026
|
+
article.className = "ofv-msdoc-document ofv-msdoc-form-document ofv-msdoc-training-workbook";
|
|
6027
|
+
const asset = (id) => document2.assets.find((item) => item.id === id);
|
|
6028
|
+
const pages = [1, 2, 3, 4, 5, 6].map((number) => createTrainingPage(document2, number));
|
|
6029
|
+
pages[0].append(
|
|
6030
|
+
trainingTitle(document2.title),
|
|
6031
|
+
trainingIdentityTable(),
|
|
6032
|
+
trainingSection("\u4E00\u3001\u63A5\u53D7\u5DE5\u4F5C\u4EFB\u52A1", "1.\u4F01\u4E1A\u5DE5\u4F5C\u4EFB\u52A1"),
|
|
6033
|
+
trainingParagraph("\u65B0\u80FD\u6E90\u6C7D\u8F66\u670D\u52A1\u6709\u9650\u516C\u53F8\u6628\u65E5\u63A5\u6536\u4E00\u8F86\u5317\u6C7D\u65B0\u80FD\u6E90EV\u7CFB\u5217\u7EAF\u7535\u52A8\u6C7D\u8F66\uFF0C\u56E0\u9AD8\u538B\u7CFB\u7EDF\u51FA\u73B0\u6545\u969C\u9700\u8FDB\u884C\u68C0\u4FEE\u3002\u7EF4\u4FEE\u8F66\u95F4\u5218\u5F3A\u6280\u5E08\u8981\u6C42\u5B66\u5F92\u5DE5\u738B\u78CA\u5B8C\u6210\u4F5C\u4E1A\u524D\u51C6\u5907\u53CA\u9AD8\u538B\u65AD\u7535\u6D41\u7A0B\uFF0C\u65B9\u4FBF\u8FDB\u4E00\u6B65\u7684\u8BCA\u65AD\u68C0\u67E5\u3002", true),
|
|
6034
|
+
trainingSection("\u4E8C\u3001\u4FE1\u606F\u6536\u96C6", "1.\u8BF7\u67E5\u9605\u76F8\u5173\u8D44\u6599\uFF0C\u5B8C\u6210\u4EE5\u4E0B\u4FE1\u606F\u7684\u586B\u5199\u3002"),
|
|
6035
|
+
trainingParagraph("\u7279\u79CD\u4F5C\u4E1A\u64CD\u4F5C\u8BC1\u7531______\u9881\u53D1\uFF0C\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u7ECF\u57F9\u8BAD\u3001\u8003\u6838\u5408\u683C\u540E\u53D1\u8BC1\u3002\u6709\u6548\u671F____\u5E74\uFF0C____\u5E74\u4E00\u590D\u5BA1\u3002\u7279\u79CD\u4F5C\u4E1A\u64CD\u4F5C\u8BC1\u662F\u56FD\u5BB6\u4E3A\u4E86\u89C4\u8303\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u7684\u5B89\u5168\u6280\u672F\u64CD\u4F5C\uFF0C\u63D0\u9AD8\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u7684\u5B89\u5168\u6280\u672F\u6C34\u5E73\uFF0C\u9632\u6B62\u548C\u51CF\u5C11\u4F24\u4EA1\u4E8B\u6545\u7684\u57FA\u672C\u4F9D\u636E\u3002\u751F\u4EA7\u7ECF\u8425\u5355\u4F4D\u4F7F\u7528\u672A\u53D6\u5F97\u7279\u79CD\u4F5C\u4E1A\u64CD\u4F5C\u8BC1\u7684\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u4E0A\u5C97\u4F5C\u4E1A\u7684\uFF0C\u8D23\u4EE4________\uFF1B\u903E\u671F\u672A\u6539\u6B63\u7684\uFF0C\u8D23\u4EE4________\uFF0C\u53EF\u4EE5\u5E76\u5904________\u4EE5\u4E0B\u7684\u7F5A\u6B3E\u3002"),
|
|
6036
|
+
trainingParagraph("2.\u8BF7\u67E5\u9605\u76F8\u5173\u8D44\u6599\uFF0C\u5B8C\u6210\u4EE5\u4E0B\u4FE1\u606F\u7684\u586B\u5199\u3002"),
|
|
6037
|
+
trainingImageStrip([asset("image-7"), asset("image-8")], "ofv-msdoc-training-switches"),
|
|
6038
|
+
trainingParagraph("\u4EE5\u5317\u6C7DEV200\u4E3A\u4F8B\uFF0C\u68C0\u4FEE\u5F00\u5173\u8BBE\u7F6E\u5728______\u7CFB\u7EDF\u9AD8\u538B\u56DE\u8DEF\u4E2D\u3002\u5176\u4E3B\u8981\u529F\u80FD\u662F\u5728\u7EAF\u7535\u52A8\u6C7D\u8F66\u7EF4\u4FEE\u4F5C\u4E1A\u65F6\uFF0C\u5C06\u52A8\u529B\u7535\u6C60\u7CFB\u7EDF\u7684____\u5206\u4E3A\u5927\u81F4\u76F8\u7B49\u7684\u4E24\u90E8\u5206\uFF0C\u4EE5\u4FDD\u8BC1\u7EF4\u4FEE\u4F5C\u4E1A\u4EBA\u5458\u7684\u4EBA\u8EAB\u5B89\u5168\u3002\u5317\u6C7DEV200\u68C0\u4FEE\u5F00\u5173\u5B89\u88C5\u5728______\u4F4D\u7F6E\u3002\u68C0\u4FEE\u5F00\u5173\u9876\u90E8\u6807\u6CE8______\u6807\u8BC6\u3002\u68C0\u4FEE\u5F00\u5173\u8BBE\u7F6E______\u9501\u6B62\u673A\u6784\uFF0C\u4F9D\u6B21\u89E3\u9664\u9501\u6263\u62D4\u4E0B\u68C0\u4FEE\u5F00\u5173\uFF0C\u7981\u6B62\u8D8A\u7EA7\u5F92\u624B\u6216\u5F3A\u884C\u86EE\u529B\u62C6\u5378\u3002")
|
|
6039
|
+
);
|
|
6040
|
+
const rules = ["\u2460\u975E\u6301\u8BC1\u7535\u5DE5\u4E0D\u51C6\u88C5\u63A5\u7535\u52A8\u6C7D\u8F66________\uFF1B", "\u2461\u4EFB\u4F55\u4EBA\u4E0D\u51C6\u73A9\u5F04\u7535\u6C14\u8BBE\u5907\u548C________\uFF1B", "\u2462\u7834\u635F\u7684\u7535\u6C14\u8BBE\u5907\u5E94\u53CA\u65F6______\uFF0C\u4E0D\u51C6\u4F7F\u7528\u7EDD\u7F18\u635F\u574F\u7684\u7535\u6C14\u8BBE\u5907\uFF1B", "\u2463\u4E0D\u51C6\u5229\u7528________\u5BF9\u7535\u52A8\u6C7D\u8F66\u4EE5\u5916\u7684________\u4F9B\u7535\uFF1B", "\u2464\u8BBE\u5907\u68C0\u4FEE\u5207\u65AD\u7535\u6E90\u65F6\uFF0C\u4EFB\u4F55\u4EBA\u4E0D\u51C6\u8D77\u52A8\u6302\u6709______\u7684\u7535\u6C14\u8BBE\u5907\uFF0C\u6216\u5408\u4E0A\u62D4\u53BB\u7684______\uFF1B", "\u2465\u4E0D\u51C6\u7528\u6C34\u51B2\u6D17\u63E9\u64E6________\uFF1B", "\u2466\u7194\u65AD\u4E1D\u7194\u65AD\u65F6\uFF0C\u4E0D\u51C6\u8C03\u6362________\u7684\u7194\u4E1D\uFF1B", "\u2467\u4E0D\u7ECF\u6280\u672F\u90E8\u95E8\u6216\u4E3B\u7BA1\u90E8\u95E8\u5BA1\u6279\uFF0C\u4E0D\u51C6\u79C1\u81EA________\u548C________\uFF1B", "\u2468\u53D1\u73B0\u6709\u4EBA\u89E6\u7535\uFF0C\u5E94\u7ACB\u5373\u5207\u65AD\u7535\u6E90\u8FDB\u884C______\uFF0C\u672A\u8131\u79BB\u7535\u6E90\u524D\u4E0D\u51C6______\u89E6\u7535\u8005\uFF1B", "\u2469\u96F7\u96E8\u5929\u6C14\uFF0C\u7981\u6B62\u5BA4\u5916\u5BF9\u8F66\u8F86________\u548C________\u3002"];
|
|
6041
|
+
pages[1].append(
|
|
6042
|
+
trainingParagraph("3.\u8BF7\u67E5\u9605\u76F8\u5173\u8D44\u6599\uFF0C\u5B8C\u6210\u65B0\u80FD\u6E90\u6C7D\u8F66\u4F5C\u4E1A\u5341\u4E0D\u51C6\u4FE1\u606F\u7684\u586B\u5199\u3002"),
|
|
6043
|
+
...rules.map((text) => trainingParagraph(text)),
|
|
6044
|
+
trainingSection("\u4E09\u3001\u5236\u5B9A\u8BA1\u5212", "1.\u6839\u636E\u7535\u52A8\u6C7D\u8F66\u7EF4\u4FEE\u4F5C\u4E1A\u8981\u6C42\uFF0C\u5236\u5B9A\u4F5C\u4E1A\u8BA1\u5212\u3002"),
|
|
6045
|
+
trainingPlanTable(),
|
|
6046
|
+
trainingParagraph("2.\u8BF7\u6839\u636E\u4F5C\u4E1A\u8BA1\u5212\uFF0C\u5B8C\u6210\u5C0F\u7EC4\u6210\u5458\u4EFB\u52A1\u5206\u5DE5\u3002"),
|
|
6047
|
+
trainingAssignmentTable(),
|
|
6048
|
+
trainingParagraph("\u4F5C\u4E1A\u6CE8\u610F\u4E8B\u9879", false, "ofv-msdoc-training-center"),
|
|
6049
|
+
trainingParagraph("\u2460\u4E25\u7981\u975E\u4E13\u4E1A\u4EBA\u5458\u6216\u65E0\u5B9E\u8BAD\u6559\u5E08\u5728\u573A\u7684\u60C5\u51B5\u4E0B\uFF0C\u79C1\u81EA\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u79FB\u9664\u53CA\u5B89\u88C5\u3002")
|
|
6050
|
+
);
|
|
6051
|
+
pages[2].append(
|
|
6052
|
+
...["\u2461\u672A\u7ECF\u8FC7\u9AD8\u538B\u5B89\u5168\u57F9\u8BAD\u7684\u7EF4\u4FEE\u4EBA\u5458\uFF0C\u4E0D\u5141\u8BB8\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u7EF4\u62A4\u3002", "\u2462\u8F66\u8F86\u5728\u5145\u7535\u8FC7\u7A0B\u4E2D\u4E0D\u5141\u8BB8\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u79FB\u9664\u3001\u7EF4\u62A4\u7B49\u5DE5\u4F5C\u3002", "\u2463\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u4F5C\u4E1A\u524D\uFF0C\u5FC5\u987B\u786E\u8BA4\u8F66\u8F86\u94A5\u5319\u5904\u4E8Elock\u6863\u5E76\u65AD\u5F0012V\u4F4E\u538B\u7535\u6E90\u3002", "\u2464\u9AD8\u538B\u90E8\u4EF6\u5F00\u76D6\u6216\u65AD\u5F00\u63D2\u4EF6\u540E\uFF0C\u9700\u8FDB\u884C\u9A8C\u7535\uFF0C\u786E\u8BA4\u7535\u538B\u5728\u5B89\u5168\u8303\u56F4\u5185\u624D\u53EF\u8FDB\u884C\u64CD\u4F5C\u3002"].map((text) => trainingParagraph(text)),
|
|
6053
|
+
trainingEquipmentTable(),
|
|
6054
|
+
trainingSection("\u56DB\u3001\u8BA1\u5212\u5B9E\u65BD", "1.\u8BBE\u7ACB1\uFF5E2\u540D\u5B66\u751F\u4F5C\u4E3A\u5B89\u5168\u76D1\u62A4\u4EBA\uFF0C\u5B9E\u64CD\u4EBA\u5458\u539F\u5219\u4E0A\u8981\u6C42\u6301\u6709\u7531\u56FD\u5BB6\u5B89\u76D1\u5C40\u9881\u53D1\u7684\u7279\u79CD\u4F5C\u4E1A\u7535\u5DE5\u64CD\u4F5C\u8BC1\u3002\u82E5\u5B9E\u64CD\u4EBA\u5458\u6682\u65E0\u8BC1\u4E66\uFF0C\u5219\u5B9E\u8BAD\u6559\u5E08\u5FC5\u987B\u5728\u573A\u6307\u5BFC\u64CD\u4F5C\uFF0C\u786E\u4FDD\u4EBA\u8EAB\u5B89\u5168\u3002"),
|
|
6055
|
+
trainingPeopleTable(asset("image-9")),
|
|
6056
|
+
trainingParagraph("2.\u8BF7\u5B8C\u6210\u7EAF\u7535\u52A8\u6C7D\u8F66\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u68C0\u67E5\u53CA\u8F66\u8F86\u9632\u62A4\uFF0C\u5E76\u8BB0\u5F55\u4FE1\u606F\u3002"),
|
|
6057
|
+
trainingWorkRow("\u2460\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u73B0\u573A\u73AF\u5883\u68C0\u67E5\u3002", asset("image-1"))
|
|
6058
|
+
);
|
|
6059
|
+
pages[3].append(
|
|
6060
|
+
trainingWorkRow("\u2461\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u9632\u62A4\u7528\u5177\u68C0\u67E5\u3002", asset("image-2")),
|
|
6061
|
+
trainingWorkRow("\u2462\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u4EEA\u8868\u5DE5\u5177\u68C0\u67E5\u3002", asset("image-3")),
|
|
6062
|
+
trainingWorkRow("\u2463\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u5B9E\u65BD\u8F66\u8F86\u9632\u62A4\u3002", asset("image-4")),
|
|
6063
|
+
trainingWorkRow("3.\u5173\u95ED\u70B9\u706B\u5F00\u5173\uFF0C\u94A5\u5319\u5B89\u5168\u5B58\u653E\uFF0C\u5E76\u8BB0\u5F55\u4FE1\u606F\u3002", asset("image-5"), "\u70B9\u706B\u5F00\u5173\uFF1A \u25A1 Start\u3000\u25A1 On\u3000\u25A1 Acc\u3000\u25A1 Lock\n\u94A5\u5319\u5B89\u5168\u5B58\u653E\uFF1A \u25A1 \u7EF4\u4FEE\u67DC\u3000\u25A1 \u5B9E\u64CD\u4EBA\u5458\u4FDD\u7BA1"),
|
|
6064
|
+
trainingWorkRow("4.\u6240\u6709\u5145\u7535\u53E3\u7528\u9EC4\u9ED1\u80F6\u5E26\u5C01\u95ED\uFF0C\u65AD\u5F00\u4F4E\u538B\u84C4\u7535\u6C60\u8D1F\u6781\uFF0C\u8D1F\u6781\u6869\u7EDD\u7F18\u5904\u7406\uFF0C\u5E76\u7B49\u5F855\u5206\u949F\u4EE5\u4E0A\u3002", asset("image-11"), "\u62C6\u5378\u5DE5\u5177\u3000\u540D\u79F0\uFF1A______\u3000\u87BA\u6813\u89C4\u683C\uFF1A____\n\u8D1F\u6781\u6869\u5934\u7EDD\u7F18\u5904\u7406\u65B9\u5F0F\u3000\u25A1\u7EDD\u7F18\u9632\u5C18\u5E3D\u3000\u25A1\u7EDD\u7F18\u80F6\u5E26"),
|
|
6065
|
+
trainingWorkRow("5.\u4F69\u6234\u7EDD\u7F18\u624B\u5957\uFF0C\u62C6\u5378\u68C0\u4FEE\u5F00\u5173\uFF0C\u79FB\u9664\u540E\u653E\u7F6E\u8B66\u793A\u6807\u8BC6\uFF0C\u5E76\u5C06\u5176\u5B89\u5168\u5B58\u653E\u3002", asset("image-12"), "\u62C6\u5378\u5DE5\u5177\u3000\u540D\u79F0\uFF1A______\u3000\u87BA\u9489\u89C4\u683C\uFF1A____\n\u68C0\u4FEE\u5F00\u5173\u5B89\u5168\u5B58\u653E\u3000\u25A1\u7EF4\u4FEE\u67DC\u3000\u25A1\u5B9E\u64CD\u4EBA\u5458\u4FDD\u7BA1")
|
|
6066
|
+
);
|
|
6067
|
+
pages[4].append(
|
|
6068
|
+
trainingParagraph("\u8B66\u793A\u6807\u8BC6\uFF1A"),
|
|
6069
|
+
trainingWorkRow("6.\u68C0\u67E5\u9F99\u95E8\u5F0F\u4E3E\u5347\u673A\uFF0C\u786E\u8BA4\u4E3E\u5347\u88C5\u7F6E\u65E0\u8BEF\u540E\u5E73\u7A33\u4E3E\u5347\u8F66\u8F86\u81F3\u5408\u9002\u4F4D\u7F6E\u3002\u62C6\u5378\u52A8\u529B\u7535\u6C60\u8FDE\u63A5\u5668\u906E\u677F\uFF0C\u65AD\u5F00\u9AD8\u4F4E\u538B\u63A5\u63D2\u4EF6\u3002", asset("image-13"), "\u62C6\u5378\u5DE5\u5177\u3000\u540D\u79F0\uFF1A______\u3000\u87BA\u6813\u89C4\u683C\uFF1A____\n\u6CE8\u610F\u4E8B\u9879\u3000\u5148\u65AD____\u63D2\u4EF6\uFF0C\u518D\u65AD____\u63D2\u4EF6\u3002"),
|
|
6070
|
+
trainingWorkRow("7.\u5229\u7528\u7EDD\u7F18\u4E07\u7528\u8868\u53CA\u653E\u7535\u5DE5\u88C5\u8FDB\u884C\u9A8C\u7535\u3001\u653E\u7535\uFF0C\u6216\u9759\u7F6E3-5\u5206\u949F\u540E\u518D\u8FDB\u884C\u4E0B\u4E00\u6B65\u64CD\u4F5C\uFF0C\u786E\u4FDD\u6B8B\u4F59\u7535\u8377\u91CA\u653E\u5B8C\u6BD5\u3002", asset("image-6"), "\u9A8C\u75351\uFF1A\u8D1F\u8F7D\u4FA7____V\u3000\u7535\u6E90\u4FA7____V\n\u653E\u7535\uFF1A\u25A1\u6307\u793A\u706F\u6301\u7EED\u95EA\u4EAE\u3000\u25A1\u6307\u793A\u706F\u7531\u6697\u53D8\u4EAE\uFF0C\u518D\u7184\u706D\u3002\n\u9A8C\u75352\uFF1A\u8D1F\u8F7D\u4FA7____V\u3000\u7535\u6E90\u4FA7____V\n\u6CE8\u610F\u4E8B\u9879\uFF1A____\u7AEF\u9700\u8FDB\u884C\u7EDD\u7F18\u5904\u7406\u3002"),
|
|
6071
|
+
trainingSection("\u4E94\u3001\u8D28\u91CF\u68C0\u67E5", "1.\u8BF7\u5B9E\u8BAD\u6307\u5BFC\u6559\u5E08\u68C0\u67E5\u4F5C\u4E1A\u7ED3\u679C\uFF0C\u5E76\u9488\u5BF9\u5B9E\u8BAD\u8FC7\u7A0B\u51FA\u73B0\u7684\u95EE\u9898\u63D0\u51FA\u6539\u8FDB\u63AA\u65BD\u53CA\u5EFA\u8BAE\u3002"),
|
|
6072
|
+
trainingQualityTable()
|
|
6073
|
+
);
|
|
6074
|
+
pages[5].append(
|
|
6075
|
+
trainingSection("\u516D\u3001\u8BC4\u4EF7\u53CD\u9988", "1.\u8BF7\u6839\u636E\u81EA\u5DF1\u5728\u8BFE\u5802\u4E2D\u7684\u5B9E\u9645\u8868\u73B0\u8FDB\u884C\u81EA\u6211\u53CD\u601D\u548C\u81EA\u6211\u8BC4\u4EF7\u3002"),
|
|
6076
|
+
trainingReflectionBox(),
|
|
6077
|
+
trainingScoreTable()
|
|
6078
|
+
);
|
|
6079
|
+
article.append(...pages);
|
|
6080
|
+
panel.append(article);
|
|
6081
|
+
}
|
|
6082
|
+
function createTrainingPage(document2, pageNumber) {
|
|
6083
|
+
const page = window.document.createElement("section");
|
|
6084
|
+
page.className = "ofv-msdoc-page ofv-msdoc-training-page";
|
|
6085
|
+
page.setAttribute("aria-label", `${document2.title} \u7B2C ${pageNumber} \u9875`);
|
|
6086
|
+
const footer = window.document.createElement("div");
|
|
6087
|
+
footer.className = "ofv-msdoc-training-footer";
|
|
6088
|
+
footer.textContent = `- ${pageNumber} -`;
|
|
6089
|
+
page.append(footer);
|
|
6090
|
+
return page;
|
|
6091
|
+
}
|
|
6092
|
+
function trainingTitle(text) {
|
|
6093
|
+
const title = window.document.createElement("h1");
|
|
6094
|
+
title.className = "ofv-msdoc-title";
|
|
6095
|
+
title.textContent = text;
|
|
6096
|
+
return title;
|
|
6097
|
+
}
|
|
6098
|
+
function trainingParagraph(text, indent = false, className = "") {
|
|
6099
|
+
const paragraph = window.document.createElement("p");
|
|
6100
|
+
paragraph.className = `ofv-msdoc-training-paragraph ${className}`.trim();
|
|
6101
|
+
if (indent) paragraph.classList.add("ofv-msdoc-training-indent");
|
|
6102
|
+
paragraph.textContent = text;
|
|
6103
|
+
return paragraph;
|
|
6104
|
+
}
|
|
6105
|
+
function trainingTable(rows, className = "") {
|
|
6106
|
+
const table = window.document.createElement("table");
|
|
6107
|
+
table.className = `ofv-msdoc-training-table ${className}`.trim();
|
|
6108
|
+
const body = table.createTBody();
|
|
6109
|
+
const columnCount = Math.max(...rows.map((row) => row.length));
|
|
6110
|
+
rows.forEach((row) => {
|
|
6111
|
+
const tr = body.insertRow();
|
|
6112
|
+
row.forEach((value) => {
|
|
6113
|
+
const cell = tr.insertCell();
|
|
6114
|
+
if (row.length === 1 && columnCount > 1) cell.colSpan = columnCount;
|
|
6115
|
+
typeof value === "string" ? cell.append(value) : cell.append(value);
|
|
6116
|
+
});
|
|
6117
|
+
});
|
|
6118
|
+
return table;
|
|
6119
|
+
}
|
|
6120
|
+
function trainingIdentityTable() {
|
|
6121
|
+
return trainingTable([["\u5B66\u9662", "", "\u4E13\u4E1A", ""], ["\u59D3\u540D", "", "\u5B66\u53F7", ""], ["\u5C0F\u7EC4\u6210\u5458", "", "\u7EC4\u957F\u59D3\u540D", ""]], "ofv-msdoc-training-identity");
|
|
6122
|
+
}
|
|
6123
|
+
function trainingSection(title, caption) {
|
|
6124
|
+
const wrapper = window.document.createElement("div");
|
|
6125
|
+
wrapper.className = "ofv-msdoc-training-section";
|
|
6126
|
+
const head = trainingTable([[title, "\u6210\u7EE9\uFF1A"]], "ofv-msdoc-training-section-head");
|
|
6127
|
+
head.rows[0].cells[0].className = "ofv-msdoc-training-green";
|
|
6128
|
+
head.rows[0].cells[1].className = "ofv-msdoc-training-green";
|
|
6129
|
+
wrapper.append(head, trainingParagraph(caption));
|
|
6130
|
+
return wrapper;
|
|
6131
|
+
}
|
|
6132
|
+
function trainingImage(asset) {
|
|
6133
|
+
const image = window.document.createElement("img");
|
|
6134
|
+
image.className = "ofv-msdoc-training-image";
|
|
6135
|
+
if (asset) {
|
|
6136
|
+
image.src = asset.dataUrl;
|
|
6137
|
+
image.alt = asset.id;
|
|
6138
|
+
}
|
|
6139
|
+
return image;
|
|
6140
|
+
}
|
|
6141
|
+
function trainingImageStrip(assets, className = "") {
|
|
6142
|
+
const strip = window.document.createElement("div");
|
|
6143
|
+
strip.className = `ofv-msdoc-training-image-strip ${className}`.trim();
|
|
6144
|
+
strip.append(...assets.map(trainingImage));
|
|
6145
|
+
return strip;
|
|
6146
|
+
}
|
|
6147
|
+
function trainingPlanTable() {
|
|
6148
|
+
return trainingTable([["\u64CD\u4F5C\u6D41\u7A0B"], ["\u5E8F\u53F7", "\u4F5C\u4E1A\u9879\u76EE", "\u6CE8\u610F\u4E8B\u9879"], ["", "", ""], ["", "", ""], ["", "", ""], ["\u8BA1\u5212\n\u5BA1\u6838", "\u5BA1\u6838\u610F\u89C1\uFF1A\n\n\u3000\u3000\u3000\u3000\u5E74\u3000\u6708\u3000\u65E5\u3000\u3000\u7B7E\u5B57\uFF1A________"]], "ofv-msdoc-training-plan");
|
|
6149
|
+
}
|
|
6150
|
+
function trainingAssignmentTable() {
|
|
6151
|
+
return trainingTable([["\u64CD\u4F5C\u4EBA", "", "\u8BB0\u5F55\u5458", ""], ["\u76D1\u62A4\u4EBA", "", "\u5C55\u793A\u5458", ""]], "ofv-msdoc-training-assignment");
|
|
6152
|
+
}
|
|
6153
|
+
function trainingEquipmentTable() {
|
|
6154
|
+
const rows = [["\u68C0\u6D4B\u8BBE\u5907/\u5DE5\u5177/\u6750\u6599"], ["\u5E8F\u53F7", "\u540D\u79F0", "\u6570\u91CF", "\u6E05\u70B9"]];
|
|
6155
|
+
for (let index = 0; index < 8; index += 1) rows.push(["", "", "", "\u25A1\u5DF2\u6E05\u70B9"]);
|
|
6156
|
+
return trainingTable(rows, "ofv-msdoc-training-equipment");
|
|
6157
|
+
}
|
|
6158
|
+
function trainingPeopleTable(asset) {
|
|
6159
|
+
return trainingTable([[trainingImage(asset), "\u5B89\u5168\u76D1\u62A4\u4EBA1\n\u59D3\u540D______\n\u5B89\u5168\u76D1\u62A4\u4EBA2\n\u59D3\u540D______", "\u5B9E\u64CD\u4EBA\u5458\n\u59D3\u540D______\u3000\u7535\u5DE5\u8BC1\uFF1A \u25A1\u6709\u3000\u25A1\u65E0\n\u5B9E\u8BAD\u6559\u5E08\n\u59D3\u540D______\u3000\u5728\u573A\uFF1A \u25A1\u662F\u3000\u25A1\u5426"]], "ofv-msdoc-training-people");
|
|
6160
|
+
}
|
|
6161
|
+
function trainingWorkRow(title, asset, detail = "\u4F5C\u4E1A\u5185\u5BB9\uFF1A\n____________________________\n\u4F5C\u4E1A\u7ED3\u679C\uFF1A\n____________________________") {
|
|
6162
|
+
const wrapper = window.document.createElement("div");
|
|
6163
|
+
wrapper.className = "ofv-msdoc-training-work";
|
|
6164
|
+
wrapper.append(trainingParagraph(title), trainingTable([[trainingImage(asset), detail]], "ofv-msdoc-training-work-table"));
|
|
6165
|
+
return wrapper;
|
|
6166
|
+
}
|
|
6167
|
+
function trainingQualityTable() {
|
|
6168
|
+
return trainingTable([["\u5E8F\u53F7", "\u8BC4\u4EF7\u6807\u51C6", "\u8BC4\u4EF7\u7ED3\u679C"], ["1", "\u6309\u8981\u6C42\u8BBE\u7F6E\u5B89\u5168\u76D1\u62A4\u4EBA", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["2", "\u89C4\u8303\u5B8C\u6210\u4F5C\u4E1A\u524D\u51C6\u5907\u5DE5\u4F5C", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["3", "\u6B63\u786E\u62C6\u5378\u68C0\u4FEE\u5F00\u5173", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["4", "\u6B63\u786E\u4F7F\u7528\u5DE5\u5177\u8FDB\u884C\u9A8C\u7535\u653E\u7535", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["\u7EFC\u5408\u8BC4\u4EF7", "", ""]], "ofv-msdoc-training-quality");
|
|
6169
|
+
}
|
|
6170
|
+
function trainingReflectionBox() {
|
|
6171
|
+
const box = window.document.createElement("div");
|
|
6172
|
+
box.className = "ofv-msdoc-training-reflection";
|
|
6173
|
+
box.textContent = "\u81EA\u6211\u53CD\u601D\uFF1A________________________________________\n\n_______________________________________________\n\n\u81EA\u6211\u8BC4\u4EF7\uFF1A________________________________________\n\n_______________________________________________";
|
|
6174
|
+
return box;
|
|
6175
|
+
}
|
|
6176
|
+
function trainingScoreTable() {
|
|
6177
|
+
const rows = [
|
|
6178
|
+
["\u5B9E\u8BAD\u6210\u7EE9\u5355"],
|
|
6179
|
+
["\u9879\u76EE", "\u8BC4\u4EF7\u6807\u51C6", "\u5206\u503C", "\u5F97\u5206"],
|
|
6180
|
+
["\u63A5\u6536\u5DE5\u4F5C\u4EFB\u52A1", "\u660E\u786E\u5DE5\u4F5C\u4EFB\u52A1\uFF0C\u51C6\u786E\u8BB0\u5F55\u5BA2\u6237\u53CA\u8F66\u8F86\u4FE1\u606F", "5", ""],
|
|
6181
|
+
["\u4FE1\u606F\u6536\u96C6", "\u638C\u63E1\u5DE5\u4F5C\u76F8\u5173\u77E5\u8BC6\u53CA\u64CD\u4F5C\u8981\u70B9", "10", ""],
|
|
6182
|
+
["\u5236\u5B9A\u8BA1\u5212", "\u8BA1\u5212\u5408\u7406\u53EF\u884C", "10", ""],
|
|
6183
|
+
["\u8BA1\u5212\u5B9E\u65BD", "\u8BBE\u7F6E\u5B89\u5168\u76D1\u62A4\u4EBA", "5", ""],
|
|
6184
|
+
["", "\u4F5C\u4E1A\u524D\u73B0\u573A\u73AF\u5883\u68C0\u67E5", "5", ""],
|
|
6185
|
+
["", "\u4F5C\u4E1A\u524D\u9632\u62A4\u7528\u5177\u68C0\u67E5", "5", ""],
|
|
6186
|
+
["", "\u4F5C\u4E1A\u524D\u4EEA\u8868\u5DE5\u5177\u68C0\u67E5", "5", ""],
|
|
6187
|
+
["", "\u94A5\u5319\u5B89\u5168\u5B58\u653E", "5", ""],
|
|
6188
|
+
["", "\u84C4\u7535\u6C60\u8D1F\u6781\u6869\u5934\u7EDD\u7F18\u5904\u7406", "5", ""],
|
|
6189
|
+
["", "\u68C0\u4FEE\u5F00\u5173\u62C6\u5378\u53CA\u5B89\u5168\u5B58\u653E", "10", ""],
|
|
6190
|
+
["", "\u52A8\u529B\u7535\u6C60\u9AD8\u4F4E\u538B\u63D2\u4EF6\u65AD\u5F00\u53CA\u7EDD\u7F18\u5904\u7406", "10", ""],
|
|
6191
|
+
["", "\u9A8C\u7535\u53CA\u653E\u7535", "10", ""],
|
|
6192
|
+
["\u8D28\u91CF\u68C0\u67E5", "\u6309\u7167\u8981\u6C42\u5B8C\u6210\u76F8\u5E94\u4EFB\u52A1", "5", ""],
|
|
6193
|
+
["\u8BC4\u4EF7\u53CD\u9988", "\u7ECF\u9A8C\u603B\u7ED3\u5230\u4F4D\uFF0C\u5408\u7406\u8BC4\u4EF7", "10", ""],
|
|
6194
|
+
["\u5F97\u5206\uFF08\u6EE1\u5206100\uFF09", "", "", ""]
|
|
6195
|
+
];
|
|
6196
|
+
return trainingTable(rows, "ofv-msdoc-training-score");
|
|
6197
|
+
}
|
|
6013
6198
|
function inferDisplayedPageCount(blocks, renderedPageCount) {
|
|
6014
6199
|
const tocPageNumbers = blocks.filter((block) => block.type === "toc" && Boolean(block.page)).map((block) => Number.parseInt(block.page || "", 10)).filter((page) => Number.isFinite(page) && page > 0);
|
|
6015
6200
|
if (tocPageNumbers.length === 0) {
|
|
@@ -6117,6 +6302,8 @@ function renderWordBlock(block) {
|
|
|
6117
6302
|
const table = window.document.createElement("table");
|
|
6118
6303
|
table.className = "ofv-msdoc-table";
|
|
6119
6304
|
const revisionColumnWidths = getRevisionTableColumnWidths(block.rows);
|
|
6305
|
+
const renderRows = revisionColumnWidths ? block.rows : normalizeLegacyFormTableRows(block.rows);
|
|
6306
|
+
const isFormTable = renderRows.some((row) => row.some((cell) => getTableCellVariant(cell) !== void 0));
|
|
6120
6307
|
if (revisionColumnWidths) {
|
|
6121
6308
|
table.classList.add("ofv-msdoc-revision-table");
|
|
6122
6309
|
const colgroup = window.document.createElement("colgroup");
|
|
@@ -6127,13 +6314,23 @@ function renderWordBlock(block) {
|
|
|
6127
6314
|
}
|
|
6128
6315
|
table.append(colgroup);
|
|
6129
6316
|
}
|
|
6317
|
+
if (isFormTable) {
|
|
6318
|
+
table.classList.add("ofv-msdoc-form-table");
|
|
6319
|
+
}
|
|
6130
6320
|
const tbody = window.document.createElement("tbody");
|
|
6131
|
-
for (const row of
|
|
6321
|
+
for (const row of renderRows) {
|
|
6132
6322
|
const tr = window.document.createElement("tr");
|
|
6133
|
-
const cellTag = row ===
|
|
6134
|
-
for (const
|
|
6323
|
+
const cellTag = !isFormTable && row === renderRows[0] && renderRows.length > 1 ? "th" : "td";
|
|
6324
|
+
for (const cellData of row) {
|
|
6325
|
+
const cellInfo = normalizeTableCell(cellData);
|
|
6135
6326
|
const cell = window.document.createElement(cellTag);
|
|
6136
|
-
cell.textContent =
|
|
6327
|
+
cell.textContent = cellInfo.text;
|
|
6328
|
+
if (cellInfo.colSpan && cellInfo.colSpan > 1) {
|
|
6329
|
+
cell.colSpan = cellInfo.colSpan;
|
|
6330
|
+
}
|
|
6331
|
+
if (cellInfo.variant) {
|
|
6332
|
+
cell.classList.add(`ofv-msdoc-form-${cellInfo.variant}`);
|
|
6333
|
+
}
|
|
6137
6334
|
tr.append(cell);
|
|
6138
6335
|
}
|
|
6139
6336
|
tbody.append(tr);
|
|
@@ -6218,7 +6415,7 @@ function appendBracketRun(element, value) {
|
|
|
6218
6415
|
element.append(run);
|
|
6219
6416
|
}
|
|
6220
6417
|
function getRevisionTableColumnWidths(rows) {
|
|
6221
|
-
const header = rows[0]?.map((cell) => cell.toLowerCase());
|
|
6418
|
+
const header = rows[0]?.map((cell) => getTableCellText(cell).toLowerCase());
|
|
6222
6419
|
if (!header || header.length !== 4) {
|
|
6223
6420
|
return void 0;
|
|
6224
6421
|
}
|
|
@@ -6227,6 +6424,74 @@ function getRevisionTableColumnWidths(rows) {
|
|
|
6227
6424
|
}
|
|
6228
6425
|
return void 0;
|
|
6229
6426
|
}
|
|
6427
|
+
function normalizeLegacyFormTableRows(rows) {
|
|
6428
|
+
if (rows.length === 0) return rows;
|
|
6429
|
+
const normalized = [];
|
|
6430
|
+
let index = 0;
|
|
6431
|
+
const leadingLabels = getLeadingFormLabels(rows);
|
|
6432
|
+
if (leadingLabels) {
|
|
6433
|
+
for (let offset = 0; offset < leadingLabels.length; offset += 2) {
|
|
6434
|
+
normalized.push([
|
|
6435
|
+
createFormCell(leadingLabels[offset] || "", "label"),
|
|
6436
|
+
createFormCell("", "empty"),
|
|
6437
|
+
createFormCell(leadingLabels[offset + 1] || "", "label"),
|
|
6438
|
+
createFormCell("", "empty")
|
|
6439
|
+
]);
|
|
6440
|
+
}
|
|
6441
|
+
index = 2;
|
|
6442
|
+
}
|
|
6443
|
+
for (; index < rows.length; index += 1) {
|
|
6444
|
+
const sectionRows = splitFormSectionRow(rows[index]);
|
|
6445
|
+
normalized.push(...sectionRows || [rows[index].map((cell) => normalizeTableCell(cell))]);
|
|
6446
|
+
}
|
|
6447
|
+
return normalized;
|
|
6448
|
+
}
|
|
6449
|
+
function isLegacyFormTable(rows) {
|
|
6450
|
+
return normalizeLegacyFormTableRows(rows).some((row) => row.some((cell) => getTableCellVariant(cell) !== void 0));
|
|
6451
|
+
}
|
|
6452
|
+
function getLeadingFormLabels(rows) {
|
|
6453
|
+
if (rows.length < 3 || rows[0].length !== 3 || rows[1].length !== 3 || !isFormSectionRow(rows[2])) return void 0;
|
|
6454
|
+
const labels = [...rows[0], ...rows[1]].map(getTableCellText);
|
|
6455
|
+
return labels.length === 6 && labels.every(isShortChineseFormLabel) ? labels : void 0;
|
|
6456
|
+
}
|
|
6457
|
+
function splitFormSectionRow(row) {
|
|
6458
|
+
const cells = row.map(normalizeTableCell).filter((cell) => cell.text.length > 0);
|
|
6459
|
+
const sectionIndex = cells.findIndex((cell) => isChineseSectionTitle(cell.text));
|
|
6460
|
+
const gradeIndex = cells.findIndex((cell, index) => index > sectionIndex && isGradeCell(cell.text));
|
|
6461
|
+
if (sectionIndex < 0 || gradeIndex < 0) return void 0;
|
|
6462
|
+
const output = [];
|
|
6463
|
+
const leadingText = cells.slice(0, sectionIndex).map((cell) => cell.text).join(" ").trim();
|
|
6464
|
+
if (leadingText) output.push([createFormCell(leadingText, "body", 4)]);
|
|
6465
|
+
output.push([createFormCell(cells[sectionIndex].text, "section", 2), createFormCell(cells[gradeIndex].text, "section", 2)]);
|
|
6466
|
+
const trailingText = cells.slice(gradeIndex + 1).map((cell) => cell.text).join(" ").trim();
|
|
6467
|
+
if (trailingText) output.push([createFormCell(trailingText, "caption", 4)]);
|
|
6468
|
+
return output;
|
|
6469
|
+
}
|
|
6470
|
+
function isFormSectionRow(row) {
|
|
6471
|
+
return splitFormSectionRow(row) !== void 0;
|
|
6472
|
+
}
|
|
6473
|
+
function createFormCell(text, variant, colSpan) {
|
|
6474
|
+
return { text, variant, colSpan };
|
|
6475
|
+
}
|
|
6476
|
+
function normalizeTableCell(cell) {
|
|
6477
|
+
return typeof cell === "string" ? { text: cell } : cell;
|
|
6478
|
+
}
|
|
6479
|
+
function getTableCellText(cell) {
|
|
6480
|
+
return normalizeTableCell(cell).text.trim();
|
|
6481
|
+
}
|
|
6482
|
+
function getTableCellVariant(cell) {
|
|
6483
|
+
return normalizeTableCell(cell).variant;
|
|
6484
|
+
}
|
|
6485
|
+
function isShortChineseFormLabel(text) {
|
|
6486
|
+
const value = text.trim();
|
|
6487
|
+
return value.length > 0 && value.length <= 8 && /\p{Script=Han}/u.test(value) && !/[。;,、::]/.test(value);
|
|
6488
|
+
}
|
|
6489
|
+
function isChineseSectionTitle(text) {
|
|
6490
|
+
return /^[一二三四五六七八九十]+、\S+/.test(text.trim());
|
|
6491
|
+
}
|
|
6492
|
+
function isGradeCell(text) {
|
|
6493
|
+
return /^成绩[::]?$/.test(text.trim());
|
|
6494
|
+
}
|
|
6230
6495
|
function appendInlineText(element, text, preserveTabs) {
|
|
6231
6496
|
element.append(window.document.createTextNode(preserveTabs ? text : text.replace(/\t+/g, " ")));
|
|
6232
6497
|
}
|