@wishbone-media/spark 0.17.0 → 0.18.0
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/dist/index.css +1 -1
- package/dist/index.js +268 -260
- package/package.json +1 -1
- package/src/components/plugins/SparkTableDatePicker.vue +13 -2
- package/src/components/plugins/SparkTableFilterButtons.vue +10 -1
- package/src/components/plugins/SparkTableFilterSelect.vue +9 -2
- package/src/components/plugins/SparkTableSearch.vue +15 -7
package/package.json
CHANGED
|
@@ -69,6 +69,7 @@ import { ref, watch } from 'vue'
|
|
|
69
69
|
* @property {string} [param] - Custom query param (defaults to filter[key])
|
|
70
70
|
* @property {string} [position='header-left'] - Toolbar position
|
|
71
71
|
* @property {Object} [formkitProps] - Additional FormKit props to pass through
|
|
72
|
+
* @property {string} [initialValue] - Initial date value in YYYY-MM-DD format to apply on mount
|
|
72
73
|
*/
|
|
73
74
|
|
|
74
75
|
const props = defineProps({
|
|
@@ -92,8 +93,18 @@ const label = props.config.label || null
|
|
|
92
93
|
const param = props.config.param || `filter[${props.config.key}]`
|
|
93
94
|
const componentKey = ref(`${param}-0`)
|
|
94
95
|
|
|
95
|
-
// Initialize from existing params
|
|
96
|
-
|
|
96
|
+
// Initialize from existing params or use initialValue
|
|
97
|
+
if (props.sparkTable.params[param]) {
|
|
98
|
+
selectedDate.value = props.sparkTable.params[param]
|
|
99
|
+
} else if (props.config.initialValue) {
|
|
100
|
+
selectedDate.value = props.config.initialValue
|
|
101
|
+
// Apply initial value to params on mount
|
|
102
|
+
props.sparkTable.methods.applyParams({
|
|
103
|
+
[param]: props.config.initialValue,
|
|
104
|
+
})
|
|
105
|
+
} else {
|
|
106
|
+
selectedDate.value = null
|
|
107
|
+
}
|
|
97
108
|
|
|
98
109
|
// Watch for date changes
|
|
99
110
|
watch(selectedDate, (newValue) => {
|
|
@@ -49,6 +49,7 @@ import SparkButtonGroup from '@/components/SparkButtonGroup.vue'
|
|
|
49
49
|
* @property {string} [label] - Label displayed before the button group
|
|
50
50
|
* @property {string} [param] - Custom query param (defaults to filter[key])
|
|
51
51
|
* @property {Array<{label: string, value: any}>} options - Button options (including "All" option with value: null)
|
|
52
|
+
* @property {string|number} [initialValue] - Initial value to apply on mount (must match an option's value)
|
|
52
53
|
*/
|
|
53
54
|
|
|
54
55
|
const props = defineProps({
|
|
@@ -71,9 +72,17 @@ const selectedValue = ref(null)
|
|
|
71
72
|
const label = props.config.label || null
|
|
72
73
|
const paramKey = props.config.param || `filter[${props.config.key}]`
|
|
73
74
|
|
|
74
|
-
// Initialize from existing params
|
|
75
|
+
// Initialize from existing params or use initialValue
|
|
75
76
|
if (props.sparkTable.params[paramKey] !== undefined) {
|
|
76
77
|
selectedValue.value = props.sparkTable.params[paramKey]
|
|
78
|
+
} else if (props.config.initialValue !== undefined) {
|
|
79
|
+
selectedValue.value = props.config.initialValue
|
|
80
|
+
// Apply initial value to params on mount (only if not null/undefined)
|
|
81
|
+
if (props.config.initialValue !== null) {
|
|
82
|
+
props.sparkTable.methods.applyParams({
|
|
83
|
+
[paramKey]: props.config.initialValue,
|
|
84
|
+
})
|
|
85
|
+
}
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
const isSelected = (value) => {
|
|
@@ -50,6 +50,7 @@ import { ref, computed, watch } from 'vue'
|
|
|
50
50
|
* @property {string} [placeholder='All'] - Placeholder for empty option
|
|
51
51
|
* @property {string} [param] - Custom query parameter name (defaults to filter[key])
|
|
52
52
|
* @property {string} [position='header-left'] - Toolbar position
|
|
53
|
+
* @property {string|number} [initialValue] - Initial value to apply on mount (must match an option's value)
|
|
53
54
|
*/
|
|
54
55
|
|
|
55
56
|
const props = defineProps({
|
|
@@ -69,11 +70,17 @@ const props = defineProps({
|
|
|
69
70
|
})
|
|
70
71
|
|
|
71
72
|
const selectedValue = ref('')
|
|
72
|
-
|
|
73
|
-
// Initialize from existing params
|
|
74
73
|
const paramKey = props.config.param || `filter[${props.config.key}]`
|
|
74
|
+
|
|
75
|
+
// Initialize from existing params or use initialValue
|
|
75
76
|
if (props.sparkTable.params[paramKey]) {
|
|
76
77
|
selectedValue.value = props.sparkTable.params[paramKey]
|
|
78
|
+
} else if (props.config.initialValue !== undefined && props.config.initialValue !== null) {
|
|
79
|
+
selectedValue.value = props.config.initialValue
|
|
80
|
+
// Apply initial value to params on mount
|
|
81
|
+
props.sparkTable.methods.applyParams({
|
|
82
|
+
[paramKey]: props.config.initialValue,
|
|
83
|
+
})
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
const label = props.config.label || null
|
|
@@ -39,6 +39,7 @@ import { useDebounceFn } from '@vueuse/core'
|
|
|
39
39
|
* @property {string} [param='search'] - Query parameter name for search
|
|
40
40
|
* @property {number} [debounce=300] - Debounce delay in milliseconds
|
|
41
41
|
* @property {string} [position='header-left'] - Toolbar position
|
|
42
|
+
* @property {string} [initialValue] - Initial search value to apply on mount
|
|
42
43
|
*/
|
|
43
44
|
|
|
44
45
|
const props = defineProps({
|
|
@@ -59,15 +60,22 @@ const props = defineProps({
|
|
|
59
60
|
})
|
|
60
61
|
|
|
61
62
|
const searchValue = ref('')
|
|
63
|
+
const paramKey = props.config.param || 'search'
|
|
62
64
|
|
|
63
|
-
// Initialize from existing params
|
|
64
|
-
if (props.sparkTable.params[
|
|
65
|
-
searchValue.value = props.sparkTable.params[
|
|
65
|
+
// Initialize from existing params or use initialValue
|
|
66
|
+
if (props.sparkTable.params[paramKey]) {
|
|
67
|
+
searchValue.value = props.sparkTable.params[paramKey]
|
|
68
|
+
} else if (props.config.initialValue) {
|
|
69
|
+
searchValue.value = props.config.initialValue
|
|
70
|
+
// Apply initial value to params on mount
|
|
71
|
+
props.sparkTable.methods.applyParams({
|
|
72
|
+
[paramKey]: props.config.initialValue,
|
|
73
|
+
})
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
const clearSearch = () => {
|
|
69
77
|
searchValue.value = ''
|
|
70
|
-
props.sparkTable.methods.removeParam(
|
|
78
|
+
props.sparkTable.methods.removeParam(paramKey)
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
// Watch searchValue and apply debounced search
|
|
@@ -75,10 +83,10 @@ const debouncedSearch = useDebounceFn((value) => {
|
|
|
75
83
|
if (value) {
|
|
76
84
|
props.sparkTable.methods.applyParams({
|
|
77
85
|
page: 1,
|
|
78
|
-
[
|
|
86
|
+
[paramKey]: value,
|
|
79
87
|
})
|
|
80
88
|
} else {
|
|
81
|
-
props.sparkTable.methods.removeParam(
|
|
89
|
+
props.sparkTable.methods.removeParam(paramKey)
|
|
82
90
|
}
|
|
83
91
|
}, props.config.debounce || 300)
|
|
84
92
|
|
|
@@ -91,7 +99,7 @@ const placeholder = props.config.placeholder || 'Search...'
|
|
|
91
99
|
|
|
92
100
|
// Watch for external param changes
|
|
93
101
|
watch(
|
|
94
|
-
() => props.sparkTable.params[
|
|
102
|
+
() => props.sparkTable.params[paramKey],
|
|
95
103
|
(newValue) => {
|
|
96
104
|
if (!newValue && searchValue.value) {
|
|
97
105
|
searchValue.value = ''
|