Skip to content

Commit a9934d1

Browse files
committed
feat: 正则排序支持顺序/倒序/原顺序(后端 > 2.19.10)
1 parent 9c33fd3 commit a9934d1

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store-front-end",
3-
"version": "2.15.10",
3+
"version": "2.15.11",
44
"private": true,
55
"scripts": {
66
"dev": "vite --host",

src/locales/en.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,8 @@ export default {
485485
},
486486
"Regex Sort Operator": {
487487
label: "Regex Sort",
488-
des: ["Regular Expressions"],
488+
des: ["Regular Expressions", "Sort of Unmatched Nodes"],
489+
options: ["Ascending", "Descending", "Original"],
489490
placeholder: ["Regular Expressions"],
490491
tipsTitle: "Regex Sort Tips",
491492
tipsDes: "Regular sorting operation instructions",

src/locales/zh.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ export default {
501501
},
502502
'Regex Sort Operator': {
503503
label: '正则排序',
504-
des: ['正则表达式'],
504+
des: ['正则表达式', '未匹配节点排序方式'],
505+
options: ['正序', '逆序', '不变'],
505506
placeholder: ['填入正则表达式'],
506507
tipsTitle: '正则排序操作提示',
507508
tipsDes:

src/views/editor/components/Regex.vue

+30-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
</nut-radio>
1313
</nut-radiogroup>
1414
</template>
15+
<template v-if="type === 'Regex Sort Operator'">
16+
<p class="des-label">
17+
{{ $t(`editorPage.subConfig.nodeActions['${type}'].des[1]`) }}
18+
</p>
19+
<nut-radiogroup direction="horizontal" v-model="mode">
20+
<nut-radio v-for="(key, index) in opt[type]" :label="key" :key="index"
21+
>{{
22+
$t(`editorPage.subConfig.nodeActions['${type}'].options[${index}]`)
23+
}}
24+
</nut-radio>
25+
</nut-radiogroup>
26+
</template>
1527
<p class="des-label">
1628
{{ $t(`editorPage.subConfig.nodeActions['${type}'].des[0]`) }}
1729
</p>
@@ -84,6 +96,7 @@
8496
// 值的次序需要与该选项的 options 值 顺序相同
8597
const opt = {
8698
'Regex Filter': [0, 1],
99+
'Regex Sort Operator': ['asc', 'desc', 'original'],
87100
};
88101
89102
const input1 = ref('');
@@ -165,6 +178,19 @@
165178
value.value = item.args.regex;
166179
mode.value = item.args.keep ? 0 : 1;
167180
break;
181+
case 'Regex Sort Operator':
182+
const order = item.args?.order || 'asc';
183+
let expressions = item.args?.expressions;
184+
if (Array.isArray(item.args)) {
185+
expressions = item.args;
186+
}
187+
if (!Array.isArray(expressions)) {
188+
expressions = [];
189+
}
190+
item.args = { order, expressions };
191+
value.value = item.args.expressions;
192+
mode.value = item.args.order;
193+
break;
168194
default:
169195
value.value = item.args;
170196
break;
@@ -177,6 +203,9 @@
177203
if (item && type === 'Regex Filter') {
178204
item.args.keep = !mode.value;
179205
}
206+
if (item && type === 'Regex Sort Operator') {
207+
item.args.order = mode.value;
208+
}
180209
});
181210
182211
const confirmLeave = () => {
@@ -220,7 +249,7 @@
220249
.nut-radiogroup {
221250
width: 100%;
222251
display: grid;
223-
grid-template-columns: 1fr 1fr;
252+
grid-template-columns: 1fr 1fr 1fr;
224253
}
225254
226255
.tag-wrapper {

0 commit comments

Comments
 (0)