@amirjalili1374/ui-kit 1.5.83 → 1.5.85
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/components/shared/CustomDataTable.vue.d.ts +3 -0
- package/dist/components/shared/CustomDataTable.vue.d.ts.map +1 -1
- package/dist/services/apiService.d.ts +1 -0
- package/dist/services/apiService.d.ts.map +1 -1
- package/dist/types/componentTypes/DataTableTypes.d.ts +4 -0
- package/dist/types/componentTypes/DataTableTypes.d.ts.map +1 -1
- package/dist/ui-kit.cjs.js +1 -1
- package/dist/ui-kit.cjs.js.map +1 -1
- package/dist/ui-kit.es.js +84 -2
- package/dist/ui-kit.es.js.map +1 -1
- package/package.json +1 -1
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, 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, IconFileExport, 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";
|
|
@@ -14338,6 +14338,13 @@ function apiService(axiosInst, resource) {
|
|
|
14338
14338
|
async get(id) {
|
|
14339
14339
|
const response = await axiosInst.get(`${baseUrl}/${id}`);
|
|
14340
14340
|
return response;
|
|
14341
|
+
},
|
|
14342
|
+
async exportExcel(params = {}, customUrl) {
|
|
14343
|
+
const url = customUrl || baseUrl;
|
|
14344
|
+
const response = await axiosInst.get(url, {
|
|
14345
|
+
params
|
|
14346
|
+
});
|
|
14347
|
+
return response;
|
|
14341
14348
|
}
|
|
14342
14349
|
};
|
|
14343
14350
|
}
|
|
@@ -18333,12 +18340,17 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
18333
18340
|
enableTextTruncation: { type: Boolean, default: false },
|
|
18334
18341
|
maxTextLength: { default: 50 },
|
|
18335
18342
|
filterAdapter: {},
|
|
18336
|
-
inlineFilter: { type: Boolean, default: false }
|
|
18343
|
+
inlineFilter: { type: Boolean, default: false },
|
|
18344
|
+
filters: {},
|
|
18345
|
+
enableExport: { type: Boolean, default: false },
|
|
18346
|
+
exportUrl: { default: "" },
|
|
18347
|
+
exportFileName: { default: "" }
|
|
18337
18348
|
},
|
|
18338
18349
|
emits: ["update:selectedItems", "selection-change"],
|
|
18339
18350
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18340
18351
|
const filters = reactive({});
|
|
18341
18352
|
const initialized = ref(false);
|
|
18353
|
+
const exportLoading = ref(false);
|
|
18342
18354
|
const props = __props;
|
|
18343
18355
|
const emit = __emit;
|
|
18344
18356
|
watch(filters, () => {
|
|
@@ -18695,6 +18707,55 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
18695
18707
|
emit("update:selectedItems", selectedItems.value);
|
|
18696
18708
|
emit("selection-change", selectedItems.value);
|
|
18697
18709
|
};
|
|
18710
|
+
const base64ToBlob = (base64, mimeType) => {
|
|
18711
|
+
const cleanedBase64 = base64.includes(",") ? base64.split(",")[1] : base64;
|
|
18712
|
+
const byteCharacters = atob(cleanedBase64);
|
|
18713
|
+
const byteNumbers = new Array(byteCharacters.length);
|
|
18714
|
+
for (let i = 0; i < byteCharacters.length; i++) {
|
|
18715
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
18716
|
+
}
|
|
18717
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
18718
|
+
return new Blob([byteArray], { type: mimeType });
|
|
18719
|
+
};
|
|
18720
|
+
const handleExport = async () => {
|
|
18721
|
+
var _a, _b, _c;
|
|
18722
|
+
try {
|
|
18723
|
+
exportLoading.value = true;
|
|
18724
|
+
const rawFilter = buildFilterParams();
|
|
18725
|
+
const finalFilter = resolveFilter(rawFilter);
|
|
18726
|
+
const hasExternalCriteria = externalCriteria.value && Object.keys(externalCriteria.value).length > 0;
|
|
18727
|
+
let params = {
|
|
18728
|
+
...hasExternalCriteria ? {} : finalFilter,
|
|
18729
|
+
...props.queryParams,
|
|
18730
|
+
...externalCriteria.value || {}
|
|
18731
|
+
};
|
|
18732
|
+
if (props.showPagination !== false) {
|
|
18733
|
+
params = {
|
|
18734
|
+
...params,
|
|
18735
|
+
page: currentPage.value - 1,
|
|
18736
|
+
size: itemsPerPage.value
|
|
18737
|
+
};
|
|
18738
|
+
}
|
|
18739
|
+
const response = await api.exportExcel(params, props.exportUrl);
|
|
18740
|
+
const base64Data = typeof response.data === "string" ? response.data : ((_a = response.data) == null ? void 0 : _a.data) || ((_b = response.data) == null ? void 0 : _b.file) || ((_c = response.data) == null ? void 0 : _c.content) || "";
|
|
18741
|
+
if (!base64Data || typeof base64Data !== "string") {
|
|
18742
|
+
throw new Error("Export response is not a valid base64 string.");
|
|
18743
|
+
}
|
|
18744
|
+
const blob = base64ToBlob(base64Data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
18745
|
+
const url = window.URL.createObjectURL(blob);
|
|
18746
|
+
const link = document.createElement("a");
|
|
18747
|
+
link.href = url;
|
|
18748
|
+
link.download = props.exportFileName || "export.xlsx";
|
|
18749
|
+
document.body.appendChild(link);
|
|
18750
|
+
link.click();
|
|
18751
|
+
document.body.removeChild(link);
|
|
18752
|
+
window.URL.revokeObjectURL(url);
|
|
18753
|
+
} catch (err) {
|
|
18754
|
+
console.error("Export Error:", err);
|
|
18755
|
+
} finally {
|
|
18756
|
+
exportLoading.value = false;
|
|
18757
|
+
}
|
|
18758
|
+
};
|
|
18698
18759
|
const selectSingleItem = (item) => {
|
|
18699
18760
|
selection.clearSelection();
|
|
18700
18761
|
selection.selectedItems.value = [item];
|
|
@@ -19511,6 +19572,27 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
19511
19572
|
])]),
|
|
19512
19573
|
_: 1
|
|
19513
19574
|
}, 8, ["loading"])) : createCommentVNode("", true),
|
|
19575
|
+
__props.enableExport ? (openBlock(), createBlock(VBtn, {
|
|
19576
|
+
key: 5,
|
|
19577
|
+
icon: "",
|
|
19578
|
+
class: "text-secondary mx-3",
|
|
19579
|
+
color: "lightsecondary",
|
|
19580
|
+
rounded: "sm",
|
|
19581
|
+
size: "small",
|
|
19582
|
+
variant: "flat",
|
|
19583
|
+
loading: exportLoading.value,
|
|
19584
|
+
disabled: loading.value,
|
|
19585
|
+
onClick: handleExport,
|
|
19586
|
+
title: "خروجی اکسل"
|
|
19587
|
+
}, {
|
|
19588
|
+
default: withCtx(() => [
|
|
19589
|
+
createVNode(unref(IconFileExport), {
|
|
19590
|
+
"stroke-width": "1.5",
|
|
19591
|
+
size: "22"
|
|
19592
|
+
})
|
|
19593
|
+
]),
|
|
19594
|
+
_: 1
|
|
19595
|
+
}, 8, ["loading", "disabled"])) : createCommentVNode("", true),
|
|
19514
19596
|
createVNode(Transition, {
|
|
19515
19597
|
name: "slide-left",
|
|
19516
19598
|
appear: ""
|