@wishbone-media/spark 0.15.2 → 0.15.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wishbone-media/spark",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div class="spark-table-date-picker">
3
3
  <FormKit
4
+ :key="componentKey"
4
5
  v-model="selectedDate"
5
6
  type="datepicker"
6
7
  picker-only
@@ -89,6 +90,7 @@ const props = defineProps({
89
90
  const selectedDate = ref(null)
90
91
  const label = props.config.label || null
91
92
  const param = props.config.param || `filter[${props.config.key}]`
93
+ const componentKey = ref(`${param}-0`)
92
94
 
93
95
  // Initialize from existing params
94
96
  selectedDate.value = props.sparkTable.params[param] || null
@@ -105,12 +107,18 @@ watch(selectedDate, (newValue) => {
105
107
  }
106
108
  })
107
109
 
108
- // Watch for external param changes
110
+ // Watch for external param changes (e.g., when reset button clears params)
109
111
  watch(
110
112
  () => props.sparkTable.params[param],
111
113
  (newValue) => {
112
- if (!newValue && selectedDate.value) {
114
+ if ((newValue === undefined || newValue === null || newValue === '') && selectedDate.value) {
113
115
  selectedDate.value = null
116
+ // Force re-render of FormKit datepicker component to clear its internal state
117
+ // Increment the numeric suffix to create a new unique key
118
+ const currentCount = parseInt(componentKey.value.split('-').pop()) || 0
119
+ componentKey.value = `${param}-${currentCount + 1}`
120
+ } else if (newValue && newValue !== selectedDate.value) {
121
+ selectedDate.value = newValue
114
122
  }
115
123
  },
116
124
  )