@itfin/components 1.2.100 → 1.2.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<itf-text-field
|
|
4
|
+
ref="input"
|
|
5
|
+
v-bind="$props"
|
|
6
|
+
@input="onValueChange"
|
|
7
|
+
/>
|
|
8
|
+
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
import { Vue, Component, Model, Inject, Prop } from 'vue-property-decorator';
|
|
12
|
+
import itfTextField from './TextField.vue';
|
|
13
|
+
import {parseHours} from "@/helpers/formatters";
|
|
14
|
+
|
|
15
|
+
export default @Component({
|
|
16
|
+
name: 'itfHoursField',
|
|
17
|
+
components: {
|
|
18
|
+
itfTextField
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
class itfHoursField extends Vue {
|
|
22
|
+
@Inject({ default: null }) itemLabel;
|
|
23
|
+
@Model('input') value;
|
|
24
|
+
@Prop() hours;
|
|
25
|
+
@Prop(String) prependIcon;
|
|
26
|
+
@Prop(String) placeholder;
|
|
27
|
+
@Prop() step;
|
|
28
|
+
@Prop() min;
|
|
29
|
+
@Prop() max;
|
|
30
|
+
@Prop(Boolean) clearable;
|
|
31
|
+
@Prop(Boolean) disabled;
|
|
32
|
+
@Prop(Boolean) readonly;
|
|
33
|
+
@Prop({ type: String, default: 'text' }) type;
|
|
34
|
+
@Prop({ type: [Number, String], default: 0 }) delayInput;
|
|
35
|
+
|
|
36
|
+
onValueChange(text) {
|
|
37
|
+
const hours = parseHours(text);
|
|
38
|
+
this.$emit('update:hours', hours);
|
|
39
|
+
this.$emit('input', text);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
focus() {
|
|
43
|
+
this.$refs.input.focus();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
blur() {
|
|
47
|
+
this.$refs.input.blur();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { storiesOf } from '@storybook/vue';
|
|
2
2
|
import itfMoneyField from './MoneyField.vue';
|
|
3
|
+
import itfHoursField from './HoursField.vue';
|
|
3
4
|
import itfForm from '../form/Form.vue';
|
|
4
5
|
import itfButton from '../button/Button.vue';
|
|
5
6
|
import itfIcon from '../icon/Icon.vue';
|
|
@@ -14,7 +15,8 @@ storiesOf('Common', module)
|
|
|
14
15
|
itfForm,
|
|
15
16
|
itfButton,
|
|
16
17
|
itfLabel,
|
|
17
|
-
itfMoneyField
|
|
18
|
+
itfMoneyField,
|
|
19
|
+
itfHoursField
|
|
18
20
|
},
|
|
19
21
|
data() {
|
|
20
22
|
return {
|
|
@@ -25,6 +27,8 @@ storiesOf('Common', module)
|
|
|
25
27
|
{ Id: 4, Symbol: 'ERO', Code: 'EUR', Title: 'Euroooo' },
|
|
26
28
|
{ Id: 3, Symbol: ".د.ب", Code: 'AED', Title: 'Emirati Dirham' },
|
|
27
29
|
],
|
|
30
|
+
hoursStr: '10h 10m',
|
|
31
|
+
hours: 0,
|
|
28
32
|
currency: null
|
|
29
33
|
}
|
|
30
34
|
},
|
|
@@ -43,11 +47,12 @@ storiesOf('Common', module)
|
|
|
43
47
|
|
|
44
48
|
<itf-app ref="app">
|
|
45
49
|
|
|
46
|
-
{{
|
|
47
|
-
{{currency}}
|
|
50
|
+
{{hours}}
|
|
48
51
|
|
|
49
52
|
<itf-money-field v-model="value" :currencies="currencies" :currency.sync="currency" />
|
|
50
53
|
|
|
54
|
+
<itf-hours-field v-model="hoursStr" :hours.sync="hours" />
|
|
55
|
+
|
|
51
56
|
</itf-app>
|
|
52
57
|
</div>`,
|
|
53
58
|
}));
|