Applied style rules to genocide all \t characters

This commit is contained in:
Stefan Zermatten
2022-10-09 16:01:36 +02:00
parent de598c70a7
commit 2fa913b09a
208 changed files with 6027 additions and 5801 deletions

View File

@@ -22,16 +22,16 @@
<script lang="js">
import FormSections from '/imports/ui/properties/forms/shared/FormSections.vue';
export default {
components: {
FormSections,
},
props: {
name: {
components: {
FormSections,
},
props: {
name: {
type: String,
default: '',
},
standalone: Boolean,
},
standalone: Boolean,
},
}
export { FormSections };
</script>

View File

@@ -8,5 +8,5 @@
</template>
<script lang="js">
export default {}
export default {}
</script>

View File

@@ -22,11 +22,11 @@
<script lang="js">
import getProficiencyIcon from '/imports/ui/utility/getProficiencyIcon.js';
const ICON_SPIN_DURATION = 300;
const ICON_SPIN_DURATION = 300;
export default {
props: {
value: {
export default {
props: {
value: {
type: Number,
default: undefined,
},
@@ -34,56 +34,56 @@
type: Boolean,
default: true,
},
},
data(){ return {
displayedIcon: 'mdi-radiobox-blank',
iconClass: '',
values: [
{value: 1, text: 'Proficient'},
},
data(){ return {
displayedIcon: 'mdi-radiobox-blank',
iconClass: '',
values: [
{value: 1, text: 'Proficient'},
{value: 0.49, text: 'Half proficiency bonus rounded down'},
{value: 0.5, text: 'Half proficiency bonus rounded up'},
{value: 2, text: 'Double proficiency bonus'},
],
}},
watch: {
'value': {
immediate: true,
handler(newValue){
let newIcon = getProficiencyIcon(newValue);
this.iconClass='leaving';
setTimeout(() => {
this.displayedIcon = newIcon;
this.iconClass='arriving';
requestAnimationFrame(() => {
this.iconClass='';
});
}, ICON_SPIN_DURATION / 2);
},
},
}
}
{value: 0.5, text: 'Half proficiency bonus rounded up'},
{value: 2, text: 'Double proficiency bonus'},
],
}},
watch: {
'value': {
immediate: true,
handler(newValue){
let newIcon = getProficiencyIcon(newValue);
this.iconClass='leaving';
setTimeout(() => {
this.displayedIcon = newIcon;
this.iconClass='arriving';
requestAnimationFrame(() => {
this.iconClass='';
});
}, ICON_SPIN_DURATION / 2);
},
},
}
}
</script>
<style lang="css" scoped>
.theme--light .icon {
color: black;
}
.icon {
min-width: 30px;
transition: transform 0.15s linear, opacity 0.15s ease;
transform-origin: 18px center;
margin-left: -12px;
}
.icon.leaving {
transform: translateY(-24px);
opacity: 0;
}
.icon.arriving {
transform: translateY(24px);
opacity: 0;
transition: none;
}
.hidden {
visibility: hidden;
}
.theme--light .icon {
color: black;
}
.icon {
min-width: 30px;
transition: transform 0.15s linear, opacity 0.15s ease;
transform-origin: 18px center;
margin-left: -12px;
}
.icon.leaving {
transform: translateY(-24px);
opacity: 0;
}
.icon.arriving {
transform: translateY(24px);
opacity: 0;
transition: none;
}
.hidden {
visibility: hidden;
}
</style>

View File

@@ -4,9 +4,9 @@
*/
import { get, toPath } from 'lodash';
function resolvePath(model, path, set){
function resolvePath(model, path, set) {
let arrayPath = toPath(path);
if (arrayPath.length === 1){
if (arrayPath.length === 1) {
return { object: model, key: arrayPath[0] };
}
let key = arrayPath.slice(-1);
@@ -15,67 +15,69 @@ function resolvePath(model, path, set){
// Ensure that nested objects exist before navigating them
objectPath.forEach(pathKey => {
let newObject = object[pathKey];
if (!newObject){
if (!newObject) {
newObject = {};
set(object, pathKey, newObject);
}
object = newObject;
});
return {object, key};
return { object, key };
}
const schemaFormMixin = {
data(){ return {
valid: true,
};},
computed: {
errors(){
this.valid = true;
if (!this.model){
throw new Error('this.model must be set');
}
if (!this.validationContext) return {};
let cleanModel = this.validationContext.clean(this.model, {
getAutoValues: false,
});
this.validationContext.validate(cleanModel);
let errors = {};
this.validationContext.validationErrors().forEach(error => {
if (this.valid) this.valid = false;
errors[error.name] = this.schema.messageForError(error);
});
return errors;
},
},
methods: {
data() {
return {
valid: true,
};
},
computed: {
errors() {
this.valid = true;
if (!this.model) {
throw new Error('this.model must be set');
}
if (!this.validationContext) return {};
let cleanModel = this.validationContext.clean(this.model, {
getAutoValues: false,
});
this.validationContext.validate(cleanModel);
let errors = {};
this.validationContext.validationErrors().forEach(error => {
if (this.valid) this.valid = false;
errors[error.name] = this.schema.messageForError(error);
});
return errors;
},
},
methods: {
// Sets the value at the given path
change({path, value, ack}){
let {object, key} = resolvePath(this.model, path, this.$set);
change({ path, value, ack }) {
let { object, key } = resolvePath(this.model, path, this.$set);
this.$set(object, key, value);
if (ack) ack();
},
push({path, value, ack}){
this.$set(object, key, value);
if (ack) ack();
},
push({ path, value, ack }) {
let array = get(this.model, path);
if (array === undefined){
let {object, key} = resolvePath(this.model, path, this.$set);
if (array === undefined) {
let { object, key } = resolvePath(this.model, path, this.$set);
this.$set(object, key, [value]);
} else if (!array.push){
} else if (!array.push) {
throw `${path.join('.')} is ${array}, doesn't have "push"`
} else {
array.push(value);
}
if (ack) ack();
if (ack) ack();
},
pull({path, ack}){
let {object, key} = resolvePath(this.model, path, this.$set);
if (!object || !object.splice){
pull({ path, ack }) {
let { object, key } = resolvePath(this.model, path, this.$set);
if (!object || !object.splice) {
throw `${path.join('.')} is ${object}, doesnt have "splice"`
}
object.splice(key, 1);
if (ack) ack();
},
},
},
};
export default schemaFormMixin;