@amirjalili1374/ui-kit 1.6.6 → 1.6.7
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/ui-kit.es.js
CHANGED
|
@@ -33097,6 +33097,9 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
33097
33097
|
const sourceItems = (props.items && props.items.length ? props.items : items.value) ?? [];
|
|
33098
33098
|
if (!sourceItems.length) return;
|
|
33099
33099
|
const headers = props.headers.filter((h2) => h2.key && h2.title);
|
|
33100
|
+
const now = /* @__PURE__ */ new Date();
|
|
33101
|
+
const exportDate = now.toLocaleDateString("fa-IR") + " " + now.toLocaleTimeString("fa-IR", { hour: "2-digit", minute: "2-digit" });
|
|
33102
|
+
const title = props.exportFileName || "گزارش";
|
|
33100
33103
|
const moneyTotals = {};
|
|
33101
33104
|
const rows = sourceItems.map((item) => {
|
|
33102
33105
|
const row = {};
|
|
@@ -33120,11 +33123,14 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
33120
33123
|
else totalRow[h2.title] = "";
|
|
33121
33124
|
});
|
|
33122
33125
|
rows.push(totalRow);
|
|
33123
|
-
const ws = xlsx_minExports.utils.json_to_sheet(rows);
|
|
33126
|
+
const ws = xlsx_minExports.utils.json_to_sheet(rows, { origin: "A4" });
|
|
33124
33127
|
const range = xlsx_minExports.utils.decode_range(ws["!ref"]);
|
|
33125
|
-
ws["!freeze"] = { xSplit: 0, ySplit:
|
|
33128
|
+
ws["!freeze"] = { xSplit: 0, ySplit: 3 };
|
|
33126
33129
|
ws["!autofilter"] = {
|
|
33127
|
-
ref: xlsx_minExports.utils.encode_range(
|
|
33130
|
+
ref: xlsx_minExports.utils.encode_range({
|
|
33131
|
+
s: { r: 3, c: 0 },
|
|
33132
|
+
e: range.e
|
|
33133
|
+
})
|
|
33128
33134
|
};
|
|
33129
33135
|
ws["!cols"] = headers.map((h2) => {
|
|
33130
33136
|
let max = h2.title.length;
|
|
@@ -33134,6 +33140,29 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
33134
33140
|
});
|
|
33135
33141
|
return { wch: max + 4 };
|
|
33136
33142
|
});
|
|
33143
|
+
xlsx_minExports.utils.sheet_add_aoa(
|
|
33144
|
+
ws,
|
|
33145
|
+
[
|
|
33146
|
+
[title],
|
|
33147
|
+
[`تاریخ چاپ: ${exportDate}`],
|
|
33148
|
+
[]
|
|
33149
|
+
],
|
|
33150
|
+
{ origin: "A1" }
|
|
33151
|
+
);
|
|
33152
|
+
ws["!merges"] = [
|
|
33153
|
+
{
|
|
33154
|
+
s: { r: 0, c: 0 },
|
|
33155
|
+
e: { r: 0, c: headers.length - 1 }
|
|
33156
|
+
}
|
|
33157
|
+
];
|
|
33158
|
+
ws["A1"].s = {
|
|
33159
|
+
font: { bold: true, sz: 16, name: "B Nazanin" },
|
|
33160
|
+
alignment: { horizontal: "center", vertical: "center" }
|
|
33161
|
+
};
|
|
33162
|
+
ws["A2"].s = {
|
|
33163
|
+
font: { name: "B Nazanin", sz: 12 },
|
|
33164
|
+
alignment: { horizontal: "left" }
|
|
33165
|
+
};
|
|
33137
33166
|
const headerStyle = {
|
|
33138
33167
|
font: { bold: true, name: "B Nazanin" },
|
|
33139
33168
|
alignment: { horizontal: "center", vertical: "center" },
|
|
@@ -33147,13 +33176,13 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
33147
33176
|
};
|
|
33148
33177
|
const zebraFill = { fgColor: { rgb: "F7F7F7" } };
|
|
33149
33178
|
headers.forEach((h2, c) => {
|
|
33150
|
-
const headerCell = xlsx_minExports.utils.encode_cell({ r:
|
|
33179
|
+
const headerCell = xlsx_minExports.utils.encode_cell({ r: 3, c });
|
|
33151
33180
|
if (ws[headerCell]) ws[headerCell].s = headerStyle;
|
|
33152
|
-
for (let r =
|
|
33181
|
+
for (let r = 4; r <= rows.length + 3; r++) {
|
|
33153
33182
|
const addr = xlsx_minExports.utils.encode_cell({ r, c });
|
|
33154
33183
|
const cell = ws[addr];
|
|
33155
33184
|
if (!cell) continue;
|
|
33156
|
-
const isTotalRow = r === rows.length;
|
|
33185
|
+
const isTotalRow = r === rows.length + 3;
|
|
33157
33186
|
const zebra = r % 2 === 0;
|
|
33158
33187
|
cell.s = {
|
|
33159
33188
|
font: { name: "B Nazanin" },
|
|
@@ -33183,7 +33212,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
33183
33212
|
Views: [{ RTL: true }]
|
|
33184
33213
|
};
|
|
33185
33214
|
xlsx_minExports.utils.book_append_sheet(wb, ws, "Report");
|
|
33186
|
-
const
|
|
33215
|
+
const dateForFile = now.toLocaleDateString("fa-IR").replaceAll("/", "-");
|
|
33216
|
+
const fileName = `${title}_${dateForFile}.xlsx`;
|
|
33187
33217
|
xlsx_minExports.writeFile(wb, fileName);
|
|
33188
33218
|
};
|
|
33189
33219
|
const handleExport = async () => {
|