saby-customizer 0.0.0-pre.29 → 0.0.0-pre.33
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.
- package/features/doc-copy-link.js +17 -0
- package/features/git-branch.js +229 -25
- package/lib/popup-dialog.js +35 -6
- package/lib/saby-lib/edo.js +17 -3
- package/lib/saby-lib/toolbar.js +16 -6
- package/material.js +1 -1
- package/octicons.js +15 -0
- package/package.json +1 -1
- package/userscript.js +2 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toolbar } from 'saby-customizer/lib.js'
|
|
2
|
+
import { octicons } from 'saby-customizer/octicons.js'
|
|
3
|
+
import { GitBranchCardData } from 'saby-customizer/features/git-branch.js'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
toolbar.addButton({
|
|
7
|
+
position: 'top',
|
|
8
|
+
title: 'Скопировать ссылку на карточку',
|
|
9
|
+
iconSVG: octicons.link.toSVG({ width: 18 }),
|
|
10
|
+
onclick: card => {
|
|
11
|
+
const gitCard = new GitBranchCardData(card.data)
|
|
12
|
+
|
|
13
|
+
gitCard.restoreFromHistory()
|
|
14
|
+
.then(() => gitCard.copyLink())
|
|
15
|
+
.catch(console.error)
|
|
16
|
+
}
|
|
17
|
+
})
|
package/features/git-branch.js
CHANGED
|
@@ -4,7 +4,7 @@ import { octicons } from 'saby-customizer/octicons.js'
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/** Класс для управления данными карточки задачи */
|
|
7
|
-
class GitBranchCardData {
|
|
7
|
+
export class GitBranchCardData {
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef GitCardData
|
|
@@ -55,9 +55,7 @@ class GitBranchCardData {
|
|
|
55
55
|
* @param {string} value Версия
|
|
56
56
|
*/
|
|
57
57
|
set version(value) {
|
|
58
|
-
|
|
59
|
-
this.raw.version = value
|
|
60
|
-
}
|
|
58
|
+
this.raw.version = value || this.raw.version
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
/** @returns {string} Часть имени ветки, зависящая от регламента задачи */
|
|
@@ -182,6 +180,17 @@ class GitBranchCardData {
|
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Удаление карточки задачи из истории
|
|
185
|
+
*
|
|
186
|
+
* @param {number} primaryKey Ид записи в истории
|
|
187
|
+
*/
|
|
188
|
+
async removeFromHistory(primaryKey) {
|
|
189
|
+
const gitBranchHistory = db.table('gitBranchHistory')
|
|
190
|
+
|
|
191
|
+
await gitBranchHistory.delete(primaryKey)
|
|
192
|
+
}
|
|
193
|
+
|
|
185
194
|
}
|
|
186
195
|
|
|
187
196
|
/** Карточка со сведениями о задаче для копирования ветки */
|
|
@@ -208,6 +217,10 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
208
217
|
whiteSpace: 'nowrap',
|
|
209
218
|
textOverflow: 'ellipsis'
|
|
210
219
|
},
|
|
220
|
+
'.history-info': {
|
|
221
|
+
fontSize: '13px',
|
|
222
|
+
fontStyle: 'italic'
|
|
223
|
+
},
|
|
211
224
|
'.link': {
|
|
212
225
|
fontSize: '14px',
|
|
213
226
|
color: 'var(--mdc-theme-primary, #6200ee)'
|
|
@@ -234,6 +247,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
234
247
|
marginBottom: '-1px',
|
|
235
248
|
cursor: 'pointer',
|
|
236
249
|
color: 'var(--mdc-theme-primary, #6200ee)',
|
|
250
|
+
whiteSpace: 'nowrap',
|
|
237
251
|
overflow: 'hidden',
|
|
238
252
|
textOverflow: 'ellipsis'
|
|
239
253
|
},
|
|
@@ -245,6 +259,9 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
245
259
|
height: '48px',
|
|
246
260
|
marginTop: '-1px'
|
|
247
261
|
},
|
|
262
|
+
'.branch-sub-name-version': {
|
|
263
|
+
width: '132px'
|
|
264
|
+
},
|
|
248
265
|
'.actions': {
|
|
249
266
|
display: 'flex',
|
|
250
267
|
marginLeft: '12px'
|
|
@@ -265,6 +282,10 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
265
282
|
'.description-textarea': {
|
|
266
283
|
width: '100%'
|
|
267
284
|
},
|
|
285
|
+
'.icon_16': {
|
|
286
|
+
'--mdc-icon-size': '16px',
|
|
287
|
+
'--mdc-icon-button-size': '24px'
|
|
288
|
+
},
|
|
268
289
|
'.icon_18': {
|
|
269
290
|
'--mdc-icon-size': '18px',
|
|
270
291
|
'--mdc-icon-button-size': '24px'
|
|
@@ -287,6 +308,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
287
308
|
}
|
|
288
309
|
|
|
289
310
|
data = new GitBranchCardData(this.options.data)
|
|
311
|
+
versionsList = this.data.milestones.concat(['Произвольная'])
|
|
290
312
|
|
|
291
313
|
elements = {
|
|
292
314
|
/** @type {HTMLSpanElement} */
|
|
@@ -320,13 +342,23 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
320
342
|
oninput: () => this.oninputDescription()
|
|
321
343
|
}).dom,
|
|
322
344
|
/** @type {import('@material/mwc-menu').Menu} */// @ts-ignore
|
|
323
|
-
versions: this.
|
|
345
|
+
versions: this.versionsList.reduce((mwcMenu, item) => {
|
|
324
346
|
return mwcMenu(oom.mwcListItem(item))
|
|
325
347
|
}, oom.mwcMenu({ fixed: true, activatable: true })).dom,
|
|
348
|
+
/** @type {import('@material/mwc-textfield').TextField} */// @ts-ignore
|
|
349
|
+
branchVersionTextfield: oom.mwcTextfield({
|
|
350
|
+
class: 'branch-sub-name branch-sub-name-version hide',
|
|
351
|
+
value: this.data.version,
|
|
352
|
+
placeholder: 'YY.XXXX',
|
|
353
|
+
pattern: '^\\d\\d.\\d\\d\\d\\d$',
|
|
354
|
+
validationmessage: 'Пример: 99.9999',
|
|
355
|
+
oninput: () => this.oninputBranchVersion(),
|
|
356
|
+
onblur: () => this.onblurBranchVersion()
|
|
357
|
+
}).dom,
|
|
326
358
|
/** @type {HTMLDivElement} */// @ts-ignore
|
|
327
359
|
branchButton: oom.div({
|
|
328
360
|
class: 'version-button',
|
|
329
|
-
onclick: () =>
|
|
361
|
+
onclick: () => this.editBranchVersion()
|
|
330
362
|
}, this.data.version).dom,
|
|
331
363
|
/** @type {HTMLSpanElement} */
|
|
332
364
|
branchNamePart: oom.span({
|
|
@@ -377,6 +409,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
377
409
|
this.data.version = value
|
|
378
410
|
if (this.data.version === value) {
|
|
379
411
|
this.elements.branchButton.textContent = this.data.version
|
|
412
|
+
this.elements.branchVersionTextfield.value = this.data.version
|
|
380
413
|
this.elements.cardTitle.textContent = this.data.branchTitle
|
|
381
414
|
}
|
|
382
415
|
}
|
|
@@ -422,13 +455,37 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
422
455
|
template = () => {
|
|
423
456
|
this.elements.versions.anchor = this.elements.branchButton
|
|
424
457
|
this.elements.versions.addEventListener('selected', (/** @type {CustomEvent<import('@material/mwc-list/mwc-list-foundation').ActionDetail>} */event) => {
|
|
425
|
-
this.
|
|
458
|
+
this.selectedVersion(event.detail.index)
|
|
426
459
|
})
|
|
427
460
|
|
|
428
461
|
this.updateBranchNamePart().catch(console.error)
|
|
429
462
|
|
|
430
|
-
|
|
431
|
-
.div({ class: 'title' }, this.elements.cardTitle)
|
|
463
|
+
const cardElement = oom.div({ class: 'mdc-card' }, oom
|
|
464
|
+
.div({ class: 'title' }, this.elements.cardTitle))
|
|
465
|
+
|
|
466
|
+
if (this.options.pk) {
|
|
467
|
+
// Добавим элементы для карточки задачи из истории
|
|
468
|
+
const useDate = this.options.useDate.toLocaleString()
|
|
469
|
+
|
|
470
|
+
cardElement(oom.div(oom
|
|
471
|
+
.span({ class: 'history-info' }, `Скопировано: ${useDate}`)
|
|
472
|
+
.mwcIconButton({
|
|
473
|
+
title: 'Удалить из истории',
|
|
474
|
+
class: 'icon_16',
|
|
475
|
+
innerHTML: octicons.x.toSVG({ width: 16 }),
|
|
476
|
+
onclick: () => {
|
|
477
|
+
/** @type {GitBranchCardList} */// @ts-ignore
|
|
478
|
+
const cardList = this.parentElement.parentElement
|
|
479
|
+
|
|
480
|
+
this.remove()
|
|
481
|
+
this.data.removeFromHistory(this.options.pk)
|
|
482
|
+
.then(() => cardList.buildHistoryList())
|
|
483
|
+
.catch(console.error)
|
|
484
|
+
}
|
|
485
|
+
})))
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return cardElement(oom
|
|
432
489
|
.div(oom
|
|
433
490
|
.a({ class: 'link' }, this.data.url, {
|
|
434
491
|
target: '_blank',
|
|
@@ -441,6 +498,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
441
498
|
.div({ class: 'branch' },
|
|
442
499
|
this.elements.branchButton,
|
|
443
500
|
this.elements.versions,
|
|
501
|
+
this.elements.branchVersionTextfield,
|
|
444
502
|
this.elements.branchNamePart,
|
|
445
503
|
this.elements.branchSubName,
|
|
446
504
|
this.elements.branchSubNameTextfield)
|
|
@@ -469,6 +527,52 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
469
527
|
this.description = this.elements.descriptionTextarea.value
|
|
470
528
|
}
|
|
471
529
|
|
|
530
|
+
/**
|
|
531
|
+
* Обработчик выбора версии из меню
|
|
532
|
+
*
|
|
533
|
+
* @param {number} index Выбранная в меню позиция
|
|
534
|
+
*/
|
|
535
|
+
selectedVersion(index) {
|
|
536
|
+
const version = this.versionsList[index]
|
|
537
|
+
|
|
538
|
+
if (version === 'Произвольная') {
|
|
539
|
+
this.elements.branchVersionTextfield.classList.toggle('hide')
|
|
540
|
+
this.elements.branchButton.classList.toggle('hide')
|
|
541
|
+
this.elements.branchVersionTextfield.focus()
|
|
542
|
+
this.elements.branchVersionTextfield.select()
|
|
543
|
+
} else {
|
|
544
|
+
this.version = version
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/** Открывает форму редактирования версии ветки */
|
|
549
|
+
editBranchVersion() {
|
|
550
|
+
if (this.data.milestones.length === 0) {
|
|
551
|
+
this.elements.branchVersionTextfield.classList.toggle('hide')
|
|
552
|
+
this.elements.branchButton.classList.toggle('hide')
|
|
553
|
+
this.elements.branchVersionTextfield.focus()
|
|
554
|
+
this.elements.branchVersionTextfield.select()
|
|
555
|
+
} else {
|
|
556
|
+
this.elements.versions.open = true
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** Сохранение данных о версии ветки при вводе */
|
|
561
|
+
oninputBranchVersion() {
|
|
562
|
+
if (this.elements.branchVersionTextfield.checkValidity()) {
|
|
563
|
+
this.version = this.elements.branchVersionTextfield.value
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/** Скрывает поле ввода версии ветки при потере фокуса */
|
|
568
|
+
onblurBranchVersion() {
|
|
569
|
+
if (this.elements.branchVersionTextfield.checkValidity()) {
|
|
570
|
+
this.elements.branchVersionTextfield.classList.toggle('hide')
|
|
571
|
+
this.elements.branchButton.classList.toggle('hide')
|
|
572
|
+
this.version = this.elements.branchVersionTextfield.value
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
472
576
|
/** Открывает форму редактирования доп. имени ветки */
|
|
473
577
|
editBranchSubName() {
|
|
474
578
|
this.elements.branchSubName.classList.toggle('hide')
|
|
@@ -499,14 +603,22 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
499
603
|
|
|
500
604
|
/** Копирование имени ветки */
|
|
501
605
|
async copyBranchName() {
|
|
502
|
-
|
|
606
|
+
const valid = this.elements.branchSubNameTextfield.checkValidity() &&
|
|
607
|
+
this.elements.branchVersionTextfield.checkValidity()
|
|
608
|
+
|
|
609
|
+
if (valid) {
|
|
503
610
|
await this.data.copyBranchName()
|
|
504
611
|
}
|
|
505
612
|
}
|
|
506
613
|
|
|
507
614
|
/** Копирование описания для git commit */
|
|
508
615
|
async copyDescription() {
|
|
509
|
-
|
|
616
|
+
const valid = this.elements.branchSubNameTextfield.checkValidity() &&
|
|
617
|
+
this.elements.branchVersionTextfield.checkValidity()
|
|
618
|
+
|
|
619
|
+
if (valid) {
|
|
620
|
+
await this.data.copyDescription()
|
|
621
|
+
}
|
|
510
622
|
}
|
|
511
623
|
|
|
512
624
|
/** Восстановление из истории последнего сохраненного состояния карточки */
|
|
@@ -527,12 +639,31 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
527
639
|
static style = oom.style({
|
|
528
640
|
'display': 'contents',
|
|
529
641
|
'.empty': {
|
|
530
|
-
padding: '
|
|
642
|
+
padding: '50px',
|
|
531
643
|
textAlign: 'center'
|
|
532
644
|
},
|
|
533
645
|
'.content': {
|
|
534
|
-
|
|
535
|
-
|
|
646
|
+
flexGrow: '1',
|
|
647
|
+
overflowY: 'auto',
|
|
648
|
+
overflowX: 'hidden',
|
|
649
|
+
maxHeight: 'calc(var(--mdc-dialog-max-height) - 100px)',
|
|
650
|
+
background: 'var(--mdc-theme-background)'
|
|
651
|
+
},
|
|
652
|
+
'.hide': {
|
|
653
|
+
display: 'none'
|
|
654
|
+
},
|
|
655
|
+
'.nav-buttons': {
|
|
656
|
+
display: 'flex',
|
|
657
|
+
justifyContent: 'space-between',
|
|
658
|
+
alignItems: 'center',
|
|
659
|
+
padding: '4px 4px 0px',
|
|
660
|
+
height: '36px'
|
|
661
|
+
},
|
|
662
|
+
'.nav-buttons-space': {
|
|
663
|
+
width: '64px'
|
|
664
|
+
},
|
|
665
|
+
'.nav-buttons-page-label': {
|
|
666
|
+
userSelect: 'none'
|
|
536
667
|
}
|
|
537
668
|
})
|
|
538
669
|
|
|
@@ -542,24 +673,45 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
542
673
|
// .mwcTab({ label: 'Список задач' })
|
|
543
674
|
.mwcTab({ label: 'История задач' }))
|
|
544
675
|
|
|
545
|
-
|
|
676
|
+
openTaskList = oom.div({ class: 'content' }, oom.div({ class: 'empty' }, 'Загрузка ...'))
|
|
677
|
+
historyTaskList = oom.div({ class: 'content hide' })
|
|
678
|
+
|
|
679
|
+
// Параметры навигации по истории
|
|
680
|
+
historyListPage = 0
|
|
681
|
+
historyListLimit = 3
|
|
546
682
|
|
|
547
683
|
template = async () => {
|
|
548
684
|
// if (this.openTaskList.length === 0) {
|
|
549
685
|
// this.tabs({ activeindex: '1' })
|
|
550
686
|
// }
|
|
551
|
-
oom(this, this.tabs, this.
|
|
552
|
-
|
|
687
|
+
oom(this, this.tabs, this.openTaskList, this.historyTaskList)
|
|
688
|
+
|
|
689
|
+
this.tabs.dom.addEventListener('MDCTabBar:activated', (/** @type {CustomEvent<import('@material/mwc-list/mwc-list-foundation').ActionDetail>} */event) => {
|
|
690
|
+
switch (event.detail.index) {
|
|
691
|
+
case 0:
|
|
692
|
+
this.historyTaskList({ innerHTML: '' })
|
|
693
|
+
this.historyTaskList.dom.classList.add('hide')
|
|
694
|
+
this.openTaskList.dom.classList.remove('hide')
|
|
695
|
+
break
|
|
696
|
+
case 1:
|
|
697
|
+
this.historyTaskList({ innerHTML: '' }, oom.div({ class: 'empty' }, 'Загрузка ...'))
|
|
698
|
+
this.openTaskList.dom.classList.add('hide')
|
|
699
|
+
this.historyTaskList.dom.classList.remove('hide')
|
|
700
|
+
this.historyListPage = 0
|
|
701
|
+
this.historyListLimit = 3
|
|
702
|
+
this.buildHistoryList().catch(console.error)
|
|
703
|
+
break
|
|
704
|
+
}
|
|
705
|
+
})
|
|
553
706
|
|
|
554
|
-
this.
|
|
707
|
+
this.openTaskList({ innerHTML: '' }, await this.buildTaskList())
|
|
555
708
|
}
|
|
556
709
|
|
|
557
710
|
/** @returns {Promise<HTMLElement|DocumentFragment>} Вернет готовый список задач с учетом аинхронной загрузки данных */
|
|
558
711
|
async buildTaskList() {
|
|
559
712
|
let taskTist = null
|
|
560
713
|
const openTaskList = (await getListOfOpenCards({
|
|
561
|
-
names: ['Ошибка', 'Задача']
|
|
562
|
-
hasVersion: true
|
|
714
|
+
names: ['Ошибка', 'Задача']
|
|
563
715
|
})).map(card => new GitBranchCard(card))
|
|
564
716
|
|
|
565
717
|
await Promise.all(openTaskList.map(card => card.restoreFromHistory()))
|
|
@@ -567,12 +719,64 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
567
719
|
if (openTaskList.length > 0) {
|
|
568
720
|
taskTist = oom()(...openTaskList)
|
|
569
721
|
} else {
|
|
570
|
-
taskTist = oom.div({ class: 'empty' }, 'Открытых задач
|
|
722
|
+
taskTist = oom.div({ class: 'empty' }, 'Открытых задач не найдено')
|
|
571
723
|
}
|
|
572
724
|
|
|
573
725
|
return taskTist.dom
|
|
574
726
|
}
|
|
575
727
|
|
|
728
|
+
/** Строит компонент списка истории задач */
|
|
729
|
+
async buildHistoryList() {
|
|
730
|
+
const offset = this.historyListPage * this.historyListLimit
|
|
731
|
+
const navButtons = oom.div({ class: 'nav-buttons' })
|
|
732
|
+
const gitBranchHistory = db.table('gitBranchHistory')
|
|
733
|
+
const historyData = await gitBranchHistory
|
|
734
|
+
.orderBy('useDate')
|
|
735
|
+
.reverse()
|
|
736
|
+
.offset(offset)
|
|
737
|
+
.limit(this.historyListLimit + 1)
|
|
738
|
+
.toArray()
|
|
739
|
+
|
|
740
|
+
if (historyData.length > 0) {
|
|
741
|
+
const totalCount = await gitBranchHistory.count()
|
|
742
|
+
const currentSize = offset + Math.min(this.historyListLimit, historyData.length)
|
|
743
|
+
|
|
744
|
+
if (this.historyListPage > 0) {
|
|
745
|
+
navButtons(oom.mwcButton({
|
|
746
|
+
innerHTML: octicons['arrow-left'].toSVG({ width: 24 }),
|
|
747
|
+
onclick: () => {
|
|
748
|
+
--this.historyListPage
|
|
749
|
+
this.buildHistoryList().catch(console.error)
|
|
750
|
+
}
|
|
751
|
+
}))
|
|
752
|
+
} else {
|
|
753
|
+
navButtons(oom.span({ class: 'nav-buttons-space' }))
|
|
754
|
+
}
|
|
755
|
+
navButtons(oom.span(`${offset + 1} - ${currentSize} / ${totalCount}`, {
|
|
756
|
+
class: 'nav-buttons-page-label'
|
|
757
|
+
}))
|
|
758
|
+
if (historyData.length > this.historyListLimit) {
|
|
759
|
+
historyData.pop()
|
|
760
|
+
navButtons(oom.mwcButton({
|
|
761
|
+
innerHTML: octicons['arrow-right'].toSVG({ width: 24 }),
|
|
762
|
+
onclick: () => {
|
|
763
|
+
++this.historyListPage
|
|
764
|
+
this.buildHistoryList().catch(console.error)
|
|
765
|
+
}
|
|
766
|
+
}))
|
|
767
|
+
} else {
|
|
768
|
+
navButtons(oom.span({ class: 'nav-buttons-space' }))
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
this.historyTaskList({ innerHTML: '' }, navButtons, ...historyData.map(card => new GitBranchCard(card)))
|
|
772
|
+
} else if (this.historyListPage > 0) {
|
|
773
|
+
--this.historyListPage
|
|
774
|
+
this.buildHistoryList().catch(console.error)
|
|
775
|
+
} else {
|
|
776
|
+
this.historyTaskList({ innerHTML: '' }, oom.div({ class: 'empty' }, 'Задач в истории не найдено'))
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
576
780
|
}
|
|
577
781
|
|
|
578
782
|
|
|
@@ -595,12 +799,12 @@ toolbar.addButton({
|
|
|
595
799
|
position: 'top',
|
|
596
800
|
filter: { names: ['Ошибка', 'Задача'] },
|
|
597
801
|
title: 'Скопировать имя ветки для Git',
|
|
598
|
-
iconSVG: octicons['git-branch'].toSVG({ width:
|
|
802
|
+
iconSVG: octicons['git-branch'].toSVG({ width: 18 }),
|
|
599
803
|
onclick: card => {
|
|
600
804
|
const gitCard = new GitBranchCardData(card.data)
|
|
601
805
|
|
|
602
806
|
gitCard.restoreFromHistory()
|
|
603
|
-
.then(() => gitCard.copyBranchName()
|
|
807
|
+
.then(() => gitCard.copyBranchName())
|
|
604
808
|
.catch(console.error)
|
|
605
809
|
}
|
|
606
810
|
})
|
|
@@ -608,12 +812,12 @@ toolbar.addButton({
|
|
|
608
812
|
position: 'top',
|
|
609
813
|
filter: { names: ['Ошибка', 'Задача'] },
|
|
610
814
|
title: 'Скопировать описание для Git коммита',
|
|
611
|
-
iconSVG: octicons['git-commit'].toSVG({ width:
|
|
815
|
+
iconSVG: octicons['git-commit'].toSVG({ width: 18 }),
|
|
612
816
|
onclick: card => {
|
|
613
817
|
const gitCard = new GitBranchCardData(card.data)
|
|
614
818
|
|
|
615
819
|
gitCard.restoreFromHistory()
|
|
616
|
-
.then(() => gitCard.copyDescription()
|
|
820
|
+
.then(() => gitCard.copyDescription())
|
|
617
821
|
.catch(console.error)
|
|
618
822
|
}
|
|
619
823
|
})
|
package/lib/popup-dialog.js
CHANGED
|
@@ -47,7 +47,8 @@ export class PopupDialog extends oom.extends(HTMLElement, PopupDialogDefaults) {
|
|
|
47
47
|
'mwc-dialog': {
|
|
48
48
|
'--mdc-dialog-z-index': '10000',
|
|
49
49
|
'--mdc-dialog-max-width': '700px',
|
|
50
|
-
'--mdc-dialog-
|
|
50
|
+
'--mdc-dialog-min-width': '500px',
|
|
51
|
+
'--mdc-dialog-max-height': '700px'
|
|
51
52
|
},
|
|
52
53
|
'header': {
|
|
53
54
|
margin: '-20px -24px 0px -24px',
|
|
@@ -61,25 +62,31 @@ export class PopupDialog extends oom.extends(HTMLElement, PopupDialogDefaults) {
|
|
|
61
62
|
overflow: 'hidden'
|
|
62
63
|
},
|
|
63
64
|
'main': {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column',
|
|
64
67
|
margin: '0px -24px -20px -24px',
|
|
65
68
|
overflow: 'auto',
|
|
66
69
|
maxHeight: 'calc(var(--mdc-dialog-max-height) - 52px)'
|
|
67
70
|
}
|
|
68
71
|
})
|
|
69
72
|
|
|
73
|
+
// Фиксированный минимальный размер диалога по содержимому
|
|
74
|
+
contentMinWidth = 0
|
|
75
|
+
contentMinHeight = 0
|
|
76
|
+
|
|
70
77
|
key = this.options.key
|
|
71
78
|
content = typeof this.options.Element === 'string' ? this.options.Element : new this.options.Element()
|
|
79
|
+
main = oom.main(this.content)
|
|
80
|
+
header = oom.header(oom
|
|
81
|
+
.span(this.options.title)
|
|
82
|
+
.mwcIconButton({ icon: 'close', onclick: () => this.close() }))
|
|
72
83
|
|
|
73
84
|
template = async () => {
|
|
74
85
|
// Открытый диалог может быть только один
|
|
75
86
|
this.id = 'sc-popup-dialog'
|
|
76
87
|
/** @type {import('@material/mwc-dialog').Dialog} */// @ts-ignore
|
|
77
88
|
this.dialog = oom
|
|
78
|
-
.mwcDialog({ hideActions: true },
|
|
79
|
-
.header(oom
|
|
80
|
-
.span(this.options.title)
|
|
81
|
-
.mwcIconButton({ icon: 'close', onclick: () => this.close() }))
|
|
82
|
-
.main(this.content))
|
|
89
|
+
.mwcDialog({ hideActions: true }, this.header, this.main)
|
|
83
90
|
.dom
|
|
84
91
|
|
|
85
92
|
oom(this, this.dialog)
|
|
@@ -87,6 +94,10 @@ export class PopupDialog extends oom.extends(HTMLElement, PopupDialogDefaults) {
|
|
|
87
94
|
this.dialog.addEventListener('closed', event => this.closed(event))
|
|
88
95
|
|
|
89
96
|
await this.open()
|
|
97
|
+
|
|
98
|
+
this.fixMinimumSize()
|
|
99
|
+
this.observer = new MutationObserver(() => this.fixMinimumSize())
|
|
100
|
+
this.observer.observe(this, { childList: true, subtree: true })
|
|
90
101
|
}
|
|
91
102
|
|
|
92
103
|
/** Функция открытия диалога с асинхронной задержкой, что бы успело построиться дерево компонента */
|
|
@@ -115,6 +126,24 @@ export class PopupDialog extends oom.extends(HTMLElement, PopupDialogDefaults) {
|
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
|
|
129
|
+
/** Фиксирует минимальный размер диалога по содержимому, чтобы избежать дальнейших скачков размера окна */
|
|
130
|
+
fixMinimumSize() {
|
|
131
|
+
const width = Math.max(this.contentMinWidth, this.main.dom.clientWidth)
|
|
132
|
+
const height = Math.max(this.contentMinHeight, this.main.dom.clientHeight)
|
|
133
|
+
|
|
134
|
+
if (this.contentMinWidth !== width || this.contentMinHeight !== height) {
|
|
135
|
+
this.contentMinWidth = width
|
|
136
|
+
this.contentMinHeight = height
|
|
137
|
+
|
|
138
|
+
this.main({
|
|
139
|
+
style: {
|
|
140
|
+
minWidth: `${this.contentMinWidth}px`,
|
|
141
|
+
minHeight: `${this.contentMinHeight}px`
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
118
147
|
}
|
|
119
148
|
|
|
120
149
|
oom.define(PopupDialog)
|
package/lib/saby-lib/edo.js
CHANGED
|
@@ -91,6 +91,16 @@ function parseRichEditorJSON(json) {
|
|
|
91
91
|
* @property {boolean} [hasVersion] Документ включен хотя бы в 1 веху
|
|
92
92
|
* @property {boolean} [duplicates] Показать/скрыть из ответа документы которые открыты дважды
|
|
93
93
|
*/
|
|
94
|
+
/**
|
|
95
|
+
* @typedef ReactWasabyControl filter
|
|
96
|
+
* @property {{record:{get:(name:string)=>any}}} props Опции компонента
|
|
97
|
+
*/
|
|
98
|
+
/**
|
|
99
|
+
* @typedef WasabyControl Реализация компонентов платформы Wasaby в в составе DOM элемента
|
|
100
|
+
* @property {HTMLElement} element Ссылка на DOM элемент
|
|
101
|
+
* @property {{record:{get:(name:string)=>any}}} options Опции компонента
|
|
102
|
+
* @property {ReactWasabyControl} control Доп. вложенность контрола, для реализации на React
|
|
103
|
+
*/
|
|
94
104
|
/**
|
|
95
105
|
* Собирает из верстки страницы список открытых в данный момент карточек документов ЭДО
|
|
96
106
|
*
|
|
@@ -107,10 +117,10 @@ export function getListOfOpenCards(filter = {}) {
|
|
|
107
117
|
const { controlNodes } = cardNode
|
|
108
118
|
|
|
109
119
|
if (controlNodes) {
|
|
110
|
-
/** @type {
|
|
120
|
+
/** @type {WasabyControl} */
|
|
111
121
|
const control = controlNodes.at()
|
|
112
122
|
const { element } = control
|
|
113
|
-
const record = control
|
|
123
|
+
const record = control.options?.record || control.control?.props?.record
|
|
114
124
|
const data = record && {
|
|
115
125
|
id: record.get('@Документ'),
|
|
116
126
|
number: record.get('Номер'),
|
|
@@ -120,10 +130,14 @@ export function getListOfOpenCards(filter = {}) {
|
|
|
120
130
|
url: '',
|
|
121
131
|
author: record.get('ЛицоСоздал.Название') || record.get('Сотрудник.Название'),
|
|
122
132
|
milestones: [],
|
|
123
|
-
version: '
|
|
133
|
+
version: `${(new Date().getFullYear() + '').slice(-2)}.0000`,
|
|
124
134
|
description: ''
|
|
125
135
|
}
|
|
126
136
|
|
|
137
|
+
if (!data) {
|
|
138
|
+
continue
|
|
139
|
+
}
|
|
140
|
+
|
|
127
141
|
if (filter.id && filter.id !== data.id) {
|
|
128
142
|
continue
|
|
129
143
|
}
|
package/lib/saby-lib/toolbar.js
CHANGED
|
@@ -23,10 +23,10 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
23
23
|
marginBottom: '6px'
|
|
24
24
|
},
|
|
25
25
|
'saby-customizer-toolbar.top': {
|
|
26
|
-
|
|
26
|
+
marginLeft: '16px'
|
|
27
27
|
},
|
|
28
28
|
'.button': {
|
|
29
|
-
padding: '
|
|
29
|
+
padding: '2px',
|
|
30
30
|
color: 'var(--secondary_icon-color)',
|
|
31
31
|
fill: 'var(--secondary_icon-color)',
|
|
32
32
|
cursor: 'pointer',
|
|
@@ -42,7 +42,10 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
42
42
|
'saby-customizer-toolbar.top .button': {
|
|
43
43
|
height: '20px',
|
|
44
44
|
width: '20px',
|
|
45
|
-
marginRight: '
|
|
45
|
+
marginRight: '8px'
|
|
46
|
+
},
|
|
47
|
+
'saby-customizer-toolbar.top .button:last-child': {
|
|
48
|
+
marginRight: '0'
|
|
46
49
|
},
|
|
47
50
|
'.button:hover': {
|
|
48
51
|
color: 'var(--link_hover_text-color)',
|
|
@@ -103,7 +106,8 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
103
106
|
* Добавляет в вертску сайта глобальный контейнер в панели для добавления кнопок
|
|
104
107
|
*/
|
|
105
108
|
static addGlobalContainer() {
|
|
106
|
-
const sabyPageRightPanel = document.querySelector('.sabyPage-MainLayout__rightPanel .sabyPage-MainLayout__wrapper')
|
|
109
|
+
const sabyPageRightPanel = document.querySelector('.sabyPage-MainLayout__rightPanel .sabyPage-MainLayout__wrapper') ||
|
|
110
|
+
document.querySelector('.sabyPage-MainLayout__mainContent .sabyPage-widgets__rightPanel__bottomButtons .sabyPage-widgets__wrapper')
|
|
107
111
|
|
|
108
112
|
if (sabyPageRightPanel) {
|
|
109
113
|
ToolbarContainer.globalContainer = new ToolbarContainer({ global: true })
|
|
@@ -117,7 +121,7 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
117
121
|
|
|
118
122
|
if (popupContainer) {
|
|
119
123
|
this.observer = new MutationObserver(() => this.addTaskPanelContainer())
|
|
120
|
-
this.observer.observe(popupContainer, { childList: true })
|
|
124
|
+
this.observer.observe(popupContainer, { childList: true, subtree: true })
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
127
|
|
|
@@ -139,7 +143,13 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
if (topPanel) {
|
|
142
|
-
|
|
146
|
+
/** @type {ToolbarContainer} */
|
|
147
|
+
let topSidebar = topPanel.querySelector('saby-customizer-toolbar')
|
|
148
|
+
|
|
149
|
+
if (topSidebar && topSidebar.options?.card.data.id !== card.data.id) {
|
|
150
|
+
topSidebar.remove()
|
|
151
|
+
topSidebar = null
|
|
152
|
+
}
|
|
143
153
|
|
|
144
154
|
if (!topSidebar) {
|
|
145
155
|
topPanel.prepend(new ToolbarContainer({ card, position: 'top' }))
|
package/material.js
CHANGED
|
@@ -5725,7 +5725,7 @@ class ButtonBase extends LitElement {
|
|
|
5725
5725
|
@mouseleave="${this.handleRippleMouseLeave}"
|
|
5726
5726
|
@touchstart="${this.handleRippleActivate}"
|
|
5727
5727
|
@touchend="${this.handleRippleDeactivate}"
|
|
5728
|
-
@touchcancel="${this.handleRippleDeactivate}">
|
|
5728
|
+
@touchcancel="${this.handleRippleDeactivate}">
|
|
5729
5729
|
${this.renderOverlay()}
|
|
5730
5730
|
${this.renderRipple()}
|
|
5731
5731
|
<span class="leading-icon">
|
package/octicons.js
CHANGED
|
@@ -2603,6 +2603,21 @@ var require$$0 = {
|
|
|
2603
2603
|
},
|
|
2604
2604
|
clock: clock,
|
|
2605
2605
|
code: code,
|
|
2606
|
+
"code-of-conduct": {
|
|
2607
|
+
name: "code-of-conduct",
|
|
2608
|
+
keywords: [
|
|
2609
|
+
],
|
|
2610
|
+
heights: {
|
|
2611
|
+
"16": {
|
|
2612
|
+
width: 16,
|
|
2613
|
+
path: "<path fill-rule=\"evenodd\" d=\"M8.048 2.241c.964-.709 2.079-1.238 3.325-1.241a4.613 4.613 0 013.282 1.355c.41.408.757.86.996 1.428.238.568.348 1.206.347 1.968 0 2.193-1.505 4.254-3.081 5.862-1.496 1.526-3.213 2.796-4.249 3.563l-.22.163a.75.75 0 01-.895 0l-.221-.163c-1.036-.767-2.753-2.037-4.249-3.563C1.51 10.008.007 7.952.002 5.762a4.614 4.614 0 011.353-3.407C3.123.585 6.223.537 8.048 2.24zm-1.153.983c-.81.78-1.546 1.669-2.166 2.417-.184.222-.358.432-.52.623a.75.75 0 00.04 1.016c.35.35.697.697 1.043 1.047.866.875 2.292.914 3.185.032.264-.26.534-.528.802-.797.694-.694 1.8-.701 2.474-.03L12.92 8.7l.283.284c-.244.334-.515.666-.81.995l-1.384-1.28A.75.75 0 109.99 9.802l1.357 1.252c-.325.31-.656.606-.984.887l-1.48-1.366a.75.75 0 10-1.018 1.102L9.191 12.9c-.433.34-.838.643-1.191.905-1.04-.773-2.537-1.907-3.846-3.242C2.611 8.99 1.502 7.306 1.502 5.75a3.114 3.114 0 01.913-2.335c1.159-1.158 3.23-1.224 4.48-.191zm7.112 4.442c.313-.65.491-1.293.491-1.916v-.001c0-.614-.088-1.045-.23-1.385-.143-.339-.357-.633-.673-.949a3.113 3.113 0 00-2.218-.915c-1.092.003-2.165.627-3.226 1.602-.823.755-1.554 1.637-2.228 2.45l-.127.154.562.566a.756.756 0 001.066.02l.794-.79c1.258-1.258 3.312-1.31 4.594-.032.396.394.792.791 1.173 1.173l.022.023z\"></path>"
|
|
2614
|
+
},
|
|
2615
|
+
"24": {
|
|
2616
|
+
width: 24,
|
|
2617
|
+
path: "<path fill-rule=\"evenodd\" d=\"M2.828 4.328C5.26 1.896 9.5 1.881 11.935 4.317c.024.024.046.05.067.076 1.391-1.078 2.993-1.886 4.777-1.89a6.216 6.216 0 014.424 1.825c.559.56 1.023 1.165 1.34 1.922.318.756.47 1.617.468 2.663 0 2.972-2.047 5.808-4.269 8.074-2.098 2.14-4.507 3.924-5.974 5.009l-.311.23a.752.752 0 01-.897 0l-.312-.23c-1.466-1.085-3.875-2.869-5.973-5.009-2.22-2.263-4.264-5.095-4.27-8.063v.012-.024.012a6.217 6.217 0 011.823-4.596zm8.033 1.042c-1.846-1.834-5.124-1.823-6.969.022a4.713 4.713 0 00-1.382 3.52c0 2.332 1.65 4.79 3.839 7.022 1.947 1.986 4.184 3.66 5.66 4.752a79.983 79.983 0 002.159-1.645l-2.14-1.974a.752.752 0 011.02-1.106l2.295 2.118c.616-.52 1.242-1.08 1.85-1.672l-2.16-1.992a.752.752 0 011.021-1.106l2.188 2.02a18.992 18.992 0 001.528-1.877l-.585-.586-1.651-1.652c-1.078-1.074-2.837-1.055-3.935.043-.379.38-.76.758-1.132 1.126-1.14 1.124-2.96 1.077-4.07-.043-.489-.495-.98-.988-1.475-1.482a.752.752 0 01-.04-1.019c.234-.276.483-.576.745-.893.928-1.12 2.023-2.442 3.234-3.576zm9.725 6.77c.579-1.08.92-2.167.92-3.228.002-.899-.128-1.552-.35-2.08-.22-.526-.551-.974-1.017-1.44a4.71 4.71 0 00-3.356-1.384c-1.66.004-3.25.951-4.77 2.346-1.18 1.084-2.233 2.353-3.188 3.506l-.351.423c.331.332.663.664.993.998a1.375 1.375 0 001.943.03c.37-.365.748-.74 1.125-1.118 1.662-1.663 4.373-1.726 6.06-.045.56.558 1.12 1.12 1.658 1.658l.333.334z\"></path>"
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
},
|
|
2606
2621
|
"code-review": {
|
|
2607
2622
|
name: "code-review",
|
|
2608
2623
|
keywords: [
|
package/package.json
CHANGED
package/userscript.js
CHANGED
|
@@ -16,7 +16,8 @@ import { oom } from '@notml/core'
|
|
|
16
16
|
// Библиотеки компонентов плагина
|
|
17
17
|
// TODO: Перевести на опциональную загрузку
|
|
18
18
|
// await import('./lib/dashboard.js')
|
|
19
|
-
await import('
|
|
19
|
+
await import('saby-customizer/features/doc-copy-link.js')
|
|
20
|
+
await import('saby-customizer/features/git-branch.js')
|
|
20
21
|
|
|
21
22
|
// @font-face doesn't work with Shadow DOM https://github.com/mdn/interactive-examples/issues/887
|
|
22
23
|
// https://wiki.csswg.org/spec/css-scoping
|