Upgrade webpack, remove service worker, other small optimizations

This commit is contained in:
Arkadiusz Sygulski
2018-04-27 19:55:15 +02:00
parent 01970b4a2b
commit 9f0ae90dd6
53 changed files with 6174 additions and 6070 deletions

View File

@@ -9,10 +9,10 @@
</template>
<script>
import Input from '../mixin/Input.vue';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'CheckboxGroup'
};
export default {
mixins: [Input],
name: 'CheckboxGroup'
};
</script>

View File

@@ -10,12 +10,12 @@
</template>
<script>
import Input from '../mixin/Input.vue';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputCheckbox'
};
export default {
mixins: [Input],
name: 'InputCheckbox'
};
</script>
<style lang="scss">

View File

@@ -16,7 +16,7 @@
</div>
<div class="col col-2">
<div class="form-input">
<button class="button outline w100" @click.prevent="addElement">{{ $t("static.add") }}</button>
<button class="button outline w100" @click.prevent="addElement">{{ $t('static.add') }}</button>
</div>
</div>
</div>
@@ -28,39 +28,39 @@
</template>
<script>
import Input from '../mixin/Input.vue';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputFlag',
data() {
return {
items: [], // Vue doesn't work well with Sets...
flagValue: this.schema.defaultValue
};
},
methods: {
addElement() {
if (!this.flagValue && this.flagValue !== 0) return;
if (!this.items.includes(this.flagValue)) this.items.push(this.flagValue);
this.flagValue = this.schema.defaultValue;
this.value = this.items.reduce((el, sum) => { return el + sum; });
},
removeElement(index) {
this.items.splice(index, 1);
this.value = this.items.reduce((el, sum) => { return el + sum; });
},
resolveOption(toResolve, options) {
if (!options) return toResolve;
export default {
mixins: [Input],
name: 'InputFlag',
data() {
return {
items: [], // Vue doesn't work well with Sets...
flagValue: this.schema.defaultValue
};
},
methods: {
addElement() {
if (!this.flagValue && this.flagValue !== 0) return;
if (!this.items.includes(this.flagValue)) this.items.push(this.flagValue);
this.flagValue = this.schema.defaultValue;
this.value = this.items.reduce((el, sum) => { return el + sum; });
},
removeElement(index) {
this.items.splice(index, 1);
this.value = this.items.reduce((el, sum) => { return el + sum; });
},
resolveOption(toResolve, options) {
if (!options) return toResolve;
options.forEach(({ value, name }) => {
if (toResolve === value) toResolve = name;
});
options.forEach(({ value, name }) => {
if (toResolve === value) toResolve = name;
});
return toResolve;
}
}
};
return toResolve;
}
}
};
</script>
<style lang="scss">

View File

