lyflowchart 1.0.115 → 1.0.133
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/ActionsConfig-BuvSvRbv.js +395 -0
- package/dist/ActionsConfig-BuvSvRbv.js.map +1 -0
- package/dist/ApprovalEditorModal-suKPJ-vN.js +48 -0
- package/dist/ApprovalEditorModal-suKPJ-vN.js.map +1 -0
- package/dist/CancelModal-BUi3ieI8.js +61 -0
- package/dist/CancelModal-BUi3ieI8.js.map +1 -0
- package/dist/Cell_click_approve-Dr83RkI-.js +244 -0
- package/dist/Cell_click_approve-Dr83RkI-.js.map +1 -0
- package/dist/JsonTags-BbWLqghI.js +66 -0
- package/dist/JsonTags-BbWLqghI.js.map +1 -0
- package/dist/MyProcess-FWGEwQcv.js +26434 -0
- package/dist/MyProcess-FWGEwQcv.js.map +1 -0
- package/dist/MyProcess.vue.d.ts +991 -0
- package/dist/approval-BW2WjPxY.js +167 -0
- package/dist/approval-BW2WjPxY.js.map +1 -0
- package/dist/approval-BaVHder3.js +18 -0
- package/dist/approval-BaVHder3.js.map +1 -0
- package/dist/approvalHistory-B2gpQbFC.js +868 -0
- package/dist/approvalHistory-B2gpQbFC.js.map +1 -0
- package/dist/approvalHistoryViewModal-DgLpv2ot.js +114 -0
- package/dist/approvalHistoryViewModal-DgLpv2ot.js.map +1 -0
- package/dist/approvalPageConfig-D0zPXOUf.js +2437 -0
- package/dist/approvalPageConfig-D0zPXOUf.js.map +1 -0
- package/dist/approveLeftConfig-BOU_UgHp.js +136 -0
- package/dist/approveLeftConfig-BOU_UgHp.js.map +1 -0
- package/dist/codeHistoryViewModal-BfSjIbEU.js +103 -0
- package/dist/codeHistoryViewModal-BfSjIbEU.js.map +1 -0
- package/dist/columnTables-DLwtgcC7.js +1272 -0
- package/dist/columnTables-DLwtgcC7.js.map +1 -0
- package/dist/components/Cell_click_approve.vue.d.ts +5 -0
- package/dist/components/Cell_click_data_source.vue.d.ts +6 -0
- package/dist/components/Process/common/bpmnUtils.d.ts +8 -0
- package/dist/components/Process/common/global.d.ts +16 -0
- package/dist/components/Process/common/index.d.ts +5 -0
- package/dist/components/Process/component/JsonTags2.vue.d.ts +60 -0
- package/dist/components/Process/component/ValueInput2.vue.d.ts +74 -0
- package/dist/components/Process/component/columnNameField2.vue.d.ts +51 -0
- package/dist/components/Process/component/data.d.ts +157 -0
- package/dist/components/Process/customPanel/CustomContextPad.d.ts +31 -0
- package/dist/components/Process/customPanel/CustomPalette.d.ts +89 -0
- package/dist/components/Process/customPanel/customTranslate.d.ts +1 -0
- package/dist/components/Process/customPanel/index.d.ts +8 -0
- package/dist/components/Process/designer.vue.d.ts +589 -0
- package/dist/components/Process/flowable/init.d.ts +1 -0
- package/dist/components/Process/index.vue.d.ts +812 -0
- package/dist/components/Process/lang/zh.d.ts +249 -0
- package/dist/components/Process/panel/ButtonsPanel.vue.d.ts +24 -0
- package/dist/components/Process/panel/PropertiesPanel.vue.d.ts +24 -0
- package/dist/components/Process/panel/commonPanel.vue.d.ts +40 -0
- package/dist/components/Process/panel/conditionPanel.vue.d.ts +271 -0
- package/dist/components/Process/panel/executionListener.vue.d.ts +66 -0
- package/dist/components/Process/panel/formPanel.vue.d.ts +7 -0
- package/dist/components/Process/panel/multiInstance.vue.d.ts +33 -0
- package/dist/components/Process/panel/otherPanel.vue.d.ts +17 -0
- package/dist/components/Process/panel/taskListener.vue.d.ts +64 -0
- package/dist/components/Process/panel/taskPanel.vue.d.ts +254 -0
- package/dist/components/Process/viewer/index.vue.d.ts +41 -0
- package/dist/components/approval/ApprovalEditorModal.vue.d.ts +26 -0
- package/dist/components/approval/CostCompanySelect.vue.d.ts +29 -0
- package/dist/components/approval/CostDepartmentSelect.vue.d.ts +35 -0
- package/dist/components/approval/CreateByCascader.vue.d.ts +27 -0
- package/dist/components/approval/CreateBySelect.vue.d.ts +35 -0
- package/dist/components/approval/PostionCascader.vue.d.ts +26 -0
- package/dist/components/approval/SystemTime.vue.d.ts +38 -0
- package/dist/components/approval/approvalViewId.d.ts +36 -0
- package/dist/components/approval/components/CancelModal.vue.d.ts +25 -0
- package/dist/components/approval/components/FormCodeInput.vue.d.ts +33 -0
- package/dist/components/approval/components/FormContextInput.vue.d.ts +33 -0
- package/dist/components/approval/components/FormFlowOrgInput.vue.d.ts +40 -0
- package/dist/components/approval/components/actionsBar.vue.d.ts +17 -0
- package/dist/components/approval/components/approvalHistory/approvalHistoryViewModal.vue.d.ts +41 -0
- package/dist/components/approval/components/approvalHistory/dataStoreSettingHistory.vue.d.ts +55 -0
- package/dist/components/approval/components/approvalHistory/dataStoreSettingHistoryViewModal.vue.d.ts +41 -0
- package/dist/components/approval/components/approvalHistory/flowHistoryViewModal.vue.d.ts +41 -0
- package/dist/components/approval/components/approvalHistory/flowSettingHistory.vue.d.ts +55 -0
- package/dist/components/approval/components/approvalHistory/index.vue.d.ts +212 -0
- package/dist/components/approval/components/approvalHistory/pageSettingHistory.vue.d.ts +55 -0
- package/dist/components/approval/components/approvalPageConfig/ActionsConfig.vue.d.ts +112 -0
- package/dist/components/approval/components/approvalPageConfig/BaseConditions.vue.d.ts +205 -0
- package/dist/components/approval/components/approvalPageConfig/CodeEditorWraper.vue.d.ts +51 -0
- package/dist/components/approval/components/approvalPageConfig/ColumnConfig.vue.d.ts +145 -0
- package/dist/components/approval/components/approvalPageConfig/ConditionFieldMulType.vue.d.ts +137 -0
- package/dist/components/approval/components/approvalPageConfig/JsonInput.vue.d.ts +38 -0
- package/dist/components/approval/components/approvalPageConfig/JsonTags.vue.d.ts +26 -0
- package/dist/components/approval/components/approvalPageConfig/JsonText.vue.d.ts +36 -0
- package/dist/components/approval/components/approvalPageConfig/approveLeftConfig.vue.d.ts +6 -0
- package/dist/components/approval/components/approvalPageConfig/baseConfig.vue.d.ts +10 -0
- package/dist/components/approval/components/approvalPageConfig/cellEdit.vue.d.ts +23 -0
- package/dist/components/approval/components/approvalPageConfig/configSync.vue.d.ts +76 -0
- package/dist/components/approval/components/approvalPageConfig/confirmInput.vue.d.ts +26 -0
- package/dist/components/approval/components/approvalPageConfig/defaultOperatorSelect.vue.d.ts +18 -0
- package/dist/components/approval/components/approvalPageConfig/index.vue.d.ts +11 -0
- package/dist/components/approval/components/approvalPageConfig/jsonConfig.vue.d.ts +16 -0
- package/dist/components/approval/components/approvalPageConfig/layoutSetting.vue.d.ts +9 -0
- package/dist/components/approval/components/approvalPageConfig/leftColumn.vue.d.ts +1184 -0
- package/dist/components/approval/components/approvalPageConfig/middleColumn.vue.d.ts +145 -0
- package/dist/components/approval/components/approvalPageConfig/operatorSelect.vue.d.ts +18 -0
- package/dist/components/approval/components/approvalPageConfig/searchConfig.vue.d.ts +166 -0
- package/dist/components/approval/components/approvalPageConfig/tableConfig.vue.d.ts +802 -0
- package/dist/components/approval/components/codeHistory/codeHistory.vue.d.ts +53 -0
- package/dist/components/approval/components/codeHistory/codeHistoryViewModal.vue.d.ts +32 -0
- package/dist/components/approval/components/columnDataList.vue.d.ts +454 -0
- package/dist/components/approval/components/columnForm.vue.d.ts +26 -0
- package/dist/components/approval/components/columnTables.vue.d.ts +502 -0
- package/dist/components/approval/components/columnUnknown.vue.d.ts +2 -0
- package/dist/components/approval/components/dataStoreConfig/ConditionConfig.vue.d.ts +199 -0
- package/dist/components/approval/components/dataStoreConfig/ValueInput.vue.d.ts +37 -0
- package/dist/components/approval/components/dataStoreConfig/dataSourceDetial.vue.d.ts +22 -0
- package/dist/components/approval/components/dataStoreConfig/dataStoreConfig.vue.d.ts +554 -0
- package/dist/components/approval/components/dataStoreConfig/dataStoreConfigItem.vue.d.ts +434 -0
- package/dist/components/approval/components/dataStoreConfig/dataStoreTest.vue.d.ts +39 -0
- package/dist/components/approval/components/dataStoreConfig/dataStoreTestsItem.vue.d.ts +17 -0
- package/dist/components/approval/components/dataStoreConfig/formField.vue.d.ts +28 -0
- package/dist/components/approval/components/dataStoreConfig/formFieldMulType.vue.d.ts +96 -0
- package/dist/components/approval/components/dataStoreConfig/selectExcelColumn.vue.d.ts +26 -0
- package/dist/components/approval/components/dataStoreConfig/selectExcelType.vue.d.ts +28 -0
- package/dist/components/approval/components/debugCode/debugCode.vue.d.ts +214 -0
- package/dist/components/approval/components/drawerDataList.vue.d.ts +504 -0
- package/dist/components/approval/components/drawerTablesList.vue.d.ts +551 -0
- package/dist/components/approval/components/flowConfig/flowConfig.vue.d.ts +1097 -0
- package/dist/components/approval/components/flowConfig/selectCcGroup.vue.d.ts +9 -0
- package/dist/components/approval/components/flowConfig/selectUsers.vue.d.ts +9 -0
- package/dist/components/approval/components/modelTablesList.vue.d.ts +551 -0
- package/dist/components/approval/components/pageConfigHistory.vue.d.ts +2 -0
- package/dist/components/approval/components/search.vue.d.ts +238 -0
- package/dist/components/approval/components/searchSummary.vue.d.ts +100 -0
- package/dist/components/approval/components/table.vue.d.ts +416 -0
- package/dist/components/approval/components/tableModal.vue.d.ts +84 -0
- package/dist/components/approval/configs/approval/default.d.ts +11 -0
- package/dist/components/approval/configs/approval/recordActions.d.ts +22 -0
- package/dist/components/approval/core.vue.d.ts +53 -0
- package/dist/components/approval/example_code/example_code.d.ts +11 -0
- package/dist/components/approval/index.d.ts +18 -0
- package/dist/components/approval/index.vue.d.ts +2 -0
- package/dist/components/approval/migrate/index.d.ts +1 -0
- package/dist/components/approval/migrate/v0001.d.ts +2 -0
- package/dist/components/approval/store/context.d.ts +48 -0
- package/dist/components/approval/store/debugCode.d.ts +7 -0
- package/dist/components/approval/store/settingsState.d.ts +15 -0
- package/dist/components/approval/typing.d.ts +210 -0
- package/dist/components/approval/useApprovalRecordActions.d.ts +83 -0
- package/dist/components/approval/utils.d.ts +164 -0
- package/dist/components/approval_for_details.vue.d.ts +9 -0
- package/dist/components/flow/ElInputTag/index.vue.d.ts +46 -0
- package/dist/components/flow/Expression/index.vue.d.ts +48 -0
- package/dist/components/flow/Role/index.vue.d.ts +68 -0
- package/dist/components/flow/User/index.vue.d.ts +76 -0
- package/dist/config/packed-config.d.ts +26 -0
- package/dist/constants.d.ts +1 -0
- package/dist/core-BOc9ch_5.js +1631 -0
- package/dist/core-BOc9ch_5.js.map +1 -0
- package/dist/dataStoreSettingHistoryViewModal-D_so-KLp.js +114 -0
- package/dist/dataStoreSettingHistoryViewModal-D_so-KLp.js.map +1 -0
- package/dist/debugCode-Cm9-WiUG.js +565 -0
- package/dist/debugCode-Cm9-WiUG.js.map +1 -0
- package/dist/debugCode-dD1YnQSD.js +11 -0
- package/dist/debugCode-dD1YnQSD.js.map +1 -0
- package/dist/default-VdDMlY4e.js +560 -0
- package/dist/default-VdDMlY4e.js.map +1 -0
- package/dist/example_code-C_xF8RRG.js +129 -0
- package/dist/example_code-C_xF8RRG.js.map +1 -0
- package/dist/flowHistoryViewModal-D8DJP7Te.js +109 -0
- package/dist/flowHistoryViewModal-D8DJP7Te.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +507 -26691
- package/dist/index.js.map +1 -1
- package/dist/init-plugin-fQTSQzui.js +48 -0
- package/dist/init-plugin-fQTSQzui.js.map +1 -0
- package/dist/init-plugin.d.ts +57 -0
- package/dist/leftColumn-CsPjufue.js +209 -0
- package/dist/leftColumn-CsPjufue.js.map +1 -0
- package/dist/lyflowchart.css +1 -1
- package/dist/middleColumn-C7M6-eVo.js +107 -0
- package/dist/middleColumn-C7M6-eVo.js.map +1 -0
- package/dist/recordActions-BgFlNsGU.js +51 -0
- package/dist/recordActions-BgFlNsGU.js.map +1 -0
- package/dist/settingsState-CI81PG-i.js +19 -0
- package/dist/settingsState-CI81PG-i.js.map +1 -0
- package/dist/style.d.ts +3 -0
- package/dist/styles.d.ts +7 -0
- package/dist/tableConfig-uLXue-BS.js +2408 -0
- package/dist/tableConfig-uLXue-BS.js.map +1 -0
- package/dist/tableModal-BcYfVL02.js +124 -0
- package/dist/tableModal-BcYfVL02.js.map +1 -0
- package/dist/useApprovalRecordActions-BQ6MgV2L.js +843 -0
- package/dist/useApprovalRecordActions-BQ6MgV2L.js.map +1 -0
- package/dist/utils/StrUtil.d.ts +52 -0
- package/dist/utils/function.d.ts +8 -0
- package/dist/utils-CLet2gLV.js +420 -0
- package/dist/utils-CLet2gLV.js.map +1 -0
- package/dist/v0001-OaBeBCXI.js +4 -0
- package/dist/v0001-OaBeBCXI.js.map +1 -0
- package/dist/{Cell_click_data_source-C8WEsBGB.js → viewer-Dv3kQsMf.js} +1839 -2724
- package/dist/viewer-Dv3kQsMf.js.map +1 -0
- package/dist/vue-print-next-HRweUmNi.js +683 -0
- package/dist/vue-print-next-HRweUmNi.js.map +1 -0
- package/package.json +39 -8
- package/dist/Cell_click_data_source-C8WEsBGB.js.map +0 -1
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
//#region node_modules/vue-print-next/dist/vue-print-next.js
|
|
2
|
+
var e = Object.defineProperty, t = Object.defineProperties, n = Object.getOwnPropertyDescriptors, r = Object.getOwnPropertySymbols, i = Object.prototype.hasOwnProperty, a = Object.prototype.propertyIsEnumerable, o = (t, n, r) => n in t ? e(t, n, {
|
|
3
|
+
enumerable: !0,
|
|
4
|
+
configurable: !0,
|
|
5
|
+
writable: !0,
|
|
6
|
+
value: r
|
|
7
|
+
}) : t[n] = r, s = (e, t) => {
|
|
8
|
+
for (var n in t ||= {}) i.call(t, n) && o(e, n, t[n]);
|
|
9
|
+
if (r) for (var n of r(t)) a.call(t, n) && o(e, n, t[n]);
|
|
10
|
+
return e;
|
|
11
|
+
}, c = (e, r) => t(e, n(r)), l = (e, t) => {
|
|
12
|
+
var n = {};
|
|
13
|
+
for (var o in e) i.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
|
|
14
|
+
if (e != null && r) for (var o of r(e)) t.indexOf(o) < 0 && a.call(e, o) && (n[o] = e[o]);
|
|
15
|
+
return n;
|
|
16
|
+
}, u = (e, t, n) => o(e, typeof t == "symbol" ? t : t + "", n), d = "[VuePrintNext]", f = 0, p = {
|
|
17
|
+
A0: {
|
|
18
|
+
width: "841mm",
|
|
19
|
+
height: "1189mm"
|
|
20
|
+
},
|
|
21
|
+
A1: {
|
|
22
|
+
width: "594mm",
|
|
23
|
+
height: "841mm"
|
|
24
|
+
},
|
|
25
|
+
A2: {
|
|
26
|
+
width: "420mm",
|
|
27
|
+
height: "594mm"
|
|
28
|
+
},
|
|
29
|
+
A3: {
|
|
30
|
+
width: "297mm",
|
|
31
|
+
height: "420mm"
|
|
32
|
+
},
|
|
33
|
+
A4: {
|
|
34
|
+
width: "210mm",
|
|
35
|
+
height: "297mm"
|
|
36
|
+
},
|
|
37
|
+
A5: {
|
|
38
|
+
width: "148mm",
|
|
39
|
+
height: "210mm"
|
|
40
|
+
},
|
|
41
|
+
A6: {
|
|
42
|
+
width: "105mm",
|
|
43
|
+
height: "148mm"
|
|
44
|
+
},
|
|
45
|
+
A7: {
|
|
46
|
+
width: "74mm",
|
|
47
|
+
height: "105mm"
|
|
48
|
+
},
|
|
49
|
+
A8: {
|
|
50
|
+
width: "52mm",
|
|
51
|
+
height: "74mm"
|
|
52
|
+
},
|
|
53
|
+
Letter: {
|
|
54
|
+
width: "215.9mm",
|
|
55
|
+
height: "279.4mm"
|
|
56
|
+
},
|
|
57
|
+
Legal: {
|
|
58
|
+
width: "215.9mm",
|
|
59
|
+
height: "355.6mm"
|
|
60
|
+
},
|
|
61
|
+
Tabloid: {
|
|
62
|
+
width: "279.4mm",
|
|
63
|
+
height: "431.8mm"
|
|
64
|
+
}
|
|
65
|
+
}, m = (e = 32) => `width: ${e}px; height: ${e}px; border: none; background: transparent; cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; padding: 0; outline: none;`, h = (e, t, n = 32, r = "") => {
|
|
66
|
+
let i = document.createElement("button");
|
|
67
|
+
return i.setAttribute("class", e), i.setAttribute("style", m(n)), i.innerHTML = t, r && i.setAttribute("title", r), i;
|
|
68
|
+
}, g = (e, t) => (e.addEventListener("mouseover", () => {
|
|
69
|
+
e.style.backgroundColor = t ? "#444" : "#f0f0f0";
|
|
70
|
+
}), e.addEventListener("mouseout", () => {
|
|
71
|
+
e.style.backgroundColor = "transparent";
|
|
72
|
+
}), e), _ = {
|
|
73
|
+
close: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg>",
|
|
74
|
+
zoomIn: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg>",
|
|
75
|
+
zoomOut: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg>",
|
|
76
|
+
darkMode: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"></path></svg>",
|
|
77
|
+
lightMode: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"5\"></circle><line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"3\"></line><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"23\"></line><line x1=\"4.22\" y1=\"4.22\" x2=\"5.64\" y2=\"5.64\"></line><line x1=\"18.36\" y1=\"18.36\" x2=\"19.78\" y2=\"19.78\"></line><line x1=\"1\" y1=\"12\" x2=\"3\" y2=\"12\"></line><line x1=\"21\" y1=\"12\" x2=\"23\" y2=\"12\"></line><line x1=\"4.22\" y1=\"19.78\" x2=\"5.64\" y2=\"18.36\"></line><line x1=\"18.36\" y1=\"5.64\" x2=\"19.78\" y2=\"4.22\"></line></svg>",
|
|
78
|
+
fullscreen: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"15 3 21 3 21 9\"></polyline><polyline points=\"9 21 3 21 3 15\"></polyline><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"></line><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"></line></svg>",
|
|
79
|
+
exitFullscreen: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"8 3 3 3 3 8\"></polyline><polyline points=\"21 8 21 3 16 3\"></polyline><polyline points=\"3 16 3 21 8 21\"></polyline><polyline points=\"16 21 21 21 21 16\"></polyline></svg>",
|
|
80
|
+
print: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><polyline points=\"6 9 6 2 18 2 18 9\"></polyline><path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\"></path><rect x=\"6\" y=\"14\" width=\"12\" height=\"8\"></rect></svg>",
|
|
81
|
+
paper: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"></path><polyline points=\"14 2 14 8 20 8\"></polyline></svg>"
|
|
82
|
+
}, v = (e, t) => {
|
|
83
|
+
if (typeof e == "number" || !isNaN(Number(e))) return `${e}${t}`;
|
|
84
|
+
let n = e.toString().match(/[a-zA-Z]+/g)?.[0];
|
|
85
|
+
return !n || !(n in p) ? `${e}mm` : e;
|
|
86
|
+
};
|
|
87
|
+
function y() {
|
|
88
|
+
try {
|
|
89
|
+
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && navigator.vendor === "Apple Computer, Inc.";
|
|
90
|
+
} catch {
|
|
91
|
+
return !1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function b(e) {
|
|
95
|
+
let { immediateEvents: t = ["load"], debug: n = !1 } = {}, r = HTMLIFrameElement.prototype.addEventListener;
|
|
96
|
+
return HTMLIFrameElement.prototype.addEventListener = function(e, i, a) {
|
|
97
|
+
if (r.call(this, e, i, a), !(!y() || typeof i != "function")) try {
|
|
98
|
+
t.includes(e) && this.contentWindow?.document.readyState === "complete" && (n && console.log(`[Safari Iframe Patch] Triggering "${e}" immediately`), this.contentWindow.setTimeout(() => {
|
|
99
|
+
i.call(this, new Event(e));
|
|
100
|
+
}));
|
|
101
|
+
} catch (e) {
|
|
102
|
+
console.warn("[Safari Iframe Patch] Error:", e);
|
|
103
|
+
}
|
|
104
|
+
}, function() {
|
|
105
|
+
HTMLIFrameElement.prototype.addEventListener = r, n && console.log("[Safari Iframe Patch] Restored original addEventListener");
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
var x = class {
|
|
109
|
+
constructor(e) {
|
|
110
|
+
u(this, "standards", {
|
|
111
|
+
strict: "strict",
|
|
112
|
+
loose: "loose",
|
|
113
|
+
html5: "html5"
|
|
114
|
+
}), u(this, "iframeId", ""), u(this, "previewBody", null), u(this, "close", null), u(this, "scale", 1), u(this, "isDarkMode", !1), u(this, "isFullscreen", !0), u(this, "settings");
|
|
115
|
+
let t = e, { vue: n, standard: r = "html5", zIndex: i = 20002, previewTitle: a = "打印预览", previewPrintBtnLabel: o = "打印", preview: d = !1, popTitle: f = document.title, previewSize: p, darkMode: m = !1, windowMode: h = !1, defaultScale: g = 1, previewTools: _ = {
|
|
116
|
+
zoom: !0,
|
|
117
|
+
theme: !0,
|
|
118
|
+
fullscreen: !0
|
|
119
|
+
} } = t, v = l(t, [
|
|
120
|
+
"vue",
|
|
121
|
+
"standard",
|
|
122
|
+
"zIndex",
|
|
123
|
+
"previewTitle",
|
|
124
|
+
"previewPrintBtnLabel",
|
|
125
|
+
"preview",
|
|
126
|
+
"popTitle",
|
|
127
|
+
"previewSize",
|
|
128
|
+
"darkMode",
|
|
129
|
+
"windowMode",
|
|
130
|
+
"defaultScale",
|
|
131
|
+
"previewTools"
|
|
132
|
+
]);
|
|
133
|
+
this.isDarkMode = m, this.isFullscreen = !h, this.scale = g, this.settings = c(s({
|
|
134
|
+
standard: r,
|
|
135
|
+
zIndex: i,
|
|
136
|
+
previewTitle: a,
|
|
137
|
+
previewPrintBtnLabel: o,
|
|
138
|
+
preview: d,
|
|
139
|
+
popTitle: f,
|
|
140
|
+
previewSize: p,
|
|
141
|
+
darkMode: m,
|
|
142
|
+
windowMode: h,
|
|
143
|
+
defaultScale: g,
|
|
144
|
+
previewTools: _
|
|
145
|
+
}, v), {
|
|
146
|
+
previewBeforeOpenCallback: () => e.previewBeforeOpenCallback?.call(e, n),
|
|
147
|
+
previewOpenCallback: () => e.previewOpenCallback?.call(e, n),
|
|
148
|
+
openCallback: () => e.openCallback?.call(e, n),
|
|
149
|
+
closeCallback: () => e.closeCallback?.call(e, n),
|
|
150
|
+
beforeOpenCallback: () => e.beforeOpenCallback?.call(e, n)
|
|
151
|
+
}), this.init();
|
|
152
|
+
}
|
|
153
|
+
init() {
|
|
154
|
+
this.iframeId = `printArea_${++f}`;
|
|
155
|
+
let { el: e, url: t, asyncUrl: n } = this.settings;
|
|
156
|
+
if (b(), e) this.handlePrintWindow("");
|
|
157
|
+
else if (t) this.handlePrintWindow(t);
|
|
158
|
+
else if (n) n((e) => this.handlePrintWindow(e), this.settings.vue);
|
|
159
|
+
else throw Error(`${d}: Either "el", "url", or "asyncUrl" parameter must be provided in the settings.`);
|
|
160
|
+
}
|
|
161
|
+
handlePrintWindow(e) {
|
|
162
|
+
let t = this.getPrintWindow(e);
|
|
163
|
+
!e && this.write(t.doc), this.settings.preview ? this.previewIframeLoad() : this.print(t);
|
|
164
|
+
}
|
|
165
|
+
addEvent(e, t, n) {
|
|
166
|
+
e && e.addEventListener(t, n, !1);
|
|
167
|
+
}
|
|
168
|
+
previewIframeLoad() {
|
|
169
|
+
var e, t;
|
|
170
|
+
let n = document.getElementById("vue-print-next-previewBox");
|
|
171
|
+
if (!n) return;
|
|
172
|
+
let r = n.querySelector("iframe");
|
|
173
|
+
(t = (e = this.settings).previewBeforeOpenCallback) == null || t.call(e), this.addEvent(r, "load", () => {
|
|
174
|
+
var e, t;
|
|
175
|
+
this.previewBoxShow(), (t = (e = this.settings).previewOpenCallback) == null || t.call(e);
|
|
176
|
+
}), this.addEvent(n.querySelector(".previewBodyUtilPrintBtn"), "click", () => {
|
|
177
|
+
var e, t, n, i, a, o;
|
|
178
|
+
(t = (e = this.settings).beforeOpenCallback) == null || t.call(e), r != null && r.contentWindow ? this.waitForFontsLoaded(r.contentWindow).then(() => {
|
|
179
|
+
var e, t, n, i, a;
|
|
180
|
+
(t = (e = this.settings).openCallback) == null || t.call(e), (n = r.contentWindow) == null || n.print(), (a = (i = this.settings).closeCallback) == null || a.call(i);
|
|
181
|
+
}).catch(() => {
|
|
182
|
+
var e, t, n, i, a;
|
|
183
|
+
console.warn(`${d}: Font loading timeout in preview mode, proceeding with print`), (t = (e = this.settings).openCallback) == null || t.call(e), (n = r.contentWindow) == null || n.print(), (a = (i = this.settings).closeCallback) == null || a.call(i);
|
|
184
|
+
}) : ((i = (n = this.settings).openCallback) == null || i.call(n), (o = (a = this.settings).closeCallback) == null || o.call(a));
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
print(e) {
|
|
188
|
+
var t, n;
|
|
189
|
+
let r = document.getElementById(this.iframeId) || e.f, i = r?.contentWindow;
|
|
190
|
+
i && ((n = (t = this.settings).beforeOpenCallback) == null || n.call(t), this.addEvent(r, "load", () => {
|
|
191
|
+
this.waitForFontsLoaded(i).then(() => {
|
|
192
|
+
let e = setTimeout(() => {
|
|
193
|
+
var t, n, a, o;
|
|
194
|
+
i.focus(), (n = (t = this.settings).openCallback) == null || n.call(t), i.print(), r.remove(), (o = (a = this.settings).closeCallback) == null || o.call(a), clearTimeout(e);
|
|
195
|
+
}, 100);
|
|
196
|
+
}).catch(() => {
|
|
197
|
+
console.warn(`${d}: Font loading timeout, proceeding with print`);
|
|
198
|
+
let e = setTimeout(() => {
|
|
199
|
+
var t, n, a, o;
|
|
200
|
+
i.focus(), (n = (t = this.settings).openCallback) == null || n.call(t), i.print(), r.remove(), (o = (a = this.settings).closeCallback) == null || o.call(a), clearTimeout(e);
|
|
201
|
+
}, 100);
|
|
202
|
+
});
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
getNoPrintMediaStyle() {
|
|
206
|
+
let { noPrintSelector: e } = this.settings;
|
|
207
|
+
if (!e) return "";
|
|
208
|
+
let t = (Array.isArray(e) ? e : [e]).filter((e) => e.trim());
|
|
209
|
+
return t.length ? `${t.join(",")} { display: none; }` : (console.error(/* @__PURE__ */ TypeError(`${d}: The "noPrintSelector" must be a non-empty string or an array of strings.`)), "");
|
|
210
|
+
}
|
|
211
|
+
write(e) {
|
|
212
|
+
e.open(), e.write(`${this.docType()}<html lang='zh'>${this.getHead()}${this.getBody()}</html>`), e.close();
|
|
213
|
+
}
|
|
214
|
+
docType() {
|
|
215
|
+
return this.settings.standard === this.standards.html5 ? "<!DOCTYPE html>" : `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01${this.settings.standard === this.standards.loose ? " Transitional" : ""}//EN" "http://www.w3.org/TR/html4/${this.settings.standard === this.standards.loose ? "loose" : "strict"}.dtd">`;
|
|
216
|
+
}
|
|
217
|
+
getPrintMediaStyle() {
|
|
218
|
+
let { paperSize: e, orientation: t, customSize: n } = this.settings, r = this.settings.paperSize !== void 0 || this.settings.orientation !== void 0 || this.settings.customSize !== void 0, i = "";
|
|
219
|
+
if (r) {
|
|
220
|
+
let r = e || "A4", a = t || "portrait";
|
|
221
|
+
if (r === "custom" && n) {
|
|
222
|
+
let { width: e, height: t, unit: r = "mm" } = n, o = v(e, r), s = v(t, r);
|
|
223
|
+
i = a === "portrait" ? `@page { size: ${o} ${s}; }` : `@page { size: ${s} ${o}; }`;
|
|
224
|
+
} else if (r in p) {
|
|
225
|
+
let e = p[r];
|
|
226
|
+
i = a === "portrait" ? `@page { size: ${e.width} ${e.height}; }` : `@page { size: ${e.height} ${e.width}; }`;
|
|
227
|
+
} else {
|
|
228
|
+
let e = p.A4;
|
|
229
|
+
i = t === "portrait" ? `@page { size: ${e.width} ${e.height}; }` : `@page { size: ${e.height} ${e.width}; }`;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return `body {-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; -ms-print-color-adjust: exact; print-color-adjust: exact;}${i}`;
|
|
233
|
+
}
|
|
234
|
+
getHead() {
|
|
235
|
+
let { extraHead: e = "", extraCss: t = "", popTitle: n } = this.settings, r = Array.from(document.querySelectorAll("link[href$=\".css\"]")).map((e) => `<link type="text/css" rel="stylesheet" href='${e.href}'>`).join(""), i = Array.from(document.querySelectorAll("style")).map((e) => e.outerHTML).join(""), a = t.split(",").filter((e) => e.trim()).map((e) => `<link type="text/css" rel="stylesheet" href='${e.trim()}'>`).join(""), o = this.getPrintMediaStyle(), s = this.getNoPrintMediaStyle();
|
|
236
|
+
return `<head><title>${n}</title>` + e + r + i + `<style type="text/css">${s}${o}</style>` + a + "</head>";
|
|
237
|
+
}
|
|
238
|
+
getPrintAreaDom() {
|
|
239
|
+
let e = this.settings.el, t = typeof e == "string";
|
|
240
|
+
if (e instanceof HTMLElement) return [e];
|
|
241
|
+
if (!t) throw TypeError(`${d}: The "el" property should be either a string (CSS selector) or an HTMLElement, but received type "${typeof e}".`);
|
|
242
|
+
let n = Array.from(document.querySelectorAll(e));
|
|
243
|
+
if (!(n != null && n.length)) throw Error(`${d}: No elements found matching the selector: "${e}".`);
|
|
244
|
+
return n;
|
|
245
|
+
}
|
|
246
|
+
getBody() {
|
|
247
|
+
let e = this.getPrintAreaDom(), t = document.createElement("div");
|
|
248
|
+
return e.forEach((e) => {
|
|
249
|
+
let n = e.cloneNode(!0);
|
|
250
|
+
this.removeScriptHandler(n), this.canvasToImgHandler(e, n), this.formDataHandler(e, n), t.appendChild(n);
|
|
251
|
+
}), `<body>${t.innerHTML}</body>`;
|
|
252
|
+
}
|
|
253
|
+
removeScriptHandler(e) {
|
|
254
|
+
let t = Array.from(e.querySelectorAll("script"));
|
|
255
|
+
t.length !== 0 && t.forEach((e) => {
|
|
256
|
+
e.remove();
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
canvasToImgHandler(e, t) {
|
|
260
|
+
try {
|
|
261
|
+
let n = Array.from(e.querySelectorAll("canvas")), r = Array.from(t.querySelectorAll("canvas"));
|
|
262
|
+
if (r.length === 0) return;
|
|
263
|
+
let i = [];
|
|
264
|
+
r.forEach((e, t) => {
|
|
265
|
+
let r = n[t];
|
|
266
|
+
if (!r) {
|
|
267
|
+
console.warn(`${d}: Canvas element mismatch, Canvas at index ${t} does not exist in the original element`);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
let a = e.parentNode;
|
|
271
|
+
if (!a) {
|
|
272
|
+
console.warn(`${d}: Canvas parent element does not exist`);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
try {
|
|
276
|
+
let t = r.toDataURL("image/png"), n = new Image();
|
|
277
|
+
n.className = "canvasImg", n.style.display = "block", n.src = t, i.push({
|
|
278
|
+
parent: a,
|
|
279
|
+
newElement: n,
|
|
280
|
+
oldElement: e
|
|
281
|
+
});
|
|
282
|
+
} catch (t) {
|
|
283
|
+
console.error(`${d}: Error processing Canvas:`, t);
|
|
284
|
+
let n = document.createElement("div");
|
|
285
|
+
n.className = "canvas-error", n.style.cssText = "padding: 10px; border: 1px dashed #ff6b6b; color: #ff6b6b; text-align: center;", n.textContent = "Unable to load Canvas content, possibly due to cross-origin restrictions", i.push({
|
|
286
|
+
parent: a,
|
|
287
|
+
newElement: n,
|
|
288
|
+
oldElement: e
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}), i.forEach(({ parent: e, newElement: t, oldElement: n }) => {
|
|
292
|
+
e.replaceChild(t, n);
|
|
293
|
+
});
|
|
294
|
+
} catch (e) {
|
|
295
|
+
console.error(`${d}: Error occurred while processing Canvas elements:`, e);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
formDataHandler(e, t) {
|
|
299
|
+
try {
|
|
300
|
+
let n = Array.from(t.querySelectorAll("input,select,textarea"));
|
|
301
|
+
if (n.length === 0) return;
|
|
302
|
+
let r = Array.from(e.querySelectorAll("select")), i = -1;
|
|
303
|
+
n.forEach((e) => {
|
|
304
|
+
try {
|
|
305
|
+
let t = e.value;
|
|
306
|
+
switch (e.getAttribute("type") ?? e.tagName.toLowerCase()) {
|
|
307
|
+
case "select":
|
|
308
|
+
if (i++, i < r.length) {
|
|
309
|
+
let t = r[i].selectedIndex, n = e.options;
|
|
310
|
+
n && n.length > t && t >= 0 ? n[t].setAttribute("selected", "selected") : n && n.length > 0 ? (n[0].setAttribute("selected", "selected"), console.warn(`${d}: Select element option index out of range, defaulting to first option`)) : console.warn(`${d}: Select element has no options`);
|
|
311
|
+
} else console.warn(`${d}: Original select element not found at index ${i}`);
|
|
312
|
+
break;
|
|
313
|
+
case "textarea":
|
|
314
|
+
e.innerHTML = t, e.setAttribute("html", t);
|
|
315
|
+
break;
|
|
316
|
+
case "radio":
|
|
317
|
+
case "checkbox":
|
|
318
|
+
e.checked && e.setAttribute("checked", "checked");
|
|
319
|
+
break;
|
|
320
|
+
default:
|
|
321
|
+
e.value = t, e.setAttribute("value", t);
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
} catch (t) {
|
|
325
|
+
console.error(`${d}: Error processing form element (${e.tagName}):`, t);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
} catch (e) {
|
|
329
|
+
console.error(`${d}: Error occurred while processing form data:`, e);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
getPrintWindow(e) {
|
|
333
|
+
let t = this.createIframe(e), n = t.contentDocument || t.contentWindow?.document || t.document;
|
|
334
|
+
if (!n) throw Error(`${d}: Unable to find the document object within the created iframe. Please ensure the iframe is correctly created and loaded.`);
|
|
335
|
+
return {
|
|
336
|
+
f: t,
|
|
337
|
+
win: t.contentWindow || t,
|
|
338
|
+
doc: n
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
previewBoxShow() {
|
|
342
|
+
let e = document.getElementById("vue-print-next-previewBox");
|
|
343
|
+
if (!e) return;
|
|
344
|
+
let t = document.querySelector("html");
|
|
345
|
+
t && (t.style.overflow = "hidden"), e.style.opacity = "0", e.style.display = "block", setTimeout(() => {
|
|
346
|
+
e.style.transition = "opacity 0.3s ease", e.style.opacity = "1", this.applyInitialSettings();
|
|
347
|
+
}, 10);
|
|
348
|
+
}
|
|
349
|
+
applyInitialSettings() {
|
|
350
|
+
this.isDarkMode && (this.isDarkMode = !1, this.toggleTheme()), this.isFullscreen || (this.isFullscreen = !0, this.toggleFullscreen()), this.scale !== 1 && this.updatePreviewScale();
|
|
351
|
+
}
|
|
352
|
+
previewBoxHide() {
|
|
353
|
+
let e = document.getElementById("vue-print-next-previewBox");
|
|
354
|
+
e && (e.style.opacity = "0", setTimeout(() => {
|
|
355
|
+
var t;
|
|
356
|
+
let n = document.querySelector("html");
|
|
357
|
+
n && (n.style.overflow = "visible"), (t = e.querySelector(".paperContainer")?.querySelector("iframe")) == null || t.remove(), e.style.display = "none", this.resetPreviewState(e);
|
|
358
|
+
}, 300));
|
|
359
|
+
}
|
|
360
|
+
resetPreviewState(e) {
|
|
361
|
+
let t = e.querySelector(".previewBodyUtilPrintBtn");
|
|
362
|
+
t && (t.style.backgroundColor = "#1890ff", t.style.boxShadow = "none"), this.scale = this.settings.defaultScale || 1, this.isDarkMode && this.toggleTheme(), this.isFullscreen && (this.isFullscreen = !1, e.style.width = "100%", e.style.height = "100%", e.style.top = "0", e.style.left = "0", e.style.borderRadius = "0");
|
|
363
|
+
}
|
|
364
|
+
previewBox() {
|
|
365
|
+
var e;
|
|
366
|
+
let t = document.getElementById("vue-print-next-previewBox");
|
|
367
|
+
if (t) {
|
|
368
|
+
(e = t.querySelector("iframe")) == null || e.remove();
|
|
369
|
+
let n = t.querySelector(".previewHeader");
|
|
370
|
+
if (n) {
|
|
371
|
+
let e = this.createPreviewHeader();
|
|
372
|
+
t.replaceChild(e, n), this.close = e.querySelector(".previewClose");
|
|
373
|
+
}
|
|
374
|
+
let r = t.querySelector(".paperContainer");
|
|
375
|
+
r && this.setPaperSize(r);
|
|
376
|
+
let i = t.querySelector(".paperInfo");
|
|
377
|
+
return i && (i.innerHTML = _.paper + this.getPaperSizeText()), {
|
|
378
|
+
close: this.close,
|
|
379
|
+
previewBody: t.querySelector(".previewBody")
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
t = document.createElement("div"), t.setAttribute("id", "vue-print-next-previewBox"), t.setAttribute("style", "position: fixed; top: 0px; left: 0px; width: 100%; height: 100%; background: rgba(250, 250, 250, 0.98); display: none; z-index: " + this.settings.zIndex + "; font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif; box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); transition: background-color 0.3s ease;"), t.setAttribute("data-theme", "light");
|
|
383
|
+
let n = this.createPreviewHeader();
|
|
384
|
+
return t.appendChild(n), this.previewBody = this.createPreviewBody(), t.appendChild(this.previewBody), document.body.appendChild(t), {
|
|
385
|
+
close: this.close,
|
|
386
|
+
previewBody: this.previewBody
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
createPreviewHeader() {
|
|
390
|
+
let e = document.createElement("div");
|
|
391
|
+
e.setAttribute("class", "previewHeader"), e.setAttribute("style", "padding: 12px 24px; background: #fff; border-bottom: 1px solid #eaeaea; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); transition: background-color 0.3s ease, border-color 0.3s ease;");
|
|
392
|
+
let t = document.createElement("div");
|
|
393
|
+
t.setAttribute("style", "font-size: 16px; font-weight: 500; color: #333; transition: color 0.3s ease;"), t.innerHTML = this.settings.previewTitle || "";
|
|
394
|
+
let n = document.createElement("div");
|
|
395
|
+
n.setAttribute("style", "display: flex; align-items: center; gap: 12px;");
|
|
396
|
+
let r = {
|
|
397
|
+
zoom: !0,
|
|
398
|
+
theme: !0,
|
|
399
|
+
fullscreen: !0
|
|
400
|
+
}, i;
|
|
401
|
+
if (this.settings.previewTools === !1) i = {
|
|
402
|
+
zoom: !1,
|
|
403
|
+
theme: !1,
|
|
404
|
+
fullscreen: !1
|
|
405
|
+
};
|
|
406
|
+
else if (typeof this.settings.previewTools == "object" && this.settings.previewTools !== null) {
|
|
407
|
+
let e = this.settings.previewTools;
|
|
408
|
+
i = {
|
|
409
|
+
zoom: e.zoom !== !1,
|
|
410
|
+
theme: e.theme !== !1,
|
|
411
|
+
fullscreen: e.fullscreen !== !1
|
|
412
|
+
};
|
|
413
|
+
} else i = s({}, r);
|
|
414
|
+
if (i.zoom) {
|
|
415
|
+
let e = this.createZoomControls();
|
|
416
|
+
n.appendChild(e);
|
|
417
|
+
}
|
|
418
|
+
if (i.theme) {
|
|
419
|
+
let e = this.createThemeToggle();
|
|
420
|
+
n.appendChild(e);
|
|
421
|
+
}
|
|
422
|
+
if (i.fullscreen) {
|
|
423
|
+
let e = this.createFullscreenToggle();
|
|
424
|
+
n.appendChild(e);
|
|
425
|
+
}
|
|
426
|
+
return this.close = this.createCloseButton(), e.appendChild(t), e.appendChild(n), e.appendChild(this.close), e;
|
|
427
|
+
}
|
|
428
|
+
createIframe(e) {
|
|
429
|
+
let t = document.createElement("iframe");
|
|
430
|
+
if (t.id = this.iframeId, t.src = e || "about:blank", t.style.cssText = "position: fixed; left: -9999px; border: 0; width: 0; height: 0; opacity: 0;", !this.settings.preview) document.body.appendChild(t);
|
|
431
|
+
else {
|
|
432
|
+
t.style.cssText = "border: 0px; width: 100%; height: 100%; background: white; transition: background-color 0.3s ease;";
|
|
433
|
+
let { close: e, previewBody: n } = this.previewBox();
|
|
434
|
+
((n?.querySelector(".paperContainer"))?.querySelector("div"))?.appendChild(t), this.updatePreviewScale(), this.addEvent(e, "click", this.previewBoxHide.bind(this)), this.addEvent(t, "load", this.applyIframeDarkMode.bind(this, t));
|
|
435
|
+
}
|
|
436
|
+
return t;
|
|
437
|
+
}
|
|
438
|
+
applyIframeDarkMode(e) {
|
|
439
|
+
if (this.isDarkMode) try {
|
|
440
|
+
let t = e.contentDocument || e.contentWindow?.document;
|
|
441
|
+
if (t) {
|
|
442
|
+
let e = t.createElement("style");
|
|
443
|
+
e.textContent = "body { color-scheme: dark; }", t.head.appendChild(e);
|
|
444
|
+
}
|
|
445
|
+
} catch (e) {
|
|
446
|
+
console.warn("[VuePrintNext] Failed to apply dark mode style to iframe content", e);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
createCloseButton() {
|
|
450
|
+
let e = document.createElement("div");
|
|
451
|
+
return e.setAttribute("class", "previewClose"), e.setAttribute("style", "width: 32px; height: 32px; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: background-color 0.2s ease, color 0.3s ease;"), e.innerHTML = _.close, g(e, this.isDarkMode), e;
|
|
452
|
+
}
|
|
453
|
+
createZoomControls() {
|
|
454
|
+
let e = document.createElement("div");
|
|
455
|
+
e.setAttribute("class", "zoomControls"), e.setAttribute("style", "display: flex; align-items: center; gap: 8px;");
|
|
456
|
+
let t = h("zoomOutBtn", _.zoomOut, 28);
|
|
457
|
+
g(t, this.isDarkMode), t.addEventListener("click", () => {
|
|
458
|
+
this.scale = Math.max(.5, this.scale - .1), this.updatePreviewScale();
|
|
459
|
+
});
|
|
460
|
+
let n = document.createElement("span");
|
|
461
|
+
n.setAttribute("class", "zoomDisplay"), n.setAttribute("style", "font-size: 14px; min-width: 40px; text-align: center;"), n.textContent = "100%";
|
|
462
|
+
let r = h("zoomInBtn", _.zoomIn, 28);
|
|
463
|
+
g(r, this.isDarkMode), r.addEventListener("click", () => {
|
|
464
|
+
this.scale = Math.min(2, this.scale + .1), this.updatePreviewScale();
|
|
465
|
+
});
|
|
466
|
+
let i = document.createElement("button");
|
|
467
|
+
return i.setAttribute("class", "zoomResetBtn"), i.setAttribute("style", "font-size: 12px; padding: 2px 6px; border: none; background: transparent; cursor: pointer; border-radius: 4px; transition: background-color 0.2s ease;"), i.textContent = "重置", g(i, this.isDarkMode), i.addEventListener("click", () => {
|
|
468
|
+
this.scale = this.settings.defaultScale || 1, this.updatePreviewScale();
|
|
469
|
+
}), e.appendChild(t), e.appendChild(n), e.appendChild(r), e.appendChild(i), e;
|
|
470
|
+
}
|
|
471
|
+
updatePreviewScale() {
|
|
472
|
+
let e = document.getElementById("vue-print-next-previewBox");
|
|
473
|
+
if (!e) return;
|
|
474
|
+
let t = e.querySelector(".zoomDisplay");
|
|
475
|
+
t && (t.textContent = `${Math.round(this.scale * 100)}%`);
|
|
476
|
+
let n = e.querySelector(".paperContainer");
|
|
477
|
+
n && (n.style.transform = `scale(${this.scale})`, n.style.transformOrigin = "center top");
|
|
478
|
+
}
|
|
479
|
+
createThemeToggle() {
|
|
480
|
+
let e = h("themeToggle", _.darkMode, 32, "切换深色/浅色模式");
|
|
481
|
+
return g(e, this.isDarkMode), e.addEventListener("click", () => {
|
|
482
|
+
this.toggleTheme();
|
|
483
|
+
}), e;
|
|
484
|
+
}
|
|
485
|
+
toggleTheme() {
|
|
486
|
+
var e, t, n, r, i;
|
|
487
|
+
this.isDarkMode = !this.isDarkMode;
|
|
488
|
+
let a = document.getElementById("vue-print-next-previewBox");
|
|
489
|
+
if (!a) return;
|
|
490
|
+
let o = this.isDarkMode ? {
|
|
491
|
+
theme: "dark",
|
|
492
|
+
background: "rgba(30, 30, 30, 0.98)",
|
|
493
|
+
headerBg: "#242424",
|
|
494
|
+
borderColor: "#333",
|
|
495
|
+
textColor: "#fff",
|
|
496
|
+
contentBg: "#1a1a1a",
|
|
497
|
+
pageInfoColor: "#ccc",
|
|
498
|
+
themeIcon: _.lightMode
|
|
499
|
+
} : {
|
|
500
|
+
theme: "light",
|
|
501
|
+
background: "rgba(250, 250, 250, 0.98)",
|
|
502
|
+
headerBg: "#fff",
|
|
503
|
+
borderColor: "#eaeaea",
|
|
504
|
+
textColor: "#333",
|
|
505
|
+
contentBg: "#f5f5f5",
|
|
506
|
+
pageInfoColor: "#666",
|
|
507
|
+
themeIcon: _.darkMode
|
|
508
|
+
};
|
|
509
|
+
a.setAttribute("data-theme", o.theme), a.style.backgroundColor = o.background;
|
|
510
|
+
let s = a.querySelector(".previewHeader");
|
|
511
|
+
s && (s.style.backgroundColor = o.headerBg, s.style.borderColor = o.borderColor);
|
|
512
|
+
let c = a.querySelector(".previewHeader > div:first-child");
|
|
513
|
+
c && (c.style.color = o.textColor), a.querySelectorAll(".previewHeader button, .previewHeader svg, .zoomDisplay, .zoomResetBtn").forEach((e) => {
|
|
514
|
+
e.style.color = o.textColor;
|
|
515
|
+
});
|
|
516
|
+
let l = a.querySelector(".previewBodyUtil");
|
|
517
|
+
l && (l.style.backgroundColor = o.headerBg, l.style.borderColor = o.borderColor);
|
|
518
|
+
let u = a.querySelector(".previewBody > div:last-child");
|
|
519
|
+
u && (u.style.backgroundColor = o.contentBg);
|
|
520
|
+
let d = a.querySelector(".pageInfo");
|
|
521
|
+
d && (d.style.color = o.pageInfoColor);
|
|
522
|
+
let f = a.querySelector(".themeToggle");
|
|
523
|
+
if (f) {
|
|
524
|
+
let t = f.cloneNode(!0);
|
|
525
|
+
t.innerHTML = o.themeIcon, (e = f.parentNode) == null || e.replaceChild(t, f), g(t, this.isDarkMode), t.addEventListener("click", () => {
|
|
526
|
+
this.toggleTheme();
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
let p = a.querySelector(".zoomInBtn");
|
|
530
|
+
if (p) {
|
|
531
|
+
let e = p.cloneNode(!0);
|
|
532
|
+
(t = p.parentNode) == null || t.replaceChild(e, p), g(e, this.isDarkMode), e.addEventListener("click", () => {
|
|
533
|
+
this.scale = Math.min(2, this.scale + .1), this.updatePreviewScale();
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
let m = a.querySelector(".zoomOutBtn");
|
|
537
|
+
if (m) {
|
|
538
|
+
let e = m.cloneNode(!0);
|
|
539
|
+
(n = m.parentNode) == null || n.replaceChild(e, m), g(e, this.isDarkMode), e.addEventListener("click", () => {
|
|
540
|
+
this.scale = Math.max(.5, this.scale - .1), this.updatePreviewScale();
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
let h = a.querySelector(".zoomResetBtn");
|
|
544
|
+
if (h) {
|
|
545
|
+
let e = h.cloneNode(!0);
|
|
546
|
+
(r = h.parentNode) == null || r.replaceChild(e, h), g(e, this.isDarkMode), e.addEventListener("click", () => {
|
|
547
|
+
this.scale = this.settings.defaultScale || 1, this.updatePreviewScale();
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
let v = a.querySelector(".fullscreenToggle");
|
|
551
|
+
if (v) {
|
|
552
|
+
let e = v.cloneNode(!0);
|
|
553
|
+
e.innerHTML = this.isFullscreen ? _.fullscreen : _.exitFullscreen, (i = v.parentNode) == null || i.replaceChild(e, v), g(e, this.isDarkMode), e.addEventListener("click", () => {
|
|
554
|
+
this.toggleFullscreen();
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
let y = a.querySelector(".previewBodyUtilPrintBtn");
|
|
558
|
+
y && (y.addEventListener("mouseover", () => {
|
|
559
|
+
y.style.backgroundColor = "#40a9ff", y.style.boxShadow = "0 2px 8px rgba(24, 144, 255, 0.3)";
|
|
560
|
+
}), y.addEventListener("mouseout", () => {
|
|
561
|
+
y.style.backgroundColor = "#1890ff", y.style.boxShadow = "none";
|
|
562
|
+
}));
|
|
563
|
+
}
|
|
564
|
+
createFullscreenToggle() {
|
|
565
|
+
let e = h("fullscreenToggle", _.fullscreen, 32, "切换全屏/弹窗模式");
|
|
566
|
+
return g(e, this.isDarkMode), e.addEventListener("click", () => {
|
|
567
|
+
this.toggleFullscreen();
|
|
568
|
+
}), e;
|
|
569
|
+
}
|
|
570
|
+
toggleFullscreen() {
|
|
571
|
+
this.isFullscreen = !this.isFullscreen;
|
|
572
|
+
let e = document.getElementById("vue-print-next-previewBox");
|
|
573
|
+
if (!e) return;
|
|
574
|
+
let t = this.isFullscreen ? {
|
|
575
|
+
width: "100%",
|
|
576
|
+
height: "100%",
|
|
577
|
+
top: "0",
|
|
578
|
+
left: "0",
|
|
579
|
+
borderRadius: "0",
|
|
580
|
+
boxShadow: "0 0 20px rgba(0, 0, 0, 0.1)",
|
|
581
|
+
icon: _.fullscreen
|
|
582
|
+
} : {
|
|
583
|
+
width: "80%",
|
|
584
|
+
height: "80%",
|
|
585
|
+
top: "10%",
|
|
586
|
+
left: "10%",
|
|
587
|
+
borderRadius: "8px",
|
|
588
|
+
boxShadow: "0 0 30px rgba(0, 0, 0, 0.2)",
|
|
589
|
+
icon: _.exitFullscreen
|
|
590
|
+
};
|
|
591
|
+
e.style.width = t.width, e.style.height = t.height, e.style.top = t.top, e.style.left = t.left, e.style.borderRadius = t.borderRadius, e.style.boxShadow = t.boxShadow;
|
|
592
|
+
let n = e.querySelector(".fullscreenToggle");
|
|
593
|
+
n && (n.innerHTML = t.icon);
|
|
594
|
+
}
|
|
595
|
+
getPaperSizeText() {
|
|
596
|
+
let { paperSize: e = "A4", orientation: t = "portrait", customSize: n, previewSize: r } = this.settings, i = "";
|
|
597
|
+
if (r) {
|
|
598
|
+
if (typeof r == "string") i = r;
|
|
599
|
+
else if (r.width && r.height) {
|
|
600
|
+
let { width: e, height: t, unit: n = "mm" } = r;
|
|
601
|
+
i = `自定义 (${v(e, n)} × ${v(t, n)})`;
|
|
602
|
+
}
|
|
603
|
+
} else if (e === "custom" && n) {
|
|
604
|
+
let { width: e, height: t, unit: r = "mm" } = n;
|
|
605
|
+
i = `自定义 (${v(e, r)} × ${v(t, r)})`;
|
|
606
|
+
} else i = e;
|
|
607
|
+
return `${i} - ${t === "portrait" ? "纵向" : "横向"}`;
|
|
608
|
+
}
|
|
609
|
+
createPreviewBody() {
|
|
610
|
+
let e = document.createElement("div");
|
|
611
|
+
e.className = "previewBody", e.style.cssText = "display: flex; flex-direction: column; height: calc(100% - 56px);";
|
|
612
|
+
let t = document.createElement("div");
|
|
613
|
+
t.className = "previewBodyUtil", t.style.cssText = "height: 48px; background: #fff; position: relative; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid #eaeaea; transition: background-color 0.3s ease, border-color 0.3s ease;";
|
|
614
|
+
let n = document.createElement("div");
|
|
615
|
+
n.className = "leftTools", n.style.cssText = "display: flex; align-items: center; gap: 16px;";
|
|
616
|
+
let r = document.createElement("button");
|
|
617
|
+
r.className = "previewBodyUtilPrintBtn", r.style.cssText = "padding: 8px 16px; font-size: 14px; color: white; cursor: pointer; background: #1890ff; border: none; border-radius: 4px; transition: all 0.3s ease; outline: none; font-weight: 500; display: flex; align-items: center; justify-content: center;", r.innerHTML = _.print + (this.settings.previewPrintBtnLabel || ""), r.addEventListener("mouseover", () => {
|
|
618
|
+
r.style.backgroundColor = "#40a9ff", r.style.boxShadow = "0 2px 8px rgba(24, 144, 255, 0.3)";
|
|
619
|
+
}), r.addEventListener("mouseout", () => {
|
|
620
|
+
r.style.backgroundColor = "#1890ff", r.style.boxShadow = "none";
|
|
621
|
+
}), n.appendChild(r);
|
|
622
|
+
let i = document.createElement("div");
|
|
623
|
+
i.className = "paperInfo", i.style.cssText = "font-size: 13px; color: #666; display: flex; align-items: center; transition: color 0.3s ease;", i.innerHTML = _.paper + this.getPaperSizeText(), n.appendChild(i), t.appendChild(n), e.appendChild(t);
|
|
624
|
+
let a = document.createElement("div");
|
|
625
|
+
a.className = "contentContainer", a.style.cssText = "flex: 1; padding: 24px; overflow: auto; background: #f5f5f5; display: flex; justify-content: center; transition: background-color 0.3s ease;";
|
|
626
|
+
let o = document.createElement("div");
|
|
627
|
+
o.className = "paperContainer", o.style.cssText = "background: white; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15); transition: box-shadow 0.3s ease; transform-origin: center top; margin-bottom: 24px;", this.setPaperSize(o);
|
|
628
|
+
let s = document.createElement("div");
|
|
629
|
+
return s.style.cssText = "width: 100%; height: 100%; overflow: hidden;", o.appendChild(s), a.appendChild(o), e.appendChild(a), e;
|
|
630
|
+
}
|
|
631
|
+
getPaperDimensions() {
|
|
632
|
+
let { paperSize: e = "A4", customSize: t, previewSize: n } = this.settings, r = p.A4, i = r.width, a = r.height;
|
|
633
|
+
if (n) {
|
|
634
|
+
if (typeof n == "string") {
|
|
635
|
+
if (n in p) {
|
|
636
|
+
let e = p[n];
|
|
637
|
+
i = e.width, a = e.height;
|
|
638
|
+
}
|
|
639
|
+
} else if (n.width && n.height) {
|
|
640
|
+
let { width: e, height: t, unit: r = "mm" } = n;
|
|
641
|
+
i = v(e, r), a = v(t, r);
|
|
642
|
+
}
|
|
643
|
+
} else if (e === "custom" && t) {
|
|
644
|
+
let { width: e, height: n, unit: r = "mm" } = t;
|
|
645
|
+
i = v(e, r), a = v(n, r);
|
|
646
|
+
} else if (e in p) {
|
|
647
|
+
let t = p[e];
|
|
648
|
+
i = t.width, a = t.height;
|
|
649
|
+
}
|
|
650
|
+
return {
|
|
651
|
+
width: i,
|
|
652
|
+
height: a
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
setPaperSize(e) {
|
|
656
|
+
let { orientation: t = "portrait" } = this.settings, { width: n, height: r } = this.getPaperDimensions();
|
|
657
|
+
t === "portrait" ? (e.style.width = n, e.style.height = r) : (e.style.width = r, e.style.height = n);
|
|
658
|
+
}
|
|
659
|
+
waitForFontsLoaded(e) {
|
|
660
|
+
return new Promise((t, n) => {
|
|
661
|
+
let r = Date.now();
|
|
662
|
+
if (e.document.fonts && typeof e.document.fonts.ready == "object") Promise.race([e.document.fonts.ready, new Promise((e, t) => {
|
|
663
|
+
setTimeout(() => t(/* @__PURE__ */ Error("Font loading timeout")), 3e3);
|
|
664
|
+
})]).then(() => {
|
|
665
|
+
t();
|
|
666
|
+
}).catch(() => {
|
|
667
|
+
n(/* @__PURE__ */ Error("Font loading timeout or failed"));
|
|
668
|
+
});
|
|
669
|
+
else {
|
|
670
|
+
let i = () => {
|
|
671
|
+
if (Date.now() - r >= 3e3) {
|
|
672
|
+
n(/* @__PURE__ */ Error("Font loading timeout"));
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
e.document.readyState === "complete" ? setTimeout(() => t(), 200) : setTimeout(i, 50);
|
|
676
|
+
};
|
|
677
|
+
i();
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
//#endregion
|
|
683
|
+
export { x as VuePrintNext };
|