@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<u-table
|
|
3
3
|
v-bind="tableProps"
|
|
4
4
|
:slots="slots"
|
|
5
|
-
:class="cls.e('table')"
|
|
5
|
+
:class="[cls.e('table'), bem.is('editing', state.visible)]"
|
|
6
6
|
:columns="columns"
|
|
7
7
|
highlight-current
|
|
8
8
|
:current-row="state.row"
|
|
@@ -12,40 +12,40 @@
|
|
|
12
12
|
ref="tableRef"
|
|
13
13
|
>
|
|
14
14
|
<template #column:__action__="{ row }">
|
|
15
|
-
<u-action-group
|
|
16
|
-
<template v-if="staticFeatures.has('create') || dynamicFeatures.create?.(row)">
|
|
17
|
-
<u-action
|
|
18
|
-
@run="handleInsertToPrev(row)"
|
|
19
|
-
:icon="InsertToPrev"
|
|
20
|
-
title="插入到上一行"
|
|
21
|
-
v-bind="props.actionsProps?.create"
|
|
22
|
-
/>
|
|
23
|
-
<u-action
|
|
24
|
-
@run="handleInsertToNext(row)"
|
|
25
|
-
:icon="InsertToNext"
|
|
26
|
-
title="插入到下一行"
|
|
27
|
-
v-bind="props.actionsProps?.create"
|
|
28
|
-
/>
|
|
29
|
-
</template>
|
|
30
|
-
|
|
15
|
+
<u-action-group :class="cls.e('row-actions')" hover circle :max="3" @click.stop>
|
|
31
16
|
<u-action
|
|
32
|
-
v-if="
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
@run="
|
|
36
|
-
|
|
37
|
-
title="添加子项"
|
|
38
|
-
v-bind="props.actionsProps?.createChild"
|
|
17
|
+
v-if="canEdit(row)"
|
|
18
|
+
:icon="props.readonly ? View : EditPen"
|
|
19
|
+
:title="props.readonly ? '查看' : '编辑'"
|
|
20
|
+
@run="handleEdit(row)"
|
|
21
|
+
v-bind="props.actionsProps?.update"
|
|
39
22
|
/>
|
|
40
23
|
|
|
41
24
|
<u-action
|
|
42
|
-
v-if="
|
|
25
|
+
v-if="canDelete(row)"
|
|
43
26
|
:icon="Delete"
|
|
44
27
|
type="danger"
|
|
45
28
|
title="删除"
|
|
46
29
|
@run="handleDelete(row)"
|
|
47
30
|
v-bind="props.actionsProps?.delete"
|
|
48
31
|
/>
|
|
32
|
+
|
|
33
|
+
<u-action v-if="allowed('create', row)" in-dropdown @run="handleInsertToPrev(row)">
|
|
34
|
+
在上方插入
|
|
35
|
+
</u-action>
|
|
36
|
+
<u-action v-if="allowed('create', row)" in-dropdown @run="handleInsertToNext(row)">
|
|
37
|
+
在下方插入
|
|
38
|
+
</u-action>
|
|
39
|
+
<u-action
|
|
40
|
+
v-if="!!props.tree && allowed('createChild', row)"
|
|
41
|
+
in-dropdown
|
|
42
|
+
@run="handleInsertChild(row)"
|
|
43
|
+
>
|
|
44
|
+
添加子级
|
|
45
|
+
</u-action>
|
|
46
|
+
<u-action v-if="allowed('copy', row)" in-dropdown @run="handleCopy(row)">
|
|
47
|
+
复制此行
|
|
48
|
+
</u-action>
|
|
49
49
|
</u-action-group>
|
|
50
50
|
</template>
|
|
51
51
|
|
|
@@ -60,16 +60,17 @@
|
|
|
60
60
|
"
|
|
61
61
|
>
|
|
62
62
|
<div :class="cls.e('add')">
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
:class="[cls.e('add-btn'), bem.is('loading', state.loading)]"
|
|
66
|
+
:disabled="state.loading"
|
|
66
67
|
@click.stop="handleCreate"
|
|
67
|
-
:loading="state.loading"
|
|
68
|
-
text
|
|
69
|
-
v-bind="props.actionsProps?.create"
|
|
70
68
|
>
|
|
71
|
-
<
|
|
72
|
-
|
|
69
|
+
<u-icon :class="cls.e('add-icon')">
|
|
70
|
+
<Plus />
|
|
71
|
+
</u-icon>
|
|
72
|
+
<span :class="cls.e('add-label')">新增一行</span>
|
|
73
|
+
</button>
|
|
73
74
|
</div>
|
|
74
75
|
</template>
|
|
75
76
|
</u-table>
|
|
@@ -77,12 +78,13 @@
|
|
|
77
78
|
|
|
78
79
|
<script setup lang="ts">
|
|
79
80
|
import { o } from '@cat-kit/core'
|
|
80
|
-
import {
|
|
81
|
+
import { Delete, EditPen, Plus, View } from '@veltra/icons/normal'
|
|
82
|
+
import { bem } from '@veltra/utils'
|
|
81
83
|
import { computed, inject, type Slots } from 'vue'
|
|
82
84
|
|
|
83
85
|
import type { BatchEditFeature, TableRow } from '../../types'
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
+
import { UAction, UActionGroup } from '../action'
|
|
87
|
+
import { UIcon } from '../icon'
|
|
86
88
|
import { UTable } from '../table'
|
|
87
89
|
import { BatchEditDIKey } from './di'
|
|
88
90
|
|
|
@@ -103,6 +105,8 @@ const {
|
|
|
103
105
|
staticFeatures,
|
|
104
106
|
dynamicFeatures,
|
|
105
107
|
handleCreate,
|
|
108
|
+
handleEdit,
|
|
109
|
+
handleCopy,
|
|
106
110
|
handleDelete,
|
|
107
111
|
handleInsertToNext,
|
|
108
112
|
handleInsertToPrev,
|
|
@@ -123,23 +127,36 @@ const tableProps = computed(() => {
|
|
|
123
127
|
|
|
124
128
|
const hasNot = (value: BatchEditFeature[]) => value.every((v) => !staticFeatures.value.has(v))
|
|
125
129
|
|
|
130
|
+
const allowed = (feature: BatchEditFeature, row?: TableRow) => {
|
|
131
|
+
return staticFeatures.value.has(feature) || !!dynamicFeatures.value[feature]?.(row)
|
|
132
|
+
}
|
|
133
|
+
|
|
126
134
|
const columns = computed(() => {
|
|
127
|
-
if (props.readonly || hasNot(['create', 'delete', 'createChild']))
|
|
135
|
+
if (props.readonly || hasNot(['create', 'delete', 'createChild', 'update', 'copy']))
|
|
136
|
+
return props.columns
|
|
128
137
|
|
|
129
138
|
return (props.columns ?? []).concat({
|
|
130
139
|
name: '操作',
|
|
131
140
|
key: '__action__',
|
|
132
141
|
align: 'center',
|
|
133
|
-
width:
|
|
142
|
+
width: 132,
|
|
134
143
|
fixed: 'right',
|
|
135
144
|
resizable: false
|
|
136
145
|
})
|
|
137
146
|
})
|
|
138
147
|
|
|
139
148
|
function handleUpdateCurrentRow(row?: TableRow) {
|
|
140
|
-
if (
|
|
149
|
+
if (allowed('update', row)) {
|
|
141
150
|
state.row = row
|
|
142
151
|
state.depth = row?.depth
|
|
143
152
|
}
|
|
144
153
|
}
|
|
154
|
+
|
|
155
|
+
function canEdit(row: TableRow) {
|
|
156
|
+
return !props.readonly ? allowed('update', row) : true
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function canDelete(row: TableRow) {
|
|
160
|
+
return !props.readonly && allowed('delete', row)
|
|
161
|
+
}
|
|
145
162
|
</script>
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<u-layout
|
|
2
|
+
<u-layout
|
|
3
|
+
:class="cls.b"
|
|
4
|
+
:cols="cols"
|
|
5
|
+
rows="100%"
|
|
6
|
+
gap="8px"
|
|
7
|
+
resizable
|
|
8
|
+
@keydown="handleKeydown"
|
|
9
|
+
tabindex="-1"
|
|
10
|
+
>
|
|
3
11
|
<!-- 编辑列表 -->
|
|
4
12
|
<BatchEditList :slots="slots" />
|
|
5
13
|
|
|
@@ -34,7 +42,7 @@ import { useEdit } from './use-edit'
|
|
|
34
42
|
defineOptions({ name: 'BatchEdit' })
|
|
35
43
|
|
|
36
44
|
const props = withDefaults(defineProps<BatchEditProps<Model>>(), {
|
|
37
|
-
cols: () => ['1fr', '
|
|
45
|
+
cols: () => ['1fr', '420px'],
|
|
38
46
|
mode: 'normal'
|
|
39
47
|
})
|
|
40
48
|
|
|
@@ -53,10 +61,13 @@ const staticFeatures = computed(() => {
|
|
|
53
61
|
return defaultFeatures
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
//
|
|
64
|
+
// 函数与 false 的特性视为关闭;显式 true 视为开启(即便不在默认集合内)
|
|
57
65
|
Object.entries(features).forEach(([key, value]) => {
|
|
66
|
+
const k = key as BatchEditFeature
|
|
58
67
|
if (typeof value === 'function' || value === false) {
|
|
59
|
-
defaultFeatures.delete(
|
|
68
|
+
defaultFeatures.delete(k)
|
|
69
|
+
} else if (value === true) {
|
|
70
|
+
defaultFeatures.add(k)
|
|
60
71
|
}
|
|
61
72
|
})
|
|
62
73
|
return defaultFeatures
|
|
@@ -113,7 +124,7 @@ const tableRef = shallowRef<TableExposed>()
|
|
|
113
124
|
|
|
114
125
|
const editCtx = useEdit({ props, emit, tableRef })
|
|
115
126
|
|
|
116
|
-
const { state, handleClose } = editCtx
|
|
127
|
+
const { state, handleClose, handleSave, handleDelete, handleCreate } = editCtx
|
|
117
128
|
|
|
118
129
|
provide(BatchEditDIKey, {
|
|
119
130
|
cls,
|
|
@@ -127,7 +138,6 @@ provide(BatchEditDIKey, {
|
|
|
127
138
|
|
|
128
139
|
const dialogCtx = inject(DialogDIKey, undefined)
|
|
129
140
|
|
|
130
|
-
// 如果在dialog上下文中
|
|
131
141
|
dialogCtx &&
|
|
132
142
|
watch(dialogCtx.visible, (visible) => {
|
|
133
143
|
!visible && editCtx.handleClose()
|
|
@@ -136,4 +146,45 @@ dialogCtx &&
|
|
|
136
146
|
const cols = computed(() => {
|
|
137
147
|
return !!state.row || state.visible ? props.cols : undefined
|
|
138
148
|
})
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 键盘快捷键:
|
|
152
|
+
* - Esc 关闭表单
|
|
153
|
+
* - ⌘/Ctrl + S 保存
|
|
154
|
+
* - ⌘/Ctrl + Backspace 删除当前编辑行
|
|
155
|
+
* - ⌘/Ctrl + N 新增(仅在不在表单中时)
|
|
156
|
+
*/
|
|
157
|
+
function handleKeydown(e: KeyboardEvent) {
|
|
158
|
+
if (props.readonly && e.key !== 'Escape') return
|
|
159
|
+
|
|
160
|
+
if (e.key === 'Escape') {
|
|
161
|
+
if (state.visible) {
|
|
162
|
+
e.preventDefault()
|
|
163
|
+
handleClose()
|
|
164
|
+
}
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const meta = e.metaKey || e.ctrlKey
|
|
169
|
+
if (!meta) return
|
|
170
|
+
|
|
171
|
+
const key = e.key.toLowerCase()
|
|
172
|
+
|
|
173
|
+
if (key === 's' && state.visible) {
|
|
174
|
+
e.preventDefault()
|
|
175
|
+
handleSave()
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (e.key === 'Backspace' && state.row && state.type === 'update') {
|
|
180
|
+
e.preventDefault()
|
|
181
|
+
handleDelete(state.row)
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (key === 'n' && !state.visible) {
|
|
186
|
+
e.preventDefault()
|
|
187
|
+
handleCreate()
|
|
188
|
+
}
|
|
189
|
+
}
|
|
139
190
|
</script>
|
|
@@ -2,67 +2,281 @@
|
|
|
2
2
|
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
3
|
@use 'pkg:@veltra/styles/vars';
|
|
4
4
|
|
|
5
|
-
@keyframes blink {
|
|
6
|
-
0% {
|
|
7
|
-
opacity: 0.3;
|
|
8
|
-
}
|
|
9
|
-
100% {
|
|
10
|
-
opacity: 1;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
5
|
$root-name: batch-edit;
|
|
15
6
|
|
|
16
7
|
@include m.b($root-name) {
|
|
17
|
-
|
|
8
|
+
position: relative;
|
|
18
9
|
overflow: hidden;
|
|
19
|
-
|
|
20
10
|
border-radius: fn.use-var(radius, default);
|
|
21
11
|
|
|
22
|
-
|
|
12
|
+
// ---------- 表格容器 ----------
|
|
13
|
+
@include m.e(table) {
|
|
23
14
|
flex-grow: 1;
|
|
24
15
|
}
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
// ---------- 行内悬浮动作条(操作列) ----------
|
|
18
|
+
// 操作组使用 `u-action-group` 的 hover 模式
|
|
19
|
+
// 这里在父级表格行 hover / 当前激活时强制显现整组
|
|
20
|
+
.u-table__row:hover .#{vars.$namespace}action-group.is-hover,
|
|
21
|
+
.u-table__row.is-current .#{vars.$namespace}action-group.is-hover {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
background-color: color-mix(in srgb, #{fn.use-var(bg-color, top)} 70%, transparent);
|
|
24
|
+
backdrop-filter: blur(8px);
|
|
25
|
+
-webkit-backdrop-filter: blur(8px);
|
|
26
|
+
box-shadow: 0 1px 4px color-mix(in srgb, #{fn.use-var(shadow, color)} 35%, transparent);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ---------- 底部"新增一行"按钮 ----------
|
|
30
|
+
// 按钮通过水平方向 sticky 始终贴住滚动视口左侧,
|
|
31
|
+
// 避免列很长横向滚动时按钮内容被滚出视口外
|
|
32
|
+
@include m.e(add) {
|
|
33
|
+
position: sticky;
|
|
34
|
+
left: 0;
|
|
35
|
+
bottom: 0;
|
|
36
|
+
z-index: 1;
|
|
37
|
+
padding: 8px 12px;
|
|
38
|
+
background-color: fn.use-var(bg-color, top);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include m.e(add-btn) {
|
|
42
|
+
--add-color: #{fn.use-var(color, primary)};
|
|
43
|
+
--add-border: #{color-mix(in srgb, fn.use-var(color, primary) 60%, transparent)};
|
|
44
|
+
--add-bg: #{color-mix(in srgb, fn.use-var(color, primary) 5%, transparent)};
|
|
45
|
+
|
|
46
|
+
position: sticky;
|
|
47
|
+
left: 12px;
|
|
48
|
+
height: 36px;
|
|
49
|
+
min-width: 220px;
|
|
50
|
+
max-width: 320px;
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
gap: 6px;
|
|
55
|
+
padding: 0 20px;
|
|
56
|
+
background: var(--add-bg);
|
|
57
|
+
border: 1px dashed var(--add-border);
|
|
58
|
+
border-radius: fn.use-var(radius, default);
|
|
59
|
+
color: var(--add-color);
|
|
60
|
+
font-size: fn.use-var(font-size-main, default);
|
|
61
|
+
font-weight: 500;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
transition:
|
|
64
|
+
border-color 0.18s ease,
|
|
65
|
+
color 0.18s ease,
|
|
66
|
+
background-color 0.18s ease,
|
|
67
|
+
transform 0.18s ease;
|
|
68
|
+
font-family: inherit;
|
|
69
|
+
|
|
70
|
+
&:hover:not(:disabled) {
|
|
71
|
+
--add-border: #{fn.use-var(color, primary)};
|
|
72
|
+
--add-bg: #{fn.use-var(color, primary, light-9)};
|
|
73
|
+
border-style: solid;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:active:not(:disabled) {
|
|
77
|
+
transform: translateY(1px);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:disabled {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
opacity: 0.55;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@include m.is(loading) {
|
|
86
|
+
pointer-events: none;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@include m.e(add-icon) {
|
|
91
|
+
font-size: 16px;
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
transition: transform 0.18s ease;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.#{vars.$namespace}#{$root-name}__add-btn:hover .#{vars.$namespace}#{$root-name}__add-icon {
|
|
97
|
+
transform: rotate(90deg);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@include m.e(add-label) {
|
|
101
|
+
line-height: 1;
|
|
29
102
|
}
|
|
30
103
|
|
|
104
|
+
// ---------- 右侧表单侧栏 ----------
|
|
31
105
|
@include m.e(form) {
|
|
106
|
+
--u-batch-edit-form-radius: #{fn.use-var(radius, large)};
|
|
107
|
+
--u-batch-edit-form-padding: 16px;
|
|
108
|
+
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
32
111
|
background-color: fn.use-var(bg-color, top);
|
|
112
|
+
border-radius: var(--u-batch-edit-form-radius);
|
|
113
|
+
box-shadow:
|
|
114
|
+
0 1px 2px color-mix(in srgb, #{fn.use-var(shadow, color)} 40%, transparent),
|
|
115
|
+
0 12px 32px -16px color-mix(in srgb, #{fn.use-var(shadow, color)} 50%, transparent);
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
isolation: isolate;
|
|
118
|
+
min-height: 0;
|
|
33
119
|
|
|
34
|
-
|
|
35
|
-
|
|
120
|
+
// 顶部装饰渐变条
|
|
121
|
+
&::before {
|
|
122
|
+
content: '';
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: 0;
|
|
125
|
+
left: 0;
|
|
126
|
+
right: 0;
|
|
127
|
+
height: 3px;
|
|
128
|
+
background: linear-gradient(
|
|
129
|
+
90deg,
|
|
130
|
+
fn.use-var(color, primary) 0%,
|
|
131
|
+
color-mix(in srgb, #{fn.use-var(color, primary)} 50%, transparent) 100%
|
|
132
|
+
);
|
|
133
|
+
opacity: 0.7;
|
|
134
|
+
z-index: 1;
|
|
36
135
|
}
|
|
37
136
|
}
|
|
38
137
|
|
|
39
|
-
@include m.e(
|
|
40
|
-
|
|
138
|
+
@include m.e(form-header) {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: 10px;
|
|
142
|
+
padding: 8px 14px;
|
|
143
|
+
border-bottom: 1px solid fn.use-var(border-color);
|
|
144
|
+
flex-shrink: 0;
|
|
41
145
|
}
|
|
42
146
|
|
|
43
|
-
@include m.e(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
147
|
+
@include m.e(form-icon) {
|
|
148
|
+
--tone-color: #{fn.use-var(color, primary)};
|
|
149
|
+
--tone-bg: #{fn.use-var(color, primary, light-9)};
|
|
150
|
+
|
|
151
|
+
width: 30px;
|
|
152
|
+
height: 30px;
|
|
153
|
+
border-radius: fn.use-var(radius, default);
|
|
154
|
+
display: inline-flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
flex-shrink: 0;
|
|
158
|
+
color: var(--tone-color);
|
|
159
|
+
background-color: var(--tone-bg);
|
|
160
|
+
font-size: 16px;
|
|
161
|
+
transition:
|
|
162
|
+
color 0.2s ease,
|
|
163
|
+
background-color 0.2s ease;
|
|
164
|
+
|
|
165
|
+
@include m.is(create) {
|
|
166
|
+
--tone-color: #{fn.use-var(color, success)};
|
|
167
|
+
--tone-bg: #{fn.use-var(color, success, light-9)};
|
|
168
|
+
}
|
|
169
|
+
@include m.is(child) {
|
|
170
|
+
--tone-color: #{fn.use-var(color, warning)};
|
|
171
|
+
--tone-bg: #{fn.use-var(color, warning, light-9)};
|
|
172
|
+
}
|
|
173
|
+
@include m.is(view) {
|
|
174
|
+
--tone-color: #{fn.use-var(text-color, second)};
|
|
175
|
+
--tone-bg: #{fn.use-var(bg-color, hover)};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@include m.e(form-title) {
|
|
180
|
+
flex: 1 1 auto;
|
|
181
|
+
min-width: 0;
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
gap: 2px;
|
|
185
|
+
|
|
186
|
+
&-text {
|
|
187
|
+
margin: 0;
|
|
188
|
+
font-size: fn.use-var(font-size-title, default);
|
|
189
|
+
font-weight: 600;
|
|
190
|
+
color: fn.use-var(text-color, title);
|
|
191
|
+
line-height: 1.25;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@include m.e(form-chip) {
|
|
196
|
+
display: inline-block;
|
|
197
|
+
align-self: flex-start;
|
|
198
|
+
padding: 1px 8px;
|
|
199
|
+
font-size: 12px;
|
|
200
|
+
line-height: 18px;
|
|
201
|
+
border-radius: 999px;
|
|
202
|
+
background-color: fn.use-var(bg-color, hover);
|
|
203
|
+
color: fn.use-var(text-color, second);
|
|
204
|
+
white-space: nowrap;
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
text-overflow: ellipsis;
|
|
207
|
+
max-width: 100%;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@include m.e(form-close) {
|
|
211
|
+
flex-shrink: 0;
|
|
212
|
+
align-self: flex-start;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@include m.e(form-body) {
|
|
216
|
+
flex: 1 1 auto;
|
|
217
|
+
min-height: 0;
|
|
218
|
+
|
|
219
|
+
// 仅限定 batch-edit 内的 u-form 表单滚动区内边距
|
|
220
|
+
.#{vars.$namespace}form__body {
|
|
221
|
+
padding: 10px var(--u-batch-edit-form-padding) 4px;
|
|
56
222
|
}
|
|
57
223
|
}
|
|
58
224
|
|
|
59
|
-
@include m.e(
|
|
60
|
-
|
|
225
|
+
@include m.e(form-footer) {
|
|
226
|
+
display: flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
justify-content: space-between;
|
|
229
|
+
gap: 12px;
|
|
230
|
+
padding: 6px 12px;
|
|
231
|
+
border-top: 1px solid fn.use-var(border-color);
|
|
232
|
+
background-color: fn.use-var(bg-color, top);
|
|
233
|
+
flex-shrink: 0;
|
|
61
234
|
}
|
|
62
235
|
|
|
63
|
-
@include m.
|
|
64
|
-
|
|
65
|
-
|
|
236
|
+
@include m.e(form-hint) {
|
|
237
|
+
font-size: 12px;
|
|
238
|
+
color: fn.use-var(text-color, placeholder);
|
|
239
|
+
flex: 1 1 auto;
|
|
240
|
+
min-width: 0;
|
|
241
|
+
overflow: hidden;
|
|
242
|
+
text-overflow: ellipsis;
|
|
243
|
+
white-space: nowrap;
|
|
244
|
+
|
|
245
|
+
& > kbd {
|
|
246
|
+
display: inline-block;
|
|
247
|
+
min-width: 18px;
|
|
248
|
+
padding: 1px 5px;
|
|
249
|
+
margin: 0 1px;
|
|
250
|
+
font-size: 11px;
|
|
251
|
+
font-family:
|
|
252
|
+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
|
253
|
+
monospace;
|
|
254
|
+
color: fn.use-var(text-color, second);
|
|
255
|
+
background-color: fn.use-var(bg-color, hover);
|
|
256
|
+
border: 1px solid fn.use-var(border-color);
|
|
257
|
+
border-radius: 4px;
|
|
258
|
+
line-height: 1;
|
|
259
|
+
vertical-align: 1px;
|
|
66
260
|
}
|
|
67
261
|
}
|
|
262
|
+
|
|
263
|
+
@include m.e(form-actions) {
|
|
264
|
+
display: flex;
|
|
265
|
+
gap: 8px;
|
|
266
|
+
flex-shrink: 0;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// 表单面板进出过渡:从右侧滑入并轻微缩放
|
|
271
|
+
.batch-edit-panel-enter-active,
|
|
272
|
+
.batch-edit-panel-leave-active {
|
|
273
|
+
transition:
|
|
274
|
+
transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
|
|
275
|
+
opacity 0.24s ease;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.batch-edit-panel-enter-from,
|
|
279
|
+
.batch-edit-panel-leave-to {
|
|
280
|
+
transform: translateX(16px) scale(0.985);
|
|
281
|
+
opacity: 0;
|
|
68
282
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import '../
|
|
1
|
+
import '../action/style'
|
|
2
|
+
import '../button/style'
|
|
2
3
|
import '../form/style'
|
|
3
|
-
import '../
|
|
4
|
+
import '../icon/style'
|
|
5
|
+
import '../layout/style'
|
|
4
6
|
import '../scroll/style'
|
|
5
|
-
import '../
|
|
6
|
-
import '../checkbox/style'
|
|
7
|
-
import '../tip/style'
|
|
8
|
-
import '../button/style'
|
|
9
|
-
import '../action/style'
|
|
7
|
+
import '../table/style'
|
|
10
8
|
import '@veltra/directives/ripple/style.js'
|
|
11
9
|
import '@veltra/styles/anime/fade.scss'
|
|
12
10
|
import './style.scss'
|
|
13
|
-
// import './style-new.scss'
|