@gip-recia/js-tree
Advanced tools
Comparing version 0.0.15 to 0.0.16
{ | ||
"trailingComma": "none", | ||
"$schema": "https://json.schemastore.org/prettierrc", | ||
"semi": false, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"trailingComma": "none", | ||
"bracketSpacing": true, | ||
"bracketSameLine": true, | ||
"arrowParens": "avoid", | ||
"semi": false | ||
"arrowParens": "avoid" | ||
} |
{ | ||
"name": "@gip-recia/js-tree", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Js Tree", | ||
@@ -34,25 +34,25 @@ "main": "src/js-tree.js", | ||
"dependencies": { | ||
"lit": "2.7.4" | ||
"lit": "2.8.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.21.8", | ||
"@babel/eslint-parser": "7.21.8", | ||
"@custom-elements-manifest/analyzer": "0.5.7", | ||
"@babel/core": "7.22.15", | ||
"@babel/eslint-parser": "7.22.15", | ||
"@custom-elements-manifest/analyzer": "0.8.4", | ||
"@esm-bundle/chai": "4.3.4-fix.0", | ||
"@fortawesome/fontawesome-free": "6.4.0", | ||
"@open-wc/testing": "3.1.8", | ||
"@fortawesome/fontawesome-free": "6.4.2", | ||
"@open-wc/testing": "3.2.0", | ||
"@open-wc/testing-karma": "4.0.9", | ||
"@rollup/plugin-node-resolve": "13.3.0", | ||
"@types/mocha": "9.1.1", | ||
"@web/dev-server": "0.1.38", | ||
"@web/dev-server-legacy": "1.0.3", | ||
"@web/test-runner": "0.13.31", | ||
"@web/test-runner-mocha": "0.7.5", | ||
"@web/test-runner-playwright": "0.8.10", | ||
"@rollup/plugin-node-resolve": "15.2.1", | ||
"@types/mocha": "10.0.1", | ||
"@web/dev-server": "0.3.1", | ||
"@web/dev-server-legacy": "2.0.1", | ||
"@web/test-runner": "0.17.1", | ||
"@web/test-runner-mocha": "0.8.1", | ||
"@web/test-runner-playwright": "0.10.1", | ||
"@webcomponents/webcomponentsjs": "2.8.0", | ||
"deepmerge": "4.3.1", | ||
"eslint": "8.41.0", | ||
"eslint": "8.48.0", | ||
"lit-analyzer": "1.2.1", | ||
"mocha": "10.2.0", | ||
"prettier": "2.8.8", | ||
"prettier": "3.0.3", | ||
"rollup": "2.79.1", | ||
@@ -62,5 +62,5 @@ "rollup-plugin-minify-html-literals": "1.2.6", | ||
"rollup-plugin-terser": "7.0.2", | ||
"rollup-plugin-visualizer": "5.9.0" | ||
"rollup-plugin-visualizer": "5.9.2" | ||
}, | ||
"customElements": "custom-elements.json" | ||
} |
@@ -59,2 +59,2 @@ // Import rollup plugins | ||
} | ||
] | ||
] |
@@ -53,4 +53,3 @@ import { LitElement, html } from 'lit' | ||
if (changedProperties) { | ||
initDatas = | ||
changedProperties.has('datas') || changedProperties.has('config') | ||
initDatas = changedProperties.has('datas') || changedProperties.has('config') | ||
} | ||
@@ -68,5 +67,3 @@ | ||
if (this.config.sort) { | ||
this._activeElement = this._datas.sort((node1, node2) => | ||
node1.text.localeCompare(node2.text) | ||
)[0] | ||
this._activeElement = this._datas.sort((node1, node2) => node1.text.localeCompare(node2.text))[0] | ||
} else { | ||
@@ -84,7 +81,3 @@ this._activeElement = this._datas[0] | ||
this.shadowRoot.querySelectorAll('input[type="checkbox"]').forEach(el => { | ||
const data = this._findDatasByProperty( | ||
this._datas, | ||
'idHtml', | ||
el.id.replace('-checkbox', '') | ||
) | ||
const data = this._findDatasByProperty(this._datas, 'idHtml', el.id.replace('-checkbox', '')) | ||
if (data && data.length === 1) { | ||
@@ -123,7 +116,3 @@ el.checked = data[0].selected | ||
deselectAllNodes() { | ||
const previousSelectedDatas = this._findDatasByProperty( | ||
this._datas, | ||
'selected', | ||
true | ||
) | ||
const previousSelectedDatas = this._findDatasByProperty(this._datas, 'selected', true) | ||
if (previousSelectedDatas && previousSelectedDatas.length > 0) { | ||
@@ -173,11 +162,5 @@ this._unSelectDatas(this._datas) | ||
if (data && data.length > 0) { | ||
const previousSelectedDatas = this._findDatasByProperty( | ||
this._datas, | ||
'selected', | ||
true | ||
) | ||
const previousSelectedDatas = this._findDatasByProperty(this._datas, 'selected', true) | ||
if (data[0].parent) { | ||
data[0].parent.loadedChildren = data[0].parent.loadedChildren.filter( | ||
child => child.id !== data[0].id | ||
) | ||
data[0].parent.loadedChildren = data[0].parent.loadedChildren.filter(child => child.id !== data[0].id) | ||
} else { | ||
@@ -189,7 +172,3 @@ this._datas = this._datas.filter(child => child.id !== data[0].id) | ||
const nextSelectedDatas = this._findDatasByProperty( | ||
this._datas, | ||
'selected', | ||
true | ||
) | ||
const nextSelectedDatas = this._findDatasByProperty(this._datas, 'selected', true) | ||
if (previousSelectedDatas.length !== nextSelectedDatas.length) { | ||
@@ -214,7 +193,3 @@ // Information d'une désélection | ||
if (data && data.length > 0) { | ||
const previousSelectedDatas = this._findDatasByProperty( | ||
this._datas, | ||
'selected', | ||
true | ||
) | ||
const previousSelectedDatas = this._findDatasByProperty(this._datas, 'selected', true) | ||
@@ -224,7 +199,3 @@ this._refreshNodes(data[0], properties, refreshChildren).then(() => { | ||
const nextSelectedDatas = this._findDatasByProperty( | ||
this._datas, | ||
'selected', | ||
true | ||
) | ||
const nextSelectedDatas = this._findDatasByProperty(this._datas, 'selected', true) | ||
if (previousSelectedDatas.length !== nextSelectedDatas.length) { | ||
@@ -285,7 +256,3 @@ // Information d'une désélection | ||
_renderIconIndicator(data) { | ||
if ( | ||
data.children && | ||
(!data.areChildrenLoaded || | ||
(data.loadedChildren && data.loadedChildren.length > 0)) | ||
) { | ||
if (data.children && (!data.areChildrenLoaded || (data.loadedChildren && data.loadedChildren.length > 0))) { | ||
// prettier-ignore | ||
@@ -393,17 +360,8 @@ return html`<i class="icon icon-indicator"></i>` | ||
if (this._activeElement.ulClasses.includes('subtree-active')) { | ||
this._activeElement.ulClasses.splice( | ||
this._activeElement.ulClasses.indexOf('subtree-active'), | ||
1 | ||
) | ||
this._activeElement.ulClasses.splice(this._activeElement.ulClasses.indexOf('subtree-active'), 1) | ||
} | ||
if (this._activeElement.liClasses.includes('item-active')) { | ||
this._activeElement.liClasses.splice( | ||
this._activeElement.liClasses.indexOf('item-active'), | ||
1 | ||
) | ||
this._activeElement.liClasses.splice(this._activeElement.liClasses.indexOf('item-active'), 1) | ||
} | ||
} else if ( | ||
this._activeElement.parent && | ||
this._activeElement.parent.expanded | ||
) { | ||
} else if (this._activeElement.parent && this._activeElement.parent.expanded) { | ||
this._activeElement = this._activeElement.parent | ||
@@ -429,6 +387,3 @@ } | ||
if (this._activeElement.expanded) { | ||
if ( | ||
this._activeElement.loadedChildren && | ||
this._activeElement.loadedChildren.length > 0 | ||
) { | ||
if (this._activeElement.loadedChildren && this._activeElement.loadedChildren.length > 0) { | ||
this._activeElement = this._activeElement.loadedChildren[0] | ||
@@ -470,5 +425,3 @@ } | ||
} else { | ||
const sibbling = this._getDownVisibleSiblingElement( | ||
this._activeElement | ||
) | ||
const sibbling = this._getDownVisibleSiblingElement(this._activeElement) | ||
if (sibbling != null) { | ||
@@ -539,9 +492,3 @@ this._activeElement = sibbling | ||
if (data.children && data.loadedChildren) { | ||
result = result.concat( | ||
this._findDatasByProperty( | ||
data.loadedChildren, | ||
propertyName, | ||
propertyValue | ||
) | ||
) | ||
result = result.concat(this._findDatasByProperty(data.loadedChildren, propertyName, propertyValue)) | ||
} | ||
@@ -581,6 +528,3 @@ }) | ||
}) | ||
} else if ( | ||
Array.isArray(data.getChildren) || | ||
data.getChildren instanceof Array | ||
) { | ||
} else if (Array.isArray(data.getChildren) || data.getChildren instanceof Array) { | ||
callback(data.getChildren) | ||
@@ -630,5 +574,3 @@ } | ||
if (i > 0) { | ||
return this._getLastVisibleChild( | ||
element.parent.loadedChildren[i - 1] | ||
) | ||
return this._getLastVisibleChild(element.parent.loadedChildren[i - 1]) | ||
} else { | ||
@@ -658,10 +600,4 @@ return element.parent | ||
_getLastVisibleChild(element) { | ||
if ( | ||
element.expanded && | ||
element.loadedChildren && | ||
element.loadedChildren.length > 0 | ||
) { | ||
return this._getLastVisibleChild( | ||
element.loadedChildren[element.loadedChildren.length - 1] | ||
) | ||
if (element.expanded && element.loadedChildren && element.loadedChildren.length > 0) { | ||
return this._getLastVisibleChild(element.loadedChildren[element.loadedChildren.length - 1]) | ||
} else { | ||
@@ -678,7 +614,3 @@ return element | ||
if (this.onSelection) { | ||
const selectedDatas = this._findDatasByProperty( | ||
this._datas, | ||
'selected', | ||
true | ||
) | ||
const selectedDatas = this._findDatasByProperty(this._datas, 'selected', true) | ||
this.onSelection(selectedDatas) | ||
@@ -702,5 +634,3 @@ } | ||
const newIds = newChildren.map(c => c.id) | ||
oldNode.loadedChildren = oldNode.loadedChildren.filter(child => | ||
newIds.includes(child.id) | ||
) | ||
oldNode.loadedChildren = oldNode.loadedChildren.filter(child => newIds.includes(child.id)) | ||
// Ajout/Mise à jour des enfants | ||
@@ -710,5 +640,3 @@ let index = 0 | ||
newChildren.forEach(newChild => { | ||
const oldChild = oldNode.loadedChildren.find( | ||
c => c.id === newChild.id | ||
) | ||
const oldChild = oldNode.loadedChildren.find(c => c.id === newChild.id) | ||
if (!oldChild) { | ||
@@ -719,5 +647,3 @@ this._initDataList([newChild], oldNode.idHtml) | ||
} else { | ||
promises.push( | ||
this._refreshNodes(oldChild, newChild, refreshChildren) | ||
) | ||
promises.push(this._refreshNodes(oldChild, newChild, refreshChildren)) | ||
} | ||
@@ -724,0 +650,0 @@ index++ |
@@ -78,5 +78,3 @@ import { legacyPlugin } from '@web/dev-server-legacy' | ||
try { | ||
commandLineBrowsers = process.env.BROWSERS?.split(',').map( | ||
b => browsers[b] ?? noBrowser(b) | ||
) | ||
commandLineBrowsers = process.env.BROWSERS?.split(',').map(b => browsers[b] ?? noBrowser(b)) | ||
} catch (e) { | ||
@@ -83,0 +81,0 @@ console.warn(e) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47050
993