cloud-web-corejs 1.0.54-dev.538 → 1.0.54-dev.539
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/package.json
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
:visiable.sync="showDialog"
|
|
12
12
|
:data.sync="value"
|
|
13
13
|
title="title"
|
|
14
|
-
:
|
|
14
|
+
:readonly="readonly"
|
|
15
15
|
@confirm="confirmUniverDialog"
|
|
16
|
-
:
|
|
16
|
+
:univerConfig="univerConfig"
|
|
17
17
|
></univerDialog>
|
|
18
18
|
</el-button>
|
|
19
19
|
</template>
|
|
@@ -27,11 +27,11 @@ export default {
|
|
|
27
27
|
type: String,
|
|
28
28
|
default: "excel",
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
readonly: {
|
|
31
31
|
type: Boolean,
|
|
32
32
|
default: false,
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
univerConfig: {
|
|
35
35
|
type: Object,
|
|
36
36
|
default: () => {},
|
|
37
37
|
},
|
|
@@ -10,10 +10,16 @@
|
|
|
10
10
|
:title="title"
|
|
11
11
|
custom-class="dialog-style list-dialog dialog-checkbox pd_0"
|
|
12
12
|
>
|
|
13
|
-
<div class="cont" id="containt">
|
|
14
|
-
<univer
|
|
13
|
+
<div class="cont" id="containt" :class="{ nfootBtn: readonly }">
|
|
14
|
+
<univer
|
|
15
|
+
ref="univer"
|
|
16
|
+
:data="json"
|
|
17
|
+
v-if="showUniver"
|
|
18
|
+
:readonly="readonly"
|
|
19
|
+
:options="univerConfig"
|
|
20
|
+
></univer>
|
|
15
21
|
</div>
|
|
16
|
-
<span slot="footer" class="dialog-footer" v-if="!
|
|
22
|
+
<span slot="footer" class="dialog-footer" v-if="!readonly">
|
|
17
23
|
<el-button type="primary" plain class="button-sty" @click="close">
|
|
18
24
|
<i class="el-icon-close el-icon"></i>
|
|
19
25
|
{{ $t2("取 消", "system.button.cancel2") }}
|
|
@@ -39,11 +45,11 @@ export default {
|
|
|
39
45
|
type: String,
|
|
40
46
|
default: "excel",
|
|
41
47
|
},
|
|
42
|
-
|
|
48
|
+
readonly: {
|
|
43
49
|
type: Boolean,
|
|
44
50
|
default: false,
|
|
45
51
|
},
|
|
46
|
-
|
|
52
|
+
univerConfig: {
|
|
47
53
|
type: Object,
|
|
48
54
|
default: () => {},
|
|
49
55
|
},
|
|
@@ -1,3 +1,95 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import dialogComponent from './dialog.vue';
|
|
3
|
+
|
|
1
4
|
export { default as univerSheet } from "./univerSheet.vue";
|
|
2
5
|
export { default as asuniverDialog } from "./dialog.vue";
|
|
3
6
|
export { default as asuniverButton } from "./button.vue";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 打开univerDialog对话框
|
|
10
|
+
* @param {Object} options - 对话框配置选项
|
|
11
|
+
* @param {Boolean} options.visiable - 是否可见
|
|
12
|
+
* @param {String} options.data - Excel数据(JSON字符串)
|
|
13
|
+
* @param {String} options.title - 对话框标题
|
|
14
|
+
* @param {Boolean} options.readonly - 是否只读
|
|
15
|
+
* @param {Object} options.options - univer配置选项
|
|
16
|
+
* @param {Function} options.onConfirm - 确认回调函数
|
|
17
|
+
* @param {Function} options.onClose - 关闭回调函数
|
|
18
|
+
* @returns {Object} 对话框实例,包含close方法
|
|
19
|
+
*/
|
|
20
|
+
export function openUniverSheetDialog(options = {}) {
|
|
21
|
+
const {
|
|
22
|
+
visiable = true,
|
|
23
|
+
data = '',
|
|
24
|
+
title = 'excel',
|
|
25
|
+
readonly = false,
|
|
26
|
+
onConfirm,
|
|
27
|
+
onClose,
|
|
28
|
+
univerConfig = {},
|
|
29
|
+
} = options;
|
|
30
|
+
|
|
31
|
+
// 创建组件实例
|
|
32
|
+
const DialogConstructor = Vue.extend(dialogComponent);
|
|
33
|
+
const instance = new DialogConstructor({
|
|
34
|
+
propsData: {
|
|
35
|
+
visiable,
|
|
36
|
+
data,
|
|
37
|
+
title,
|
|
38
|
+
readonly,
|
|
39
|
+
univerConfig: univerConfig,
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// 挂载组件
|
|
44
|
+
instance.$mount();
|
|
45
|
+
document.body.appendChild(instance.$el);
|
|
46
|
+
|
|
47
|
+
// 定义销毁函数
|
|
48
|
+
const destroyDialog = () => {
|
|
49
|
+
// 延迟销毁,确保动画完成
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
// 从DOM中移除
|
|
52
|
+
if (instance.$el && instance.$el.parentNode) {
|
|
53
|
+
instance.$el.parentNode.removeChild(instance.$el);
|
|
54
|
+
}
|
|
55
|
+
// 销毁组件实例
|
|
56
|
+
instance.$destroy();
|
|
57
|
+
}, 300);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// 监听确认事件
|
|
61
|
+
if (onConfirm) {
|
|
62
|
+
instance.$on('confirm', (result) => {
|
|
63
|
+
onConfirm(result);
|
|
64
|
+
// 确认后也需要销毁
|
|
65
|
+
destroyDialog();
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
// 如果没有传入onConfirm,也要确保确认后销毁
|
|
69
|
+
instance.$on('confirm', destroyDialog);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 监听关闭事件
|
|
73
|
+
if (onClose) {
|
|
74
|
+
instance.$on('update:visiable', (value) => {
|
|
75
|
+
if (!value) {
|
|
76
|
+
onClose();
|
|
77
|
+
// 关闭后销毁
|
|
78
|
+
destroyDialog();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
// 如果没有传入onClose,也要确保关闭后销毁
|
|
83
|
+
instance.$on('update:visiable', (value) => {
|
|
84
|
+
if (!value) destroyDialog();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 返回实例,允许外部控制
|
|
89
|
+
return {
|
|
90
|
+
instance,
|
|
91
|
+
close: () => {
|
|
92
|
+
instance.close();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -15,8 +15,6 @@ import { UniverSheetsHyperLinkPreset } from "@univerjs/preset-sheets-hyper-link"
|
|
|
15
15
|
import sheetsHyperLinkZhCN from "@univerjs/preset-sheets-hyper-link/locales/zh-CN";
|
|
16
16
|
import { UniverSheetsSortPreset } from "@univerjs/preset-sheets-sort";
|
|
17
17
|
import SheetsSortZhCN from "@univerjs/preset-sheets-sort/locales/zh-CN";
|
|
18
|
-
import { UniverSheetsThreadCommentPreset } from "@univerjs/preset-sheets-thread-comment";
|
|
19
|
-
import UniverPresetSheetsThreadCommentZhCN from "@univerjs/preset-sheets-thread-comment/locales/zh-CN";
|
|
20
18
|
import { createUniver, LocaleType, mergeLocales } from "@univerjs/presets";
|
|
21
19
|
import { UniverSheetsCrosshairHighlightPlugin } from "@univerjs/sheets-crosshair-highlight";
|
|
22
20
|
import SheetsCrosshairHighlightZhCN from "@univerjs/sheets-crosshair-highlight/locale/zh-CN";
|
|
@@ -32,12 +30,11 @@ import "@univerjs/preset-sheets-sort/lib/index.css";
|
|
|
32
30
|
import "@univerjs/preset-sheets-filter/lib/index.css";
|
|
33
31
|
import "@univerjs/preset-sheets-conditional-formatting/lib/index.css";
|
|
34
32
|
import "@univerjs/preset-sheets-data-validation/lib/index.css";
|
|
35
|
-
import "@univerjs/preset-sheets-drawing/lib/index.css";
|
|
36
33
|
import "@univerjs/preset-sheets-hyper-link/lib/index.css";
|
|
37
34
|
import "@univerjs/preset-sheets-find-replace/lib/index.css";
|
|
38
|
-
import "@univerjs/preset-sheets-thread-comment/lib/index.css";
|
|
39
35
|
import "@univerjs/sheets-zen-editor/lib/index.css";
|
|
40
36
|
import "@univerjs/sheets-crosshair-highlight/lib/index.css";
|
|
37
|
+
import "@univerjs/preset-sheets-drawing/lib/index.css";
|
|
41
38
|
|
|
42
39
|
export default {
|
|
43
40
|
name: "univerSheet",
|
|
@@ -46,6 +43,10 @@ export default {
|
|
|
46
43
|
type: Object,
|
|
47
44
|
default: () => {},
|
|
48
45
|
},
|
|
46
|
+
readonly: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
49
50
|
options: {
|
|
50
51
|
type: Object,
|
|
51
52
|
default: () => {},
|
|
@@ -70,38 +71,50 @@ export default {
|
|
|
70
71
|
methods: {
|
|
71
72
|
initStyle() {},
|
|
72
73
|
init() {
|
|
74
|
+
// 基础国际化文件
|
|
75
|
+
const localeFiles = [
|
|
76
|
+
sheetsCoreZhCN,
|
|
77
|
+
SheetsSortZhCN,
|
|
78
|
+
UniverPresetSheetsFilterZhCN,
|
|
79
|
+
sheetsConditionalFormattingZhCN,
|
|
80
|
+
sheetsDataValidationZhCN,
|
|
81
|
+
UniverPresetSheetsFindReplaceZhCN,
|
|
82
|
+
sheetsHyperLinkZhCN,
|
|
83
|
+
SheetsCrosshairHighlightZhCN,
|
|
84
|
+
SheetsZenEditorZhCN,
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
// 基础预设
|
|
88
|
+
const presets = [
|
|
89
|
+
UniverSheetsCorePreset({
|
|
90
|
+
container: this.$refs.container,
|
|
91
|
+
menu: {
|
|
92
|
+
"sheet.contextMenu.permission": {
|
|
93
|
+
hidden: true,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
UniverSheetsFindReplacePreset(),
|
|
98
|
+
UniverSheetsSortPreset(),
|
|
99
|
+
UniverSheetsFilterPreset(),
|
|
100
|
+
UniverSheetsConditionalFormattingPreset(),
|
|
101
|
+
UniverSheetsDataValidationPreset(),
|
|
102
|
+
UniverSheetsFilterPreset(),
|
|
103
|
+
UniverSheetsHyperLinkPreset(),
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
// 根据options.enableImage参数条件性添加图片相关功能
|
|
107
|
+
if (this.options?.enableImage) {
|
|
108
|
+
localeFiles.push(sheetsDrawingZhCN);
|
|
109
|
+
presets.push(UniverSheetsDrawingPreset());
|
|
110
|
+
}
|
|
111
|
+
|
|
73
112
|
const { univer, univerAPI } = createUniver({
|
|
74
113
|
locale: LocaleType.ZH_CN,
|
|
75
114
|
locales: {
|
|
76
|
-
[LocaleType.ZH_CN]: mergeLocales(
|
|
77
|
-
sheetsCoreZhCN,
|
|
78
|
-
SheetsSortZhCN,
|
|
79
|
-
UniverPresetSheetsFilterZhCN,
|
|
80
|
-
sheetsConditionalFormattingZhCN,
|
|
81
|
-
sheetsDataValidationZhCN,
|
|
82
|
-
UniverPresetSheetsFindReplaceZhCN,
|
|
83
|
-
sheetsDrawingZhCN,
|
|
84
|
-
sheetsHyperLinkZhCN,
|
|
85
|
-
UniverPresetSheetsThreadCommentZhCN,
|
|
86
|
-
SheetsCrosshairHighlightZhCN,
|
|
87
|
-
SheetsZenEditorZhCN
|
|
88
|
-
),
|
|
115
|
+
[LocaleType.ZH_CN]: mergeLocales(...localeFiles),
|
|
89
116
|
},
|
|
90
|
-
presets
|
|
91
|
-
UniverSheetsCorePreset({
|
|
92
|
-
container: this.$refs.container,
|
|
93
|
-
// zIndex: 3000,
|
|
94
|
-
}),
|
|
95
|
-
UniverSheetsFindReplacePreset(),
|
|
96
|
-
UniverSheetsSortPreset(),
|
|
97
|
-
UniverSheetsFilterPreset(),
|
|
98
|
-
UniverSheetsConditionalFormattingPreset(),
|
|
99
|
-
UniverSheetsDataValidationPreset(),
|
|
100
|
-
UniverSheetsDrawingPreset(),
|
|
101
|
-
UniverSheetsFilterPreset(),
|
|
102
|
-
UniverSheetsHyperLinkPreset(),
|
|
103
|
-
UniverSheetsThreadCommentPreset(),
|
|
104
|
-
],
|
|
117
|
+
presets,
|
|
105
118
|
plugins: [
|
|
106
119
|
/* [
|
|
107
120
|
UniverWatermarkPlugin,
|
|
@@ -133,13 +146,25 @@ export default {
|
|
|
133
146
|
|
|
134
147
|
this.univerInstance = univer;
|
|
135
148
|
this.univerAPIInstance = univerAPI;
|
|
149
|
+
|
|
150
|
+
// 获取工作表
|
|
151
|
+
const worksheets = this.workbook.getSheets();
|
|
152
|
+
|
|
153
|
+
this.$nextTick(() => {
|
|
154
|
+
const fWorkbook = univerAPI.getActiveWorkbook();
|
|
155
|
+
const permission = fWorkbook.getWorkbookPermission();
|
|
156
|
+
if (this.readonly) {
|
|
157
|
+
// 设置为只读模式
|
|
158
|
+
permission.setMode("viewer");
|
|
159
|
+
permission.setPoint(univerAPI.Enum.WorkbookPermissionPoint.CopyContent, true);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
136
162
|
},
|
|
137
163
|
async getValue() {
|
|
138
164
|
const fWorkbook = this.univerAPIInstance.getActiveWorkbook();
|
|
139
165
|
await fWorkbook.endEditingAsync(true);
|
|
140
166
|
const snapshot = fWorkbook.save();
|
|
141
167
|
return snapshot;
|
|
142
|
-
// return this.workbook.save();
|
|
143
168
|
},
|
|
144
169
|
},
|
|
145
170
|
};
|
|
@@ -161,7 +186,12 @@ export default {
|
|
|
161
186
|
}
|
|
162
187
|
</style>
|
|
163
188
|
<style>
|
|
164
|
-
div[data-radix-popper-content-wrapper]
|
|
189
|
+
div[data-radix-popper-content-wrapper],
|
|
190
|
+
.univer-popup.univer-popup-enter-done,
|
|
191
|
+
.univer-menu-submenu,
|
|
192
|
+
[data-u-comp="rect-popup"],
|
|
193
|
+
.univer-grid,
|
|
194
|
+
div[role="tooltip"] {
|
|
165
195
|
z-index: 999999 !important;
|
|
166
196
|
}
|
|
167
197
|
</style>
|