hy-app 0.2.9 → 0.2.11

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/common/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './versionControl'
2
2
  export * from './shakeService'
3
+ export * from './queue'
@@ -0,0 +1,34 @@
1
+ /*
2
+ * @Author: weisheng
3
+ * @Date: 2023-07-02 22:51:06
4
+ * @LastEditTime: 2024-03-16 19:59:07
5
+ * @LastEditors: weisheng
6
+ * @Description:
7
+ * @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/common/clickoutside.ts
8
+ * 记得注释
9
+ */
10
+ let queue: any[] = []
11
+
12
+ export function pushToQueue(comp: any) {
13
+ queue.push(comp)
14
+ }
15
+
16
+ export function removeFromQueue(comp: any) {
17
+ queue = queue.filter((item) => {
18
+ return item.$.uid !== comp.$.uid
19
+ })
20
+ }
21
+
22
+ export function closeOther(comp: any) {
23
+ queue.forEach((item) => {
24
+ if (item.$.uid !== comp.$.uid) {
25
+ item.$.exposed.close()
26
+ }
27
+ })
28
+ }
29
+
30
+ export function closeOutside() {
31
+ queue.forEach((item) => {
32
+ item.$.exposed.close()
33
+ })
34
+ }
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <view class="hy-popover" :style="customStyle" id="popover" @click.stop="popover.noop">
2
+ <view
3
+ :class="['hy-popover', customClass]"
4
+ :style="customStyle"
5
+ id="popover"
6
+ @click.stop="popover.noop"
7
+ >
3
8
  <!-- 使用插槽时无法获取正确宽高 -->
4
9
  <view class="hy-popover__pos hy-popover__hidden" id="pos">
5
10
  <view class="hy-popover__container">
@@ -111,6 +116,7 @@ import defaultProps from './props'
111
116
  import IProps, { type PopoverExpose } from './typing'
112
117
  import { isArray } from '../../utils'
113
118
  import { type Queue, queueKey, usePopover } from '../../composables'
119
+ import { closeOther, pushToQueue, removeFromQueue } from '../../common'
114
120
 
115
121
  // 组件
116
122
  import HyIcon from '../hy-icon/hy-icon.vue'
@@ -157,8 +163,11 @@ watch(
157
163
  (newValue) => {
158
164
  if (newValue) {
159
165
  popover.control(placement.value, props.offset)
166
+ // provide/inject在微信小程序不能使用,所以执行两个保存方法
160
167
  if (queue && queue.closeOther) {
161
168
  queue.closeOther(proxy)
169
+ } else {
170
+ closeOther(proxy)
162
171
  }
163
172
  }
164
173
  popover.showStyle.value = newValue ? 'display: inline-block;' : 'display: none;'
@@ -174,6 +183,8 @@ onMounted(() => {
174
183
  onBeforeMount(() => {
175
184
  if (queue && queue.pushToQueue) {
176
185
  queue.pushToQueue(proxy)
186
+ } else {
187
+ pushToQueue(proxy)
177
188
  }
178
189
  popover.showStyle.value = showPopover.value ? 'opacity: 1;' : 'opacity: 0;'
179
190
  })
@@ -181,6 +192,8 @@ onBeforeMount(() => {
181
192
  onBeforeUnmount(() => {
182
193
  if (queue && queue.removeFromQueue) {
183
194
  queue.removeFromQueue(proxy)
195
+ } else {
196
+ removeFromQueue(proxy)
184
197
  }
185
198
  })
186
199
 
@@ -53,4 +53,8 @@ export default interface HyOverlayProps {
53
53
  * @description 定义需要用到的外部样式
54
54
  * */
55
55
  customStyle?: CSSProperties
56
+ /**
57
+ * @description 定义需要用到的类名
58
+ * */
59
+ customClass?: string
56
60
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.2.9",
4
- "description": "fix: 气泡组件在小程序列表不默认关闭",
3
+ "version": "0.2.11",
4
+ "description": "增加修改组件提示",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},
@@ -22,22 +22,12 @@
22
22
  "theme.scss",
23
23
  "README.md"
24
24
  ],
25
- "dependencies": {
26
- "@dcloudio/uni-app": "3.0.0-alpha-3081220230802001",
27
- "pinia": "^2.3.1",
28
- "pinia-plugin-unistorage": "^0.0.8",
29
- "vue": "^3.5.13",
30
- "vue-i18n": "^9.14.3"
31
- },
32
- "devDependencies": {
33
- "@dcloudio/types": "^3.4.14",
34
- "@vue/tsconfig": "^0.1.3",
35
- "uni-app-types": "^0.1.7"
36
- },
37
25
  "keywords": [
38
26
  "华玥组件库",
39
- "ui组件库"
27
+ "ui组件库",
28
+ "暗黑模式"
40
29
  ],
30
+ "web-types": "web-types.json",
41
31
  "author": "gaoxianhua",
42
- "license": "ISC"
32
+ "license": "MIT"
43
33
  }