@robot-admin/naive-ui-components 0.13.2 → 0.13.6
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/CHANGELOG.md +27 -0
- package/README.md +25 -5
- package/README_EN.md +17 -5
- package/dist/C_ActionBar.css +75 -63
- package/dist/C_ActionBar2.cjs +1 -1
- package/dist/C_ActionBar2.js +1 -1
- package/dist/C_AntV.css +249 -79
- package/dist/C_AntV2.cjs +3 -3
- package/dist/C_AntV2.js +2 -2
- package/dist/C_AudioPlayer.css +88 -76
- package/dist/C_AudioPlayer2.cjs +1 -1
- package/dist/C_AudioPlayer2.js +1 -1
- package/dist/C_AvatarGroup.css +32 -28
- package/dist/C_AvatarGroup2.cjs +1 -1
- package/dist/C_AvatarGroup2.js +1 -1
- package/dist/C_Breadcrumb.css +35 -17
- package/dist/C_Breadcrumb2.cjs +1 -1
- package/dist/C_Breadcrumb2.js +1 -1
- package/dist/C_Captcha.css +66 -53
- package/dist/C_Captcha2.cjs +1 -1
- package/dist/C_Captcha2.js +1 -1
- package/dist/C_Cascade.css +6 -2
- package/dist/C_Cascade2.cjs +1 -1
- package/dist/C_Cascade2.js +1 -1
- package/dist/C_Chat.css +40 -33
- package/dist/C_City.css +37 -32
- package/dist/C_City2.cjs +1 -1
- package/dist/C_City2.js +1 -1
- package/dist/C_Code.css +53 -40
- package/dist/C_Code2.cjs +1 -1
- package/dist/C_Code2.js +1 -1
- package/dist/C_CollapsePanel.css +68 -55
- package/dist/C_CollapsePanel2.cjs +1 -1
- package/dist/C_CollapsePanel2.js +1 -1
- package/dist/C_ContextMenu.css +68 -26
- package/dist/C_ContextMenu2.cjs +1 -1
- package/dist/C_ContextMenu2.js +1 -1
- package/dist/C_Cron.css +95 -68
- package/dist/C_Cron2.cjs +1 -1
- package/dist/C_Cron2.js +1 -1
- package/dist/C_Date.css +8 -1
- package/dist/C_Date2.cjs +1 -1
- package/dist/C_Date2.js +1 -1
- package/dist/C_Draggable.css +60 -51
- package/dist/C_Draggable2.cjs +1 -1
- package/dist/C_Draggable2.js +1 -1
- package/dist/C_Editor.css +23 -15
- package/dist/C_Editor2.cjs +1 -1
- package/dist/C_Editor2.js +1 -1
- package/dist/C_FilePreview.css +200 -90
- package/dist/C_FilePreview2.cjs +1 -1
- package/dist/C_FilePreview2.js +1 -1
- package/dist/C_Form.base.css +284 -224
- package/dist/C_Form.css +307 -239
- package/dist/C_Form2.cjs +1 -1
- package/dist/C_Form2.js +1 -1
- package/dist/C_FormModal.css +18 -8
- package/dist/C_FormModal2.cjs +1 -1
- package/dist/C_FormModal2.js +1 -1
- package/dist/C_FormSearch.css +58 -45
- package/dist/C_FormSearch2.cjs +1 -1
- package/dist/C_FormSearch2.js +1 -1
- package/dist/C_FormulaEditor.css +62 -37
- package/dist/C_FormulaEditor2.cjs +1 -1
- package/dist/C_FormulaEditor2.js +1 -1
- package/dist/C_FullCalendar.css +16 -3
- package/dist/C_FullCalendar2.cjs +1 -1
- package/dist/C_FullCalendar2.js +1 -1
- package/dist/C_GlobalSearch.css +121 -112
- package/dist/C_GlobalSearch2.cjs +1 -1
- package/dist/C_GlobalSearch2.js +1 -1
- package/dist/C_Guide.css +30 -18
- package/dist/C_Guide2.cjs +1 -1
- package/dist/C_Guide2.js +1 -1
- package/dist/C_Icon.css +24 -17
- package/dist/C_Icon2.cjs +1 -1
- package/dist/C_Icon2.js +1 -1
- package/dist/C_ImageCropper.css +39 -22
- package/dist/C_ImageCropper2.cjs +1 -1
- package/dist/C_ImageCropper2.js +1 -1
- package/dist/C_Language.css +30 -17
- package/dist/C_Language2.cjs +1 -1
- package/dist/C_Language2.js +1 -1
- package/dist/C_Loading.cjs +1 -0
- package/dist/C_Loading.css +119 -0
- package/dist/C_Loading.d.cts +2 -0
- package/dist/C_Loading.d.ts +2 -0
- package/dist/C_Loading.js +1 -0
- package/dist/C_Loading2.cjs +1 -0
- package/dist/C_Loading2.js +1 -0
- package/dist/C_Login.css +162 -137
- package/dist/C_Login.d.cts +1 -1
- package/dist/C_Login.d.ts +1 -1
- package/dist/C_Login2.cjs +1 -1
- package/dist/C_Login2.js +1 -1
- package/dist/C_Map.css +25 -4
- package/dist/C_Map2.cjs +1 -1
- package/dist/C_Map2.js +1 -1
- package/dist/C_Markdown.css +47 -42
- package/dist/C_Markdown.d.cts +1 -1
- package/dist/C_Markdown.d.ts +1 -1
- package/dist/C_Markdown2.cjs +1 -1
- package/dist/C_Markdown2.js +1 -1
- package/dist/C_Menu.css +7 -1
- package/dist/C_Menu.d.ts +1 -1
- package/dist/C_Menu2.cjs +1 -1
- package/dist/C_Menu2.js +1 -1
- package/dist/C_NotificationCenter.css +134 -90
- package/dist/C_NotificationCenter2.cjs +1 -1
- package/dist/C_NotificationCenter2.js +1 -1
- package/dist/C_OrgChart.css +10 -0
- package/dist/C_OrgChart.d.cts +1 -1
- package/dist/C_OrgChart.d.ts +1 -1
- package/dist/C_OrgChart2.cjs +1 -1
- package/dist/C_OrgChart2.js +1 -1
- package/dist/C_Progress.d.cts +1 -1
- package/dist/C_Progress.d.ts +1 -1
- package/dist/C_QRCode.css +12 -8
- package/dist/C_QRCode2.cjs +1 -1
- package/dist/C_QRCode2.js +1 -1
- package/dist/C_Signature.css +18 -14
- package/dist/C_Signature2.cjs +1 -1
- package/dist/C_Signature2.js +1 -1
- package/dist/C_Skeleton.css +5 -0
- package/dist/C_Skeleton.d.cts +1 -1
- package/dist/C_Skeleton.d.ts +1 -1
- package/dist/C_Skeleton2.cjs +1 -1
- package/dist/C_Skeleton2.js +1 -1
- package/dist/C_SplitPane.css +61 -39
- package/dist/C_SplitPane2.cjs +1 -1
- package/dist/C_SplitPane2.js +1 -1
- package/dist/C_Steps.css +42 -38
- package/dist/C_Steps.d.cts +1 -1
- package/dist/C_Steps.d.ts +1 -1
- package/dist/C_Steps2.cjs +1 -1
- package/dist/C_Steps2.js +1 -1
- package/dist/C_Table.base.css +585 -352
- package/dist/C_Table.cjs +1 -1
- package/dist/C_Table.css +608 -367
- package/dist/C_Table.d.ts +2 -2
- package/dist/C_Table.js +1 -1
- package/dist/C_TagsView.css +93 -55
- package/dist/C_TagsView.d.cts +1 -1
- package/dist/C_TagsView.d.ts +1 -1
- package/dist/C_TagsView2.cjs +1 -1
- package/dist/C_TagsView2.js +1 -1
- package/dist/C_Theme.css +24 -17
- package/dist/C_Theme.d.cts +1 -1
- package/dist/C_Theme.d.ts +1 -1
- package/dist/C_Timeline.css +47 -36
- package/dist/C_Timeline.d.cts +1 -1
- package/dist/C_Timeline.d.ts +1 -1
- package/dist/C_Transfer.css +86 -67
- package/dist/C_Transfer.d.cts +1 -1
- package/dist/C_Transfer.d.ts +1 -1
- package/dist/C_Transfer2.cjs +1 -1
- package/dist/C_Transfer2.js +1 -1
- package/dist/C_Tree.css +48 -33
- package/dist/C_Tree2.cjs +1 -1
- package/dist/C_Tree2.js +1 -1
- package/dist/C_Upload.css +104 -51
- package/dist/C_Upload2.cjs +1 -1
- package/dist/C_Upload2.js +1 -1
- package/dist/C_VideoPlayer.css +140 -69
- package/dist/C_VideoPlayer2.cjs +1 -1
- package/dist/C_VideoPlayer2.js +1 -1
- package/dist/C_VtableGantt.css +42 -19
- package/dist/C_VtableGantt.d.cts +1 -1
- package/dist/C_VtableGantt.d.ts +1 -1
- package/dist/C_VtableGantt2.cjs +1 -1
- package/dist/C_VtableGantt2.js +1 -1
- package/dist/C_WaterFall.css +32 -16
- package/dist/C_WaterFall2.cjs +1 -1
- package/dist/C_WaterFall2.js +1 -1
- package/dist/C_WorkFlow.css +332 -221
- package/dist/C_WorkFlow2.cjs +1 -1
- package/dist/C_WorkFlow2.js +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.js +1 -1
- package/dist/constants.d.cts +4 -4
- package/dist/constants.d.ts +4 -4
- package/dist/constants2.d.cts +4 -4
- package/dist/constants2.d.ts +4 -4
- package/dist/constants3.d.cts +3 -3
- package/dist/constants3.d.ts +3 -3
- package/dist/constants4.d.cts +6 -6
- package/dist/constants4.d.ts +6 -6
- package/dist/constants5.d.cts +2 -2
- package/dist/constants5.d.ts +2 -2
- package/dist/data.d.cts +8 -8
- package/dist/data.d.ts +8 -8
- package/dist/data2.cjs +1 -1
- package/dist/data2.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +28 -27
- package/dist/index.d.ts +28 -27
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +1 -1
- package/dist/index.vue.d.ts +1 -1
- package/dist/index10.vue.d.cts +5 -5
- package/dist/index10.vue.d.ts +3 -3
- package/dist/index11.vue.d.cts +3 -3
- package/dist/index11.vue.d.ts +2 -2
- package/dist/index12.vue.d.cts +2 -2
- package/dist/index13.vue.d.ts +1 -1
- package/dist/index14.vue.d.cts +1 -1
- package/dist/index14.vue.d.ts +11 -9
- package/dist/index15.vue.d.cts +11 -9
- package/dist/index15.vue.d.ts +3 -3
- package/dist/index16.vue.d.cts +3 -3
- package/dist/index16.vue.d.ts +13 -129
- package/dist/index17.vue.d.cts +13 -129
- package/dist/index17.vue.d.ts +129 -76
- package/dist/index18.vue.d.cts +129 -76
- package/dist/index18.vue.d.ts +75 -71
- package/dist/index19.vue.d.cts +75 -93
- package/dist/index19.vue.d.ts +68 -90
- package/dist/index2.vue.d.cts +2 -2
- package/dist/index2.vue.d.ts +2 -2
- package/dist/index20.vue.d.cts +87 -40
- package/dist/index20.vue.d.ts +87 -40
- package/dist/index21.vue.d.cts +40 -89
- package/dist/index21.vue.d.ts +40 -89
- package/dist/index22.vue.d.cts +95 -37
- package/dist/index22.vue.d.ts +95 -37
- package/dist/index23.vue.d.cts +34 -8
- package/dist/index23.vue.d.ts +34 -8
- package/dist/index24.vue.d.cts +12 -654
- package/dist/index24.vue.d.ts +12 -654
- package/dist/index25.vue.d.cts +650 -85
- package/dist/index25.vue.d.ts +650 -85
- package/dist/index26.vue.d.cts +85 -100
- package/dist/index26.vue.d.ts +85 -100
- package/dist/index27.vue.d.cts +92 -61
- package/dist/index27.vue.d.ts +92 -61
- package/dist/index28.vue.d.cts +80 -0
- package/dist/index28.vue.d.ts +80 -0
- package/dist/index3.vue.d.cts +5 -5
- package/dist/index3.vue.d.ts +5 -5
- package/dist/index5.vue.d.ts +2 -2
- package/dist/index6.vue.d.cts +2 -2
- package/dist/index6.vue.d.ts +1 -1
- package/dist/index7.vue.d.cts +1 -1
- package/dist/index7.vue.d.ts +2 -2
- package/dist/index8.vue.d.cts +2 -2
- package/dist/index8.vue.d.ts +3 -3
- package/dist/index9.vue.d.cts +3 -3
- package/dist/index9.vue.d.ts +5 -5
- package/dist/mapUtils.d.cts +2 -2
- package/dist/mapUtils.d.ts +2 -2
- package/dist/presets.d.cts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/resolver.cjs +1 -1
- package/dist/resolver.d.cts +1 -1
- package/dist/resolver.d.ts +1 -1
- package/dist/resolver.js +1 -1
- package/dist/style.css +3205 -1982
- package/dist/useCollapsePanel.d.cts +2 -2
- package/dist/useCollapsePanel.d.ts +2 -2
- package/dist/useCropperCore.d.cts +8 -8
- package/dist/useCropperCore.d.ts +8 -8
- package/dist/useDraggableLayout.d.cts +5 -5
- package/dist/useDraggableLayout.d.ts +5 -5
- package/dist/useDynamicFormState.d.cts +2 -2
- package/dist/useDynamicFormState.d.ts +2 -2
- package/dist/useEdgeInteraction.d.cts +1 -1
- package/dist/useEdgeInteraction.d.ts +1 -1
- package/dist/useFullscreen.d.cts +2 -2
- package/dist/useFullscreen.d.ts +2 -2
- package/dist/useInfiniteScroll.d.cts +3 -3
- package/dist/useInfiniteScroll.d.ts +3 -3
- package/dist/useQRCode.d.cts +2 -2
- package/dist/useQRCode.d.ts +2 -2
- package/dist/useSearchState.d.cts +6 -6
- package/dist/useSearchState.d.ts +6 -6
- package/dist/useSignatureHistory.d.cts +6 -6
- package/dist/useSignatureHistory.d.ts +6 -6
- package/dist/useSplitResize.d.cts +4 -4
- package/dist/useSplitResize.d.ts +4 -4
- package/dist/useTableQuery.cjs +3 -3
- package/dist/useTableQuery.d.cts +3 -1
- package/dist/useTableQuery.d.ts +3 -1
- package/dist/useTableQuery.js +3 -3
- package/dist/useTimeSelection.d.cts +4 -4
- package/dist/useTimeSelection.d.ts +4 -4
- package/dist/useTreeOperations.d.cts +6 -6
- package/dist/useTreeOperations.d.ts +6 -6
- package/dist/useWorkflowValidation.d.cts +6 -6
- package/dist/useWorkflowValidation.d.ts +6 -6
- package/dist/verification.d.cts +2 -2
- package/dist/verification.d.ts +2 -2
- package/package.json +10 -3
package/dist/C_ImageCropper.css
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
/* unplugin-vue-components disabled */.cropper-toolbar[data-v-
|
|
1
|
+
/* unplugin-vue-components disabled */.cropper-toolbar[data-v-8dc2ca25] {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-wrap: wrap;
|
|
4
4
|
gap: 4px;
|
|
5
5
|
align-items: center;
|
|
6
6
|
padding: 8px 0;
|
|
7
7
|
}
|
|
8
|
-
/* unplugin-vue-components disabled
|
|
8
|
+
/* unplugin-vue-components disabled */
|
|
9
|
+
/* layer: default */
|
|
10
|
+
.flex[data-v-8dc2ca25]{display:flex;}
|
|
11
|
+
.flex-wrap[data-v-8dc2ca25]{flex-wrap:wrap;}
|
|
12
|
+
|
|
13
|
+
/* unplugin-vue-components disabled */.cropper-preview[data-v-ca124789] {
|
|
9
14
|
display: flex;
|
|
10
15
|
flex-direction: column;
|
|
11
16
|
gap: 16px;
|
|
12
17
|
}
|
|
13
|
-
.cropper-preview .preview-label[data-v-
|
|
18
|
+
.cropper-preview .preview-label[data-v-ca124789] {
|
|
14
19
|
display: flex;
|
|
15
20
|
gap: 6px;
|
|
16
21
|
align-items: center;
|
|
@@ -18,7 +23,7 @@
|
|
|
18
23
|
font-weight: 500;
|
|
19
24
|
color: var(--text-color-2);
|
|
20
25
|
}
|
|
21
|
-
.cropper-preview .preview-main[data-v-
|
|
26
|
+
.cropper-preview .preview-main[data-v-ca124789] {
|
|
22
27
|
width: 100%;
|
|
23
28
|
overflow: hidden;
|
|
24
29
|
border: 1px solid var(--border-color);
|
|
@@ -27,14 +32,14 @@
|
|
|
27
32
|
background-position: 0 0, 0 8px, 8px -8px, -8px 0;
|
|
28
33
|
background-size: 16px 16px;
|
|
29
34
|
}
|
|
30
|
-
.cropper-preview .preview-main--circular[data-v-
|
|
35
|
+
.cropper-preview .preview-main--circular[data-v-ca124789] {
|
|
31
36
|
border-radius: 50%;
|
|
32
37
|
}
|
|
33
|
-
.cropper-preview .preview-main__viewport img[data-v-
|
|
38
|
+
.cropper-preview .preview-main__viewport img[data-v-ca124789] {
|
|
34
39
|
display: block;
|
|
35
40
|
max-width: none !important;
|
|
36
41
|
}
|
|
37
|
-
.cropper-preview .preview-empty[data-v-
|
|
42
|
+
.cropper-preview .preview-empty[data-v-ca124789] {
|
|
38
43
|
display: flex;
|
|
39
44
|
align-items: center;
|
|
40
45
|
justify-content: center;
|
|
@@ -42,50 +47,58 @@
|
|
|
42
47
|
height: 100%;
|
|
43
48
|
min-height: 120px;
|
|
44
49
|
}
|
|
45
|
-
.cropper-preview .preview-thumbs[data-v-
|
|
50
|
+
.cropper-preview .preview-thumbs[data-v-ca124789] {
|
|
46
51
|
display: flex;
|
|
47
52
|
gap: 12px;
|
|
48
53
|
align-items: flex-end;
|
|
49
54
|
justify-content: center;
|
|
50
55
|
}
|
|
51
|
-
.cropper-preview .preview-thumb[data-v-
|
|
56
|
+
.cropper-preview .preview-thumb[data-v-ca124789] {
|
|
52
57
|
display: flex;
|
|
53
58
|
flex-direction: column;
|
|
54
59
|
gap: 4px;
|
|
55
60
|
align-items: center;
|
|
56
61
|
}
|
|
57
|
-
.cropper-preview .preview-thumb__box[data-v-
|
|
62
|
+
.cropper-preview .preview-thumb__box[data-v-ca124789] {
|
|
58
63
|
overflow: hidden;
|
|
59
64
|
border: 1px solid var(--border-color);
|
|
60
65
|
border-radius: 4px;
|
|
61
66
|
background: var(--body-color);
|
|
62
67
|
}
|
|
63
|
-
.cropper-preview .preview-thumb__box--circular[data-v-
|
|
68
|
+
.cropper-preview .preview-thumb__box--circular[data-v-ca124789] {
|
|
64
69
|
border-radius: 50%;
|
|
65
70
|
}
|
|
66
|
-
.cropper-preview .preview-thumb__viewport img[data-v-
|
|
71
|
+
.cropper-preview .preview-thumb__viewport img[data-v-ca124789] {
|
|
67
72
|
display: block;
|
|
68
73
|
max-width: none !important;
|
|
69
74
|
}
|
|
70
|
-
.cropper-preview .preview-thumb__label[data-v-
|
|
75
|
+
.cropper-preview .preview-thumb__label[data-v-ca124789] {
|
|
71
76
|
font-size: 11px;
|
|
72
77
|
color: var(--text-color-3);
|
|
73
78
|
}
|
|
79
|
+
/* unplugin-vue-components disabled */
|
|
80
|
+
/* layer: default */
|
|
81
|
+
.block[data-v-ca124789]{display:block;}
|
|
82
|
+
.hidden[data-v-ca124789]{display:none;}
|
|
83
|
+
.flex[data-v-ca124789]{display:flex;}
|
|
84
|
+
.border[data-v-ca124789]{border-width:1px;}
|
|
85
|
+
.px[data-v-ca124789]{padding-left:1rem;padding-right:1rem;}
|
|
86
|
+
|
|
74
87
|
/* unplugin-vue-components disabled *//* C_ImageCropper styles */
|
|
75
|
-
.c-image-cropper[data-v-
|
|
88
|
+
.c-image-cropper[data-v-b3645c9b] {
|
|
76
89
|
width: 100%;
|
|
77
90
|
}
|
|
78
|
-
.c-image-cropper__body[data-v-
|
|
91
|
+
.c-image-cropper__body[data-v-b3645c9b] {
|
|
79
92
|
display: flex;
|
|
80
93
|
flex-direction: column;
|
|
81
94
|
gap: 8px;
|
|
82
95
|
}
|
|
83
|
-
.c-image-cropper__workspace[data-v-
|
|
96
|
+
.c-image-cropper__workspace[data-v-b3645c9b] {
|
|
84
97
|
display: flex;
|
|
85
98
|
gap: 16px;
|
|
86
99
|
align-items: stretch;
|
|
87
100
|
}
|
|
88
|
-
.c-image-cropper__canvas[data-v-
|
|
101
|
+
.c-image-cropper__canvas[data-v-b3645c9b] {
|
|
89
102
|
position: relative;
|
|
90
103
|
flex: 1;
|
|
91
104
|
min-width: 0;
|
|
@@ -94,11 +107,11 @@
|
|
|
94
107
|
border-radius: 6px;
|
|
95
108
|
background: var(--body-color);
|
|
96
109
|
}
|
|
97
|
-
.c-image-cropper__canvas[data-v-
|
|
110
|
+
.c-image-cropper__canvas[data-v-b3645c9b] .vue-cropper {
|
|
98
111
|
width: 100% !important;
|
|
99
112
|
height: 100% !important;
|
|
100
113
|
}
|
|
101
|
-
.c-image-cropper__preview-panel[data-v-
|
|
114
|
+
.c-image-cropper__preview-panel[data-v-b3645c9b] {
|
|
102
115
|
flex: 0 1 280px;
|
|
103
116
|
min-width: 200px;
|
|
104
117
|
padding: 16px;
|
|
@@ -107,7 +120,7 @@
|
|
|
107
120
|
border-radius: 6px;
|
|
108
121
|
background: var(--card-color);
|
|
109
122
|
}
|
|
110
|
-
.c-image-cropper__placeholder[data-v-
|
|
123
|
+
.c-image-cropper__placeholder[data-v-b3645c9b] {
|
|
111
124
|
display: flex;
|
|
112
125
|
flex-direction: column;
|
|
113
126
|
gap: 8px;
|
|
@@ -118,10 +131,14 @@
|
|
|
118
131
|
font-size: 14px;
|
|
119
132
|
}
|
|
120
133
|
@media (width <= 768px) {
|
|
121
|
-
.c-image-cropper__workspace[data-v-
|
|
134
|
+
.c-image-cropper__workspace[data-v-b3645c9b] {
|
|
122
135
|
flex-direction: column;
|
|
123
136
|
}
|
|
124
|
-
.c-image-cropper__preview-panel[data-v-
|
|
137
|
+
.c-image-cropper__preview-panel[data-v-b3645c9b] {
|
|
125
138
|
max-width: none;
|
|
126
139
|
}
|
|
127
140
|
}
|
|
141
|
+
/* unplugin-vue-components disabled */
|
|
142
|
+
/* layer: default */
|
|
143
|
+
.px[data-v-b3645c9b]{padding-left:1rem;padding-right:1rem;}
|
|
144
|
+
|
package/dist/C_ImageCropper2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`),i=require(`vue-cropper`);function a(e={}){let t=(0,n.ref)(null);function r(){t.value?.rotateLeft()}function i(){t.value?.rotateRight()}function a(e){if(!Number.isFinite(e))return;let t=Math.round(e/90),n=t>0?i:r;for(let e=0;e<Math.abs(t);e++)n()}function o(e){!Number.isFinite(e)||e===0||t.value?.changeScale(e>0?1:-1)}function s(){t.value?.refresh()}function c(t,n){let r=e.maxWidth?.value??0,i=e.maxHeight?.value??0,a=Math.min(1,r>0?r/t:1,i>0?i/n:1);return{width:Math.max(1,Math.round(t*a)),height:Math.max(1,Math.round(n*a))}}function l(){return new Promise((n,r)=>{let i=t.value;if(!i){r(Error(`Cropper not initialized`));return}let a=e.format?.value??`png`,o=Math.min(1,Math.max(0,e.quality?.value??.92)),s=a===`jpeg`?`image/jpeg`:`image/${a}`,l=!1,u=setTimeout(()=>d(Error(`Crop result timed out`)),15e3);function d(e){l||(l=!0,clearTimeout(u),r(e instanceof Error?e:Error(String(e))))}function f(e){l||(l=!0,clearTimeout(u),n(e))}try{i.getCropChecked(e=>{if(!l)try{if(!e.width||!e.height)throw Error(`Crop result is empty`);let{width:t,height:n}=c(e.width,e.height),r=e;if(t!==e.width||n!==e.height){r=document.createElement(`canvas`),r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0,t,n)}let i=r.toDataURL(s,o);r.toBlob(e=>{if(!e){d(Error(`Crop result could not be encoded`));return}f({base64:i,blob:e,width:t,height:n,format:a})},s,o)}catch(e){d(e)}})}catch(e){d(e)}})}return{cropperRef:t,rotate:a,rotateLeft:r,rotateRight:i,zoom:o,reset:s,getCropResult:l}}const o={class:`cropper-toolbar`},s=(0,n.defineComponent)({__name:`CropperToolbar`,props:{currentRatio:{},ratioPresets:{},disabled:{type:Boolean}},emits:[`ratio`,`rotate`,`flipX`,`flipY`,`zoom`,`reset`],setup(t){return(i,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,o,[(0,n.createVNode)((0,n.unref)(r.NButtonGroup),{size:`small`},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(t.ratioPresets,e=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.NButton),{key:e.value,type:t.currentRatio===e.value?`primary`:`default`,disabled:t.disabled,onClick:t=>i.$emit(`ratio`,e.value)},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)(e.label),1)]),_:2},1032,[`type`,`disabled`,`onClick`]))),128))]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[0]||=e=>i.$emit(`rotate`,-90)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:rotate-left`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[7]||=(0,n.createTextVNode)(` 逆时针旋转 90° `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[1]||=e=>i.$emit(`rotate`,90)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:rotate-right`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[8]||=(0,n.createTextVNode)(` 顺时针旋转 90° `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[2]||=e=>i.$emit(`flipX`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:flip-horizontal`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[9]||=(0,n.createTextVNode)(` 水平翻转 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[3]||=e=>i.$emit(`flipY`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:flip-vertical`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[10]||=(0,n.createTextVNode)(` 垂直翻转 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[4]||=e=>i.$emit(`zoom`,.1)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:magnify-plus-outline`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[11]||=(0,n.createTextVNode)(` 放大 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[5]||=e=>i.$emit(`zoom`,-.1)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:magnify-minus-outline`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[12]||=(0,n.createTextVNode)(` 缩小 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[6]||=e=>i.$emit(`reset`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:refresh`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[13]||=(0,n.createTextVNode)(` 重置 `,-1)]),_:1})]))}});var c=t.t(s,[[`__scopeId`,`data-v-eb7204dc`]]);const l={class:`cropper-preview`},u={class:`preview-label`},d=[`src`],f={key:1,class:`preview-empty`},p={class:`preview-thumbs`},m=[`src`],h={class:`preview-thumb__label`},g=(0,n.defineComponent)({__name:`CropperPreview`,props:{previewData:{},circular:{type:Boolean}},setup(t){let r=t,i=(0,n.ref)(null),a=(0,n.ref)(200),o=[{label:`80px`,size:80},{label:`48px`,size:48},{label:`32px`,size:32}],s=(0,n.computed)(()=>{let e=r.previewData;return e&&e.url&&e.w>0&&e.h>0}),c=(0,n.computed)(()=>{if(!s.value)return{};let{w:e}=r.previewData;return{zoom:a.value/e,overflow:`hidden`}});function g(e){if(!s.value)return{};let{w:t}=r.previewData;return{zoom:e/t,overflow:`hidden`}}let _=null;return(0,n.onMounted)(()=>{i.value&&(a.value=i.value.clientWidth,_=new ResizeObserver(e=>{requestAnimationFrame(()=>{for(let t of e)a.value=t.contentRect.width})}),_.observe(i.value))}),(0,n.onBeforeUnmount)(()=>{_?.disconnect()}),(r,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,l,[(0,n.createElementVNode)(`div`,u,[(0,n.createVNode)(e.t,{name:`mdi:eye-outline`}),a[0]||=(0,n.createElementVNode)(`span`,null,`裁剪预览`,-1)]),(0,n.createElementVNode)(`div`,{ref_key:`mainBoxRef`,ref:i,class:(0,n.normalizeClass)([`preview-main`,{"preview-main--circular":t.circular}])},[s.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`preview-main__viewport`,style:(0,n.normalizeStyle)(c.value)},[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(t.previewData.div)},[(0,n.createElementVNode)(`img`,{src:t.previewData.url,style:(0,n.normalizeStyle)(t.previewData.img),alt:`preview`},null,12,d)],4)],4)):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,f,[(0,n.createVNode)(e.t,{name:`mdi:image-outline`,style:{"font-size":`32px`,opacity:`0.2`}})]))],2),(0,n.createElementVNode)(`div`,p,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(o,e=>(0,n.createElementVNode)(`div`,{key:e.label,class:`preview-thumb`},[(0,n.createElementVNode)(`div`,{class:(0,n.normalizeClass)([`preview-thumb__box`,{"preview-thumb__box--circular":t.circular}]),style:(0,n.normalizeStyle)({width:`${e.size}px`,height:`${e.size}px`})},[s.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`preview-thumb__viewport`,style:(0,n.normalizeStyle)(g(e.size))},[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(t.previewData.div)},[(0,n.createElementVNode)(`img`,{src:t.previewData.url,style:(0,n.normalizeStyle)(t.previewData.img),alt:`thumb`},null,12,m)],4)],4)):(0,n.createCommentVNode)(`v-if`,!0)],6),(0,n.createElementVNode)(`span`,h,(0,n.toDisplayString)(e.label),1)])),64))])]))}});var _=t.t(g,[[`__scopeId`,`data-v-c8968d14`]]);function v(e,t){return new Promise((n,r)=>{let i=new Image;!e.startsWith(`data:`)&&!e.startsWith(`blob:`)&&(i.crossOrigin=`anonymous`),i.onload=()=>{try{let e=i.naturalWidth,r=i.naturalHeight;if(!e||!r)throw Error(`Image has no dimensions`);let a=document.createElement(`canvas`);a.width=e,a.height=r;let o=a.getContext(`2d`);if(!o)throw Error(`Canvas 2D context unavailable`);o.translate(t===`horizontal`?e:0,t===`vertical`?r:0),o.scale(t===`horizontal`?-1:1,t===`vertical`?-1:1),o.drawImage(i,0,0),n(a.toDataURL(`image/png`))}catch(e){r(e)}},i.onerror=()=>r(Error(`Image could not be loaded for flipping`)),i.src=e})}const y={class:`c-image-cropper__body`},b={class:`c-image-cropper__workspace`},x={key:1,class:`c-image-cropper__placeholder`},S={key:0,class:`c-image-cropper__preview-panel`},C={key:1,class:`c-image-cropper`},w={class:`c-image-cropper__body`},T={class:`c-image-cropper__workspace`},E={key:1,class:`c-image-cropper__placeholder`},D={key:0,class:`c-image-cropper__preview-panel`},O=(0,n.defineComponent)({name:`C_ImageCropper`,__name:`index`,props:{src:{default:``},aspectRatio:{default:0},outputFormat:{default:`png`},outputQuality:{default:.92},maxOutputWidth:{default:0},maxOutputHeight:{default:0},showPreview:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},circular:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},height:{default:`400px`},modal:{type:Boolean,default:!1},modalTitle:{default:`图片裁剪`}},emits:[`crop`,`ready`,`error`,`confirm`,`cancel`],setup(t,{expose:o,emit:s}){let l=t,u=s,d=(0,n.ref)(l.src),f=(0,n.ref)(l.aspectRatio),p=(0,n.ref)(!1),m=(0,n.ref)(!1),h=(0,n.ref)(!1),g=(0,n.ref)(!1),O=(0,n.ref)(null),k=(0,n.ref)(null),A=(0,n.ref)(null),j=(0,n.computed)(()=>l.modal?A.value:k.value),M=(0,n.computed)(()=>typeof l.height==`number`?`${l.height}px`:l.height),N=(0,n.computed)(()=>({png:`png`,jpeg:`jpeg`,webp:`webp`})[l.outputFormat]||`png`),P=(0,n.computed)(()=>f.value>0),F=(0,n.computed)(()=>f.value<=0||f.value===1?[1,1]:Math.abs(f.value-16/9)<.01?[16,9]:Math.abs(f.value-4/3)<.01?[4,3]:Math.abs(f.value-3/2)<.01?[3,2]:[Math.round(f.value*100),100]),I=(0,n.computed)(()=>({width:300,height:f.value>0?300/f.value:200})),L=[{label:`自由`,value:0},{label:`1:1`,value:1},{label:`16:9`,value:16/9},{label:`4:3`,value:4/3},{label:`3:2`,value:3/2}],R=a({format:(0,n.computed)(()=>l.outputFormat),quality:(0,n.computed)(()=>l.outputQuality),maxWidth:(0,n.computed)(()=>l.maxOutputWidth),maxHeight:(0,n.computed)(()=>l.maxOutputHeight)});(0,n.watch)(j,e=>{R.cropperRef.value=e});function z(e){O.value=e}function B(e){g.value=e===`success`,g.value?u(`ready`):W(e instanceof Error?e:Error(`Image could not be loaded`))}function V(e){l.disabled||h.value||m.value||R.rotate(e)}function H(e){l.disabled||h.value||m.value||(f.value=e)}function U(){l.disabled||h.value||m.value||(g.value=!1,R.reset())}function W(e){u(`error`,e instanceof Error?e:Error(String(e)))}async function G(e){if(l.disabled||h.value||m.value||!d.value)return;h.value=!0;let t=d.value;try{let n=await v(t,e);d.value===t&&(d.value=n)}catch(e){W(e)}finally{h.value=!1}}function K(){G(`horizontal`)}function q(){G(`vertical`)}async function J(){if(!g.value||h.value)throw Error(`Image cropper is not ready`);let e=d.value,t=await R.getCropResult();if(e!==d.value||!g.value)throw Error(`Image changed during crop export`);return t}async function Y(){if(!(l.disabled||h.value||m.value||!g.value)){m.value=!0;try{let e=await J();if(!p.value)return;u(`confirm`,e),u(`crop`,e),p.value=!1}catch(e){W(e)}finally{m.value=!1}}}function X(){p.value=!1,u(`cancel`)}function Z(e){if(!e.type.startsWith(`image/`)){W(Error(`Please select an image file`));return}let t=new FileReader;t.onerror=()=>W(Error(`Image file could not be read`)),t.onload=e=>{typeof e.target?.result==`string`&&(d.value=e.target.result)},t.readAsDataURL(e)}return(0,n.watch)(d,()=>{g.value=!1,O.value=null}),(0,n.watch)(()=>l.src,e=>{d.value=e}),(0,n.watch)(()=>l.aspectRatio,e=>{f.value=e}),o({getCropResult:J,rotate:R.rotate,zoom:R.zoom,flipX:K,flipY:q,reset:R.reset,setAspectRatio:e=>{f.value=e},loadFile:Z,open:e=>{e&&(d.value=e),p.value=!0},close:()=>{p.value=!1}}),(t,a)=>l.modal?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.NModal),{key:0,show:p.value,"onUpdate:show":a[0]||=e=>p.value=e,preset:`card`,title:l.modalTitle||`图片裁剪`,style:{width:`860px`},"mask-closable":!1,closable:!0},{footer:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NSpace),{justify:`end`},{default:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{disabled:m.value,onClick:X},{default:(0,n.withCtx)(()=>[...a[2]||=[(0,n.createTextVNode)(`取消`,-1)]]),_:1},8,[`disabled`]),(0,n.createVNode)((0,n.unref)(r.NButton),{type:`primary`,loading:m.value,disabled:l.disabled||h.value||!g.value,onClick:Y},{default:(0,n.withCtx)(()=>[...a[3]||=[(0,n.createTextVNode)(`确认裁剪`,-1)]]),_:1},8,[`loading`,`disabled`])]),_:1})]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`div`,y,[l.showToolbar?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,"current-ratio":f.value,"ratio-presets":L,disabled:l.disabled||h.value||m.value||!g.value,onRatio:H,onRotate:V,onFlipX:K,onFlipY:q,onZoom:(0,n.unref)(R).zoom,onReset:U},null,8,[`current-ratio`,`disabled`,`onZoom`])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,b,[(0,n.createElementVNode)(`div`,{class:`c-image-cropper__canvas`,style:(0,n.normalizeStyle)({height:M.value})},[d.value?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(i.VueCropper),{key:0,ref_key:`modalCropperRef`,ref:A,img:d.value,"output-size":l.outputQuality,"output-type":N.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":I.value.width,"auto-crop-height":I.value.height,fixed:P.value,"fixed-number":F.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!l.disabled&&!m.value&&!h.value,"can-move-box":!l.disabled&&!m.value&&!h.value,"fixed-box":l.disabled||m.value||h.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:z,onImgLoad:B},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,x,[(0,n.createVNode)(e.t,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),a[1]||=(0,n.createElementVNode)(`span`,null,`请选择图片`,-1)]))],4),l.showPreview&&d.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,S,[(0,n.createVNode)(_,{"preview-data":O.value,circular:l.circular},null,8,[`preview-data`,`circular`])])):(0,n.createCommentVNode)(`v-if`,!0)])])]),_:1},8,[`show`,`title`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,C,[(0,n.createElementVNode)(`div`,w,[l.showToolbar?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,"current-ratio":f.value,"ratio-presets":L,disabled:l.disabled||h.value||m.value||!g.value,onRatio:H,onRotate:V,onFlipX:K,onFlipY:q,onZoom:(0,n.unref)(R).zoom,onReset:U},null,8,[`current-ratio`,`disabled`,`onZoom`])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,T,[(0,n.createElementVNode)(`div`,{class:`c-image-cropper__canvas`,style:(0,n.normalizeStyle)({height:M.value})},[d.value?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(i.VueCropper),{key:0,ref_key:`inlineCropperRef`,ref:k,img:d.value,"output-size":l.outputQuality,"output-type":N.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":I.value.width,"auto-crop-height":I.value.height,fixed:P.value,"fixed-number":F.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!l.disabled&&!m.value&&!h.value,"can-move-box":!l.disabled&&!m.value&&!h.value,"fixed-box":l.disabled||m.value||h.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:z,onImgLoad:B},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,E,[(0,n.createVNode)(e.t,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),a[4]||=(0,n.createElementVNode)(`span`,null,`请选择图片`,-1)]))],4),l.showPreview&&d.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,D,[(0,n.createVNode)(_,{"preview-data":O.value,circular:l.circular},null,8,[`preview-data`,`circular`])])):(0,n.createCommentVNode)(`v-if`,!0)])])]))}});var k=t.t(O,[[`__scopeId`,`data-v-8aa3952f`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`),i=require(`vue-cropper`);function a(e={}){let t=(0,n.ref)(null);function r(){t.value?.rotateLeft()}function i(){t.value?.rotateRight()}function a(e){if(!Number.isFinite(e))return;let t=Math.round(e/90),n=t>0?i:r;for(let e=0;e<Math.abs(t);e++)n()}function o(e){!Number.isFinite(e)||e===0||t.value?.changeScale(e>0?1:-1)}function s(){t.value?.refresh()}function c(t,n){let r=e.maxWidth?.value??0,i=e.maxHeight?.value??0,a=Math.min(1,r>0?r/t:1,i>0?i/n:1);return{width:Math.max(1,Math.round(t*a)),height:Math.max(1,Math.round(n*a))}}function l(){return new Promise((n,r)=>{let i=t.value;if(!i){r(Error(`Cropper not initialized`));return}let a=e.format?.value??`png`,o=Math.min(1,Math.max(0,e.quality?.value??.92)),s=a===`jpeg`?`image/jpeg`:`image/${a}`,l=!1,u=setTimeout(()=>d(Error(`Crop result timed out`)),15e3);function d(e){l||(l=!0,clearTimeout(u),r(e instanceof Error?e:Error(String(e))))}function f(e){l||(l=!0,clearTimeout(u),n(e))}try{i.getCropChecked(e=>{if(!l)try{if(!e.width||!e.height)throw Error(`Crop result is empty`);let{width:t,height:n}=c(e.width,e.height),r=e;if(t!==e.width||n!==e.height){r=document.createElement(`canvas`),r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0,t,n)}let i=r.toDataURL(s,o);r.toBlob(e=>{if(!e){d(Error(`Crop result could not be encoded`));return}f({base64:i,blob:e,width:t,height:n,format:a})},s,o)}catch(e){d(e)}})}catch(e){d(e)}})}return{cropperRef:t,rotate:a,rotateLeft:r,rotateRight:i,zoom:o,reset:s,getCropResult:l}}const o={class:`cropper-toolbar`},s=(0,n.defineComponent)({__name:`CropperToolbar`,props:{currentRatio:{},ratioPresets:{},disabled:{type:Boolean}},emits:[`ratio`,`rotate`,`flipX`,`flipY`,`zoom`,`reset`],setup(t){return(i,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,o,[(0,n.createVNode)((0,n.unref)(r.NButtonGroup),{size:`small`},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(t.ratioPresets,e=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.NButton),{key:e.value,type:t.currentRatio===e.value?`primary`:`default`,disabled:t.disabled,onClick:t=>i.$emit(`ratio`,e.value)},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)(e.label),1)]),_:2},1032,[`type`,`disabled`,`onClick`]))),128))]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[0]||=e=>i.$emit(`rotate`,-90)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:rotate-left`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[7]||=(0,n.createTextVNode)(` 逆时针旋转 90° `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[1]||=e=>i.$emit(`rotate`,90)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:rotate-right`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[8]||=(0,n.createTextVNode)(` 顺时针旋转 90° `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[2]||=e=>i.$emit(`flipX`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:flip-horizontal`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[9]||=(0,n.createTextVNode)(` 水平翻转 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[3]||=e=>i.$emit(`flipY`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:flip-vertical`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[10]||=(0,n.createTextVNode)(` 垂直翻转 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[4]||=e=>i.$emit(`zoom`,.1)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:magnify-plus-outline`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[11]||=(0,n.createTextVNode)(` 放大 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[5]||=e=>i.$emit(`zoom`,-.1)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:magnify-minus-outline`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[12]||=(0,n.createTextVNode)(` 缩小 `,-1)]),_:1}),(0,n.createVNode)((0,n.unref)(r.NDivider),{vertical:``}),(0,n.createVNode)((0,n.unref)(r.NTooltip),null,{trigger:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[6]||=e=>i.$emit(`reset`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:refresh`})]),_:1},8,[`disabled`])]),default:(0,n.withCtx)(()=>[a[13]||=(0,n.createTextVNode)(` 重置 `,-1)]),_:1})]))}});var c=t.t(s,[[`__scopeId`,`data-v-8dc2ca25`]]);const l={class:`cropper-preview`},u={class:`preview-label`},d=[`src`],f={key:1,class:`preview-empty`},p={class:`preview-thumbs`},m=[`src`],h={class:`preview-thumb__label`},g=(0,n.defineComponent)({__name:`CropperPreview`,props:{previewData:{},circular:{type:Boolean}},setup(t){let r=t,i=(0,n.ref)(null),a=(0,n.ref)(200),o=[{label:`80px`,size:80},{label:`48px`,size:48},{label:`32px`,size:32}],s=(0,n.computed)(()=>{let e=r.previewData;return e&&e.url&&e.w>0&&e.h>0}),c=(0,n.computed)(()=>{if(!s.value)return{};let{w:e}=r.previewData;return{zoom:a.value/e,overflow:`hidden`}});function g(e){if(!s.value)return{};let{w:t}=r.previewData;return{zoom:e/t,overflow:`hidden`}}let _=null;return(0,n.onMounted)(()=>{i.value&&(a.value=i.value.clientWidth,_=new ResizeObserver(e=>{requestAnimationFrame(()=>{for(let t of e)a.value=t.contentRect.width})}),_.observe(i.value))}),(0,n.onBeforeUnmount)(()=>{_?.disconnect()}),(r,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,l,[(0,n.createElementVNode)(`div`,u,[(0,n.createVNode)(e.t,{name:`mdi:eye-outline`}),a[0]||=(0,n.createElementVNode)(`span`,null,`裁剪预览`,-1)]),(0,n.createElementVNode)(`div`,{ref_key:`mainBoxRef`,ref:i,class:(0,n.normalizeClass)([`preview-main`,{"preview-main--circular":t.circular}])},[s.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`preview-main__viewport`,style:(0,n.normalizeStyle)(c.value)},[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(t.previewData.div)},[(0,n.createElementVNode)(`img`,{src:t.previewData.url,style:(0,n.normalizeStyle)(t.previewData.img),alt:`preview`},null,12,d)],4)],4)):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,f,[(0,n.createVNode)(e.t,{name:`mdi:image-outline`,style:{"font-size":`32px`,opacity:`0.2`}})]))],2),(0,n.createElementVNode)(`div`,p,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(o,e=>(0,n.createElementVNode)(`div`,{key:e.label,class:`preview-thumb`},[(0,n.createElementVNode)(`div`,{class:(0,n.normalizeClass)([`preview-thumb__box`,{"preview-thumb__box--circular":t.circular}]),style:(0,n.normalizeStyle)({width:`${e.size}px`,height:`${e.size}px`})},[s.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`preview-thumb__viewport`,style:(0,n.normalizeStyle)(g(e.size))},[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(t.previewData.div)},[(0,n.createElementVNode)(`img`,{src:t.previewData.url,style:(0,n.normalizeStyle)(t.previewData.img),alt:`thumb`},null,12,m)],4)],4)):(0,n.createCommentVNode)(`v-if`,!0)],6),(0,n.createElementVNode)(`span`,h,(0,n.toDisplayString)(e.label),1)])),64))])]))}});var _=t.t(g,[[`__scopeId`,`data-v-ca124789`]]);function v(e,t){return new Promise((n,r)=>{let i=new Image;!e.startsWith(`data:`)&&!e.startsWith(`blob:`)&&(i.crossOrigin=`anonymous`),i.onload=()=>{try{let e=i.naturalWidth,r=i.naturalHeight;if(!e||!r)throw Error(`Image has no dimensions`);let a=document.createElement(`canvas`);a.width=e,a.height=r;let o=a.getContext(`2d`);if(!o)throw Error(`Canvas 2D context unavailable`);o.translate(t===`horizontal`?e:0,t===`vertical`?r:0),o.scale(t===`horizontal`?-1:1,t===`vertical`?-1:1),o.drawImage(i,0,0),n(a.toDataURL(`image/png`))}catch(e){r(e)}},i.onerror=()=>r(Error(`Image could not be loaded for flipping`)),i.src=e})}const y={class:`c-image-cropper__body`},b={class:`c-image-cropper__workspace`},x={key:1,class:`c-image-cropper__placeholder`},S={key:0,class:`c-image-cropper__preview-panel`},C={key:1,class:`c-image-cropper`},w={class:`c-image-cropper__body`},T={class:`c-image-cropper__workspace`},E={key:1,class:`c-image-cropper__placeholder`},D={key:0,class:`c-image-cropper__preview-panel`},O=(0,n.defineComponent)({name:`C_ImageCropper`,__name:`index`,props:{src:{default:``},aspectRatio:{default:0},outputFormat:{default:`png`},outputQuality:{default:.92},maxOutputWidth:{default:0},maxOutputHeight:{default:0},showPreview:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},circular:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},height:{default:`400px`},modal:{type:Boolean,default:!1},modalTitle:{default:`图片裁剪`}},emits:[`crop`,`ready`,`error`,`confirm`,`cancel`],setup(t,{expose:o,emit:s}){let l=t,u=s,d=(0,n.ref)(l.src),f=(0,n.ref)(l.aspectRatio),p=(0,n.ref)(!1),m=(0,n.ref)(!1),h=(0,n.ref)(!1),g=(0,n.ref)(!1),O=(0,n.ref)(null),k=(0,n.ref)(null),A=(0,n.ref)(null),j=(0,n.computed)(()=>l.modal?A.value:k.value),M=(0,n.computed)(()=>typeof l.height==`number`?`${l.height}px`:l.height),N=(0,n.computed)(()=>({png:`png`,jpeg:`jpeg`,webp:`webp`})[l.outputFormat]||`png`),P=(0,n.computed)(()=>f.value>0),F=(0,n.computed)(()=>f.value<=0||f.value===1?[1,1]:Math.abs(f.value-16/9)<.01?[16,9]:Math.abs(f.value-4/3)<.01?[4,3]:Math.abs(f.value-3/2)<.01?[3,2]:[Math.round(f.value*100),100]),I=(0,n.computed)(()=>({width:300,height:f.value>0?300/f.value:200})),L=[{label:`自由`,value:0},{label:`1:1`,value:1},{label:`16:9`,value:16/9},{label:`4:3`,value:4/3},{label:`3:2`,value:3/2}],R=a({format:(0,n.computed)(()=>l.outputFormat),quality:(0,n.computed)(()=>l.outputQuality),maxWidth:(0,n.computed)(()=>l.maxOutputWidth),maxHeight:(0,n.computed)(()=>l.maxOutputHeight)});(0,n.watch)(j,e=>{R.cropperRef.value=e});function z(e){O.value=e}function B(e){g.value=e===`success`,g.value?u(`ready`):W(e instanceof Error?e:Error(`Image could not be loaded`))}function V(e){l.disabled||h.value||m.value||R.rotate(e)}function H(e){l.disabled||h.value||m.value||(f.value=e)}function U(){l.disabled||h.value||m.value||(g.value=!1,R.reset())}function W(e){u(`error`,e instanceof Error?e:Error(String(e)))}async function G(e){if(l.disabled||h.value||m.value||!d.value)return;h.value=!0;let t=d.value;try{let n=await v(t,e);d.value===t&&(d.value=n)}catch(e){W(e)}finally{h.value=!1}}function K(){G(`horizontal`)}function q(){G(`vertical`)}async function J(){if(!g.value||h.value)throw Error(`Image cropper is not ready`);let e=d.value,t=await R.getCropResult();if(e!==d.value||!g.value)throw Error(`Image changed during crop export`);return t}async function Y(){if(!(l.disabled||h.value||m.value||!g.value)){m.value=!0;try{let e=await J();if(!p.value)return;u(`confirm`,e),u(`crop`,e),p.value=!1}catch(e){W(e)}finally{m.value=!1}}}function X(){p.value=!1,u(`cancel`)}function Z(e){if(!e.type.startsWith(`image/`)){W(Error(`Please select an image file`));return}let t=new FileReader;t.onerror=()=>W(Error(`Image file could not be read`)),t.onload=e=>{typeof e.target?.result==`string`&&(d.value=e.target.result)},t.readAsDataURL(e)}return(0,n.watch)(d,()=>{g.value=!1,O.value=null}),(0,n.watch)(()=>l.src,e=>{d.value=e}),(0,n.watch)(()=>l.aspectRatio,e=>{f.value=e}),o({getCropResult:J,rotate:R.rotate,zoom:R.zoom,flipX:K,flipY:q,reset:R.reset,setAspectRatio:e=>{f.value=e},loadFile:Z,open:e=>{e&&(d.value=e),p.value=!0},close:()=>{p.value=!1}}),(t,a)=>l.modal?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.NModal),{key:0,show:p.value,"onUpdate:show":a[0]||=e=>p.value=e,preset:`card`,title:l.modalTitle||`图片裁剪`,style:{width:`860px`},"mask-closable":!1,closable:!0},{footer:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NSpace),{justify:`end`},{default:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{disabled:m.value,onClick:X},{default:(0,n.withCtx)(()=>[...a[2]||=[(0,n.createTextVNode)(`取消`,-1)]]),_:1},8,[`disabled`]),(0,n.createVNode)((0,n.unref)(r.NButton),{type:`primary`,loading:m.value,disabled:l.disabled||h.value||!g.value,onClick:Y},{default:(0,n.withCtx)(()=>[...a[3]||=[(0,n.createTextVNode)(`确认裁剪`,-1)]]),_:1},8,[`loading`,`disabled`])]),_:1})]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`div`,y,[l.showToolbar?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,"current-ratio":f.value,"ratio-presets":L,disabled:l.disabled||h.value||m.value||!g.value,onRatio:H,onRotate:V,onFlipX:K,onFlipY:q,onZoom:(0,n.unref)(R).zoom,onReset:U},null,8,[`current-ratio`,`disabled`,`onZoom`])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,b,[(0,n.createElementVNode)(`div`,{class:`c-image-cropper__canvas`,style:(0,n.normalizeStyle)({height:M.value})},[d.value?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(i.VueCropper),{key:0,ref_key:`modalCropperRef`,ref:A,img:d.value,"output-size":l.outputQuality,"output-type":N.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":I.value.width,"auto-crop-height":I.value.height,fixed:P.value,"fixed-number":F.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!l.disabled&&!m.value&&!h.value,"can-move-box":!l.disabled&&!m.value&&!h.value,"fixed-box":l.disabled||m.value||h.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:z,onImgLoad:B},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,x,[(0,n.createVNode)(e.t,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),a[1]||=(0,n.createElementVNode)(`span`,null,`请选择图片`,-1)]))],4),l.showPreview&&d.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,S,[(0,n.createVNode)(_,{"preview-data":O.value,circular:l.circular},null,8,[`preview-data`,`circular`])])):(0,n.createCommentVNode)(`v-if`,!0)])])]),_:1},8,[`show`,`title`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,C,[(0,n.createElementVNode)(`div`,w,[l.showToolbar?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,"current-ratio":f.value,"ratio-presets":L,disabled:l.disabled||h.value||m.value||!g.value,onRatio:H,onRotate:V,onFlipX:K,onFlipY:q,onZoom:(0,n.unref)(R).zoom,onReset:U},null,8,[`current-ratio`,`disabled`,`onZoom`])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,T,[(0,n.createElementVNode)(`div`,{class:`c-image-cropper__canvas`,style:(0,n.normalizeStyle)({height:M.value})},[d.value?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(i.VueCropper),{key:0,ref_key:`inlineCropperRef`,ref:k,img:d.value,"output-size":l.outputQuality,"output-type":N.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":I.value.width,"auto-crop-height":I.value.height,fixed:P.value,"fixed-number":F.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!l.disabled&&!m.value&&!h.value,"can-move-box":!l.disabled&&!m.value&&!h.value,"fixed-box":l.disabled||m.value||h.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:z,onImgLoad:B},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,E,[(0,n.createVNode)(e.t,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),a[4]||=(0,n.createElementVNode)(`span`,null,`请选择图片`,-1)]))],4),l.showPreview&&d.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,D,[(0,n.createVNode)(_,{"preview-data":O.value,circular:l.circular},null,8,[`preview-data`,`circular`])])):(0,n.createCommentVNode)(`v-if`,!0)])])]))}});var k=t.t(O,[[`__scopeId`,`data-v-b3645c9b`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});
|
package/dist/C_ImageCropper2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{Fragment as n,computed as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createElementVNode as s,createTextVNode as c,createVNode as l,defineComponent as u,normalizeClass as d,normalizeStyle as f,onBeforeUnmount as p,onMounted as m,openBlock as h,ref as g,renderList as _,toDisplayString as v,unref as y,watch as b,withCtx as x}from"vue";import{NButton as S,NButtonGroup as C,NDivider as w,NModal as T,NSpace as ee,NTooltip as E}from"naive-ui";import{VueCropper as D}from"vue-cropper";function O(e={}){let t=g(null);function n(){t.value?.rotateLeft()}function r(){t.value?.rotateRight()}function i(e){if(!Number.isFinite(e))return;let t=Math.round(e/90),i=t>0?r:n;for(let e=0;e<Math.abs(t);e++)i()}function a(e){!Number.isFinite(e)||e===0||t.value?.changeScale(e>0?1:-1)}function o(){t.value?.refresh()}function s(t,n){let r=e.maxWidth?.value??0,i=e.maxHeight?.value??0,a=Math.min(1,r>0?r/t:1,i>0?i/n:1);return{width:Math.max(1,Math.round(t*a)),height:Math.max(1,Math.round(n*a))}}function c(){return new Promise((n,r)=>{let i=t.value;if(!i){r(Error(`Cropper not initialized`));return}let a=e.format?.value??`png`,o=Math.min(1,Math.max(0,e.quality?.value??.92)),c=a===`jpeg`?`image/jpeg`:`image/${a}`,l=!1,u=setTimeout(()=>d(Error(`Crop result timed out`)),15e3);function d(e){l||(l=!0,clearTimeout(u),r(e instanceof Error?e:Error(String(e))))}function f(e){l||(l=!0,clearTimeout(u),n(e))}try{i.getCropChecked(e=>{if(!l)try{if(!e.width||!e.height)throw Error(`Crop result is empty`);let{width:t,height:n}=s(e.width,e.height),r=e;if(t!==e.width||n!==e.height){r=document.createElement(`canvas`),r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0,t,n)}let i=r.toDataURL(c,o);r.toBlob(e=>{if(!e){d(Error(`Crop result could not be encoded`));return}f({base64:i,blob:e,width:t,height:n,format:a})},c,o)}catch(e){d(e)}})}catch(e){d(e)}})}return{cropperRef:t,rotate:i,rotateLeft:n,rotateRight:r,zoom:a,reset:o,getCropResult:c}}const k={class:`cropper-toolbar`};var A=t(u({__name:`CropperToolbar`,props:{currentRatio:{},ratioPresets:{},disabled:{type:Boolean}},emits:[`ratio`,`rotate`,`flipX`,`flipY`,`zoom`,`reset`],setup(t){return(r,a)=>(h(),o(`div`,k,[l(y(C),{size:`small`},{default:x(()=>[(h(!0),o(n,null,_(t.ratioPresets,e=>(h(),i(y(S),{key:e.value,type:t.currentRatio===e.value?`primary`:`default`,disabled:t.disabled,onClick:t=>r.$emit(`ratio`,e.value)},{default:x(()=>[c(v(e.label),1)]),_:2},1032,[`type`,`disabled`,`onClick`]))),128))]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[0]||=e=>r.$emit(`rotate`,-90)},{icon:x(()=>[l(e,{name:`mdi:rotate-left`})]),_:1},8,[`disabled`])]),default:x(()=>[a[7]||=c(` 逆时针旋转 90° `,-1)]),_:1}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[1]||=e=>r.$emit(`rotate`,90)},{icon:x(()=>[l(e,{name:`mdi:rotate-right`})]),_:1},8,[`disabled`])]),default:x(()=>[a[8]||=c(` 顺时针旋转 90° `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[2]||=e=>r.$emit(`flipX`)},{icon:x(()=>[l(e,{name:`mdi:flip-horizontal`})]),_:1},8,[`disabled`])]),default:x(()=>[a[9]||=c(` 水平翻转 `,-1)]),_:1}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[3]||=e=>r.$emit(`flipY`)},{icon:x(()=>[l(e,{name:`mdi:flip-vertical`})]),_:1},8,[`disabled`])]),default:x(()=>[a[10]||=c(` 垂直翻转 `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[4]||=e=>r.$emit(`zoom`,.1)},{icon:x(()=>[l(e,{name:`mdi:magnify-plus-outline`})]),_:1},8,[`disabled`])]),default:x(()=>[a[11]||=c(` 放大 `,-1)]),_:1}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[5]||=e=>r.$emit(`zoom`,-.1)},{icon:x(()=>[l(e,{name:`mdi:magnify-minus-outline`})]),_:1},8,[`disabled`])]),default:x(()=>[a[12]||=c(` 缩小 `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[6]||=e=>r.$emit(`reset`)},{icon:x(()=>[l(e,{name:`mdi:refresh`})]),_:1},8,[`disabled`])]),default:x(()=>[a[13]||=c(` 重置 `,-1)]),_:1})]))}}),[[`__scopeId`,`data-v-eb7204dc`]]);const j={class:`cropper-preview`},M={class:`preview-label`},N=[`src`],P={key:1,class:`preview-empty`},F={class:`preview-thumbs`},I=[`src`],L={class:`preview-thumb__label`};var R=t(u({__name:`CropperPreview`,props:{previewData:{},circular:{type:Boolean}},setup(t){let i=t,c=g(null),u=g(200),y=[{label:`80px`,size:80},{label:`48px`,size:48},{label:`32px`,size:32}],b=r(()=>{let e=i.previewData;return e&&e.url&&e.w>0&&e.h>0}),x=r(()=>{if(!b.value)return{};let{w:e}=i.previewData;return{zoom:u.value/e,overflow:`hidden`}});function S(e){if(!b.value)return{};let{w:t}=i.previewData;return{zoom:e/t,overflow:`hidden`}}let C=null;return m(()=>{c.value&&(u.value=c.value.clientWidth,C=new ResizeObserver(e=>{requestAnimationFrame(()=>{for(let t of e)u.value=t.contentRect.width})}),C.observe(c.value))}),p(()=>{C?.disconnect()}),(r,i)=>(h(),o(`div`,j,[s(`div`,M,[l(e,{name:`mdi:eye-outline`}),i[0]||=s(`span`,null,`裁剪预览`,-1)]),s(`div`,{ref_key:`mainBoxRef`,ref:c,class:d([`preview-main`,{"preview-main--circular":t.circular}])},[b.value?(h(),o(`div`,{key:0,class:`preview-main__viewport`,style:f(x.value)},[s(`div`,{style:f(t.previewData.div)},[s(`img`,{src:t.previewData.url,style:f(t.previewData.img),alt:`preview`},null,12,N)],4)],4)):(h(),o(`div`,P,[l(e,{name:`mdi:image-outline`,style:{"font-size":`32px`,opacity:`0.2`}})]))],2),s(`div`,F,[(h(),o(n,null,_(y,e=>s(`div`,{key:e.label,class:`preview-thumb`},[s(`div`,{class:d([`preview-thumb__box`,{"preview-thumb__box--circular":t.circular}]),style:f({width:`${e.size}px`,height:`${e.size}px`})},[b.value?(h(),o(`div`,{key:0,class:`preview-thumb__viewport`,style:f(S(e.size))},[s(`div`,{style:f(t.previewData.div)},[s(`img`,{src:t.previewData.url,style:f(t.previewData.img),alt:`thumb`},null,12,I)],4)],4)):a(`v-if`,!0)],6),s(`span`,L,v(e.label),1)])),64))])]))}}),[[`__scopeId`,`data-v-c8968d14`]]);function z(e,t){return new Promise((n,r)=>{let i=new Image;!e.startsWith(`data:`)&&!e.startsWith(`blob:`)&&(i.crossOrigin=`anonymous`),i.onload=()=>{try{let e=i.naturalWidth,r=i.naturalHeight;if(!e||!r)throw Error(`Image has no dimensions`);let a=document.createElement(`canvas`);a.width=e,a.height=r;let o=a.getContext(`2d`);if(!o)throw Error(`Canvas 2D context unavailable`);o.translate(t===`horizontal`?e:0,t===`vertical`?r:0),o.scale(t===`horizontal`?-1:1,t===`vertical`?-1:1),o.drawImage(i,0,0),n(a.toDataURL(`image/png`))}catch(e){r(e)}},i.onerror=()=>r(Error(`Image could not be loaded for flipping`)),i.src=e})}const B={class:`c-image-cropper__body`},te={class:`c-image-cropper__workspace`},ne={key:1,class:`c-image-cropper__placeholder`},re={key:0,class:`c-image-cropper__preview-panel`},ie={key:1,class:`c-image-cropper`},ae={class:`c-image-cropper__body`},oe={class:`c-image-cropper__workspace`},se={key:1,class:`c-image-cropper__placeholder`},ce={key:0,class:`c-image-cropper__preview-panel`};var V=t(u({name:`C_ImageCropper`,__name:`index`,props:{src:{default:``},aspectRatio:{default:0},outputFormat:{default:`png`},outputQuality:{default:.92},maxOutputWidth:{default:0},maxOutputHeight:{default:0},showPreview:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},circular:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},height:{default:`400px`},modal:{type:Boolean,default:!1},modalTitle:{default:`图片裁剪`}},emits:[`crop`,`ready`,`error`,`confirm`,`cancel`],setup(t,{expose:n,emit:u}){let d=t,p=u,m=g(d.src),_=g(d.aspectRatio),v=g(!1),C=g(!1),w=g(!1),E=g(!1),k=g(null),j=g(null),M=g(null),N=r(()=>d.modal?M.value:j.value),P=r(()=>typeof d.height==`number`?`${d.height}px`:d.height),F=r(()=>({png:`png`,jpeg:`jpeg`,webp:`webp`})[d.outputFormat]||`png`),I=r(()=>_.value>0),L=r(()=>_.value<=0||_.value===1?[1,1]:Math.abs(_.value-16/9)<.01?[16,9]:Math.abs(_.value-4/3)<.01?[4,3]:Math.abs(_.value-3/2)<.01?[3,2]:[Math.round(_.value*100),100]),V=r(()=>({width:300,height:_.value>0?300/_.value:200})),H=[{label:`自由`,value:0},{label:`1:1`,value:1},{label:`16:9`,value:16/9},{label:`4:3`,value:4/3},{label:`3:2`,value:3/2}],U=O({format:r(()=>d.outputFormat),quality:r(()=>d.outputQuality),maxWidth:r(()=>d.maxOutputWidth),maxHeight:r(()=>d.maxOutputHeight)});b(N,e=>{U.cropperRef.value=e});function W(e){k.value=e}function G(e){E.value=e===`success`,E.value?p(`ready`):Y(e instanceof Error?e:Error(`Image could not be loaded`))}function K(e){d.disabled||w.value||C.value||U.rotate(e)}function q(e){d.disabled||w.value||C.value||(_.value=e)}function J(){d.disabled||w.value||C.value||(E.value=!1,U.reset())}function Y(e){p(`error`,e instanceof Error?e:Error(String(e)))}async function X(e){if(d.disabled||w.value||C.value||!m.value)return;w.value=!0;let t=m.value;try{let n=await z(t,e);m.value===t&&(m.value=n)}catch(e){Y(e)}finally{w.value=!1}}function Z(){X(`horizontal`)}function Q(){X(`vertical`)}async function $(){if(!E.value||w.value)throw Error(`Image cropper is not ready`);let e=m.value,t=await U.getCropResult();if(e!==m.value||!E.value)throw Error(`Image changed during crop export`);return t}async function le(){if(!(d.disabled||w.value||C.value||!E.value)){C.value=!0;try{let e=await $();if(!v.value)return;p(`confirm`,e),p(`crop`,e),v.value=!1}catch(e){Y(e)}finally{C.value=!1}}}function ue(){v.value=!1,p(`cancel`)}function de(e){if(!e.type.startsWith(`image/`)){Y(Error(`Please select an image file`));return}let t=new FileReader;t.onerror=()=>Y(Error(`Image file could not be read`)),t.onload=e=>{typeof e.target?.result==`string`&&(m.value=e.target.result)},t.readAsDataURL(e)}return b(m,()=>{E.value=!1,k.value=null}),b(()=>d.src,e=>{m.value=e}),b(()=>d.aspectRatio,e=>{_.value=e}),n({getCropResult:$,rotate:U.rotate,zoom:U.zoom,flipX:Z,flipY:Q,reset:U.reset,setAspectRatio:e=>{_.value=e},loadFile:de,open:e=>{e&&(m.value=e),v.value=!0},close:()=>{v.value=!1}}),(t,n)=>d.modal?(h(),i(y(T),{key:0,show:v.value,"onUpdate:show":n[0]||=e=>v.value=e,preset:`card`,title:d.modalTitle||`图片裁剪`,style:{width:`860px`},"mask-closable":!1,closable:!0},{footer:x(()=>[l(y(ee),{justify:`end`},{default:x(()=>[l(y(S),{disabled:C.value,onClick:ue},{default:x(()=>[...n[2]||=[c(`取消`,-1)]]),_:1},8,[`disabled`]),l(y(S),{type:`primary`,loading:C.value,disabled:d.disabled||w.value||!E.value,onClick:le},{default:x(()=>[...n[3]||=[c(`确认裁剪`,-1)]]),_:1},8,[`loading`,`disabled`])]),_:1})]),default:x(()=>[s(`div`,B,[d.showToolbar?(h(),i(A,{key:0,"current-ratio":_.value,"ratio-presets":H,disabled:d.disabled||w.value||C.value||!E.value,onRatio:q,onRotate:K,onFlipX:Z,onFlipY:Q,onZoom:y(U).zoom,onReset:J},null,8,[`current-ratio`,`disabled`,`onZoom`])):a(`v-if`,!0),s(`div`,te,[s(`div`,{class:`c-image-cropper__canvas`,style:f({height:P.value})},[m.value?(h(),i(y(D),{key:0,ref_key:`modalCropperRef`,ref:M,img:m.value,"output-size":d.outputQuality,"output-type":F.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":V.value.width,"auto-crop-height":V.value.height,fixed:I.value,"fixed-number":L.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!d.disabled&&!C.value&&!w.value,"can-move-box":!d.disabled&&!C.value&&!w.value,"fixed-box":d.disabled||C.value||w.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:W,onImgLoad:G},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):(h(),o(`div`,ne,[l(e,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),n[1]||=s(`span`,null,`请选择图片`,-1)]))],4),d.showPreview&&m.value?(h(),o(`div`,re,[l(R,{"preview-data":k.value,circular:d.circular},null,8,[`preview-data`,`circular`])])):a(`v-if`,!0)])])]),_:1},8,[`show`,`title`])):(h(),o(`div`,ie,[s(`div`,ae,[d.showToolbar?(h(),i(A,{key:0,"current-ratio":_.value,"ratio-presets":H,disabled:d.disabled||w.value||C.value||!E.value,onRatio:q,onRotate:K,onFlipX:Z,onFlipY:Q,onZoom:y(U).zoom,onReset:J},null,8,[`current-ratio`,`disabled`,`onZoom`])):a(`v-if`,!0),s(`div`,oe,[s(`div`,{class:`c-image-cropper__canvas`,style:f({height:P.value})},[m.value?(h(),i(y(D),{key:0,ref_key:`inlineCropperRef`,ref:j,img:m.value,"output-size":d.outputQuality,"output-type":F.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":V.value.width,"auto-crop-height":V.value.height,fixed:I.value,"fixed-number":L.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!d.disabled&&!C.value&&!w.value,"can-move-box":!d.disabled&&!C.value&&!w.value,"fixed-box":d.disabled||C.value||w.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:W,onImgLoad:G},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):(h(),o(`div`,se,[l(e,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),n[4]||=s(`span`,null,`请选择图片`,-1)]))],4),d.showPreview&&m.value?(h(),o(`div`,ce,[l(R,{"preview-data":k.value,circular:d.circular},null,8,[`preview-data`,`circular`])])):a(`v-if`,!0)])])]))}}),[[`__scopeId`,`data-v-8aa3952f`]]);export{O as n,V as t};
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{Fragment as n,computed as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createElementVNode as s,createTextVNode as c,createVNode as l,defineComponent as u,normalizeClass as d,normalizeStyle as f,onBeforeUnmount as p,onMounted as m,openBlock as h,ref as g,renderList as _,toDisplayString as v,unref as y,watch as b,withCtx as x}from"vue";import{NButton as S,NButtonGroup as C,NDivider as w,NModal as T,NSpace as ee,NTooltip as E}from"naive-ui";import{VueCropper as D}from"vue-cropper";function O(e={}){let t=g(null);function n(){t.value?.rotateLeft()}function r(){t.value?.rotateRight()}function i(e){if(!Number.isFinite(e))return;let t=Math.round(e/90),i=t>0?r:n;for(let e=0;e<Math.abs(t);e++)i()}function a(e){!Number.isFinite(e)||e===0||t.value?.changeScale(e>0?1:-1)}function o(){t.value?.refresh()}function s(t,n){let r=e.maxWidth?.value??0,i=e.maxHeight?.value??0,a=Math.min(1,r>0?r/t:1,i>0?i/n:1);return{width:Math.max(1,Math.round(t*a)),height:Math.max(1,Math.round(n*a))}}function c(){return new Promise((n,r)=>{let i=t.value;if(!i){r(Error(`Cropper not initialized`));return}let a=e.format?.value??`png`,o=Math.min(1,Math.max(0,e.quality?.value??.92)),c=a===`jpeg`?`image/jpeg`:`image/${a}`,l=!1,u=setTimeout(()=>d(Error(`Crop result timed out`)),15e3);function d(e){l||(l=!0,clearTimeout(u),r(e instanceof Error?e:Error(String(e))))}function f(e){l||(l=!0,clearTimeout(u),n(e))}try{i.getCropChecked(e=>{if(!l)try{if(!e.width||!e.height)throw Error(`Crop result is empty`);let{width:t,height:n}=s(e.width,e.height),r=e;if(t!==e.width||n!==e.height){r=document.createElement(`canvas`),r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)throw Error(`Canvas 2D context unavailable`);i.drawImage(e,0,0,t,n)}let i=r.toDataURL(c,o);r.toBlob(e=>{if(!e){d(Error(`Crop result could not be encoded`));return}f({base64:i,blob:e,width:t,height:n,format:a})},c,o)}catch(e){d(e)}})}catch(e){d(e)}})}return{cropperRef:t,rotate:i,rotateLeft:n,rotateRight:r,zoom:a,reset:o,getCropResult:c}}const k={class:`cropper-toolbar`};var A=t(u({__name:`CropperToolbar`,props:{currentRatio:{},ratioPresets:{},disabled:{type:Boolean}},emits:[`ratio`,`rotate`,`flipX`,`flipY`,`zoom`,`reset`],setup(t){return(r,a)=>(h(),o(`div`,k,[l(y(C),{size:`small`},{default:x(()=>[(h(!0),o(n,null,_(t.ratioPresets,e=>(h(),i(y(S),{key:e.value,type:t.currentRatio===e.value?`primary`:`default`,disabled:t.disabled,onClick:t=>r.$emit(`ratio`,e.value)},{default:x(()=>[c(v(e.label),1)]),_:2},1032,[`type`,`disabled`,`onClick`]))),128))]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[0]||=e=>r.$emit(`rotate`,-90)},{icon:x(()=>[l(e,{name:`mdi:rotate-left`})]),_:1},8,[`disabled`])]),default:x(()=>[a[7]||=c(` 逆时针旋转 90° `,-1)]),_:1}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[1]||=e=>r.$emit(`rotate`,90)},{icon:x(()=>[l(e,{name:`mdi:rotate-right`})]),_:1},8,[`disabled`])]),default:x(()=>[a[8]||=c(` 顺时针旋转 90° `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[2]||=e=>r.$emit(`flipX`)},{icon:x(()=>[l(e,{name:`mdi:flip-horizontal`})]),_:1},8,[`disabled`])]),default:x(()=>[a[9]||=c(` 水平翻转 `,-1)]),_:1}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[3]||=e=>r.$emit(`flipY`)},{icon:x(()=>[l(e,{name:`mdi:flip-vertical`})]),_:1},8,[`disabled`])]),default:x(()=>[a[10]||=c(` 垂直翻转 `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[4]||=e=>r.$emit(`zoom`,.1)},{icon:x(()=>[l(e,{name:`mdi:magnify-plus-outline`})]),_:1},8,[`disabled`])]),default:x(()=>[a[11]||=c(` 放大 `,-1)]),_:1}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[5]||=e=>r.$emit(`zoom`,-.1)},{icon:x(()=>[l(e,{name:`mdi:magnify-minus-outline`})]),_:1},8,[`disabled`])]),default:x(()=>[a[12]||=c(` 缩小 `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(E),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,disabled:t.disabled,onClick:a[6]||=e=>r.$emit(`reset`)},{icon:x(()=>[l(e,{name:`mdi:refresh`})]),_:1},8,[`disabled`])]),default:x(()=>[a[13]||=c(` 重置 `,-1)]),_:1})]))}}),[[`__scopeId`,`data-v-8dc2ca25`]]);const j={class:`cropper-preview`},M={class:`preview-label`},N=[`src`],P={key:1,class:`preview-empty`},F={class:`preview-thumbs`},I=[`src`],L={class:`preview-thumb__label`};var R=t(u({__name:`CropperPreview`,props:{previewData:{},circular:{type:Boolean}},setup(t){let i=t,c=g(null),u=g(200),y=[{label:`80px`,size:80},{label:`48px`,size:48},{label:`32px`,size:32}],b=r(()=>{let e=i.previewData;return e&&e.url&&e.w>0&&e.h>0}),x=r(()=>{if(!b.value)return{};let{w:e}=i.previewData;return{zoom:u.value/e,overflow:`hidden`}});function S(e){if(!b.value)return{};let{w:t}=i.previewData;return{zoom:e/t,overflow:`hidden`}}let C=null;return m(()=>{c.value&&(u.value=c.value.clientWidth,C=new ResizeObserver(e=>{requestAnimationFrame(()=>{for(let t of e)u.value=t.contentRect.width})}),C.observe(c.value))}),p(()=>{C?.disconnect()}),(r,i)=>(h(),o(`div`,j,[s(`div`,M,[l(e,{name:`mdi:eye-outline`}),i[0]||=s(`span`,null,`裁剪预览`,-1)]),s(`div`,{ref_key:`mainBoxRef`,ref:c,class:d([`preview-main`,{"preview-main--circular":t.circular}])},[b.value?(h(),o(`div`,{key:0,class:`preview-main__viewport`,style:f(x.value)},[s(`div`,{style:f(t.previewData.div)},[s(`img`,{src:t.previewData.url,style:f(t.previewData.img),alt:`preview`},null,12,N)],4)],4)):(h(),o(`div`,P,[l(e,{name:`mdi:image-outline`,style:{"font-size":`32px`,opacity:`0.2`}})]))],2),s(`div`,F,[(h(),o(n,null,_(y,e=>s(`div`,{key:e.label,class:`preview-thumb`},[s(`div`,{class:d([`preview-thumb__box`,{"preview-thumb__box--circular":t.circular}]),style:f({width:`${e.size}px`,height:`${e.size}px`})},[b.value?(h(),o(`div`,{key:0,class:`preview-thumb__viewport`,style:f(S(e.size))},[s(`div`,{style:f(t.previewData.div)},[s(`img`,{src:t.previewData.url,style:f(t.previewData.img),alt:`thumb`},null,12,I)],4)],4)):a(`v-if`,!0)],6),s(`span`,L,v(e.label),1)])),64))])]))}}),[[`__scopeId`,`data-v-ca124789`]]);function z(e,t){return new Promise((n,r)=>{let i=new Image;!e.startsWith(`data:`)&&!e.startsWith(`blob:`)&&(i.crossOrigin=`anonymous`),i.onload=()=>{try{let e=i.naturalWidth,r=i.naturalHeight;if(!e||!r)throw Error(`Image has no dimensions`);let a=document.createElement(`canvas`);a.width=e,a.height=r;let o=a.getContext(`2d`);if(!o)throw Error(`Canvas 2D context unavailable`);o.translate(t===`horizontal`?e:0,t===`vertical`?r:0),o.scale(t===`horizontal`?-1:1,t===`vertical`?-1:1),o.drawImage(i,0,0),n(a.toDataURL(`image/png`))}catch(e){r(e)}},i.onerror=()=>r(Error(`Image could not be loaded for flipping`)),i.src=e})}const B={class:`c-image-cropper__body`},te={class:`c-image-cropper__workspace`},ne={key:1,class:`c-image-cropper__placeholder`},re={key:0,class:`c-image-cropper__preview-panel`},ie={key:1,class:`c-image-cropper`},ae={class:`c-image-cropper__body`},oe={class:`c-image-cropper__workspace`},se={key:1,class:`c-image-cropper__placeholder`},ce={key:0,class:`c-image-cropper__preview-panel`};var V=t(u({name:`C_ImageCropper`,__name:`index`,props:{src:{default:``},aspectRatio:{default:0},outputFormat:{default:`png`},outputQuality:{default:.92},maxOutputWidth:{default:0},maxOutputHeight:{default:0},showPreview:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},circular:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},height:{default:`400px`},modal:{type:Boolean,default:!1},modalTitle:{default:`图片裁剪`}},emits:[`crop`,`ready`,`error`,`confirm`,`cancel`],setup(t,{expose:n,emit:u}){let d=t,p=u,m=g(d.src),_=g(d.aspectRatio),v=g(!1),C=g(!1),w=g(!1),E=g(!1),k=g(null),j=g(null),M=g(null),N=r(()=>d.modal?M.value:j.value),P=r(()=>typeof d.height==`number`?`${d.height}px`:d.height),F=r(()=>({png:`png`,jpeg:`jpeg`,webp:`webp`})[d.outputFormat]||`png`),I=r(()=>_.value>0),L=r(()=>_.value<=0||_.value===1?[1,1]:Math.abs(_.value-16/9)<.01?[16,9]:Math.abs(_.value-4/3)<.01?[4,3]:Math.abs(_.value-3/2)<.01?[3,2]:[Math.round(_.value*100),100]),V=r(()=>({width:300,height:_.value>0?300/_.value:200})),H=[{label:`自由`,value:0},{label:`1:1`,value:1},{label:`16:9`,value:16/9},{label:`4:3`,value:4/3},{label:`3:2`,value:3/2}],U=O({format:r(()=>d.outputFormat),quality:r(()=>d.outputQuality),maxWidth:r(()=>d.maxOutputWidth),maxHeight:r(()=>d.maxOutputHeight)});b(N,e=>{U.cropperRef.value=e});function W(e){k.value=e}function G(e){E.value=e===`success`,E.value?p(`ready`):Y(e instanceof Error?e:Error(`Image could not be loaded`))}function K(e){d.disabled||w.value||C.value||U.rotate(e)}function q(e){d.disabled||w.value||C.value||(_.value=e)}function J(){d.disabled||w.value||C.value||(E.value=!1,U.reset())}function Y(e){p(`error`,e instanceof Error?e:Error(String(e)))}async function X(e){if(d.disabled||w.value||C.value||!m.value)return;w.value=!0;let t=m.value;try{let n=await z(t,e);m.value===t&&(m.value=n)}catch(e){Y(e)}finally{w.value=!1}}function Z(){X(`horizontal`)}function Q(){X(`vertical`)}async function $(){if(!E.value||w.value)throw Error(`Image cropper is not ready`);let e=m.value,t=await U.getCropResult();if(e!==m.value||!E.value)throw Error(`Image changed during crop export`);return t}async function le(){if(!(d.disabled||w.value||C.value||!E.value)){C.value=!0;try{let e=await $();if(!v.value)return;p(`confirm`,e),p(`crop`,e),v.value=!1}catch(e){Y(e)}finally{C.value=!1}}}function ue(){v.value=!1,p(`cancel`)}function de(e){if(!e.type.startsWith(`image/`)){Y(Error(`Please select an image file`));return}let t=new FileReader;t.onerror=()=>Y(Error(`Image file could not be read`)),t.onload=e=>{typeof e.target?.result==`string`&&(m.value=e.target.result)},t.readAsDataURL(e)}return b(m,()=>{E.value=!1,k.value=null}),b(()=>d.src,e=>{m.value=e}),b(()=>d.aspectRatio,e=>{_.value=e}),n({getCropResult:$,rotate:U.rotate,zoom:U.zoom,flipX:Z,flipY:Q,reset:U.reset,setAspectRatio:e=>{_.value=e},loadFile:de,open:e=>{e&&(m.value=e),v.value=!0},close:()=>{v.value=!1}}),(t,n)=>d.modal?(h(),i(y(T),{key:0,show:v.value,"onUpdate:show":n[0]||=e=>v.value=e,preset:`card`,title:d.modalTitle||`图片裁剪`,style:{width:`860px`},"mask-closable":!1,closable:!0},{footer:x(()=>[l(y(ee),{justify:`end`},{default:x(()=>[l(y(S),{disabled:C.value,onClick:ue},{default:x(()=>[...n[2]||=[c(`取消`,-1)]]),_:1},8,[`disabled`]),l(y(S),{type:`primary`,loading:C.value,disabled:d.disabled||w.value||!E.value,onClick:le},{default:x(()=>[...n[3]||=[c(`确认裁剪`,-1)]]),_:1},8,[`loading`,`disabled`])]),_:1})]),default:x(()=>[s(`div`,B,[d.showToolbar?(h(),i(A,{key:0,"current-ratio":_.value,"ratio-presets":H,disabled:d.disabled||w.value||C.value||!E.value,onRatio:q,onRotate:K,onFlipX:Z,onFlipY:Q,onZoom:y(U).zoom,onReset:J},null,8,[`current-ratio`,`disabled`,`onZoom`])):a(`v-if`,!0),s(`div`,te,[s(`div`,{class:`c-image-cropper__canvas`,style:f({height:P.value})},[m.value?(h(),i(y(D),{key:0,ref_key:`modalCropperRef`,ref:M,img:m.value,"output-size":d.outputQuality,"output-type":F.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":V.value.width,"auto-crop-height":V.value.height,fixed:I.value,"fixed-number":L.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!d.disabled&&!C.value&&!w.value,"can-move-box":!d.disabled&&!C.value&&!w.value,"fixed-box":d.disabled||C.value||w.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:W,onImgLoad:G},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):(h(),o(`div`,ne,[l(e,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),n[1]||=s(`span`,null,`请选择图片`,-1)]))],4),d.showPreview&&m.value?(h(),o(`div`,re,[l(R,{"preview-data":k.value,circular:d.circular},null,8,[`preview-data`,`circular`])])):a(`v-if`,!0)])])]),_:1},8,[`show`,`title`])):(h(),o(`div`,ie,[s(`div`,ae,[d.showToolbar?(h(),i(A,{key:0,"current-ratio":_.value,"ratio-presets":H,disabled:d.disabled||w.value||C.value||!E.value,onRatio:q,onRotate:K,onFlipX:Z,onFlipY:Q,onZoom:y(U).zoom,onReset:J},null,8,[`current-ratio`,`disabled`,`onZoom`])):a(`v-if`,!0),s(`div`,oe,[s(`div`,{class:`c-image-cropper__canvas`,style:f({height:P.value})},[m.value?(h(),i(y(D),{key:0,ref_key:`inlineCropperRef`,ref:j,img:m.value,"output-size":d.outputQuality,"output-type":F.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":V.value.width,"auto-crop-height":V.value.height,fixed:I.value,"fixed-number":L.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!d.disabled&&!C.value&&!w.value,"can-move-box":!d.disabled&&!C.value&&!w.value,"fixed-box":d.disabled||C.value||w.value,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:W,onImgLoad:G},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`,`can-move`,`can-move-box`,`fixed-box`])):(h(),o(`div`,se,[l(e,{name:`mdi:image-plus-outline`,style:{"font-size":`48px`,opacity:`0.3`}}),n[4]||=s(`span`,null,`请选择图片`,-1)]))],4),d.showPreview&&m.value?(h(),o(`div`,ce,[l(R,{"preview-data":k.value,circular:d.circular},null,8,[`preview-data`,`circular`])])):a(`v-if`,!0)])])]))}}),[[`__scopeId`,`data-v-b3645c9b`]]);export{O as n,V as t};
|
package/dist/C_Language.css
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
/* unplugin-vue-components disabled */.c-icon[data-v-
|
|
1
|
+
/* unplugin-vue-components disabled */.c-icon[data-v-075758a0] {
|
|
2
2
|
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
+
position: relative;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
vertical-align: middle;
|
|
5
8
|
user-select: none;
|
|
6
9
|
transition: all 0.2s ease-in-out;
|
|
7
10
|
}
|
|
8
|
-
.c-icon--clickable[data-v-
|
|
11
|
+
.c-icon--clickable[data-v-075758a0] {
|
|
9
12
|
cursor: pointer;
|
|
10
13
|
}
|
|
11
|
-
.c-icon--clickable[data-v-
|
|
14
|
+
.c-icon--clickable[data-v-075758a0]:hover {
|
|
12
15
|
opacity: 0.8;
|
|
13
16
|
transform: scale(1.05);
|
|
14
17
|
}
|
|
15
|
-
.c-icon--clickable[data-v-
|
|
18
|
+
.c-icon--clickable[data-v-075758a0]:active {
|
|
16
19
|
transform: scale(0.95);
|
|
17
20
|
}
|
|
18
|
-
.c-icon--clickable[data-v-
|
|
21
|
+
.c-icon--clickable[data-v-075758a0]:focus-visible {
|
|
19
22
|
outline: 2px solid currentColor;
|
|
20
23
|
outline-offset: 2px;
|
|
21
24
|
border-radius: 4px;
|
|
22
25
|
}
|
|
23
|
-
.c-icon--loading[data-v-
|
|
26
|
+
.c-icon--loading[data-v-075758a0] {
|
|
24
27
|
opacity: 0.6;
|
|
25
28
|
cursor: wait;
|
|
26
29
|
}
|
|
27
|
-
.c-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.c-icon__loading[data-v-711aedcd] {
|
|
31
|
-
position: relative;
|
|
30
|
+
.c-icon__loading[data-v-075758a0] {
|
|
31
|
+
position: absolute;
|
|
32
|
+
inset: 0;
|
|
32
33
|
}
|
|
33
|
-
.c-icon__spinner[data-v-
|
|
34
|
+
.c-icon__spinner[data-v-075758a0] {
|
|
34
35
|
width: 100%;
|
|
35
36
|
height: 100%;
|
|
36
37
|
border: 2px solid currentColor;
|
|
37
38
|
border-radius: 50%;
|
|
38
39
|
border-top-color: transparent;
|
|
39
|
-
animation: spin-
|
|
40
|
+
animation: spin-075758a0 1s linear infinite;
|
|
40
41
|
}
|
|
41
|
-
.c-icon__error[data-v-
|
|
42
|
+
.c-icon__error[data-v-075758a0] {
|
|
42
43
|
font-size: 0.8em;
|
|
43
44
|
opacity: 0.5;
|
|
44
45
|
}
|
|
45
|
-
.c-icon__rotatable[data-v-
|
|
46
|
+
.c-icon__rotatable[data-v-075758a0] {
|
|
46
47
|
transition: transform 0.3s ease-in-out;
|
|
47
48
|
}
|
|
48
|
-
.c-icon__flippable[data-v-
|
|
49
|
+
.c-icon__flippable[data-v-075758a0] {
|
|
49
50
|
transition: transform 0.3s ease-in-out;
|
|
50
51
|
}
|
|
51
|
-
@keyframes spin-
|
|
52
|
+
@keyframes spin-075758a0 {
|
|
52
53
|
0% {
|
|
53
54
|
transform: rotate(0deg);
|
|
54
55
|
}
|
|
@@ -56,3 +57,15 @@
|
|
|
56
57
|
transform: rotate(360deg);
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
/* unplugin-vue-components disabled */
|
|
61
|
+
/* layer: default */
|
|
62
|
+
.inline-flex[data-v-075758a0]{display:inline-flex;}
|
|
63
|
+
.transform[data-v-075758a0]{transform:translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotateZ(var(--un-rotate-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z));}
|
|
64
|
+
.px[data-v-075758a0]{padding-left:1rem;padding-right:1rem;}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
/* unplugin-vue-components disabled */
|
|
68
|
+
/* layer: default */
|
|
69
|
+
.flex[data-v-423b9151]{display:flex;}
|
|
70
|
+
.items-center[data-v-423b9151]{align-items:center;}
|
|
71
|
+
|
package/dist/C_Language2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`);let
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`);const i={class:`flex items-center`},a=(0,n.defineComponent)({name:`C_Language`,__name:`index`,props:{modelValue:{default:`zh-cn`},options:{default:()=>[{key:`zh-cn`,label:`简体中文`,iconClass:`mdi:alpha-c`},{key:`en`,label:`English`,iconClass:`mdi:alpha-u`},{key:`ja`,label:`日本語`,iconClass:`mdi:alpha-j`},{key:`ko`,label:`한국어`,iconClass:`mdi:alpha-k`}]},tooltip:{default:`语言切换`}},emits:[`update:modelValue`,`change`],setup(t,{emit:a}){let o=t,s=a,c=(0,n.computed)(()=>o.options.find(e=>e.key===o.modelValue)?.label??o.modelValue),l=(0,n.computed)(()=>`${o.tooltip} (${c.value})`),u=(0,n.computed)(()=>o.options.map(t=>{let r=t.iconClass;return{key:t.key,label:t.label,icon:r?()=>(0,n.h)(e.t,{name:r,size:16}):void 0}})),d=e=>{e!==o.modelValue&&(s(`update:modelValue`,e),s(`change`,e))};return(a,o)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.NDropdown),{size:`small`,trigger:`hover`,options:u.value,value:t.modelValue,onSelect:d},{default:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.NButton),{text:``},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`div`,i,[(0,n.createVNode)(e.t,{name:`mdi:language`,size:18,title:l.value},null,8,[`title`])])]),_:1})]),_:1},8,[`options`,`value`]))}});var o=t.t(a,[[`__scopeId`,`data-v-423b9151`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
package/dist/C_Language2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./C_Icon2.js";import{computed as
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{computed as n,createBlock as r,createElementVNode as i,createVNode as a,defineComponent as o,h as s,openBlock as c,unref as l,withCtx as u}from"vue";import{NButton as d,NDropdown as f}from"naive-ui";const p={class:`flex items-center`};var m=t(o({name:`C_Language`,__name:`index`,props:{modelValue:{default:`zh-cn`},options:{default:()=>[{key:`zh-cn`,label:`简体中文`,iconClass:`mdi:alpha-c`},{key:`en`,label:`English`,iconClass:`mdi:alpha-u`},{key:`ja`,label:`日本語`,iconClass:`mdi:alpha-j`},{key:`ko`,label:`한국어`,iconClass:`mdi:alpha-k`}]},tooltip:{default:`语言切换`}},emits:[`update:modelValue`,`change`],setup(t,{emit:o}){let m=t,h=o,g=n(()=>m.options.find(e=>e.key===m.modelValue)?.label??m.modelValue),_=n(()=>`${m.tooltip} (${g.value})`),v=n(()=>m.options.map(t=>{let n=t.iconClass;return{key:t.key,label:t.label,icon:n?()=>s(e,{name:n,size:16}):void 0}})),y=e=>{e!==m.modelValue&&(h(`update:modelValue`,e),h(`change`,e))};return(n,o)=>(c(),r(l(f),{size:`small`,trigger:`hover`,options:v.value,value:t.modelValue,onSelect:y},{default:u(()=>[a(l(d),{text:``},{default:u(()=>[i(`div`,p,[a(e,{name:`mdi:language`,size:18,title:_.value},null,8,[`title`])])]),_:1})]),_:1},8,[`options`,`value`]))}}),[[`__scopeId`,`data-v-423b9151`]]);export{m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./C_Loading2.cjs`);exports.C_Loading=e.t;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* unplugin-vue-components disabled *//*
|
|
2
|
+
* @Author: ChenYu ycyplus@gmail.com
|
|
3
|
+
* @Date: 2026-10-06
|
|
4
|
+
* @FilePath: \naive-ui-components\src\components\C_Loading\index.scss
|
|
5
|
+
* @Description: 机器人扫描与数据流动画,仅在组件挂载时运行
|
|
6
|
+
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
7
|
+
*/
|
|
8
|
+
.c-loading[data-v-48232aaa] {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
gap: 6px;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
line-height: 1;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
.c-loading--labeled[data-v-48232aaa] {
|
|
19
|
+
flex-direction: row;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
padding: 8px 14px;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
border: 1px solid var(--c-loading-border);
|
|
25
|
+
border-radius: 14px;
|
|
26
|
+
background: var(--c-loading-surface);
|
|
27
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
|
|
28
|
+
}
|
|
29
|
+
.c-loading__glyph[data-v-48232aaa] {
|
|
30
|
+
width: var(--c-loading-size, 48px);
|
|
31
|
+
height: var(--c-loading-size, 48px);
|
|
32
|
+
flex-shrink: 0;
|
|
33
|
+
overflow: visible;
|
|
34
|
+
}
|
|
35
|
+
.c-loading__frame[data-v-48232aaa] {
|
|
36
|
+
opacity: 0.35;
|
|
37
|
+
animation: c-loading-frame-48232aaa 2.4s ease-in-out infinite;
|
|
38
|
+
}
|
|
39
|
+
.c-loading__scan[data-v-48232aaa] {
|
|
40
|
+
opacity: 0;
|
|
41
|
+
animation: c-loading-scan-48232aaa 2.4s ease-in-out infinite;
|
|
42
|
+
}
|
|
43
|
+
.c-loading__eyes[data-v-48232aaa] {
|
|
44
|
+
transform-box: fill-box;
|
|
45
|
+
transform-origin: center;
|
|
46
|
+
animation: c-loading-eyes-48232aaa 3.6s ease-in-out infinite;
|
|
47
|
+
}
|
|
48
|
+
.c-loading__packet[data-v-48232aaa] {
|
|
49
|
+
opacity: 0.25;
|
|
50
|
+
animation: c-loading-data-48232aaa 2.4s ease-in-out infinite;
|
|
51
|
+
}
|
|
52
|
+
.c-loading__packet--out[data-v-48232aaa] {
|
|
53
|
+
animation-delay: 0.8s;
|
|
54
|
+
}
|
|
55
|
+
.c-loading__label[data-v-48232aaa] {
|
|
56
|
+
color: var(--c-loading-text, currentColor);
|
|
57
|
+
font-size: 12px;
|
|
58
|
+
font-weight: 500;
|
|
59
|
+
letter-spacing: 0.03em;
|
|
60
|
+
line-height: 1.6;
|
|
61
|
+
}
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
.c-loading__frame[data-v-48232aaa], .c-loading__scan[data-v-48232aaa], .c-loading__eyes[data-v-48232aaa], .c-loading__packet[data-v-48232aaa] {
|
|
64
|
+
animation: none;
|
|
65
|
+
}
|
|
66
|
+
.c-loading__scan[data-v-48232aaa] {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
.c-loading__frame[data-v-48232aaa], .c-loading__packet[data-v-48232aaa] {
|
|
70
|
+
opacity: 0.55;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
@keyframes c-loading-scan-48232aaa {
|
|
74
|
+
0%, 12% {
|
|
75
|
+
transform: translateY(0);
|
|
76
|
+
opacity: 0;
|
|
77
|
+
}
|
|
78
|
+
25% {
|
|
79
|
+
opacity: 0.2;
|
|
80
|
+
}
|
|
81
|
+
70% {
|
|
82
|
+
transform: translateY(14px);
|
|
83
|
+
opacity: 0.2;
|
|
84
|
+
}
|
|
85
|
+
88%, 100% {
|
|
86
|
+
transform: translateY(14px);
|
|
87
|
+
opacity: 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
@keyframes c-loading-frame-48232aaa {
|
|
91
|
+
0%, 100% {
|
|
92
|
+
opacity: 0.25;
|
|
93
|
+
}
|
|
94
|
+
50% {
|
|
95
|
+
opacity: 0.7;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
@keyframes c-loading-eyes-48232aaa {
|
|
99
|
+
0%, 72%, 82%, 100% {
|
|
100
|
+
transform: scaleY(1);
|
|
101
|
+
}
|
|
102
|
+
77% {
|
|
103
|
+
transform: scaleY(0.25);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
@keyframes c-loading-data-48232aaa {
|
|
107
|
+
0%, 100% {
|
|
108
|
+
opacity: 0.2;
|
|
109
|
+
}
|
|
110
|
+
40%, 60% {
|
|
111
|
+
opacity: 0.85;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/* unplugin-vue-components disabled */
|
|
115
|
+
/* layer: default */
|
|
116
|
+
.table[data-v-48232aaa]{display:table;}
|
|
117
|
+
.px[data-v-48232aaa]{padding-left:1rem;padding-right:1rem;}
|
|
118
|
+
.filter[data-v-48232aaa]{filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia);}
|
|
119
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./C_Loading2.js";export{e as C_Loading};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./config.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`);const i=[`aria-label`],a={key:0,class:`c-loading__label`},o=(0,n.defineComponent)({name:`C_Loading`,__name:`index`,props:{size:{default:48},label:{default:``},color:{}},setup(t){let o=t,s=(0,r.useThemeVars)(),{t:c}=e.i(),l=(0,n.computed)(()=>Number.isFinite(o.size)?Math.min(120,Math.max(16,o.size)):48);return(e,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`span`,{class:(0,n.normalizeClass)([`c-loading`,{"c-loading--labeled":!!t.label}]),role:`status`,"aria-label":t.label||(0,n.unref)(c)(`common.loading`),style:(0,n.normalizeStyle)({"--c-loading-size":`${l.value}px`,"--c-loading-surface":(0,n.unref)(s).cardColor,"--c-loading-border":(0,n.unref)(s).dividerColor,"--c-loading-text":(0,n.unref)(s).textColor2,color:t.color||(0,n.unref)(s).primaryColor})},[r[0]||=(0,n.createElementVNode)(`svg`,{class:`c-loading__glyph`,viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`,focusable:`false`},[(0,n.createElementVNode)(`rect`,{x:`10`,y:`10`,width:`44`,height:`44`,rx:`14`,fill:`currentColor`,opacity:`.045`}),(0,n.createElementVNode)(`path`,{class:`c-loading__frame`,d:`M13 21v-4a4 4 0 0 1 4-4h4m22 0h4a4 4 0 0 1 4 4v4m0 22v4a4 4 0 0 1-4 4h-4m-22 0h-4a4 4 0 0 1-4-4v-4`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),(0,n.createElementVNode)(`rect`,{x:`20`,y:`22`,width:`24`,height:`21`,rx:`6`,fill:`currentColor`,"fill-opacity":`.08`,stroke:`currentColor`,"stroke-width":`1.7`}),(0,n.createElementVNode)(`path`,{d:`M32 17v5M24 47h16`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,opacity:`.65`}),(0,n.createElementVNode)(`circle`,{cx:`32`,cy:`15`,r:`2`,fill:`currentColor`}),(0,n.createElementVNode)(`g`,{class:`c-loading__eyes`,fill:`currentColor`},[(0,n.createElementVNode)(`rect`,{x:`25.5`,y:`29`,width:`3`,height:`4`,rx:`1.5`}),(0,n.createElementVNode)(`rect`,{x:`35.5`,y:`29`,width:`3`,height:`4`,rx:`1.5`})]),(0,n.createElementVNode)(`path`,{d:`M28 37h8`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,opacity:`.65`}),(0,n.createElementVNode)(`rect`,{class:`c-loading__scan`,x:`23`,y:`25`,width:`18`,height:`2`,rx:`1`,fill:`currentColor`}),(0,n.createElementVNode)(`path`,{class:`c-loading__packet c-loading__packet--in`,d:`M9 30h4m-4 4h7`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),(0,n.createElementVNode)(`path`,{class:`c-loading__packet c-loading__packet--out`,d:`M48 30h7m-4 4h4`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`})],-1),t.label?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,a,(0,n.toDisplayString)(t.label),1)):(0,n.createCommentVNode)(`v-if`,!0)],14,i))}});var s=t.t(o,[[`__scopeId`,`data-v-48232aaa`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./config.js";import{t}from"./export-helper.js";import{computed as n,createCommentVNode as r,createElementBlock as i,createElementVNode as a,defineComponent as o,normalizeClass as s,normalizeStyle as c,openBlock as l,toDisplayString as u,unref as d}from"vue";import{useThemeVars as f}from"naive-ui";const p=[`aria-label`],m={key:0,class:`c-loading__label`};var h=t(o({name:`C_Loading`,__name:`index`,props:{size:{default:48},label:{default:``},color:{}},setup(t){let o=t,h=f(),{t:g}=e(),_=n(()=>Number.isFinite(o.size)?Math.min(120,Math.max(16,o.size)):48);return(e,n)=>(l(),i(`span`,{class:s([`c-loading`,{"c-loading--labeled":!!t.label}]),role:`status`,"aria-label":t.label||d(g)(`common.loading`),style:c({"--c-loading-size":`${_.value}px`,"--c-loading-surface":d(h).cardColor,"--c-loading-border":d(h).dividerColor,"--c-loading-text":d(h).textColor2,color:t.color||d(h).primaryColor})},[n[0]||=a(`svg`,{class:`c-loading__glyph`,viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`,focusable:`false`},[a(`rect`,{x:`10`,y:`10`,width:`44`,height:`44`,rx:`14`,fill:`currentColor`,opacity:`.045`}),a(`path`,{class:`c-loading__frame`,d:`M13 21v-4a4 4 0 0 1 4-4h4m22 0h4a4 4 0 0 1 4 4v4m0 22v4a4 4 0 0 1-4 4h-4m-22 0h-4a4 4 0 0 1-4-4v-4`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),a(`rect`,{x:`20`,y:`22`,width:`24`,height:`21`,rx:`6`,fill:`currentColor`,"fill-opacity":`.08`,stroke:`currentColor`,"stroke-width":`1.7`}),a(`path`,{d:`M32 17v5M24 47h16`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,opacity:`.65`}),a(`circle`,{cx:`32`,cy:`15`,r:`2`,fill:`currentColor`}),a(`g`,{class:`c-loading__eyes`,fill:`currentColor`},[a(`rect`,{x:`25.5`,y:`29`,width:`3`,height:`4`,rx:`1.5`}),a(`rect`,{x:`35.5`,y:`29`,width:`3`,height:`4`,rx:`1.5`})]),a(`path`,{d:`M28 37h8`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,opacity:`.65`}),a(`rect`,{class:`c-loading__scan`,x:`23`,y:`25`,width:`18`,height:`2`,rx:`1`,fill:`currentColor`}),a(`path`,{class:`c-loading__packet c-loading__packet--in`,d:`M9 30h4m-4 4h7`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),a(`path`,{class:`c-loading__packet c-loading__packet--out`,d:`M48 30h7m-4 4h4`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`})],-1),t.label?(l(),i(`span`,m,u(t.label),1)):r(`v-if`,!0)],14,p))}}),[[`__scopeId`,`data-v-48232aaa`]]);export{h as t};
|