saby-customizer 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,6 @@ export class GitBranchCardData {
51
51
 
52
52
  /**
53
53
  * Обновление выбранной версии и обновление карточки задачи
54
- *
55
54
  * @param {string} value Версия
56
55
  */
57
56
  set version(value) {
@@ -70,7 +69,6 @@ export class GitBranchCardData {
70
69
 
71
70
  /**
72
71
  * Обновление доп. имени ветки и обновление карточки задачи
73
- *
74
72
  * @param {string} value Доп. имя ветки
75
73
  */
76
74
  set branchSubName(value) {
@@ -84,7 +82,6 @@ export class GitBranchCardData {
84
82
 
85
83
  /**
86
84
  * Обновление краткого описания и карточки задачи
87
- *
88
85
  * @param {string} value Доп. имя ветки
89
86
  */
90
87
  set description(value) {
@@ -103,7 +100,6 @@ export class GitBranchCardData {
103
100
 
104
101
  /**
105
102
  * Получение имени ветки с учетом выбора вехи и доп. имени ветки
106
- *
107
103
  * @returns {Promise<string>} Имя ветки
108
104
  */
109
105
  async getBranchName() {
@@ -142,7 +138,6 @@ export class GitBranchCardData {
142
138
  if (this.milestones.length) {
143
139
  await this.saveToHistory()
144
140
  }
145
-
146
141
  }
147
142
 
148
143
  /** Сохраняет данные в историю по карточкам для которых копировали имя ветки или описание */
@@ -187,7 +182,6 @@ export class GitBranchCardData {
187
182
 
188
183
  /**
189
184
  * Удаление карточки задачи из истории
190
- *
191
185
  * @param {number} primaryKey Ид записи в истории
192
186
  */
193
187
  async removeFromHistory(primaryKey) {
@@ -407,7 +401,6 @@ class GitBranchCard extends oom.extends(HTMLElement) {
407
401
 
408
402
  /**
409
403
  * Обновление выбранной версии и обновление карточки задачи
410
- *
411
404
  * @param {string} value Версия
412
405
  */
413
406
  set version(value) {
@@ -426,7 +419,6 @@ class GitBranchCard extends oom.extends(HTMLElement) {
426
419
 
427
420
  /**
428
421
  * Обновление доп. имени ветки и обновление карточки задачи
429
- *
430
422
  * @param {string} value Доп. имя ветки
431
423
  */
432
424
  set branchSubName(value) {
@@ -444,7 +436,6 @@ class GitBranchCard extends oom.extends(HTMLElement) {
444
436
 
445
437
  /**
446
438
  * Обновление краткого описания и карточки задачи
447
- *
448
439
  * @param {string} value Доп. имя ветки
449
440
  */
450
441
  set description(value) {
@@ -534,7 +525,6 @@ class GitBranchCard extends oom.extends(HTMLElement) {
534
525
 
535
526
  /**
536
527
  * Обработчик выбора версии из меню
537
- *
538
528
  * @param {number} index Выбранная в меню позиция
539
529
  */
540
530
  selectedVersion(index) {
@@ -802,7 +792,7 @@ toolbar.addButton({
802
792
 
803
793
  toolbar.addButton({
804
794
  position: 'top',
805
- filter: { names: ['Ошибка', 'Задача'] },
795
+ filter: { names: ['Ошибка', 'Задача', 'ЗадачаДок'] },
806
796
  title: 'Скопировать имя ветки для Git',
807
797
  iconSVG: octicons['git-branch'].toSVG({ width: 18 }),
808
798
  onclick: card => {
@@ -815,7 +805,7 @@ toolbar.addButton({
815
805
  })
816
806
  toolbar.addButton({
817
807
  position: 'top',
818
- filter: { names: ['Ошибка', 'Задача'] },
808
+ filter: { names: ['Ошибка', 'Задача', 'ЗадачаДок'] },
819
809
  title: 'Скопировать описание для Git коммита',
820
810
  iconSVG: octicons['git-commit'].toSVG({ width: 18 }),
821
811
  onclick: card => {
@@ -830,10 +820,12 @@ toolbar.addButton({
830
820
  position: 'top',
831
821
  filter: { names: ['Merge request'] },
832
822
  title: 'Открыть ветки для Review кода',
833
- iconSVG: octicons['codescan'].toSVG({ width: 18 }),
823
+ iconSVG: octicons.codescan.toSVG({ width: 18 }),
824
+ keysMapping: 'alt-KeyR',
834
825
  onclick: card => {
835
826
  const links = []
836
827
  const view = card.element.querySelector('.fed2-DocumentPrint__content-view')?.shadowRoot
828
+
837
829
  if (view) {
838
830
  const rows = Array.from(view.querySelectorAll('.git_row'))
839
831
  const rc = `div[title="rc-${card.data.version}"]`
@@ -853,7 +845,7 @@ toolbar.addButton({
853
845
  window.open(link, '_blank')
854
846
  }
855
847
  } else {
856
- snackbar.show(`Не удалось найти ветки для Review кода`)
848
+ snackbar.show('Не удалось найти ветки для Review кода')
857
849
  }
858
850
  }
859
851
  })
@@ -1,13 +1,14 @@
1
1
  const replaceDocTypeName = {
2
2
  'Error': 'Ошибка',
3
3
  'Task to Development': 'Задача',
4
- 'Задача в разработку': 'Задача'
4
+ 'Задача в разработку': 'Задача',
5
+ 'Изменение документации разработки': 'ЗадачаДок',
6
+ 'Изменение документации': 'ЗадачаДок'
5
7
  }
6
8
 
7
9
 
8
10
  /**
9
11
  * Приведение даты к формату
10
- *
11
12
  * @param {Date} date Дата
12
13
  * @returns {string} dd.mm.yy
13
14
  */
@@ -19,12 +20,13 @@ function getStrDate(date) {
19
20
 
20
21
  return d + '.' + m + '.' + y
21
22
  }
23
+
24
+ return ''
22
25
  }
23
26
 
24
27
 
25
28
  /**
26
29
  * Разбирает формат RichEditor и приводить в нестилизированный текст
27
- *
28
30
  * @param {*} json Объет с RichEditorJSON
29
31
  * @returns {string} Тексто документа
30
32
  */
@@ -103,7 +105,6 @@ function parseRichEditorJSON(json) {
103
105
  */
104
106
  /**
105
107
  * Собирает из верстки страницы список открытых в данный момент карточек документов ЭДО
106
- *
107
108
  * @param {OpenCardsFilter} [filter] Параметры фильтрации документов
108
109
  * @returns {Array<Card>} Список открытых карточке документов
109
110
  */
@@ -1,5 +1,6 @@
1
1
  import { oom } from '@notml/core'
2
2
  import { getListOfOpenCards } from './edo.js'
3
+ import { keysMapping } from 'saby-customizer/lib.js'
3
4
 
4
5
  const { MutationObserver } = window
5
6
  /**
@@ -68,6 +69,7 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
68
69
  * @property {ButtonOptionsFilter} [filter] Фильтры отображения кнопок
69
70
  * @property {string} title Всплывающая подсказка на кнопке
70
71
  * @property {string} iconSVG Верстка иконки в формате SVG
72
+ * @property {string} [keysMapping] Горячие клавиши для вызова обработчика на onclick
71
73
  * @property {Function} onclick Обработчик клика на иконку
72
74
  */
73
75
  /** @type {ButtonOptions[]} */
@@ -84,13 +86,23 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
84
86
 
85
87
  /**
86
88
  * Регистрирует новую общую кнопку в панели сайта
87
- *
88
89
  * @param {ButtonOptions} options Опции кнопки
89
90
  */
90
91
  static addButton(options) {
91
92
  options = Object.assign({ position: 'right' }, options)
92
93
  this.buttons.push(options)
93
94
 
95
+ if (options.keysMapping) {
96
+ keysMapping[options.keysMapping] = () => {
97
+ const container = Array.from(this.containers).pop()
98
+ const [card] = container.options.card
99
+ ? getListOfOpenCards({ id: container.options.card.data.id })
100
+ : [null]
101
+
102
+ options.onclick(card)
103
+ }
104
+ }
105
+
94
106
  this.containers.forEach(container => container.addButton(options))
95
107
 
96
108
  if (!ToolbarContainer.globalContainer) {
@@ -104,7 +116,6 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
104
116
 
105
117
  /**
106
118
  * Добавляет в вертску сайта глобальный контейнер в панели для добавления кнопок
107
- *
108
119
  * @param {{searchCount:number}} options Опции регистарции обработчиков
109
120
  */
110
121
  static addGlobalContainer({ searchCount } = { searchCount: 0 }) {
@@ -130,7 +141,6 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
130
141
 
131
142
  /**
132
143
  * Регистрирует обработчик для поиска открытых задач и добавления в них панели
133
- *
134
144
  * @param {{searchCount:number}} options Опции регистарции обработчиков
135
145
  */
136
146
  static registerTaskPanelWatcher({ searchCount } = { searchCount: 0 }) {
@@ -226,7 +236,6 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
226
236
 
227
237
  /**
228
238
  * Добавляет новую общую кнопку в текущий контейнер панели
229
- *
230
239
  * @param {ButtonOptions} options Опции кнопки
231
240
  */
232
241
  addButton(options) {
@@ -241,16 +250,13 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
241
250
  }
242
251
 
243
252
  if (match) {
253
+ const [card] = this.options.card
254
+ ? getListOfOpenCards({ id: this.options.card.data.id })
255
+ : [null]
244
256
  const button = oom.div({
245
257
  class: 'button',
246
258
  title: options.title,
247
- onclick: () => {
248
- const [card] = this.options.card
249
- ? getListOfOpenCards({ id: this.options.card.data.id })
250
- : [null]
251
-
252
- options.onclick(card)
253
- }
259
+ onclick: () => options.onclick(card)
254
260
  })
255
261
 
256
262
  if (options.iconSVG) {
@@ -268,5 +274,5 @@ oom.define(ToolbarContainer)
268
274
 
269
275
 
270
276
  export const toolbar = {
271
- addButton: (options) => ToolbarContainer.addButton(options)
277
+ addButton: (/** @type {ButtonOptions} */ options) => ToolbarContainer.addButton(options)
272
278
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": "github:saby-customizer/saby-customizer.github.io",
11
11
  "license": "Unlicense",
12
- "version": "0.0.1",
12
+ "version": "0.0.3",
13
13
  "type": "module",
14
14
  "main": "./userscript.js",
15
15
  "exports": {