@ray-js/lamp-saturation-slider 1.1.2-beta-1 → 1.1.4-beta-2

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,215 +0,0 @@
1
- import "core-js/modules/es.number.constructor.js";
2
- import "core-js/modules/es.regexp.exec.js";
3
- import "core-js/modules/es.regexp.test.js";
4
- import "core-js/modules/es.array.concat.js";
5
- import "core-js/modules/es.array.map.js";
6
- import "core-js/modules/es.array.fill.js";
7
- import "core-js/modules/es.parse-int.js";
8
- /* eslint-disable func-names */
9
- /* eslint-disable vars-on-top */
10
- import 'core-js/modules/es.number.constructor.js';
11
- import 'core-js/modules/es.regexp.exec.js';
12
- import 'core-js/modules/es.regexp.test.js';
13
- import 'core-js/modules/es.array.concat.js';
14
- import 'core-js/modules/es.array.map.js';
15
- import 'core-js/modules/es.array.fill.js';
16
- import 'core-js/modules/es.parse-int.js';
17
- // eslint-disable-next-line no-undef
18
- Component({
19
- options: {
20
- addGlobalClass: true
21
- },
22
- properties: {
23
- className: {
24
- type: String,
25
- value: ''
26
- },
27
- hue: {
28
- type: Number,
29
- value: 0
30
- },
31
- disable: {
32
- type: Boolean,
33
- value: false
34
- },
35
- closed: {
36
- type: Boolean,
37
- value: false
38
- },
39
- // 左滑块初始值
40
- start: {
41
- type: Number,
42
- value: 0
43
- },
44
- // 左滑块最小值限制
45
- startMin: {
46
- type: Number
47
- },
48
- // 左滑块最大值限制
49
- startMax: {
50
- type: Number
51
- },
52
- // 右滑块初始值/单向滑条初始值
53
- end: {
54
- type: Number,
55
- value: 30
56
- },
57
- watchStart: {
58
- type: Number
59
- },
60
- watchEnd: {
61
- type: Number
62
- },
63
- // 右滑块最小值/单向滑条最小值
64
- endMin: {
65
- type: Number
66
- },
67
- // 右滑块最大值/单向滑条最大值
68
- endMax: {
69
- type: Number
70
- },
71
- // 最小值
72
- min: {
73
- type: Number,
74
- value: 0
75
- },
76
- // 最大值
77
- max: {
78
- type: Number,
79
- value: 1000
80
- },
81
- // 阶段值
82
- step: {
83
- type: Number,
84
- value: 1
85
- },
86
- // 阶段值
87
- forceStep: {
88
- type: Number
89
- },
90
- // 滑块样式
91
- thumbStartStyle: {
92
- type: String
93
- },
94
- // 滑块样式
95
- thumbEndStyle: {
96
- type: String
97
- },
98
- // 轨道样式
99
- trackStyle: {
100
- type: String
101
- },
102
- // 滑条样式
103
- barStyle: {
104
- type: String
105
- },
106
- // step样式
107
- stepStyle: {
108
- type: String
109
- },
110
- // step样式
111
- activeStepStyle: {
112
- type: String
113
- },
114
- // 单向还是双向 range: 双向,normal: 单向
115
- mode: {
116
- type: String
117
- },
118
- // 方向 "horizontal" | "vertical"
119
- direction: {
120
- type: String
121
- },
122
- // 控制滑动bar的偏移量,用于样式微调
123
- barPad: {
124
- type: Number
125
- },
126
- // 隐藏滑块
127
- hideThumb: {
128
- type: Boolean,
129
- value: false
130
- },
131
- // 显示阶段提示
132
- showSteps: {
133
- type: Boolean,
134
- value: false
135
- },
136
- // 反转
137
- reverse: {
138
- type: Boolean,
139
- value: false
140
- },
141
- // 使用触摸跳跃
142
- enableTouch: {
143
- type: Boolean,
144
- value: false
145
- },
146
- // 使用触摸bar增加偏移
147
- enableTouchBar: {
148
- type: Boolean,
149
- value: false
150
- },
151
- // 使用触摸跳跃
152
- maxRangeOffset: {
153
- type: Number,
154
- value: 0
155
- },
156
- // 唯一ID
157
- instanceId: {
158
- type: String
159
- },
160
- // 在bar上显示文本
161
- showText: {
162
- type: Boolean
163
- },
164
- // bar文本样式
165
- textStyle: {
166
- type: String
167
- },
168
- // 文本格式化,例如 textTemplate="比率 {{text}} %"
169
- textTemplate: {
170
- type: String
171
- },
172
- // 动态计算thumb样式,如 { background: "rgba(0,0,0, {{text}}/100)" }
173
- thumbStyleCalc: {
174
- type: Object
175
- }
176
- },
177
- data: {
178
- steps: [],
179
- text: ''
180
- },
181
- lifetimes: {
182
- /**
183
- * 组件的方法列表
184
- */
185
- ready: function () {
186
- var isNumber = function (n) {
187
- return /\d+/.test(n);
188
- };
189
- var getNumber = function (n, def) {
190
- return isNumber(n) ? n : def;
191
- };
192
- if (!this.data.showSteps) return;
193
- var stepCount = this.data.step || this.data.forceStep;
194
- var max = getNumber(this.data.max, 100);
195
- var min = getNumber(this.data.min, 0);
196
- var steps = new Array(parseInt(String((max - min) / stepCount), 10)).fill(0).map(function (_, i) {
197
- return i;
198
- }).concat(-1);
199
- this.setData({
200
- steps: steps
201
- });
202
- }
203
- },
204
- methods: {
205
- setText: function (_ref) {
206
- var instanceId = _ref.instanceId;
207
- var content = _ref.content;
208
- if (!this.data.showText) return;
209
- if (instanceId !== this.data.instanceId) return;
210
- this.setData({
211
- text: content
212
- });
213
- }
214
- }
215
- });
@@ -1,3 +0,0 @@
1
- {
2
- "component": true
3
- }
@@ -1,194 +0,0 @@
1
- .rayui-slider {
2
- --slider-width: 300px;
3
- --slider-height: 10px;
4
- --slider-top-position: 2.5px;
5
- --range-width: 20px;
6
- --range-left-position: 20px;
7
- --thumb-height: 24px;
8
- --thumb-width: 24px;
9
- --thumb-left-position: 30px;
10
- --thumb-active-color: #FFFFFF;
11
-
12
- border-radius: 5px;
13
- background: #E0E0E0;
14
- width: var(--slider-width);
15
- height: var(--slider-height);
16
- margin: var(--slider-top-position);
17
- position: relative;
18
- display: flex;
19
- align-items: center;
20
-
21
- .rayui-slider-mask {
22
- width: 100%;
23
- height: 100%;
24
- position: absolute;
25
- left: 0;
26
- top: 0;
27
- background: rgba(0, 0, 0, 0.3);
28
- border-radius: 16px;
29
- }
30
-
31
- &-steps {
32
- position: absolute;
33
- left: 0;
34
- width: 100%;
35
- height: 100%;
36
- top: 50%;
37
- transform: translateY(-50%);
38
- display: flex;
39
- justify-content: space-between;
40
- align-items: center;
41
-
42
- &-dot {
43
- width: 4px;
44
- height: 4px;
45
- border-radius: 50%;
46
- background-color: #328EFF;
47
-
48
- &:first-child {
49
- opacity: 0;
50
- }
51
-
52
- &:last-child {
53
- opacity: 0;
54
- }
55
- }
56
- }
57
-
58
- &-bar {
59
- position: absolute;
60
- width: var(--range-width);
61
- height: var(--slider-height);
62
- background: #328EFF;
63
- cursor: pointer;
64
- border-top-left-radius: 5px;
65
- border-bottom-left-radius: 5px;
66
- flex-shrink: 0;
67
- will-change: width;
68
- overflow: hidden;
69
-
70
- .rayui-slider-steps-dot {
71
- background-color: rgba(51, 255, 241, 0.75);
72
- }
73
-
74
- &-text {
75
- position: absolute;
76
- top: 50%;
77
- left: 50%;
78
- transform: translate(-50%, -50%);
79
- display: inline-block;
80
- font-size: 12px;
81
- color: #fff;
82
- white-space: nowrap;
83
- }
84
-
85
- &-steps_wrap {
86
- position: absolute;
87
- pointer-events: none;
88
- top: 0;
89
- left: 0;
90
- width: 100%;
91
- height: 100%;
92
- }
93
- }
94
-
95
- &-thumb {
96
- position: absolute;
97
- will-change: left;
98
-
99
- &-start {
100
- top: 50%;
101
- transform: translateY(-50%);
102
-
103
- &-render {
104
- width: var(--thumb-width);
105
- height: var(--thumb-height);
106
- border-radius: 50%;
107
- background: var(--thumb-active-color);
108
- cursor: pointer;
109
- box-shadow: rgb(0 0 0 / 12%) 0px 0.5px 4px, rgb(0 0 0 / 12%) 0px 6px 13px;
110
- }
111
- }
112
-
113
- &-end {
114
- top: 50%;
115
- transform: translateY(-50%);
116
-
117
- &-render {
118
- width: var(--thumb-width);
119
- height: var(--thumb-height);
120
- border-radius: 50%;
121
- background: var(--thumb-active-color);
122
- cursor: pointer;
123
- box-shadow: rgb(0 0 0 / 12%) 0px 0.5px 4px, rgb(0 0 0 / 12%) 0px 6px 13px;
124
- }
125
- }
126
- }
127
-
128
- &.reverse {
129
- .rayui-slider {
130
- &-bar {
131
- right: 0;
132
- left: auto;
133
- border-top-right-radius: 5px;
134
- border-bottom-right-radius: 5px;
135
- }
136
- }
137
- }
138
-
139
- &.vertical {
140
- height: var(--slider-width);
141
- width: var(--slider-height);
142
- align-items: flex-start;
143
- justify-content: center;
144
-
145
- .rayui-slider {
146
- &-steps {
147
- height: 100%;
148
- top: 0;
149
- left: 50%;
150
- transform: translateX(-50%);
151
- flex-direction: column;
152
- align-items: center;
153
- }
154
-
155
- &-bar {
156
- height: var(--range-width);
157
- width: var(--slider-height);
158
- top: calc(var(--range-left-position) + var(--thumb-width)/2);
159
- border-top-right-radius: 5px;
160
- border-bottom-right-radius: 5px;
161
- transform: translateX(-50%);
162
- left: 50%;
163
- will-change: height;
164
- }
165
-
166
- &-thumb {
167
- will-change: top;
168
-
169
- &-start {
170
- left: 50%;
171
- transform: translateX(-50%);
172
- }
173
-
174
- &-end {
175
- left: 50%;
176
- transform: translateX(-50%);
177
- }
178
- }
179
- }
180
- }
181
-
182
- &.vertical.reverse {
183
- .rayui-slider {
184
- &-bar {
185
- top: auto;
186
- bottom: 0;
187
- }
188
- }
189
- }
190
-
191
- &.disabled {
192
- pointer-events: none;
193
- }
194
- }