fixi foxi
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<button v-if="!confirming" :disabled="disabled" type="button" @click="onClick" class="ui-dropdown-button" :class="{ 'has-icon': icon, 'is-active': selected, 'is-multiline': multiline }">
|
||||
<button v-if="!confirming" :disabled="disabled" type="button" @click.stop="onClick" class="ui-dropdown-button" :class="{ 'has-icon': icon, 'is-active': selected, 'is-multiline': multiline }">
|
||||
<ui-icon v-if="icon" :symbol="icon" class="ui-dropdown-button-icon" />
|
||||
<span><ui-localize :value="label" /><span v-if="false && confirm && !confirming"> …</span><span v-if="false && confirming">?</span></span>
|
||||
<ui-icon v-if="selected" symbol="fth-check" class="ui-dropdown-button-selected" />
|
||||
<span><ui-localize :value="label" /><span v-if="confirm && !confirming"> …</span></span>
|
||||
<ui-icon v-if="selected" symbol="fth-check" class="ui-dropdown-button-selected" />
|
||||
<i v-if="loading" class="ui-dropdown-button-progress"></i>
|
||||
</button>
|
||||
<div v-if="confirming" class="ui-dropdown-button-confirmation">
|
||||
<div v-if="confirming" class="ui-dropdown-button ui-dropdown-button-confirmation">
|
||||
<ui-icon v-if="icon" :symbol="icon" class="ui-dropdown-button-icon" />
|
||||
<ui-localize :value="label" />
|
||||
<ui-button type="small light" icon="fth-x" title="Cancel" @click="confirming=false" />
|
||||
<ui-button :type="negative ? 'small danger' : 'small primary'" icon="fth-check" title="OK" @click="onClick($event, true)" />
|
||||
<span><ui-localize :value="label" /><span>?</span></span>
|
||||
<ui-button type="small light" icon="fth-x" title="@ui.cancel" @click="confirming=false" />
|
||||
<ui-button :type="negative ? 'small danger' : 'small primary'" icon="fth-check" title="@ui.ok" @click="onClick($event, true)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ export interface ZeroCompiledEditorField
|
||||
options: any | null;
|
||||
component: Component;
|
||||
|
||||
optional: (model: any) => boolean;
|
||||
readonly: (model: any) => boolean;
|
||||
hidden: (model: any) => boolean;
|
||||
optional: (model: any, parent: any) => boolean;
|
||||
readonly: (model: any, parent: any) => boolean;
|
||||
hidden: (model: any, parent: any) => boolean;
|
||||
label: string;
|
||||
hideLabel: boolean;
|
||||
description: string | null;
|
||||
@@ -90,7 +90,7 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi
|
||||
path: field.path,
|
||||
component,
|
||||
|
||||
optional(model: any)
|
||||
optional(model: any, parent: any)
|
||||
{
|
||||
if (typeof field.configuration.optional === 'boolean')
|
||||
{
|
||||
@@ -98,12 +98,12 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi
|
||||
}
|
||||
if (typeof field.configuration.optional === 'function')
|
||||
{
|
||||
return field.configuration.optional(model);
|
||||
return field.configuration.optional(model, parent);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
readonly(model: any)
|
||||
readonly(model: any, parent: any)
|
||||
{
|
||||
if (typeof field.configuration.readonly === 'boolean')
|
||||
{
|
||||
@@ -111,12 +111,12 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi
|
||||
}
|
||||
if (typeof field.configuration.readonly === 'function')
|
||||
{
|
||||
return field.configuration.readonly(model);
|
||||
return field.configuration.readonly(model, parent);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
hidden(model: any)
|
||||
hidden(model: any, parent: any)
|
||||
{
|
||||
if (typeof field.configuration.hidden === 'boolean')
|
||||
{
|
||||
@@ -124,7 +124,7 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi
|
||||
}
|
||||
if (typeof field.configuration.hidden === 'function')
|
||||
{
|
||||
return field.configuration.hidden(model);
|
||||
return field.configuration.hidden(model, parent);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -41,4 +41,15 @@ export function toCurrency(value: number, decimals: number = 2, hideSymbol: bool
|
||||
|
||||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, noEncode ? " " : " ") + (hideSymbol === true ? "" : (noEncode ? " €" : " €"));
|
||||
// TODO we have dynamic currencies, not fixed to €
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Rounds a number up
|
||||
* @returns {number} Number
|
||||
*/
|
||||
export function roundUp(value: number, decimals: number = 2)
|
||||
{
|
||||
decimals = Math.pow(10, decimals);
|
||||
return Math.ceil(value * decimals) / decimals;
|
||||
}
|
||||
@@ -33,6 +33,7 @@
|
||||
"back": "Zurück",
|
||||
"close": "Schließen",
|
||||
"cancel": "Abbrechen",
|
||||
"ok": "OK",
|
||||
"confirm": "Bestätigen",
|
||||
"save": "Speichern",
|
||||
"create": "Erstellen",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"back": "Go back",
|
||||
"close": "Close",
|
||||
"cancel": "Cancel",
|
||||
"ok": "OK",
|
||||
"confirm": "Confirm",
|
||||
"save": "Save",
|
||||
"create": "Create",
|
||||
|
||||
Reference in New Issue
Block a user