vdesign-ui 0.1.24-beta → 0.2.0-beta

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 (34) hide show
  1. package/dist/components/activityviews/index.vue +1 -1
  2. package/dist/components/checkbox/checkbox-group/index.vue +2 -1
  3. package/dist/components/checkbox/index.vue +19 -20
  4. package/dist/components/dialog/index.vue +15 -11
  5. package/dist/components/footer/index.vue +5 -1
  6. package/dist/components/footnav/footnav-item/index.vue +10 -37
  7. package/dist/components/footnav/index.vue +13 -27
  8. package/dist/components/headnav/index.vue +52 -35
  9. package/dist/components/icon/font/iconfont.css +16 -16
  10. package/dist/components/icon/font/iconfont.js +1 -1
  11. package/dist/components/icon/index.vue +26 -18
  12. package/dist/components/input/index.vue +84 -109
  13. package/dist/components/input/search/index.vue +18 -22
  14. package/dist/components/input/stepper/index.vue +32 -26
  15. package/dist/components/input/style.less +20 -32
  16. package/dist/components/list/index.vue +57 -69
  17. package/dist/components/list/style.less +20 -92
  18. package/dist/components/loading/index.vue +17 -8
  19. package/dist/components/pagebreak/index.vue +12 -11
  20. package/dist/components/radio/index.vue +164 -135
  21. package/dist/components/radio/radio-group/index.vue +40 -52
  22. package/dist/components/selector/style.less +4 -0
  23. package/dist/components/step-item/index.vue +2 -2
  24. package/dist/components/tabs/index.vue +55 -32
  25. package/dist/components/tabs/tab/index.vue +13 -16
  26. package/dist/components/tag/index.vue +18 -4
  27. package/dist/components/tag/style.less +2 -2
  28. package/dist/components/title/index.vue +11 -8
  29. package/dist/components/title/style.less +6 -0
  30. package/dist/vdesign-ui.common.js +954 -939
  31. package/dist/vdesign-ui.css +1 -1
  32. package/dist/vdesign-ui.umd.js +954 -939
  33. package/dist/vdesign-ui.umd.min.js +3 -3
  34. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="vd-loading-wrapper">
3
- <div class="vd-loading" v-if="loading">
3
+ <div v-if="isLoading" class="vd-loading">
4
4
  <slot>
5
5
  <img src="./img_status_loading_white_ani.svg" alt="">
6
6
  </slot>
