@amirjalili1374/ui-kit 1.5.83 → 1.5.84
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 +70 -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,14 @@ 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
|
+
responseType: "blob"
|
|
14347
|
+
});
|
|
14348
|
+
return response;
|
|
14341
14349
|
}
|
|
14342
14350
|
};
|
|
14343
14351
|
}
|
|
@@ -18333,12 +18341,17 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
18333
18341
|
enableTextTruncation: { type: Boolean, default: false },
|
|
18334
18342
|
maxTextLength: { default: 50 },
|
|
18335
18343
|
filterAdapter: {},
|
|
18336
|
-
inlineFilter: { type: Boolean, default: false }
|
|
18344
|
+
inlineFilter: { type: Boolean, default: false },
|
|
18345
|
+
filters: {},
|
|
18346
|
+
enableExport: { type: Boolean, default: false },
|
|
18347
|
+
exportUrl: { default: "" },
|
|
18348
|
+
exportFileName: { default: "" }
|
|
18337
18349
|
},
|
|
18338
18350
|
emits: ["update:selectedItems", "selection-change"],
|
|
18339
18351
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18340
18352
|
const filters = reactive({});
|
|
18341
18353
|
const initialized = ref(false);
|
|
18354
|
+
const exportLoading = ref(false);
|
|
18342
18355
|
const props = __props;
|
|
18343
18356
|
const emit = __emit;
|
|
18344
18357
|
watch(filters, () => {
|
|
@@ -18695,6 +18708,40 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
18695
18708
|
emit("update:selectedItems", selectedItems.value);
|
|
18696
18709
|
emit("selection-change", selectedItems.value);
|
|
18697
18710
|
};
|
|
18711
|
+
const handleExport = async () => {
|
|
18712
|
+
try {
|
|
18713
|
+
exportLoading.value = true;
|
|
18714
|
+
const rawFilter = buildFilterParams();
|
|
18715
|
+
const finalFilter = resolveFilter(rawFilter);
|
|
18716
|
+
const hasExternalCriteria = externalCriteria.value && Object.keys(externalCriteria.value).length > 0;
|
|
18717
|
+
let params = {
|
|
18718
|
+
...hasExternalCriteria ? {} : finalFilter,
|
|
18719
|
+
...props.queryParams,
|
|
18720
|
+
...externalCriteria.value || {}
|
|
18721
|
+
};
|
|
18722
|
+
if (props.showPagination !== false) {
|
|
18723
|
+
params = {
|
|
18724
|
+
...params,
|
|
18725
|
+
page: currentPage.value - 1,
|
|
18726
|
+
size: itemsPerPage.value
|
|
18727
|
+
};
|
|
18728
|
+
}
|
|
18729
|
+
const response = await api.exportExcel(params, props.exportUrl);
|
|
18730
|
+
const blob = new Blob([response.data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
|
|
18731
|
+
const url = window.URL.createObjectURL(blob);
|
|
18732
|
+
const link = document.createElement("a");
|
|
18733
|
+
link.href = url;
|
|
18734
|
+
link.download = props.exportFileName || "export.xlsx";
|
|
18735
|
+
document.body.appendChild(link);
|
|
18736
|
+
link.click();
|
|
18737
|
+
document.body.removeChild(link);
|
|
18738
|
+
window.URL.revokeObjectURL(url);
|
|
18739
|
+
} catch (err) {
|
|
18740
|
+
console.error("Export Error:", err);
|
|
18741
|
+
} finally {
|
|
18742
|
+
exportLoading.value = false;
|
|
18743
|
+
}
|
|
18744
|
+
};
|
|
18698
18745
|
const selectSingleItem = (item) => {
|
|
18699
18746
|
selection.clearSelection();
|
|
18700
18747
|
selection.selectedItems.value = [item];
|
|
@@ -19511,6 +19558,27 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
|
|
|
19511
19558
|
])]),
|
|
19512
19559
|
_: 1
|
|
19513
19560
|
}, 8, ["loading"])) : createCommentVNode("", true),
|
|
19561
|
+
__props.enableExport ? (openBlock(), createBlock(VBtn, {
|
|
19562
|
+
key: 5,
|
|
19563
|
+
icon: "",
|
|
19564
|
+
class: "text-secondary mx-3",
|
|
19565
|
+
color: "lightsecondary",
|
|
19566
|
+
rounded: "sm",
|
|
19567
|
+
size: "small",
|
|
19568
|
+
variant: "flat",
|
|
19569
|
+
loading: exportLoading.value,
|
|
19570
|
+
disabled: loading.value,
|
|
19571
|
+
onClick: handleExport,
|
|
19572
|
+
title: "خروجی اکسل"
|
|
19573
|
+
}, {
|
|
19574
|
+
default: withCtx(() => [
|
|
19575
|
+
createVNode(unref(IconFileExport), {
|
|
19576
|
+
"stroke-width": "1.5",
|
|
19577
|
+
size: "22"
|
|
19578
|
+
})
|
|
19579
|
+
]),
|
|
19580
|
+
_: 1
|
|
19581
|
+
}, 8, ["loading", "disabled"])) : createCommentVNode("", true),
|
|
19514
19582
|
createVNode(Transition, {
|
|
19515
19583
|
name: "slide-left",
|
|
19516
19584
|
appear: ""
|