@snowui-design-system/components 0.3.0-alpha.2 → 0.3.0-alpha.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/dist/client/blocks/Sidebar.js +56 -41
- package/dist/client/blocks/SidebarSection.js +3 -1
- package/dist/client/components/BarChart.js +1 -1
- package/dist/client/components/Breadcrumb.js +17 -11
- package/dist/client/components/CircularChart.js +2 -2
- package/dist/client/components/CodeBlock.js +278 -225
- package/dist/client/components/CopyButton.js +5 -2
- package/dist/client/components/ExpandButton.js +10 -3
- package/dist/client/components/Frame.js +15 -9
- package/dist/client/components/GaugeChart.js +2 -2
- package/dist/client/components/ImageViewer.js +51 -27
- package/dist/client/components/Indicator.js +5 -3
- package/dist/client/components/Input.js +27 -17
- package/dist/client/components/LineChart.js +1 -1
- package/dist/client/components/Link.d.ts +1 -1
- package/dist/client/components/Link.js +43 -22
- package/dist/client/components/Listbox.js +26 -15
- package/dist/client/components/OverflowAction.d.ts +2 -0
- package/dist/client/components/OverflowAction.js +146 -65
- package/dist/client/components/OverflowActions.d.ts +2 -0
- package/dist/client/components/OverflowActions.js +67 -16
- package/dist/client/components/Pagination.js +71 -48
- package/dist/client/components/Select.js +29 -18
- package/dist/client/components/SidePanel.js +76 -50
- package/dist/client/components/Tab.js +30 -31
- package/dist/client/components/TableBody.js +10 -4
- package/dist/client/components/TableCell.js +57 -32
- package/dist/client/components/TableHead.js +69 -38
- package/dist/client/components/TableToolbar.js +112 -79
- package/dist/client/components/Text.js +99 -59
- package/dist/client/components/Textarea.js +7 -1
- package/dist/client/components/Toast.js +8 -1
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +114 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/lib/number-format.js +6 -0
- package/dist/client/lib/progressive-blur.d.ts +13 -0
- package/dist/client/lib/progressive-blur.js +54 -0
- package/dist/client/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/client/logic/ComponentPartsBoundary.js +15 -0
- package/dist/client/logic/overflow-actions.d.ts +3 -2
- package/dist/client/styles/layout.css +12 -2
- package/dist/server/blocks/Sidebar.js +19 -5
- package/dist/server/blocks/SidebarSection.js +3 -1
- package/dist/server/components/BarChart.js +1 -1
- package/dist/server/components/Breadcrumb.js +9 -2
- package/dist/server/components/CircularChart.js +2 -2
- package/dist/server/components/CodeBlock.js +25 -13
- package/dist/server/components/CopyButton.js +6 -2
- package/dist/server/components/ExpandButton.js +7 -3
- package/dist/server/components/Frame.js +10 -3
- package/dist/server/components/GaugeChart.js +2 -2
- package/dist/server/components/ImageViewer.js +6 -3
- package/dist/server/components/Indicator.js +5 -3
- package/dist/server/components/Input.js +14 -17
- package/dist/server/components/LineChart.js +1 -1
- package/dist/server/components/Link.d.ts +1 -1
- package/dist/server/components/Link.js +20 -3
- package/dist/server/components/Listbox.js +17 -4
- package/dist/server/components/OverflowAction.d.ts +2 -0
- package/dist/server/components/OverflowAction.js +70 -26
- package/dist/server/components/OverflowActions.d.ts +2 -0
- package/dist/server/components/OverflowActions.js +49 -14
- package/dist/server/components/Pagination.js +21 -10
- package/dist/server/components/Select.js +23 -11
- package/dist/server/components/SidePanel.js +28 -8
- package/dist/server/components/Tab.js +61 -52
- package/dist/server/components/TableBody.js +9 -2
- package/dist/server/components/TableCell.js +28 -7
- package/dist/server/components/TableHead.js +31 -7
- package/dist/server/components/TableToolbar.js +57 -30
- package/dist/server/components/Text.js +46 -10
- package/dist/server/components/Textarea.js +4 -1
- package/dist/server/components/Toast.js +4 -1
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +114 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/lib/number-format.js +6 -0
- package/dist/server/lib/progressive-blur.d.ts +13 -0
- package/dist/server/lib/progressive-blur.js +54 -0
- package/dist/server/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/server/logic/ComponentPartsBoundary.js +12 -0
- package/dist/server/logic/overflow-actions.d.ts +3 -2
- package/dist/server/styles/layout.css +12 -2
- package/package.json +4 -3
|
@@ -13,6 +13,8 @@ import { getTableRowContext } from "../lib/table-row-context.js";
|
|
|
13
13
|
import { SKELETON_CONTEXT_KEY } from "../keys.js";
|
|
14
14
|
import { tableSelectionFade } from "../lib/table-selection-fade.js";
|
|
15
15
|
import { getTableRoleBlurStyles } from "../lib/table-role-blur.js";
|
|
16
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
17
|
+
import { useLocale } from "../i18n/locale.js";
|
|
16
18
|
import { mergeComponentPartProps, useComponentPart } from "../logic/component-parts.js";
|
|
17
19
|
|
|
18
20
|
const actionsFadeMask = createEdgeFadeMaskImage({
|
|
@@ -90,16 +92,23 @@ export default function TableCell($$anchor, $$props) {
|
|
|
90
92
|
|
|
91
93
|
var node_3 = $.sibling(span_2, 2);
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
{
|
|
96
|
+
let $0 = $.derived(() => localeContext.t("tableCell.selectRow"));
|
|
97
|
+
|
|
98
|
+
Checkbox(node_3, {
|
|
99
|
+
get checked() {
|
|
100
|
+
return $.get(isSelected);
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
get ariaLabel() {
|
|
104
|
+
return $.get($0);
|
|
105
|
+
},
|
|
106
|
+
onclick: (event) => event.stopPropagation(),
|
|
107
|
+
onCheckedChange: (checked) => {
|
|
108
|
+
if ($.get(rowId) !== undefined) table.setRowSelected($.get(rowId), checked);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
103
112
|
|
|
104
113
|
$.reset(span_1);
|
|
105
114
|
$.bind_this(span_1, ($$value) => $.set(roleOverlayElement, $$value), () => $.get(roleOverlayElement));
|
|
@@ -136,11 +145,16 @@ export default function TableCell($$anchor, $$props) {
|
|
|
136
145
|
|
|
137
146
|
{
|
|
138
147
|
var consequent_3 = ($$anchor) => {
|
|
139
|
-
|
|
140
|
-
|
|
148
|
+
ComponentPartsBoundary($$anchor, {
|
|
149
|
+
children: ($$anchor, $$slotProps) => {
|
|
150
|
+
var fragment_3 = $.comment();
|
|
151
|
+
var node_5 = $.first_child(fragment_3);
|
|
141
152
|
|
|
142
|
-
|
|
143
|
-
|
|
153
|
+
$.snippet(node_5, () => $.get(children));
|
|
154
|
+
$.append($$anchor, fragment_3);
|
|
155
|
+
},
|
|
156
|
+
$$slots: { default: true }
|
|
157
|
+
});
|
|
144
158
|
};
|
|
145
159
|
|
|
146
160
|
var consequent_4 = ($$anchor) => {
|
|
@@ -197,11 +211,16 @@ export default function TableCell($$anchor, $$props) {
|
|
|
197
211
|
|
|
198
212
|
{
|
|
199
213
|
var consequent_6 = ($$anchor) => {
|
|
200
|
-
|
|
201
|
-
|
|
214
|
+
ComponentPartsBoundary($$anchor, {
|
|
215
|
+
children: ($$anchor, $$slotProps) => {
|
|
216
|
+
var fragment_6 = $.comment();
|
|
217
|
+
var node_7 = $.first_child(fragment_6);
|
|
202
218
|
|
|
203
|
-
|
|
204
|
-
|
|
219
|
+
$.snippet(node_7, () => $.get(children));
|
|
220
|
+
$.append($$anchor, fragment_6);
|
|
221
|
+
},
|
|
222
|
+
$$slots: { default: true }
|
|
223
|
+
});
|
|
205
224
|
};
|
|
206
225
|
|
|
207
226
|
$.if(node_6, ($$render) => {
|
|
@@ -215,8 +234,8 @@ export default function TableCell($$anchor, $$props) {
|
|
|
215
234
|
var consequent_9 = ($$anchor) => {
|
|
216
235
|
Tooltip($$anchor, {
|
|
217
236
|
children: ($$anchor, $$slotProps) => {
|
|
218
|
-
var
|
|
219
|
-
var node_9 = $.first_child(
|
|
237
|
+
var fragment_8 = $.comment();
|
|
238
|
+
var node_9 = $.first_child(fragment_8);
|
|
220
239
|
|
|
221
240
|
{
|
|
222
241
|
var consequent_7 = ($$anchor) => {
|
|
@@ -227,11 +246,16 @@ export default function TableCell($$anchor, $$props) {
|
|
|
227
246
|
};
|
|
228
247
|
|
|
229
248
|
var consequent_8 = ($$anchor) => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
249
|
+
ComponentPartsBoundary($$anchor, {
|
|
250
|
+
children: ($$anchor, $$slotProps) => {
|
|
251
|
+
var fragment_11 = $.comment();
|
|
252
|
+
var node_10 = $.first_child(fragment_11);
|
|
253
|
+
|
|
254
|
+
$.snippet(node_10, () => $.get(tooltip));
|
|
255
|
+
$.append($$anchor, fragment_11);
|
|
256
|
+
},
|
|
257
|
+
$$slots: { default: true }
|
|
258
|
+
});
|
|
235
259
|
};
|
|
236
260
|
|
|
237
261
|
var alternate = ($$anchor) => {
|
|
@@ -246,7 +270,7 @@ export default function TableCell($$anchor, $$props) {
|
|
|
246
270
|
});
|
|
247
271
|
}
|
|
248
272
|
|
|
249
|
-
$.append($$anchor,
|
|
273
|
+
$.append($$anchor, fragment_8);
|
|
250
274
|
},
|
|
251
275
|
$$slots: { default: true }
|
|
252
276
|
});
|
|
@@ -284,6 +308,7 @@ export default function TableCell($$anchor, $$props) {
|
|
|
284
308
|
$.append($$anchor, fragment);
|
|
285
309
|
};
|
|
286
310
|
|
|
311
|
+
const localeContext = useLocale();
|
|
287
312
|
const inheritedTableCellPart = useComponentPart("TableCell");
|
|
288
313
|
let explicitProps = $.rest_props($$props, rest_excludes);
|
|
289
314
|
|
|
@@ -586,13 +611,13 @@ export default function TableCell($$anchor, $$props) {
|
|
|
586
611
|
: undefined);
|
|
587
612
|
|
|
588
613
|
const useSemanticFastPath = $.derived(() => !$.get(skeleton) && !$.get(isSelectionRole) && !$.get(isActionsRole) && $.get(resolvedWhileAppear) === undefined && $.get(userCurrentState) === undefined && $.get(parts) === undefined && parentSkeletonContext === undefined && !$.get(enableResponsive) && !$.get(enableContext) && !$.get(enableScaleObserver) && Object.keys($.get(rest)).length === 0);
|
|
589
|
-
var
|
|
590
|
-
var node_11 = $.first_child(
|
|
614
|
+
var fragment_13 = $.comment();
|
|
615
|
+
var node_11 = $.first_child(fragment_13);
|
|
591
616
|
|
|
592
617
|
{
|
|
593
618
|
var consequent_11 = ($$anchor) => {
|
|
594
|
-
var
|
|
595
|
-
var node_12 = $.first_child(
|
|
619
|
+
var fragment_14 = $.comment();
|
|
620
|
+
var node_12 = $.first_child(fragment_14);
|
|
596
621
|
|
|
597
622
|
{
|
|
598
623
|
var consequent_10 = ($$anchor) => {
|
|
@@ -690,7 +715,7 @@ export default function TableCell($$anchor, $$props) {
|
|
|
690
715
|
});
|
|
691
716
|
}
|
|
692
717
|
|
|
693
|
-
$.append($$anchor,
|
|
718
|
+
$.append($$anchor, fragment_14);
|
|
694
719
|
};
|
|
695
720
|
|
|
696
721
|
$.if(node_11, ($$render) => {
|
|
@@ -698,6 +723,6 @@ export default function TableCell($$anchor, $$props) {
|
|
|
698
723
|
});
|
|
699
724
|
}
|
|
700
725
|
|
|
701
|
-
$.append($$anchor,
|
|
726
|
+
$.append($$anchor, fragment_13);
|
|
702
727
|
$.pop();
|
|
703
728
|
}
|
|
@@ -8,6 +8,8 @@ import Checkbox from "./Checkbox.js";
|
|
|
8
8
|
import { getTableContext } from "../lib/table-context.js";
|
|
9
9
|
import { tableSelectionFade } from "../lib/table-selection-fade.js";
|
|
10
10
|
import { getTableRoleBlurStyles } from "../lib/table-role-blur.js";
|
|
11
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
12
|
+
import { useLocale } from "../i18n/locale.js";
|
|
11
13
|
|
|
12
14
|
var rest_excludes = new Set([
|
|
13
15
|
'$$slots',
|
|
@@ -56,6 +58,8 @@ export default function TableHead($$anchor, $$props) {
|
|
|
56
58
|
$.append_styles($$anchor, $$css);
|
|
57
59
|
|
|
58
60
|
// SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
|
|
61
|
+
const localeContext = useLocale();
|
|
62
|
+
|
|
59
63
|
function columnScope(node) {
|
|
60
64
|
node.setAttribute("scope", "col");
|
|
61
65
|
}
|
|
@@ -297,17 +301,24 @@ export default function TableHead($$anchor, $$props) {
|
|
|
297
301
|
|
|
298
302
|
var node_3 = $.sibling(span_1, 2);
|
|
299
303
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return $.get(selectionState).all;
|
|
303
|
-
},
|
|
304
|
+
{
|
|
305
|
+
let $0 = $.derived(() => localeContext.t("tableHead.selectAll"));
|
|
304
306
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
307
|
+
Checkbox(node_3, {
|
|
308
|
+
get checked() {
|
|
309
|
+
return $.get(selectionState).all;
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
get indeterminate() {
|
|
313
|
+
return $.get(selectionState).some;
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
get ariaLabel() {
|
|
317
|
+
return $.get($0);
|
|
318
|
+
},
|
|
319
|
+
onCheckedChange: (checked) => table.setAllRowsSelected(checked)
|
|
320
|
+
});
|
|
321
|
+
}
|
|
311
322
|
|
|
312
323
|
$.reset(span);
|
|
313
324
|
|
|
@@ -344,7 +355,17 @@ export default function TableHead($$anchor, $$props) {
|
|
|
344
355
|
|
|
345
356
|
var node_5 = $.sibling(span_4, 2);
|
|
346
357
|
|
|
347
|
-
|
|
358
|
+
ComponentPartsBoundary(node_5, {
|
|
359
|
+
children: ($$anchor, $$slotProps) => {
|
|
360
|
+
var fragment_4 = $.comment();
|
|
361
|
+
var node_6 = $.first_child(fragment_4);
|
|
362
|
+
|
|
363
|
+
$.snippet(node_6, () => $$props.children);
|
|
364
|
+
$.append($$anchor, fragment_4);
|
|
365
|
+
},
|
|
366
|
+
$$slots: { default: true }
|
|
367
|
+
});
|
|
368
|
+
|
|
348
369
|
$.reset(span_3);
|
|
349
370
|
$.template_effect(() => $.set_style(span_4, $.get(actionsBlur).containerStyle));
|
|
350
371
|
$.append($$anchor, span_3);
|
|
@@ -361,25 +382,30 @@ export default function TableHead($$anchor, $$props) {
|
|
|
361
382
|
var consequent_6 = ($$anchor) => {
|
|
362
383
|
var button = root_3();
|
|
363
384
|
var span_6 = $.child(button);
|
|
364
|
-
var
|
|
385
|
+
var node_7 = $.child(span_6);
|
|
365
386
|
|
|
366
387
|
{
|
|
367
388
|
var consequent_3 = ($$anchor) => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
389
|
+
ComponentPartsBoundary($$anchor, {
|
|
390
|
+
children: ($$anchor, $$slotProps) => {
|
|
391
|
+
var fragment_6 = $.comment();
|
|
392
|
+
var node_8 = $.first_child(fragment_6);
|
|
393
|
+
|
|
394
|
+
$.snippet(node_8, () => $$props.children);
|
|
395
|
+
$.append($$anchor, fragment_6);
|
|
396
|
+
},
|
|
397
|
+
$$slots: { default: true }
|
|
398
|
+
});
|
|
373
399
|
};
|
|
374
400
|
|
|
375
|
-
$.if(
|
|
401
|
+
$.if(node_7, ($$render) => {
|
|
376
402
|
if ($$props.children) $$render(consequent_3);
|
|
377
403
|
});
|
|
378
404
|
}
|
|
379
405
|
|
|
380
406
|
$.reset(span_6);
|
|
381
407
|
|
|
382
|
-
var
|
|
408
|
+
var node_9 = $.sibling(span_6, 2);
|
|
383
409
|
|
|
384
410
|
{
|
|
385
411
|
var consequent_4 = ($$anchor) => {
|
|
@@ -400,7 +426,7 @@ export default function TableHead($$anchor, $$props) {
|
|
|
400
426
|
});
|
|
401
427
|
};
|
|
402
428
|
|
|
403
|
-
$.if(
|
|
429
|
+
$.if(node_9, ($$render) => {
|
|
404
430
|
if ($.get(isSortActive) && $.get(direction) === "ascending") $$render(consequent_4); else if ($.get(isSortActive) && $.get(direction) === "descending") $$render(consequent_5, 1);
|
|
405
431
|
});
|
|
406
432
|
}
|
|
@@ -413,18 +439,23 @@ export default function TableHead($$anchor, $$props) {
|
|
|
413
439
|
|
|
414
440
|
var alternate = ($$anchor) => {
|
|
415
441
|
var span_7 = root_4();
|
|
416
|
-
var
|
|
442
|
+
var node_10 = $.child(span_7);
|
|
417
443
|
|
|
418
444
|
{
|
|
419
445
|
var consequent_7 = ($$anchor) => {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
446
|
+
ComponentPartsBoundary($$anchor, {
|
|
447
|
+
children: ($$anchor, $$slotProps) => {
|
|
448
|
+
var fragment_10 = $.comment();
|
|
449
|
+
var node_11 = $.first_child(fragment_10);
|
|
450
|
+
|
|
451
|
+
$.snippet(node_11, () => $$props.children);
|
|
452
|
+
$.append($$anchor, fragment_10);
|
|
453
|
+
},
|
|
454
|
+
$$slots: { default: true }
|
|
455
|
+
});
|
|
425
456
|
};
|
|
426
457
|
|
|
427
|
-
$.if(
|
|
458
|
+
$.if(node_10, ($$render) => {
|
|
428
459
|
if ($$props.children) $$render(consequent_7);
|
|
429
460
|
});
|
|
430
461
|
}
|
|
@@ -438,12 +469,12 @@ export default function TableHead($$anchor, $$props) {
|
|
|
438
469
|
});
|
|
439
470
|
}
|
|
440
471
|
|
|
441
|
-
var
|
|
472
|
+
var node_12 = $.sibling(node_2, 2);
|
|
442
473
|
|
|
443
474
|
{
|
|
444
475
|
var consequent_10 = ($$anchor) => {
|
|
445
|
-
var
|
|
446
|
-
var
|
|
476
|
+
var fragment_11 = root_7();
|
|
477
|
+
var node_13 = $.first_child(fragment_11);
|
|
447
478
|
|
|
448
479
|
{
|
|
449
480
|
var consequent_8 = ($$anchor) => {
|
|
@@ -461,12 +492,12 @@ export default function TableHead($$anchor, $$props) {
|
|
|
461
492
|
$.append($$anchor, span_8);
|
|
462
493
|
};
|
|
463
494
|
|
|
464
|
-
$.if(
|
|
495
|
+
$.if(node_13, ($$render) => {
|
|
465
496
|
if ($.get(hasSelectionOverlay)) $$render(consequent_8);
|
|
466
497
|
});
|
|
467
498
|
}
|
|
468
499
|
|
|
469
|
-
var
|
|
500
|
+
var node_14 = $.sibling(node_13, 2);
|
|
470
501
|
|
|
471
502
|
{
|
|
472
503
|
var consequent_9 = ($$anchor) => {
|
|
@@ -484,25 +515,25 @@ export default function TableHead($$anchor, $$props) {
|
|
|
484
515
|
$.append($$anchor, span_10);
|
|
485
516
|
};
|
|
486
517
|
|
|
487
|
-
$.if(
|
|
518
|
+
$.if(node_14, ($$render) => {
|
|
488
519
|
if ($.get(hasActionsOverlay)) $$render(consequent_9);
|
|
489
520
|
});
|
|
490
521
|
}
|
|
491
522
|
|
|
492
|
-
$.append($$anchor,
|
|
523
|
+
$.append($$anchor, fragment_11);
|
|
493
524
|
};
|
|
494
525
|
|
|
495
|
-
$.if(
|
|
526
|
+
$.if(node_12, ($$render) => {
|
|
496
527
|
if (!$.get(isSelectionRole) && !$.get(isActionsRole)) $$render(consequent_10);
|
|
497
528
|
});
|
|
498
529
|
}
|
|
499
530
|
|
|
500
|
-
var
|
|
531
|
+
var node_15 = $.sibling(node_12, 2);
|
|
501
532
|
|
|
502
533
|
{
|
|
503
534
|
var consequent_11 = ($$anchor) => {
|
|
504
535
|
{
|
|
505
|
-
let $0 = $.derived(() =>
|
|
536
|
+
let $0 = $.derived(() => localeContext.t("tableHead.resizeColumn", { column: $.get(resolvedColumnId) }));
|
|
506
537
|
|
|
507
538
|
Indicator($$anchor, {
|
|
508
539
|
class: 'snowui-table-head-indicator',
|
|
@@ -533,7 +564,7 @@ export default function TableHead($$anchor, $$props) {
|
|
|
533
564
|
}
|
|
534
565
|
};
|
|
535
566
|
|
|
536
|
-
$.if(
|
|
567
|
+
$.if(node_15, ($$render) => {
|
|
537
568
|
if ($.get(isResizeEnabled) && $.get(resolvedColumnId)) $$render(consequent_11);
|
|
538
569
|
});
|
|
539
570
|
}
|