Commit 7d8342f 1 parent b8549ea commit 7d8342f Copy full SHA for 7d8342f
File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ function violDecr() {
196
196
<FormMultiSelectModInput
197
197
:name =" 'admins'"
198
198
:tooltip =" 'default []'"
199
+ :regEx =" ['^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', '^[0-9]{17}$']"
199
200
:readonly =" props.readonly"
200
201
v-model =" server.config.game.admins"
201
202
></FormMultiSelectModInput >
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ const props = defineProps({
6
6
readonly: Boolean ,
7
7
name: String ,
8
8
tooltip: String ,
9
- optionalParam: Boolean
9
+ optionalParam: Boolean ,
10
+ regEx: Array
10
11
});
11
12
const model = defineModel <string [] | undefined >({ required: true });
12
13
@@ -27,6 +28,22 @@ watch(
27
28
28
29
function addItem() {
29
30
const input: HTMLInputElement = document .getElementById (inputId ) as HTMLInputElement ;
31
+
32
+ if (props .regEx ) {
33
+ let successCounter = 0 ;
34
+ props .regEx .forEach (element => {
35
+ const regEx = new RegExp (element as string );
36
+ const regExResult = regEx .exec (input .value );
37
+ if (regExResult !== null ) {
38
+ successCounter ++ ;
39
+ }
40
+ });
41
+ if (successCounter === 0 ) {
42
+ alert (' Malformatted string. See reference for details.' );
43
+ return ;
44
+ }
45
+ }
46
+
30
47
localOptions .value .push (input .value );
31
48
input .value = ' ' ;
32
49
assignNewValue ();
You can’t perform that action at this time.
0 commit comments