vdesign-ui 0.1.19 → 0.1.20

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 (193) hide show
  1. package/dist/components/actionbar/actionbar-cell/index.vue +34 -0
  2. package/dist/components/actionbar/index.js +8 -0
  3. package/dist/components/actionbar/index.vue +39 -0
  4. package/dist/components/actionbar/style.less +48 -0
  5. package/dist/components/actions-cell/actions/index.js +7 -0
  6. package/dist/components/actions-cell/actions/index.vue +76 -0
  7. package/dist/components/actions-cell/actions/style.less +112 -0
  8. package/dist/components/actions-cell/index.js +7 -0
  9. package/dist/components/actions-cell/index.vue +94 -0
  10. package/dist/components/actions-cell/style.less +39 -0
  11. package/dist/components/activityviews/index.js +8 -0
  12. package/dist/components/activityviews/index.vue +140 -0
  13. package/dist/components/activityviews/style.less +138 -0
  14. package/dist/components/badge/index.js +8 -0
  15. package/dist/components/badge/index.vue +49 -0
  16. package/dist/components/badge/style.less +66 -0
  17. package/dist/components/button/index.js +8 -0
  18. package/dist/components/button/index.vue +89 -0
  19. package/dist/components/button/style.less +563 -0
  20. package/dist/components/calendar/end.png +0 -0
  21. package/dist/components/calendar/index-element.vue +84 -0
  22. package/dist/components/calendar/index.js +8 -0
  23. package/dist/components/calendar/index.vue +52 -0
  24. package/dist/components/calendar/start.png +0 -0
  25. package/dist/components/calendar/style.less +167 -0
  26. package/dist/components/checkbox/assist.js +34 -0
  27. package/dist/components/checkbox/checkbox-group/index.js +8 -0
  28. package/dist/components/checkbox/checkbox-group/index.vue +69 -0
  29. package/dist/components/checkbox/index.js +8 -0
  30. package/dist/components/checkbox/index.vue +184 -0
  31. package/dist/components/checkbox/style.less +291 -0
  32. package/dist/components/common/state/index.vue +80 -0
  33. package/dist/components/data-list/index.js +10 -0
  34. package/dist/components/data-list/index.vue +19 -0
  35. package/dist/components/data-list/style.less +624 -0
  36. package/dist/components/datetime-picker/index.js +8 -0
  37. package/dist/components/datetime-picker/index.vue +37 -0
  38. package/dist/components/datetime-picker/style.less +24 -0
  39. package/dist/components/dialog/index.js +8 -0
  40. package/dist/components/dialog/index.vue +162 -0
  41. package/dist/components/dialog/overlay-manager.js +18 -0
  42. package/dist/components/dialog/style.less +132 -0
  43. package/dist/components/divider/index.js +8 -0
  44. package/dist/components/divider/index.vue +54 -0
  45. package/dist/components/divider/style.less +92 -0
  46. package/dist/components/dropdown/index.js +8 -0
  47. package/dist/components/dropdown/index.vue +210 -0
  48. package/dist/components/dropdown/style.less +418 -0
  49. package/dist/components/empty/404-dark.png +0 -0
  50. package/dist/components/empty/404.png +0 -0
  51. package/dist/components/empty/index.js +8 -0
  52. package/dist/components/empty/index.vue +95 -0
  53. package/dist/components/empty/network-dark.png +0 -0
  54. package/dist/components/empty/network.png +0 -0
  55. package/dist/components/empty/nodata-dark.png +0 -0
  56. package/dist/components/empty/nodata.png +0 -0
  57. package/dist/components/empty/style.less +60 -0
  58. package/dist/components/footer/index.js +7 -0
  59. package/dist/components/footer/index.vue +29 -0
  60. package/dist/components/footer/style.less +22 -0
  61. package/dist/components/footnav/footnav-item/index.js +7 -0
  62. package/dist/components/footnav/footnav-item/index.vue +75 -0
  63. package/dist/components/footnav/footnav-item/style.less +39 -0
  64. package/dist/components/footnav/index.js +7 -0
  65. package/dist/components/footnav/index.vue +97 -0
  66. package/dist/components/footnav/style.less +23 -0
  67. package/dist/components/form/index.js +7 -0
  68. package/dist/components/form/index.vue +12 -0
  69. package/dist/components/headnav/index.js +7 -0
  70. package/dist/components/headnav/index.vue +163 -0
  71. package/dist/components/headnav/style.less +245 -0
  72. package/dist/components/icon/font/iconfont.css +1050 -0
  73. package/dist/components/icon/font/iconfont.js +2 -0
  74. package/dist/components/icon/index.js +9 -0
  75. package/dist/components/icon/index.vue +46 -0
  76. package/dist/components/icon/style.less +44 -0
  77. package/dist/components/input/calcTextareaHeight.js +266 -0
  78. package/dist/components/input/index.js +8 -0
  79. package/dist/components/input/index.vue +343 -0
  80. package/dist/components/input/password/index.js +8 -0
  81. package/dist/components/input/password/index.vue +60 -0
  82. package/dist/components/input/search/index.js +8 -0
  83. package/dist/components/input/search/index.vue +66 -0
  84. package/dist/components/input/stepper/index.js +8 -0
  85. package/dist/components/input/stepper/index.vue +136 -0
  86. package/dist/components/input/style.less +497 -0
  87. package/dist/components/list/index.js +8 -0
  88. package/dist/components/list/index.vue +159 -0
  89. package/dist/components/list/style.less +292 -0
  90. package/dist/components/loading/index.js +7 -0
  91. package/dist/components/loading/index.vue +53 -0
  92. package/dist/components/loading/loading.png +0 -0
  93. package/dist/components/loading/refresh.png +0 -0
  94. package/dist/components/loading/style.less +48 -0
  95. package/dist/components/mixins/clickoutside.js +81 -0
  96. package/dist/components/mixins/dom.js +41 -0
  97. package/dist/components/mixins/languageMixin.js +38 -0
  98. package/dist/components/mixins/outlineConfigPlugin.js +40 -0
  99. package/dist/components/mixins/router-link.js +23 -0
  100. package/dist/components/mixins/themeMixin.js +29 -0
  101. package/dist/components/noticebar/index.js +8 -0
  102. package/dist/components/noticebar/index.vue +247 -0
  103. package/dist/components/noticebar/style.less +332 -0
  104. package/dist/components/overlay/index.js +8 -0
  105. package/dist/components/overlay/index.vue +161 -0
  106. package/dist/components/overlay/style.less +23 -0
  107. package/dist/components/pagebreak/index.js +7 -0
  108. package/dist/components/pagebreak/index.vue +60 -0
  109. package/dist/components/pagebreak/style.less +43 -0
  110. package/dist/components/popover/index.js +8 -0
  111. package/dist/components/popover/index.vue +99 -0
  112. package/dist/components/popover/style.less +346 -0
  113. package/dist/components/popover/vue-popover.vue +314 -0
  114. package/dist/components/radio/assist.js +34 -0
  115. package/dist/components/radio/index.js +8 -0
  116. package/dist/components/radio/index.vue +159 -0
  117. package/dist/components/radio/radio-group/index.vue +70 -0
  118. package/dist/components/radio/style.less +297 -0
  119. package/dist/components/result/completed-dark.png +0 -0
  120. package/dist/components/result/completed.png +0 -0
  121. package/dist/components/result/error-dark.png +0 -0
  122. package/dist/components/result/error.png +0 -0
  123. package/dist/components/result/index.js +8 -0
  124. package/dist/components/result/index.vue +75 -0
  125. package/dist/components/result/style.less +42 -0
  126. package/dist/components/result/wait-dark.png +0 -0
  127. package/dist/components/result/wait.png +0 -0
  128. package/dist/components/selector/index.js +8 -0
  129. package/dist/components/selector/index.vue +124 -0
  130. package/dist/components/selector/style.less +474 -0
  131. package/dist/components/skeleton/index.js +7 -0
  132. package/dist/components/skeleton/index.vue +142 -0
  133. package/dist/components/skeleton/style.less +192 -0
  134. package/dist/components/slider/draggable.js +49 -0
  135. package/dist/components/slider/index.js +7 -0
  136. package/dist/components/slider/index.vue +173 -0
  137. package/dist/components/slider/style.less +96 -0
  138. package/dist/components/slider/utils.js +60 -0
  139. package/dist/components/step/index.js +7 -0
  140. package/dist/components/step/index.vue +48 -0
  141. package/dist/components/step/style.less +59 -0
  142. package/dist/components/step-item/index.js +7 -0
  143. package/dist/components/step-item/index.vue +117 -0
  144. package/dist/components/step-item/style.less +361 -0
  145. package/dist/components/style/index.vue +42 -0
  146. package/dist/components/switch/index.js +8 -0
  147. package/dist/components/switch/index.vue +72 -0
  148. package/dist/components/switch/style.less +56 -0
  149. package/dist/components/tabs/index.js +8 -0
  150. package/dist/components/tabs/index.vue +145 -0
  151. package/dist/components/tabs/style.less +385 -0
  152. package/dist/components/tabs/tab/index.vue +56 -0
  153. package/dist/components/tag/index.js +7 -0
  154. package/dist/components/tag/index.vue +50 -0
  155. package/dist/components/tag/style.less +211 -0
  156. package/dist/components/title/index.js +8 -0
  157. package/dist/components/title/index.vue +92 -0
  158. package/dist/components/title/style.less +188 -0
  159. package/dist/components/toast/index.js +80 -0
  160. package/dist/components/toast/index.vue +44 -0
  161. package/dist/components/toast/style.less +55 -0
  162. package/dist/components/transition/index.js +8 -0
  163. package/dist/components/transition/index.vue +13 -0
  164. package/dist/components/transition/style.less +208 -0
  165. package/dist/components/upload/index.js +7 -0
  166. package/dist/components/upload/index.vue +224 -0
  167. package/dist/components/upload/style.less +156 -0
  168. package/dist/demo.html +10 -0
  169. package/dist/locale/ar.js +98 -0
  170. package/dist/locale/en.js +98 -0
  171. package/dist/locale/zh.js +98 -0
  172. package/dist/token.css +2982 -0
  173. package/dist/vdesign-ui.common.js +27204 -0
  174. package/dist/vdesign-ui.css +1 -0
  175. package/dist/vdesign-ui.umd.js +27214 -0
  176. package/dist/vdesign-ui.umd.min.js +32 -0
  177. package/package.json +1 -1
  178. package/dist/css/chunk-1952c402.04c2303e.css +0 -1
  179. package/dist/css/chunk-6a5c6104.38021b56.css +0 -1
  180. package/dist/css/chunk-vendors.4ecfba63.css +0 -1
  181. package/dist/css/sites.395ce21f.css +0 -1
  182. package/dist/img/bg_mobile.5909f667.png +0 -0
  183. package/dist/img/icon.a67073c3.svg +0 -7
  184. package/dist/img/iphoneX.38c8778e.png +0 -0
  185. package/dist/img/logo-white.fad4f907.png +0 -0
  186. package/dist/img/logo.1eda11d6.png +0 -0
  187. package/dist/img/qrcode2.0a9d9044.png +0 -0
  188. package/dist/index.html +0 -1
  189. package/dist/js/chunk-1952c402.c58ecfb5.js +0 -1
  190. package/dist/js/chunk-2d2183be.2a64419d.js +0 -1
  191. package/dist/js/chunk-6a5c6104.c8fa5635.js +0 -1
  192. package/dist/js/chunk-vendors.490b7673.js +0 -37
  193. package/dist/js/sites.5a217467.js +0 -1
