enrecipes/app/components/modal/PromptDialog.vue

54 lines
1.4 KiB
Vue
Raw Normal View History

2020-10-21 23:24:45 +05:30
<template>
<Page>
<StackLayout class="dialogContainer" :class="appTheme">
<Label class="dialogTitle orkm" :text="`${title}` | L" textWrap='true' />
<StackLayout class="dialogInput">
<TextField @loaded="focusField" :hint="hint ? hint : ''" v-model="category" autocapitalizationType="words" />
2020-10-21 23:24:45 +05:30
</StackLayout>
<GridLayout rows="auto" columns="*, auto, auto" class="actionsContainer">
<MDButton :rippleColor="rippleColor" variant="text" col="1" class="action orkm" :text="'CANCEL' | L" @tap="$modal.close(false)" />
<MDButton :rippleColor="rippleColor" variant="text" col="2" class="action orkm" :text="`${action}` | L" @tap="$modal.close(category)" />
</GridLayout>
</StackLayout>
</Page>
2020-10-21 23:24:45 +05:30
</template>
<script>
import {
Application,
Utils
}
from "@nativescript/core"
import {
localize
}
from '@nativescript/localize'
2020-10-21 23:24:45 +05:30
export default {
props: [ "title", "hint", "text", "action" ],
2020-10-21 23:24:45 +05:30
data() {
return {
category: null,
}
},
computed: {
2020-11-10 23:58:48 +05:30
appTheme() {
return Application.systemAppearance()
},
2020-11-10 23:58:48 +05:30
rippleColor() {
return this.appTheme == "light" ? "rgba(134,142,150,0.2)" : "rgba(206,212,218,0.1)"
2020-11-10 23:58:48 +05:30
},
2020-10-23 00:06:50 +05:30
},
2020-11-02 17:06:53 +05:30
methods: {
focusField( args ) {
2020-11-02 17:06:53 +05:30
args.object.focus()
setTimeout( ( e ) => Utils.ad.showSoftInput( args.object.android ), 1 )
2020-11-02 17:06:53 +05:30
},
},
2020-11-10 23:58:48 +05:30
mounted() {
if ( this.text ) {
this.category = localize( this.text )
2020-11-10 23:58:48 +05:30
}
},
2020-10-21 23:24:45 +05:30
}
</script>