@@ -27,7 +27,7 @@
</div>
<div class="col col-2">
<div class="form-input">
<button class="button outline w100" @click.prevent="addElement">{{ $t("static.add") }}</button>
<button class="button outline w100" @click.prevent="addElement">{{ $t('static.add') }}</button>
</div>
</div>
</div>
@@ -40,75 +40,75 @@
</template>
<script>
import { each } from 'lodash';
import Input from '../mixin/Input.vue';
import { each } from 'lodash';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputMap',
computed: {
keyErrors() {
if (!this.schema.keyValidator) return [];
return this.validate(this.mapKey, this.schema.keyValidator);
},
keyInvalid() {
return this.keyErrors.length !== 0;
},
valueErrors() {
if (!this.schema.valueValidator) return [];
return this.validate(this.mapValue, this.schema.valueValidator);
},
valueInvalid() {
return this.valueErrors.length !== 0;
}
},
data() {
return {
items: {}, // Vue doesn't work well with Maps...
mapKey: this.schema.defaultKey,
mapValue: this.schema.defaultValue
};
},
methods: {
addElement() {
if (!this.mapValue && this.mapValue !== 0 || !this.mapKey && this.mapKey !== 0) return;
export default {
mixins: [Input],
name: 'InputMap',
computed: {
keyErrors() {
if (!this.schema.keyValidator) return [];
return this.validate(this.mapKey, this.schema.keyValidator);
},
keyInvalid() {
return this.keyErrors.length !== 0;
},
valueErrors() {
if (!this.schema.valueValidator) return [];
return this.validate(this.mapValue, this.schema.valueValidator);
},
valueInvalid() {
return this.valueErrors.length !== 0;
}
},
data() {
return {
items: {}, // Vue doesn't work well with Maps...
mapKey: this.schema.defaultKey,
mapValue: this.schema.defaultValue
};
},
methods: {
addElement() {
if (!this.mapValue && this.mapValue !== 0 || !this.mapKey && this.mapKey !== 0) return;
if (this.hasErrors()) return;
if (this.hasErrors()) return;
this.items[this.mapKey] = this.mapValue;
this.mapValue = this.schema.defaultValue;
this.mapKey = this.schema.defaultKey;
this.$emit('update', this.items, this.schema.field);
},
removeElement(key) {
this.$delete(this.items, key);
this.$emit('update', this.items, this.schema.field);
},
resolveOption(toResolve, options) {
if (!options) return toResolve;
this.items[this.mapKey] = this.mapValue;
this.mapValue = this.schema.defaultValue;
this.mapKey = this.schema.defaultKey;
this.$emit('update', this.items, this.schema.field);
},
removeElement(key) {
this.$delete(this.items, key);
this.$emit('update', this.items, this.schema.field);
},
resolveOption(toResolve, options) {
if (!options) return toResolve;
options.forEach(({ value, name }) => {
if (toResolve === value) toResolve = name;
});
options.forEach(({ value, name }) => {
if (toResolve === value) toResolve = name;
});
return toResolve;
},
hasErrors() {
const invalid = this.keyInvalid || this.valueInvalid;
if (!invalid) return false;
return toResolve;
},
hasErrors() {
const invalid = this.keyInvalid || this.valueInvalid;
if (!invalid) return false;
const fields = [];
if (this.keyInvalid) each(this.$el.getElementsByClassName('map-key'), field => fields.push(field));
if (this.valueInvalid) each(this.$el.getElementsByClassName('map-value'), field => fields.push(field));
const fields = [];
if (this.keyInvalid) each(this.$el.getElementsByClassName('map-key'), field => fields.push(field));
if (this.valueInvalid) each(this.$el.getElementsByClassName('map-value'), field => fields.push(field));
clearTimeout(this.shakeTimeout);
each(fields, field => { field.classList.add('shake'); });
this.shakeTimeout = setTimeout(() => { each(fields, field => { field.classList.remove('shake'); }); }, 500);
clearTimeout(this.shakeTimeout);
each(fields, field => { field.classList.add('shake'); });
this.shakeTimeout = setTimeout(() => { each(fields, field => { field.classList.remove('shake'); }); }, 500);
return true;
}
}
};
return true;
}
}
};
</script>
<style lang="scss">

View File

@@ -12,21 +12,21 @@
</template>
<script>
import Input from '../mixin/Input.vue';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputNumber',
computed: {
errors() {
return this.validate(this.value);
},
valid() {
return this.errors.length === 0;
},
invalid() {
return this.errors.length !== 0;
}
}
};
export default {
mixins: [Input],
name: 'InputNumber',
computed: {
errors() {
return this.validate(this.value);
},
valid() {
return this.errors.length === 0;
},
invalid() {
return this.errors.length !== 0;
}
}
};
</script>

View File

@@ -11,21 +11,21 @@
</template>
<script>
import Input from '../mixin/Input.vue';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputPassword',
computed: {
errors() {
return this.validate(this.value);
},
valid() {
return this.errors.length === 0;
},
invalid() {
return this.errors.length !== 0;
}
}
};
export default {
mixins: [Input],
name: 'InputPassword',
computed: {
errors() {
return this.validate(this.value);
},
valid() {
return this.errors.length === 0;
},
invalid() {
return this.errors.length !== 0;
}
}
};
</script>

