@webitel/ui-sdk 24.12.13 → 24.12.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.12.13",
3
+ "version": "24.12.15",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -173,6 +173,6 @@
173
173
  },
174
174
  "engines": {
175
175
  "npm": "10.9.0",
176
- "node": "v22.11.0"
176
+ "node": "v22.12.0"
177
177
  }
178
178
  }
@@ -68,6 +68,8 @@ import WtTooltip from './wt-tooltip/wt-tooltip.vue';
68
68
  import WtNavigationMenu
69
69
  from './on-demand/wt-navigation-menu/components/wt-navigation-menu.vue';
70
70
  import WtStartPage from './on-demand/wt-start-page/components/wt-start-page.vue';
71
+ import WtSelectionPopup
72
+ from './on-demand/wt-selection-popup/wt-selection-popup.vue';
71
73
 
72
74
  const Components = {
73
75
  WtActionBar,
@@ -135,6 +137,7 @@ const Components = {
135
137
  WtExpansionPanel,
136
138
  WtNavigationMenu,
137
139
  WtStartPage,
140
+ WtSelectionPopup,
138
141
  };
139
142
 
140
143
  export default Components;
@@ -0,0 +1,158 @@
1
+ <template>
2
+ <wt-popup
3
+ class="wt-selection-popup"
4
+ overflow
5
+ size="sm"
6
+ v-bind="$attrs"
7
+ @close="close"
8
+ >
9
+ <template #title>
10
+ {{ title }}
11
+ </template>
12
+ <template #main>
13
+ <ul class="wt-selection-popup__options">
14
+ <li
15
+ v-for="(option, key) of options"
16
+ :key="key"
17
+ :class="{'active': option.value === selected.value }"
18
+ class="wt-selection-popup__item-wrapper"
19
+ @click="selectOption(option)"
20
+ >
21
+ <slot
22
+ :option="option"
23
+ name="option"
24
+ >
25
+ <wt-icon
26
+ v-if="option.icon"
27
+ :icon="option.icon"
28
+ size="sm"
29
+ />
30
+ <h4 class="wt-selection-popup__item-header">
31
+ {{ option.title }}
32
+ </h4>
33
+ <p
34
+ v-if="option.description"
35
+ class="popup-options__item-text">
36
+ {{ option.description }}
37
+ </p>
38
+ <wt-tooltip>
39
+ <template #activator>
40
+ <wt-icon-btn
41
+ v-if="option.description"
42
+ color="info"
43
+ icon="rounded-info"
44
+ />
45
+ </template>
46
+ {{ option.description }}
47
+ </wt-tooltip>
48
+ </slot>
49
+ </li>
50
+ </ul>
51
+ <!--Slot for displaying specific template styling-->
52
+ <slot name="after-section" />
53
+ </template>
54
+
55
+ <template #actions>
56
+ <wt-button
57
+ :disabled="!selected"
58
+ @click="add"
59
+ >
60
+ {{ t('reusable.create') }}
61
+ </wt-button>
62
+ <wt-button
63
+ color="secondary"
64
+ @click="close"
65
+ >
66
+ {{ t('reusable.close') }}
67
+ </wt-button>
68
+ </template>
69
+ </wt-popup>
70
+ </template>
71
+
72
+ <script setup>
73
+ import { useI18n } from 'vue-i18n';
74
+
75
+ const props = defineProps({
76
+
77
+ /**
78
+ * Popup title
79
+ */
80
+
81
+ title: {
82
+ type: String,
83
+ },
84
+
85
+ /**
86
+ * Selected value. The scheme repeats attribute `option` from `options`
87
+ */
88
+
89
+ selected: {
90
+ type: Object,
91
+ },
92
+
93
+ /**
94
+ * All displayed values. Should have following schema: `{ value: '', title: '', description: '', icon: ''}`
95
+ */
96
+
97
+ options: {
98
+ type: Array,
99
+ default: () => [],
100
+ },
101
+ });
102
+
103
+ const emit = defineEmits(['change', 'add', 'close']);
104
+
105
+ const { t } = useI18n();
106
+
107
+ function add() {
108
+ emit('add', props.selected);
109
+ }
110
+
111
+ function close() {
112
+ emit('close');
113
+ }
114
+
115
+ function selectOption(option) {
116
+ emit('change', option);
117
+ }
118
+ </script>
119
+
120
+ <style lang="scss" scoped>
121
+ @import '../../../css/main.scss';
122
+
123
+ .wt-selection-popup {
124
+ &__options {
125
+ display: flex;
126
+ flex-direction: column;
127
+ gap: var(--spacing-xs);
128
+ }
129
+
130
+ &__item-wrapper {
131
+ position: relative;
132
+ display: flex;
133
+ align-items: center;
134
+ padding: var(--spacing-xs);
135
+ cursor: pointer;
136
+ transition: var(--transition);
137
+ border: 1px solid var(--text-main-color);
138
+ border-radius: var(--border-radius);
139
+
140
+ &:hover,
141
+ &.active {
142
+ border: 1px solid var(--primary-color);
143
+ }
144
+
145
+ .wt-icon {
146
+ margin-right: var(--spacing-xs);
147
+ }
148
+
149
+ .wt-tooltip {
150
+ margin-left: auto;
151
+ }
152
+ }
153
+
154
+ &__item-header {
155
+ @extend %typo-subtitle-2;
156
+ }
157
+ }
158
+ </style>
@@ -77,6 +77,7 @@ export default {
77
77
  step: 'Step { count }',
78
78
  more: 'More',
79
79
  read: 'Read',
80
+ create: 'Create',
80
81
  },
81
82
  // yak zhe ya zaebalsya povtoriaty odni i ti sami slova!!!!
82
83
  vocabulary: {
@@ -77,6 +77,7 @@ export default {
77
77
  step: 'Шаг { count }',
78
78
  more: 'Больше',
79
79
  read: 'Читать',
80
+ create: 'Создать',
80
81
  },
81
82
  vocabulary: {
82
83
  language: 'Язык',
@@ -78,6 +78,7 @@ export default {
78
78
  step: 'Крок { count }',
79
79
  more: 'Більше',
80
80
  read: 'Читати',
81
+ create: 'Створити',
81
82
  },
82
83
  vocabulary: {
83
84
  language: 'Мова',
@@ -7,8 +7,8 @@
7
7
 
8
8
  <wt-popup
9
9
  :shown="shown"
10
- size="sm"
11
10
  overflow
11
+ size="sm"
12
12
  @close="close"
13
13
  >
14
14
  <template #title>
@@ -24,13 +24,13 @@
24
24
  </template>
25
25
  <template #actions>
26
26
  <wt-button @click="save(grantee)">
27
- {{ t('objects.add') }}
27
+ {{ t('reusable.add') }}
28
28
  </wt-button>
29
29
  <wt-button
30
30
  color="secondary"
31
31
  @click="close"
32
32
  >
33
- {{ t('objects.close') }}
33
+ {{ t('reusable.close') }}
34
34
  </wt-button>
35
35
  </template>
36
36
  </wt-popup>
@@ -1,19 +1,17 @@
1
1
  <template>
2
2
  <section
3
3
  v-if="access.read"
4
- class="permissions-tab"
4
+ class="table-page"
5
5
  >
6
- <header class="content-header">
7
- <h3 class="content-title">
8
- {{ $t('access.operations') }}
6
+ <header class="table-title">
7
+ <h3 class="table-title__title">
8
+ {{ t('access.operations') }}
9
9
  </h3>
10
- <div class="content-header__actions-wrap">
11
- <!-- TODO replace wt-table-actions -->
12
- <!-- <wt-table-actions-->
13
- <!-- :icons="['refresh']"-->
14
- <!-- @input="(event) => event === 'refresh' && loadData()"-->
15
- <!-- >-->
16
- <!-- </wt-table-actions>-->
10
+ <div class="table-title__actions-wrap">
11
+ <wt-action-bar
12
+ :include="[IconAction.REFRESH]"
13
+ @click:refresh="loadData"
14
+ />
17
15
  <role-popup
18
16
  v-if="props.access.add"
19
17
  :namespace="tableNamespace"
@@ -23,81 +21,67 @@
23
21
 
24
22
  <wt-loader v-show="isLoading" />
25
23
 
26
- <!-- TODO -->
27
- <!-- <wt-dummy-->
28
- <!-- v-if="dummy && !isLoading"-->
29
- <!-- :dark-mode="darkMode"-->
30
- <!-- :src="dummy.src"-->
31
- <!-- :text="dummy.text && t(dummy.text)"-->
32
- <!-- class="dummy-wrapper"-->
33
- <!-- />-->
34
-
35
- <div class="table-wrapper">
36
- <div
37
- v-if="dataList.length && !isLoading"
38
- style="display:contents;"
39
- >
40
- <!-- TODO -->
41
- <!-- <transition-slide-->
42
- <!-- :offset="{-->
43
- <!-- enter: ['-5%', 0],-->
44
- <!-- leave: [0, 0]-->
45
- <!-- }"-->
46
- <!-- duration="200"-->
47
- <!-- mode="out-in"-->
48
- <!-- appear-->
49
- <!-- >-->
50
- <wt-table
51
- :data="localizedDataList"
52
- :grid-actions="access.edit"
53
- :headers="headers"
54
- :selectable="false"
55
- sortable
56
- @sort="sort"
57
- >
58
- <template #grantee="{ item }">
59
- <role-column
60
- :role="item.grantee"
61
- />
62
- </template>
63
-
64
- <template #read="{ item }">
65
- <wt-select
66
- :clearable="false"
67
- :disabled="!access.edit"
68
- :options="accessOptions"
69
- :value="item.access.r"
70
- @input="changeAccessMode({ item, ruleName: 'r', mode: $event })"
71
- />
72
- </template>
73
-
74
- <template #edit="{ item }">
75
- <wt-select
76
- :clearable="false"
77
- :disabled="!access.edit"
78
- :options="accessOptions"
79
- :value="item.access.w"
80
- @input="changeAccessMode({ item, ruleName: 'w', mode: $event })"
81
- />
82
- </template>
83
-
84
- <template #delete="{ item }">
85
- <wt-select
86
- :clearable="false"
87
- :disabled="!access.edit"
88
- :options="accessOptions"
89
- :value="item.access.d"
90
- @input="changeAccessMode({ item, ruleName: 'd', mode: $event })"
91
- />
92
- </template>
93
- <template #actions="{ item }">
94
- <wt-icon-action
95
- action="delete"
96
- @click="changeAccessMode({ item, ruleName: 'r', mode: { id: AccessMode.FORBIDDEN }})"
97
- />
98
- </template>
99
- </wt-table>
100
- <!-- </transition-slide>-->
24
+ <wt-empty
25
+ v-show="showEmpty"
26
+ :image="imageEmpty"
27
+ :text="textEmpty"
28
+ />
29
+
30
+ <div class="table-section__table-wrapper">
31
+ <div>
32
+ <wt-table-transition
33
+ v-if="dataList.length && !isLoading">
34
+ <wt-table
35
+ :data="localizedDataList"
36
+ :grid-actions="access.edit"
37
+ :headers="headers"
38
+ :selectable="false"
39
+ sortable
40
+ @sort="sort"
41
+ >
42
+ <template #grantee="{ item }">
43
+ <role-column
44
+ :role="item.grantee"
45
+ />
46
+ </template>
47
+
48
+ <template #read="{ item }">
49
+ <wt-select
50
+ :clearable="false"
51
+ :disabled="!access.edit"
52
+ :options="accessOptions"
53
+ :value="item.access.r"
54
+ @input="changeAccessMode({ item, ruleName: 'r', mode: $event })"
55
+ />
56
+ </template>
57
+
58
+ <template #edit="{ item }">
59
+ <wt-select
60
+ :clearable="false"
61
+ :disabled="!access.edit"
62
+ :options="accessOptions"
63
+ :value="item.access.w"
64
+ @input="changeAccessMode({ item, ruleName: 'w', mode: $event })"
65
+ />
66
+ </template>
67
+
68
+ <template #delete="{ item }">
69
+ <wt-select
70
+ :clearable="false"
71
+ :disabled="!access.edit"
72
+ :options="accessOptions"
73
+ :value="item.access.d"
74
+ @input="changeAccessMode({ item, ruleName: 'd', mode: $event })"
75
+ />
76
+ </template>
77
+ <template #actions="{ item }">
78
+ <wt-icon-action
79
+ action="delete"
80
+ @click="changeAccessMode({ item, ruleName: 'r', mode: { id: AccessMode.FORBIDDEN }})"
81
+ />
82
+ </template>
83
+ </wt-table>
84
+ </wt-table-transition>
101
85
  </div>
102
86
  <filter-pagination
103
87
  :namespace="filtersNamespace"
@@ -108,8 +92,6 @@
108
92
  </template>
109
93
 
110
94
  <script setup>
111
- // TODO: класи, даммі, транзішен таблички. WTEL-3392
112
-
113
95
  import { computed, onUnmounted } from 'vue';
114
96
  import { useI18n } from 'vue-i18n';
115
97
  import { useStore } from 'vuex';
@@ -119,6 +101,8 @@ import { useTableFilters } from '../../Filters/composables/useTableFilters.js';
119
101
  import RoleColumn from '../_internals/components/permissions-role-row.vue';
120
102
  import RolePopup from '../_internals/components/permissions-tab-role-popup.vue';
121
103
  import { AccessMode } from '../_internals/enums/AccessMode.enum.js';
104
+ import IconAction from '../../../enums/IconAction/IconAction.enum.js';
105
+ import { useTableEmpty } from '../../../modules/TableComponentModule/composables/useTableEmpty.js';
122
106
 
123
107
  const props = defineProps({
124
108
  /**
@@ -154,7 +138,7 @@ const {
154
138
  isNext,
155
139
  error,
156
140
 
157
- loadData, // TODO: use for refresh button
141
+ loadData,
158
142
  sort,
159
143
  onFilterEvent,
160
144
  } = useTableStore(`${props.namespace}/permissions`);
@@ -197,11 +181,11 @@ onUnmounted(() => {
197
181
  flushSubscribers();
198
182
  });
199
183
 
200
- // TODO
201
- // const { dummy } = useDummy({
202
- // namespace,
203
- // hiddenText: true,
204
- // });
184
+ const {
185
+ showEmpty,
186
+ image: imageEmpty,
187
+ text: textEmpty,
188
+ } = useTableEmpty({ dataList, error, isLoading });
205
189
 
206
190
  const accessOptions = computed(() => {
207
191
  return Object.values(AccessMode).map((mode) => ({
@@ -83,7 +83,7 @@ export const useTableEmpty = ({ dataList, filters, error, isLoading }, overrides
83
83
  if (!emptyState?.value) return null;
84
84
 
85
85
  if (error.value) return EmptyCause.ERROR;
86
- if (filters.value) {
86
+ if (filters?.value) {
87
87
  const uncheckedFilters = ['page', 'size', 'sort', 'fields'];
88
88
  const filtersApplied = Object.entries(filters.value).some(
89
89
  ([filterValue, filterName]) =>