hy-app 0.2.13 → 0.2.15

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 (223) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +81 -13
  2. package/components/hy-action-sheet/typing.d.ts +1 -3
  3. package/components/hy-address-picker/hy-address-picker.vue +109 -8
  4. package/components/hy-address-picker/index.scss +2 -2
  5. package/components/hy-address-picker/typing.d.ts +39 -30
  6. package/components/hy-avatar/hy-avatar.vue +78 -4
  7. package/components/hy-avatar/typing.d.ts +21 -16
  8. package/components/hy-back-top/hy-back-top.vue +86 -28
  9. package/components/hy-back-top/typing.d.ts +17 -12
  10. package/components/hy-badge/hy-badge.vue +114 -43
  11. package/components/hy-badge/typing.d.ts +20 -15
  12. package/components/hy-button/HyButton.docgen.js +6 -0
  13. package/components/hy-button/hy-button.vue +70 -77
  14. package/components/hy-button/props.ts +40 -41
  15. package/components/hy-calendar/hy-calendar.vue +290 -143
  16. package/components/hy-calendar/typing.d.ts +38 -31
  17. package/components/hy-card/hy-card.vue +139 -36
  18. package/components/hy-card/typing.d.ts +39 -28
  19. package/components/hy-cell/hy-cell.vue +131 -67
  20. package/components/hy-cell/typing.d.ts +6 -1
  21. package/components/hy-check-button/hy-check-button.vue +101 -32
  22. package/components/hy-check-button/typing.d.ts +26 -19
  23. package/components/hy-checkbox/hy-checkbox.vue +167 -78
  24. package/components/hy-checkbox/typing.d.ts +26 -19
  25. package/components/hy-code-input/hy-code-input.vue +101 -5
  26. package/components/hy-code-input/typing.d.ts +9 -0
  27. package/components/hy-config-provider/hy-config-provider.vue +44 -24
  28. package/components/hy-config-provider/typing.d.ts +0 -4
  29. package/components/hy-count-down/hy-count-down.vue +99 -62
  30. package/components/hy-count-down/typing.d.ts +18 -5
  31. package/components/hy-count-to/hy-count-to.vue +165 -113
  32. package/components/hy-count-to/typing.d.ts +15 -11
  33. package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
  34. package/components/hy-datetime-picker/typing.d.ts +49 -39
  35. package/components/hy-divider/hy-divider.vue +128 -64
  36. package/components/hy-divider/typing.d.ts +16 -16
  37. package/components/hy-dropdown/hy-dropdown.vue +57 -19
  38. package/components/hy-dropdown/typing.d.ts +14 -14
  39. package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
  40. package/components/hy-dropdown-item/typing.d.ts +13 -6
  41. package/components/hy-empty/hy-empty.vue +64 -6
  42. package/components/hy-empty/typing.d.ts +5 -0
  43. package/components/hy-float-button/hy-float-button.vue +117 -5
  44. package/components/hy-float-button/typing.d.ts +7 -0
  45. package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
  46. package/components/hy-folding-panel/typing.d.ts +24 -15
  47. package/components/hy-grid/hy-grid.vue +95 -35
  48. package/components/hy-grid/typing.d.ts +24 -19
  49. package/components/hy-icon/hy-icon.vue +84 -6
  50. package/components/hy-icon/typing.d.ts +5 -0
  51. package/components/hy-image/hy-image.vue +105 -6
  52. package/components/hy-image/typing.d.ts +9 -0
  53. package/components/hy-input/hy-input.vue +277 -130
  54. package/components/hy-input/props.ts +13 -14
  55. package/components/hy-input/typing.d.ts +59 -38
  56. package/components/hy-line/hy-line.vue +65 -25
  57. package/components/hy-line-progress/hy-line-progress.vue +68 -35
  58. package/components/hy-list/hy-list.vue +127 -61
  59. package/components/hy-list/typing.d.ts +19 -12
  60. package/components/hy-loading/hy-loading.vue +79 -25
  61. package/components/hy-menu/hy-menu.vue +69 -45
  62. package/components/hy-menu/typing.d.ts +22 -15
  63. package/components/hy-modal/hy-modal.vue +91 -4
  64. package/components/hy-modal/typing.d.ts +11 -0
  65. package/components/hy-navbar/hy-navbar.vue +105 -25
  66. package/components/hy-navbar/typing.d.ts +25 -20
  67. package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
  68. package/components/hy-notice-bar/typing.d.ts +22 -17
  69. package/components/hy-notify/hy-notify.vue +106 -54
  70. package/components/hy-number-step/hy-number-step.vue +211 -120
  71. package/components/hy-number-step/typing.d.ts +45 -28
  72. package/components/hy-overlay/hy-overlay.vue +60 -16
  73. package/components/hy-overlay/typing.d.ts +11 -6
  74. package/components/hy-pagination/hy-pagination.vue +94 -37
  75. package/components/hy-pagination/typing.d.ts +20 -11
  76. package/components/hy-picker/hy-picker.vue +225 -160
  77. package/components/hy-picker/typing.d.ts +51 -28
  78. package/components/hy-popover/hy-popover.vue +55 -7
  79. package/components/hy-popover/typing.d.ts +21 -1
  80. package/components/hy-popup/hy-popup.vue +164 -99
  81. package/components/hy-popup/typing.d.ts +11 -0
  82. package/components/hy-price/hy-price.vue +77 -30
  83. package/components/hy-price/typing.d.ts +10 -10
  84. package/components/hy-qrcode/hy-qrcode.vue +75 -5
  85. package/components/hy-qrcode/typing.d.ts +25 -16
  86. package/components/hy-radio/hy-radio.vue +169 -88
  87. package/components/hy-radio/typing.d.ts +29 -22
  88. package/components/hy-rate/hy-rate.vue +155 -104
  89. package/components/hy-rate/typing.d.ts +23 -16
  90. package/components/hy-read-more/hy-read-more.vue +83 -56
  91. package/components/hy-read-more/typing.d.ts +18 -11
  92. package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
  93. package/components/hy-scroll-list/typing.d.ts +14 -7
  94. package/components/hy-search/hy-search.vue +168 -62
  95. package/components/hy-search/typing.d.ts +47 -26
  96. package/components/hy-signature/hy-signature.vue +354 -272
  97. package/components/hy-signature/typing.d.ts +65 -52
  98. package/components/hy-slider/hy-slider.vue +208 -160
  99. package/components/hy-slider/typing.d.ts +28 -17
  100. package/components/hy-steps/hy-steps.vue +125 -99
  101. package/components/hy-steps/typing.d.ts +21 -14
  102. package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
  103. package/components/hy-submit-bar/typing.d.ts +30 -23
  104. package/components/hy-subsection/hy-subsection.vue +139 -96
  105. package/components/hy-subsection/typing.d.ts +23 -16
  106. package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
  107. package/components/hy-swipe-action/typing.d.ts +26 -17
  108. package/components/hy-swiper/hy-swiper.vue +178 -73
  109. package/components/hy-swiper/typing.d.ts +37 -28
  110. package/components/hy-switch/hy-switch.vue +107 -60
  111. package/components/hy-switch/typing.d.ts +25 -18
  112. package/components/hy-tabs/hy-tabs.vue +170 -160
  113. package/components/hy-tabs/typing.d.ts +36 -22
  114. package/components/hy-tag/hy-tag.vue +133 -58
  115. package/components/hy-tag/typing.d.ts +26 -18
  116. package/components/hy-text/hy-text.vue +106 -6
  117. package/components/hy-text/typing.d.ts +31 -26
  118. package/components/hy-textarea/hy-textarea.vue +183 -89
  119. package/components/hy-textarea/typing.d.ts +41 -24
  120. package/components/hy-tooltip/hy-tooltip.vue +145 -101
  121. package/components/hy-tooltip/typing.d.ts +18 -13
  122. package/components/hy-transition/hy-transition.vue +48 -13
  123. package/components/hy-transition/typing.d.ts +17 -0
  124. package/components/hy-upload/hy-upload.vue +113 -148
  125. package/components/hy-upload/typing.d.ts +71 -71
  126. package/components/hy-warn/hy-warn.vue +79 -36
  127. package/components/hy-warn/typing.d.ts +18 -11
  128. package/components/hy-waterfall/hy-waterfall.vue +90 -77
  129. package/components/hy-watermark/hy-watermark.vue +82 -5
  130. package/components/hy-watermark/typing.d.ts +20 -20
  131. package/global.d.ts +39 -59
  132. package/package.json +5 -13
  133. package/utils/inspect.ts +3 -1
  134. package/web-types.json +1 -1
  135. package/component-helper.ts +0 -177
  136. package/components.json +0 -3287
  137. package/dist/attributes.json +0 -1
  138. package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
  139. package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
  140. package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
  141. package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
  142. package/dist/docs/components/hy-badge/hy-badge.md +0 -13
  143. package/dist/docs/components/hy-button/hy-button.md +0 -61
  144. package/dist/docs/components/hy-calendar/header.md +0 -17
  145. package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
  146. package/dist/docs/components/hy-calendar/month.md +0 -38
  147. package/dist/docs/components/hy-card/hy-card.md +0 -24
  148. package/dist/docs/components/hy-cell/hy-cell.md +0 -26
  149. package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
  150. package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
  151. package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
  152. package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
  153. package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
  154. package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
  155. package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
  156. package/dist/docs/components/hy-divider/hy-divider.md +0 -13
  157. package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
  158. package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
  159. package/dist/docs/components/hy-empty/hy-empty.md +0 -20
  160. package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
  161. package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
  162. package/dist/docs/components/hy-form/hy-form.md +0 -29
  163. package/dist/docs/components/hy-grid/hy-grid.md +0 -19
  164. package/dist/docs/components/hy-icon/hy-icon.md +0 -13
  165. package/dist/docs/components/hy-image/hy-image.md +0 -22
  166. package/dist/docs/components/hy-input/hy-input.md +0 -29
  167. package/dist/docs/components/hy-line/hy-line.md +0 -7
  168. package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
  169. package/dist/docs/components/hy-list/hy-list.md +0 -25
  170. package/dist/docs/components/hy-loading/hy-loading.md +0 -14
  171. package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
  172. package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
  173. package/dist/docs/components/hy-login/hy-login.md +0 -14
  174. package/dist/docs/components/hy-menu/hy-menu.md +0 -21
  175. package/dist/docs/components/hy-modal/hy-modal.md +0 -23
  176. package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
  177. package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
  178. package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
  179. package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
  180. package/dist/docs/components/hy-notify/hy-notify.md +0 -23
  181. package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
  182. package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
  183. package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
  184. package/dist/docs/components/hy-parse/hy-parse.md +0 -46
  185. package/dist/docs/components/hy-parse/node/node.md +0 -7
  186. package/dist/docs/components/hy-picker/hy-picker.md +0 -32
  187. package/dist/docs/components/hy-popover/hy-popover.md +0 -34
  188. package/dist/docs/components/hy-popup/hy-popup.md +0 -22
  189. package/dist/docs/components/hy-price/hy-price.md +0 -13
  190. package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
  191. package/dist/docs/components/hy-radio/hy-radio.md +0 -21
  192. package/dist/docs/components/hy-rate/hy-rate.md +0 -14
  193. package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
  194. package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
  195. package/dist/docs/components/hy-search/hy-search.md +0 -27
  196. package/dist/docs/components/hy-signature/hy-signature.md +0 -45
  197. package/dist/docs/components/hy-slider/hy-slider.md +0 -24
  198. package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
  199. package/dist/docs/components/hy-steps/hy-steps.md +0 -23
  200. package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
  201. package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
  202. package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
  203. package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
  204. package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
  205. package/dist/docs/components/hy-switch/hy-switch.md +0 -20
  206. package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
  207. package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
  208. package/dist/docs/components/hy-tag/hy-tag.md +0 -21
  209. package/dist/docs/components/hy-text/hy-text.md +0 -13
  210. package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
  211. package/dist/docs/components/hy-toast/hy-toast.md +0 -17
  212. package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
  213. package/dist/docs/components/hy-transition/hy-transition.md +0 -25
  214. package/dist/docs/components/hy-upload/hy-upload.md +0 -25
  215. package/dist/docs/components/hy-warn/hy-warn.md +0 -14
  216. package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
  217. package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
  218. package/dist/docs/components/message/TheMessage.md +0 -17
  219. package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
  220. package/dist/tags.json +0 -1
  221. package/dist/web-types.json +0 -1
  222. package/docgen.config.js +0 -14
  223. package/web-types.config.js +0 -7
