@snowui-design-system/components 0.3.0-alpha.6 → 0.3.0-alpha.8
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/AGENTS.md +10 -0
- package/LICENSE +31 -14
- package/README.md +21 -3
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/component-catalog.json +26 -0
- package/dist/client/blocks/Sidebar.js +108 -95
- package/dist/client/blocks/SidebarItem.js +26 -12
- package/dist/client/blocks/SidebarSection.js +3 -1
- package/dist/client/blocks/index.js +1 -1
- package/dist/client/compat.js +1 -1
- package/dist/client/components/BarChart.js +9 -2
- package/dist/client/components/Breadcrumb.js +10 -6
- package/dist/client/components/ChartGroup.js +23 -10
- package/dist/client/components/CircularChart.js +8 -1
- package/dist/client/components/DataTable.d.ts +8 -2
- package/dist/client/components/DataTable.js +9 -3
- package/dist/client/components/GaugeChart.js +8 -1
- package/dist/client/components/Image.d.ts +2 -0
- package/dist/client/components/Image.js +14 -2
- package/dist/client/components/Input.js +2 -2
- package/dist/client/components/LineChart.js +9 -2
- package/dist/client/components/Listbox.js +43 -15
- package/dist/client/components/MenuItem.js +7 -1
- package/dist/client/components/OTPInput.d.ts +32 -0
- package/dist/client/components/OTPInput.js +556 -0
- package/dist/client/components/OverflowActions.d.ts +5 -1
- package/dist/client/components/OverflowActions.js +36 -11
- package/dist/client/components/Pagination.js +9 -8
- package/dist/client/components/ScrollArea.js +11 -5
- package/dist/client/components/SearchBox.js +12 -3
- package/dist/client/components/Select.js +3 -1
- package/dist/client/components/SidePanel.js +4 -3
- package/dist/client/components/Slider.js +7 -3
- package/dist/client/components/Spinner.js +9 -2
- package/dist/client/components/Table.js +14 -7
- package/dist/client/components/TableCell.js +33 -11
- package/dist/client/components/Tag.js +8 -1
- package/dist/client/context.js +1 -1
- package/dist/client/dev.js +1 -1
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +55 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +3 -1
- package/dist/client/internal/code-block/prettier-svelte.d.ts +1 -1
- package/dist/client/internal/component-icon/index.js +1 -1
- package/dist/client/internal/snow-ui-logo/emoji-metrics.js +1 -1
- package/dist/client/keys.d.ts +1 -0
- package/dist/client/keys.js +2 -1
- package/dist/client/lib/adaptive-contrast-renderer.js +1 -1
- package/dist/client/lib/chart/appearance-timeline.js +1 -1
- package/dist/client/lib/chart/arc-path.js +1 -1
- package/dist/client/lib/chart/colors.js +1 -1
- package/dist/client/lib/chart/size.js +1 -1
- package/dist/client/lib/clipboard.js +1 -1
- package/dist/client/lib/color.js +1 -1
- package/dist/client/lib/date-format.js +1 -1
- package/dist/client/lib/edge-fade.js +1 -1
- package/dist/client/lib/media-loading.d.ts +7 -0
- package/dist/client/lib/media-loading.js +12 -0
- package/dist/client/lib/number-format.js +1 -1
- package/dist/client/lib/overflow-actions-motion.js +1 -1
- package/dist/client/lib/overlay-trigger-timing.js +1 -1
- package/dist/client/lib/responsive-exit.js +1 -1
- package/dist/client/lib/search-filter.js +1 -1
- package/dist/client/lib/side-panel.js +1 -1
- package/dist/client/lib/split-pane.js +1 -1
- package/dist/client/lib/table-column-motion.js +1 -1
- package/dist/client/lib/table-context.d.ts +5 -0
- package/dist/client/lib/table-context.js +4 -1
- package/dist/client/lib/table-responsive.d.ts +1 -1
- package/dist/client/lib/table-responsive.js +40 -8
- package/dist/client/lib/table-selection-fade.js +1 -1
- package/dist/client/lib/table-truncation.js +1 -1
- package/dist/client/lib/text-motion/animation.js +1 -1
- package/dist/client/lib/text-motion/character.js +1 -1
- package/dist/client/lib/text-motion/color.js +1 -1
- package/dist/client/lib/text-motion/layout.js +1 -1
- package/dist/client/lib/text-motion/preference.js +1 -1
- package/dist/client/lib/text-motion/sequence.js +1 -1
- package/dist/client/lib/text-motion/typography.js +1 -1
- package/dist/client/lib/tooltip-delay.js +1 -1
- package/dist/client/lib/tooltip-motion-dismiss.js +1 -1
- package/dist/client/lib/tooltip-pointer-speed.js +1 -1
- package/dist/client/lib/truncate.js +1 -1
- package/dist/client/logic/frame-field-control.js +1 -1
- package/dist/client/logic/frame-motion-defaults.js +1 -1
- package/dist/client/logic/frame-prop-filter.js +1 -1
- package/dist/client/logic/geometry-cache.js +1 -1
- package/dist/client/logic/layout-flip.js +1 -1
- package/dist/client/logic/morph.js +1 -1
- package/dist/client/logic/motion-engine.js +1 -1
- package/dist/client/logic/motion-orchestration.js +1 -1
- package/dist/client/logic/motion-types.js +1 -1
- package/dist/client/logic/overflow-actions.d.ts +8 -0
- package/dist/client/logic/overflow-actions.js +5 -0
- package/dist/client/logic/wc-adapter.js +1 -1
- package/dist/client/motion/bridge.js +1 -1
- package/dist/client/motion/content-crossfade.js +1 -1
- package/dist/client/motion/expand.js +1 -1
- package/dist/client/motion/fade-in.js +1 -1
- package/dist/client/motion/fade-out.js +1 -1
- package/dist/client/motion/morph.js +1 -1
- package/dist/client/motion/move.js +1 -1
- package/dist/client/motion/number.js +1 -1
- package/dist/client/motion/replace.js +1 -1
- package/dist/client/motion/rotate.css +1 -1
- package/dist/client/motion/rotate.js +1 -1
- package/dist/client/motion/scale-in.js +1 -1
- package/dist/client/motion/tokens.js +1 -1
- package/dist/client/motion/while-2xl.js +1 -1
- package/dist/client/motion/while-active.js +1 -1
- package/dist/client/motion/while-appear.js +1 -1
- package/dist/client/motion/while-click.js +1 -1
- package/dist/client/motion/while-collapsed.js +1 -1
- package/dist/client/motion/while-disabled.js +1 -1
- package/dist/client/motion/while-disappear.js +1 -1
- package/dist/client/motion/while-drag.js +1 -1
- package/dist/client/motion/while-editing.js +1 -1
- package/dist/client/motion/while-expanded.js +1 -1
- package/dist/client/motion/while-focus.js +1 -1
- package/dist/client/motion/while-hover.js +1 -1
- package/dist/client/motion/while-idle.js +1 -1
- package/dist/client/motion/while-key.js +1 -1
- package/dist/client/motion/while-lg.js +1 -1
- package/dist/client/motion/while-load.js +1 -1
- package/dist/client/motion/while-md.js +1 -1
- package/dist/client/motion/while-reload.js +1 -1
- package/dist/client/motion/while-scroll.js +1 -1
- package/dist/client/motion/while-sm.js +1 -1
- package/dist/client/motion/while-uploading.js +1 -1
- package/dist/client/motion/while-validating.js +1 -1
- package/dist/client/motion/while-xl.js +1 -1
- package/dist/client/motion/while-xs.js +1 -1
- package/dist/client/styles/auto-layout.css +1 -1
- package/dist/client/styles/backdrop.css +1 -1
- package/dist/client/styles/components.css +7 -1
- package/dist/client/styles/index.css +1 -1
- package/dist/client/styles/layout.css +13 -3
- package/dist/client/styles/scale.css +1 -1
- package/dist/client/styles/scrollbar.css +1 -1
- package/dist/client/styles/tokens.css +1 -1
- package/dist/client/vite-env.d.ts +1 -1
- package/dist/server/blocks/Sidebar.js +5 -5
- package/dist/server/blocks/SidebarItem.js +4 -2
- package/dist/server/blocks/SidebarSection.js +3 -1
- package/dist/server/blocks/index.js +1 -1
- package/dist/server/compat.js +1 -1
- package/dist/server/components/BarChart.js +5 -2
- package/dist/server/components/Breadcrumb.js +5 -2
- package/dist/server/components/ChartGroup.js +6 -3
- package/dist/server/components/CircularChart.js +4 -1
- package/dist/server/components/DataTable.d.ts +8 -2
- package/dist/server/components/DataTable.js +9 -3
- package/dist/server/components/GaugeChart.js +4 -1
- package/dist/server/components/Image.d.ts +2 -0
- package/dist/server/components/Image.js +11 -4
- package/dist/server/components/Input.js +2 -2
- package/dist/server/components/LineChart.js +5 -2
- package/dist/server/components/Listbox.js +32 -14
- package/dist/server/components/MenuItem.js +4 -1
- package/dist/server/components/OTPInput.d.ts +32 -0
- package/dist/server/components/OTPInput.js +401 -0
- package/dist/server/components/OverflowActions.d.ts +5 -1
- package/dist/server/components/OverflowActions.js +41 -18
- package/dist/server/components/Pagination.js +2 -2
- package/dist/server/components/ScrollArea.js +5 -2
- package/dist/server/components/SearchBox.js +9 -3
- package/dist/server/components/Select.js +3 -1
- package/dist/server/components/SidePanel.js +4 -3
- package/dist/server/components/Slider.js +7 -3
- package/dist/server/components/Spinner.js +4 -2
- package/dist/server/components/Table.js +8 -3
- package/dist/server/components/TableCell.js +31 -11
- package/dist/server/components/Tag.js +4 -1
- package/dist/server/context.js +1 -1
- package/dist/server/dev.js +1 -1
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +55 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +3 -1
- package/dist/server/internal/code-block/prettier-svelte.d.ts +1 -1
- package/dist/server/internal/component-icon/index.js +1 -1
- package/dist/server/internal/snow-ui-logo/emoji-metrics.js +1 -1
- package/dist/server/keys.d.ts +1 -0
- package/dist/server/keys.js +2 -1
- package/dist/server/lib/adaptive-contrast-renderer.js +1 -1
- package/dist/server/lib/chart/appearance-timeline.js +1 -1
- package/dist/server/lib/chart/arc-path.js +1 -1
- package/dist/server/lib/chart/colors.js +1 -1
- package/dist/server/lib/chart/size.js +1 -1
- package/dist/server/lib/clipboard.js +1 -1
- package/dist/server/lib/color.js +1 -1
- package/dist/server/lib/date-format.js +1 -1
- package/dist/server/lib/edge-fade.js +1 -1
- package/dist/server/lib/media-loading.d.ts +7 -0
- package/dist/server/lib/media-loading.js +12 -0
- package/dist/server/lib/number-format.js +1 -1
- package/dist/server/lib/overflow-actions-motion.js +1 -1
- package/dist/server/lib/overlay-trigger-timing.js +1 -1
- package/dist/server/lib/responsive-exit.js +1 -1
- package/dist/server/lib/search-filter.js +1 -1
- package/dist/server/lib/side-panel.js +1 -1
- package/dist/server/lib/split-pane.js +1 -1
- package/dist/server/lib/table-column-motion.js +1 -1
- package/dist/server/lib/table-context.d.ts +5 -0
- package/dist/server/lib/table-context.js +4 -1
- package/dist/server/lib/table-responsive.d.ts +1 -1
- package/dist/server/lib/table-responsive.js +40 -8
- package/dist/server/lib/table-selection-fade.js +1 -1
- package/dist/server/lib/table-truncation.js +1 -1
- package/dist/server/lib/text-motion/animation.js +1 -1
- package/dist/server/lib/text-motion/character.js +1 -1
- package/dist/server/lib/text-motion/color.js +1 -1
- package/dist/server/lib/text-motion/layout.js +1 -1
- package/dist/server/lib/text-motion/preference.js +1 -1
- package/dist/server/lib/text-motion/sequence.js +1 -1
- package/dist/server/lib/text-motion/typography.js +1 -1
- package/dist/server/lib/tooltip-delay.js +1 -1
- package/dist/server/lib/tooltip-motion-dismiss.js +1 -1
- package/dist/server/lib/tooltip-pointer-speed.js +1 -1
- package/dist/server/lib/truncate.js +1 -1
- package/dist/server/logic/frame-field-control.js +1 -1
- package/dist/server/logic/frame-motion-defaults.js +1 -1
- package/dist/server/logic/frame-prop-filter.js +1 -1
- package/dist/server/logic/geometry-cache.js +1 -1
- package/dist/server/logic/layout-flip.js +1 -1
- package/dist/server/logic/morph.js +1 -1
- package/dist/server/logic/motion-engine.js +1 -1
- package/dist/server/logic/motion-orchestration.js +1 -1
- package/dist/server/logic/motion-types.js +1 -1
- package/dist/server/logic/overflow-actions.d.ts +8 -0
- package/dist/server/logic/overflow-actions.js +5 -0
- package/dist/server/logic/wc-adapter.js +1 -1
- package/dist/server/motion/bridge.js +1 -1
- package/dist/server/motion/content-crossfade.js +1 -1
- package/dist/server/motion/expand.js +1 -1
- package/dist/server/motion/fade-in.js +1 -1
- package/dist/server/motion/fade-out.js +1 -1
- package/dist/server/motion/morph.js +1 -1
- package/dist/server/motion/move.js +1 -1
- package/dist/server/motion/number.js +1 -1
- package/dist/server/motion/replace.js +1 -1
- package/dist/server/motion/rotate.css +1 -1
- package/dist/server/motion/rotate.js +1 -1
- package/dist/server/motion/scale-in.js +1 -1
- package/dist/server/motion/tokens.js +1 -1
- package/dist/server/motion/while-2xl.js +1 -1
- package/dist/server/motion/while-active.js +1 -1
- package/dist/server/motion/while-appear.js +1 -1
- package/dist/server/motion/while-click.js +1 -1
- package/dist/server/motion/while-collapsed.js +1 -1
- package/dist/server/motion/while-disabled.js +1 -1
- package/dist/server/motion/while-disappear.js +1 -1
- package/dist/server/motion/while-drag.js +1 -1
- package/dist/server/motion/while-editing.js +1 -1
- package/dist/server/motion/while-expanded.js +1 -1
- package/dist/server/motion/while-focus.js +1 -1
- package/dist/server/motion/while-hover.js +1 -1
- package/dist/server/motion/while-idle.js +1 -1
- package/dist/server/motion/while-key.js +1 -1
- package/dist/server/motion/while-lg.js +1 -1
- package/dist/server/motion/while-load.js +1 -1
- package/dist/server/motion/while-md.js +1 -1
- package/dist/server/motion/while-reload.js +1 -1
- package/dist/server/motion/while-scroll.js +1 -1
- package/dist/server/motion/while-sm.js +1 -1
- package/dist/server/motion/while-uploading.js +1 -1
- package/dist/server/motion/while-validating.js +1 -1
- package/dist/server/motion/while-xl.js +1 -1
- package/dist/server/motion/while-xs.js +1 -1
- package/dist/server/styles/auto-layout.css +1 -1
- package/dist/server/styles/backdrop.css +1 -1
- package/dist/server/styles/components.css +7 -1
- package/dist/server/styles/index.css +1 -1
- package/dist/server/styles/layout.css +13 -3
- package/dist/server/styles/scale.css +1 -1
- package/dist/server/styles/scrollbar.css +1 -1
- package/dist/server/styles/tokens.css +1 -1
- package/dist/server/vite-env.d.ts +1 -1
- package/llms.txt +3 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
import { RESIZE_MOTION } from '../motion/presets/resize.js';
|
|
4
4
|
const contentSelector = ':scope > .snowui-table-cell-content, :scope > .snowui-table-head-content, :scope > .snowui-table-sort';
|
|
@@ -2,6 +2,8 @@ import type { ResourceSize } from "../context";
|
|
|
2
2
|
import type { MotionConfig } from "../logic/motion-config";
|
|
3
3
|
import type { TableTruncationResult } from "./table-truncation";
|
|
4
4
|
import type { OverflowActionsItem } from "../components/OverflowActions.js";
|
|
5
|
+
import type { ComponentProps } from "svelte";
|
|
6
|
+
import type OverflowActions from "../components/OverflowActions.js";
|
|
5
7
|
export type TableSortDirection = "ascending" | "descending";
|
|
6
8
|
export type TableRoleLayout = "auto" | "column" | "overlay";
|
|
7
9
|
export type TableRoleOverlayBlurMode = "progressive" | "uniform";
|
|
@@ -49,6 +51,9 @@ export interface TableContext {
|
|
|
49
51
|
getActionsCompact: () => "auto" | "none";
|
|
50
52
|
getActionsOverflow: () => "all" | "progressive";
|
|
51
53
|
getActionsOverflowFrom: () => "start" | "end";
|
|
54
|
+
getActionsMaxVisible: () => number;
|
|
55
|
+
getActionsProps: () => Pick<ComponentProps<typeof OverflowActions>, "buttonProps" | "parts" | "moreLabel">;
|
|
56
|
+
getActionsContentWidth: () => number | undefined;
|
|
52
57
|
getActionsColumnWidth: () => number;
|
|
53
58
|
getActionsMinWidth: () => number;
|
|
54
59
|
getActionsMaxWidth: () => number;
|
|
@@ -22,8 +22,11 @@ const fallback = {
|
|
|
22
22
|
getRowActions: () => [],
|
|
23
23
|
runRowAction: () => {},
|
|
24
24
|
getActionsCompact: () => "auto",
|
|
25
|
-
getActionsOverflow: () => "
|
|
25
|
+
getActionsOverflow: () => "progressive",
|
|
26
26
|
getActionsOverflowFrom: () => "end",
|
|
27
|
+
getActionsMaxVisible: () => 3,
|
|
28
|
+
getActionsProps: () => ({}),
|
|
29
|
+
getActionsContentWidth: () => undefined,
|
|
27
30
|
getActionsColumnWidth: () => 160,
|
|
28
31
|
getActionsMinWidth: () => 40,
|
|
29
32
|
getActionsMaxWidth: () => 320,
|
|
@@ -3,7 +3,7 @@ interface Options {
|
|
|
3
3
|
horizontalScroll: boolean;
|
|
4
4
|
roleLayout: TableRoleLayout;
|
|
5
5
|
actionsWidth: number;
|
|
6
|
-
onLayout: (layout: "column" | "overlay", actionsWidth: number) => void;
|
|
6
|
+
onLayout: (layout: "column" | "overlay", actionsWidth: number, actionsContentWidth: number) => void;
|
|
7
7
|
}
|
|
8
8
|
/** 表格私有响应式控制器;每表统一测量,不为各 Cell 创建 Observer。 */
|
|
9
9
|
export declare function observeTableResponsive(table: HTMLTableElement, viewport: HTMLElement, initial: Options): {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
import { createResponsiveExit } from "./responsive-exit.js";
|
|
4
4
|
import { createTableColumnMotion } from "./table-column-motion.js";
|
|
@@ -24,6 +24,8 @@ export function observeTableResponsive(table, viewport, initial) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
let measuredActionsWidth = 0;
|
|
27
|
+
let cachedActionsPadding = 0;
|
|
28
|
+
let cachedMoreWidth = 0;
|
|
27
29
|
let complexGrid = false;
|
|
28
30
|
const originalSpans = new WeakMap();
|
|
29
31
|
const renderedSpans = new WeakMap();
|
|
@@ -91,20 +93,50 @@ export function observeTableResponsive(table, viewport, initial) {
|
|
|
91
93
|
const hideable = !complexGrid && !role && !firstData && head.dataset.responsiveHide !== 'false' && head.colSpan === 1;
|
|
92
94
|
if (!role)
|
|
93
95
|
firstData = false;
|
|
94
|
-
return { role, hideable, preferred: preferred[index], minimum: minimum[index] };
|
|
96
|
+
return { role, actions: head.dataset.as === 'actions', hideable, preferred: preferred[index], minimum: minimum[index] };
|
|
95
97
|
});
|
|
98
|
+
measureActionChrome();
|
|
96
99
|
copy.remove();
|
|
97
100
|
}
|
|
101
|
+
function measureActionChrome() {
|
|
102
|
+
const actionCells = Array.from(table.querySelectorAll('.snowui-table-cell[data-as="actions"]'));
|
|
103
|
+
let padding = preferredPadding * 2;
|
|
104
|
+
let moreWidth = 0;
|
|
105
|
+
for (const cell of actionCells) {
|
|
106
|
+
const style = getComputedStyle(cell);
|
|
107
|
+
const content = cell.querySelector('.snowui-table-cell-content[data-actions="true"]');
|
|
108
|
+
const contentStyle = content ? getComputedStyle(content) : undefined;
|
|
109
|
+
padding = Math.max(padding, parseFloat(style.paddingLeft) + parseFloat(style.paddingRight), contentStyle ? parseFloat(contentStyle.paddingLeft) + parseFloat(contentStyle.paddingRight) : 0);
|
|
110
|
+
for (const more of cell.querySelectorAll('.snowui-overflow-actions-more-measure')) {
|
|
111
|
+
moreWidth = Math.max(moreWidth, more.getBoundingClientRect().width);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
cachedActionsPadding = padding;
|
|
115
|
+
cachedMoreWidth = moreWidth;
|
|
116
|
+
}
|
|
98
117
|
function flush() {
|
|
99
118
|
frame = 0;
|
|
100
119
|
if (disposed || !table.isConnected || viewport.clientWidth <= 0)
|
|
101
120
|
return;
|
|
121
|
+
// 菜单存在时保留触发器几何;关闭属性变更会重新进入同一求解入口。
|
|
122
|
+
if (table.querySelector('.snowui-select-button-trigger[aria-expanded="true"]'))
|
|
123
|
+
return;
|
|
102
124
|
if (!columns)
|
|
103
125
|
measureColumns();
|
|
104
126
|
const measured = columns;
|
|
105
127
|
// clientWidth 会取整;慢速拖动时会让 padding 与渐隐每隔 1px 才跳一次。
|
|
106
128
|
// 内部 viewport 无边框及 padding,计算样式保留未受 transform 影响的 CSS 小数宽度。
|
|
107
129
|
const available = parseFloat(getComputedStyle(viewport).width) || viewport.clientWidth;
|
|
130
|
+
const padding = cachedActionsPadding;
|
|
131
|
+
const moreWidth = cachedMoreWidth;
|
|
132
|
+
const protectedWidth = measured.filter(column => !column.role && !column.hideable).reduce((sum, column) => sum + column.minimum, 0);
|
|
133
|
+
const selectionWidth = measured.filter(column => column.role && !column.actions).reduce((sum, column) => sum + column.minimum, 0);
|
|
134
|
+
const floor = moreWidth + padding + fadeDistance;
|
|
135
|
+
const budget = Math.max(floor, Math.min(available * .2, 14 * (parseFloat(getComputedStyle(document.documentElement).fontSize) || 16), options.actionsWidth, Math.max(0, available - protectedWidth - selectionWidth)));
|
|
136
|
+
measuredActionsWidth = budget;
|
|
137
|
+
for (const column of measured)
|
|
138
|
+
if (column.actions)
|
|
139
|
+
column.preferred = column.minimum = budget;
|
|
108
140
|
const full = measured.reduce((sum, column) => sum + column.preferred, 0);
|
|
109
141
|
const layout = options.roleLayout === 'auto' ? (full <= available + 0.5 ? 'column' : 'overlay') : options.roleLayout;
|
|
110
142
|
const included = measured.filter(column => layout === 'column' || !column.role);
|
|
@@ -162,14 +194,14 @@ export function observeTableResponsive(table, viewport, initial) {
|
|
|
162
194
|
table.classList.toggle('snowui-table-responsive-text-fit', textFit);
|
|
163
195
|
// 容器改变时由同一次 CSS 布局同步调整 padding,不能等尺寸回调再补一次位移。
|
|
164
196
|
// 显式固定列宽可能使首选与最小宽度相等,此时保留原来的边界选择。
|
|
165
|
-
const
|
|
197
|
+
const responsivePadding = preferred > minimum
|
|
166
198
|
? `clamp(${minimumPadding}px, calc(${minimumPadding}px + (100cqw - ${minimum}px) * ${(preferredPadding - minimumPadding) / (preferred - minimum)}), ${preferredPadding}px)`
|
|
167
199
|
: `${minimumPadding + (preferredPadding - minimumPadding) * ratio}px`;
|
|
168
200
|
const paddingProperty = '--snowui-table-responsive-cell-padding-inline';
|
|
169
|
-
if (table.style.getPropertyValue(paddingProperty) !==
|
|
170
|
-
table.style.setProperty(paddingProperty,
|
|
201
|
+
if (table.style.getPropertyValue(paddingProperty) !== responsivePadding)
|
|
202
|
+
table.style.setProperty(paddingProperty, responsivePadding);
|
|
171
203
|
table.dataset.responsiveLayout = layout;
|
|
172
|
-
options.onLayout(layout, measuredActionsWidth);
|
|
204
|
+
options.onLayout(layout, measuredActionsWidth, Math.max(moreWidth, budget - padding - fadeDistance));
|
|
173
205
|
for (const row of rows()) {
|
|
174
206
|
let index = 0;
|
|
175
207
|
const visible = [];
|
|
@@ -242,11 +274,11 @@ export function observeTableResponsive(table, viewport, initial) {
|
|
|
242
274
|
originalSpans.set(record.target, record.target.colSpan);
|
|
243
275
|
return true;
|
|
244
276
|
}
|
|
245
|
-
return record.type !== 'attributes' || record.attributeName !== 'style' || (record.target instanceof Element && record.target.matches('th, td'));
|
|
277
|
+
return record.type !== 'attributes' || record.attributeName !== 'style' || (record.target instanceof Element && (record.target.matches('th, td') || record.target.closest('.snowui-overflow-actions-more-measure')));
|
|
246
278
|
}))
|
|
247
279
|
refresh();
|
|
248
280
|
});
|
|
249
|
-
observer.observe(table, { childList: true, characterData: true, subtree: true, attributes: true, attributeOldValue: true, attributeFilter: ['data-responsive-hide', 'data-column-id', 'style', 'colspan', 'rowspan', 'class'] });
|
|
281
|
+
observer.observe(table, { childList: true, characterData: true, subtree: true, attributes: true, attributeOldValue: true, attributeFilter: ['data-responsive-hide', 'data-column-id', 'style', 'colspan', 'rowspan', 'class', 'aria-expanded'] });
|
|
250
282
|
window.addEventListener('resize', refresh);
|
|
251
283
|
table.addEventListener('load', refresh, true);
|
|
252
284
|
document.fonts?.addEventListener('loadingdone', refresh);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
import { createEdgeFadeMaskImage } from "./edge-fade.js";
|
|
4
4
|
import { resizeManager } from "../logic/observer.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
/** 内部连续重定向:逻辑终点与仍在播放的差值分离。 */
|
|
4
4
|
export function animateTextMotionDelta(element, property, from, to, timing) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
import { animateSettledTextMotionColor, animateTextMotionColorSequence, cancelTextMotionColor, } from "./color.js";
|
|
4
4
|
import { cancelTextMotionLayout, flipTextMotionElement, splitTextMotionGraphemes, TEXT_MOTION_LAYOUT_TRANSITION, } from "./layout.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
import { getTextMotionStagger } from "./sequence.js";
|
|
4
4
|
import { resolveTextMotionColor } from "./typography.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
import { TEXT_MOTION_SPACE } from "./sequence.js";
|
|
4
4
|
export const TEXT_MOTION_LAYOUT_TRANSITION = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
export function shouldReduceTextMotion(respectMotionPreference) {
|
|
4
4
|
return (respectMotionPreference &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
import { resolveSnowUIColor } from "../color.js";
|
|
4
4
|
function resolveCssValue(value, numberUnit = "unitless") {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
1
|
+
/* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
|
|
2
2
|
复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
|
|
3
3
|
/** 仅由可见的共享 Tooltip 宿主持有;事件只更新数值,不读布局或驱动渲染。 */
|
|
4
4
|
export function trackTooltipPointerSpeed(document) {
|
|
@@ -22,4 +22,12 @@ export interface OverflowActionsContext {
|
|
|
22
22
|
buttonProps?: Record<string, any>;
|
|
23
23
|
}
|
|
24
24
|
export declare const OVERFLOW_ACTIONS_CONTEXT_KEY: unique symbol;
|
|
25
|
+
/** 宿主只提供布局约束,不接管显式子项的按钮视觉。 */
|
|
26
|
+
export interface OverflowActionsLayoutContext {
|
|
27
|
+
readonly availableWidth: number | undefined;
|
|
28
|
+
readonly maxVisible: number | undefined;
|
|
29
|
+
readonly overflow: "all" | "progressive" | undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare const OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY: unique symbol;
|
|
32
|
+
export declare function getOverflowActionsLayoutContext(): OverflowActionsLayoutContext | undefined;
|
|
25
33
|
export declare function getOverflowActionsContext(): OverflowActionsContext | undefined;
|
|
@@ -3,6 +3,11 @@ import * as $ from 'svelte/internal/server';
|
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
4
|
|
|
5
5
|
export const OVERFLOW_ACTIONS_CONTEXT_KEY = Symbol("snowui-overflow-actions");
|
|
6
|
+
export const OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY = Symbol("snowui-overflow-actions-layout");
|
|
7
|
+
|
|
8
|
+
export function getOverflowActionsLayoutContext() {
|
|
9
|
+
return getContext(OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY);
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
export function getOverflowActionsContext() {
|
|
8
13
|
return getContext(OVERFLOW_ACTIONS_CONTEXT_KEY);
|