bfg-common 1.5.905 → 1.5.907

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.
@@ -3398,7 +3398,7 @@
3398
3398
  "once": "Once",
3399
3399
  "selectFrequency": "Select Frequency",
3400
3400
  "frequency": "Frequency",
3401
- "delayMinutes": "Delay (Minutes)",
3401
+ "delayMinutes": "Delay (Minutes)"
3402
3402
  },
3403
3403
  "license": {
3404
3404
  "limits": "Limits",
@@ -1,5 +1,4 @@
1
1
  <template>
2
- <div class="frequency">
3
2
  <common-pages-scheduled-tasks-modals-common-frequency-after-startup
4
3
  v-if="props.type === 'after-startup'"
5
4
  v-model="model"
@@ -27,7 +26,6 @@
27
26
  v-model="model"
28
27
  :type="props.type"
29
28
  />
30
- </div>
31
29
  </template>
32
30
 
33
31
  <script lang="ts" setup>
@@ -48,12 +46,3 @@ const showTimeOn = computed<boolean>(() => {
48
46
  return ['once', 'week', 'month'].includes(props.type)
49
47
  })
50
48
  </script>
51
-
52
- <style lang="scss" scoped>
53
- @import 'bfg-common/assets/scss/common/mixins.scss';
54
- .frequency {
55
- width: 100%;
56
- &__interval {
57
- }
58
- }
59
- </style>
@@ -1,38 +1,11 @@
1
1
  <template>
2
- <div class="end-time">
3
- <common-select-input
4
- v-model="selectedFrequencyEndMode"
5
- :label="localization.scheduledTasks.end"
6
- :data="frequencyEndTimeOptions"
7
- :class="[
8
- 'end-time__select-input',
9
- selectedFrequencyEndMode === 'on' && 'enabled',
10
- ]"
11
- test-id="frequency-ent-time"
12
- >
13
- <template #options>
14
- <label
15
- v-if="selectedFrequencyEndMode === 'on'"
16
- :class="[
17
- 'tooltip tooltip-validation tooltip-xs tooltip-top-left frequency-end-date',
18
- schedulerEndDateErrorText && 'invalid',
19
- ]"
20
- for="frequency-end-date"
21
- >
22
- <input
23
- id="frequency-end-date"
24
- v-model.lazy="modelFrequencyLocal.frg_end_time"
25
- data-id="frequency-end-date-input"
26
- type="datetime-local"
27
- />
28
-
29
- <span class="tooltip-content">
30
- {{ schedulerEndDateErrorText }}
31
- </span>
32
- </label>
33
- </template>
34
- </common-select-input>
35
- </div>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model="modelFrequencyLocal"
5
+ v-model:selected-end-mode="selectedFrequencyEndMode"
6
+ :end-options="frequencyEndTimeOptions"
7
+ :type="props.type"
8
+ />
36
9
  </template>
37
10
 
38
11
  <script lang="ts" setup>
@@ -50,7 +23,14 @@ const props = defineProps<{
50
23
  }>()
51
24
 
52
25
  const localization = computed<UI_I_Localization>(() => useLocal())
53
- // const { $store, $formattedDate, $isDate, $getUnixByDate }: any = useNuxtApp()
26
+ const { $store }: any = useNuxtApp()
27
+
28
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
29
+ const currentComponent = computed(() =>
30
+ isNewView.value
31
+ ? defineAsyncComponent(() => import('./New.vue'))
32
+ : defineAsyncComponent(() => import('./Old.vue'))
33
+ )
54
34
 
55
35
  const frequencyEndTimeOptions = computed<UI_I_SelectInputItem[]>(() =>
56
36
  frequencyEndTimeFunc(localization.value)
@@ -79,37 +59,3 @@ watch(
79
59
  }
80
60
  )
81
61
  </script>
