Status.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div>
  3. <!---------------------------------------------->
  4. <div class="hidden sets-part-header">
  5. Строка статуса
  6. </div>
  7. <div class="sets-item row">
  8. <div class="sets-label label">
  9. Статус
  10. </div>
  11. <div class="col row">
  12. <q-checkbox v-model="form.showStatusBar" size="xs" label="Показывать" />
  13. <q-checkbox v-show="form.showStatusBar" v-model="form.statusBarTop" class="q-ml-sm" size="xs" label="Вверху/внизу" />
  14. </div>
  15. </div>
  16. <div v-show="form.showStatusBar" class="sets-item row no-wrap">
  17. <div class="sets-label label">
  18. Цвет
  19. </div>
  20. <div class="col-left row">
  21. <q-input
  22. v-model="statusBarColorFiltered"
  23. class="col-left no-mp"
  24. outlined dense
  25. :rules="['hexColor']"
  26. style="max-width: 150px"
  27. :disable="form.statusBarColorAsText"
  28. >
  29. <template #prepend>
  30. <q-icon name="la la-angle-down la-xs" class="cursor-pointer text-white" :style="helper.colorPanStyle(form.statusBarColor)">
  31. <q-popup-proxy anchor="bottom middle" self="top middle">
  32. <div>
  33. <q-color
  34. v-model="form.statusBarColor"
  35. no-header default-view="palette" :palette="defPalette.predefineTextColors"
  36. />
  37. </div>
  38. </q-popup-proxy>
  39. </q-icon>
  40. </template>
  41. </q-input>
  42. </div>
  43. <div class="q-px-xs" />
  44. <q-checkbox v-model="form.statusBarColorAsText" size="xs" label="Как у текста" />
  45. </div>
  46. <div v-show="form.showStatusBar" class="sets-item row">
  47. <div class="sets-label label">
  48. Прозрачность
  49. </div>
  50. <div class="col row">
  51. <NumInput v-model="form.statusBarColorAlpha" class="col-left" :min="0" :max="1" :digits="2" :step="0.1" />
  52. </div>
  53. </div>
  54. <div v-show="form.showStatusBar" class="sets-item row">
  55. <div class="sets-label label">
  56. Высота
  57. </div>
  58. <div class="col row">
  59. <NumInput v-model="form.statusBarHeight" class="col-left" :min="5" :max="100" />
  60. </div>
  61. </div>
  62. <div v-show="form.showStatusBar" class="sets-item row">
  63. <div class="sets-label label"></div>
  64. <div class="col row">
  65. <q-checkbox v-model="form.statusBarClickOpen" size="xs" label="Открывать оригинал по клику">
  66. <q-tooltip :delay="1000" anchor="top middle" self="bottom middle" content-style="font-size: 80%">
  67. По клику на автора-название в строке статуса<br>
  68. открывать оригинал произведения в новой вкладке
  69. </q-tooltip>
  70. </q-checkbox>
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. //-----------------------------------------------------------------------------
  77. import vueComponent from '../../../../vueComponent.js';
  78. import NumInput from '../../../../share/NumInput.vue';
  79. import * as helper from '../helper';
  80. import defPalette from '../defPalette';
  81. const componentOptions = {
  82. components: {
  83. NumInput,
  84. },
  85. watch: {
  86. form: {
  87. handler() {
  88. this.formChanged();//no await
  89. },
  90. deep: true,
  91. },
  92. statusBarColorFiltered(newValue) {
  93. if (!this.isFormChanged && this.helper.isHexColor(newValue))
  94. this.form.statusBarColor = newValue;
  95. },
  96. },
  97. };
  98. class Text {
  99. _options = componentOptions;
  100. _props = {
  101. form: Object,
  102. };
  103. helper = helper;
  104. defPalette = defPalette;
  105. statusBarColorFiltered = '';
  106. created() {
  107. this.formChanged();//no await
  108. }
  109. mounted() {
  110. }
  111. async formChanged() {
  112. this.isFormChanged = true;
  113. try {
  114. this.statusBarColorFiltered = this.form.statusBarColor;
  115. } finally {
  116. await this.$nextTick();
  117. this.isFormChanged = false;
  118. }
  119. }
  120. }
  121. export default vueComponent(Text);
  122. //-----------------------------------------------------------------------------
  123. </script>
  124. <style scoped>
  125. .label {
  126. width: 110px;
  127. }
  128. .col-left {
  129. width: 145px;
  130. }
  131. .no-mp {
  132. margin: 0;
  133. padding: 0;
  134. }
  135. </style>