@webitel/ui-sdk 25.10.9 → 25.10.11

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.
@@ -88,7 +88,7 @@ export default {
88
88
  return this.draft
89
89
  .filter((header) => !this.staticHeaders.includes(header.value))
90
90
  .sort((a, b) => {
91
- return this.shownColLabel(a).localeCompare(this.shownColLabel(b));
91
+ return this.shownColLabel(a)?.localeCompare(this.shownColLabel(b));
92
92
  // sorting headers for alphabet just in popup
93
93
  });
94
94
  },
@@ -31,12 +31,6 @@
31
31
  width: 100%;
32
32
  min-height: 0;
33
33
 
34
- .wt-table__head {
35
- position: sticky;
36
- top: 0;
37
- z-index: 1;
38
- }
39
-
40
34
  .wt-pagination {
41
35
  margin-top: auto;
42
36
  }
@@ -4,7 +4,9 @@ import PBreadcrumb from 'primevue/breadcrumb';
4
4
  import PButton from 'primevue/button';
5
5
  import PCheckbox from 'primevue/checkbox';
6
6
  import PChip from 'primevue/chip';
7
+ import PColumn from 'primevue/column';
7
8
  import PrimeVue from 'primevue/config';
9
+ import PTable from 'primevue/datatable';
8
10
  import PDivider from 'primevue/divider';
9
11
  import PInputText from 'primevue/inputtext';
10
12
  import PMenubar from 'primevue/menubar';