@@ -1,156 +1,169 @@
1
1
  <template>
2
2
  <view class="hy-waterfall">
3
- <view
4
- ref="hy-waterfall__left"
5
- id="hy-waterfall__left--column"
6
- class="hy-waterfall__column"
7
- >
3
+ <view ref="hy-waterfall__left" id="hy-waterfall__left--column" class="hy-waterfall__column">
8
4
  <slot name="left" :leftList="leftList"></slot>
9
5
  </view>
10
- <view
11
- ref="hy-waterfall__right"
12
- id="hy-waterfall__right--column"
13
- class="hy-waterfall__column"
14
- >
6
+ <view ref="hy-waterfall__right" id="hy-waterfall__right--column" class="hy-waterfall__column">
15
7
  <slot name="right" :rightList="rightList"></slot>
16
8
  </view>
17
9
  </view>
18
10
  </template>
19
11
 
20
12
  <script lang="ts">
13
+ /**
14
+ * 这是一个瀑布流形式的组件,内容分为左右两列,结合uview的懒加载组件效果更佳。
15
+ * 相较于某些只是奇偶数左右分别,或者没有利用vue作用域插槽的做法,
16
+ * uView的瀑布流实现了真正的 组件化,搭配LazyLoad 懒加载和loadMore 加载更多组件,让您开箱即用,眼前一亮。
17
+ * @displayName hy-waterfall
18
+ */
19
+ defineOptions({})
21
20
  export default {
22
21
  name: 'hy-waterfall',
23
22
  options: {
24
23
  addGlobalClass: true,
25
24
  virtualHost: true,
26
- styleIsolation: 'shared'
27
- }
25
+ styleIsolation: 'shared',
26
+ },
28
27
  }
