@cmstops/pro-compo 0.1.13 → 0.1.15

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.
Files changed (150) hide show
  1. package/dist/gif.worker.js +3 -0
  2. package/dist/index.css +486 -6
  3. package/dist/index.min.css +1 -1
  4. package/es/contentDetailList/component.js +1 -2
  5. package/es/contentDetailList/components/Content/CompoItem/index.js +1 -2
  6. package/es/contentDetailList/components/Content/ContentListItem/index.js +1 -2
  7. package/es/contentDetailList/components/Content/DocItem/ApprovalStateMap/index.js +1 -2
  8. package/es/contentDetailList/components/Content/DocItem/index.js +1 -2
  9. package/es/contentDetailList/components/Content/KongoNavItem/index.js +1 -2
  10. package/es/contentDetailList/components/Content/LiveItem/index.js +1 -2
  11. package/es/contentDetailList/components/Content/MaccountItem/index.js +1 -2
  12. package/es/contentDetailList/components/Content/index.js +1 -2
  13. package/es/contentDetailList/components/Doc/index.js +1 -2
  14. package/es/contentModal/component.js +1 -2
  15. package/es/contentModal/components/CompoList/CompoFilter/index.js +2 -3
  16. package/es/contentModal/components/CompoList/index.js +2 -3
  17. package/es/contentModal/components/ViewAllColumn/MediaFilter/index.js +1 -2
  18. package/es/contentModal/components/ViewAllColumn/columnTree/index.js +1 -2
  19. package/es/contentModal/components/ViewAllColumn/index.js +1 -2
  20. package/es/contentModal/components/storeBox/index.js +1 -2
  21. package/es/gif.worker.js +3 -0
  22. package/es/hooks/assets.d.ts +1 -0
  23. package/es/hooks/assets.js +9 -0
  24. package/es/hooks/user.d.ts +1 -3
  25. package/es/imageCrop/component.d.ts +0 -0
  26. package/es/imageCrop/component.js +472 -0
  27. package/es/imageCrop/index.d.ts +2 -0
  28. package/es/imageCrop/index.js +7 -0
  29. package/es/imageCrop/script/api.d.ts +1 -0
  30. package/es/imageCrop/script/api.js +11 -0
  31. package/es/imageCrop/style/cropper.less +291 -0
  32. package/es/imageCrop/style/css.js +1 -0
  33. package/es/imageCrop/style/imageCropper.less +133 -0
  34. package/es/imageCrop/style/index.css +366 -0
  35. package/es/imageCrop/style/index.d.ts +1 -0
  36. package/es/imageCrop/style/index.js +1 -0
  37. package/es/imageCrop/style/index.less +2 -0
  38. package/es/index.css +486 -6
  39. package/es/index.d.ts +2 -0
  40. package/es/index.js +2 -0
  41. package/es/index.less +2 -0
  42. package/es/mediaFilter/component.js +1 -2
  43. package/es/mediaFilter/components/DocFilter.js +1 -2
  44. package/es/messageBox/list.js +1 -2
  45. package/es/previousVersion/component.js +1 -2
  46. package/es/resourceModal/component.js +4 -7
  47. package/es/resourceModal/components/MediaPreviewer/index.js +1 -2
  48. package/es/resourceModal/components/MediaSelection/DocAiMediaSelected/index.js +10 -19
  49. package/es/resourceModal/components/MediaSelection/MainContent/FileTypeThumb/index.js +4 -9
  50. package/es/resourceModal/components/MediaSelection/MainContent/index.js +7 -15
  51. package/es/resourceModal/components/MediaSelection/ToolbarSearch/index.js +1 -2
  52. package/es/resourceModal/components/MediaSelection/index.js +8 -12
  53. package/es/selectAvatarList/component.js +67 -48
  54. package/es/selectGategory/component.js +1 -2
  55. package/es/selectGategory/components/ColumnSelection/index.js +1 -2
  56. package/es/selectThumb/component.d.ts +0 -0
  57. package/es/selectThumb/component.js +410 -0
  58. package/es/selectThumb/components/card.d.ts +0 -0
  59. package/es/selectThumb/components/card.js +86 -0
  60. package/es/selectThumb/components/colorPalette.d.ts +0 -0
  61. package/es/selectThumb/components/colorPalette.js +75 -0
  62. package/es/selectThumb/index.d.ts +2 -0
  63. package/es/selectThumb/index.js +7 -0
  64. package/es/selectThumb/style/card.less +79 -0
  65. package/es/selectThumb/style/colorPalette.less +0 -0
  66. package/es/selectThumb/style/css.js +1 -0
  67. package/es/selectThumb/style/index.css +101 -0
  68. package/es/selectThumb/style/index.d.ts +1 -0
  69. package/es/selectThumb/style/index.js +1 -0
  70. package/es/selectThumb/style/index.less +27 -0
  71. package/es/uploadBefore/component.js +2 -3
  72. package/es/uploadBefore/components/UploadBefore.js +1 -2
  73. package/es/uploadBefore/components/UploadForClick.js +1 -2
  74. package/es/uploadStep/component.js +2 -3
  75. package/es/userDirector/component.js +15 -14
  76. package/es/userDirector/components/userTree.js +2 -2
  77. package/es/userDirector/style/index.css +19 -6
  78. package/es/userDirector/style/index.less +25 -12
  79. package/es/utils/doc.js +30 -7
  80. package/es/utils/index.d.ts +1 -0
  81. package/es/utils/index.js +6 -1
  82. package/es/utils/tusUpload.d.ts +1 -1
  83. package/es/utils/tusUpload.js +1 -1
  84. package/es/utils/uploadCatalog.d.ts +1 -0
  85. package/lib/contentDetailList/component.js +1 -2
  86. package/lib/contentDetailList/components/Content/CompoItem/index.js +1 -2
  87. package/lib/contentDetailList/components/Content/ContentListItem/index.js +1 -2
  88. package/lib/contentDetailList/components/Content/DocItem/ApprovalStateMap/index.js +1 -2
  89. package/lib/contentDetailList/components/Content/DocItem/index.js +1 -2
  90. package/lib/contentDetailList/components/Content/KongoNavItem/index.js +1 -2
  91. package/lib/contentDetailList/components/Content/LiveItem/index.js +1 -2
  92. package/lib/contentDetailList/components/Content/MaccountItem/index.js +1 -2
  93. package/lib/contentDetailList/components/Content/index.js +1 -2
  94. package/lib/contentDetailList/components/Doc/index.js +1 -2
  95. package/lib/contentModal/component.js +1 -2
  96. package/lib/contentModal/components/CompoList/CompoFilter/index.js +2 -3
  97. package/lib/contentModal/components/CompoList/index.js +2 -3
  98. package/lib/contentModal/components/ViewAllColumn/MediaFilter/index.js +1 -2
  99. package/lib/contentModal/components/ViewAllColumn/columnTree/index.js +1 -2
  100. package/lib/contentModal/components/ViewAllColumn/index.js +1 -2
  101. package/lib/contentModal/components/storeBox/index.js +1 -2
  102. package/lib/hooks/assets.js +11 -0
  103. package/lib/imageCrop/component.js +479 -0
  104. package/lib/imageCrop/index.js +8 -0
  105. package/lib/imageCrop/script/api.js +13 -0
  106. package/lib/imageCrop/style/cropper.less +291 -0
  107. package/lib/imageCrop/style/css.js +2 -0
  108. package/lib/imageCrop/style/imageCropper.less +133 -0
  109. package/lib/imageCrop/style/index.css +366 -0
  110. package/lib/imageCrop/style/index.js +2 -0
  111. package/lib/imageCrop/style/index.less +2 -0
  112. package/lib/index.css +486 -6
  113. package/lib/index.js +16 -12
  114. package/lib/index.less +2 -0
  115. package/lib/mediaFilter/component.js +1 -2
  116. package/lib/mediaFilter/components/DocFilter.js +1 -2
  117. package/lib/messageBox/list.js +1 -2
  118. package/lib/previousVersion/component.js +1 -2
  119. package/lib/resourceModal/component.js +4 -7
  120. package/lib/resourceModal/components/MediaPreviewer/index.js +1 -2
  121. package/lib/resourceModal/components/MediaSelection/DocAiMediaSelected/index.js +10 -19
  122. package/lib/resourceModal/components/MediaSelection/MainContent/FileTypeThumb/index.js +4 -9
  123. package/lib/resourceModal/components/MediaSelection/MainContent/index.js +7 -15
  124. package/lib/resourceModal/components/MediaSelection/ToolbarSearch/index.js +1 -2
  125. package/lib/resourceModal/components/MediaSelection/index.js +8 -12
  126. package/lib/selectAvatarList/component.js +67 -48
  127. package/lib/selectGategory/component.js +1 -2
  128. package/lib/selectGategory/components/ColumnSelection/index.js +1 -2
  129. package/lib/selectThumb/component.js +411 -0
  130. package/lib/selectThumb/components/card.js +87 -0
  131. package/lib/selectThumb/components/colorPalette.js +76 -0
  132. package/lib/selectThumb/index.js +8 -0
  133. package/lib/selectThumb/style/card.less +79 -0
  134. package/lib/selectThumb/style/colorPalette.less +0 -0
  135. package/lib/selectThumb/style/css.js +2 -0
  136. package/lib/selectThumb/style/index.css +101 -0
  137. package/lib/selectThumb/style/index.js +2 -0
  138. package/lib/selectThumb/style/index.less +27 -0
  139. package/lib/uploadBefore/component.js +2 -3
  140. package/lib/uploadBefore/components/UploadBefore.js +1 -2
  141. package/lib/uploadBefore/components/UploadForClick.js +1 -2
  142. package/lib/uploadStep/component.js +2 -3
  143. package/lib/userDirector/component.js +15 -14
  144. package/lib/userDirector/components/userTree.js +2 -2
  145. package/lib/userDirector/style/index.css +19 -6
  146. package/lib/userDirector/style/index.less +25 -12
  147. package/lib/utils/doc.js +31 -6
  148. package/lib/utils/index.js +6 -0
  149. package/lib/utils/tusUpload.js +1 -1
  150. package/package.json +16 -2