@@ -41,6 +43,8 @@ const initPrimevue = (app) => {
41
43
  app.component('PToolbar', changeComponentCompatMode(PToolbar));
42
44
  app.component('PAvatar', changeComponentCompatMode(PAvatar));
43
45
  app.component('PCheckbox', changeComponentCompatMode(PCheckbox));
46
+ app.component('PTable', changeComponentCompatMode(PTable));
47
+ app.component('PColumn', changeComponentCompatMode(PColumn));
44
48
  app.component('PRadio', changeComponentCompatMode(PRadio));
45
49
  app.component('PChip', changeComponentCompatMode(PChip));
46
50
  app.component('PToggleSwitch', changeComponentCompatMode(PToggleSwitch));
@@ -10,6 +10,7 @@ import popover from './popover/popover.js';
10
10
  import radio from './radio/radio.js';
11
11
  import slider from './slider/slider.js'
12
12
  import switcher from './switcher/switcher.js';
13
+ import table from './table/table.js';
13
14
  import toolbar from './toolbar/toolbar.js';
14
15
  import tooltip from './tooltip/tooltip.js';
15
16
 
@@ -27,6 +28,8 @@ const components = {
27
28
  radiobutton: radio,
28
29
  slider,
29
30
  tooltip,
31
+ checkbox,
32
+ datatable: table,
30
33
  toolbar,
31
34
  };
32
35
 
@@ -0,0 +1,25 @@
1
+ import { TableScheme } from '@webitel/styleguide/component-schemes';
2
+
3
+ const table = {
4
+ ...TableScheme.sizes,
5
+ colorScheme: TableScheme.colorScheme,
6
+
7
+ // Rewrite the default table styles in the theme here:
8
+ // For customize the table styles you need write css styles for classes
9
+ css: () => `
10
+ .p-datatable-table-container {
11
+ width: 100%;
12
+ }
13
+
14
+ .p-datatable-tbody > tr > td {
15
+ word-break: break-all;
16
+ overflow-wrap: break-word;
17
+ }
18
+
19
+ .p-datatable-thead > tr > th {
20
+ overflow: hidden;
21
+ }
22
+ `,
23
+ };
24
+
25
+ export default table;
@@ -29,7 +29,7 @@ import prettifyFileSize from './prettifyFileSize.js';
29
29
  import prettifyTime from './prettifyTime.js';
30
30
  import preventHiddenPageCallsDecorator from './preventHiddenPageCallsDecorator.js';
31
31
  import saveAsJSON from './saveAsJSON.js';
32
- import { queryToSortAdapter, sortToQueryAdapter } from './sortQueryAdapters.js';
32
+ import { getNextSortOrder,queryToSortAdapter, sortToQueryAdapter } from './sortQueryAdapters.js';
33
33
  import updateObject from './updateObject.js';
34
34
 
35
35
  export {
@@ -39,6 +39,7 @@ export {
39
39
  convertDuration,
40
40
  debounce,
41
41
  eventBus,
42
+ getNextSortOrder,
42
43
  isEmpty,
43
44
  isRelativeDatetimeValue,
44
45
  kebabToCamel,
@@ -5,6 +5,5 @@ type __VLS_WithSlots<T, S> = T & (new () => {
5
5
  });
6
6
  declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
7
  type __VLS_Slots = {
8
- [x: string]: (props: {}) => any;
9
- [x: number]: (props: {}) => any;
8
+ default?: (props: {}) => any;
10
9
  };
@@ -0,0 +1,10 @@
1
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
2
+ export default _default;
3
+ type __VLS_WithSlots<T, S> = T & (new () => {
4
+ $slots: S;
5
+ });
6
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ type __VLS_Slots = {
8
+ [x: string]: (props: {}) => any;
9
+ [x: number]: (props: {}) => any;
10
+ };
@@ -1,132 +1,148 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
1
+ import type { DataTableProps } from 'primevue';
2
+ import type { WtTableHeader } from './types/WtTable';
3
+ interface Props extends DataTableProps {
2
4
  /**
3
- * 'Accepts list of header objects. Draws text depending on "text" property, looks for data values through "value", "show" boolean controls visibility of a column (if undefined, all visible by default). ' Column width is calculated by "width" param. By default, sets minmax(150px, 1fr). '
5
+ * 'Accepts list of header objects. Draws text depending on "text" property, looks for data values through "value", "show" boolean controls visibility of a column (if undefined, all visible by default). ' Column width is calculated by "width" param. By default, sets 140px. '
4
6
  */
5
- headers: {
6
- type: ArrayConstructor;
7
- default: () => any[];
8
- };
7
+ headers?: WtTableHeader[];
9
8
  /**
10
9
  * 'List of data, represented by table. '
11
10
  */
12
- data: {
13
- type: ArrayConstructor;
14
- default: () => any[];
15
- };
11
+ data?: Array<unknown>;
16
12
  /**
17
13
  * 'If true, draws sorting arrows and sends sorting events at header click. Draws a sorting arrow by "sort": "asc"/"desc" header value. '
18
14
  */
19
- sortable: {
20
- type: BooleanConstructor;
21
- default: boolean;
22
- };
15
+ sortable?: boolean;
23
16
  /**
24
17
  * 'If true, draws row selection checkboxes. Checkbox toggles data object _isSelected property. It's IMPORTANT to set this property before sending data to table. '
25
18
  */
26
- selectable: {
27
- type: BooleanConstructor;
28
- default: boolean;
29
- };
30
- selected: {
31
- type: ArrayConstructor;
32
- };
19
+ selectable?: boolean;
20
+ selected?: Array<unknown>;
33
21
  /**
34
22
  * 'If true, reserves space for 3 icon actions in the last column. Accessible by "actions" slot. '
35
23
  */
36
- gridActions: {
37
- type: BooleanConstructor;
38
- default: boolean;
39
- };
24
+ gridActions?: boolean;
40
25
  /**
41
26
  * 'If true, 3 icon actions in the last column have position:sticky and fixed on the right'
42
27
  */
43
- fixedActions: {
44
- type: BooleanConstructor;
45
- default: boolean;
46
- };
28
+ fixedActions?: boolean;
47
29
  /**
48
30
  * 'If true, displays table without header.'
49
31
  */
50
- headless: {
51
- type: BooleanConstructor;
52
- default: boolean;
53
- };
54
- }>, {}, {}, {
55
- _selected(): unknown[];
56
- isAllSelected(): boolean;
57
- dataHeaders(): any[];
58
- columnsStyle(): string;
59
- isTableFooter(): boolean;
60
- }, {
61
- sort(col: any): void;
62
- isColSortable({ sort }: {
63
- sort: any;
64
- }): boolean;
65
- selectAll(): void;
66
- handleSelection(row: any, select: any): void;
67
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("sort" | "update:selected")[], "sort" | "update:selected", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
68
- /**
69
- * 'Accepts list of header objects. Draws text depending on "text" property, looks for data values through "value", "show" boolean controls visibility of a column (if undefined, all visible by default). ' Column width is calculated by "width" param. By default, sets minmax(150px, 1fr). '
70
- */
71
- headers: {
72
- type: ArrayConstructor;
73
- default: () => any[];
74
- };
75
- /**
76
- * 'List of data, represented by table. '
77
- */
78
- data: {
79
- type: ArrayConstructor;
80
- default: () => any[];
81
- };
82
- /**
83
- * 'If true, draws sorting arrows and sends sorting events at header click. Draws a sorting arrow by "sort": "asc"/"desc" header value. '
84
- */
85
- sortable: {
86
- type: BooleanConstructor;
87
- default: boolean;
88
- };
89
- /**
90
- * 'If true, draws row selection checkboxes. Checkbox toggles data object _isSelected property. It's IMPORTANT to set this property before sending data to table. '
91
- */
92
- selectable: {
93
- type: BooleanConstructor;
94
- default: boolean;
95
- };
96
- selected: {
97
- type: ArrayConstructor;
98
- };
32
+ headless?: boolean;
99
33
  /**
100
- * 'If true, reserves space for 3 icon actions in the last column. Accessible by "actions" slot. '
34
+ * 'If true, allows to reorder rows.'
101
35
  */
102
- gridActions: {
103
- type: BooleanConstructor;
104
- default: boolean;
105
- };
36
+ rowReorder?: boolean;
106
37
  /**
107
- * 'If true, 3 icon actions in the last column have position:sticky and fixed on the right'
38
+ * 'If true, restrict sprecific row reorder.'
108
39
  */
109
- fixedActions: {
110
- type: BooleanConstructor;
111
- default: boolean;
112
- };
113
- /**
114
- * 'If true, displays table without header.'
115
- */
116
- headless: {
117
- type: BooleanConstructor;
118
- default: boolean;
119
- };
120
- }>> & Readonly<{
40
+ isRowReorderDisabled?: (row: any) => boolean;
41
+ rowClass?: () => string;
42
+ rowStyle?: () => {
43
+ [key: string]: string;
44
+ };
45
+ }
46
+ declare const emit: (event: "sort" | "update:selected" | "reorder:row", ...args: any[]) => void;
47
+ declare const _selected: import("vue").ComputedRef<unknown[]>;
48
+ declare const dataHeaders: import("vue").ComputedRef<WtTableHeader[]>;
49
+ declare const isColumnHidden: (col: any) => boolean;
50
+ declare const columnStyle: (col: any) => {
51
+ minWidth: any;
52
+ };
53
+ declare const isTableColumnFooters: import("vue").ComputedRef<boolean>;
54
+ declare const isTableFooter: import("vue").ComputedRef<boolean>;
55
+ declare const isAllSelected: import("vue").ComputedRef<boolean>;
56
+ declare const sort: ({ sortField }: {
57
+ sortField: any;
58
+ }) => void;
59
+ declare const isColSortable: ({ sort }: {
60
+ sort: any;
61
+ }) => boolean;
62
+ declare const selectAll: () => void;
63
+ declare const handleSelection: (row: any, select: any) => void;
64
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
65
+ declare var __VLS_45: string, __VLS_46: {
66
+ index: any;
67
+ item: any;
68
+ }, __VLS_57: `${string}-footer`, __VLS_58: {}, __VLS_64: {}, __VLS_66: {
69
+ index: any;
70
+ item: any;
71
+ }, __VLS_68: {};
72
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
73
+ [K in NonNullable<typeof __VLS_45>]?: (props: typeof __VLS_46) => any;
74
+ } & {
75
+ [K in NonNullable<typeof __VLS_57>]?: (props: typeof __VLS_58) => any;
76
+ } & {
77
+ 'actions-header'?: (props: typeof __VLS_64) => any;
78
+ } & {
79
+ actions?: (props: typeof __VLS_66) => any;
80
+ } & {
81
+ footer?: (props: typeof __VLS_68) => any;
82
+ }>;
83
+ declare const __VLS_self: import("vue").DefineComponent<Props, {
84
+ emit: typeof emit;
85
+ _selected: typeof _selected;
86
+ dataHeaders: typeof dataHeaders;
87
+ isColumnHidden: typeof isColumnHidden;
88
+ columnStyle: typeof columnStyle;
89
+ isTableColumnFooters: typeof isTableColumnFooters;
90
+ isTableFooter: typeof isTableFooter;
91
+ isAllSelected: typeof isAllSelected;
92
+ sort: typeof sort;
93
+ isColSortable: typeof isColSortable;
94
+ selectAll: typeof selectAll;
95
+ handleSelection: typeof handleSelection;
96
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
97
+ sort: (...args: any[]) => void;
98
+ "update:selected": (...args: any[]) => void;
99
+ "reorder:row": (...args: any[]) => void;
100
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
101
+ onSort?: (...args: any[]) => any;
121
102
  "onUpdate:selected"?: (...args: any[]) => any;
103
+ "onReorder:row"?: (...args: any[]) => any;
104
+ }>, {
105
+ headers: WtTableHeader[];
106
+ data: Array<unknown>;
107
+ sortable: boolean;
108
+ selectable: boolean;
109
+ gridActions: boolean;
110
+ fixedActions: boolean;
111
+ headless: boolean;
112
+ rowReorder: boolean;
113
+ isRowReorderDisabled: (row: any) => boolean;
114
+ rowClass: () => string;
115
+ rowStyle: () => {
116
+ [key: string]: string;
117
+ };
118
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
119
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
120
+ sort: (...args: any[]) => void;
121
+ "update:selected": (...args: any[]) => void;
122
+ "reorder:row": (...args: any[]) => void;
123
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
122
124
  onSort?: (...args: any[]) => any;
125
+ "onUpdate:selected"?: (...args: any[]) => any;
126
+ "onReorder:row"?: (...args: any[]) => any;
123
127
  }>, {
124
- headers: unknown[];
125
- data: unknown[];
128
+ headers: WtTableHeader[];
129
+ data: Array<unknown>;
126
130
  sortable: boolean;
127
131
  selectable: boolean;
128
132
  gridActions: boolean;
129
133
  fixedActions: boolean;
130
134
  headless: boolean;
135
+ rowReorder: boolean;
136
+ isRowReorderDisabled: (row: any) => boolean;
137
+ rowClass: () => string;
138
+ rowStyle: () => {
139
+ [key: string]: string;
140
+ };
131
141
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
142
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
132
143
  export default _default;
144
+ type __VLS_WithSlots<T, S> = T & {
145
+ new (): {
146
+ $slots: S;
147
+ };
148
+ };
@@ -13,6 +13,7 @@ declare namespace components {
13
13
  export { radio as radiobutton };
14
14
  export { slider };
15
15
  export { tooltip };
16
+ export { table as datatable };
16
17
  export { toolbar };
17
18
  }
18
19
  import autocomplete from './autocomplete/autocomplete.js';
@@ -28,4 +29,5 @@ import popover from './popover/popover.js';
28
29
  import radio from './radio/radio.js';
29
30
  import slider from './slider/slider.js';
30
31
  import tooltip from './tooltip/tooltip.js';
32
+ import table from './table/table.js';
31
33
  import toolbar from './toolbar/toolbar.js';
@@ -0,0 +1,186 @@
1
+ export default table;
2
+ declare const table: {
3
+ colorScheme: {
4
+ light: {
5
+ root: {
6
+ borderColor: string;
7
+ };
8
+ header: {
9
+ background: string;
10
+ borderColor: string;
11
+ color: string;
12
+ };
13
+ headerCell: {
14
+ background: string;
15
+ hoverBackground: string;
16
+ selectedBackground: string;
17
+ borderColor: string;
18
+ color: string;
19
+ hoverColor: string;
20
+ selectedColor: string;
21
+ focusRing: {
22
+ color: string;
23
+ shadow: string;
24
+ };
25
+ };
26
+ row: {
27
+ stripedBackground: string;
28
+ background: string;
29
+ hoverBackground: string;
30
+ selectedBackground: string;
31
+ color: string;
32
+ hoverColor: string;
33
+ selectedColor: string;
34
+ focusRing: {
35
+ color: string;
36
+ shadow: string;
37
+ };
38
+ };
39
+ bodyCell: {
40
+ borderColor: string;
41
+ selectedBorderColor: string;
42
+ };
43
+ footerCell: {
44
+ background: string;
45
+ borderColor: string;
46
+ color: string;
47
+ };
48
+ footer: {
49
+ background: string;
50
+ borderColor: string;
51
+ color: string;
52
+ };
53
+ sortIcon: {
54
+ color: string;
55
+ hoverColor: string;
56
+ };
57
+ };
58
+ dark: {
59
+ root: {
60
+ borderColor: string;
61
+ };
62
+ header: {
63
+ background: string;
64
+ borderColor: string;
65
+ color: string;
66
+ };
67
+ headerCell: {
68
+ background: string;
69
+ hoverBackground: string;
70
+ selectedBackground: string;
71
+ borderColor: string;
72
+ color: string;
73
+ hoverColor: string;
74
+ selectedColor: string;
75
+ focusRing: {
76
+ color: string;
77
+ shadow: string;
78
+ };
79
+ };
80
+ row: {
81
+ stripedBackground: string;
82
+ background: string;
83
+ hoverBackground: string;
84
+ selectedBackground: string;
85
+ color: string;
86
+ hoverColor: string;
87
+ selectedColor: string;
88
+ focusRing: {
89
+ color: string;
90
+ shadow: string;
91
+ };
92
+ };
93
+ bodyCell: {
94
+ borderColor: string;
95
+ selectedBorderColor: string;
96
+ };
97
+ footerCell: {
98
+ background: string;
99
+ borderColor: string;
100
+ color: string;
101
+ };
102
+ footer: {
103
+ background: string;
104
+ borderColor: string;
105
+ color: string;
106
+ };
107
+ sortIcon: {
108
+ color: string;
109
+ hoverColor: string;
110
+ };
111
+ };
112
+ };
113
+ css: () => string;
114
+ root: {
115
+ transitionDuration: string;
116
+ };
117
+ header: {
118
+ borderWidth: string;
119
+ padding: string;
120
+ sm: {
121
+ padding: string;
122
+ };
123
+ lg: {
124
+ padding: string;
125
+ };
126
+ };
127
+ headerCell: {
128
+ gap: string;
129
+ padding: string;
130
+ focusRing: {
131
+ width: string;
132
+ style: string;
133
+ offset: string;
134
+ };
135
+ sm: {
136
+ padding: string;
137
+ };
138
+ lg: {
139
+ padding: string;
140
+ };
141
+ };
142
+ columnWeight: {
143
+ fontWeight: string;
144
+ };
145
+ row: {
146
+ focusRing: {
147
+ width: string;
148
+ style: string;
149
+ offset: string;
150
+ };
151
+ };
152
+ bodyCell: {
153
+ padding: string;
154
+ sm: {
155
+ padding: string;
156
+ };
157
+ lg: {
158
+ padding: string;
159
+ };
160
+ };
161
+ footerCell: {
162
+ padding: string;
163
+ sm: {
164
+ padding: string;
165
+ };
166
+ lg: {
167
+ padding: string;
168
+ };
169
+ };
170
+ columnFooter: {
171
+ fontWeight: string;
172
+ };
173
+ footer: {
174
+ borderWidth: string;
175
+ padding: string;
176
+ sm: {
177
+ padding: string;
178
+ };
179
+ lg: {
180
+ padding: string;
181
+ };
182
+ };
183
+ sortIcon: {
184
+ size: string;
185
+ };
186
+ };
@@ -4,6 +4,7 @@ import { compareSize } from './compareSize.ts';
4
4
  import convertDuration from './convertDuration.js';
5
5
  import debounce from './debounce.js';
6
6
  import eventBus from './eventBus.js';
7
+ import { getNextSortOrder } from './sortQueryAdapters.js';
7
8
  import isEmpty from './isEmpty.js';
8
9
  import { isRelativeDatetimeValue } from './normalizeDatetime';
9
10
  import { kebabToCamel } from './caseConverters.js';
@@ -26,4 +27,4 @@ import { snakeToKebab } from './caseConverters.js';
26
27
  import { sortToQueryAdapter } from './sortQueryAdapters.js';
27
28
  import updateObject from './updateObject.js';
28
29
  import { wtlog } from './logger.js';
29
- export { camelToKebab, camelToSnake, compareSize, convertDuration, debounce, eventBus, isEmpty, isRelativeDatetimeValue, kebabToCamel, kebabToSnake, normalizeToTimestamp, objCamelToKebab, objCamelToSnake, objSnakeToCamel, prettifyFileSize, prettifyTime, preventHiddenPageCallsDecorator, queryToSortAdapter, saveAsJSON, sizeGreaterOrEqual, sizeGreaterThen, sizeSmallerOrEqual, sizeSmallerThen, snakeToCamel, snakeToKebab, sortToQueryAdapter, updateObject, wtlog };
30
+ export { camelToKebab, camelToSnake, compareSize, convertDuration, debounce, eventBus, getNextSortOrder, isEmpty, isRelativeDatetimeValue, kebabToCamel, kebabToSnake, normalizeToTimestamp, objCamelToKebab, objCamelToSnake, objSnakeToCamel, prettifyFileSize, prettifyTime, preventHiddenPageCallsDecorator, queryToSortAdapter, saveAsJSON, sizeGreaterOrEqual, sizeGreaterThen, sizeSmallerOrEqual, sizeSmallerThen, snakeToCamel, snakeToKebab, sortToQueryAdapter, updateObject, wtlog };