mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Show badges with the number of child nodes in the admin page treeviews again.
This commit is contained in:
parent
365b85ac4c
commit
f21cd55b2e
4 changed files with 16 additions and 7 deletions
|
@ -1,14 +1,19 @@
|
|||
import {Controller} from "@hotwired/stimulus";
|
||||
|
||||
import {BSTreeView, BS5Theme, FAIconTheme, EVENT_INITIALIZED} from "@jbtronics/bs-treeview";
|
||||
import {BSTreeView, BSTreeViewNode, BS5Theme, FAIconTheme, EVENT_INITIALIZED} from "@jbtronics/bs-treeview";
|
||||
import "@jbtronics/bs-treeview/styles/bs-treeview.css";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "tree" ];
|
||||
|
||||
/** @type {string} */
|
||||
_url = null;
|
||||
/** @type {BSTreeViewNode[]} */
|
||||
_data = null;
|
||||
|
||||
/** @type {boolean} */
|
||||
_showTags = false;
|
||||
|
||||
/**
|
||||
* @type {BSTreeView}
|
||||
* @private
|
||||
|
@ -25,6 +30,10 @@ export default class extends Controller {
|
|||
this._url = this.element.dataset.treeUrl;
|
||||
this._data = this.element.dataset.treeData;
|
||||
|
||||
if(this.element.dataset.treeShowTags === "true") {
|
||||
this._showTags = true;
|
||||
}
|
||||
|
||||
this.reinitTree();
|
||||
}
|
||||
|
||||
|
@ -55,7 +64,7 @@ export default class extends Controller {
|
|||
|
||||
this._tree = new BSTreeView(this.treeTarget, {
|
||||
levels: 1,
|
||||
//showTags: true,
|
||||
showTags: this._showTags,
|
||||
data: data,
|
||||
showIcon: false,
|
||||
onNodeSelected: function (event) {
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
{% endmacro %}
|
||||
|
||||
{% macro treeview(entity) %}
|
||||
<div {{ stimulus_controller('elements/tree') }} data-tree-data="{{ generateTreeData(entity) }}">
|
||||
<div {{ stimulus_controller('elements/tree') }} data-tree-data="{{ generateTreeData(entity) }}" data-tree-show-tags="true">
|
||||
<div class="row" >
|
||||
<div class="col-8">
|
||||
<input type="search" class="form-control" placeholder="{% trans %}search.placeholder{% endtrans %}" {{ stimulus_action('elements/tree', 'searchInput') }}>
|
||||
|
|
|
@ -93,7 +93,7 @@ Encore
|
|||
|
||||
// enables @babel/preset-env polyfills
|
||||
.configureBabelPresetEnv((config) => {
|
||||
config.useBuiltIns = 'usage';
|
||||
//config.useBuiltIns = 'usage';
|
||||
config.corejs = 3;
|
||||
})
|
||||
// enables Sass/SCSS support
|
||||
|
|
|
@ -1345,9 +1345,9 @@
|
|||
integrity sha512-Q8kGjqwPqER+CtpQudbH+3Zgs2X4zb6pBAlr6NsKTXadg45pAOvxI9i4QpuHbwSzR2+x87HUm+rot9F/Pe8rxA==
|
||||
|
||||
"@jbtronics/bs-treeview@^1.0.1":
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@jbtronics/bs-treeview/-/bs-treeview-1.0.2.tgz#139e43eb81e9a03099e577975721b9cac0a420de"
|
||||
integrity sha512-xviDoNNkZbgg5kmluNibiAPF39sPBz4WYcPs7IX6U2C0jYbomyEtwzLAz0GXDjB/w1z1C2Gp3EkivfRxpRHSnQ==
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@jbtronics/bs-treeview/-/bs-treeview-1.0.3.tgz#19a176fc84fbee5c7cc86c190ee351f480bdaf3d"
|
||||
integrity sha512-9KU5bnrZr5saEfkTvUY5/sg1AS1tf5OvDiQmjHSnfygtVW77FI91jyuMOmn/7gGwPypPYI354wlMVvlgf9HroA==
|
||||
|
||||
"@jridgewell/gen-mapping@^0.1.0":
|
||||
version "0.1.1"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue