saby-customizer 0.0.0-pre.32 → 0.0.0-pre.35

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.
@@ -719,7 +719,7 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
719
719
  if (openTaskList.length > 0) {
720
720
  taskTist = oom()(...openTaskList)
721
721
  } else {
722
- taskTist = oom.div({ class: 'empty' }, 'Открытых задач с вехой не найдено')
722
+ taskTist = oom.div({ class: 'empty' }, 'Открытых задач не найдено')
723
723
  }
724
724
 
725
725
  return taskTist.dom
@@ -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 {{element:HTMLElement,options:{record:{get:(name:string)=>any}}}} */
120
+ /** @type {WasabyControl} */
111
121
  const control = controlNodes.at()
112
122
  const { element } = control
113
- const record = control?.options?.record
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('Номер'),
@@ -124,6 +134,10 @@ export function getListOfOpenCards(filter = {}) {
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
  }
@@ -106,7 +106,8 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
106
106
  * Добавляет в вертску сайта глобальный контейнер в панели для добавления кнопок
107
107
  */
108
108
  static addGlobalContainer() {
109
- 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')
110
111
 
111
112
  if (sabyPageRightPanel) {
112
113
  ToolbarContainer.globalContainer = new ToolbarContainer({ global: true })
@@ -117,11 +118,24 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
117
118
  /** Регистрирует обработчик для поиска открытых задач и добавления в них панели */
118
119
  static registerTaskPanelWatcher() {
119
120
  const popupContainer = document.getElementById('popup')
121
+ const pageEntityContainer = document.querySelector('.onlinePage_Entity-wrapper.controls-Popup__dialog-target-container')
122
+ let timeout = null
123
+
124
+ this.observer = new MutationObserver(() => {
125
+ if (!timeout) {
126
+ timeout = setTimeout(() => {
127
+ this.addTaskPanelContainer()
128
+ timeout = null
129
+ }, 100)
130
+ }
131
+ })
120
132
 
121
133
  if (popupContainer) {
122
- this.observer = new MutationObserver(() => this.addTaskPanelContainer())
123
134
  this.observer.observe(popupContainer, { childList: true, subtree: true })
124
135
  }
136
+ if (pageEntityContainer) {
137
+ this.observer.observe(pageEntityContainer, { childList: true, subtree: true })
138
+ }
125
139
  }
126
140
 
127
141
  /** Добавления во все найденные открытые задачи правую панель */