BookmarkSettings.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <Window ref="window" width="600px" height="95%" @close="close">
  3. <template slot="header">
  4. Настроить закладки
  5. </template>
  6. <div class="column fit">
  7. <div class="row items-center top-panel bg-grey-3">
  8. <q-btn class="q-mr-md" round dense color="blue" icon="la la-check" @click.stop="openSelected" size="16px">
  9. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Открыть выбранную закладку</q-tooltip>
  10. </q-btn>
  11. <q-input class="col q-mr-sm" ref="input" rounded outlined dense bg-color="white" placeholder="Найти" v-model="search">
  12. </q-input>
  13. <q-btn round dense color="blue" icon="la la-cog" @click.stop="openOptions" size="14px">
  14. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Опции</q-tooltip>
  15. </q-btn>
  16. </div>
  17. <div class="col row">
  18. <div class="left-panel column items-center bg-grey-3">
  19. <q-btn class="q-mb-sm" round dense color="blue" icon="la la-edit" @click.stop="editBookmark" size="14px">
  20. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Редактировать закладку</q-tooltip>
  21. </q-btn>
  22. <q-btn class="q-mb-sm" round dense color="blue" icon="la la-plus" @click.stop="addBookmark" size="14px">
  23. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Добавить закладку</q-tooltip>
  24. </q-btn>
  25. <q-btn class="q-mb-sm" round dense color="blue" icon="la la-minus" @click.stop="delBookmark" size="14px">
  26. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Удалить закладку</q-tooltip>
  27. </q-btn>
  28. <q-btn class="q-mb-sm" round dense color="blue" icon="la la-arrow-up" @click.stop="moveUp" size="14px">
  29. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Переместить вверх</q-tooltip>
  30. </q-btn>
  31. <q-btn class="q-mb-sm" round dense color="blue" icon="la la-arrow-down" @click.stop="moveDown" size="14px">
  32. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Переместить вниз</q-tooltip>
  33. </q-btn>
  34. </div>
  35. <div class="col tree">
  36. <q-tree
  37. :nodes="nodes"
  38. node-key="key"
  39. tick-strategy="leaf-filtered"
  40. :selected.sync="selected"
  41. :ticked.sync="ticked"
  42. :expanded.sync="expanded"
  43. text-color="grey-7"
  44. selected-color="black"
  45. />
  46. </div>
  47. </div>
  48. </div>
  49. </Window>
  50. </template>
  51. <script>
  52. //-----------------------------------------------------------------------------
  53. import Vue from 'vue';
  54. import Component from 'vue-class-component';
  55. import Window from '../../share/Window.vue';
  56. const BookmarkSettingsProps = Vue.extend({
  57. props: {
  58. libs: Object,
  59. }
  60. });
  61. export default @Component({
  62. components: {
  63. Window,
  64. },
  65. watch: {
  66. libs: function() {
  67. },
  68. }
  69. })
  70. class BookmarkSettings extends BookmarkSettingsProps {
  71. search = '';
  72. selected = '';
  73. ticked = [];
  74. expanded = [];
  75. created() {
  76. }
  77. mounted() {
  78. }
  79. init() {
  80. this.$refs.window.init();
  81. }
  82. get nodes() {
  83. const result = [];
  84. let i = 0;
  85. this.libs.groups.forEach(group => {
  86. const g = {label: group.r, key: `${i}`, children: []};
  87. let j = 0;
  88. group.list.forEach(link => {
  89. g.children.push({label: (link.c ? link.c + ' ': '') + link.l, key: `${i}-${j}`});
  90. });
  91. result.push(g);
  92. i++;
  93. });
  94. return result;
  95. }
  96. openSelected() {
  97. }
  98. openOptions() {
  99. }
  100. close() {
  101. this.$emit('close');
  102. }
  103. keyHook(event) {
  104. if (event.type == 'keydown' && event.key == 'Escape') {
  105. this.close();
  106. return true;
  107. }
  108. return false;
  109. }
  110. }
  111. //-----------------------------------------------------------------------------
  112. </script>
  113. <style scoped>
  114. .top-panel {
  115. height: 50px;
  116. border-bottom: 1px solid gray;
  117. padding: 0 10px 0 12px;
  118. }
  119. .left-panel {
  120. width: 60px;
  121. border-right: 1px solid gray;
  122. padding: 10px 0 10px 0;
  123. }
  124. .tree {
  125. padding: 10px;
  126. }
  127. </style>