= {}
if (isRangeMode) {
// Range mode: set both start and end
if (this.inputData?.startKey) {
if (start) {
searchParams.set(this.inputData.startKey, String(start.getTime()))
params[this.inputData.startKey] = String(start.getTime())
} else {
searchParams.delete(this.inputData.startKey)
params[this.inputData.startKey] = undefined
}
}
if (this.inputData?.endKey) {
if (end) {
searchParams.set(this.inputData.endKey, String(end.getTime()))
params[this.inputData.endKey] = String(end.getTime())
} else {
searchParams.delete(this.inputData.endKey)
params[this.inputData.endKey] = undefined
}
}
} else {
// Single date mode: use whichever key is provided
const singleKey = this.inputData?.startKey || this.inputData?.endKey
if (singleKey) {
if (start) {
searchParams.set(singleKey, String(start.getTime()))
params[singleKey] = String(start.getTime())
} else {
searchParams.delete(singleKey)
params[singleKey] = undefined
}
}
}
// Construct the new URL with updated parameters
const navEvent = new CustomEvent('param-submit', {
detail: { params },
bubbles: true,
composed: true
})
this.dispatchEvent(navEvent)
}
handleClear(e: Event) {
e.stopPropagation()
this.defaultRange = []
if (this.flatpickr) {
this.flatpickr.clear()
}
this.handleSelectionChange(e)
}
static styles = css`
:host {
display: block;
container-type: size;
width: 100%;
}
.wrapper {
display: flex;
flex-direction: column;
justify-content: center;
align-items: stretch;
font-family: sans-serif;
padding: 2cqh 2cqw;
height: 100%;
box-sizing: border-box;
}
input {
padding: 8px;
width: 100%;
font-size: 16px;
outline: none;
border-radius: 6px;
box-sizing: border-box;
border: 1px solid #ddd;
outline: none;
}
md-outlined-text-field {
--md-outlined-text-field-container-shape: 4px;
--md-outlined-field-top-space: 8px;
--md-outlined-field-bottom-space: 8px;
--md-outlined-field-leading-space: 12px;
--md-outlined-field-trailing-space: 12px;
min-height: 40px;
height: 40px;
}
lit-flatpickr {
width: 100%;
background-color: transparent;
overflow: visible;
}
`
render() {
const fontColor = this.themeTitleColor
const bgColor = this.themeBgColor
const isRangeMode = !!(this.inputData?.startKey && this.inputData?.endKey)
return html`
${this.defaultRange.length > 0
? html`
close
`
: ''}
`
}
}