oxy-uni-ui 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +132 -98
  3. package/components/common/util.ts +25 -0
  4. package/components/composables/useDynamicVirtualScroll.ts +80 -0
  5. package/components/oxy-action-sheet/index.scss +6 -6
  6. package/components/oxy-backtop/index.scss +1 -1
  7. package/components/oxy-badge/index.scss +2 -2
  8. package/components/oxy-button/index.scss +3 -6
  9. package/components/oxy-calendar/index.scss +2 -2
  10. package/components/oxy-calendar/oxy-calendar.vue +3 -3
  11. package/components/oxy-calendar-view/monthPanel/month-panel.vue +72 -37
  12. package/components/oxy-calendar-view/monthPanel/types.ts +43 -1
  13. package/components/oxy-calendar-view/types.ts +1 -1
  14. package/components/oxy-calendar-view/utils.ts +12 -1
  15. package/components/oxy-calendar-view/yearPanel/types.ts +36 -2
  16. package/components/oxy-calendar-view/yearPanel/year-panel.vue +64 -45
  17. package/components/oxy-card/index.scss +4 -4
  18. package/components/oxy-cell/index.scss +1 -1
  19. package/components/oxy-cell-group/index.scss +2 -2
  20. package/components/oxy-checkbox/index.scss +73 -218
  21. package/components/oxy-collapse/index.scss +1 -1
  22. package/components/oxy-collapse-item/index.scss +2 -2
  23. package/components/oxy-corner/index.scss +3 -3
  24. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  25. package/components/oxy-count-to/types.ts +1 -1
  26. package/components/oxy-date-strip-item/index.scss +4 -4
  27. package/components/oxy-datetime-picker/types.ts +1 -1
  28. package/components/oxy-datetime-picker-view/types.ts +2 -2
  29. package/components/oxy-fab/index.scss +1 -5
  30. package/components/oxy-file-list/index.scss +2 -2
  31. package/components/oxy-footer/index.scss +2 -2
  32. package/components/oxy-footer/oxy-footer.vue +2 -3
  33. package/components/oxy-form-item/index.scss +0 -5
  34. package/components/oxy-grid/oxy-grid.vue +1 -1
  35. package/components/oxy-grid-item/index.scss +1 -1
  36. package/components/oxy-guidance/index.scss +2 -2
  37. package/components/oxy-img/index.scss +2 -2
  38. package/components/oxy-img-cropper/index.scss +0 -2
  39. package/components/oxy-img-lazy/index.scss +0 -1
  40. package/components/oxy-index-anchor/index.scss +3 -3
  41. package/components/oxy-input/index.scss +2 -2
  42. package/components/oxy-input-number/index.scss +21 -3
  43. package/components/oxy-input-number/oxy-input-number.vue +9 -1
  44. package/components/oxy-keyboard/index.scss +1 -1
  45. package/components/oxy-link/index.scss +11 -10
  46. package/components/oxy-loading/index.scss +1 -1
  47. package/components/oxy-loadmore/index.scss +1 -1
  48. package/components/oxy-message-box/index.scss +7 -7
  49. package/components/oxy-navbar/index.scss +1 -1
  50. package/components/oxy-navbar/oxy-navbar.vue +2 -3
  51. package/components/oxy-password-input/index.scss +4 -4
  52. package/components/oxy-picker/types.ts +1 -1
  53. package/components/oxy-picker-view/oxy-picker-view.vue +8 -5
  54. package/components/oxy-picker-view/types.ts +2 -2
  55. package/components/oxy-progress/index.scss +2 -2
  56. package/components/oxy-radio/index.scss +8 -4
  57. package/components/oxy-radio-group/index.scss +0 -1
  58. package/components/oxy-rich-text/index.scss +2 -6
  59. package/components/oxy-rich-text/mp-html/mp-html.d.ts +2 -0
  60. package/components/oxy-rich-text/mp-html/mp-html.vue +2 -1
  61. package/components/oxy-rich-text/mp-html/node/node.vue +23 -0
  62. package/components/oxy-rich-text/mp-html/parser.js +6 -6
  63. package/components/oxy-rich-text/oxy-rich-text.vue +23 -0
  64. package/components/oxy-search/index.scss +1 -1
  65. package/components/oxy-segmented/index.scss +4 -8
  66. package/components/oxy-select/index.scss +6 -6
  67. package/components/oxy-sidebar-item/index.scss +20 -11
  68. package/components/oxy-slider/index.scss +4 -5
  69. package/components/oxy-sort-button/index.scss +3 -5
  70. package/components/oxy-splitter-panel/index.scss +8 -8
  71. package/components/oxy-step/index.scss +9 -9
  72. package/components/oxy-swiper-nav/index.scss +2 -2
  73. package/components/oxy-switch/index.scss +3 -3
  74. package/components/oxy-tab/index.scss +8 -2
  75. package/components/oxy-tabbar/index.scss +3 -3
  76. package/components/oxy-tabbar/oxy-tabbar.vue +3 -3
  77. package/components/oxy-table/index.scss +0 -1
  78. package/components/oxy-table-col/index.scss +1 -2
  79. package/components/oxy-tabs/index.scss +3 -3
  80. package/components/oxy-tag/index.scss +4 -4
  81. package/components/oxy-text/index.scss +1 -1
  82. package/components/oxy-textarea/index.scss +2 -6
  83. package/components/oxy-toast/index.scss +1 -1
  84. package/components/oxy-tree/index.scss +31 -11
  85. package/components/oxy-tree/oxy-tree.vue +113 -2
  86. package/components/oxy-tree/types.ts +1 -0
  87. package/components/oxy-upload/index.scss +3 -3
  88. package/components/oxy-video-preview/index.scss +3 -3
  89. package/components/oxy-virtual-scroll/index.scss +1 -1
  90. package/components/oxy-voice-player/index.scss +36 -36
  91. package/components/oxy-watermark/index.scss +1 -1
  92. package/package.json +1 -1
  93. package/tags.json +1 -1
  94. package/web-types.json +1 -1
