@ibiz-template/vue3-components 0.7.41-alpha.5 → 0.7.41-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/ibiz-markdown-editor-V31Pwvs_.js +1 -0
  2. package/dist/index-2Djp0sQl.js +4 -0
  3. package/dist/index.min.css +1 -1
  4. package/dist/index.system.min.js +1 -1
  5. package/dist/wang-editor-kEzIt0zV.js +1 -0
  6. package/dist/{xlsx-util-GVd_ca5q.js → xlsx-util-_VPcoWqm.js} +1 -1
  7. package/es/common/data-import2/data-import2.mjs +3 -2
  8. package/es/editor/code/monaco-editor/monaco-editor.mjs +2 -8
  9. package/es/editor/html/wang-editor/wang-editor.mjs +5 -10
  10. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +2 -2
  11. package/es/editor/text-box/input/input.mjs +2 -8
  12. package/es/editor/upload/use/use-iview-upload.mjs +3 -4
  13. package/es/util/app-util/app-util.mjs +2 -8
  14. package/es/util/notification-util/upload-manager/upload-manager.mjs +1 -5
  15. package/es/web-app/util/unauthorized-handler/unauthorized-handler.mjs +1 -1
  16. package/lib/common/data-import2/data-import2.cjs +2 -1
  17. package/lib/editor/code/monaco-editor/monaco-editor.cjs +1 -7
  18. package/lib/editor/html/wang-editor/wang-editor.cjs +4 -9
  19. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +2 -2
  20. package/lib/editor/text-box/input/input.cjs +1 -7
  21. package/lib/editor/upload/use/use-iview-upload.cjs +2 -3
  22. package/lib/util/app-util/app-util.cjs +1 -7
  23. package/lib/util/notification-util/upload-manager/upload-manager.cjs +1 -5
  24. package/lib/web-app/util/unauthorized-handler/unauthorized-handler.cjs +1 -1
  25. package/package.json +4 -4
  26. package/dist/ibiz-markdown-editor--ivCvp3a.js +0 -1
  27. package/dist/index-u5jvzY6s.js +0 -4
  28. package/dist/wang-editor--AXyy3P_.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { isVNode, ref, watch, onMounted, computed, createVNode, resolveComponent, resolveDirective, withDirectives, defineComponent } from 'vue';
2
2
  import { useNamespace } from '@ibiz-template/vue3-util';
3
3
  import qs from 'qs';
4
- import { CoreConst, getAppCookie, showTitle } from '@ibiz-template/core';
4
+ import { showTitle } from '@ibiz-template/core';
5
5
  import { clone } from 'ramda';
6
6
  import './data-import2.css';
7
7
  import { getDefaultDataImport, getImportSchema, updateImportSchema, createImportSchema, asyncImportData2, fetchImportSchemas } from '@ibiz-template/runtime';
@@ -234,8 +234,9 @@ const DataImport2 = /* @__PURE__ */ defineComponent({
234
234
  }
235
235
  columnMappingListQuery();
236
236
  });
237
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
237
238
  const headers = ref({
238
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(getAppCookie(CoreConst.TOKEN))
239
+ ...uploadHeaders
239
240
  });
