@veltra/desktop 1.0.13 → 1.0.14
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/components/action/action-group.js +110 -3
- package/dist/components/action/action-group.js.map +1 -1
- package/dist/components/action/action-group.vue.d.ts +16 -3
- package/dist/components/action/action.js +26 -13
- package/dist/components/action/action.js.map +1 -1
- package/dist/components/action/action.vue.d.ts +2 -2
- package/dist/components/action/style.js +2 -1
- package/dist/components/action/style2.css +35 -7
- package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
- package/dist/components/batch-edit/batch-edit-form.js +106 -42
- package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
- package/dist/components/batch-edit/batch-edit-list.js +84 -47
- package/dist/components/batch-edit/batch-edit-list.js.map +1 -1
- package/dist/components/batch-edit/batch-edit.js +42 -10
- package/dist/components/batch-edit/batch-edit.js.map +1 -1
- package/dist/components/batch-edit/style.js +2 -4
- package/dist/components/batch-edit/style2.css +202 -30
- package/dist/components/batch-edit/use-edit.js +45 -9
- package/dist/components/batch-edit/use-edit.js.map +1 -1
- package/dist/components/cascade/cascade.js +3 -1
- package/dist/components/cascade/cascade.js.map +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +2 -2
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
- package/dist/components/code-editor/code-editor.js +145 -49
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/code-editor/code-editor.vue.d.ts +2 -0
- package/dist/components/code-editor/style2.css +87 -19
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
- package/dist/components/dialog/dialog.js +6 -2
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dialog/style2.css +2 -3
- package/dist/components/expression-editor/components/path-preview.js +27 -0
- package/dist/components/expression-editor/components/path-preview.js.map +1 -0
- package/dist/components/expression-editor/components/variable-picker.js +199 -153
- package/dist/components/expression-editor/components/variable-picker.js.map +1 -1
- package/dist/components/expression-editor/core/chip.js +54 -0
- package/dist/components/expression-editor/core/chip.js.map +1 -0
- package/dist/components/expression-editor/core/editor.js +424 -0
- package/dist/components/expression-editor/core/editor.js.map +1 -0
- package/dist/components/expression-editor/core/mention.js +91 -0
- package/dist/components/expression-editor/core/mention.js.map +1 -0
- package/dist/components/expression-editor/core/model.js +64 -0
- package/dist/components/expression-editor/core/model.js.map +1 -0
- package/dist/components/expression-editor/di.js +4 -10
- package/dist/components/expression-editor/di.js.map +1 -1
- package/dist/components/expression-editor/expression-editor.js +168 -114
- package/dist/components/expression-editor/expression-editor.js.map +1 -1
- package/dist/components/expression-editor/expression-editor.vue.d.ts +2 -1
- package/dist/components/expression-editor/style.js +0 -2
- package/dist/components/expression-editor/style2.css +145 -219
- package/dist/components/index.js +54 -54
- package/dist/components/input/input.vue.d.ts +2 -2
- package/dist/components/layout/layout.js +12 -11
- package/dist/components/layout/layout.js.map +1 -1
- package/dist/components/multi-select/multi-select.vue.d.ts +3 -3
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +3 -3
- package/dist/components/notification/notification.vue.d.ts +1 -1
- package/dist/components/number/number.vue.d.ts +1 -1
- package/dist/components/number-input/number-input.js +4 -4
- package/dist/components/number-input/number-input.js.map +1 -1
- package/dist/components/number-input/number-input.vue.d.ts +2 -2
- package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
- package/dist/components/password-input/password-input.vue.d.ts +1 -1
- package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
- package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
- package/dist/components/rich-text-editor/rich-text-editor.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
- package/dist/components/rich-text-editor/toolbar.js +2 -2
- package/dist/components/select/select.vue.d.ts +2 -2
- package/dist/components/steps/steps.vue.d.ts +1 -1
- package/dist/components/table/use-table.js +16 -0
- package/dist/components/table/use-table.js.map +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +1 -1
- package/dist/components/tabs/tabs-vertical.vue.d.ts +1 -1
- package/dist/components/tabs/tabs.vue.d.ts +1 -1
- package/dist/components/textarea/textarea.vue.d.ts +2 -2
- package/dist/components/tip/tip.vue.d.ts +1 -1
- package/dist/components/tree/style2.css +18 -12
- package/dist/components/tree/tree-node.js +7 -4
- package/dist/components/tree/tree-node.js.map +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +83 -83
- package/dist/style.js +3 -3
- package/dist/types/action.d.ts +38 -4
- package/dist/types/cascade.d.ts +2 -3
- package/dist/types/code-editor.d.ts +9 -2
- package/dist/types/expression-editor.d.ts +9 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +11 -12
- package/src/components/action/action-group.vue +126 -56
- package/src/components/action/action.vue +35 -12
- package/src/components/action/style.scss +46 -10
- package/src/components/action/style.ts +2 -1
- package/src/components/batch-edit/batch-edit-form.vue +121 -45
- package/src/components/batch-edit/batch-edit-list.vue +56 -39
- package/src/components/batch-edit/batch-edit.vue +57 -6
- package/src/components/batch-edit/style.scss +251 -37
- package/src/components/batch-edit/style.ts +5 -8
- package/src/components/batch-edit/use-edit.ts +58 -11
- package/src/components/cascade/cascade.vue +3 -1
- package/src/components/code-editor/code-editor.vue +198 -63
- package/src/components/code-editor/style.scss +110 -12
- package/src/components/dialog/dialog.vue +6 -2
- package/src/components/dialog/style.scss +4 -4
- package/src/components/expression-editor/__test__/chip.test.ts +86 -0
- package/src/components/expression-editor/__test__/mention.test.ts +122 -0
- package/src/components/expression-editor/__test__/model.test.ts +127 -0
- package/src/components/expression-editor/components/path-preview.vue +32 -0
- package/src/components/expression-editor/components/variable-picker.vue +224 -219
- package/src/components/expression-editor/core/chip.ts +101 -0
- package/src/components/expression-editor/core/editor.ts +513 -0
- package/src/components/expression-editor/core/mention.ts +121 -0
- package/src/components/expression-editor/core/model.ts +109 -0
- package/src/components/expression-editor/di.ts +4 -32
- package/src/components/expression-editor/expression-editor.vue +184 -151
- package/src/components/expression-editor/style.scss +148 -220
- package/src/components/expression-editor/style.ts +0 -2
- package/src/components/layout/layout.vue +17 -19
- package/src/components/number-input/number-input.vue +4 -4
- package/src/components/table/use-table.ts +16 -0
- package/src/components/tree/style.scss +30 -33
- package/src/components/tree/tree-node.vue +4 -2
- package/src/types/action.ts +42 -4
- package/src/types/cascade.ts +4 -3
- package/src/types/code-editor.ts +9 -2
- package/src/types/expression-editor.ts +9 -0
- package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js +0 -65
- package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/components/expression-editor/constants.js +0 -9
- package/dist/components/expression-editor/constants.js.map +0 -1
- package/dist/components/expression-editor/internal/editor-runtime/create-runtime.js +0 -47
- package/dist/components/expression-editor/internal/editor-runtime/create-runtime.js.map +0 -1
- package/dist/components/expression-editor/internal/editor-runtime/model-sync.js +0 -49
- package/dist/components/expression-editor/internal/editor-runtime/model-sync.js.map +0 -1
- package/dist/components/expression-editor/internal/features/commands/register-command-packs.js +0 -215
- package/dist/components/expression-editor/internal/features/commands/register-command-packs.js.map +0 -1
- package/dist/components/expression-editor/internal/features/drag-drop/drag-drop-service.js +0 -33
- package/dist/components/expression-editor/internal/features/drag-drop/drag-drop-service.js.map +0 -1
- package/dist/components/expression-editor/internal/features/insertion/insertion-service.js +0 -33
- package/dist/components/expression-editor/internal/features/insertion/insertion-service.js.map +0 -1
- package/dist/components/expression-editor/nodes/variable-node.js +0 -94
- package/dist/components/expression-editor/nodes/variable-node.js.map +0 -1
- package/dist/components/expression-editor/parser.js +0 -32
- package/dist/components/expression-editor/parser.js.map +0 -1
- package/dist/components/expression-editor/plain-text.js +0 -19
- package/dist/components/expression-editor/plain-text.js.map +0 -1
- package/dist/components/expression-editor/use-context.js +0 -69
- package/dist/components/expression-editor/use-context.js.map +0 -1
- package/dist/components/expression-editor/use-decorators.js +0 -27
- package/dist/components/expression-editor/use-decorators.js.map +0 -1
- package/dist/components/expression-editor/use-expression-drag-drop.js +0 -275
- package/dist/components/expression-editor/use-expression-drag-drop.js.map +0 -1
- package/src/components/batch-edit/batch-edit-new.vue +0 -168
- package/src/components/batch-edit/style-new.scss +0 -35
- package/src/components/batch-edit/use-edit-new.ts +0 -68
- package/src/components/batch-edit/use-tip.ts +0 -47
- package/src/components/expression-editor/__test__/architecture-boundaries.test.ts +0 -103
- package/src/components/expression-editor/__test__/architecture-compatibility.test.ts +0 -52
- package/src/components/expression-editor/__test__/drag-drop.test.ts +0 -171
- package/src/components/expression-editor/__test__/parser.test.ts +0 -62
- package/src/components/expression-editor/constants.ts +0 -6
- package/src/components/expression-editor/internal/contracts/editor-runtime.ts +0 -11
- package/src/components/expression-editor/internal/editor-runtime/create-runtime.ts +0 -64
- package/src/components/expression-editor/internal/editor-runtime/index.ts +0 -1
- package/src/components/expression-editor/internal/editor-runtime/model-sync.ts +0 -68
- package/src/components/expression-editor/internal/features/commands/register-command-packs.ts +0 -517
- package/src/components/expression-editor/internal/features/drag-drop/drag-drop-service.ts +0 -51
- package/src/components/expression-editor/internal/features/insertion/insertion-service.ts +0 -56
- package/src/components/expression-editor/nodes/variable-node.tsx +0 -118
- package/src/components/expression-editor/parser.ts +0 -46
- package/src/components/expression-editor/plain-text.ts +0 -25
- package/src/components/expression-editor/plan.md +0 -22
- package/src/components/expression-editor/use-context.ts +0 -134
- package/src/components/expression-editor/use-decorators.tsx +0 -29
- package/src/components/expression-editor/use-editor.ts +0 -12
- package/src/components/expression-editor/use-expression-drag-drop.ts +0 -396
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
@use 'pkg:@veltra/styles/mixins' as m;
|
|
2
2
|
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
|
-
@use 'sass:map';
|
|
4
3
|
|
|
5
4
|
$root-name: tree;
|
|
6
5
|
|
|
7
|
-
// 每一级缩进与展开图标 /
|
|
6
|
+
// 每一级缩进与展开图标 / 叶子图标保持一致的宽度,
|
|
8
7
|
// 保证节点内容在各层之间横向对齐。
|
|
9
8
|
$indent-width: 20px;
|
|
10
|
-
$indent-leaf-width: 20px;
|
|
11
|
-
$expand-icon-size: 20px;
|
|
12
|
-
// 节点稳态高度,与 `tree.vue` 中 `estimateSize` 协同,用于虚拟滚动初始估算。
|
|
13
|
-
$node-min-height-small: 28px;
|
|
14
|
-
$node-min-height-default: 32px;
|
|
15
|
-
$node-min-height-large: 40px;
|
|
16
|
-
$node-min-heights: (
|
|
17
|
-
small: $node-min-height-small,
|
|
18
|
-
default: $node-min-height-default,
|
|
19
|
-
large: $node-min-height-large
|
|
20
|
-
);
|
|
21
9
|
|
|
22
10
|
@include m.b($root-name) {
|
|
23
11
|
@include m.size using ($size) {
|
|
@@ -33,7 +21,7 @@ $node-min-heights: (
|
|
|
33
21
|
}
|
|
34
22
|
|
|
35
23
|
@include m.bem($root-name, node) {
|
|
36
|
-
min-height:
|
|
24
|
+
min-height: fn.use-var(form-component-height, $size);
|
|
37
25
|
}
|
|
38
26
|
}
|
|
39
27
|
|
|
@@ -85,22 +73,23 @@ $node-min-heights: (
|
|
|
85
73
|
@include m.flex($align: center);
|
|
86
74
|
|
|
87
75
|
@include m.is(selected) {
|
|
88
|
-
// 左侧 3px 色带,配合淡色背景共同构成选中态。
|
|
89
|
-
&::before {
|
|
90
|
-
content: '';
|
|
91
|
-
position: absolute;
|
|
92
|
-
left: 0;
|
|
93
|
-
top: 4px;
|
|
94
|
-
bottom: 4px;
|
|
95
|
-
width: 3px;
|
|
96
|
-
border-radius: 3px;
|
|
97
|
-
background-color: fn.use-var(color, primary);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
76
|
@include m.bem($root-name, node-content) {
|
|
101
77
|
background-color: fn.use-var(color, primary, light-9);
|
|
102
78
|
color: fn.use-var(color, primary);
|
|
103
79
|
font-weight: 500;
|
|
80
|
+
|
|
81
|
+
// 左侧 3px 色带,配合淡色背景共同构成选中态;
|
|
82
|
+
// 贴在节点内容(而非整行)左侧,避免与缩进 / 图标错位。
|
|
83
|
+
&::before {
|
|
84
|
+
content: '';
|
|
85
|
+
position: absolute;
|
|
86
|
+
left: 0;
|
|
87
|
+
top: 4px;
|
|
88
|
+
bottom: 4px;
|
|
89
|
+
width: 3px;
|
|
90
|
+
border-radius: 3px;
|
|
91
|
+
background-color: fn.use-var(color, primary);
|
|
92
|
+
}
|
|
104
93
|
}
|
|
105
94
|
}
|
|
106
95
|
|
|
@@ -128,18 +117,14 @@ $node-min-heights: (
|
|
|
128
117
|
@include m.e(indent) {
|
|
129
118
|
flex-shrink: 0;
|
|
130
119
|
width: $indent-width;
|
|
131
|
-
|
|
132
|
-
@include m.em(indent, leaf) {
|
|
133
|
-
width: $indent-leaf-width;
|
|
134
|
-
}
|
|
135
120
|
}
|
|
136
121
|
|
|
137
122
|
@include m.e(expand-icon) {
|
|
138
123
|
cursor: pointer;
|
|
139
124
|
flex-shrink: 0;
|
|
140
|
-
width: $
|
|
141
|
-
height: $
|
|
142
|
-
font-size: $
|
|
125
|
+
width: $indent-width;
|
|
126
|
+
height: $indent-width;
|
|
127
|
+
font-size: $indent-width;
|
|
143
128
|
border-radius: 50%;
|
|
144
129
|
transition:
|
|
145
130
|
transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
|
|
@@ -150,7 +135,19 @@ $node-min-heights: (
|
|
|
150
135
|
}
|
|
151
136
|
}
|
|
152
137
|
|
|
138
|
+
// 叶子节点的占位标识:与展开图标占据相同尺寸以保持同列对齐,
|
|
139
|
+
// 通过淡色 + 缩小的圆点显式表达"叶子"语义,避免空白看起来像缺失。
|
|
140
|
+
@include m.e(leaf-icon) {
|
|
141
|
+
flex-shrink: 0;
|
|
142
|
+
width: $indent-width;
|
|
143
|
+
height: $indent-width;
|
|
144
|
+
font-size: $indent-width;
|
|
145
|
+
color: fn.use-var(text-color, placeholder);
|
|
146
|
+
pointer-events: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
153
149
|
@include m.e(node-content) {
|
|
150
|
+
position: relative;
|
|
154
151
|
flex-grow: 1;
|
|
155
152
|
overflow: hidden;
|
|
156
153
|
user-select: none;
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
<u-icon v-if="!node.isLeaf" :class="cls.e('expand-icon')" @click.stop="toggleExpand">
|
|
9
9
|
<ArrowRight />
|
|
10
10
|
</u-icon>
|
|
11
|
-
<
|
|
11
|
+
<u-icon v-else :class="cls.e('leaf-icon')" aria-hidden="true">
|
|
12
|
+
<Dot />
|
|
13
|
+
</u-icon>
|
|
12
14
|
|
|
13
15
|
<div
|
|
14
16
|
:class="cls.e('node-content')"
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
|
|
36
38
|
<script lang="ts" setup>
|
|
37
39
|
import { vRipple } from '@veltra/directives'
|
|
38
|
-
import { ArrowRight } from '@veltra/icons/normal'
|
|
40
|
+
import { ArrowRight, Dot } from '@veltra/icons/normal'
|
|
39
41
|
import { bem } from '@veltra/utils'
|
|
40
42
|
import { inject } from 'vue'
|
|
41
43
|
|
package/src/types/action.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeconstructValue } from '@veltra/utils'
|
|
1
|
+
import type { ColorType, DeconstructValue } from '@veltra/utils'
|
|
2
2
|
|
|
3
3
|
import type { ButtonProps } from './button'
|
|
4
4
|
|
|
@@ -7,7 +7,10 @@ export interface ActionProps extends ButtonProps {
|
|
|
7
7
|
/** 是否需要确认 */
|
|
8
8
|
needConfirm?: boolean
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* 是否始终位于下拉菜单中,无视 `max` 限制
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
11
14
|
inDropdown?: boolean
|
|
12
15
|
}
|
|
13
16
|
|
|
@@ -15,11 +18,46 @@ export interface ActionProps extends ButtonProps {
|
|
|
15
18
|
export interface ActionGroupProps {
|
|
16
19
|
/** 是否加载中 */
|
|
17
20
|
loading?: boolean
|
|
18
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* 是否为圆形按钮,适用于图标类。`hover` 模式下默认对所有子项生效
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
19
25
|
circle?: boolean
|
|
20
26
|
|
|
21
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* 最大可显示按钮数量,超出部分自动收纳到下拉菜单
|
|
29
|
+
* @default 3
|
|
30
|
+
*/
|
|
22
31
|
max?: number
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 紧凑悬浮模式
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* - 默认半透明,悬浮在父容器上方时完全显现
|
|
38
|
+
* - 提供圆角胶囊容器与磨砂背景,更适合表格行内操作栏
|
|
39
|
+
* - "更多"按钮也会切换为图标态以与其他操作按钮保持一致
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
hover?: boolean
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 子项默认尺寸
|
|
46
|
+
* @default 'small'
|
|
47
|
+
*/
|
|
48
|
+
size?: 'small' | 'default' | 'large'
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 子项默认是否使用文本样式
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
text?: boolean
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 子项默认按钮类型
|
|
58
|
+
* @default 'primary'
|
|
59
|
+
*/
|
|
60
|
+
type?: ColorType
|
|
23
61
|
}
|
|
24
62
|
|
|
25
63
|
/** 操作组件定义的事件 */
|
package/src/types/cascade.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TreeNode } from '@cat-kit/core'
|
|
2
2
|
import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
|
|
3
3
|
|
|
4
|
-
export interface CascadeNode
|
|
5
|
-
|
|
4
|
+
export interface CascadeNode<
|
|
5
|
+
Data extends Record<string, any> = Record<string, any>
|
|
6
|
+
> extends TreeNode<Data, CascadeNode<Data>> {
|
|
6
7
|
visible: boolean
|
|
7
8
|
value: string
|
|
8
9
|
label: string
|
package/src/types/code-editor.ts
CHANGED
|
@@ -2,11 +2,18 @@ import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
|
|
|
2
2
|
|
|
3
3
|
export type CodeEditorLang = 'js' | 'sql' | 'java' | 'json'
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
export interface CodeEditorProps extends FormComponentProps {
|
|
5
|
+
/** 代码编辑器组件属性(不支持 `size`) */
|
|
6
|
+
export interface CodeEditorProps extends Omit<FormComponentProps, 'size'> {
|
|
7
7
|
modelValue?: string
|
|
8
8
|
/** 定义语言 */
|
|
9
9
|
language?: CodeEditorLang
|
|
10
|
+
/** 是否使用暗色主题 */
|
|
11
|
+
dark?: boolean
|
|
12
|
+
/**
|
|
13
|
+
* 默认显示的行数,用于撑起编辑器最小高度,超出后滚动
|
|
14
|
+
* @default 8
|
|
15
|
+
*/
|
|
16
|
+
defaultLines?: number
|
|
10
17
|
}
|
|
11
18
|
|
|
12
19
|
/** 代码编辑器组件定义的事件 */
|
|
@@ -9,12 +9,21 @@ export interface VariableItem {
|
|
|
9
9
|
children?: VariableItem[]
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/** 选中范围:仅叶子节点,或允许任意层级(含分支) */
|
|
13
|
+
export type ExpressionSelectableLevels = 'leaf' | 'any'
|
|
14
|
+
|
|
12
15
|
/** 表达式编辑器组件属性 */
|
|
13
16
|
export interface ExpressionEditorProps extends FormComponentProps {
|
|
14
17
|
modelValue?: string
|
|
15
18
|
placeholder?: string
|
|
16
19
|
/** 变量列表 */
|
|
17
20
|
variables?: VariableItem[]
|
|
21
|
+
/**
|
|
22
|
+
* 是否允许选中任意层级的变量(含中间分支)。
|
|
23
|
+
* - `'leaf'`(默认):仅叶子节点可选;分支节点上 Enter / → 进入下一级
|
|
24
|
+
* - `'any'`:分支节点上 Enter 选中分支本身、→ 进入下一级
|
|
25
|
+
*/
|
|
26
|
+
selectableLevels?: ExpressionSelectableLevels
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
/** 表达式编辑器组件定义的事件 */
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import _sfc_main from "../icon/icon.js";
|
|
2
|
-
import _sfc_main$1 from "../tip/tip.js";
|
|
3
|
-
import _sfc_main$2 from "../button/button.js";
|
|
4
|
-
import { ActionDIKey } from "./di.js";
|
|
5
|
-
import { Fragment, createBlock, createElementBlock, createTextVNode, createVNode, defineComponent, openBlock, provide, renderList, resolveDynamicComponent, useSlots } from "vue";
|
|
6
|
-
import { bem, extractNormalVNodes } from "@veltra/utils";
|
|
7
|
-
import { ArrowDown } from "@veltra/icons/normal";
|
|
8
|
-
//#region src/components/action/action-group.vue?vue&type=script&setup=true&lang.tsx
|
|
9
|
-
var action_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
10
|
-
name: "ActionGroup",
|
|
11
|
-
inheritAttrs: false,
|
|
12
|
-
__name: "action-group",
|
|
13
|
-
props: {
|
|
14
|
-
loading: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: false
|
|
17
|
-
},
|
|
18
|
-
circle: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false
|
|
21
|
-
},
|
|
22
|
-
max: { default: 3 }
|
|
23
|
-
},
|
|
24
|
-
setup(__props) {
|
|
25
|
-
const props = __props;
|
|
26
|
-
const cls = bem("action-group");
|
|
27
|
-
const actionCls = bem("action");
|
|
28
|
-
const slots = useSlots();
|
|
29
|
-
function getSlotsNodes() {
|
|
30
|
-
const nodes = slots.default?.();
|
|
31
|
-
if (!nodes) return [];
|
|
32
|
-
const extractedNodes = extractNormalVNodes(nodes).filter((node) => node.type?.name === "Action");
|
|
33
|
-
let normalNodes = [];
|
|
34
|
-
let hiddenNodes = [];
|
|
35
|
-
if (extractedNodes.length === props.max) normalNodes = extractedNodes;
|
|
36
|
-
else {
|
|
37
|
-
normalNodes = extractedNodes.slice(0, props.max - 1);
|
|
38
|
-
hiddenNodes = extractedNodes.slice(props.max - 1);
|
|
39
|
-
}
|
|
40
|
-
const dropdown = hiddenNodes.length ? createVNode(_sfc_main$1, {
|
|
41
|
-
"direction": "bottom",
|
|
42
|
-
"class": cls.e("dropdown")
|
|
43
|
-
}, {
|
|
44
|
-
content: () => hiddenNodes,
|
|
45
|
-
default: () => createVNode(_sfc_main$2, {
|
|
46
|
-
"text": true,
|
|
47
|
-
"size": "small",
|
|
48
|
-
"type": "primary",
|
|
49
|
-
"class": actionCls.b
|
|
50
|
-
}, { default: () => [createTextVNode("更多"), createVNode(_sfc_main, null, { default: () => [createVNode(ArrowDown, null, null)] })] })
|
|
51
|
-
}) : null;
|
|
52
|
-
return dropdown ? [...normalNodes, dropdown] : normalNodes;
|
|
53
|
-
}
|
|
54
|
-
provide(ActionDIKey, { groupProps: props });
|
|
55
|
-
return (_ctx, _cache) => {
|
|
56
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(getSlotsNodes(), (node) => {
|
|
57
|
-
return openBlock(), createBlock(resolveDynamicComponent(node), { key: node.key });
|
|
58
|
-
}), 128);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
//#endregion
|
|
63
|
-
export { action_group_vue_vue_type_script_setup_true_lang_default as default };
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=action-group.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-group.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/action/action-group.vue"],"sourcesContent":["<template>\n <component v-for=\"node of getSlotsNodes()\" :key=\"node.key\" :is=\"node\" />\n</template>\n\n<script lang=\"tsx\" setup>\nimport type { ActionGroupProps } from \"../../types\";\nimport { ArrowDown } from '@veltra/icons/normal'\nimport { UIcon } from \"../icon\";\nimport { UButton } from \"../button\";\nimport { provide, type VNode } from \"vue\";\nimport { bem, extractNormalVNodes } from \"@veltra/utils\";\nimport { UTip } from \"../tip\";\nimport { ActionDIKey } from \"./di\";\n\ndefineOptions({\n name: \"ActionGroup\",\n inheritAttrs: false,\n});\n\nconst props = withDefaults(defineProps<ActionGroupProps>(), {\n max: 3,\n loading: false,\n circle: false,\n});\n\nconst cls = bem(\"action-group\");\nconst actionCls = bem(\"action\");\n\nconst slots = defineSlots<{\n default?: () => VNode[];\n}>();\n\nfunction getSlotsNodes() {\n const nodes = slots.default?.();\n\n if (!nodes) return [];\n const extractedNodes = extractNormalVNodes(nodes).filter(\n // @ts-ignore\n (node) => node.type?.name === \"Action\",\n );\n\n let normalNodes: VNode[] = [];\n let hiddenNodes: VNode[] = [];\n if (extractedNodes.length === props.max) {\n normalNodes = extractedNodes;\n } else {\n normalNodes = extractedNodes.slice(0, props.max - 1);\n hiddenNodes = extractedNodes.slice(props.max - 1);\n }\n\n const dropdown = hiddenNodes.length ? (\n <UTip direction=\"bottom\" class={cls.e(\"dropdown\")}>\n {{\n content: () => hiddenNodes,\n default: () => (\n <UButton text size=\"small\" type=\"primary\" class={actionCls.b}>\n 更多\n <UIcon>\n <ArrowDown />\n </UIcon>\n </UButton>\n ),\n }}\n </UTip>\n ) : null;\n\n return dropdown ? [...normalNodes, dropdown] : normalNodes;\n}\n\nprovide(ActionDIKey, {\n groupProps: props,\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAmBA,MAAM,QAAQ;EAMd,MAAM,MAAM,IAAI,eAAe;EAC/B,MAAM,YAAY,IAAI,SAAS;EAE/B,MAAM,QAAQ,UAEV;EAEJ,SAAS,gBAAgB;GACvB,MAAM,QAAQ,MAAM,WAAW;AAE/B,OAAI,CAAC,MAAO,QAAO,EAAE;GACrB,MAAM,iBAAiB,oBAAoB,MAAM,CAAC,QAE/C,SAAS,KAAK,MAAM,SAAS,SAC/B;GAED,IAAI,cAAuB,EAAE;GAC7B,IAAI,cAAuB,EAAE;AAC7B,OAAI,eAAe,WAAW,MAAM,IAClC,eAAc;QACT;AACL,kBAAc,eAAe,MAAM,GAAG,MAAM,MAAM,EAAE;AACpD,kBAAc,eAAe,MAAM,MAAM,MAAM,EAAE;;GAGnD,MAAM,WAAW,YAAY,SAAM,YAAA,aAAA;IAAA,aAAA;IAAA,SACD,IAAI,EAAE,WAAU;IAAC,EAAA;IAE7C,eAAe;IACf,eAAS,YAAA,aAAA;KAAA,QAAA;KAAA,QAAA;KAAA,QAAA;KAAA,SAC0C,UAAU;KAAC,EAAA,EAAA,eAAA,CAAA,gBAAA,KAAA,EAAA,YAAA,WAAA,MAAA,EAAA,eAAA,CAAA,YAAA,WAAA,MAAA,KAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA;IAM7D,CAAA,GAGH;AAEJ,UAAO,WAAW,CAAC,GAAG,aAAa,SAAS,GAAG;;AAGjD,UAAQ,aAAa,EACnB,YAAY,OACb,CAAC;;2BAtEA,mBAAwE,UAAA,MAAA,WAA9C,eAAa,GAArB,SAAI;wBAAtB,YAAwE,wBAAR,KAAI,EAAA,EAAxB,KAAK,KAAK,KAAA,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region src/components/expression-editor/constants.ts
|
|
2
|
-
const EXPRESSION_VARIABLE_DRAG_TYPE = "application/x-ultra-expression-variable";
|
|
3
|
-
const EXPRESSION_VARIABLE_DRAG_MARKER_ATTR = "data-ultra-expression-variable-node";
|
|
4
|
-
const EXPRESSION_VARIABLE_DRAG_KEY_ATTR = "data-ultra-expression-variable-key";
|
|
5
|
-
const EXPRESSION_DROP_SCOPE_ATTR = "data-ultra-expression-drop-scope";
|
|
6
|
-
//#endregion
|
|
7
|
-
export { EXPRESSION_DROP_SCOPE_ATTR, EXPRESSION_VARIABLE_DRAG_KEY_ATTR, EXPRESSION_VARIABLE_DRAG_MARKER_ATTR, EXPRESSION_VARIABLE_DRAG_TYPE };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/components/expression-editor/constants.ts"],"sourcesContent":["export const CONTEXT_TRIGGER_CHAR = '@'\n\nexport const EXPRESSION_VARIABLE_DRAG_TYPE = 'application/x-ultra-expression-variable'\nexport const EXPRESSION_VARIABLE_DRAG_MARKER_ATTR = 'data-ultra-expression-variable-node'\nexport const EXPRESSION_VARIABLE_DRAG_KEY_ATTR = 'data-ultra-expression-variable-key'\nexport const EXPRESSION_DROP_SCOPE_ATTR = 'data-ultra-expression-drop-scope'\n"],"mappings":";AAEA,MAAa,gCAAgC;AAC7C,MAAa,uCAAuC;AACpD,MAAa,oCAAoC;AACjD,MAAa,6BAA6B"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createVariableMap } from "../../di.js";
|
|
2
|
-
import { VariableNode } from "../../nodes/variable-node.js";
|
|
3
|
-
import { createModelSync } from "./model-sync.js";
|
|
4
|
-
import { computed, watchEffect } from "vue";
|
|
5
|
-
import { createEditor } from "lexical";
|
|
6
|
-
//#region src/components/expression-editor/internal/editor-runtime/create-runtime.ts
|
|
7
|
-
function createDefaultMutationGateway(editor) {
|
|
8
|
-
return { runUpdate(updater) {
|
|
9
|
-
editor.update(() => {
|
|
10
|
-
updater();
|
|
11
|
-
});
|
|
12
|
-
} };
|
|
13
|
-
}
|
|
14
|
-
function resolveEditable(disabled, readonly) {
|
|
15
|
-
return !disabled.value && !readonly.value;
|
|
16
|
-
}
|
|
17
|
-
function createExpressionEditorRuntime(options) {
|
|
18
|
-
const { disabled, readonly, container, props, emit, cls } = options;
|
|
19
|
-
const editor = createEditor({
|
|
20
|
-
namespace: "ExpressionEditor",
|
|
21
|
-
nodes: [VariableNode],
|
|
22
|
-
onError: console.error,
|
|
23
|
-
editable: resolveEditable(disabled, readonly),
|
|
24
|
-
theme: { paragraph: cls.e("paragraph") }
|
|
25
|
-
});
|
|
26
|
-
watchEffect(() => {
|
|
27
|
-
editor.setEditable(resolveEditable(disabled, readonly));
|
|
28
|
-
});
|
|
29
|
-
watchEffect(() => {
|
|
30
|
-
container.value && editor.setRootElement(container.value);
|
|
31
|
-
});
|
|
32
|
-
const sync = createModelSync({
|
|
33
|
-
editor,
|
|
34
|
-
props,
|
|
35
|
-
emit,
|
|
36
|
-
variableMap: computed(() => createVariableMap(props.variables))
|
|
37
|
-
});
|
|
38
|
-
return {
|
|
39
|
-
editor,
|
|
40
|
-
mutations: createDefaultMutationGateway(editor),
|
|
41
|
-
syncFromModelValue: sync.syncFromModelValue
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { createExpressionEditorRuntime };
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=create-runtime.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-runtime.js","names":[],"sources":["../../../../../src/components/expression-editor/internal/editor-runtime/create-runtime.ts"],"sourcesContent":["import type { BEM } from '@veltra/utils'\nimport { createEditor } from 'lexical'\nimport { watchEffect, computed, type Ref, type ShallowRef } from 'vue'\n\nimport type { ExpressionEditorEmits, ExpressionEditorProps } from '../../../../types'\nimport { createVariableMap } from '../../di'\nimport { VariableNode } from '../../nodes/variable-node'\nimport type { EditorMutationGateway, ExpressionEditorRuntime } from '../contracts/editor-runtime'\nimport { createModelSync } from './model-sync'\n\nexport interface CreateExpressionEditorRuntimeOptions {\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n props: ExpressionEditorProps\n cls: BEM<'expression-editor'>\n emit: ExpressionEditorEmits\n container: ShallowRef<HTMLElement | null>\n}\n\nfunction createDefaultMutationGateway(\n editor: ExpressionEditorRuntime['editor']\n): EditorMutationGateway {\n return {\n runUpdate(updater) {\n editor.update(() => {\n updater()\n })\n }\n }\n}\n\nfunction resolveEditable(disabled: Ref<boolean>, readonly: Ref<boolean>) {\n return !disabled.value && !readonly.value\n}\n\nexport function createExpressionEditorRuntime(\n options: CreateExpressionEditorRuntimeOptions\n): ExpressionEditorRuntime {\n const { disabled, readonly, container, props, emit, cls } = options\n const editor = createEditor({\n namespace: 'ExpressionEditor',\n nodes: [VariableNode],\n onError: console.error,\n editable: resolveEditable(disabled, readonly),\n theme: { paragraph: cls.e('paragraph') }\n })\n\n watchEffect(() => {\n editor.setEditable(resolveEditable(disabled, readonly))\n })\n\n watchEffect(() => {\n container.value && editor.setRootElement(container.value)\n })\n\n const variableMap = computed(() => createVariableMap(props.variables))\n const sync = createModelSync({ editor, props, emit, variableMap })\n\n return {\n editor,\n mutations: createDefaultMutationGateway(editor),\n syncFromModelValue: sync.syncFromModelValue\n }\n}\n"],"mappings":";;;;;;AAmBA,SAAS,6BACP,QACuB;AACvB,QAAO,EACL,UAAU,SAAS;AACjB,SAAO,aAAa;AAClB,YAAS;IACT;IAEL;;AAGH,SAAS,gBAAgB,UAAwB,UAAwB;AACvE,QAAO,CAAC,SAAS,SAAS,CAAC,SAAS;;AAGtC,SAAgB,8BACd,SACyB;CACzB,MAAM,EAAE,UAAU,UAAU,WAAW,OAAO,MAAM,QAAQ;CAC5D,MAAM,SAAS,aAAa;EAC1B,WAAW;EACX,OAAO,CAAC,aAAa;EACrB,SAAS,QAAQ;EACjB,UAAU,gBAAgB,UAAU,SAAS;EAC7C,OAAO,EAAE,WAAW,IAAI,EAAE,YAAY,EAAE;EACzC,CAAC;AAEF,mBAAkB;AAChB,SAAO,YAAY,gBAAgB,UAAU,SAAS,CAAC;GACvD;AAEF,mBAAkB;AAChB,YAAU,SAAS,OAAO,eAAe,UAAU,MAAM;GACzD;CAGF,MAAM,OAAO,gBAAgB;EAAE;EAAQ;EAAO;EAAM,aADhC,eAAe,kBAAkB,MAAM,UAAU,CACN;EAAE,CAAC;AAElE,QAAO;EACL;EACA,WAAW,6BAA6B,OAAO;EAC/C,oBAAoB,KAAK;EAC1B"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { parseContent } from "../../parser.js";
|
|
2
|
-
import { nextTick, watchEffect } from "vue";
|
|
3
|
-
import { $createParagraphNode, $getRoot, SKIP_DOM_SELECTION_TAG } from "lexical";
|
|
4
|
-
//#region src/components/expression-editor/internal/editor-runtime/model-sync.ts
|
|
5
|
-
function createModelSync(options) {
|
|
6
|
-
const { editor, props, emit, variableMap } = options;
|
|
7
|
-
let changeByUser = false;
|
|
8
|
-
let changeByModel = false;
|
|
9
|
-
let lastEmittedValue = null;
|
|
10
|
-
function syncFromModelValue() {
|
|
11
|
-
changeByModel = true;
|
|
12
|
-
const { modelValue } = props;
|
|
13
|
-
if (!modelValue) return;
|
|
14
|
-
editor.update(() => {
|
|
15
|
-
const root = $getRoot();
|
|
16
|
-
root.clear();
|
|
17
|
-
const paragraph = $createParagraphNode();
|
|
18
|
-
const nodes = parseContent(modelValue, variableMap.value);
|
|
19
|
-
paragraph.append(...nodes);
|
|
20
|
-
root.append(paragraph);
|
|
21
|
-
}, { tag: SKIP_DOM_SELECTION_TAG });
|
|
22
|
-
nextTick(() => {
|
|
23
|
-
changeByModel = false;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
editor.registerTextContentListener((text) => {
|
|
27
|
-
if (changeByModel) return;
|
|
28
|
-
emit("update:modelValue", text);
|
|
29
|
-
lastEmittedValue = text;
|
|
30
|
-
changeByUser = true;
|
|
31
|
-
nextTick(() => {
|
|
32
|
-
if (lastEmittedValue === props.modelValue) changeByUser = false;
|
|
33
|
-
else setTimeout(() => {
|
|
34
|
-
changeByUser = false;
|
|
35
|
-
}, 0);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
watchEffect(() => {
|
|
39
|
-
if (changeByUser) return;
|
|
40
|
-
const current = editor.getEditorState().read(() => $getRoot().getTextContent());
|
|
41
|
-
if (props.modelValue === current) return;
|
|
42
|
-
syncFromModelValue();
|
|
43
|
-
});
|
|
44
|
-
return { syncFromModelValue };
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
export { createModelSync };
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=model-sync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-sync.js","names":[],"sources":["../../../../../src/components/expression-editor/internal/editor-runtime/model-sync.ts"],"sourcesContent":["import { $createParagraphNode, $getRoot, SKIP_DOM_SELECTION_TAG, type LexicalEditor } from 'lexical'\nimport { nextTick, watchEffect, type ComputedRef } from 'vue'\n\nimport type { ExpressionEditorEmits, ExpressionEditorProps, VariableItem } from '../../../../types'\nimport { parseContent } from '../../parser'\n\ninterface CreateModelSyncOptions {\n editor: LexicalEditor\n props: ExpressionEditorProps\n emit: ExpressionEditorEmits\n variableMap: ComputedRef<Map<string, VariableItem>>\n}\n\nexport function createModelSync(options: CreateModelSyncOptions) {\n const { editor, props, emit, variableMap } = options\n\n let changeByUser = false\n let changeByModel = false\n let lastEmittedValue: string | null = null\n\n function syncFromModelValue() {\n changeByModel = true\n const { modelValue } = props\n if (!modelValue) return\n\n editor.update(\n () => {\n const root = $getRoot()\n root.clear()\n const paragraph = $createParagraphNode()\n const nodes = parseContent(modelValue, variableMap.value)\n paragraph.append(...nodes)\n root.append(paragraph)\n },\n { tag: SKIP_DOM_SELECTION_TAG }\n )\n\n nextTick(() => {\n changeByModel = false\n })\n }\n\n editor.registerTextContentListener((text) => {\n if (changeByModel) return\n\n emit('update:modelValue', text)\n lastEmittedValue = text\n changeByUser = true\n nextTick(() => {\n if (lastEmittedValue === props.modelValue) {\n changeByUser = false\n } else {\n setTimeout(() => {\n changeByUser = false\n }, 0)\n }\n })\n })\n\n watchEffect(() => {\n if (changeByUser) return\n const current = editor.getEditorState().read(() => $getRoot().getTextContent())\n if (props.modelValue === current) return\n syncFromModelValue()\n })\n\n return { syncFromModelValue }\n}\n"],"mappings":";;;;AAaA,SAAgB,gBAAgB,SAAiC;CAC/D,MAAM,EAAE,QAAQ,OAAO,MAAM,gBAAgB;CAE7C,IAAI,eAAe;CACnB,IAAI,gBAAgB;CACpB,IAAI,mBAAkC;CAEtC,SAAS,qBAAqB;AAC5B,kBAAgB;EAChB,MAAM,EAAE,eAAe;AACvB,MAAI,CAAC,WAAY;AAEjB,SAAO,aACC;GACJ,MAAM,OAAO,UAAU;AACvB,QAAK,OAAO;GACZ,MAAM,YAAY,sBAAsB;GACxC,MAAM,QAAQ,aAAa,YAAY,YAAY,MAAM;AACzD,aAAU,OAAO,GAAG,MAAM;AAC1B,QAAK,OAAO,UAAU;KAExB,EAAE,KAAK,wBAAwB,CAChC;AAED,iBAAe;AACb,mBAAgB;IAChB;;AAGJ,QAAO,6BAA6B,SAAS;AAC3C,MAAI,cAAe;AAEnB,OAAK,qBAAqB,KAAK;AAC/B,qBAAmB;AACnB,iBAAe;AACf,iBAAe;AACb,OAAI,qBAAqB,MAAM,WAC7B,gBAAe;OAEf,kBAAiB;AACf,mBAAe;MACd,EAAE;IAEP;GACF;AAEF,mBAAkB;AAChB,MAAI,aAAc;EAClB,MAAM,UAAU,OAAO,gBAAgB,CAAC,WAAW,UAAU,CAAC,gBAAgB,CAAC;AAC/E,MAAI,MAAM,eAAe,QAAS;AAClC,sBAAoB;GACpB;AAEF,QAAO,EAAE,oBAAoB"}
|