@@ -0,0 +1,142 @@
1
+ <template>
2
+ <div class="vd-skeleton" :class="{ 'vd-skeleton--animate': animate }">
3
+ <template v-if="loading">
4
+ <div class="vd-skeleton__img" v-if="img"></div>
5
+ <div class="vd-skeleton__title" :class="titleClasses" v-if="title"></div>
6
+ <div class="vd-skeleton__button" v-if="button"></div>
7
+ <div class="vd-skeleton__img--s" v-if="sImg"></div>
8
+ <div class="vd-skeleton__avatar" :class="avatarClasses" v-if="avatar"></div>
9
+ <div v-if="paragraph || text" class="vd-skeleton__content">
10
+ <div class="vd-skeleton__text" v-if="text"></div>
11
+ <template v-if="paragraph">
12
+ <div class="vd-skeleton__paragraph" v-for="item in rows" :key="item" :class="{
13
+ 'is-last': item === rows && rows > 1,
14
+ }">
15
+ </div>
16
+ </template>
17
+ </div>
18
+ <div class="vd-skeleton__stock" v-if="stock">
19
+ <div class="vd-skeleton__stock--left">
20
+ <span class="vd-skeleton__stock--data"></span>
21
+ <span class="vd-skeleton__stock--subdatax"></span>
22
+ </div>
23
+ <div class="vd-skeleton--space">
24
+ <div class="vd-skeleton__stock--center"></div>
25
+ <div class="vd-skeleton__stock--right spacing">
26
+ <span class="vd-skeleton__stock--title"></span>
27
+ <span class="vd-skeleton__stock--text"></span>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ <div class="vd-skeleton__stock" v-if="data">
32
+ <div class="vd-skeleton__stock--left">
33
+ <span class="vd-skeleton__stock--data"></span>
34
+ <span class="vd-skeleton__stock--subdatal"></span>
35
+ </div>
36
+ <div class="vd-skeleton--space">
37
+ <div class="vd-skeleton__stock--right">
38
+ <span class="vd-skeleton__stock--title"></span>
39
+ <span class="vd-skeleton__stock--text"></span>
40
+ </div>
41
+ <div class="vd-skeleton__stock--right">
42
+ <span class="vd-skeleton__stock--title"></span>
43
+ <span class="vd-skeleton__stock--text"></span>
44
+ </div>
45
+ <div class="vd-skeleton__stock--right">
46
+ <span class="vd-skeleton__stock--title"></span>
47
+ <span class="vd-skeleton__stock--text"></span>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <div class="vd-skeleton__equally" v-if="equally">
52
+ <div class="vd-skeleton__img" v-for="item in equallys" :key="item" :style="{ height: height + 'px' }"></div>
53
+ </div>
54
+ </template>
55
+ <template v-else>
56
+ <slot></slot>
57
+ </template>
58
+ </div>
59
+ </template>
60
+
61
+ <script>
62
+ const prefixCls = 'vd-skeleton'
63
+ export default {
64
+ name: 'vd-skeleton',
65
+ props: {
66
+ rows: {
67
+ type: Number,
68
+ default: 4
69
+ },
70
+ img: {
71
+ type: Boolean
72
+ },
73
+ title: {
74
+ type: Boolean
75
+ },
76
+ button: {
77
+ type: Boolean
78
+ },
79
+ paragraph: {
80
+ type: Boolean
81
+ },
82
+ sImg: {
83
+ type: Boolean
84
+ },
85
+ avatar: {
86
+ type: Boolean
87
+ },
88
+ text: {
89
+ type: Boolean
90
+ },
91
+ stock: {
92
+ type: Boolean
93
+ },
94
+ data: {
95
+ type: Boolean
96
+ },
97
+ equally: {
98
+ type: Boolean
99
+ },
100
+ equallys: {
101
+ type: Number,
102
+ default: 2
103
+ },
104
+ height: {
105
+ type: Number
106
+ },
107
+ animate: {
108
+ type: Boolean,
109
+ default: true
110
+ },
111
+ titleSize: {
112
+ type: String,
113
+ default: 'l'
114
+ },
115
+ avatarSize: {
116
+ type: String,
117
+ default: 's'
118
+ },
119
+ loading: {
120
+ type: Boolean,
121
+ default: true
122
+ },
123
+ },
124
+ computed: {
125
+ titleClasses() {
126
+ return {
127
+ [`${prefixCls}__title--${this.titleSize}`]: this.titleSize,
128
+ }
129
+ },
130
+ avatarClasses() {
131
+ return {
132
+ [`${prefixCls}__avatar--${this.avatarSize}`]: this.avatarSize,
133
+ }
134
+ },
135
+ }
136
+
137
+ }
138
+ </script>
139
+
140
+ <style lang="less">
141
+ @import './style.less';
142
+ </style>
@@ -0,0 +1,192 @@
1
+ @skeleton-prefix-cls: vd-skeleton;
2
+
3
+ .@{skeleton-prefix-cls}{
4
+ display: flex;
5
+ padding: 0 calc(var(--spacing-base-loose) * 1px);
6
+
7
+ &__img, &__title, &__button, &__img--s, &__paragraph, &__avatar, &__text,
8
+ &__stock--data, &__stock--subdatax, &__stock--subdatal, &__stock--center, &__stock--title, &__stock--text,&__stock--content,&__stock--maindata
9
+ {
10
+ background: var(--color-skeleton-bg);
11
+ }
12
+
13
+ &--animate &__img, &__title, &__button, &__img--s, &__paragraph, &__avatar, &__text,
14
+ &__stock--data, &__stock--subdatax, &__stock--subdatal, &__stock--center, &__stock--title, &__stock--text,&__stock--content,&__stock--maindata
15
+ {
16
+ background: linear-gradient(90deg,var(--color-skeleton-bg) 25%,var(--color-skeleton-loading_gradient-bg-active) 44%,var(--color-skeleton-bg) 88%);
17
+ // background: linear-gradient(90deg,rgba(247,248,249,1) 25%,rgba(247,248,249,.3) 44%,rgba(247,248,249,1) 88%);
18
+ background-size: 400% 100%;
19
+ animation: skeleton-loading 1.4s ease infinite;
20
+ animation-fill-mode: forwards;
21
+ }
22
+
23
+ &__img{
24
+ width: 100%;
25
+ height: calc(var(--height-skeleton-img) * 1px);
26
+ border-radius: calc(var(--radius-skeleton-img) * 1px);
27
+ }
28
+
29
+ &__title{
30
+ width: calc(var(--width-skeleton-head) * 1px);
31
+
32
+ &--l{
33
+ height: calc(var(--height-skeleton-text_l) * 1px);
34
+ border-radius: calc(var(--radius-skeleton-text_l) * 1px);
35
+ }
36
+ &--m{
37
+ height: calc(var(--height-skeleton-text_m) * 1px);
38
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
39
+ }
40
+ &--s{
41
+ height: calc(var(--height-skeleton-text_s) * 1px);
42
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
43
+ }
44
+ }
45
+
46
+ &__button{
47
+ width: calc(var(--width-skeleton-button) * 1px);
48
+ height: calc(var(--height-skeleton-button) * 1px);
49
+ border-radius: calc(var(--radius-skeleton-button) * 1px);
50
+ }
51
+
52
+ &__img--s{
53
+ width: calc(var(--width-skeleton-img_small) * 1px);
54
+ height: calc(var(--height-skeleton-small_shapes) * 1px);
55
+ border-radius: calc(var(--radius-skeleton-small_shapes) * 1px);
56
+ }
57
+
58
+ &__content{
59
+ width: 100%;
60
+ .is-last{
61
+ width: 80%;
62
+ }
63
+ }
64
+
65
+ &__paragraph{
66
+ width: 100%;
67
+ height: calc(var(--height-skeleton-text_s) * 1px);
68
+ margin-block-end: calc(var(--spacing-skeleton-text-margin_bottom) * 1px);
69
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
70
+ }
71
+
72
+ &__avatar{
73
+ flex-shrink: 0;
74
+ border-radius: 50%;
75
+ margin-inline-end: calc(var(--spacing-skeleton-avatar-margin_right) * 1px);
76
+
77
+
78
+ &--l{
79
+ width: calc(var(--width-skeleton-avatar_l) * 1px);
80
+ height: calc(var(--width-skeleton-avatar_l) * 1px);
81
+ }
82
+ &--m{
83
+ width: calc(var(--width-skeleton-avatar_m) * 1px);
84
+ height: calc(var(--width-skeleton-avatar_m) * 1px);
85
+ }
86
+ &--s{
87
+ width: calc(var(--width-skeleton-avatar_s) * 1px);
88
+ height: calc(var(--width-skeleton-avatar_s) * 1px);
89
+ }
90
+ }
91
+
92
+ &__text{
93
+ margin: calc(var(--spacing-skeleton-avatar-margin_bottom) * 1px) 0;
94
+ width: calc(var(--width-skeleton-avatar_text) * 1px);
95
+ height: calc(var(--height-skeleton-text_m) * 1px);
96
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
97
+ }
98
+
99
+
100
+ &__stock{
101
+ width: 100%;
102
+ display: flex;
103
+ justify-content: space-between;
104
+ &--left{
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+ &--data{
109
+ width: calc(var(--width-skeleton-stock_data_s) * 1px);
110
+ height: calc(var(--height-skeleton-text_m) * 1px);
111
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
112
+ }
113
+ &--subdatax{
114
+ margin-block-start: calc(var(--spacing-skeleton-stock-padding_x) * 1px);
115
+ width: calc(var(--width-skeleton-stock_data_xl) * 1px);
116
+ height: calc(var(--height-skeleton-text_s) * 1px);
117
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
118
+ }
119
+ &--subdatal{
120
+ margin-block-start: calc(var(--spacing-skeleton-stock-padding_x) * 1px);
121
+ width: calc(var(--width-skeleton-stock_data_l) * 1px);
122
+ height: calc(var(--height-skeleton-text_s) * 1px);
123
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
124
+ }
125
+ &--center{
126
+ width: calc(var(--width-skeleton-stock_data_m) * 1px);
127
+ height: calc(var(--height-skeleton-text_l) * 1px);
128
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
129
+ }
130
+
131
+
132
+
133
+ &--right{
134
+ margin-inline-start: calc(var(--spacing-skeleton-data-padding_y) * 1px);
135
+ display: flex;
136
+ align-items: flex-end;
137
+ flex-direction: column;
138
+ }
139
+
140
+ &--title{
141
+ width: calc(var(--width-skeleton-stock_data_l) * 1px);
142
+ height: calc(var(--height-skeleton-text_m) * 1px);
143
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
144
+ }
145
+ &--text{
146
+ margin-block-start: calc(var(--spacing-skeleton-stock-padding_x) * 1px);
147
+ width: calc(var(--width-skeleton-stock_data_s) * 1px);
148
+ height: calc(var(--height-skeleton-text_s) * 1px);
149
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
150
+ }
151
+
152
+ &--content{
153
+ display: flex;
154
+ align-items: flex-end;
155
+ flex-direction: column;
156
+ }
157
+
158
+ &--maindata{
159
+ width: calc(var(--width-skeleton-stock_data_m) * 1px);
160
+ height: calc(var(--height-skeleton-text_m) * 1px);
161
+ border-radius: calc(var(--radius-skeleton-text_s) * 1px);
162
+ }
163
+
164
+
165
+ }
166
+
167
+ &--space{
168
+ display: flex;
169
+ align-items: center;
170
+ .spacing{
171
+ margin-inline-start: calc(var(--spacing-skeleton-stock-padding_y) * 1px);
172
+
173
+ }
174
+ }
175
+
176
+ &__equally{
177
+ display: flex;
178
+ width: 100%;
179
+ gap: calc(var(--spacing-skeleton-avatar-margin_right) * 1px);
180
+ }
181
+
182
+ }
183
+
184
+ @keyframes skeleton-loading {
185
+ 0%{
186
+ background-position: 100% 50%;
187
+ }
188
+
189
+ 100% {
190
+ background-position: 0 50%;
191
+ }
192
+ }
@@ -0,0 +1,49 @@
1
+ let isDragging = false;
2
+ import Vue from 'vue';
3
+ const supportTouch = !Vue.prototype.$isServer && 'ontouchstart' in window;
4
+
5
+ export default function(element, options) {
6
+ const moveFn = function(event) {
7
+ if (options.drag) {
8
+ options.drag(supportTouch ? event.changedTouches[0] || event.touches[0] : event);
9
+ }
10
+ };
11
+
12
+ const endFn = function(event) {
13
+ if (!supportTouch) {
14
+ document.removeEventListener('mousemove', moveFn);
15
+ document.removeEventListener('mouseup', endFn);
16
+ }
17
+ document.onselectstart = null;
18
+ document.ondragstart = null;
19
+
20
+ isDragging = false;
21
+
22
+ if (options.end) {
23
+ options.end(supportTouch ? event.changedTouches[0] || event.touches[0] : event);
24
+ }
25
+ };
26
+
27
+ element.addEventListener(supportTouch ? 'touchstart' : 'mousedown', function(event) {
28
+ if (isDragging) return;
29
+ event.preventDefault();
30
+ document.onselectstart = function() { return false; };
31
+ document.ondragstart = function() { return false; };
32
+
33
+ if (!supportTouch) {
34
+ document.addEventListener('mousemove', moveFn);
35
+ document.addEventListener('mouseup', endFn);
36
+ }
37
+ isDragging = true;
38
+
39
+ if (options.start) {
40
+ options.start(supportTouch ? event.changedTouches[0] || event.touches[0] : event);
41
+ }
42
+ });
43
+
44
+ if (supportTouch) {
45
+ element.addEventListener('touchmove', moveFn);
46
+ element.addEventListener('touchend', endFn);
47
+ element.addEventListener('touchcancel', endFn);
48
+ }
49
+ }
@@ -0,0 +1,7 @@
1
+ import Slider from './index.vue';
2
+ import './style.less';
3
+ Slider.install = function(Vue) {
4
+ Vue.component(Slider.name, Slider)
5
+ }
6
+
7
+ export default Slider;
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <div class="vd-slider">
3
+ <template v-if="demonstration">
4
+ <div class="vd-slider__marks vd-slider__marks--top">
5
+ <div class="vd-slider__marks--start" :class="{ 'vd-slider__marks--hidden': (showMarks && progress === 0) }">0%
6
+ </div>
7
+ <div class="vd-slider__marks--end" v-if="progressWidth < 100">100%</div>
8
+ </div>
9
+ <div class="vd-slider__wrap vd-slider__wrap--demonstration" ref="content">
10
+ <div class="vd-slider__bar vd-slider__bar--demonstration" :style="{ width: progressWidth + '%' }"></div>
11
+ <div class="vd-slider__button vd-slider__button--demonstration" ref="thumb"
12
+ :class="{ 'vd-slider__button--active': progress }" :style="{left: this.progress + '%'}">
13
+ <!-- 显示逻辑是滑动时候显示 -->
14
+ <span class="vd-slider__tips" v-if="showMarks">{{ value }}%</span>
15
+ </div>
16
+ <template v-for="(item, index) in items">
17
+ <div :key="index" v-if="index > 1 && index !== items.length - 1"
18
+ :class="['vd-slider__dots', { 'vd-slider__dots--active': (index - 1) % 2 !== 0 }]"
19
+ :style="{ left: (index - 1) * 5 + '%' }"></div>
20
+ </template>
21
+ </div>
22
+ </template>
23
+ <template v-else>
24
+ <div class="vd-slider__wrap" ref="content">
25
+ <div class="vd-slider__bar" :style="{ width: progressWidth + '%' }"></div>
26
+ <div class="vd-slider__button" :class="{ 'vd-slider__button--active': progress }" ref="thumb"
27
+ :style="{left: this.progress + '%'}">
28
+ </div>
29
+ </div>
30
+ <div class="vd-slider__marks">
31
+ <div class="vd-slider__marks--start">0%</div>
32
+ <div class="vd-slider__marks--end">100%</div>
33
+ </div>
34
+ </template>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ import languageMixin from '@p/components/mixins/languageMixin.js';
40
+
41
+ import draggable from './draggable';
42
+ export default {
43
+ name: 'vd-slider',
44
+ mixins: [languageMixin],
45
+ props: {
46
+ demonstration: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ min: {
51
+ type: Number,
52
+ default: 0
53
+ },
54
+ max: {
55
+ type: Number,
56
+ default: 100
57
+ },
58
+ step: {
59
+ type: Number,
60
+ default: 1
61
+ },
62
+ // disabled: {
63
+ // type: Boolean,
64
+ // default: false
65
+ // },
66
+ value: {
67
+ type: Number
68
+ },
69
+ markLeft:Number,
70
+ markRight:Number,
71
+
72
+ },
73
+ data() {
74
+ return {
75
+ items: Array(22),
76
+ showMarks: false, // 控制是否显示百分比标记
77
+ hideStartMark: false, // 控制是否隐藏0%标记
78
+ disabled: false
79
+ };
80
+ },
81
+ computed: {
82
+ progress() {
83
+ const value = this.value;
84
+ if (typeof value === 'undefined' || value === null) return 0;
85
+ const progressValue = Math.floor((value - this.min) / (this.max - this.min) * 100);
86
+ return this.language === 'ar' ? 100 - progressValue : progressValue;
87
+ },
88
+ progressWidth() {
89
+ const value = this.value;
90
+ if (typeof value === 'undefined' || value === null) return 0;
91
+ const progressValue = Math.floor((value - this.min) / (this.max - this.min) * 100);
92
+ return progressValue;
93
+ },
94
+ inputStyle() {
95
+ if (this.language === 'ar') {
96
+ return {
97
+ left: 'auto',
98
+ right: this.progress + '%'
99
+ };
100
+ } else {
101
+ return {
102
+ left: this.progress + '%',
103
+ right: 'auto'
104
+ };
105
+ }
106
+ }
107
+ },
108
+ watch: {
109
+
110
+ },
111
+ mounted() {
112
+
113
+
114
+ const thumb = this.$refs.thumb;
115
+ const content = this.$refs.content;
116
+ const getThumbPosition = () => {
117
+ const contentBox = content.getBoundingClientRect();
118
+ const thumbBox = thumb.getBoundingClientRect();
119
+ return {
120
+ left: thumbBox.left - contentBox.left,
121
+ top: thumbBox.top - contentBox.top,
122
+ thumbBoxLeft: thumbBox.left
123
+ };
124
+ };
125
+
126
+ let dragState = {};
127
+ draggable(thumb, {
128
+ start: (event) => {
129
+ if (this.disabled) return;
130
+ this.showMarks = true;
131
+ const position = getThumbPosition();
132
+ const thumbClickDetalX = event.clientX - position.thumbBoxLeft;
133
+ dragState = {
134
+ thumbStartLeft: position.left,
135
+ thumbStartTop: position.top,
136
+ thumbClickDetalX: thumbClickDetalX
137
+ };
138
+ },
139
+ drag: (event) => {
140
+ if (this.disabled) return;
141
+ const contentBox = content.getBoundingClientRect();
142
+ const deltaX = this.language === 'ar' ?
143
+ contentBox.right - event.pageX - dragState.thumbStartLeft - dragState.thumbClickDetalX :
144
+ event.pageX - contentBox.left - dragState.thumbStartLeft - dragState.thumbClickDetalX;
145
+ // const deltaX = event.pageX - contentBox.left - dragState.thumbStartLeft - dragState.thumbClickDetalX;
146
+ const stepCount = Math.ceil((this.max - this.min) / this.step);
147
+ const newPosition = (dragState.thumbStartLeft + deltaX) - (dragState.thumbStartLeft + deltaX) % (contentBox.width / stepCount);
148
+
149
+ let newProgress = newPosition / contentBox.width;
150
+
151
+ if (newProgress < 0) {
152
+ newProgress = 0;
153
+ } else if (newProgress > 1) {
154
+ newProgress = 1;
155
+ }
156
+
157
+ this.$emit('input', Math.round(this.min + newProgress * (this.max - this.min)));
158
+ },
159
+ end: () => {
160
+ if (this.disabled) return;
161
+ this.$emit('change', this.value);
162
+ dragState = {};
163
+ }
164
+ });
165
+ }
166
+ }
167
+ </script>
168
+
169
+ <style lang="less">
170
+ @import './style.less';
171
+
172
+
173
+ </style>
@@ -0,0 +1,96 @@
1
+ @silder-prefix-cls: vd-slider;
2
+
3
+ .@{silder-prefix-cls} {
4
+
5
+ &__wrap{
6
+ position: relative;
7
+ margin: 7px 0;
8
+ height: calc(var(--height-slider-track) * 1px);
9
+ background-color: var(--color-slider-track-default);
10
+ border-radius: calc(var(--radius-slider-track) * 1px);
11
+ &--demonstration{
12
+ height: calc(var(--height-slider-mark_track) * 1px);
13
+ border-radius: calc(var(--radius-slider-mark_track) * 1px);
14
+ }
15
+ }
16
+ &__bar{
17
+ position: absolute;
18
+ top: 0;
19
+ height: calc(var(--height-slider-track) * 1px);
20
+ background-color: var(--color-slider-track-focus);
21
+ border-radius: calc(var(--radius-slider-track) * 1px);
22
+
23
+
24
+ &--demonstration{
25
+ height: calc(var(--height-slider-mark_track) * 1px);
26
+ }
27
+ }
28
+ &__button{
29
+ position: absolute;
30
+ left: 0;
31
+ top: 50%;
32
+ transform: translate3d(-50%, -50%, 0);
33
+ cursor: grab;
34
+ border-radius: 50%;
35
+ width: calc(var(--width-slider-handle) * 1px);
36
+ height: calc(var(--width-slider-handle) * 1px);
37
+ background-color: var(--color-slider-handle-bg);
38
+ border: calc(var(--width-slider-handle_border) * 1px) solid var(--color-slider-handle_border-default);
39
+
40
+ &--demonstration{
41
+ width: calc(var(--width-slider-mark_handle) * 1px);
42
+ height: calc(var(--height-slider-mark_handle) * 1px);
43
+ border-radius: calc(var(--radius-slider-mark_handle) * 1px);
44
+ border: calc(var(--width-slider-mark_handle_border) * 1px) solid var(--color-slider-handle_border-default);
45
+ }
46
+
47
+ &--active{
48
+ border-color: var(--color-slider-handle_border-focus);
49
+ }
50
+ }
51
+
52
+ &__marks{
53
+ display: flex;
54
+ justify-content: space-between;
55
+ margin-block-start: calc(var(--spacing-slider-margin_bottom) * 1px);
56
+ font-size: calc(var(--en-single-f-a-r-fontSize) * 1px);
57
+ font-weight: var(--en-single-f-a-r-fontWeight);
58
+ color: var(--color-slider-mark-text);
59
+
60
+ &--top{
61
+ margin-block-start: 0;
62
+ margin-block-end: calc(var(--spacing-slider-margin_bottom) * 1px);
63
+ }
64
+ &--active{
65
+ font-size: calc(var(--en-single-f-d-s-fontSize) * 1px);
66
+ font-weight: var(--en-single-f-d-s-fontWeight);
67
+ }
68
+
69
+ &--hidden {
70
+ opacity: 0;
71
+ }
72
+ }
73
+
74
+ &__dots{
75
+ position: absolute;
76
+ width: 1px;
77
+ height: 3px;
78
+ border-radius: 4px;
79
+ background-color: #fff;
80
+ top: 50%;
81
+ transform: translate(-50%,-50%);
82
+ &--active{
83
+ height: 5px;
84
+ }
85
+ }
86
+
87
+ &__tips{
88
+ position: absolute;
89
+ left: 50%;
90
+ top: calc((var(--height-slider-mark_handle) + 8) * -1px );
91
+ transform: translateX(-50%);
92
+ font-size: calc(var(--en-single-f-d-s-fontSize) * 1px);
93
+ font-weight: var(--en-single-f-d-s-fontWeight);
94
+ color: var(--color-slider-mark-text-focus);
95
+ }
96
+ }