@teammodlr/ui-kit 2.3.3 → 2.3.4

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/lib/index.es.js CHANGED
@@ -11119,13 +11119,13 @@ const zl = /* @__PURE__ */ K(Y0, [["render", J0]]), Q0 = {
11119
11119
  MConfirm: zl
11120
11120
  },
11121
11121
  setup(e, { slots: t }) {
11122
- const n = w([]), o = {}, r = Aa(null, "m-confirm");
11122
+ const n = w([]), o = w({}), r = Aa(null, "m-confirm");
11123
11123
  function a(u) {
11124
11124
  const i = r, d = {
11125
11125
  ...u,
11126
11126
  key: i,
11127
11127
  destroy: () => {
11128
- o[i].hide();
11128
+ o.value[i].hide();
11129
11129
  }
11130
11130
  };
11131
11131
  return n.value.push(d), d;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teammodlr/ui-kit",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs.js",
6
6
  "module": "lib/index.es.js",
@@ -1,82 +1,82 @@
1
- <template>
2
- <slot />
3
- <template v-if="dialogList.length > 0">
4
- <Teleport :to="teleportTo ?? 'body'">
5
- <MConfirm
6
- v-for="dialog in dialogList"
7
- :key="dialog.key"
8
- :internalKey="dialog.key"
9
- :title="dialog.title"
10
- :content="dialog.content"
11
- :okText="dialog.okText"
12
- :cancelText="dialog.cancelText"
13
- :on-ok="dialog.onOk"
14
- :on-cancel="dialog.onCancel"
15
- :ok-variant="dialog.okVariant"
16
- ref="dialogRefs" />
17
- </Teleport>
18
- </template>
19
- </template>
20
-
21
- <script lang="ts">
22
- import { defineComponent, provide, ref } from 'vue';
23
- import { useId } from '../../composables/useCachedUid';
24
- import { providerProps } from './providerProps';
25
- import type { Confirm, ConfirmApiInjection, ConfirmOptions } from './types';
26
- import MConfirm from './Confirm.vue';
27
-
28
- interface PrivateConfirm extends Confirm {
29
- key: string;
30
- }
31
-
32
- interface PrivateConfirmRef extends Confirm {
33
- key: string;
34
- hide: () => void;
35
- }
36
-
37
- export default defineComponent({
38
- name: 'ConfirmProvider',
39
- props: providerProps,
40
- components: {
41
- MConfirm
42
- },
43
- setup(props, { slots }) {
44
- const dialogListRef = ref<PrivateConfirm[]>([]);
45
- const dialogRefs: Record<string, PrivateConfirmRef> = {};
46
- const id = useId(null, 'm-confirm');
47
- function create(options: ConfirmOptions): Confirm {
48
- const key = id;
49
- const dialog: PrivateConfirm = {
50
- ...options,
51
- key,
52
- destroy: () => {
53
- dialogRefs[key].hide();
54
- }
55
- };
56
-
57
- dialogListRef.value.push(dialog);
58
- return dialog;
59
- }
60
-
61
- function destroyAll(): void {
62
- // @ts-ignore
63
- Object.values(dialogRefs.value).forEach(dialog => {
64
- dialog.hide();
65
- });
66
- }
67
-
68
- const api: ConfirmApiInjection = {
69
- create,
70
- destroyAll
71
- } as const;
72
-
73
- provide('m-confirm', api);
74
-
75
- return {
76
- ...api,
77
- dialogRefs,
78
- dialogList: dialogListRef
79
- };
80
- }
81
- });
82
- </script>
1
+ <template>
2
+ <slot />
3
+ <template v-if="dialogList.length > 0">
4
+ <Teleport :to="teleportTo ?? 'body'">
5
+ <MConfirm
6
+ v-for="dialog in dialogList"
7
+ :key="dialog.key"
8
+ :internalKey="dialog.key"
9
+ :title="dialog.title"
10
+ :content="dialog.content"
11
+ :okText="dialog.okText"
12
+ :cancelText="dialog.cancelText"
13
+ :on-ok="dialog.onOk"
14
+ :on-cancel="dialog.onCancel"
15
+ :ok-variant="dialog.okVariant"
16
+ ref="dialogRefs" />
17
+ </Teleport>
18
+ </template>
19
+ </template>
20
+
21
+ <script lang="ts">
22
+ import { defineComponent, provide, ref, type Ref } from 'vue';
23
+ import { useId } from '../../composables/useCachedUid';
24
+ import { providerProps } from './providerProps';
25
+ import type { Confirm, ConfirmApiInjection, ConfirmOptions } from './types';
26
+ import MConfirm from './Confirm.vue';
27
+
28
+ interface PrivateConfirm extends Confirm {
29
+ key: string;
30
+ }
31
+
32
+ interface PrivateConfirmRef extends Confirm {
33
+ key: string;
34
+ hide: () => void;
35
+ }
36
+
37
+ export default defineComponent({
38
+ name: 'ConfirmProvider',
39
+ props: providerProps,
40
+ components: {
41
+ MConfirm
42
+ },
43
+ setup(props, { slots }) {
44
+ const dialogListRef = ref<PrivateConfirm[]>([]);
45
+ const dialogRefs: Ref<Record<string, PrivateConfirmRef>> = ref({});
46
+ const id = useId(null, 'm-confirm');
47
+ function create(options: ConfirmOptions): Confirm {
48
+ const key = id;
49
+ const dialog: PrivateConfirm = {
50
+ ...options,
51
+ key,
52
+ destroy: () => {
53
+ dialogRefs.value[key].hide();
54
+ }
55
+ };
56
+
57
+ dialogListRef.value.push(dialog);
58
+ return dialog;
59
+ }
60
+
61
+ function destroyAll(): void {
62
+ // @ts-ignore
63
+ Object.values(dialogRefs.value).forEach(dialog => {
64
+ dialog.hide();
65
+ });
66
+ }
67
+
68
+ const api: ConfirmApiInjection = {
69
+ create,
70
+ destroyAll
71
+ } as const;
72
+
73
+ provide('m-confirm', api);
74
+
75
+ return {
76
+ ...api,
77
+ dialogRefs,
78
+ dialogList: dialogListRef
79
+ };
80
+ }
81
+ });
82
+ </script>