29
28
  </script>
30
29
 
31
30
  <script setup lang="ts">
32
- import type IProps from "./typing";
33
- import defaultProps from "./props";
34
- import { computed, getCurrentInstance, ref, toRefs, watch } from "vue";
35
- import { getRect, isArray } from "../../utils";
31
+ import { computed, getCurrentInstance, ref, toRefs, watch } from 'vue'
32
+ import { getRect, isArray } from '../../utils'
36
33
 
37
- const props = withDefaults(defineProps<IProps>(), defaultProps);
38
- const { modelValue, addTime, idKey } = toRefs(props);
39
- const emit = defineEmits(["update:modelValue"]);
34
+ // const props = withDefaults(defineProps<IProps>(), defaultProps)
35
+ const props = defineProps({
36
+ /** 数据列表 */
37
+ modelValue: {
38
+ type: Array,
39
+ default() {
40
+ return []
41
+ },
42
+ },
43
+ /** 每次向结构插入数据的时间间隔,间隔越长,越能保证两列高度相近,但是对用户体验越不好 */
44
+ addTime: {
45
+ type: String,
46
+ default: 200,
47
+ },
48
+ /** id值 */
49
+ idKey: {
50
+ type: String,
51
+ default: 'id',
52
+ },
53
+ })
54
+ const { modelValue, addTime, idKey } = toRefs(props)
55
+ const emit = defineEmits(['update:modelValue'])
40
56
 
41
- const instance = getCurrentInstance();
42
- const leftList = ref<Record<string, any>[]>([]);
43
- const rightList = ref<Record<string, any>[]>([]);
44
- const tempList = ref([]);
57
+ const instance = getCurrentInstance()
58
+ const leftList = ref<Record<string, any>[]>([])
59
+ const rightList = ref<Record<string, any>[]>([])
60
+ const tempList = ref([])
45
61
 
46
62
  /**
47
63
  * @description 清空数据列表
48
64
  */
49
65
  const clear = (bak = true) => {
50
- leftList.value = [];
51
- rightList.value = [];
66
+ leftList.value = []
67
+ rightList.value = []
52
68
  // 同时清除父组件列表中的数据
53
69
  if (bak) {
54
- emit("update:modelValue", []);
70
+ emit('update:modelValue', [])
55
71
  }
56
- tempList.value = [];
57
- };
72
+ tempList.value = []
73
+ }
58
74
  // 复制而不是引用对象和数组
