@pequity/squirrel 5.0.1 → 5.1.0

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/cjs/index.js CHANGED
@@ -776,7 +776,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
776
776
  }) }
777
777
  },
778
778
  emits: ["scroll", "click-filter-icon", "col-resize"],
779
- setup(__props, { emit: __emit }) {
779
+ setup(__props, { expose: __expose, emit: __emit }) {
780
780
  const emit = __emit;
781
781
  const props = __props;
782
782
  vue.provide(
@@ -809,6 +809,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
809
809
  enabled: vue.computed(() => props.colsResizable),
810
810
  ths
811
811
  });
812
+ const tbodyElement = vue.ref(null);
812
813
  const updateThsRefs = (el, index) => {
813
814
  if (el instanceof Element) {
814
815
  ths.value[index] = el;
@@ -870,6 +871,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
870
871
  emit("col-resize", colResizingIndex.value, colResizingWidth.value);
871
872
  }
872
873
  });
874
+ __expose({
875
+ tbodyElement
876
+ });
873
877
  return (_ctx, _cache) => {
874
878
  var _a, _b;
875
879
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -943,7 +947,10 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
943
947
  _ctx.colsResizable && !_ctx.isLastColFixed ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_4$1)) : vue.createCommentVNode("", true)
944
948
  ])
945
949
  ]),
946
- vue.createElementVNode("tbody", null, [
950
+ vue.createElementVNode("tbody", {
951
+ ref_key: "tbodyElement",
952
+ ref: tbodyElement
953
+ }, [
947
954
  _ctx.virtualizer.paddingTop > 0 ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_5$1, [
948
955
  vue.createElementVNode("td", {
949
956
  style: vue.normalizeStyle({ height: `${_ctx.virtualizer.paddingTop}px` })
@@ -955,13 +962,13 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
955
962
  style: vue.normalizeStyle({ height: `${_ctx.virtualizer.paddingBottom}px` })
956
963
  }, null, 4)
957
964
  ])) : vue.createCommentVNode("", true)
958
- ])
965
+ ], 512)
959
966
  ], 16)
960
967
  ], 2);
961
968
  };
962
969
  }
963
970
  });
964
- const pTable = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["__scopeId", "data-v-f12e8db6"]]);
971
+ const pTable = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["__scopeId", "data-v-1d76cd98"]]);
965
972
  const _sfc_main = vue.defineComponent({
966
973
  name: "PTableSort",
967
974
  props: {
@@ -19,7 +19,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
19
  },
20
20
  __name: "p-loading",
21
21
  setup(__props) {
22
- const { show, content, props: componentProps } = usePLoading.usePLoading();
22
+ const { show, content, props: componentProps, loadingHide } = usePLoading.usePLoading();
23
23
  const dimsReference = vue.ref(null);
24
24
  const width = vue.ref(0);
25
25
  const height = vue.ref(0);
@@ -37,6 +37,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
37
37
  const isComponent2 = typeof content2 === "object" && content2 !== null;
38
38
  return isComponent2;
39
39
  };
40
+ vue.onBeforeUnmount(() => {
41
+ loadingHide();
42
+ });
40
43
  return (_ctx, _cache) => {
41
44
  return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
42
45
  vue.createVNode(vue.Transition, {
@@ -82,5 +85,5 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
82
85
  };
83
86
  }
84
87
  });
85
- const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-7af44c7f"]]);
88
+ const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-f0f6bdd4"]]);
86
89
  module.exports = pLoading;
@@ -12,11 +12,17 @@ const props = vue.computed(() => {
12
12
  var _a;
13
13
  return (_a = loadingItems.value[loadingItems.value.length - 1]) == null ? void 0 : _a.props;
14
14
  });
15
- let timer;
16
15
  const usePLoading = (options) => {
17
16
  const { delay } = { delay: 200, ...options };
18
17
  const scope = vue.getCurrentScope();
18
+ const clearLoadingItems = () => {
19
+ loadingItems.value.forEach((item) => {
20
+ clearTimeout(item.timer);
21
+ });
22
+ loadingItems.value = [];
23
+ };
19
24
  const loadingShow = (loadingItem) => {
25
+ let timer = 0;
20
26
  if (!loadingItem.id) {
21
27
  throw new Error("id is required");
22
28
  }
@@ -30,28 +36,39 @@ const usePLoading = (options) => {
30
36
  loadingItems.value.push({
31
37
  id: loadingItem.id,
32
38
  content: loadingItem.content && typeof loadingItem.content === "object" ? vue.markRaw(loadingItem.content) : loadingItem.content || LOADING_TEXT,
33
- props: loadingItem.props
39
+ props: loadingItem.props,
40
+ timer,
41
+ clearOnDispose: loadingItem.clearOnDispose ?? true
34
42
  });
35
43
  };
36
44
  const loadingHide = (id) => {
37
45
  if (id && typeof id === "string") {
38
46
  const index = loadingItems.value.findIndex((item) => item.id === id);
47
+ const loadingItem = loadingItems.value[index];
39
48
  if (index !== -1) {
49
+ clearTimeout(loadingItem.timer);
40
50
  loadingItems.value.splice(index, 1);
41
51
  }
42
52
  } else {
43
- loadingItems.value = [];
53
+ clearLoadingItems();
44
54
  }
45
55
  if (loadingItems.value.length === 0) {
46
56
  show.value = false;
47
57
  }
48
- clearTimeout(timer);
49
58
  };
50
59
  if (scope) {
51
60
  vue.onScopeDispose(() => {
52
- loadingItems.value = [];
53
- show.value = false;
54
- clearTimeout(timer);
61
+ if (loadingItems.value.some((item) => item.clearOnDispose === false)) {
62
+ loadingItems.value.forEach((item) => {
63
+ if (item.clearOnDispose) {
64
+ clearTimeout(item.timer);
65
+ }
66
+ });
67
+ loadingItems.value = loadingItems.value.filter((item) => item.clearOnDispose === false);
68
+ } else {
69
+ clearLoadingItems();
70
+ show.value = false;
71
+ }
55
72
  });
56
73
  }
57
74
  return { show, content, props, loadingShow, loadingHide };
package/dist/es/index.js CHANGED
@@ -776,7 +776,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
776
776
  }) }
