hy-app 0.7.0 → 0.7.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.
Files changed (32) hide show
  1. package/components/hy-calendar/hy-calendar.vue +2 -2
  2. package/components/hy-calendar/typing.d.ts +9 -0
  3. package/components/hy-count-down/hy-count-down.vue +8 -8
  4. package/components/hy-count-down/typing.d.ts +16 -0
  5. package/components/hy-count-to/hy-count-to.vue +7 -7
  6. package/components/hy-count-to/typing.d.ts +24 -0
  7. package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -1
  8. package/components/hy-folding-panel/hy-folding-panel.vue +3 -3
  9. package/components/hy-folding-panel/typing.d.ts +23 -0
  10. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -2
  11. package/components/hy-folding-panel-item/typing.d.ts +21 -0
  12. package/components/hy-form/hy-form.vue +2 -2
  13. package/components/hy-form/typing.d.ts +37 -6
  14. package/components/hy-list/hy-list.vue +15 -13
  15. package/components/hy-list/props.ts +1 -1
  16. package/components/hy-notify/hy-notify.vue +2 -2
  17. package/components/hy-notify/typing.d.ts +34 -21
  18. package/components/hy-number-step/hy-number-step.vue +370 -367
  19. package/components/hy-number-step/index.scss +1 -0
  20. package/components/hy-number-step/props.ts +1 -1
  21. package/components/hy-popover/hy-popover.vue +2 -2
  22. package/components/hy-popover/typing.d.ts +1 -1
  23. package/components/hy-popup/hy-popup.vue +1 -1
  24. package/components/hy-signature/hy-signature.vue +17 -17
  25. package/components/hy-signature/typing.d.ts +1 -1
  26. package/components/hy-toast/hy-toast.vue +3 -3
  27. package/components/hy-toast/index.scss +1 -1
  28. package/components/hy-toast/typing.d.ts +14 -1
  29. package/libs/api/http.ts +122 -119
  30. package/libs/css/theme.scss +2 -0
  31. package/package.json +1 -1
  32. package/components/hy-folding-panel/hy-folding-panel-group.vue +0 -163
@@ -1,163 +0,0 @@
1
- <template>
2
- <view class="hy-folding-panel-group">
3
- <slot></slot>
4
- </view>
5
- </template>
6
-
7
- <script lang="ts">
8
- export default {
9
- name: "hy-folding-panel-group"
10
- };
11
- </script>
12
-
13
- <script setup lang="ts">
14
- import { provide, ref, watch, onMounted, nextTick, getCurrentInstance } from 'vue';
15
- import type { Ref } from 'vue';
16
-
17
- // Props定义
18
- const props = defineProps({
19
- /**
20
- * 当前激活的面板索引,支持v-model
21
- */
22
- modelValue: {
23
- type: Number,
24
- default: -1
25
- },
26
- /**
27
- * 是否手风琴模式,默认true
28
- */
29
- accordion: {
30
- type: Boolean,
31
- default: true
32
- },
33
- /**
34
- * 是否禁用整个折叠面板组
35
- */
36
- disabled: {
37
- type: Boolean,
38
- default: false
39
- }
40
- });
41
-
42
- // 事件定义
43
- const emit = defineEmits<{
44
- (e: 'update:modelValue', value: number): void;
45
- (e: 'change', index: number): void;
46
- (e: 'open', index: number): void;
47
- (e: 'close', index: number): void;
48
- }>();
49
-
50
- // 内部激活索引
51
- const activeIndex = ref(props.modelValue);
52
-
53
- // 监听v-model变化
54
- watch(() => props.modelValue, (newVal) => {
55
- activeIndex.value = newVal;
56
- });
57
-
58
- // 监听内部激活索引变化
59
- watch(activeIndex, (newVal) => {
60
- emit('update:modelValue', newVal);
61
- emit('change', newVal);
62
- });
63
-
64
- // 提供给子组件的方法
65
- const updateActiveIndex = (index: number) => {
66
- if (props.disabled) return;
67
-
68
- if (props.accordion) {
69
- // 手风琴模式下,如果点击的是当前激活的索引,则关闭(设为-1)
70
- const wasActive = activeIndex.value === index;
71
- activeIndex.value = wasActive ? -1 : index;
72
-
73
- // 触发相应的事件
74
- if (!wasActive) {
75
- emit('open', index);
76
- } else {
77
- emit('close', index);
78
- }
79
- } else {
80
- // 非手风琴模式下,这里不做特殊处理,由子组件自己控制
81
- activeIndex.value = index;
82
- }
83
- };
84
-
85
- // 提供给子组件的配置
86
- provide('hy-folding-panel-group', {
87
- accordion: props.accordion,
88
- disabled: props.disabled,
89
- activeIndex,
90
- updateActiveIndex
91
- });
92
-
93
- // 自动为子组件设置索引
94
- onMounted(() => {
95
- nextTick(() => {
96
- const children = getCurrentInstance()?.proxy?.$el?.querySelectorAll('.hy-folding-panel-item');
97
- children?.forEach((child, index) => {
98
- const vueComponent = (child as any).__vueParentComponent?.proxy;
99
- if (vueComponent && vueComponent.$options.name === 'hy-folding-panel-item') {
100
- vueComponent.index = index;
101
- }
102
- });
103
- });
104
- });
105
-
106
- // 对外暴露的方法
107
- defineExpose({
108
- /**
109
- * 打开指定索引的面板
110
- */
111
- open: (index: number) => {
112
- if (props.disabled) return;
113
- activeIndex.value = index;
114
- emit('open', index);
115
- },
116
-
117
- /**
118
- * 关闭所有面板
119
- */
120
- closeAll: () => {
121
- if (props.disabled) return;
122
- const prevIndex = activeIndex.value;
123
- activeIndex.value = -1;
124
- if (prevIndex !== -1) {
125
- emit('close', prevIndex);
126
- }
127
- },
128
-
129
- /**
130
- * 切换指定索引面板的状态
131
- */
132
- toggle: (index: number) => {
133
- if (props.disabled) return;
134
- updateActiveIndex(index);
135
- },
136
-
137
- /**
138
- * 关闭指定索引的面板
139
- */
140
- close: (index: number) => {
141
- if (props.disabled) return;
142
- if (activeIndex.value === index) {
143
- activeIndex.value = -1;
144
- emit('close', index);
145
- }
146
- }
147
- });
148
- </script>
149
-
150
- <style lang="scss" scoped>
151
- .hy-folding-panel-group {
152
- width: 100%;
153
- background-color: #ffffff;
154
- border-radius: 8px;
155
- overflow: hidden;
156
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
157
- }
158
-
159
- .hy-folding-panel-group--disabled {
160
- opacity: 0.6;
161
- pointer-events: none;
162
- }
163
- </style>