@ibiz-template/vue3-components 0.1.12-dev.0 → 0.1.13

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 (171) hide show
  1. package/dist/index.min.css +1 -1
  2. package/dist/index.system.min.js +3 -3
  3. package/dist/index.system.min.js.map +1 -1
  4. package/dist/wang-editor-0c05cd5f.js +2 -0
  5. package/dist/wang-editor-0c05cd5f.js.map +1 -0
  6. package/es/common/action-toolbar/action-toolbar.mjs +1 -1
  7. package/es/common/no-data/no-data.mjs +1 -1
  8. package/es/common/rawitem/rawitem.css +1 -1
  9. package/es/common/split/split.css +1 -1
  10. package/es/control/app-menu/app-menu.css +1 -1
  11. package/es/control/app-menu/app-menu.mjs +1 -1
  12. package/es/control/app-menu-icon-view/app-menu-icon-view.mjs +1 -1
  13. package/es/control/calendar/calendar.mjs +1 -1
  14. package/es/control/dashboard/portlet/container-portlet/container-portlet.css +1 -0
  15. package/es/control/dashboard/portlet/container-portlet/container-portlet.d.ts +1 -0
  16. package/es/control/dashboard/portlet/container-portlet/container-portlet.mjs +1 -0
  17. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  18. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.mjs +1 -1
  19. package/es/control/data-view/data-view.css +1 -1
  20. package/es/control/drbar/drbar.controller.mjs +2 -8
  21. package/es/control/drtab/drtab.controller.mjs +2 -8
  22. package/es/control/exp-bar/data-view-exp-bar/data-view-exp-bar.css +1 -1
  23. package/es/control/exp-bar/grid-exp-bar/grid-exp-bar.css +1 -1
  24. package/es/control/exp-bar/list-exp-bar/list-exp-bar.css +1 -1
  25. package/es/control/exp-bar/render-util.mjs +2 -2
  26. package/es/control/exp-bar/tree-exp-bar/tree-exp-bar.css +1 -1
  27. package/es/control/form/form/form.mjs +1 -1
  28. package/es/control/form/form-detail/form-button/form-button.css +1 -1
  29. package/es/control/form/form-detail/form-button/form-button.mjs +6 -5
  30. package/es/control/form/form-detail/form-group-panel/form-group-panel.mjs +1 -1
  31. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.d.ts +72 -0
  32. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.mjs +157 -0
  33. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.d.ts +1 -3
  34. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.mjs +17 -100
  35. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.d.ts +1 -3
  36. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.mjs +19 -85
  37. package/es/control/form/form-detail/form-mdctrl/index.mjs +2 -0
  38. package/es/control/form/form-detail/form-page/form-page.css +1 -1
  39. package/es/control/form/search-form/search-form.css +1 -1
  40. package/es/control/form/search-form/search-form.mjs +10 -3
  41. package/es/control/grid/grid-column/grid-field-column/grid-field-column.d.ts +2 -0
  42. package/es/control/grid/grid-column/grid-field-column/grid-field-column.mjs +7 -4
  43. package/es/control/grid/grid-column/grid-field-column/index.d.ts +2 -0
  44. package/es/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.mjs +2 -1
  45. package/es/control/panel/view-layout-panel/index.d.ts +10 -0
  46. package/es/control/panel/view-layout-panel/view-layout-panel.d.ts +11 -3
  47. package/es/control/panel/view-layout-panel/view-layout-panel.mjs +48 -42
  48. package/es/control/toolbar/toolbar.mjs +1 -1
  49. package/es/control/tree/tree.css +1 -1
  50. package/es/devtool/devtool-action.css +1 -0
  51. package/es/devtool/devtool-action.d.ts +26 -0
  52. package/es/devtool/devtool-action.mjs +218 -0
  53. package/es/devtool/index.d.ts +50 -0
  54. package/es/devtool/index.mjs +80 -0
  55. package/es/devtool/interface/devtool-event.d.ts +12 -0
  56. package/es/devtool/interface/devtool-event.mjs +1 -0
  57. package/es/devtool/interface/devtool-view.d.ts +15 -0
  58. package/es/devtool/interface/devtool-view.mjs +1 -0
  59. package/es/editor/check-box/ibiz-checkbox/ibiz-checkbox.mjs +1 -1
  60. package/es/editor/html/wang-editor/wang-editor.mjs +5 -0
  61. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  62. package/es/editor/text-box/input/input.d.ts +2 -2
  63. package/es/editor/text-box/input/input.mjs +1 -1
  64. package/es/index.d.ts +1 -0
  65. package/es/index.mjs +3 -0
  66. package/es/node_modules/.pnpm/element-plus@2.3.9_vue@3.3.4/node_modules/element-plus/dist/locale/zh-cn.mjs +131 -0
  67. package/es/panel-component/auth-userinfo/auth-userinfo.css +1 -1
  68. package/es/panel-component/auth-userinfo/auth-userinfo.d.ts +3 -0
  69. package/es/panel-component/auth-userinfo/auth-userinfo.mjs +29 -6
  70. package/es/panel-component/auth-userinfo/index.d.ts +3 -0
  71. package/es/panel-component/index.d.ts +1 -0
  72. package/es/panel-component/index.mjs +4 -1
  73. package/es/panel-component/nav-tabs/nav-tabs.css +1 -1
  74. package/es/panel-component/panel-app-header/panel-app-header.css +1 -1
  75. package/es/panel-component/panel-app-title/panel-app-title.css +1 -1
  76. package/es/panel-component/panel-button/panel-button.css +1 -1
  77. package/es/panel-component/panel-button/panel-button.mjs +5 -4
  78. package/es/panel-component/panel-exp-header/panel-exp-header.css +1 -1
  79. package/es/panel-component/panel-index-view-search/index.d.ts +28 -0
  80. package/es/panel-component/panel-index-view-search/index.mjs +17 -0
  81. package/es/panel-component/panel-index-view-search/panel-index-view-search.css +1 -0
  82. package/es/panel-component/panel-index-view-search/panel-index-view-search.d.ts +30 -0
  83. package/es/panel-component/panel-index-view-search/panel-index-view-search.mjs +82 -0
  84. package/es/panel-component/panel-index-view-search/panel-index-view-search.provider.d.ts +13 -0
  85. package/es/panel-component/panel-index-view-search/panel-index-view-search.provider.mjs +20 -0
  86. package/es/panel-component/single-data-container/index.d.ts +10 -0
  87. package/es/panel-component/single-data-container/single-data-container.controller.d.ts +37 -2
  88. package/es/panel-component/single-data-container/single-data-container.controller.mjs +75 -1
  89. package/es/panel-component/single-data-container/single-data-container.d.ts +11 -2
  90. package/es/panel-component/single-data-container/single-data-container.mjs +34 -21
  91. package/es/util/app-drawer/app-drawer-component.css +1 -1
  92. package/es/view/common/index.d.ts +1 -0
  93. package/es/view/common/view.css +1 -1
  94. package/es/view/common/view.d.ts +1 -0
  95. package/es/view/common/view.mjs +13 -1
  96. package/es/view-engine/tab-exp-view.engine.d.ts +1 -0
  97. package/es/view-engine/tab-exp-view.engine.mjs +8 -1
  98. package/lib/common/action-toolbar/action-toolbar.cjs +1 -1
  99. package/lib/common/no-data/no-data.cjs +1 -1
  100. package/lib/common/rawitem/rawitem.css +1 -1
  101. package/lib/common/split/split.css +1 -1
  102. package/lib/control/app-menu/app-menu.cjs +1 -1
  103. package/lib/control/app-menu/app-menu.css +1 -1
  104. package/lib/control/app-menu-icon-view/app-menu-icon-view.cjs +1 -1
  105. package/lib/control/calendar/calendar.cjs +1 -1
  106. package/lib/control/dashboard/portlet/container-portlet/container-portlet.cjs +1 -0
  107. package/lib/control/dashboard/portlet/container-portlet/container-portlet.css +1 -0
  108. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.cjs +1 -1
  109. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  110. package/lib/control/data-view/data-view.css +1 -1
  111. package/lib/control/drbar/drbar.controller.cjs +2 -8
  112. package/lib/control/drtab/drtab.controller.cjs +2 -8
  113. package/lib/control/exp-bar/data-view-exp-bar/data-view-exp-bar.css +1 -1
  114. package/lib/control/exp-bar/grid-exp-bar/grid-exp-bar.css +1 -1
  115. package/lib/control/exp-bar/list-exp-bar/list-exp-bar.css +1 -1
  116. package/lib/control/exp-bar/render-util.cjs +2 -2
  117. package/lib/control/exp-bar/tree-exp-bar/tree-exp-bar.css +1 -1
  118. package/lib/control/form/form/form.cjs +1 -1
  119. package/lib/control/form/form-detail/form-button/form-button.cjs +6 -5
  120. package/lib/control/form/form-detail/form-button/form-button.css +1 -1
  121. package/lib/control/form/form-detail/form-group-panel/form-group-panel.cjs +1 -1
  122. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.cjs +159 -0
  123. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.cjs +16 -99
  124. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.cjs +18 -84
  125. package/lib/control/form/form-detail/form-mdctrl/index.cjs +2 -0
  126. package/lib/control/form/form-detail/form-page/form-page.css +1 -1
  127. package/lib/control/form/search-form/search-form.cjs +10 -3
  128. package/lib/control/form/search-form/search-form.css +1 -1
  129. package/lib/control/grid/grid-column/grid-field-column/grid-field-column.cjs +7 -4
  130. package/lib/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.cjs +2 -1
  131. package/lib/control/panel/view-layout-panel/view-layout-panel.cjs +47 -41
  132. package/lib/control/toolbar/toolbar.cjs +1 -1
  133. package/lib/control/tree/tree.css +1 -1
  134. package/lib/devtool/devtool-action.cjs +220 -0
  135. package/lib/devtool/devtool-action.css +1 -0
  136. package/lib/devtool/index.cjs +83 -0
  137. package/lib/devtool/interface/devtool-event.cjs +2 -0
  138. package/lib/devtool/interface/devtool-view.cjs +2 -0
  139. package/lib/editor/check-box/ibiz-checkbox/ibiz-checkbox.cjs +1 -1
  140. package/lib/editor/html/wang-editor/wang-editor.cjs +5 -0
  141. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
  142. package/lib/editor/text-box/input/input.cjs +1 -1
  143. package/lib/index.cjs +165 -159
  144. package/lib/node_modules/.pnpm/element-plus@2.3.9_vue@3.3.4/node_modules/element-plus/dist/locale/zh-cn.cjs +135 -0
  145. package/lib/panel-component/auth-userinfo/auth-userinfo.cjs +28 -5
  146. package/lib/panel-component/auth-userinfo/auth-userinfo.css +1 -1
  147. package/lib/panel-component/index.cjs +19 -14
  148. package/lib/panel-component/nav-tabs/nav-tabs.css +1 -1
  149. package/lib/panel-component/panel-app-header/panel-app-header.css +1 -1
  150. package/lib/panel-component/panel-app-title/panel-app-title.css +1 -1
  151. package/lib/panel-component/panel-button/panel-button.cjs +5 -4
  152. package/lib/panel-component/panel-button/panel-button.css +1 -1
  153. package/lib/panel-component/panel-exp-header/panel-exp-header.css +1 -1
  154. package/lib/panel-component/panel-index-view-search/index.cjs +23 -0
  155. package/lib/panel-component/panel-index-view-search/panel-index-view-search.cjs +84 -0
  156. package/lib/panel-component/panel-index-view-search/panel-index-view-search.css +1 -0
  157. package/lib/panel-component/panel-index-view-search/panel-index-view-search.provider.cjs +22 -0
  158. package/lib/panel-component/single-data-container/single-data-container.cjs +33 -20
  159. package/lib/panel-component/single-data-container/single-data-container.controller.cjs +74 -0
  160. package/lib/util/app-drawer/app-drawer-component.css +1 -1
  161. package/lib/util/confirm-util/confirm-util.cjs +5 -5
  162. package/lib/util/loading-util/loading-util.cjs +2 -2
  163. package/lib/util/message-util/message-util.cjs +5 -5
  164. package/lib/util/modal-util/modal-util.cjs +6 -6
  165. package/lib/util/notification-util/notification-util.cjs +5 -5
  166. package/lib/view/common/view.cjs +12 -0
  167. package/lib/view/common/view.css +1 -1
  168. package/lib/view-engine/tab-exp-view.engine.cjs +7 -0
  169. package/package.json +6 -6
  170. package/dist/wang-editor-675011c6.js +0 -2
  171. package/dist/wang-editor-675011c6.js.map +0 -1
