@amirjalili1374/ui-kit 1.5.87 → 1.5.89

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
@@ -2,7 +2,7 @@ var __defProp2 = Object.defineProperty;
2
2
  var __defNormalProp2 = (obj, key2, value2) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key2] = value2;
3
3
  var __publicField = (obj, key2, value2) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value2);
4
4
  import { warn, reactive, watchEffect, toRef, capitalize, shallowRef, Fragment, camelize, isVNode, Comment, unref, getCurrentInstance as getCurrentInstance$1, ref, computed, provide, inject, defineComponent as defineComponent$1, h, createElementVNode, normalizeStyle, normalizeClass, toValue, resolveDynamicComponent, nextTick, onScopeDispose, createVNode, mergeProps, toRefs, Text, isRef, TransitionGroup, Transition, watch, onBeforeMount, onBeforeUnmount, withDirectives, vShow, toDisplayString, effectScope, toRaw, readonly, openBlock, createBlock, withCtx, createCommentVNode, useId, onMounted, onUpdated, Teleport, createTextVNode, createElementBlock, renderSlot, onDeactivated, cloneVNode, renderList, createSlots, normalizeProps, guardReactiveProps, resolveComponent, onActivated, onBeforeUpdate, withModifiers, vModelText, withKeys, onUnmounted } from "vue";
5
- import { IconHome, IconArrowBadgeLeft, IconFileExport, IconCheck, IconSquareX, IconChevronDown, IconChevronRight, IconMinus, IconPlus, IconRefresh, IconChevronLeft, IconDownload, IconPrinter, IconMaximize, IconMinimize, IconX, IconFileText, IconPencil, IconClock, IconMenu2, IconPalette } from "@tabler/icons-vue";
5
+ import { IconHome, IconArrowBadgeLeft, IconCheck, IconSquareX, IconChevronDown, IconChevronRight, IconMinus, IconPlus, IconRefresh, IconChevronLeft, IconDownload, IconPrinter, IconMaximize, IconMinimize, IconX, IconFileText, IconPencil, IconClock, IconMenu2, IconPalette } from "@tabler/icons-vue";
6
6
  import axios from "axios";
7
7
  import { useDebounceFn } from "@vueuse/core";
8
8
  import { useRouter as useRouter$1 } from "vue-router";
@@ -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
- if (!props.items || props.items.length === 0) {
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 = props.items.map((item) => {
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 = DateConverter.toShamsi(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 fileName = props.exportFileName ? `${props.exportFileName}.xlsx` : "export-data.xlsx";
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 () => {
@@ -39781,23 +39788,16 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
39781
39788
  }, 8, ["loading"])) : createCommentVNode("", true),
39782
39789
  __props.enableExport ? (openBlock(), createBlock(VBtn, {
39783
39790
  key: 5,
39784
- icon: "",
39785
- class: "text-secondary mx-3",
39786
- color: "lightsecondary",
39787
- rounded: "sm",
39788
- size: "small",
39789
- variant: "outlined",
39791
+ color: "secondary",
39792
+ variant: "tonal",
39793
+ class: "me-2",
39794
+ onClick: onExportClick,
39790
39795
  loading: exportLoading.value,
39791
- disabled: loading.value,
39792
- onClick: onExportClick
39796
+ disabled: loading.value
39793
39797
  }, {
39794
- default: withCtx(() => [
39795
- createVNode(unref(IconFileExport), {
39796
- "stroke-width": "1.5",
39797
- size: "22"
39798
- }),
39799
- _cache[30] || (_cache[30] = createTextVNode(" خروجی اکسل ", -1))
39800
- ]),
39798
+ default: withCtx(() => [..._cache[30] || (_cache[30] = [
39799
+ createTextVNode("گزارش کلی", -1)
39800
+ ])]),
39801
39801
  _: 1
39802
39802
  }, 8, ["loading", "disabled"])) : createCommentVNode("", true),
39803
39803
  createVNode(Transition, {