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

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,211 +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
- // 左滑块初始值
36
- start: {
37
- type: Number,
38
- value: 0
39
- },
40
- // 左滑块最小值限制
41
- startMin: {
42
- type: Number
43
- },
44
- // 左滑块最大值限制
45
- startMax: {
46
- type: Number
47
- },
48
- // 右滑块初始值/单向滑条初始值
49
- end: {
50
- type: Number,
51
- value: 30
52
- },
53
- watchStart: {
54
- type: Number
55
- },
56
- watchEnd: {
57
- type: Number
58
- },
59
- // 右滑块最小值/单向滑条最小值
60
- endMin: {
61
- type: Number
62
- },
63
- // 右滑块最大值/单向滑条最大值
64
- endMax: {
65
- type: Number
66
- },
67
- // 最小值
68
- min: {
69
- type: Number,
70
- value: 0
71
- },
72
- // 最大值
73
- max: {
74
- type: Number,
75
- value: 1000
76
- },
77
- // 阶段值
78
- step: {
79
- type: Number,
80
- value: 1
81
- },
82
- // 阶段值
83
- forceStep: {
84
- type: Number
85
- },
86
- // 滑块样式
87
- thumbStartStyle: {
88
- type: String
89
- },
90
- // 滑块样式
91
- thumbEndStyle: {
92
- type: String
93
- },
94
- // 轨道样式
95
- trackStyle: {
96
- type: String
97
- },
98
- // 滑条样式
99
- barStyle: {
100
- type: String
101
- },
102
- // step样式
103
- stepStyle: {
104
- type: String
105
- },
106
- // step样式
107
- activeStepStyle: {
108
- type: String
109
- },
110
- // 单向还是双向 range: 双向,normal: 单向
111
- mode: {
112
- type: String
113
- },
114
- // 方向 "horizontal" | "vertical"
115
- direction: {
116
- type: String
117
- },
118
- // 控制滑动bar的偏移量,用于样式微调
119
- barPad: {
120
- type: Number
121
- },
122
- // 隐藏滑块
123
- hideThumb: {
124
- type: Boolean,
125
- value: false
126
- },
127
- // 显示阶段提示
128
- showSteps: {
129
- type: Boolean,
130
- value: false
131
- },
132
- // 反转
133
- reverse: {
134
- type: Boolean,
135
- value: false
136
- },
137
- // 使用触摸跳跃
138
- enableTouch: {
139
- type: Boolean,
140
- value: false
141
- },
142
- // 使用触摸bar增加偏移
143
- enableTouchBar: {
144
- type: Boolean,
145
- value: false
146
- },
147
- // 使用触摸跳跃
148
- maxRangeOffset: {
149
- type: Number,
150
- value: 0
151
- },
152
- // 唯一ID
153
- instanceId: {
154
- type: String
155
- },
156
- // 在bar上显示文本
157
- showText: {
158
- type: Boolean
159
- },
160
- // bar文本样式
161
- textStyle: {
162
- type: String
163
- },
164
- // 文本格式化,例如 textTemplate="比率 {{text}} %"
165
- textTemplate: {
166
- type: String
167
- },
168
- // 动态计算thumb样式,如 { background: "rgba(0,0,0, {{text}}/100)" }
169
- thumbStyleCalc: {
170
- type: Object
171
- }
172
- },
173
- data: {
174
- steps: [],
175
- text: ''
176
- },
177
- lifetimes: {
178
- /**
179
- * 组件的方法列表
180
- */
181
- ready: function () {
182
- var isNumber = function (n) {
183
- return /\d+/.test(n);
184
- };
185
- var getNumber = function (n, def) {
186
- return isNumber(n) ? n : def;
187
- };
188
- if (!this.data.showSteps) return;
189
- var stepCount = this.data.step || this.data.forceStep;
190
- var max = getNumber(this.data.max, 100);
191
- var min = getNumber(this.data.min, 0);
192
- var steps = new Array(parseInt(String((max - min) / stepCount), 10)).fill(0).map(function (_, i) {
193
- return i;
194
- }).concat(-1);
195
- this.setData({
196
- steps: steps
197
- });
198
- }
199
- },
200
- methods: {
201
- setText: function (_ref) {
202
- var instanceId = _ref.instanceId;
203
- var content = _ref.content;
204
- if (!this.data.showText) return;
205
- if (instanceId !== this.data.instanceId) return;
206
- this.setData({
207
- text: content
208
- });
209
- }
210
- }
211
- });
@@ -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
- }