@itfin/components 1.0.35 → 1.0.39
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 +1 -1
- package/src/assets/scss/_variables.scss +1 -1
- package/src/components/button/Button.vue +17 -3
- package/src/components/checkbox/Checkbox.vue +4 -3
- package/src/components/checkbox/Radio.vue +89 -0
- package/src/components/datepicker/DatePicker.vue +5 -0
- package/src/components/datepicker/DateRangePicker.vue +21 -3
- package/src/components/datepicker/DateRangePickerInline.vue +1 -1
- package/src/components/form/Form.vue +2 -1
- package/src/components/modal/Modal.vue +20 -11
- package/src/components/popover/Popover.vue +7 -2
- package/src/components/text-field/TextField.vue +13 -0
- package/src/components/text-field/Textarea.vue +13 -0
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ $input-focus-border: rgb(11 49 79 / 25%);
|
|
|
42
42
|
$form-check-input-border: 1px solid rgba(#000, .08);
|
|
43
43
|
$form-switch-focus-color: tint-color($primary, 50%);
|
|
44
44
|
|
|
45
|
-
$modal-backdrop-bg: #
|
|
45
|
+
$modal-backdrop-bg: #999;
|
|
46
46
|
$modal-backdrop-opacity: .25;
|
|
47
47
|
$modal-content-border-radius: 0;
|
|
48
48
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
|
-
<
|
|
4
|
-
@click="$emit('click', $event)"
|
|
3
|
+
<nuxt-link
|
|
4
|
+
@click.native="$emit('click', $event)"
|
|
5
5
|
:disabled="disabled"
|
|
6
6
|
class="itf-button btn"
|
|
7
7
|
tabindex="0"
|
|
8
8
|
type="button"
|
|
9
|
+
:tag="isLink ? 'a' : 'button'"
|
|
10
|
+
:href="href"
|
|
11
|
+
:to="to || {}"
|
|
12
|
+
:target="target"
|
|
9
13
|
:class="{
|
|
10
14
|
[`btn-${color}`]: color,
|
|
11
15
|
'itf-button__block': block,
|
|
@@ -25,7 +29,7 @@
|
|
|
25
29
|
<div class="itf-spinner" :class="{'itf-spinner__white': primary}" v-if="loading"></div>
|
|
26
30
|
<div v-if="loading && loadingText">{{loadingText}}</div>
|
|
27
31
|
<slot v-else></slot>
|
|
28
|
-
</
|
|
32
|
+
</nuxt-link>
|
|
29
33
|
|
|
30
34
|
</template>
|
|
31
35
|
<style lang="scss">
|
|
@@ -36,6 +40,9 @@
|
|
|
36
40
|
display: inline-flex;
|
|
37
41
|
align-items: center;
|
|
38
42
|
|
|
43
|
+
&.btn-primary {
|
|
44
|
+
color: #fff; // @todo remove when remove vuetify
|
|
45
|
+
}
|
|
39
46
|
&.itf-button__block {
|
|
40
47
|
display: block;
|
|
41
48
|
width: 100%;
|
|
@@ -150,5 +157,12 @@ class itfButton extends Vue {
|
|
|
150
157
|
@Prop(String) loadingText;
|
|
151
158
|
@Prop(String) color;
|
|
152
159
|
@Prop(Boolean) disabled;
|
|
160
|
+
@Prop({ type: [String, Object] }) to;
|
|
161
|
+
@Prop(String) href;
|
|
162
|
+
@Prop(String) target;
|
|
163
|
+
|
|
164
|
+
get isLink() {
|
|
165
|
+
return this.to || this.href;
|
|
166
|
+
}
|
|
153
167
|
}
|
|
154
168
|
</script>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<div class="itf-checkbox form-check" :class="{ 'form-switch': this.switch, 'itf-checkbox__large': large, 'itf-checkbox__medium': medium }">
|
|
4
|
-
<input class="form-check-input" :id="id"
|
|
4
|
+
<input class="form-check-input" :id="id" type="checkbox" name="checkbox" v-model="isChecked" :disabled="isDisabled" />
|
|
5
5
|
<label :for="id" slot="label" class="form-check-label">
|
|
6
6
|
{{label}}
|
|
7
|
+
<slot name="icon"></slot>
|
|
7
8
|
</label>
|
|
8
9
|
</div>
|
|
9
10
|
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
.form-check-input, .form-check-label {
|
|
16
17
|
cursor: pointer;
|
|
17
18
|
}
|
|
18
|
-
&__large {
|
|
19
|
+
&__large.form-check {
|
|
19
20
|
padding-left: $form-check-padding-start * 2;
|
|
20
21
|
min-height: 2.5rem;
|
|
21
22
|
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
&__medium {
|
|
43
|
+
&__medium.form-check {
|
|
43
44
|
padding-left: $form-check-padding-start * 1.5;
|
|
44
45
|
min-height: 2rem;
|
|
45
46
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<div class="itf-radio form-check" :class="{ 'itf-radio__large': large, 'itf-radio__medium': medium }">
|
|
4
|
+
<input class="form-check-input" :id="id" type="radio" :name="name" v-model="isChecked" :disabled="disabled" />
|
|
5
|
+
<label :for="id" slot="label" class="form-check-label">
|
|
6
|
+
{{label}}
|
|
7
|
+
<slot name="icon"></slot>
|
|
8
|
+
</label>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
</template>
|
|
12
|
+
<style lang="scss">
|
|
13
|
+
@import '../../assets/scss/variables';
|
|
14
|
+
|
|
15
|
+
.itf-radio {
|
|
16
|
+
.form-check-input, .form-check-label {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
&__large.form-check {
|
|
20
|
+
padding-left: $form-check-padding-start * 2;
|
|
21
|
+
min-height: 2.5rem;
|
|
22
|
+
|
|
23
|
+
.form-check-label {
|
|
24
|
+
padding-top: 0.25rem;
|
|
25
|
+
}
|
|
26
|
+
.form-check-input {
|
|
27
|
+
margin-top: 0;
|
|
28
|
+
width: $form-check-input-width * 2;
|
|
29
|
+
height: $form-check-input-width * 2;
|
|
30
|
+
margin-left: -$form-check-padding-start * 2;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
&__medium.form-check {
|
|
34
|
+
padding-left: $form-check-padding-start * 1.5;
|
|
35
|
+
min-height: 2rem;
|
|
36
|
+
|
|
37
|
+
.form-check-input {
|
|
38
|
+
margin-top: 0;
|
|
39
|
+
width: $form-check-input-width * 1.5;
|
|
40
|
+
height: $form-check-input-width * 1.5;
|
|
41
|
+
margin-left: -$form-check-padding-start * 1.5;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
46
|
+
<script>
|
|
47
|
+
import { Vue, Component, Prop, Model, Inject } from 'vue-property-decorator';
|
|
48
|
+
|
|
49
|
+
let globalRadioId = 0;
|
|
50
|
+
|
|
51
|
+
export default @Component({
|
|
52
|
+
name: 'itfCheckbox',
|
|
53
|
+
components: {
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
class itfCheckbox extends Vue {
|
|
57
|
+
@Inject({ default: null }) checkboxGroup;
|
|
58
|
+
|
|
59
|
+
@Model('input') checked;
|
|
60
|
+
@Prop(String) label;
|
|
61
|
+
@Prop() value;
|
|
62
|
+
@Prop({ type: String, required: true }) name;
|
|
63
|
+
|
|
64
|
+
@Prop(Boolean) disabled;
|
|
65
|
+
@Prop(Boolean) medium;
|
|
66
|
+
@Prop(Boolean) large;
|
|
67
|
+
|
|
68
|
+
id = '';
|
|
69
|
+
|
|
70
|
+
created() {
|
|
71
|
+
globalRadioId += 1;
|
|
72
|
+
this.id = `radio${globalRadioId}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
set isChecked(val) {
|
|
76
|
+
this.$emit('input', this.value);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get isChecked() {
|
|
80
|
+
if (this.itemKey) {
|
|
81
|
+
if (!this.checked || !this.value) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return this.checked[this.itemKey] === this.value[this.itemKey];
|
|
85
|
+
}
|
|
86
|
+
return this.checked === this.value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="itf-daterange-picker" :class="{'with-addon addon-start': prependIcon}">
|
|
2
|
+
<div class="itf-daterange-picker" :class="{ 'with-addon addon-start': prependIcon, 'with-addon addon-end': clearable }">
|
|
3
3
|
<div class="addon" v-if="prependIcon">
|
|
4
4
|
<slot name="addon">
|
|
5
5
|
<itf-icon :name="prependIcon" />
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
:parse="parse"
|
|
41
41
|
:unmask="false"
|
|
42
42
|
:lazy="!focused"
|
|
43
|
-
:placeholder="placeholder"
|
|
44
43
|
/>
|
|
45
44
|
</div>
|
|
46
45
|
<div style="display: none">
|
|
@@ -55,6 +54,18 @@
|
|
|
55
54
|
></itf-date-range-picker-inline>
|
|
56
55
|
</div>
|
|
57
56
|
</div>
|
|
57
|
+
|
|
58
|
+
<div class="addon-end" v-if="clearable && value && value[0]">
|
|
59
|
+
<slot name="clear">
|
|
60
|
+
<itf-button
|
|
61
|
+
icon
|
|
62
|
+
small
|
|
63
|
+
@click="$emit('input', '')"
|
|
64
|
+
>
|
|
65
|
+
<itf-icon name="close" />
|
|
66
|
+
</itf-button>
|
|
67
|
+
</slot>
|
|
68
|
+
</div>
|
|
58
69
|
</div>
|
|
59
70
|
</template>
|
|
60
71
|
<style lang="scss">
|
|
@@ -66,6 +77,10 @@
|
|
|
66
77
|
visibility: hidden;
|
|
67
78
|
}
|
|
68
79
|
|
|
80
|
+
.addon-end {
|
|
81
|
+
pointer-events: all;
|
|
82
|
+
padding-right: 0.25rem;
|
|
83
|
+
}
|
|
69
84
|
&__dropdown {
|
|
70
85
|
width: max-content;
|
|
71
86
|
overflow: hidden;
|
|
@@ -116,6 +131,7 @@ import { IMask, IMaskComponent } from 'vue-imask';
|
|
|
116
131
|
import { DateTime } from 'luxon';
|
|
117
132
|
import tippy from 'tippy.js';
|
|
118
133
|
import itfIcon from '../icon/Icon';
|
|
134
|
+
import itfButton from '../button/Button';
|
|
119
135
|
import itfDateRangePickerInline from './DateRangePickerInline.vue';
|
|
120
136
|
import ITFSettings from '../../ITFSettings';
|
|
121
137
|
|
|
@@ -123,6 +139,7 @@ export default @Component({
|
|
|
123
139
|
name: 'itfDateRangePicker',
|
|
124
140
|
components: {
|
|
125
141
|
itfIcon,
|
|
142
|
+
itfButton,
|
|
126
143
|
itfDateRangePickerInline,
|
|
127
144
|
IMaskComponent,
|
|
128
145
|
},
|
|
@@ -136,6 +153,7 @@ class itfDateRangePicker extends Vue {
|
|
|
136
153
|
@Prop({ type: String, default: ITFSettings.defaultDisplayDateFormat }) displayFormat;
|
|
137
154
|
@Prop({ type: String, default: 'days', validator: (value) => ['days', 'months', 'years'].includes(value) }) startView;
|
|
138
155
|
@Prop({ type: Boolean, default: false }) onlyCalendar;
|
|
156
|
+
@Prop({ type: Boolean, default: false }) clearable;
|
|
139
157
|
@Prop({ type: String, default: '' }) placeholder;
|
|
140
158
|
@Prop({ type: String, default: '' }) prependIcon;
|
|
141
159
|
|
|
@@ -187,7 +205,7 @@ class itfDateRangePicker extends Vue {
|
|
|
187
205
|
}
|
|
188
206
|
|
|
189
207
|
get valueAsLuxon() {
|
|
190
|
-
if (!this.value || this.value.length < 2) {
|
|
208
|
+
if (!this.value || this.value.length < 2 || !this.value[0] || !this.value[1]) {
|
|
191
209
|
return null;
|
|
192
210
|
}
|
|
193
211
|
if (this.valueFormat === 'ISO') {
|
|
@@ -147,7 +147,7 @@ class itfDatePickerInline extends Vue {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
get valueAsLuxon() {
|
|
150
|
-
if (!this.value || this.value.length < 2) {
|
|
150
|
+
if (!this.value || this.value.length < 2 || !this.value[0] || !this.value[1]) {
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
153
|
if (this.valueFormat === 'ISO') {
|
|
@@ -90,7 +90,8 @@ class itfForm extends Vue {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
doValidation(showError = true) {
|
|
93
|
-
|
|
93
|
+
// @todo remove validate when migrate from vuetify
|
|
94
|
+
const isValid = !this.components.filter(component => (component.doValidation && !component.doValidation(true)) || (component.validate && !component.validate(true))).length;
|
|
94
95
|
if (showError && !isValid && this.$showError) {
|
|
95
96
|
this.$showError('Please fix the errors below to proceed.', { duration: 3000 });
|
|
96
97
|
}
|
|
@@ -13,10 +13,8 @@
|
|
|
13
13
|
<div class="modal-body">
|
|
14
14
|
<slot></slot>
|
|
15
15
|
</div>
|
|
16
|
-
<div class="modal-footer">
|
|
17
|
-
<slot name="footer">
|
|
18
|
-
<itf-button primary data-bs-dismiss="modal">Close</itf-button>
|
|
19
|
-
</slot>
|
|
16
|
+
<div class="modal-footer" v-if="$slots.footer">
|
|
17
|
+
<slot name="footer"></slot>
|
|
20
18
|
</div>
|
|
21
19
|
</div>
|
|
22
20
|
</div>
|
|
@@ -36,9 +34,9 @@
|
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
.modal-open .itf-app {
|
|
39
|
-
-webkit-filter: blur(5px);
|
|
40
|
-
-moz-filter: blur(5px);
|
|
41
|
-
filter: blur(5px);
|
|
37
|
+
-webkit-filter: blur(5px) grayscale(1);
|
|
38
|
+
-moz-filter: blur(5px) grayscale(1);
|
|
39
|
+
filter: blur(5px) grayscale(1);
|
|
42
40
|
}
|
|
43
41
|
</style>
|
|
44
42
|
<script>
|
|
@@ -98,14 +96,18 @@ class itfModal extends Vue {
|
|
|
98
96
|
modalStack[modalStack.length - 1].unbindEvents();
|
|
99
97
|
modalStack[modalStack.length - 1].hide(true);
|
|
100
98
|
}
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
this.modalEl.show();
|
|
101
|
+
modalStack.push(this);
|
|
102
|
+
}, 500);
|
|
103
103
|
} else {
|
|
104
104
|
this.modalEl.hide();
|
|
105
105
|
modalStack.pop();
|
|
106
106
|
if (modalStack.length > 0) {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
modalStack[modalStack.length - 1].show();
|
|
109
|
+
modalStack[modalStack.length - 1].bindEvents();
|
|
110
|
+
}, 500);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
}
|
|
@@ -158,5 +160,12 @@ class itfModal extends Vue {
|
|
|
158
160
|
this.value = false;
|
|
159
161
|
}
|
|
160
162
|
}
|
|
163
|
+
|
|
164
|
+
scrollModalTop() {
|
|
165
|
+
const scrollEl = this.$el.closest('.itf-modal');
|
|
166
|
+
if (scrollEl) {
|
|
167
|
+
scrollEl.scrollTop = 0;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
161
170
|
}
|
|
162
171
|
</script>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
</style>
|
|
49
49
|
<script>
|
|
50
|
-
import { Vue, Component, Prop, Watch, PropSync } from 'vue-property-decorator';
|
|
50
|
+
import { Vue, Component, Prop, Watch, PropSync, Inject } from 'vue-property-decorator';
|
|
51
51
|
|
|
52
52
|
let globalModalIndex = 0; // base modal z-index
|
|
53
53
|
|
|
@@ -57,6 +57,8 @@ export default @Component({
|
|
|
57
57
|
},
|
|
58
58
|
})
|
|
59
59
|
class itfPopover extends Vue {
|
|
60
|
+
@Inject({ default: null }) appendContext;
|
|
61
|
+
|
|
60
62
|
@PropSync('visible') value;
|
|
61
63
|
@Prop({ type: String, default: 'bottom', validator: (value) => ['bottom', 'left', 'right', 'top'].includes(value) }) placement;
|
|
62
64
|
@Prop({ type: String, default: 'click', validator: (value) => ['click', 'focus', 'hover', 'manual'].includes(value) }) trigger;
|
|
@@ -92,8 +94,11 @@ class itfPopover extends Vue {
|
|
|
92
94
|
}
|
|
93
95
|
const el = this.$refs.popover;
|
|
94
96
|
const { default: Popover } = await import('bootstrap/js/src/popover.js');
|
|
97
|
+
|
|
98
|
+
const elContext = (this.appendContext && this.appendContext()) || document.body;
|
|
95
99
|
this.modalEl = new Popover(this.$el, {
|
|
96
|
-
content: el,
|
|
100
|
+
content: el,
|
|
101
|
+
container: elContext,
|
|
97
102
|
sanitize: false,
|
|
98
103
|
html: true,
|
|
99
104
|
customClass: this.customClass,
|
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<input
|
|
11
|
+
ref="input"
|
|
11
12
|
autocomplete="off"
|
|
12
13
|
:placeholder="placeholder"
|
|
13
14
|
:class="{ 'is-invalid': isInvalid(), 'is-valid': isSuccess() }"
|
|
14
15
|
class="itf-text-field__input form-control"
|
|
15
16
|
type="text"
|
|
16
17
|
:value="value"
|
|
18
|
+
:disabled="disabled"
|
|
19
|
+
:readonly="readonly"
|
|
17
20
|
@input="onInput($event.target.value)"
|
|
18
21
|
/>
|
|
19
22
|
|
|
@@ -65,6 +68,8 @@ class itfTextField extends Vue {
|
|
|
65
68
|
@Prop(String) prependIcon;
|
|
66
69
|
@Prop(String) placeholder;
|
|
67
70
|
@Prop(Boolean) clearable;
|
|
71
|
+
@Prop(Boolean) disabled;
|
|
72
|
+
@Prop(Boolean) readonly;
|
|
68
73
|
@Prop({ type: [Number, String], default: 0 }) delayInput;
|
|
69
74
|
|
|
70
75
|
onInput = null;
|
|
@@ -80,5 +85,13 @@ class itfTextField extends Vue {
|
|
|
80
85
|
isSuccess() {
|
|
81
86
|
return this.itemLabel && this.itemLabel.isHasSuccess();
|
|
82
87
|
}
|
|
88
|
+
|
|
89
|
+
insertTextToCurrentPosition(text) {
|
|
90
|
+
const position = this.$refs.input.selectionStart;
|
|
91
|
+
const value = this.value || '';
|
|
92
|
+
const startText = value.slice(0, position);
|
|
93
|
+
const endText = value.slice(position);
|
|
94
|
+
this.$emit('input', `${startText}${text}${endText}`);
|
|
95
|
+
}
|
|
83
96
|
}
|
|
84
97
|
</script>
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
</div>
|
|
9
9
|
<div v-if="autogrow" class="itf-textarea__autogrow-text form-control">{{value}} </div>
|
|
10
10
|
<textarea
|
|
11
|
+
ref="input"
|
|
11
12
|
:rows="rows"
|
|
13
|
+
:readonly="readonly"
|
|
14
|
+
:disabled="disabled"
|
|
12
15
|
:placeholder="placeholder"
|
|
13
16
|
:class="{ 'is-invalid': isInvalid(), 'is-valid': isSuccess() }"
|
|
14
17
|
class="itf-textarea__input form-control"
|
|
@@ -65,6 +68,8 @@ class itfTextarea extends Vue {
|
|
|
65
68
|
@Prop(String) prependIcon;
|
|
66
69
|
@Prop(String) placeholder;
|
|
67
70
|
@Prop(Boolean) autogrow;
|
|
71
|
+
@Prop(Boolean) disabled;
|
|
72
|
+
@Prop(Boolean) readonly;
|
|
68
73
|
@Prop({ type: [Number, String], default: 0 }) delayInput;
|
|
69
74
|
@Prop({ type: [Number, String] }) rows;
|
|
70
75
|
|
|
@@ -81,5 +86,13 @@ class itfTextarea extends Vue {
|
|
|
81
86
|
isSuccess() {
|
|
82
87
|
return this.itemLabel && this.itemLabel.isHasSuccess();
|
|
83
88
|
}
|
|
89
|
+
|
|
90
|
+
insertTextToCurrentPosition(text) {
|
|
91
|
+
const position = this.$refs.input.selectionStart;
|
|
92
|
+
const value = this.value || '';
|
|
93
|
+
const startText = value.slice(0, position);
|
|
94
|
+
const endText = value.slice(position);
|
|
95
|
+
this.$emit('input', `${startText}${text}${endText}`);
|
|
96
|
+
}
|
|
84
97
|
}
|
|
85
98
|
</script>
|