saby-customizer 0.0.0-pre.31 → 0.0.0-pre.32
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/git-branch.js +88 -13
- package/lib/saby-lib/edo.js +1 -1
- package/lib/saby-lib/toolbar.js +1 -1
- package/octicons.js +15 -0
- package/package.json +1 -1
package/features/git-branch.js
CHANGED
|
@@ -55,9 +55,7 @@ export 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} Часть имени ветки, зависящая от регламента задачи */
|
|
@@ -249,6 +247,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
249
247
|
marginBottom: '-1px',
|
|
250
248
|
cursor: 'pointer',
|
|
251
249
|
color: 'var(--mdc-theme-primary, #6200ee)',
|
|
250
|
+
whiteSpace: 'nowrap',
|
|
252
251
|
overflow: 'hidden',
|
|
253
252
|
textOverflow: 'ellipsis'
|
|
254
253
|
},
|
|
@@ -260,6 +259,9 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
260
259
|
height: '48px',
|
|
261
260
|
marginTop: '-1px'
|
|
262
261
|
},
|
|
262
|
+
'.branch-sub-name-version': {
|
|
263
|
+
width: '132px'
|
|
264
|
+
},
|
|
263
265
|
'.actions': {
|
|
264
266
|
display: 'flex',
|
|
265
267
|
marginLeft: '12px'
|
|
@@ -306,6 +308,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
306
308
|
}
|
|
307
309
|
|
|
308
310
|
data = new GitBranchCardData(this.options.data)
|
|
311
|
+
versionsList = this.data.milestones.concat(['Произвольная'])
|
|
309
312
|
|
|
310
313
|
elements = {
|
|
311
314
|
/** @type {HTMLSpanElement} */
|
|
@@ -339,13 +342,23 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
339
342
|
oninput: () => this.oninputDescription()
|
|
340
343
|
}).dom,
|
|
341
344
|
/** @type {import('@material/mwc-menu').Menu} */// @ts-ignore
|
|
342
|
-
versions: this.
|
|
345
|
+
versions: this.versionsList.reduce((mwcMenu, item) => {
|
|
343
346
|
return mwcMenu(oom.mwcListItem(item))
|
|
344
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,
|
|
345
358
|
/** @type {HTMLDivElement} */// @ts-ignore
|
|
346
359
|
branchButton: oom.div({
|
|
347
360
|
class: 'version-button',
|
|
348
|
-
onclick: () =>
|
|
361
|
+
onclick: () => this.editBranchVersion()
|
|
349
362
|
}, this.data.version).dom,
|
|
350
363
|
/** @type {HTMLSpanElement} */
|
|
351
364
|
branchNamePart: oom.span({
|
|
@@ -396,6 +409,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
396
409
|
this.data.version = value
|
|
397
410
|
if (this.data.version === value) {
|
|
398
411
|
this.elements.branchButton.textContent = this.data.version
|
|
412
|
+
this.elements.branchVersionTextfield.value = this.data.version
|
|
399
413
|
this.elements.cardTitle.textContent = this.data.branchTitle
|
|
400
414
|
}
|
|
401
415
|
}
|
|
@@ -441,7 +455,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
441
455
|
template = () => {
|
|
442
456
|
this.elements.versions.anchor = this.elements.branchButton
|
|
443
457
|
this.elements.versions.addEventListener('selected', (/** @type {CustomEvent<import('@material/mwc-list/mwc-list-foundation').ActionDetail>} */event) => {
|
|
444
|
-
this.
|
|
458
|
+
this.selectedVersion(event.detail.index)
|
|
445
459
|
})
|
|
446
460
|
|
|
447
461
|
this.updateBranchNamePart().catch(console.error)
|
|
@@ -484,6 +498,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
484
498
|
.div({ class: 'branch' },
|
|
485
499
|
this.elements.branchButton,
|
|
486
500
|
this.elements.versions,
|
|
501
|
+
this.elements.branchVersionTextfield,
|
|
487
502
|
this.elements.branchNamePart,
|
|
488
503
|
this.elements.branchSubName,
|
|
489
504
|
this.elements.branchSubNameTextfield)
|
|
@@ -512,6 +527,52 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
512
527
|
this.description = this.elements.descriptionTextarea.value
|
|
513
528
|
}
|
|
514
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
|
+
|
|
515
576
|
/** Открывает форму редактирования доп. имени ветки */
|
|
516
577
|
editBranchSubName() {
|
|
517
578
|
this.elements.branchSubName.classList.toggle('hide')
|
|
@@ -542,14 +603,22 @@ class GitBranchCard extends oom.extends(HTMLElement) {
|
|
|
542
603
|
|
|
543
604
|
/** Копирование имени ветки */
|
|
544
605
|
async copyBranchName() {
|
|
545
|
-
|
|
606
|
+
const valid = this.elements.branchSubNameTextfield.checkValidity() &&
|
|
607
|
+
this.elements.branchVersionTextfield.checkValidity()
|
|
608
|
+
|
|
609
|
+
if (valid) {
|
|
546
610
|
await this.data.copyBranchName()
|
|
547
611
|
}
|
|
548
612
|
}
|
|
549
613
|
|
|
550
614
|
/** Копирование описания для git commit */
|
|
551
615
|
async copyDescription() {
|
|
552
|
-
|
|
616
|
+
const valid = this.elements.branchSubNameTextfield.checkValidity() &&
|
|
617
|
+
this.elements.branchVersionTextfield.checkValidity()
|
|
618
|
+
|
|
619
|
+
if (valid) {
|
|
620
|
+
await this.data.copyDescription()
|
|
621
|
+
}
|
|
553
622
|
}
|
|
554
623
|
|
|
555
624
|
/** Восстановление из истории последнего сохраненного состояния карточки */
|
|
@@ -570,7 +639,7 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
570
639
|
static style = oom.style({
|
|
571
640
|
'display': 'contents',
|
|
572
641
|
'.empty': {
|
|
573
|
-
padding: '
|
|
642
|
+
padding: '50px',
|
|
574
643
|
textAlign: 'center'
|
|
575
644
|
},
|
|
576
645
|
'.content': {
|
|
@@ -587,7 +656,8 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
587
656
|
display: 'flex',
|
|
588
657
|
justifyContent: 'space-between',
|
|
589
658
|
alignItems: 'center',
|
|
590
|
-
padding: '4px 4px 0px'
|
|
659
|
+
padding: '4px 4px 0px',
|
|
660
|
+
height: '36px'
|
|
591
661
|
},
|
|
592
662
|
'.nav-buttons-space': {
|
|
593
663
|
width: '64px'
|
|
@@ -641,8 +711,7 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
641
711
|
async buildTaskList() {
|
|
642
712
|
let taskTist = null
|
|
643
713
|
const openTaskList = (await getListOfOpenCards({
|
|
644
|
-
names: ['Ошибка', 'Задача']
|
|
645
|
-
hasVersion: true
|
|
714
|
+
names: ['Ошибка', 'Задача']
|
|
646
715
|
})).map(card => new GitBranchCard(card))
|
|
647
716
|
|
|
648
717
|
await Promise.all(openTaskList.map(card => card.restoreFromHistory()))
|
|
@@ -669,6 +738,9 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
669
738
|
.toArray()
|
|
670
739
|
|
|
671
740
|
if (historyData.length > 0) {
|
|
741
|
+
const totalCount = await gitBranchHistory.count()
|
|
742
|
+
const currentSize = offset + Math.min(this.historyListLimit, historyData.length)
|
|
743
|
+
|
|
672
744
|
if (this.historyListPage > 0) {
|
|
673
745
|
navButtons(oom.mwcButton({
|
|
674
746
|
innerHTML: octicons['arrow-left'].toSVG({ width: 24 }),
|
|
@@ -680,7 +752,7 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
680
752
|
} else {
|
|
681
753
|
navButtons(oom.span({ class: 'nav-buttons-space' }))
|
|
682
754
|
}
|
|
683
|
-
navButtons(oom.span(`${offset + 1} - ${
|
|
755
|
+
navButtons(oom.span(`${offset + 1} - ${currentSize} / ${totalCount}`, {
|
|
684
756
|
class: 'nav-buttons-page-label'
|
|
685
757
|
}))
|
|
686
758
|
if (historyData.length > this.historyListLimit) {
|
|
@@ -697,6 +769,9 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
|
|
|
697
769
|
}
|
|
698
770
|
|
|
699
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)
|
|
700
775
|
} else {
|
|
701
776
|
this.historyTaskList({ innerHTML: '' }, oom.div({ class: 'empty' }, 'Задач в истории не найдено'))
|
|
702
777
|
}
|
package/lib/saby-lib/edo.js
CHANGED
|
@@ -120,7 +120,7 @@ export function getListOfOpenCards(filter = {}) {
|
|
|
120
120
|
url: '',
|
|
121
121
|
author: record.get('ЛицоСоздал.Название') || record.get('Сотрудник.Название'),
|
|
122
122
|
milestones: [],
|
|
123
|
-
version: '
|
|
123
|
+
version: `${(new Date().getFullYear() + '').slice(-2)}.0000`,
|
|
124
124
|
description: ''
|
|
125
125
|
}
|
|
126
126
|
|
package/lib/saby-lib/toolbar.js
CHANGED
|
@@ -145,7 +145,7 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
145
145
|
/** @type {ToolbarContainer} */
|
|
146
146
|
let topSidebar = topPanel.querySelector('saby-customizer-toolbar')
|
|
147
147
|
|
|
148
|
-
if (topSidebar && topSidebar.options?.card.data.
|
|
148
|
+
if (topSidebar && topSidebar.options?.card.data.id !== card.data.id) {
|
|
149
149
|
topSidebar.remove()
|
|
150
150
|
topSidebar = null
|
|
151
151
|
}
|
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: [
|