complexqa_frontend_core 1.2.1 → 1.3.2

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.
@@ -0,0 +1,124 @@
1
+ import { LOCALE_AG_GRID_RU } from "./locale_table_ru.js";
2
+ import { LOCALE_AG_GRID_EG } from "./table_locale_ar.js";
3
+ import { typeTestCase } from "../types/family_elements/typeTestCase.js";
4
+ import { typeProject } from "../types/family_elements/typeProject.js";
5
+
6
+ /**
7
+ *
8
+ * @version v.0.1 (17/08/2025)
9
+ */
10
+ export class TableBaseConfig
11
+ {
12
+
13
+
14
+ /**
15
+ *
16
+ * @version v.0.1 (17/08/2025)
17
+ * @param {string} element_type
18
+ * @param {string} section
19
+ * @param {string} lang
20
+ *
21
+ * @todo - header_name модифицируем под локаль
22
+ */
23
+ static get_config(element_type, section, lang)
24
+ {
25
+ let response = this.config;
26
+
27
+ response.getRowNodeId = this.#getRowNodeId(element_type);
28
+
29
+ if (lang !== 'en')
30
+ {
31
+ response.localeText = TableBaseConfig.#localeText(lang);
32
+ }
33
+
34
+ return response;
35
+ }
36
+
37
+
38
+ /**
39
+ *
40
+ * @param lang
41
+ * @returns {{}}
42
+ */
43
+ static #localeText(lang)
44
+ {
45
+ let response = {};
46
+ switch (lang)
47
+ {
48
+ case 'ru':
49
+ response = LOCALE_AG_GRID_RU
50
+ break;
51
+ case 'ar':
52
+ response = LOCALE_AG_GRID_EG
53
+ break;
54
+ }
55
+
56
+ return response;
57
+ }
58
+
59
+
60
+ /**
61
+ *
62
+ * @version v.0.1 (17/08/2025)
63
+ * @param element_type
64
+ * @returns {function(*): number}
65
+ *
66
+ */
67
+ static #getRowNodeId(element_type)
68
+ {
69
+ return function (data)
70
+ {
71
+ let id = 0;
72
+ let model = false;
73
+
74
+ switch (element_type)
75
+ {
76
+ case 'test_case':
77
+ model = new typeTestCase();
78
+ break;
79
+ case 'project':
80
+ model = new typeProject();
81
+ break;
82
+ }
83
+
84
+ if (model)
85
+ {
86
+ let key = model.get_primary_key();
87
+ if (data?.[key])
88
+ {
89
+ id= data?.[key];
90
+ }
91
+ }
92
+
93
+ return id;
94
+ }
95
+ }
96
+
97
+
98
+ /**
99
+ *
100
+ * @version v.0.1 (17/08/2025)
101
+ */
102
+ static config = {
103
+ defaultColDef: {
104
+ filter : true,
105
+ sortable : true,
106
+ resizable: true,
107
+ editable : false,
108
+ },
109
+ suppressMenuHide : true,
110
+ columnHoverHighlight : false,
111
+ enableBrowserTooltips : false,
112
+ rowSelection : 'multiple',
113
+ rowMultiSelectWithClick : false,
114
+ suppressRowClickSelection: true,
115
+ enableRangeSelection : true,
116
+ headerHeight: '44',
117
+ rowHeight : '44',
118
+ groupIncludeFooter : false,
119
+ groupIncludeTotalFooter: false,
120
+ overlayLoadingTemplate : '<span class="ag-overlay-loading-center">wait</span>',
121
+ overlayNoRowsTemplate : '<span class="ag-overlay-loading-center">no data</span>',
122
+ suppressNoRowsOverlay : false,
123
+ };
124
+ }
@@ -0,0 +1,195 @@
1
+ import { typeTableConfiguration } from "../types/family_service/typeTableConfiguration.js";
2
+ import { typeTableColumn } from "../types/family_service/typeTableColumn.js";
3
+ import { abstractAppConfiguration } from "./abstract_app_configuration.js";
4
+
5
+ /**
6
+ *
7
+ * @version v.0.1 (17/08/2025)
8
+ */
9
+ export class TableConfiguration extends abstractAppConfiguration
10
+ {
11
+ static config = {};
12
+
13
+ static state = {
14
+ loaded: false
15
+ }
16
+
17
+ /**
18
+ *
19
+ * @param init_options
20
+ */
21
+ constructor(init_options = false)
22
+ {
23
+ super();
24
+ if (this.constructor._instance)
25
+ {
26
+ return this.constructor._instance;
27
+ }
28
+
29
+ this.init_options = init_options;
30
+
31
+ this.constructor._instance = this;
32
+
33
+ TableConfiguration.bootstrap();
34
+ }
35
+
36
+
37
+ /**
38
+ *
39
+ * @version v.0.1 (17/08/2025)
40
+ * @param {string} element_type
41
+ * @param {string} section
42
+ * @param {string} lang
43
+ *
44
+ * @todo - header_name модифицируем под локаль
45
+ */
46
+ static get_config(element_type, section, lang)
47
+ {
48
+ if (!this.state.loaded)
49
+ {
50
+ this.bootstrap();
51
+ }
52
+
53
+ if (this.config?.[ element_type ]?.[ section ])
54
+ {
55
+ return this.config?.[ element_type ]?.[ section ];
56
+ }
57
+ else
58
+ {
59
+ return false;
60
+ }
61
+ }
62
+
63
+
64
+ /****************************************************************************************/
65
+ /****************************************************************************************/
66
+
67
+ /****************************************************************************************/
68
+
69
+
70
+ /**
71
+ * Не понятно пока как лучше организовать
72
+ * @version v.0.1 (17/08/2025)
73
+ */
74
+ static bootstrap()
75
+ {
76
+ if (this.state.loaded)
77
+ {
78
+ return;
79
+ }
80
+
81
+ this.bootstrap_test_case();
82
+
83
+ this.state.loaded = true;
84
+ }
85
+
86
+
87
+ /**
88
+ *
89
+ * @version v.0.1 (17/08/2025)
90
+ */
91
+ static bootstrap_test_case()
92
+ {
93
+ let payload_listing = {};
94
+
95
+ let columns = this.bootstrap_test_case_columns();
96
+
97
+ payload_listing.config = new typeTableConfiguration({
98
+ columns: columns
99
+ });
100
+
101
+ this.config.test_case = {
102
+ listing: payload_listing
103
+ }
104
+ }
105
+
106
+
107
+ /**
108
+ *
109
+ * @version v.0.1 (17/08/2025)
110
+ */
111
+ static bootstrap_test_case_columns()
112
+ {
113
+ let response = [];
114
+
115
+ response.push(new typeTableColumn({
116
+ header_name : 'ID',
117
+ field : 'test_case_id',
118
+ width : '120',
119
+ sort_order : '1',
120
+ cell_classes: 'bg-secondary',
121
+ default_sort: 'asc',
122
+ is_sortable : true,
123
+ is_filter : true,
124
+ is_hide : true,
125
+ is_editable : false,
126
+ }));
127
+
128
+ response.push(new typeTableColumn({
129
+ header_name : 'Name',
130
+ field : 'test_case_title',
131
+ width : '480',
132
+ sort_order : '1',
133
+ cell_classes: '',
134
+ default_sort: '',
135
+ is_sortable : true,
136
+ is_filter : true,
137
+ is_hide : false,
138
+ is_editable : true,
139
+ }));
140
+
141
+ response.push(new typeTableColumn({
142
+ header_name : 'Time',
143
+ field : 'test_case_time_to_execute',
144
+ width : '120',
145
+ sort_order : '2',
146
+ cell_classes: '',
147
+ default_sort: '',
148
+ is_sortable : true,
149
+ is_filter : true,
150
+ is_hide : false,
151
+ is_editable : true,
152
+ }));
153
+
154
+ response.push(new typeTableColumn({
155
+ header_name : 'Complexity',
156
+ field : 'test_case_complexity',
157
+ width : '120',
158
+ sort_order : '2',
159
+ cell_classes: '',
160
+ default_sort: '',
161
+ is_sortable : true,
162
+ is_filter : true,
163
+ is_hide : false,
164
+ is_editable : true,
165
+ }));
166
+
167
+ response.push(new typeTableColumn({
168
+ header_name : 'Importance',
169
+ field : 'test_case_importance',
170
+ width : '120',
171
+ sort_order : '2',
172
+ cell_classes: '',
173
+ default_sort: '',
174
+ is_sortable : true,
175
+ is_filter : true,
176
+ is_hide : false,
177
+ is_editable : true,
178
+ }));
179
+
180
+ response.push(new typeTableColumn({
181
+ header_name : 'updated at',
182
+ field : 'updated_at',
183
+ width : '120',
184
+ sort_order : '2',
185
+ cell_classes: 'bg-secondary',
186
+ default_sort: '',
187
+ is_sortable : true,
188
+ is_filter : true,
189
+ is_hide : true,
190
+ is_editable : false,
191
+ }));
192
+
193
+ return response;
194
+ }
195
+ }