ropav 0.4.0 → 0.6.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/components/autocomplete/autocomplete-root.js +3 -1
- package/dist/components/autocomplete/index.d.ts +3 -0
- package/dist/components/breadcrumbs/breadcrumbs-item.js +1 -0
- package/dist/components/breadcrumbs/index.d.ts +1 -0
- package/dist/components/calendar/index.d.ts +5 -3
- package/dist/components/calendar-year-picker/index.d.ts +4 -2
- package/dist/components/checkbox/checkbox-content.js +1 -1
- package/dist/components/color-field/index.d.ts +1 -0
- package/dist/components/color-input-group/color-input-group-root.js +2 -0
- package/dist/components/color-input-group/color-input-group.types.d.ts +2 -0
- package/dist/components/color-input-group/index.d.ts +2 -0
- package/dist/components/combo-box/combo-box-root.js +9 -2
- package/dist/components/combo-box/combo-box.types.d.ts +3 -0
- package/dist/components/combo-box/index.d.ts +3 -0
- package/dist/components/date-field/index.d.ts +1 -0
- package/dist/components/date-input-group/date-input-group-root.js +2 -0
- package/dist/components/date-input-group/date-input-group-segment.js +1 -1
- package/dist/components/date-input-group/date-input-group.types.d.ts +2 -0
- package/dist/{composables → components/date-input-group}/use-date-segment.d.ts +2 -2
- package/dist/{composables → components/date-input-group}/use-date-segment.js +9 -9
- package/dist/components/date-range-picker/date-range-picker-root.js +1 -1
- package/dist/components/date-range-picker/index.d.ts +15 -14
- package/dist/{composables → components/date-range-picker}/use-date-range-picker.d.ts +7 -7
- package/dist/{composables → components/date-range-picker}/use-date-range-picker.js +10 -10
- package/dist/components/drawer/drawer-dialog.js +1 -1
- package/dist/{composables → components/drawer}/use-drawer-drag.d.ts +1 -1
- package/dist/{composables → components/drawer}/use-drawer-drag.js +1 -1
- package/dist/components/drop-zone/drop-zone-root.d.ts +23 -0
- package/dist/components/drop-zone/drop-zone-root.js +153 -0
- package/dist/components/drop-zone/drop-zone-trigger.d.ts +21 -0
- package/dist/components/drop-zone/drop-zone-trigger.js +20 -0
- package/dist/components/drop-zone/drop-zone.accept.d.ts +19 -0
- package/dist/components/drop-zone/drop-zone.accept.js +28 -0
- package/dist/components/drop-zone/drop-zone.context.d.ts +6 -0
- package/dist/components/drop-zone/drop-zone.context.js +5 -0
- package/dist/components/drop-zone/drop-zone.types.d.ts +30 -0
- package/dist/components/drop-zone/index.d.ts +86 -0
- package/dist/components/drop-zone/index.js +11 -0
- package/dist/components/dropdown/dropdown-menu.js +1 -0
- package/dist/components/dropdown/dropdown-submenu-trigger.js +1 -1
- package/dist/components/dropdown/index.d.ts +4 -2
- package/dist/{composables → components/dropdown}/use-safely-mouse-to-submenu.js +1 -1
- package/dist/components/icons/icon-overlay-arrow.js +1 -1
- package/dist/components/index.d.ts +5 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/input-root.js +3 -0
- package/dist/components/input/input.types.d.ts +5 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/input-group-root.js +3 -0
- package/dist/components/input-group/input-group.types.d.ts +5 -0
- package/dist/components/input-otp/index.d.ts +6 -4
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/link/link-root.js +22 -5
- package/dist/components/link/link.types.d.ts +14 -3
- package/dist/{composables → components/list-box}/drag-collection.d.ts +2 -2
- package/dist/{composables → components/list-box}/drag-collection.js +1 -1
- package/dist/components/list-box/index.d.ts +4 -0
- package/dist/components/list-box/list-box-root.js +53 -32
- package/dist/components/list-box/list-box.types.d.ts +2 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/menu-root.js +5 -1
- package/dist/components/menu/menu.types.d.ts +3 -0
- package/dist/components/number-field/index.d.ts +3 -0
- package/dist/components/number-field/number-field-root.js +2 -0
- package/dist/components/number-field/number-field.types.d.ts +2 -0
- package/dist/components/overlay/overlay-arrow.js +64 -11
- package/dist/components/progress-bar/index.d.ts +4 -0
- package/dist/components/progress-bar/progress-bar-root.js +4 -0
- package/dist/components/progress-bar/progress-bar.types.d.ts +7 -0
- package/dist/components/radio/radio-content.js +1 -1
- package/dist/components/range-calendar/index.d.ts +18 -15
- package/dist/components/router-provider/index.d.ts +5 -0
- package/dist/components/router-provider/index.js +3 -0
- package/dist/components/router-provider/router-provider.context.d.ts +40 -0
- package/dist/components/router-provider/router-provider.context.js +16 -0
- package/dist/components/router-provider/router-provider.d.ts +21 -0
- package/dist/components/router-provider/router-provider.js +22 -0
- package/dist/components/router-provider/router-provider.types.d.ts +23 -0
- package/dist/components/scroll-shadow/use-scroll-shadow.js +25 -1
- package/dist/components/search-field/index.d.ts +2 -0
- package/dist/components/search-field/search-field-root.js +3 -1
- package/dist/components/search-field/search-field.types.d.ts +2 -0
- package/dist/{composables → components/search-field}/use-search-field.d.ts +2 -2
- package/dist/{composables → components/search-field}/use-search-field.js +3 -3
- package/dist/components/segmented-control/index.d.ts +134 -0
- package/dist/components/segmented-control/index.js +15 -0
- package/dist/components/segmented-control/segmented-control-indicator.d.ts +19 -0
- package/dist/components/segmented-control/segmented-control-indicator.js +36 -0
- package/dist/components/segmented-control/segmented-control-item.d.ts +21 -0
- package/dist/components/segmented-control/segmented-control-item.js +96 -0
- package/dist/components/segmented-control/segmented-control-root.d.ts +25 -0
- package/dist/components/segmented-control/segmented-control-root.js +112 -0
- package/dist/components/segmented-control/segmented-control-separator.d.ts +19 -0
- package/dist/components/segmented-control/segmented-control-separator.js +18 -0
- package/dist/components/segmented-control/segmented-control.context.d.ts +17 -0
- package/dist/components/segmented-control/segmented-control.context.js +12 -0
- package/dist/components/segmented-control/segmented-control.types.d.ts +67 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/select/select-hidden-select.js +1 -1
- package/dist/components/select/select-root.js +2 -0
- package/dist/components/select/select.types.d.ts +2 -0
- package/dist/components/sidebar/index.d.ts +546 -0
- package/dist/components/sidebar/index.js +47 -0
- package/dist/components/sidebar/sidebar-collapsible-trigger.d.ts +21 -0
- package/dist/components/sidebar/sidebar-collapsible-trigger.js +70 -0
- package/dist/components/sidebar/sidebar-collapsible.d.ts +24 -0
- package/dist/components/sidebar/sidebar-collapsible.js +78 -0
- package/dist/components/sidebar/sidebar-content.d.ts +21 -0
- package/dist/components/sidebar/sidebar-content.js +37 -0
- package/dist/components/sidebar/sidebar-footer.d.ts +21 -0
- package/dist/components/sidebar/sidebar-footer.js +24 -0
- package/dist/components/sidebar/sidebar-group-label.d.ts +21 -0
- package/dist/components/sidebar/sidebar-group-label.js +32 -0
- package/dist/components/sidebar/sidebar-group.d.ts +21 -0
- package/dist/components/sidebar/sidebar-group.js +48 -0
- package/dist/components/sidebar/sidebar-header.d.ts +21 -0
- package/dist/components/sidebar/sidebar-header.js +24 -0
- package/dist/components/sidebar/sidebar-inset.d.ts +21 -0
- package/dist/components/sidebar/sidebar-inset.js +24 -0
- package/dist/components/sidebar/sidebar-item-icon.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-icon.js +20 -0
- package/dist/components/sidebar/sidebar-item-indicator.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-indicator.js +48 -0
- package/dist/components/sidebar/sidebar-item-label.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-label.js +28 -0
- package/dist/components/sidebar/sidebar-item-tooltip.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-tooltip.js +38 -0
- package/dist/components/sidebar/sidebar-item-trailing.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-trailing.js +28 -0
- package/dist/components/sidebar/sidebar-item.d.ts +23 -0
- package/dist/components/sidebar/sidebar-item.js +160 -0
- package/dist/components/sidebar/sidebar-panel.d.ts +21 -0
- package/dist/components/sidebar/sidebar-panel.js +88 -0
- package/dist/components/sidebar/sidebar-rail.d.ts +21 -0
- package/dist/components/sidebar/sidebar-rail.js +210 -0
- package/dist/components/sidebar/sidebar-root.d.ts +31 -0
- package/dist/components/sidebar/sidebar-root.js +140 -0
- package/dist/components/sidebar/sidebar-separator.d.ts +19 -0
- package/dist/components/sidebar/sidebar-separator.js +16 -0
- package/dist/components/sidebar/sidebar-sub-menu.d.ts +23 -0
- package/dist/components/sidebar/sidebar-sub-menu.js +40 -0
- package/dist/components/sidebar/sidebar-trigger.d.ts +21 -0
- package/dist/components/sidebar/sidebar-trigger.js +69 -0
- package/dist/components/sidebar/sidebar.context.d.ts +75 -0
- package/dist/components/sidebar/sidebar.context.js +30 -0
- package/dist/components/sidebar/sidebar.state.d.ts +73 -0
- package/dist/components/sidebar/sidebar.state.js +76 -0
- package/dist/components/sidebar/sidebar.storage.d.ts +8 -0
- package/dist/components/sidebar/sidebar.storage.js +45 -0
- package/dist/components/sidebar/sidebar.types.d.ts +273 -0
- package/dist/components/splitter/index.d.ts +143 -0
- package/dist/components/splitter/index.js +13 -0
- package/dist/components/splitter/splitter-handle.d.ts +21 -0
- package/dist/components/splitter/splitter-handle.js +209 -0
- package/dist/components/splitter/splitter-panel.d.ts +21 -0
- package/dist/components/splitter/splitter-panel.js +70 -0
- package/dist/components/splitter/splitter-root.d.ts +31 -0
- package/dist/components/splitter/splitter-root.js +152 -0
- package/dist/components/splitter/splitter.context.d.ts +15 -0
- package/dist/components/splitter/splitter.context.js +5 -0
- package/dist/components/splitter/splitter.state.d.ts +87 -0
- package/dist/components/splitter/splitter.state.js +322 -0
- package/dist/components/splitter/splitter.storage.d.ts +15 -0
- package/dist/components/splitter/splitter.storage.js +56 -0
- package/dist/components/splitter/splitter.types.d.ts +98 -0
- package/dist/components/switch/switch-content.js +1 -1
- package/dist/components/table/index.d.ts +10 -9
- package/dist/components/table/table-body.js +13 -13
- package/dist/components/table/table-cell.js +49 -46
- package/dist/components/table/table-column-resizer.js +1 -1
- package/dist/components/table/table-column.js +1 -1
- package/dist/components/table/table-content.js +37 -18
- package/dist/{composables → components/table}/table-drag-collection.d.ts +1 -1
- package/dist/{composables → components/table}/table-drag-collection.js +1 -1
- package/dist/components/table/table-drop-indicator.js +3 -1
- package/dist/components/table/table-resizable-container.d.ts +4 -5
- package/dist/components/table/table-row.js +45 -14
- package/dist/components/table/table-virtualizer-item.d.ts +2 -7
- package/dist/components/table/table-virtualizer-item.js +20 -9
- package/dist/components/table/table.context.d.ts +11 -3
- package/dist/components/table/table.types.d.ts +1 -1
- package/dist/{composables → components/table}/use-grid-keyboard.d.ts +3 -3
- package/dist/{composables → components/table}/use-grid-keyboard.js +57 -55
- package/dist/{composables → components/table}/use-grid-selection-announcement.d.ts +2 -2
- package/dist/{composables → components/table}/use-grid-selection-announcement.js +2 -2
- package/dist/{composables → components/table}/use-table-collection.d.ts +2 -2
- package/dist/{composables → components/table}/use-table-collection.js +4 -4
- package/dist/{composables → components/table}/use-table-column-layout.d.ts +13 -20
- package/dist/components/table/use-table-column-layout.js +115 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/textarea-root.js +3 -0
- package/dist/components/textarea/textarea.types.d.ts +5 -0
- package/dist/components/textfield/index.d.ts +2 -0
- package/dist/components/textfield/textfield-root.js +5 -1
- package/dist/components/textfield/textfield.context.d.ts +2 -0
- package/dist/components/textfield/textfield.types.d.ts +5 -0
- package/dist/components/time-field/index.d.ts +1 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/toast-default-content.js +1 -1
- package/dist/components/toolbar/index.d.ts +3 -2
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip-root.js +1 -1
- package/dist/components/virtualizer/index.d.ts +3 -1
- package/dist/components/virtualizer/index.js +2 -1
- package/dist/components/virtualizer/use-virtualizer-item.d.ts +23 -0
- package/dist/components/virtualizer/use-virtualizer-item.js +45 -0
- package/dist/components/virtualizer/virtualizer-item.js +7 -41
- package/dist/components/virtualizer/virtualizer-scrollbar-track.d.ts +20 -0
- package/dist/components/virtualizer/virtualizer-scrollbar-track.js +141 -0
- package/dist/components/virtualizer/virtualizer-scrollbar.d.ts +18 -0
- package/dist/components/virtualizer/virtualizer-scrollbar.js +55 -0
- package/dist/components/virtualizer/virtualizer.context.d.ts +17 -1
- package/dist/composables/drag-manager.js +1 -13
- package/dist/composables/index.d.ts +3 -70
- package/dist/composables/use-collection.d.ts +22 -3
- package/dist/composables/use-collection.js +67 -14
- package/dist/composables/use-color-area.js +2 -2
- package/dist/composables/use-color-field.js +1 -1
- package/dist/composables/use-combo-box.js +1 -1
- package/dist/composables/use-date-field.js +1 -1
- package/dist/composables/use-drag.d.ts +6 -5
- package/dist/composables/use-draggable-item.d.ts +2 -2
- package/dist/composables/use-droppable-collection.js +3 -3
- package/dist/composables/use-droppable-item.js +1 -1
- package/dist/composables/use-form-reset.d.ts +6 -2
- package/dist/composables/use-form-reset.js +9 -5
- package/dist/composables/use-list-keyboard.js +64 -62
- package/dist/composables/use-number-field.js +1 -1
- package/dist/composables/use-select.js +2 -2
- package/dist/composables/use-selection-manager.js +4 -4
- package/dist/composables/use-single-select-list-state.d.ts +37 -0
- package/dist/composables/use-single-select-list-state.js +110 -0
- package/dist/composables/use-slider-thumb.js +2 -2
- package/dist/composables/use-slider.js +1 -1
- package/dist/composables/use-tab-list-state.d.ts +10 -29
- package/dist/composables/use-tab-list-state.js +10 -99
- package/dist/composables/use-text-field.js +1 -1
- package/dist/composables/use-virtualizer-scroll.d.ts +52 -2
- package/dist/composables/use-virtualizer-scroll.js +79 -13
- package/dist/composables/use-virtualizer.d.ts +24 -4
- package/dist/composables/use-virtualizer.js +40 -6
- package/dist/index.js +60 -83
- package/dist/utils/document-order.d.ts +14 -0
- package/dist/utils/document-order.js +17 -0
- package/dist/utils/flex-sizing.d.ts +41 -0
- package/dist/utils/flex-sizing.js +140 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/open-link.d.ts +31 -0
- package/dist/utils/open-link.js +32 -0
- package/dist/utils/story-truncation.d.ts +20 -0
- package/dist/utils/story-users.d.ts +11 -0
- package/dist/utils/virtualizer-collection.d.ts +14 -4
- package/dist/utils/virtualizer-collection.js +9 -14
- package/dist/utils/virtualizer-layout-info.js +3 -2
- package/dist/utils/virtualizer-list-layout.d.ts +75 -29
- package/dist/utils/virtualizer-list-layout.js +182 -99
- package/dist/utils/virtualizer-offsets.d.ts +111 -0
- package/dist/utils/virtualizer-offsets.js +159 -0
- package/dist/utils/virtualizer-overscan.d.ts +9 -15
- package/dist/utils/virtualizer-overscan.js +14 -33
- package/dist/utils/virtualizer-table-layout.d.ts +50 -21
- package/dist/utils/virtualizer-table-layout.js +130 -89
- package/dist/version.js +1 -1
- package/package.json +25 -5
- package/dist/composables/use-table-column-layout.js +0 -214
- /package/dist/{composables → components/dropdown}/use-safely-mouse-to-submenu.d.ts +0 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { sortByDocumentOrder } from "../../utils/document-order.js";
|
|
2
|
+
import { calculateFlexSizes, getMaxSize, getMinSize, isStaticSize } from "../../utils/flex-sizing.js";
|
|
3
|
+
import { computed, shallowRef, toValue } from "vue";
|
|
4
|
+
//#region src/components/splitter/splitter.state.ts
|
|
5
|
+
var PERCENT_UNIT = /%$/;
|
|
6
|
+
var FRACTION_UNIT = /fr$/;
|
|
7
|
+
/** Which family a declared size belongs to, so a drag can write its result back in the same one. */
|
|
8
|
+
var unitOf = (size) => {
|
|
9
|
+
if (size == null) return "fraction";
|
|
10
|
+
if (typeof size === "number") return "pixels";
|
|
11
|
+
if (PERCENT_UNIT.test(size)) return "percent";
|
|
12
|
+
if (FRACTION_UNIT.test(size)) return "fraction";
|
|
13
|
+
return isStaticSize(size) ? "pixels" : "fraction";
|
|
14
|
+
};
|
|
15
|
+
/** Trim the float a division leaves behind, without pinning the value to whole pixels. */
|
|
16
|
+
var round = (value) => Number(value.toFixed(4));
|
|
17
|
+
var isSameLayout = (a, b) => a.length === b.length && a.every((size, index) => size === b[index]);
|
|
18
|
+
var isSameSet = (a, b) => {
|
|
19
|
+
if (a.size !== b.size) return false;
|
|
20
|
+
for (const key of a) if (!b.has(key)) return false;
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
var registry = () => {
|
|
24
|
+
const items = /* @__PURE__ */ new Map();
|
|
25
|
+
const version = shallowRef(0);
|
|
26
|
+
return {
|
|
27
|
+
get: (key) => {
|
|
28
|
+
return items.get(key);
|
|
29
|
+
},
|
|
30
|
+
keys: computed(() => {
|
|
31
|
+
return sortByDocumentOrder([...items.entries()], ([, meta]) => meta.element()).map(([key]) => key);
|
|
32
|
+
}),
|
|
33
|
+
register: (key, meta) => {
|
|
34
|
+
items.set(key, meta);
|
|
35
|
+
version.value += 1;
|
|
36
|
+
return () => {
|
|
37
|
+
if (items.get(key) === meta) {
|
|
38
|
+
items.delete(key);
|
|
39
|
+
version.value += 1;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
var useSplitterState = (options) => {
|
|
46
|
+
const panels = registry();
|
|
47
|
+
const handles = registry();
|
|
48
|
+
const containerSize = shallowRef(0);
|
|
49
|
+
const resizingHandle = shallowRef(null);
|
|
50
|
+
const stored = shallowRef(/* @__PURE__ */ new Map());
|
|
51
|
+
const collapsed = shallowRef(/* @__PURE__ */ new Set());
|
|
52
|
+
/** What a collapsible panel held before it shut, so re-opening returns it there. */
|
|
53
|
+
const remembered = /* @__PURE__ */ new Map();
|
|
54
|
+
const orientation = computed(() => toValue(options.orientation) ?? "horizontal");
|
|
55
|
+
const isDisabled = computed(() => toValue(options.isDisabled) ?? false);
|
|
56
|
+
const isControlled = computed(() => toValue(options.sizes) !== void 0);
|
|
57
|
+
const handleTotal = computed(() => handles.keys.value.reduce((total, key) => total + (handles.get(key)?.size() ?? 0), 0));
|
|
58
|
+
const availableSize = computed(() => Math.max(0, containerSize.value - handleTotal.value));
|
|
59
|
+
/** The declared size the layout should use for a panel, before the solver resolves it. */
|
|
60
|
+
const declaredOf = (key, index) => {
|
|
61
|
+
const panel = panels.get(key);
|
|
62
|
+
if (!panel) return void 0;
|
|
63
|
+
if (collapsed.value.has(key)) return panel.collapsedSize() ?? 0;
|
|
64
|
+
const controlled = toValue(options.sizes)?.[index];
|
|
65
|
+
if (controlled !== void 0) return controlled;
|
|
66
|
+
return stored.value.get(key) ?? panel.size() ?? toValue(options.defaultSizes)?.[index] ?? panel.defaultSize();
|
|
67
|
+
};
|
|
68
|
+
const definitionsOf = () => panels.keys.value.map((key, index) => {
|
|
69
|
+
const panel = panels.get(key);
|
|
70
|
+
const isShut = collapsed.value.has(key);
|
|
71
|
+
return {
|
|
72
|
+
defaultSize: panel.defaultSize(),
|
|
73
|
+
maxSize: isShut ? void 0 : panel.maxSize(),
|
|
74
|
+
minSize: isShut ? 0 : panel.minSize(),
|
|
75
|
+
size: declaredOf(key, index)
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
const layout = computed(() => {
|
|
79
|
+
const available = availableSize.value;
|
|
80
|
+
if (available <= 0 || panels.keys.value.length === 0) return [];
|
|
81
|
+
return calculateFlexSizes(available, definitionsOf(), () => "1fr", () => 0);
|
|
82
|
+
});
|
|
83
|
+
const indexOf = (key) => panels.keys.value.indexOf(key);
|
|
84
|
+
const getPanelSize = (key) => layout.value[indexOf(key)] ?? 0;
|
|
85
|
+
const boundsOf = (index) => {
|
|
86
|
+
const panel = panels.get(panels.keys.value[index]);
|
|
87
|
+
const available = availableSize.value;
|
|
88
|
+
const min = getMinSize(panel.minSize(), available);
|
|
89
|
+
const shut = panel.isCollapsible() ? getMinSize(panel.collapsedSize() ?? 0, available) : min;
|
|
90
|
+
return {
|
|
91
|
+
floor: Math.min(shut, min),
|
|
92
|
+
isCollapsible: panel.isCollapsible(),
|
|
93
|
+
max: getMaxSize(panel.maxSize(), available),
|
|
94
|
+
min
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The nearest size a panel may legally hold.
|
|
99
|
+
*
|
|
100
|
+
* A collapsible panel has a gap in its range — everything between its collapsed size and its
|
|
101
|
+
* minimum is unreachable — so a size that lands in the gap snaps to whichever end is nearer.
|
|
102
|
+
* The midpoint is the threshold, which needs no constant of its own and scales with whatever
|
|
103
|
+
* minimum the caller chose.
|
|
104
|
+
*/
|
|
105
|
+
const legalize = (index, intended) => {
|
|
106
|
+
const { floor, isCollapsible, max, min } = boundsOf(index);
|
|
107
|
+
if (intended > max) return max;
|
|
108
|
+
if (!isCollapsible) return Math.max(intended, min);
|
|
109
|
+
if (intended >= min) return intended;
|
|
110
|
+
return intended < (floor + min) / 2 ? floor : min;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Move the edge at `handleIndex` by `delta`, taking from one side and giving it to the other.
|
|
114
|
+
*
|
|
115
|
+
* The shrinking side cascades: a neighbour already sitting on its floor is walked past, so a
|
|
116
|
+
* three-panel group keeps responding once the middle panel is spent. The growing side
|
|
117
|
+
* deliberately does not, because spreading growth outward would move a handle nobody touched.
|
|
118
|
+
*/
|
|
119
|
+
const resolveDelta = (base, handleIndex, delta) => {
|
|
120
|
+
if (delta === 0) return [...base];
|
|
121
|
+
const growing = delta > 0 ? handleIndex : handleIndex + 1;
|
|
122
|
+
const step = delta > 0 ? 1 : -1;
|
|
123
|
+
const first = delta > 0 ? handleIndex + 1 : handleIndex;
|
|
124
|
+
const release = (demand) => {
|
|
125
|
+
const next = [...base];
|
|
126
|
+
let taken = 0;
|
|
127
|
+
for (let i = first; i >= 0 && i < base.length && taken < demand; i += step) {
|
|
128
|
+
const intended = base[i] - (demand - taken);
|
|
129
|
+
const landing = legalize(i, intended);
|
|
130
|
+
const give = base[i] - landing;
|
|
131
|
+
if (give > 0) {
|
|
132
|
+
next[i] = landing;
|
|
133
|
+
taken += give;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
next,
|
|
138
|
+
taken
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
let released = release(Math.abs(delta));
|
|
142
|
+
let applied = legalize(growing, base[growing] + released.taken) - base[growing];
|
|
143
|
+
if (round(applied) !== round(released.taken)) {
|
|
144
|
+
released = release(Math.max(applied, 0));
|
|
145
|
+
applied = legalize(growing, base[growing] + released.taken) - base[growing];
|
|
146
|
+
}
|
|
147
|
+
if (round(applied) > round(released.taken)) return [...base];
|
|
148
|
+
const next = released.next;
|
|
149
|
+
next[growing] = base[growing] + applied;
|
|
150
|
+
return next;
|
|
151
|
+
};
|
|
152
|
+
/** Write pixel sizes back in the unit each panel declared, so intent survives a resize. */
|
|
153
|
+
const toDeclared = (pixels) => {
|
|
154
|
+
const keys = panels.keys.value;
|
|
155
|
+
const available = availableSize.value;
|
|
156
|
+
const units = keys.map((key, index) => unitOf(declaredOf(key, index)));
|
|
157
|
+
const fractionIndexes = units.flatMap((unit, index) => unit === "fraction" ? [index] : []);
|
|
158
|
+
const fractionPixels = fractionIndexes.reduce((total, index) => total + pixels[index], 0);
|
|
159
|
+
const next = /* @__PURE__ */ new Map();
|
|
160
|
+
keys.forEach((key, index) => {
|
|
161
|
+
const size = pixels[index];
|
|
162
|
+
if (units[index] === "pixels") next.set(key, round(size));
|
|
163
|
+
else if (units[index] === "percent") next.set(key, `${round(available > 0 ? size / available * 100 : 0)}%`);
|
|
164
|
+
else {
|
|
165
|
+
const weight = fractionPixels > 0 ? size / fractionPixels * fractionIndexes.length : 1;
|
|
166
|
+
next.set(key, `${round(weight)}fr`);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
return next;
|
|
170
|
+
};
|
|
171
|
+
const sizes = computed(() => panels.keys.value.map((key, index) => declaredOf(key, index) ?? "1fr"));
|
|
172
|
+
const commit = (next) => {
|
|
173
|
+
if (!isControlled.value) stored.value = next;
|
|
174
|
+
options.onSizesChange?.(panels.keys.value.map((key) => next.get(key) ?? "1fr"));
|
|
175
|
+
};
|
|
176
|
+
/** The pixel layout a drag measures its deltas against, taken once when the drag opens. */
|
|
177
|
+
let snapshot = [];
|
|
178
|
+
/** What this drag last committed, so a move resolving to the same layout can be dropped. */
|
|
179
|
+
let committed = null;
|
|
180
|
+
const applyPixels = (pixels) => {
|
|
181
|
+
const next = toDeclared(pixels);
|
|
182
|
+
const wasCollapsed = new Set(collapsed.value);
|
|
183
|
+
const shut = /* @__PURE__ */ new Set();
|
|
184
|
+
panels.keys.value.forEach((key, index) => {
|
|
185
|
+
if (!panels.get(key).isCollapsible()) return;
|
|
186
|
+
const { floor, min } = boundsOf(index);
|
|
187
|
+
if (pixels[index] <= floor && floor < min) shut.add(key);
|
|
188
|
+
});
|
|
189
|
+
for (const key of shut) if (!wasCollapsed.has(key)) remembered.set(key, stored.value.get(key) ?? "1fr");
|
|
190
|
+
if (!isSameSet(collapsed.value, shut)) collapsed.value = shut;
|
|
191
|
+
commit(next);
|
|
192
|
+
for (const key of shut) if (!wasCollapsed.has(key)) options.onCollapse?.(key);
|
|
193
|
+
for (const key of wasCollapsed) if (!shut.has(key)) options.onExpand?.(key);
|
|
194
|
+
};
|
|
195
|
+
const resolveNeighbours = (handleKey) => {
|
|
196
|
+
const element = handles.get(handleKey)?.element();
|
|
197
|
+
if (!element) return null;
|
|
198
|
+
const before = panels.keys.value.filter((key) => {
|
|
199
|
+
const panel = panels.get(key)?.element();
|
|
200
|
+
return panel && panel.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING;
|
|
201
|
+
}).length - 1;
|
|
202
|
+
if (before < 0 || before + 1 >= panels.keys.value.length) return null;
|
|
203
|
+
return {
|
|
204
|
+
after: before + 1,
|
|
205
|
+
before
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
const neighbourCache = computed(() => {
|
|
209
|
+
return /* @__PURE__ */ new Map();
|
|
210
|
+
});
|
|
211
|
+
const neighboursOf = (handleKey) => {
|
|
212
|
+
const cache = neighbourCache.value;
|
|
213
|
+
const hit = cache.get(handleKey);
|
|
214
|
+
if (hit !== void 0) return hit;
|
|
215
|
+
const pair = resolveNeighbours(handleKey);
|
|
216
|
+
cache.set(handleKey, pair);
|
|
217
|
+
return pair;
|
|
218
|
+
};
|
|
219
|
+
const collapse = (key) => {
|
|
220
|
+
const panel = panels.get(key);
|
|
221
|
+
if (!panel?.isCollapsible() || collapsed.value.has(key)) return;
|
|
222
|
+
remembered.set(key, stored.value.get(key) ?? panel.size() ?? panel.defaultSize() ?? "1fr");
|
|
223
|
+
collapsed.value = new Set(collapsed.value).add(key);
|
|
224
|
+
options.onCollapse?.(key);
|
|
225
|
+
};
|
|
226
|
+
const expand = (key) => {
|
|
227
|
+
if (!collapsed.value.has(key)) return;
|
|
228
|
+
const next = new Set(collapsed.value);
|
|
229
|
+
next.delete(key);
|
|
230
|
+
collapsed.value = next;
|
|
231
|
+
const panel = panels.get(key);
|
|
232
|
+
const restored = new Map(stored.value);
|
|
233
|
+
restored.set(key, remembered.get(key) ?? panel?.defaultSize() ?? panel?.minSize() ?? "1fr");
|
|
234
|
+
if (!isControlled.value) stored.value = restored;
|
|
235
|
+
options.onExpand?.(key);
|
|
236
|
+
};
|
|
237
|
+
const handleRange = (handleKey) => {
|
|
238
|
+
const pair = neighboursOf(handleKey);
|
|
239
|
+
const base = layout.value;
|
|
240
|
+
if (!pair || base.length === 0) return null;
|
|
241
|
+
return {
|
|
242
|
+
max: resolveDelta(base, pair.before, Number.MAX_SAFE_INTEGER)[pair.before],
|
|
243
|
+
min: resolveDelta(base, pair.before, -Number.MAX_SAFE_INTEGER)[pair.before],
|
|
244
|
+
now: base[pair.before]
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
return {
|
|
248
|
+
availableSize,
|
|
249
|
+
cancelResize: () => {
|
|
250
|
+
if (resizingHandle.value == null) return;
|
|
251
|
+
if (snapshot.length > 0 && !isSameLayout(committed ?? [], snapshot)) applyPixels(snapshot);
|
|
252
|
+
committed = null;
|
|
253
|
+
resizingHandle.value = null;
|
|
254
|
+
options.onResizeEnd?.(sizes.value);
|
|
255
|
+
},
|
|
256
|
+
collapse,
|
|
257
|
+
endResize: () => {
|
|
258
|
+
const wasResizing = resizingHandle.value != null;
|
|
259
|
+
committed = null;
|
|
260
|
+
resizingHandle.value = null;
|
|
261
|
+
if (wasResizing) options.onResizeEnd?.(sizes.value);
|
|
262
|
+
},
|
|
263
|
+
expand,
|
|
264
|
+
getPanel: (key) => panels.get(key),
|
|
265
|
+
getPanelSize,
|
|
266
|
+
handleRange,
|
|
267
|
+
isCollapsed: (key) => collapsed.value.has(key),
|
|
268
|
+
isDisabled,
|
|
269
|
+
layout,
|
|
270
|
+
neighbours: neighboursOf,
|
|
271
|
+
orientation,
|
|
272
|
+
panelKeys: panels.keys,
|
|
273
|
+
registerHandle: handles.register,
|
|
274
|
+
registerPanel: panels.register,
|
|
275
|
+
reset: (keys) => {
|
|
276
|
+
const next = new Map(stored.value);
|
|
277
|
+
const stillShut = new Set(collapsed.value);
|
|
278
|
+
for (const key of keys) {
|
|
279
|
+
next.delete(key);
|
|
280
|
+
stillShut.delete(key);
|
|
281
|
+
remembered.delete(key);
|
|
282
|
+
}
|
|
283
|
+
collapsed.value = stillShut;
|
|
284
|
+
if (!isControlled.value) stored.value = next;
|
|
285
|
+
options.onSizesChange?.(sizes.value);
|
|
286
|
+
},
|
|
287
|
+
resize: (handleKey, totalDelta) => {
|
|
288
|
+
if (resizingHandle.value !== handleKey || snapshot.length === 0) return;
|
|
289
|
+
const pair = neighboursOf(handleKey);
|
|
290
|
+
if (!pair) return;
|
|
291
|
+
const pixels = resolveDelta(snapshot, pair.before, totalDelta);
|
|
292
|
+
if (committed && isSameLayout(committed, pixels)) return;
|
|
293
|
+
committed = pixels;
|
|
294
|
+
applyPixels(pixels);
|
|
295
|
+
},
|
|
296
|
+
resizingHandle: computed(() => resizingHandle.value),
|
|
297
|
+
setAvailableSize: (size) => {
|
|
298
|
+
containerSize.value = size;
|
|
299
|
+
},
|
|
300
|
+
setSizes: (next) => {
|
|
301
|
+
const keyed = /* @__PURE__ */ new Map();
|
|
302
|
+
panels.keys.value.forEach((key, index) => {
|
|
303
|
+
const size = next[index];
|
|
304
|
+
if (size !== void 0) keyed.set(key, size);
|
|
305
|
+
});
|
|
306
|
+
commit(keyed);
|
|
307
|
+
},
|
|
308
|
+
sizes,
|
|
309
|
+
startResize: (handleKey) => {
|
|
310
|
+
snapshot = [...layout.value];
|
|
311
|
+
committed = snapshot;
|
|
312
|
+
resizingHandle.value = handleKey;
|
|
313
|
+
options.onResizeStart?.(sizes.value);
|
|
314
|
+
},
|
|
315
|
+
toggleCollapse: (key) => {
|
|
316
|
+
if (collapsed.value.has(key)) expand(key);
|
|
317
|
+
else collapse(key);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
//#endregion
|
|
322
|
+
export { useSplitterState };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CollectionKey } from "../../composables/use-collection.js";
|
|
2
|
+
import type { SplitterOrientation, SplitterSize } from "./splitter.state.js";
|
|
3
|
+
export interface SplitterLayout {
|
|
4
|
+
sizes: SplitterSize[];
|
|
5
|
+
collapsed: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The layout stored under `id`, or `null` when there is nothing usable there.
|
|
9
|
+
*
|
|
10
|
+
* Validated against the panels actually on screen rather than trusted: a stored layout whose
|
|
11
|
+
* panels no longer match would apply sizes to the wrong ones, which is worse than starting fresh.
|
|
12
|
+
*/
|
|
13
|
+
export declare const readSplitterLayout: (id: string, orientation: SplitterOrientation, keys: CollectionKey[]) => SplitterLayout | null;
|
|
14
|
+
export declare const writeSplitterLayout: (id: string, orientation: SplitterOrientation, keys: CollectionKey[], sizes: SplitterSize[], collapsed: (key: CollectionKey) => boolean) => void;
|
|
15
|
+
export declare const clearSplitterLayout: (id: string) => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/components/splitter/splitter.storage.ts
|
|
2
|
+
var VERSION = 1;
|
|
3
|
+
var keyFor = (id) => `ropav:splitter:${id}`;
|
|
4
|
+
/**
|
|
5
|
+
* Storage can throw rather than merely fail — Safari's private mode raises on access, not only on
|
|
6
|
+
* write — so every call is guarded, and an unreadable store is treated as an empty one.
|
|
7
|
+
*/
|
|
8
|
+
var storage = () => {
|
|
9
|
+
try {
|
|
10
|
+
return typeof window === "undefined" ? null : window.localStorage;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The layout stored under `id`, or `null` when there is nothing usable there.
|
|
17
|
+
*
|
|
18
|
+
* Validated against the panels actually on screen rather than trusted: a stored layout whose
|
|
19
|
+
* panels no longer match would apply sizes to the wrong ones, which is worse than starting fresh.
|
|
20
|
+
*/
|
|
21
|
+
var readSplitterLayout = (id, orientation, keys) => {
|
|
22
|
+
const store = storage();
|
|
23
|
+
if (!store) return null;
|
|
24
|
+
try {
|
|
25
|
+
const raw = store.getItem(keyFor(id));
|
|
26
|
+
if (!raw) return null;
|
|
27
|
+
const parsed = JSON.parse(raw);
|
|
28
|
+
if (parsed?.v !== VERSION || parsed.o !== orientation || !Array.isArray(parsed.p)) return null;
|
|
29
|
+
if (parsed.p.length !== keys.length) return null;
|
|
30
|
+
if (parsed.p.some((panel, index) => panel.k !== String(keys[index]))) return null;
|
|
31
|
+
return {
|
|
32
|
+
collapsed: parsed.p.filter((panel) => panel.c).map((panel) => panel.k),
|
|
33
|
+
sizes: parsed.p.map((panel) => panel.s)
|
|
34
|
+
};
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var writeSplitterLayout = (id, orientation, keys, sizes, collapsed) => {
|
|
40
|
+
const store = storage();
|
|
41
|
+
if (!store) return;
|
|
42
|
+
const layout = {
|
|
43
|
+
o: orientation,
|
|
44
|
+
p: keys.map((key, index) => ({
|
|
45
|
+
...collapsed(key) ? { c: true } : {},
|
|
46
|
+
k: String(key),
|
|
47
|
+
s: sizes[index] ?? "1fr"
|
|
48
|
+
})),
|
|
49
|
+
v: VERSION
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
store.setItem(keyFor(id), JSON.stringify(layout));
|
|
53
|
+
} catch {}
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { readSplitterLayout, writeSplitterLayout };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { CollectionKey } from "../../composables/use-collection.js";
|
|
2
|
+
import type { SplitterOrientation, SplitterSize } from "./splitter.state.js";
|
|
3
|
+
export interface SplitterRootProps {
|
|
4
|
+
class?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Axis the panels are laid out along. A horizontal group puts its panels side by side, which
|
|
7
|
+
* makes each handle a vertical line. @default "horizontal"
|
|
8
|
+
*/
|
|
9
|
+
orientation?: SplitterOrientation;
|
|
10
|
+
/** Every panel's size, in order. Set, a drag reports what it would do rather than doing it. */
|
|
11
|
+
sizes?: SplitterSize[];
|
|
12
|
+
/** Sizes the splitter starts at, when the caller is not controlling them. */
|
|
13
|
+
defaultSizes?: SplitterSize[];
|
|
14
|
+
/**
|
|
15
|
+
* Where the layout is remembered between visits, under `ropav:splitter:<id>` in `localStorage`.
|
|
16
|
+
* Read once after mount, and discarded unless it still matches the panels on screen.
|
|
17
|
+
*/
|
|
18
|
+
autoSaveId?: string;
|
|
19
|
+
/** Suppresses every handle. */
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
/** How far one arrow press moves a handle, in pixels. @default 10 */
|
|
22
|
+
keyboardStep?: number;
|
|
23
|
+
/** How far a shift-arrow press moves a handle, in pixels. @default 50 */
|
|
24
|
+
keyboardLargeStep?: number;
|
|
25
|
+
/** Accessible name, for a splitter with no visible label. */
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
/** Ids of the elements that name the splitter. */
|
|
28
|
+
ariaLabelledby?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SplitterPanelProps {
|
|
31
|
+
class?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Identity of the panel. Falls back to a generated key — but an explicit id is what lets a
|
|
34
|
+
* stored layout survive a panel being added, removed or reordered.
|
|
35
|
+
*/
|
|
36
|
+
id?: CollectionKey;
|
|
37
|
+
/** A size the caller controls. A drag never writes to it. */
|
|
38
|
+
size?: SplitterSize;
|
|
39
|
+
/** The size the panel starts at, and what a double-click on its handle restores. @default "1fr" */
|
|
40
|
+
defaultSize?: SplitterSize;
|
|
41
|
+
/** Smallest size a drag may reach. Cannot be given in `fr`. @default 0 */
|
|
42
|
+
minSize?: SplitterSize;
|
|
43
|
+
/** Largest size a drag may reach. Cannot be given in `fr`. */
|
|
44
|
+
maxSize?: SplitterSize;
|
|
45
|
+
/** Whether dragging past the minimum snaps the panel shut instead of stopping there. */
|
|
46
|
+
isCollapsible?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The size a collapsed panel keeps. `0` takes it out of the layout; `48` leaves an icon rail.
|
|
49
|
+
* Cannot be given in `fr`. @default 0
|
|
50
|
+
*/
|
|
51
|
+
collapsedSize?: SplitterSize;
|
|
52
|
+
}
|
|
53
|
+
export interface SplitterHandleProps {
|
|
54
|
+
class?: string;
|
|
55
|
+
/** Identity of the handle. Falls back to a generated key. */
|
|
56
|
+
id?: CollectionKey;
|
|
57
|
+
/** Disables this handle alone; the splitter being disabled also counts. */
|
|
58
|
+
isDisabled?: boolean;
|
|
59
|
+
/** Whether a double-click puts both neighbours back to their default size. @default true */
|
|
60
|
+
resetOnDoubleClick?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Draws a grip across the middle of the divider, purely decorative — the grab area reaches well
|
|
63
|
+
* past it either way. @default false
|
|
64
|
+
*/
|
|
65
|
+
showGrip?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Accessible name. Declared as `ariaLabel`, not `aria-label`: Vue normalises prop names, so a
|
|
68
|
+
* hyphenated declaration would never be matched. @default "Resize panel"
|
|
69
|
+
*/
|
|
70
|
+
ariaLabel?: string;
|
|
71
|
+
/** Ids of the elements that name the handle. */
|
|
72
|
+
ariaLabelledby?: string;
|
|
73
|
+
}
|
|
74
|
+
/** State the root hands to its slot. */
|
|
75
|
+
export interface SplitterSlotProps {
|
|
76
|
+
orientation: SplitterOrientation;
|
|
77
|
+
/** Every panel's resolved size, in pixels and in order. Empty until the container is measured. */
|
|
78
|
+
layout: number[];
|
|
79
|
+
isDragging: boolean;
|
|
80
|
+
isDisabled: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** State a panel hands to its slot. */
|
|
83
|
+
export interface SplitterPanelSlotProps {
|
|
84
|
+
/** The panel's resolved size in pixels, or `0` before the container has been measured. */
|
|
85
|
+
size: number;
|
|
86
|
+
isCollapsed: boolean;
|
|
87
|
+
isCollapsible: boolean;
|
|
88
|
+
orientation: SplitterOrientation;
|
|
89
|
+
}
|
|
90
|
+
/** State a handle hands to its slot. */
|
|
91
|
+
export interface SplitterHandleSlotProps {
|
|
92
|
+
isDragging: boolean;
|
|
93
|
+
isHovered: boolean;
|
|
94
|
+
isFocused: boolean;
|
|
95
|
+
isFocusVisible: boolean;
|
|
96
|
+
isDisabled: boolean;
|
|
97
|
+
orientation: SplitterOrientation;
|
|
98
|
+
}
|
|
@@ -19,7 +19,7 @@ var switch_content_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
|
|
|
19
19
|
const setInputEl = (element) => {
|
|
20
20
|
inputEl.value = element instanceof HTMLInputElement ? element : null;
|
|
21
21
|
};
|
|
22
|
-
useFormReset(inputEl, defaultSelected, setSelected);
|
|
22
|
+
useFormReset(inputEl, defaultSelected, setSelected, form);
|
|
23
23
|
watch([inputEl, isSelected], ([input, selected]) => setFormChecked(input, selected), {
|
|
24
24
|
flush: "post",
|
|
25
25
|
immediate: true
|
|
@@ -100,10 +100,10 @@ export declare const Table: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
100
100
|
allowsSorting?: boolean;
|
|
101
101
|
id?: import("../../index.js").CollectionKey;
|
|
102
102
|
isRowHeader?: boolean;
|
|
103
|
-
width?: import("
|
|
104
|
-
defaultWidth?: import("
|
|
105
|
-
minWidth?: import("
|
|
106
|
-
maxWidth?: import("
|
|
103
|
+
width?: import("./use-table-column-layout.js").TableColumnSize;
|
|
104
|
+
defaultWidth?: import("./use-table-column-layout.js").TableColumnSize;
|
|
105
|
+
minWidth?: import("./use-table-column-layout.js").TableColumnSize;
|
|
106
|
+
maxWidth?: import("./use-table-column-layout.js").TableColumnSize;
|
|
107
107
|
} & (typeof globalThis extends {
|
|
108
108
|
__VLS_PROPS_FALLBACK: infer P;
|
|
109
109
|
} ? P : {});
|
|
@@ -323,13 +323,13 @@ export declare const Table: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
323
323
|
slots: {
|
|
324
324
|
default?: () => unknown;
|
|
325
325
|
};
|
|
326
|
-
emit: ((evt: "resize", widths: Map<import("../../index.js").CollectionKey, import("../../
|
|
326
|
+
emit: ((evt: "resize", widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => void) & ((evt: "resizeEnd", widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => void) & ((evt: "resizeStart", widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => void);
|
|
327
327
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
|
|
328
328
|
props: import('vue').PublicProps & {
|
|
329
329
|
class?: string;
|
|
330
|
-
onResize?: ((widths: Map<import("../../index.js").CollectionKey, import("../../
|
|
331
|
-
onResizeEnd?: ((widths: Map<import("../../index.js").CollectionKey, import("../../
|
|
332
|
-
onResizeStart?: ((widths: Map<import("../../index.js").CollectionKey, import("../../
|
|
330
|
+
onResize?: ((widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => any) | undefined;
|
|
331
|
+
onResizeEnd?: ((widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => any) | undefined;
|
|
332
|
+
onResizeStart?: ((widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => any) | undefined;
|
|
333
333
|
} & (typeof globalThis extends {
|
|
334
334
|
__VLS_PROPS_FALLBACK: infer P;
|
|
335
335
|
} ? P : {});
|
|
@@ -338,7 +338,7 @@ export declare const Table: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
338
338
|
slots: {
|
|
339
339
|
default?: () => unknown;
|
|
340
340
|
};
|
|
341
|
-
emit: ((evt: "resize", widths: Map<import("../../index.js").CollectionKey, import("../../
|
|
341
|
+
emit: ((evt: "resize", widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => void) & ((evt: "resizeEnd", widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => void) & ((evt: "resizeStart", widths: Map<import("../../index.js").CollectionKey, import("../../utils/flex-sizing.js").FlexSize>) => void);
|
|
342
342
|
}>) => import('vue').VNode & {
|
|
343
343
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
344
344
|
};
|
|
@@ -458,5 +458,6 @@ export declare const Table: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
458
458
|
};
|
|
459
459
|
export { TableRoot, TableScrollContainer, TableResizableContainer, TableContent, TableHeader, TableColumn, TableColumnResizer, TableBody, TableRow, TableCell, TableExpandTrigger, TableDragHandle, TableDropIndicator, TableFooter, TableLoadMore, TableLoadMoreContent, TableSelectionCheckbox, TableSortableColumnHeader, };
|
|
460
460
|
export type { TableRootProps, TableRootProps as TableProps, TableScrollContainerProps, TableResizableContainerProps, TableContentProps, TableHeaderProps, TableHeaderSlotProps, TableColumnProps, TableColumnResizerProps, TableBodyProps, TableRowProps, TableCellProps, TableCellSlotProps, TableDragHandleProps, TableDropIndicatorProps, TableFooterProps, TableLoadMoreProps, TableLoadMoreContentProps, TableSelectionCheckboxProps, TableSortableColumnHeaderProps, TableColumnSlotProps, TableRowSlotProps, TableSortDescriptor, TableSortDirection, } from "./table.types.js";
|
|
461
|
+
export type { TableColumnSize } from "./use-table-column-layout.js";
|
|
461
462
|
export { tableVariants } from "@ropav/styles";
|
|
462
463
|
export type { TableVariants } from "@ropav/styles";
|
|
@@ -19,6 +19,11 @@ var table_body_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PUR
|
|
|
19
19
|
const { collection, dropState } = useTableGridContext();
|
|
20
20
|
const virtualizer = useTableVirtualizerContext();
|
|
21
21
|
/**
|
|
22
|
+
* The rows are keyed by the slot the virtualizer hands them rather than by their own key, so a
|
|
23
|
+
* window that moved keeps its elements and changes what they show. Everything a row derives from
|
|
24
|
+
* its item — its key, its registrations, its drag target — has to follow the item for that to
|
|
25
|
+
* hold, which is the row's side of the bargain.
|
|
26
|
+
*
|
|
22
27
|
* A row node's datum, back as the item type it came in as.
|
|
23
28
|
*
|
|
24
29
|
* `VirtualizerNode.content` is `unknown` on purpose — the virtualizer carries data it never looks
|
|
@@ -58,9 +63,9 @@ var table_body_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PUR
|
|
|
58
63
|
* A windowed body renders its own drop indicators; a plain one leaves them to the caller.
|
|
59
64
|
*
|
|
60
65
|
* Not a second way of doing the same thing — it is the only way. An indicator is positioned
|
|
61
|
-
* against the
|
|
62
|
-
*
|
|
63
|
-
*
|
|
66
|
+
* against the rows it sits between, which makes it their **sibling**, and this is the level that
|
|
67
|
+
* produces them. Markup written in the row slot lands *inside* a row, where an absolute offset
|
|
68
|
+
* would be measured from the wrong origin.
|
|
64
69
|
*/
|
|
65
70
|
const rendersDropIndicators = computed(() => virtualizer != null && dropState != null);
|
|
66
71
|
/** The gap after the last row, which no row's own "before" indicator covers. */
|
|
@@ -81,16 +86,11 @@ var table_body_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PUR
|
|
|
81
86
|
key: _for_item0.value.key,
|
|
82
87
|
type: "item"
|
|
83
88
|
}) });
|
|
84
|
-
}, null,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
index: () => _for_item0.value.node?.index,
|
|
90
|
-
item: () => itemOf(_for_item0.value.node)
|
|
91
|
-
}, null, 36);
|
|
92
|
-
}, { _: 8 }))];
|
|
93
|
-
}, (view) => view.key, 32), createIf(() => rendersDropIndicators.value && lastRowKey.value != null, () => {
|
|
89
|
+
}, null, 138), createSlot("default", {
|
|
90
|
+
index: () => _for_item0.value.node?.index,
|
|
91
|
+
item: () => itemOf(_for_item0.value.node)
|
|
92
|
+
}, null, 20)];
|
|
93
|
+
}, (view) => view.slot, 32), createIf(() => rendersDropIndicators.value && lastRowKey.value != null, () => {
|
|
94
94
|
return createComponent(table_drop_indicator_default, { target: () => ({
|
|
95
95
|
dropPosition: "after",
|
|
96
96
|
key: lastRowKey.value,
|