@veltra/sheet 2.3.0 → 2.3.1
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.
|
@@ -66,11 +66,25 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
66
66
|
resetPreview();
|
|
67
67
|
runDescribe();
|
|
68
68
|
}, { immediate: true });
|
|
69
|
+
/** 立即把草稿 SQL 落入数据集(v-model 实时、change 失焦才发且提交有 debounce),供预览同步拿到最新 SQL */
|
|
70
|
+
function flushSqlDraft(datasetId) {
|
|
71
|
+
if (sqlTimer) {
|
|
72
|
+
clearTimeout(sqlTimer);
|
|
73
|
+
sqlTimer = void 0;
|
|
74
|
+
}
|
|
75
|
+
const current = dataset.value;
|
|
76
|
+
if (!current || current.sql === sqlDraft.value) return;
|
|
77
|
+
props.hub.updateDataset(datasetId, { sql: sqlDraft.value });
|
|
78
|
+
runDescribe();
|
|
79
|
+
}
|
|
69
80
|
function onSqlChange(value) {
|
|
70
81
|
sqlDraft.value = value;
|
|
82
|
+
const datasetId = props.datasetId;
|
|
71
83
|
if (sqlTimer) clearTimeout(sqlTimer);
|
|
72
84
|
sqlTimer = setTimeout(() => {
|
|
73
|
-
|
|
85
|
+
sqlTimer = void 0;
|
|
86
|
+
if (props.datasetId !== datasetId) return;
|
|
87
|
+
props.hub.updateDataset(datasetId, { sql: value });
|
|
74
88
|
runDescribe();
|
|
75
89
|
}, 280);
|
|
76
90
|
}
|
|
@@ -104,6 +118,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
104
118
|
}));
|
|
105
119
|
});
|
|
106
120
|
async function runPreview() {
|
|
121
|
+
flushSqlDraft(props.datasetId);
|
|
107
122
|
previewing.value = true;
|
|
108
123
|
previewError.value = "";
|
|
109
124
|
const result = await props.hub.previewDataset(props.datasetId);
|
|
@@ -13,7 +13,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
13
13
|
*/
|
|
14
14
|
const props = __props;
|
|
15
15
|
/** 填充颜色('' = 无填充) */
|
|
16
|
-
const fillColor = ref(
|
|
16
|
+
const fillColor = ref();
|
|
17
17
|
onMounted(() => {
|
|
18
18
|
const active = props.context.getSelection().activeCell;
|
|
19
19
|
const style = active ? props.context.getEffectiveStyle(active) : void 0;
|
|
@@ -21,6 +21,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
21
21
|
});
|
|
22
22
|
/** 填充颜色变化('' = 无填充:清除 fill 保留边框) */
|
|
23
23
|
function applyFillColor(color) {
|
|
24
|
+
fillColor.value = color;
|
|
24
25
|
const range = currentRange(props.context);
|
|
25
26
|
if (!range) return;
|
|
26
27
|
props.context.applyStyle(range, color ? { fill: { color } } : { fill: {} });
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltra/sheet",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
|
+
"homepage": "https://github.com/cabinet-fe/ultra-ui#readme",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/cabinet-fe/ultra-ui/issues"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/cabinet-fe/ultra-ui",
|
|
11
|
+
"directory": "packages/sheet"
|
|
12
|
+
},
|
|
4
13
|
"files": [
|
|
5
14
|
"dist",
|
|
6
15
|
"src"
|
|
@@ -30,12 +39,12 @@
|
|
|
30
39
|
"peerDependencies": {
|
|
31
40
|
"@cat-kit/core": ">=1.1.8",
|
|
32
41
|
"@cat-kit/fe": ">=1.1.8",
|
|
33
|
-
"@veltra/compositions": "^1.6.
|
|
34
|
-
"@veltra/desktop": "^1.6.
|
|
42
|
+
"@veltra/compositions": "^1.6.2",
|
|
43
|
+
"@veltra/desktop": "^1.6.2",
|
|
35
44
|
"@veltra/icons": "^1.5.0",
|
|
36
|
-
"@veltra/sheet-core": "^2.3.
|
|
37
|
-
"@veltra/styles": "^1.6.
|
|
38
|
-
"@veltra/utils": "^1.6.
|
|
45
|
+
"@veltra/sheet-core": "^2.3.1",
|
|
46
|
+
"@veltra/styles": "^1.6.2",
|
|
47
|
+
"@veltra/utils": "^1.6.2",
|
|
39
48
|
"vue": ">=3.5.41"
|
|
40
49
|
}
|
|
41
50
|
}
|
|
@@ -219,11 +219,27 @@ watch(
|
|
|
219
219
|
{ immediate: true }
|
|
220
220
|
)
|
|
221
221
|
|
|
222
|
+
/** 立即把草稿 SQL 落入数据集(v-model 实时、change 失焦才发且提交有 debounce),供预览同步拿到最新 SQL */
|
|
223
|
+
function flushSqlDraft(datasetId: string): void {
|
|
224
|
+
if (sqlTimer) {
|
|
225
|
+
clearTimeout(sqlTimer)
|
|
226
|
+
sqlTimer = undefined
|
|
227
|
+
}
|
|
228
|
+
const current = dataset.value
|
|
229
|
+
if (!current || current.sql === sqlDraft.value) return
|
|
230
|
+
props.hub.updateDataset(datasetId, { sql: sqlDraft.value })
|
|
231
|
+
void runDescribe()
|
|
232
|
+
}
|
|
233
|
+
|
|
222
234
|
function onSqlChange(value: string): void {
|
|
223
235
|
sqlDraft.value = value
|
|
236
|
+
const datasetId = props.datasetId
|
|
224
237
|
if (sqlTimer) clearTimeout(sqlTimer)
|
|
225
238
|
sqlTimer = setTimeout(() => {
|
|
226
|
-
|
|
239
|
+
sqlTimer = undefined
|
|
240
|
+
// 防抖窗口内切换了数据集则丢弃,避免把旧草稿写进新数据集
|
|
241
|
+
if (props.datasetId !== datasetId) return
|
|
242
|
+
props.hub.updateDataset(datasetId, { sql: value })
|
|
227
243
|
void runDescribe()
|
|
228
244
|
}, 280)
|
|
229
245
|
}
|
|
@@ -271,6 +287,8 @@ const schemaRows = computed(() => {
|
|
|
271
287
|
// ---- 记录预览(按参数默认值经连接器取数) ----
|
|
272
288
|
|
|
273
289
|
async function runPreview(): Promise<void> {
|
|
290
|
+
// 编辑器 change 仅在失焦时触发且提交有 debounce,先同步落草稿 SQL,避免用旧 SQL 取数
|
|
291
|
+
flushSqlDraft(props.datasetId)
|
|
274
292
|
previewing.value = true
|
|
275
293
|
previewError.value = ''
|
|
276
294
|
const result = await props.hub.previewDataset(props.datasetId)
|
|
@@ -21,7 +21,7 @@ const props = defineProps<{
|
|
|
21
21
|
}>()
|
|
22
22
|
|
|
23
23
|
/** 填充颜色('' = 无填充) */
|
|
24
|
-
const fillColor = ref(
|
|
24
|
+
const fillColor = ref<string>()
|
|
25
25
|
|
|
26
26
|
// 打开时初始化为活动格当前填充色
|
|
27
27
|
onMounted(() => {
|
|
@@ -31,7 +31,8 @@ onMounted(() => {
|
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
/** 填充颜色变化('' = 无填充:清除 fill 保留边框) */
|
|
34
|
-
function applyFillColor(color
|
|
34
|
+
function applyFillColor(color?: string): void {
|
|
35
|
+
fillColor.value = color
|
|
35
36
|
const range = currentRange(props.context)
|
|
36
37
|
if (!range) return
|
|
37
38
|
props.context.applyStyle(range, color ? { fill: { color } } : { fill: {} })
|