@@ -18,6 +18,10 @@
18
18
  export default {
19
19
  name:'vd-loading',
20
20
  props:{
21
+ type:{
22
+ type: String,
23
+ default:'null',
24
+ },
21
25
  text:{
22
26
  type: String,
23
27
  default:''
@@ -28,17 +32,22 @@ export default {
28
32
  },
29
33
  size:{
30
34
  type: String,
31
- default:'large'
35
+ default:'large',
36
+ validator: value => ['large', 'small'].includes(value)
32
37
  }
33
38
  },
34
39
  computed:{
40
+ isLoading() {
41
+ if (this.type === 'loading') {
42
+ return true;
43
+ } else if (this.type === 'refresh') {
44
+ return false;
45
+ } else {
46
+ return this.loading;
47
+ }
48
+ },
35
49
  refreshClasses() {
36
- return [
37
- 'vd-refresh',
38
- {
39
- [`vd-refresh--${this.size}`]:this.size
40
- }
41
- ]
50
+ return ['vd-refresh', `vd-refresh--${this.size}`];
42
51
  }
43
52
  },
44
53
  methods:{
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <div class="vd-page-break">
3
- <template v-if="drop">
3
+ <template v-if="drop === 'dropdot'">
4
4
  <div v-for="pageNumber in totalPages" class="vd-page-break__cell"
5
5
  :class="{ 'vd-page-break__cell--active': pageNumber === currentPage }" :key="pageNumber"
6
6
  @click="changePage(pageNumber)">
7
7
  </div>
8
8
  </template>
9
9
 
10
- <div class="vd-page-break__number" v-else>
10
+ <div class="vd-page-break__number" v-else-if="drop === 'dropnum'">
11
11
  <span class="vd-page-break__number--active" v-if="number">{{ number }}</span>
12
12
  <span class="vd-page-break__number--line">/</span>
13
13
  <span class="vd-page-break__number--total">{{ total }}</span>
@@ -19,26 +19,27 @@
19
19
  export default {
20
20
  name: 'vd-page-break',
21
21
  props: {
22
+ drop: {
23
+ type: String,
24
+ default: 'dropdot'
25
+ },
22
26
  totalPages: {
23
27
  type: Number,
24
28
  default: 5
25
29
  },
26
- drop: {
27
- type: Boolean,
28
- default: true
29
- },
30
- number: {
30
+ activePage: {
31
31
  type: Number,
32
- default: 1
32
+ default: 1 // 默认显示第一页
33
33
  },
34
34
  total: {
35
35
  type: Number,
36
36
  default: 9
37
37
  },
38
- activePage: {
38
+ number: {
39
39
  type: Number,
40
- default: 1 // 默认显示第一页
41
- }
40
+ default: 1
41
+ },
42
+
42
43
  },
43
44
  data() {
44
45
  return {
@@ -1,155 +1,184 @@
1
1
  <template>
2
+ <!-- 常规单选框 -->
2
3
  <label :class="wrapClasses" v-if="!radioButton">
3
- <span :class="radioClasses">
4
- <span :class="innerClasses"></span>
5
- <input type="radio" :class="inputClasses" :disabled="disabled" :checked="currentValue" @change="change">
6
- </span>
7
- <div class="vd-radio__label" v-if="$slots.default">
8
- <div class="vd-radio__text">
9
- <slot></slot>
10
- </div>
11
- <!-- <p class="vd-radio__description" v-if="extra">{{ extra }}</p> -->
4
+ <span :class="radioClasses">
5
+ <span :class="innerClasses"></span>
6
+ <input
7
+ type="radio"
8
+ :class="inputClasses"
9
+ :disabled="isDisabled"
10
+ :checked="currentValue"
11
+ @change="handleChange"
12
+ >
13
+ </span>
14
+ <!-- 标签内容 -->
15
+ <div class="vd-radio__label" v-if="$slots.default">
16
+ <div class="vd-radio__text">
17
+ <slot></slot>
12
18
  </div>
19
+ </div>
13
20
  </label>
14
-
15
-
16
- <label class="vd-radio vd-radio-button" :class="radioButtonClasses" v-else>
17
- <input type="radio" :class="inputClasses" :disabled="disabled" :checked="currentValue" @change="change">
18
- <span class="vd-radio-button-text">
19
- <slot></slot>
20
- </span>
21
+
22
+ <!-- 按钮样式的单选框 -->
23
+ <label
24
+ class="vd-radio vd-radio-button"
25
+ :class="radioButtonClasses"
26
+ v-else
27
+ >
28
+ <input
29
+ type="radio"
30
+ :class="inputClasses"
31
+ :disabled="isDisabled"
32
+ :checked="currentValue"
33
+ @change="handleChange"
34
+ >
35
+ <span class="vd-radio-button-text">
36
+ <slot></slot>
37
+ </span>
21
38
  </label>
22
- </template>
23
- <script>
24
- import { findComponentUpward } from './assist';
25
- const prefixCls = 'vd-radio';
26
-
27
- export default {
39
+ </template>
40
+ <script>
41
+ import { findComponentUpward } from './assist';
42
+
43
+ const prefixCls = 'vd-radio';
44
+
45
+ export default {
28
46
  name: 'vd-radio',
29
47
  props: {
30
- radioButton: {
31
- type: Boolean,
32
- default: false
33
- },
34
- disabled: {
35
- type: Boolean,
36
- default: false
37
- },
38
- value: {
39
- type: [String, Number, Boolean],
40
- default: false
41
- },
42
- trueValue: {
43
- type: [String, Number, Boolean],
44
- default: true
45
- },
46
- falseValue: {
47
- type: [String, Number, Boolean],
48
- default: false
49
- },
50
- name: {
51
- type: [String, Number, Boolean]
52
- },
53
- type: {
54
- type: String,
55
- default: ''
56
- },
48
+ // 组件的值,用于 v-model 绑定
49
+ value: {
50
+ type: [String, Number, Boolean],
51
+ default: false,
52
+ },
53
+ // 是否为按钮样式
54
+ radioButton: Boolean,
55
+ // 是否禁用
56
+ disabled: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
60
+ // 选中时的值
61
+ trueValue: {
62
+ type: [String, Number, Boolean],
63
+ default: true,
64
+ },
65
+ // 未选中时的值
66
+ falseValue: {
67
+ type: [String, Number, Boolean],
68
+ default: false,
69
+ },
70
+ // 单选框的标识名称,在组内使用
71
+ name: {
72
+ type: [String, Number, Boolean],
73
+ },
74
+ // 类型,用于样式
75
+ type: String,
57
76
  },
58
77
  data() {
59
- return {
60
- currentValue: this.value,
61
- group: false,
62
- parent: findComponentUpward(this, 'vd-radio-group'),
63
- // parent: this.$parent,
64
- focusWrapper: false,
65
- focusInner: false
66
- };
78
+ return {
79
+ // 当前是否选中
80
+ currentValue: this.value === this.trueValue,
81
+ // 是否属于单选框组
82
+ isGroup: false,
83
+ // 父级单选框组的引用
84
+ parentGroup: null,
85
+ };
67
86
  },
68
87
  computed: {
69
- wrapClasses() {
70
- return [
71
- `${prefixCls}`,
72
- {
73
- [`${prefixCls}--checked`]: this.currentValue,
74
- [`${prefixCls}--disabled`]: this.disabled,
75
- }
76
- ];
77
- },
78
- radioClasses() {
79
- return [
80
- `${prefixCls}__input`,
81
- ];
82
- },
83
- innerClasses() {
84
- return [
85
- `${prefixCls}__icon`,
86
- ];
87
- },
88
- inputClasses() {
89
- return `${prefixCls}__original`;
90
- },
91
- radioButtonClasses() {
92
- return [
93
- {
94
- [`${prefixCls}-button--checked`]: this.currentValue,
95
- [`${prefixCls}-button--${this.type}`]: this.type,
96
- [`${prefixCls}-button--disabled`]: this.disabled,
97
- }
98
- ]
99
-
100
- }
88
+ // 计算禁用状态,优先级:自身 > 组
89
+ isDisabled() {
90
+ return this.disabled || (this.isGroup && this.parentGroup.disabled);
91
+ },
92
+ // 包裹类名
93
+ wrapClasses() {
94
+ return [
95
+ `${prefixCls}`,
96
+ {
97
+ [`${prefixCls}--checked`]: this.currentValue,
98
+ [`${prefixCls}--disabled`]: this.isDisabled,
99
+ },
100
+ ];
101
+ },
102
+ // 单选框的类名
103
+ radioClasses() {
104
+ return [`${prefixCls}__input`];
105
+ },
106
+ // 图标的类名
107
+ innerClasses() {
108
+ return [`${prefixCls}__icon`];
109
+ },
110
+ // 输入框的类名
111
+ inputClasses() {
112
+ return `${prefixCls}__original`;
113
+ },
114
+ // 按钮样式的类名
115
+ radioButtonClasses() {
116
+ return [
117
+ {
118
+ [`${prefixCls}-button--checked`]: this.currentValue,
119
+ [`${prefixCls}-button--${this.type}`]: this.type,
120
+ [`${prefixCls}-button--disabled`]: this.isDisabled,
121
+ },
122
+ ];
123
+ },
101
124
  },
102
125
  mounted() {
103
- if (this.parent) {
104
- this.group = true;
126
+ // 查找父级 vd-radio-group 组件
127
+ this.parentGroup = findComponentUpward(this, 'vd-radio-group');
128
+ this.isGroup = !!this.parentGroup;
129
+
130
+ if (this.isGroup) {
131
+ // 如果在组内,注册到组中
132
+ this.parentGroup.updateValue();
133
+ } else {
134
+ // 如果不在组内,更新自身的选中状态
135
+ this.updateValue();
136
+ }
137
+ },
138
+ methods: {
139
+ // 处理 change 事件
140
+ handleChange(event) {
141
+ if (this.isDisabled) {
142
+ return;
105
143
  }
106
-
107
- if (this.group) {
108
- this.parent.updateValue();
144
+
145
+ const checked = event.target.checked;
146
+ this.currentValue = checked;
147
+ const value = checked ? this.trueValue : this.falseValue;
148
+ this.$emit('input', value);
149
+
150
+ if (this.isGroup) {
151
+ // 如果在组内,通知组更新
152
+ this.parentGroup.change(this.name);
109
153
  } else {
110
- this.updateValue();
154
+ // 否则,触发自身的 change 事件
155
+ this.$emit('change', value);
111
156
  }
112
- },
113
- methods: {
114
- change(event) {
115
- if (this.disabled) {
116
- return false;
117
- }
118
-
119
- const checked = event.target.checked;
120
- this.currentValue = checked;
121
-
122
- const value = checked ? this.trueValue : this.falseValue;
123
- this.$emit('input', value);
124
-
125
- if (this.group) {
126
- if (this.name !== undefined) {
127
- this.parent.change({
128
- value: this.name,
129
- checked: this.value
130
- });
131
- }
132
- } else {
133
- this.$emit('change', value);
134
- }
135
- },
136
- updateValue() {
137
- this.currentValue = this.value === this.trueValue;
138
- },
139
-
157
+ },
158
+ // 更新 currentValue
159
+ updateValue() {
160
+ if (this.isGroup) {
161
+ // 组内,通过比较组的值和自身的 name 来确定是否选中
162
+ this.currentValue = this.parentGroup.value === this.name;
163
+ } else {
164
+ // 组外,通过比较 value 和 trueValue
165
+ this.currentValue = this.value === this.trueValue;
166
+ }
167
+ },
140
168
  },
141
169
  watch: {
142
- value(val) {
143
- if (val === this.trueValue || val === this.falseValue) {
144
- this.updateValue();
145
- } else {
146
- throw 'Value should be trueValue or falseValue.';
147
- }
148
- }
149
- }
150
- };
151
- </script>
152
-
170
+ // 监听 value 的变化
171
+ value() {
172
+ this.updateValue();
173
+ },
174
+ // 如果在组内,监听组的 value 变化
175
+ 'parentGroup.value'() {
176
+ this.updateValue();
177
+ },
178
+ },
179
+ };
180
+ </script>
181
+
153
182
  <style lang="less">
154
- @import './style.less';
183
+ @import "./style.less";
155
184
  </style>
@@ -9,62 +9,50 @@ import { findComponentsDownward } from '../assist';
9
9
  const prefixCls = 'vd-radio-group';
10
10
 
11
11
  export default {
12
- name: 'vd-radio-group',
13
- props: {
14
- value: {
15
- type: [String, Number],
16
- default: ''
17
- },
18
- type: {
19
- type: String,
20
- default: ''
21
- }
12
+ name: 'vd-radio-group',
13
+ props: {
14
+ // 绑定的值,用于 v-model
15
+ value: {
16
+ type: [String, Number, Boolean],
17
+ default: '',
22
18
  },
23
- data() {
24
- return {
25
- currentValue: this.value,
26
- childrens: []
27
- };
19
+ // 类型,用于样式
20
+ type: String,
21
+ // 是否禁用组内所有单选框
22
+ disabled: Boolean
23
+ },
24
+ computed: {
25
+ // 组容器的类名
26
+ classes() {
27
+ return [
28
+ `${prefixCls}`,
29
+ {
30
+ [`${prefixCls}__${this.type}`]: this.type,
31
+ },
32
+ ];
28
33
  },
29
- computed: {
30
- classes() {
31
- return [
32
- `${prefixCls}`,
33
- {
34
- [`${prefixCls}__${this.type}`]: this.type,
35
- }
36
- ];
37
- }
34
+ },
35
+ methods: {
36
+ // 更新子单选框的状态
37
+ updateValue() {
38
+ const children = findComponentsDownward(this, 'vd-radio');
39
+ if (children.length) {
40
+ children.forEach((child) => {
41
+ child.updateValue();
42
+ });
43
+ }
38
44
  },
39
- mounted() {
40
- this.updateValue();
45
+ // 处理子单选框的变化
46
+ change(name) {
47
+ this.$emit('input', name);
48
+ this.$emit('change', name);
41
49
  },
42
- methods: {
43
- updateValue() {
44
- this.childrens = findComponentsDownward(this, 'vd-radio');
45
- if (this.childrens) {
46
- this.childrens.forEach(child => {
47
- child.currentValue = this.currentValue === child.name;
48
- child.group = true;
49
- });
50
- }
51
- },
52
- change(data) {
53
- this.currentValue = data.value;
54
- this.updateValue();
55
- this.$emit('input', data.value);
56
- this.$emit('change', data.value);
57
- }
50
+ },
51
+ watch: {
52
+ // 监听 value 的变化,更新子组件
53
+ value() {
54
+ this.updateValue();
58
55
  },
59
- watch: {
60
- value() {
61
- if (this.currentValue !== this.value) {
62
- this.currentValue = this.value;
63
- this.$nextTick(() => {
64
- this.updateValue();
65
- });
66
- }
67
- }
68
- }
56
+ },
69
57
  };
70
58
  </script>
@@ -58,6 +58,7 @@
58
58
  }
59
59
 
60
60
  &__icon {
61
+ display: flex;
61
62
  font-size: calc(var(--icon-selector-xl) * 1px);
62
63
  margin-inline-end: calc(var(--spacing-selector-xl-margin_y) * 1px);
63
64
 
@@ -108,6 +109,7 @@
108
109
  }
109
110
 
110
111
  &__icon {
112
+ display: flex;
111
113
  font-size: calc(var(--icon-selector-l) * 1px);
112
114
  margin-inline-end: calc(var(--spacing-selector-l-margin_y) * 1px);
113
115
 
@@ -157,6 +159,7 @@
157
159
  }
158
160
 
159
161
  &__icon {
162
+ display: flex;
160
163
  font-size: calc(var(--icon-selector-m) * 1px);
161
164
  margin-inline-end: calc(var(--spacing-selector-m-margin_y) * 1px);
162
165
 
@@ -205,6 +208,7 @@
205
208
  }
206
209
 
207
210
  &__icon {
211
+ display: flex;
208
212
  font-size: calc(var(--icon-selector-s) * 1px);
209
213
  margin-inline-end: calc(var(--spacing-selector-s-margin_y) * 1px);
210
214
 
@@ -70,9 +70,9 @@ export default {
70
70
  },
71
71
  iconName() {
72
72
  if (this.state === 'afoot') {
73
- return this.currentTheme === 'dark' ? 'icon_show_steping1' : 'icon_show_steping'
73
+ return this.currentTheme === 'dark' ? 'icon_show_steping1_svg' : 'icon_show_steping_svg'
74
74
  } else if (this.state === 'warning') {
75
- return this.currentTheme === 'dark' ? 'icon_show_stepwrong1' : 'icon_show_stepwrong'
75
+ return this.currentTheme === 'dark' ? 'icon_show_stepwrong1_svg' : 'icon_show_stepwrong_svg'
76
76
  }
77
77
  return ''
78
78
  }