bfg-common 1.5.130 → 1.5.131

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.
@@ -76,7 +76,6 @@
76
76
  :objects-data="props.objectsData"
77
77
  :valid-date-end="props.validDateEnd"
78
78
  :format-date="props.formatDate"
79
- :options-names="optionsNames"
80
79
  :view-options="viewOptions"
81
80
  :period-options="periodOptions"
82
81
  @save-option-name="onSaveOptionName"
@@ -443,7 +443,7 @@ const onSaveOptions = (name: string): void => {
443
443
  const prefix = props.project === 'sphere'
444
444
  useLocalStorage(`${name}ChartOptions`, saveOptionsData, prefix)
445
445
  optionsNames.value = getCurrentOptionsStorageFunc(routeType, props.project)
446
- localSelectedChartOptionName.value = name
446
+ // localSelectedChartOptionName.value = name
447
447
  emits('save-option-name')
448
448
  }
449
449
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.130",
4
+ "version": "1.5.131",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -3,22 +3,69 @@ import type { DirectiveBinding } from '@vue/runtime-core'
3
3
  export default defineNuxtPlugin((nuxtApp) => {
4
4
  nuxtApp.vueApp.directive('development', {
5
5
  mounted(el: HTMLElement, binding: DirectiveBinding) {
6
- if (!binding.value) return
7
-
8
- el.setAttribute('title', 'In development')
9
- el.setAttribute('disabled', 'true')
10
- el.style.opacity = '0.6'
11
- el.style.cursor = 'not-allowed'
12
-
13
- el.addEventListener(
14
- 'click',
15
- (e: MouseEvent) => {
16
- e.preventDefault()
17
- e.stopPropagation()
18
- return false
19
- },
20
- true
21
- )
6
+ applyDevelopmentState(el, binding.value)
7
+ },
8
+ updated(el: HTMLElement, binding: DirectiveBinding) {
9
+ applyDevelopmentState(el, binding.value)
10
+ },
11
+ unmounted(el: HTMLElement) {
12
+ cleanupDevelopment(el)
22
13
  },
23
14
  })
24
15
  })
16
+ function applyDevelopmentState(el: HTMLElement, isDevelopment: boolean) {
17
+ cleanupDevelopment(el)
18
+ if (!isDevelopment) return
19
+
20
+ el.setAttribute('title', 'In development')
21
+ el.setAttribute('disabled', 'true')
22
+ el.style.opacity = '0.6'
23
+ el.style.cursor = 'not-allowed'
24
+
25
+ // Оборачиваем, чтобы не навешивать несколько обработчиков
26
+ const preventClick = (e: MouseEvent) => {
27
+ e.preventDefault()
28
+ e.stopPropagation()
29
+ return false
30
+ }
31
+
32
+ el.addEventListener('click', preventClick, true)
33
+
34
+ // Сохраняем ссылку на обработчик в DOM-элементе, если понадобится удалить потом
35
+ ;(el as any)._developmentClickHandler = preventClick
36
+ }
37
+
38
+ function cleanupDevelopment(el: HTMLElement) {
39
+ el.removeAttribute('title')
40
+ el.style.opacity = ''
41
+ el.style.cursor = ''
42
+
43
+ const handler = (el as any)._developmentClickHandler
44
+ if (handler) {
45
+ el.removeEventListener('click', handler, true)
46
+ delete (el as any)._developmentClickHandler
47
+ }
48
+ }
49
+
50
+ // export default defineNuxtPlugin((nuxtApp) => {
51
+ // nuxtApp.vueApp.directive('development', {
52
+ // mounted(el: HTMLElement, binding: DirectiveBinding) {
53
+ // if (!binding.value) return
54
+ //
55
+ // el.setAttribute('title', 'In development')
56
+ // el.setAttribute('disabled', 'true')
57
+ // el.style.opacity = '0.6'
58
+ // el.style.cursor = 'not-allowed'
59
+ //
60
+ // el.addEventListener(
61
+ // 'click',
62
+ // (e: MouseEvent) => {
63
+ // e.preventDefault()
64
+ // e.stopPropagation()
65
+ // return false
66
+ // },
67
+ // true
68
+ // )
69
+ // },
70
+ // })
71
+ // })