st-comp 0.0.190 → 0.0.192

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.190",
4
+ "version": "0.0.192",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -148,16 +148,17 @@ watch(
148
148
  :key="item.id"
149
149
  :label="item.funcName"
150
150
  :value="item.funcName"
151
+ @click="handleInsert"
151
152
  >
152
153
  <div class="func-option">
153
154
  <span>{{ item.funcName }}</span>
154
155
  <div class="icons">
155
- <el-icon @click.stop="handleAddOrEdit(item)">
156
- <Edit />
157
- </el-icon>
158
156
  <el-icon @click.stop="handleAddOrEdit(item, true)">
159
157
  <DocumentCopy />
160
158
  </el-icon>
159
+ <el-icon @click.stop="handleAddOrEdit(item)">
160
+ <Edit />
161
+ </el-icon>
161
162
  <el-popconfirm
162
163
  :title="`确认是否删除?`"
163
164
  confirm-button-text="确认"
@@ -48,6 +48,9 @@ const setPasswordCallBack = () => {
48
48
  </div>
49
49
  <template #dropdown>
50
50
  <el-dropdown-menu>
51
+ <!-- 自定义菜单项插槽 -->
52
+ <slot name="dropdown-items"></slot>
53
+
51
54
  <el-dropdown-item
52
55
  v-if="userData.canSet"
53
56
  @click="SetPasswordDialogRef?.open()"
@@ -107,4 +110,4 @@ const setPasswordCallBack = () => {
107
110
  }
108
111
  }
109
112
  }
110
- </style>
113
+ </style>
@@ -32,7 +32,7 @@ const stVarSelectDialogRef = ref();
32
32
  // 弹窗开关
33
33
  const visible = ref(false);
34
34
  const visibleDescriptions = ref(false);
35
- const factorType = ref("模版");
35
+ const factorType = ref("脚本");
36
36
  // 弹窗表单
37
37
  const dialogFormRef = ref(null);
38
38
  const dialogForm = ref({
@@ -52,16 +52,6 @@ const dialogForm = ref({
52
52
  factorSelectExpr: "",
53
53
  });
54
54
 
55
- watch(
56
- () => [factorType.value, visible.value],
57
- () => {
58
- if (factorType.value === "模版" || visible.value === false) {
59
- stVarSelectDialogRef.value.close();
60
- }
61
- },
62
- { deep: true }
63
- );
64
-
65
55
  // 打开
66
56
  const handleOpenDialog = () => {
67
57
  const { list, sqlEnable, sqlValue, factorSelectExpr } = data.value;
@@ -74,12 +64,12 @@ const handleOpenDialog = () => {
74
64
  // 保证因子筛选最少一条
75
65
  if (!dialogForm.value.list.length) handleAppendFactor();
76
66
  visible.value = true;
77
- // 解决初次访问样式错乱问题
67
+ // 解决刚打开时, 如果是脚本的样式错乱问题
78
68
  nextTick(() => {
79
69
  if (factorSelectExpr) {
80
70
  factorType.value = "脚本";
81
71
  monacoEditorRef.value.setValue(factorSelectExpr);
82
- } else factorType.value = "模版";
72
+ }
83
73
  monacoEditorRef.value.resize();
84
74
  });
85
75
  };
@@ -295,6 +285,16 @@ const handleInsertCustomFunction = (value) => {
295
285
  editorIns.focus();
296
286
  }
297
287
  };
288
+
289
+ watch(
290
+ () => [factorType.value, visible.value],
291
+ () => {
292
+ if (factorType.value === "模版" || visible.value === false) {
293
+ stVarSelectDialogRef.value.close();
294
+ }
295
+ },
296
+ { deep: true }
297
+ );
298
298
  </script>
299
299
 
300
300
  <template>
@@ -1,20 +1,24 @@
1
1
  <template>
2
- <div style="width: 100%;height: 100%;">
3
- <st-user :config="config" @loginout="loginoutFn" />
2
+ <div style="width: 100%; height: 100%">
3
+ <st-user
4
+ :config="config"
5
+ @loginout="loginoutFn"
6
+ >
7
+ <template #dropdown-items>
8
+ <el-dropdown-item>自定义菜单项</el-dropdown-item>
9
+ </template>
10
+ </st-user>
4
11
  </div>
5
12
  </template>
6
13
 
7
14
  <script setup lang="ts">
8
-
9
15
  const config = {
10
16
  loginoutToLogin: false,
11
- }
17
+ };
12
18
 
13
19
  const loginoutFn = () => {
14
- location.reload()
15
- }
20
+ location.reload();
21
+ };
16
22
  </script>
17
23
 
18
- <style lang="scss" scoped>
19
-
20
- </style>
24
+ <style lang="scss" scoped></style>