@gip-recia/evaluator
Advanced tools
Comparing version 0.0.16 to 0.0.17
{ | ||
"root": true, | ||
"extends": ["eslint:recommended"], | ||
"parser": "babel-eslint", | ||
"parser": "@babel/eslint-parser", | ||
"globals": { | ||
@@ -9,3 +9,4 @@ "chai": "readonly" | ||
"parserOptions": { | ||
"sourceType": "module" | ||
"sourceType": "module", | ||
"requireConfigFile": false | ||
}, | ||
@@ -12,0 +13,0 @@ "env": { |
{ | ||
"name": "@gip-recia/evaluator", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Evaluator", | ||
@@ -34,34 +34,35 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"@gip-recia/esup-publisher-webcomponents-utils": "^0.0.3", | ||
"@gip-recia/subject-infos": "^0.0.12", | ||
"@gip-recia/subject-search-button": "^0.0.16", | ||
"lit": "^2.2.0" | ||
"@gip-recia/esup-publisher-webcomponents-utils": "0.0.4", | ||
"@gip-recia/subject-infos": "0.0.13", | ||
"@gip-recia/subject-search-button": "0.0.17", | ||
"lit": "2.7.4" | ||
}, | ||
"devDependencies": { | ||
"@custom-elements-manifest/analyzer": "^0.5.3", | ||
"@esm-bundle/chai": "^4.1.5", | ||
"@fortawesome/fontawesome-free": "^6.4.0", | ||
"@open-wc/testing": "^3.0.0-next.1", | ||
"@open-wc/testing-karma": "^4.0.9", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@types/mocha": "^9.0.0", | ||
"@web/dev-server": "^0.1.22", | ||
"@web/dev-server-legacy": "^0.1.4", | ||
"@web/test-runner": "^0.13.16", | ||
"@web/test-runner-mocha": "^0.7.4", | ||
"@web/test-runner-playwright": "^0.8.4", | ||
"@webcomponents/webcomponentsjs": "^2.6.0", | ||
"babel-eslint": "^10.1.0", | ||
"deepmerge": "^4.2.2", | ||
"eslint": "^7.32.0", | ||
"lit-analyzer": "^1.2.1", | ||
"mocha": "^9.1.1", | ||
"prettier": "^2.3.2", | ||
"rollup": "^2.70.1", | ||
"rollup-plugin-minify-html-literals": "^1.2.6", | ||
"rollup-plugin-summary": "^1.3.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-visualizer": "^5.6.0" | ||
"@babel/core": "7.21.8", | ||
"@babel/eslint-parser": "7.21.8", | ||
"@custom-elements-manifest/analyzer": "0.5.7", | ||
"@esm-bundle/chai": "4.3.4-fix.0", | ||
"@fortawesome/fontawesome-free": "6.4.0", | ||
"@open-wc/testing": "3.1.8", | ||
"@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", | ||
"@webcomponents/webcomponentsjs": "2.8.0", | ||
"deepmerge": "4.3.1", | ||
"eslint": "8.41.0", | ||
"lit-analyzer": "1.2.1", | ||
"mocha": "10.2.0", | ||
"prettier": "2.8.8", | ||
"rollup": "2.79.1", | ||
"rollup-plugin-minify-html-literals": "1.2.6", | ||
"rollup-plugin-summary": "1.4.3", | ||
"rollup-plugin-terser": "7.0.2", | ||
"rollup-plugin-visualizer": "5.9.0" | ||
}, | ||
"customElements": "custom-elements.json" | ||
} |
@@ -88,2 +88,4 @@ # **Esup Evaluator et Edit-Evaluator** | ||
- `onSubjectClicked` - Fonction appelée lors du clic sur une personne/un groupe. | ||
### **Variables CSS** | ||
@@ -136,2 +138,4 @@ | ||
- `onSubjectClicked` - Fonction appelée lors du clic sur une personne/un groupe. | ||
### **Fonctions** | ||
@@ -138,0 +142,0 @@ |
@@ -27,4 +27,4 @@ import { css } from 'lit' | ||
.icon-remove:before { | ||
content: var(--icon-remove-content, '\\f057'); | ||
content: var(--icon-remove-content, '\\f2ed'); | ||
} | ||
` |
@@ -53,3 +53,9 @@ import { LitElement, html, css } from 'lit' | ||
*/ | ||
onModification: { attribute: false } | ||
onModification: { attribute: false }, | ||
/** | ||
* Fonction appelée au clic sur un subject-infos. | ||
* @type {Function} | ||
*/ | ||
onSubjectClicked: { attribute: false } | ||
} | ||
@@ -102,3 +108,4 @@ } | ||
@childDeletion="${(e) => this._onChildDeletionEvent(e)}" | ||
@childUpdate="${(e) => this._onChildUpdateEvent(e)}"> | ||
@childUpdate="${(e) => this._onChildUpdateEvent(e)}" | ||
@subjectClick="${(e) => this._onSubjectClickedEvent(e, e.detail.subject)}"> | ||
</esup-edit-evaluators> | ||
@@ -125,3 +132,4 @@ ` | ||
@childDeletion="${(e) => this._onChildDeletionEvent(e)}" | ||
@childUpdate="${(e) => this._onChildUpdateEvent(e)}"> | ||
@childUpdate="${(e) => this._onChildUpdateEvent(e)}" | ||
@subjectClick="${(e) => this._onSubjectClickedEvent(e, e.detail.subject)}"> | ||
</esup-edit-evaluators> | ||
@@ -160,3 +168,3 @@ </li> | ||
userRendering = html` | ||
<esup-subject-infos .subject="${userModelId}" .config="${this.config}"> | ||
<esup-subject-infos .subject="${userModelId}" .config="${this.config}" .onSubjectClicked="${() => this._onSubjectClickedEvent(null, userModelId)}"> | ||
<span>${this._localization.getLabel('userAttribute.subjetIs')}</span> | ||
@@ -220,3 +228,3 @@ </esup-subject-infos> | ||
groupRendering = html` | ||
<esup-subject-infos .subject="${userModelId}" .config="${this.config}"> | ||
<esup-subject-infos .subject="${userModelId}" .config="${this.config}" .onSubjectClicked="${() => this._onSubjectClickedEvent(null, userModelId)}"> | ||
<span>${this._localization.getLabel('userGroup.memberOf')}</span> | ||
@@ -732,17 +740,34 @@ </esup-subject-infos> | ||
/** | ||
* Envoi un évènement au composant parrent. | ||
* Méthode appelée au clic sur un subject-infos. | ||
* | ||
* @param {Object} event Evènement | ||
* @param {Object} subject Subject-infos cliqué | ||
*/ | ||
_onSubjectClickedEvent(event, subject) { | ||
if (event) { | ||
event.stopPropagation() | ||
} | ||
this._sendEvent('subjectClick', {subject: subject}) | ||
} | ||
/** | ||
* Envoi un évènement au composant parent. | ||
* | ||
* @param {String} eventName Nom de l'évènement | ||
* @param {Object} detail Détail envoyé avec l'évènement | ||
*/ | ||
_sendEvent(eventName) { | ||
_sendEvent(eventName, detail) { | ||
if (!this.isChild && eventName === 'childUpdate') { | ||
// Si on est sur l'évaluateur racine et qu'il s'ait d'une mise à jour, appel à la méthode callBack | ||
// Si on est sur l'évaluateur racine et qu'il s'agit d'une mise à jour, appel à la méthode callBack | ||
if (this.onModification) { | ||
this.onModification(this._evaluator) | ||
} | ||
} else if (!this.isChild && eventName === 'subjectClick') { | ||
// Si on est sur l'évaluateur racine et qu'il s'agit d'une mise à jour, appel à la méthode callBack | ||
if (this.onSubjectClicked && detail.subject) { | ||
this.onSubjectClicked(detail.subject) | ||
} | ||
} else { | ||
const options = { | ||
detail: { | ||
evaluator: this._evaluator | ||
}, | ||
detail: Object.assign(detail || {}, { evaluator: this._evaluator }), | ||
bubbles: true, | ||
@@ -749,0 +774,0 @@ composed: true |
@@ -46,3 +46,9 @@ import { LitElement, html, css } from 'lit' | ||
*/ | ||
config: { attribute: false } | ||
config: { attribute: false }, | ||
/** | ||
* Fonction appelée au clic sur un subject-infos. | ||
* @type {Function} | ||
*/ | ||
onSubjectClicked: { attribute: false } | ||
} | ||
@@ -63,3 +69,3 @@ } | ||
// prettier-ignore | ||
rendering = html`<esup-simple-evaluators .collection="${this.evaluator.evaluators}" .config="${this.config}"></esup-simple-evaluators>` | ||
rendering = html`<esup-simple-evaluators .collection="${this.evaluator.evaluators}" .config="${this.config}" @subjectClick="${(e) => this._onSubjectClickedEvent(e, e.detail.subject)}"></esup-simple-evaluators>` | ||
if (this.isChild || this.evaluator.type !== 'OR') { | ||
@@ -71,3 +77,3 @@ // prettier-ignore | ||
// prettier-ignore | ||
rendering = html`<span>${this.evaluator.type}</span><esup-evaluators .collection="${this.evaluator.evaluators}" .config="${this.config}"></esup-evaluators>` | ||
rendering = html`<span>${this.evaluator.type}</span><esup-evaluators .collection="${this.evaluator.evaluators}" .config="${this.config}" @subjectClick="${(e) => this._onSubjectClickedEvent(e, e.detail.subject)}"></esup-evaluators>` | ||
} | ||
@@ -100,6 +106,6 @@ if (!(this.isChild || this.simple)) { | ||
// prettier-ignore | ||
rendering = html`<esup-subject-infos .subject="${userModelId}" .config="${this.config}"><span>${this._localization.getLabel('userAttribute.subjetIs')}</span></esup-subject-infos>` | ||
rendering = html`<esup-subject-infos .subject="${userModelId}" .config="${this.config}" .onSubjectClicked="${() => this._onSubjectClickedEvent(null, userModelId)}"><span>${this._localization.getLabel('userAttribute.subjetIs')}</span></esup-subject-infos>` | ||
} else { | ||
// prettier-ignore | ||
rendering = html`<esup-subject-infos .subject="${userModelId}" .config="${this.config}"></esup-subject-infos>` | ||
rendering = html`<esup-subject-infos .subject="${userModelId}" .config="${this.config}" .onSubjectClicked="${() => this._onSubjectClickedEvent(null, userModelId)}"></esup-subject-infos>` | ||
} | ||
@@ -124,6 +130,6 @@ } else { | ||
// prettier-ignore | ||
rendering = html`<esup-subject-infos .subject="${groupModelId}" .config="${this.config}"><span>${this._localization.getLabel('userGroup.memberOf')}</span></esup-subject-infos>` | ||
rendering = html`<esup-subject-infos .subject="${groupModelId}" .config="${this.config}" .onSubjectClicked="${() => this._onSubjectClickedEvent(null, groupModelId)}"><span>${this._localization.getLabel('userGroup.memberOf')}</span></esup-subject-infos>` | ||
} else { | ||
// prettier-ignore | ||
rendering = html`<esup-subject-infos .subject="${groupModelId}" .config="${this.config}"></esup-subject-infos>` | ||
rendering = html`<esup-subject-infos .subject="${groupModelId}" .config="${this.config}" .onSubjectClicked="${() => this._onSubjectClickedEvent(null, groupModelId)}"></esup-subject-infos>` | ||
} | ||
@@ -161,2 +167,37 @@ break | ||
} | ||
/** | ||
* Méthode appelée au clic sur un subject-infos. | ||
* | ||
* @param {Object} event Evènement | ||
* @param {Object} subject Subject-infos cliqué | ||
*/ | ||
_onSubjectClickedEvent(event, subject) { | ||
if (event) { | ||
event.stopPropagation() | ||
} | ||
this._sendEvent('subjectClick', {subject: subject}) | ||
} | ||
/** | ||
* Envoi un évènement au composant parent. | ||
* | ||
* @param {String} eventName Nom de l'évènement | ||
* @param {Object} detail Détail envoyé avec l'évènement | ||
*/ | ||
_sendEvent(eventName, detail) { | ||
if (!this.isChild && eventName === 'subjectClick') { | ||
// Si on est sur l'évaluateur racine et qu'il s'agit d'un clic sur un subject-infos, appel à la méthode callBack | ||
if (this.onSubjectClicked && detail.subject) { | ||
this.onSubjectClicked(detail.subject) | ||
} | ||
} else { | ||
const options = { | ||
detail: detail, | ||
bubbles: true, | ||
composed: true | ||
} | ||
this.dispatchEvent(new CustomEvent(eventName, options)) | ||
} | ||
} | ||
} | ||
@@ -163,0 +204,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
100285
1819
180
0
25
+ Added@gip-recia/esup-publisher-webcomponents-utils@0.0.4(transitive)
+ Added@gip-recia/js-tree@0.0.13(transitive)
+ Added@gip-recia/subject-infos@0.0.13(transitive)
+ Added@gip-recia/subject-search-button@0.0.17(transitive)
+ Addedlit@2.7.4(transitive)
- Removed@gip-recia/esup-publisher-webcomponents-utils@0.0.3(transitive)
- Removed@gip-recia/js-tree@0.0.14(transitive)
- Removed@gip-recia/subject-infos@0.0.12(transitive)
- Removed@gip-recia/subject-search-button@0.0.16(transitive)
- Removedlit@2.8.0(transitive)
Updatedlit@2.7.4