240
241
  const UploadUrl = computed(() => {
241
242
  let uploadFileUrl;
@@ -4,7 +4,7 @@ import { createUUID } from 'qx-util';
4
4
  import { ElMessageBox } from 'element-plus';
5
5
  import '../../../node_modules/.pnpm/@monaco-editor_loader@1.4.0_monaco-editor@0.45.0/node_modules/@monaco-editor/loader/lib/es/index.mjs';
6
6
  import { UIActionUtil, SysUIActionTag } from '@ibiz-template/runtime';
7
- import { StringUtil, CoreConst, getAppCookie, IBizContext } from '@ibiz-template/core';
7
+ import { StringUtil, IBizContext } from '@ibiz-template/core';
8
8
  import '../../../util/index.mjs';
9
9
  import './monaco-editor.css';
10
10
  import { calcAiToolbarItemsByAc } from '../../../util/ai-util/ai-util.mjs';
@@ -242,13 +242,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
242
242
  uploader: {
243
243
  onUpload: async (file, reportProgress, options) => {
244
244
  const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
245
- const uploadHeaders = {};
246
- const token = getAppCookie(CoreConst.TOKEN);
247
- if (token) {
248
- Object.assign(uploadHeaders, {
249
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
250
- });
251
- }
245
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
252
246
  const formData = new FormData();
253
247
  formData.append("file", file);
254
248
  const res = await ibiz.net.axios({
@@ -3,7 +3,7 @@ import { Toolbar, Editor } from '@wangeditor/editor-for-vue';
3
3
  import { createUUID } from 'qx-util';
4
4
  import { isNil } from 'ramda';
5
5
  import { getHtmlProps, getEditorEmits, useNamespace, useUIStore } from '@ibiz-template/vue3-util';
6
- import { CoreConst, getAppCookie, StringUtil, IBizContext, awaitTimeout } from '@ibiz-template/core';
6
+ import { StringUtil, IBizContext, awaitTimeout } from '@ibiz-template/core';
7
7
  import { UIActionUtil, SysUIActionTag } from '@ibiz-template/runtime';
8
8
  import { ElMessageBox } from 'element-plus';
9
9
  import '../../../util/index.mjs';
@@ -27,8 +27,9 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
27
27
  const toolbarRef = ref();
28
28
  const editorRef = shallowRef();
29
29
  const valueHtml = ref("");
30
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
30
31
  const headers = ref({
31
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(getAppCookie(CoreConst.TOKEN))
32
+ ...uploadHeaders
32
33
  });
33
34
  const uploadUrl = ref("");
34
35
  const downloadUrl = ref("");
@@ -303,19 +304,13 @@ const IBizHtml = /* @__PURE__ */ defineComponent({
303
304
  uploader: {
304
305
  onUpload: async (file, reportProgress, options) => {
305
306
  const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
306
- const uploadHeaders = {};
307
- const token = getAppCookie(CoreConst.TOKEN);
308
- if (token) {
309
- Object.assign(uploadHeaders, {
310
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
311
- });
312
- }
307
+ const fielUploadHeaders = ibiz.util.file.getUploadHeaders();
313
308
  const formData = new FormData();
314
309
  formData.append("file", file);
315
310
  const res = await ibiz.net.axios({
316
311
  url: fileMeata.uploadUrl,
317
312
  method: "post",
318
- headers: uploadHeaders,
313
+ headers: fielUploadHeaders,
319
314
  data: formData,
320
315
  onUploadProgress: (progressEvent) => {
321
316
  const percent = progressEvent.loaded / progressEvent.total * 100;
@@ -2,7 +2,6 @@ import { ref, watch, nextTick, onMounted, onBeforeUnmount, onUnmounted, createVN
2
2
  import { getMarkDownProps, getEditorEmits, useNamespace, useUIStore } from '@ibiz-template/vue3-util';
3
3
  import { createUUID } from 'qx-util';
4
4
  import Cherry from 'cherry-markdown';
5
- import { CoreConst, getAppCookie } from '@ibiz-template/core';
6
5
  import './ibiz-markdown-editor.css';
7
6
 
8
7
  "use strict";
@@ -19,8 +18,9 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
19
18
  const currentVal = ref("");
20
19
  let editor = null;
21
20
  const id = createUUID();
21
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
22
22
  const headers = ref({
23
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(getAppCookie(CoreConst.TOKEN))
23
+ ...uploadHeaders
24
24
  });
25
25
  const uploadUrl = ref("");
26
26
  const downloadUrl = ref("");
@@ -2,7 +2,7 @@ import { isVNode, ref, computed, watch, onUnmounted, resolveComponent, createVNo
2
2
  import { debounce } from 'lodash-es';
3
3
  import { getInputProps, getEditorEmits, useNamespace, useUIStore, useCodeListListen } from '@ibiz-template/vue3-util';
4
4
  import { UIActionUtil, SysUIActionTag } from '@ibiz-template/runtime';
5
- import { isEmoji, base64ToStr, StringUtil, CoreConst, getAppCookie, IBizContext } from '@ibiz-template/core';
5
+ import { isEmoji, base64ToStr, StringUtil, IBizContext } from '@ibiz-template/core';
6
6
  import { createUUID } from 'qx-util';
7
7
  import '../../../util/index.mjs';
8
8
  import './input.css';
@@ -312,13 +312,7 @@ const IBizInput = /* @__PURE__ */ defineComponent({
312
312
  uploader: {
313
313
  onUpload: async (file, reportProgress, options) => {
314
314
  const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
315
- const uploadHeaders = {};
316
- const token = getAppCookie(CoreConst.TOKEN);
317
- if (token) {
318
- Object.assign(uploadHeaders, {
319
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
320
- });
321
- }
315
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
322
316
  const formData = new FormData();
323
317
  formData.append("file", file);
324
318
  const res = await ibiz.net.axios({
@@ -1,12 +1,11 @@
1
- import { CoreConst, getAppCookie, HttpError } from '@ibiz-template/core';
1
+ import { HttpError } from '@ibiz-template/core';
2
2
  import { ref, watch, computed } from 'vue';
3
3
 
4
4
  "use strict";
5
5
  function useIViewUpload(props, valueChange, c) {
6
6
  const files = ref([]);
7
- const headers = ref({
8
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(getAppCookie(CoreConst.TOKEN))
9
- });
7
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
8
+ const headers = ref({ ...uploadHeaders });
10
9
  const uploadUrl = ref("");
11
10
  const downloadUrl = ref("");
12
11
  const uploadCache = {
@@ -1,6 +1,6 @@
1
1
  import { getDeACMode, calcDeCodeNameById, ConfigService, UIActionUtil, SysUIActionTag } from '@ibiz-template/runtime';
2
2
  import { createUUID } from 'qx-util';
3
- import { CoreConst, getAppCookie, IBizContext } from '@ibiz-template/core';
3
+ import { IBizContext } from '@ibiz-template/core';
4
4
  import { route2routePath, useUIStore } from '@ibiz-template/vue3-util';
5
5
  import { calcAiToolbarItemsByAc } from '../ai-util/ai-util.mjs';
6
6
 
@@ -381,13 +381,7 @@ class AppUtil {
381
381
  (options == null ? void 0 : options.params) || params,
382
382
  {}
383
383
  );
384
- const headers = {};
385
- const token = getAppCookie(CoreConst.TOKEN);
386
- if (token) {
387
- Object.assign(headers, {
388
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
389
- });
390
- }
384
+ const headers = ibiz.util.file.getUploadHeaders();
391
385
  const formData = new FormData();
392
386
  formData.append("file", file);
393
387
  const res = await ibiz.net.axios({
@@ -1,6 +1,5 @@
1
1
  import { ref, computed, watch, onMounted, resolveComponent, createVNode, defineComponent } from 'vue';
2
2
  import { useNamespace } from '@ibiz-template/vue3-util';
3
- import { CoreConst, getAppCookie } from '@ibiz-template/core';
4
3
  import { getFileSvgByType } from './file-type.mjs';
5
4
  import './upload-manager.css';
6
5
 
@@ -55,10 +54,7 @@ const IBizUploadManager = /* @__PURE__ */ defineComponent({
55
54
  const uploadFile = async (item) => {
56
55
  const data = new FormData();
57
56
  data.append("file", item.file);
58
- const headers = {
59
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(getAppCookie(CoreConst.TOKEN)),
60
- ...props.params.headers
61
- };
57
+ const headers = ibiz.util.file.getUploadHeaders();
62
58
  const res = await ibiz.net.axios({
63
59
  url: props.params.uploadUrl,
64
60
  method: "post",
@@ -108,7 +108,7 @@ class UnauthorizedHandler {
108
108
  if (error instanceof HttpError) {
109
109
  if (error.status === 401) {
110
110
  const search = qs.parse(window.location.search.replace("?", ""));
111
- if (search.isAnonymous) {
111
+ if (search.isAnonymous || ibiz.env.enableAnonymous) {
112
112
  ibiz.auth.anonymousLogin().then((bol) => {
113
113
  if (bol) {
114
114
  window.location.reload();
@@ -236,8 +236,9 @@ const DataImport2 = /* @__PURE__ */ vue.defineComponent({
236
236
  }
237
237
  columnMappingListQuery();
238
238
  });
239
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
239
240
  const headers = vue.ref({
240
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(core.getAppCookie(core.CoreConst.TOKEN))
241
+ ...uploadHeaders
241
242
  });
242
243
  const UploadUrl = vue.computed(() => {
243
244
  let uploadFileUrl;
@@ -244,13 +244,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
244
244
  uploader: {
245
245
  onUpload: async (file, reportProgress, options) => {
246
246
  const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
247
- const uploadHeaders = {};
248
- const token = core.getAppCookie(core.CoreConst.TOKEN);
249
- if (token) {
250
- Object.assign(uploadHeaders, {
251
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
252
- });
253
- }
247
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
254
248
  const formData = new FormData();
255
249
  formData.append("file", file);
256
250
  const res = await ibiz.net.axios({
@@ -31,8 +31,9 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
31
31
  const toolbarRef = vue.ref();
32
32
  const editorRef = vue.shallowRef();
33
33
  const valueHtml = vue.ref("");
34
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
34
35
  const headers = vue.ref({
35
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(core.getAppCookie(core.CoreConst.TOKEN))
36
+ ...uploadHeaders
36
37
  });
37
38
  const uploadUrl = vue.ref("");
38
39
  const downloadUrl = vue.ref("");
@@ -307,19 +308,13 @@ const IBizHtml = /* @__PURE__ */ vue.defineComponent({
307
308
  uploader: {
308
309
  onUpload: async (file, reportProgress, options) => {
309
310
  const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
310
- const uploadHeaders = {};
311
- const token = core.getAppCookie(core.CoreConst.TOKEN);
312
- if (token) {
313
- Object.assign(uploadHeaders, {
314
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
315
- });
316
- }
311
+ const fielUploadHeaders = ibiz.util.file.getUploadHeaders();
317
312
  const formData = new FormData();
318
313
  formData.append("file", file);
319
314
  const res = await ibiz.net.axios({
320
315
  url: fileMeata.uploadUrl,
321
316
  method: "post",
322
- headers: uploadHeaders,
317
+ headers: fielUploadHeaders,
323
318
  data: formData,
324
319
  onUploadProgress: (progressEvent) => {
325
320
  const percent = progressEvent.loaded / progressEvent.total * 100;
@@ -6,7 +6,6 @@ var vue = require('vue');
6
6
  var vue3Util = require('@ibiz-template/vue3-util');
7
7
  var qxUtil = require('qx-util');
8
8
  var Cherry = require('cherry-markdown');
9
- var core = require('@ibiz-template/core');
10
9
  require('./ibiz-markdown-editor.css');
11
10
 
12
11
  "use strict";
@@ -23,8 +22,9 @@ const IBizMarkDown = /* @__PURE__ */ vue.defineComponent({
23
22
  const currentVal = vue.ref("");
24
23
  let editor = null;
25
24
  const id = qxUtil.createUUID();
25
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
26
26
  const headers = vue.ref({
27
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(core.getAppCookie(core.CoreConst.TOKEN))
27
+ ...uploadHeaders
28
28
  });
29
29
  const uploadUrl = vue.ref("");
30
30
  const downloadUrl = vue.ref("");
@@ -314,13 +314,7 @@ const IBizInput = /* @__PURE__ */ vue.defineComponent({
314
314
  uploader: {
315
315
  onUpload: async (file, reportProgress, options) => {
316
316
  const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
317
- const uploadHeaders = {};
318
- const token = core.getAppCookie(core.CoreConst.TOKEN);
319
- if (token) {
320
- Object.assign(uploadHeaders, {
321
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
322
- });
323
- }
317
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
324
318
  const formData = new FormData();
325
319
  formData.append("file", file);
326
320
  const res = await ibiz.net.axios({
@@ -6,9 +6,8 @@ var vue = require('vue');
6
6
  "use strict";
7
7
  function useIViewUpload(props, valueChange, c) {
8
8
  const files = vue.ref([]);
9
- const headers = vue.ref({
10
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(core.getAppCookie(core.CoreConst.TOKEN))
11
- });
9
+ const uploadHeaders = ibiz.util.file.getUploadHeaders();
10
+ const headers = vue.ref({ ...uploadHeaders });
12
11
  const uploadUrl = vue.ref("");
13
12
  const downloadUrl = vue.ref("");
14
13
  const uploadCache = {
@@ -383,13 +383,7 @@ class AppUtil {
383
383
  (options == null ? void 0 : options.params) || params,
384
384
  {}
385
385
  );
386
- const headers = {};
387
- const token = core.getAppCookie(core.CoreConst.TOKEN);
388
- if (token) {
389
- Object.assign(headers, {
390
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(token)
391
- });
392
- }
386
+ const headers = ibiz.util.file.getUploadHeaders();
393
387
  const formData = new FormData();
394
388
  formData.append("file", file);
395
389
  const res = await ibiz.net.axios({
@@ -2,7 +2,6 @@
2
2
 
3
3
  var vue = require('vue');
4
4
  var vue3Util = require('@ibiz-template/vue3-util');
5
- var core = require('@ibiz-template/core');
6
5
  var fileType = require('./file-type.cjs');
7
6
  require('./upload-manager.css');
8
7
 
@@ -57,10 +56,7 @@ const IBizUploadManager = /* @__PURE__ */ vue.defineComponent({
57
56
  const uploadFile = async (item) => {
58
57
  const data = new FormData();
59
58
  data.append("file", item.file);
60
- const headers = {
61
- ["".concat(ibiz.env.tokenHeader, "Authorization")]: "".concat(ibiz.env.tokenPrefix, "Bearer ").concat(core.getAppCookie(core.CoreConst.TOKEN)),
62
- ...props.params.headers
63
- };
59
+ const headers = ibiz.util.file.getUploadHeaders();
64
60
  const res = await ibiz.net.axios({
65
61
  url: props.params.uploadUrl,
66
62
  method: "post",
@@ -110,7 +110,7 @@ class UnauthorizedHandler {
110
110
  if (error instanceof core.HttpError) {
111
111
  if (error.status === 401) {
112
112
  const search = qs.parse(window.location.search.replace("?", ""));
113
- if (search.isAnonymous) {
113
+ if (search.isAnonymous || ibiz.env.enableAnonymous) {
114
114
  ibiz.auth.anonymousLogin().then((bol) => {
115
115
  if (bol) {
116
116
  window.location.reload();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.7.41-alpha.5",
3
+ "version": "0.7.41-alpha.6",
4
4
  "description": "web端组件库(vue3)",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -36,10 +36,10 @@
36
36
  "@ibiz-template-plugin/data-view": "0.0.4",
37
37
  "@ibiz-template/core": "0.7.41-alpha.2",
38
38
  "@ibiz-template/devtool": "0.0.11",
39
- "@ibiz-template/model-helper": "0.7.41-alpha.5",
40
- "@ibiz-template/runtime": "0.7.41-alpha.5",
39
+ "@ibiz-template/model-helper": "0.7.41-alpha.6",
40
+ "@ibiz-template/runtime": "0.7.41-alpha.6",
41
41
  "@ibiz-template/theme": "0.7.39",
42
- "@ibiz-template/vue3-util": "0.7.41-alpha.5",
42
+ "@ibiz-template/vue3-util": "0.7.41-alpha.6",
43
43
  "@ibiz-template/web-theme": "3.4.0",
44
44
  "@ibiz/model-core": "^0.1.77",
45
45
  "@imengyu/vue3-context-menu": "^1.3.5",
@@ -1 +0,0 @@
1
- System.register(["vue","@ibiz-template/vue3-util","qx-util","cherry-markdown","@ibiz-template/core"],(function(e){"use strict";var t,n,l,o,i,r,a,s,c,u,d,h,m,v,b,f;return{setters:[function(e){t=e.defineComponent,n=e.ref,l=e.watch,o=e.onMounted,i=e.onBeforeUnmount,r=e.onUnmounted,a=e.createVNode,s=e.nextTick},function(e){c=e.getMarkDownProps,u=e.getEditorEmits,d=e.useNamespace,h=e.useUIStore},function(e){m=e.createUUID},function(e){v=e.default},function(e){b=e.getAppCookie,f=e.CoreConst}],execute:function(){e("default",t({name:"IBizMarkDown",props:c(),emits:u(),setup(e,{emit:t}){var a;const c=d("markdown"),u=e.controller,p=n("");let g=null;const k=m(),w=n({["".concat(ibiz.env.tokenHeader,"Authorization")]:"".concat(ibiz.env.tokenPrefix,"Bearer ").concat(b(f.TOKEN))}),y=n(""),C=n(""),x=null==(a=null==u?void 0:u.editorParams)?void 0:a.customTheme,{UIStore:z}=h(),E=n(x||z.theme),U=n("editOnly");let B=null,T=0;const D=n({});let M=!1;l((()=>e.data),(e=>{if(e&&u){const t=ibiz.util.file.calcFileUpDownUrl(u.context,u.params,e,u.editorParams);y.value=t.uploadUrl,C.value=t.downloadUrl}}),{immediate:!0,deep:!0});const N=n(),O=async(e,t)=>{const n=await ibiz.util.file.fileUpload(y.value,e,w.value);t(C.value.replace("%fileId%",n.fileid))},P=()=>null==g?void 0:g.getMarkdown(),S=e=>{M=!0,null==g||g.setMarkdown(e,!1)};l((()=>e.value),((e,t)=>{e!==t&&(p.value=e||"")}),{immediate:!0}),l(p,((e,t)=>{const n=P();e!==t&&n!==e&&S(e)}));const I=e=>{t("change",P(),null==u?void 0:u.model.id,M),M=!1},V=(e,t)=>({[e]:t}),q=(e,t="")=>{const n=document.createElement(e);return n.className=t,n},A=e=>q("i","ch-icon ch-icon-".concat(e)),R=c.e("fullscreen"),j=e=>{for(;e.firstChild;)e.removeChild(e.firstChild)},H=()=>{if(g&&N.value){const e=g.editor.options.editorDom.parentElement;if(!e)return{};const t=e.classList,n=N.value.querySelector(".".concat(R));return n?{parentElement:e,cherryClass:t,fullscreenNode:n}:{}}return{}},L=()=>{const{parentElement:e,cherryClass:t,fullscreenNode:n}=H();e&&t&&n&&(j(n),n.appendChild(A("fullscreen")),n.title=ibiz.i18n.t("editor.common.fullscreen"),t.remove("fullscreen"),null==e||e.blur(),e.setAttribute("tabindex","-1"))},W=()=>{const{cherryClass:e}=H();return null==e?void 0:e.contains("fullscreen")},F=()=>{g&&N.value&&(W()?L():(()=>{const{parentElement:e,cherryClass:t,fullscreenNode:n}=H();e&&t&&n&&(j(n),n.appendChild(A("minscreen")),t.add("fullscreen"),n.title=ibiz.i18n.t("editor.common.minimize"),e.setAttribute("tabindex","-1"),s((()=>null==e?void 0:e.focus())))})())},K=e=>{e.stopPropagation(),"Escape"===e.key&&W()&&L()};l((()=>z.theme),(e=>{E.value=x||e,null==g||g.setTheme(E.value),null==g||g.setCodeBlockTheme(E.value)}));return o((()=>{var t;e.disabled&&(U.value="previewOnly"),s((()=>{var t;g=new v({id:k,value:p.value,previewer:{enablePreviewerBubble:!(e.disabled||e.readonly)},themeSettings:{mainTheme:E.value,codeBlockTheme:E.value},fileUpload:O,emoji:{useUnicode:!0},header:{anchorStyle:"autonumber"},editor:{height:"100%",defaultModel:U.value,codemirror:{autofocus:!1}},toolbars:{toolbar:["bold","italic","underline","strikethrough","|","color","header","|","list","image",{insert:["link","hr","br","code","formula","toc","table","line-table","bar-table"]},"settings","togglePreview"],bubble:["bold","italic","underline","strikethrough","sub","sup","|","size","color"],float:["h1","h2","h3","|","checklist","quote","quickTable","code"],customMenu:[],sidebar:[]},callback:{afterChange:I,beforeImageMounted:V},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}}),g.setTheme(E.value),x&&(g.setTheme(x),g.setCodeBlockTheme(x));const n=q("span","".concat(R," cherry-toolbar-button"));n.title=ibiz.i18n.t("editor.common.fullscreen"),n.onclick=F,n.appendChild(A("fullscreen"));const l=e.disabled?g.editor.options.editorDom.parentElement:null==(t=g.editor.options.editorDom.parentElement)?void 0:t.querySelector(".cherry-toolbar>.toolbar-right");null==l||l.appendChild(n)})),(()=>{if(window.ResizeObserver&&N.value){const e={width:N.value.offsetWidth?"".concat(N.value.offsetWidth,"px"):"100%"};u&&"number"==typeof u.parent.model.height&&Object.assign(e,{height:"".concat(u.parent.model.height,"px")}),D.value=c.cssVarBlock(e),B=new ResizeObserver((e=>{const t=e[0].contentRect.width;if(t!==T){const n={width:"".concat(e[0].contentRect.width,"px")};u&&"number"==typeof u.parent.model.height&&Object.assign(n,{height:"".concat(u.parent.model.height,"px")}),D.value=c.cssVarBlock(n),T=t}})),B.observe(N.value)}})(),null==(t=N.value)||t.addEventListener("keydown",K.bind(this))})),i((()=>{var e;null==(e=N.value)||e.removeEventListener("keydown",K.bind(this))})),r((()=>{g=null,B&&B.disconnect()})),{ns:c,currentVal:p,id:k,editor:g,markDownBox:N,headers:w,theme:E,defaultModel:U,cssVars:D,getCherryHtml:()=>null==g?void 0:g.getHtml(),getCherryContent:P,setCherryContent:S}},render(){return a("div",{ref:"markDownBox",class:[this.ns.b(),this.ns.is("disabled",this.disabled)]},[a("div",{id:this.id,style:this.cssVars,class:this.ns.b("cherry")},null)])}}))}}}));