82
-
83
- <style lang="scss" scoped>
84
- @import 'bfg-common/assets/scss/common/mixins.scss';
85
- .end-time {
86
- margin-top: 10px;
87
- &__select-input {
88
- &.enabled {
89
- row-gap: 15px;
90
- &.clr-flex-row {
91
- flex-direction: column !important;
92
- align-items: flex-start;
93
- }
94
- :deep(.select-input__inner) {
95
- flex-direction: row;
96
- }
97
- }
98
-
99
- :deep(.select-input__label) {
100
- font-weight: 400;
101
- }
102
- :deep(.select) {
103
- max-width: max-content !important;
104
- }
105
- }
106
- .frequency-end-date {
107
- margin-left: 15px;
108
- }
109
- }
110
- .tooltip {
111
- & > .tooltip-content {
112
- width: 200px;
113
- }
114
- }
115
- </style>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div class="frequency-end-time">
3
+ <div>
4
+ <h2>{{ localization.scheduledTasks.end }}</h2>
5
+ <ui-radio
6
+ v-for="(option, key) in props.endOptions"
7
+ :key="key"
8
+ v-model="endTimeModeLocal"
9
+ :label="option.label"
10
+ :test-id="option.testId"
11
+ :value="option.value"
12
+ size="md"
13
+ >
14
+ </ui-radio>
15
+ </div>
16
+
17
+ <ui-input-with-datepicker
18
+ id="frequency-end-date"
19
+ v-model="modelFrequencyLocal.frg_end_time"
20
+ :format="datepickerFormat"
21
+ test-id="frequency-end-date-input"
22
+ time-format="12"
23
+ :error="''"
24
+ :error-timepicker="''"
25
+ />
26
+ </div>
27
+ </template>
28
+
29
+ <script lang="ts" setup>
30
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
31
+ import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
32
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
33
+ import { getUiDatepickerFormatByLanguage } from '~/lib/utils/date'
34
+
35
+ const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
36
+ required: true,
37
+ })
38
+ const endTimeModeLocal = defineModel<'never' | 'on'>('selectedEndMode', {
39
+ required: true,
40
+ })
41
+ const props = defineProps<{
42
+ endOptions: UI_I_SelectInputItem[]
43
+ type: string
44
+ }>()
45
+
46
+ const localization = computed<UI_I_Localization>(() => useLocal())
47
+
48
+ const datepickerFormat = computed<string>(
49
+ () => getUiDatepickerFormatByLanguage('en_US') // TODO из пропс должен приходить язык
50
+ )
51
+ </script>
52
+
53
+ <style lang="scss" scoped>
54
+ .frequency-end-time {
55
+ }
56
+ </style>
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div class="end-time">
3
+ <common-select-input
4
+ v-model="endTimeModeLocal"
5
+ :label="localization.scheduledTasks.end"
6
+ :data="props.endOptions"
7
+ :class="[
8
+ 'end-time__select-input',
9
+ endTimeModeLocal === 'on' && 'enabled',
10
+ ]"
11
+ test-id="frequency-ent-time"
12
+ >
13
+ <template #options>
14
+ <label
15
+ v-if="endTimeModeLocal === 'on'"
16
+ :class="[
17
+ 'tooltip tooltip-validation tooltip-xs tooltip-top-left frequency-end-date',
18
+ schedulerEndDateErrorText && 'invalid',
19
+ ]"
20
+ for="frequency-end-date"
21
+ >
22
+ <input
23
+ id="frequency-end-date"
24
+ v-model.lazy="modelFrequencyLocal.frg_end_time"
25
+ data-id="frequency-end-date-input"
26
+ type="datetime-local"
27
+ />
28
+
29
+ <span class="tooltip-content">
30
+ {{ schedulerEndDateErrorText }}
31
+ </span>
32
+ </label>
33
+ </template>
34
+ </common-select-input>
35
+ </div>
36
+ </template>
37
+
38
+ <script lang="ts" setup>
39
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
40
+ import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
41
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
42
+ import { validateDate } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
43
+
44
+ const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
45
+ required: true,
46
+ })
47
+ const endTimeModeLocal = defineModel<'never' | 'on'>('selectedEndMode', {
48
+ required: true,
49
+ })
50
+ const props = defineProps<{
51
+ endOptions: UI_I_SelectInputItem[]
52
+ type: string
53
+ }>()
54
+
55
+ const localization = computed<UI_I_Localization>(() => useLocal())
56
+ // const { $store, $formattedDate, $isDate, $getUnixByDate }: any = useNuxtApp()
57
+
58
+ const schedulerEndDateErrorText = computed<string>(() => {
59
+ const { frg_end_time, frg_start_on_time } = modelFrequencyLocal.value
60
+ return !frg_end_time
61
+ ? localization.value.common.fieldRequired
62
+ : validateDate(
63
+ localization.value,
64
+ frg_end_time,
65
+ frg_start_on_time,
66
+ props.type
67
+ )
68
+ })
69
+ watch(
70
+ [schedulerEndDateErrorText, endTimeModeLocal],
71
+ ([newValue1, newValue2]: [string, 'never' | 'on']) => {
72
+ modelFrequencyLocal.value.isValid =
73
+ newValue2 === 'never' ? false : !!newValue1
74
+
75
+ newValue2 === 'never' && (modelFrequencyLocal.value.frg_end_time = '')
76
+ }
77
+ )
78
+ </script>
79
+
80
+ <style lang="scss" scoped>
81
+ @import 'bfg-common/assets/scss/common/mixins.scss';
82
+ .end-time {
83
+ margin-top: 10px;
84
+ &__select-input {
85
+ &.enabled {
86
+ row-gap: 15px;
87
+ &.clr-flex-row {
88
+ flex-direction: column !important;
89
+ align-items: flex-start;
90
+ }
91
+ :deep(.select-input__inner) {
92
+ flex-direction: row;
93
+ }
94
+ }
95
+
96
+ :deep(.select-input__label) {
97
+ font-weight: 400;
98
+ }
99
+ :deep(.select) {
100
+ max-width: max-content !important;
101
+ }
102
+ }
103
+ .frequency-end-date {
104
+ margin-left: 15px;
105
+ }
106
+ }
107
+ .tooltip {
108
+ & > .tooltip-content {
109
+ width: 200px;
110
+ }
111
+ }
112
+ </style>
@@ -3,7 +3,7 @@
3
3
  <div>
