django-smartbase-admin 1.0.40__py3-none-any.whl → 1.0.41__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/engine/dashboard.py +2 -0
- django_smartbase_admin/engine/filter_widgets.py +41 -1
- django_smartbase_admin/static/sb_admin/dist/main.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/table.js +1 -1
- django_smartbase_admin/static/sb_admin/src/js/autocomplete.js +7 -7
- django_smartbase_admin/static/sb_admin/src/js/main.js +2 -0
- django_smartbase_admin/static/sb_admin/src/js/radio.js +31 -0
- django_smartbase_admin/static/sb_admin/src/js/table_modules/detail_view_module.js +50 -1
- django_smartbase_admin/static/sb_admin/src/js/table_modules/filter_module.js +7 -0
- django_smartbase_admin/templates/sb_admin/components/filters.html +1 -0
- django_smartbase_admin/templates/sb_admin/filter_widgets/boolean_field.html +1 -14
- django_smartbase_admin/templates/sb_admin/filter_widgets/partials/clear.html +2 -1
- django_smartbase_admin/templates/sb_admin/filter_widgets/radio_choice_field.html +3 -1
- {django_smartbase_admin-1.0.40.dist-info → django_smartbase_admin-1.0.41.dist-info}/METADATA +1 -1
- {django_smartbase_admin-1.0.40.dist-info → django_smartbase_admin-1.0.41.dist-info}/RECORD +17 -16
- {django_smartbase_admin-1.0.40.dist-info → django_smartbase_admin-1.0.41.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-1.0.40.dist-info → django_smartbase_admin-1.0.41.dist-info}/WHEEL +0 -0
|
@@ -429,6 +429,7 @@ class SBAdminDashboardChartWidgetByDate(SBAdminDashboardChartWidget):
|
|
|
429
429
|
filter_widget=RadioChoiceFilterWidget(
|
|
430
430
|
choices=self.DateResolutionsOptions.choices,
|
|
431
431
|
default_value=self.default_date_resolution,
|
|
432
|
+
allow_clear=False,
|
|
432
433
|
),
|
|
433
434
|
),
|
|
434
435
|
SBAdminField(
|
|
@@ -437,6 +438,7 @@ class SBAdminDashboardChartWidgetByDate(SBAdminDashboardChartWidget):
|
|
|
437
438
|
filter_widget=RadioChoiceFilterWidget(
|
|
438
439
|
choices=self.CompareOptions.choices,
|
|
439
440
|
default_value=self.CompareOptions.values[0],
|
|
441
|
+
allow_clear=False,
|
|
440
442
|
),
|
|
441
443
|
),
|
|
442
444
|
]
|
|
@@ -75,6 +75,11 @@ class SBAdminFilterWidget(JSONSerializableMixin):
|
|
|
75
75
|
default_label = None
|
|
76
76
|
filter_query_lambda = None
|
|
77
77
|
exclude_null_operators = False
|
|
78
|
+
# If True, the filter dropdown closes after the filter value changes (frontend behavior).
|
|
79
|
+
# Useful for single-step filters; set to False for widgets where users typically make multiple
|
|
80
|
+
# changes before closing the dropdown.
|
|
81
|
+
close_dropdown_on_change = False
|
|
82
|
+
allow_clear = True
|
|
78
83
|
|
|
79
84
|
def __init__(
|
|
80
85
|
self,
|
|
@@ -83,6 +88,8 @@ class SBAdminFilterWidget(JSONSerializableMixin):
|
|
|
83
88
|
default_label=None,
|
|
84
89
|
filter_query_lambda=None,
|
|
85
90
|
exclude_null_operators=None,
|
|
91
|
+
close_dropdown_on_change=None,
|
|
92
|
+
allow_clear=None,
|
|
86
93
|
**kwargs,
|
|
87
94
|
) -> None:
|
|
88
95
|
super().__init__()
|
|
@@ -93,6 +100,10 @@ class SBAdminFilterWidget(JSONSerializableMixin):
|
|
|
93
100
|
self.exclude_null_operators = (
|
|
94
101
|
exclude_null_operators or self.exclude_null_operators
|
|
95
102
|
)
|
|
103
|
+
if close_dropdown_on_change is not None:
|
|
104
|
+
self.close_dropdown_on_change = close_dropdown_on_change
|
|
105
|
+
if allow_clear is not None:
|
|
106
|
+
self.allow_clear = allow_clear
|
|
96
107
|
|
|
97
108
|
def init_filter_widget_static(self, field, view, configuration):
|
|
98
109
|
self.field = field
|
|
@@ -124,7 +135,9 @@ class SBAdminFilterWidget(JSONSerializableMixin):
|
|
|
124
135
|
return original_query
|
|
125
136
|
|
|
126
137
|
def to_json(self):
|
|
127
|
-
return {
|
|
138
|
+
return {
|
|
139
|
+
"input_id": self.input_id,
|
|
140
|
+
}
|
|
128
141
|
|
|
129
142
|
def get_default_value(self):
|
|
130
143
|
return self.default_value
|
|
@@ -162,6 +175,7 @@ class SBAdminFilterWidget(JSONSerializableMixin):
|
|
|
162
175
|
|
|
163
176
|
class StringFilterWidget(SBAdminFilterWidget):
|
|
164
177
|
template_name = "sb_admin/filter_widgets/string_field.html"
|
|
178
|
+
close_dropdown_on_change = True
|
|
165
179
|
|
|
166
180
|
def get_advanced_filter_operators(self):
|
|
167
181
|
return STRING_ATTRIBUTES
|
|
@@ -178,6 +192,29 @@ class StringFilterWidget(SBAdminFilterWidget):
|
|
|
178
192
|
|
|
179
193
|
class BooleanFilterWidget(SBAdminFilterWidget):
|
|
180
194
|
template_name = "sb_admin/filter_widgets/boolean_field.html"
|
|
195
|
+
choices = None
|
|
196
|
+
close_dropdown_on_change = True
|
|
197
|
+
|
|
198
|
+
def __init__(
|
|
199
|
+
self,
|
|
200
|
+
template_name=None,
|
|
201
|
+
default_value=None,
|
|
202
|
+
default_label=None,
|
|
203
|
+
filter_query_lambda=None,
|
|
204
|
+
exclude_null_operators=None,
|
|
205
|
+
close_dropdown_on_change=None,
|
|
206
|
+
**kwargs,
|
|
207
|
+
) -> None:
|
|
208
|
+
super().__init__(
|
|
209
|
+
template_name,
|
|
210
|
+
default_value,
|
|
211
|
+
default_label,
|
|
212
|
+
filter_query_lambda,
|
|
213
|
+
exclude_null_operators,
|
|
214
|
+
close_dropdown_on_change,
|
|
215
|
+
**kwargs,
|
|
216
|
+
)
|
|
217
|
+
self.choices = ((True, _("Yes")), (False, _("No")))
|
|
181
218
|
|
|
182
219
|
def parse_value_from_input(self, request, filter_value):
|
|
183
220
|
input_value = super().parse_value_from_input(request, filter_value)
|
|
@@ -201,6 +238,7 @@ class BooleanFilterWidget(SBAdminFilterWidget):
|
|
|
201
238
|
class ChoiceFilterWidget(SBAdminFilterWidget):
|
|
202
239
|
template_name = "sb_admin/filter_widgets/choice_field.html"
|
|
203
240
|
choices = None
|
|
241
|
+
close_dropdown_on_change = True
|
|
204
242
|
|
|
205
243
|
def __init__(
|
|
206
244
|
self,
|
|
@@ -236,6 +274,7 @@ class ChoiceFilterWidget(SBAdminFilterWidget):
|
|
|
236
274
|
|
|
237
275
|
class RadioChoiceFilterWidget(ChoiceFilterWidget):
|
|
238
276
|
template_name = "sb_admin/filter_widgets/radio_choice_field.html"
|
|
277
|
+
close_dropdown_on_change = True
|
|
239
278
|
|
|
240
279
|
|
|
241
280
|
class MultipleChoiceFilterWidget(AutocompleteParseMixin, ChoiceFilterWidget):
|
|
@@ -243,6 +282,7 @@ class MultipleChoiceFilterWidget(AutocompleteParseMixin, ChoiceFilterWidget):
|
|
|
243
282
|
enable_select_all = False
|
|
244
283
|
select_all_keyword = None
|
|
245
284
|
select_all_label = None
|
|
285
|
+
close_dropdown_on_change = False
|
|
246
286
|
|
|
247
287
|
def __init__(
|
|
248
288
|
self,
|