django-smartbase-admin 0.2.97__py3-none-any.whl → 0.2.98__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/admin/widgets.py +1 -1
- django_smartbase_admin/static/sb_admin/dist/tree_widget.js +1 -1
- django_smartbase_admin/static/sb_admin/src/js/tree_widget.js +4 -2
- django_smartbase_admin/templates/sb_admin/widgets/tree_base.html +1 -0
- {django_smartbase_admin-0.2.97.dist-info → django_smartbase_admin-0.2.98.dist-info}/METADATA +1 -1
- {django_smartbase_admin-0.2.97.dist-info → django_smartbase_admin-0.2.98.dist-info}/RECORD +8 -8
- {django_smartbase_admin-0.2.97.dist-info → django_smartbase_admin-0.2.98.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-0.2.97.dist-info → django_smartbase_admin-0.2.98.dist-info}/WHEEL +0 -0
|
@@ -559,7 +559,7 @@ class SBAdminTreeWidget(SBAdminTreeWidgetMixin, SBAdminAutocompleteWidget):
|
|
|
559
559
|
}
|
|
560
560
|
context["widget"]["additional_columns"] = self.additional_columns
|
|
561
561
|
context["widget"]["tree_strings"] = self.tree_strings
|
|
562
|
-
|
|
562
|
+
context["fancytree_filter_settings"] = {}
|
|
563
563
|
return context
|
|
564
564
|
|
|
565
565
|
@classmethod
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{const e=function(e,t,n){let o=e.val();void 0!==o&&n.selectAll(!1);let r=[o];if(!0===t.filter){let e=[];r=[];try{e=JSON.parse(o)}catch(t){e=[]}finally{e.forEach((function(e){r.push(e.value)}))}}else if(2===t.multiselect)try{r=JSON.parse(o)}catch(e){r=[]}r.forEach((function(e){let t=n.getNodeByKey(e);t&&(t.getParentList().forEach((function(e){e.setExpanded(!0)})),t.setSelected(!0))}))};$((function(){const t=function(t){if(t.hasClass("fancytree-container"))return;t.on("change",(e=>{const t=e.target.dataset.changeTarget;if(t){const n=document.querySelector(t);n&&(n.value=e.target.value)}}));let n={};const o=e=>{if(!n.isFiltered)return void e.filterNodes((e=>(e.setExpanded(!1),!0)),{autoExpand:!1});const t={};n.data.forEach((e=>t[e.path]=e)),e.filterNodes((e=>{if(t[e.key])return!0}),{autoExpand:!0})},r=$("#"+t.data("tree-data-id")),d=$("#"+t.data("tree-additional-columns-id")),a=$("#"+t.data("tree-strings-id"));let i={},s=[],l={loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."};try{i=JSON.parse(r.text())||{},s=JSON.parse(d.text())||[],l=JSON.parse(a.text())}catch(e){console.error(e)}const c=$("#"+i.input_id),u=$("#"+i.input_id+"_search"),f=$("#"+i.input_id+"_matches"),p=$("#"+i.input_id+"_label"),h={indentation:32,nodeColumnIdx:0};i.checkbox&&(h.checkboxColumnIdx=0,h.nodeColumnIdx=1);let
|
|
1
|
+
(()=>{const e=function(e,t,n){let o=e.val();void 0!==o&&n.selectAll(!1);let r=[o];if(!0===t.filter){let e=[];r=[];try{e=JSON.parse(o)}catch(t){e=[]}finally{e.forEach((function(e){r.push(e.value)}))}}else if(2===t.multiselect)try{r=JSON.parse(o)}catch(e){r=[]}r.forEach((function(e){let t=n.getNodeByKey(e);t&&(t.getParentList().forEach((function(e){e.setExpanded(!0)})),t.setSelected(!0))}))};$((function(){const t=function(t){if(t.hasClass("fancytree-container"))return;t.on("change",(e=>{const t=e.target.dataset.changeTarget;if(t){const n=document.querySelector(t);n&&(n.value=e.target.value)}}));let n={};const o=e=>{if(!n.isFiltered)return void e.filterNodes((e=>(e.setExpanded(!1),!0)),{autoExpand:!1});const t={};n.data.forEach((e=>t[e.path]=e)),e.filterNodes((e=>{if(t[e.key])return!0}),{autoExpand:!0})},r=$("#"+t.data("tree-data-id")),d=$("#"+t.data("tree-additional-columns-id")),a=$("#"+t.data("tree-strings-id"));let i={},s=[],l={loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."};try{i=JSON.parse(r.text())||{},s=JSON.parse(d.text())||[],l=JSON.parse(a.text())}catch(e){console.error(e)}const c=$("#"+i.input_id),u=$("#"+i.input_id+"_search"),f=$("#"+i.input_id+"_matches"),p=$("#"+i.input_id+"_label"),h={indentation:32,nodeColumnIdx:0},m=window.loadJSONScriptData("fancytree_filter_settings");i.checkbox&&(h.checkboxColumnIdx=0,h.nodeColumnIdx=1);let v=["table","gridnav","filter"];i.reorder_url&&v.push("dnd5"),t.fancytree({source:{url:i.data_url},extensions:v,checkbox:i.checkbox,selectMode:i.multiselect,dnd5:{preventVoidMoves:!0,preventRecursion:!0,autoExpandMS:400,dropMarkerParent:".tree-list-view",dropMarkerOffsetX:-8,dropMarkerInsertOffsetX:0,dragStart:function(){return!0},dragEnter:function(){return!0},dragDrop:function(e,t){t.otherNode.moveTo(e,t.hitMode)}},filter:{autoApply:!0,autoExpand:!0,counter:!1,fuzzy:!1,hideExpandedCounter:!0,hideExpanders:!0,highlight:!0,leavesOnly:!1,nodata:!0,mode:"hide",...m},table:h,gridnav:{autofocusInput:!1,handleCursorKeys:!0},strings:l,postProcess:function(t,n){setTimeout((function(){e(c,i,n.tree)}),1)},select:function(e,t){if(c.length>0){let e=null;if(i.filter)e=t.tree.getSelectedNodes().map((function(e){return{value:e.key,label:e.title}})),c.val(JSON.stringify(e));else{e=t.tree.getSelectedNodes().map((function(e){return e.key})).join(", "),2===i.multiselect&&(e=JSON.stringify(t.tree.getSelectedNodes().map((function(e){return e.key}))));let n=t.tree.getSelectedNodes().map((function(e){return e.title})).join(", ");p.text(n),c.val(e)}return c[0].dispatchEvent(new CustomEvent("SBAutocompleteChange")),void c[0].dispatchEvent(new Event("change",{bubbles:!0}))}if(i.filter_by_table_data&&t.originalEvent){const e=t.tree.getSelectedNodes().map((function(e){return e.data.id}));document.body.dispatchEvent(new CustomEvent("treeRowSelected",{detail:{data:e}}))}},enhanceTitle:function(e,t){const n=i.reorder_url,o=t.node.rendered,r=t.node.tree.enableFilter,d=i.detail_url,a=t.node.span&&t.node.span.classList.contains("fancytree-node")&&!t.node.tr.classList.contains("fancytree-hide");if(d&&(!o||r)&&!n&&a){const e=t.node.span.querySelector(".fancytree-title"),n=document.createElement("a"),o=i.detail_url.replace(-1,t.node.data.id);n.innerHTML=e.innerHTML,n.classList.add("link"),n.href=o,e.innerHTML="",e.append(n),e.addEventListener("mousedown",(function(e){e.preventDefault(),e.stopPropagation()}),!0)}},renderNode:function(e,t){const n=i.reorder_url,o=t.node.rendered,r=t.node.span&&t.node.span.classList.contains("fancytree-node")&&!t.node.tr.classList.contains("fancytree-hide");if(o&&!n)return;let d=t.node&&t.node.tr&&t.node.tr.classList.contains("fancytree-lastsib");if(d=void 0!==d&&d,t.node.parent?(t.node.treeLevel=t.node.parent.treeLevel+1,t.node.treeAdditionalLevel=[{level:t.node.treeLevel,lastSib:d},...t.node.parent.treeAdditionalLevel]):(t.node.treeLevel=0,t.node.treeAdditionalLevel=[]),t.node.rendered=!0,r){const e=t.node.span.querySelector(".fancytree-expander"),n=t.node.treeLevel,o=t.node.treeAdditionalLevel;e.innerHTML="",e.className="fancytree-expander",e.classList.add("level-"+n),t.node.parent.expanded&&e.classList.add("expanded-parent"),o.forEach(((t,n)=>{if(0!==n&&t.lastSib)return;const o=document.createElement("span");o.classList.add("expander-additional"),0===n&&o.classList.add("expander-additional-last"),o.style.left=-(50+100*n)+"%",e.append(o)}));const r=document.createElement("span");r.classList.add("expander-border"),e.append(r),e.append(document.createElement("div"))}},renderColumns:function(e,t){const n=$(t.node.tr).find(">td");s.forEach((function(e,o){let r=t.node.data[e.key];e.hide_zero&&0===r&&(r=""),n.eq(1+h.nodeColumnIdx+o).html(r)}))},init:function(e,t){i.filter_by_table_data&&o(t.tree)}});const y=function(){u.val(""),f.text(""),g.visit((function(e){e.rendered=!1})),g.clearFilter()},g=$.ui.fancytree.getTree("#"+i.input_id+"_tree");c.on("SBTableFilterFormLoad",(()=>{e(c,i,g)})),c.on("clear",(()=>{g.getSelectedNodes().map((e=>{e.setSelected(!1)}))})),u.on("keyup",(function(e){let t=$(this).val(),n=g.filterNodes(t);e&&e.which===$.ui.keyCode.ESCAPE||""===$.trim(t)?y():f.text("("+n+" matches)")})).trigger("focus"),u.on("search",(function(e){e.target.value||y()})),g.saveTreeOrder=function(){const e=JSON.stringify(g.toDict());fetch(i.reorder_url,{method:"POST",headers:{"X-CSRFToken":window.csrf_token},body:e}).then((e=>e.json())).then((e=>{document.getElementById("notification-messages").innerHTML=e.messages,window.htmx.process(document.getElementById("notification-messages"))}))},i.filter_by_table_data&&(document.body.addEventListener("tableDataProcessed",(e=>{n=e.detail,"loading"!==g.getRootNode().getChildren()[0].statusNodeType&&o(g)})),document.body.addEventListener("treeDeselectAllRows",(()=>{g.selectAll(!1)})),document.body.addEventListener("treeSelectAllRows",(()=>{g.selectAll(!0)})))},n=function(){$(".js-tree-widget").each((function(e,n){const o=$(n);if(o.hasClass("fancytree-container"))return;const r=o.closest(".dropdown-menu");if(r.length>0){const e=function(){t(o),r.prev().off("show.bs.dropdown",e)};r.prev().on("show.bs.dropdown",e)}else t(o)}))};n(),document.addEventListener("formset:added",(()=>{n()}));$(".query-builder-advanced").on("afterCreateRuleInput.queryBuilder",(function(){setTimeout((()=>{n()}),0)}))}))})();
|
|
@@ -95,6 +95,7 @@ const loadValue = function ($inputEl, treeWidgetData, treeInstance) {
|
|
|
95
95
|
indentation: 32,
|
|
96
96
|
nodeColumnIdx: 0,
|
|
97
97
|
}
|
|
98
|
+
const fancytreeFilterSettings = window.loadJSONScriptData("fancytree_filter_settings")
|
|
98
99
|
if (treeWidgetData.checkbox) {
|
|
99
100
|
tableConfig.checkboxColumnIdx = 0
|
|
100
101
|
tableConfig.nodeColumnIdx = 1
|
|
@@ -131,13 +132,14 @@ const loadValue = function ($inputEl, treeWidgetData, treeInstance) {
|
|
|
131
132
|
autoApply: true, // Re-apply last filter if lazy data is loaded
|
|
132
133
|
autoExpand: true, // Expand all branches that contain matches while filtered
|
|
133
134
|
counter: false, // Show a badge with number of matching child nodes near parent icons
|
|
134
|
-
fuzzy:
|
|
135
|
+
fuzzy: false, // Match single characters in order, e.g. 'fb' will match 'FooBar'
|
|
135
136
|
hideExpandedCounter: true, // Hide counter badge if parent is expanded
|
|
136
137
|
hideExpanders: true, // Hide expanders if all child nodes are hidden by filter
|
|
137
138
|
highlight: true, // Highlight matches by wrapping inside <mark> tags
|
|
138
139
|
leavesOnly: false, // Match end nodes only
|
|
139
140
|
nodata: true, // Display a 'no data' status node if result is empty
|
|
140
|
-
mode: "hide" // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
|
|
141
|
+
mode: "hide", // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
|
|
142
|
+
...fancytreeFilterSettings,
|
|
141
143
|
},
|
|
142
144
|
table: tableConfig,
|
|
143
145
|
gridnav: {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"filter_by_table_data": {% if filter_by_table_data %}true{% else %}false{% endif %}
|
|
49
49
|
}
|
|
50
50
|
</script>
|
|
51
|
+
{{ fancytree_filter_settings|get_json_script:'fancytree_filter_settings' }}
|
|
51
52
|
<script id="{{ tree_component_id }}_additional_columns" type="application/json">{{ tree_additional_columns|get_json|safe }}</script>
|
|
52
53
|
<script id="{{ tree_component_id }}_tree_strings" type="application/json">
|
|
53
54
|
{{ tree_strings|get_json|safe }}
|
|
@@ -5,7 +5,7 @@ django_smartbase_admin/actions/advanced_filters.py,sha256=Vm8b6TAwNehR8INjolFG7p
|
|
|
5
5
|
django_smartbase_admin/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
django_smartbase_admin/admin/admin_base.py,sha256=dInknwstu6miwpJetdHqEJ0FAFr1lzNCF9fX44qWLL4,41535
|
|
7
7
|
django_smartbase_admin/admin/site.py,sha256=VrJBhwgZsLa2GohvjnNL7m4dVR3S4Ou1V1UzfE1qOoQ,6577
|
|
8
|
-
django_smartbase_admin/admin/widgets.py,sha256=
|
|
8
|
+
django_smartbase_admin/admin/widgets.py,sha256=YANVaaBZJKJWdXYkM4Aj0vd4YlkMBLOffyR9yiDULsU,22110
|
|
9
9
|
django_smartbase_admin/apps.py,sha256=C1wT1YUEZNKcUJfpD01nIZEFgYEsuav52WFKvEURRDU,545
|
|
10
10
|
django_smartbase_admin/compilemessages.py,sha256=-_FEFQlOvE4L8UzSuUxSxZQjgGlwL9IZtmg59fW_kIQ,342
|
|
11
11
|
django_smartbase_admin/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -69,7 +69,7 @@ django_smartbase_admin/static/sb_admin/dist/main_style.js,sha256=47DEQpj8HBSa-_T
|
|
|
69
69
|
django_smartbase_admin/static/sb_admin/dist/table.js,sha256=xXAY3TNQbbyUZMZ51trz9P29PHjzLoLIEt4uB1biok4,592072
|
|
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
|
-
django_smartbase_admin/static/sb_admin/dist/tree_widget.js,sha256=
|
|
72
|
+
django_smartbase_admin/static/sb_admin/dist/tree_widget.js,sha256=HISaHwiDQu8u8SGMqCQJP6LmAroyNqg4wi-oKb2CE2E,6314
|
|
73
73
|
django_smartbase_admin/static/sb_admin/dist/tree_widget_style.css,sha256=rFGd70qMkzMLhDkjoKZTbbUNMU19_wWeCngHaoSrUhc,10546
|
|
74
74
|
django_smartbase_admin/static/sb_admin/dist/tree_widget_style.js,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
75
|
django_smartbase_admin/static/sb_admin/fancytree/jquery.fancytree-all-deps.min.js,sha256=JcIBncqpLNQT11WI19oVQQOhCmvoduGuxCR5Vaqupcc,130772
|
|
@@ -527,7 +527,7 @@ django_smartbase_admin/static/sb_admin/src/js/table_modules/selection_module.js,
|
|
|
527
527
|
django_smartbase_admin/static/sb_admin/src/js/table_modules/table_params_module.js,sha256=2-l4rsjDqaUZZzM7why-u21XbVNa9gFogehKTi8hIkE,11370
|
|
528
528
|
django_smartbase_admin/static/sb_admin/src/js/table_modules/views_module.js,sha256=ZdirU9jt_aE_vkVXxMytZ3AaC0q6r57ECijdhV6j3-M,3393
|
|
529
529
|
django_smartbase_admin/static/sb_admin/src/js/translations.js,sha256=GEizlr_D5yDj00i7jKENkWfDr6gZcg4RQ1Nek22WP4g,954
|
|
530
|
-
django_smartbase_admin/static/sb_admin/src/js/tree_widget.js,sha256=
|
|
530
|
+
django_smartbase_admin/static/sb_admin/src/js/tree_widget.js,sha256=NHmGeDtPipZggb2DW0XqA5XHAHfZ7jn_h3ug3JJHjKE,17127
|
|
531
531
|
django_smartbase_admin/static/sb_admin/src/js/utils.js,sha256=I6jvqqmgQVIL-VrWWAZsYSAThl3sThhaG4nxquyd4ic,4677
|
|
532
532
|
django_smartbase_admin/templates/sb_admin/actions/change_form.html,sha256=Vqp9oZgwagz8bZw7UmsXf692cYLnGl5W-ujQp-aR2Jk,12734
|
|
533
533
|
django_smartbase_admin/templates/sb_admin/actions/change_password.html,sha256=LhciaKCvlywKMJ6gY9JbEaTkOXjNSFO-mAnWIZfk6sA,3200
|
|
@@ -665,7 +665,7 @@ django_smartbase_admin/templates/sb_admin/widgets/text.html,sha256=piw2218tiWPfO
|
|
|
665
665
|
django_smartbase_admin/templates/sb_admin/widgets/textarea.html,sha256=JZ4Bf6l49dg2VVC5McXtQRehOHmZid1eknUKc2oIDGU,257
|
|
666
666
|
django_smartbase_admin/templates/sb_admin/widgets/time.html,sha256=piw2218tiWPfOwncIvSGAW14Gc5FIzkL_YllirK4yTs,160
|
|
667
667
|
django_smartbase_admin/templates/sb_admin/widgets/toggle.html,sha256=z7E1re0gy2Adkbsvp_iYgZ6_48TmZDz5A0s_D9Zsi2w,289
|
|
668
|
-
django_smartbase_admin/templates/sb_admin/widgets/tree_base.html,sha256=
|
|
668
|
+
django_smartbase_admin/templates/sb_admin/widgets/tree_base.html,sha256=V7C1cjEiaa6NCFw6O7Nq29MBkv3_AhwBdtCTW3M5pFM,2649
|
|
669
669
|
django_smartbase_admin/templates/sb_admin/widgets/tree_select.html,sha256=FlUDS8ALj1nPsKTkyz9sMEugkl2RTvkUdN1VeL35ddc,1330
|
|
670
670
|
django_smartbase_admin/templates/sb_admin/widgets/tree_select_inline.html,sha256=lJeWRAVZSDHjNphFVLTL-mABGBnplmzNXcbnk_iGhPo,933
|
|
671
671
|
django_smartbase_admin/templates/sb_admin/widgets/url.html,sha256=piw2218tiWPfOwncIvSGAW14Gc5FIzkL_YllirK4yTs,160
|
|
@@ -679,7 +679,7 @@ django_smartbase_admin/views/dashboard_view.py,sha256=vtz5emYTQ5WDFeLA8HrcmjSOVd
|
|
|
679
679
|
django_smartbase_admin/views/global_filter_view.py,sha256=eYo1moJGyi7jc2cPDA5ZBiEgA7Hmc-DxbQvbqUpDkg8,1127
|
|
680
680
|
django_smartbase_admin/views/media_view.py,sha256=5BLWXuzynF7nM34t-mf2BQSRN5ojY8HxpLIqt7Jiq9g,292
|
|
681
681
|
django_smartbase_admin/views/translations_view.py,sha256=tkShf5IWyPDjNhcPQsvh8WXs-EMRCfG_oTD9x-LP1No,20272
|
|
682
|
-
django_smartbase_admin-0.2.
|
|
683
|
-
django_smartbase_admin-0.2.
|
|
684
|
-
django_smartbase_admin-0.2.
|
|
685
|
-
django_smartbase_admin-0.2.
|
|
682
|
+
django_smartbase_admin-0.2.98.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
|
|
683
|
+
django_smartbase_admin-0.2.98.dist-info/METADATA,sha256=KUYzvnlqfKETXDgWKtlGyiNvGILTBNcg0dBqc39B_sU,996
|
|
684
|
+
django_smartbase_admin-0.2.98.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
685
|
+
django_smartbase_admin-0.2.98.dist-info/RECORD,,
|
{django_smartbase_admin-0.2.97.dist-info → django_smartbase_admin-0.2.98.dist-info}/LICENSE.md
RENAMED
|
File without changes
|
|
File without changes
|