zartui 0.1.21 → 0.1.25
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 +20 -20
- package/changelog.generated.md +15 -0
- package/es/area/style/index.js +4 -0
- package/es/area/style/less.js +4 -0
- package/es/avatar/index.css +1 -1
- package/es/avatar/index.js +54 -36
- package/es/avatar/index.less +39 -11
- package/es/avatar/local.less +1 -1
- package/es/button/index.js +4 -1
- package/es/button/index.less +206 -206
- package/es/calendar/index.less +250 -250
- package/es/calendar/style/index.js +1 -1
- package/es/calendar/style/less.js +1 -1
- package/es/cell/index.less +103 -103
- package/es/cell-group/index.less +22 -22
- package/es/checkbox/index.less +89 -89
- package/es/checkbox-group/index.less +8 -8
- package/es/col/index.less +20 -20
- package/es/datetime-picker/style/index.js +4 -0
- package/es/datetime-picker/style/less.js +4 -0
- package/es/dialog/index.css +1 -1
- package/es/dialog/index.less +125 -125
- package/es/dialog/style/index.js +1 -1
- package/es/dialog/style/less.js +1 -1
- package/es/empty/Developing.js +1643 -0
- package/es/empty/Error.js +484 -0
- package/es/empty/NotFound.js +645 -0
- package/es/empty/NotRight.js +395 -0
- package/es/empty/Search.js +336 -0
- package/es/empty/index.css +1 -0
- package/es/empty/index.js +105 -0
- package/es/empty/index.less +33 -0
- package/es/empty/style/index.js +2 -0
- package/es/empty/style/less.js +2 -0
- package/es/field/index.less +172 -172
- package/es/icon/index.less +10 -10
- package/es/icon/local.less +1 -1
- package/es/image/index.less +47 -47
- package/es/image-preview/index.less +103 -103
- package/es/image-preview/style/index.js +1 -1
- package/es/image-preview/style/less.js +1 -1
- package/es/index.js +6 -3
- package/es/info/index.less +29 -29
- package/es/loading/index.less +103 -103
- package/es/locale/lang/zh-CN.js +22 -0
- package/es/mixins/bind-event.js +2 -2
- package/es/mixins/checkbox.js +2 -2
- package/es/mixins/click-outside.js +2 -2
- package/es/mixins/slots.js +3 -3
- package/es/mixins/telemetry.js +11 -0
- package/es/nav-bar/index.less +74 -74
- package/es/number-keyboard/index.css +1 -1
- package/es/number-keyboard/index.less +144 -142
- package/es/overlay/index.less +11 -11
- package/es/password-input/index.css +1 -0
- package/es/password-input/index.js +80 -0
- package/es/password-input/index.less +83 -0
- package/es/password-input/style/index.js +2 -0
- package/es/password-input/style/less.js +2 -0
- package/es/pdf-viewer/style/index.js +1 -1
- package/es/pdf-viewer/style/less.js +1 -1
- package/es/picker/PickerColumn.js +5 -6
- package/es/picker/index.js +34 -5
- package/es/picker/index.less +151 -151
- package/es/picker/shared.js +4 -0
- package/es/picker/style/index.js +4 -0
- package/es/picker/style/less.js +4 -0
- package/es/popup/index.less +137 -137
- package/es/popup/style/index.js +1 -1
- package/es/popup/style/less.js +1 -1
- package/es/radio/index.less +86 -86
- package/es/radio-group/index.less +8 -8
- package/es/rate/index.css +1 -1
- package/es/rate/index.js +1 -1
- package/es/rate/index.less +47 -47
- package/es/row/index.less +42 -42
- package/es/signature/index.css +1 -0
- package/es/signature/index.js +230 -0
- package/es/signature/index.less +50 -0
- package/es/signature/style/index.js +9 -0
- package/es/signature/style/less.js +9 -0
- package/es/slider/index.less +94 -94
- package/es/step/index.less +139 -139
- package/es/stepper/index.less +130 -130
- package/es/steps/index.less +21 -21
- package/es/sticky/index.less +11 -11
- package/es/style/animation.less +139 -139
- package/es/style/base.less +11 -11
- package/es/style/clearfix.less +5 -5
- package/es/style/ellipsis.less +13 -13
- package/es/style/hairline.less +47 -47
- package/es/style/halfPxBorder.less +15 -15
- package/es/style/mixins/clearfix.less +7 -7
- package/es/style/mixins/ellipsis.less +15 -15
- package/es/style/mixins/hairline.less +39 -39
- package/es/style/normalize.less +38 -38
- package/es/style/reset.less +171 -171
- package/es/style/var.less +941 -919
- package/es/swipe/index.less +56 -56
- package/es/swipe-cell/index.less +29 -29
- package/es/swipe-item/index.less +8 -8
- package/es/switch/index.less +56 -56
- package/es/switch/shared.js +2 -2
- package/es/switch-cell/index.less +15 -15
- package/es/tab/index.less +17 -17
- package/es/tabs/index.less +153 -153
- package/es/tag/index.less +99 -99
- package/es/telemetry/index.js +72 -0
- package/es/toast/index.js +1 -1
- package/es/toast/index.less +75 -75
- package/es/toast/style/index.js +1 -1
- package/es/toast/style/less.js +1 -1
- package/es/uploader/index.less +163 -163
- package/es/uploader/style/index.js +1 -1
- package/es/uploader/style/less.js +1 -1
- package/es/utils/create/bem.js +7 -7
- package/es/utils/create/component.js +37 -7
- package/es/utils/dom/raf.js +2 -2
- package/es/utils/dom/reset-scroll.js +3 -3
- package/es/utils/index.js +29 -29
- package/es/utils/media/image-util.js +138 -0
- package/es/utils/router.js +2 -2
- package/lib/7893e51cf0a4877dac80.worker.js +10 -0
- package/lib/area/style/index.js +4 -0
- package/lib/area/style/less.js +4 -0
- package/lib/avatar/index.css +1 -1
- package/lib/avatar/index.js +55 -37
- package/lib/avatar/index.less +39 -11
- package/lib/avatar/local.less +1 -1
- package/lib/be09b519a460e229fd8d.worker.js +2527 -0
- package/lib/button/index.js +5 -0
- package/lib/button/index.less +206 -206
- package/lib/calendar/index.less +250 -250
- package/lib/calendar/style/index.js +1 -1
- package/lib/calendar/style/less.js +1 -1
- package/lib/cell/index.less +103 -103
- package/lib/cell-group/index.less +22 -22
- package/lib/checkbox/index.less +89 -89
- package/lib/checkbox-group/index.less +8 -8
- package/lib/col/index.less +20 -20
- package/lib/datetime-picker/style/index.js +4 -0
- package/lib/datetime-picker/style/less.js +4 -0
- package/lib/dialog/index.css +1 -1
- package/lib/dialog/index.less +125 -125
- package/lib/dialog/style/index.js +1 -1
- package/lib/dialog/style/less.js +1 -1
- package/lib/empty/Developing.js +1648 -0
- package/lib/empty/Error.js +489 -0
- package/lib/empty/NotFound.js +650 -0
- package/lib/empty/NotRight.js +400 -0
- package/lib/empty/Search.js +341 -0
- package/lib/empty/index.css +1 -0
- package/lib/empty/index.js +119 -0
- package/lib/empty/index.less +33 -0
- package/lib/empty/style/index.js +2 -0
- package/lib/empty/style/less.js +2 -0
- package/lib/field/index.less +172 -172
- package/lib/icon/index.less +10 -10
- package/lib/icon/local.less +1 -1
- package/lib/image/index.less +47 -47
- package/lib/image-preview/index.less +103 -103
- package/lib/image-preview/style/index.js +1 -1
- package/lib/image-preview/style/less.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.js +14 -2
- package/lib/index.less +6 -3
- package/lib/info/index.less +29 -29
- package/lib/loading/index.less +103 -103
- package/lib/locale/lang/zh-CN.js +22 -0
- package/lib/mixins/bind-event.js +2 -2
- package/lib/mixins/checkbox.js +2 -2
- package/lib/mixins/click-outside.js +2 -2
- package/lib/mixins/slots.js +3 -3
- package/lib/mixins/telemetry.js +20 -0
- package/lib/nav-bar/index.less +74 -74
- package/lib/number-keyboard/index.css +1 -1
- package/lib/number-keyboard/index.less +144 -142
- package/lib/overlay/index.less +11 -11
- package/lib/password-input/index.css +1 -0
- package/lib/password-input/index.js +93 -0
- package/lib/password-input/index.less +83 -0
- package/lib/password-input/style/index.js +2 -0
- package/lib/password-input/style/less.js +2 -0
- package/lib/pdf-viewer/style/index.js +1 -1
- package/lib/pdf-viewer/style/less.js +1 -1
- package/lib/picker/PickerColumn.js +5 -6
- package/lib/picker/index.js +36 -6
- package/lib/picker/index.less +151 -151
- package/lib/picker/shared.js +4 -0
- package/lib/picker/style/index.js +4 -0
- package/lib/picker/style/less.js +4 -0
- package/lib/popup/index.less +137 -137
- package/lib/popup/style/index.js +1 -1
- package/lib/popup/style/less.js +1 -1
- package/lib/radio/index.less +86 -86
- package/lib/radio-group/index.less +8 -8
- package/lib/rate/index.css +1 -1
- package/lib/rate/index.js +1 -1
- package/lib/rate/index.less +47 -47
- package/lib/row/index.less +42 -42
- package/lib/signature/index.css +1 -0
- package/lib/signature/index.js +242 -0
- package/lib/signature/index.less +50 -0
- package/lib/signature/style/index.js +9 -0
- package/lib/signature/style/less.js +9 -0
- package/lib/slider/index.less +94 -94
- package/lib/step/index.less +139 -139
- package/lib/stepper/index.less +130 -130
- package/lib/steps/index.less +21 -21
- package/lib/sticky/index.less +11 -11
- package/lib/style/animation.less +139 -139
- package/lib/style/base.less +11 -11
- package/lib/style/clearfix.less +5 -5
- package/lib/style/ellipsis.less +13 -13
- package/lib/style/hairline.less +47 -47
- package/lib/style/halfPxBorder.less +15 -15
- package/lib/style/mixins/clearfix.less +7 -7
- package/lib/style/mixins/ellipsis.less +15 -15
- package/lib/style/mixins/hairline.less +39 -39
- package/lib/style/normalize.less +38 -38
- package/lib/style/reset.less +171 -171
- package/lib/style/var.less +941 -919
- package/lib/swipe/index.less +56 -56
- package/lib/swipe-cell/index.less +29 -29
- package/lib/swipe-item/index.less +8 -8
- package/lib/switch/index.less +56 -56
- package/lib/switch/shared.js +2 -2
- package/lib/switch-cell/index.less +15 -15
- package/lib/tab/index.less +17 -17
- package/lib/tabs/index.less +153 -153
- package/lib/tag/index.less +99 -99
- package/lib/telemetry/index.js +82 -0
- package/lib/toast/index.js +1 -1
- package/lib/toast/index.less +75 -75
- package/lib/toast/style/index.js +1 -1
- package/lib/toast/style/less.js +1 -1
- package/lib/uploader/index.less +163 -163
- package/lib/uploader/style/index.js +1 -1
- package/lib/uploader/style/less.js +1 -1
- package/lib/utils/create/bem.js +7 -7
- package/lib/utils/create/component.js +41 -7
- package/lib/utils/dom/raf.js +2 -2
- package/lib/utils/dom/reset-scroll.js +3 -3
- package/lib/utils/index.js +29 -29
- package/lib/utils/media/image-util.js +153 -0
- package/lib/utils/router.js +2 -2
- package/lib/zart.js +27476 -55536
- package/lib/zart.min.js +5 -5
- package/package.json +74 -74
- package/lib/a037f57fc4d92a8a1f1e.worker.js +0 -60600
- package/lib/b7cf90b4775181215df7.worker.js +0 -10
package/es/radio/index.less
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
@import '../style/var';
|
|
2
|
-
|
|
3
|
-
.zt-radio {
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
user-select: none;
|
|
9
|
-
|
|
10
|
-
&--disabled {
|
|
11
|
-
cursor: not-allowed;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&--label-disabled {
|
|
15
|
-
cursor: default;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&--horizontal {
|
|
19
|
-
margin-right: @padding-sm;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&__icon {
|
|
23
|
-
flex: none;
|
|
24
|
-
height: 1em;
|
|
25
|
-
font-size: @radio-size;
|
|
26
|
-
line-height: 1em;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
|
|
29
|
-
.zt-icon {
|
|
30
|
-
display: block;
|
|
31
|
-
box-sizing: border-box;
|
|
32
|
-
width: 1.25em;
|
|
33
|
-
height: 1.25em;
|
|
34
|
-
color: transparent;
|
|
35
|
-
font-size: 0.8em;
|
|
36
|
-
line-height: 1.25;
|
|
37
|
-
text-align: center;
|
|
38
|
-
border: 1px solid @radio-border-color;
|
|
39
|
-
transition-duration: @radio-transition-duration;
|
|
40
|
-
transition-property: color, border-color, background-color;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&--round {
|
|
44
|
-
.zt-icon {
|
|
45
|
-
border-radius: 100%;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&--checked {
|
|
50
|
-
.zt-icon {
|
|
51
|
-
color: @white;
|
|
52
|
-
background-color: @radio-checked-icon-color;
|
|
53
|
-
border-color: @radio-checked-icon-color;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&--disabled {
|
|
58
|
-
cursor: not-allowed;
|
|
59
|
-
|
|
60
|
-
.zt-icon {
|
|
61
|
-
background-color: @radio-disabled-background-color;
|
|
62
|
-
border-color: @radio-disabled-icon-color;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&--disabled&--checked {
|
|
67
|
-
.zt-icon {
|
|
68
|
-
color: @radio-disabled-icon-color;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&__label {
|
|
74
|
-
margin-left: @radio-label-margin;
|
|
75
|
-
color: @radio-label-color;
|
|
76
|
-
line-height: @radio-size;
|
|
77
|
-
|
|
78
|
-
&--left {
|
|
79
|
-
margin: 0 @radio-label-margin 0 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&--disabled {
|
|
83
|
-
color: @radio-disabled-label-color;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
|
|
3
|
+
.zt-radio {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
user-select: none;
|
|
9
|
+
|
|
10
|
+
&--disabled {
|
|
11
|
+
cursor: not-allowed;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&--label-disabled {
|
|
15
|
+
cursor: default;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--horizontal {
|
|
19
|
+
margin-right: @padding-sm;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__icon {
|
|
23
|
+
flex: none;
|
|
24
|
+
height: 1em;
|
|
25
|
+
font-size: @radio-size;
|
|
26
|
+
line-height: 1em;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
|
|
29
|
+
.zt-icon {
|
|
30
|
+
display: block;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
width: 1.25em;
|
|
33
|
+
height: 1.25em;
|
|
34
|
+
color: transparent;
|
|
35
|
+
font-size: 0.8em;
|
|
36
|
+
line-height: 1.25;
|
|
37
|
+
text-align: center;
|
|
38
|
+
border: 1px solid @radio-border-color;
|
|
39
|
+
transition-duration: @radio-transition-duration;
|
|
40
|
+
transition-property: color, border-color, background-color;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&--round {
|
|
44
|
+
.zt-icon {
|
|
45
|
+
border-radius: 100%;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--checked {
|
|
50
|
+
.zt-icon {
|
|
51
|
+
color: @white;
|
|
52
|
+
background-color: @radio-checked-icon-color;
|
|
53
|
+
border-color: @radio-checked-icon-color;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--disabled {
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
|
|
60
|
+
.zt-icon {
|
|
61
|
+
background-color: @radio-disabled-background-color;
|
|
62
|
+
border-color: @radio-disabled-icon-color;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&--disabled&--checked {
|
|
67
|
+
.zt-icon {
|
|
68
|
+
color: @radio-disabled-icon-color;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__label {
|
|
74
|
+
margin-left: @radio-label-margin;
|
|
75
|
+
color: @radio-label-color;
|
|
76
|
+
line-height: @radio-size;
|
|
77
|
+
|
|
78
|
+
&--left {
|
|
79
|
+
margin: 0 @radio-label-margin 0 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&--disabled {
|
|
83
|
+
color: @radio-disabled-label-color;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@import '../style/var';
|
|
2
|
-
|
|
3
|
-
.zt-radio-group {
|
|
4
|
-
&--horizontal {
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-wrap: wrap;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
|
|
3
|
+
.zt-radio-group {
|
|
4
|
+
&--horizontal {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
}
|
|
8
|
+
}
|
package/es/rate/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-rate{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;cursor:pointer;-webkit-user-select:none;user-select:none}.zt-rate__item{position:relative}.zt-rate__item:not(:last-child){padding-right:4px}.zt-rate__icon{display:block;width:1em;color:#
|
|
1
|
+
.zt-rate{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;cursor:pointer;-webkit-user-select:none;user-select:none}.zt-rate__item{position:relative}.zt-rate__item:not(:last-child){padding-right:4px}.zt-rate__icon{display:block;width:1em;color:#ccc;font-size:20px}.zt-rate__icon--half{position:absolute;top:0;left:0;width:.5em;overflow:hidden}.zt-rate__icon--full{color:#ffcd23}.zt-rate__icon--disabled{color:#c8c9cc}.zt-rate--disabled{cursor:not-allowed}.zt-rate--readonly{cursor:default}
|
package/es/rate/index.js
CHANGED
package/es/rate/index.less
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
@import '../style/var';
|
|
2
|
-
|
|
3
|
-
.zt-rate {
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
cursor: pointer;
|
|
7
|
-
user-select: none;
|
|
8
|
-
|
|
9
|
-
&__item {
|
|
10
|
-
position: relative;
|
|
11
|
-
|
|
12
|
-
&:not(:last-child) {
|
|
13
|
-
padding-right: @rate-icon-gutter;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&__icon {
|
|
18
|
-
display: block;
|
|
19
|
-
width: 1em;
|
|
20
|
-
color: @rate-icon-void-color;
|
|
21
|
-
font-size: @rate-icon-size;
|
|
22
|
-
|
|
23
|
-
&--half {
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: 0;
|
|
26
|
-
left: 0;
|
|
27
|
-
width: 0.5em;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&--full {
|
|
32
|
-
color: @rate-icon-full-color;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&--disabled {
|
|
36
|
-
color: @rate-icon-disabled-color;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&--disabled {
|
|
41
|
-
cursor: not-allowed;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&--readonly {
|
|
45
|
-
cursor: default;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
|
|
3
|
+
.zt-rate {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
user-select: none;
|
|
8
|
+
|
|
9
|
+
&__item {
|
|
10
|
+
position: relative;
|
|
11
|
+
|
|
12
|
+
&:not(:last-child) {
|
|
13
|
+
padding-right: @rate-icon-gutter;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__icon {
|
|
18
|
+
display: block;
|
|
19
|
+
width: 1em;
|
|
20
|
+
color: @rate-icon-void-color;
|
|
21
|
+
font-size: @rate-icon-size;
|
|
22
|
+
|
|
23
|
+
&--half {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
width: 0.5em;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--full {
|
|
32
|
+
color: @rate-icon-full-color;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&--disabled {
|
|
36
|
+
color: @rate-icon-disabled-color;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--disabled {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&--readonly {
|
|
45
|
+
cursor: default;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/es/row/index.less
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
@import '../style/var';
|
|
2
|
-
|
|
3
|
-
.zt-row {
|
|
4
|
-
&::after {
|
|
5
|
-
display: table;
|
|
6
|
-
clear: both;
|
|
7
|
-
content: '';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&--flex {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-wrap: wrap;
|
|
13
|
-
|
|
14
|
-
&::after {
|
|
15
|
-
display: none;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&--justify-center {
|
|
20
|
-
justify-content: center;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&--justify-end {
|
|
24
|
-
justify-content: flex-end;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&--justify-space-between {
|
|
28
|
-
justify-content: space-between;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&--justify-space-around {
|
|
32
|
-
justify-content: space-around;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&--align-center {
|
|
36
|
-
align-items: center;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&--align-bottom {
|
|
40
|
-
align-items: flex-end;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
|
|
3
|
+
.zt-row {
|
|
4
|
+
&::after {
|
|
5
|
+
display: table;
|
|
6
|
+
clear: both;
|
|
7
|
+
content: '';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&--flex {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
|
|
14
|
+
&::after {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&--justify-center {
|
|
20
|
+
justify-content: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&--justify-end {
|
|
24
|
+
justify-content: flex-end;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&--justify-space-between {
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--justify-space-around {
|
|
32
|
+
justify-content: space-around;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&--align-center {
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&--align-bottom {
|
|
40
|
+
align-items: flex-end;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.zt-signature{background-color:#f5f5f5;width:100%;height:100%;position:relative}.zt-signature__placeholder{z-index:2;pointer-events:none;position:absolute;left:0;top:calc(50% - 8px);font-size:16px;height:16px;width:100%;opacity:.1;color:#000;text-align:center}.zt-signature__canvasWrapper{z-index:1;position:absolute;top:0;left:0;width:100%;height:100%;background:#fff}.zt-signature__canvas{background:#f5f5f5}.zt-signature__actions{z-index:2;position:absolute;right:0;bottom:16px;width:320px;float:right}.zt-signature__actions button{float:left;width:96px;margin-right:8px}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// Utils
|
|
2
|
+
import { createNamespace } from '../utils';
|
|
3
|
+
import Button from '../button';
|
|
4
|
+
import Toast from '../toast';
|
|
5
|
+
import { canvas2File } from "../utils/media/image-util";
|
|
6
|
+
|
|
7
|
+
var _createNamespace = createNamespace('signature'),
|
|
8
|
+
createComponent = _createNamespace[0],
|
|
9
|
+
bem = _createNamespace[1],
|
|
10
|
+
t = _createNamespace[2];
|
|
11
|
+
|
|
12
|
+
export default createComponent({
|
|
13
|
+
props: {
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
18
|
+
lineWidth: {
|
|
19
|
+
type: Number | String,
|
|
20
|
+
default: 2
|
|
21
|
+
},
|
|
22
|
+
strokeStyle: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: '#000'
|
|
25
|
+
},
|
|
26
|
+
imageType: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: 'png'
|
|
29
|
+
},
|
|
30
|
+
resultTypes: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'file,dataUrl'
|
|
33
|
+
},
|
|
34
|
+
unSupportTpl: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: t('browserUnsupported')
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
data: function data() {
|
|
40
|
+
return {
|
|
41
|
+
canvasHeight: 0,
|
|
42
|
+
canvasWidth: 0,
|
|
43
|
+
ctx: null,
|
|
44
|
+
isSupportTouch: 'ontouchstart' in window,
|
|
45
|
+
events: 'ontouchstart' in window ? ['touchstart', 'touchmove', 'touchend', 'touchleave'] : ['mousedown', 'mousemove', 'mouseup', 'mouseleave'],
|
|
46
|
+
isHintHidden: false,
|
|
47
|
+
isCompleteButtonDisabled: true // default disabled
|
|
48
|
+
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
methods: {
|
|
52
|
+
addEvent: function addEvent() {
|
|
53
|
+
var _this = this;
|
|
54
|
+
|
|
55
|
+
// console.log(this.resultTypes)
|
|
56
|
+
this.startEventHandler = this.startEventHandler.bind(this);
|
|
57
|
+
this.$refs.canvas.addEventListener(this.events[0], this.startEventHandler, false);
|
|
58
|
+
|
|
59
|
+
if (this.isCanvasSupported) {
|
|
60
|
+
window.addEventListener("orientationchange", function () {
|
|
61
|
+
setTimeout(function () {
|
|
62
|
+
_this.canvasWidth = _this.$refs.canvasWrapper.offsetWidth;
|
|
63
|
+
_this.canvasHeight = _this.$refs.canvasWrapper.offsetHeight;
|
|
64
|
+
|
|
65
|
+
if (!_this.isCompleteButtonDisabled) {
|
|
66
|
+
Toast(t('orientationChangeTip'));
|
|
67
|
+
|
|
68
|
+
_this.clear(true);
|
|
69
|
+
}
|
|
70
|
+
}, 100);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
startEventHandler: function startEventHandler(event) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
this.ctx.beginPath();
|
|
77
|
+
this.ctx.lineWidth = this.lineWidth;
|
|
78
|
+
this.ctx.strokeStyle = this.strokeStyle;
|
|
79
|
+
this.moveEventHandler = this.moveEventHandler.bind(this), this.leaveEventHandler = this.leaveEventHandler.bind(this), this.endEventHandler = this.endEventHandler.bind(this);
|
|
80
|
+
this.$refs.canvas.addEventListener(this.events[1], this.moveEventHandler, false);
|
|
81
|
+
this.$refs.canvas.addEventListener(this.events[2], this.endEventHandler, false);
|
|
82
|
+
this.$refs.canvas.addEventListener(this.events[3], this.leaveEventHandler, false);
|
|
83
|
+
},
|
|
84
|
+
moveEventHandler: function moveEventHandler(event) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
this.isHintHidden = true;
|
|
87
|
+
this.isCompleteButtonDisabled = false;
|
|
88
|
+
var evt = this.isSupportTouch ? event.touches[0] : event;
|
|
89
|
+
var coverPos = this.$refs.canvas.getBoundingClientRect();
|
|
90
|
+
var mouseX = evt.clientX - coverPos.left;
|
|
91
|
+
var mouseY = evt.clientY - coverPos.top;
|
|
92
|
+
this.ctx.lineTo(mouseX, mouseY);
|
|
93
|
+
this.ctx.stroke();
|
|
94
|
+
},
|
|
95
|
+
endEventHandler: function endEventHandler(event) {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
this.$refs.canvas.removeEventListener(this.events[1], this.moveEventHandler, false);
|
|
98
|
+
this.$refs.canvas.removeEventListener(this.events[2], this.endEventHandler, false);
|
|
99
|
+
},
|
|
100
|
+
leaveEventHandler: function leaveEventHandler(event) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
this.$refs.canvas.removeEventListener(this.events[1], this.moveEventHandler, false);
|
|
103
|
+
this.$refs.canvas.removeEventListener(this.events[2], this.endEventHandler, false);
|
|
104
|
+
},
|
|
105
|
+
clear: function clear(isUnEmit) {
|
|
106
|
+
this.$refs.canvas.addEventListener(this.events[2], this.endEventHandler, false);
|
|
107
|
+
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
|
|
108
|
+
this.ctx.closePath();
|
|
109
|
+
this.isHintHidden = false;
|
|
110
|
+
this.isCompleteButtonDisabled = true;
|
|
111
|
+
|
|
112
|
+
if (!isUnEmit) {
|
|
113
|
+
this.$emit('clear');
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
confirm: function confirm() {
|
|
117
|
+
this.onSave(this.$refs.canvas);
|
|
118
|
+
},
|
|
119
|
+
cancel: function cancel() {
|
|
120
|
+
this.clear(true);
|
|
121
|
+
this.$emit('cancel');
|
|
122
|
+
},
|
|
123
|
+
onSave: function onSave(canvas) {
|
|
124
|
+
var _this2 = this;
|
|
125
|
+
|
|
126
|
+
var resultTypes = this.resultTypes ? this.resultTypes.split(',') : ['file', 'dataUrl']; // build result
|
|
127
|
+
|
|
128
|
+
Promise.all(resultTypes.map(function (resultType) {
|
|
129
|
+
if (resultType.trim() === 'dataUrl') {
|
|
130
|
+
var dataURL;
|
|
131
|
+
|
|
132
|
+
switch (_this2.imageType) {
|
|
133
|
+
case 'png':
|
|
134
|
+
dataURL = canvas.toDataURL('image/png');
|
|
135
|
+
break;
|
|
136
|
+
|
|
137
|
+
case 'jpg':
|
|
138
|
+
dataURL = canvas.toDataURL('image/jpeg', 0.8);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return Promise.resolve(dataURL);
|
|
143
|
+
} else if (resultType.trim() === 'file') {
|
|
144
|
+
var exportFilename = new Date().getTime() + '.jpg';
|
|
145
|
+
return canvas2File(canvas, exportFilename);
|
|
146
|
+
} else {
|
|
147
|
+
return Promise.resolve(null);
|
|
148
|
+
}
|
|
149
|
+
})).then(function (results) {
|
|
150
|
+
_this2.clear(true);
|
|
151
|
+
|
|
152
|
+
_this2.$emit('confirm', canvas, results);
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
onMounted: function onMounted() {
|
|
156
|
+
if (this.isCanvasSupported) {
|
|
157
|
+
this.ctx = this.$refs.canvas.getContext('2d');
|
|
158
|
+
this.canvasWidth = this.$refs.canvasWrapper.offsetWidth;
|
|
159
|
+
this.canvasHeight = this.$refs.canvasWrapper.offsetHeight;
|
|
160
|
+
this.addEvent();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
computed: {
|
|
165
|
+
isCanvasSupported: function isCanvasSupported() {
|
|
166
|
+
var elem = document.createElement('canvas');
|
|
167
|
+
return !!(elem.getContext && elem.getContext('2d'));
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
render: function render() {
|
|
171
|
+
var h = arguments[0];
|
|
172
|
+
return h("transition", {
|
|
173
|
+
"attrs": {
|
|
174
|
+
"appear": true
|
|
175
|
+
},
|
|
176
|
+
"on": {
|
|
177
|
+
"afterEnter": this.onMounted
|
|
178
|
+
}
|
|
179
|
+
}, [h("div", {
|
|
180
|
+
"class": [bem(''), this.customClass ? this.customClass : '']
|
|
181
|
+
}, [h("label", {
|
|
182
|
+
"class": bem('placeholder'),
|
|
183
|
+
"directives": [{
|
|
184
|
+
name: "show",
|
|
185
|
+
value: !this.isHintHidden
|
|
186
|
+
}]
|
|
187
|
+
}, [this.isCanvasSupported ? t('hint') : this.unSupportTpl]), h("div", {
|
|
188
|
+
"class": bem('canvasWrapper'),
|
|
189
|
+
"ref": "canvasWrapper"
|
|
190
|
+
}, [h("canvas", {
|
|
191
|
+
"class": bem('canvas'),
|
|
192
|
+
"directives": [{
|
|
193
|
+
name: "show",
|
|
194
|
+
value: this.isCanvasSupported
|
|
195
|
+
}],
|
|
196
|
+
"ref": "canvas",
|
|
197
|
+
"attrs": {
|
|
198
|
+
"width": this.canvasWidth,
|
|
199
|
+
"height": this.canvasHeight
|
|
200
|
+
}
|
|
201
|
+
})]), h("div", {
|
|
202
|
+
"class": bem('actions')
|
|
203
|
+
}, [h(Button, {
|
|
204
|
+
"attrs": {
|
|
205
|
+
"plain": true,
|
|
206
|
+
"type": "warning"
|
|
207
|
+
},
|
|
208
|
+
"on": {
|
|
209
|
+
"click": this.clear
|
|
210
|
+
}
|
|
211
|
+
}, [t('reSign')]), h(Button, {
|
|
212
|
+
"attrs": {
|
|
213
|
+
"plain": true,
|
|
214
|
+
"type": "default"
|
|
215
|
+
},
|
|
216
|
+
"on": {
|
|
217
|
+
"click": this.cancel
|
|
218
|
+
}
|
|
219
|
+
}, [t('cancel')]), h(Button, {
|
|
220
|
+
"attrs": {
|
|
221
|
+
"block": true,
|
|
222
|
+
"type": "primary",
|
|
223
|
+
"disabled": this.isCompleteButtonDisabled
|
|
224
|
+
},
|
|
225
|
+
"on": {
|
|
226
|
+
"click": this.confirm
|
|
227
|
+
}
|
|
228
|
+
}, [t('complete')])])])]);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
|
|
3
|
+
.zt-signature {
|
|
4
|
+
background-color: #f5f5f5;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
&__placeholder {
|
|
10
|
+
z-index: @signature-hint-z-index;
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
position: absolute;
|
|
13
|
+
left: 0;
|
|
14
|
+
top: calc(50% - 8px);
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
height: 16px;
|
|
17
|
+
width: 100%;
|
|
18
|
+
opacity: 0.1;
|
|
19
|
+
color: #000;
|
|
20
|
+
text-align: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__canvasWrapper {
|
|
24
|
+
z-index: @signature-canvas-z-index;
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
background: white
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__canvas {
|
|
34
|
+
background: #f5f5f5;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__actions {
|
|
38
|
+
z-index: @signature-actions-z-index;
|
|
39
|
+
position: absolute;
|
|
40
|
+
right: 0px;
|
|
41
|
+
bottom: 16px;
|
|
42
|
+
width: 320px;
|
|
43
|
+
float: right;
|
|
44
|
+
button {
|
|
45
|
+
float: left;
|
|
46
|
+
width: 96px;
|
|
47
|
+
margin-right: 8px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '../../style/base.css';
|
|
2
|
+
import '../../loading/index.css';
|
|
3
|
+
import '../../overlay/index.css';
|
|
4
|
+
import '../../info/index.css';
|
|
5
|
+
import '../../icon/index.css';
|
|
6
|
+
import '../../button/index.css';
|
|
7
|
+
import '../../popup/index.css';
|
|
8
|
+
import '../../toast/index.css';
|
|
9
|
+
import '../index.css';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '../../style/base.less';
|
|
2
|
+
import '../../loading/index.less';
|
|
3
|
+
import '../../overlay/index.less';
|
|
4
|
+
import '../../info/index.less';
|
|
5
|
+
import '../../icon/index.less';
|
|
6
|
+
import '../../button/index.less';
|
|
7
|
+
import '../../popup/index.less';
|
|
8
|
+
import '../../toast/index.less';
|
|
9
|
+
import '../index.less';
|