stellar-ui-v2 1.40.21 → 1.40.22

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.
@@ -1,116 +1,116 @@
1
- <template>
2
- <view class="sub-table-root" :class="[cmpRootClass]">
3
- <view class="row" v-for="(v, i) in rows" :key="i" :style="[cmpRowStyle]">
4
- <view class="cell">
5
- {{ v }}
6
- </view>
7
- </view>
8
- </view>
9
- </template>
10
-
11
- <script>
12
- import utils from '../../utils/utils.js';
13
-
14
- function findMaxInRange(tolerance, numbers = []) {
15
- if (numbers.length === 0) return 0;
16
-
17
- let max = Math.max(...numbers);
18
- let min = Math.min(...numbers);
19
-
20
- // 如果最大值和最小值的差值在浮动范围内,返回 0
21
- if (max - min <= tolerance) {
22
- return 0;
23
- }
24
-
25
- // 返回最大值
26
- return max;
27
- }
28
- export default {
29
- options: {
30
- virtualHost: true,
31
- },
32
- props: {
33
- rows: {
34
- type: [Array, null],
35
- default: () => [],
36
- },
37
- border: {
38
- type: [Boolean, null],
39
- default: false,
40
- },
41
- },
42
- data() {
43
- return {
44
- rowEls: [],
45
- };
46
- },
47
- mounted() {
48
- utils.querySelector('.sub-table-root .row', this, true).then((rec) => {
49
- this.rowEls = rec;
50
- });
51
- },
52
- computed: {
53
- cmpRootClass() {
54
- let classArr = [];
55
- if (this.border) {
56
- classArr.push('border');
57
- }
58
- return classArr.join(' ');
59
- },
60
- cmpRowStyle() {
61
- let style = {};
62
- if (this.rowEls.length > 0) {
63
- let maxHeight = findMaxInRange(
64
- 0.5,
65
- this.rowEls.map((e) => e.height)
66
- );
67
- if (maxHeight > 0) {
68
- style.flexBasis = maxHeight + 'px';
69
- style.flexGrow = 0;
70
- }
71
- }
72
- return style;
73
- },
74
- },
75
- };
76
- </script>
77
-
78
- <style lang="scss" scoped>
79
- @import './var.scss';
80
- .sub-table-root {
81
- width: 100%;
82
- height: 100%;
83
- display: flex;
84
- flex-direction: column;
85
-
86
- &.border {
87
- .row {
88
- .cell {
89
- border-bottom: $default-border;
90
- }
91
- }
92
- }
93
-
94
- .row {
95
- // margin-left: -32rpx;
96
- // width: calc(100% + 64rpx);
97
- width: 100%;
98
- display: flex;
99
- justify-content: space-between;
100
- flex: 1;
101
- .cell {
102
- @import './common.scss';
103
- @include cell;
104
- // padding-right: 0;
105
-
106
- border-bottom: none;
107
- padding: 24rpx 32rpx;
108
- }
109
- &:nth-last-child(1) {
110
- .cell {
111
- border-bottom: none;
112
- }
113
- }
114
- }
115
- }
116
- </style>
1
+ <template>
2
+ <view class="sub-table-root" :class="[cmpRootClass]">
3
+ <view class="row" v-for="(v, i) in rows" :key="i" :style="[cmpRowStyle]">
4
+ <view class="cell">
5
+ {{ v }}
6
+ </view>
7
+ </view>
8
+ </view>
9
+ </template>
10
+
11
+ <script>
12
+ import utils from '../../utils/utils.js';
13
+
14
+ function findMaxInRange(tolerance, numbers = []) {
15
+ if (numbers.length === 0) return 0;
16
+
17
+ let max = Math.max(...numbers);
18
+ let min = Math.min(...numbers);
19
+
20
+ // 如果最大值和最小值的差值在浮动范围内,返回 0
21
+ if (max - min <= tolerance) {
22
+ return 0;
23
+ }
24
+
25
+ // 返回最大值
26
+ return max;
27
+ }
28
+ export default {
29
+ options: {
30
+ virtualHost: true,
31
+ },
32
+ props: {
33
+ rows: {
34
+ type: [Array, null],
35
+ default: () => [],
36
+ },
37
+ border: {
38
+ type: [Boolean, null],
39
+ default: false,
40
+ },
41
+ },
42
+ data() {
43
+ return {
44
+ rowEls: [],
45
+ };
46
+ },
47
+ mounted() {
48
+ utils.querySelector('.sub-table-root .row', this, true).then((rec) => {
49
+ this.rowEls = rec;
50
+ });
51
+ },
52
+ computed: {
53
+ cmpRootClass() {
54
+ let classArr = [];
55
+ if (this.border) {
56
+ classArr.push('border');
57
+ }
58
+ return classArr.join(' ');
59
+ },
60
+ cmpRowStyle() {
61
+ let style = {};
62
+ if (this.rowEls.length > 0) {
63
+ let maxHeight = findMaxInRange(
64
+ 0.5,
65
+ this.rowEls.map((e) => e.height)
66
+ );
67
+ if (maxHeight > 0) {
68
+ style.flexBasis = maxHeight + 'px';
69
+ style.flexGrow = 0;
70
+ }
71
+ }
72
+ return style;
73
+ },
74
+ },
75
+ };
76
+ </script>
77
+
78
+ <style lang="scss" scoped>
79
+ @import './var.scss';
80
+ .sub-table-root {
81
+ width: 100%;
82
+ height: 100%;
83
+ display: flex;
84
+ flex-direction: column;
85
+
86
+ &.border {
87
+ .row {
88
+ .cell {
89
+ border-bottom: $default-border;
90
+ }
91
+ }
92
+ }
93
+
94
+ .row {
95
+ // margin-left: -32rpx;
96
+ // width: calc(100% + 64rpx);
97
+ width: 100%;
98
+ display: flex;
99
+ justify-content: space-between;
100
+ flex: 1;
101
+ .cell {
102
+ @import './common.scss';
103
+ @include cell;
104
+ // padding-right: 0;
105
+
106
+ border-bottom: none;
107
+ padding: 24rpx 32rpx;
108
+ }
109
+ &:nth-last-child(1) {
110
+ .cell {
111
+ border-bottom: none;
112
+ }
113
+ }
114
+ }
115
+ }
116
+ </style>
@@ -1,212 +1,212 @@
1
- export default {
2
- // 当前激活的选项支持sync双向绑定(类型为number时绑定index,类型为string时绑定name)
3
- active: {
4
- type: [Number, String, null],
5
- default: () => 0,
6
- },
7
- // 样式风格类型,可选值为 line card
8
- type: {
9
- type: [String, null],
10
- default: () => 'line',
11
- },
12
- // 是否显示图片
13
- showImage: {
14
- type: [Boolean, null],
15
- default: () => false,
16
- },
17
- // 是否显示主标题
18
- showTitle: {
19
- type: [Boolean, null],
20
- default: () => true,
21
- },
22
- // 是否显示副标题
23
- showSubtitle: {
24
- type: [Boolean, null],
25
- default: () => false,
26
- },
27
- // 主题色(滑块颜色,边框颜色,选中的背景色,激活下拉列表中选项颜色)
28
- color: {
29
- type: [String, null],
30
- default: () => '',
31
- },
32
- // 背景
33
- background: {
34
- type: [String, null],
35
- default: () => '',
36
- },
37
- // 圆角
38
- radius: {
39
- type: [String, Number, null],
40
- default: () => 0,
41
- },
42
- // 动画时间,单位秒,设置为 0 可以禁用动画
43
- duration: {
44
- type: [String, Number, null],
45
- default: () => 0.3,
46
- },
47
- // 底部条是否显示,默认true(显示副标题的情况下会自动隐藏)
48
- showLine: {
49
- type: [Boolean, null],
50
- default: () => true,
51
- },
52
- // 底部条宽度,默认单位rpx
53
- lineWidth: {
54
- type: [String, Number, null],
55
- default: () => 52,
56
- },
57
- // 底部条高度,默认单位rpx
58
- lineHeight: {
59
- type: [String, Number, null],
60
- default: () => 6,
61
- },
62
- // 是否显示标签栏外边框,仅在 type="line" 时有效
63
- border: {
64
- type: [Boolean, null],
65
- default: () => false,
66
- },
67
- // 是否省略过长的标题文字
68
- ellipsis: {
69
- type: [Boolean, null],
70
- default: () => false,
71
- },
72
- // tab内容的宽度
73
- tabWidth: {
74
- type: [String, Number, null],
75
- default: () => 'auto',
76
- },
77
- // 选项内边距,默认24,单位rpx
78
- tabPadding: {
79
- type: [Number, String, null],
80
- default: () => 24,
81
- },
82
- // tab间距rpx
83
- tabSpace: {
84
- type: [Number, String, null],
85
- default: () => 0,
86
- },
87
- // tab等分数量,设置为 0 ,则不等分
88
- divideNum: {
89
- type: [Number, null],
90
- default: () => 4,
91
- },
92
- // 是否使用粘性布局
93
- sticky: {
94
- type: [Boolean, null],
95
- default: () => false,
96
- },
97
- // 粘性布局下吸顶时与顶部的距离,单位rpx
98
- offsetTop: {
99
- type: [String, Number, null],
100
- default: () => 0,
101
- },
102
- // 是否开启手势左右滑动切换
103
- swipeable: {
104
- type: [Boolean, null],
105
- default: () => false,
106
- },
107
- // 主标题字体颜色和下拉列表中选项颜色
108
- titleColor: {
109
- type: [String, null],
110
- default: () => '#000000',
111
- },
112
- // 激活主标题字体颜色
113
- activeTitleColor: {
114
- type: [String, null],
115
- default: () => '#000000',
116
- },
117
- // 标题高度
118
- titleHeight: {
119
- type: [Number, String, null],
120
- default: () => 48,
121
- },
122
- // 子标题字体颜色和下拉列表中选项颜色
123
- subColor: {
124
- type: [String, null],
125
- default: () => '#000',
126
- },
127
- // 激活子标题字体颜色和下拉列表中选项颜色
128
- activeSubColor: {
129
- type: [String, null],
130
- default: () => '#fff',
131
- },
132
- // 子标题高度
133
- subTitleHeight: {
134
- type: [Number, String, null],
135
- default: () => 42,
136
- },
137
- // 子标题高度
138
- subTitleRadius: {
139
- type: [Number, String, null],
140
- default: () => 21,
141
- },
142
- // 图片宽度,默认80,单位rpx
143
- imageWidth: {
144
- type: [Number, String, null],
145
- default: () => 80,
146
- },
147
- // 图片高度,默认80,单位rpx
148
- imageHeight: {
149
- type: [Number, String, null],
150
- default: () => 80,
151
- },
152
- // 图片圆角,默认50%,单位rpx
153
- imageRadius: {
154
- type: [Number, String, null],
155
- default: () => '50%',
156
- },
157
- // 选中图片边框宽度,默认4,单位rpx
158
- imageBorderWidth: {
159
- type: [Number, String, null],
160
- default: () => 4,
161
- },
162
- // 是否显示分隔符
163
- showGapLine: {
164
- type: [Boolean, null],
165
- default: () => false,
166
- },
167
- // 是否锁定tab(无法切换)
168
- lock: {
169
- type: [Boolean, null],
170
- default: () => false,
171
- },
172
- // 是否禁用tab(所有功能失效)
173
- disabled: {
174
- type: [Boolean, null],
175
- default: () => false,
176
- },
177
- // 是否有下拉选择按钮
178
- pullDown: {
179
- type: [Boolean, null],
180
- default: () => false,
181
- },
182
- // 下拉占位符
183
- placeholder: {
184
- type: [String, null],
185
- default: () => '请选择',
186
- },
187
- // 下拉蒙层顶部距离
188
- maskTop: {
189
- type: [String, Number, null],
190
- default: () => 0,
191
- },
192
- // 下拉蒙层右侧距离
193
- maskRight: {
194
- type: [String, Number, null],
195
- default: () => 0,
196
- },
197
- // 下拉蒙层底部距离
198
- maskBottom: {
199
- type: [String, Number, null],
200
- default: () => 0,
201
- },
202
- // 下拉蒙层左侧距离
203
- maskLeft: {
204
- type: [String, Number, null],
205
- default: () => 0,
206
- },
207
- // 下拉蒙层层级
208
- maskZindex: {
209
- type: [String, Number, null],
210
- default: () => 1001,
211
- },
212
- };
1
+ export default {
2
+ // 当前激活的选项支持sync双向绑定(类型为number时绑定index,类型为string时绑定name)
3
+ active: {
4
+ type: [Number, String, null],
5
+ default: () => 0,
6
+ },
7
+ // 样式风格类型,可选值为 line card
8
+ type: {
9
+ type: [String, null],
10
+ default: () => 'line',
11
+ },
12
+ // 是否显示图片
13
+ showImage: {
14
+ type: [Boolean, null],
15
+ default: () => false,
16
+ },
17
+ // 是否显示主标题
18
+ showTitle: {
19
+ type: [Boolean, null],
20
+ default: () => true,
21
+ },
22
+ // 是否显示副标题
23
+ showSubtitle: {
24
+ type: [Boolean, null],
25
+ default: () => false,
26
+ },
27
+ // 主题色(滑块颜色,边框颜色,选中的背景色,激活下拉列表中选项颜色)
28
+ color: {
29
+ type: [String, null],
30
+ default: () => '',
31
+ },
32
+ // 背景
33
+ background: {
34
+ type: [String, null],
35
+ default: () => '',
36
+ },
37
+ // 圆角
38
+ radius: {
39
+ type: [String, Number, null],
40
+ default: () => 0,
41
+ },
42
+ // 动画时间,单位秒,设置为 0 可以禁用动画
43
+ duration: {
44
+ type: [String, Number, null],
45
+ default: () => 0.3,
46
+ },
47
+ // 底部条是否显示,默认true(显示副标题的情况下会自动隐藏)
48
+ showLine: {
49
+ type: [Boolean, null],
50
+ default: () => true,
51
+ },
52
+ // 底部条宽度,默认单位rpx
53
+ lineWidth: {
54
+ type: [String, Number, null],
55
+ default: () => 52,
56
+ },
57
+ // 底部条高度,默认单位rpx
58
+ lineHeight: {
59
+ type: [String, Number, null],
60
+ default: () => 6,
61
+ },
62
+ // 是否显示标签栏外边框,仅在 type="line" 时有效
63
+ border: {
64
+ type: [Boolean, null],
65
+ default: () => false,
66
+ },
67
+ // 是否省略过长的标题文字
68
+ ellipsis: {
69
+ type: [Boolean, null],
70
+ default: () => false,
71
+ },
72
+ // tab内容的宽度
73
+ tabWidth: {
74
+ type: [String, Number, null],
75
+ default: () => 'auto',
76
+ },
77
+ // 选项内边距,默认24,单位rpx
78
+ tabPadding: {
79
+ type: [Number, String, null],
80
+ default: () => 24,
81
+ },
82
+ // tab间距rpx
83
+ tabSpace: {
84
+ type: [Number, String, null],
85
+ default: () => 0,
86
+ },
87
+ // tab等分数量,设置为 0 ,则不等分
88
+ divideNum: {
89
+ type: [Number, null],
90
+ default: () => 4,
91
+ },
92
+ // 是否使用粘性布局
93
+ sticky: {
94
+ type: [Boolean, null],
95
+ default: () => false,
96
+ },
97
+ // 粘性布局下吸顶时与顶部的距离,单位rpx
98
+ offsetTop: {
99
+ type: [String, Number, null],
100
+ default: () => 0,
101
+ },
102
+ // 是否开启手势左右滑动切换
103
+ swipeable: {
104
+ type: [Boolean, null],
105
+ default: () => false,
106
+ },
107
+ // 主标题字体颜色和下拉列表中选项颜色
108
+ titleColor: {
109
+ type: [String, null],
110
+ default: () => '#000000',
111
+ },
112
+ // 激活主标题字体颜色
113
+ activeTitleColor: {
114
+ type: [String, null],
115
+ default: () => '#000000',
116
+ },
117
+ // 标题高度
118
+ titleHeight: {
119
+ type: [Number, String, null],
120
+ default: () => 48,
121
+ },
122
+ // 子标题字体颜色和下拉列表中选项颜色
123
+ subColor: {
124
+ type: [String, null],
125
+ default: () => '#000',
126
+ },
127
+ // 激活子标题字体颜色和下拉列表中选项颜色
128
+ activeSubColor: {
129
+ type: [String, null],
130
+ default: () => '#fff',
131
+ },
132
+ // 子标题高度
133
+ subTitleHeight: {
134
+ type: [Number, String, null],
135
+ default: () => 42,
136
+ },
137
+ // 子标题高度
138
+ subTitleRadius: {
139
+ type: [Number, String, null],
140
+ default: () => 21,
141
+ },
142
+ // 图片宽度,默认80,单位rpx
143
+ imageWidth: {
144
+ type: [Number, String, null],
145
+ default: () => 80,
146
+ },
147
+ // 图片高度,默认80,单位rpx
148
+ imageHeight: {
149
+ type: [Number, String, null],
150
+ default: () => 80,
151
+ },
152
+ // 图片圆角,默认50%,单位rpx
153
+ imageRadius: {
154
+ type: [Number, String, null],
155
+ default: () => '50%',
156
+ },
157
+ // 选中图片边框宽度,默认4,单位rpx
158
+ imageBorderWidth: {
159
+ type: [Number, String, null],
160
+ default: () => 4,
161
+ },
162
+ // 是否显示分隔符
163
+ showGapLine: {
164
+ type: [Boolean, null],
165
+ default: () => false,
166
+ },
167
+ // 是否锁定tab(无法切换)
168
+ lock: {
169
+ type: [Boolean, null],
170
+ default: () => false,
171
+ },
172
+ // 是否禁用tab(所有功能失效)
173
+ disabled: {
174
+ type: [Boolean, null],
175
+ default: () => false,
176
+ },
177
+ // 是否有下拉选择按钮
178
+ pullDown: {
179
+ type: [Boolean, null],
180
+ default: () => false,
181
+ },
182
+ // 下拉占位符
183
+ placeholder: {
184
+ type: [String, null],
185
+ default: () => '请选择',
186
+ },
187
+ // 下拉蒙层顶部距离
188
+ maskTop: {
189
+ type: [String, Number, null],
190
+ default: () => 0,
191
+ },
192
+ // 下拉蒙层右侧距离
193
+ maskRight: {
194
+ type: [String, Number, null],
195
+ default: () => 0,
196
+ },
197
+ // 下拉蒙层底部距离
198
+ maskBottom: {
199
+ type: [String, Number, null],
200
+ default: () => 0,
201
+ },
202
+ // 下拉蒙层左侧距离
203
+ maskLeft: {
204
+ type: [String, Number, null],
205
+ default: () => 0,
206
+ },
207
+ // 下拉蒙层层级
208
+ maskZindex: {
209
+ type: [String, Number, null],
210
+ default: () => 1001,
211
+ },
212
+ };