@xy-planning-network/trees 0.6.1 → 0.6.2-rc-1

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/trees.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref, cloneVNode, h, inject, watchEffect, provide, defineComponent, onUnmounted, Teleport, reactive, onUpdated, computed, unref, onMounted, nextTick, toRaw, watch, openBlock, createBlock, createVNode, withCtx, Transition, createElementVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, renderSlot, resolveDynamicComponent, mergeProps, createTextVNode, normalizeProps, useAttrs, shallowRef, withModifiers, TransitionGroup, withDirectives, vShow, normalizeStyle, getCurrentInstance, vModelText, resolveComponent, Comment as Comment$1, Text, useSlots } from "vue";
1
+ import { ref, cloneVNode, h, inject, provide, watchEffect, defineComponent, onUnmounted, Teleport, reactive, onUpdated, computed, unref, onMounted, nextTick, toRaw, watch, openBlock, createBlock, createVNode, withCtx, Transition, createElementVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, renderSlot, resolveDynamicComponent, mergeProps, createTextVNode, normalizeProps, useAttrs, shallowRef, withModifiers, TransitionGroup, withDirectives, vShow, normalizeStyle, getCurrentInstance, vModelText, resolveComponent, Comment as Comment$1, Text, useSlots } from "vue";
2
2
  function useSpinnerDisplay() {
3
3
  const idx = ref(0);
4
4
  const loading = ref(false);
@@ -1304,28 +1304,20 @@ axios$1.isAxiosError = isAxiosError;
1304
1304
  axios$2.exports = axios$1;
1305
1305
  axios$2.exports.default = axios$1;
1306
1306
  var axios = axios$2.exports;
1307
- const apiDelayReqIntercept = (config) => {
1308
- const delay = config.withDelay || 0;
1307
+ const apiDelayResponseIntercept = (result) => {
1308
+ const delay = result.config.withDelay || 0;
1309
1309
  return new Promise((resolve) => {
1310
1310
  setTimeout(() => {
1311
- resolve(config);
1311
+ resolve(result);
1312
1312
  }, Math.max(delay, 0));
1313
1313
  });
1314
1314
  };
1315
- const apiDataRespIntercept = (response) => {
1316
- var _a;
1317
- if (response.config.dataIntercept && ((_a = response.data) == null ? void 0 : _a.data)) {
1318
- response.data = response.data.data;
1319
- }
1320
- return response;
1321
- };
1322
1315
  const apiAxiosInstance = axios.create({
1323
1316
  baseURL: process.env.VUE_APP_BASE_API_URL || "/api/v1",
1324
1317
  responseType: "json",
1325
1318
  withCredentials: true
1326
1319
  });
1327
- apiAxiosInstance.interceptors.request.use(apiDelayReqIntercept);
1328
- apiAxiosInstance.interceptors.response.use(apiDataRespIntercept);
1320
+ apiAxiosInstance.interceptors.response.use(apiDelayResponseIntercept);
1329
1321
  const BaseAPI = {
1330
1322
  makeRequest(config, opts) {
1331
1323
  const wait = window.setTimeout(() => {
@@ -1333,7 +1325,13 @@ const BaseAPI = {
1333
1325
  useAppSpinner.show();
1334
1326
  }
1335
1327
  }, 200);
1336
- return apiAxiosInstance({ ...config, ...opts }).then((success) => success.data).finally(() => {
1328
+ return apiAxiosInstance({ ...config, ...opts }).then((success) => {
1329
+ var _a;
1330
+ return {
1331
+ data: ((_a = success.data) == null ? void 0 : _a.data) || {},
1332
+ status: success.status
1333
+ };
1334
+ }).finally(() => {
1337
1335
  if (!opts.skipLoader)
1338
1336
  useAppSpinner.hide();
1339
1337
  window.clearTimeout(wait);
@@ -4998,7 +4996,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
4998
4996
  createVNode(unref(Dialog), {
4999
4997
  as: "div",
5000
4998
  static: "",
5001
- class: "fixed z-30 inset-0 overflow-y-auto",
4999
+ class: "fixed z-10 inset-0 overflow-y-auto",
5002
5000
  onClose: _cache[1] || (_cache[1] = ($event) => updateModelValue3(false)),
5003
5001
  open: __props.modelValue
5004
5002
  }, {
@@ -7436,6 +7434,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
7436
7434
  });
7437
7435
  function useBaseAPI(path, method = "GET", initOpts = {}) {
7438
7436
  const result = ref();
7437
+ const status = ref();
7439
7438
  const error = shallowRef();
7440
7439
  const hasFetched = ref(false);
7441
7440
  const isFinished = ref(false);
@@ -7464,16 +7463,22 @@ function useBaseAPI(path, method = "GET", initOpts = {}) {
7464
7463
  };
7465
7464
  return BaseAPI.makeRequest(requestConfig, { ...initOpts, ...opts }).then(
7466
7465
  (success) => {
7467
- result.value = success;
7466
+ result.value = success.data;
7467
+ status.value = success.status;
7468
7468
  error.value = void 0;
7469
7469
  isAborted.value = false;
7470
7470
  return success;
7471
7471
  },
7472
7472
  (err) => {
7473
+ var _a;
7473
7474
  error.value = err;
7475
+ status.value = 0;
7474
7476
  if (axios.isCancel(err)) {
7475
7477
  isAborted.value = true;
7476
7478
  }
7479
+ if (axios.isAxiosError(err)) {
7480
+ status.value = ((_a = err.response) == null ? void 0 : _a.status) || 0;
7481
+ }
7477
7482
  throw err;
7478
7483
  }
7479
7484
  ).finally(() => {
@@ -7489,6 +7494,7 @@ function useBaseAPI(path, method = "GET", initOpts = {}) {
7489
7494
  }
7490
7495
  return {
7491
7496
  result,
7497
+ status,
7492
7498
  error,
7493
7499
  isFinished,
7494
7500
  isLoading,
@@ -7849,7 +7855,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
7849
7855
  }
7850
7856
  });
7851
7857
  var Flash_vue_vue_type_style_index_0_lang = "";
7852
- const _hoisted_1$j = { class: "fixed inset-0 flex flex-col items-end justify-end px-4 py-6 pointer-events-none sm:p-6 z-[45]" };
7858
+ const _hoisted_1$j = { class: "fixed inset-0 flex flex-col items-end justify-end px-4 py-6 pointer-events-none sm:p-6 z-40" };
7853
7859
  const _hoisted_2$g = { class: "rounded-lg ring-1 ring-black ring-opacity-5 overflow-hidden" };
7854
7860
  const _hoisted_3$f = { class: "p-4" };
7855
7861
  const _hoisted_4$d = { class: "flex items-center" };
@@ -7890,52 +7896,47 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
7890
7896
  loadWindowFlashes(flasher);
7891
7897
  });
7892
7898
  return (_ctx, _cache) => {
7893
- return openBlock(), createBlock(unref(Portal), null, {
7894
- default: withCtx(() => [
7895
- createElementVNode("div", _hoisted_1$j, [
7896
- createVNode(TransitionGroup, {
7897
- tag: "div",
7898
- class: "max-w-sm space-y-2 w-full",
7899
- "enter-active-class": "ease-out duration-300",
7900
- "enter-from-class": "translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2",
7901
- "enter-to-class": "translate-y-0 opacity-100 sm:translate-x-0",
7902
- "leave-active-class": "ease-in duration-100",
7903
- "leave-from-class": "opacity-100",
7904
- "leave-to-class": "opacity-0"
7905
- }, {
7906
- default: withCtx(() => [
7907
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(flashes), ([id2, flash]) => {
7908
- return openBlock(), createElementBlock("div", {
7909
- key: flash.message,
7910
- class: normalizeClass(["bg-white shadow-lg rounded-lg pointer-events-auto border-t-4 transform z-10", [getFlashClass(flash.type)]])
7911
- }, [
7912
- createElementVNode("div", _hoisted_2$g, [
7913
- createElementVNode("div", _hoisted_3$f, [
7914
- createElementVNode("div", _hoisted_4$d, [
7915
- createElementVNode("div", _hoisted_5$c, [
7916
- createElementVNode("p", {
7917
- class: "w-0 flex-1 text-sm leading-5 font-medium text-gray-900",
7918
- innerHTML: flash.message
7919
- }, null, 8, _hoisted_6$a)
7920
- ]),
7921
- createElementVNode("div", _hoisted_7$9, [
7922
- createElementVNode("button", {
7923
- onClick: ($event) => unref(flasher).remove(id2),
7924
- class: "inline-flex text-gray-400 focus:outline-none focus:text-gray-500 transition ease-in-out duration-150"
7925
- }, _hoisted_10$7, 8, _hoisted_8$7)
7926
- ])
7927
- ])
7899
+ return openBlock(), createElementBlock("div", _hoisted_1$j, [
7900
+ createVNode(TransitionGroup, {
7901
+ tag: "div",
7902
+ class: "max-w-sm space-y-2 w-full",
7903
+ "enter-active-class": "ease-out duration-300",
7904
+ "enter-from-class": "translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2",
7905
+ "enter-to-class": "translate-y-0 opacity-100 sm:translate-x-0",
7906
+ "leave-active-class": "ease-in duration-100",
7907
+ "leave-from-class": "opacity-100",
7908
+ "leave-to-class": "opacity-0"
7909
+ }, {
7910
+ default: withCtx(() => [
7911
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(flashes), ([id2, flash]) => {
7912
+ return openBlock(), createElementBlock("div", {
7913
+ key: flash.message,
7914
+ class: normalizeClass(["bg-white shadow-lg rounded-lg pointer-events-auto border-t-4 transform", [getFlashClass(flash.type)]])
7915
+ }, [
7916
+ createElementVNode("div", _hoisted_2$g, [
7917
+ createElementVNode("div", _hoisted_3$f, [
7918
+ createElementVNode("div", _hoisted_4$d, [
7919
+ createElementVNode("div", _hoisted_5$c, [
7920
+ createElementVNode("p", {
7921
+ class: "w-0 flex-1 text-sm leading-5 font-medium text-gray-900",
7922
+ innerHTML: flash.message
7923
+ }, null, 8, _hoisted_6$a)
7924
+ ]),
7925
+ createElementVNode("div", _hoisted_7$9, [
7926
+ createElementVNode("button", {
7927
+ onClick: ($event) => unref(flasher).remove(id2),
7928
+ class: "inline-flex text-gray-400 focus:outline-none focus:text-gray-500 transition ease-in-out duration-150"
7929
+ }, _hoisted_10$7, 8, _hoisted_8$7)
7928
7930
  ])
7929
7931
  ])
7930
- ], 2);
7931
- }), 128))
7932
- ]),
7933
- _: 1
7934
- })
7935
- ])
7936
- ]),
7937
- _: 1
7938
- });
7932
+ ])
7933
+ ])
7934
+ ], 2);
7935
+ }), 128))
7936
+ ]),
7937
+ _: 1
7938
+ })
7939
+ ]);
7939
7940
  };
7940
7941
  }
7941
7942
  });
@@ -8060,7 +8061,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8060
8061
  createVNode(unref(Dialog), {
8061
8062
  as: "div",
8062
8063
  static: "",
8063
- class: "fixed z-30 inset-0 overflow-y-auto",
8064
+ class: "fixed z-10 inset-0 overflow-y-auto",
8064
8065
  onClose: _cache[3] || (_cache[3] = ($event) => updateModelValue3(false)),
8065
8066
  open: __props.modelValue
8066
8067
  }, {
@@ -8150,7 +8151,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8150
8151
  const _hoisted_1$h = { class: "aspect-square overflow-hidden" };
8151
8152
  const _hoisted_2$e = { class: "flex justify-center relative" };
8152
8153
  const _hoisted_3$d = { class: "sr-only" };
8153
- const _hoisted_4$b = /* @__PURE__ */ createElementVNode("div", { class: "animate-spin-gear drop-shadow-md" }, [
8154
+ const _hoisted_4$b = /* @__PURE__ */ createElementVNode("div", { class: "animate-spin-gear" }, [
8154
8155
  /* @__PURE__ */ createElementVNode("svg", {
8155
8156
  width: "100%",
8156
8157
  height: "100%",
@@ -8246,7 +8247,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
8246
8247
  });
8247
8248
  const _hoisted_1$g = {
8248
8249
  key: 0,
8249
- class: "fixed top-0 left-0 flex flex-col items-center justify-center w-full h-full cursor-not-allowed z-40 bg-gray-50 bg-opacity-50"
8250
+ class: "fixed top-0 left-0 flex flex-col items-center justify-center w-full h-full cursor-not-allowed z-50 bg-gray-50 bg-opacity-50"
8250
8251
  };
8251
8252
  const _hoisted_2$d = { class: "mt-2" };
8252
8253
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
@@ -8268,36 +8269,31 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8268
8269
  }, 2500);
8269
8270
  };
8270
8271
  return (_ctx, _cache) => {
8271
- return openBlock(), createBlock(unref(Portal), null, {
8272
- default: withCtx(() => [
8273
- unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
8274
- createVNode(_sfc_main$j, { class: "w-32 h-32" }),
8275
- withDirectives(createElementVNode("div", _hoisted_2$d, [
8276
- createVNode(Transition, {
8277
- appear: "",
8278
- "enter-active-class": "ease-out duration-1000",
8279
- "enter-from-class": "opacity-0",
8280
- "enter-to-class": "opacity-100",
8281
- "leave-active-class": "ease-in duration-500",
8282
- "leave-from-class": "opacity-100",
8283
- "leave-to-class": "opacity-0",
8284
- onAfterEnter: fadeOut,
8285
- onAfterLeave: fadeIn
8286
- }, {
8287
- default: withCtx(() => [
8288
- withDirectives(createElementVNode("div", { class: "container font-medium text-lg leading-snug text-center transition-opacity" }, toDisplayString(unref(msg)), 513), [
8289
- [vShow, unref(showMsg)]
8290
- ])
8291
- ]),
8292
- _: 1
8293
- })
8294
- ], 512), [
8295
- [vShow, unref(messages)]
8296
- ])
8297
- ])) : createCommentVNode("", true)
8298
- ]),
8299
- _: 1
8300
- });
8272
+ return unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
8273
+ createVNode(_sfc_main$j, { class: "w-32 h-32" }),
8274
+ withDirectives(createElementVNode("div", _hoisted_2$d, [
8275
+ createVNode(Transition, {
8276
+ appear: "",
8277
+ "enter-active-class": "ease-out duration-1000",
8278
+ "enter-from-class": "opacity-0",
8279
+ "enter-to-class": "opacity-100",
8280
+ "leave-active-class": "ease-in duration-500",
8281
+ "leave-from-class": "opacity-100",
8282
+ "leave-to-class": "opacity-0",
8283
+ onAfterEnter: fadeOut,
8284
+ onAfterLeave: fadeIn
8285
+ }, {
8286
+ default: withCtx(() => [
8287
+ withDirectives(createElementVNode("div", { class: "container font-medium text-lg leading-snug text-center transition-opacity" }, toDisplayString(unref(msg)), 513), [
8288
+ [vShow, unref(showMsg)]
8289
+ ])
8290
+ ]),
8291
+ _: 1
8292
+ })
8293
+ ], 512), [
8294
+ [vShow, unref(messages)]
8295
+ ])
8296
+ ])) : createCommentVNode("", true);
8301
8297
  };
8302
8298
  }
8303
8299
  });
@@ -8357,7 +8353,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
8357
8353
  createVNode(unref(Dialog), {
8358
8354
  as: "div",
8359
8355
  static: "",
8360
- class: "fixed inset-0 flex z-10 md:hidden",
8356
+ class: "fixed inset-0 flex z-40 md:hidden",
8361
8357
  onClose: _cache[1] || (_cache[1] = ($event) => sidebarOpen.value = false),
8362
8358
  open: sidebarOpen.value
8363
8359
  }, {
@@ -8828,7 +8824,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
8828
8824
  createVNode(unref(Dialog), {
8829
8825
  as: "div",
8830
8826
  static: "",
8831
- class: "fixed inset-0 z-20 overflow-hidden bg-black bg-opacity-50",
8827
+ class: "fixed inset-0 z-40 overflow-hidden bg-black bg-opacity-50",
8832
8828
  onClose: _cache[1] || (_cache[1] = ($event) => close2()),
8833
8829
  open: __props.modelValue
8834
8830
  }, {