Работа над хоткеями, промежуточный коммит
This commit is contained in:
@@ -76,6 +76,8 @@ import _ from 'lodash';
|
|||||||
import * as utils from '../../../share/utils';
|
import * as utils from '../../../share/utils';
|
||||||
import Window from '../../share/Window.vue';
|
import Window from '../../share/Window.vue';
|
||||||
import NumInput from '../../share/NumInput.vue';
|
import NumInput from '../../share/NumInput.vue';
|
||||||
|
import UserHotKeys from './UserHotKeys/UserHotKeys.vue';
|
||||||
|
|
||||||
import rstore from '../../../store/modules/reader';
|
import rstore from '../../../store/modules/reader';
|
||||||
import defPalette from './defPalette';
|
import defPalette from './defPalette';
|
||||||
|
|
||||||
@@ -85,6 +87,7 @@ export default @Component({
|
|||||||
components: {
|
components: {
|
||||||
Window,
|
Window,
|
||||||
NumInput,
|
NumInput,
|
||||||
|
UserHotKeys,
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return Object.assign({}, rstore.settingDefaults);
|
return Object.assign({}, rstore.settingDefaults);
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<div class="table col column no-wrap">
|
||||||
|
<!-- header -->
|
||||||
|
<div class="table-row row">
|
||||||
|
<div class="desc q-pa-sm bg-green-4">Действие</div>
|
||||||
|
<div class="hotKeys col q-pa-sm bg-green-4 row no-wrap">
|
||||||
|
<span>Сочетания клавиш</span>
|
||||||
|
<q-input ref="input" outlined dense rounded bg-color="grey-4"
|
||||||
|
placeholder="Найти"
|
||||||
|
v-model="search"
|
||||||
|
@click.stop
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- body -->
|
||||||
|
<div class="table-row row" v-for="(action, index) in tableData" :key="index">
|
||||||
|
<div class="desc q-pa-sm">{{ rstore.readerActions[action] }}</div>
|
||||||
|
<div class="hotKeys col q-pa-sm">
|
||||||
|
<q-chip removable color="grey-8" text-color="white" v-for="(code, index) in value[action]" :key="index" @remove="removeCode(action, code)">
|
||||||
|
{{ code }}
|
||||||
|
</q-chip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
import Vue from 'vue';
|
||||||
|
import Component from 'vue-class-component';
|
||||||
|
|
||||||
|
import rstore from '../../../../store/modules/reader';
|
||||||
|
//import * as utils from '../../share/utils';
|
||||||
|
|
||||||
|
const UserHotKeysProps = Vue.extend({
|
||||||
|
props: {
|
||||||
|
value: Object,
|
||||||
|
//prop: { type: Number, default: 0 },
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default @Component({
|
||||||
|
watch: {
|
||||||
|
search: function() {
|
||||||
|
this.updateTableData();
|
||||||
|
},
|
||||||
|
value: function() {
|
||||||
|
this.updateTableData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
class UserHotKeys extends UserHotKeysProps {
|
||||||
|
search = '';
|
||||||
|
rstore = {};
|
||||||
|
tableData = [];
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.rstore = rstore;
|
||||||
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.updateTableData();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTableData() {
|
||||||
|
let result = rstore.hotKeys.map(hk => hk.name);
|
||||||
|
|
||||||
|
const search = this.search.toLowerCase();
|
||||||
|
const codesIncludeSearch = (action) => {
|
||||||
|
for (const code of this.value[action]) {
|
||||||
|
if (code.toLowerCase().includes(search))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
result = result.filter(item => {
|
||||||
|
return !search ||
|
||||||
|
rstore.readerActions[item].toLowerCase().includes(search) ||
|
||||||
|
codesIncludeSearch(item)
|
||||||
|
});
|
||||||
|
|
||||||
|
this.tableData = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
removeCode(action, code) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.table {
|
||||||
|
border-left: 1px solid grey;
|
||||||
|
border-top: 1px solid grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-row {
|
||||||
|
border-right: 1px solid grey;
|
||||||
|
border-bottom: 1px solid grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hotKeys {
|
||||||
|
border-left: 1px solid grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -11,3 +11,7 @@
|
|||||||
<div class="label-4"></div>
|
<div class="label-4"></div>
|
||||||
<q-btn class="button" dense no-caps @click="addHotKeyCode">{{ testCode }}</q-btn>
|
<q-btn class="button" dense no-caps @click="addHotKeyCode">{{ testCode }}</q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="item row">
|
||||||
|
<UserHotKeys v-model="userHotKeys" />
|
||||||
|
</div>
|
||||||
@@ -30,6 +30,7 @@ import {QSelect} from 'quasar/src/components/select';
|
|||||||
import {QColor} from 'quasar/src/components/color';
|
import {QColor} from 'quasar/src/components/color';
|
||||||
import {QPopupProxy} from 'quasar/src/components/popup-proxy';
|
import {QPopupProxy} from 'quasar/src/components/popup-proxy';
|
||||||
import {QDialog} from 'quasar/src/components/dialog';
|
import {QDialog} from 'quasar/src/components/dialog';
|
||||||
|
import {QChip} from 'quasar/src/components/chip';
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
//QLayout,
|
//QLayout,
|
||||||
@@ -55,6 +56,7 @@ const components = {
|
|||||||
QColor,
|
QColor,
|
||||||
QPopupProxy,
|
QPopupProxy,
|
||||||
QDialog,
|
QDialog,
|
||||||
|
QChip,
|
||||||
};
|
};
|
||||||
|
|
||||||
//directives
|
//directives
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const readerActions = {
|
const readerActions = {
|
||||||
'help': 'Справка',
|
'help': 'Справка',
|
||||||
'loader': 'Загрузить книгу',
|
'loader': 'Страница загрузки',
|
||||||
'settings': 'Настроить',
|
'settings': 'Настроить',
|
||||||
'undoAction': 'Действие назад',
|
'undoAction': 'Действие назад',
|
||||||
'redoAction': 'Действие вперед',
|
'redoAction': 'Действие вперед',
|
||||||
|
|||||||
Reference in New Issue
Block a user