4
4
  <h2>{{ localization.common.on }}</h2>
5
5
  <ui-input-with-datepicker
6
- id="events-filter-time-range-date-to"
6
+ id="frequency-on-date"
7
7
  v-model="scheduledTaskFormLocal.frg_on_time"
8
8
  :format="datepickerFormat"
9
9
  test-id="frequency-on-date-input"
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div class="frequency-start-on">
3
+ <div>
4
+ <h2>{{ localization.common.start }}</h2>
5
+ <ui-input-with-datepicker
6
+ id="frequency-start-on-date"
7
+ v-model="modelFrequencyLocal.frg_start_on_time"
8
+ :format="datepickerFormat"
9
+ test-id="frequency-start-on-date-input"
10
+ time-format="12"
11
+ :error="''"
12
+ :error-timepicker="''"
13
+ />
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
20
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
21
+ import { getUiDatepickerFormatByLanguage } from '~/lib/utils/date'
22
+
23
+ const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
24
+ required: true,
25
+ })
26
+
27
+ const localization = computed<UI_I_Localization>(() => useLocal())
28
+
29
+ const datepickerFormat = computed<string>(
30
+ () => getUiDatepickerFormatByLanguage('en_US') // TODO из пропс должен приходить язык
31
+ )
32
+ </script>
33
+
34
+ <style lang="scss" scoped>
35
+ .frequency-start-on {
36
+ grid-column: span 2;
37
+ h2 {
38
+ font-family: 'Inter', sans-serif;
39
+ color: var(--title-form-first-color);
40
+ font-size: 14px;
41
+ font-weight: 500;
42
+ line-height: 18px;
43
+ margin-bottom: 12px;
44
+ }
45
+ }
46
+ </style>
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="start-on">
3
+ <label class="clr-control-label clr-col-2 pl-0 start-on__label">
4
+ {{ localization.scheduledTasks.startOn }}
5
+ </label>
6
+
7
+ <label
8
+ :class="[
9
+ 'tooltip tooltip-validation tooltip-xs tooltip-top-left',
10
+ schedulerStartOnErrorText && 'invalid',
11
+ ]"
12
+ for="frequency-start-on-date"
13
+ >
14
+ <input
15
+ id="frequency-start-on-date"
16
+ v-model.lazy="modelFrequencyLocal.frg_start_on_time"
17
+ data-id="frequency-start-on-date-input"
18
+ type="datetime-local"
19
+ />
20
+
21
+ <span class="tooltip-content">
22
+ {{ schedulerStartOnErrorText }}
23
+ </span>
24
+ </label>
25
+ </div>
26
+ </template>
27
+
28
+ <script lang="ts" setup>
29
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
30
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
31
+ import { validateDate } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
32
+
33
+ const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
34
+ required: true,
35
+ })
36
+
37
+
38
+ const localization = computed<UI_I_Localization>(() => useLocal())
39
+ // const { $formattedDate, $isDate, $getUnixByDate }: any = useNuxtApp()
40
+
41
+ const schedulerStartOnErrorText = computed<string>(() => {
42
+ return !modelFrequencyLocal.value.frg_start_on_time
43
+ ? localization.value.common.fieldRequired
44
+ : validateDate(
45
+ localization.value,
46
+ modelFrequencyLocal.value.frg_start_on_time
47
+ )
48
+ })
49
+ watch(
50
+ schedulerStartOnErrorText,
51
+ (newValue: string) => {
52
+ modelFrequencyLocal.value.isValid = !!newValue
53
+ },
54
+ { immediate: true }
55
+ )
56
+ </script>
57
+
58
+ <style lang="scss" scoped>
59
+ @import 'bfg-common/assets/scss/common/mixins.scss';
60
+ .start-on {
61
+ @include flex($align: center);
62
+ margin-top: 10px;
63
+ &__select-input {
64
+ :deep(.select-input__label) {
65
+ font-weight: 400;
66
+ }
67
+ :deep(.select) {
68
+ max-width: 80px !important;
69
+ }
70
+ }
71
+ }
72
+ .tooltip {
73
+ & > .tooltip-content {
74
+ width: 200px;
75
+ }
76
+ }
77
+ </style>
@@ -1,28 +1,9 @@
1
1
  <template>
