bfg-common 1.5.907 → 1.5.909

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.
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="frequency-end-time">
3
- <div>
4
- <h2>{{ localization.scheduledTasks.end }}</h2>
3
+ <h2>{{ localization.scheduledTasks.end }}</h2>
4
+ <div class="frequency-end-time__radios">
5
5
  <ui-radio
6
6
  v-for="(option, key) in props.endOptions"
7
7
  :key="key"
@@ -15,6 +15,7 @@
15
15
  </div>
16
16
 
17
17
  <ui-input-with-datepicker
18
+ v-if="endTimeModeLocal === 'on'"
18
19
  id="frequency-end-date"
19
20
  v-model="modelFrequencyLocal.frg_end_time"
20
21
  :format="datepickerFormat"
@@ -52,5 +53,21 @@ const datepickerFormat = computed<string>(
52
53
 
53
54
  <style lang="scss" scoped>
54
55
  .frequency-end-time {
56
+ grid-column: span 2;
57
+ &__radios {
58
+ display: flex;
59
+ align-items: center;
60
+ column-gap: 32px;
61
+ margin-bottom: 12px;
62
+ }
63
+
64
+ h2 {
65
+ font-family: 'Inter', sans-serif;
66
+ color: var(--title-form-first-color);
67
+ font-size: 14px;
68
+ font-weight: 500;
69
+ line-height: 18px;
70
+ margin-bottom: 12px;
71
+ }
55
72
  }
56
73
  </style>
@@ -3,7 +3,7 @@
3
3
  :is="currentComponent"
4
4
  v-model="modelFrequencyLocal.frg_interval"
5
5
  :time-interval-error-text="timeIntervalErrorText"
6
- :time-interval-suffix-label="intervalSuffixLabel"
6
+ :interval-suffix-label="intervalSuffixLabel"
7
7
  @init-validation="onInitValidation"
8
8
  />
9
9
  </template>
@@ -2,15 +2,20 @@
2
2
  <div class="frequency-interval">
3
3
  <h2>{{ localization.scheduledTasks.repeatEvery }}</h2>
4
4
  <ui-input
5
- id="ip-address"
5
+ id="frequency-time-interval"
6
6
  v-model="intervalModel"
7
7
  :error="props.timeIntervalErrorText"
8
8
  :placeholder="localization.common.value"
9
9
  test-id="frequency-time-interval-input"
10
10
  autocomplete="off"
11
- type="number"
12
11
  @input="onInitValidation"
13
- ></ui-input>
12
+ >
13
+ <template #icon>
14
+ <span>
15
+ {{ props.intervalSuffixLabel }}
16
+ </span>
17
+ </template>
18
+ </ui-input>
14
19
  </div>
15
20
  </template>
16
21
 
@@ -1,17 +1,22 @@
1
1
  <template>
2
2
  <div class="frequency-on-date">
3
- <div>
4
- <h2>{{ localization.common.on }}</h2>
5
- <ui-input-with-datepicker
6
- id="frequency-on-date"
7
- v-model="scheduledTaskFormLocal.frg_on_time"
8
- :format="datepickerFormat"
9
- test-id="frequency-on-date-input"
10
- time-format="12"
11
- :error="''"
12
- :error-timepicker="''"
13
- />
14
- </div>
3
+ <h2>{{ localization.common.on }}</h2>
4
+
5
+ <common-pages-scheduled-tasks-modals-common-frequency-on-select-week
6
+ v-if="props.type === 'week'"
7
+ v-model="scheduledTaskFormLocal"
8
+ />
9
+
10
+ <ui-input-with-datepicker
11
+ v-if="props.type === 'once'"
12
+ id="frequency-on-date"
13
+ v-model="scheduledTaskFormLocal.frg_on_time"
14
+ :format="datepickerFormat"
15
+ test-id="frequency-on-date-input"
16
+ time-format="12"
17
+ :error="''"
18
+ :error-timepicker="''"
19
+ />
15
20
  </div>
16
21
  </template>
17
22
 
@@ -19,10 +24,16 @@
19
24
  import type { UI_I_Localization } from '~/lib/models/interfaces'
20
25
  import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
21
26
  import { getUiDatepickerFormatByLanguage } from '~/lib/utils/date'
27
+ import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
22
28
 
23
29
  const scheduledTaskFormLocal = defineModel<UI_I_ScheduleNewTasksForm>({
24
30
  required: true,
25
31
  })
32
+ const props = defineProps<{
33
+ type: string
34
+ frequencyOnWeeksDays: UI_I_SelectInputItem[]
35
+ frequencyOnOrdinalNumber: UI_I_SelectInputItem[]
36
+ }>()
26
37
 
27
38
  const localization = computed<UI_I_Localization>(() => useLocal())
28
39
 
@@ -6,14 +6,14 @@
6
6
 
7
7
  <common-pages-scheduled-tasks-modals-common-frequency-on-select-week
8
8
  v-if="props.type === 'week'"
9
- v-model="model"
9
+ v-model="scheduledTaskFormLocal"
10
10
  />
11
11
 
12
12
  <div v-if="props.type === 'month'">
13
13
  <div class="on-time__radio radio">
14
14
  <input
15
15
  id="on-time-monthly-by-day"
16
- v-model="model.frg_monthly_mode"
16
+ v-model="scheduledTaskFormLocal.frg_monthly_mode"
17
17
  data-id="on-time-monthly-by-day"
18
18
  type="radio"
19
19
  value="day"
@@ -33,7 +33,7 @@
33
33
  >
34
34
  <input
35
35
  id="monthly-by-day-field"
36
- v-model="model.frg_monthly_day"
36
+ v-model="scheduledTaskFormLocal.frg_monthly_day"
37
37
  :disabled="isDisabledMonthlyDayField"
38
38
  data-id="edit-lockout-policy-time-interval-input"
39
39
  type="text"
@@ -51,7 +51,7 @@
51
51
  <div class="on-time__radio radio">
52
52
  <input
53
53
  id="on-time-monthly-by-week"
54
- v-model="model.frg_monthly_mode"
54
+ v-model="scheduledTaskFormLocal.frg_monthly_mode"
55
55
  data-id="on-time-monthly-by-week"
56
56
  type="radio"
57
57
  value="week"
@@ -63,8 +63,8 @@
63
63
  {{ localization.scheduledTasks.the }}
64
64
  </label>
65
65
  <common-select-input
66
- v-model="model.frq_ordinal_number"
67
- :data="frequencyOnOrdinalNumber"
66
+ v-model="scheduledTaskFormLocal.frq_ordinal_number"
67
+ :data="props.frequencyOnOrdinalNumber"
68
68
  :class="[
69
69
  'radio__select ordinary-day',
70
70
  !isDisabledMonthlyDayField && 'disabled',
@@ -72,8 +72,8 @@
72
72
  />
73
73
 
74
74
  <common-select-input
75
- v-model="model.frq_week_day"
76
- :data="frequencyOnWeeksDays"
75
+ v-model="scheduledTaskFormLocal.frq_week_day"
76
+ :data="props.frequencyOnWeeksDays"
77
77
  :class="[
78
78
  'radio__select week-days',
79
79
  !isDisabledMonthlyDayField && 'disabled',
@@ -92,7 +92,7 @@
92
92
  >
93
93
  <input
94
94
  id="frequency-on-date"
95
- v-model.lazy="model.frg_on_time"
95
+ v-model.lazy="scheduledTaskFormLocal.frg_on_time"
96
96
  data-id="frequency-on-date-input"
97
97
  type="datetime-local"
98
98
  />
@@ -108,34 +108,26 @@
108
108
  import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
109
109
  import type { UI_I_Localization } from '~/lib/models/interfaces'
110
110
  import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
111
- import {
112
- frequencyOnOrdinalNumberFunc,
113
- frequencyOnWeeksDaysFunc,
114
- } from '~/components/common/pages/scheduledTasks/modals/common/frequency/on/lib/config/options'
115
111
  import {
116
112
  validateDate,
117
113
  validateField,
118
114
  } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
119
115
 
120
- const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
116
+ const scheduledTaskFormLocal = defineModel<UI_I_ScheduleNewTasksForm>({
117
+ required: true,
118
+ })
121
119
  const props = defineProps<{
122
120
  type: string
121
+ frequencyOnWeeksDays: UI_I_SelectInputItem[]
122
+ frequencyOnOrdinalNumber: UI_I_SelectInputItem[]
123
123
  }>()
124
124
 
125
125
  const { $formattedDatetime }: any = useNuxtApp()
126
126
 
127
-
128
127
  const localization = computed<UI_I_Localization>(() => useLocal())
129
128
 
130
- const frequencyOnWeeksDays = computed<UI_I_SelectInputItem[]>(() => {
131
- return frequencyOnWeeksDaysFunc(localization.value)
132
- })
133
- const frequencyOnOrdinalNumber = computed<UI_I_SelectInputItem[]>(() => {
134
- return frequencyOnOrdinalNumberFunc(localization.value)
135
- })
136
-
137
129
  const isDisabledMonthlyDayField = computed<boolean>(
138
- () => model.value.frg_monthly_mode === 'week'
130
+ () => scheduledTaskFormLocal.value.frg_monthly_mode === 'week'
139
131
  )
140
132
 
141
133
  const isInitTimeIntervalValidation = ref<boolean>(false)
@@ -148,7 +140,7 @@ const schedulerOnDayErrorText = computed<string>(() => {
148
140
 
149
141
  return validateField(
150
142
  localization.value,
151
- model.value.frg_monthly_day,
143
+ scheduledTaskFormLocal.value.frg_monthly_day,
152
144
  true,
153
145
  true
154
146
  )
@@ -156,20 +148,20 @@ const schedulerOnDayErrorText = computed<string>(() => {
156
148
  watch(
157
149
  schedulerOnDayErrorText,
158
150
  (newValue: string) => {
159
- model.value.isValid = !!newValue
151
+ scheduledTaskFormLocal.value.isValid = !!newValue
160
152
  },
161
153
  { immediate: true }
162
154
  )
163
155
 
164
156
  const schedulerAtOnceErrorText = computed<string>(() => {
165
- return !model.value.frg_on_time
157
+ return !scheduledTaskFormLocal.value.frg_on_time
166
158
  ? localization.value.common.fieldRequired
167
- : validateDate(localization.value, model.value.frg_on_time)
159
+ : validateDate(localization.value, scheduledTaskFormLocal.value.frg_on_time)
168
160
  })
169
161
  watch(
170
162
  schedulerAtOnceErrorText,
171
163
  (newValue: string) => {
172
- model.value.isValid = !!newValue
164
+ scheduledTaskFormLocal.value.isValid = !!newValue
173
165
  },
174
166
  { immediate: true }
175
167
  )
@@ -178,7 +170,7 @@ onMounted(() => {
178
170
  props.type === 'once' && setDefaultDateTime()
179
171
  })
180
172
  const setDefaultDateTime = () => {
181
- model.value.frg_on_time = $formattedDatetime(new Date(), {
173
+ scheduledTaskFormLocal.value.frg_on_time = $formattedDatetime(new Date(), {
182
174
  formatDate: 'yyyy-MM-dd',
183
175
  separator: ' ',
184
176
  formatTime: 'HH:mm',
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <div class="frequency-week-days">
3
+ <ui-block
4
+ v-for="item in props.tabs"
5
+ :key="item.value"
6
+ :class="{ selected: item.isSelected }"
7
+ @click="onSelectDay(item.value)"
8
+ >
9
+ <div class="main-info">
10
+ <span class="main-info-label">{{ item.label }}</span>
11
+ </div>
12
+ </ui-block>
13
+ </div>
14
+ </template>
15
+
16
+ <script lang="ts" setup>
17
+ import type { UI_I_SelectWeekDayTab } from '~/components/common/pages/scheduledTasks/modals/common/frequency/on/selectWeek/lib/models/interfaces'
18
+
19
+ const props = defineProps<{
20
+ tabs: UI_I_SelectWeekDayTab[]
21
+ }>()
22
+ const emits = defineEmits<{
23
+ (event: 'select-day', value: number): void
24
+ }>()
25
+
26
+ const onSelectDay = (value: number): void => {
27
+ emits('select-day', value)
28
+ }
29
+ </script>
30
+
31
+ <style lang="scss" scoped>
32
+ .frequency-week-days {
33
+ display: flex;
34
+ gap: 12px;
35
+
36
+ :deep(.block) {
37
+ width: max-content;
38
+ padding: 8px 12px;
39
+ color: var(--feedback-text-color);
40
+ background: var(--feedback-tab-bg-color);
41
+ box-shadow: inset 0 0 0 1px var(--feedback-tab-border-color);
42
+ //border: 1px solid var();
43
+ //box-shadow: none;
44
+ cursor: pointer;
45
+
46
+ &.selected {
47
+ //border: 1.5px solid var(--feedback-tab-active-text-color);
48
+ box-shadow: inset 0 0 0 1.5px
49
+ var(--feedback-tab-active-text-color);
50
+ background: var(--feedback-tab-active-bg-color);
51
+ color: var(--feedback-tab-active-text-color);
52
+ cursor: default;
53
+ }
54
+ &:not(.selected):hover {
55
+ background: var(--feedback-tab-hover-bg-color);
56
+ }
57
+ }
58
+
59
+ .main-info {
60
+ display: flex;
61
+ align-items: center;
62
+ gap: 8px;
63
+
64
+ &-label {
65
+ font-size: 13px;
66
+ font-weight: 500;
67
+ line-height: 15.73px;
68
+ }
69
+ }
70
+ }
71
+ </style>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <!-- TODO это компонент уже есть надо сделат одну но не ламать функционалность -->
3
+ <div class="flex-align-center">
4
+ <div class="btn-group">
5
+ <button
6
+ v-for="item in props.tabs"
7
+ :key="item"
8
+ :data-id="item.testId"
9
+ :class="['btn btn-sm btn-secondary', { 'btn-primary': item.isActive }]"
10
+ @click="onSelectDay(item.value)"
11
+ >
12
+ {{ item.name }}
13
+ </button>
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_SelectWeekDayTab } from '~/components/common/pages/scheduledTasks/modals/common/frequency/on/selectWeek/lib/models/interfaces'
21
+
22
+ const props = defineProps<{
23
+ tabs: UI_I_SelectWeekDayTab[]
24
+ }>()
25
+ const emits = defineEmits<{
26
+ (event: 'select-day', value: number): void
27
+ }>()
28
+
29
+ const localization = computed<UI_I_Localization>(() => useLocal())
30
+
31
+ const onSelectDay = (value: number): void => {
32
+ emits('select-day', value)
33
+ }
34
+ </script>
35
+
36
+ <style lang="scss" scoped>
37
+ .btn-group {
38
+ margin-right: 0;
39
+ button {
40
+ padding: 0 0.5rem;
41
+ min-width: 24px;
42
+ }
43
+ }
44
+ </style>
@@ -1,18 +1,5 @@
1
1
  <template>
2
- <!-- TODO это компонент уже есть надо сделат одну но не ламать функционалность -->
3
- <div class="flex-align-center">
4
- <div class="btn-group">
5
- <button
6
- v-for="item in tabs"
7
- :key="item"
8
- :data-id="item.testId"
9
- :class="['btn btn-sm btn-secondary', { 'btn-primary': item.isActive }]"
10
- @click="onSelectDay(item.value)"
11
- >
12
- {{ item.name }}
13
- </button>
14
- </div>
15
- </div>
2
+ <component :is="currentComponent" :tabs="tabs" @select-day="onSelectDay" />
16
3
  </template>
17
4
 
18
5
  <script lang="ts" setup>
@@ -26,6 +13,18 @@ const modelFrequency = defineModel<UI_I_ScheduleNewTasksForm>({
26
13
  })
27
14
 
28
15
  const localization = computed<UI_I_Localization>(() => useLocal())
16
+ const { $store }: any = useNuxtApp()
17
+
18
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
19
+ const currentComponent = computed(() =>
20
+ isNewView.value
21
+ ? defineAsyncComponent(() => import('./New.vue'))
22
+ : defineAsyncComponent(() => import('./Old.vue'))
23
+ )
24
+
25
+ const tabs = computed<UI_I_SelectWeekDayTab[]>(() =>
26
+ weekDaysFunc(localization.value, modelFrequency.value.frg_on_week_days)
27
+ )
29
28
 
30
29
  const onSelectDay = (value: number): void => {
31
30
  const index = modelFrequency.value?.frg_on_week_days.indexOf(value)
@@ -41,10 +40,6 @@ const onSelectDay = (value: number): void => {
41
40
  }
42
41
  }
43
42
 
44
- const tabs = computed<UI_I_SelectWeekDayTab[]>(() =>
45
- weekDaysFunc(localization.value, modelFrequency.value.frg_on_week_days)
46
- )
47
-
48
43
  watch(
49
44
  modelFrequency,
50
45
  (newValue: UI_I_ScheduleNewTasksForm) => {
@@ -56,13 +51,3 @@ watch(
56
51
  }
57
52
  )
58
53
  </script>
59
-
60
- <style lang="scss" scoped>
61
- .btn-group {
62
- margin-right: 0;
63
- button {
64
- padding: 0 0.5rem;
65
- min-width: 24px;
66
- }
67
- }
68
- </style>
@@ -1,17 +1,15 @@
1
1
  <template>
2
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>
3
+ <h2>{{ localization.common.start }}</h2>
4
+ <ui-input-with-datepicker
5
+ id="frequency-start-on-date"
6
+ v-model="modelFrequencyLocal.frg_start_on_time"
7
+ :format="datepickerFormat"
8
+ test-id="frequency-start-on-date-input"
9
+ time-format="12"
10
+ :error="''"
11
+ :error-timepicker="''"
12
+ />
15
13
  </div>
16
14
  </template>
17
15
 
@@ -34,6 +32,8 @@ const datepickerFormat = computed<string>(
34
32
  <style lang="scss" scoped>
35
33
  .frequency-start-on {
36
34
  grid-column: span 2;
35
+ border-top: 1px solid var(--horizontal-line);
36
+ padding-top: 16px;
37
37
  h2 {
38
38
  font-family: 'Inter', sans-serif;
39
39
  color: var(--title-form-first-color);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.907",
4
+ "version": "1.5.909",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",