@@ -25,10 +25,9 @@ const _sfc_main = vue.defineComponent({
25
25
  userInfo: {}
26
26
  },
27
27
  emits: ["change"],
28
- setup(__props, { emit: __emit }) {
29
- const columnIdMap = typeMap.compoColumnsMap();
30
- const emit = __emit;
28
+ setup(__props, { emit }) {
31
29
  const props = __props;
30
+ const columnIdMap = typeMap.compoColumnsMap();
32
31
  const _maxSelect = props.maxSelect || 100;
33
32
  const selectedData = vue.ref([]);
34
33
  const tempSelectedData = vue.computed(() => {
@@ -14,10 +14,9 @@ const _sfc_main = vue.defineComponent({
14
14
  userInfo: {}
15
15
  },
16
16
  emits: ["update:group_id"],
17
- setup(__props, { emit: __emit }) {
17
+ setup(__props, { emit }) {
18
18
  const props = __props;
19
19
  const column_id = vue.ref(0);
20
- const emit = __emit;
21
20
  vue.watch(
22
21
  () => props.group_id,
23
22
  (val) => {
@@ -14,8 +14,7 @@ const _sfc_main = vue.defineComponent({
14
14
  userInfo: {}
15
15
  },
16
16
  emits: ["update:column_id"],
17
- setup(__props, { emit: __emit }) {
18
- const emit = __emit;
17
+ setup(__props, { emit }) {
19
18
  const props = __props;
20
19
  const selectAlais = vue.ref("");
21
20
  const treeOptions = {
@@ -24,8 +24,7 @@ const _sfc_main = vue.defineComponent({
24
24
  userInfo: {}
25
25
  },
26
26
  emits: ["change"],
27
- setup(__props, { emit: __emit }) {
28
- const emit = __emit;
27
+ setup(__props, { emit }) {
29
28
  const props = __props;
30
29
  const _maxSelect = props.maxSelect || 100;
31
30
  const selectedData = vue.ref([]);
@@ -15,9 +15,8 @@ const _sfc_main = vue.defineComponent({
15
15
  selectData: {}
16
16
  },
17
17
  emits: ["update:selectData"],
18
- setup(__props, { emit: __emit }) {
18
+ setup(__props, { emit }) {
19
19
  const props = __props;
20
- const emit = __emit;
21
20
  const remove = (item, index) => {
22
21
  const arr = props.selectData;
23
22
  arr.splice(index, 1);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ var request = require("../utils/request.js");
4
+ function useGenerateAssets(BASE_API, params) {
5
+ return request(BASE_API, {
6
+ url: "/poplar/v2/media/add",
7
+ method: "post",
8
+ data: params
9
+ });
10
+ }
11
+ exports.useGenerateAssets = useGenerateAssets;
@@ -0,0 +1,479 @@
1
+ "use strict";
2
+ var vue = require("vue");
3
+ var webVue = require("@arco-design/web-vue");
4
+ var icon = require("@arco-design/web-vue/es/icon");
5
+ var Cropper = require("cropperjs");
6
+ var ColorThief = require("colorthief");
7
+ var gifToCanvas = require("gif-to-canvas");
8
+ var GIF = require("gif.js/dist/gif");
9
+ var tusUpload = require("../utils/tusUpload.js");
10
+ var config = require("../config.js");
11
+ var index = require("../utils/index.js");
12
+ var api = require("./script/api.js");
13
+ var assets = require("../hooks/assets.js");
14
+ function _interopDefaultLegacy(e) {
15
+ return e && typeof e === "object" && "default" in e ? e : { "default": e };
16
+ }
17
+ var Cropper__default = /* @__PURE__ */ _interopDefaultLegacy(Cropper);
18
+ var ColorThief__default = /* @__PURE__ */ _interopDefaultLegacy(ColorThief);
19
+ var GIF__default = /* @__PURE__ */ _interopDefaultLegacy(GIF);
20
+ const _hoisted_1 = { class: "image-cropper" };
21
+ const _hoisted_2 = { class: "edit-cropper" };
22
+ const _hoisted_3 = ["src"];
23
+ const _hoisted_4 = {
24
+ key: 0,
25
+ class: "tool"
26
+ };
27
+ const _hoisted_5 = ["onClick"];
28
+ const _hoisted_6 = {
29
+ key: 1,
30
+ class: "tool"
31
+ };
32
+ const _hoisted_7 = ["onClick"];
33
+ const _hoisted_8 = { class: "image-crop-modal-footer" };
34
+ const _hoisted_9 = { class: "left" };
35
+ const _hoisted_10 = { class: "right" };
36
+ const _sfc_main = vue.defineComponent({
37
+ __name: "component",
38
+ props: {
39
+ BASE_API: {},
40
+ visible: { type: Boolean },
41
+ aspectRatioProp: {},
42
+ corpData: {},
43
+ userInfo: {},
44
+ generateAssets: { type: Boolean }
45
+ },
46
+ emits: ["update:visible", "confirm"],
47
+ setup(__props, { emit }) {
48
+ const props = __props;
49
+ const BASE_API = props.BASE_API || config.DEFAULT_BASE_API;
50
+ const saveLoading = vue.ref(false);
51
+ const editImage = vue.ref("");
52
+ const setVisible = (bool) => {
53
+ emit("update:visible", bool);
54
+ };
55
+ const cancelDialog = () => {
56
+ setVisible(false);
57
+ };
58
+ const croppering = vue.ref(true);
59
+ const aspectRatioList = [
60
+ { label: "\u81EA\u7531", value: null },
61
+ { label: "1:1", value: 1 / 1 },
62
+ { label: "4:3", value: 4 / 3 },
63
+ { label: "3:4", value: 3 / 4 },
64
+ { label: "16:9", value: 16 / 9 },
65
+ { label: "9:16", value: 9 / 16 }
66
+ ];
67
+ const customizedAspectRatioList = vue.ref([]);
68
+ const aspectRatioActive = vue.ref(null);
69
+ const mosaicObj = vue.ref(null);
70
+ const cropperIndex = vue.ref(0);
71
+ const selectedData = vue.ref([]);
72
+ const loadImage = () => {
73
+ };
74
+ const getBase64 = (imgUrl) => {
75
+ window.URL = window.URL || window.webkitURL;
76
+ const xhr = new XMLHttpRequest();
77
+ xhr.open("get", imgUrl, true);
78
+ xhr.responseType = "blob";
79
+ xhr.send();
80
+ xhr.onload = function() {
81
+ if (xhr.status === 200) {
82
+ const blob = xhr.response;
83
+ const oFileReader = new FileReader();
84
+ oFileReader.onloadend = (e) => {
85
+ const base64 = e.target.result;
86
+ editImage.value = base64;
87
+ setTimeout(() => {
88
+ if (props.aspectRatioProp) {
89
+ if (Array.isArray(props.aspectRatioProp)) {
90
+ cropper(props.aspectRatioProp[0], 0);
91
+ } else {
92
+ cropper(props.aspectRatioProp, null);
93
+ }
94
+ }
95
+ }, 300);
96
+ };
97
+ oFileReader.onerror = (e) => {
98
+ };
99
+ oFileReader.readAsDataURL(blob);
100
+ }
101
+ };
102
+ };
103
+ const cropper = (aspectRatio, index2) => {
104
+ const image = document.getElementById("cropper_img");
105
+ aspectRatioActive.value = index2;
106
+ cropperDestroy();
107
+ mosaicObj.value = new Cropper__default["default"](image, {
108
+ crop() {
109
+ croppering.value = false;
110
+ },
111
+ initialAspectRatio: aspectRatio,
112
+ aspectRatio,
113
+ touchDragZoom: false,
114
+ autoCropArea: 1,
115
+ rotatable: true,
116
+ strict: false,
117
+ guides: false
118
+ });
119
+ };
120
+ const cropperZoom = (ratio) => {
121
+ mosaicObj.value.zoom(ratio);
122
+ };
123
+ const cropperRotate = (degree) => {
124
+ mosaicObj.value.rotate(degree);
125
+ };
126
+ const cropperReset = () => {
127
+ mosaicObj.value.reset();
128
+ };
129
+ const cropperDestroy = () => {
130
+ mosaicObj.value && mosaicObj.value.destroy();
131
+ };
132
+ const dataURLtoBlob = (dataurl) => {
133
+ const arr = dataurl.split(",");
134
+ const mime = arr[0].match(/:(.*?);/)[1];
135
+ const bstr = atob(arr[1]);
136
+ let n = bstr.length;
137
+ const u8arr = new Uint8Array(n);
138
+ while (n--) {
139
+ u8arr[n] = bstr.charCodeAt(n);
140
+ }
141
+ return new Blob([u8arr], { type: mime });
142
+ };
143
+ const save = () => {
144
+ saveLoading.value = true;
145
+ if (mosaicObj.value) {
146
+ if (mosaicObj.value.url.includes("data:image/gif")) {
147
+ const url = URL.createObjectURL(dataURLtoBlob(mosaicObj.value.url));
148
+ const cropBoxData = mosaicObj.value.getCropBoxData();
149
+ const canvasData = mosaicObj.value.getCanvasData();
150
+ const gifToCanvas$1 = new gifToCanvas.GifToCanvas(url, {
151
+ targetOffset: {
152
+ dx: cropBoxData.left - canvasData.left,
153
+ dy: cropBoxData.top - canvasData.top,
154
+ width: canvasData.width,
155
+ height: canvasData.height,
156
+ sWidth: cropBoxData.width,
157
+ sHeight: cropBoxData.height
158
+ }
159
+ });
160
+ gifToCanvas$1.init();
161
+ let gifWorker = "";
162
+ if (window.location.href.includes("localhost")) {
163
+ gifWorker = "./gif.worker.js";
164
+ } else {
165
+ gifWorker = `${BASE_API}/static/js/gif.worker.js`;
166
+ }
167
+ const gifObj = new GIF__default["default"]({
168
+ workers: 4,
169
+ quality: 10,
170
+ width: cropBoxData.width,
171
+ height: cropBoxData.height,
172
+ workerScript: gifWorker
173
+ });
174
+ const addFrame = (canvas, delay) => {
175
+ gifObj.addFrame(canvas, { copy: true, delay });
176
+ };
177
+ gifToCanvas$1.on("progress", (canvas, delay) => {
178
+ addFrame(canvas, delay);
179
+ });
180
+ gifToCanvas$1.on("finished", (canvas, delay) => {
181
+ addFrame(canvas, delay);
182
+ gifObj.render();
183
+ });
184
+ gifObj.on("finished", function(blob) {
185
+ handleUploadCropData(blob, "gif");
186
+ });
187
+ } else {
188
+ const CroppedCanvas = mosaicObj.value.getCroppedCanvas({});
189
+ CroppedCanvas.toBlob(
190
+ async (blob) => {
191
+ handleUploadCropData(blob, "png");
192
+ },
193
+ "image/jpeg",
194
+ 0.75
195
+ );
196
+ }
197
+ } else {
198
+ saveLoading.value = false;
199
+ if (selectedData.value.length === cropperIndex.value + 1) {
200
+ emit("confirm", JSON.parse(JSON.stringify(selectedData.value)));
201
+ cancelDialog();
202
+ } else {
203
+ cropperIndex.value += 1;
204
+ cropperDestroy();
205
+ getMediaRealUrl();
206
+ }
207
+ }
208
+ };
209
+ const getUploadFileUrl = (file) => {
210
+ const pattern = /\+.*$/;
211
+ const result = file.url.replace(pattern, "").replace("upload", "static");
212
+ return { url: result, size: file.size || file.file.size };
213
+ };
214
+ const handleUploadCropData = async (blob, fileType) => {
215
+ const themeColors = getThemeColor();
216
+ const name = `\u88C1\u5207\u526F\u672C${new Date().getTime()}.${fileType}`;
217
+ const file = new File([blob], name, { type: blob.type });
218
+ const result = await tusUpload.uploadByTUS(file);
219
+ const resImg = getUploadFileUrl(result);
220
+ if (!props.generateAssets) {
221
+ afterCropperAndUploadFile({
222
+ url: resImg.url,
223
+ banner_theme_color: themeColors
224
+ });
225
+ return;
226
+ }
227
+ if (props.userInfo) {
228
+ const param = {
229
+ url: resImg.url,
230
+ size: resImg.size,
231
+ alias: index.replaceSuffix(
232
+ selectedData.value[cropperIndex.value].alias,
233
+ "\u88C1\u5207\u526F\u672C"
234
+ ),
235
+ repository_id: props.userInfo.repository_id,
236
+ directory_id: selectedData.value[cropperIndex.value].directory_id,
237
+ banner_theme_color: themeColors
238
+ };
239
+ assets.useGenerateAssets(BASE_API, param).then((response) => {
240
+ response.message.banner_theme_color = themeColors;
241
+ afterCropperAndUploadFile(response.message);
242
+ });
243
+ }
244
+ };
245
+ const afterCropperAndUploadFile = (data) => {
246
+ selectedData.value[cropperIndex.value] = { ...data };
247
+ saveLoading.value = false;
248
+ if (selectedData.value.length === cropperIndex.value + 1) {
249
+ emit("confirm", JSON.parse(JSON.stringify(selectedData.value)));
250
+ cancelDialog();
251
+ } else {
252
+ cropperIndex.value += 1;
253
+ cropperDestroy();
254
+ getMediaRealUrl();
255
+ }
256
+ };
257
+ const getThemeColor = () => {
258
+ const colorThief = new ColorThief__default["default"]();
259
+ const img = document.getElementById("cropper_img");
260
+ let themeColors = [];
261
+ const Palette = colorThief.getPalette(img);
262
+ if (Palette) {
263
+ themeColors = Palette.slice(0, 8);
264
+ } else {
265
+ themeColors = [[255, 255, 255]];
266
+ }
267
+ return themeColors;
268
+ };
269
+ const getMediaRealUrl = () => {
270
+ const item = selectedData.value[cropperIndex.value];
271
+ const flag = !item.url.includes("/poplar/v2");
272
+ const cape = item.url.includes("cape/v1/upload");
273
+ croppering.value = true;
274
+ getBase64(item.url);
275
+ if (item.realUrl && flag || cape) {
276
+ getBase64(item.url);
277
+ } else {
278
+ api.getFileRealUrl(BASE_API, item.url).then((res) => {
279
+ getBase64(res.message);
280
+ });
281
+ }
282
+ };
283
+ vue.watch(
284
+ () => props.visible,
285
+ (newVal) => {
286
+ if (newVal) {
287
+ init();
288
+ }
289
+ }
290
+ );
291
+ const init = () => {
292
+ cropperIndex.value = 0;
293
+ selectedData.value = props.corpData;
294
+ if (props.aspectRatioProp && Array.isArray(props.aspectRatioProp)) {
295
+ const aspectRatioLists = aspectRatioList.map((item) => {
296
+ item.buttonIndex = cropperIndex.value++;
297
+ return item;
298
+ }).filter((item) => {
299
+ return props.aspectRatioProp.includes(item.value);
300
+ });
301
+ if (aspectRatioLists.length) {
302
+ customizedAspectRatioList.value = aspectRatioLists;
303
+ }
304
+ }
305
+ getMediaRealUrl();
306
+ };
307
+ return (_ctx, _cache) => {
308
+ const _directive_loading = vue.resolveDirective("loading");
309
+ return vue.openBlock(), vue.createBlock(vue.unref(webVue.Modal), {
310
+ visible: _ctx.visible,
311
+ width: "986px",
312
+ "mask-closable": false,
313
+ "title-align": "center",
314
+ "unmount-on-close": "",
315
+ "modal-class": "image-crop-modal-wrapper",
316
+ "body-class": "image-crop-modal-body"
317
+ }, {
318
+ title: vue.withCtx(() => [
319
+ vue.createTextVNode(vue.toDisplayString(_ctx.aspectRatioProp ? "\u88C1\u526A\u56FE\u7247" : "\u8BF7\u9009\u62E9\u88C1\u526A\u6BD4\u4F8B"), 1)
320
+ ]),
321
+ footer: vue.withCtx(() => [
322
+ vue.createElementVNode("span", _hoisted_8, [
323
+ vue.createElementVNode("div", _hoisted_9, [
324
+ vue.createVNode(vue.unref(webVue.Tooltip), { content: "\u653E\u5927" }, {
325
+ default: vue.withCtx(() => [
326
+ vue.createVNode(vue.unref(webVue.Button), {
327
+ class: "cropper-btn",
328
+ shape: "circle",
329
+ onClick: _cache[0] || (_cache[0] = ($event) => cropperZoom(0.1))
330
+ }, {
331
+ default: vue.withCtx(() => [
332
+ vue.createVNode(vue.unref(icon.IconZoomIn))
333
+ ]),
334
+ _: 1
335
+ })
336
+ ]),
337
+ _: 1
338
+ }),
339
+ vue.createVNode(vue.unref(webVue.Tooltip), { content: "\u7F29\u5C0F" }, {
340
+ default: vue.withCtx(() => [
341
+ vue.createVNode(vue.unref(webVue.Button), {
342
+ class: "cropper-btn",
343
+ shape: "circle",
344
+ onClick: _cache[1] || (_cache[1] = ($event) => cropperZoom(-0.1))
345
+ }, {
346
+ default: vue.withCtx(() => [
347
+ vue.createVNode(vue.unref(icon.IconZoomOut))
348
+ ]),
349
+ _: 1
350
+ })
351
+ ]),
352
+ _: 1
353
+ }),
354
+ vue.createVNode(vue.unref(webVue.Tooltip), { content: "\u5411\u5DE6\u65CB\u8F6C45\u5EA6" }, {
355
+ default: vue.withCtx(() => [
356
+ vue.createVNode(vue.unref(webVue.Button), {
357
+ class: "cropper-btn",
358
+ shape: "circle",
359
+ onClick: _cache[2] || (_cache[2] = ($event) => cropperRotate(-45))
360
+ }, {
361
+ default: vue.withCtx(() => [
362
+ vue.createVNode(vue.unref(icon.IconRotateLeft))
363
+ ]),
364
+ _: 1
365
+ })
366
+ ]),
367
+ _: 1
368
+ }),
369
+ vue.createVNode(vue.unref(webVue.Tooltip), { content: "\u5411\u53F3\u65CB\u8F6C45\u5EA6" }, {
370
+ default: vue.withCtx(() => [
371
+ vue.createVNode(vue.unref(webVue.Button), {
372
+ class: "cropper-btn",
373
+ shape: "circle",
374
+ onClick: _cache[3] || (_cache[3] = ($event) => cropperRotate(45))
375
+ }, {
376
+ default: vue.withCtx(() => [
377
+ vue.createVNode(vue.unref(icon.IconRotateRight))
378
+ ]),
379
+ _: 1
380
+ })
381
+ ]),
382
+ _: 1
383
+ }),
384
+ vue.createVNode(vue.unref(webVue.Tooltip), { content: "\u91CD\u7F6E" }, {
385
+ default: vue.withCtx(() => [
386
+ vue.createVNode(vue.unref(webVue.Button), {
387
+ class: "cropper-btn",
388
+ shape: "circle",
389
+ onClick: cropperReset
390
+ }, {
391
+ default: vue.withCtx(() => [
392
+ vue.createVNode(vue.unref(icon.IconSync))
393
+ ]),
394
+ _: 1
395
+ })
396
+ ]),
397
+ _: 1
398
+ })
399
+ ]),
400
+ vue.createElementVNode("div", _hoisted_10, [
401
+ vue.createVNode(vue.unref(webVue.Space), null, {
402
+ default: vue.withCtx(() => [
403
+ vue.createVNode(vue.unref(webVue.Button), {
404
+ size: "medium",
405
+ onClick: cancelDialog
406
+ }, {
407
+ default: vue.withCtx(() => [
408
+ vue.createTextVNode("\u53D6\u6D88")
409
+ ]),
410
+ _: 1
411
+ }),
412
+ vue.withDirectives(vue.createVNode(vue.unref(webVue.Button), {
413
+ size: "medium",
414
+ type: "primary",
415
+ loading: saveLoading.value,
416
+ onClick: save
417
+ }, {
418
+ default: vue.withCtx(() => [
419
+ vue.createTextVNode("\u88C1\u526A")
420
+ ]),
421
+ _: 1
422
+ }, 8, ["loading"]), [
423
+ [vue.vShow, !croppering.value]
424
+ ])
425
+ ]),
426
+ _: 1
427
+ })
428
+ ])
429
+ ])
430
+ ]),
431
+ default: vue.withCtx(() => [
432
+ vue.createElementVNode("div", _hoisted_1, [
433
+ vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
434
+ class: vue.normalizeClass(["edit", {
435
+ fullHeight: _ctx.aspectRatioProp && !Array.isArray(_ctx.aspectRatioProp)
436
+ }])
437
+ }, [
438
+ vue.createElementVNode("div", _hoisted_2, [
439
+ editImage.value ? (vue.openBlock(), vue.createElementBlock("img", {
440
+ key: 0,
441
+ id: "cropper_img",
442
+ class: "position",
443
+ crossorigin: "anonymous",
444
+ src: editImage.value,
445
+ onLoad: loadImage
446
+ }, null, 40, _hoisted_3)) : vue.createCommentVNode("v-if", true)
447
+ ])
448
+ ], 2)), [
449
+ [_directive_loading, croppering.value]
450
+ ]),
451
+ !_ctx.aspectRatioProp ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
452
+ (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(aspectRatioList, (item, i) => {
453
+ return vue.createElementVNode("div", {
454
+ key: item.lable,
455
+ class: vue.normalizeClass(["btn btn" + (i + 1), { active: aspectRatioActive.value === i }]),
456
+ onClick: ($event) => cropper(item.value, i)
457
+ }, vue.toDisplayString(item.label), 11, _hoisted_5);
458
+ }), 64))
459
+ ])) : vue.createCommentVNode("v-if", true),
460
+ _ctx.aspectRatioProp && Array.isArray(_ctx.aspectRatioProp) && customizedAspectRatioList.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
461
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(customizedAspectRatioList.value, (item, i) => {
462
+ return vue.openBlock(), vue.createElementBlock("div", {
463
+ key: item.lable,
464
+ class: vue.normalizeClass([
465
+ "btn btn" + (item.buttonIndex + 1),
466
+ { active: aspectRatioActive.value === i }
467
+ ]),
468
+ onClick: ($event) => cropper(item.value, i)
469
+ }, vue.toDisplayString(item.label), 11, _hoisted_7);
470
+ }), 128))
471
+ ])) : vue.createCommentVNode("v-if", true)
472
+ ])
473
+ ]),
474
+ _: 1
475
+ }, 8, ["visible"]);
476
+ };
477
+ }
478
+ });
479
+ module.exports = _sfc_main;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var component = require("./component.js");
3
+ const imageCrop = Object.assign(component, {
4
+ install: (app) => {
5
+ app.component(component.name, component);
6
+ }
7
+ });
8
+ module.exports = imageCrop;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ var request = require("../../utils/request.js");
4
+ function getFileRealUrl(BASE_API, url) {
5
+ return request(BASE_API, {
6
+ url,
7
+ method: "get",
8
+ params: {
9
+ real_url: "true"
10
+ }
11
+ });
12
+ }
13
+ exports.getFileRealUrl = getFileRealUrl;