qsyx-element 1.0.1

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.
Files changed (83) hide show
  1. package/dist/es/Button-OBW9FK8V.js +13 -0
  2. package/dist/es/Dialog-lE9CYwyT.js +67 -0
  3. package/dist/es/Form-GllMGZ5L.js +658 -0
  4. package/dist/es/Table-BrzOxcFz.js +122 -0
  5. package/dist/es/cdn/iconfont.css +457 -0
  6. package/dist/es/cdn/luckysheet.css +1 -0
  7. package/dist/es/cdn/luckysheet.umd.js +27 -0
  8. package/dist/es/cdn/plugin.js +1 -0
  9. package/dist/es/cdn/plugins.css +10 -0
  10. package/dist/es/cdn/pluginsCss.css +1 -0
  11. package/dist/es/excelSee-DNbR9hdn.js +346 -0
  12. package/dist/es/exportExcel-rMHaYDUw.js +326 -0
  13. package/dist/es/exportWord-zS-yn0r2.js +615 -0
  14. package/dist/es/imToText-nJqaYhI_.js +38 -0
  15. package/dist/es/index.js +39 -0
  16. package/dist/es/insertExcel-BYsef8on.js +23155 -0
  17. package/dist/es/onlineExcel-DJeuDI97.js +371 -0
  18. package/dist/es/pdfSee-BJvVkNxS.js +113 -0
  19. package/dist/es/utils-DsWIZ76j.js +14 -0
  20. package/dist/es/vendor-P2JMGdqH.js +157444 -0
  21. package/dist/es/wordSee-oMFtPj-S.js +73 -0
  22. package/dist/index.css +1 -0
  23. package/dist/types/components/Button/Button.vue.d.ts +2 -0
  24. package/dist/types/components/Button/index.d.ts +13 -0
  25. package/dist/types/components/Dialog/Dialog.vue.d.ts +35 -0
  26. package/dist/types/components/Dialog/index.d.ts +60 -0
  27. package/dist/types/components/Form/Form.vue.d.ts +34 -0
  28. package/dist/types/components/Table/Table.vue.d.ts +30 -0
  29. package/dist/types/components/Table/index.d.ts +43 -0
  30. package/dist/types/components/excelSee/color.d.ts +2 -0
  31. package/dist/types/components/excelSee/excel.d.ts +7 -0
  32. package/dist/types/components/excelSee/hack.d.ts +1 -0
  33. package/dist/types/components/excelSee/index.d.ts +1 -0
  34. package/dist/types/components/excelSee/media.d.ts +2 -0
  35. package/dist/types/components/exportExcel/index.d.ts +53 -0
  36. package/dist/types/components/exportExcel/index.vue.d.ts +22 -0
  37. package/dist/types/components/exportWord/index.d.ts +86 -0
  38. package/dist/types/components/exportWord/index.vue.d.ts +37 -0
  39. package/dist/types/components/exportWordEcharts/index.d.ts +1 -0
  40. package/dist/types/components/exportWordImage/index.d.ts +1 -0
  41. package/dist/types/components/foundationComponents/qsyxCheckBox/index.d.ts +83 -0
  42. package/dist/types/components/foundationComponents/qsyxCheckBox/index.vue.d.ts +25 -0
  43. package/dist/types/components/foundationComponents/qsyxDate/index.d.ts +67 -0
  44. package/dist/types/components/foundationComponents/qsyxDate/index.vue.d.ts +23 -0
  45. package/dist/types/components/foundationComponents/qsyxDateInterval/index.d.ts +67 -0
  46. package/dist/types/components/foundationComponents/qsyxDateInterval/index.vue.d.ts +23 -0
  47. package/dist/types/components/foundationComponents/qsyxInput/index.d.ts +83 -0
  48. package/dist/types/components/foundationComponents/qsyxInput/index.vue.d.ts +25 -0
  49. package/dist/types/components/foundationComponents/qsyxInputMoney/index.d.ts +67 -0
  50. package/dist/types/components/foundationComponents/qsyxInputMoney/index.vue.d.ts +23 -0
  51. package/dist/types/components/foundationComponents/qsyxRadio/index.d.ts +83 -0
  52. package/dist/types/components/foundationComponents/qsyxRadio/index.vue.d.ts +25 -0
  53. package/dist/types/components/foundationComponents/qsyxSelect/index.d.ts +99 -0
  54. package/dist/types/components/foundationComponents/qsyxSelect/index.vue.d.ts +27 -0
  55. package/dist/types/components/foundationComponents/qsyxTextArea/index.d.ts +83 -0
  56. package/dist/types/components/foundationComponents/qsyxTextArea/index.vue.d.ts +25 -0
  57. package/dist/types/components/imToText/index.d.ts +1 -0
  58. package/dist/types/components/index.d.ts +22 -0
  59. package/dist/types/components/insertExcel/index.d.ts +39 -0
  60. package/dist/types/components/insertExcel/index.vue.d.ts +14 -0
  61. package/dist/types/components/onlineExcel/export.d.ts +2 -0
  62. package/dist/types/components/onlineExcel/index.d.ts +1 -0
  63. package/dist/types/components/onlineExcel/is.d.ts +2 -0
  64. package/dist/types/components/pdfSee/index.d.ts +1 -0
  65. package/dist/types/components/pdfSee/pdf.d.ts +1 -0
  66. package/dist/types/components/pdfSee/worker.d.ts +1 -0
  67. package/dist/types/components/utils/baseToFile.d.ts +6 -0
  68. package/dist/types/components/utils/debounceRef.d.ts +1 -0
  69. package/dist/types/components/utils/downloadFile.d.ts +2 -0
  70. package/dist/types/components/utils/exportWord.d.ts +14 -0
  71. package/dist/types/components/utils/htmlToPdf.d.ts +4 -0
  72. package/dist/types/components/utils/index.d.ts +0 -0
  73. package/dist/types/components/utils/showMsg.d.ts +2 -0
  74. package/dist/types/components/utils/test.d.ts +1 -0
  75. package/dist/types/components/utils/url.d.ts +2 -0
  76. package/dist/types/components/wordSee/docx.d.ts +7 -0
  77. package/dist/types/components/wordSee/index.d.ts +1 -0
  78. package/dist/types/core/index.d.ts +4 -0
  79. package/dist/types/utils/index.d.ts +1 -0
  80. package/dist/types/utils/install.d.ts +6 -0
  81. package/dist/umd/index.css +1 -0
  82. package/dist/umd/index.umd.cjs +668 -0
  83. package/package.json +45 -0
