@invopop/popui 0.1.4-beta.36 → 0.1.4-beta.38
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/DatePicker.svelte
CHANGED
|
@@ -141,21 +141,22 @@
|
|
|
141
141
|
end: undefined
|
|
142
142
|
})
|
|
143
143
|
let isOpen = $state(false)
|
|
144
|
+
let selectedLabel = $state(label)
|
|
144
145
|
let isStacked = $derived(stackLeft || stackRight)
|
|
145
146
|
let hasSelectedDates = $derived(value.start !== undefined)
|
|
147
|
+
let hasConfirmedDates = $derived(selectedLabel !== label)
|
|
146
148
|
let styles = $derived(
|
|
147
149
|
isStacked
|
|
148
|
-
?
|
|
150
|
+
? buttonVariants({
|
|
149
151
|
variant: 'ghost',
|
|
150
152
|
stackedLeft: stackLeft,
|
|
151
153
|
stackedRight: stackRight
|
|
152
|
-
})
|
|
154
|
+
})
|
|
153
155
|
: clsx('border backdrop-blur-sm backdrop-filter', {
|
|
154
156
|
'border-border-selected-bold shadow-active': isOpen,
|
|
155
157
|
'border-border-default-secondary hover:border-border-default-secondary-hover': !isOpen
|
|
156
158
|
})
|
|
157
159
|
)
|
|
158
|
-
let selectedLabel = $state(label)
|
|
159
160
|
|
|
160
161
|
$effect(() => {
|
|
161
162
|
if (!value.end) {
|
|
@@ -240,9 +241,11 @@
|
|
|
240
241
|
/>
|
|
241
242
|
{/if}
|
|
242
243
|
<span
|
|
243
|
-
class=
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
class={clsx('flex-1 text-base truncate', {
|
|
245
|
+
'text-foreground': hasConfirmedDates,
|
|
246
|
+
'text-foreground-default-secondary': !hasConfirmedDates,
|
|
247
|
+
'font-normal': isStacked && !hasConfirmedDates
|
|
248
|
+
})}
|
|
246
249
|
>
|
|
247
250
|
{selectedLabel}
|
|
248
251
|
</span>
|
|
@@ -95,9 +95,11 @@
|
|
|
95
95
|
|
|
96
96
|
{#snippet label()}
|
|
97
97
|
<span
|
|
98
|
-
class=
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
class={clsx('flex-1 text-base truncate', {
|
|
99
|
+
'text-foreground': selectedItems.length,
|
|
100
|
+
'text-foreground-default-secondary': !selectedItems.length,
|
|
101
|
+
'font-normal': isStacked && !selectedItems.length
|
|
102
|
+
})}
|
|
101
103
|
>
|
|
102
104
|
{selectedLabel}
|
|
103
105
|
</span>
|
|
@@ -119,7 +119,9 @@
|
|
|
119
119
|
|
|
120
120
|
// Sync pagination pageIndex with initialPage prop (for manual pagination resets)
|
|
121
121
|
$effect(() => {
|
|
122
|
-
|
|
122
|
+
if (manualPagination) {
|
|
123
|
+
pagination.pageIndex = initialPage
|
|
124
|
+
}
|
|
123
125
|
})
|
|
124
126
|
|
|
125
127
|
// Reorder initial frozen columns on mount
|
|
@@ -204,12 +206,42 @@
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
|
|
209
|
+
function reorderUnfrozenColumn(columnId: string) {
|
|
210
|
+
const currentOrder = table.getState().columnOrder.length > 0
|
|
211
|
+
? table.getState().columnOrder
|
|
212
|
+
: table.getAllLeafColumns().map(col => col.id)
|
|
213
|
+
|
|
214
|
+
const newOrder = [...currentOrder]
|
|
215
|
+
const columnIndex = newOrder.indexOf(columnId)
|
|
216
|
+
|
|
217
|
+
if (columnIndex > -1) {
|
|
218
|
+
newOrder.splice(columnIndex, 1)
|
|
219
|
+
|
|
220
|
+
const selectIndex = newOrder.indexOf('select')
|
|
221
|
+
const insertIndex = selectIndex >= 0 ? selectIndex + 1 : 0
|
|
222
|
+
|
|
223
|
+
// Find the first unfrozen column position (after all frozen columns)
|
|
224
|
+
let firstUnfrozenIndex = insertIndex
|
|
225
|
+
for (let i = insertIndex; i < newOrder.length; i++) {
|
|
226
|
+
if (frozenColumns.has(newOrder[i])) {
|
|
227
|
+
firstUnfrozenIndex = i + 1
|
|
228
|
+
} else {
|
|
229
|
+
break
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
newOrder.splice(firstUnfrozenIndex, 0, columnId)
|
|
234
|
+
table.setColumnOrder(newOrder)
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
207
238
|
function handleFreezeColumn(columnId: string) {
|
|
208
239
|
const isFrozen = frozenColumns.has(columnId)
|
|
209
240
|
|
|
210
241
|
if (isFrozen) {
|
|
211
242
|
frozenColumns.delete(columnId)
|
|
212
243
|
frozenColumns = new Set(frozenColumns)
|
|
244
|
+
reorderUnfrozenColumn(columnId)
|
|
213
245
|
} else {
|
|
214
246
|
frozenColumns.add(columnId)
|
|
215
247
|
frozenColumns = new Set(frozenColumns)
|