oxy-uni-ui 1.2.3 → 2.0.0

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 (235) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +353 -328
  3. package/components/common/util.ts +185 -32
  4. package/components/composables/index.ts +1 -0
  5. package/components/composables/usePopover.ts +24 -20
  6. package/components/composables/useVirtualScroll.ts +10 -9
  7. package/components/composables/useWindowResize.ts +35 -0
  8. package/components/oxy-action-sheet/index.scss +24 -11
  9. package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
  10. package/components/oxy-action-sheet/types.ts +7 -0
  11. package/components/oxy-backtop/index.scss +3 -3
  12. package/components/oxy-backtop/oxy-backtop.vue +9 -6
  13. package/components/oxy-backtop/types.ts +7 -7
  14. package/components/oxy-badge/index.scss +4 -4
  15. package/components/oxy-badge/oxy-badge.vue +3 -3
  16. package/components/oxy-badge/types.ts +2 -2
  17. package/components/oxy-button/index.scss +5 -5
  18. package/components/oxy-button/oxy-button.vue +5 -1
  19. package/components/oxy-calendar/index.scss +11 -11
  20. package/components/oxy-calendar/oxy-calendar.vue +1 -0
  21. package/components/oxy-calendar/types.ts +5 -0
  22. package/components/oxy-calendar-view/month/index.scss +4 -4
  23. package/components/oxy-calendar-view/month/types.ts +36 -0
  24. package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
  25. package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
  26. package/components/oxy-calendar-view/year/index.scss +4 -4
  27. package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
  28. package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
  29. package/components/oxy-card/index.scss +2 -2
  30. package/components/oxy-cell/index.scss +8 -8
  31. package/components/oxy-checkbox/index.scss +7 -7
  32. package/components/oxy-checkbox-group/index.scss +2 -2
  33. package/components/oxy-circle/oxy-circle.vue +10 -7
  34. package/components/oxy-circle/types.ts +5 -5
  35. package/components/oxy-col/oxy-col.vue +2 -2
  36. package/components/oxy-col-picker/index.scss +4 -4
  37. package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
  38. package/components/oxy-col-picker/types.ts +7 -2
  39. package/components/oxy-collapse/index.scss +2 -2
  40. package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
  41. package/components/oxy-corner/index.scss +32 -32
  42. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  43. package/components/oxy-curtain/index.scss +15 -15
  44. package/components/oxy-curtain/oxy-curtain.vue +4 -2
  45. package/components/oxy-curtain/types.ts +6 -1
  46. package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
  47. package/components/oxy-date-strip/types.ts +1 -1
  48. package/components/oxy-date-strip-item/index.scss +3 -3
  49. package/components/oxy-datetime-picker/index.scss +11 -11
  50. package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
  51. package/components/oxy-datetime-picker/types.ts +5 -0
  52. package/components/oxy-drop-menu/index.scss +3 -3
  53. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
  54. package/components/oxy-drop-menu-item/index.scss +1 -1
  55. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
  56. package/components/oxy-drop-menu-item/types.ts +5 -0
  57. package/components/oxy-echarts/types.ts +6 -0
  58. package/components/oxy-fab/index.scss +8 -8
  59. package/components/oxy-fab/oxy-fab.vue +22 -3
  60. package/components/oxy-file-list/index.scss +24 -23
  61. package/components/oxy-file-list/oxy-file-list.vue +2 -2
  62. package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
  63. package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
  64. package/components/oxy-footer/index.scss +19 -0
  65. package/components/oxy-footer/oxy-footer.vue +78 -0
  66. package/components/oxy-footer/types.ts +17 -0
  67. package/components/oxy-form-item/types.ts +22 -1
  68. package/components/oxy-gap/oxy-gap.vue +2 -2
  69. package/components/oxy-gap/types.ts +2 -2
  70. package/components/oxy-grid/oxy-grid.vue +1 -1
  71. package/components/oxy-grid/types.ts +1 -1
  72. package/components/oxy-grid-item/index.scss +1 -1
  73. package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
  74. package/components/oxy-grid-item/types.ts +1 -1
  75. package/components/oxy-guidance/index.scss +75 -0
  76. package/components/oxy-guidance/oxy-guidance.vue +201 -0
  77. package/components/oxy-guidance/types.ts +33 -0
  78. package/components/oxy-icon/oxy-icon.vue +2 -2
  79. package/components/oxy-icon/types.ts +1 -1
  80. package/components/oxy-img/oxy-img.vue +4 -4
  81. package/components/oxy-img/types.ts +3 -3
  82. package/components/oxy-img-cropper/index.scss +12 -12
  83. package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
  84. package/components/oxy-img-cropper/types.ts +2 -2
  85. package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
  86. package/components/oxy-img-lazy/types.ts +3 -3
  87. package/components/oxy-index-anchor/index.scss +2 -2
  88. package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
  89. package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
  90. package/components/oxy-index-bar/index.scss +3 -3
  91. package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
  92. package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
  93. package/components/oxy-input/index.scss +1 -1
  94. package/components/oxy-input-number/index.scss +5 -5
  95. package/components/oxy-input-number/oxy-input-number.vue +2 -2
  96. package/components/oxy-input-number/types.ts +3 -2
  97. package/components/oxy-keyboard/index.scss +5 -5
  98. package/components/oxy-keyboard/key/index.scss +3 -3
  99. package/components/oxy-keyboard/key/index.vue +2 -2
  100. package/components/oxy-keyboard/key/types.ts +15 -0
  101. package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
  102. package/components/oxy-keyboard/types.ts +5 -0
  103. package/components/oxy-link/index.scss +2 -2
  104. package/components/oxy-list/oxy-list.vue +4 -3
  105. package/components/oxy-loading/oxy-loading.vue +8 -4
  106. package/components/oxy-loading/types.ts +1 -1
  107. package/components/oxy-loadmore/index.scss +3 -3
  108. package/components/oxy-long-press-menu/index.scss +93 -0
  109. package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
  110. package/components/oxy-long-press-menu/types.ts +34 -0
  111. package/components/oxy-message-box/index.scss +12 -11
  112. package/components/oxy-message-box/oxy-message-box.vue +11 -3
  113. package/components/oxy-message-box/types.ts +14 -0
  114. package/components/oxy-navbar/index.scss +2 -2
  115. package/components/oxy-navbar/oxy-navbar.vue +58 -13
  116. package/components/oxy-navbar/types.ts +8 -1
  117. package/components/oxy-navbar-capsule/types.ts +3 -0
  118. package/components/oxy-notice-bar/index.scss +3 -3
  119. package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
  120. package/components/oxy-notice-bar/types.ts +3 -3
  121. package/components/oxy-notify/index.ts +1 -0
  122. package/components/oxy-notify/oxy-notify.vue +3 -2
  123. package/components/oxy-notify/types.ts +7 -0
  124. package/components/oxy-pagination/index.scss +1 -1
  125. package/components/oxy-password-input/oxy-password-input.vue +2 -2
  126. package/components/oxy-password-input/types.ts +1 -1
  127. package/components/oxy-picker/index.scss +45 -2
  128. package/components/oxy-picker/oxy-picker.vue +100 -14
  129. package/components/oxy-picker/types.ts +29 -1
  130. package/components/oxy-picker-view/index.scss +3 -3
  131. package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
  132. package/components/oxy-popover/index.scss +9 -9
  133. package/components/oxy-popup/index.scss +2 -2
  134. package/components/oxy-popup/oxy-popup.vue +35 -2
  135. package/components/oxy-popup/types.ts +8 -1
  136. package/components/oxy-progress/index.scss +3 -3
  137. package/components/oxy-qrcode/draw.ts +398 -0
  138. package/components/oxy-qrcode/index.scss +2 -0
  139. package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
  140. package/components/oxy-qrcode/qrcode.ts +936 -0
  141. package/components/oxy-qrcode/types.ts +42 -0
  142. package/components/oxy-radio/index.scss +10 -10
  143. package/components/oxy-radio-group/index.scss +2 -2
  144. package/components/oxy-rate/types.ts +4 -4
  145. package/components/oxy-resize/index.scss +2 -2
  146. package/components/oxy-resize/oxy-resize.vue +4 -4
  147. package/components/oxy-resize/types.ts +3 -0
  148. package/components/oxy-rich-text/index.scss +30 -29
  149. package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
  150. package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
  151. package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
  152. package/components/oxy-rich-text/types.ts +6 -1
  153. package/components/oxy-row/oxy-row.vue +3 -3
  154. package/components/oxy-row/types.ts +1 -1
  155. package/components/oxy-search/index.scss +3 -3
  156. package/components/oxy-segmented/index.scss +16 -16
  157. package/components/oxy-segmented/oxy-segmented.vue +23 -3
  158. package/components/oxy-select/index.scss +144 -68
  159. package/components/oxy-select/oxy-select.vue +85 -50
  160. package/components/oxy-select/types.ts +13 -1
  161. package/components/oxy-select-picker/index.scss +7 -7
  162. package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
  163. package/components/oxy-select-picker/types.ts +2 -0
  164. package/components/oxy-sidebar-item/index.scss +1 -1
  165. package/components/oxy-signature/oxy-signature.vue +18 -10
  166. package/components/oxy-signature/types.ts +106 -13
  167. package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
  168. package/components/oxy-skeleton/types.ts +1 -1
  169. package/components/oxy-slider/index.scss +3 -3
  170. package/components/oxy-sort-button/index.scss +8 -8
  171. package/components/oxy-status-tip/index.scss +4 -4
  172. package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
  173. package/components/oxy-status-tip/types.ts +3 -3
  174. package/components/oxy-step/index.scss +14 -14
  175. package/components/oxy-sticky/oxy-sticky.vue +6 -6
  176. package/components/oxy-stream-render/types.ts +4 -1
  177. package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
  178. package/components/oxy-swiper/oxy-swiper.vue +6 -6
  179. package/components/oxy-swiper/types.ts +5 -5
  180. package/components/oxy-switch/index.scss +8 -8
  181. package/components/oxy-switch/oxy-switch.vue +2 -2
  182. package/components/oxy-switch/types.ts +1 -1
  183. package/components/oxy-tab/index.scss +11 -1
  184. package/components/oxy-tabbar/index.scss +1 -1
  185. package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
  186. package/components/oxy-table/index.scss +5 -5
  187. package/components/oxy-table/oxy-table.vue +8 -6
  188. package/components/oxy-table/types.ts +2 -2
  189. package/components/oxy-table-col/oxy-table-col.vue +3 -3
  190. package/components/oxy-table-col/types.ts +2 -2
  191. package/components/oxy-tabs/index.scss +43 -15
  192. package/components/oxy-tabs/oxy-tabs.vue +53 -19
  193. package/components/oxy-tabs/types.ts +15 -3
  194. package/components/oxy-tag/index.scss +15 -15
  195. package/components/oxy-text/index.scss +5 -1
  196. package/components/oxy-text/oxy-text.vue +76 -7
  197. package/components/oxy-text/types.ts +12 -0
  198. package/components/oxy-textarea/index.scss +6 -6
  199. package/components/oxy-toast/oxy-toast.vue +24 -8
  200. package/components/oxy-tooltip/index.scss +9 -9
  201. package/components/oxy-tree/index.scss +51 -15
  202. package/components/oxy-tree/oxy-tree.vue +13 -9
  203. package/components/oxy-tree/types.ts +12 -9
  204. package/components/oxy-upload/index.scss +21 -21
  205. package/components/oxy-upload/types.ts +2 -2
  206. package/components/oxy-verification-code/index.scss +6 -0
  207. package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
  208. package/components/oxy-verification-code/types.ts +82 -0
  209. package/components/oxy-video-preview/index.scss +4 -4
  210. package/components/oxy-virtual-scroll/index.scss +4 -4
  211. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
  212. package/components/oxy-virtual-scroll/types.ts +14 -14
  213. package/components/oxy-voice-player/index.scss +908 -0
  214. package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
  215. package/components/oxy-voice-player/types.ts +567 -0
  216. package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
  217. package/components/oxy-waterfall/types.ts +6 -6
  218. package/components/oxy-watermark/oxy-watermark.vue +35 -13
  219. package/components/oxy-watermark/types.ts +14 -14
  220. package/global.d.ts +2 -0
  221. package/locale/lang/ar-SA.ts +3 -0
  222. package/locale/lang/en-US.ts +3 -0
  223. package/locale/lang/zh-CN.ts +3 -0
  224. package/package.json +97 -1
  225. package/tags.json +1 -1
  226. package/web-types.json +1 -1
  227. package/components/oxy-number-keyboard/index.scss +0 -78
  228. package/components/oxy-number-keyboard/key/index.scss +0 -81
  229. package/components/oxy-number-keyboard/key/index.vue +0 -78
  230. package/components/oxy-number-keyboard/key/types.ts +0 -11
  231. package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
  232. package/components/oxy-number-keyboard/types.ts +0 -83
  233. package/components/oxy-tree/components/tree-node-content.vue +0 -72
  234. package/components/oxy-tree/index.ts +0 -51
  235. package/oxy-uni-ui.zip +0 -0
