@amirjalili1374/ui-kit 1.2.1 → 1.2.3

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
@@ -13167,7 +13167,7 @@ function useTableSelection(items, options = {}) {
13167
13167
  getUniqueValue
13168
13168
  };
13169
13169
  }
13170
- function apiService(axiosInst = axios, resource) {
13170
+ function apiService(axiosInst, resource) {
13171
13171
  const baseUrl = resource.startsWith("/") ? resource : `/${resource}`;
13172
13172
  return {
13173
13173
  async fetch(params = {}) {
@@ -13195,6 +13195,13 @@ function apiService(axiosInst = axios, resource) {
13195
13195
  }
13196
13196
  };
13197
13197
  }
13198
+ let configuredInstance = null;
13199
+ function configureAxiosInstance(instance) {
13200
+ configuredInstance = instance;
13201
+ }
13202
+ function getAxiosInstance() {
13203
+ return configuredInstance || axios;
13204
+ }
13198
13205
  class DateConverter {
13199
13206
  // Convert Gregorian to Shamsi
13200
13207
  static toShamsi(dateStr) {
@@ -16272,7 +16279,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent$1({
16272
16279
  defaultExpanded: { type: Boolean, default: false },
16273
16280
  defaultSelected: {},
16274
16281
  dateWithTimezone: { type: Boolean, default: false },
16275
- bulkMode: { type: Boolean, default: false }
16282
+ bulkMode: { type: Boolean, default: false },
16283
+ axiosInstance: {}
16276
16284
  },
16277
16285
  emits: ["update:selectedItems", "selection-change"],
16278
16286
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -16709,7 +16717,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent$1({
16709
16717
  );
16710
16718
  onBeforeUnmount(() => {
16711
16719
  });
16712
- const api = apiService(axios, props.apiResource);
16720
+ const componentAxiosInstance = props.axiosInstance || getAxiosInstance();
16721
+ const api = apiService(componentAxiosInstance, props.apiResource);
16713
16722
  const customActionDialog = ref(false);
16714
16723
  const customActionComponent = shallowRef(null);
16715
16724
  const customActionItem = ref(null);
@@ -16947,7 +16956,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent$1({
16947
16956
  } catch (error2) {
16948
16957
  console.error("Download error:", error2);
16949
16958
  try {
16950
- const axiosResponse = await axios.get(fileUrlString, {
16959
+ const axiosResponse = await componentAxiosInstance.get(fileUrlString, {
16951
16960
  responseType: "blob",
16952
16961
  headers: {
16953
16962
  Accept: "application/octet-stream,application/pdf,image/*,*/*"
@@ -16961,7 +16970,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent$1({
16961
16970
  url: fileUrlString
16962
16971
  });
16963
16972
  if (contentType && contentType.includes("xml")) {
16964
- const textResponse = await axios.get(fileUrlString, {
16973
+ const textResponse = await componentAxiosInstance.get(fileUrlString, {
16965
16974
  responseType: "text"
16966
16975
  });
16967
16976
  console.error("Server returned XML error:", textResponse.data);
@@ -16985,7 +16994,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent$1({
16985
16994
  console.error("Axios download error:", axiosError);
16986
16995
  if (axiosError.response) {
16987
16996
  try {
16988
- const errorText = await axios.get(url, {
16997
+ const errorText = await componentAxiosInstance.get(fileUrlString, {
16989
16998
  responseType: "text"
16990
16999
  });
16991
17000
  console.error("Server error response:", errorText.data);
@@ -36263,7 +36272,8 @@ function useDataTable(options) {
36263
36272
  loading.value = true;
36264
36273
  error.value = null;
36265
36274
  try {
36266
- const response = await axios.get(options.apiResource, {
36275
+ const axiosInstance = getAxiosInstance();
36276
+ const response = await axiosInstance.get(options.apiResource, {
36267
36277
  params: {
36268
36278
  page: pagination.value.currentPage,
36269
36279
  per_page: pagination.value.itemsPerPage,
@@ -36301,7 +36311,8 @@ function useDataTable(options) {
36301
36311
  isLoadingMore.value = true;
36302
36312
  pagination.value.currentPage += 1;
36303
36313
  try {
36304
- const response = await axios.get(options.apiResource, {
36314
+ const axiosInstance = getAxiosInstance();
36315
+ const response = await axiosInstance.get(options.apiResource, {
36305
36316
  params: {
36306
36317
  page: pagination.value.currentPage,
36307
36318
  per_page: pagination.value.itemsPerPage,
@@ -36825,10 +36836,12 @@ export {
36825
36836
  _sfc_main$4 as UiParentCard,
36826
36837
  _sfc_main$3 as VPriceTextField,
36827
36838
  configureAuth,
36839
+ configureAxiosInstance,
36828
36840
  index as default,
36829
36841
  fetchWrapper,
36830
36842
  formatNumberWithCommas,
36831
36843
  formatPrice,
36844
+ getAxiosInstance,
36832
36845
  install,
36833
36846
  nationalCodeRule,
36834
36847
  useCustomizerStore,