vdesign-ui 0.2.6 → 0.2.7

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 (195) hide show
  1. package/dist/components/actionbar/index.js +8 -0
  2. package/dist/components/actionbar/index.vue +39 -0
  3. package/dist/components/actionbar/style.less +44 -0
  4. package/dist/components/actionbar-cell/index.js +7 -0
  5. package/dist/components/actionbar-cell/index.vue +38 -0
  6. package/dist/components/actions/index.js +7 -0
  7. package/dist/components/actions/index.vue +76 -0
  8. package/dist/components/actions/style.less +109 -0
  9. package/dist/components/actions-cell/index.js +7 -0
  10. package/dist/components/actions-cell/index.vue +94 -0
  11. package/dist/components/actions-cell/style.less +39 -0
  12. package/dist/components/activityviews/index.js +8 -0
  13. package/dist/components/activityviews/index.vue +192 -0
  14. package/dist/components/activityviews/style.less +152 -0
  15. package/dist/components/badge/index.js +8 -0
  16. package/dist/components/badge/index.vue +49 -0
  17. package/dist/components/badge/style.less +54 -0
  18. package/dist/components/button/index.js +8 -0
  19. package/dist/components/button/index.vue +93 -0
  20. package/dist/components/button/style.less +558 -0
  21. package/dist/components/calendar/end.png +0 -0
  22. package/dist/components/calendar/index-element.vue +84 -0
  23. package/dist/components/calendar/index.js +8 -0
  24. package/dist/components/calendar/index.vue +52 -0
  25. package/dist/components/calendar/start.png +0 -0
  26. package/dist/components/calendar/style.less +138 -0
  27. package/dist/components/checkbox/index.js +8 -0
  28. package/dist/components/checkbox/index.vue +161 -0
  29. package/dist/components/checkbox/style.less +289 -0
  30. package/dist/components/checkbox-group/index.js +7 -0
  31. package/dist/components/checkbox-group/index.vue +69 -0
  32. package/dist/components/common/state/index.vue +33 -0
  33. package/dist/components/common/state/style.less +48 -0
  34. package/dist/components/data-list/index.js +10 -0
  35. package/dist/components/data-list/index.vue +19 -0
  36. package/dist/components/data-list/style.less +623 -0
  37. package/dist/components/datetime-picker/index.js +8 -0
  38. package/dist/components/datetime-picker/index.vue +37 -0
  39. package/dist/components/datetime-picker/style.less +24 -0
  40. package/dist/components/dialog/index.js +8 -0
  41. package/dist/components/dialog/index.vue +164 -0
  42. package/dist/components/dialog/overlay-manager.js +18 -0
  43. package/dist/components/dialog/style.less +139 -0
  44. package/dist/components/divider/index.js +8 -0
  45. package/dist/components/divider/index.vue +54 -0
  46. package/dist/components/divider/style.less +92 -0
  47. package/dist/components/dropdown/index.js +8 -0
  48. package/dist/components/dropdown/index.vue +218 -0
  49. package/dist/components/dropdown/style.less +432 -0
  50. package/dist/components/empty/404-dark.png +0 -0
  51. package/dist/components/empty/404.png +0 -0
  52. package/dist/components/empty/index.js +8 -0
  53. package/dist/components/empty/index.vue +138 -0
  54. package/dist/components/empty/network-dark.png +0 -0
  55. package/dist/components/empty/network.png +0 -0
  56. package/dist/components/empty/nocoupons-dark.png +0 -0
  57. package/dist/components/empty/nocoupons.png +0 -0
  58. package/dist/components/empty/nodata-dark.png +0 -0
  59. package/dist/components/empty/nodata.png +0 -0
  60. package/dist/components/empty/nomargin-dark.png +0 -0
  61. package/dist/components/empty/nomargin.png +0 -0
  62. package/dist/components/empty/nonotice-dark.png +0 -0
  63. package/dist/components/empty/nonotice.png +0 -0
  64. package/dist/components/empty/noocomments-dark.png +0 -0
  65. package/dist/components/empty/noocomments.png +0 -0
  66. package/dist/components/empty/noorders-dark.png +0 -0
  67. package/dist/components/empty/noorders.png +0 -0
  68. package/dist/components/empty/noposition-dark.png +0 -0
  69. package/dist/components/empty/noposition.png +0 -0
  70. package/dist/components/empty/nosearch-dark.png +0 -0
  71. package/dist/components/empty/nosearch.png +0 -0
  72. package/dist/components/empty/style.less +61 -0
  73. package/dist/components/footer/index.js +7 -0
  74. package/dist/components/footer/index.vue +33 -0
  75. package/dist/components/footer/style.less +21 -0
  76. package/dist/components/footnav/index.js +7 -0
  77. package/dist/components/footnav/index.vue +93 -0
  78. package/dist/components/footnav/style.less +23 -0
  79. package/dist/components/footnav-item/index.js +7 -0
  80. package/dist/components/footnav-item/index.vue +50 -0
  81. package/dist/components/footnav-item/style.less +39 -0
  82. package/dist/components/form/index.js +7 -0
  83. package/dist/components/form/index.vue +12 -0
  84. package/dist/components/headnav/index.js +7 -0
  85. package/dist/components/headnav/index.vue +185 -0
  86. package/dist/components/headnav/style.less +232 -0
  87. package/dist/components/icon/font/iconfont.css +163 -0
  88. package/dist/components/icon/font/iconfont.js +6 -0
  89. package/dist/components/icon/index.js +9 -0
  90. package/dist/components/icon/index.vue +96 -0
  91. package/dist/components/icon/style.less +44 -0
  92. package/dist/components/input/calcTextareaHeight.js +162 -0
  93. package/dist/components/input/index.js +8 -0
  94. package/dist/components/input/index.vue +345 -0
  95. package/dist/components/input/style.less +471 -0
  96. package/dist/components/list/index.js +8 -0
  97. package/dist/components/list/index.vue +152 -0
  98. package/dist/components/list/style.less +213 -0
  99. package/dist/components/loading/index.js +7 -0
  100. package/dist/components/loading/index.vue +68 -0
  101. package/dist/components/loading/style.less +54 -0
  102. package/dist/components/mixins/clickoutside.js +81 -0
  103. package/dist/components/mixins/dom.js +41 -0
  104. package/dist/components/mixins/languageMixin.js +41 -0
  105. package/dist/components/mixins/outlineConfigPlugin.js +45 -0
  106. package/dist/components/mixins/router-link.js +23 -0
  107. package/dist/components/mixins/themeMixin.js +43 -0
  108. package/dist/components/noticebar/index.js +8 -0
  109. package/dist/components/noticebar/index.vue +258 -0
  110. package/dist/components/noticebar/style.less +328 -0
  111. package/dist/components/overlay/index.js +8 -0
  112. package/dist/components/overlay/index.vue +184 -0
  113. package/dist/components/overlay/style.less +23 -0
  114. package/dist/components/pagebreak/index.js +7 -0
  115. package/dist/components/pagebreak/index.vue +67 -0
  116. package/dist/components/pagebreak/style.less +42 -0
  117. package/dist/components/password/index.js +8 -0
  118. package/dist/components/password/index.vue +60 -0
  119. package/dist/components/popover/index.js +8 -0
  120. package/dist/components/popover/index.vue +100 -0
  121. package/dist/components/popover/style.less +346 -0
  122. package/dist/components/popover/vue-popover.vue +314 -0
  123. package/dist/components/popup/index.js +7 -0
  124. package/dist/components/popup/index.vue +243 -0
  125. package/dist/components/radio/index.js +8 -0
  126. package/dist/components/radio/index.vue +184 -0
  127. package/dist/components/radio/style.less +294 -0
  128. package/dist/components/radio-group/index.js +6 -0
  129. package/dist/components/radio-group/index.vue +58 -0
  130. package/dist/components/result/completed-dark.png +0 -0
  131. package/dist/components/result/completed.png +0 -0
  132. package/dist/components/result/error-dark.png +0 -0
  133. package/dist/components/result/error.png +0 -0
  134. package/dist/components/result/index.js +8 -0
  135. package/dist/components/result/index.vue +73 -0
  136. package/dist/components/result/style.less +44 -0
  137. package/dist/components/result/wait-dark.png +0 -0
  138. package/dist/components/result/wait.png +0 -0
  139. package/dist/components/search/index.js +8 -0
  140. package/dist/components/search/index.vue +66 -0
  141. package/dist/components/selector/index.js +8 -0
  142. package/dist/components/selector/index.vue +161 -0
  143. package/dist/components/selector/style.less +484 -0
  144. package/dist/components/skeleton/index.js +7 -0
  145. package/dist/components/skeleton/index.vue +206 -0
  146. package/dist/components/skeleton/style.less +197 -0
  147. package/dist/components/slider/draggable.js +49 -0
  148. package/dist/components/slider/index.js +7 -0
  149. package/dist/components/slider/index.vue +167 -0
  150. package/dist/components/slider/style.less +100 -0
  151. package/dist/components/slider/utils.js +60 -0
  152. package/dist/components/step/index.js +7 -0
  153. package/dist/components/step/index.vue +48 -0
  154. package/dist/components/step/style.less +58 -0
  155. package/dist/components/step-item/index.js +7 -0
  156. package/dist/components/step-item/index.vue +126 -0
  157. package/dist/components/step-item/style.less +362 -0
  158. package/dist/components/stepper/index.js +8 -0
  159. package/dist/components/stepper/index.vue +146 -0
  160. package/dist/components/style/index.vue +42 -0
  161. package/dist/components/switch/index.js +8 -0
  162. package/dist/components/switch/index.vue +72 -0
  163. package/dist/components/switch/style.less +56 -0
  164. package/dist/components/tab/index.js +7 -0
  165. package/dist/components/tab/index.vue +53 -0
  166. package/dist/components/tabs/index.js +8 -0
  167. package/dist/components/tabs/index.vue +172 -0
  168. package/dist/components/tabs/style.less +377 -0
  169. package/dist/components/tag/index.js +7 -0
  170. package/dist/components/tag/index.vue +64 -0
  171. package/dist/components/tag/style.less +211 -0
  172. package/dist/components/title/index.js +8 -0
  173. package/dist/components/title/index.vue +99 -0
  174. package/dist/components/title/style.less +188 -0
  175. package/dist/components/toast/index.js +83 -0
  176. package/dist/components/toast/index.vue +49 -0
  177. package/dist/components/toast/style.less +55 -0
  178. package/dist/components/transition/index.js +8 -0
  179. package/dist/components/transition/index.vue +13 -0
  180. package/dist/components/transition/style.less +208 -0
  181. package/dist/components/upload/index.js +7 -0
  182. package/dist/components/upload/index.vue +106 -0
  183. package/dist/components/upload/style.less +147 -0
  184. package/dist/components/utils/assist.js +34 -0
  185. package/dist/components/utils/env.js +2 -0
  186. package/dist/demo.html +10 -0
  187. package/dist/locale/ar.js +98 -0
  188. package/dist/locale/en.js +98 -0
  189. package/dist/locale/zh.js +98 -0
  190. package/dist/token.css +2990 -0
  191. package/dist/vdesign-ui.common.js +27076 -0
  192. package/dist/vdesign-ui.css +1 -0
  193. package/dist/vdesign-ui.umd.js +27086 -0
  194. package/dist/vdesign-ui.umd.min.js +32 -0
  195. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import Actionbar from './index.vue';