@@ -1,23 +1,23 @@
1
1
  'use strict';
2
2
 
3
- var elementPlus = require('element-plus');
3
+ var ElementPlus = require('element-plus');
4
4
 
5
5
  class ModalUtil {
6
6
  async info(params) {
7
- elementPlus.ElMessageBox.alert(params.desc, params.title, { type: "info" });
7
+ ElementPlus.ElMessageBox.alert(params.desc, params.title, { type: "info" });
8
8
  }
9
9
  async success(params) {
10
- elementPlus.ElMessageBox.alert(params.desc, params.title, { type: "success" });
10
+ ElementPlus.ElMessageBox.alert(params.desc, params.title, { type: "success" });
11
11
  }
12
12
  async warning(params) {
13
- elementPlus.ElMessageBox.alert(params.desc, params.title, { type: "warning" });
13
+ ElementPlus.ElMessageBox.alert(params.desc, params.title, { type: "warning" });
14
14
  }
15
15
  async error(params) {
16
- elementPlus.ElMessageBox.alert(params.desc, params.title, { type: "error" });
16
+ ElementPlus.ElMessageBox.alert(params.desc, params.title, { type: "error" });
17
17
  }
18
18
  async confirm(params) {
19
19
  return new Promise((resolve) => {
20
- elementPlus.ElMessageBox.confirm(params.desc, params.title).then(() => resolve(true)).catch(() => resolve(false));
20
+ ElementPlus.ElMessageBox.confirm(params.desc, params.title).then(() => resolve(true)).catch(() => resolve(false));
21
21
  });
22
22
  }
23
23
  }
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var elementPlus = require('element-plus');
3
+ var ElementPlus = require('element-plus');
4
4
 
