django-smartbase-admin 0.2.91__py3-none-any.whl → 0.2.92__py3-none-any.whl

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.
Files changed (45) hide show
  1. django_smartbase_admin/actions/admin_action_list.py +0 -6
  2. django_smartbase_admin/admin/admin_base.py +1 -0
  3. django_smartbase_admin/admin/widgets.py +70 -0
  4. django_smartbase_admin/engine/admin_base_view.py +4 -1
  5. django_smartbase_admin/engine/filter_widgets.py +182 -1
  6. django_smartbase_admin/locale/sk/LC_MESSAGES/django.mo +0 -0
  7. django_smartbase_admin/locale/sk/LC_MESSAGES/django.po +241 -28
  8. django_smartbase_admin/services/views.py +2 -2
  9. django_smartbase_admin/static/sb_admin/build/webpack.common.js +9 -8
  10. django_smartbase_admin/static/sb_admin/fancytree/jquery.fancytree-all-deps.min.js +2 -0
  11. django_smartbase_admin/static/sb_admin/src/css/_base.css +4 -0
  12. django_smartbase_admin/static/sb_admin/src/css/_inlines.css +3 -3
  13. django_smartbase_admin/static/sb_admin/src/css/_tabulator.css +6 -0
  14. django_smartbase_admin/static/sb_admin/src/css/components/_toggle.css +2 -1
  15. django_smartbase_admin/static/sb_admin/src/css/tree_widget.css +405 -0
  16. django_smartbase_admin/static/sb_admin/src/js/datepicker.js +1 -0
  17. django_smartbase_admin/static/sb_admin/src/js/table.js +18 -2
  18. django_smartbase_admin/static/sb_admin/src/js/table_modules/filter_module.js +3 -1
  19. django_smartbase_admin/static/sb_admin/src/js/table_modules/selection_module.js +20 -2
  20. django_smartbase_admin/static/sb_admin/src/js/table_modules/table_params_module.js +6 -0
  21. django_smartbase_admin/static/sb_admin/src/js/tree_widget.js +376 -0
  22. django_smartbase_admin/templates/sb_admin/actions/tree_list.html +63 -0
  23. django_smartbase_admin/templates/sb_admin/components/columns.html +1 -1
  24. django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/tree_select_filter.html +2 -0
  25. django_smartbase_admin/templates/sb_admin/filter_widgets/tree_select_filter.html +16 -0
  26. django_smartbase_admin/templates/sb_admin/sb_admin_base_no_sidebar.html +7 -5
  27. django_smartbase_admin/templates/sb_admin/sb_admin_js_trans.html +1 -0
  28. django_smartbase_admin/templates/sb_admin/widgets/filer_file.html +1 -1
  29. django_smartbase_admin/templates/sb_admin/widgets/tree_base.html +54 -0
  30. django_smartbase_admin/templates/sb_admin/widgets/tree_select.html +24 -0
  31. django_smartbase_admin/templates/sb_admin/widgets/tree_select_inline.html +12 -0
  32. {django_smartbase_admin-0.2.91.dist-info → django_smartbase_admin-0.2.92.dist-info}/METADATA +2 -2
  33. {django_smartbase_admin-0.2.91.dist-info → django_smartbase_admin-0.2.92.dist-info}/RECORD +35 -36
  34. {django_smartbase_admin-0.2.91.dist-info → django_smartbase_admin-0.2.92.dist-info}/WHEEL +1 -1
  35. django_smartbase_admin/static/sb_admin/dist/chart.js +0 -2
  36. django_smartbase_admin/static/sb_admin/dist/chart.js.LICENSE.txt +0 -13
  37. django_smartbase_admin/static/sb_admin/dist/confirmation_modal.js +0 -1
  38. django_smartbase_admin/static/sb_admin/dist/main.js +0 -2
  39. django_smartbase_admin/static/sb_admin/dist/main.js.LICENSE.txt +0 -131
  40. django_smartbase_admin/static/sb_admin/dist/main_style.css +0 -1
  41. django_smartbase_admin/static/sb_admin/dist/main_style.js +0 -0
  42. django_smartbase_admin/static/sb_admin/dist/table.js +0 -2
  43. django_smartbase_admin/static/sb_admin/dist/table.js.LICENSE.txt +0 -15
  44. django_smartbase_admin/static/sb_admin/dist/translations.js +0 -1
  45. {django_smartbase_admin-0.2.91.dist-info → django_smartbase_admin-0.2.92.dist-info}/LICENSE.md +0 -0
