django-smartbase-admin 0.2.89__py3-none-any.whl → 0.2.90__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.
@@ -271,6 +271,24 @@ export const createRadioInput = (id, name, value, label, checked, index) => {
271
271
 
272
272
  // eslint-disable-next-line no-unused-vars
273
273
  export const customActionsPlugin = (fp) => {
274
+ const setInitialValueAndLabel = (realInput, shortcuts, baseId) => {
275
+ const shortcutValue = JSON.parse(realInput.value)
276
+ const from = new Date()
277
+ from.setDate(from.getDate() + shortcutValue[0])
278
+
279
+ const to = new Date()
280
+ to.setDate(to.getDate() + shortcutValue[1])
281
+ fp.setDate([from, to], false, fp.config.dateFormat)
282
+
283
+ shortcuts.forEach((shortcut, idx) => {
284
+ if(JSON.stringify(shortcut.value) === realInput.value) {
285
+ document.getElementById(`${baseId}_range${idx}`).checked = true
286
+ realInput.dataset['label'] = shortcut.label
287
+ }
288
+ })
289
+ }
290
+
291
+
274
292
  const createShortcuts = () => {
275
293
  const realInput = document.getElementById(fp.element.dataset.sbadminDatepickerRealInputId)
276
294
  const baseId = realInput.id
@@ -312,22 +330,13 @@ export const customActionsPlugin = (fp) => {
312
330
  })
313
331
  fp.calendarContainer.prepend(el)
314
332
 
333
+ if(realInput.value){
334
+ setInitialValueAndLabel(realInput, shortcuts, baseId)
335
+ }
336
+
315
337
  realInput.addEventListener('SBTableFilterFormLoad', () => {
316
338
  try {
317
- const shortcutValue = JSON.parse(realInput.value)
318
- const from = new Date()
319
- from.setDate(from.getDate() + shortcutValue[0])
320
-
321
- const to = new Date()
322
- to.setDate(to.getDate() + shortcutValue[1])
323
- fp.setDate([from, to], false, fp.config.dateFormat)
324
-
325
- shortcuts.forEach((shortcut, idx) => {
326
- if(JSON.stringify(shortcut.value) === realInput.value) {
327
- document.getElementById(`${baseId}_range${idx}`).checked = true
328
- realInput.dataset['label'] = shortcut.label
329
- }
330
- })
339
+ setInitialValueAndLabel(realInput, shortcuts, baseId)
331
340
  }
332
341
  catch {
333
342
  fp.setDate(realInput.value, false, fp.config.dateFormat)
@@ -7,7 +7,7 @@
7
7
  id="{{ filter_widget.input_id }}"
8
8
  name="{{ filter_widget.input_name }}"
9
9
  form="{{ filter_widget.view_id }}-filter-form"
10
- {% if filter_widget.get_default_value %}value="{{ filter_widget.get_default_value }}"{% endif %}
10
+ {% if filter_widget.get_default_value %}value="{{ filter_widget.get_default_value }}" data-label="{{ filter_widget.get_default_label }}"{% endif %}
11
11
  {% if not all_filters_visible %}disabled{% endif %}
12
12
  >
13
13
  <input type="text"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-smartbase-admin
3
- Version: 0.2.89
3
+ Version: 0.2.90
4
4
  Summary:
5
5
  Author: SmartBase
6
6
  Author-email: info@smartbase.sk
@@ -19,7 +19,7 @@ django_smartbase_admin/engine/dashboard.py,sha256=wrvX0GI-SII2pG0DX8Kvy4JFaM6h8e
19
19
  django_smartbase_admin/engine/fake_inline.py,sha256=9C2_mltg2P9-xa3vuoo5X_RcFaCRpKGNSy7t1_iiasE,5802
20
20
  django_smartbase_admin/engine/field.py,sha256=BD_W0ekE5tQJxUGpUA8bo4ZyFk0u2F_6UTPH4drj0JU,10286
21
21
  django_smartbase_admin/engine/field_formatter.py,sha256=eHbXEBwG8jBc9zKpDQ4T64N5J4afF0Cbb8RFeFfgQRg,1950
22
- django_smartbase_admin/engine/filter_widgets.py,sha256=eIMSeoDxUcULfBJCe1BniM2poqrzRi-7gIERioSCKwY,24049
22
+ django_smartbase_admin/engine/filter_widgets.py,sha256=q1BC1uHS_6QlKowbQA9STpy61RpYKaPsstdQL2z7eks,24613
23
23
  django_smartbase_admin/engine/global_filter_form.py,sha256=jlj6e9VYWDPyUNjcgj3gTIkCZXO01NZOWAeU3jFtkoA,249
24
24
  django_smartbase_admin/engine/menu_item.py,sha256=rMJFG5xm1T0wF8lUmiAZHzKtt9C0LdbpRFvaP0PlngM,2936
25
25
  django_smartbase_admin/engine/modal_view.py,sha256=Qzx9kd9shoqCYes_lYkAvX1ItVL41oi2vORUrYUkZkE,2269
@@ -62,11 +62,11 @@ django_smartbase_admin/static/sb_admin/css/querybuilder/query-builder.default.mi
62
62
  django_smartbase_admin/static/sb_admin/dist/chart.js,sha256=junrr52JM6iSKJ2jIXKbAG7LzjU83w2GCQgaq2rjGOg,204742
63
63
  django_smartbase_admin/static/sb_admin/dist/chart.js.LICENSE.txt,sha256=m7M__mzLlrKDz-hky_AC848p_HzYWhziwCLIpXMsj4I,257
64
64
  django_smartbase_admin/static/sb_admin/dist/confirmation_modal.js,sha256=glK-x4oxSAHqiabqXmNFE3FRtzMbpg7TgZiKcPle9_o,1745
65
- django_smartbase_admin/static/sb_admin/dist/main.js,sha256=4bC9ly00yaje80yiJwKFAL53ENTTDEpXhfbLZhBnXHA,378122
65
+ django_smartbase_admin/static/sb_admin/dist/main.js,sha256=EatmY7YHjaLg1TFJ_F_cGDiUmrDhE1U-rm9SLaxh-xU,378174
66
66
  django_smartbase_admin/static/sb_admin/dist/main.js.LICENSE.txt,sha256=Z8-1IrzhOFV3eE_WGR7SRfbzN9GRXsvfiU7_E_BkX-k,5600
67
67
  django_smartbase_admin/static/sb_admin/dist/main_style.css,sha256=72BRjvvEW11qwYaMdbldP2BNVuAZsOLYC_nnNKoSJvA,153895
68
68
  django_smartbase_admin/static/sb_admin/dist/main_style.js,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
- django_smartbase_admin/static/sb_admin/dist/table.js,sha256=95hDWDBSvRPWDGrxQIR0vL2AOPrNvDFY0hKhzyJJynI,590741
69
+ django_smartbase_admin/static/sb_admin/dist/table.js,sha256=mDdVEmvypTDjEjFndwhj07Pwepua8WDpIb0JhkCJIYE,590793
70
70
  django_smartbase_admin/static/sb_admin/dist/table.js.LICENSE.txt,sha256=WOKSfEow5EUe0a78P0kcxdWcrQlqn2n6H8idNZqHVDk,462
71
71
  django_smartbase_admin/static/sb_admin/dist/translations.js,sha256=5PRY3zmbnQ9pH-FtNHmsZ5xmYLPOQiO_hR3CBxHIAIo,567
72
72
  django_smartbase_admin/static/sb_admin/favicon/android-chrome-192x192.png,sha256=Og0qXawivKxQWmPPU6dkkGjO0txd-yDXXfemTWXCBDY,18172
@@ -501,7 +501,7 @@ django_smartbase_admin/static/sb_admin/src/js/choices.js,sha256=DzrJYV5vq_NywD6K
501
501
  django_smartbase_admin/static/sb_admin/src/js/code.js,sha256=Q1jKpTsUZhxhaGDRrqHhs_jn9gZPYjB1xf7VSXfiCd0,486
502
502
  django_smartbase_admin/static/sb_admin/src/js/confirmation_modal.js,sha256=9xycy0sYJfT0SxeDucbOmvg9gHSrBo3KngZjCAHkVMM,3610
503
503
  django_smartbase_admin/static/sb_admin/src/js/datepicker.js,sha256=_f3a2sMP0lBb-ymI1a6I-_Rly-4Ut88uJSbKeapqsFQ,6412
504
- django_smartbase_admin/static/sb_admin/src/js/datepicker_plugins.js,sha256=E3HXFYxRSQOqO-v-5Z9jfdS2RdmYfzmvBSY0c-iKJJs,12208
504
+ django_smartbase_admin/static/sb_admin/src/js/datepicker_plugins.js,sha256=d_EkPi0qv_74diVL4inJs8n1os4t1Ss6hp6-gY4_6hU,12368
505
505
  django_smartbase_admin/static/sb_admin/src/js/main.js,sha256=kr6U6y4cDu2LspsqLsw0EsuvxrbahwK42Br0-3RzSFY,9905
506
506
  django_smartbase_admin/static/sb_admin/src/js/multiselect.js,sha256=-mTD2CNCQyBfZTbVgj9khbdApBo6G1pfHNm7c082gsM,3500
507
507
  django_smartbase_admin/static/sb_admin/src/js/range.js,sha256=Vc_NZMKAUzwYpTC1jf8eOpoP_JJsH6x0fzsWwhsKdts,1752
@@ -573,7 +573,7 @@ django_smartbase_admin/templates/sb_admin/filter_widgets/advanced_filters/string
573
573
  django_smartbase_admin/templates/sb_admin/filter_widgets/autocomplete_field.html,sha256=biufhvpytO3PtpzuwlEm0mtns5L4KVVPfayg5r-ZSbM,1071
574
574
  django_smartbase_admin/templates/sb_admin/filter_widgets/boolean_field.html,sha256=w7A6ljzbokmY_UO3cG-RpB7aDULbUjo7WyT9vJqGZZY,548
575
575
  django_smartbase_admin/templates/sb_admin/filter_widgets/choice_field.html,sha256=tOFTMskFGrqbR9qNnKRPV3dlcPTzE4UFZp8nqrfb3yk,645
576
- django_smartbase_admin/templates/sb_admin/filter_widgets/date_field.html,sha256=mxaxV526C78h-MiSKh5cHJnQKi8cwDvNSqOsX6IAIlA,1093
576
+ django_smartbase_admin/templates/sb_admin/filter_widgets/date_field.html,sha256=WR2fqKv8P2XG2xCpE0FXgKfl4gj3Gmlo3ZAOep1xYQY,1144
577
577
  django_smartbase_admin/templates/sb_admin/filter_widgets/multiple_choice_field.html,sha256=IUGOLzVrHa-RXjkbM6ebZ0yQyX5OzPcLrIz6s6hIupc,1248
578
578
  django_smartbase_admin/templates/sb_admin/filter_widgets/number_range_field.html,sha256=3d8yYpmvgQZUxCXw80lNpxeLCLTfIy8Xumg4X1nzJFc,1162
579
579
  django_smartbase_admin/templates/sb_admin/filter_widgets/partials/clear.html,sha256=lp8fmVbCjOPkLHEGq6sSc9VNNu-iegJ1f7adbsrc70U,614
@@ -667,7 +667,7 @@ django_smartbase_admin/views/dashboard_view.py,sha256=vtz5emYTQ5WDFeLA8HrcmjSOVd
667
667
  django_smartbase_admin/views/global_filter_view.py,sha256=eYo1moJGyi7jc2cPDA5ZBiEgA7Hmc-DxbQvbqUpDkg8,1127
668
668
  django_smartbase_admin/views/media_view.py,sha256=5BLWXuzynF7nM34t-mf2BQSRN5ojY8HxpLIqt7Jiq9g,292
669
669
  django_smartbase_admin/views/translations_view.py,sha256=tkShf5IWyPDjNhcPQsvh8WXs-EMRCfG_oTD9x-LP1No,20272
670
- django_smartbase_admin-0.2.89.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
671
- django_smartbase_admin-0.2.89.dist-info/METADATA,sha256=WdbeXuroRC1azMiOrQLOy-RUzvSDlx5CCv_ikbM7BsM,996
672
- django_smartbase_admin-0.2.89.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
673
- django_smartbase_admin-0.2.89.dist-info/RECORD,,
670
+ django_smartbase_admin-0.2.90.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
671
+ django_smartbase_admin-0.2.90.dist-info/METADATA,sha256=g-c6gRy3W7RNKPZV9DwylMisylBXR9TxNZNK_Vcx1RA,996
672
+ django_smartbase_admin-0.2.90.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
673
+ django_smartbase_admin-0.2.90.dist-info/RECORD,,