@@ -0,0 +1,326 @@
1
+ import { r as m } from "./vendor-P2JMGdqH.js";
2
+ import { openBlock as d, createElementBlock as x, renderSlot as y, createTextVNode as h, toDisplayString as g, defineComponent as b, ref as w, reactive as p, resolveComponent as k, createBlock as _, withCtx as f, createVNode as E } from "vue";
3
+ import { _ as c } from "./Form-GllMGZ5L.js";
4
+ import { w as V } from "./utils-DsWIZ76j.js";
5
+ const C = {
6
+ props: {
7
+ // mime type [xls, csv]
8
+ type: {
9
+ type: String,
10
+ default: "xls"
11
+ },
12
+ // Json to download
13
+ data: {
14
+ type: Array,
15
+ required: !1,
16
+ default: null
17
+ },
18
+ // fields inside the Json Object that you want to export
19
+ // if no given, all the properties in the Json are exported
20
+ fields: {
21
+ type: Object,
22
+ default: () => null
23
+ },
24
+ // this prop is used to fix the problem with other components that use the
25
+ // variable fields, like vee-validate. exportFields works exactly like fields
26
+ exportFields: {
27
+ type: Object,
28
+ default: () => null
29
+ },
30
+ // Use as fallback when the row has no field values
31
+ defaultValue: {
32
+ type: String,
33
+ required: !1,
34
+ default: ""
35
+ },
36
+ // Title(s) for the data, could be a string or an array of strings (multiple titles)
37
+ header: {
38
+ default: null
39
+ },
40
+ // Footer(s) for the data, could be a string or an array of strings (multiple footers)
41
+ footer: {
42
+ default: null
43
+ },
44
+ // filename to export
45
+ name: {
46
+ type: String,
47
+ default: "data.xls"
48
+ },
49
+ fetch: {
50
+ type: Function
51
+ },
52
+ meta: {
53
+ type: Array,
54
+ default: () => []
55
+ },
56
+ worksheet: {
57
+ type: String,
58
+ default: "Sheet1"
59
+ },
60
+ //event before generate was called
61
+ beforeGenerate: {
62
+ type: Function
63
+ },
64
+ //event before download pops up
65
+ beforeFinish: {
66
+ type: Function
67
+ },
68
+ // Determine if CSV Data should be escaped
69
+ escapeCsv: {
70
+ type: Boolean,
71
+ default: !0
72
+ },
73
+ // long number stringify
74
+ stringifyLongNum: {
75
+ type: Boolean,
76
+ default: !1
77
+ }
78
+ },
79
+ computed: {
80
+ // unique identifier
81
+ idName() {
82
+ var e = (/* @__PURE__ */ new Date()).getTime();
83
+ return "export_" + e;
84
+ },
85
+ downloadFields() {
86
+ if (this.fields)
87
+ return this.fields;
88
+ if (this.exportFields)
89
+ return this.exportFields;
90
+ }
91
+ },
92
+ methods: {
93
+ async generate() {
94
+ typeof this.beforeGenerate == "function" && await this.beforeGenerate();
95
+ let e = this.data;
96
+ if ((typeof this.fetch == "function" || !e) && (e = await this.fetch()), !e || !e.length)
97
+ return;
98
+ let r = this.getProcessedJson(e, this.downloadFields);
99
+ return this.type === "html" ? this.export(
100
+ this.jsonToXLS(r),
101
+ this.name.replace(".xls", ".html"),
102
+ "text/html"
103
+ ) : this.type === "csv" ? this.export(
104
+ this.jsonToCSV(r),
105
+ this.name.replace(".xls", ".csv"),
106
+ "application/csv"
107
+ ) : this.export(
108
+ this.jsonToXLS(r),
109
+ this.name,
110
+ "application/vnd.ms-excel"
111
+ );
112
+ },
113
+ /*
114
+ Use downloadjs to generate the download link
115
+ */
116
+ export: async function(e, r, t) {
117
+ let s = this.base64ToBlob(e, t);
118
+ typeof this.beforeFinish == "function" && await this.beforeFinish(), m(s, r, t);
119
+ },
120
+ /*
121
+ jsonToXLS
122
+ ---------------
123
+ Transform json data into an xml document with MS Excel format, sadly
124
+ it shows a prompt when it opens, that is a default behavior for
125
+ Microsoft office and cannot be avoided. It's recommended to use CSV format instead.
126
+ */
127
+ jsonToXLS(e) {
128
+ let r = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=ProgId content=Excel.Sheet> <meta name=Generator content="Microsoft Excel 11"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>${worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><style>br {mso-data-placement: same-cell;}</style></head><body><table>${table}</table></body></html>', t = "<thead>";
129
+ const s = Object.keys(e[0]).length;
130
+ let o = this;
131
+ const n = this.header || this.$attrs.title;
132
+ n && (t += this.parseExtraData(
133
+ n,
134
+ '<tr><th colspan="' + s + '">${data}</th></tr>'
135
+ )), t += "<tr>";
136
+ for (let a in e[0])
137
+ t += "<th>" + a + "</th>";
138
+ return t += "</tr>", t += "</thead>", t += "<tbody>", e.map(function(a, i) {
139
+ t += "<tr>";
140
+ for (let l in a)
141
+ t += "<td>" + o.preprocessLongNum(
142
+ o.valueReformattedForMultilines(a[l])
143
+ ) + "</td>";
144
+ t += "</tr>";
145
+ }), t += "</tbody>", this.footer != null && (t += "<tfoot>", t += this.parseExtraData(
146
+ this.footer,
147
+ '<tr><td colspan="' + s + '">${data}</td></tr>'
148
+ ), t += "</tfoot>"), r.replace("${table}", t).replace("${worksheet}", this.worksheet);
149
+ },
150
+ /*
151
+ jsonToCSV
152
+ ---------------
153
+ Transform json data into an CSV file.
154
+ */
155
+ jsonToCSV(e) {
156
+ let r = this;
157
+ var t = [];
158
+ const s = this.header || this.$attrs.title;
159
+ s && t.push(this.parseExtraData(s, "${data}\r\n"));
160
+ for (let o in e[0])
161
+ t.push(o), t.push(",");
162
+ return t.pop(), t.push(`\r
163
+ `), e.map(function(o) {
164
+ for (let n in o) {
165
+ let a = o[n] + "";
166
+ r.escapeCsv && (a = '="' + a + '"', a.match(/[,"\n]/) && (a = '"' + a.replace(/\"/g, '""') + '"')), t.push(a), t.push(",");
167
+ }
168
+ t.pop(), t.push(`\r
169
+ `);
170
+ }), this.footer != null && t.push(this.parseExtraData(this.footer, "${data}\r\n")), t.join("");
171
+ },
172
+ /*
173
+ getProcessedJson
174
+ ---------------
175
+ Get only the data to export, if no fields are set return all the data
176
+ */
177
+ getProcessedJson(e, r) {
178
+ let t = this.getKeys(e, r), s = [], o = this;
179
+ return e.map(function(n, a) {
180
+ let i = {};
181
+ for (let l in t) {
182
+ let u = t[l];
183
+ i[l] = o.getValue(u, n);
184
+ }
185
+ s.push(i);
186
+ }), s;
187
+ },
188
+ getKeys(e, r) {
189
+ if (r)
190
+ return r;
191
+ let t = {};
192
+ for (let s in e[0])
193
+ t[s] = s;
194
+ return t;
195
+ },
196
+ /*
197
+ parseExtraData
198
+ ---------------
199
+ Parse title and footer attribute to the csv format
200
+ */
201
+ parseExtraData(e, r) {
202
+ let t = "";
203
+ if (Array.isArray(e))
204
+ for (var s = 0; s < e.length; s++)
205
+ e[s] && (t += r.replace("${data}", e[s]));
206
+ else
207
+ t += r.replace("${data}", e);
208
+ return t;
209
+ },
210
+ getValue(e, r) {
211
+ const t = typeof e != "object" ? e : e.field;
212
+ let s = typeof t != "string" ? [] : t.split("."), o = this.defaultValue;
213
+ return t ? s.length > 1 ? o = this.getValueFromNestedItem(r, s) : o = this.parseValue(r[t]) : o = r, e.hasOwnProperty("callback") && (o = this.getValueFromCallback(o, e.callback)), o;
214
+ },
215
+ /*
216
+ convert values with newline \n characters into <br/>
217
+ */
218
+ valueReformattedForMultilines(e) {
219
+ return typeof e == "string" ? e.replace(/\n/gi, "<br/>") : e;
220
+ },
221
+ preprocessLongNum(e) {
222
+ if (this.stringifyLongNum) {
223
+ if (String(e).startsWith("0x"))
224
+ return e;
225
+ if (!isNaN(e) && e != "" && (e > 99999999999 || e < 1e-13))
226
+ return '="' + e + '"';
227
+ }
228
+ return e;
229
+ },
230
+ getValueFromNestedItem(e, r) {
231
+ let t = e;
232
+ for (let s of r)
233
+ t && (t = t[s]);
234
+ return this.parseValue(t);
235
+ },
236
+ getValueFromCallback(e, r) {
237
+ if (typeof r != "function")
238
+ return this.defaultValue;
239
+ const t = r(e);
240
+ return this.parseValue(t);
241
+ },
242
+ parseValue(e) {
243
+ return e || e === 0 || typeof e == "boolean" ? e : this.defaultValue;
244
+ },
245
+ base64ToBlob(e, r) {
246
+ let t = window.btoa(window.unescape(encodeURIComponent(e))), s = atob(t), o = s.length, n = new Uint8ClampedArray(o);
247
+ for (; o--; )
248
+ n[o] = s.charCodeAt(o);
249
+ return new Blob([n], { type: r });
250
+ }
251
+ }
252
+ // end methods
253
+ }, F = ["id"];
254
+ function S(e, r, t, s, o, n) {
255
+ return d(), x("div", {
256
+ id: n.idName,
257
+ onClick: r[0] || (r[0] = (...a) => n.generate && n.generate(...a))
258
+ }, [
259
+ y(e.$slots, "default", {}, () => [
260
+ h(" Download " + g(t.name), 1)
261
+ ])
262
+ ], 8, F);
263
+ }
264
+ const N = /* @__PURE__ */ c(C, [["render", S]]), $ = /* @__PURE__ */ b({
265
+ name: "QsyxExportExcel",
266
+ __name: "index",
267
+ props: {
268
+ json_fields: {
269
+ required: !0
270
+ },
271
+ details_form: {
272
+ required: !0
273
+ },
274
+ header: {
275
+ type: String
276
+ }
277
+ },
278
+ setup(e) {
279
+ const r = e;
280
+ return w(""), p({
281
+ 排查日期: "date",
282
+ 整改隐患内容: "details",
283
+ 整改措施: "measure",
284
+ 整改时限: "timeLimit",
285
+ 应急措施和预案: "plan",
286
+ 整改责任人: "personInCharge",
287
+ 填表人: "preparer",
288
+ 整改资金: "fund",
289
+ 整改完成情况: "complete",
290
+ 备注: "remark"
291
+ }), p([{
292
+ date: "2022-3-10",
293
+ details: "卸油区过路灯损坏",
294
+ measure: "更换灯泡",
295
+ timeLimit: "2022-3-21",
296
+ plan: "先使用充电灯代替,贴好安全提醒告示",
297
+ personInCharge: "王xx",
298
+ preparer: "王xx",
299
+ fund: "20元",
300
+ complete: "已完成整改",
301
+ remark: "重新更换了灯泡"
302
+ }]), (t, s) => {
303
+ const o = k("el-button");
304
+ return d(), _(N, {
305
+ class: "export-excel-wrapper",
306
+ data: r.details_form,
307
+ fields: r.json_fields,
308
+ header: r.header,
309
+ name: "aaa.xls"
310
+ }, {
311
+ default: f(() => [
312
+ E(o, { type: "success" }, {
313
+ default: f(() => s[0] || (s[0] = [
314
+ h("导出")
315
+ ])),
316
+ _: 1
317
+ })
318
+ ]),
319
+ _: 1
320
+ }, 8, ["data", "fields", "header"]);
321
+ };
322
+ }
323
+ }), j = /* @__PURE__ */ c($, [["__scopeId", "data-v-a42e3f01"]]), W = V(j);
324
+ export {
325
+ W as Q
326
+ };