oxy-uni-ui 1.0.1 → 1.2.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 (57) hide show
  1. package/LICENSE +1 -1
  2. package/attributes.json +1 -1
  3. package/components/common/abstracts/variable.scss +40 -4
  4. package/components/common/util.ts +44 -0
  5. package/components/composables/index.ts +1 -0
  6. package/components/composables/useVirtualScroll.ts +172 -0
  7. package/components/oxy-checkbox/index.scss +36 -6
  8. package/components/oxy-checkbox/oxy-checkbox.vue +5 -4
  9. package/components/oxy-checkbox/types.ts +2 -1
  10. package/components/oxy-col-picker/index.scss +18 -15
  11. package/components/oxy-col-picker/oxy-col-picker.vue +28 -3
  12. package/components/oxy-col-picker/types.ts +12 -0
  13. package/components/oxy-corner/index.scss +258 -0
  14. package/components/oxy-corner/oxy-corner.vue +67 -0
  15. package/components/oxy-corner/types.ts +50 -0
  16. package/components/oxy-drop-menu/index.scss +4 -0
  17. package/components/oxy-drop-menu/oxy-drop-menu.vue +5 -3
  18. package/components/oxy-drop-menu/types.ts +1 -1
  19. package/components/oxy-drop-menu-item/index.scss +4 -4
  20. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +2 -0
  21. package/components/oxy-file-list/index.scss +83 -0
  22. package/components/oxy-file-list/oxy-file-list.vue +213 -0
  23. package/components/oxy-file-list/types.ts +54 -0
  24. package/components/oxy-list/index.scss +5 -0
  25. package/components/oxy-list/oxy-list.vue +206 -0
  26. package/components/oxy-list/types.ts +38 -0
  27. package/components/oxy-slider/index.scss +2 -2
  28. package/components/oxy-swiper/index.scss +1 -2
  29. package/components/oxy-textarea/oxy-textarea.vue +0 -4
  30. package/components/oxy-tree/components/tree-node-content.vue +72 -0
  31. package/components/oxy-tree/index.scss +83 -0
  32. package/components/oxy-tree/index.ts +51 -0
  33. package/components/oxy-tree/oxy-tree.vue +406 -0
  34. package/components/oxy-tree/types.ts +85 -0
  35. package/components/oxy-tree/utils.ts +51 -0
  36. package/components/oxy-upload/images/audio.png +0 -0
  37. package/components/oxy-upload/images/excle.png +0 -0
  38. package/components/oxy-upload/images/other.png +0 -0
  39. package/components/oxy-upload/images/pdf.png +0 -0
  40. package/components/oxy-upload/images/pic.png +0 -0
  41. package/components/oxy-upload/images/txt.png +0 -0
  42. package/components/oxy-upload/images/video.png +0 -0
  43. package/components/oxy-upload/images/word.png +0 -0
  44. package/components/oxy-upload/index.scss +50 -0
  45. package/components/oxy-upload/oxy-upload.vue +93 -7
  46. package/components/oxy-upload/types.ts +22 -1
  47. package/components/oxy-virtual-scroll/index.scss +35 -0
  48. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +143 -0
  49. package/components/oxy-virtual-scroll/types.ts +155 -0
  50. package/components/oxy-virtual-scroll/virtual-scroll.ts +81 -0
  51. package/global.d.ts +3 -0
  52. package/locale/lang/ar-SA.ts +2 -1
  53. package/locale/lang/en-US.ts +10 -9
  54. package/locale/lang/zh-CN.ts +7 -6
  55. package/package.json +1 -1
  56. package/tags.json +1 -1
  57. package/web-types.json +1 -1