2
+ import './style.less';
3
+
4
+ Actionbar.install = function (Vue) {
5
+ Vue.component(Actionbar.name, Actionbar);
6
+ };
7
+
8
+ export default Actionbar;
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div class="vd-actionbar" :class="wrapClasses">
3
+ <div class="vd-actionbar__main">
4
+ <slot></slot>
5
+ </div>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ const prefixCls = 'vd-actionbar';
10
+ export default {
11
+ name: 'vd-actionbar',
12
+ props: {
13
+ // 默认左右有间距,但是实际设计稿有的没有间距,
14
+ //block属性预留一个填充,如果使用基础图标按钮组件填充,不太好填充。
15
+ block: {
16
+ type: Boolean,
17
+ default: false
18
+ }
19
+ },
20
+ data() {
21
+ return {
22
+
23
+ }
24
+ },
25
+ computed: {
26
+ wrapClasses() {
27
+ return [
28
+ {
29
+ [`${prefixCls}__block`]: this.block
30
+ }
31
+ ]
32
+ }
33
+ }
34
+ };
35
+ </script>
36
+
37
+ <style lang="less">
38
+ @import './style.less';
39
+ </style>
@@ -0,0 +1,44 @@
1
+ @actionbar-prefix-cls: vd-actionbar;
2
+
3
+ .@{actionbar-prefix-cls} {
4
+
5
+ display: flex;
6
+ width: 100%;
7
+ height: var(--height-actionbar-content);
8
+ background-color: var(--color-actionbar-bg);
9
+ padding-inline-start: var(--spacing-actionbar-padding_y);
10
+ padding-inline-end: var(--spacing-actionbar-padding_y);
11
+
12
+ &__block {
13
+ padding-inline-start: 0;
14
+ padding-inline-end: 0;
15
+ }
16
+
17
+ &__main {
18
+ display: flex;
19
+ flex: 1;
20
+ justify-content: space-around;
21
+ }
22
+ }
23
+
24
+ .@{actionbar-prefix-cls}-cell {
25
+ display: flex;
26
+ flex: 1;
27
+ align-items: center;
28
+ cursor: pointer;
29
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
30
+ font-size: var(--en-single-f-d-r-fontSize);
31
+ font-weight: var(--en-single-f-d-r-fontWeight);
32
+
33
+ &--left {
34
+ justify-content: left;
35
+ }
36
+
37
+ &--center {
38
+ justify-content: center;
39
+ }
40
+
41
+ &--right {
42
+ justify-content: right;
43
+ }
44
+ }
@@ -0,0 +1,7 @@
1
+ import ActionbarCell from './index.vue';
2
+
3
+ ActionbarCell.install = function (Vue) {
4
+ Vue.component(ActionbarCell.name, ActionbarCell);
5
+ };
6
+
7
+ export default ActionbarCell;
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <span class="vd-actionbar-cell" :class="wrapClasses">
3
+ <vd-icon v-if="iconName" :name="iconName"></vd-icon>
4
+ <slot></slot>
5
+ </span>
6
+ </template>
7
+ <script>
8
+ import VdIcon from '../icon';
9
+ const prefixCls = 'vd-actionbar'
10
+ export default {
11
+ name: 'vd-actionbar-cell',
12
+ components: {
13
+ VdIcon
14
+ },
15
+ props: {
16
+ // 实际使用场景不多,为了设计验收
17
+ iconName: String,
18
+ direction: {
19
+ type: String,
20
+ default: 'center'
21
+ }
22
+ },
23
+ data() {
24
+ return {
25
+
26
+ };
27
+ },
28
+ computed: {
29
+ wrapClasses() {
30
+ return [
31
+ {
32
+ [`${prefixCls}-cell--${this.direction}`]: this.direction
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ };
38
+ </script>
@@ -0,0 +1,7 @@
1
+ import Actions from './index.vue';
2
+ import './style.less';
3
+ Actions.install = function(Vue) {
4
+ Vue.component(Actions.name, Actions)
5
+ }
6
+
7
+ export default Actions;
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div :class="wrapClasses">
3
+ <span class="vd-actions__text" :class="textClasses" v-if="text">{{ text }}</span>
4
+ <vd-icon v-if="icon && type === 'list'" class="vd-actions__icon" :class="iconClasses" :name="icon"></vd-icon>
5
+ <span class="vd-actions__content" :class="contentBg" v-if="icon && type === 'card'">
6
+ <vd-icon class="vd-actions__icon" :class="iconClasses" :name="icon"></vd-icon>
7
+ </span>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ import VdIcon from '../icon';
13
+ const prefixCls = 'vd-actions'
14
+ export default {
15
+ name: 'vd-actions',
16
+ components: {
17
+ VdIcon
18
+ },
19
+ props: {
20
+ type: {
21
+ type: String,
22
+ },
23
+ colors: {
24
+ type: String,
25
+ },
26
+ backgrounds: {
27
+ type: String,
28
+ },
29
+ text: {
30
+ type: String,
31
+ },
32
+ icon: {
33
+ type: String,
34
+ },
35
+ disabled:Boolean,
36
+ },
37
+ computed: {
38
+ wrapClasses() {
39
+ return [
40
+ `${prefixCls}`,
41
+ {
42
+ [`${prefixCls}__${this.type}`]: this.type,
43
+ [`${prefixCls}__${this.colors}`]: this.colors,
44
+ [`${prefixCls}__${this.colors}--disabled`]: this.disabled && (this.type ==='list'),
45
+ }
46
+ ]
47
+ },
48
+ contentBg() {
49
+ return [
50
+ {
51
+ [`${prefixCls}__content--${this.backgrounds}`]: this.backgrounds,
52
+ [`${prefixCls}__content--${this.backgrounds}--disabled`]: this.disabled,
53
+ }
54
+ ]
55
+ },
56
+ textClasses(){
57
+ return [
58
+ {
59
+ [`${prefixCls}__text--disabled`]: this.disabled
60
+ }
61
+ ]
62
+ },
63
+ iconClasses(){
64
+ return [
65
+ {
66
+ [`${prefixCls}__icon--disabled`]: this.disabled
67
+ }
68
+ ]
69
+ },
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <style lang="less">
75
+ @import './style.less';
76
+ </style>
@@ -0,0 +1,109 @@
1
+ @actions-prefix-cls: vd-actions;
2
+
3
+ .@{actions-prefix-cls} {
4
+ height: 100%;
5
+ display: inline-flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+
9
+ &__list {
10
+ width: fit-content;
11
+ min-width: var(--width-actions-form_small);
12
+ max-width: var(--width-actions-form_large);
13
+ padding: 0 var(--spacing-actions-form-padding_y);
14
+ }
15
+
16
+ &__card {
17
+ padding: 0 var(--spacing-actions-card_item-margin_y);
18
+
19
+ .@{actions-prefix-cls}__content {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ border-radius: 50%;
24
+ width: var(--width-actions-card);
25
+ height: var(--width-actions-card);
26
+
27
+ &--green {
28
+ background-color: var(--color-actions-bg-green);
29
+ &--disabled {
30
+ background-color: var(--color-actions-bg-green-disable);
31
+ }
32
+ }
33
+
34
+ &--warning {
35
+ background-color: var(--color-actions-bg-warning);
36
+ &--disabled {
37
+ background-color: var(--color-actions-bg-warning-disable);
38
+ }
39
+ }
40
+
41
+ &--blue {
42
+ background-color: var(--color-actions-bg-blue);
43
+ &--disabled {
44
+ background-color: var(--color-actions-bg-blue-disable);
45
+ }
46
+ }
47
+
48
+ &--gray {
49
+ background-color: var(--color-actions-bg-gray);
50
+ &--disabled {
51
+ background-color: var(--color-actions-bg-gray-disable);
52
+ }
53
+ }
54
+ }
55
+
56
+ .@{actions-prefix-cls}__icon {
57
+ color: var(--color-actions-text);
58
+ font-size: var(--icon-actions-card);
59
+ &--disabled {
60
+ color: var(--color-actions-text-disable);
61
+ }
62
+ }
63
+ }
64
+
65
+ &__text {
66
+ color: var(--color-actions-text);
67
+ font-size: var(--en-single-f-d-s-fontSize);
68
+ font-weight: var(--en-single-f-d-s-fontWeight);
69
+ &--disabled {
70
+ color: var(--color-actions-text-disable);
71
+ }
72
+ }
73
+
74
+ &__icon {
75
+ font-size: var(--icon-actions-size);
76
+ color: var(--color-actions-text);
77
+ &--disabled {
78
+ color: var(--color-actions-text-disable);
79
+ }
80
+ }
81
+
82
+ &__green {
83
+ background-color: var(--color-actions-bg-green);
84
+ &--disabled {
85
+ background-color: var(--color-actions-bg-green-disable);
86
+ }
87
+ }
88
+
89
+ &__warning {
90
+ background-color: var(--color-actions-bg-warning);
91
+ &--disabled {
92
+ background-color: var(--color-actions-bg-warning-disable);
93
+ }
94
+ }
95
+
96
+ &__blue {
97
+ background-color: var(--color-actions-bg-blue);
98
+ &--disabled {
99
+ background-color: var(--color-actions-bg-blue-disable);
100
+ }
101
+ }
102
+
103
+ &__gray {
104
+ background-color: var(--color-actions-bg-gray);
105
+ &--disabled {
106
+ background-color: var(--color-actions-bg-gray-disable);
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,7 @@
1
+ import ActionsCell from './index.vue';
2
+ import './style.less';
3
+ ActionsCell.install = function(Vue) {
4
+ Vue.component(ActionsCell.name, ActionsCell)
5
+ }
6
+
7
+ export default ActionsCell;
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div class="vd-actions-cell">
3
+ <div class="vd-actions-cell__wrapper" :style="{ transform: `translateX(${offset}px)` }"
4
+ @touchstart="handleTouchStart" @touchmove="handleTouchMove" @touchend="handleTouchEnd" @click="handleClick">
5
+ <div class="vd-actions-cell__left" ref="leftButton">
6
+ <slot name="left"></slot>
7
+ </div>
8
+ <slot name="content"></slot>
9
+ <div class="vd-actions-cell__right" ref="rightButton">
10
+ <slot name="right"></slot>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ export default {
18
+ name: 'vd-actions-cell',
19
+ props: {
20
+ },
21
+ data() {
22
+ return {
23
+ offset: 0, // 初始偏移量
24
+ startX: 0, // 按下时的X坐标
25
+ lastX: 0, // 上一次移动的X坐标
26
+ isDragging: false // 是否正在拖动
27
+ }
28
+ },
29
+ computed: {
30
+
31
+ },
32
+ methods: {
33
+ handleTouchStart(event) {
34
+ this.startX = event.touches[0].pageX;
35
+ this.lastX = this.startX;
36
+ this.isDragging = true;
37
+ },
38
+ handleTouchMove(event) {
39
+ if (!this.isDragging) return;
40
+
41
+ const currentX = event.touches[0].pageX;
42
+ const deltaX = currentX - this.lastX;
43
+
44
+ // // 判断滑动的方向
45
+ // if (deltaX > 0) {
46
+ // // 向右侧滑动
47
+ // // 这里可以执行相应的逻辑
48
+ // this.offset = 0;
49
+ // }
50
+
51
+ // this.lastX = currentX;
52
+ // 计算内容区域的新偏移量
53
+ this.offset += deltaX;
54
+
55
+
56
+ // // 限制内容区域的滑动范围在按钮的宽度以内
57
+ // const buttonWidth = this.$refs.rightButton.offsetWidth;
58
+ // const maxOffset = buttonWidth >= 0 ? buttonWidth : 0;
59
+ // this.offset = Math.max(-maxOffset, Math.min(0, this.offset));
60
+
61
+
62
+ const rightButtonWidth = this.$refs.rightButton.offsetWidth;
63
+ const leftButtonWidth = this.$refs.leftButton.offsetWidth;
64
+ this.offset = Math.max(-rightButtonWidth, Math.min(leftButtonWidth, this.offset));
65
+ this.startX = currentX;
66
+ },
67
+ handleTouchEnd() {
68
+ this.isDragging = false;
69
+ const rightButtonWidth = this.$refs.rightButton.offsetWidth;
70
+ const leftButtonWidth = this.$refs.leftButton.offsetWidth;
71
+ const thresholdRight = rightButtonWidth / 3;
72
+ const thresholdLeft = leftButtonWidth / 3;
73
+
74
+ if (this.offset < -thresholdRight) {
75
+ // 向左侧滑动超过三分之一,显示右侧按钮
76
+ this.offset = -rightButtonWidth;
77
+ } else if (this.offset > thresholdLeft) {
78
+ // 向右侧滑动超过三分之一,显示左侧按钮
79
+ this.offset = leftButtonWidth;
80
+ } else {
81
+ // 按钮偏移不超过三分之一,按钮回到原位
82
+ this.offset = 0;
83
+ }
84
+ },
85
+ handleClick() {
86
+ this.offset = 0;
87
+ }
88
+ }
89
+ }
90
+ </script>
91
+
92
+ <style lang="less">
93
+ @import './style.less';
94
+ </style>
@@ -0,0 +1,39 @@
1
+ @actions-cell-prefix-cls:vd-actions-cell;
2
+
3
+ .@{actions-cell-prefix-cls}{
4
+ height: 100%;
5
+ overflow: hidden;
6
+ position: relative;
7
+ cursor: grab;
8
+
9
+ &__left{
10
+ position: absolute;
11
+ top: 0;
12
+ left: 0;
13
+ height: 100%;
14
+ transform: translate3d(-100%, 0, 0);
15
+ display: flex;
16
+ }
17
+
18
+ &__right{
19
+ position: absolute;
20
+ top: 0;
21
+ right: 0;
22
+ height: 100%;
23
+ transform: translate3d(100%, 0, 0);
24
+ display: flex;
25
+
26
+ }
27
+
28
+
29
+ &__wrapper{
30
+ height: 100%;
31
+ -webkit-transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1);
32
+ transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1);
33
+ -webkit-transition-property: -webkit-transform;
34
+ transition-property: -webkit-transform;
35
+ transition-property: transform;
36
+ transition-property: transform, -webkit-transform;
37
+ transition-duration: 0.6s;
38
+ }
39
+ }
@@ -0,0 +1,8 @@
1
+ import Activityviews from './index.vue';
2
+ import './style.less';
3
+
4
+ Activityviews.install = function (Vue) {
5
+ Vue.component(Activityviews.name, Activityviews);
6
+ };
7
+
8
+ export default Activityviews;
@@ -0,0 +1,192 @@
1
+ <template>
2
+ <div>
3
+ <div class="vd-overlay" v-if="overlay && visible" @click="handleOverlayClick"></div>
4
+ <transition name="vd-activity-views-slide-up">
5
+ <div :class="['vd-activity-views',{'vd-activity-views--safe-area-inset-bottom':safeAreaInsetBottom}]" :style="transitionStyle" v-if="visible">
6
+ <div class="vd-activity-views__header" v-if="withHeader">
7
+ <div class="vd-activity-views__wrapper">
8
+ <vd-icon v-if="backDefault" name="icon_nav_back"></vd-icon>
9
+ <div v-if="title || $slots.title" class="vd-activity-views__title">
10
+ <slot name="title">{{ title }}</slot>
11
+ </div>
12
+ <slot name="close">
13
+ <vd-icon v-if="closeIcon" class="vd-activity-views__close" :name="currentCloseIcon" svg
14
+ @click="onCancel"></vd-icon>
15
+ <vd-button v-if="closeBtn" class="vd-activity-views__done" type="primary_text" size="large"
16
+ @click="onCancel">{{ closeBtn }}</vd-button>
17
+ </slot>
18
+ </div>
19
+ <p v-if="description" class="vd-activity-views__description">{{ description }}</p>
20
+ </div>
21
+ <div v-if="withBar" class="vd-activity-views__bar"></div>
22
+ <div :class="['vd-activity-views__body', { 'vd-activity-views__body--action': actionSheet }]">
23
+ <div v-if="actionSheet" class="vd-activity-views__action">
24
+ <p v-if="title || $slots.title" class="vd-activity-views__action-title vd-hairline--bottom">
25
+ <slot name="title">{{ title }}</slot>
26
+ </p>
27
+ <div class="vd-activity-views__actions">
28
+ <vd-button v-for="(item, index) in actions" block size="large" :type="item.type"
29
+ :key="index" :class="{ 'vd-hairline--bottom': index !== actions.length - 1 }"
30
+ :disabled="item.disabled" @click.stop="onSelect(item)">{{ item.name }}</vd-button>
31
+ </div>
32
+ <div v-if="cancelText" class="vd-activity-views__gap"></div>
33
+ <div v-if="cancelText" class="vd-activity-views__cancel" @click="onCancel">
34
+ <vd-button block type="tertiary" size="large">{{ cancelText }}</vd-button>
35
+ </div>
36
+ </div>
37
+ <slot v-else></slot>
38
+ </div>
39
+ </div>
40
+ </transition>
41
+ </div>
42
+ </template>
43
+
44
+ <script>
45
+ import { inBrowser } from '../utils/env';
46
+ import { themeMixin } from '../mixins/themeMixin';
47
+ import VdIcon from '../icon';
48
+ import VdButton from '../button';
49
+
50
+ export default {
51
+ name: 'vd-activity-views',
52
+ mixins: [themeMixin], // 引入混入
53
+ components: {
54
+ VdIcon,
55
+ VdButton
56
+ },
57
+ props: {
58
+ value: Boolean,
59
+ title: String,
60
+ backDefault: Boolean,
61
+ closeIcon: Boolean,
62
+ closeBtn: String,
63
+ description: String,
64
+ withHeader: {
65
+ type: Boolean,
66
+ default: true
67
+ },
68
+ withBar: Boolean,
69
+ actionSheet: Boolean,
70
+ actions: {
71
+ type: Array,
72
+ default() {
73
+ return [];
74
+ }
75
+ },
76
+ cancelText: String,
77
+ overlay: {
78
+ type: Boolean,
79
+ default: true
80
+ },
81
+ disabled: Boolean,
82
+ closeOnOverlay: {
83
+ type: Boolean,
84
+ default: true
85
+ },
86
+ safeAreaInsetBottom: {
87
+ type: Boolean,
88
+ default: true,
89
+ },
90
+ lockScroll: {
91
+ type: Boolean,
92
+ default: true
93
+ },
94
+ duration: {
95
+ type: Number,
96
+ },
97
+ // 指定挂载的容器,可以是选择器字符串或返回元素的函数
98
+ getContainer: {
99
+ type: [String, Function],
100
+ default: 'body',
101
+ },
102
+ },
103
+ data() {
104
+ return {
105
+ }
106
+ },
107
+ computed: {
108
+ visible() {
109
+ return this.value
110
+ },
111
+ currentCloseIcon() {
112
+ return this.isDarkTheme ? 'icon_btn_dialogclose_dark_svg' : 'icon_btn_dialogclose_svg';
113
+ },
114
+ isDarkTheme() {
115
+ return this.theme === 'dark';
116
+ },
117
+ // 动态设置过渡持续时间的样式
118
+ transitionStyle() {
119
+ return {
120
+ transitionDuration: `${this.duration}s`,
121
+ };
122
+ },
123
+ },
124
+ watch: {
125
+ visible(val) {
126
+ if (inBrowser) {
127
+ if (this.lockScroll) {
128
+ if (val) {
129
+ document.body.style.overflow = 'hidden';
130
+ } else {
131
+ document.body.style.overflow = '';
132
+ }
133
+ }
134
+ }
135
+ }
136
+ },
137
+ methods: {
138
+ closeActivity() {
139
+ this.$emit('input', false);
140
+ },
141
+ onCancel() {
142
+ this.closeActivity();
143
+ this.$emit('cancel');
144
+ },
145
+ onSelect(item) {
146
+ if (!item.disabled) {
147
+ this.$emit('select', item);
148
+ }
149
+ },
150
+ handleOverlayClick() {
151
+ if (this.closeOnOverlay) {
152
+ this.closeActivity();
153
+ }
154
+ },
155
+ // 将弹出层添加到指定的容器中
156
+ appendToContainer() {
157
+ const container =
158
+ typeof this.getContainer === 'function'
159
+ ? this.getContainer()
160
+ : document.querySelector(this.getContainer);
161
+ if (container && container !== this.$el.parentNode) {
162
+ container.appendChild(this.$el);
163
+ }
164
+ },
165
+ },
166
+ mounted() {
167
+ if (inBrowser) {
168
+ this.appendToContainer();
169
+ if (this.lockScroll && this.visible) {
170
+ document.body.style.overflow = 'hidden';
171
+ }
172
+ }
173
+ },
174
+ beforeDestroy() {
175
+ if (inBrowser){
176
+ if(this.lockScroll) {
177
+ document.body.style.overflow = '';
178
+ }
179
+ // 从容器中移除弹出层元素
180
+ if (this.$el.parentNode) {
181
+ this.$el.parentNode.removeChild(this.$el);
182
+ }
183
+ }
184
+ }
185
+
186
+ }
187
+ </script>
188
+
189
+ <style lang="less">
190
+ @import './style.less';
191
+
192
+ </style>