@antify/ui 3.1.21 → 3.1.23

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.
@@ -1,25 +1,15 @@
1
1
  <script lang="ts" setup>
2
2
  import AntAccordionItem from './AntAccordionItem.vue';
3
3
  import {
4
- onMounted, ref,
4
+ onMounted,
5
5
  } from 'vue';
6
6
  import {
7
- CollapseStrategy,
7
+ CollapseStrategy, type AccordionItem,
8
8
  } from './__types/AntAccordion.types';
9
9
  import AntSkeleton from './AntSkeleton.vue';
10
10
 
11
11
  const props = withDefaults(defineProps<{
12
- items: {
13
- label?: string;
14
- content?: string;
15
- isOpen?: boolean;
16
- iconLeft?: boolean;
17
- contentPadding?: boolean;
18
- activeLabelClasses?: string;
19
- activeIconClasses?: string;
20
- inactiveLabelClasses?: string;
21
- inactiveIconClasses?: string;
22
- }[];
12
+ items: AccordionItem[];
23
13
  collapseStrategy?: CollapseStrategy;
24
14
  skeleton?: boolean;
25
15
  }>(), {
@@ -27,22 +17,24 @@ const props = withDefaults(defineProps<{
27
17
  skeleton: false,
28
18
  });
29
19
 
30
- const openItems = ref<number[]>([]);
20
+ const _openItems = defineModel<number[]>('openItems', {
21
+ default: [],
22
+ });
31
23
 
32
24
  onMounted(() => {
33
- openItems.value = props.items
25
+ _openItems.value = props.items
34
26
  .map((item, index) => item.isOpen ? index : -1)
35
27
  .filter((index) => index !== -1);
36
28
  });
37
29
 
38
30
  function onOpen(index: number) {
39
31
  if (props.collapseStrategy === CollapseStrategy.single) {
40
- openItems.value = [
32
+ _openItems.value = [
41
33
  index,
42
34
  ];
43
35
  } else {
44
- openItems.value = [
45
- ...openItems.value,
36
+ _openItems.value = [
37
+ ..._openItems.value,
46
38
  index,
47
39
  ];
48
40
  }
@@ -50,9 +42,9 @@ function onOpen(index: number) {
50
42
 
51
43
  function onClose(index: number) {
52
44
  if (props.collapseStrategy === CollapseStrategy.single) {
53
- openItems.value = [];
45
+ _openItems.value = [];
54
46
  } else {
55
- openItems.value = openItems.value.filter((item) => item !== index);
47
+ _openItems.value = _openItems.value.filter((item) => item !== index);
56
48
  }
57
49
  }
58
50
  </script>
@@ -64,7 +56,7 @@ function onClose(index: number) {
64
56
  v-for="(item, index) in items"
65
57
  :key="`accordion-item-${index}`"
66
58
  :label="item.label"
67
- :is-open="openItems.includes(index)"
59
+ :is-open="_openItems.includes(index)"
68
60
  :icon-left="item.iconLeft"
69
61
  :content-padding="item.contentPadding"
70
62
  :active-label-classes="item.activeLabelClasses"
@@ -2,3 +2,14 @@ export declare enum CollapseStrategy {
2
2
  single = "single",
3
3
  multiple = "multiple"
4
4
  }
5
+ export interface AccordionItem {
6
+ label?: string;
7
+ content?: string;
8
+ isOpen?: boolean;
9
+ iconLeft?: boolean;
10
+ contentPadding?: boolean;
11
+ activeLabelClasses?: string;
12
+ activeIconClasses?: string;
13
+ inactiveLabelClasses?: string;
14
+ inactiveIconClasses?: string;
15
+ }
@@ -136,6 +136,7 @@ function onClickCalendar() {
136
136
 
137
137
  <AntButton
138
138
  v-if="_nullable"
139
+ :disabled="disabled"
139
140
  :icon-left="faMultiply"
140
141
  :grouped="Grouped.right"
141
142
  :state="state as unknown as State"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antify/ui",
3
- "version": "3.1.21",
3
+ "version": "3.1.23",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {