django-smartbase-admin 0.2.54__py3-none-any.whl → 1.0.38__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.
- django_smartbase_admin/actions/admin_action_list.py +74 -38
- django_smartbase_admin/actions/advanced_filters.py +24 -1
- django_smartbase_admin/admin/admin_base.py +401 -96
- django_smartbase_admin/admin/site.py +93 -35
- django_smartbase_admin/admin/widgets.py +589 -26
- django_smartbase_admin/apps.py +2 -0
- django_smartbase_admin/engine/actions.py +34 -16
- django_smartbase_admin/engine/admin_base_view.py +252 -115
- django_smartbase_admin/engine/configuration.py +186 -4
- django_smartbase_admin/engine/const.py +6 -0
- django_smartbase_admin/engine/dashboard.py +44 -23
- django_smartbase_admin/engine/fake_inline.py +15 -11
- django_smartbase_admin/engine/field.py +42 -12
- django_smartbase_admin/engine/field_formatter.py +22 -8
- django_smartbase_admin/engine/filter_widgets.py +309 -20
- django_smartbase_admin/engine/menu_item.py +8 -5
- django_smartbase_admin/engine/modal_view.py +12 -7
- django_smartbase_admin/engine/request.py +2 -0
- django_smartbase_admin/integration/__init__.py +0 -0
- django_smartbase_admin/integration/django_cms.py +43 -0
- django_smartbase_admin/locale/sk/LC_MESSAGES/django.mo +0 -0
- django_smartbase_admin/locale/sk/LC_MESSAGES/django.po +268 -37
- django_smartbase_admin/migrations/0005_sbadminuserconfiguration.py +26 -0
- django_smartbase_admin/migrations/0006_alter_sbadminuserconfiguration_color_scheme.py +18 -0
- django_smartbase_admin/models.py +22 -0
- django_smartbase_admin/monkeypatch/admin_readonly_field_monkeypatch.py +96 -0
- django_smartbase_admin/monkeypatch/fake_inline_monkeypatch.py +1 -1
- django_smartbase_admin/querysets.py +3 -0
- django_smartbase_admin/services/configuration.py +30 -0
- django_smartbase_admin/services/thread_local.py +6 -19
- django_smartbase_admin/services/views.py +80 -13
- django_smartbase_admin/services/xlsx_export.py +6 -0
- django_smartbase_admin/static/sb_admin/build/tailwind.config.js +1 -0
- django_smartbase_admin/static/sb_admin/build/tailwind_config_partials/colors.js +4 -0
- django_smartbase_admin/static/sb_admin/build/tailwind_config_partials/spacing.js +1 -0
- django_smartbase_admin/static/sb_admin/build/webpack.common.js +11 -8
- django_smartbase_admin/static/sb_admin/css/ckeditor/ckeditor_content_dark.css +208 -0
- django_smartbase_admin/static/sb_admin/css/coloris/coloris.min.css +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar.js +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar_style.css +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar_style.js +0 -0
- django_smartbase_admin/static/sb_admin/dist/chart.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/main.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/main_style.css +1 -1
- django_smartbase_admin/static/sb_admin/dist/table.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/tree_widget.js +1 -0
- django_smartbase_admin/static/sb_admin/dist/tree_widget_style.css +1 -0
- django_smartbase_admin/static/sb_admin/dist/tree_widget_style.js +0 -0
- django_smartbase_admin/static/sb_admin/fancytree/jquery.fancytree-all-deps.min.js +1 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-csv.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-doc.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-docx.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-other.svg +13 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-pdf.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-ppt.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-xls.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-xlsx.svg +11 -0
- django_smartbase_admin/static/sb_admin/images/file_types/file-zip.svg +18 -0
- django_smartbase_admin/static/sb_admin/images/flags/de-at.png +0 -0
- django_smartbase_admin/static/sb_admin/images/flags/de-ch.png +0 -0
- django_smartbase_admin/static/sb_admin/images/logo_light.svg +21 -0
- django_smartbase_admin/static/sb_admin/js/coloris/coloris.min.js +6 -0
- django_smartbase_admin/static/sb_admin/js/fullcalendar.min.js +14804 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Bolt-one.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Calendar.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Caution.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Electric-drill.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Fire-extinguisher.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Gas.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Lightning-fill.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Moon.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Phone-telephone.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Printer.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Pull.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Sun-one.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Time.svg +3 -0
- django_smartbase_admin/static/sb_admin/src/css/_base.css +5 -1
- django_smartbase_admin/static/sb_admin/src/css/_colors.css +257 -82
- django_smartbase_admin/static/sb_admin/src/css/_components.css +61 -13
- django_smartbase_admin/static/sb_admin/src/css/_datepicker.css +8 -1
- django_smartbase_admin/static/sb_admin/src/css/_filer.css +60 -0
- django_smartbase_admin/static/sb_admin/src/css/_inlines.css +51 -10
- django_smartbase_admin/static/sb_admin/src/css/_tabulator.css +8 -2
- django_smartbase_admin/static/sb_admin/src/css/calendar.css +162 -0
- django_smartbase_admin/static/sb_admin/src/css/components/_button.css +41 -1
- django_smartbase_admin/static/sb_admin/src/css/components/_dropdown.css +26 -8
- django_smartbase_admin/static/sb_admin/src/css/components/_input.css +62 -20
- django_smartbase_admin/static/sb_admin/src/css/components/_modal.css +1 -1
- django_smartbase_admin/static/sb_admin/src/css/components/_query-builder.css +21 -2
- django_smartbase_admin/static/sb_admin/src/css/components/_toggle.css +12 -1
- django_smartbase_admin/static/sb_admin/src/css/components/_tooltip.css +8 -22
- django_smartbase_admin/static/sb_admin/src/css/style.css +17 -0
- django_smartbase_admin/static/sb_admin/src/css/tree_widget.css +411 -0
- django_smartbase_admin/static/sb_admin/src/js/autocomplete.js +63 -5
- django_smartbase_admin/static/sb_admin/src/js/calendar.js +56 -0
- django_smartbase_admin/static/sb_admin/src/js/chart.js +8 -22
- django_smartbase_admin/static/sb_admin/src/js/choices.js +18 -8
- django_smartbase_admin/static/sb_admin/src/js/datepicker.js +97 -336
- django_smartbase_admin/static/sb_admin/src/js/datepicker_plugins.js +357 -0
- django_smartbase_admin/static/sb_admin/src/js/main.js +304 -31
- django_smartbase_admin/static/sb_admin/src/js/multiselect.js +50 -41
- django_smartbase_admin/static/sb_admin/src/js/range.js +3 -2
- django_smartbase_admin/static/sb_admin/src/js/table.js +34 -5
- django_smartbase_admin/static/sb_admin/src/js/table_modules/advanced_filter_module.js +43 -20
- django_smartbase_admin/static/sb_admin/src/js/table_modules/data_edit_module.js +8 -10
- django_smartbase_admin/static/sb_admin/src/js/table_modules/filter_module.js +3 -3
- django_smartbase_admin/static/sb_admin/src/js/table_modules/header_tabs_module.js +11 -11
- django_smartbase_admin/static/sb_admin/src/js/table_modules/selection_module.js +28 -8
- django_smartbase_admin/static/sb_admin/src/js/table_modules/table_params_module.js +6 -0
- django_smartbase_admin/static/sb_admin/src/js/table_modules/views_module.js +6 -0
- django_smartbase_admin/static/sb_admin/src/js/tree_widget.js +406 -0
- django_smartbase_admin/static/sb_admin/src/js/utils.js +56 -21
- django_smartbase_admin/templates/sb_admin/actions/change_form.html +169 -114
- django_smartbase_admin/templates/sb_admin/actions/dashboard.html +2 -2
- django_smartbase_admin/templates/sb_admin/actions/list.html +79 -39
- django_smartbase_admin/templates/sb_admin/actions/partials/action_link.html +14 -0
- django_smartbase_admin/templates/sb_admin/actions/partials/tabulator_header_v2.html +2 -2
- django_smartbase_admin/templates/sb_admin/actions/tree_list.html +63 -0
- django_smartbase_admin/templates/sb_admin/authentification/login_base.html +5 -1
- django_smartbase_admin/templates/sb_admin/components/columns.html +1 -1
- django_smartbase_admin/templates/sb_admin/components/filters_v2.html +99 -85
- django_smartbase_admin/templates/sb_admin/dashboard/calendar_widget.html +69 -0
- django_smartbase_admin/templates/sb_admin/dashboard/chart_widget.html +21 -2
- django_smartbase_admin/templates/sb_admin/dashboard/list_widget.html +6 -0
- django_smartbase_admin/templates/sb_admin/dashboard/widget_base.html +1 -1
- django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/date_field.html +18 -8
- django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/multiple_choice_field.html +1 -1
- django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/tree_select_filter.html +2 -0
- django_smartbase_admin/templates/sb_admin/filter_widgets/date_field.html +18 -4
- django_smartbase_admin/templates/sb_admin/filter_widgets/multiple_choice_field.html +14 -0
- django_smartbase_admin/templates/sb_admin/filter_widgets/partials/clear.html +10 -5
- django_smartbase_admin/templates/sb_admin/filter_widgets/radio_choice_field.html +2 -2
- django_smartbase_admin/templates/sb_admin/filter_widgets/tree_select_filter.html +16 -0
- django_smartbase_admin/templates/sb_admin/includes/change_form_title.html +3 -1
- django_smartbase_admin/templates/sb_admin/includes/inline_fieldset.html +48 -39
- django_smartbase_admin/templates/sb_admin/includes/notifications.html +2 -1
- django_smartbase_admin/templates/sb_admin/includes/readonly_boolean_field.html +9 -0
- django_smartbase_admin/templates/sb_admin/includes/readonly_field.html +12 -0
- django_smartbase_admin/templates/sb_admin/includes/table_inline_delete_button.html +4 -5
- django_smartbase_admin/templates/sb_admin/inlines/stacked_inline.html +68 -40
- django_smartbase_admin/templates/sb_admin/inlines/table_inline.html +76 -34
- django_smartbase_admin/templates/sb_admin/integrations/filer/folder_list.html +18 -0
- django_smartbase_admin/templates/sb_admin/navigation.html +166 -158
- django_smartbase_admin/templates/sb_admin/partials/modal/modal_content.html +2 -6
- django_smartbase_admin/templates/sb_admin/sb_admin_base.html +49 -4
- django_smartbase_admin/templates/sb_admin/sb_admin_base_no_sidebar.html +27 -11
- django_smartbase_admin/templates/sb_admin/sb_admin_js_trans.html +3 -0
- django_smartbase_admin/templates/sb_admin/sprites/sb_admin.svg +1 -1
- django_smartbase_admin/templates/sb_admin/tailwind_whitelist.html +6 -3
- django_smartbase_admin/templates/sb_admin/widgets/array.html +0 -1
- django_smartbase_admin/templates/sb_admin/widgets/attributes.html +68 -0
- django_smartbase_admin/templates/sb_admin/widgets/autocomplete.html +13 -2
- django_smartbase_admin/templates/sb_admin/widgets/{checkbox_select.html → checkbox_dropdown.html} +2 -2
- django_smartbase_admin/templates/sb_admin/widgets/clearable_file_input.html +2 -2
- django_smartbase_admin/templates/sb_admin/widgets/color_field.html +30 -0
- django_smartbase_admin/templates/sb_admin/widgets/date.html +8 -1
- django_smartbase_admin/templates/sb_admin/widgets/filer_file.html +84 -0
- django_smartbase_admin/templates/sb_admin/widgets/includes/related_item_buttons.html +38 -0
- django_smartbase_admin/templates/sb_admin/widgets/multiwidget.html +1 -1
- django_smartbase_admin/templates/sb_admin/widgets/radio.html +3 -2
- django_smartbase_admin/templates/sb_admin/widgets/radio_dropdown.html +30 -0
- django_smartbase_admin/templates/sb_admin/widgets/read_only_password_hash.html +3 -0
- django_smartbase_admin/templates/sb_admin/widgets/time.html +8 -1
- django_smartbase_admin/templates/sb_admin/widgets/toggle.html +1 -1
- django_smartbase_admin/templates/sb_admin/widgets/tree_base.html +59 -0
- django_smartbase_admin/templates/sb_admin/widgets/tree_select.html +24 -0
- django_smartbase_admin/templates/sb_admin/widgets/tree_select_inline.html +12 -0
- django_smartbase_admin/templatetags/sb_admin_tags.py +85 -4
- django_smartbase_admin/utils.py +22 -3
- django_smartbase_admin/views/dashboard_view.py +6 -0
- django_smartbase_admin/views/global_filter_view.py +8 -2
- django_smartbase_admin/views/translations_view.py +12 -5
- django_smartbase_admin/views/user_config_view.py +52 -0
- django_smartbase_admin-1.0.38.dist-info/METADATA +166 -0
- {django_smartbase_admin-0.2.54.dist-info → django_smartbase_admin-1.0.38.dist-info}/RECORD +177 -115
- {django_smartbase_admin-0.2.54.dist-info → django_smartbase_admin-1.0.38.dist-info}/WHEEL +1 -1
- django_smartbase_admin/templates/sb_admin/integrations/sorting/change_list.html +0 -401
- django_smartbase_admin-0.2.54.dist-info/METADATA +0 -25
- {django_smartbase_admin-0.2.54.dist-info → django_smartbase_admin-1.0.38.dist-info}/LICENSE.md +0 -0
|
@@ -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,22 @@ class SBAdminTable {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
isFiltered() {
|
|
110
|
+
const filterParams = this.getUrlParams()[this.constants.FILTER_DATA_NAME]
|
|
111
|
+
if(filterParams === undefined) {
|
|
112
|
+
return false
|
|
113
|
+
}
|
|
114
|
+
return Object.values(filterParams).some(val=>val)
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
loadFromUrlAfterInit() {
|
|
110
118
|
window.htmx.process(this.tabulator.rowManager.tableElement)
|
|
111
|
-
this.tabulator.on("dataProcessed", () => {
|
|
119
|
+
this.tabulator.on("dataProcessed", (data) => {
|
|
112
120
|
window.htmx.process(this.tabulator.rowManager.tableElement)
|
|
121
|
+
document.body.dispatchEvent(new CustomEvent('tableDataProcessed', {"detail": {"data": data, "isFiltered": this.isFiltered()}}))
|
|
113
122
|
})
|
|
114
123
|
this.callModuleAction('loadFromUrlAfterInit')
|
|
124
|
+
document.body.dispatchEvent(new CustomEvent('tableDataProcessed', {"detail": {"data": this.tabulator.getData(), "isFiltered": this.isFiltered()}}))
|
|
115
125
|
}
|
|
116
126
|
|
|
117
127
|
initModules(modules) {
|
|
@@ -246,6 +256,16 @@ class SBAdminTable {
|
|
|
246
256
|
document.getElementById(this.viewId + "-tabulator-header").style.display = "none"
|
|
247
257
|
}
|
|
248
258
|
|
|
259
|
+
class NoRender extends Renderer {
|
|
260
|
+
render() {}
|
|
261
|
+
}
|
|
262
|
+
if(this.tabulatorOptions['renderVertical'] === "no-render") {
|
|
263
|
+
this.tabulatorOptions['renderVertical'] = NoRender
|
|
264
|
+
}
|
|
265
|
+
if(this.tabulatorOptions['renderHorizontal'] === "no-render") {
|
|
266
|
+
this.tabulatorOptions['renderHorizontal'] =NoRender
|
|
267
|
+
}
|
|
268
|
+
|
|
249
269
|
let tabulatorOptions = {
|
|
250
270
|
columns: this.tableColumns,
|
|
251
271
|
ajaxURL: this.tableAjaxUrl,
|
|
@@ -271,12 +291,17 @@ class SBAdminTable {
|
|
|
271
291
|
Tabulator.registerModule(SBAjaxParamsTabulatorModifier)
|
|
272
292
|
this.tabulator = new Tabulator(this.tableElSelector, tabulatorOptions)
|
|
273
293
|
this.tabulator.SBTable = this
|
|
274
|
-
document.addEventListener(
|
|
294
|
+
document.addEventListener(window.sb_admin_const.TABLE_RELOAD_DATA_EVENT_NAME, function () {
|
|
275
295
|
self.refreshTableDataIfNotUrlLoad()
|
|
276
296
|
})
|
|
297
|
+
document.addEventListener(window.sb_admin_const.TABLE_UPDATE_ROW_DATA_EVENT_NAME, function (e) {
|
|
298
|
+
if (e.detail && e.detail.rowData) {
|
|
299
|
+
self.tabulator.updateData(e.detail.rowData)
|
|
300
|
+
}
|
|
301
|
+
})
|
|
277
302
|
}
|
|
278
303
|
|
|
279
|
-
executeListAction(action_url, no_params) {
|
|
304
|
+
executeListAction(action_url, no_params, open_in_new_tab = false) {
|
|
280
305
|
const params = this.getUrlParamsString()
|
|
281
306
|
if (this.tabulatorOptions["ajaxConfig"]["method"] === "POST") {
|
|
282
307
|
const urlParams = new URLSearchParams(params)
|
|
@@ -323,7 +348,11 @@ class SBAdminTable {
|
|
|
323
348
|
if (!no_params) {
|
|
324
349
|
action_url += params
|
|
325
350
|
}
|
|
326
|
-
|
|
351
|
+
if (open_in_new_tab) {
|
|
352
|
+
window.open(action_url, '_blank')
|
|
353
|
+
} else {
|
|
354
|
+
window.location.href = action_url
|
|
355
|
+
}
|
|
327
356
|
}
|
|
328
357
|
}
|
|
329
358
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SBAdminTableModule } from "./base_module"
|
|
2
2
|
import { filterInputValueChangedUtil, filterInputValueChangeListener } from "../utils"
|
|
3
|
+
import {customActionsPlugin, monthYearViewsPlugin} from "../datepicker_plugins"
|
|
3
4
|
|
|
4
5
|
export class AdvancedFilterModule extends SBAdminTableModule {
|
|
5
6
|
constructor(table) {
|
|
@@ -16,13 +17,13 @@ export class AdvancedFilterModule extends SBAdminTableModule {
|
|
|
16
17
|
window.SBAdmin.range.initRange(widgetEl)
|
|
17
18
|
widgetEl.dispatchEvent(new CustomEvent("SBTableFilterFormLoad"))
|
|
18
19
|
},
|
|
19
|
-
".js-datepicker-
|
|
20
|
+
".js-datepicker-dynamic": (rule, ruleEl, widgetEl) => {
|
|
20
21
|
this.dateOperatorUpdate(rule, ruleEl, widgetEl)
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
this.afterUpdateRuleOperatorFunctions = {
|
|
24
25
|
".js-range": this.rangeOperatorUpdate,
|
|
25
|
-
".js-datepicker-
|
|
26
|
+
".js-datepicker-dynamic": this.dateOperatorUpdate.bind(this)
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -36,6 +37,9 @@ export class AdvancedFilterModule extends SBAdminTableModule {
|
|
|
36
37
|
if(!filterData?.rules || filterData.rules.length === 0) {
|
|
37
38
|
filterData = emptyRules
|
|
38
39
|
}
|
|
40
|
+
document.querySelectorAll('.js-datepicker-dynamic').forEach(widgetEl => {
|
|
41
|
+
this.destroyDatePicker(widgetEl)
|
|
42
|
+
})
|
|
39
43
|
window.dispatchEvent(new CustomEvent("SBinitOrUpdateQueryBuilder", { detail: { SBTable: this, filterData: filterData } }))
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -95,26 +99,45 @@ export class AdvancedFilterModule extends SBAdminTableModule {
|
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
destroyDatePicker(widgetEl) {
|
|
103
|
+
if(widgetEl._flatpickr){
|
|
104
|
+
widgetEl._flatpickr.calendarContainer?.remove()
|
|
105
|
+
widgetEl._flatpickr.clear()
|
|
106
|
+
widgetEl._flatpickr.destroy()
|
|
107
|
+
widgetEl._flatpickr = undefined
|
|
108
|
+
return
|
|
102
109
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
widgetEl.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const currentMode = flatPickr.config.mode
|
|
110
|
+
const dropdownInstance = window.bootstrap5.Dropdown.getInstance(widgetEl)
|
|
111
|
+
if(dropdownInstance) {
|
|
112
|
+
dropdownInstance.dispose()
|
|
113
|
+
widgetEl.removeAttribute('data-bs-toggle')
|
|
114
|
+
widgetEl.nextElementSibling?.remove()
|
|
115
|
+
widgetEl.readOnly = false
|
|
116
|
+
widgetEl.value = ""
|
|
117
|
+
}
|
|
118
|
+
}
|
|
113
119
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
dateOperatorUpdate(rule, ruleEl, widgetEl) {
|
|
121
|
+
let optionsOverride = {
|
|
122
|
+
inline: false,
|
|
123
|
+
mode: "single",
|
|
124
|
+
allowInput: true,
|
|
125
|
+
plugins: [
|
|
126
|
+
monthYearViewsPlugin,
|
|
127
|
+
customActionsPlugin
|
|
128
|
+
],
|
|
129
|
+
}
|
|
130
|
+
if (["between", "not_between", "in_the_last", "in_the_next"].includes(rule.operator.type)) {
|
|
131
|
+
optionsOverride["mode"] = "range"
|
|
132
|
+
}
|
|
133
|
+
this.destroyDatePicker(widgetEl)
|
|
134
|
+
const shortcuts = JSON.parse(widgetEl.dataset.sbadminDatepickerShortcutsDict)
|
|
135
|
+
widgetEl.dataset.sbadminDatepickerShortcuts = JSON.stringify(shortcuts[rule.operator.type] || [])
|
|
136
|
+
if (["in_the_last", "in_the_next"].includes(rule.operator.type)) {
|
|
137
|
+
window.SBAdmin.datepicker.initShortcutsDropdown(widgetEl, {}, optionsOverride)
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
window.SBAdmin.datepicker.initFlatPickr(widgetEl, {}, optionsOverride)
|
|
118
141
|
}
|
|
119
142
|
}
|
|
120
143
|
}
|
|
@@ -11,16 +11,14 @@ export class DataEditModule extends SBAdminTableModule {
|
|
|
11
11
|
editRequestData.set('currentRowId', currentRowId)
|
|
12
12
|
editRequestData.set('columnFieldName', cell.getColumn().getField())
|
|
13
13
|
editRequestData.set('cellValue', cell.getValue())
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
console.log(res)
|
|
23
|
-
})
|
|
14
|
+
window.htmx.ajax('POST', this.table.tableDataEditUrl, {
|
|
15
|
+
'swap': 'none',
|
|
16
|
+
'values': {
|
|
17
|
+
'currentRowId': currentRowId,
|
|
18
|
+
'columnFieldName': cell.getColumn().getField(),
|
|
19
|
+
'cellValue': cell.getValue()
|
|
20
|
+
}
|
|
21
|
+
})
|
|
24
22
|
})
|
|
25
23
|
}
|
|
26
24
|
}
|
|
@@ -21,10 +21,10 @@ export class FilterModule extends SBAdminTableModule {
|
|
|
21
21
|
const wrapperEl = el.closest('.filter-wrapper')
|
|
22
22
|
if(wrapperEl) {
|
|
23
23
|
if (!wrapperEl.hasAttribute('data-all-filters-visible')) {
|
|
24
|
-
this.hideFilter(wrapperEl.getAttribute('data-filter-input-name')
|
|
24
|
+
this.hideFilter(wrapperEl.getAttribute('data-filter-input-name'))
|
|
25
25
|
}
|
|
26
26
|
} else {
|
|
27
|
-
this.hideFilter(el.getAttribute('name'))
|
|
27
|
+
this.hideFilter(el.getAttribute('name'), false)
|
|
28
28
|
}
|
|
29
29
|
})
|
|
30
30
|
if (filterData) {
|
|
@@ -101,7 +101,7 @@ export class FilterModule extends SBAdminTableModule {
|
|
|
101
101
|
this.table.refreshTableDataIfNotUrlLoad()
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
hideFilter(field, hideWrapper=
|
|
104
|
+
hideFilter(field, hideWrapper=true) {
|
|
105
105
|
const fieldElem = this.getFormField(field)
|
|
106
106
|
const filterElem = document.querySelector(`#${this.table.viewId}-${field}-wrapper`)
|
|
107
107
|
if (!fieldElem) {
|
|
@@ -9,7 +9,7 @@ export class HeaderTabsModule extends SBAdminTableModule {
|
|
|
9
9
|
if (!filterOptionsWrapper || !targetInput) {
|
|
10
10
|
return
|
|
11
11
|
}
|
|
12
|
-
filterOptionsWrapper.querySelectorAll('[data-bs-toggle]').forEach(el => {
|
|
12
|
+
filterOptionsWrapper.querySelectorAll('[data-bs-toggle="tab"]').forEach(el => {
|
|
13
13
|
el.addEventListener("show.bs.tab", (event) => {
|
|
14
14
|
const targetId = event.target.id
|
|
15
15
|
if (targetId !== 'tab_saved_views') {
|
|
@@ -49,18 +49,18 @@ export class HeaderTabsModule extends SBAdminTableModule {
|
|
|
49
49
|
if (!targetInput) {
|
|
50
50
|
return
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
targetInput.value
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
targetInput.value
|
|
52
|
+
const filterOptionsWrapper = document.querySelector(".js-filters-options")
|
|
53
|
+
const activeTab = filterOptionsWrapper.querySelector('[data-bs-toggle="tab"].active')
|
|
54
|
+
if (activeTab.id !== 'tab_saved_views') {
|
|
55
|
+
if (targetInput.value === "") {
|
|
56
|
+
const filterOptionsWrapper = document.querySelector(".js-filters-options")
|
|
57
|
+
targetInput.value = filterOptionsWrapper.querySelector('[data-bs-toggle="tab"]').id
|
|
58
|
+
}
|
|
59
|
+
document.getElementById(targetInput.value).click()
|
|
60
60
|
}
|
|
61
|
-
if(window.location.search.includes('tabCreated')) {
|
|
61
|
+
if (window.location.search.includes('tabCreated')) {
|
|
62
62
|
targetInput.value = 'tab_saved_views'
|
|
63
|
+
document.getElementById(targetInput.value).click()
|
|
63
64
|
}
|
|
64
|
-
document.getElementById(targetInput.value).click()
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -18,15 +18,15 @@ 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
|
-
|
|
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 =
|
|
25
|
-
if(selectedRows.size > 0) {
|
|
25
|
+
tableSelectedRowsInfo.innerHTML = window.sb_admin_translation_strings["selected"].replace('${value}', selectedRows.size)
|
|
26
|
+
if (selectedRows.size > 0) {
|
|
26
27
|
tableSelectedRowsBar.classList.add('show')
|
|
27
28
|
document.getElementById('table-selected-rows-bar-select-all').checked = true
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
29
|
+
} else {
|
|
30
30
|
document.getElementById('table-selected-rows-bar-select-all').checked = false
|
|
31
31
|
tableSelectedRowsBar.classList.remove('show')
|
|
32
32
|
}
|
|
@@ -35,11 +35,13 @@ export class SelectionModule extends SBAdminTableModule {
|
|
|
35
35
|
selectAllData() {
|
|
36
36
|
this.table.tabulator.selectRow('all')
|
|
37
37
|
this.setSelectedRows(this.table.constants.SELECT_ALL_KEYWORD, new Set())
|
|
38
|
+
document.body.dispatchEvent(new CustomEvent('treeSelectAllRows'))
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
selectNoData() {
|
|
41
42
|
this.table.tabulator.deselectRow()
|
|
42
43
|
this.setSelectedRows(new Set(), new Set())
|
|
44
|
+
document.body.dispatchEvent(new CustomEvent('treeDeselectAllRows'))
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
rowSelectionFormatter(tabulatorFormatterHandle, cell, formatterParams, onRendered) {
|
|
@@ -70,8 +72,7 @@ export class SelectionModule extends SBAdminTableModule {
|
|
|
70
72
|
checkbox.setAttribute("name", `row-select-${this.table.viewId}`)
|
|
71
73
|
label.setAttribute("for", `row-select-${rowData[this.table.tableIdColumnName]}`)
|
|
72
74
|
wrapper.setAttribute("for", `row-select-${rowData[this.table.tableIdColumnName]}`)
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
+
} else {
|
|
75
76
|
checkbox.setAttribute("id", `row-select-all`)
|
|
76
77
|
label.setAttribute("for", `row-select-all`)
|
|
77
78
|
wrapper.setAttribute("for", `row-select-all`)
|
|
@@ -128,7 +129,7 @@ export class SelectionModule extends SBAdminTableModule {
|
|
|
128
129
|
getUrlParams() {
|
|
129
130
|
const params = {}
|
|
130
131
|
const selectionData = {}
|
|
131
|
-
const selectedArray = Array.from(this.tableSelectedRows)
|
|
132
|
+
const selectedArray = this.table.constants.SELECT_ALL_KEYWORD === this.tableSelectedRows ? this.tableSelectedRows : Array.from(this.tableSelectedRows)
|
|
132
133
|
const deselectedArray = Array.from(this.tableDeselectedRows)
|
|
133
134
|
if (selectedArray.length > 0) {
|
|
134
135
|
selectionData[this.table.constants.SELECTED_ROWS_KWARG_NAME] = selectedArray
|
|
@@ -149,9 +150,28 @@ export class SelectionModule extends SBAdminTableModule {
|
|
|
149
150
|
afterInit() {
|
|
150
151
|
this.table.tabulator.on("rowSelected", this.getSelectionHandler("rowSelected"))
|
|
151
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
|
+
})
|
|
152
168
|
}
|
|
153
169
|
|
|
154
170
|
loadFromUrlAfterInit() {
|
|
155
171
|
this.selectNoData()
|
|
156
172
|
}
|
|
173
|
+
|
|
174
|
+
beforeRefreshTableDataIfNotUrlLoad() {
|
|
175
|
+
this.selectNoData()
|
|
176
|
+
}
|
|
157
177
|
}
|
|
@@ -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')
|
|
@@ -28,6 +28,9 @@ export class ViewsModule extends SBAdminTableModule {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
document.querySelectorAll('.js-view-button').forEach((item) => {
|
|
31
|
+
if(!item.dataset.params) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
31
34
|
const itemParams = JSON.stringify(this.filterParamsForCompare(JSON.parse(item.dataset.params)))
|
|
32
35
|
const sameAsUrlParams = (itemParams === searchParams)
|
|
33
36
|
const sameAsSelectedParams = selectedParams === itemParams
|
|
@@ -67,6 +70,9 @@ export class ViewsModule extends SBAdminTableModule {
|
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
openView(e, params, view_id) {
|
|
73
|
+
if (!params) {
|
|
74
|
+
return
|
|
75
|
+
}
|
|
70
76
|
if (e.target.closest("svg")) {
|
|
71
77
|
return
|
|
72
78
|
}
|