@robot-admin/naive-ui-components 0.11.8 → 0.13.0
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 +26 -0
- package/README.md +172 -29
- package/README_EN.md +171 -28
- package/SECURITY.md +1 -0
- package/dist/C_ActionBar.cjs +1 -1
- package/dist/C_ActionBar.css +67 -67
- package/dist/C_ActionBar.d.cts +2 -2
- package/dist/C_ActionBar.d.ts +2 -2
- package/dist/C_ActionBar.js +1 -1
- package/dist/C_ActionBar2.cjs +1 -1
- package/dist/C_ActionBar2.js +1 -1
- package/dist/C_AntV.css +70 -70
- package/dist/C_AntV2.cjs +3 -3
- package/dist/C_AntV2.js +3 -3
- package/dist/C_AudioPlayer.css +81 -66
- package/dist/C_AudioPlayer.d.cts +1 -1
- package/dist/C_AudioPlayer.d.ts +1 -1
- package/dist/C_AudioPlayer2.cjs +1 -1
- package/dist/C_AudioPlayer2.js +1 -1
- package/dist/C_AvatarGroup.css +40 -25
- package/dist/C_AvatarGroup.d.cts +1 -1
- package/dist/C_AvatarGroup.d.ts +1 -1
- package/dist/C_AvatarGroup2.cjs +1 -1
- package/dist/C_AvatarGroup2.js +1 -1
- package/dist/C_Barcode.css +6 -6
- package/dist/C_Barcode.d.cts +1 -1
- package/dist/C_Barcode.d.ts +1 -1
- package/dist/C_Barcode2.cjs +1 -1
- package/dist/C_Barcode2.js +1 -1
- package/dist/C_Breadcrumb.css +14 -14
- package/dist/C_Breadcrumb.d.cts +1 -1
- package/dist/C_Breadcrumb.d.ts +1 -1
- package/dist/C_Breadcrumb2.cjs +1 -1
- package/dist/C_Breadcrumb2.js +1 -1
- package/dist/C_Captcha.cjs +1 -1
- package/dist/C_Captcha.css +193 -51
- package/dist/C_Captcha.d.cts +2 -3
- package/dist/C_Captcha.d.ts +2 -3
- package/dist/C_Captcha.js +1 -1
- package/dist/C_Captcha2.cjs +1 -1
- package/dist/C_Captcha2.js +1 -1
- package/dist/C_Cascade.css +2 -2
- package/dist/C_Cascade.d.cts +1 -1
- package/dist/C_Cascade.d.ts +1 -1
- package/dist/C_Cascade2.cjs +1 -1
- package/dist/C_Cascade2.js +1 -1
- package/dist/C_Chat.css +96 -78
- package/dist/C_Chat.d.cts +1 -1
- package/dist/C_Chat.d.ts +1 -1
- package/dist/C_Chat2.cjs +1 -1
- package/dist/C_Chat2.js +1 -1
- package/dist/C_City.css +52 -28
- package/dist/C_City.d.cts +1 -1
- package/dist/C_City.d.ts +1 -1
- package/dist/C_City2.cjs +1 -1
- package/dist/C_City2.js +1 -1
- package/dist/C_Code.css +48 -42
- package/dist/C_Code.d.cts +1 -1
- package/dist/C_Code.d.ts +1 -1
- package/dist/C_Code2.cjs +1 -1
- package/dist/C_Code2.js +1 -1
- package/dist/C_CollapsePanel.css +14 -14
- package/dist/C_CollapsePanel2.cjs +1 -1
- package/dist/C_CollapsePanel2.js +1 -1
- package/dist/C_ContextMenu.css +14 -14
- package/dist/C_ContextMenu.d.cts +1 -1
- package/dist/C_ContextMenu.d.ts +1 -1
- package/dist/C_ContextMenu2.cjs +1 -1
- package/dist/C_ContextMenu2.js +1 -1
- package/dist/C_Cron.css +94 -55
- package/dist/C_Cron2.cjs +1 -1
- package/dist/C_Cron2.js +1 -1
- package/dist/C_Date.d.cts +1 -1
- package/dist/C_Date.d.ts +1 -1
- package/dist/C_Date2.cjs +1 -1
- package/dist/C_Date2.js +1 -1
- package/dist/C_Draggable.css +48 -48
- package/dist/C_Draggable2.cjs +1 -1
- package/dist/C_Draggable2.js +1 -1
- package/dist/C_Editor.css +13 -14
- package/dist/C_Editor.d.cts +1 -1
- package/dist/C_Editor.d.ts +1 -1
- package/dist/C_Editor2.cjs +1 -1
- package/dist/C_Editor2.js +1 -1
- package/dist/C_FilePreview.css +18 -18
- package/dist/C_FilePreview2.cjs +1 -1
- package/dist/C_FilePreview2.js +1 -1
- package/dist/C_Form.base.css +36 -36
- package/dist/C_Form.css +49 -50
- package/dist/C_Form2.cjs +1 -1
- package/dist/C_Form2.js +1 -1
- package/dist/C_FormModal.cjs +1 -0
- package/dist/C_FormModal.css +41 -0
- package/dist/C_FormModal.d.cts +2 -0
- package/dist/C_FormModal.d.ts +3 -0
- package/dist/C_FormModal.js +1 -0
- package/dist/C_FormModal2.cjs +1 -0
- package/dist/C_FormModal2.js +1 -0
- package/dist/C_FormSearch.css +45 -45
- package/dist/C_FormSearch2.cjs +1 -1
- package/dist/C_FormSearch2.js +1 -1
- package/dist/C_FormulaEditor.css +94 -55
- package/dist/C_FormulaEditor2.cjs +2 -2
- package/dist/C_FormulaEditor2.js +2 -2
- package/dist/C_FullCalendar.css +8 -1
- package/dist/C_FullCalendar2.cjs +1 -1
- package/dist/C_FullCalendar2.js +1 -1
- package/dist/C_GlobalSearch2.cjs +1 -1
- package/dist/C_GlobalSearch2.js +1 -1
- package/dist/C_Guide.css +14 -14
- package/dist/C_Guide2.cjs +1 -1
- package/dist/C_Guide2.js +1 -1
- package/dist/C_Icon.css +14 -14
- package/dist/C_Icon2.cjs +1 -1
- package/dist/C_Icon2.js +1 -1
- package/dist/C_ImageCropper.css +22 -22
- package/dist/C_ImageCropper2.cjs +1 -1
- package/dist/C_ImageCropper2.js +1 -1
- package/dist/C_Language.css +14 -14
- package/dist/C_Language2.cjs +1 -1
- package/dist/C_Language2.js +1 -1
- package/dist/C_Login.css +232 -149
- package/dist/C_Login2.cjs +1 -1
- package/dist/C_Login2.js +1 -1
- package/dist/C_Map.css +3 -3
- package/dist/C_Map2.cjs +1 -1
- package/dist/C_Map2.js +1 -1
- package/dist/C_Markdown.css +35 -35
- package/dist/C_Markdown2.cjs +1 -1
- package/dist/C_Markdown2.js +1 -1
- package/dist/C_Menu.d.cts +1 -1
- package/dist/C_Menu2.cjs +1 -1
- package/dist/C_Menu2.js +1 -1
- package/dist/C_NotificationCenter.css +30 -30
- package/dist/C_NotificationCenter2.cjs +1 -1
- package/dist/C_NotificationCenter2.js +1 -1
- package/dist/C_OrgChart.css +4 -0
- package/dist/C_OrgChart2.cjs +1 -1
- package/dist/C_OrgChart2.js +1 -1
- package/dist/C_Progress2.cjs +1 -1
- package/dist/C_Progress2.js +1 -1
- package/dist/C_QRCode.css +8 -8
- package/dist/C_QRCode2.cjs +1 -1
- package/dist/C_QRCode2.js +1 -1
- package/dist/C_Signature.css +14 -14
- package/dist/C_Signature2.cjs +1 -1
- package/dist/C_Signature2.js +1 -1
- package/dist/C_Skeleton2.cjs +1 -1
- package/dist/C_Skeleton2.js +1 -1
- package/dist/C_SplitPane.css +39 -39
- package/dist/C_SplitPane2.cjs +1 -1
- package/dist/C_SplitPane2.js +1 -1
- package/dist/C_Steps.css +48 -38
- package/dist/C_Steps2.cjs +1 -1
- package/dist/C_Steps2.js +1 -1
- package/dist/C_Table.base.css +160 -160
- package/dist/C_Table.cjs +1 -1
- package/dist/C_Table.css +173 -174
- package/dist/C_Table.d.ts +4 -3
- package/dist/C_Table.js +1 -1
- package/dist/C_Tabs.cjs +1 -0
- package/dist/C_Tabs.css +1 -0
- package/dist/C_Tabs.d.cts +2 -0
- package/dist/C_Tabs.d.ts +2 -0
- package/dist/C_Tabs.js +1 -0
- package/dist/C_TagsView.css +52 -52
- package/dist/C_TagsView2.cjs +1 -1
- package/dist/C_TagsView2.js +1 -1
- package/dist/C_Theme.css +14 -14
- package/dist/C_Theme2.cjs +1 -1
- package/dist/C_Theme2.js +1 -1
- package/dist/C_Time.css +4 -4
- package/dist/C_Time2.cjs +1 -1
- package/dist/C_Time2.js +1 -1
- package/dist/C_Timeline.css +76 -58
- package/dist/C_Timeline2.cjs +1 -1
- package/dist/C_Timeline2.js +1 -1
- package/dist/C_Transfer.css +51 -51
- package/dist/C_Transfer2.cjs +1 -1
- package/dist/C_Transfer2.js +1 -1
- package/dist/C_Tree.css +35 -32
- package/dist/C_Tree2.cjs +1 -1
- package/dist/C_Tree2.js +1 -1
- package/dist/C_Upload.css +53 -50
- package/dist/C_Upload2.cjs +1 -1
- package/dist/C_Upload2.js +1 -1
- package/dist/C_VideoPlayer.css +17 -13
- package/dist/C_VideoPlayer2.cjs +2 -2
- package/dist/C_VideoPlayer2.js +2 -2
- package/dist/C_VtableGantt.css +19 -19
- package/dist/C_VtableGantt2.cjs +1 -1
- package/dist/C_VtableGantt2.js +1 -1
- package/dist/C_WaterFall.css +19 -15
- package/dist/C_WaterFall2.cjs +1 -1
- package/dist/C_WaterFall2.js +1 -1
- package/dist/C_WorkFlow.css +123 -123
- package/dist/C_WorkFlow2.cjs +1 -1
- package/dist/C_WorkFlow2.js +1 -1
- package/dist/constants.d.cts +2 -2
- package/dist/constants.d.ts +2 -2
- package/dist/constants2.d.cts +3 -3
- package/dist/constants2.d.ts +3 -3
- package/dist/constants3.d.cts +8 -4
- package/dist/constants3.d.ts +8 -4
- 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 +108 -0
- package/dist/data.d.ts +108 -0
- package/dist/data2.cjs +1 -0
- package/dist/data2.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +49 -49
- package/dist/index.d.ts +51 -49
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +74 -69
- package/dist/index.vue.d.ts +74 -69
- package/dist/index10.vue.d.cts +80 -39
- package/dist/index10.vue.d.ts +68 -77
- package/dist/index11.vue.d.cts +68 -77
- package/dist/index11.vue.d.ts +54 -69
- package/dist/index12.vue.d.cts +54 -69
- package/dist/index12.vue.d.ts +52 -58
- package/dist/index13.vue.d.cts +52 -58
- package/dist/index13.vue.d.ts +1 -1
- package/dist/index14.vue.d.cts +1 -1
- package/dist/index14.vue.d.ts +14 -47
- package/dist/index15.vue.d.cts +14 -47
- package/dist/index16.vue.d.ts +15 -12
- package/dist/index17.vue.d.cts +15 -12
- package/dist/index17.vue.d.ts +4 -4
- package/dist/index18.vue.d.cts +4 -4
- package/dist/index18.vue.d.ts +2 -2
- package/dist/index19.vue.d.cts +1 -1
- package/dist/index19.vue.d.ts +1 -1
- package/dist/index2.vue.d.cts +70 -65
- package/dist/index2.vue.d.ts +70 -65
- package/dist/index20.vue.d.cts +1 -1
- package/dist/index20.vue.d.ts +1 -1
- package/dist/index24.vue.d.cts +3 -3
- package/dist/index24.vue.d.ts +3 -3
- package/dist/index25.vue.d.cts +1 -1
- package/dist/index25.vue.d.ts +1 -1
- package/dist/index26.vue.d.cts +5 -5
- package/dist/index26.vue.d.ts +5 -5
- package/dist/index27.vue.d.cts +1 -1
- package/dist/index27.vue.d.ts +1 -1
- package/dist/index3.vue.d.cts +30 -80
- package/dist/index3.vue.d.ts +30 -80
- package/dist/index4.vue.d.cts +130 -30
- package/dist/index4.vue.d.ts +22 -30
- package/dist/index5.vue.d.cts +18 -126
- package/dist/index5.vue.d.ts +22 -19
- package/dist/index6.vue.d.cts +22 -19
- package/dist/index6.vue.d.ts +117 -22
- package/dist/index7.vue.d.cts +117 -22
- package/dist/index7.vue.d.ts +17 -110
- package/dist/index8.vue.d.cts +17 -110
- package/dist/index8.vue.d.ts +37 -24
- package/dist/index9.vue.d.cts +37 -24
- package/dist/index9.vue.d.ts +80 -39
- package/dist/mapUtils.d.cts +2 -2
- package/dist/mapUtils.d.ts +2 -2
- package/dist/presets.d.cts +96 -0
- package/dist/presets.d.ts +96 -0
- 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 +1735 -1400
- package/dist/useCalendarEvents.d.cts +23 -18
- package/dist/useCalendarEvents.d.ts +23 -18
- package/dist/useCollapsePanel.d.cts +4 -3
- package/dist/useCollapsePanel.d.ts +4 -3
- package/dist/useCropperCore.d.cts +32 -17
- package/dist/useCropperCore.d.ts +32 -17
- package/dist/useDraggableLayout.d.cts +2 -2
- package/dist/useDraggableLayout.d.ts +2 -2
- package/dist/useDynamicFormState.d.cts +7 -2
- package/dist/useDynamicFormState.d.ts +7 -2
- package/dist/useEdgeInteraction.d.cts +20 -19
- package/dist/useEdgeInteraction.d.ts +20 -19
- package/dist/useFullscreen.d.cts +6 -6
- package/dist/useFullscreen.d.ts +6 -6
- package/dist/useInfiniteScroll.d.cts +1 -1
- package/dist/useInfiniteScroll.d.ts +1 -1
- package/dist/useQRCode.d.cts +5 -4
- package/dist/useQRCode.d.ts +5 -4
- package/dist/useSearchState.d.cts +9 -9
- package/dist/useSearchState.d.ts +9 -9
- package/dist/useSignatureHistory.d.cts +18 -10
- package/dist/useSignatureHistory.d.ts +18 -10
- package/dist/useSplitResize.d.cts +7 -7
- package/dist/useSplitResize.d.ts +7 -7
- package/dist/useTableQuery.cjs +3 -3
- package/dist/useTableQuery.d.cts +12 -5
- package/dist/useTableQuery.d.ts +12 -5
- package/dist/useTableQuery.js +3 -3
- package/dist/useTimeSelection.d.cts +6 -3
- package/dist/useTimeSelection.d.ts +6 -3
- package/dist/useTreeOperations.d.cts +8 -8
- package/dist/useTreeOperations.d.ts +8 -8
- package/dist/useWorkflowValidation.d.cts +6 -4
- package/dist/useWorkflowValidation.d.ts +6 -4
- package/dist/verification.d.cts +71 -6
- package/dist/verification.d.ts +71 -6
- package/package.json +5 -3
- package/dist/types.d.ts +0 -58
- package/dist/types2.d.cts +0 -58
package/dist/C_ImageCropper.css
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/* unplugin-vue-components disabled */.cropper-toolbar[data-v-
|
|
1
|
+
/* unplugin-vue-components disabled */.cropper-toolbar[data-v-eb7204dc] {
|
|
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 */.cropper-preview[data-v-
|
|
8
|
+
/* unplugin-vue-components disabled */.cropper-preview[data-v-c8968d14] {
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
gap: 16px;
|
|
12
12
|
}
|
|
13
|
-
.cropper-preview .preview-label[data-v-
|
|
13
|
+
.cropper-preview .preview-label[data-v-c8968d14] {
|
|
14
14
|
display: flex;
|
|
15
15
|
gap: 6px;
|
|
16
16
|
align-items: center;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
font-weight: 500;
|
|
19
19
|
color: var(--text-color-2);
|
|
20
20
|
}
|
|
21
|
-
.cropper-preview .preview-main[data-v-
|
|
21
|
+
.cropper-preview .preview-main[data-v-c8968d14] {
|
|
22
22
|
width: 100%;
|
|
23
23
|
overflow: hidden;
|
|
24
24
|
border: 1px solid var(--border-color);
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
background-position: 0 0, 0 8px, 8px -8px, -8px 0;
|
|
28
28
|
background-size: 16px 16px;
|
|
29
29
|
}
|
|
30
|
-
.cropper-preview .preview-main--circular[data-v-
|
|
30
|
+
.cropper-preview .preview-main--circular[data-v-c8968d14] {
|
|
31
31
|
border-radius: 50%;
|
|
32
32
|
}
|
|
33
|
-
.cropper-preview .preview-main__viewport img[data-v-
|
|
33
|
+
.cropper-preview .preview-main__viewport img[data-v-c8968d14] {
|
|
34
34
|
display: block;
|
|
35
35
|
max-width: none !important;
|
|
36
36
|
}
|
|
37
|
-
.cropper-preview .preview-empty[data-v-
|
|
37
|
+
.cropper-preview .preview-empty[data-v-c8968d14] {
|
|
38
38
|
display: flex;
|
|
39
39
|
align-items: center;
|
|
40
40
|
justify-content: center;
|
|
@@ -42,50 +42,50 @@
|
|
|
42
42
|
height: 100%;
|
|
43
43
|
min-height: 120px;
|
|
44
44
|
}
|
|
45
|
-
.cropper-preview .preview-thumbs[data-v-
|
|
45
|
+
.cropper-preview .preview-thumbs[data-v-c8968d14] {
|
|
46
46
|
display: flex;
|
|
47
47
|
gap: 12px;
|
|
48
48
|
align-items: flex-end;
|
|
49
49
|
justify-content: center;
|
|
50
50
|
}
|
|
51
|
-
.cropper-preview .preview-thumb[data-v-
|
|
51
|
+
.cropper-preview .preview-thumb[data-v-c8968d14] {
|
|
52
52
|
display: flex;
|
|
53
53
|
flex-direction: column;
|
|
54
54
|
gap: 4px;
|
|
55
55
|
align-items: center;
|
|
56
56
|
}
|
|
57
|
-
.cropper-preview .preview-thumb__box[data-v-
|
|
57
|
+
.cropper-preview .preview-thumb__box[data-v-c8968d14] {
|
|
58
58
|
overflow: hidden;
|
|
59
59
|
border: 1px solid var(--border-color);
|
|
60
60
|
border-radius: 4px;
|
|
61
61
|
background: var(--body-color);
|
|
62
62
|
}
|
|
63
|
-
.cropper-preview .preview-thumb__box--circular[data-v-
|
|
63
|
+
.cropper-preview .preview-thumb__box--circular[data-v-c8968d14] {
|
|
64
64
|
border-radius: 50%;
|
|
65
65
|
}
|
|
66
|
-
.cropper-preview .preview-thumb__viewport img[data-v-
|
|
66
|
+
.cropper-preview .preview-thumb__viewport img[data-v-c8968d14] {
|
|
67
67
|
display: block;
|
|
68
68
|
max-width: none !important;
|
|
69
69
|
}
|
|
70
|
-
.cropper-preview .preview-thumb__label[data-v-
|
|
70
|
+
.cropper-preview .preview-thumb__label[data-v-c8968d14] {
|
|
71
71
|
font-size: 11px;
|
|
72
72
|
color: var(--text-color-3);
|
|
73
73
|
}
|
|
74
74
|
/* unplugin-vue-components disabled *//* C_ImageCropper styles */
|
|
75
|
-
.c-image-cropper[data-v-
|
|
75
|
+
.c-image-cropper[data-v-8aa3952f] {
|
|
76
76
|
width: 100%;
|
|
77
77
|
}
|
|
78
|
-
.c-image-cropper__body[data-v-
|
|
78
|
+
.c-image-cropper__body[data-v-8aa3952f] {
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-direction: column;
|
|
81
81
|
gap: 8px;
|
|
82
82
|
}
|
|
83
|
-
.c-image-cropper__workspace[data-v-
|
|
83
|
+
.c-image-cropper__workspace[data-v-8aa3952f] {
|
|
84
84
|
display: flex;
|
|
85
85
|
gap: 16px;
|
|
86
86
|
align-items: stretch;
|
|
87
87
|
}
|
|
88
|
-
.c-image-cropper__canvas[data-v-
|
|
88
|
+
.c-image-cropper__canvas[data-v-8aa3952f] {
|
|
89
89
|
position: relative;
|
|
90
90
|
flex: 1;
|
|
91
91
|
min-width: 0;
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
border-radius: 6px;
|
|
95
95
|
background: var(--body-color);
|
|
96
96
|
}
|
|
97
|
-
.c-image-cropper__canvas[data-v-
|
|
97
|
+
.c-image-cropper__canvas[data-v-8aa3952f] .vue-cropper {
|
|
98
98
|
width: 100% !important;
|
|
99
99
|
height: 100% !important;
|
|
100
100
|
}
|
|
101
|
-
.c-image-cropper__preview-panel[data-v-
|
|
101
|
+
.c-image-cropper__preview-panel[data-v-8aa3952f] {
|
|
102
102
|
flex: 0 1 280px;
|
|
103
103
|
min-width: 200px;
|
|
104
104
|
padding: 16px;
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
border-radius: 6px;
|
|
108
108
|
background: var(--card-color);
|
|
109
109
|
}
|
|
110
|
-
.c-image-cropper__placeholder[data-v-
|
|
110
|
+
.c-image-cropper__placeholder[data-v-8aa3952f] {
|
|
111
111
|
display: flex;
|
|
112
112
|
flex-direction: column;
|
|
113
113
|
gap: 8px;
|
|
@@ -118,10 +118,10 @@
|
|
|
118
118
|
font-size: 14px;
|
|
119
119
|
}
|
|
120
120
|
@media (width <= 768px) {
|
|
121
|
-
.c-image-cropper__workspace[data-v-
|
|
121
|
+
.c-image-cropper__workspace[data-v-8aa3952f] {
|
|
122
122
|
flex-direction: column;
|
|
123
123
|
}
|
|
124
|
-
.c-image-cropper__preview-panel[data-v-
|
|
124
|
+
.c-image-cropper__preview-panel[data-v-8aa3952f] {
|
|
125
125
|
max-width: none;
|
|
126
126
|
}
|
|
127
127
|
}
|
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){let t=Math.round(e/90),n=t>0?i:r;for(let e=0;e<Math.abs(t);e++)n()}function o(e){t.value?.changeScale(e>0?1:-1)}function s(){let e=t.value?.$refs?.img;if(!e)return;let n=e.style.transform||``;n.includes(`scaleX(-1)`)?e.style.transform=n.replace(`scaleX(-1)`,`scaleX(1)`):e.style.transform=n.replace(/scaleX\([^)]*\)/,``)+` scaleX(-1)`}function c(){let e=t.value?.$refs?.img;if(!e)return;let n=e.style.transform||``;n.includes(`scaleY(-1)`)?e.style.transform=n.replace(`scaleY(-1)`,`scaleY(1)`):e.style.transform=n.replace(/scaleY\([^)]*\)/,``)+` scaleY(-1)`}function l(){t.value?.refresh()}function u(t,n){let r=t,i=n,a=e.maxWidth?.value??0,o=e.maxHeight?.value??0;if(a>0&&r>a){let e=a/r;r=a,i=Math.round(i*e)}if(o>0&&i>o){let e=o/i;i=o,r=Math.round(r*e)}return{width:r,height:i}}function d(){return new Promise((n,r)=>{let i=t.value;if(!i)return r(Error(`Cropper not initialized`));let a=e.format?.value??`png`,o=e.quality?.value??.92,s=a===`jpeg`?`image/jpeg`:a===`webp`?`image/webp`:`image/png`;i.getCropData(e=>{i.getCropBlob(t=>{let i=new Image;i.onload=()=>{let{width:r,height:c}=u(i.width,i.height);if(r!==i.width||c!==i.height){let e=document.createElement(`canvas`);e.width=r,e.height=c,e.getContext(`2d`).drawImage(i,0,0,r,c);let t=e.toDataURL(s,o);e.toBlob(e=>{n({base64:t,blob:e,width:r,height:c,format:a})},s,a===`png`?void 0:o)}else n({base64:e,blob:t,width:i.width,height:i.height,format:a})},i.onerror=()=>r(Error(`Failed to load crop result`)),i.src=e})})})}return{cropperRef:t,rotate:a,rotateLeft:r,rotateRight:i,zoom:o,flipX:s,flipY:c,reset:l,getCropResult:d}}const o={class:`cropper-toolbar`},s=(0,n.defineComponent)({__name:`CropperToolbar`,props:{currentRatio:{},ratioPresets:{}},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`,onClick:t=>i.$emit(`ratio`,e.value)},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)(e.label),1)]),_:2},1032,[`type`,`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:``,onClick:a[0]||=e=>i.$emit(`rotate`,-90)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:rotate-left`})]),_:1})]),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:``,onClick:a[1]||=e=>i.$emit(`rotate`,90)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:rotate-right`})]),_:1})]),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:``,onClick:a[2]||=e=>i.$emit(`flipX`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:flip-horizontal`})]),_:1})]),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:``,onClick:a[3]||=e=>i.$emit(`flipY`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:flip-vertical`})]),_:1})]),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:``,onClick:a[4]||=e=>i.$emit(`zoom`,.1)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:magnify-plus-outline`})]),_:1})]),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:``,onClick:a[5]||=e=>i.$emit(`zoom`,-.1)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:magnify-minus-outline`})]),_:1})]),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:``,onClick:a[6]||=e=>i.$emit(`reset`)},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:`mdi:refresh`})]),_:1})]),default:(0,n.withCtx)(()=>[a[13]||=(0,n.createTextVNode)(` 重置 `,-1)]),_:1})]))}});var c=t.t(s,[[`__scopeId`,`data-v-499ffd01`]]);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-cefefdc0`]]);const v={class:`c-image-cropper__body`},y={class:`c-image-cropper__workspace`},b={key:1,class:`c-image-cropper__placeholder`},x={key:0,class:`c-image-cropper__preview-panel`},S={key:1,class:`c-image-cropper`},C={class:`c-image-cropper__body`},w={class:`c-image-cropper__workspace`},T={key:1,class:`c-image-cropper__placeholder`},E={key:0,class:`c-image-cropper__preview-panel`},D=(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)(null),g=(0,n.ref)(null),D=(0,n.ref)(null),O=(0,n.computed)(()=>l.modal?D.value:g.value),k=(0,n.computed)(()=>typeof l.height==`number`?`${l.height}px`:l.height),A=(0,n.computed)(()=>({png:`png`,jpeg:`jpeg`,webp:`webp`})[l.outputFormat]||`png`),j=(0,n.computed)(()=>f.value>0),M=(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]),N=(0,n.computed)(()=>({width:300,height:f.value>0?300/f.value:200})),P=[{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}],F=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)(O,e=>{F.cropperRef.value=e});function I(e){h.value=e}function L(e){e===`success`&&u(`ready`)}function R(e){F.rotate(e)}function z(e){f.value=e}function B(){F.reset()}async function V(){m.value=!0;try{let e=await F.getCropResult();u(`confirm`,e),u(`crop`,e),p.value=!1}finally{m.value=!1}}function H(){p.value=!1,u(`cancel`)}function U(e){let t=new FileReader;t.onload=e=>{d.value=e.target?.result},t.readAsDataURL(e)}return(0,n.watch)(()=>l.src,e=>{d.value=e}),(0,n.watch)(()=>l.aspectRatio,e=>{f.value=e}),o({getCropResult:F.getCropResult,rotate:F.rotate,zoom:F.zoom,flipX:F.flipX,flipY:F.flipY,reset:F.reset,setAspectRatio:e=>{f.value=e},loadFile:U,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),{onClick:H},{default:(0,n.withCtx)(()=>[...a[2]||=[(0,n.createTextVNode)(`取消`,-1)]]),_:1}),(0,n.createVNode)((0,n.unref)(r.NButton),{type:`primary`,loading:m.value,onClick:V},{default:(0,n.withCtx)(()=>[...a[3]||=[(0,n.createTextVNode)(`确认裁剪`,-1)]]),_:1},8,[`loading`])]),_:1})]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`div`,v,[l.showToolbar?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,"current-ratio":f.value,"ratio-presets":P,onRatio:z,onRotate:R,onFlipX:(0,n.unref)(F).flipX,onFlipY:(0,n.unref)(F).flipY,onZoom:(0,n.unref)(F).zoom,onReset:B},null,8,[`current-ratio`,`onFlipX`,`onFlipY`,`onZoom`])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,y,[(0,n.createElementVNode)(`div`,{class:`c-image-cropper__canvas`,style:(0,n.normalizeStyle)({height:k.value})},[d.value?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(i.VueCropper),{key:0,ref_key:`modalCropperRef`,ref:D,img:d.value,"output-size":l.outputQuality,"output-type":A.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":N.value.width,"auto-crop-height":N.value.height,fixed:j.value,"fixed-number":M.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!0,"can-move-box":!0,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:I,onImgLoad:L},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,b,[(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`,x,[(0,n.createVNode)(_,{"preview-data":h.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`,S,[(0,n.createElementVNode)(`div`,C,[l.showToolbar?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,"current-ratio":f.value,"ratio-presets":P,onRatio:z,onRotate:R,onFlipX:(0,n.unref)(F).flipX,onFlipY:(0,n.unref)(F).flipY,onZoom:(0,n.unref)(F).zoom,onReset:B},null,8,[`current-ratio`,`onFlipX`,`onFlipY`,`onZoom`])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,w,[(0,n.createElementVNode)(`div`,{class:`c-image-cropper__canvas`,style:(0,n.normalizeStyle)({height:k.value})},[d.value?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(i.VueCropper),{key:0,ref_key:`inlineCropperRef`,ref:g,img:d.value,"output-size":l.outputQuality,"output-type":A.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":N.value.width,"auto-crop-height":N.value.height,fixed:j.value,"fixed-number":M.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!0,"can-move-box":!0,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:I,onImgLoad:L},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`])):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,T,[(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`,E,[(0,n.createVNode)(_,{"preview-data":h.value,circular:l.circular},null,8,[`preview-data`,`circular`])])):(0,n.createCommentVNode)(`v-if`,!0)])])]))}});var O=t.t(D,[[`__scopeId`,`data-v-296916a4`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return O}});
|
|
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}});
|
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 E,NTooltip as D}from"naive-ui";import{VueCropper as O}from"vue-cropper";function k(e={}){let t=g(null);function n(){t.value?.rotateLeft()}function r(){t.value?.rotateRight()}function i(e){let t=Math.round(e/90),i=t>0?r:n;for(let e=0;e<Math.abs(t);e++)i()}function a(e){t.value?.changeScale(e>0?1:-1)}function o(){let e=t.value?.$refs?.img;if(!e)return;let n=e.style.transform||``;n.includes(`scaleX(-1)`)?e.style.transform=n.replace(`scaleX(-1)`,`scaleX(1)`):e.style.transform=n.replace(/scaleX\([^)]*\)/,``)+` scaleX(-1)`}function s(){let e=t.value?.$refs?.img;if(!e)return;let n=e.style.transform||``;n.includes(`scaleY(-1)`)?e.style.transform=n.replace(`scaleY(-1)`,`scaleY(1)`):e.style.transform=n.replace(/scaleY\([^)]*\)/,``)+` scaleY(-1)`}function c(){t.value?.refresh()}function l(t,n){let r=t,i=n,a=e.maxWidth?.value??0,o=e.maxHeight?.value??0;if(a>0&&r>a){let e=a/r;r=a,i=Math.round(i*e)}if(o>0&&i>o){let e=o/i;i=o,r=Math.round(r*e)}return{width:r,height:i}}function u(){return new Promise((n,r)=>{let i=t.value;if(!i)return r(Error(`Cropper not initialized`));let a=e.format?.value??`png`,o=e.quality?.value??.92,s=a===`jpeg`?`image/jpeg`:a===`webp`?`image/webp`:`image/png`;i.getCropData(e=>{i.getCropBlob(t=>{let i=new Image;i.onload=()=>{let{width:r,height:c}=l(i.width,i.height);if(r!==i.width||c!==i.height){let e=document.createElement(`canvas`);e.width=r,e.height=c,e.getContext(`2d`).drawImage(i,0,0,r,c);let t=e.toDataURL(s,o);e.toBlob(e=>{n({base64:t,blob:e,width:r,height:c,format:a})},s,a===`png`?void 0:o)}else n({base64:e,blob:t,width:i.width,height:i.height,format:a})},i.onerror=()=>r(Error(`Failed to load crop result`)),i.src=e})})})}return{cropperRef:t,rotate:i,rotateLeft:n,rotateRight:r,zoom:a,flipX:o,flipY:s,reset:c,getCropResult:u}}const A={class:`cropper-toolbar`};var j=t(u({__name:`CropperToolbar`,props:{currentRatio:{},ratioPresets:{}},emits:[`ratio`,`rotate`,`flipX`,`flipY`,`zoom`,`reset`],setup(t){return(r,a)=>(h(),o(`div`,A,[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`,onClick:t=>r.$emit(`ratio`,e.value)},{default:x(()=>[c(v(e.label),1)]),_:2},1032,[`type`,`onClick`]))),128))]),_:1}),l(y(w),{vertical:``}),l(y(D),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,onClick:a[0]||=e=>r.$emit(`rotate`,-90)},{icon:x(()=>[l(e,{name:`mdi:rotate-left`})]),_:1})]),default:x(()=>[a[7]||=c(` 逆时针旋转 90° `,-1)]),_:1}),l(y(D),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,onClick:a[1]||=e=>r.$emit(`rotate`,90)},{icon:x(()=>[l(e,{name:`mdi:rotate-right`})]),_:1})]),default:x(()=>[a[8]||=c(` 顺时针旋转 90° `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(D),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,onClick:a[2]||=e=>r.$emit(`flipX`)},{icon:x(()=>[l(e,{name:`mdi:flip-horizontal`})]),_:1})]),default:x(()=>[a[9]||=c(` 水平翻转 `,-1)]),_:1}),l(y(D),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,onClick:a[3]||=e=>r.$emit(`flipY`)},{icon:x(()=>[l(e,{name:`mdi:flip-vertical`})]),_:1})]),default:x(()=>[a[10]||=c(` 垂直翻转 `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(D),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,onClick:a[4]||=e=>r.$emit(`zoom`,.1)},{icon:x(()=>[l(e,{name:`mdi:magnify-plus-outline`})]),_:1})]),default:x(()=>[a[11]||=c(` 放大 `,-1)]),_:1}),l(y(D),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,onClick:a[5]||=e=>r.$emit(`zoom`,-.1)},{icon:x(()=>[l(e,{name:`mdi:magnify-minus-outline`})]),_:1})]),default:x(()=>[a[12]||=c(` 缩小 `,-1)]),_:1}),l(y(w),{vertical:``}),l(y(D),null,{trigger:x(()=>[l(y(S),{size:`small`,quaternary:``,onClick:a[6]||=e=>r.$emit(`reset`)},{icon:x(()=>[l(e,{name:`mdi:refresh`})]),_:1})]),default:x(()=>[a[13]||=c(` 重置 `,-1)]),_:1})]))}}),[[`__scopeId`,`data-v-499ffd01`]]);const M={class:`cropper-preview`},N={class:`preview-label`},P=[`src`],F={key:1,class:`preview-empty`},I={class:`preview-thumbs`},L=[`src`],R={class:`preview-thumb__label`};var z=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`,M,[s(`div`,N,[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,P)],4)],4)):(h(),o(`div`,F,[l(e,{name:`mdi:image-outline`,style:{"font-size":`32px`,opacity:`0.2`}})]))],2),s(`div`,I,[(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,L)],4)],4)):a(`v-if`,!0)],6),s(`span`,R,v(e.label),1)])),64))])]))}}),[[`__scopeId`,`data-v-cefefdc0`]]);const B={class:`c-image-cropper__body`},V={class:`c-image-cropper__workspace`},H={key:1,class:`c-image-cropper__placeholder`},U={key:0,class:`c-image-cropper__preview-panel`},W={key:1,class:`c-image-cropper`},G={class:`c-image-cropper__body`},K={class:`c-image-cropper__workspace`},q={key:1,class:`c-image-cropper__placeholder`},ee={key:0,class:`c-image-cropper__preview-panel`};var J=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(null),D=g(null),A=g(null),M=r(()=>d.modal?A.value:D.value),N=r(()=>typeof d.height==`number`?`${d.height}px`:d.height),P=r(()=>({png:`png`,jpeg:`jpeg`,webp:`webp`})[d.outputFormat]||`png`),F=r(()=>_.value>0),I=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]),L=r(()=>({width:300,height:_.value>0?300/_.value:200})),R=[{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}],J=k({format:r(()=>d.outputFormat),quality:r(()=>d.outputQuality),maxWidth:r(()=>d.maxOutputWidth),maxHeight:r(()=>d.maxOutputHeight)});b(M,e=>{J.cropperRef.value=e});function Y(e){w.value=e}function X(e){e===`success`&&p(`ready`)}function Z(e){J.rotate(e)}function Q(e){_.value=e}function $(){J.reset()}async function te(){C.value=!0;try{let e=await J.getCropResult();p(`confirm`,e),p(`crop`,e),v.value=!1}finally{C.value=!1}}function ne(){v.value=!1,p(`cancel`)}function re(e){let t=new FileReader;t.onload=e=>{m.value=e.target?.result},t.readAsDataURL(e)}return b(()=>d.src,e=>{m.value=e}),b(()=>d.aspectRatio,e=>{_.value=e}),n({getCropResult:J.getCropResult,rotate:J.rotate,zoom:J.zoom,flipX:J.flipX,flipY:J.flipY,reset:J.reset,setAspectRatio:e=>{_.value=e},loadFile:re,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(E),{justify:`end`},{default:x(()=>[l(y(S),{onClick:ne},{default:x(()=>[...n[2]||=[c(`取消`,-1)]]),_:1}),l(y(S),{type:`primary`,loading:C.value,onClick:te},{default:x(()=>[...n[3]||=[c(`确认裁剪`,-1)]]),_:1},8,[`loading`])]),_:1})]),default:x(()=>[s(`div`,B,[d.showToolbar?(h(),i(j,{key:0,"current-ratio":_.value,"ratio-presets":R,onRatio:Q,onRotate:Z,onFlipX:y(J).flipX,onFlipY:y(J).flipY,onZoom:y(J).zoom,onReset:$},null,8,[`current-ratio`,`onFlipX`,`onFlipY`,`onZoom`])):a(`v-if`,!0),s(`div`,V,[s(`div`,{class:`c-image-cropper__canvas`,style:f({height:N.value})},[m.value?(h(),i(y(O),{key:0,ref_key:`modalCropperRef`,ref:A,img:m.value,"output-size":d.outputQuality,"output-type":P.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":L.value.width,"auto-crop-height":L.value.height,fixed:F.value,"fixed-number":I.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!0,"can-move-box":!0,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:Y,onImgLoad:X},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`])):(h(),o(`div`,H,[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`,U,[l(z,{"preview-data":w.value,circular:d.circular},null,8,[`preview-data`,`circular`])])):a(`v-if`,!0)])])]),_:1},8,[`show`,`title`])):(h(),o(`div`,W,[s(`div`,G,[d.showToolbar?(h(),i(j,{key:0,"current-ratio":_.value,"ratio-presets":R,onRatio:Q,onRotate:Z,onFlipX:y(J).flipX,onFlipY:y(J).flipY,onZoom:y(J).zoom,onReset:$},null,8,[`current-ratio`,`onFlipX`,`onFlipY`,`onZoom`])):a(`v-if`,!0),s(`div`,K,[s(`div`,{class:`c-image-cropper__canvas`,style:f({height:N.value})},[m.value?(h(),i(y(O),{key:0,ref_key:`inlineCropperRef`,ref:D,img:m.value,"output-size":d.outputQuality,"output-type":P.value,"can-scale":!1,"auto-crop":!0,"auto-crop-width":L.value.width,"auto-crop-height":L.value.height,fixed:F.value,"fixed-number":I.value,"center-box":!0,info:!0,"info-true":!0,"can-move":!0,"can-move-box":!0,original:!1,high:!0,full:!1,mode:`contain`,onRealTime:Y,onImgLoad:X},null,8,[`img`,`output-size`,`output-type`,`auto-crop-width`,`auto-crop-height`,`fixed`,`fixed-number`])):(h(),o(`div`,q,[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`,ee,[l(z,{"preview-data":w.value,circular:d.circular},null,8,[`preview-data`,`circular`])])):a(`v-if`,!0)])])]))}}),[[`__scopeId`,`data-v-296916a4`]]);export{k as n,J 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-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};
|
package/dist/C_Language.css
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
/* unplugin-vue-components disabled */.c-icon[data-v-
|
|
1
|
+
/* unplugin-vue-components disabled */.c-icon[data-v-711aedcd] {
|
|
2
2
|
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
user-select: none;
|
|
6
6
|
transition: all 0.2s ease-in-out;
|
|
7
7
|
}
|
|
8
|
-
.c-icon--clickable[data-v-
|
|
8
|
+
.c-icon--clickable[data-v-711aedcd] {
|
|
9
9
|
cursor: pointer;
|
|
10
10
|
}
|
|
11
|
-
.c-icon--clickable[data-v-
|
|
11
|
+
.c-icon--clickable[data-v-711aedcd]:hover {
|
|
12
12
|
opacity: 0.8;
|
|
13
13
|
transform: scale(1.05);
|
|
14
14
|
}
|
|
15
|
-
.c-icon--clickable[data-v-
|
|
15
|
+
.c-icon--clickable[data-v-711aedcd]:active {
|
|
16
16
|
transform: scale(0.95);
|
|
17
17
|
}
|
|
18
|
-
.c-icon--clickable[data-v-
|
|
18
|
+
.c-icon--clickable[data-v-711aedcd]:focus-visible {
|
|
19
19
|
outline: 2px solid currentColor;
|
|
20
20
|
outline-offset: 2px;
|
|
21
21
|
border-radius: 4px;
|
|
22
22
|
}
|
|
23
|
-
.c-icon--loading[data-v-
|
|
23
|
+
.c-icon--loading[data-v-711aedcd] {
|
|
24
24
|
opacity: 0.6;
|
|
25
25
|
cursor: wait;
|
|
26
26
|
}
|
|
27
|
-
.c-icon--error[data-v-
|
|
27
|
+
.c-icon--error[data-v-711aedcd] {
|
|
28
28
|
opacity: 0.5;
|
|
29
29
|
}
|
|
30
|
-
.c-icon__loading[data-v-
|
|
30
|
+
.c-icon__loading[data-v-711aedcd] {
|
|
31
31
|
position: relative;
|
|
32
32
|
}
|
|
33
|
-
.c-icon__spinner[data-v-
|
|
33
|
+
.c-icon__spinner[data-v-711aedcd] {
|
|
34
34
|
width: 100%;
|
|
35
35
|
height: 100%;
|
|
36
36
|
border: 2px solid currentColor;
|
|
37
37
|
border-radius: 50%;
|
|
38
38
|
border-top-color: transparent;
|
|
39
|
-
animation: spin-
|
|
39
|
+
animation: spin-711aedcd 1s linear infinite;
|
|
40
40
|
}
|
|
41
|
-
.c-icon__error[data-v-
|
|
41
|
+
.c-icon__error[data-v-711aedcd] {
|
|
42
42
|
font-size: 0.8em;
|
|
43
43
|
opacity: 0.5;
|
|
44
44
|
}
|
|
45
|
-
.c-icon__rotatable[data-v-
|
|
45
|
+
.c-icon__rotatable[data-v-711aedcd] {
|
|
46
46
|
transition: transform 0.3s ease-in-out;
|
|
47
47
|
}
|
|
48
|
-
.c-icon__flippable[data-v-
|
|
48
|
+
.c-icon__flippable[data-v-711aedcd] {
|
|
49
49
|
transition: transform 0.3s ease-in-out;
|
|
50
50
|
}
|
|
51
|
-
@keyframes spin-
|
|
51
|
+
@keyframes spin-711aedcd {
|
|
52
52
|
0% {
|
|
53
53
|
transform: rotate(0deg);
|
|
54
54
|
}
|
package/dist/C_Language2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`);let t=require(`vue`),n=require(`naive-ui`);const r={class:`flex items-center`},i=(0,t.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(i,{emit:a}){let o=i,s=a,c=(0,t.computed)(()=>o.options.find(e=>e.key===o.modelValue)?.label??o.modelValue),l=(0,t.computed)(()=>`${o.tooltip} (${c.value})`),u=(0,t.computed)(()=>o.options.map(n=>
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`);let t=require(`vue`),n=require(`naive-ui`);const r={class:`flex items-center`},i=(0,t.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(i,{emit:a}){let o=i,s=a,c=(0,t.computed)(()=>o.options.find(e=>e.key===o.modelValue)?.label??o.modelValue),l=(0,t.computed)(()=>`${o.tooltip} (${c.value})`),u=(0,t.computed)(()=>o.options.map(n=>{let r=n.iconClass;return{key:n.key,label:n.label,icon:r?()=>(0,t.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,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.NDropdown),{size:`small`,trigger:`hover`,options:u.value,value:i.modelValue,onSelect:d},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.NButton),{text:``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,r,[(0,t.createVNode)(e.t,{name:`mdi:language`,size:18,title:l.value},null,8,[`title`])])]),_:1})]),_:1},8,[`options`,`value`]))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
package/dist/C_Language2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./C_Icon2.js";import{computed as t,createBlock as n,createElementVNode as r,createVNode as i,defineComponent as a,h as o,openBlock as s,unref as c,withCtx as l}from"vue";import{NButton as u,NDropdown as d}from"naive-ui";const f={class:`flex items-center`},p=a({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(a,{emit:p}){let m=a,h=p,g=t(()=>m.options.find(e=>e.key===m.modelValue)?.label??m.modelValue),_=t(()=>`${m.tooltip} (${g.value})`),v=t(()=>m.options.map(t=>
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{computed as t,createBlock as n,createElementVNode as r,createVNode as i,defineComponent as a,h as o,openBlock as s,unref as c,withCtx as l}from"vue";import{NButton as u,NDropdown as d}from"naive-ui";const f={class:`flex items-center`},p=a({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(a,{emit:p}){let m=a,h=p,g=t(()=>m.options.find(e=>e.key===m.modelValue)?.label??m.modelValue),_=t(()=>`${m.tooltip} (${g.value})`),v=t(()=>m.options.map(t=>{let n=t.iconClass;return{key:t.key,label:t.label,icon:n?()=>o(e,{name:n,size:16}):void 0}})),y=e=>{e!==m.modelValue&&(h(`update:modelValue`,e),h(`change`,e))};return(t,o)=>(s(),n(c(d),{size:`small`,trigger:`hover`,options:v.value,value:a.modelValue,onSelect:y},{default:l(()=>[i(c(u),{text:``},{default:l(()=>[r(`div`,f,[i(e,{name:`mdi:language`,size:18,title:_.value},null,8,[`title`])])]),_:1})]),_:1},8,[`options`,`value`]))}});export{p as t};
|