mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:47:08 +00:00
Refactor <dougal-project-settings-raw-ntbp/>
This commit is contained in:
@@ -8,14 +8,14 @@
|
|||||||
label="Pattern"
|
label="Pattern"
|
||||||
hint="Regular expression text"
|
hint="Regular expression text"
|
||||||
persistent-hint
|
persistent-hint
|
||||||
v-model="regex"
|
v-model="regex_"
|
||||||
>
|
>
|
||||||
</v-text-field>
|
</v-text-field>
|
||||||
<v-text-field
|
<v-text-field
|
||||||
label="Flags"
|
label="Flags"
|
||||||
hint="Regular expression modifier flags"
|
hint="Regular expression modifier flags"
|
||||||
persistent-hint
|
persistent-hint
|
||||||
v-model="flags"
|
v-model="flags_"
|
||||||
>
|
>
|
||||||
</v-text-field>
|
</v-text-field>
|
||||||
</v-form>
|
</v-form>
|
||||||
@@ -40,35 +40,44 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { deepCompare, deepMerge } from '@/lib/utils';
|
||||||
|
import setIfDifferent from '@/lib/watcher-mixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DougalProjectSettingsRawNTBP",
|
name: "DougalProjectSettingsRawNTBP",
|
||||||
|
|
||||||
props: [ "value" ],
|
mixins: [
|
||||||
|
setIfDifferent({
|
||||||
|
regex: "regex_",
|
||||||
|
flags: "flags_"
|
||||||
|
})
|
||||||
|
],
|
||||||
|
|
||||||
|
props: [ "regex", "flags" ],
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
regex: "NTBP",
|
regex_: "NTBP",
|
||||||
flags: "i"
|
flags_: "i"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
value (newValue) {
|
|
||||||
this.reset();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
reset () {
|
reset () {
|
||||||
for (const key of Object.keys(this.$data)) {
|
this.regex_ = this.regex;
|
||||||
this[key] = this.value[key];
|
this.flags_ = this.flags;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
save () {
|
save () {
|
||||||
this.$emit('input', {...this.$data});
|
this.$emit('merge', [ ["raw", "ntbp"], {
|
||||||
|
regex: this.regex_,
|
||||||
|
flags: this.flags_
|
||||||
|
}]);
|
||||||
|
this.$nextTick(this.reset);
|
||||||
},
|
},
|
||||||
|
|
||||||
back () {
|
back () {
|
||||||
|
|||||||
Reference in New Issue
Block a user