777
777
  },
778
778
  emits: ["scroll", "click-filter-icon", "col-resize"],
779
- setup(__props, { emit: __emit }) {
779
+ setup(__props, { expose: __expose, emit: __emit }) {
780
780
  const emit = __emit;
781
781
  const props = __props;
782
782
  provide(
@@ -809,6 +809,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
809
809
  enabled: computed(() => props.colsResizable),
810
810
  ths
811
811
  });
812
+ const tbodyElement = ref(null);
812
813
  const updateThsRefs = (el, index) => {
813
814
  if (el instanceof Element) {
814
815
  ths.value[index] = el;
@@ -870,6 +871,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
870
871
  emit("col-resize", colResizingIndex.value, colResizingWidth.value);
871
872
  }
872
873
  });
874
+ __expose({
875
+ tbodyElement
876
+ });
873
877
  return (_ctx, _cache) => {
874
878
  var _a, _b;
875
879
  return openBlock(), createElementBlock("div", {
@@ -943,7 +947,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
943
947
  _ctx.colsResizable && !_ctx.isLastColFixed ? (openBlock(), createElementBlock("th", _hoisted_4$1)) : createCommentVNode("", true)
944
948
  ])
945
949
  ]),
946
- createElementVNode("tbody", null, [
950
+ createElementVNode("tbody", {
951
+ ref_key: "tbodyElement",
952
+ ref: tbodyElement
953
+ }, [
947
954
  _ctx.virtualizer.paddingTop > 0 ? (openBlock(), createElementBlock("tr", _hoisted_5$1, [
948
955
  createElementVNode("td", {
949
956
  style: normalizeStyle({ height: `${_ctx.virtualizer.paddingTop}px` })
@@ -955,13 +962,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
955
962
  style: normalizeStyle({ height: `${_ctx.virtualizer.paddingBottom}px` })
956
963
  }, null, 4)
957
964
  ])) : createCommentVNode("", true)
958
- ])
965
+ ], 512)
959
966
  ], 16)
960
967
  ], 2);
961
968
  };
962
969
  }
963
970
  });