59
75
  const cloneData = (data: Record<string, any>[]) => {
60
- return JSON.parse(JSON.stringify(data));
61
- };
76
+ return JSON.parse(JSON.stringify(data))
77
+ }
62
78
  const splitData = async () => {
63
- if (!tempList.value.length) return;
79
+ if (!tempList.value.length) return
64
80
  const leftRect = (await getRect(
65
- "#hy-waterfall__left--column",
81
+ '#hy-waterfall__left--column',
66
82
  false,
67
83
  instance,
68
- )) as UniApp.NodeInfo;
84
+ )) as UniApp.NodeInfo
69
85
  const rightRect = (await getRect(
70
- "#hy-waterfall__right--column",
86
+ '#hy-waterfall__right--column',
71
87
  false,
72
88
  instance,
73
- )) as UniApp.NodeInfo;
89
+ )) as UniApp.NodeInfo
74
90
  // 如果左边小于或等于右边,就添加到左边,否则添加到右边
75
- let item = tempList.value[0];
91
+ let item = tempList.value[0]
76
92
  // 解决多次快速上拉后,可能数据会乱的问题,因为经过上面的两个await节点查询阻塞一定时间,加上后面的定时器干扰
77
93
  // 数组可能变成[],导致此item值可能为undefined
78
- if (!item) return;
94
+ if (!item) return
79
95
  if (leftRect.height !== undefined && rightRect.height !== undefined) {
80
96
  if (leftRect.height < rightRect.height) {
81
- leftList.value.push(item);
97
+ leftList.value.push(item)
82
98
  } else if (leftRect.height > rightRect.height) {
83
- rightList.value.push(item);
99
+ rightList.value.push(item)
84
100
  } else {
85
101
  // 这里是为了保证第一和第二张添加时,左右都能有内容
86
102
  // 因为添加第一张,实际队列的高度可能还是0,这时需要根据队列元素长度判断下一个该放哪边
87
103
  if (leftList.value.length <= rightList.value.length) {
88
- leftList.value.push(item);
104
+ leftList.value.push(item)
89
105
  } else {
90
- rightList.value.push(item);
106
+ rightList.value.push(item)
91
107
  }
92
108
  }
93
109
  }
94
110
  // 移除临时列表的第一项
95
- tempList.value.splice(0, 1);
111
+ tempList.value.splice(0, 1)
96
112
  // 如果临时数组还有数据,继续循环
97
113
  if (tempList.value.length) {
98
114
  setTimeout(() => {
99
- splitData();
100
- }, addTime.value);
115
+ splitData()
116
+ }, addTime.value)
101
117
  }
102
- };
118
+ }
103
119
 
104
120
  /**
105
121
  * @description 破坏flowList变量的引用,否则watch的结果新旧值是一样的
106
122
  * */
107
123
  const copyFlowList = computed(() => {
108
124
  if (!modelValue.value || modelValue.value.length == 0) {
109
- clear(false);
110
- return [];
125
+ clear(false)
126
+ return []
111
127
  } else {
112
- return cloneData(modelValue.value);
128
+ return cloneData(modelValue.value)
113
129
  }
114
- });
130
+ })
115
131
 
116
132
  watch(
117
133
  () => copyFlowList.value,
118
134
  (newVal, oldValue) => {
119
135
  if (!newVal || newVal.length == 0) {
120
- clear(false);
136
+ clear(false)
121
137
  } else {
122
138
  // 取差值,即这一次数组变化新增的部分
123
- let startIndex =
124
- isArray(oldValue) && oldValue.length > 0 ? oldValue.length : 0;
139
+ let startIndex = isArray(oldValue) && oldValue.length > 0 ? oldValue.length : 0
125
140
  // 拼接上原有数据
126
- tempList.value = tempList.value.concat(
127
- cloneData(newVal.slice(startIndex)),
128
- );
129
- splitData();
141
+ tempList.value = tempList.value.concat(cloneData(newVal.slice(startIndex)))
142
+ splitData()
130
143
  }
131
144
  },
132
145
  { immediate: true },
133
- );
146
+ )
134
147
 
135
148
  /**
136
149
  * @description 清除某一条指定的数据,根据id实现
137
150
  * */
138
151
  const remove = (id: string) => {
139
152
  // 如果findIndex找不到合适的条件,就会返回-1
140
- let index = -1;
141
- index = leftList.value.findIndex((val) => val[idKey.value] == id);
153
+ let index = -1
154
+ index = leftList.value.findIndex((val) => val[idKey.value] == id)
142
155
  if (index != -1) {
143
156
  // 如果index不等于-1,说明已经找到了要找的id,根据index索引删除这一条数据
144
- leftList.value.splice(index, 1);
157
+ leftList.value.splice(index, 1)
145
158
  } else {
146
159
  // 同理于上方面的方法
147
- index = rightList.value.findIndex((val) => val[idKey.value] == id);
148
- if (index != -1) rightList.value.splice(index, 1);
160
+ index = rightList.value.findIndex((val) => val[idKey.value] == id)
161
+ if (index != -1) rightList.value.splice(index, 1)
149
162
  }
150
163
  // 同时清除父组件的数据中的对应id的条目
151
- index = modelValue.value.findIndex((val) => val[idKey.value] == id);
152
- if (index != -1) emit("update:modelValue", modelValue.value.splice(index, 1));
153
- };
164
+ index = modelValue.value.findIndex((val) => val[idKey.value] == id)
165
+ if (index != -1) emit('update:modelValue', modelValue.value.splice(index, 1))
166
+ }
154
167
  /**
155
168
  * @description 修改某条数据的某个属性
156
169
  * @param id 唯一值
@@ -159,34 +172,34 @@ const remove = (id: string) => {
159
172
  * */
