@amirjalili1374/ui-kit 1.5.88 → 1.5.90
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
|
@@ -38882,12 +38882,13 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
38882
38882
|
return new Blob([byteArray], { type: mimeType });
|
|
38883
38883
|
};
|
|
38884
38884
|
const handleExportClientSide = () => {
|
|
38885
|
-
|
|
38885
|
+
const sourceItems = (props.items && props.items.length ? props.items : items.value) ?? [];
|
|
38886
|
+
if (sourceItems.length === 0) {
|
|
38886
38887
|
console.warn("دادهای برای خروجی اکسل وجود ندارد.");
|
|
38887
38888
|
return;
|
|
38888
38889
|
}
|
|
38889
|
-
const validHeaders = props.headers.filter((h2) => h2.key && h2.title);
|
|
38890
|
-
const excelData =
|
|
38890
|
+
const validHeaders = props.headers.filter((h2) => !!h2.key && !!h2.title);
|
|
38891
|
+
const excelData = sourceItems.map((item) => {
|
|
38891
38892
|
const row = {};
|
|
38892
38893
|
validHeaders.forEach((header) => {
|
|
38893
38894
|
var _a;
|
|
@@ -38895,7 +38896,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
38895
38896
|
if (header.formatter) {
|
|
38896
38897
|
value2 = header.formatter(value2, item);
|
|
38897
38898
|
} else if (header.type === "date" || header.isDate) {
|
|
38898
|
-
value2
|
|
38899
|
+
if (value2 !== null && value2 !== void 0 && value2 !== "") {
|
|
38900
|
+
try {
|
|
38901
|
+
value2 = DateConverter.toShamsi(value2);
|
|
38902
|
+
} catch {
|
|
38903
|
+
}
|
|
38904
|
+
}
|
|
38899
38905
|
} else if (typeof value2 === "boolean") {
|
|
38900
38906
|
value2 = value2 ? "بله" : "خیر";
|
|
38901
38907
|
}
|
|
@@ -38905,11 +38911,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
38905
38911
|
});
|
|
38906
38912
|
const worksheet = utils.json_to_sheet(excelData);
|
|
38907
38913
|
worksheet["!cols"] = validHeaders.map((h2) => ({
|
|
38908
|
-
wch: h2.width ? Math.round(h2.width / 7) : 20
|
|
38914
|
+
wch: h2.width ? Math.max(10, Math.round(h2.width / 7)) : 20
|
|
38909
38915
|
}));
|
|
38910
38916
|
const workbook = utils.book_new();
|
|
38911
38917
|
utils.book_append_sheet(workbook, worksheet, "Data Export");
|
|
38912
|
-
const
|
|
38918
|
+
const safeName = (props.exportFileName || "export-data").trim();
|
|
38919
|
+
const fileName = safeName.toLowerCase().endsWith(".xlsx") ? safeName : `${safeName}.xlsx`;
|
|
38913
38920
|
writeFileSync(workbook, fileName);
|
|
38914
38921
|
};
|
|
38915
38922
|
const handleExport = async () => {
|
|
@@ -39168,8 +39175,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
39168
39175
|
const previewItem = ref(null);
|
|
39169
39176
|
__expose({
|
|
39170
39177
|
fetchData,
|
|
39171
|
-
items,
|
|
39172
|
-
selectedItems,
|
|
39178
|
+
getItems: () => items.value,
|
|
39173
39179
|
getSelectedItems: () => selectedItems.value,
|
|
39174
39180
|
clearSelection: () => {
|
|
39175
39181
|
selectedItems.value = [];
|