View File

@@ -12,10 +12,10 @@
</template>
<script>
import Input from '../mixin/Input.vue';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputSelect'
};
export default {
mixins: [Input],
name: 'InputSelect'
};
</script>

View File

@@ -19,7 +19,7 @@
</div>
<div class="col col-2">
<div class="form-input">
<button class="button outline w100" @click.prevent="addElement">{{ $t("static.add") }}</button>
<button class="button outline w100" @click.prevent="addElement">{{ $t('static.add') }}</button>
</div>
</div>
</div>
@@ -31,61 +31,61 @@
</template>
<script>
import { each } from 'lodash';
import Input from '../mixin/Input.vue';
import { each } from 'lodash';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputSet',
computed: {
errors() {
return this.schema.values ? [] : this.validate(this.setValue);
},
invalid() {
return this.errors.length !== 0;
}
},
data() {
return {
items: [], // Vue doesn't work well with Sets...
setValue: this.schema.defaultValue
};
},
methods: {
addElement() {
if (!this.setValue && this.setValue !== 0) return;
if (this.hasErrors()) return;
if (!this.items.includes(this.setValue)) this.items.push(this.setValue);
this.setValue = this.schema.defaultValue;
this.$emit('update', this.items, this.schema.field);
},
removeElement(index) {
this.items.splice(index, 1);
this.$emit('update', this.items, this.schema.field);
},
resolveOption(toResolve, options) {
if (!options) return toResolve;
export default {
mixins: [Input],
name: 'InputSet',
computed: {
errors() {
return this.schema.values ? [] : this.validate(this.setValue);
},
invalid() {
return this.errors.length !== 0;
}
},
data() {
return {
items: [], // Vue doesn't work well with Sets...
setValue: this.schema.defaultValue
};
},
methods: {
addElement() {
if (!this.setValue && this.setValue !== 0) return;
if (this.hasErrors()) return;
if (!this.items.includes(this.setValue)) this.items.push(this.setValue);
this.setValue = this.schema.defaultValue;
this.$emit('update', this.items, this.schema.field);
},
removeElement(index) {
this.items.splice(index, 1);
this.$emit('update', this.items, this.schema.field);
},
resolveOption(toResolve, options) {
if (!options) return toResolve;
options.forEach(({ value, name }) => {
if (toResolve === value) toResolve = name;
});
options.forEach(({ value, name }) => {
if (toResolve === value) toResolve = name;
});
return toResolve;
},
hasErrors() {
if (!this.invalid) return false;
return toResolve;
},
hasErrors() {
if (!this.invalid) return false;
const fields = [];
each(this.$el.getElementsByClassName('set-value'), field => fields.push(field));
const fields = [];
each(this.$el.getElementsByClassName('set-value'), field => fields.push(field));
clearTimeout(this.shakeTimeout);
each(fields, field => { field.classList.add('shake'); });
this.shakeTimeout = setTimeout(() => { each(fields, field => { field.classList.remove('shake'); }); }, 500);
clearTimeout(this.shakeTimeout);
each(fields, field => { field.classList.add('shake'); });
this.shakeTimeout = setTimeout(() => { each(fields, field => { field.classList.remove('shake'); }); }, 500);
return true;
}
}
};
return true;
}
}
};
</script>
<style lang="scss">

View File

@@ -11,21 +11,21 @@
</template>
<script>
import Input from '../mixin/Input.vue';
import Input from '../mixin/Input.vue';
export default {
mixins: [Input],
name: 'InputText',
computed: {
errors() {
return this.validate(this.value);
},
valid() {
return this.errors.length === 0;
},
invalid() {
return this.errors.length !== 0;
}
}
};
export default {
mixins: [Input],
name: 'InputText',
computed: {
errors() {
return this.validate(this.value);
},
valid() {
return this.errors.length === 0;
},
invalid() {
return this.errors.length !== 0;
}
}
};
</script>