@@ -0,0 +1,258 @@
1
+ @import '../common/abstracts/variable';
2
+ @import '../common/abstracts/mixin';
3
+
4
+ @mixin corner-type-style ($normalColor, $normalBg) {
5
+ background: $normalBg;
6
+ color: $normalColor;
7
+ }
8
+ @include b(corner) {
9
+ position: relative;
10
+ @include e(box) {
11
+ position: absolute;
12
+ top: 0;
13
+ right: 0;
14
+ width: 80px;
15
+ height: 80px;
16
+ overflow: hidden;
17
+ @include when(round) {
18
+ border-top-right-radius: $-corner-radius;
19
+ }
20
+ @include when(primary) {
21
+ .oxy-corner__text {
22
+ @include corner-type-style($-corner-color, $-corner-primary-bg);
23
+ }
24
+ &.is-horizontal {
25
+ .oxy-corner__text {
26
+ @include corner-type-style($-corner-primary-color, $-corner-horizontal-primary-bg);
27
+ }
28
+ }
29
+ &.is-embedded {
30
+ .oxy-corner__text {
31
+ @include corner-type-style($-corner-primary-color, $-corner-embedded-primary-bg);
32
+ }
33
+ }
34
+ }
35
+ @include when(info) {
36
+ .oxy-corner__text {
37
+ @include corner-type-style($-corner-color, $-corner-info-bg);
38
+ }
39
+ &.is-horizontal {
40
+ .oxy-corner__text {
41
+ @include corner-type-style($-corner-info-color, $-corner-horizontal-info-bg);
42
+ }
43
+ }
44
+ &.is-embedded {
45
+ .oxy-corner__text {
46
+ @include corner-type-style($-corner-info-color, $-corner-embedded-info-bg);
47
+ }
48
+ }
49
+ }
50
+ @include when(success) {
51
+ .oxy-corner__text {
52
+ @include corner-type-style($-corner-color, $-corner-success-bg);
53
+ }
54
+ &.is-horizontal {
55
+ .oxy-corner__text {
56
+ @include corner-type-style($-corner-success-color, $-corner-horizontal-success-bg);
57
+ }
58
+ }
59
+ &.is-embedded {
60
+ .oxy-corner__text {
61
+ @include corner-type-style($-corner-success-color, $-corner-embedded-success-bg);
62
+ }
63
+ }
64
+ }
65
+ @include when(warning) {
66
+ .oxy-corner__text {
67
+ @include corner-type-style($-corner-color, $-corner-warning-bg);
68
+ }
69
+ &.is-horizontal {
70
+ .oxy-corner__text {
71
+ @include corner-type-style($-corner-warning-color, $-corner-horizontal-warning-bg);
72
+ }
73
+ }
74
+ &.is-embedded {
75
+ .oxy-corner__text {
76
+ @include corner-type-style($-corner-warning-color, $-corner-embedded-warning-bg);
77
+ }
78
+ }
79
+ }
80
+ @include when(danger) {
81
+ .oxy-corner__text {
82
+ @include corner-type-style($-corner-color, $-corner-danger-bg);
83
+ }
84
+ &.is-horizontal {
85
+ .oxy-corner__text {
86
+ @include corner-type-style($-corner-danger-color, $-corner-horizontal-danger-bg);
87
+ }
88
+ }
89
+ &.is-embedded {
90
+ .oxy-corner__text {
91
+ @include corner-type-style($-corner-danger-color, $-corner-embedded-danger-bg);
92
+ }
93
+ }
94
+ }
95
+ &:not(.is-horizontal) {
96
+ &.is-top-left{
97
+ top: 0;
98
+ left: 0;
99
+ right: auto;
100
+ &.is-round {
101
+ border-top-right-radius: 0;
102
+ border-top-left-radius: $-corner-radius;
103
+ }
104
+ .oxy-corner__text {
105
+ transform: rotate(-45deg);
106
+ top: 10px;
107
+ left: -26px;
108
+ }
109
+ }
110
+ &.is-bottom-left{
111
+ bottom: 0;
112
+ left: 0;
113
+ top: auto;
114
+ &.is-round {
115
+ border-top-right-radius: 0;
116
+ border-bottom-left-radius: $-corner-radius;
117
+ }
118
+ .oxy-corner__text {
119
+ transform: rotate(-135deg);
120
+ bottom: 10px;
121
+ left: -26px;
122
+ top: auto;
123
+ > span{
124
+ transform: rotate(180deg);
125
+ display: inline-block;
126
+ }
127
+ }
128
+ }
129
+ &.is-bottom-right{
130
+ bottom: 0;
131
+ right: 0;
132
+ top: auto;
133
+ &.is-round {
134
+ border-top-right-radius: 0;
135
+ border-bottom-right-radius: $-corner-radius;
136
+ }
137
+ .oxy-corner__text {
138
+ transform: rotate(135deg);
139
+ bottom: 10px;
140
+ right: -26px;
141
+ top: auto;
142
+ > span{
143
+ transform: rotate(180deg);
144
+ display: inline-block;
145
+ }
146
+ }
147
+ }
148
+ &.is-embedded {
149
+ &.is-top-left{
150
+ &::after {
151
+ left: auto;
152
+ right: -6px;
153
+ bottom: 0;
154
+ transform: skewX(-30deg);
155
+ }
156
+ .oxy-corner__text {
157
+ transform: none;
158
+ top: 0;
159
+ left: 0;
160
+ border-bottom-left-radius: 0;
161
+ border-bottom-right-radius: 32px;
162
+ padding-left: 0;
163
+ padding-right: 12px;
164
+ }
165
+ }
166
+ &.is-bottom-left{
167
+ &::after {
168
+ left: auto;
169
+ right: -6px;
170
+ bottom: 0;
171
+ transform: skewX(30deg);
172
+ }
173
+ .oxy-corner__text {
174
+ transform: none;
175
+ bottom: 0;
176
+ left: 0;
177
+ border-bottom-left-radius: 0;
178
+ border-top-right-radius: 32px;
179
+ padding-left: 0;
180
+ padding-right: 12px;
181
+ > span{
182
+ transform: none;
183
+ }
184
+ }
185
+ }
186
+ &.is-bottom-right{
187
+ &::after {
188
+ left: -6px;
189
+ bottom: 0;
190
+ transform: skewX(-30deg);
191
+ }
192
+ .oxy-corner__text {
193
+ transform: none;
194
+ bottom: 0;
195
+ right: 0;
196
+ border-bottom-left-radius: 0;
197
+ border-top-left-radius: 32px;
198
+ > span{
199
+ transform: none;
200
+ }
201
+ }
202
+ }
203
+ }
204
+ .oxy-corner__text {
205
+ width: 106px;
206
+ height: 32px;
207
+ position: absolute;
208
+ right: -26px;
209
+ top: 10px;
210
+ text-align: center;
211
+ line-height: 32px;
212
+ overflow: hidden;
213
+ transform: rotate(45deg);
214
+ box-sizing: border-box;
215
+ white-space: nowrap;
216
+ text-align: center;
217
+ font-size: $-corner-font-size;
218
+ font-weight: $-corner-font-weight;
219
+ }
220
+ }
221
+ &.is-horizontal {
222
+ width: 160px;
223
+ height: 40px;
224
+ .oxy-corner__text {
225
+ padding-right: 20px;
226
+ box-sizing: border-box;
227
+ font-size: $-corner-horizontal-font-size;
228
+ font-weight: $-corner-horizontal-font-weight;
229
+ line-height: 40px;
230
+ text-align: right;
231
+ }
232
+ }
233
+ &.is-embedded {
234
+ width: 106px;
235
+ height: 32px;
236
+ &::after {
237
+ content: '';
238
+ position: absolute;
239
+ left: -6px;
240
+ bottom: 0;
241
+ width: 16px;
242
+ height: 32px;
243
+ background-color: #ffffff;
244
+ transform: skewX(30deg);
245
+ }
246
+ .oxy-corner__text {
247
+ right: 0;
248
+ top: 0;
249
+ transform: none;
250
+ padding-left: 12px;
251
+ box-sizing: border-box;
252
+ font-size: $-corner-embedded-font-size;
253
+ font-weight: $-corner-embedded-font-weight;
254
+ border-bottom-left-radius: 32px;
255
+ }
256
+ }
257
+ }
258
+ }
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <view class="oxy-corner">
3
+ <slot />
4
+ <view v-if="text || $slots.text" :class="textClass">
5
+ <view class="oxy-corner__text">
6
+ <slot name="text">
7
+ <span>{{ text }}</span>
8
+ </slot>
9
+ </view>
10
+ </view>
11
+ </view>
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ export default {
16
+ name: 'oxy-corner',
17
+ options: {
18
+ addGlobalClass: true,
19
+ virtualHost: true,
20
+ styleIsolation: 'shared'
21
+ }
22
+ }
23
+ </script>
24
+ <script lang="ts" setup>
25
+ import { computed, ref, watch } from 'vue'
26
+ import { cornerProps } from './types'
27
+
28
+ const props = defineProps(cornerProps)
29
+
30
+ const cornerClass = ref<string>('')
31
+
32
+ watch(
33
+ [() => () => props.position, () => props.mode, () => props.round],
34
+ () => {
35
+ computeCornerClass()
36
+ },
37
+ { deep: true, immediate: true }
38
+ )
39
+
40
+ watch(
41
+ () => props.type,
42
+ (newValue) => {
43
+ if (!newValue) return
44
+ const type = ['primary', 'info', 'success', 'warning', 'danger']
45
+ if (type.indexOf(newValue) === -1) console.error(`type must be one of ${type.toString()}`)
46
+ computeCornerClass()
47
+ },
48
+ { immediate: true }
49
+ )
50
+
51
+ const textClass = computed(() => {
52
+ return `oxy-corner__box ${props.customClass} ${cornerClass.value}`
53
+ })
54
+
55
+ function computeCornerClass() {
56
+ const { type, position, mode, round } = props
57
+ let cornerClassList: string[] = []
58
+ type && cornerClassList.push(`is-${type}`)
59
+ position && cornerClassList.push(`is-${position}`)
60
+ mode && cornerClassList.push(`is-${mode}`)
61
+ round && cornerClassList.push('is-round')
62
+ cornerClass.value = cornerClassList.join(' ')
63
+ }
64
+ </script>
65
+ <style lang="scss" scoped>
66
+ @import './index.scss';
67
+ </style>
@@ -0,0 +1,50 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
3
+
4
+ export type CornerType = 'primary' | 'info' | 'success' | 'warning' | 'danger'
5
+ export type CornerPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
6
+ export type CornerMode = '' | 'horizontal' | 'embedded'
7
+
8
+ export const cornerProps = {
9
+ ...baseProps,
10
+
11
+ /**
12
+ * 角标类型
13
+ * 类型:string
14
+ * 可选值:'primary' / 'info' / 'success' / 'warning' / 'danger'
15
+ * 默认值:'primary'
16
+ */
17
+ type: makeStringProp<CornerType>('primary'),
18
+
19
+ /**
20
+ * 角标位置
21
+ * 类型:string
22
+ * 可选值:'top-left' / 'top-right' / 'bottom-left' / 'bottom-right'
23
+ * 默认值:'top-right'
24
+ */
25
+ position: makeStringProp<CornerPosition>('top-right'),
26
+
27
+ /**
28
+ * 圆角类型
29
+ * 类型:boolean
30
+ * 默认值:false
31
+ */
32
+ round: makeBooleanProp(false),
33
+
34
+ /**
35
+ * 角标模式
36
+ * 类型:string
37
+ * 可选值:'horizontal' / 'embedded'
38
+ * 默认值:''
39
+ */
40
+ mode: makeStringProp<CornerMode>(''),
41
+
42
+ /**
43
+ * 角标文字
44
+ * 类型:string
45
+ * 默认值:空字符串
46
+ */
47
+ text: makeStringProp('')
48
+ }
49
+
50
+ export type CornerProps = ExtractPropTypes<typeof cornerProps>
@@ -4,6 +4,7 @@
4
4
  .oxy-theme-dark {
5
5
  @include b(drop-menu) {
6
6
  color: $-dark-color;
7
+
7
8
  @include e(list) {
8
9
  background-color: $-dark-background2;
9
10
  }
@@ -27,6 +28,7 @@
27
28
  text-align: center;
28
29
  background-color: #fff;
29
30
  }
31
+
30
32
  @include e(item) {
31
33
  flex: 1;
32
34
  min-width: 0;
@@ -40,11 +42,13 @@
40
42
  .oxy-drop-menu__item-title::after {
41
43
  opacity: 1;
42
44
  }
45
+
43
46
  :deep(.oxy-drop-menu__arrow) {
44
47
  transform: rotate(-180deg);
45
48
  transform-origin: center center;
46
49
  }
47
50
  }
51
+
48
52
  @include when(disabled) {
49
53
  color: $-drop-menu-disabled-color;
50
54
  }
@@ -18,7 +18,7 @@
18
18
  v-for="(child, index) in children"
19
19
  :key="index"
20
20
  @click="toggle(child)"
21
- :class="`oxy-drop-menu__item ${child.disabled ? 'is-disabled' : ''} ${child.$.exposed!.getShowPop() ? 'is-active' : ''}`"
21
+ :class="`oxy-drop-menu__item ${child.disabled ? 'is-disabled' : ''} ${child.$.exposed?.getShowPop() ? 'is-active' : ''}`"
22
22
  >
23
23
  <view class="oxy-drop-menu__item-title">
24
24
  <view class="oxy-drop-menu__item-title-text">{{ getDisplayTitle(child) }}</view>
@@ -60,6 +60,8 @@ const windowHeight = ref<number>(0)
60
60
  const modalStyle = computed(() => {
61
61
  return props.direction === 'down'
62
62
  ? `top: calc(var(--window-top) + ${offset.value}px); bottom: 0;`
63
+ : props.direction === 'bottom'
64
+ ? 'top: var(--window-top); bottom: 0;'
63
65
  : `top: 0; bottom: calc(var(--window-bottom) + ${offset.value}px)`
64
66
  })
65
67
 
@@ -95,7 +97,7 @@ linkChildren({ props, fold, offset })
95
97
  watch(
96
98
  () => props.direction,
97
99
  (newValue) => {
98
- if (!['up', 'down'].includes(newValue)) {
100
+ if (!['up', 'down', 'bottom'].includes(newValue)) {
99
101
  // eslint-disable-next-line quotes
100
102
  console.error("[Oxy ui] warning(oxy-drop-menu): direction must be 'up' or 'down'")
101
103
  }
@@ -142,7 +144,7 @@ function fold(child: any) {
142
144
  getRect(`#${dropMenuId.value}`, false, proxy).then((rect) => {
143
145
  if (!rect) return
144
146
  const { top, bottom } = rect
145
- if (props.direction === 'down') {
147
+ if (props.direction === 'down' || props.direction === 'bottom') {
146
148
  offset.value = Number(bottom)
147
149
  } else {
148
150
  offset.value = windowHeight.value - Number(top)
@@ -1,7 +1,7 @@
1
1
  import { type ExtractPropTypes, type InjectionKey, type Ref } from 'vue'
2
2
  import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
3
3
 
4
- export type DropDirection = 'up' | 'down'
4
+ export type DropDirection = 'up' | 'down' | 'bottom'
5
5
 
6
6
  export type DropMenuProvide = {
7
7
  props: Partial<DropMenuProps>
@@ -20,8 +20,8 @@
20
20
  color: $-drop-menu-item-color;
21
21
  width: 100%;
22
22
  z-index: 101;
23
-
24
- @include e(popup){
23
+
24
+ @include e(popup) {
25
25
  position: absolute;
26
26
  max-height: 80%;
27
27
  }
@@ -40,7 +40,7 @@
40
40
  }
41
41
  }
42
42
 
43
- @include e(title){
43
+ @include e(title) {
44
44
  display: block;
45
45
  }
46
46
 
@@ -51,7 +51,7 @@
51
51
  margin-left: 2px;
52
52
  }
53
53
 
54
- @include edeep(icon){
54
+ @include edeep(icon) {
55
55
  display: block;
56
56
  font-size: $-drop-menu-option-check-size;
57
57
  }
@@ -91,6 +91,8 @@ const positionStyle = computed(() => {
91
91
  style =
92
92
  dropMenu.props.direction === 'down'
93
93
  ? `top: calc(var(--window-top) + ${dropMenu.offset.value}px); bottom: 0;`
94
+ : dropMenu.props.direction === 'bottom'
95
+ ? 'top: calc(var(--window-top); bottom: 0;'
94
96
  : `top: 0; bottom: calc(var(--window-bottom) + ${dropMenu.offset.value}px)`
95
97
  } else {
96
98
  style = ''
@@ -0,0 +1,83 @@
1
+ @import '../common/abstracts/variable';
2
+ @import '../common/abstracts/mixin';
3
+
4
+ @include b(file-list) {
5
+ position: relative;
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ margin: 0 -8px;
9
+ @include e(item) {
10
+ position: relative;
11
+ width: calc(33.33% - 16px);
12
+ height: $-file-list-height;
13
+ margin: 0 8px 32px;
14
+ }
15
+ @include e(content) {
16
+ display: flex;
17
+ flex-direction: column;
18
+ justify-content: center;
19
+ align-items: center;
20
+ width: 100%;
21
+ height: 100%;
22
+ border: 1px solid $-color-border;
23
+ border-radius: 8px;
24
+ }
25
+ @include e(picture) {
26
+ position: relative;
27
+ display: block;
28
+ width: 100%;
29
+ height: 100%;
30
+ border-radius: 8px;
31
+ }
32
+ @include e(icon) {
33
+ width: 32px;
34
+ height: 32px;
35
+ }
36
+ @include e(name) {
37
+ display: block;
38
+ width: 100%;
39
+ font-size: $-upload-file-fs;
40
+ color: $-upload-file-color;
41
+ padding: 0 4px;
42
+ text-align: center;
43
+ margin-top: 8px;
44
+ white-space: nowrap;
45
+ overflow: hidden;
46
+ text-overflow: ellipsis;
47
+ }
48
+ :deep(.oxy-tooltip) {
49
+ width: 100%;
50
+ .oxy-tooltip__inner {
51
+ width: fit-content;
52
+ white-space: pre-wrap;
53
+ word-break: break-all;
54
+ }
55
+ }
56
+ &.oxy-file-list__list {
57
+ display: block;
58
+ margin: 0;
59
+ .oxy-file-list__list--item {
60
+ width: 100%;
61
+ background: #f8f9ff;
62
+ padding: 8px 12px;
63
+ border-radius: 4px;
64
+ display: flex;
65
+ flex-direction: row;
66
+ align-items: center;
67
+ .oxy-file-list__icon {
68
+ width: 24px;
69
+ height: 24px;
70
+ margin-right: 8px;
71
+ }
72
+ .oxy-file-list__name {
73
+ flex: 1;
74
+ text-align: left;
75
+ margin: 0;
76
+ padding: 0;
77
+ }
78
+ & + .oxy-file-list__list--item {
79
+ margin-top: 8px;
80
+ }
81
+ }
82
+ }
83
+ }