2
- <div class="start-on">
3
- <label class="clr-control-label clr-col-2 pl-0 start-on__label">
4
- {{ localization.scheduledTasks.startOn }}
5
- </label>
6
-
7
- <label
8
- :class="[
9
- 'tooltip tooltip-validation tooltip-xs tooltip-top-left',
10
- schedulerStartOnErrorText && 'invalid',
11
- ]"
12
- for="frequency-start-on-date"
13
- >
14
- <input
15
- id="frequency-start-on-date"
16
- v-model.lazy="modelFrequencyLocal.frg_start_on_time"
17
- data-id="frequency-start-on-date-input"
18
- type="datetime-local"
19
- />
20
-
21
- <span class="tooltip-content">
22
- {{ schedulerStartOnErrorText }}
23
- </span>
24
- </label>
25
- </div>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model="modelFrequencyLocal"
5
+ @vue:mounted="onSetDefaultDateTime"
6
+ />
26
7
  </template>
27
8
 
28
9
  <script lang="ts" setup>
@@ -34,11 +15,18 @@ const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
34
15
  required: true,
35
16
  })
36
17
 
37
- const { $formattedDatetime }: any = useNuxtApp()
38
-
39
18
  const localization = computed<UI_I_Localization>(() => useLocal())
19
+ const { $formattedDatetime }: any = useNuxtApp()
20
+ const { $store }: any = useNuxtApp()
40
21
  // const { $formattedDate, $isDate, $getUnixByDate }: any = useNuxtApp()
41
22
 
23
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
24
+ const currentComponent = computed(() =>
25
+ isNewView.value
26
+ ? defineAsyncComponent(() => import('./New.vue'))
27
+ : defineAsyncComponent(() => import('./Old.vue'))
28
+ )
29
+
42
30
  const schedulerStartOnErrorText = computed<string>(() => {
43
31
  return !modelFrequencyLocal.value.frg_start_on_time
44
32
  ? localization.value.common.fieldRequired
@@ -55,10 +43,7 @@ watch(
55
43
  { immediate: true }
56
44
  )
57
45
 
58
- onMounted(() => {
59
- setDefaultDateTime()
60
- })
61
- const setDefaultDateTime = () => {
46
+ const onSetDefaultDateTime = () => {
62
47
  modelFrequencyLocal.value.frg_start_on_time = $formattedDatetime(new Date(), {
63
48
  formatDate: 'yyyy-MM-dd',
64
49
  separator: ' ',
@@ -66,24 +51,3 @@ const setDefaultDateTime = () => {
66
51
  })
67
52
  }
68
53
  </script>
69
-
70
- <style lang="scss" scoped>
71
- @import 'bfg-common/assets/scss/common/mixins.scss';
72
- .start-on {
73
- @include flex($align: center);
74
- margin-top: 10px;
75
- &__select-input {
76
- :deep(.select-input__label) {
77
- font-weight: 400;
78
- }
79
- :deep(.select) {
80
- max-width: 80px !important;
81
- }
82
- }
83
- }
84
- .tooltip {
85
- & > .tooltip-content {
86
- width: 200px;
87
- }
88
- }
89
- </style>
@@ -40,7 +40,9 @@
40
40
 
41
41
  <div
42
42
  class="form__run-frequency"
43
- :class="model.frequency === 'once' && 'grid-single-col'"
43
+ :class="{
44
+ 'grid-single-col': !model.frequency || model.frequency === 'once',
45
+ }"
44
46
  >
45
47
  <div>
46
48
  <h2 class="frequency">
@@ -166,7 +168,7 @@ const frequencyMethodOptionsLocal = computed<UI_I_Dropdown[]>(() =>
166
168
  &__run {
167
169
  &-frequency {
168
170
  display: grid;
169
- grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
171
+ grid-template-columns: 1fr 1fr;
170
172
  grid-gap: 16px;
171
173
  &.grid-single-col {
172
174
  grid-template-columns: 1fr;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.905",
4
+ "version": "1.5.907",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",