Skip to content

Commit f6f197c

Browse files
authored
Merge pull request #11565 from owncloud/feat/date-range-filter
feat: add custom date range filter
2 parents e02ecc5 + 39433fc commit f6f197c

File tree

6 files changed

+740
-9
lines changed

6 files changed

+740
-9
lines changed

packages/design-system/src/components/OcDatepicker/OcDatepicker.vue

+13-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</template>
1515

1616
<script lang="ts">
17-
import { computed, defineComponent, onMounted, PropType, ref, unref, watch } from 'vue'
17+
import { computed, defineComponent, PropType, ref, unref, watch } from 'vue'
1818
import { useGettext } from 'vue3-gettext'
1919
import { DateTime } from 'luxon'
2020
export default defineComponent({
@@ -56,11 +56,18 @@ export default defineComponent({
5656
return ''
5757
})
5858
59-
onMounted(() => {
60-
if (props.currentDate) {
61-
dateInputString.value = props.currentDate.toISODate()
62-
}
63-
})
59+
watch(
60+
() => props.currentDate,
61+
() => {
62+
if (props.currentDate) {
63+
dateInputString.value = props.currentDate.toISODate()
64+
return
65+
}
66+
67+
dateInputString.value = undefined
68+
},
69+
{ immediate: true }
70+
)
6471
6572
watch(
6673
date,

packages/design-system/src/components/OcFilterChip/OcFilterChip.vue

+14-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
</oc-button>
2626
<oc-drop
2727
v-if="!isToggle"
28+
ref="dropRef"
2829
:toggle="'#' + id"
2930
class="oc-filter-chip-drop"
3031
mode="click"
@@ -49,8 +50,9 @@
4950
</template>
5051

5152
<script lang="ts">
52-
import { computed, defineComponent, PropType } from 'vue'
53+
import { computed, defineComponent, PropType, ref, unref } from 'vue'
5354
import uniqueId from '../../utils/uniqueId'
55+
import OcDrop from '../OcDrop/OcDrop.vue'
5456
5557
export default defineComponent({
5658
name: 'OcFilterChip',
@@ -107,14 +109,23 @@ export default defineComponent({
107109
}
108110
},
109111
emits: ['clearFilter', 'hideDrop', 'showDrop', 'toggleFilter'],
110-
setup(props) {
112+
setup(props, { expose }) {
113+
const dropRef = ref<typeof OcDrop>()
114+
111115
const filterActive = computed(() => {
112116
if (props.isToggle) {
113117
return props.isToggleActive
114118
}
115119
return !!props.selectedItemNames.length
116120
})
117-
return { filterActive }
121+
122+
const hideDrop = () => {
123+
unref(dropRef)?.hide()
124+
}
125+
126+
expose({ hideDrop })
127+
128+
return { filterActive, dropRef }
118129
}
119130
})
120131
</script>

0 commit comments

Comments
 (0)