@ajaxjs/ui 1.1.2 → 1.1.3
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.
- package/README.md +4 -24
- package/dist/css/app.11ca79dd.css +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.html +1 -0
- package/dist/index.js +56 -3
- package/dist/index.js.map +1 -1
- package/dist/js/app.44da9bce.js +2 -0
- package/dist/js/app.44da9bce.js.map +1 -0
- package/dist/js/chunk-vendors.0d9e9c3a.js +8 -0
- package/dist/js/chunk-vendors.0d9e9c3a.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +14 -9
- package/dist/main.js.map +1 -1
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.js +36 -28
- package/dist/router/index.js.map +1 -1
- package/dist/shims-vue.d.ts +4 -0
- package/dist/util/cookies.d.ts +18 -0
- package/dist/util/cookies.js +46 -0
- package/dist/util/cookies.js.map +1 -0
- package/dist/util/dom.d.ts +17 -0
- package/dist/util/dom.js +44 -0
- package/dist/util/dom.js.map +1 -0
- package/dist/util/system/config.d.ts +13 -0
- package/dist/util/system/config.js +84 -0
- package/dist/util/system/config.js.map +1 -0
- package/dist/util/utils.d.ts +44 -0
- package/dist/util/utils.js +140 -0
- package/dist/util/utils.js.map +1 -0
- package/dist/util/xhr-config.d.ts +22 -0
- package/dist/util/xhr-config.js +3 -0
- package/dist/util/xhr-config.js.map +1 -0
- package/dist/util/xhr.d.ts +71 -0
- package/dist/util/xhr.js +262 -0
- package/dist/util/xhr.js.map +1 -0
- package/dist/{components/widgets → widget}/AccordionMenu.vue +139 -137
- package/dist/{components/widgets → widget}/AdjustFontSize.vue +65 -65
- package/dist/{components/widgets → widget}/Article.vue +58 -48
- package/dist/{components/widgets → widget}/BaiduSearch.vue +49 -49
- package/dist/widget/EmptyContent.d.ts +5 -0
- package/dist/widget/EmptyContent.js +7 -0
- package/dist/widget/EmptyContent.js.map +1 -0
- package/dist/{components/widgets → widget}/Expander.vue +64 -64
- package/dist/widget/FileUploader/FileUploader.d.ts +70 -0
- package/dist/{components/form → widget}/FileUploader/FileUploader.js +40 -5
- package/dist/widget/FileUploader/FileUploader.js.map +1 -0
- package/dist/{components/form → widget}/FileUploader/FileUploader.less +67 -54
- package/dist/{components/form → widget}/FileUploader/FileUploader.ts +155 -120
- package/dist/widget/FileUploader/FileUploader.vue +43 -0
- package/dist/widget/HtmlEditor/HtmlEditor.d.ts +70 -0
- package/dist/{components/form → widget}/HtmlEditor/HtmlEditor.js +10 -7
- package/dist/widget/HtmlEditor/HtmlEditor.js.map +1 -0
- package/dist/{components/form → widget}/HtmlEditor/HtmlEditor.less +344 -344
- package/dist/{components/form → widget}/HtmlEditor/HtmlEditor.ts +338 -336
- package/dist/{components/form → widget}/HtmlEditor/HtmlEditor.vue +69 -69
- package/dist/{components/form → widget}/HtmlEditor/html-editor-HtmlSanitizer.js +102 -102
- package/dist/{components/widgets → widget}/ImageEnlarger.vue +104 -98
- package/dist/{components/widgets → widget}/OpacityBanner.vue +124 -123
- package/dist/{components/widgets → widget}/ProcessLine.vue +132 -132
- package/dist/widget/Resize.d.ts +51 -0
- package/dist/widget/Resize.js +133 -0
- package/dist/widget/Resize.js.map +1 -0
- package/dist/widget/Resize.ts +152 -0
- package/dist/widget/Resize.vue +104 -0
- package/dist/widget/TreeSelector.vue +4 -0
- package/dist/widget/calendar/BetweenDate.vue +63 -0
- package/dist/widget/calendar/Calendar.d.ts +55 -0
- package/dist/widget/calendar/Calendar.js +145 -0
- package/dist/widget/calendar/Calendar.js.map +1 -0
- package/dist/widget/calendar/Calendar.less +208 -0
- package/dist/widget/calendar/Calendar.ts +167 -0
- package/dist/widget/calendar/Calendar.vue +52 -0
- package/dist/widget/calendar/CalendarInput.vue +71 -0
- package/dist/widget/form/validator.d.ts +72 -0
- package/dist/widget/form/validator.js +222 -0
- package/dist/widget/form/validator.js.map +1 -0
- package/dist/widget/form/validator.ts +290 -0
- package/dist/widget/play-ground/sku.vue +93 -0
- package/package.json +36 -33
- package/dist/components/form/AjSelect.vue +0 -33
- package/dist/components/form/FileUploader/FileUploader.js.map +0 -1
- package/dist/components/form/FileUploader/FileUploader.vue +0 -26
- package/dist/components/form/HtmlEditor/HtmlEditor.js.map +0 -1
- package/dist/components/form/TreeLikeSelect.vue +0 -125
|
@@ -1,124 +1,125 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul class="aj-opacity-banner">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</ul>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
/**
|
|
9
|
-
* 渐显 banner
|
|
10
|
-
* 注意:定时器保存在 DOM 元素的属性上,是否会内存泄漏呢?
|
|
11
|
-
*/
|
|
12
|
-
export default {
|
|
13
|
-
props: {
|
|
14
|
-
delay: { default: 3000 }, // 延时
|
|
15
|
-
fps: { default: 25 }, // 帧速
|
|
16
|
-
},
|
|
17
|
-
data(): any {
|
|
18
|
-
return {
|
|
19
|
-
active: 0, // 当前索引
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
mounted(): void {
|
|
23
|
-
this.list = this.$el.querySelectorAll("li"); // 各帧
|
|
24
|
-
this.list[0].style.opacity = "1";
|
|
25
|
-
this.run();
|
|
26
|
-
},
|
|
27
|
-
methods: {
|
|
28
|
-
/**
|
|
29
|
-
* 播放动画
|
|
30
|
-
*
|
|
31
|
-
* @param this
|
|
32
|
-
*/
|
|
33
|
-
run(): void {
|
|
34
|
-
this.timer = window.setInterval(() => {
|
|
35
|
-
let active: number = this.active;
|
|
36
|
-
this.clear();
|
|
37
|
-
active += 1;
|
|
38
|
-
this.active = active % this.list.length;
|
|
39
|
-
this.animate(100);
|
|
40
|
-
}, this.delay);
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 下一帧
|
|
45
|
-
*
|
|
46
|
-
* @param this
|
|
47
|
-
*/
|
|
48
|
-
per(): void {
|
|
49
|
-
let active: number = this.active;
|
|
50
|
-
this.clear();
|
|
51
|
-
active -= 1;
|
|
52
|
-
active = active % this.list.length;
|
|
53
|
-
|
|
54
|
-
if (active < 0) active = this.list.length - 1;
|
|
55
|
-
|
|
56
|
-
this.active = active;
|
|
57
|
-
this.animate(100);
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* 内容淡出
|
|
62
|
-
*/
|
|
63
|
-
clear(): void {
|
|
64
|
-
this.animate(0);
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @param params
|
|
70
|
-
*/
|
|
71
|
-
animate(params: number): void {
|
|
72
|
-
var el: HTMLLIElement = this.list[this.active],
|
|
73
|
-
fps: number = 1000 / this.fps;
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
window.clearTimeout(el.timer);
|
|
76
|
-
|
|
77
|
-
window.setTimeout(function loop() {
|
|
78
|
-
var i: number = getOpacity(el);
|
|
79
|
-
let speed: number = (params - i) / 8;
|
|
80
|
-
speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
|
|
81
|
-
// console.log("i=" + i + "; speed="+ speed+"; s="+s+"; k="+k);
|
|
82
|
-
i += speed;
|
|
83
|
-
el.style.opacity = String(i / 100);
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
window.clearTimeout(el.timer);
|
|
86
|
-
// params.complete && params.complete.call(elem);
|
|
87
|
-
// @ts-ignore
|
|
88
|
-
el.timer = window.setTimeout(loop, fps);
|
|
89
|
-
}, fps);
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* 获取元素的透明度
|
|
96
|
-
*
|
|
97
|
-
* @param el
|
|
98
|
-
*/
|
|
99
|
-
function getOpacity(el: Element): number {
|
|
100
|
-
let v = Number(getComputedStyle(el)["opacity"]);
|
|
101
|
-
v *= 100;
|
|
102
|
-
|
|
103
|
-
return parseFloat(v + "") || 0;
|
|
104
|
-
}
|
|
105
|
-
</script>
|
|
106
|
-
|
|
107
|
-
<style lang="less" scoped>
|
|
108
|
-
.aj-opacity-banner {
|
|
109
|
-
position: relative;
|
|
110
|
-
min-height: 90px;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="aj-opacity-banner">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</ul>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
/**
|
|
9
|
+
* 渐显 banner
|
|
10
|
+
* 注意:定时器保存在 DOM 元素的属性上,是否会内存泄漏呢?
|
|
11
|
+
*/
|
|
12
|
+
export default {
|
|
13
|
+
props: {
|
|
14
|
+
delay: { default: 3000 }, // 延时
|
|
15
|
+
fps: { default: 25 }, // 帧速
|
|
16
|
+
},
|
|
17
|
+
data(): any {
|
|
18
|
+
return {
|
|
19
|
+
active: 0, // 当前索引
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
mounted(): void {
|
|
23
|
+
this.list = this.$el.querySelectorAll("li"); // 各帧
|
|
24
|
+
this.list[0].style.opacity = "1";
|
|
25
|
+
this.run();
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
/**
|
|
29
|
+
* 播放动画
|
|
30
|
+
*
|
|
31
|
+
* @param this
|
|
32
|
+
*/
|
|
33
|
+
run(): void {
|
|
34
|
+
this.timer = window.setInterval(() => {
|
|
35
|
+
let active: number = this.active;
|
|
36
|
+
this.clear();
|
|
37
|
+
active += 1;
|
|
38
|
+
this.active = active % this.list.length;
|
|
39
|
+
this.animate(100);
|
|
40
|
+
}, this.delay);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 下一帧
|
|
45
|
+
*
|
|
46
|
+
* @param this
|
|
47
|
+
*/
|
|
48
|
+
per(): void {
|
|
49
|
+
let active: number = this.active;
|
|
50
|
+
this.clear();
|
|
51
|
+
active -= 1;
|
|
52
|
+
active = active % this.list.length;
|
|
53
|
+
|
|
54
|
+
if (active < 0) active = this.list.length - 1;
|
|
55
|
+
|
|
56
|
+
this.active = active;
|
|
57
|
+
this.animate(100);
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 内容淡出
|
|
62
|
+
*/
|
|
63
|
+
clear(): void {
|
|
64
|
+
this.animate(0);
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param params
|
|
70
|
+
*/
|
|
71
|
+
animate(params: number): void {
|
|
72
|
+
var el: HTMLLIElement = this.list[this.active],
|
|
73
|
+
fps: number = 1000 / this.fps;
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
window.clearTimeout(el.timer);
|
|
76
|
+
|
|
77
|
+
window.setTimeout(function loop() {
|
|
78
|
+
var i: number = getOpacity(el);
|
|
79
|
+
let speed: number = (params - i) / 8;
|
|
80
|
+
speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
|
|
81
|
+
// console.log("i=" + i + "; speed="+ speed+"; s="+s+"; k="+k);
|
|
82
|
+
i += speed;
|
|
83
|
+
el.style.opacity = String(i / 100);
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
window.clearTimeout(el.timer);
|
|
86
|
+
// params.complete && params.complete.call(elem);
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
el.timer = window.setTimeout(loop, fps);
|
|
89
|
+
}, fps);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 获取元素的透明度
|
|
96
|
+
*
|
|
97
|
+
* @param el
|
|
98
|
+
*/
|
|
99
|
+
function getOpacity(el: Element): number {
|
|
100
|
+
let v = Number(getComputedStyle(el)["opacity"]);
|
|
101
|
+
v *= 100;
|
|
102
|
+
|
|
103
|
+
return parseFloat(v + "") || 0;
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<style lang="less" scoped>
|
|
108
|
+
.aj-opacity-banner {
|
|
109
|
+
position: relative;
|
|
110
|
+
min-height: 90px;
|
|
111
|
+
|
|
112
|
+
li {
|
|
113
|
+
position: absolute;
|
|
114
|
+
top: 0;
|
|
115
|
+
left: 0;
|
|
116
|
+
opacity: 0;
|
|
117
|
+
width: 100%;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
img {
|
|
121
|
+
// border-top:solid 20px #00416d;
|
|
122
|
+
width: 100%;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
124
125
|
</style>
|
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="aj-process-line">
|
|
3
|
-
<div class="process-line">
|
|
4
|
-
<div v-for="(item, index) in items" :key="index" :class="{current: index == current, done: index < current}">
|
|
5
|
-
<span>{{index + 1}}</span>
|
|
6
|
-
<p>{{item}}</p>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
/**
|
|
14
|
-
* 进度条
|
|
15
|
-
*/
|
|
16
|
-
export default {
|
|
17
|
-
props: {
|
|
18
|
-
items: {
|
|
19
|
-
type: Array,
|
|
20
|
-
default(): string[] {
|
|
21
|
-
return ["Step 1", "Step 2", "Step 3"];
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
data():any {
|
|
26
|
-
return {
|
|
27
|
-
current: 0,
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
methods: {
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @param i
|
|
34
|
-
*/
|
|
35
|
-
go(i: number): void {
|
|
36
|
-
this.current = i;
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
perv(): void {
|
|
43
|
-
let perv: number = this.current - 1;
|
|
44
|
-
if (perv < 0) perv = this.items.length - 1;
|
|
45
|
-
|
|
46
|
-
this.go(perv);
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*/
|
|
52
|
-
next(): void {
|
|
53
|
-
let next: number = this.current + 1;
|
|
54
|
-
if (this.items.length == next) next = 0; // 循环
|
|
55
|
-
|
|
56
|
-
this.go(next);
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
</script>
|
|
61
|
-
|
|
62
|
-
<style lang="less" scoped>
|
|
63
|
-
.aj-process-line {
|
|
64
|
-
display: flex;
|
|
65
|
-
padding: 5%;
|
|
66
|
-
justify-content: center;
|
|
67
|
-
|
|
68
|
-
.process-line {
|
|
69
|
-
font-size: 18px;
|
|
70
|
-
color: lightgray;
|
|
71
|
-
font-weight: bold;
|
|
72
|
-
|
|
73
|
-
& > div {
|
|
74
|
-
float: left;
|
|
75
|
-
width: 156px;
|
|
76
|
-
text-align: center;
|
|
77
|
-
position: relative;
|
|
78
|
-
|
|
79
|
-
&.current {
|
|
80
|
-
color: black;
|
|
81
|
-
|
|
82
|
-
span {
|
|
83
|
-
background-color: gray;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&.done {
|
|
88
|
-
// color: lighten(@mainColor, 80%);
|
|
89
|
-
span {
|
|
90
|
-
// background-color: lighten(@mainColor, 50%);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&::after {
|
|
94
|
-
// background-color: lighten(@mainColor, 50%);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
p {
|
|
99
|
-
font-size: 1rem;
|
|
100
|
-
letter-spacing: 3px;
|
|
101
|
-
padding-top: 5%;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
span {
|
|
105
|
-
display: inline-block;
|
|
106
|
-
width: 32px;
|
|
107
|
-
height: 32px;
|
|
108
|
-
border-radius: 50%;
|
|
109
|
-
color: #fff;
|
|
110
|
-
line-height: 32px;
|
|
111
|
-
font-size: 16px;
|
|
112
|
-
background-color: lightgray;
|
|
113
|
-
position: relative;
|
|
114
|
-
z-index: 1;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&:last-child::after {
|
|
118
|
-
display: none;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
&::after {
|
|
122
|
-
content: "";
|
|
123
|
-
position: absolute;
|
|
124
|
-
top: 14px;
|
|
125
|
-
left: 94px;
|
|
126
|
-
width: 124px;
|
|
127
|
-
height: 4px;
|
|
128
|
-
background-color: lightgray;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="aj-process-line">
|
|
3
|
+
<div class="process-line">
|
|
4
|
+
<div v-for="(item, index) in items" :key="index" :class="{current: index == current, done: index < current}">
|
|
5
|
+
<span>{{index + 1}}</span>
|
|
6
|
+
<p>{{item}}</p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
/**
|
|
14
|
+
* 进度条
|
|
15
|
+
*/
|
|
16
|
+
export default {
|
|
17
|
+
props: {
|
|
18
|
+
items: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default(): string[] {
|
|
21
|
+
return ["Step 1", "Step 2", "Step 3"];
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
data():any {
|
|
26
|
+
return {
|
|
27
|
+
current: 0,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param i
|
|
34
|
+
*/
|
|
35
|
+
go(i: number): void {
|
|
36
|
+
this.current = i;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
perv(): void {
|
|
43
|
+
let perv: number = this.current - 1;
|
|
44
|
+
if (perv < 0) perv = this.items.length - 1;
|
|
45
|
+
|
|
46
|
+
this.go(perv);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
next(): void {
|
|
53
|
+
let next: number = this.current + 1;
|
|
54
|
+
if (this.items.length == next) next = 0; // 循环
|
|
55
|
+
|
|
56
|
+
this.go(next);
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style lang="less" scoped>
|
|
63
|
+
.aj-process-line {
|
|
64
|
+
display: flex;
|
|
65
|
+
padding: 5%;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
|
|
68
|
+
.process-line {
|
|
69
|
+
font-size: 18px;
|
|
70
|
+
color: lightgray;
|
|
71
|
+
font-weight: bold;
|
|
72
|
+
|
|
73
|
+
& > div {
|
|
74
|
+
float: left;
|
|
75
|
+
width: 156px;
|
|
76
|
+
text-align: center;
|
|
77
|
+
position: relative;
|
|
78
|
+
|
|
79
|
+
&.current {
|
|
80
|
+
color: black;
|
|
81
|
+
|
|
82
|
+
span {
|
|
83
|
+
background-color: gray;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.done {
|
|
88
|
+
// color: lighten(@mainColor, 80%);
|
|
89
|
+
span {
|
|
90
|
+
// background-color: lighten(@mainColor, 50%);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&::after {
|
|
94
|
+
// background-color: lighten(@mainColor, 50%);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
p {
|
|
99
|
+
font-size: 1rem;
|
|
100
|
+
letter-spacing: 3px;
|
|
101
|
+
padding-top: 5%;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
span {
|
|
105
|
+
display: inline-block;
|
|
106
|
+
width: 32px;
|
|
107
|
+
height: 32px;
|
|
108
|
+
border-radius: 50%;
|
|
109
|
+
color: #fff;
|
|
110
|
+
line-height: 32px;
|
|
111
|
+
font-size: 16px;
|
|
112
|
+
background-color: lightgray;
|
|
113
|
+
position: relative;
|
|
114
|
+
z-index: 1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&:last-child::after {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&::after {
|
|
122
|
+
content: "";
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: 14px;
|
|
125
|
+
left: 94px;
|
|
126
|
+
width: 124px;
|
|
127
|
+
height: 4px;
|
|
128
|
+
background-color: lightgray;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
133
|
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
data(): {
|
|
3
|
+
styleWidth: number;
|
|
4
|
+
styleHeight: number;
|
|
5
|
+
styleLeft: number;
|
|
6
|
+
styleTop: number;
|
|
7
|
+
sideLeft: number;
|
|
8
|
+
sideRight: number;
|
|
9
|
+
sideUp: number;
|
|
10
|
+
sideDown: number;
|
|
11
|
+
fixLeft: number;
|
|
12
|
+
fixTop: number;
|
|
13
|
+
fn: any;
|
|
14
|
+
LockX: boolean;
|
|
15
|
+
LockY: boolean;
|
|
16
|
+
Lock: boolean;
|
|
17
|
+
scale: {
|
|
18
|
+
enable: boolean;
|
|
19
|
+
ratio: number;
|
|
20
|
+
left: number;
|
|
21
|
+
top: number;
|
|
22
|
+
};
|
|
23
|
+
min: {
|
|
24
|
+
enable: boolean;
|
|
25
|
+
height: number;
|
|
26
|
+
width: number;
|
|
27
|
+
};
|
|
28
|
+
max: {
|
|
29
|
+
enable: boolean;
|
|
30
|
+
height: number;
|
|
31
|
+
width: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
methods: {
|
|
35
|
+
/**
|
|
36
|
+
* 准备拖动
|
|
37
|
+
*/
|
|
38
|
+
start(e: MouseEvent, fn: Function): void;
|
|
39
|
+
resize(e: MouseEvent): void;
|
|
40
|
+
stop(): void;
|
|
41
|
+
up(e: MouseEvent): void;
|
|
42
|
+
down(e: MouseEvent): void;
|
|
43
|
+
right(e: MouseEvent): void;
|
|
44
|
+
left(e: MouseEvent): void;
|
|
45
|
+
rightDown(e: MouseEvent): void;
|
|
46
|
+
rightUp(e: MouseEvent): void;
|
|
47
|
+
leftDown(e: MouseEvent): void;
|
|
48
|
+
leftUp(e: MouseEvent): void;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
data() {
|
|
5
|
+
return {
|
|
6
|
+
styleWidth: 0,
|
|
7
|
+
styleHeight: 0,
|
|
8
|
+
styleLeft: 0,
|
|
9
|
+
styleTop: 0,
|
|
10
|
+
sideLeft: 0,
|
|
11
|
+
sideRight: 0,
|
|
12
|
+
sideUp: 0,
|
|
13
|
+
sideDown: 0,
|
|
14
|
+
fixLeft: 0,
|
|
15
|
+
fixTop: 0,
|
|
16
|
+
fn: null,
|
|
17
|
+
LockX: false,
|
|
18
|
+
LockY: false,
|
|
19
|
+
Lock: false,
|
|
20
|
+
scale: {
|
|
21
|
+
enable: true,
|
|
22
|
+
ratio: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
top: 0,
|
|
25
|
+
},
|
|
26
|
+
min: {
|
|
27
|
+
enable: false,
|
|
28
|
+
height: 100,
|
|
29
|
+
width: 200,
|
|
30
|
+
},
|
|
31
|
+
max: {
|
|
32
|
+
enable: false,
|
|
33
|
+
height: 300,
|
|
34
|
+
width: 500,
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
/**
|
|
40
|
+
* 准备拖动
|
|
41
|
+
*/
|
|
42
|
+
start(e, fn) {
|
|
43
|
+
this.styleWidth = this.$el.clientWidth;
|
|
44
|
+
this.styleHeight = this.$el.clientHeight;
|
|
45
|
+
this.styleLeft = this.$el.offsetLeft; // 记录鼠标相对拖放对象的位置
|
|
46
|
+
this.styleTop = this.$el.offsetTop;
|
|
47
|
+
this.sideLeft = e.clientX - this.styleWidth;
|
|
48
|
+
this.sideRight = e.clientX + this.styleWidth;
|
|
49
|
+
this.sideUp = e.clientY - this.styleHeight;
|
|
50
|
+
this.sideDown = e.clientY + this.styleHeight;
|
|
51
|
+
this.fixLeft = this.styleWidth + this.styleLeft;
|
|
52
|
+
this.fixTop = this.styleHeight + this.styleTop;
|
|
53
|
+
this.fn = fn;
|
|
54
|
+
if (this.scale.enable) {
|
|
55
|
+
this.scale.ratio = Math.max(this.scale.ratio, 0) || this.styleWidth / this.styleHeight; //设置比例
|
|
56
|
+
this.scale.left = this.styleLeft + this.styleWidth / 2; // left 和 top 的定位坐标
|
|
57
|
+
this.scale.top = this.styleTop + this.styleHeight / 2;
|
|
58
|
+
}
|
|
59
|
+
document.addEventListener("mousemove", this.resize); // mousemove 时移动 mouseup 时停止
|
|
60
|
+
document.addEventListener("mouseup", this.stop);
|
|
61
|
+
},
|
|
62
|
+
// 缩放
|
|
63
|
+
resize(e) {
|
|
64
|
+
window.getSelection().removeAllRanges(); // 清除选择
|
|
65
|
+
this.fn(e);
|
|
66
|
+
if (this.min.enable) {
|
|
67
|
+
if (this.styleHeight <= this.min.height)
|
|
68
|
+
return;
|
|
69
|
+
if (this.styleWidth <= this.min.width)
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (this.max.enable) {
|
|
73
|
+
if (this.styleHeight >= this.max.height)
|
|
74
|
+
return;
|
|
75
|
+
if (this.styleWidth >= this.max.width)
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let s = this.$el.style;
|
|
79
|
+
s.width = this.styleWidth + "px";
|
|
80
|
+
s.height = this.styleHeight + "px";
|
|
81
|
+
s.top = this.styleTop + "px";
|
|
82
|
+
s.left = this.styleLeft + "px";
|
|
83
|
+
},
|
|
84
|
+
// 停止缩放
|
|
85
|
+
stop() {
|
|
86
|
+
document.removeEventListener("mousemove", this.resize);
|
|
87
|
+
document.removeEventListener("mouseup", this.stop);
|
|
88
|
+
},
|
|
89
|
+
//缩放程序
|
|
90
|
+
//上
|
|
91
|
+
up(e) {
|
|
92
|
+
this.styleHeight = Math.max(this.sideDown - e.clientY, 0);
|
|
93
|
+
this.styleTop = this.fixTop - this.styleHeight;
|
|
94
|
+
this.styleLeft = this.scale.left - this.styleWidth / 2;
|
|
95
|
+
console.log(this.styleLeft);
|
|
96
|
+
},
|
|
97
|
+
//下
|
|
98
|
+
down(e) {
|
|
99
|
+
this.styleHeight = Math.max(e.clientY - this.sideUp, 0);
|
|
100
|
+
this.styleLeft = this.scale.left - this.styleWidth / 2;
|
|
101
|
+
},
|
|
102
|
+
//右
|
|
103
|
+
right(e) {
|
|
104
|
+
this.styleWidth = Math.max(e.clientX - this.sideLeft, 0);
|
|
105
|
+
},
|
|
106
|
+
//左
|
|
107
|
+
left(e) {
|
|
108
|
+
this.styleWidth = Math.max(this.sideRight - e.clientX, 0);
|
|
109
|
+
this.styleLeft = this.fixLeft - this.styleWidth;
|
|
110
|
+
},
|
|
111
|
+
//右下
|
|
112
|
+
rightDown(e) {
|
|
113
|
+
this.right(e);
|
|
114
|
+
this.down(e);
|
|
115
|
+
},
|
|
116
|
+
//右上
|
|
117
|
+
rightUp(e) {
|
|
118
|
+
this.right(e);
|
|
119
|
+
this.up(e);
|
|
120
|
+
},
|
|
121
|
+
//左下
|
|
122
|
+
leftDown(e) {
|
|
123
|
+
this.left(e);
|
|
124
|
+
this.down(e);
|
|
125
|
+
},
|
|
126
|
+
//左上
|
|
127
|
+
leftUp(e) {
|
|
128
|
+
this.left(e);
|
|
129
|
+
this.up(e);
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=Resize.js.map
|