160
173
  const modify = (id: string, key: string, value: Record<string, any>[]) => {
161
174
  // 如果findIndex找不到合适的条件,就会返回-1
162
- let index = -1;
163
- index = leftList.value.findIndex((val) => val[idKey.value] == id);
175
+ let index = -1
176
+ index = leftList.value.findIndex((val) => val[idKey.value] == id)
164
177
  if (index != -1) {
165
178
  // 如果index不等于-1,说明已经找到了要找的id,修改对应key的值
166
- leftList.value[index][key] = value;
179
+ leftList.value[index][key] = value
167
180
  } else {
168
181
  // 同理于上方面的方法
169
- index = rightList.value.findIndex((val) => val[idKey.value] == id);
170
- if (index != -1) rightList.value[index][key] = value;
182
+ index = rightList.value.findIndex((val) => val[idKey.value] == id)
183
+ if (index != -1) rightList.value[index][key] = value
171
184
  }
172
185
  // 修改父组件的数据中的对应id的条目
173
- index = modelValue.value.findIndex((val) => val[idKey.value] == id);
186
+ index = modelValue.value.findIndex((val) => val[idKey.value] == id)
174
187
  if (index != -1) {
175
188
  // 首先复制一份value的数据
176
- const data = cloneData(modelValue.value);
189
+ const data = cloneData(modelValue.value)
177
190
  // 修改对应索引的key属性的值为value
178
- data[index][key] = value;
191
+ data[index][key] = value
179
192
  // 修改父组件通过v-model绑定的变量的值
180
- emit("update:modelValue", data);
193
+ emit('update:modelValue', data)
181
194
  }
182
- };
195
+ }
183
196
 
184
197
  defineExpose({
185
198
  remove,
186
199
  clear,
187
- });
200
+ })
188
201
  </script>
189
202
 
190
203
  <style lang="scss" scoped>
191
- @import "./index.scss";
204
+ @import './index.scss';
192
205
  </style>
@@ -15,6 +15,11 @@
15
15
  </template>
16
16
 
17
17
  <script lang="ts">