964
- const pTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-f12e8db6"]]);
971
+ const pTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1d76cd98"]]);
965
972
  const _sfc_main = defineComponent({
966
973
  name: "PTableSort",
967
974
  props: {
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, watch, toValue, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, unref, createElementBlock, createElementVNode, normalizeStyle, resolveDynamicComponent, normalizeProps, mergeProps, normalizeClass, toDisplayString, createCommentVNode } from "vue";
1
+ import { defineComponent, ref, watch, toValue, onBeforeUnmount, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, unref, createElementBlock, createElementVNode, normalizeStyle, resolveDynamicComponent, normalizeProps, mergeProps, normalizeClass, toDisplayString, createCommentVNode } from "vue";
2
2
  import { usePLoading } from "./usePLoading.js";
3
3
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
4
4
  const _hoisted_1 = {
@@ -18,7 +18,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
18
  },
19
19
  __name: "p-loading",
20
20
  setup(__props) {
21
- const { show, content, props: componentProps } = usePLoading();
21
+ const { show, content, props: componentProps, loadingHide } = usePLoading();
22
22
  const dimsReference = ref(null);
23
23
  const width = ref(0);
24
24
  const height = ref(0);
@@ -36,6 +36,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  const isComponent2 = typeof content2 === "object" && content2 !== null;
37
37
  return isComponent2;
38
38
  };
39
+ onBeforeUnmount(() => {
40
+ loadingHide();
41
+ });
39
42
  return (_ctx, _cache) => {
40
43
  return openBlock(), createBlock(Teleport, { to: "body" }, [
41
44
  createVNode(Transition, {
@@ -81,7 +84,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
84
  };
82
85
  }
83
86
  });
84
- const pLoading = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7af44c7f"]]);
87
+ const pLoading = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f0f6bdd4"]]);
85
88
  export {
86
89
  pLoading as default
87
90
  };
@@ -10,11 +10,17 @@ const props = computed(() => {
10
10
  var _a;
11
11
  return (_a = loadingItems.value[loadingItems.value.length - 1]) == null ? void 0 : _a.props;
12
12
  });
13
- let timer;
14
13
  const usePLoading = (options) => {
15
14
  const { delay } = { delay: 200, ...options };
16
15
  const scope = getCurrentScope();
16
+ const clearLoadingItems = () => {
17
+ loadingItems.value.forEach((item) => {
18
+ clearTimeout(item.timer);
19
+ });
20
+ loadingItems.value = [];
21
+ };
17
22
  const loadingShow = (loadingItem) => {
23
+ let timer = 0;
18
24
  if (!loadingItem.id) {
19
25
  throw new Error("id is required");
20
26
  }
@@ -28,28 +34,39 @@ const usePLoading = (options) => {
28
34
  loadingItems.value.push({
29
35
  id: loadingItem.id,
30
36
  content: loadingItem.content && typeof loadingItem.content === "object" ? markRaw(loadingItem.content) : loadingItem.content || LOADING_TEXT,
31
- props: loadingItem.props
37
+ props: loadingItem.props,
38
+ timer,
39
+ clearOnDispose: loadingItem.clearOnDispose ?? true
32
40
  });
33
41
  };
34
42
  const loadingHide = (id) => {
35
43
  if (id && typeof id === "string") {
36
44
  const index = loadingItems.value.findIndex((item) => item.id === id);
45
+ const loadingItem = loadingItems.value[index];
37
46
  if (index !== -1) {
47
+ clearTimeout(loadingItem.timer);
38
48
  loadingItems.value.splice(index, 1);
39
49
  }
40
50
  } else {
41
- loadingItems.value = [];
51
+ clearLoadingItems();
42
52
  }
43
53
  if (loadingItems.value.length === 0) {
44
54
  show.value = false;
45
55
  }
46
- clearTimeout(timer);
47
56
  };
48
57
  if (scope) {
49
58
  onScopeDispose(() => {
50
- loadingItems.value = [];
51
- show.value = false;
52
- clearTimeout(timer);
59
+ if (loadingItems.value.some((item) => item.clearOnDispose === false)) {
60
+ loadingItems.value.forEach((item) => {
61
+ if (item.clearOnDispose) {
62
+ clearTimeout(item.timer);
63
+ }
64
+ });
65
+ loadingItems.value = loadingItems.value.filter((item) => item.clearOnDispose === false);
66
+ } else {
67
+ clearLoadingItems();
68
+ show.value = false;
69
+ }
53
70
  });
54
71
  }
55
72
  return { show, content, props, loadingShow, loadingHide };
@@ -1,17 +1,14 @@
1
- declare var __VLS_0: {
2
- titleClass: "text-xl font-medium leading-none text-p-purple-60";
3
- };
4
- declare var __VLS_1: {};
5
- declare var __VLS_inheritedAttrs: {};
6
- declare const __VLS_templateResult: {
1
+ declare function __VLS_template(): {
7
2
  slots: {
8
- title?(_: typeof __VLS_0): any;
9
- default?(_: typeof __VLS_1): any;
3
+ title?(_: {
4
+ titleClass: "text-xl font-medium leading-none text-p-purple-60";
5
+ }): any;
6
+ default?(_: {}): any;
10
7
  };
11
8
  refs: {};
12
- attrs: Partial<typeof __VLS_inheritedAttrs>;
9
+ attrs: Partial<{}>;
13
10
  };
14
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
11
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
12
  declare const __VLS_component: import("vue").DefineComponent<{
16
13
  title: {
17
14
  type: StringConstructor;
@@ -25,7 +22,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
25
22
  }>>, {
26
23
  title: string;
27
24
  }, {}>;
28
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
25
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
26
  export default _default;
30
27
  type __VLS_WithTemplateSlots<T, S> = T & {
31
28
  new (): {
@@ -1,15 +1,12 @@
1
- declare var __VLS_0: {};
2
- declare var __VLS_1: {};
3
- declare var __VLS_inheritedAttrs: {};
4
- declare const __VLS_templateResult: {
1
+ declare function __VLS_template(): {
5
2
  slots: {
6
- "label-before"?(_: typeof __VLS_0): any;
7
- label?(_: typeof __VLS_1): any;
3
+ "label-before"?(_: {}): any;
4
+ label?(_: {}): any;
8
5
  };
9
6
  refs: {};
10
- attrs: Partial<typeof __VLS_inheritedAttrs>;
7
+ attrs: Partial<{}>;
11
8
  };
12
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
10
  declare const __VLS_component: import("vue").DefineComponent<{
14
11
  modelValue: {
15
12
  type: BooleanConstructor;
@@ -36,7 +33,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
36
33
  label: string;
37
34
  modelValue: boolean;
38
35
  }, {}>;
39
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
36
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
40
37
  export default _default;
41
38
  type __VLS_WithTemplateSlots<T, S> = T & {
42
39
  new (): {
@@ -2,8 +2,7 @@ import { type PropType } from 'vue';
2
2
  import { type ModelValue, type Size } from '../p-select-list/p-select-list.types';
3
3
  type AnyValue = string | number | boolean | null | undefined | Record<string, unknown>;
4
4
  type AnyObject = Record<string, AnyValue>;
5
- declare var __VLS_inheritedAttrs: {};
6
- declare const __VLS_templateResult: {
5
+ declare function __VLS_template(): {
7
6
  slots: Readonly<{
8
7
  'selected-item'(props: {
9
8
  item: any;
@@ -26,9 +25,9 @@ declare const __VLS_templateResult: {
26
25
  }): unknown;
27
26
  };
28
27
  refs: {
29
- formControl: import("vue").HTMLAttributes & import("vue").ReservedProps;
30
- button: import("vue").ButtonHTMLAttributes & import("vue").ReservedProps;
31
- actionsContainer: import("vue").HTMLAttributes & import("vue").ReservedProps;
28
+ formControl: HTMLDivElement;
29
+ button: HTMLButtonElement;
30
+ actionsContainer: HTMLDivElement;
32
31
  inputSearch: import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
33
32
  modelValue: {
34
33
  type: StringConstructor;
@@ -116,11 +115,11 @@ declare const __VLS_templateResult: {
116
115
  modelValue: string;
117
116
  showEnterIcon: boolean;
118
117
  }> | null;
119
- virtualizerRef: import("vue").HTMLAttributes & import("vue").ReservedProps;
118
+ virtualizerRef: HTMLDivElement;
120
119
  };
121
- attrs: Partial<typeof __VLS_inheritedAttrs>;
120
+ attrs: Partial<{}>;
122
121
  };
123
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
122
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
124
123
  declare const __VLS_component: import("vue").DefineComponent<{
125
124
  modelValue: {
126
125
  type: PropType<ModelValue>;
@@ -381,7 +380,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
381
380
  placeholderSearch: string;
382
381
  selectedTopShown: boolean;
383
382
  }, {}>;
384
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
383
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
385
384
  export default _default;
386
385
  type __VLS_WithTemplateSlots<T, S> = T & {
387
386
  new (): {
@@ -1,12 +1,11 @@
1
- declare var __VLS_inheritedAttrs: {};
2
- declare const __VLS_templateResult: {
1
+ declare function __VLS_template(): {
3
2
  slots: {
4
3
  default?(_: {}): any;
5
4
  };
6
5
  refs: {};
7
- attrs: Partial<typeof __VLS_inheritedAttrs>;
6
+ attrs: Partial<{}>;
8
7
  };
9
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
8
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
9
  declare const __VLS_component: import("vue").DefineComponent<{
11
10
  text: {
12
11
  type: StringConstructor;
@@ -20,7 +19,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
20
19
  }>>, {
21
20
  text: string;
22
21
  }, {}>;
23
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
22
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
24
23
  export default _default;
25
24
  type __VLS_WithTemplateSlots<T, S> = T & {
26
25
  new (): {
@@ -1,16 +1,15 @@
1
1
  import { type RouterLinkProps } from 'vue-router';
2
- declare var __VLS_inheritedAttrs: {};
3
- declare const __VLS_templateResult: {
2
+ declare function __VLS_template(): {
4
3
  slots: {
5
4
  default?(_: {}): any;
6
5
  default?(_: {}): any;
7
6
  };
8
7
  refs: {};
9
- attrs: Partial<typeof __VLS_inheritedAttrs>;
8
+ attrs: Partial<{}>;
10
9
  };
11
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
10
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
12
11
  declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<RouterLinkProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<RouterLinkProps>>>, {}, {}>;
13
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
12
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
14
13
  export default _default;
15
14
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
16
15
  type __VLS_TypePropsToOption<T> = {
@@ -7,13 +7,16 @@ type LoadingItem = {
7
7
  id: string;
8
8
  content?: Content;
9
9
  props?: Ref;
10
+ timer: ReturnType<typeof setTimeout> | 0;
11
+ clearOnDispose?: boolean;
10
12
  };
13
+ type LoadingItemOption = Pick<LoadingItem, 'id' | 'content' | 'props' | 'clearOnDispose'>;
11
14
  type UsePLoading = {
12
15
  show: Ref<boolean>;
13
16
  content: Content;
14
17
  props: Ref;
15
- loadingShow: (loadingItem: LoadingItem) => void;
16
- loadingHide: (id: LoadingItem['id']) => void;
18
+ loadingShow: (loadingItem: LoadingItemOption) => void;
19
+ loadingHide: (id?: LoadingItemOption['id']) => void;
17
20
  };
18
21
  export declare const usePLoading: (options?: Options) => UsePLoading;
19
22
  export {};
@@ -1,6 +1,5 @@
1
1
  import { type PropType, type StyleValue } from 'vue';
2
- declare var __VLS_inheritedAttrs: {};
3
- declare const __VLS_templateResult: {
2
+ declare function __VLS_template(): {
4
3
  slots: {
5
4
  "title-wrapper"?(_: {}): any;
6
5
  "content-wrapper"?(_: {}): any;
@@ -9,12 +8,12 @@ declare const __VLS_templateResult: {
9
8
  footer?(_: {}): any;
10
9
  };
11
10
  refs: {
12
- pmWrapper: import("vue").HTMLAttributes & import("vue").ReservedProps;
13
- pm: import("vue").HTMLAttributes & import("vue").ReservedProps;
11
+ pmWrapper: HTMLDivElement;
12
+ pm: HTMLDivElement;
14
13
  };
15
- attrs: Partial<typeof __VLS_inheritedAttrs>;
14
+ attrs: Partial<{}>;
16
15
  };
17
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
16
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
18
17
  declare const __VLS_component: import("vue").DefineComponent<{
19
18
  name: {
20
19
  type: StringConstructor;
@@ -206,7 +205,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
206
205
  bgInClass: string;
207
206
  bgOutClass: string;
208
207
  }, {}>;
209
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
208
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
210
209
  export default _default;
211
210
  type __VLS_WithTemplateSlots<T, S> = T & {
212
211
  new (): {
@@ -1,12 +1,11 @@
1
- declare var __VLS_inheritedAttrs: {};
2
- declare const __VLS_templateResult: {
1
+ declare function __VLS_template(): {
3
2
  slots: {
4
3
  "no-results"?(_: {}): any;
5
4
  };
6
5
  refs: {};
7
- attrs: Partial<typeof __VLS_inheritedAttrs>;
6
+ attrs: Partial<{}>;
8
7
  };
9
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
8
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
9
  declare const __VLS_component: import("vue").DefineComponent<{
11
10
  /**
12
11
  * The current page.
@@ -71,7 +70,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
71
70
  pageSize: number;
72
71
  currentPage: number;
73
72
  }, {}>;
74
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
73
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
75
74
  export default _default;
76
75
  type __VLS_WithTemplateSlots<T, S> = T & {
77
76
  new (): {
@@ -1,18 +1,16 @@
1
1
  import { type InputSize } from '../../utils/inputClassesShared';
2
2
  import { type PropType } from 'vue';
3
- declare var __VLS_0: {
4
- label: string;
5
- labelClasses: string;
6
- };
7
- declare var __VLS_inheritedAttrs: {};
8
- declare const __VLS_templateResult: {
3
+ declare function __VLS_template(): {
9
4
  slots: {
10
- label?(_: typeof __VLS_0): any;
5
+ label?(_: {
6
+ label: string;
7
+ labelClasses: string;
8
+ }): any;
11
9
  };
12
10
  refs: {};
13
- attrs: Partial<typeof __VLS_inheritedAttrs>;
11
+ attrs: Partial<{}>;
14
12
  };
15
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
14
  declare const __VLS_component: import("vue").DefineComponent<{
17
15
  modelValue: {
18
16
  type: PropType<string | number | boolean | null>;
@@ -95,7 +93,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
95
93
  errorMsg: string;
96
94
  itemValue: string | number | boolean | null;
97
95
  }, {}>;
98
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
96
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
99
97
  export default _default;
100
98
  type __VLS_WithTemplateSlots<T, S> = T & {
101
99
  new (): {
@@ -13,16 +13,15 @@ type Props = {
13
13
  multiple?: boolean;
14
14
  noPadding?: boolean;
15
15
  };
16
- declare var __VLS_inheritedAttrs: {};
17
- declare const __VLS_templateResult: {
16
+ declare function __VLS_template(): {
18
17
  slots: Partial<Record<`btn-${number}`, (_: {
19
18
  item: BtnGroupItem;
20
19
  isSelected: boolean | undefined;
21
20
  }) => any>>;
22
21
  refs: {};
23
- attrs: Partial<typeof __VLS_inheritedAttrs>;
22
+ attrs: Partial<{}>;
24
23
  };
25
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
24
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
26
25
  declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
27
26
  modelValue: null;
28
27
  items: () => never[];
@@ -64,7 +63,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
64
63
  highlightSelected: boolean;
65
64
  noPadding: boolean;
66
65
  }, {}>;
67
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
66
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
68
67
  export default _default;
69
68
  type __VLS_WithDefaults<P, D> = {
70
69
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
@@ -1,7 +1,6 @@
1
1
  import { type AnyObject, type AnyValue, type ModelValue, type Size } from './p-select-list.types';
2
2
  import { type PropType } from 'vue';
3
- declare var __VLS_inheritedAttrs: {};
4
- declare const __VLS_templateResult: {
3
+ declare function __VLS_template(): {
5
4
  slots: Readonly<{
6
5
  'selected-item'(props: {
7
6
  item: any;
@@ -24,8 +23,8 @@ declare const __VLS_templateResult: {
24
23
  }): unknown;
25
24
  };
26
25
  refs: {
27
- formControl: import("vue").HTMLAttributes & import("vue").ReservedProps;
28
- actionsContainer: import("vue").HTMLAttributes & import("vue").ReservedProps;
26
+ formControl: HTMLDivElement;
27
+ actionsContainer: HTMLDivElement;
29
28
  inputSearch: import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
30
29
  modelValue: {
31
30
  type: StringConstructor;
@@ -113,11 +112,11 @@ declare const __VLS_templateResult: {
113
112
  modelValue: string;
114
113
  showEnterIcon: boolean;
115
114
  }> | null;
116
- virtualizerRef: import("vue").HTMLAttributes & import("vue").ReservedProps;
115
+ virtualizerRef: HTMLDivElement;
117
116
  };
118
- attrs: Partial<typeof __VLS_inheritedAttrs>;
117
+ attrs: Partial<{}>;
119
118
  };
120
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
119
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
121
120
  declare const __VLS_component: import("vue").DefineComponent<{
122
121
  modelValue: {
123
122
  type: PropType<ModelValue>;
@@ -360,7 +359,7 @@ declare const __VLS_component: import("vue").DefineComponent<{
360
359
  topSectionClass: string;
361
360
  closePopperOnSelect: boolean;
362
361
  }, {}>;
363
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
362
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
364
363
  export default _default;
365
364
  type __VLS_WithTemplateSlots<T, S> = T & {
366
365
  new (): {
@@ -11,20 +11,19 @@ type Props = {
11
11
  paddingBottom: number;
12
12
  };
13
13
  };
14
- declare var __VLS_11: {};
15
- declare var __VLS_inheritedAttrs: {};
16
- declare const __VLS_templateResult: {
14
+ declare function __VLS_template(): {
17
15
  slots: Partial<Record<`prepend-header-cell-${string}`, (_: {
18
16
  col: TableCol;
19
17
  }) => any>> & Partial<Record<`subheader-cell-${string}`, (_: {}) => any>> & {
20
- default?(_: typeof __VLS_11): any;
18
+ default?(_: {}): any;
21
19
  };
22
20
  refs: {
23
- scrollWrapper: import("vue").HTMLAttributes & import("vue").ReservedProps;
21
+ scrollWrapper: HTMLDivElement;
22
+ tbodyElement: HTMLTableSectionElement;
24
23
  };
25
- attrs: Partial<typeof __VLS_inheritedAttrs>;
24
+ attrs: Partial<{}>;
26
25
  };
27
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
26
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
28
27
  declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
29
28
  colsResizable: boolean;
30
29
  isFirstColFixed: boolean;
@@ -35,7 +34,9 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
35
34
  paddingTop: number;
36
35
  paddingBottom: number;
37
36
  };
38
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
+ }>, {
38
+ tbodyElement: import("vue").Ref<HTMLElement | null>;
39
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
40
  scroll: (val: Event) => void;
40
41
  "click-filter-icon": (val: Event, col: any) => void;
41
42
  "col-resize": (colIndex: number, width: number) => void;
@@ -64,7 +65,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
64
65
  paddingBottom: number;
65
66
  };
66
67
  }, {}>;
67
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
68
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
68
69
  export default _default;
69
70
  type __VLS_WithDefaults<P, D> = {
70
71
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
@@ -3,16 +3,14 @@ type Props = {
3
3
  isEditable?: boolean;
4
4
  isSelected?: boolean;
5
5
  };
6
- declare var __VLS_0: {};
7
- declare var __VLS_inheritedAttrs: {};
8
- declare const __VLS_templateResult: {
6
+ declare function __VLS_template(): {
9
7
  slots: {
10
- default?(_: typeof __VLS_0): any;
8
+ default?(_: {}): any;
11
9
  };
12
10
  refs: {};
13
- attrs: Partial<typeof __VLS_inheritedAttrs>;
11
+ attrs: Partial<{}>;
14
12
  };
15
- type __VLS_Slots = typeof __VLS_templateResult['slots'];
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
14
  declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
17
15
  isEditable: boolean;
18
16
  isSelected: boolean;
@@ -23,7 +21,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
23
21
  isSelected: boolean;
24
22
  isEditable: boolean;
25
23
  }, {}>;
26
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_Slots>;
24
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
27
25
  export default _default;
28
26
  type __VLS_WithDefaults<P, D> = {
29
27
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
package/dist/style.css CHANGED
@@ -381,12 +381,12 @@ from {
381
381
  to {
382
382
  opacity: 0;
383
383
  }
384
- }.fadeInDown[data-v-7af44c7f] {
384
+ }.fadeInDown[data-v-f0f6bdd4] {
385
385
  animation-duration: 0.4s;
386
386
  animation-fill-mode: both;
387
- animation-name: fadeInDown-7af44c7f;
387
+ animation-name: fadeInDown-f0f6bdd4;
388
388
  }
389
- @keyframes fadeInDown-7af44c7f {
389
+ @keyframes fadeInDown-f0f6bdd4 {
390
390
  0% {
391
391
  opacity: 0;
392
392
  transform: translate3d(0, -100%, 0);
@@ -396,12 +396,12 @@ to {
396
396
  transform: none;
397
397
  }
398
398
  }
399
- .fadeOutUp[data-v-7af44c7f] {
399
+ .fadeOutUp[data-v-f0f6bdd4] {
400
400
  animation-duration: 0.25s;
401
401
  animation-fill-mode: both;
402
- animation-name: fadeOutUp-7af44c7f;
402
+ animation-name: fadeOutUp-f0f6bdd4;
403
403
  }
404
- @keyframes fadeOutUp-7af44c7f {
404
+ @keyframes fadeOutUp-f0f6bdd4 {
405
405
  0% {
406
406
  opacity: 1;
407
407
  }
@@ -2098,29 +2098,29 @@ to {
2098
2098
  .bg-file-upload-x-icon[data-v-d07a8f64]:hover {
2099
2099
  background-image: url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%208C0%209.58225%200.469192%2011.129%201.34824%2012.4446C2.22729%2013.7602%203.47672%2014.7855%204.93853%2015.391C6.40034%2015.9965%208.00887%2016.155%209.56072%2015.8463C11.1126%2015.5376%2012.538%2014.7757%2013.6569%2013.6569C14.7757%2012.538%2015.5376%2011.1126%2015.8463%209.56072C16.155%208.00887%2015.9965%206.40034%2015.391%204.93853C14.7855%203.47672%2013.7602%202.22729%2012.4446%201.34824C11.129%200.469192%209.58225%200%208%200C5.87827%200%203.84344%200.842855%202.34315%202.34315C0.842855%203.84344%200%205.87827%200%208ZM14.3333%208C14.3333%209.25262%2013.9619%2010.4771%2013.266%2011.5186C12.5701%2012.5601%2011.5809%2013.3719%2010.4237%2013.8512C9.2664%2014.3306%207.99298%2014.456%206.76443%2014.2116C5.53588%2013.9673%204.40739%2013.3641%203.52166%2012.4783C2.63592%2011.5926%202.03273%2010.4641%201.78836%209.23557C1.54399%208.00703%201.66941%206.7336%202.14876%205.57634C2.62812%204.41907%203.43988%203.42994%204.48139%202.73403C5.5229%202.03811%206.74739%201.66667%208%201.66667C9.67916%201.66843%2011.289%202.33626%2012.4764%203.52361C13.6637%204.71096%2014.3316%206.32084%2014.3333%208Z'%20fill='%23BB1410'%20/%3e%3cpath%20d='M5.88634%204.71322C5.73075%204.55763%205.51972%204.47021%205.29967%204.47021C5.07963%204.47021%204.8686%204.55763%204.71301%204.71322C4.55741%204.86881%204.47%205.07984%204.47%205.29989C4.47%205.51993%204.55741%205.73096%204.71301%205.88655L6.71301%207.88655C6.72914%207.9021%206.74197%207.92074%206.75073%207.94136C6.7595%207.96198%206.76401%207.98415%206.76401%208.00655C6.76401%208.02896%206.7595%208.05113%206.75073%208.07175C6.74197%208.09237%206.72914%208.11101%206.71301%208.12655L4.71301%2010.1266C4.63561%2010.2034%204.57417%2010.2948%204.53225%2010.3955C4.49033%2010.4962%204.46875%2010.6042%204.46875%2010.7132C4.46875%2010.8223%204.49033%2010.9303%204.53225%2011.031C4.57417%2011.1317%204.63561%2011.223%204.71301%2011.2999C4.78939%2011.3781%204.88063%2011.4403%204.98138%2011.4827C5.08213%2011.5251%205.19035%2011.547%205.29967%2011.547C5.409%2011.547%205.51721%2011.5251%205.61796%2011.4827C5.71871%2011.4403%205.80996%2011.3781%205.88634%2011.2999L7.88634%209.29989C7.91934%209.27037%207.96207%209.25405%208.00634%209.25405C8.05062%209.25405%208.09334%209.27037%208.12634%209.29989L10.1263%2011.2999C10.2027%2011.3781%2010.294%2011.4403%2010.3947%2011.4827C10.4955%2011.5251%2010.6037%2011.547%2010.713%2011.547C10.8223%2011.547%2010.9305%2011.5251%2011.0313%2011.4827C11.132%2011.4403%2011.2233%2011.3781%2011.2997%2011.2999C11.3771%2011.223%2011.4385%2011.1317%2011.4804%2011.031C11.5224%2010.9303%2011.5439%2010.8223%2011.5439%2010.7132C11.5439%2010.6042%2011.5224%2010.4962%2011.4804%2010.3955C11.4385%2010.2948%2011.3771%2010.2034%2011.2997%2010.1266L9.29967%208.12655C9.27016%208.09355%209.25384%208.05083%209.25384%208.00655C9.25384%207.96228%209.27016%207.91955%209.29967%207.88655L11.2997%205.88655C11.4553%205.73096%2011.5427%205.51993%2011.5427%205.29989C11.5427%205.07984%2011.4553%204.86881%2011.2997%204.71322C11.1441%204.55763%2010.9331%204.47021%2010.713%204.47021C10.493%204.47021%2010.2819%204.55763%2010.1263%204.71322L8.12634%206.71322C8.09334%206.74274%208.05062%206.75906%208.00634%206.75906C7.96207%206.75906%207.91934%206.74274%207.88634%206.71322L5.88634%204.71322Z'%20fill='%23BB1410'%20/%3e%3c/svg%3e");
2100
2100
  }
2101
- .p-table[data-v-f12e8db6] {
2101
+ .p-table[data-v-1d76cd98] {
2102
2102
  color: var(--color-night);
2103
2103
  height: 1px;
2104
2104
  }
2105
- .p-table th[data-v-f12e8db6] {
2105
+ .p-table th[data-v-1d76cd98] {
2106
2106
  position: sticky;
2107
2107
  top: 0px;
2108
2108
  z-index: 20;
2109
2109
  padding: 0px;
2110
2110
  }
2111
- .p-table.first-col-fixed th[data-v-f12e8db6]:first-child {
2111
+ .p-table.first-col-fixed th[data-v-1d76cd98]:first-child {
2112
2112
  left: 0px;
2113
2113
  z-index: 30;
2114
2114
  }
2115
- .p-table.first-col-fixed th:first-child .th-shadow[data-v-f12e8db6] {
2115
+ .p-table.first-col-fixed th:first-child .th-shadow[data-v-1d76cd98] {
2116
2116
  box-shadow: -1px 1px 5px 4px rgba(0, 0, 0, 0.15);
2117
2117
  clip-path: inset(0px -12px 0px 0px);
2118
2118
  }
2119
- .p-table.last-col-fixed th[data-v-f12e8db6]:last-child {
2119
+ .p-table.last-col-fixed th[data-v-1d76cd98]:last-child {
2120
2120
  right: 0px;
2121
2121
  z-index: 30;
2122
2122
  }
2123
- .p-table.last-col-fixed th:last-child .th-shadow[data-v-f12e8db6] {
2123
+ .p-table.last-col-fixed th:last-child .th-shadow[data-v-1d76cd98] {
2124
2124
  box-shadow: -2px 1px 8px rgba(0, 0, 0, 0.15);
2125
2125
  clip-path: inset(0px 0px 0px -12px);
2126
2126
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "5.0.1",
4
+ "version": "5.1.0",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -55,7 +55,7 @@
55
55
  "@commitlint/cli": "^19.4.1",
56
56
  "@commitlint/config-conventional": "^19.4.1",
57
57
  "@pequity/eslint-config": "^0.0.13",
58
- "@playwright/test": "^1.46.1",
58
+ "@playwright/test": "^1.47.0",
59
59
  "@popperjs/core": "2.11.8",
60
60
  "@semantic-release/changelog": "^6.0.3",
61
61
  "@semantic-release/git": "^10.0.1",
@@ -75,20 +75,18 @@
75
75
  "@types/jest": "^29.5.12",
76
76
  "@types/jsdom": "^21.1.7",
77
77
  "@types/lodash-es": "^4.17.12",
78
- "@types/node": "^22.5.3",
78
+ "@types/node": "^22.5.4",
79
79
  "@vitejs/plugin-vue": "^5.1.3",
80
80
  "@vue/compiler-sfc": "3.4.38",
81
81
  "@vue/test-utils": "^2.4.6",
82
82
  "@vue/vue3-jest": "^29.2.6",
83
83
  "autoprefixer": "^10.4.20",
84
84
  "babel-jest": "^29.7.0",
85
- "concurrently": "^8.2.2",
86
85
  "dayjs": "1.11.13",
87
86
  "eslint": "^8.57.0",
88
87
  "eslint-plugin-storybook": "^0.8.0",
89
88
  "floating-vue": "5.2.2",
90
89
  "glob": "^11.0.0",
91
- "http-server": "^14.1.1",
92
90
  "husky": "^9.1.5",
93
91
  "jest": "^29.7.0",
94
92
  "jest-environment-jsdom": "^29.7.0",
@@ -101,7 +99,7 @@
101
99
  "resolve-tspaths": "^0.8.19",
102
100
  "rimraf": "^6.0.1",
103
101
  "sass": "^1.78.0",
104
- "semantic-release": "^24.1.0",
102
+ "semantic-release": "^24.1.1",
105
103
  "storybook": "^8.2.9",
106
104
  "svgo": "^3.3.2",
107
105
  "tailwindcss": "^3.4.10",
@@ -113,6 +111,6 @@
113
111
  "vue-currency-input": "3.1.0",
114
112
  "vue-router": "4.4.3",
115
113
  "vue-toastification": "2.0.0-rc.5",
116
- "vue-tsc": "2.1.4"
114
+ "vue-tsc": "2.1.6"
117
115
  }
118
116
  }
@@ -24,7 +24,7 @@ const createWrapper = (options) => {
24
24
  <button class="request-1-sec-component" @click="fireRequestComponent(1000)"></button>
25
25
  `,
26
26
  setup() {
27
- const { loadingShow, loadingHide } = usePLoading(options);
27
+ const { loadingShow, loadingHide, show } = usePLoading(options);
28
28
 
29
29
  const fireRequest = async (time) => {
30
30
  const id = `default-${time}`;
@@ -47,7 +47,7 @@ const createWrapper = (options) => {
47
47
  loadingHide(id);
48
48
  };
49
49
 
50
- return { loadingShow, loadingHide, fireRequest, fireRequestText, fireRequestComponent };
50
+ return { loadingShow, loadingHide, fireRequest, fireRequestText, fireRequestComponent, show };
51
51
  },
52
52
  },
53
53
  {
@@ -287,4 +287,22 @@ describe('PLoading.vue', () => {
287
287
  await waitNT(appWrapper.vm);
288
288
  expect(appWrapper.find('[aria-busy]').exists()).toBe(false);
289
289
  });
290
+
291
+ it('hides the loader on unmount', async () => {
292
+ const wrapper = createWrapper({ delay: 200 });
293
+
294
+ await wrapper.find('.request-1-sec-component').trigger('click');
295
+
296
+ jest.advanceTimersByTime(300);
297
+ await waitNT(appWrapper.vm);
298
+
299
+ expect(wrapper.vm.show).toBe(true);
300
+ expect(appWrapper.find('[aria-busy]').exists()).toBe(true);
301
+ expect(appWrapper.findComponent(PSkeletonLoader).exists()).toBe(true);
302
+
303
+ appWrapper.unmount();
304
+
305
+ expect(wrapper.vm.show).toBe(false);
306
+ expect(appWrapper.exists()).toBe(false);
307
+ });
290
308
  });
@@ -28,7 +28,7 @@
28
28
  </template>
29
29
 
30
30
  <script setup lang="ts">
31
- import { type Component, ref, toValue, watch } from 'vue';
31
+ import { type Component, onBeforeUnmount, ref, toValue, watch } from 'vue';
32
32
  import { usePLoading } from '@squirrel/components/p-loading/usePLoading';
33
33
 
34
34
  const textDivClass = `overflow-hidden whitespace-nowrap px-4 pt-1 h-8 text-center text-sm font-semibold text-p-purple-60`;
@@ -37,7 +37,7 @@ defineOptions({
37
37
  name: 'PLoading',
38
38
  });
39
39
 
40
- const { show, content, props: componentProps } = usePLoading();
40
+ const { show, content, props: componentProps, loadingHide } = usePLoading();
41
41
  const dimsReference = ref<HTMLElement | null>(null);
42
42
  const width = ref(0);
43
43
  const height = ref(0);
@@ -58,6 +58,10 @@ const isComponent = (content: unknown): content is Component => {
58
58
 
59
59
  return isComponent;
60
60
  };
61
+
62
+ onBeforeUnmount(() => {
63
+ loadingHide();
64
+ });
61
65
  </script>
62
66
 
63
67
  <style scoped lang="scss">
@@ -10,14 +10,18 @@ type LoadingItem = {
10
10
  id: string;
11
11
  content?: Content;
12
12
  props?: Ref;
13
+ timer: ReturnType<typeof setTimeout> | 0;
14
+ clearOnDispose?: boolean;
13
15
  };
14
16
 
17
+ type LoadingItemOption = Pick<LoadingItem, 'id' | 'content' | 'props' | 'clearOnDispose'>;
18
+
15
19
  type UsePLoading = {
16
20
  show: Ref<boolean>;
17
21
  content: Content;
18
22
  props: Ref;
19
- loadingShow: (loadingItem: LoadingItem) => void;
20
- loadingHide: (id: LoadingItem['id']) => void;
23
+ loadingShow: (loadingItem: LoadingItemOption) => void;
24
+ loadingHide: (id?: LoadingItemOption['id']) => void;
21
25
  };
22
26
 
23
27
  const LOADING_TEXT = 'Loading...';
@@ -25,13 +29,21 @@ const show = ref(false);
25
29
  const loadingItems = ref<LoadingItem[]>([]);
26
30
  const content = computed(() => loadingItems.value[loadingItems.value.length - 1]?.content);
27
31
  const props = computed(() => loadingItems.value[loadingItems.value.length - 1]?.props);
28
- let timer: ReturnType<typeof setTimeout>;
29
32
 
30
33
  export const usePLoading = (options?: Options): UsePLoading => {
31
34
  const { delay } = { delay: 200, ...options };
32
35
  const scope = getCurrentScope();
33
36
 
34
- const loadingShow = (loadingItem: LoadingItem) => {
37
+ const clearLoadingItems = () => {
38
+ loadingItems.value.forEach((item) => {
39
+ clearTimeout(item.timer);
40
+ });
41
+ loadingItems.value = [];
42
+ };
43
+
44
+ const loadingShow = (loadingItem: LoadingItemOption) => {
45
+ let timer: ReturnType<typeof setTimeout> | 0 = 0;
46
+
35
47
  if (!loadingItem.id) {
36
48
  throw new Error('id is required');
37
49
  }
@@ -51,31 +63,42 @@ export const usePLoading = (options?: Options): UsePLoading => {
51
63
  ? markRaw(loadingItem.content)
52
64
  : loadingItem.content || LOADING_TEXT,
53
65
  props: loadingItem.props,
66
+ timer,
67
+ clearOnDispose: loadingItem.clearOnDispose ?? true,
54
68
  });
55
69
  };
56
70
 
57
- const loadingHide = (id?: LoadingItem['id']) => {
71
+ const loadingHide = (id?: LoadingItemOption['id']) => {
58
72
  if (id && typeof id === 'string') {
59
73
  const index = loadingItems.value.findIndex((item) => item.id === id);
74
+ const loadingItem = loadingItems.value[index];
60
75
 
61
76
  if (index !== -1) {
77
+ clearTimeout(loadingItem.timer);
62
78
  loadingItems.value.splice(index, 1);
63
79
  }
64
80
  } else {
65
- loadingItems.value = [];
81
+ clearLoadingItems();
66
82
  }
67
83
 
68
84
  if (loadingItems.value.length === 0) {
69
85
  show.value = false;
70
86
  }
71
- clearTimeout(timer);
72
87
  };
73
88
 
74
89
  if (scope) {
75
90
  onScopeDispose(() => {
76
- loadingItems.value = [];
77
- show.value = false;
78
- clearTimeout(timer);
91
+ if (loadingItems.value.some((item) => item.clearOnDispose === false)) {
92
+ loadingItems.value.forEach((item) => {
93
+ if (item.clearOnDispose) {
94
+ clearTimeout(item.timer);
95
+ }
96
+ });
97
+ loadingItems.value = loadingItems.value.filter((item) => item.clearOnDispose === false);
98
+ } else {
99
+ clearLoadingItems();
100
+ show.value = false;
101
+ }
79
102
  });
80
103
  }
81
104
 
@@ -65,7 +65,7 @@
65
65
  ></th>
66
66
  </tr>
67
67
  </thead>
68
- <tbody>
68
+ <tbody ref="tbodyElement">
69
69
  <tr v-if="virtualizer.paddingTop > 0">
70
70
  <td :style="{ height: `${virtualizer.paddingTop}px` }"></td>
71
71
  </tr>
@@ -159,6 +159,7 @@ const {
159
159
  enabled: computed(() => props.colsResizable),
160
160
  ths,
161
161
  });
162
+ const tbodyElement = ref<HTMLElement | null>(null);
162
163
 
163
164
  // Methods
164
165
  const updateThsRefs = (el: unknown, index: number) => {
@@ -235,6 +236,11 @@ watch(isColResizing, (nV) => {
235
236
  emit('col-resize', colResizingIndex.value, colResizingWidth.value);
236
237
  }
237
238
  });
239
+
240
+ // Expose
241
+ defineExpose({
242
+ tbodyElement,
243
+ });
238
244
  </script>
239
245
 
240
246
  <style scoped lang="scss">