@veltra/desktop 1.2.30 → 1.2.32
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.vue.d.ts +1 -1
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
- package/dist/components/batch-edit/batch-edit-form.js +3 -1
- package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
- package/dist/components/batch-edit/batch-edit.js +4 -0
- package/dist/components/batch-edit/batch-edit.js.map +1 -1
- package/dist/components/batch-edit/batch-edit.vue.d.ts +10 -2
- package/dist/components/batch-edit/use-handlers.js +9 -1
- package/dist/components/batch-edit/use-handlers.js.map +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +3 -3
- 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/lang-loaders.js +3 -1
- package/dist/components/code-editor/lang-loaders.js.map +1 -1
- package/dist/components/code-editor/langs/bash/index.js +11 -0
- package/dist/components/code-editor/langs/bash/index.js.map +1 -0
- package/dist/components/code-editor/langs/powershell/index.js +11 -0
- package/dist/components/code-editor/langs/powershell/index.js.map +1 -0
- 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/empty/empty.vue.d.ts +1 -1
- package/dist/components/input/input.vue.d.ts +6 -6
- package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +3 -3
- 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/progress-nodes/progress-nodes.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.vue.d.ts +1 -1
- package/dist/components/select/select.vue.d.ts +2 -2
- package/dist/components/steps/steps.vue.d.ts +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
- package/dist/components/tabs/tabs.vue.d.ts +2 -2
- package/dist/components/textarea/textarea.vue.d.ts +2 -2
- package/dist/components/tip/tip.vue.d.ts +1 -1
- package/dist/components/tree/tree.vue.d.ts +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +3 -3
- package/dist/node_modules/.bun/@codemirror_legacy-modes@6.5.3/node_modules/@codemirror/legacy-modes/mode/powershell.js +303 -0
- package/dist/node_modules/.bun/@codemirror_legacy-modes@6.5.3/node_modules/@codemirror/legacy-modes/mode/powershell.js.map +1 -0
- package/dist/node_modules/.bun/@codemirror_legacy-modes@6.5.3/node_modules/@codemirror/legacy-modes/mode/shell.js +225 -0
- package/dist/node_modules/.bun/@codemirror_legacy-modes@6.5.3/node_modules/@codemirror/legacy-modes/mode/shell.js.map +1 -0
- package/dist/types/batch-edit.d.ts +16 -2
- package/dist/types/code-editor.d.ts +1 -1
- package/package.json +7 -6
- package/src/components/batch-edit/batch-edit-form.vue +5 -1
- package/src/components/batch-edit/use-handlers.ts +10 -1
- package/src/components/code-editor/lang-loaders.ts +3 -1
- package/src/components/code-editor/langs/bash/index.ts +7 -0
- package/src/components/code-editor/langs/powershell/index.ts +7 -0
- package/src/types/batch-edit.ts +17 -1
- package/src/types/code-editor.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","names":[],"sources":["../../../../../../../../../../node_modules/.bun/@codemirror+legacy-modes@6.5.3/node_modules/@codemirror/legacy-modes/mode/shell.js"],"sourcesContent":["var words = {};\nfunction define(style, dict) {\n for(var i = 0; i < dict.length; i++) {\n words[dict[i]] = style;\n }\n};\n\nvar commonAtoms = [\"true\", \"false\"];\nvar commonKeywords = [\"if\", \"then\", \"do\", \"else\", \"elif\", \"while\", \"until\", \"for\", \"in\", \"esac\", \"fi\",\n \"fin\", \"fil\", \"done\", \"exit\", \"set\", \"unset\", \"export\", \"function\"];\nvar commonCommands = [\"ab\", \"awk\", \"bash\", \"beep\", \"cat\", \"cc\", \"cd\", \"chown\", \"chmod\", \"chroot\", \"clear\",\n \"cp\", \"curl\", \"cut\", \"diff\", \"echo\", \"find\", \"gawk\", \"gcc\", \"get\", \"git\", \"grep\", \"hg\", \"kill\", \"killall\",\n \"ln\", \"ls\", \"make\", \"mkdir\", \"openssl\", \"mv\", \"nc\", \"nl\", \"node\", \"npm\", \"ping\", \"ps\", \"restart\", \"rm\",\n \"rmdir\", \"sed\", \"service\", \"sh\", \"shopt\", \"shred\", \"source\", \"sort\", \"sleep\", \"ssh\", \"start\", \"stop\",\n \"su\", \"sudo\", \"svn\", \"tee\", \"telnet\", \"top\", \"touch\", \"vi\", \"vim\", \"wall\", \"wc\", \"wget\", \"who\", \"write\",\n \"yes\", \"zsh\"];\n\ndefine('atom', commonAtoms);\ndefine('keyword', commonKeywords);\ndefine('builtin', commonCommands);\n\nfunction tokenBase(stream, state) {\n if (stream.eatSpace()) return null;\n\n var sol = stream.sol();\n var ch = stream.next();\n\n if (ch === '\\\\') {\n stream.next();\n return null;\n }\n if (ch === '\\'' || ch === '\"' || ch === '`') {\n state.tokens.unshift(tokenString(ch, ch === \"`\" ? \"quote\" : \"string\"));\n return tokenize(stream, state);\n }\n if (ch === '#') {\n if (sol && stream.eat('!')) {\n stream.skipToEnd();\n return 'meta'; // 'comment'?\n }\n stream.skipToEnd();\n return 'comment';\n }\n if (ch === '$') {\n state.tokens.unshift(tokenDollar);\n return tokenize(stream, state);\n }\n if (ch === '+' || ch === '=') {\n return 'operator';\n }\n if (ch === '-') {\n stream.eat('-');\n stream.eatWhile(/\\w/);\n return 'attribute';\n }\n if (ch == \"<\") {\n if (stream.match(\"<<\")) return \"operator\"\n var heredoc = stream.match(/^<-?\\s*(?:['\"]([^'\"]*)['\"]|([^'\"\\s]*))/)\n if (heredoc) {\n state.tokens.unshift(tokenHeredoc(heredoc[1] || heredoc[2]))\n return 'string.special'\n }\n }\n if (/\\d/.test(ch)) {\n stream.eatWhile(/\\d/);\n if(stream.eol() || !/\\w/.test(stream.peek())) {\n return 'number';\n }\n }\n stream.eatWhile(/[\\w-]/);\n var cur = stream.current();\n if (stream.peek() === '=' && /\\w+/.test(cur)) return 'def';\n return words.hasOwnProperty(cur) ? words[cur] : null;\n}\n\nfunction tokenString(quote, style) {\n var close = quote == \"(\" ? \")\" : quote == \"{\" ? \"}\" : quote\n return function(stream, state) {\n var next, escaped = false;\n while ((next = stream.next()) != null) {\n if (next === close && !escaped) {\n state.tokens.shift();\n break;\n } else if (next === '$' && !escaped && quote !== \"'\" && stream.peek() != close) {\n escaped = true;\n stream.backUp(1);\n state.tokens.unshift(tokenDollar);\n break;\n } else if (!escaped && quote !== close && next === quote) {\n state.tokens.unshift(tokenString(quote, style))\n return tokenize(stream, state)\n } else if (!escaped && /['\"]/.test(next) && !/['\"]/.test(quote)) {\n state.tokens.unshift(tokenStringStart(next, \"string\"));\n stream.backUp(1);\n break;\n }\n escaped = !escaped && next === '\\\\';\n }\n return style;\n };\n};\n\nfunction tokenStringStart(quote, style) {\n return function(stream, state) {\n state.tokens[0] = tokenString(quote, style)\n stream.next()\n return tokenize(stream, state)\n }\n}\n\nvar tokenDollar = function(stream, state) {\n if (state.tokens.length > 1) stream.eat('$');\n var ch = stream.next()\n if (/['\"({]/.test(ch)) {\n state.tokens[0] = tokenString(ch, ch == \"(\" ? \"quote\" : ch == \"{\" ? \"def\" : \"string\");\n return tokenize(stream, state);\n }\n if (!/\\d/.test(ch)) stream.eatWhile(/\\w/);\n state.tokens.shift();\n return 'def';\n};\n\nfunction tokenHeredoc(delim) {\n return function(stream, state) {\n if (stream.sol() && stream.string == delim) state.tokens.shift()\n stream.skipToEnd()\n return \"string.special\"\n }\n}\n\nfunction tokenize(stream, state) {\n return (state.tokens[0] || tokenBase) (stream, state);\n};\n\nexport const shell = {\n name: \"shell\",\n startState: function() {return {tokens:[]};},\n token: function(stream, state) {\n return tokenize(stream, state);\n },\n languageData: {\n autocomplete: commonAtoms.concat(commonKeywords, commonCommands),\n closeBrackets: {brackets: [\"(\", \"[\", \"{\", \"'\", '\"', \"`\"]},\n commentTokens: {line: \"#\"}\n }\n};\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAI,QAAQ,CAAC;AACb,SAAS,OAAO,OAAO,MAAM;CAC3B,KAAI,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAC9B,MAAM,KAAK,MAAM;AAErB;AAEA,IAAI,cAAc,CAAC,QAAQ,OAAO;AAClC,IAAI,iBAAiB;CAAC;CAAM;CAAQ;CAAM;CAAQ;CAAQ;CAAS;CAAS;CAAO;CAAM;CAAQ;CAC3E;CAAO;CAAO;CAAQ;CAAQ;CAAO;CAAS;CAAU;AAAU;AACxF,IAAI,iBAAiB;CAAC;CAAM;CAAO;CAAQ;CAAQ;CAAO;CAAM;CAAM;CAAS;CAAS;CAAU;CAC5E;CAAM;CAAQ;CAAO;CAAQ;CAAQ;CAAQ;CAAQ;CAAO;CAAO;CAAO;CAAQ;CAAM;CAAQ;CAChG;CAAM;CAAM;CAAQ;CAAS;CAAW;CAAM;CAAM;CAAM;CAAQ;CAAO;CAAQ;CAAM;CAAW;CAClG;CAAS;CAAO;CAAW;CAAM;CAAS;CAAS;CAAU;CAAQ;CAAS;CAAO;CAAS;CAC9F;CAAM;CAAQ;CAAO;CAAO;CAAU;CAAO;CAAS;CAAM;CAAO;CAAQ;CAAM;CAAQ;CAAO;CAChG;CAAO;AAAK;AAElC,OAAO,QAAQ,WAAW;AAC1B,OAAO,WAAW,cAAc;AAChC,OAAO,WAAW,cAAc;AAEhC,SAAS,UAAU,QAAQ,OAAO;CAChC,IAAI,OAAO,SAAS,G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OAAO;AACT;AAEA,SAAS,aAAa,OAAO;CAC3B,OAAO,SAAS,QAAQ,OAAO;EAC7B,IAAI,OAAO,IAAI,KAAK,OAAO,UAAU,OAAO,MAAM,OAAO,MAAM;EAC/D,OAAO,UAAU;EACjB,OAAO;CACT;AACF;AAEA,SAAS,SAAS,QAAQ,OAAO;CAC/B,QAAQ,MAAM,OAAO,MAAM,UAAA,CAAY,QAAQ,KAAK;AACtD;AAEA,MAAa,QAAQ;CACnB,MAAM;CACN,YAAY,WAAW;EAAC,OAAO,EAAC,QAAO,CAAC,EAAC;CAAE;CAC3C,OAAO,SAAS,QAAQ,OAAO;EAC7B,OAAO,SAAS,QAAQ,KAAK;CAC/B;CACA,cAAc;EACZ,cAAc,YAAY,OAAO,gBAAgB,cAAc;EAC/D,eAAe,EAAC,UAAU;GAAC;GAAK;GAAK;GAAK;GAAK;GAAK;EAAG,EAAC;EACxD,eAAe,EAAC,MAAM,IAAG;CAC3B;AACF"}
|
|
@@ -51,7 +51,11 @@ interface BatchEditProps extends TableProps {
|
|
|
51
51
|
beforeCreate?: (data: Record<string, any>, parentData?: Record<string, any>) => void | Promise<void>;
|
|
52
52
|
/** label的宽度 */
|
|
53
53
|
labelWidth?: string | number;
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* 删除方法
|
|
56
|
+
* @description 删除时调用。如果返回 false,则不删除
|
|
57
|
+
* @returns 如果返回 false,则不删除
|
|
58
|
+
*/
|
|
55
59
|
deleteMethod?: (data: Record<string, any>[]) => any;
|
|
56
60
|
/**
|
|
57
61
|
* 保存方法
|
|
@@ -98,11 +102,21 @@ interface BatchEditProps extends TableProps {
|
|
|
98
102
|
interface BatchEditEmits extends TableEmits {
|
|
99
103
|
/** 更新数据 */
|
|
100
104
|
(e: 'update:data', value: Record<string, any>[]): void;
|
|
105
|
+
/** 点击底部「新增一行」 */
|
|
106
|
+
(e: 'create'): void;
|
|
107
|
+
/** 点击「在上方插入」 */
|
|
108
|
+
(e: 'create-prev', row: TableRow): void;
|
|
109
|
+
/** 点击「在下方插入」 */
|
|
110
|
+
(e: 'create-next', row: TableRow): void;
|
|
111
|
+
/** 点击「添加子级」,参数为父级行 */
|
|
112
|
+
(e: 'create-child', row: TableRow): void;
|
|
101
113
|
}
|
|
102
114
|
type BatchEditSlots = {
|
|
103
115
|
form?: (props: {
|
|
104
116
|
/** 当前编辑的层级 */depth?: number; /** 当前编辑的行 */
|
|
105
|
-
row?: TableRow; /**
|
|
117
|
+
row?: TableRow; /** 新增时的父级行(createChild / 非根同级插入) */
|
|
118
|
+
parentRow?: TableRow; /** 当前表单操作类型 */
|
|
119
|
+
formActionType?: BatchEditStates['formActionType']; /** 当前编辑的行索引 */
|
|
106
120
|
index?: number; /** 操作的目标行索引路径 */
|
|
107
121
|
indexes?: number[];
|
|
108
122
|
}) => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeconstructValue, FormComponentProps } from "@veltra/utils";
|
|
2
2
|
|
|
3
3
|
//#region src/types/code-editor.d.ts
|
|
4
|
-
type CodeEditorLang = 'js' | 'sql' | 'java' | 'json' | 'spel';
|
|
4
|
+
type CodeEditorLang = 'js' | 'sql' | 'java' | 'json' | 'spel' | 'bash' | 'powershell';
|
|
5
5
|
/** 代码编辑器组件属性(不支持 `size`) */
|
|
6
6
|
interface CodeEditorProps extends Omit<FormComponentProps, 'size'> {
|
|
7
7
|
modelValue?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltra/desktop",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.32",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src"
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"@cat-kit/core": ">=1.1.8",
|
|
58
58
|
"@cat-kit/excel": ">=1.0.0",
|
|
59
59
|
"@cat-kit/fe": "^1.1.8",
|
|
60
|
-
"@veltra/compositions": "1.2.
|
|
61
|
-
"@veltra/directives": "1.2.
|
|
62
|
-
"@veltra/icons": "1.2.
|
|
63
|
-
"@veltra/styles": "1.2.
|
|
64
|
-
"@veltra/utils": "1.2.
|
|
60
|
+
"@veltra/compositions": "1.2.32",
|
|
61
|
+
"@veltra/directives": "1.2.32",
|
|
62
|
+
"@veltra/icons": "1.2.32",
|
|
63
|
+
"@veltra/styles": "1.2.32",
|
|
64
|
+
"@veltra/utils": "1.2.32",
|
|
65
65
|
"vue": ">=3.5.39"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"@codemirror/lang-json": "6.0.2",
|
|
73
73
|
"@codemirror/lang-sql": "6.10.0",
|
|
74
74
|
"@codemirror/language": "6.12.4",
|
|
75
|
+
"@codemirror/legacy-modes": "6.5.3",
|
|
75
76
|
"@codemirror/lint": "6.9.7",
|
|
76
77
|
"@codemirror/search": "6.7.1",
|
|
77
78
|
"@codemirror/state": "6.7.0",
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
<slot
|
|
33
33
|
v-bind="{
|
|
34
34
|
row: state.row,
|
|
35
|
+
parentRow: state.parentRow,
|
|
36
|
+
formActionType: state.formActionType,
|
|
35
37
|
depth: state.depth,
|
|
36
38
|
indexes: state.indexPath,
|
|
37
39
|
index: state.row?.index
|
|
@@ -114,7 +116,9 @@ const creatable = computed(() => {
|
|
|
114
116
|
|
|
115
117
|
const creatableChild = computed(() => {
|
|
116
118
|
if (state.formActionType !== 'createChild') return false
|
|
117
|
-
return
|
|
119
|
+
return (
|
|
120
|
+
staticFeatures.value.has('createChild') || dynamicFeatures.value.createChild?.(state.parentRow)
|
|
121
|
+
)
|
|
118
122
|
})
|
|
119
123
|
|
|
120
124
|
const updatable = computed(() => {
|
|
@@ -98,6 +98,7 @@ export function useHandlers(options: Options): EditReturned {
|
|
|
98
98
|
state.formVisible = true
|
|
99
99
|
state.depth = 1
|
|
100
100
|
state.indexPath = [data?.length ?? 0]
|
|
101
|
+
emit('create')
|
|
101
102
|
})
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -105,16 +106,20 @@ export function useHandlers(options: Options): EditReturned {
|
|
|
105
106
|
resetState()
|
|
106
107
|
state.formActionType = 'create'
|
|
107
108
|
state.formVisible = true
|
|
109
|
+
state.parentRow = row.parent
|
|
108
110
|
state.depth = row.depth
|
|
109
111
|
state.indexPath = [...row.indexes]
|
|
112
|
+
emit('create-prev', row)
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
function handleInsertToNext(row: TableRow) {
|
|
113
116
|
resetState()
|
|
114
117
|
state.formActionType = 'create'
|
|
115
118
|
state.formVisible = true
|
|
119
|
+
state.parentRow = row.parent
|
|
116
120
|
state.depth = row.depth
|
|
117
121
|
state.indexPath = [...row.indexes.slice(0, -1), row.index + 1]
|
|
122
|
+
emit('create-next', row)
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
function handleInsertChild(row: TableRow) {
|
|
@@ -125,6 +130,7 @@ export function useHandlers(options: Options): EditReturned {
|
|
|
125
130
|
state.depth = row.depth + 1
|
|
126
131
|
row.expanded = true
|
|
127
132
|
state.indexPath = [...row.indexes, row.children?.length ?? 0]
|
|
133
|
+
emit('create-child', row)
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
function runWithLoading<Arg extends any[]>(fn: (...args: Arg) => Promise<void> | void) {
|
|
@@ -190,7 +196,10 @@ export function useHandlers(options: Options): EditReturned {
|
|
|
190
196
|
const { deleteMethod } = props
|
|
191
197
|
|
|
192
198
|
if (deleteMethod) {
|
|
193
|
-
await deleteMethod([row.data])
|
|
199
|
+
const result = await deleteMethod([row.data])
|
|
200
|
+
if (result === false) {
|
|
201
|
+
return
|
|
202
|
+
}
|
|
194
203
|
}
|
|
195
204
|
|
|
196
205
|
const data = [...(props.data ?? [])]
|
|
@@ -8,7 +8,9 @@ const LANG_LOADERS: Record<CodeEditorLang, () => Promise<Extension>> = {
|
|
|
8
8
|
sql: () => import('@codemirror/lang-sql').then((m) => m.sql()),
|
|
9
9
|
java: () => import('@codemirror/lang-java').then((m) => m.java()),
|
|
10
10
|
json: () => import('@codemirror/lang-json').then((m) => m.json()),
|
|
11
|
-
spel: () => import('./langs/spel').then((m) => m.spel())
|
|
11
|
+
spel: () => import('./langs/spel').then((m) => m.spel()),
|
|
12
|
+
bash: () => import('./langs/bash').then((m) => m.bash()),
|
|
13
|
+
powershell: () => import('./langs/powershell').then((m) => m.powershell())
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** 按需加载语言扩展;模块缓存由运行时保证,重复切换同一语言不会重复下载 */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LanguageSupport, StreamLanguage } from '@codemirror/language'
|
|
2
|
+
import { shell } from '@codemirror/legacy-modes/mode/shell'
|
|
3
|
+
|
|
4
|
+
/** Bash / shell 脚本语言支持(基于 CodeMirror legacy shell mode) */
|
|
5
|
+
export function bash(): LanguageSupport {
|
|
6
|
+
return new LanguageSupport(StreamLanguage.define(shell))
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LanguageSupport, StreamLanguage } from '@codemirror/language'
|
|
2
|
+
import { powerShell } from '@codemirror/legacy-modes/mode/powershell'
|
|
3
|
+
|
|
4
|
+
/** PowerShell 语言支持(基于 CodeMirror legacy powershell mode) */
|
|
5
|
+
export function powershell(): LanguageSupport {
|
|
6
|
+
return new LanguageSupport(StreamLanguage.define(powerShell))
|
|
7
|
+
}
|
package/src/types/batch-edit.ts
CHANGED
|
@@ -58,7 +58,11 @@ export interface BatchEditProps extends TableProps {
|
|
|
58
58
|
) => void | Promise<void>
|
|
59
59
|
/** label的宽度 */
|
|
60
60
|
labelWidth?: string | number
|
|
61
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* 删除方法
|
|
63
|
+
* @description 删除时调用。如果返回 false,则不删除
|
|
64
|
+
* @returns 如果返回 false,则不删除
|
|
65
|
+
*/
|
|
62
66
|
deleteMethod?: (data: Record<string, any>[]) => any
|
|
63
67
|
/**
|
|
64
68
|
* 保存方法
|
|
@@ -113,6 +117,14 @@ export interface BatchEditProps extends TableProps {
|
|
|
113
117
|
export interface BatchEditEmits extends TableEmits {
|
|
114
118
|
/** 更新数据 */
|
|
115
119
|
(e: 'update:data', value: Record<string, any>[]): void
|
|
120
|
+
/** 点击底部「新增一行」 */
|
|
121
|
+
(e: 'create'): void
|
|
122
|
+
/** 点击「在上方插入」 */
|
|
123
|
+
(e: 'create-prev', row: TableRow): void
|
|
124
|
+
/** 点击「在下方插入」 */
|
|
125
|
+
(e: 'create-next', row: TableRow): void
|
|
126
|
+
/** 点击「添加子级」,参数为父级行 */
|
|
127
|
+
(e: 'create-child', row: TableRow): void
|
|
116
128
|
}
|
|
117
129
|
|
|
118
130
|
export type BatchEditSlots = {
|
|
@@ -121,6 +133,10 @@ export type BatchEditSlots = {
|
|
|
121
133
|
depth?: number
|
|
122
134
|
/** 当前编辑的行 */
|
|
123
135
|
row?: TableRow
|
|
136
|
+
/** 新增时的父级行(createChild / 非根同级插入) */
|
|
137
|
+
parentRow?: TableRow
|
|
138
|
+
/** 当前表单操作类型 */
|
|
139
|
+
formActionType?: BatchEditStates['formActionType']
|
|
124
140
|
/** 当前编辑的行索引 */
|
|
125
141
|
index?: number
|
|
126
142
|
/** 操作的目标行索引路径 */
|
package/src/types/code-editor.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
|
|
2
2
|
|
|
3
|
-
export type CodeEditorLang = 'js' | 'sql' | 'java' | 'json' | 'spel'
|
|
3
|
+
export type CodeEditorLang = 'js' | 'sql' | 'java' | 'json' | 'spel' | 'bash' | 'powershell'
|
|
4
4
|
|
|
5
5
|
/** 代码编辑器组件属性(不支持 `size`) */
|
|
6
6
|
export interface CodeEditorProps extends Omit<FormComponentProps, 'size'> {
|