5
5
  class NotificationUtil {
6
6
  info(params) {
7
7
  const duration = params.duration ? params.duration * 1e3 : 4500;
8
- elementPlus.ElNotification({
8
+ ElementPlus.ElNotification({
9
9
  title: params.title,
10
10
  message: params.desc,
11
11
  type: "info",
@@ -14,7 +14,7 @@ class NotificationUtil {
14
14
  }
15
15
  success(params) {
16
16
  const duration = params.duration ? params.duration * 1e3 : 4500;
17
- elementPlus.ElNotification({
17
+ ElementPlus.ElNotification({
18
18
  title: params.title,
19
19
  message: params.desc,
20
20
  type: "success",
@@ -23,7 +23,7 @@ class NotificationUtil {
23
23
  }
24
24
  warning(params) {
25
25
  const duration = params.duration ? params.duration * 1e3 : 4500;
26
- elementPlus.ElNotification({
26
+ ElementPlus.ElNotification({
27
27
  title: params.title,
28
28
  message: params.desc,
29
29
  type: "warning",
@@ -32,7 +32,7 @@ class NotificationUtil {
32
32
  }
33
33
  error(params) {
34
34
  const duration = params.duration ? params.duration * 1e3 : 4500;
35
- elementPlus.ElNotification({
35
+ ElementPlus.ElNotification({
36
36
  title: params.title,
37
37
  message: params.desc,
38
38
  type: "error",
@@ -4,6 +4,8 @@ var vue = require('vue');
4
4
  var runtime = require('@ibiz-template/runtime');
5
5
  var vue3Util = require('@ibiz-template/vue3-util');
6
6
  require('./view.css');
7
+ var qxUtil = require('qx-util');
8
+ var index = require('../../devtool/index.cjs');
7
9
 
8
10
  const View = /* @__PURE__ */ vue.defineComponent({
9
11
  name: "IBizView",
@@ -39,12 +41,21 @@ const View = /* @__PURE__ */ vue.defineComponent({
39
41
  const onLayoutPanelCreated = (controller) => {
40
42
  c.setLayoutPanel(controller);
41
43
  };
44
+ const container = vue.ref(null);
45
+ const key = qxUtil.createUUID();
46
+ vue.onMounted(() => {
47
+ index.devtool.registerView(key, c, container);
48
+ });
49
+ vue.onUnmounted(() => {
50
+ index.devtool.unRegisterView(key);
51
+ });
42
52
  vue.onActivated(() => c.onActivated());
43
53
  vue.onDeactivated(() => c.onDeactivated());
44
54
  return {
45
55
  c,
46
56
  controls,
47
57
  viewClassNames,
58
+ container,
48
59
  onLayoutPanelCreated
49
60
  };
50
61
  },
@@ -100,6 +111,7 @@ const View = /* @__PURE__ */ vue.defineComponent({
100
111
  }
101
112
  }
102
113
  return vue.withDirectives(vue.createVNode("div", {
114
+ "ref": "container",
103
115
  "class": this.viewClassNames
104
116
  }, [layoutPanel]), [[vue.resolveDirective("loading"), this.c.state.isLoading]]);
105
117
  }
@@ -1 +1 @@
1
- .ibiz-view{--ibiz-view-bg-color:var(--ibiz-color-bg-1);--ibiz-view-border-radius:var(--ibiz-border-radius-medium);width:100%;height:100%}.ibiz-view .ibiz-view{background-color:var(--ibiz-view-bg-color);border-radius:var(--ibiz-view-border-radius)}
1
+ .ibiz-view{--ibiz-view-bg-color:var(--ibiz-color-bg-1);--ibiz-view-border-radius:var(--ibiz-border-radius-medium);width:100%;height:100%}.ibiz-view .ibiz-view{background-color:var(--ibiz-view-bg-color);border-radius:var(--ibiz-view-border-radius)}.ibiz-view .ibiz-view-appportalview{background-color:transparent}
@@ -31,6 +31,13 @@ class TabExpViewEngine extends runtime.ViewEngineBase {
31
31
  await super.onMounted();
32
32
  await this.loadEntityData();
33
33
  }
34
+ async loadEntityData() {
35
+ const deName = runtime.calcDeCodeNameById(this.view.model.appDataEntityId);
36
+ if (!this.view.context[deName]) {
37
+ return;
38
+ }
39
+ return super.loadEntityData();
40
+ }
34
41
  }
35
42
 
36
43
  exports.TabExpViewEngine = TabExpViewEngine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.1.12-dev.0",
3
+ "version": "0.1.13",
4
4
  "description": "使用 rollup 编译 vue 组件或者 jsx",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@floating-ui/dom": "^1.5.1",
26
- "@ibiz-template/core": "^0.1.12-dev.0",
27
- "@ibiz-template/model-helper": "^0.1.12-dev.0",
28
- "@ibiz-template/runtime": "^0.1.12-dev.0",
26
+ "@ibiz-template/core": "^0.1.13",
27
+ "@ibiz-template/model-helper": "^0.1.13",
28
+ "@ibiz-template/runtime": "^0.1.13",
29
29
  "@ibiz-template/theme": "^0.1.6",
30
- "@ibiz-template/vue3-util": "^0.1.12-dev.0",
30
+ "@ibiz-template/vue3-util": "^0.1.13",
31
31
  "@ibiz/model-core": "^0.0.15",
32
32
  "@imengyu/vue3-context-menu": "^1.3.3",
33
33
  "@monaco-editor/loader": "^1.3.3",
@@ -55,7 +55,7 @@
55
55
  "@commitlint/config-conventional": "^17.7.0",
56
56
  "@ibiz-template/cli": "0.2.1",
57
57
  "@types/lodash-es": "^4.17.8",
58
- "@types/node": "^20.5.4",
58
+ "@types/node": "^20.5.7",
59
59
  "@types/qs": "^6.9.7",
60
60
  "@types/ramda": "^0.29.3",
61
61
  "husky": "^8.0.3",
@@ -1,2 +0,0 @@
1
- System.register(["vue","@wangeditor/editor-for-vue","qx-util","@ibiz-template/vue3-util","@ibiz-template/core"],function(H){"use strict";var c,d,s,u,m,f,i,h,g,v,p,C,b,y;return{setters:[function(o){c=o.defineComponent,d=o.shallowRef,s=o.ref,u=o.watch,m=o.onBeforeUnmount,f=o.onMounted,i=o.createVNode},function(o){h=o.Toolbar,g=o.Editor},function(o){v=o.getCookie},function(o){p=o.getHtmlProps,C=o.getEditorEmits,b=o.useNamespace},function(o){y=o.CoreConst}],execute:function(){const o=H("default",c({name:"IBizHtml",props:p(),emits:C(),setup(n,{emit:N}){const O=b("html"),E=n.controller,l=d(),a=s(""),L=s({Authorization:`Bearer ${v(y.TOKEN)}`}),F=s(""),k=s("");u(()=>n.data,e=>{if(e){const t=E.calcBaseUrl(e);F.value=t.uploadUrl,k.value=t.downloadUrl}},{immediate:!0,deep:!0});const U=(e,t)=>{if(t)return!0},x=e=>e,P={excludeKeys:["group-video"]},z={placeholder:E.placeHolder,readOnly:n.readonly,MENU_CONF:{uploadImage:{server:F.value,fieldName:"file",maxFileSize:10*1024*1024,maxNumberOfFiles:10,allowedFileTypes:[],headers:L.value,withCredentials:!0,onBeforeUpload(e){return e},onProgress(e){console.log("progress",e)},onSuccess(e,t){console.log(`${e.name} \u4E0A\u4F20\u6210\u529F`,t)},onFailed(e,t){console.log(`${e.name} \u4E0A\u4F20\u5931\u8D25`,t)},onError(e,t,r){console.log(`${e.name} \u4E0A\u4F20\u51FA\u9519`,t,r)},async customInsert(e,t){const r=k.value.replace("%fileId%",e.id),K=e.filename;t(r,K,"")}},insertLink:{checkLink:U,parseLinkUrl:x},editLink:{checkLink:U,parseLinkUrl:x}}};m(()=>{const e=l.value;e?.destroy()});const T=e=>{l.value=e},$=e=>{const t=e.getHtml();N("change",t==="<p><br></p>"?"":t)},w=e=>{},D=e=>{},I=e=>{},R=(e,t)=>{alert(`\u3010\u81EA\u5B9A\u4E49\u63D0\u793A\u3011${t} - ${e}`)},_=(e,t,r)=>{r(!0)},M=e=>{const t=l.value;t?.insertText(e)},S=()=>{const e=l.value;e!=null&&console.log(e.getHtml())},A=()=>{const e=l.value;e?.disable()},B=()=>{const e=l.value;e?.enable()};return f(()=>{u(()=>n.value,(e,t)=>{e!==t&&(typeof n.value=="string"||e===null)&&(e===null?a.value="":a.value=e)},{immediate:!0}),u(()=>n.disabled,(e,t)=>{e!==t&&(e===!0?A():B())},{immediate:!0})}),{ns:O,editorRef:l,mode:"default",valueHtml:a,toolbarConfig:P,editorConfig:z,handleCreated:T,handleChange:$,handleDestroyed:w,handleFocus:D,handleBlur:I,customAlert:R,customPaste:_,insertText:M,printHtml:S,disable:A,enable:B}},render(){return i("div",{class:this.ns.b()},[i("div",{style:"border: 1px solid #ccc; margin-top: 10px"},[i(h,{editor:this.editorRef,"default-config":this.toolbarConfig,mode:this.mode,style:"border-bottom: 1px solid #ccc"},null),i(g,{modelValue:this.valueHtml,"onUpdate:modelValue":n=>this.valueHtml=n,"default-config":this.editorConfig,mode:this.mode,style:"height: 400px; overflow-y: hidden",onOnCreated:this.handleCreated,onOnChange:this.handleChange,onOnDestroyed:this.handleDestroyed,onOnFocus:this.handleFocus,onOnBlur:this.handleBlur,oncustomAlert:this.customAlert,oncustomPaste:this.customPaste},null)])])}}))}}});
2
- //# sourceMappingURL=wang-editor-675011c6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wang-editor-675011c6.js","sources":["../src/editor/html/wang-editor/wang-editor.tsx"],"sourcesContent":["import {\n onBeforeUnmount,\n ref,\n shallowRef,\n onMounted,\n watch,\n Ref,\n defineComponent,\n} from 'vue';\nimport { Editor, Toolbar } from '@wangeditor/editor-for-vue';\nimport { IEditorConfig, IToolbarConfig } from '@wangeditor/editor';\nimport type { IDomEditor } from '@wangeditor/editor';\nimport { getCookie } from 'qx-util';\nimport {\n getEditorEmits,\n getHtmlProps,\n useNamespace,\n} from '@ibiz-template/vue3-util';\nimport { CoreConst } from '@ibiz-template/core';\nimport { HtmlEditorController } from '../html-editor.controller';\nimport './wang-editor.scss';\n\ntype InsertFnType = (_url: string, _alt: string, _href: string) => void;\n\nconst IBizHtml = defineComponent({\n name: 'IBizHtml',\n props: getHtmlProps<HtmlEditorController>(),\n emits: getEditorEmits(),\n setup(props, { emit }) {\n const ns = useNamespace('html');\n\n const c = props.controller!;\n\n // 编辑器实例,必须用 shallowRef,重要!\n const editorRef = shallowRef();\n\n // 内容 HTML\n const valueHtml = ref('');\n\n // 请求头\n const headers: Ref<IData> = ref({\n Authorization: `Bearer ${getCookie(CoreConst.TOKEN)}`,\n });\n\n // 上传文件路径\n const uploadUrl: Ref<string> = ref('');\n\n // 下载文件路径\n const downloadUrl: Ref<string> = ref('');\n\n // data响应式变更基础路径\n watch(\n () => props.data,\n newVal => {\n if (newVal) {\n const urls = c.calcBaseUrl(newVal);\n uploadUrl.value = urls.uploadUrl;\n downloadUrl.value = urls.downloadUrl;\n }\n },\n { immediate: true, deep: true },\n );\n\n // 自定义校验链接\n const customCheckLinkFn = (\n text: string,\n url: string,\n ): string | boolean | undefined => {\n if (!url) {\n return;\n }\n // if (url.indexOf('http') !== 0) {\n // return '链接必须以 http/https 开头';\n // }\n return true;\n\n // 返回值有三种选择:\n // 1. 返回 true ,说明检查通过,编辑器将正常插入链接\n // 2. 返回一个字符串,说明检查未通过,编辑器会阻止插入。会 alert 出错误信息(即返回的字符串)\n // 3. 返回 undefined(即没有任何返回),说明检查未通过,编辑器会阻止插入。但不会提示任何信息\n };\n\n // 自定义转换链接 url\n const customParseLinkUrl = (url: string): string => {\n // if (url.indexOf('http') !== 0) {\n // return `http://${url}`;\n // }\n return url;\n };\n\n // 工具栏配置\n const toolbarConfig: Partial<IToolbarConfig> = {\n excludeKeys: ['group-video'],\n };\n\n // 编辑器配置\n const editorConfig: Partial<IEditorConfig> = {\n placeholder: c.placeHolder,\n readOnly: props.readonly,\n MENU_CONF: {\n // 图片上传\n uploadImage: {\n // 上传地址\n server: uploadUrl.value,\n\n // form-data fieldName ,默认值 'wangeditor-uploaded-image'\n fieldName: 'file',\n\n // 单个文件的最大体积限制,默认为 2M\n maxFileSize: 10 * 1024 * 1024, // 10M\n\n // 最多可上传几个文件,默认为 100\n maxNumberOfFiles: 10,\n\n // 选择文件时的类型限制,默认为 ['image/*'] 。如不想限制,则设置为 []\n allowedFileTypes: [],\n\n // 自定义增加 http header\n headers: headers.value,\n\n // 跨域是否传递 cookie ,默认为 false\n withCredentials: true,\n\n // 上传之前触发\n onBeforeUpload(file: File) {\n // TS 语法\n // onBeforeUpload(file) { // JS 语法\n // file 选中的文件,格式如 { key: file }\n return file;\n\n // 可以 return\n // 1. return file 或者 new 一个 file ,接下来将上传\n // 2. return false ,不上传这个 file\n },\n\n // 上传进度的回调函数\n onProgress(progress: number) {\n console.log('progress', progress);\n },\n\n // 单个文件上传成功之后\n onSuccess(file: File, res: IData) {\n console.log(`${file.name} 上传成功`, res);\n },\n\n // 单个文件上传失败\n onFailed(file: File, res: IData) {\n console.log(`${file.name} 上传失败`, res);\n },\n\n // 上传错误,或者触发 timeout 超时\n onError(file: File, err: IData, res: IData) {\n console.log(`${file.name} 上传出错`, err, res);\n },\n\n // 自定义插入图片\n async customInsert(res: IData, insertFn: InsertFnType) {\n const url = downloadUrl.value.replace('%fileId%', res.id);\n const alt = res.filename;\n // 从 res 中找到 url alt href ,然后插入图片\n insertFn(url, alt, '');\n },\n },\n // 插入链接\n insertLink: {\n checkLink: customCheckLinkFn, // 也支持 async 函数\n parseLinkUrl: customParseLinkUrl, // 也支持 async 函数\n },\n // 更新链接\n editLink: {\n checkLink: customCheckLinkFn, // 也支持 async 函数\n parseLinkUrl: customParseLinkUrl, // 也支持 async 函数\n },\n },\n };\n\n // 组件销毁时,也及时销毁编辑器,重要!\n onBeforeUnmount(() => {\n const editor = editorRef.value;\n if (editor == null) return;\n\n editor.destroy();\n });\n\n // 编辑器回调函数\n // 编辑器创建完毕时的回调函数\n const handleCreated = (editor: IDomEditor) => {\n editorRef.value = editor; // 记录 editor 实例,重要!\n // 配置菜单\n // setTimeout(() => {\n // const toolbar = DomEditor.getToolbar(editor);\n // const curToolbarConfig = toolbar?.getConfig();\n // console.log(curToolbarConfig?.toolbarKeys); // 当前菜单排序和分组\n // }, 3000);\n };\n // 编辑器内容、选区变化时的回调函数\n const handleChange = (editor: IDomEditor) => {\n // console.log('change:', editor.getHtml());\n const html = editor.getHtml();\n // wangEditor初始值抛空字符串给后台\n const emitValue = html === '<p><br></p>' ? '' : html;\n emit('change', emitValue);\n };\n // 编辑器销毁时的回调函数。调用 editor.destroy() 即可销毁编辑器\n const handleDestroyed = (_editor: IDomEditor) => {\n // console.log('destroyed', _editor);\n };\n // 编辑器 focus 时的回调函数\n const handleFocus = (_editor: IDomEditor) => {\n // console.log('focus', _editor);\n };\n // 编辑器 blur 时的回调函数。\n const handleBlur = (_editor: IDomEditor) => {\n // console.log('blur', _editor);\n };\n // 自定义编辑器 alert\n const customAlert = (info: string, type: string) => {\n // eslint-disable-next-line no-alert\n alert(`【自定义提示】${type} - ${info}`);\n };\n // 自定义粘贴。可阻止编辑器的默认粘贴,实现自己的粘贴逻辑\n const customPaste = (\n editor: IDomEditor,\n event: ClipboardEvent,\n callback: (_n: boolean) => void,\n ) => {\n // 返回值(注意,vue 事件的返回值,不能用 return)\n // callback(false); // 返回 false ,阻止默认粘贴行为\n callback(true); // 返回 true ,继续默认的粘贴行为\n };\n\n // 插入文本\n const insertText = (str: string) => {\n const editor = editorRef.value;\n if (editor == null) return;\n\n editor.insertText(str);\n };\n\n // 获取非格式化的 html\n const printHtml = () => {\n const editor = editorRef.value;\n if (editor == null) return;\n console.log(editor.getHtml());\n };\n\n // 禁用编辑器\n const disable = () => {\n const editor = editorRef.value;\n if (editor == null) return;\n editor.disable();\n };\n\n // 取消禁用编辑器\n const enable = () => {\n const editor = editorRef.value;\n if (editor == null) return;\n editor.enable();\n };\n\n onMounted(() => {\n // 监听值变化赋值\n watch(\n () => props.value,\n (newVal, oldVal) => {\n if (\n newVal !== oldVal &&\n (typeof props.value === 'string' || newVal === null)\n ) {\n if (newVal === null) {\n valueHtml.value = '';\n } else {\n valueHtml.value = newVal as string;\n }\n }\n },\n { immediate: true },\n );\n\n // 监听disabled禁用\n watch(\n () => props.disabled,\n (newVal, oldVal) => {\n if (newVal !== oldVal) {\n if (newVal === true) {\n disable();\n } else {\n enable();\n }\n }\n },\n { immediate: true },\n );\n });\n\n return {\n ns,\n editorRef,\n mode: 'default',\n valueHtml,\n toolbarConfig,\n editorConfig,\n handleCreated,\n handleChange,\n handleDestroyed,\n handleFocus,\n handleBlur,\n customAlert,\n customPaste,\n insertText,\n printHtml,\n disable,\n enable,\n };\n },\n render() {\n return (\n <div class={this.ns.b()}>\n <div style='border: 1px solid #ccc; margin-top: 10px'>\n <Toolbar\n editor={this.editorRef}\n default-config={this.toolbarConfig}\n mode={this.mode}\n style='border-bottom: 1px solid #ccc'\n />\n <Editor\n v-model={this.valueHtml}\n default-config={this.editorConfig}\n mode={this.mode}\n style='height: 400px; overflow-y: hidden'\n onOnCreated={this.handleCreated}\n onOnChange={this.handleChange}\n onOnDestroyed={this.handleDestroyed}\n onOnFocus={this.handleFocus}\n onOnBlur={this.handleBlur}\n oncustomAlert={this.customAlert}\n oncustomPaste={this.customPaste}\n />\n </div>\n </div>\n );\n },\n});\n\nexport default IBizHtml;\n"],"names":["IBizHtml","exports","defineComponent","name","props","getHtmlProps","emits","getEditorEmits","setup","emit","ns","useNamespace","c","controller","valueHtml","ref","editorRef","watch","newVal","headers","Authorization","getCookie","CoreConst","uploadUrl","urls","url","downloadUrl","immediate","deep","customParseLinkUrl","file","toolbarConfig","progress","res","MENU_CONF","uploadImage","server","err","fieldName","maxFileSize","insertFn","alt","maxNumberOfFiles","customCheckLinkFn","withCredentials","editor","onSuccess","handleChange","onFailed","html","onError","console","handleFocus","_editor","handleBlur","customInsert","customAlert","info","type","customPaste","event","callback","insertLink","str","checkLink","printHtml","editLink","disable","onBeforeUnmount","onMounted","handleCreated","value","oldVal","emitValue","enable","editorConfig","alert","handleDestroyed","log","$event"],"mappings":"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"}