@@ -1,78 +0,0 @@
1
- @import "./../common/abstracts/_mixin.scss";
2
- @import "./../common/abstracts/variable.scss";
3
-
4
- .oxy-theme-dark {
5
- @include b(number-keyboard) {
6
- background: $-dark-background5;
7
-
8
- @include e(header){
9
- color: $-dark-color;
10
- }
11
- }
12
- }
13
-
14
- @include b(number-keyboard) {
15
- width: 100%;
16
- background: $-number-keyboard-background;
17
- color: $-color-black;
18
- user-select: none;
19
-
20
- @include m(with-title) {
21
- border-radius: 20px 20px 0 0;
22
- }
23
-
24
- @include e(header) {
25
- position: relative;
26
- display: flex;
27
- align-items: center;
28
- justify-content: center;
29
- box-sizing: content-box;
30
- height: $-number-keyboard-title-height;
31
- padding-top: 6px;
32
- color: $-number-keyboard-title-color;
33
- font-size: $-number-keyboard-title-font-size;
34
- }
35
-
36
- @include e(title) {
37
- display: inline-block;
38
- font-weight: normal;
39
-
40
- &-left {
41
- position: absolute;
42
- left: 0;
43
- }
44
- }
45
-
46
- @include e(body) {
47
- display: flex;
48
- padding: 6px 0 0 6px;
49
- }
50
-
51
- @include e(keys) {
52
- display: flex;
53
- flex: 3;
54
- flex-wrap: wrap;
55
- }
56
-
57
- @include e(close) {
58
- position: absolute;
59
- display: flex;
60
- align-items: center;
61
- right: 0;
62
- height: 100%;
63
- padding: $-number-keyboard-close-padding;
64
- color: $-number-keyboard-close-color;
65
- font-size: $-number-keyboard-close-font-size;
66
- background-color: transparent;
67
- border: none;
68
- @include m(hover){
69
- opacity: 0.6;
70
- }
71
- }
72
-
73
- @include e(sidebar) {
74
- display: flex;
75
- flex: 1;
76
- flex-direction: column;
77
- }
78
- }
@@ -1,81 +0,0 @@
1
- @import "./../../common/abstracts/_mixin.scss";
2
- @import "./../../common/abstracts/variable.scss";
3
-
4
- .oxy-theme-dark {
5
- @include b(key) {
6
- background: $-dark-background2;
7
- color: $-dark-color;
8
-
9
- &:active {
10
- background-color: $-dark-background4;
11
- }
12
-
13
- @include m(active) {
14
- background-color: $-dark-background4;
15
- }
16
-
17
- }
18
- }
19
-
20
- .oxy-key-wrapper {
21
- position: relative;
22
- flex: 1;
23
- flex-basis: 33%;
24
- box-sizing: border-box;
25
- padding: 0 6px 6px 0;
26
-
27
- @include m(wider) {
28
- flex-basis: 66%;
29
- }
30
- }
31
-
32
- @include b(key) {
33
- display: flex;
34
- align-items: center;
35
- justify-content: center;
36
- height: $-number-keyboard-key-height;
37
- font-size: $-number-keyboard-key-font-size;
38
- line-height: 1.5;
39
- background: $-number-keyboard-key-background;
40
- border-radius: $-number-keyboard-key-border-radius;
41
-
42
- &:active {
43
- background-color: $-number-keyboard-key-active-color;
44
- }
45
-
46
- @include m(large) {
47
- position: absolute;
48
- top: 0;
49
- right: 6px;
50
- bottom: 6px;
51
- left: 0;
52
- height: auto;
53
- }
54
-
55
- @include m(delete, close) {
56
- font-size: $-number-keyboard-delete-font-size;
57
- }
58
-
59
- @include m(active) {
60
- background-color: $-number-keyboard-key-active-color;
61
- }
62
-
63
- @include m(close) {
64
- color: $-number-keyboard-button-text-color;
65
- background: $-number-keyboard-button-background;
66
-
67
- &:active {
68
- background: $-number-keyboard-button-background;
69
- opacity: $-number-keyboard-button-active-opacity;
70
- }
71
- }
72
-
73
- @include edeep(loading-icon) {
74
- color: $-number-keyboard-button-text-color;
75
- }
76
-
77
- @include edeep(icon) {
78
- font-size: $-number-keyboard-icon-size;
79
- }
80
-
81
- }
@@ -1,78 +0,0 @@
1
- <template>
2
- <view
3
- :class="`oxy-key-wrapper ${wider ? 'oxy-key-wrapper--wider' : ''}`"
4
- @touchstart="onTouchStart"
5
- @touchmove="onTouchMove"
6
- @touchend="onTouchEnd"
7
- >
8
- <view :class="keyClass">
9
- <oxy-loading custom-class="oxy-key__loading-icon" v-if="props.loading" />
10
- <template v-if="type === 'delete'">
11
- <template v-if="text">
12
- {{ text }}
13
- </template>
14
- <oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-delete" size="22px"></oxy-icon>
15
- </template>
16
- <template v-else-if="type === 'extra'">
17
- <template v-if="text">
18
- {{ text }}
19
- </template>
20
- <oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-collapse" size="22px"></oxy-icon>
21
- </template>
22
- <template v-else>{{ text }}</template>
23
- </view>
24
- </view>
25
- </template>
26
- <script lang="ts">
27
- export default {
28
- name: 'oxy-key',
29
- options: {
30
- virtualHost: true,
31
- addGlobalClass: true,
32
- styleIsolation: 'shared'
33
- }
34
- }
35
- </script>
36
-
37
- <script lang="ts" setup>
38
- import OxyLoading from '../../oxy-loading/oxy-loading.vue'
39
- import OxyIcon from '../../oxy-icon/oxy-icon.vue'
40
- import { computed, ref } from 'vue'
41
- import { useTouch } from '../../composables/useTouch'
42
- import { keyProps } from './types'
43
-
44
- const props = defineProps(keyProps)
45
- const emit = defineEmits(['press'])
46
-
47
- const touch = useTouch()
48
- const active = ref<boolean>(false)
49
-
50
- const keyClass = computed(() => {
51
- return `oxy-key ${props.large ? 'oxy-key--large' : ''} ${props.type === 'delete' ? 'oxy-key--delete' : ''} ${
52
- props.type === 'close' ? 'oxy-key--close' : ''
53
- }`
54
- })
55
-
56
- function onTouchStart(event: TouchEvent) {
57
- touch.touchStart(event)
58
- active.value = true
59
- }
60
-
61
- function onTouchMove(event: TouchEvent) {
62
- touch.touchMove(event)
63
- if (touch.direction.value) {
64
- active.value = false
65
- }
66
- }
67
-
68
- function onTouchEnd() {
69
- if (active.value) {
70
- active.value = false
71
- emit('press', props.text, props.type)
72
- }
73
- }
74
- </script>
75
-
76
- <style lang="scss">
77
- @import './index.scss';
78
- </style>
@@ -1,11 +0,0 @@
1
- import { makeBooleanProp, makeNumericProp, makeStringProp } from '../../common/props'
2
-
3
- export type NumberKeyType = '' | 'delete' | 'extra' | 'close'
4
-
5
- export const keyProps = {
6
- type: makeStringProp<NumberKeyType>(''),
7
- text: makeNumericProp(''),
8
- wider: makeBooleanProp(false),
9
- large: makeBooleanProp(false),
10
- loading: makeBooleanProp(false)
11
- }
@@ -1,151 +0,0 @@
1
- <template>
2
- <oxy-popup
3
- v-model="show"
4
- position="bottom"
5
- :z-index="zIndex"
6
- :safe-area-inset-bottom="safeAreaInsetBottom"
7
- :modal-style="modal ? '' : 'opacity: 0;'"
8
- :modal="hideOnClickOutside"
9
- :lockScroll="lockScroll"
10
- :root-portal="rootPortal"
11
- @click-modal="handleClose"
12
- >
13
- <view :class="`oxy-number-keyboard ${customClass}`" :style="customStyle">
14
- <view class="oxy-number-keyboard__header" v-if="showHeader">
15
- <slot name="title" v-if="showTitle">
16
- <text class="oxy-number-keyboard__title">{{ title }}</text>
17
- </slot>
18
- <view class="oxy-number-keyboard__close" hover-class="oxy-number-keyboard__close--hover" v-if="showClose" @click="handleClose">
19
- <text>{{ closeText }}</text>
20
- </view>
21
- </view>
22
- <view class="oxy-number-keyboard__body">
23
- <view class="oxy-number-keyboard__keys">
24
- <oxy-key v-for="key in keys" :key="key.text" :text="key.text" :type="key.type" :wider="key.wider" @press="handlePress"></oxy-key>
25
- </view>
26
- <view class="oxy-number-keyboard__sidebar" v-if="mode === 'custom'">
27
- <oxy-key v-if="showDeleteKey" large :text="deleteText" type="delete" @press="handlePress"></oxy-key>
28
- <oxy-key large :text="closeText" type="close" :loading="closeButtonLoading" @press="handlePress"></oxy-key>
29
- </view>
30
- </view>
31
- </view>
32
- </oxy-popup>
33
- </template>
34
- <script lang="ts">
35
- export default {
36
- name: 'oxy-number-keyboard',
37
- options: {
38
- virtualHost: true,
39
- addGlobalClass: true,
40
- styleIsolation: 'shared'
41
- }
42
- }
43
- </script>
44
-
45
- <script lang="ts" setup>
46
- import OxyPopup from '../oxy-popup/oxy-popup.vue'
47
- import { computed, ref, useSlots, watch } from 'vue'
48
- import OxyKey from './key/index.vue'
49
- import { numberKeyboardProps, type Key } from './types'
50
- import type { NumberKeyType } from './key/types'
51
-
52
- const props = defineProps(numberKeyboardProps)
53
- const emit = defineEmits(['update:visible', 'input', 'close', 'delete', 'update:modelValue'])
54
- const slots = useSlots()
55
- const show = ref(props.visible)
56
- watch(
57
- () => props.visible,
58
- (newValue) => {
59
- show.value = newValue
60
- }
61
- )
62
-
63
- const keys = computed(() => (props.mode === 'custom' ? genCustomKeys() : genDefaultKeys()))
64
-
65
- const showClose = computed(() => {
66
- return props.closeText && props.mode === 'default'
67
- })
68
-
69
- const showTitle = computed(() => {
70
- return !!props.title || !!slots.title
71
- })
72
-
73
- const showHeader = computed(() => {
74
- return showTitle.value || showClose.value
75
- })
76
-
77
- /**
78
- * 随机打乱数组的顺序
79
- * @param arr 要打乱顺序的数组
80
- * @returns 打乱顺序后的数组
81
- */
82
- function shuffleArray<T>(arr: T[]): T[] {
83
- const newArr = [...arr]
84
- for (let i = newArr.length - 1; i > 0; i--) {
85
- // 生成一个随机索引 j,范围是 [0, i]
86
- const j = Math.floor(Math.random() * (i + 1))
87
-
88
- // 交换索引 i 和 j 处的元素
89
- ;[newArr[i], newArr[j]] = [newArr[j], newArr[i]]
90
- }
91
- return newArr
92
- }
93
- function genBasicKeys(): Key[] {
94
- const keys = Array.from({ length: 9 }, (_, i) => ({ text: i + 1 }))
95
-
96
- // 如果需要随机顺序,则调用 shuffleArray 方法打乱数组顺序
97
- return props.randomKeyOrder ? shuffleArray(keys) : keys
98
- }
99
-
100
- function genDefaultKeys(): Key[] {
101
- return [
102
- ...genBasicKeys(),
103
- { text: props.extraKey as string, type: 'extra' },
104
- { text: 0 },
105
- {
106
- // 根据条件是否显示删除键的文本和类型
107
- text: props.showDeleteKey ? props.deleteText : '',
108
- type: props.showDeleteKey ? 'delete' : ''
109
- }
110
- ]
111
- }
112
-
113
- function genCustomKeys(): Key[] {
114
- const keys = genBasicKeys()
115
- const extraKeys = Array.isArray(props.extraKey) ? props.extraKey : [props.extraKey]
116
- if (extraKeys.length === 1) {
117
- // 如果只有一个额外按键,则添加一个宽度较大的数字0和一个额外按键
118
- keys.push({ text: 0, wider: true }, { text: extraKeys[0], type: 'extra' })
119
- } else if (extraKeys.length === 2) {
120
- // 如果有两个额外按键,则添加两个额外按键和一个数字0
121
- keys.push({ text: extraKeys[0], type: 'extra' }, { text: 0 }, { text: extraKeys[1], type: 'extra' })
122
- }
123
-
124
- return keys
125
- }
126
-
127
- const handleClose = () => {
128
- emit('close')
129
- emit('update:visible', false)
130
- }
131
-
132
- const handlePress = (text: string, type: NumberKeyType) => {
133
- if (text === '' && type === 'extra') {
134
- return handleClose()
135
- }
136
- const value = props.modelValue
137
- if (type === 'delete') {
138
- emit('delete')
139
- emit('update:modelValue', value.slice(0, value.length - 1))
140
- } else if (type === 'close') {
141
- handleClose()
142
- } else if (value.length < +props.maxlength) {
143
- emit('input', text)
144
- emit('update:modelValue', value + text)
145
- }
146
- }
147
- </script>
148
-
149
- <style lang="scss">
150
- @import './index.scss';
151
- </style>
@@ -1,83 +0,0 @@
1
- import type { PropType } from 'vue'
2
- import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
3
-
4
- export type KeyboardMode = 'default' | 'custom'
5
- export type KeyType = '' | 'delete' | 'extra' | 'close'
6
-
7
- export interface Key {
8
- text?: number | string // key文本
9
- type?: KeyType // key的类型
10
- wider?: boolean // 是否占2个key的宽度
11
- }
12
-
13
- export const numberKeyboardProps = {
14
- ...baseProps,
15
- /**
16
- * 是否可见
17
- */
18
- visible: makeBooleanProp(false),
19
- /**
20
- * 绑定的值
21
- */
22
- modelValue: makeStringProp(''),
23
- /**
24
- * 标题
25
- */
26
- title: String,
27
- /**
28
- * 键盘模式
29
- */
30
- mode: makeStringProp<KeyboardMode>('default'),
31
- /**
32
- * 层级
33
- */
34
- zIndex: makeNumberProp(100),
35
- /**
36
- * 最大长度
37
- */
38
- maxlength: makeNumberProp(Infinity),
39
- /**
40
- * 是否显示删除键
41
- */
42
- showDeleteKey: makeBooleanProp(true),
43
- /**
44
- * 是否随机键盘按键顺序
45
- */
46
- randomKeyOrder: makeBooleanProp(false),
47
- /**
48
- * 确认按钮文本
49
- */
50
- closeText: String,
51
- /**
52
- * 删除按钮文本
53
- */
54
- deleteText: String,
55
- /**
56
- * 关闭按钮是否显示加载状态
57
- */
58
- closeButtonLoading: makeBooleanProp(false),
59
- /**
60
- * 是否显示蒙层
61
- */
62
- modal: makeBooleanProp(false),
63
- /**
64
- * 是否在点击外部时收起键盘
65
- */
66
- hideOnClickOutside: makeBooleanProp(true),
67
- /**
68
- * 是否锁定滚动
69
- */
70
- lockScroll: makeBooleanProp(true),
71
- /**
72
- * 是否在底部安全区域内
73
- */
74
- safeAreaInsetBottom: makeBooleanProp(true),
75
- /**
76
- * 额外按键
77
- */
78
- extraKey: [String, Array] as PropType<string | Array<string>>,
79
- /**
80
- * 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
81
- */
82
- rootPortal: makeBooleanProp(false)
83
- }
@@ -1,72 +0,0 @@
1
- <template>
2
- <view class="oxy-tree-node-content" :style="getNodeStyle()" :class="computedClass" @click="handleNodeClick">
3
- <oxy-icon @click.stop="toggleExpand" name="fill-arrow-down" class="oxy-tree-node-icon" size="22px"></oxy-icon>
4
- <oxy-checkbox
5
- v-if="treeProps?.showCheckbox"
6
- :modelValue="node.checked"
7
- :disabled="node.disabled"
8
- :indeterminate="node.immediate"
9
- shape="square"
10
- ></oxy-checkbox>
11
- <view class="oxy-tree-node">
12
- <slot :node="node" :data="node.data">
13
- {{ node.label }}
14
- </slot>
15
- </view>
16
- </view>
17
- </template>
18
-
19
- <script lang="ts">
20
- export default {
21
- name: 'oxy-tree-node-content'
22
- }
23
- </script>
24
-
25
- <script lang="ts" setup>
26
- import { computed, toRefs, type Ref } from 'vue'
27
- import type { TextProps, TreeNode } from '../types'
28
- import { inject } from 'vue'
29
- // 获取组件的 props 和 emit 函数
30
- const emit = defineEmits<{
31
- (e: 'click', node: TreeNode): void
32
- (e: 'toggle-expand', node: TreeNode, flag: boolean): void
33
- (e: 'toggle-checked', node: TreeNode, flag: boolean, isClick: boolean): void
34
- }>()
35
-
36
- const props = defineProps<{
37
- node: TreeNode
38
- }>()
39
- const treeProps = inject<TextProps>('treeProps')
40
- const currentNode = inject<Ref<TreeNode | undefined>>('currentNode')
41
-
42
- function getNodeStyle() {
43
- return {
44
- paddingLeft: `${(props.node.level - 1) * (treeProps?.indent || 16)}px`
45
- }
46
- }
47
-
48
- function toggleExpand() {
49
- emit('toggle-expand', props.node, !props.node.expanded)
50
- }
51
-
52
- const computedClass = computed(() => {
53
- const currentValue = currentNode?.value
54
- return {
55
- expanded: props.node.expanded,
56
- checked: props.node.checked,
57
- 'is-leaf': props.node.isLeaf,
58
- immediate: props.node.immediate,
59
- 'is-current': currentValue === props.node,
60
- 'is-disabled': props.node.disabled
61
- }
62
- })
63
-
64
- const handleNodeClick = () => {
65
- emit('click', props.node)
66
- emit('toggle-checked', props.node, !props.node.checked, true)
67
- }
68
- </script>
69
-
70
- <style lang="scss" scoped>
71
- @import '../index.scss';
72
- </style>
@@ -1,51 +0,0 @@
1
- import type { TextProps, RawTreeNode } from './types'
2
-
3
- export const useTreeMethods = (props: TextProps) => {
4
- function getDisabled(node: RawTreeNode): boolean {
5
- return node.disabled ?? false
6
- }
7
-
8
- function getChildren(node: RawTreeNode): RawTreeNode[] {
9
- return node[props.childrenKey] ?? []
10
- }
11
-
12
- function getLabel(node: RawTreeNode): string {
13
- return node[props.labelKey] ?? ''
14
- }
15
-
16
- function getKey(node: RawTreeNode | undefined): string {
17
- if (!node) {
18
- return ''
19
- }
20
- return (node[props.valueKey] ?? '') as string
21
- }
22
-
23
- return {
24
- getDisabled,
25
- getChildren,
26
- getLabel,
27
- getKey
28
- }
29
- }
30
- /**
31
- * 判断两个 Set 中的元素是否完全相同(不考虑顺序)
32
- * @param {Set} setA - 第一个 Set
33
- * @param {Set} setB - 第二个 Set
34
- * @returns {boolean} 两个 Set 是否相同
35
- */
36
- export function isSetsEqual(setA: Set<any>, setB: Set<any>) {
37
- // 步骤1:如果大小不同,直接返回 false
38
- if (setA.size !== setB.size) {
39
- return false
40
- }
41
-
42
- // 步骤2:遍历 setA 的所有元素,检查 setB 是否都包含
43
- for (const item of setA) {
44
- if (!setB.has(item)) {
45
- return false // 有元素不匹配,返回 false
46
- }
47
- }
48
-
49
- // 所有元素匹配,返回 true
50
- return true
51
- }
package/oxy-uni-ui.zip DELETED
Binary file