@clevercloud/components
Advanced tools
Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3
@@ -1,2 +0,2 @@ | ||
import"../atoms/cc-button.js";import"../atoms/cc-loader.js";import"./env-var-editor-expert.js";import"./env-var-editor-simple.js";import{css as t,html as e,LitElement as i}from"lit-element";import{classMap as r}from"lit-html/directives/class-map.js";import{dispatchCustomEvent as s}from"../lib/events.js";import a from"@i18n";export class EnvVarForm extends i{static get properties(){return{saving:{type:Boolean},t:{type:Array,attribute:!1},i:{type:Array,attribute:!1},s:{type:String,attribute:!1},o:{type:Boolean,attribute:!1}}}constructor(){super(),this.s="SIMPLE",this.saving=!1}static get modes(){return[{label:a("env-var-form.mode.simple"),value:"SIMPLE"},{label:a("env-var-form.mode.expert"),value:"EXPERT"}]}static get styles(){return t`:host{display:block;background:#fff;border-radius:.25rem;border:1px solid #bcc2d1;padding:1rem;position:relative}.editor,.mode-switcher{margin-bottom:1rem}.mode-switcher{justify-content:center}.saving{filter:blur(.3rem)}.button-bar{display:flex;justify-content:space-between}.saving-loader{height:100%;left:0;position:absolute;top:0;width:100%}`}set variables(t){this.l=t,this.o=!0,this.t=t.sort((t,e)=>t.name.localeCompare(e.name)),this.i=t.sort((t,e)=>t.name.localeCompare(e.name))}render(){const t=this.saving?e`<cc-loader class="saving-loader"></cc-loader>`:"";return e`<cc-toggle class="${r({"mode-switcher":!0,saving:this.saving})}" value="${this.s}" .choices="${EnvVarForm.modes}" ?disabled="${this.saving}" @cc-toggle:input="${this.h}"></cc-toggle><div class="${r({editor:!0,saving:this.saving})}"><env-var-editor-simple ?hidden="${"SIMPLE"!==this.s}" .variables="${this.t}" ?disabled="${this.saving}" @env-var-editor-simple:change="${this.v}"></env-var-editor-simple><env-var-editor-expert ?hidden="${"EXPERT"!==this.s}" .variables="${this.i}" ?disabled="${this.saving}" @env-var-editor-expert:change="${this.v}"></env-var-editor-expert></div><div class="button-bar"><cc-button ?disabled="${this.saving}" @click="${this.m}">${a("env-var-form.reset")}</cc-button><cc-button success ?disabled="${this.saving||this.o}" @click="${this.p}">${a("env-var-form.update")}</cc-button></div>${t}`}v({detail:t}){const e=this.l.filter(e=>{const i=t.find(t=>t.name===e.name);return(null==i||i.isDeleted)&&!e.isNew}).map(t=>({...t,isDeleted:!0})),i=t.filter(t=>{return null==this.l.find(e=>e.name===t.name)}).map(t=>({...t,isNew:!0})),r=t.filter(t=>{const r=e.find(e=>e.name===t.name),s=i.find(e=>e.name===t.name);return!r&&!s}).map(t=>{const e=this.l.find(e=>e.name===t.name).value!==t.value;return{...t,isEdited:e}}),s=[...e,...i,...r];this.o=!s.some(({isDeleted:t,isNew:e,isEdited:i})=>t||e||i),this.t=s.sort((t,e)=>t.name.localeCompare(e.name))}h({detail:t}){"EXPERT"===t&&(this.i=this.t),this.s=t}m(){this.variables=this.l}p(){s(this,"submit",this.t)}}window.customElements.define("env-var-form",EnvVarForm); | ||
import"../atoms/cc-button.js";import"../atoms/cc-loader.js";import"./env-var-editor-expert.js";import"./env-var-editor-simple.js";import{css as e,html as t,LitElement as i}from"lit-element";import{classMap as r}from"lit-html/directives/class-map.js";import{dispatchCustomEvent as s}from"../lib/events.js";import n from"@i18n";export class EnvVarForm extends i{static get properties(){return{saving:{type:Boolean},error:{type:String},t:{type:Array,attribute:!1},i:{type:Array,attribute:!1},s:{type:String,attribute:!1},o:{type:Boolean,attribute:!1}}}constructor(){super(),this.s="SIMPLE",this.saving=!1,this.error=null}static get modes(){return[{label:n("env-var-form.mode.simple"),value:"SIMPLE"},{label:n("env-var-form.mode.expert"),value:"EXPERT"}]}static get styles(){return e`:host{display:block;background:#fff;border-radius:.25rem;border:1px solid #bcc2d1;padding:1rem;position:relative}.editor,.mode-switcher{margin-bottom:1rem}.mode-switcher{justify-content:center}.saving{filter:blur(.3rem)}.button-bar{display:flex;justify-content:space-between}.saving-loader{height:100%;left:0;position:absolute;top:0;width:100%}.error-container{height:100%;left:0;position:absolute;top:0;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.panel{display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:#fff;padding:1rem;border-radius:.25rem;border:1px solid #ccc;max-width:80%}.error-message{margin-bottom:1rem}`}set variables(e){this.l=e,this.o=!0,this.t=e.sort((e,t)=>e.name.localeCompare(t.name)),this.i=e.sort((e,t)=>e.name.localeCompare(t.name))}render(){const e=this.saving?t`<cc-loader class="saving-loader"></cc-loader>`:"",i="loading"===this.error?n("env-var-form.error.loading"):"saving"===this.error?n("env-var-form.error.saving"):n("env-var-form.error.unknown"),s=null!=this.error?t`<div class="error-container"><div class="panel"><div class="error-message">⚠️ ${i}</div><cc-button @click="${()=>this.h(this.error)}">OK</cc-button></div></div>`:"";return t`<cc-toggle class="${r({"mode-switcher":!0,saving:this.saving||null!=this.error})}" value="${this.s}" .choices="${EnvVarForm.modes}" ?disabled="${this.saving||null!=this.error}" @cc-toggle:input="${this.v}"></cc-toggle><div class="${r({editor:!0,saving:this.saving||null!=this.error})}"><env-var-editor-simple ?hidden="${"SIMPLE"!==this.s}" .variables="${this.t}" ?disabled="${this.saving||null!=this.error}" @env-var-editor-simple:change="${this.m}"></env-var-editor-simple><env-var-editor-expert ?hidden="${"EXPERT"!==this.s}" .variables="${this.i}" ?disabled="${this.saving||null!=this.error}" @env-var-editor-expert:change="${this.m}"></env-var-editor-expert></div><div class="button-bar"><cc-button ?disabled="${null==this.t||this.saving||null!=this.error}" @click="${this.u}">${n("env-var-form.reset")}</cc-button><cc-button success ?disabled="${null==this.t||this.saving||this.o||null!=this.error}" @click="${this.p}">${n("env-var-form.update")}</cc-button></div>${e} ${s}`}m({detail:e}){const t=this.l.filter(t=>{const i=e.find(e=>e.name===t.name);return(null==i||i.isDeleted)&&!t.isNew}).map(e=>({...e,isDeleted:!0})),i=e.filter(e=>{return null==this.l.find(t=>t.name===e.name)}).map(e=>({...e,isNew:!0})),r=e.filter(e=>{const r=t.find(t=>t.name===e.name),s=i.find(t=>t.name===e.name);return!r&&!s}).map(e=>{const t=this.l.find(t=>t.name===e.name).value!==e.value;return{...e,isEdited:t}}),s=[...t,...i,...r];this.o=!s.some(({isDeleted:e,isNew:t,isEdited:i})=>e||t||i),this.t=s.sort((e,t)=>e.name.localeCompare(t.name))}v({detail:e}){"EXPERT"===e&&(this.i=this.t),this.s=e}u(){this.variables=this.l}p(){const e=this.t.filter(({isDeleted:e})=>!e).map(({name:e,value:t})=>({name:e,value:t}));s(this,"submit",e)}h(e){s(this,"dismissed-error",e)}}window.customElements.define("env-var-form",EnvVarForm); | ||
//# sourceMappingURL=env-var-form.js.map |
@@ -1,2 +0,2 @@ | ||
module.exports.en={LANGUAGE:"English","env-var-create.name.placeholder":"ENV_VAR_NAME","env-var-create.value.placeholder":"env var value","env-var-create.create-button":"Create","env-var-create.errors.invalid-name":({name:e})=>`Name ${e} is invalid`,"env-var-create.errors.already-defined-name":({name:e})=>`Name ${e} is already defined`,"env-var-editor-simple.empty-data":"No environment variables yet.","env-var-editor-expert.errors.none":"No errors","env-var-editor-expert.errors.unknown":"Unknown Error","env-var-editor-expert.errors.invalid-name":({name:e})=>`${e} is not a valid variable name`,"env-var-editor-expert.errors.duplicated-name":({name:e})=>`be careful, the name ${e} is already defined`,"env-var-editor-expert.errors.invalid-line":'this line is not valid, the correct pattern is KEY="VALUE"',"env-var-editor-expert.errors.invalid-value":'the value is not valid, if you use quotes, you need to escape them like this \\" or quote the whole value.',"env-var-form.mode.simple":"Simple","env-var-form.mode.expert":"Expert","env-var-form.reset":"Reset changes","env-var-form.update":"Update changes","env-var-input.delete-button":"Remove","env-var-input.keep-button":"Keep","env-var-input.value-placeholder":"Environment variable value"}; | ||
module.exports.en={LANGUAGE:"English","env-var-create.name.placeholder":"ENV_VAR_NAME","env-var-create.value.placeholder":"env var value","env-var-create.create-button":"Create","env-var-create.errors.invalid-name":({name:e})=>`Name ${e} is invalid`,"env-var-create.errors.already-defined-name":({name:e})=>`Name ${e} is already defined`,"env-var-editor-simple.empty-data":"No environment variables yet.","env-var-editor-expert.errors.unknown":"Unknown Error","env-var-editor-expert.errors.invalid-name":({name:e})=>`${e} is not a valid variable name`,"env-var-editor-expert.errors.duplicated-name":({name:e})=>`be careful, the name ${e} is already defined`,"env-var-editor-expert.errors.invalid-line":'this line is not valid, the correct pattern is KEY="VALUE"',"env-var-editor-expert.errors.invalid-value":'the value is not valid, if you use quotes, you need to escape them like this \\" or quote the whole value.',"env-var-form.mode.simple":"Simple","env-var-form.mode.expert":"Expert","env-var-form.reset":"Reset changes","env-var-form.update":"Update changes","env-var-form.error.loading":"Something went wrong while loading environment variables.","env-var-form.error.saving":"Something went wrong while updating environment variables.","env-var-form.error.unknown":"Something went wrong...","env-var-input.delete-button":"Remove","env-var-input.keep-button":"Keep","env-var-input.value-placeholder":"Environment variable value"}; | ||
//# sourceMappingURL=translations.en.js.map |
@@ -1,2 +0,2 @@ | ||
module.exports.fr={LANGUAGE:"Français","env-var-create.name.placeholder":"NOM_VAR_ENV","env-var-create.value.placeholder":"valeur var env","env-var-create.create-button":"Créer","env-var-create.errors.invalid-name":({name:e})=>`Name ${e} is invalid`,"env-var-create.errors.already-defined-name":({name:e})=>`Name ${e} is already defined`,"env-var-editor-simple.empty-data":"Pas de variable d'environnement.","env-var-editor-expert.errors.none":"Pas d'erreur","env-var-editor-expert.errors.unknown":"Erreur inconnue","env-var-editor-expert.errors.invalid-name":({name:e})=>`${e} is not a valid variable name`,"env-var-editor-expert.errors.duplicated-name":({name:e})=>`be careful, the name ${e} is already defined`,"env-var-editor-expert.errors.invalid-line":'this line is not valid, the correct pattern is KEY="VALUE"',"env-var-editor-expert.errors.invalid-value":'the value is not valid, if you use quotes, you need to escape them like this \\" or quote the whole value.',"env-var-form.mode.simple":"Simple","env-var-form.mode.expert":"Expert","env-var-form.reset":"Annuler les changements","env-var-form.update":"Mettre à jour les changements","env-var-input.delete-button":"Enlever","env-var-input.keep-button":"Garder","env-var-input.value-placeholder":"Valeur de la variable d'environnement"}; | ||
module.exports.fr={LANGUAGE:"Français","env-var-create.name.placeholder":"NOM_VAR_ENV","env-var-create.value.placeholder":"valeur var env","env-var-create.create-button":"Créer","env-var-create.errors.invalid-name":({name:e})=>`Name ${e} is invalid`,"env-var-create.errors.already-defined-name":({name:e})=>`Name ${e} is already defined`,"env-var-editor-simple.empty-data":"Pas de variable d'environnement.","env-var-editor-expert.errors.unknown":"Erreur inconnue","env-var-editor-expert.errors.invalid-name":({name:e})=>`${e} is not a valid variable name`,"env-var-editor-expert.errors.duplicated-name":({name:e})=>`be careful, the name ${e} is already defined`,"env-var-editor-expert.errors.invalid-line":'this line is not valid, the correct pattern is KEY="VALUE"',"env-var-editor-expert.errors.invalid-value":'the value is not valid, if you use quotes, you need to escape them like this \\" or quote the whole value.',"env-var-form.mode.simple":"Simple","env-var-form.mode.expert":"Expert","env-var-form.reset":"Annuler les changements","env-var-form.update":"Mettre à jour les changements","env-var-form.error.loading":"Une erreur est survenue pendant le chargement des variables d'environnement.","env-var-form.error.saving":"Une erreur est survenue pendant la mise à jour des variables d'environnement.","env-var-form.error.unknown":"Une erreur est survenue...","env-var-input.delete-button":"Enlever","env-var-input.keep-button":"Garder","env-var-input.value-placeholder":"Valeur de la variable d'environnement"}; | ||
//# sourceMappingURL=translations.fr.js.map |
{ | ||
"name": "@clevercloud/components", | ||
"version": "1.0.0-alpha.2", | ||
"version": "1.0.0-alpha.3", | ||
"description": "This is a Work In Progress to introduce Web Components in our Clever Cloud Web based UIs.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
99228
104