@@ -0,0 +1,405 @@
1
+
2
+ .tree-widget-wrapper > .dropdown-menu {
3
+ min-width: 480px;
4
+ width: auto;
5
+ }
6
+
7
+ .fancytree-ext-table {
8
+ @apply text-14 h-full text-dark-900;
9
+ >thead {
10
+ @apply bg-dark-50 border-b border-dark-200;
11
+ }
12
+ > tbody {
13
+ > tr {
14
+ &.fancytree-selected,
15
+ &:hover,
16
+ &.fancytree-active,
17
+ &.fancytree-active:hover,
18
+ &.fancytree-selected:hover {
19
+ @apply bg-primary-50;
20
+ }
21
+ }
22
+ }
23
+ th {
24
+ @apply whitespace-nowrap p-8 bg-dark-50 text-dark-600 h-48 text-14 font-normal;
25
+ &:first-child {
26
+ @apply pl-16;
27
+ }
28
+ &:last-child {
29
+ @apply pr-16;
30
+ }
31
+ &:not(.text-right) {
32
+ @apply text-left;
33
+ }
34
+ }
35
+ td {
36
+ @apply px-8 py-0 relative;
37
+ &:not(.fancytree-checkbox-column):first-child {
38
+ width: 99%;
39
+ }
40
+ &:not(:first-child) {
41
+ @apply border-b border-dark-200;
42
+ }
43
+ &:first-child,
44
+ &.fancytree-checkbox-column + td {
45
+ overflow: hidden;
46
+ border: none;
47
+ width: 99%;
48
+ }
49
+ &.fancytree-checkbox-column {
50
+ @apply pr-0 w-32;
51
+ }
52
+ &:last-child {
53
+ @apply pr-16;
54
+ }
55
+ .fancytree-title {
56
+ @apply ml-40 whitespace-nowrap;
57
+ a {
58
+ @apply flex items-center px-8 py-4;
59
+ }
60
+ .inactive-title {
61
+ color: #8997AB;
62
+ transition: color 0.2s ease-in-out;
63
+ }
64
+ .inactive-badge {
65
+ border-radius: 4px;
66
+ background: #E2E3E7;
67
+ color: #4B5563 !important;
68
+ padding: 2px 8px;
69
+ font-size: 10px;
70
+ margin-left: 8px;
71
+ }
72
+ }
73
+ }
74
+ tr.fancytree-expanded td {
75
+ .fancytree-title a {
76
+ @apply font-semibold;
77
+ }
78
+ }
79
+ }
80
+
81
+ .fancytree-node {
82
+ @apply flex items-center h-40 relative;
83
+ }
84
+
85
+ .fancytree-icon {
86
+ display: none;
87
+ }
88
+
89
+ .fancytree-checkbox {
90
+ @apply block relative cursor-pointer;
91
+ @apply left-0 bg-light border border-dark-300 rounded transition-colors shadow-xs;
92
+ @apply outline outline-transparent outline-2 outline-offset-2;
93
+ @apply w-20 h-20 top-0;
94
+ @apply rounded;
95
+ &:after {
96
+ content: '';
97
+ @apply block;
98
+ @apply transition-opacity;
99
+ @apply w-18 h-18;
100
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.7072 7.70712L10.7072 17.7071C10.3167 18.0976 9.68349 18.0976 9.29297 17.7071L4.29297 12.7071L5.70718 11.2929L10.0001 15.5858L19.293 6.29291L20.7072 7.70712Z' fill='%23E5E7EB' fill-rule='nonzero'/%3E%3C/svg%3E%0A");
101
+ width: 18px;
102
+ height: 18px;
103
+ top: 1px;
104
+ left: 1px;
105
+ opacity: 0;
106
+ }
107
+ &:hover {
108
+ @apply border-dark;
109
+ &:after {
110
+ opacity: 1;
111
+ }
112
+ }
113
+ }
114
+
115
+ .fancytree-selected {
116
+ opacity: 1;
117
+ .fancytree-checkbox {
118
+ @apply bg-primary border-primary;
119
+ &:after {
120
+ opacity: 1;
121
+ }
122
+ &:hover {
123
+ @apply bg-primary-600 border-primary-600;
124
+ }
125
+ }
126
+ }
127
+
128
+ .fancytree-partsel {
129
+ opacity: 1;
130
+ .fancytree-checkbox {
131
+ @apply bg-primary border-primary;
132
+ &:after {
133
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19.25 13h-14v-2h14v2Z' fill='%23E5E7EB'/%3E%3C/svg%3E");
134
+ opacity: 1;
135
+ }
136
+ &:hover {
137
+ @apply bg-primary-600 border-primary-600;
138
+ }
139
+ }
140
+ }
141
+
142
+ .fancytree-title {
143
+ @apply relative flex items-center h-24;
144
+ }
145
+
146
+ .expander-border {
147
+ @apply absolute left-0 bottom-0 right-0;
148
+ &:after {
149
+ content: '';
150
+ @apply block absolute bottom-0 left-full;
151
+ right: -100vw;
152
+ @apply border-b border-dark-200;
153
+ }
154
+ }
155
+
156
+ .fancytree-expander {
157
+ @apply w-32 h-full;
158
+ @apply flex items-center justify-center;
159
+ background-size: 16px;
160
+ position: absolute;
161
+ --expander-border: 2px solid var(--color-dark-400);
162
+ >div {
163
+ @apply w-20 h-20;
164
+ background-position: center;
165
+ position: relative;
166
+ z-index: 1;
167
+ }
168
+ &:before,
169
+ &:after {
170
+ content: '';
171
+ @apply block absolute;
172
+ }
173
+ &:before {
174
+ border-bottom: var(--expander-border);
175
+ top: 50%;
176
+ left: -50%;
177
+ right: 0;
178
+ @apply mr-16;
179
+ }
180
+ &:after {
181
+ border-left: var(--expander-border);
182
+ left: 50%;
183
+ }
184
+ &.level-1 {
185
+ &:before,
186
+ &:after {
187
+ content: none;
188
+ }
189
+ }
190
+ &.expanded-parent {
191
+ .expander-additional {
192
+ position: absolute;
193
+ top: 0;
194
+ bottom: 0;
195
+ &:before {
196
+ content: '';
197
+ display: block;
198
+ position: absolute;
199
+ border-left: var(--expander-border);
200
+ top: 0;
201
+ bottom: 0;
202
+ }
203
+ }
204
+ }
205
+ &:hover {
206
+ >div {
207
+ filter: brightness(0.5);
208
+ }
209
+ }
210
+ }
211
+
212
+ tr.fancytree-has-children span.fancytree-expander:before {
213
+ right: 50%;
214
+ }
215
+
216
+ .fancytree-ico-e {
217
+ .fancytree-expander {
218
+ &:before {
219
+ bottom: 50%;
220
+ }
221
+ &:after {
222
+ top: 50%;
223
+ bottom: 0;
224
+ @apply mt-16;
225
+ }
226
+ }
227
+ }
228
+
229
+ .fancytree-ico-c {
230
+ .fancytree-expander {
231
+ &:before {
232
+
233
+ }
234
+ &:after {
235
+ left: -50%;
236
+ }
237
+ }
238
+ }
239
+
240
+ .fancytree-lastsib span.fancytree-expander.expanded-parent .expander-additional-last:before {
241
+ bottom: 50% !important;
242
+ }
243
+
244
+ .fancytree-exp-c, .fancytree-exp-e {
245
+ &:first-child .fancytree-expander:after {
246
+ top: 50%;
247
+ }
248
+ }
249
+
250
+ .fancytree-exp-cl span.fancytree-expander:after {
251
+ bottom: 50%;
252
+ }
253
+
254
+ .fancytree-ext-filter-hide-expanders tr.fancytree-match span.fancytree-expander {
255
+ visibility: visible;
256
+ }
257
+
258
+ .fancytree-exp-n, .fancytree-exp-nl {
259
+ .fancytree-expander {
260
+ > div {
261
+ display: none;
262
+ }
263
+ &:before {
264
+ @apply mr-8;
265
+ }
266
+ }
267
+ }
268
+
269
+ .fancytree-exp-nl .fancytree-expander:after {
270
+ bottom: 50%;
271
+ }
272
+
273
+ .fancytree-exp-c, .fancytree-exp-cl {
274
+ .fancytree-expander > div {
275
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 3C7.02943 3 3 7.02943 3 12C3 16.9706 7.02943 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02943 16.9706 3 12 3ZM11 11V8H13V11H16V13H13V16H11V13H8V11H11Z' fill='%236B7280'/%3E%3C/svg%3E");
276
+ }
277
+ }
278
+
279
+ .fancytree-exp-e, .fancytree-exp-ed, .fancytree-exp-edl, .fancytree-exp-el {
280
+ .fancytree-expander > div {
281
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1ZM3 12C3 7.02943 7.02943 3 12 3C16.9706 3 21 7.02943 21 12C21 16.9706 16.9706 21 12 21C7.02943 21 3 16.9706 3 12ZM8 13H16V11H8V13Z' fill='%236B7280'/%3E%3C/svg%3E");
282
+ }
283
+ }
284
+
285
+ .fancytree-hide {
286
+ @apply hidden;
287
+ }
288
+
289
+ .fancytree-submatch:not(.fancytree-match) > *{
290
+ opacity: 0.5;
291
+ }
292
+
293
+ .fancytree-status-merged {
294
+ @apply h-40;
295
+ }
296
+
297
+ .fancytree-statusnode-loading,
298
+ .fancytree-statusnode-error {
299
+ pointer-events: none;
300
+ }
301
+
302
+ .filter-wrapper .fancytree-ext-table {
303
+ > thead {
304
+ @apply hidden;
305
+ }
306
+ .fancytree-checkbox-column {
307
+ @apply pl-12 pr-4;
308
+ @apply sticky left-0 bg-light z-1;
309
+ + td {
310
+ @apply pl-0 isolate;
311
+ }
312
+ }
313
+
314
+ > tbody > tr {
315
+ &.fancytree-selected,
316
+ &:hover,
317
+ &.fancytree-active,
318
+ &.fancytree-active:hover,
319
+ &.fancytree-selected:hover {
320
+ > .fancytree-checkbox-column {
321
+ @apply bg-primary-50;
322
+ }
323
+ }
324
+ }
325
+ }
326
+
327
+ #fancytree-drop-marker {
328
+ height: 42px;
329
+ width: 100%;
330
+ position: absolute;
331
+ margin: 0;
332
+
333
+ &:before {
334
+ content: '';
335
+ display: block;
336
+ position: absolute;
337
+ left: 0;
338
+ top: 0;
339
+ width: 100%;
340
+ height: 100%;
341
+
342
+ }
343
+
344
+ &:after {
345
+ content: '';
346
+ display: block;
347
+ position: absolute;
348
+ top: 0;
349
+ bottom: 0;
350
+ right: 100%;
351
+ width: 28px;
352
+ @apply bg-no-repeat;
353
+ }
354
+ }
355
+
356
+ #fancytree-drop-marker.fancytree-drop-before {
357
+ &:before {
358
+ @apply border-t-2 border-primary;
359
+ margin-top: 12px;
360
+ }
361
+
362
+ &:after {
363
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.5859 10L15.293 7.70711L16.7072 6.29289L20.7072 10.2929C21.0977 10.6834 21.0977 11.3166 20.7072 11.7071L16.7072 15.7071L15.293 14.2929L17.5859 12H5.5C5.22385 12 5 12.2238 5 12.5V19H3V12.5C3 11.1193 4.1193 10 5.5 10H17.5859Z" fill="%2300959D"/></svg>');
364
+ background-position: top right;
365
+ top: 2px;
366
+ }
367
+ }
368
+
369
+ #fancytree-drop-marker.fancytree-drop-after {
370
+ &:before {
371
+ @apply border-b-2 border-primary;
372
+ margin-top: -12px;
373
+ }
374
+
375
+ &:after {
376
+ bottom: 2px;
377
+ transform: rotateX(180deg);
378
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.5859 10L15.293 7.70711L16.7072 6.29289L20.7072 10.2929C21.0977 10.6834 21.0977 11.3166 20.7072 11.7071L16.7072 15.7071L15.293 14.2929L17.5859 12H5.5C5.22385 12 5 12.2238 5 12.5V19H3V12.5C3 11.1193 4.1193 10 5.5 10H17.5859Z" fill="%2300959D"/></svg>');
379
+ background-position: top right;
380
+
381
+ }
382
+ }
383
+
384
+ #fancytree-drop-marker.fancytree-drop-over {
385
+ &:before {
386
+ @apply border-y-2 border-primary;
387
+ }
388
+
389
+ &:after {
390
+ background-position: center right;
391
+ top: 2px;
392
+ background-color: white;
393
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 3C7.02943 3 3 7.02943 3 12C3 16.9706 7.02943 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02943 16.9706 3 12 3ZM13.8315 13.25H7.24609V11.25H13.8315L11.0386 8.45711L12.4528 7.04289L16.9528 11.5429C17.3433 11.9334 17.3433 12.5666 16.9528 12.9571L12.4528 17.4571L11.0386 16.0429L13.8315 13.25Z" fill="%2300959D"/></svg>');
394
+ }
395
+ }
396
+
397
+ span.fancytree-drag-source.fancytree-drag-remove {
398
+ opacity: 0.5;
399
+ }
400
+
401
+ .fancytree-ext-table:active {
402
+ > tbody > tr.fancytree-active {
403
+ background-color: transparent;
404
+ }
405
+ }
@@ -10,6 +10,7 @@ import {
10
10
  export default class Datepicker {
11
11
  constructor() {
12
12
  let documentLocale = document.documentElement.lang || 'default'
13
+ documentLocale = documentLocale.split('-')[0]
13
14
  if (documentLocale === 'en') {
14
15
  documentLocale = 'default'
15
16
  }
@@ -1,4 +1,4 @@
1
- import {TabulatorFull as Tabulator} from 'tabulator-tables'
1
+ import {TabulatorFull as Tabulator, Renderer} from 'tabulator-tables'
2
2
  import {ViewsModule} from "./table_modules/views_module"
3
3
  import {SelectionModule} from "./table_modules/selection_module"
4
4
  import {ColumnDisplayModule} from "./table_modules/column_display_module"
@@ -106,12 +106,18 @@ class SBAdminTable {
106
106
  }
107
107
  }
108
108
 
109
+ isFiltered() {
110
+ return this.getUrlParams()[this.constants.FILTER_DATA_NAME] !== undefined
111
+ }
112
+
109
113
  loadFromUrlAfterInit() {
110
114
  window.htmx.process(this.tabulator.rowManager.tableElement)
111
- this.tabulator.on("dataProcessed", () => {
115
+ this.tabulator.on("dataProcessed", (data) => {
112
116
  window.htmx.process(this.tabulator.rowManager.tableElement)
117
+ document.body.dispatchEvent(new CustomEvent('tableDataProcessed', {"detail": {"data": data, "isFiltered": this.isFiltered()}}))
113
118
  })
114
119
  this.callModuleAction('loadFromUrlAfterInit')
120
+ document.body.dispatchEvent(new CustomEvent('tableDataProcessed', {"detail": {"data": this.tabulator.getData(), "isFiltered": this.isFiltered()}}))
115
121
  }
116
122
 
117
123
  initModules(modules) {
@@ -246,6 +252,16 @@ class SBAdminTable {
246
252
  document.getElementById(this.viewId + "-tabulator-header").style.display = "none"
247
253
  }
248
254
 
255
+ class NoRender extends Renderer {
256
+ render() {}
257
+ }
258
+ if(this.tabulatorOptions['renderVertical'] === "no-render") {
259
+ this.tabulatorOptions['renderVertical'] = NoRender
260
+ }
261
+ if(this.tabulatorOptions['renderHorizontal'] === "no-render") {
262
+ this.tabulatorOptions['renderHorizontal'] =NoRender
263
+ }
264
+
249
265
  let tabulatorOptions = {
250
266
  columns: this.tableColumns,
251
267
  ajaxURL: this.tableAjaxUrl,
@@ -67,7 +67,9 @@ export class FilterModule extends SBAdminTableModule {
67
67
  const filterData = new FormData(filterForm).entries()
68
68
  const filterDataNotEmpty = {}
69
69
  for (const [key, value] of filterData) {
70
- filterDataNotEmpty[key] = value
70
+ if(value) {
71
+ filterDataNotEmpty[key] = value
72
+ }
71
73
  }
72
74
  if (Object.keys(filterDataNotEmpty).length > 0) {
73
75
  params[this.table.constants.FILTER_DATA_NAME] = filterDataNotEmpty
@@ -18,10 +18,11 @@ export class SelectionModule extends SBAdminTableModule {
18
18
  this.tableSelectedRows = selectedRows
19
19
  this.tableDeselectedRows = deselectedRows
20
20
  if (selectedRows === this.table.constants.SELECT_ALL_KEYWORD) {
21
- tableSelectedRowsInfo.innerHTML = this.table.tabulator.modules.page.remoteRowCountEstimate - deselectedRows.size
21
+ const count = this.table.tabulator.modules.page.remoteRowCountEstimate - deselectedRows.size
22
+ tableSelectedRowsInfo.innerHTML = window.sb_admin_translation_strings["selected"].replace('${value}', count)
22
23
  return
23
24
  }
24
- tableSelectedRowsInfo.innerHTML = `${selectedRows.size} selected`
25
+ tableSelectedRowsInfo.innerHTML = window.sb_admin_translation_strings["selected"].replace('${value}', selectedRows.size)
25
26
  if (selectedRows.size > 0) {
26
27
  tableSelectedRowsBar.classList.add('show')
27
28
  document.getElementById('table-selected-rows-bar-select-all').checked = true
@@ -34,11 +35,13 @@ export class SelectionModule extends SBAdminTableModule {
34
35
  selectAllData() {
35
36
  this.table.tabulator.selectRow('all')
36
37
  this.setSelectedRows(this.table.constants.SELECT_ALL_KEYWORD, new Set())
38
+ document.body.dispatchEvent(new CustomEvent('treeSelectAllRows'))
37
39
  }
38
40
 
39
41
  selectNoData() {
40
42
  this.table.tabulator.deselectRow()
41
43
  this.setSelectedRows(new Set(), new Set())
44
+ document.body.dispatchEvent(new CustomEvent('treeDeselectAllRows'))
42
45
  }
43
46
 
44
47
  rowSelectionFormatter(tabulatorFormatterHandle, cell, formatterParams, onRendered) {
@@ -147,6 +150,21 @@ export class SelectionModule extends SBAdminTableModule {
147
150
  afterInit() {
148
151
  this.table.tabulator.on("rowSelected", this.getSelectionHandler("rowSelected"))
149
152
  this.table.tabulator.on("rowDeselected", this.getSelectionHandler("rowDeselected"))
153
+ this.table.tabulator.on("rowSelectionChanged", (data)=> {
154
+ if(data.length === 0) {
155
+ document.body.dispatchEvent(new CustomEvent('treeDeselectAllRows'))
156
+ }
157
+ })
158
+ document.body.addEventListener("treeRowSelected", (e) => {
159
+ const selectedRowIds = this.table.tabulator.getSelectedData().map(rowData => rowData.id)
160
+ const newSelectedRowIds = e.detail.data
161
+ const newSelectedRowIdsSet = new Set(e.detail.data)
162
+
163
+ const rowIdsToDeselect = selectedRowIds.filter((e) => !newSelectedRowIdsSet.has(e))
164
+
165
+ this.table.tabulator.deselectRow(rowIdsToDeselect)
166
+ this.table.tabulator.selectRow(newSelectedRowIds)
167
+ })
150
168
  }
151
169
 
152
170
  loadFromUrlAfterInit() {
@@ -117,6 +117,9 @@ export class TableParamsModule extends SBAdminTableModule {
117
117
  }
118
118
 
119
119
  createPagination(paginationWidget) {
120
+ if(!paginationWidget) {
121
+ return
122
+ }
120
123
  const maxPage = this.table.tabulator.getPageMax()
121
124
  const currentPage = this.table.tabulator.getPage()
122
125
  const currentPageSize = this.table.tabulator.getPageSize()
@@ -242,6 +245,9 @@ export class TableParamsModule extends SBAdminTableModule {
242
245
  }
243
246
 
244
247
  createPageSize(pageSizeWidget) {
248
+ if(!pageSizeWidget) {
249
+ return
250
+ }
245
251
  pageSizeWidget.innerHTML = ''
246
252
  const pageSizeWrapper = document.createElement('div')
247
253
  pageSizeWrapper.classList.add('relative')