@@ -14,7 +14,7 @@
14
14
  color: $-dark-color3;
15
15
 
16
16
  @include when(active) {
17
- font-weight: 600;
17
+ font-weight: $-fw-semibold;
18
18
  color: $-dark-color;
19
19
  }
20
20
 
@@ -103,7 +103,7 @@
103
103
  transition: color .3s;
104
104
 
105
105
  @include when(active) {
106
- font-weight: 600;
106
+ font-weight: $-fw-semibold;
107
107
  }
108
108
 
109
109
  @include when(disabled) {
@@ -269,7 +269,7 @@
269
269
  line-height: 1.2;
270
270
  background-color: $-tabs-nav-map-button-back-color;
271
271
  border-color: transparent;
272
- margin-bottom: 24rpx;
272
+ margin-bottom: $-spacing-24;
273
273
  border-radius: $-tabs-nav-map-button-radius;
274
274
  color: $-tabs-nav-map-color;
275
275
  font-size: $-tabs-nav-map-fs;
@@ -67,9 +67,9 @@
67
67
  color: $-tag-color;
68
68
  padding: 12rpx 20rpx;
69
69
  min-height: 64rpx;
70
- border: 1px solid transparent;
70
+ border: #{$-border-width-base} solid transparent;
71
71
  border-radius: $-tag-radius;
72
- transition: opacity .2s, color .2s, border-color .2s, background-color .2s;
72
+ transition: opacity $-transition-duration-base, color $-transition-duration-base, border-color $-transition-duration-base, background-color $-transition-duration-base;
73
73
  vertical-align: middle;
74
74
  line-height: 1.4;
75
75
  white-space: nowrap;
@@ -166,7 +166,7 @@
166
166
  display: inline-flex;
167
167
  align-items: center;
168
168
  justify-content: center;
169
- margin-left: 16rpx;
169
+ margin-left: $-spacing-16;
170
170
  margin-right: 0;
171
171
  font-size: $-tag-close-size;
172
172
  width: $-tag-close-size;
@@ -175,7 +175,7 @@
175
175
  vertical-align: middle;
176
176
  color: $-tag-close-color;
177
177
  opacity: 0.7;
178
- transition: opacity .2s, color .2s;
178
+ transition: opacity $-transition-duration-base, color $-transition-duration-base;
179
179
 
180
180
  &:active {
181
181
  opacity: 1;
@@ -6,7 +6,7 @@
6
6
  @include b(text) {
7
7
 
8
8
  @include when(bold) {
9
- font-weight: bold;
9
+ font-weight: $-fw-bold;
10
10
  }
11
11
 
12
12
  @for $i from 1 through 5 {
@@ -84,7 +84,7 @@
84
84
  height: 1px;
85
85
  background: $-textarea-border-color;
86
86
  transform: scaleY(0.5);
87
- transition: background-color 0.2s ease-in-out;
87
+ transition: background-color $-transition-duration-base ease-in-out;
88
88
  }
89
89
 
90
90
 
@@ -203,7 +203,7 @@
203
203
  font-size: $-textarea-count-fs;
204
204
  color: $-textarea-count-color;
205
205
  background: $-textarea-bg;
206
- line-height: 48rpx;
206
+ line-height: $-lh-base;
207
207
  display: inline-flex;
208
208
  }
209
209
 
@@ -257,10 +257,6 @@
257
257
  }
258
258
 
259
259
  @include when(auto-height) {
260
- &:not(.is-cell) {
261
- padding: 16rpx 0;
262
- }
263
-
264
260
  &::after {
265
261
  display: block;
266
262
  }
@@ -8,7 +8,7 @@
8
8
  background-color: $-toast-bg;
9
9
  border-radius: $-toast-radius;
10
10
  color: $-toast-color;
11
- transition: all 0.2s;
11
+ transition: all $-transition-duration-base;
12
12
  font-size: $-toast-fs;
13
13
  box-sizing: border-box;
14
14
  box-shadow: $-toast-box-shadow;
@@ -2,49 +2,53 @@
2
2
  @import '../common/abstracts/mixin';
3
3
  @import '../oxy-virtual-scroll/index.scss';
4
4
 
5
- .oxy-tree {
5
+ @include b(tree) {
6
6
  position: relative;
7
- &__virtual-scroll {
7
+
8
+ @include e(virtual-scroll) {
8
9
  position: relative;
9
10
  overflow: hidden;
10
11
  }
11
12
 
12
- &__view {
13
+ @include e(view) {
13
14
  height: 100%;
14
15
  }
15
16
 
16
- &__container {
17
+ @include e(container) {
17
18
  position: relative;
18
19
  }
19
20
 
20
- &__items {
21
+ @include e(items) {
21
22
  position: absolute;
22
23
  top: 0;
23
24
  left: 0;
24
25
  right: 0;
25
26
  }
26
- .oxy-tree__search{
27
+
28
+ @include e(search) {
27
29
  display: flex;
28
- :deep(.oxy-button){
30
+
31
+ :deep(.oxy-button) {
29
32
  min-width: 120rpx;
30
33
  }
34
+
31
35
  :deep(.oxy-tree__search-input) {
32
36
  flex: 1;
33
37
  background-color: $-tree-search-input-color;
34
38
  padding: 16rpx 24rpx;
35
39
  border-radius: $-tree-search-input-radius;
36
40
  margin-bottom: 20rpx;
37
- margin-right: 24rpx;
38
- .oxy-input__icon{
41
+ margin-right: $-spacing-24;
42
+
43
+ .oxy-input__icon {
39
44
  background: transparent;
40
45
  }
41
46
  }
42
47
  }
43
-
44
-
45
48
  }
46
49
 
47
50
  .oxy-tree-node-content {
51
+ position: relative;
48
52
  display: flex;
49
53
  width: 100%;
50
54
  align-items: center;
@@ -132,4 +136,20 @@
132
136
  min-width: 0;
133
137
  @include lineEllipsis;
134
138
  }
139
+
140
+ .oxy-tree-line-vertical {
141
+ position: absolute;
142
+ width: 1px;
143
+ border-left: 1px dashed $-tree-node-icon-color;
144
+ pointer-events: none;
145
+ z-index: 0;
146
+ }
147
+ .oxy-tree-line-horizontal {
148
+ position: absolute;
149
+ top: 50%;
150
+ height: 1px;
151
+ border-top: 1px dashed $-tree-node-icon-color;
152
+ pointer-events: none;
153
+ z-index: 0;
154
+ }
135
155
  }
@@ -21,6 +21,22 @@
21
21
  <view class="oxy-tree__items" :style="{ transform: `translateY(${unitConvert(virtualOffsetY, 0, { output: 'px' })})` }">
22
22
  <view v-for="(item, index) in virtualData" :key="index">
23
23
  <view class="oxy-tree-node-content" :style="getNodeStyle(item)" :class="getNodeClass(item)" @click="handleNodeClick(item)">
24
+ <!-- 结构线 -->
25
+ <block v-if="showLine">
26
+ <view
27
+ v-for="l in item.level - 1"
28
+ :key="'line-' + l"
29
+ class="oxy-tree-line-vertical"
30
+ :style="getAncestorLineStyle(item, l)"
31
+ v-show="shouldShowAncestorLine(item, l)"
32
+ ></view>
33
+ <view v-if="hasHorizontalLine(item)" class="oxy-tree-line-horizontal" :style="getHorizontalLineStyle(item)"></view>
34
+
35
+ <view v-if="shouldShowRootVerticalLine(item)" class="oxy-tree-line-vertical" :style="getRootVerticalLineStyle(item)"></view>
36
+
37
+ <view v-if="shouldShowOwnChildrenLine(item)" class="oxy-tree-line-vertical" :style="getOwnChildrenLineStyle(item)"></view>
38
+ </block>
39
+
24
40
  <!-- 兼容支付宝、微信小程序 -->
25
41
  <view class="oxy-tree-node-toggle" @tap.stop="handleClickExpand(item)">
26
42
  <oxy-icon
@@ -69,8 +85,8 @@ export default {
69
85
  </script>
70
86
 
71
87
  <script lang="ts" setup>
72
- import { computed, nextTick, provide, type Ref, ref, toRefs, watch } from 'vue'
73
- import type { RawTreeNode, Tree, TreeInstance, TreeNode } from './types'
88
+ import { computed, nextTick, type CSSProperties, type Ref, ref, toRefs, watch } from 'vue'
89
+ import type { RawTreeNode, Tree, TreeNode } from './types'
74
90
  import { treeProps, type TreeExpose } from './types'
75
91
  import { isSetsEqual, useTreeMethods } from './utils'
76
92
  import { useVirtualScroll } from '../composables/useVirtualScroll'
@@ -85,6 +101,7 @@ const {
85
101
  expandAll,
86
102
  showCheckbox,
87
103
  checkStrictly,
104
+ showLine,
88
105
  selectionLeafOnly,
89
106
  height,
90
107
  itemHeight,
@@ -469,6 +486,100 @@ const handleFilter = () => {
469
486
  filter(searchValue.value)
470
487
  }
471
488
 
489
+ const isAncestorLast = (node: TreeNode, level: number) => {
490
+ let current: TreeNode | undefined = node
491
+ let steps = node.level - level
492
+ while (steps > 0 && current) {
493
+ current = current.parent
494
+ steps--
495
+ }
496
+ return current ? current.isLast : false
497
+ }
498
+
499
+ const TREE_LINE_ICON_BOX_SIZE = '56rpx'
500
+ const TREE_LINE_ICON_SIZE = '32rpx'
501
+ const TREE_LINE_GAP_OFFSET = '2px'
502
+ const ZERO_LENGTH = '0px'
503
+ const HALF_HEIGHT = '50%'
504
+
505
+ const toRpxLength = (value: number) => {
506
+ return value === 0 ? ZERO_LENGTH : `${value}rpx`
507
+ }
508
+
509
+ const getLineLeft = (l: number) => {
510
+ const indent = Number(props.indent || 32)
511
+ return `calc(${toRpxLength(indent * (l - 1))} + var(--oxy-tree-node-icon-box-size, ${TREE_LINE_ICON_BOX_SIZE}) / 2)`
512
+ }
513
+
514
+ const getLineGap = () => {
515
+ return `var(--oxy-tree-node-icon-size, ${TREE_LINE_ICON_SIZE}) / 2 + ${TREE_LINE_GAP_OFFSET}`
516
+ }
517
+
518
+ const getLineWidth = (isLeaf: boolean) => {
519
+ const indent = Number(props.indent || 32)
520
+ const indentStr = toRpxLength(indent)
521
+ if (isLeaf) {
522
+ return `calc(${indentStr} + var(--oxy-tree-node-icon-box-size, ${TREE_LINE_ICON_BOX_SIZE}) / 2)`
523
+ }
524
+ return `calc(${indentStr} - var(--oxy-tree-node-icon-size, ${TREE_LINE_ICON_SIZE}) / 2 - ${TREE_LINE_GAP_OFFSET})`
525
+ }
526
+
527
+ const hasHorizontalLine = (node: TreeNode) => {
528
+ return node.level > 1
529
+ }
530
+
531
+ const shouldShowAncestorLine = (node: TreeNode, level: number) => {
532
+ if (level === node.level - 1) {
533
+ return true
534
+ }
535
+ if (level === 1 && !isAncestorLast(node, 1)) {
536
+ return true
537
+ }
538
+ return !isAncestorLast(node, level + 1)
539
+ }
540
+
541
+ const getAncestorLineStyle = (node: TreeNode, level: number): CSSProperties => {
542
+ const shouldExtendToBottom = level === 1 && !isAncestorLast(node, 1)
543
+ const isLastBranch = level === node.level - 1 && node.isLast
544
+
545
+ return {
546
+ left: getLineLeft(level),
547
+ top: 0,
548
+ bottom: shouldExtendToBottom ? 0 : isLastBranch ? HALF_HEIGHT : 0
549
+ }
550
+ }
551
+
552
+ const getHorizontalLineStyle = (node: TreeNode): CSSProperties => {
553
+ return {
554
+ left: getLineLeft(node.level - 1),
555
+ width: getLineWidth(node.isLeaf)
556
+ }
557
+ }
558
+
559
+ const shouldShowRootVerticalLine = (node: TreeNode) => {
560
+ return node.level === 1 && node.index > 0
561
+ }
562
+
563
+ const getRootVerticalLineStyle = (node: TreeNode): CSSProperties => {
564
+ return {
565
+ left: getLineLeft(1),
566
+ top: 0,
567
+ bottom: node.isLeaf ? (node.isLast ? HALF_HEIGHT : 0) : `calc(${HALF_HEIGHT} + ${getLineGap()})`
568
+ }
569
+ }
570
+
571
+ const shouldShowOwnChildrenLine = (node: TreeNode) => {
572
+ return !node.isLeaf && (expandedKeySet.value.has(node.key) || (node.level === 1 && !node.isLast))
573
+ }
574
+
575
+ const getOwnChildrenLineStyle = (node: TreeNode): CSSProperties => {
576
+ return {
577
+ left: getLineLeft(node.level),
578
+ top: `calc(${HALF_HEIGHT} + ${getLineGap()})`,
579
+ bottom: 0
580
+ }
581
+ }
582
+
472
583
  defineExpose<TreeExpose>({
473
584
  toggleExpand,
474
585
  toggleChecked,
@@ -43,6 +43,7 @@ export const treeProps = {
43
43
  defaultExpandedKeys: makeArrayProp<string>(),
44
44
  expandAll: makeBooleanProp(false),
45
45
  checkStrictly: makeBooleanProp(false),
46
+ showLine: makeBooleanProp(false),
46
47
  modelValue: {
47
48
  type: [Array<string>, String],
48
49
  default: ''
@@ -122,7 +122,7 @@
122
122
 
123
123
  &::before {
124
124
  background-color: $-upload-video-play-bg;
125
- border-radius: 50%;
125
+ border-radius: $-radius-circle;
126
126
  }
127
127
  }
128
128
 
@@ -142,7 +142,7 @@
142
142
  content: "";
143
143
  width: 100%;
144
144
  height: 100%;
145
- border-radius: 50%;
145
+ border-radius: $-radius-circle;
146
146
  background-color: $-color-white;
147
147
  left: 0;
148
148
  z-index: -1;
@@ -219,7 +219,7 @@
219
219
 
220
220
  &.oxy-upload__position-right {
221
221
  .oxy-upload__evoke {
222
- margin-right: 24rpx;
222
+ margin-right: $-spacing-24;
223
223
  }
224
224
  }
225
225
  }
@@ -5,7 +5,7 @@
5
5
  position: fixed;
6
6
  top: 0;
7
7
  left: 0;
8
- z-index: 999;
8
+ z-index: $-z-index-overlay;
9
9
  width: 100%;
10
10
  height: 100%;
11
11
  display: flex;
@@ -17,7 +17,7 @@
17
17
  @include e(video) {
18
18
  width: 100%;
19
19
  height: 484rpx;
20
- transition: all 0.3s ease;
20
+ transition: all $-transition-duration-slow ease;
21
21
  }
22
22
 
23
23
  @include edeep(close) {
@@ -31,4 +31,4 @@
31
31
  font-size: $-video-preview-close-font-size;
32
32
  color: $-video-preview-close-color;
33
33
  }
34
- }
34
+ }
@@ -25,7 +25,7 @@
25
25
  width: 80rpx;
26
26
  height: 80rpx;
27
27
  background: $-virtual-scroll-back-top-bg;
28
- border-radius: 50%;
28
+ border-radius: $-radius-circle;
29
29
  display: flex;
30
30
  align-items: center;
31
31
  justify-content: center;