Skip to content

Commit c7862f8

Browse files
authored
Merge branch 'development' into feature/v-snack-bar-v-model
2 parents 96ac9b7 + ca0061b commit c7862f8

12 files changed

+61
-154
lines changed

src/components/AddButton.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:color="buttonColor"
55
:width="buttonSize"
66
:height="buttonSize"
7-
@click="onClick"
7+
@click="$emit('clickAddButton')"
88
>
99
<v-icon :size="iconSize" :color="iconColor">{{ iconName }}</v-icon>
1010
</v-btn>
@@ -41,11 +41,6 @@ export default Vue.extend({
4141
required: false,
4242
default: '40'
4343
}
44-
},
45-
methods: {
46-
onClick(): void {
47-
this.$emit('addButtonClicked')
48-
}
4944
}
5045
})
5146
</script>

src/components/BottomSheetLayer.vue

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<template>
22
<v-bottom-sheet
3-
v-model="layer"
3+
:value="value"
44
persistent
55
scrollable
66
no-click-animation
77
:fullscreen="fullscreen"
8+
@input="$emit('input', $event)"
89
>
910
<v-card class="Layer">
1011
<v-card-title class="Layer-CardElements Layer-CardTitle">
@@ -32,13 +33,9 @@
3233
<script lang="ts">
3334
import Vue from 'vue'
3435
35-
type DataType = {
36-
layer: boolean
37-
}
38-
3936
export default Vue.extend({
4037
props: {
41-
expanded: {
38+
value: {
4239
type: Boolean,
4340
required: false,
4441
default: true
@@ -56,16 +53,6 @@ export default Vue.extend({
5653
required: false,
5754
default: false
5855
}
59-
},
60-
data(): DataType {
61-
return {
62-
layer: this.expanded
63-
}
64-
},
65-
watch: {
66-
expanded(newValue) {
67-
this.layer = newValue
68-
}
6956
}
7057
})
7158
</script>

src/components/CalendarBar.vue

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export type CalendarBarConfig = {
6565
export interface DateListWindow {
6666
list: Array<Date>
6767
currentDate: Date
68+
inputHandler: (value: Date) => Date
6869
selectDate(date: Date): DateListWindow
6970
nextDay(): DateListWindow
7071
prevDay(): DateListWindow
@@ -79,11 +80,13 @@ class DateListWindowImpl implements DateListWindow {
7980
startWeekOn: StartWeekOn
8081
currentDate: Date
8182
list: Array<Date>
83+
inputHandler: (value: Date) => Date
8284
8385
constructor(
8486
view: View = 'Week',
8587
startWeekOn: StartWeekOn = 'Monday',
86-
date: Date = new Date()
88+
date: Date = new Date(),
89+
inputHandler: (value: Date) => Date
8790
) {
8891
this.view = view
8992
this.startWeekOn = view === 'Weekday' ? 'Monday' : startWeekOn
@@ -96,6 +99,7 @@ class DateListWindowImpl implements DateListWindow {
9699
this.startWeekOn,
97100
this.currentDate
98101
)
102+
this.inputHandler = inputHandler
99103
}
100104
101105
nextDay(): DateListWindow {
@@ -128,6 +132,9 @@ class DateListWindowImpl implements DateListWindow {
128132
isValid(date) ? date : new Date()
129133
)
130134
this.list = this.generateDateList()
135+
136+
// CalendarBar を経由して変更を通知
137+
this.inputHandler(this.currentDate)
131138
return this
132139
}
133140
@@ -211,28 +218,18 @@ export default class CalendarBar extends Vue {
211218
dateListWindow: DateListWindow = new DateListWindowImpl(
212219
this.config?.view ?? 'Week',
213220
this.config?.startWeekOn ?? 'Monday',
214-
this.date ?? new Date()
221+
this.value ?? new Date(),
222+
this.input
215223
)
216224
217-
@Emit('changeCurrentDate')
218-
changeCurrentDate(): Date {
219-
return this.dateListWindow.currentDate
220-
}
221-
222-
private get date(): Date {
223-
return this.value
224-
}
225-
226225
@Emit()
227226
public input(value: Date) {
228227
return value
229228
}
230229
231-
@Watch('dateListWindow.currentDate', { immediate: true })
232-
// @Watch('dateListWindow.currentDate')
233-
onChangeCurrentDate() {
234-
this.input(this.dateListWindow.currentDate)
235-
this.changeCurrentDate()
230+
@Watch('value', { immediate: true })
231+
onValueChanged(newValue: Date) {
232+
this.dateListWindow.selectDate(newValue)
236233
}
237234
238235
get currentMonthString(): string {

src/components/EditingScreen.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<v-bottom-sheet v-model="screen" no-click-animation persistent scrollable>
2+
<v-bottom-sheet :value="expanded" no-click-animation persistent scrollable>
33
<v-card class="EditingScreen">
44
<v-card-title class="EditingScreen-CardElements">
55
<v-container class="EditingScreen-Container">
@@ -100,7 +100,6 @@ type FourthPageDataType = {
100100
}
101101
102102
type DataType = {
103-
screen: boolean
104103
page: number
105104
error: boolean
106105
lessonId: string
@@ -158,7 +157,6 @@ export default Vue.extend({
158157
},
159158
data(): DataType {
160159
return {
161-
screen: this.expanded,
162160
page: 1,
163161
error: false,
164162
isHidden: this.value.isHidden,
@@ -199,9 +197,6 @@ export default Vue.extend({
199197
}
200198
},
201199
watch: {
202-
expanded(newValue) {
203-
this.screen = newValue
204-
},
205200
value(value) {
206201
this.isHidden = value.isHidden
207202
this.lessonId = value.lessonId

src/components/EditorField.vue

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
<span v-if="title" class="EditorField-Title">{{ title }}</span>
44
<div class="EditorField-Form">
55
<editor-input-field
6-
v-model="modelValue"
6+
:value="value"
77
:label="label"
88
:placeholder="placeholder"
99
:transparent="transparent"
1010
:readonly="readonly"
11+
@input="$emit('input', $event)"
1112
/>
1213
<content-card-editor-button
1314
v-if="iconName"
@@ -24,10 +25,6 @@ import Vue from 'vue'
2425
import EditorInputField from '@/components/EditorInputField.vue'
2526
import ContentCardEditorButton from '@/components/ContentCardEditorButton.vue'
2627
27-
type DataType = {
28-
modelValue: string
29-
}
30-
3128
export default Vue.extend({
3229
components: { EditorInputField, ContentCardEditorButton },
3330
props: {
@@ -66,19 +63,6 @@ export default Vue.extend({
6663
required: false,
6764
default: ''
6865
}
69-
},
70-
data(): DataType {
71-
return {
72-
modelValue: this.value
73-
}
74-
},
75-
watch: {
76-
modelValue(value) {
77-
this.$emit('input', value)
78-
},
79-
value(value) {
80-
this.modelValue = value
81-
}
8266
}
8367
})
8468
</script>

src/components/EditorInputField.vue

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<v-text-field
3-
v-model="modelValue"
3+
:value="value"
44
:color="transparent ? 'white' : '#424242'"
55
type="text"
66
:hint="hint"
@@ -11,14 +11,13 @@
1111
class="elevation-0"
1212
solo
1313
flat
14+
@input="$emit('input', $event)"
1415
/>
1516
</template>
1617

1718
<script lang="ts">
1819
import Vue from 'vue'
19-
type DataType = {
20-
modelValue: string
21-
}
20+
2221
export default Vue.extend({
2322
name: 'InputField',
2423
props: {
@@ -62,19 +61,6 @@ export default Vue.extend({
6261
required: true,
6362
default: ''
6463
}
65-
},
66-
data(): DataType {
67-
return {
68-
modelValue: this.value
69-
}
70-
},
71-
watch: {
72-
modelValue(value) {
73-
this.$emit('input', value)
74-
},
75-
value(value) {
76-
this.modelValue = value
77-
}
7864
}
7965
})
8066
</script>

src/components/EditorTextarea.vue

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,22 @@
22
<div>
33
<span v-if="title" class="EditorTextarea-Title">{{ title }}</span>
44
<v-textarea
5-
v-model="modelValue"
5+
:value="value"
66
:hint="hint"
77
:label="label"
88
:placeholder="placeholder"
99
background-color="white"
1010
class="elevation-0"
1111
solo
1212
flat
13+
@input="$emit('input', $event)"
1314
/>
1415
</div>
1516
</template>
1617

1718
<script lang="ts">
1819
import Vue from 'vue'
1920
20-
type DataType = {
21-
modelValue: string
22-
}
23-
2421
export default Vue.extend({
2522
props: {
2623
title: {
@@ -48,19 +45,6 @@ export default Vue.extend({
4845
required: false,
4946
default: ''
5047
}
51-
},
52-
data(): DataType {
53-
return {
54-
modelValue: this.value
55-
}
56-
},
57-
watch: {
58-
modelValue(value) {
59-
this.$emit('input', value)
60-
},
61-
value(value) {
62-
this.modelValue = value
63-
}
6448
}
6549
})
6650
</script>

0 commit comments

Comments
 (0)