18
+ /**
19
+ * 在页面或组件上添加指定的图片或文字,可用于版权保护、品牌宣传等场景。
20
+ * @displayName hy-watermark
21
+ */
22
+ defineOptions({})
18
23
  export default {
19
24
  name: 'hy-watermark',
20
25
  options: {
@@ -28,11 +33,83 @@ export default {
28
33
  <script lang="ts" setup>
29
34
  import { computed, onMounted, ref, watch, nextTick, type CSSProperties, toRefs } from 'vue'
30
35
  import { addUnit, guid } from '../../utils'
31
- import type IProps from './typing'
32
- import defaultProps from './props'
33
36
 
34
- const props = withDefaults(defineProps<IProps>(), defaultProps)
35
- const { customStyle } = toRefs(props)
37
+ // const props = withDefaults(defineProps<IProps>(), defaultProps)
38
+ const props = defineProps({
39
+ /** 显示内容 */
40
+ content: String,
41
+ /** 显示图片的地址,支持网络图片和base64(钉钉小程序仅支持网络图片) */
42
+ image: String,
43
+ /** 图片高度 */
44
+ imageHeight: {
45
+ type: Number,
46
+ default: 50,
47
+ },
48
+ /** 图片宽度 */
49
+ imageWidth: {
50
+ type: Number,
51
+ default: 70,
52
+ },
53
+ /** X轴间距,单位px */
54
+ gutterX: {
55
+ type: Number,
56
+ default: 0,
57
+ },
58
+ /** Y轴间距,单位px */
59
+ gutterY: {
60
+ type: Number,
61
+ default: 0,
62
+ },
63
+ /** canvas画布宽度,单位px */
64
+ width: {
65
+ type: Number,
66
+ default: 100,
67
+ },
68
+ /** canvas画布高度,单位px */
69
+ height: {
70
+ type: Number,
71
+ default: 100,
72
+ },
73
+ /** 是否为全屏水印 */
74
+ fullScreen: {
75
+ type: Boolean,
76
+ default: true,
77
+ },
78
+ /** 水印字体颜色 */
79
+ color: {
80
+ type: String,
81
+ default: '#8c8c8c',
82
+ },
83
+ /** 水印字体大小,单位px */
84
+ size: {
85
+ type: Number,
86
+ default: 14,
87
+ },
88
+ /** 水印字体样式(仅微信和h5支持) */
89
+ fontStyle: String,
90
+ /** 水印字体的粗细 */
91
+ fontWeight: String,
92
+ /** 水印字体系列(仅微信和h5支持) */
93
+ fontFamily: {
94
+ type: String,
95
+ default: 'PingFang SC',
96
+ },
97
+ /** 水印旋转角度 */
98
+ rotate: {
99
+ type: Number,
100
+ default: -25,
101
+ },
102
+ /** 自定义层级 */
103
+ zIndex: {
104
+ type: Number,
105
+ default: 10086,
106
+ },
107
+ /** 自定义透明度,取值 0~1 */
108
+ opacity: {
109
+ type: Number,
110
+ default: 0.5,
111
+ },
112
+ })
36
113
 
37
114
  watch(
38
115
  () => props,
@@ -74,7 +151,7 @@ const rootStyle = computed(() => {
74
151
  if (waterMarkUrl.value) {
75
152
  style['backgroundImage'] = `url('${waterMarkUrl.value}')`
76
153
  }
77
- return Object.assign(style, customStyle.value)
154
+ return style
78
155
  })
79
156
 
80
157
  onMounted(() => {
@@ -1,76 +1,76 @@
1
- import type { CSSProperties } from "vue";
1
+ import type { CSSProperties } from 'vue'
2
2
 
3
3
  export default interface HyOverlayProps {
4
4
  /**
5
5
  * @description 显示内容
6
6
  * */
7
- content?: string;
7
+ content?: string
8
8
  /**
9
9
  * @description 显示图片的地址,支持网络图片和base64(钉钉小程序仅支持网络图片)
10
10
  * */
11
- image?: string;
11
+ image?: string
12
12
  /**
13
13
  * @description 图片高度
14
14
  * */
15
- imageHeight?: number;
15
+ imageHeight?: number
16
16
  /**
17
- * @description 图片高度
17
+ * @description 图片宽度
18
18
  * */
19
- imageWidth?: number;
19
+ imageWidth?: number
20
20
  /**
21
21
  * @description X轴间距,单位px
22
22
  * */
23
- gutterX?: number;
23
+ gutterX?: number
24
24
  /**
25
25
  * @description Y轴间距,单位px
26
26
  * */
27
- gutterY?: number;
27
+ gutterY?: number
28
28
  /**
29
29
  * @description canvas画布宽度,单位px
30
30
  * */
31
- width?: number;
31
+ width?: number
32
32
  /**
33
33
  * @description canvas画布高度,单位px
34
34
  * */
35
- height?: number;
35
+ height?: number
36
36
  /**
37
37
  * @description 是否为全屏水印
38
38
  * */
39
- fullScreen?: boolean;
39
+ fullScreen?: boolean
40
40
  /**
41
41
  * @description 水印字体颜色
42
42
  * */
43
- color?: string;
43
+ color?: string
44
44
  /**
45
45
  * @description 水印字体大小,单位px
46
46
  * */
47
- size?: number;
47
+ size?: number
48
48
  /**
49
49
  * @description 水印字体样式(仅微信和h5支持),可能的值:normal、italic、oblique
50
50
  * */
51
- fontStyle?: string;
51
+ fontStyle?: string
52
52
  /**
53
53
  * @description 水印字体的粗细(仅微信和h5支持)
54
54
  * */
55
- fontWeight?: string;
55
+ fontWeight?: string
56
56
  /**
57
57
  * @description 水印字体系列(仅微信和h5支持)
58
58
  * */
59
- fontFamily?: string;
59
+ fontFamily?: string
60
60
  /**
61
61
  * @description 水印旋转角度
62
62
  * */
63
- rotate?: number;
63
+ rotate?: number
64
64
  /**
65
65
  * @description 自定义层级
66
66
  * */
67
- zIndex?: number;
67
+ zIndex?: number
68
68
  /**
69
69
  * @description 自定义透明度,取值 0~1
70
70
  * */
71
- opacity?: number;
71
+ opacity?: number
72
72
  /**
73
73
  * @description 定义需要用到的外部样式
74
74
  * */
75
- customStyle?: CSSProperties;
75
+ customStyle?: CSSProperties
76
76
  }
package/global.d.ts CHANGED
@@ -2,99 +2,79 @@ declare module 'vue' {
2
2
  // Helper for Volar
3
3
  export interface GlobalComponents {
4
4
  HyActionSheet: (typeof import('./components/hy-action-sheet/hy-action-sheet.vue'))['default']
5
+ HyAddressPicker: (typeof import('./components/hy-address-picker/hy-address-picker.vue'))['default']
6
+ HyAvatar: (typeof import('./components/hy-avatar/hy-avatar.vue'))['default']
7
+ HyBackTop: (typeof import('./components/hy-back-top/hy-back-top.vue'))['default']
5
8
  HyBadge: (typeof import('./components/hy-badge/hy-badge.vue'))['default']
6
9
  HyButton: (typeof import('./components/hy-button/hy-button.vue'))['default']
7
10
  HyCalendar: (typeof import('./components/hy-calendar/hy-calendar.vue'))['default']
8
- HyCalendarView: (typeof import('./components/hy-calendar-view/hy-calendar-view.vue'))['default']
9
11
  HyCard: (typeof import('./components/hy-card/hy-card.vue'))['default']
10
12
  HyCell: (typeof import('./components/hy-cell/hy-cell.vue'))['default']
11
- HyCellGroup: (typeof import('./components/hy-cell-group/hy-cell-group.vue'))['default']
13
+ HyCheckButton: (typeof import('./components/hy-check-button/hy-check-button.vue'))['default']
12
14
  HyCheckbox: (typeof import('./components/hy-checkbox/hy-checkbox.vue'))['default']
13
- HyCheckboxGroup: (typeof import('./components/hy-checkbox-group/hy-checkbox-group.vue'))['default']
14
- HyCol: (typeof import('./components/hy-col/hy-col.vue'))['default']
15
- HyColPicker: (typeof import('./components/hy-col-picker/hy-col-picker.vue'))['default']
16
- HyCollapse: (typeof import('./components/hy-collapse/hy-collapse.vue'))['default']
17
- HyCollapseItem: (typeof import('./components/hy-collapse-item/hy-collapse-item.vue'))['default']
15
+ HyCodeInput: (typeof import('./components/hy-code-input/hy-code-input.vue'))['default']
18
16
  HyConfigProvider: (typeof import('./components/hy-config-provider/hy-config-provider.vue'))['default']
19
- HyCurtain: (typeof import('./components/hy-curtain/hy-curtain.vue'))['default']
17
+ HyCountDown: (typeof import('./components/hy-count-down/hy-count-down.vue'))['default']
18
+ HyCountTo: (typeof import('./components/hy-count-to/hy-count-to.vue'))['default']
20
19
  HyDatetimePicker: (typeof import('./components/hy-datetime-picker/hy-datetime-picker.vue'))['default']
21
20
  HyDatetimePickerView: (typeof import('./components/hy-datetime-picker-view/hy-datetime-picker-view.vue'))['default']
22
21
  HyDivider: (typeof import('./components/hy-divider/hy-divider.vue'))['default']
23
- HyDropMenu: (typeof import('./components/hy-drop-menu/hy-drop-menu.vue'))['default']
24
- HyDropMenuItem: (typeof import('./components/hy-drop-menu-item/hy-drop-menu-item.vue'))['default']
22
+ HyDropdown: (typeof import('./components/hy-dropdown/hy-dropdown.vue'))['default']
23
+ HyDropdownItem: (typeof import('./components/hy-dropdown-item/hy-dropdown-item.vue'))['default']
24
+ HyEmpty: (typeof import('./components/hy-empty/hy-empty.vue'))['default']
25
+ HyFloatButton: (typeof import('./components/hy-float-button/hy-float-button.vue'))['default']
26
+ HyFloatingPanel: (typeof import('./components/hy-floating-panel/hy-floating-panel.vue'))['default']
27
+ HyForm: (typeof import('./components/hy-form/hy-form.vue'))['default']
25
28
  HyGrid: (typeof import('./components/hy-grid/hy-grid.vue'))['default']
26
- HyGridItem: (typeof import('./components/hy-grid-item/hy-grid-item.vue'))['default']
27
29
  HyIcon: (typeof import('./components/hy-icon/hy-icon.vue'))['default']
28
- HyImg: (typeof import('./components/hy-img/hy-img.vue'))['default']
29
- HyImgCropper: (typeof import('./components/hy-img-cropper/hy-img-cropper.vue'))['default']
30
+ HyImage: (typeof import('./components/hy-image/hy-image.vue'))['default']
30
31
  HyInput: (typeof import('./components/hy-input/hy-input.vue'))['default']
31
- HyInputNumber: (typeof import('./components/hy-input-number/hy-input-number.vue'))['default']
32
+ HyLine: (typeof import('./components/hy-line/hy-line.vue'))['default']
33
+ HyLineProgress: (typeof import('./components/hy-line-progress/hy-line-progress.vue'))['default']
34
+ HyList: (typeof import('./components/hy-list/hy-list.vue'))['default']
32
35
  HyLoading: (typeof import('./components/hy-loading/hy-loading.vue'))['default']
33
- HyLoadmore: (typeof import('./components/hy-loadmore/hy-loadmore.vue'))['default']
34
- HyMessageBox: (typeof import('./components/hy-message-box/hy-message-box.vue'))['default']
35
- HyOverlay: (typeof import('./components/hy-overlay/hy-overlay.vue'))['default']
36
+ HyLogin: (typeof import('./components/hy-login/hy-login.vue'))['default']
37
+ HyMenu: (typeof import('./components/hy-menu/hy-menu.vue'))['default']
38
+ HyModal: (typeof import('./components/hy-modal/hy-modal.vue'))['default']
39
+ HyNavbar: (typeof import('./components/hy-navbar/hy-navbar.vue'))['default']
36
40
  HyNoticeBar: (typeof import('./components/hy-notice-bar/hy-notice-bar.vue'))['default']
41
+ HyNotify: (typeof import('./components/hy-notify/hy-notify.vue'))['default']
42
+ HyNumberStep: (typeof import('./components/hy-number-step/hy-number-step.vue'))['default']
43
+ HyOverlay: (typeof import('./components/hy-overlay/hy-overlay.vue'))['default']
37
44
  HyPagination: (typeof import('./components/hy-pagination/hy-pagination.vue'))['default']
45
+ HyParse: (typeof import('./components/hy-parse/hy-parse.vue'))['default']
38
46
  HyPicker: (typeof import('./components/hy-picker/hy-picker.vue'))['default']
39
- HyPickerView: (typeof import('./components/hy-picker-view/hy-picker-view.vue'))['default']
40
47
  HyPopover: (typeof import('./components/hy-popover/hy-popover.vue'))['default']
41
48
  HyPopup: (typeof import('./components/hy-popup/hy-popup.vue'))['default']
42
- HyProgress: (typeof import('./components/hy-progress/hy-progress.vue'))['default']
49
+ HyPrice: (typeof import('./components/hy-price/hy-price.vue'))['default']
50
+ HyQrcode: (typeof import('./components/hy-qrcode/hy-qrcode.vue'))['default']
43
51
  HyRadio: (typeof import('./components/hy-radio/hy-radio.vue'))['default']
44
- HyRadioGroup: (typeof import('./components/hy-radio-group/hy-radio-group.vue'))['default']
45
52
  HyRate: (typeof import('./components/hy-rate/hy-rate.vue'))['default']
46
- HyResize: (typeof import('./components/hy-resize/hy-resize.vue'))['default']
47
- HyRow: (typeof import('./components/hy-row/hy-row.vue'))['default']
53
+ HyReadMore: (typeof import('./components/hy-read-more/hy-read-more.vue'))['default']
54
+ HyScrollList: (typeof import('./components/hy-scroll-list/hy-scroll-list.vue'))['default']
48
55
  HySearch: (typeof import('./components/hy-search/hy-search.vue'))['default']
49
- HySelectPicker: (typeof import('./components/hy-select-picker/hy-select-picker.vue'))['default']
56
+ HySignature: (typeof import('./components/hy-signature/hy-signature.vue'))['default']
50
57
  HySlider: (typeof import('./components/hy-slider/hy-slider.vue'))['default']
51
- HySortButton: (typeof import('./components/hy-sort-button/hy-sort-button.vue'))['default']
52
- HyStatusTip: (typeof import('./components/hy-status-tip/hy-status-tip.vue'))['default']
53
- HyStep: (typeof import('./components/hy-step/hy-step.vue'))['default']
58
+ HyStatusBar: (typeof import('./components/hy-status-bar/hy-status-bar.vue'))['default']
54
59
  HySteps: (typeof import('./components/hy-steps/hy-steps.vue'))['default']
55
60
  HySticky: (typeof import('./components/hy-sticky/hy-sticky.vue'))['default']
56
- HyStickyBox: (typeof import('./components/hy-sticky-box/hy-sticky-box.vue'))['default']
61
+ HySubmitBar: (typeof import('./components/hy-submit-bar/hy-submit-bar.vue'))['default']
62
+ HySubsection: (typeof import('./components/hy-subsection/hy-subsection.vue'))['default']
57
63
  HySwipeAction: (typeof import('./components/hy-swipe-action/hy-swipe-action.vue'))['default']
64
+ HySwiper: (typeof import('./components/hy-swiper/hy-swiper.vue'))['default']
58
65
  HySwitch: (typeof import('./components/hy-switch/hy-switch.vue'))['default']
59
- HyTab: (typeof import('./components/hy-tab/hy-tab.vue'))['default']
66
+ HyTabBar: (typeof import('./components/hy-tabBar/hy-tabBar.vue'))['default']
60
67
  HyTabs: (typeof import('./components/hy-tabs/hy-tabs.vue'))['default']
61
68
  HyTag: (typeof import('./components/hy-tag/hy-tag.vue'))['default']
69
+ HyTextarea: (typeof import('./components/hy-textarea/hy-textarea.vue'))['default']
70
+ HyText: (typeof import('./components/hy-text/hy-text.vue'))['default']
62
71
  HyToast: (typeof import('./components/hy-toast/hy-toast.vue'))['default']
63
72
  HyTooltip: (typeof import('./components/hy-tooltip/hy-tooltip.vue'))['default']
64
73
  HyTransition: (typeof import('./components/hy-transition/hy-transition.vue'))['default']
65
74
  HyUpload: (typeof import('./components/hy-upload/hy-upload.vue'))['default']
66
- HyNotify: (typeof import('./components/hy-notify/hy-notify.vue'))['default']
75
+ HyWarn: (typeof import('./components/hy-warn/hy-warn.vue'))['default']
76
+ HyWaterfall: (typeof import('./components/hy-waterfall/hy-waterfall.vue'))['default']
67
77
  HyWatermark: (typeof import('./components/hy-watermark/hy-watermark.vue'))['default']
68
- HyCircle: (typeof import('./components/hy-circle/hy-circle.vue'))['default']
69
- HySwiper: (typeof import('./components/hy-swiper/hy-swiper.vue'))['default']
70
- HySwiperNav: (typeof import('./components/hy-swiper-nav/hy-swiper-nav.vue'))['default']
71
- HySegmented: (typeof import('./components/hy-segmented/hy-segmented.vue'))['default']
72
- HyTabbar: (typeof import('./components/hy-tabbar/hy-tabbar.vue'))['default']
73
- HyTabbarItem: (typeof import('./components/hy-tabbar-item/hy-tabbar-item.vue'))['default']
74
- HyNavbar: (typeof import('./components/hy-navbar/hy-navbar.vue'))['default']
75
- HyNavbarCapsule: (typeof import('./components/hy-navbar-capsule/hy-navbar-capsule.vue'))['default']
76
- HyTable: (typeof import('./components/hy-table/hy-table.vue'))['default']
77
- HyTableCol: (typeof import('./components/hy-table-col/hy-table-col.vue'))['default']
78
- HySidebar: (typeof import('./components/hy-sidebar/hy-sidebar.vue'))['default']
79
- HySidebarItem: (typeof import('./components/hy-sidebar-item/hy-sidebar-item.vue'))['default']
80
- HyFab: (typeof import('./components/hy-fab/hy-fab.vue'))['default']
81
- HyCountDown: (typeof import('./components/hy-count-down/hy-count-down.vue'))['default']
82
- HyNumberKeyboard: (typeof import('./components/hy-number-keyboard/hy-number-keyboard.vue'))['default']
83
- HyKeyboard: (typeof import('./components/hy-keyboard/hy-keyboard.vue'))['default']
84
- HyGap: (typeof import('./components/hy-gap/hy-gap.vue'))['default']
85
- HyPasswordInput: (typeof import('./components/hy-password-input/hy-password-input.vue'))['default']
86
- HyForm: (typeof import('./components/hy-form/hy-form.vue'))['default']
87
- HyTextarea: (typeof import('./components/hy-textarea/hy-textarea.vue'))['default']
88
- HyVideoPreview: (typeof import('./components/hy-video-preview/hy-video-preview.vue'))['default']
89
- HyBacktop: (typeof import('./components/hy-backtop/hy-backtop.vue'))['default']
90
- HySkeleton: (typeof import('./components/hy-skeleton/hy-skeleton.vue'))['default']
91
- HyIndexBar: (typeof import('./components/hy-index-bar/hy-index-bar.vue'))['default']
92
- HyIndexAnchor: (typeof import('./components/hy-index-anchor/hy-index-anchor.vue'))['default']
93
- HyText: (typeof import('./components/hy-text/hy-text.vue'))['default']
94
- HyCountTo: (typeof import('./components/hy-count-to/hy-count-to.vue'))['default']
95
- HyFloatingPanel: (typeof import('./components/hy-floating-panel/hy-floating-panel.vue'))['default']
96
- HySignature: (typeof import('./components/hy-signature/hy-signature.vue'))['default']
97
- HyRootPortal: (typeof import('./components/hy-root-portal/hy-root-portal.vue'))['default']
98
78
  }
99
79
  }
100
80