super-page-runtime 2.2.26 → 2.2.29-tmp2
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/dist/es/_virtual/_plugin-vue_export-helper.js +7 -5
- package/dist/es/assets/chart-themes/theme1.js +6 -2
- package/dist/es/assets/chart-themes/theme2.js +6 -2
- package/dist/es/assets/chart-themes/theme3.js +6 -2
- package/dist/es/components/runtime/utils/api/api-util.js +7 -4
- package/dist/es/components/runtime/utils/api/page-expose-util.js +443 -135
- package/dist/es/components/runtime/utils/assemblys-config.js +369 -13
- package/dist/es/components/runtime/utils/barcode-util.js +33 -9
- package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +306 -122
- package/dist/es/components/runtime/utils/charts/chart-gauge-util.js +68 -29
- package/dist/es/components/runtime/utils/charts/chart-pie-util.js +152 -68
- package/dist/es/components/runtime/utils/charts/chart-radar-util.js +124 -46
- package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +99 -36
- package/dist/es/components/runtime/utils/charts/chart-util.js +522 -224
- package/dist/es/components/runtime/utils/common-util.js +156 -76
- package/dist/es/components/runtime/utils/eventBus.js +8 -3
- package/dist/es/components/runtime/utils/events/event-util.js +775 -362
- package/dist/es/components/runtime/utils/events/print-label.js +140 -72
- package/dist/es/components/runtime/utils/events/standard-event.js +2320 -808
- package/dist/es/components/runtime/utils/events/validator-util.js +560 -224
- package/dist/es/components/runtime/utils/form/date-shortcuts.js +88 -28
- package/dist/es/components/runtime/utils/form/scan-util.js +162 -61
- package/dist/es/components/runtime/utils/global-refs.js +84 -53
- package/dist/es/components/runtime/utils/i18n-util.js +20 -11
- package/dist/es/components/runtime/utils/interfaces/page-design-types.js +7 -2
- package/dist/es/components/runtime/utils/page-helper-util.js +660 -279
- package/dist/es/components/runtime/utils/page-init-util.js +406 -141
- package/dist/es/components/runtime/utils/page-permission-util.js +531 -22
- package/dist/es/components/runtime/utils/page-store.js +68 -23
- package/dist/es/components/runtime/utils/store-util.js +13 -9
- package/dist/es/components/runtime/utils/store.js +2 -2
- package/dist/es/components/runtime/utils/table-utils.js +81 -40
- package/dist/es/components/runtime/utils/tree-utils.js +37 -17
- package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +83 -21
- package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue2.js +46 -14
- package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +132 -36
- package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue2.js +18 -4
- package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js +107 -17
- package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +198 -50
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue.js +42 -12
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue.js +60 -7
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +203 -52
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue.js +4 -4
- package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue2.js +162 -46
- package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +109 -32
- package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +166 -43
- package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +117 -32
- package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +118 -32
- package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +597 -246
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue.js +42 -4
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue.js +62 -8
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue.js +160 -29
- package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue.js +62 -13
- package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue2.js +594 -212
- package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue.js +139 -29
- package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue.js +125 -21
- package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue.js +102 -16
- package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue2.js +81 -18
- package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue2.js +82 -17
- package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue2.js +86 -14
- package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +79 -21
- package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue2.js +61 -16
- package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue2.js +37 -10
- package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +127 -38
- package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue2.js +76 -28
- package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue2.js +178 -61
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +810 -302
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +635 -262
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +115 -40
- package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue2.js +215 -56
- package/dist/es/components/runtime/views/assemblys/error-render.vue.js +21 -3
- package/dist/es/components/runtime/views/assemblys/error-render.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +154 -42
- package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue.js +98 -34
- package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue2.js +200 -52
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +239 -68
- package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +109 -31
- package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue2.js +59 -21
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +188 -56
- package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +103 -22
- package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +245 -57
- package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue2.js +174 -32
- package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +107 -28
- package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +4 -4
- package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue2.js +50 -13
- package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +194 -64
- package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +249 -88
- package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +263 -80
- package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue2.js +57 -13
- package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +155 -30
- package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +129 -40
- package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +107 -22
- package/dist/es/components/runtime/views/assemblys/home-chart-render.vue.js +188 -89
- package/dist/es/components/runtime/views/assemblys/home-chart-render.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/object-render.vue.js +272 -133
- package/dist/es/components/runtime/views/assemblys/object-render.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue2.js +46 -18
- package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue2.js +49 -21
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +58 -20
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue2.js +53 -16
- package/dist/es/components/runtime/views/home-chart.vue.js +160 -40
- package/dist/es/components/runtime/views/home-chart.vue2.js +2 -2
- package/dist/es/components/runtime/views/super-page-dialog.vue.js +139 -20
- package/dist/es/components/runtime/views/super-page-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/super-page.vue.js +754 -226
- package/dist/es/components/runtime/views/super-page.vue2.js +2 -2
- package/dist/es/i18n/langs/cn.js +55 -2
- package/dist/es/i18n/langs/en.js +55 -2
- package/package.json +2 -2
|
@@ -1,98 +1,259 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
import { getFormModelFields
|
|
3
|
-
import { formatVariableValue
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, nextTick, onBeforeUnmount, resolveComponent, createElementBlock, openBlock, Fragment, createBlock, createCommentVNode, normalizeStyle, normalizeClass, unref, withCtx, createElementVNode, toDisplayString } from "vue";
|
|
2
|
+
import { getFormModelFields } from "../../../../utils/page-init-util.js";
|
|
3
|
+
import { formatVariableValue, setVariableValue, getVariableValue } from "../../../../utils/page-helper-util.js";
|
|
4
|
+
import Quill from "quill";
|
|
5
5
|
import "quill/dist/quill.snow.css";
|
|
6
|
-
import { handleAfterInitEvent
|
|
7
|
-
import
|
|
8
|
-
import { $t
|
|
9
|
-
import { getToken
|
|
10
|
-
import { getBaseUrl
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
import { handleAfterInitEvent, handleFormEvent } from "../../../../utils/events/event-util.js";
|
|
7
|
+
import http from "agilebuilder-ui/src/utils/request";
|
|
8
|
+
import { $t } from "../../../../utils/i18n-util.js";
|
|
9
|
+
import { getToken } from "agilebuilder-ui/src/utils/auth";
|
|
10
|
+
import { getBaseUrl } from "../../../../utils/common-util.js";
|
|
11
|
+
const _hoisted_1 = { style: { "width": "100%", "height": "100%" } };
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
__name: "richtext-runtime",
|
|
14
|
+
props: {
|
|
15
|
+
pageContext: {},
|
|
16
|
+
configure: {}
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const entity = props.pageContext.entity ? props.pageContext.entity : {};
|
|
21
|
+
const dynamicFields = getFormModelFields(props.pageContext, props.configure);
|
|
22
|
+
const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
|
|
23
|
+
const runtimeStyle = runtimeInfo.style;
|
|
24
|
+
const runtimeClass = runtimeInfo.class;
|
|
25
|
+
const headerStyle = runtimeInfo.headerStyle;
|
|
26
|
+
const titleExceedStyle = runtimeInfo.titleExceedStyle;
|
|
27
|
+
const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
|
|
28
|
+
let contentVariable = designProperty.value.value;
|
|
29
|
+
const initValue = formatVariableValue(props.pageContext, contentVariable);
|
|
30
|
+
const quillEditorRef = ref(null);
|
|
31
|
+
let quill = null;
|
|
32
|
+
ref(null);
|
|
33
|
+
const fontSize = [
|
|
34
|
+
"12px",
|
|
35
|
+
"13px",
|
|
36
|
+
"14px",
|
|
37
|
+
"15px",
|
|
38
|
+
"16px",
|
|
39
|
+
"18px",
|
|
40
|
+
"20px",
|
|
41
|
+
"24px",
|
|
42
|
+
"28px",
|
|
43
|
+
"32px",
|
|
44
|
+
"36px"
|
|
45
|
+
];
|
|
46
|
+
let hisState = designProperty.value.state;
|
|
47
|
+
function checkReadonly(state) {
|
|
48
|
+
return state == "readonly" || state == "disabled";
|
|
28
49
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
const initReadonly = checkReadonly(hisState);
|
|
51
|
+
const option = ref({
|
|
52
|
+
modules: {
|
|
53
|
+
toolbar: [
|
|
54
|
+
["bold", "italic", "underline", "strike"],
|
|
55
|
+
// 加粗 斜体 下划线 删除线
|
|
56
|
+
["blockquote", "code-block"],
|
|
57
|
+
// 引用
|
|
58
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
59
|
+
// 有序、无序列表
|
|
60
|
+
[{ script: "sub" }, { script: "super" }],
|
|
61
|
+
// 上标/下标
|
|
62
|
+
[{ indent: "-1" }, { indent: "+1" }],
|
|
63
|
+
// 缩进
|
|
64
|
+
[{ direction: "rtl" }],
|
|
65
|
+
// 文本方向
|
|
66
|
+
[{ size: fontSize }],
|
|
67
|
+
// 字体大小
|
|
68
|
+
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
|
69
|
+
// 标题
|
|
70
|
+
[{ color: [] }, { background: [] }],
|
|
71
|
+
// 字体颜色、字体背景颜色
|
|
72
|
+
[{ font: [] }],
|
|
73
|
+
// 字体种类
|
|
74
|
+
[{ align: [] }],
|
|
75
|
+
// 对齐方式
|
|
76
|
+
["clean"],
|
|
77
|
+
// 清除文本格式
|
|
78
|
+
["link", "image"]
|
|
79
|
+
// 链接、图片、视频
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
theme: "snow",
|
|
83
|
+
placeholder: initReadonly ? "" : designProperty.value.placeholder,
|
|
84
|
+
readOnly: initReadonly
|
|
85
|
+
});
|
|
86
|
+
watch(designProperty.value, () => {
|
|
87
|
+
const newState = designProperty.value.state;
|
|
88
|
+
if (newState != void 0 && newState !== hisState) {
|
|
89
|
+
hisState = newState;
|
|
90
|
+
const isReadonly = checkReadonly(hisState);
|
|
91
|
+
if (quill) {
|
|
92
|
+
quill.enable(!isReadonly);
|
|
93
|
+
quill.root.dataset.placeholder = isReadonly ? "" : designProperty.value.placeholder;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
function updateEditorHeight() {
|
|
98
|
+
if (quill && quill.container) {
|
|
99
|
+
const parentNode = quill.container.parentNode;
|
|
100
|
+
const parentRect = parentNode.getBoundingClientRect();
|
|
101
|
+
const thisRect = quill.container.getBoundingClientRect();
|
|
102
|
+
let newHeight = parentRect.height - (thisRect.top - parentRect.top);
|
|
103
|
+
if (newHeight < 100) {
|
|
104
|
+
newHeight = 100;
|
|
105
|
+
}
|
|
106
|
+
quill.container.style.height = newHeight + "px";
|
|
107
|
+
}
|
|
41
108
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
109
|
+
const previewList = ref([]);
|
|
110
|
+
const showViewer = ref(false);
|
|
111
|
+
const formItemRef = ref(null);
|
|
112
|
+
const componentRef = ref(null);
|
|
113
|
+
const titleRef = ref(null);
|
|
114
|
+
let editorContainer;
|
|
115
|
+
onMounted(() => {
|
|
116
|
+
var _a;
|
|
117
|
+
quill = new Quill(quillEditorRef.value, option.value);
|
|
118
|
+
const delta = quill.clipboard.convertHTML(initValue);
|
|
119
|
+
quill.setContents(delta.ops);
|
|
120
|
+
(_a = quillEditorRef.value) == null ? void 0 : _a.addEventListener("focusout", handleFocusOut);
|
|
121
|
+
quill.on("text-change", async function(delta2, oldDelta, source) {
|
|
122
|
+
if (delta2.ops && delta2.ops.length > 0) {
|
|
123
|
+
for (let i = 0; i < delta2.ops.length; i++) {
|
|
124
|
+
const ops = delta2.ops[i];
|
|
125
|
+
if (ops.insert && ops.insert.image) {
|
|
126
|
+
const dataurl = ops.insert.image;
|
|
127
|
+
if (!dataurl.startsWith("data:image")) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const file = dataURLtoFile(dataurl, "image.png");
|
|
131
|
+
await uploadImage(file).then((res) => {
|
|
132
|
+
if (!quill) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const images = quill.root.getElementsByTagName("img");
|
|
136
|
+
if (images && images.length > 0) {
|
|
137
|
+
for (let i2 = 0; i2 < images.length; i2++) {
|
|
138
|
+
const img = images[i2];
|
|
139
|
+
if (img.src === dataurl) {
|
|
140
|
+
img.src = res.url + "&jwt=" + getToken();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}).catch((err) => {
|
|
145
|
+
console.error(err, "上传图片失败");
|
|
146
|
+
});
|
|
71
147
|
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
148
|
+
}
|
|
74
149
|
}
|
|
150
|
+
setVariableValue(entity, dynamicFields, quill.root.innerHTML);
|
|
151
|
+
});
|
|
152
|
+
editorContainer = quill.container;
|
|
153
|
+
editorContainer.addEventListener("click", handleClick);
|
|
154
|
+
updateEditorHeight();
|
|
155
|
+
nextTick(() => {
|
|
156
|
+
const value = getVariableValue(entity, dynamicFields);
|
|
157
|
+
handleAfterInitEvent(
|
|
158
|
+
value,
|
|
159
|
+
props.pageContext,
|
|
160
|
+
props.configure,
|
|
161
|
+
{
|
|
162
|
+
formItemRef: formItemRef.value,
|
|
163
|
+
componentRef: componentRef.value,
|
|
164
|
+
titleRef: titleRef.value,
|
|
165
|
+
value,
|
|
166
|
+
entity: props.pageContext.entity.data,
|
|
167
|
+
pageData: props.pageContext.entity.page
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
onBeforeUnmount(() => {
|
|
173
|
+
if (quillEditorRef.value) {
|
|
174
|
+
quillEditorRef.value.removeEventListener("focusout", handleFocusOut);
|
|
75
175
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (I && I.container) {
|
|
79
|
-
const e4 = I.container.parentNode.getBoundingClientRect(), t2 = I.container.getBoundingClientRect();
|
|
80
|
-
let l2 = e4.height - (t2.top - e4.top);
|
|
81
|
-
l2 < 100 && (l2 = 100), I.container.style.height = l2 + "px";
|
|
176
|
+
if (editorContainer) {
|
|
177
|
+
editorContainer.removeEventListener("click", handleClick);
|
|
82
178
|
}
|
|
83
|
-
}(), i(() => {
|
|
84
|
-
const e4 = C(_, B);
|
|
85
|
-
k(e4, S2.pageContext, S2.configure, { formItemRef: V.value, componentRef: X.value, titleRef: Y.value, value: e4, entity: S2.pageContext.entity.data, pageData: S2.pageContext.entity.page });
|
|
86
179
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
180
|
+
function handleFocusOut(event) {
|
|
181
|
+
var _a;
|
|
182
|
+
if (event.relatedTarget === null || !((_a = quillEditorRef.value) == null ? void 0 : _a.contains(event.relatedTarget))) {
|
|
183
|
+
handleFormEvent(quill.root.innerHTML, props.pageContext, props.configure, "change", {
|
|
184
|
+
entity
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function handleClick(event) {
|
|
189
|
+
if (event.target.localName === "img") {
|
|
190
|
+
previewList.value = [];
|
|
191
|
+
let imgSrc = event.target.src;
|
|
192
|
+
previewList.value.push(imgSrc);
|
|
193
|
+
showViewer.value = true;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function uploadImage(blob) {
|
|
197
|
+
const params = new FormData();
|
|
198
|
+
params.append("file", blob);
|
|
199
|
+
const config = {
|
|
200
|
+
headers: {
|
|
201
|
+
"Content-Type": "multipart/form-data"
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const backendUrl = props.pageContext.backendUrl;
|
|
205
|
+
const baseUrl = getBaseUrl(backendUrl, props.pageContext.isTest);
|
|
206
|
+
return http.post(baseUrl + "/common/fs-upload/rich-editor-image", params, config);
|
|
207
|
+
}
|
|
208
|
+
function dataURLtoFile(dataurl, filename) {
|
|
209
|
+
let arr = dataurl.split(",");
|
|
210
|
+
let mime = arr[0].match(/:(.*?);/)[1];
|
|
211
|
+
let bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
|
212
|
+
while (n--) {
|
|
213
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
214
|
+
}
|
|
215
|
+
return new File([u8arr], filename, { type: mime });
|
|
216
|
+
}
|
|
217
|
+
return (_ctx, _cache) => {
|
|
218
|
+
const _component_el_form_item = resolveComponent("el-form-item");
|
|
219
|
+
const _component_el_image_viewer = resolveComponent("el-image-viewer");
|
|
220
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
221
|
+
designProperty.value.tittleShow ? (openBlock(), createBlock(_component_el_form_item, {
|
|
222
|
+
key: 0,
|
|
223
|
+
required: designProperty.value.required,
|
|
224
|
+
class: normalizeClass(unref(runtimeClass)),
|
|
225
|
+
"label-width": designProperty.value.labelWidth,
|
|
226
|
+
style: normalizeStyle(unref(runtimeStyle))
|
|
227
|
+
}, {
|
|
228
|
+
label: withCtx(() => [
|
|
229
|
+
designProperty.value.tittleShow ? (openBlock(), createElementBlock("div", {
|
|
230
|
+
key: 0,
|
|
231
|
+
style: normalizeStyle({ ...unref(headerStyle), ...unref(titleExceedStyle) })
|
|
232
|
+
}, toDisplayString(unref($t)(designProperty.value.title)), 5)) : createCommentVNode("", true)
|
|
233
|
+
]),
|
|
234
|
+
default: withCtx(() => [
|
|
235
|
+
createElementVNode("div", _hoisted_1, [
|
|
236
|
+
createElementVNode("div", {
|
|
237
|
+
ref_key: "quillEditorRef",
|
|
238
|
+
ref: quillEditorRef,
|
|
239
|
+
style: { "width": "100%" }
|
|
240
|
+
}, null, 512)
|
|
241
|
+
])
|
|
242
|
+
]),
|
|
243
|
+
_: 1
|
|
244
|
+
}, 8, ["required", "class", "label-width", "style"])) : createCommentVNode("", true),
|
|
245
|
+
showViewer.value ? (openBlock(), createBlock(_component_el_image_viewer, {
|
|
246
|
+
key: 1,
|
|
247
|
+
"hide-on-click-modal": "",
|
|
248
|
+
onClose: _cache[0] || (_cache[0] = () => {
|
|
249
|
+
showViewer.value = false;
|
|
250
|
+
}),
|
|
251
|
+
"url-list": previewList.value
|
|
252
|
+
}, null, 8, ["url-list"])) : createCommentVNode("", true)
|
|
253
|
+
], 64);
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
});
|
|
96
257
|
export {
|
|
97
|
-
|
|
258
|
+
_sfc_main as default
|
|
98
259
|
};
|