wimui 0.67.0 → 0.69.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/_internal/InlineDisclosure.cjs +2 -0
- package/dist/components/_internal/InlineDisclosure.d.ts +22 -0
- package/dist/components/_internal/InlineDisclosure.js +47 -0
- package/dist/components/_internal/inline-disclosure.module.cjs +2 -0
- package/dist/components/_internal/inline-disclosure.module.js +9 -0
- package/dist/components/_internal/useAnnounce.cjs +2 -0
- package/dist/components/_internal/useAnnounce.d.ts +39 -0
- package/dist/components/_internal/useAnnounce.js +41 -0
- package/dist/components/data-display/AvatarGroup/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/AvatarGroup.d.ts +10 -3
- package/dist/components/data-display/AvatarGroup/AvatarGroup.js +55 -27
- package/dist/components/data-display/AvatarGroup/avatar-group.module.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/avatar-group.module.js +8 -6
- package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
- package/dist/components/data-display/Carousel/Carousel.js +61 -65
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +78 -74
- package/dist/components/data-display/DataGrid/useFixedColumns.cjs +1 -1
- package/dist/components/data-display/DataGrid/useFixedColumns.d.ts +6 -1
- package/dist/components/data-display/DataGrid/useFixedColumns.js +22 -17
- package/dist/components/data-display/SelectionBar/SelectionBar.cjs +2 -0
- package/dist/components/data-display/SelectionBar/SelectionBar.d.ts +77 -0
- package/dist/components/data-display/SelectionBar/SelectionBar.js +68 -0
- package/dist/components/data-display/SelectionBar/selection-bar.module.cjs +2 -0
- package/dist/components/data-display/SelectionBar/selection-bar.module.js +10 -0
- package/dist/components/data-display/Table/table.module.cjs +1 -1
- package/dist/components/data-display/Table/table.module.js +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.js +8 -9
- package/dist/components/feedback/Toast/Toast.cjs +1 -1
- package/dist/components/feedback/Toast/Toast.js +60 -71
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.js +4 -4
- package/dist/components/form/Combobox/Combobox.cjs +1 -1
- package/dist/components/form/Combobox/Combobox.js +11 -11
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +4 -4
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.js +13 -18
- package/dist/components/form/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/form/MultiSelect/MultiSelect.js +66 -66
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.js +114 -114
- package/dist/components/form/Transfer/Transfer.cjs +1 -1
- package/dist/components/form/Transfer/Transfer.js +84 -88
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +4 -4
- package/dist/components/layout/OverflowList/OverflowList.cjs +2 -0
- package/dist/components/layout/OverflowList/OverflowList.d.ts +81 -0
- package/dist/components/layout/OverflowList/OverflowList.js +85 -0
- package/dist/components/layout/OverflowList/getVisibleCount.cjs +2 -0
- package/dist/components/layout/OverflowList/getVisibleCount.d.ts +30 -0
- package/dist/components/layout/OverflowList/getVisibleCount.js +26 -0
- package/dist/components/layout/OverflowList/overflow-list.module.cjs +2 -0
- package/dist/components/layout/OverflowList/overflow-list.module.js +10 -0
- package/dist/components/layout/SimpleGrid/SimpleGrid.cjs +1 -1
- package/dist/components/layout/SimpleGrid/SimpleGrid.js +1 -1
- package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.d.ts +15 -0
- package/dist/components/layout/Toolbar/Toolbar.js +85 -60
- package/dist/components/layout/Toolbar/toolbar.module.cjs +1 -1
- package/dist/components/layout/Toolbar/toolbar.module.js +8 -6
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.js +46 -47
- package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +88 -53
- package/dist/components/navigation/Menubar/Menubar.cjs +1 -1
- package/dist/components/navigation/Menubar/Menubar.js +10 -10
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +110 -112
- package/dist/data-display-core.d.ts +1 -0
- package/dist/data-display.cjs +1 -1
- package/dist/data-display.js +2 -1
- package/dist/i18n/generated/components.d.ts +1 -1
- package/dist/i18n/generated/data-display.cjs +1 -1
- package/dist/i18n/generated/data-display.d.ts +1 -1
- package/dist/i18n/generated/data-display.js +30 -3
- package/dist/i18n/generated/keys.d.ts +3 -1
- package/dist/i18n/generated/layout.cjs +2 -0
- package/dist/i18n/generated/layout.d.ts +3 -0
- package/dist/i18n/generated/layout.js +12 -0
- package/dist/i18n/generated/navigation.cjs +2 -0
- package/dist/i18n/generated/navigation.d.ts +3 -0
- package/dist/i18n/generated/navigation.js +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +173 -171
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +1 -0
- package/dist/layout.js +3 -2
- package/dist/llms-full.txt +58 -3
- package/dist/llms.txt +3 -1
- package/dist/locales/en/components.json +3 -1
- package/dist/locales/en/data-display.json +9 -0
- package/dist/locales/ja/components.json +3 -1
- package/dist/locales/ja/data-display.json +9 -0
- package/dist/locales/pt/components.json +3 -1
- package/dist/locales/pt/data-display.json +9 -0
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +38 -35
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../form/Checkbox/Checkbox.cjs"),i=require("../../_internal/useAnnounce.cjs"),a=require("../../navigation/Pagination/Pagination.cjs"),o=require("../Table/Table.cjs"),s=require("./useFixedColumns.cjs"),c=require("./useDataGridKeyboard.cjs"),l=require("./useInfiniteScroll.cjs"),u=require("./datagrid.module.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("classnames");f=e.__toESM(f,1);let p=require("react/jsx-runtime");function m({columns:e,data:m,rowKey:h=`id`,loading:g=!1,striped:_=!1,bordered:v=!1,hoverable:y=!0,stickyHeader:b=!0,height:x,maxHeight:S,emptyMessage:C,mobileCard:w=!1,selection:T,selectedRowKeys:E,onSelectionChange:D,sortConfig:O,onSortChange:k,pagination:A,infiniteScroll:j,className:M,ariaLabel:N,"aria-label":P,"aria-labelledby":F}){let{t:I}=t.useWimTranslation(n.commonNs),L=g!==!1&&g!==void 0,R=g===!0||g===`blocking`,z=(0,d.useMemo)(()=>T?T===!0?{type:`checkbox`,selectedRowKeys:E??[],onChange:(e,t)=>{D?.(e,t)}}:T:null,[T,E,D]),B=d.default.useRef(null),[V,H]=(0,d.useState)(),U=!!z&&e.some(e=>e.fixed===`left`);d.default.useLayoutEffect(()=>{let e=B.current;if(!U||!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>H(e.offsetWidth));return t.observe(e,{box:`border-box`}),()=>t.disconnect()},[U]);let{fixedLeftOffsets:W,fixedRightOffsets:G}=s.useFixedColumns(e,!!z,V),K=(e,t=!1)=>{let n=W[e];if(n)return{stickyLeft:!0,leftOffset:n.offset,stickyZIndex:t?1e3+n.zIndex:n.zIndex,className:(0,f.default)(u.default.cellFixed,n.isLast&&u.default.cellFixedLeftLast)};let r=G[e];return r?{stickyRight:!0,rightOffset:r.offset,stickyZIndex:t?1e3+r.zIndex:r.zIndex,className:(0,f.default)(u.default.cellFixed,r.isFirst&&u.default.cellFixedRightFirst)}:{}},q=(0,d.useCallback)(e=>typeof h==`function`?h(e):e[h],[h]),J=(0,d.useMemo)(()=>!z||m.length===0?!1:m.every(e=>z.selectedRowKeys.includes(q(e))),[m,z,q]),Y=(0,d.useMemo)(()=>z?!J&&m.some(e=>z.selectedRowKeys.includes(q(e))):!1,[m,z,J,q]),X=e=>{if(!z)return;let t=e.target.checked,n=t?m.map(q):[],r=t?m:[];z.onChange(n,r)},Z=(e,t)=>{if(!z)return;let n=t.target.checked,r=q(e),i=n?[...z.selectedRowKeys,r]:z.selectedRowKeys.filter(e=>e!==r),a=m.filter(e=>i.includes(q(e)));z.onChange(i,a)},{focusedCell:Q,handleKeyDown:$,containerRef:ee}=c.useDataGridKeyboard(e,m,!!z),{loaderRef:te}=l.useInfiniteScroll(j),ne=e.length+ +!!z,{announce:re,region:ie}=i.useAnnounce();return(0,p.jsxs)(`div`,{className:(0,f.default)(`wim-data-grid`,u.default.root,R&&u.default.loading,w===`md`?u.default.mobileCardMd:w&&u.default.mobileCard,M),"aria-busy":L||void 0,children:[ie,(0,p.jsxs)(`div`,{className:u.default.container,style:{height:x,maxHeight:S},inert:R||void 0,children:[(0,p.jsxs)(o.Table,{ref:ee,onKeyDown:$,tabIndex:0,role:`grid`,"aria-label":F?void 0:P??N??I(`a11y.data_grid`),"aria-labelledby":F,"aria-rowcount":m.length+1,"aria-colcount":ne,striped:_,bordered:v,hoverable:y,stickyHeader:b,mobileCard:w,fullWidth:!0,className:(0,f.default)(`wim-table`,u.default.table),containerClassName:u.default.tableContainer,children:[(0,p.jsx)(o.Table.Header,{children:(0,p.jsxs)(o.Table.Row,{children:[z&&(0,p.jsx)(o.Table.Head,{ref:B,role:`columnheader`,selection:!0,stickyLeft:!0,leftOffset:0,stickyZIndex:1150,"data-row":-1,"data-col":-1,"aria-label":I(`a11y.select_all_rows`),tabIndex:Q.row===-1&&Q.col===-1?0:-1,children:(z.type??`checkbox`)===`checkbox`&&(0,p.jsx)(r.Checkbox,{checked:J,indeterminate:Y,onChange:X,"aria-label":I(`a11y.select_all_rows`)})}),e.map((e,t)=>{let n=K(e.key,!0);return(0,p.jsx)(o.Table.Head,{role:`columnheader`,style:{width:e.width,minWidth:e.width},sortable:!!(e.sortable&&k),sortDirection:O?.key===e.key?O.direction:`none`,onSort:()=>{if(!e.sortable||!k)return;let t=O?.key===e.key?O.direction===`asc`?`desc`:O.direction===`desc`?`none`:`asc`:`asc`,n=typeof e.title==`string`?e.title:e.key;re(I(t===`asc`?`dataGrid.sorted_ascending`:t===`desc`?`dataGrid.sorted_descending`:`dataGrid.sort_cleared`,{column:n})),k(e.key,t)},...n,tabIndex:Q.row===-1&&Q.col===(z?t+1:t)?0:-1,"data-row":-1,"data-col":z?t+1:t,children:e.title},e.key)})]})}),(0,p.jsx)(o.Table.Body,{children:m.map((t,n)=>{let i=q(t),a=z?.selectedRowKeys.includes(i);return(0,p.jsxs)(o.Table.Row,{selected:a,children:[z&&(0,p.jsx)(o.Table.Cell,{role:`gridcell`,selection:!0,stickyLeft:!0,leftOffset:0,stickyZIndex:150,"data-row":n,"data-col":-1,tabIndex:Q.row===n&&Q.col===-1?0:-1,children:(0,p.jsx)(r.Checkbox,{checked:a,onChange:e=>Z(t,e),"aria-label":I(`a11y.select_row_numbered`,{row:n+1})})}),e.map((e,r)=>{let i=K(e.key,!1),a=t[e.dataIndex??e.key];return(0,p.jsx)(o.Table.Cell,{role:`gridcell`,label:typeof e.title==`string`?e.title:void 0,...i,"data-row":n,"data-col":z?r+1:r,tabIndex:Q.row===n&&Q.col===(z?r+1:r)?0:-1,children:e.maxWidth==null?e.render?e.render(a,t,n):a:(0,p.jsx)(`div`,{style:{maxWidth:e.maxWidth},children:e.render?e.render(a,t,n):a})},e.key)})]},i)})})]}),m.length===0&&C&&(0,p.jsx)(`div`,{role:`status`,className:u.default.empty,children:C}),j?.hasMore&&(0,p.jsx)(`div`,{ref:te,className:u.default.loader,children:j.hasMore&&I(`dataGrid.loading_more`)})]}),A&&(0,p.jsxs)(`div`,{className:u.default.footer,inert:R||void 0,children:[(0,p.jsxs)(`div`,{className:u.default.info,children:[I(`dataGrid.displaying`,{shown:m.length,total:A.total}),z?.selectedRowKeys&&z.selectedRowKeys.length>0&&(0,p.jsx)(`span`,{className:u.default.selectionInfo,children:I(`dataGrid.rows_selected`,{selected:z.selectedRowKeys.length})})]}),(0,p.jsx)(`div`,{className:u.default.pagination,children:(0,p.jsx)(a.Pagination,{className:u.default.paginationContent,current:A.current,total:A.total,pageSize:A.pageSize,onChange:A.onChange})})]})]})}exports.DataGrid=m;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
3
|
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Checkbox as n } from "../../form/Checkbox/Checkbox.js";
|
|
5
|
+
import { useAnnounce as r } from "../../_internal/useAnnounce.js";
|
|
6
6
|
import { Pagination as i } from "../../navigation/Pagination/Pagination.js";
|
|
7
7
|
import { Table as a } from "../Table/Table.js";
|
|
8
8
|
import { useFixedColumns as o } from "./useFixedColumns.js";
|
|
9
9
|
import { useDataGridKeyboard as s } from "./useDataGridKeyboard.js";
|
|
10
10
|
import { useInfiniteScroll as c } from "./useInfiniteScroll.js";
|
|
11
11
|
import l from "./datagrid.module.js";
|
|
12
|
-
import { useCallback as
|
|
13
|
-
import
|
|
14
|
-
import { jsx as
|
|
12
|
+
import u, { useCallback as d, useMemo as f, useState as p } from "react";
|
|
13
|
+
import m from "classnames";
|
|
14
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
15
15
|
//#region src/components/data-display/DataGrid/DataGrid.tsx
|
|
16
|
-
function
|
|
17
|
-
let { t: z } = e(t), B =
|
|
16
|
+
function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x = !1, bordered: ee = !1, hoverable: S = !0, stickyHeader: C = !0, height: w, maxHeight: T, emptyMessage: E, mobileCard: D = !1, selection: O, selectedRowKeys: k, onSelectionChange: A, sortConfig: j, onSortChange: M, pagination: N, infiniteScroll: P, className: F, ariaLabel: I, "aria-label": L, "aria-labelledby": R }) {
|
|
17
|
+
let { t: z } = e(t), B = b !== !1 && b !== void 0, V = b === !0 || b === "blocking", H = f(() => O ? O === !0 ? {
|
|
18
18
|
type: "checkbox",
|
|
19
19
|
selectedRowKeys: k ?? [],
|
|
20
20
|
onChange: (e, t) => {
|
|
@@ -24,49 +24,52 @@ function g({ columns: g, data: _, rowKey: v = "id", loading: y = !1, striped: b
|
|
|
24
24
|
O,
|
|
25
25
|
k,
|
|
26
26
|
A
|
|
27
|
-
]),
|
|
28
|
-
|
|
27
|
+
]), U = u.useRef(null), [W, G] = p(), K = !!H && _.some((e) => e.fixed === "left");
|
|
28
|
+
u.useLayoutEffect(() => {
|
|
29
|
+
let e = U.current;
|
|
30
|
+
if (!K || !e || typeof ResizeObserver > "u") return;
|
|
31
|
+
let t = new ResizeObserver(() => G(e.offsetWidth));
|
|
32
|
+
return t.observe(e, { box: "border-box" }), () => t.disconnect();
|
|
33
|
+
}, [K]);
|
|
34
|
+
let { fixedLeftOffsets: q, fixedRightOffsets: J } = o(_, !!H, W), Y = (e, t = !1) => {
|
|
35
|
+
let n = q[e];
|
|
29
36
|
if (n) return {
|
|
30
37
|
stickyLeft: !0,
|
|
31
38
|
leftOffset: n.offset,
|
|
32
39
|
stickyZIndex: t ? 1e3 + n.zIndex : n.zIndex,
|
|
33
|
-
className:
|
|
40
|
+
className: m(l.cellFixed, n.isLast && l.cellFixedLeftLast)
|
|
34
41
|
};
|
|
35
|
-
let r =
|
|
42
|
+
let r = J[e];
|
|
36
43
|
return r ? {
|
|
37
44
|
stickyRight: !0,
|
|
38
45
|
rightOffset: r.offset,
|
|
39
46
|
stickyZIndex: t ? 1e3 + r.zIndex : r.zIndex,
|
|
40
|
-
className:
|
|
47
|
+
className: m(l.cellFixed, r.isFirst && l.cellFixedRightFirst)
|
|
41
48
|
} : {};
|
|
42
|
-
},
|
|
43
|
-
|
|
49
|
+
}, X = d((e) => typeof y == "function" ? y(e) : e[y], [y]), Z = f(() => !H || v.length === 0 ? !1 : v.every((e) => H.selectedRowKeys.includes(X(e))), [
|
|
50
|
+
v,
|
|
44
51
|
H,
|
|
45
|
-
|
|
46
|
-
]),
|
|
47
|
-
|
|
52
|
+
X
|
|
53
|
+
]), Q = f(() => H ? !Z && v.some((e) => H.selectedRowKeys.includes(X(e))) : !1, [
|
|
54
|
+
v,
|
|
48
55
|
H,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
]),
|
|
56
|
+
Z,
|
|
57
|
+
X
|
|
58
|
+
]), te = (e) => {
|
|
52
59
|
if (!H) return;
|
|
53
|
-
let t = e.target.checked, n = t ?
|
|
60
|
+
let t = e.target.checked, n = t ? v.map(X) : [], r = t ? v : [];
|
|
54
61
|
H.onChange(n, r);
|
|
55
|
-
},
|
|
62
|
+
}, ne = (e, t) => {
|
|
56
63
|
if (!H) return;
|
|
57
|
-
let n = t.target.checked, r =
|
|
64
|
+
let n = t.target.checked, r = X(e), i = n ? [...H.selectedRowKeys, r] : H.selectedRowKeys.filter((e) => e !== r), a = v.filter((e) => i.includes(X(e)));
|
|
58
65
|
H.onChange(i, a);
|
|
59
|
-
}, { focusedCell:
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
className:
|
|
66
|
+
}, { focusedCell: $, handleKeyDown: re, containerRef: ie } = s(_, v, !!H), { loaderRef: ae } = c(P), oe = _.length + +!!H, { announce: se, region: ce } = r();
|
|
67
|
+
return /* @__PURE__ */ g("div", {
|
|
68
|
+
className: m("wim-data-grid", l.root, V && l.loading, D === "md" ? l.mobileCardMd : D && l.mobileCard, F),
|
|
62
69
|
"aria-busy": B || void 0,
|
|
63
70
|
children: [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"aria-atomic": "true",
|
|
67
|
-
children: ne
|
|
68
|
-
}),
|
|
69
|
-
/* @__PURE__ */ h("div", {
|
|
71
|
+
ce,
|
|
72
|
+
/* @__PURE__ */ g("div", {
|
|
70
73
|
className: l.container,
|
|
71
74
|
style: {
|
|
72
75
|
height: w,
|
|
@@ -74,24 +77,25 @@ function g({ columns: g, data: _, rowKey: v = "id", loading: y = !1, striped: b
|
|
|
74
77
|
},
|
|
75
78
|
inert: V || void 0,
|
|
76
79
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
ref:
|
|
79
|
-
onKeyDown:
|
|
80
|
+
/* @__PURE__ */ g(a, {
|
|
81
|
+
ref: ie,
|
|
82
|
+
onKeyDown: re,
|
|
80
83
|
tabIndex: 0,
|
|
81
84
|
role: "grid",
|
|
82
85
|
"aria-label": R ? void 0 : L ?? I ?? z("a11y.data_grid"),
|
|
83
86
|
"aria-labelledby": R,
|
|
84
|
-
"aria-rowcount":
|
|
85
|
-
"aria-colcount":
|
|
86
|
-
striped:
|
|
87
|
-
bordered:
|
|
87
|
+
"aria-rowcount": v.length + 1,
|
|
88
|
+
"aria-colcount": oe,
|
|
89
|
+
striped: x,
|
|
90
|
+
bordered: ee,
|
|
88
91
|
hoverable: S,
|
|
89
92
|
stickyHeader: C,
|
|
90
93
|
mobileCard: D,
|
|
91
94
|
fullWidth: !0,
|
|
92
|
-
className:
|
|
95
|
+
className: m("wim-table", l.table),
|
|
93
96
|
containerClassName: l.tableContainer,
|
|
94
|
-
children: [/* @__PURE__ */
|
|
97
|
+
children: [/* @__PURE__ */ h(a.Header, { children: /* @__PURE__ */ g(a.Row, { children: [H && /* @__PURE__ */ h(a.Head, {
|
|
98
|
+
ref: U,
|
|
95
99
|
role: "columnheader",
|
|
96
100
|
selection: !0,
|
|
97
101
|
stickyLeft: !0,
|
|
@@ -100,16 +104,16 @@ function g({ columns: g, data: _, rowKey: v = "id", loading: y = !1, striped: b
|
|
|
100
104
|
"data-row": -1,
|
|
101
105
|
"data-col": -1,
|
|
102
106
|
"aria-label": z("a11y.select_all_rows"),
|
|
103
|
-
tabIndex:
|
|
104
|
-
children: (H.type ?? "checkbox") === "checkbox" && /* @__PURE__ */
|
|
105
|
-
checked:
|
|
106
|
-
indeterminate:
|
|
107
|
-
onChange:
|
|
107
|
+
tabIndex: $.row === -1 && $.col === -1 ? 0 : -1,
|
|
108
|
+
children: (H.type ?? "checkbox") === "checkbox" && /* @__PURE__ */ h(n, {
|
|
109
|
+
checked: Z,
|
|
110
|
+
indeterminate: Q,
|
|
111
|
+
onChange: te,
|
|
108
112
|
"aria-label": z("a11y.select_all_rows")
|
|
109
113
|
})
|
|
110
|
-
}),
|
|
111
|
-
let n =
|
|
112
|
-
return /* @__PURE__ */
|
|
114
|
+
}), _.map((e, t) => {
|
|
115
|
+
let n = Y(e.key, !0);
|
|
116
|
+
return /* @__PURE__ */ h(a.Head, {
|
|
113
117
|
role: "columnheader",
|
|
114
118
|
style: {
|
|
115
119
|
width: e.width,
|
|
@@ -120,19 +124,19 @@ function g({ columns: g, data: _, rowKey: v = "id", loading: y = !1, striped: b
|
|
|
120
124
|
onSort: () => {
|
|
121
125
|
if (!e.sortable || !M) return;
|
|
122
126
|
let t = j?.key === e.key ? j.direction === "asc" ? "desc" : j.direction === "desc" ? "none" : "asc" : "asc", n = typeof e.title == "string" ? e.title : e.key;
|
|
123
|
-
|
|
127
|
+
se(z(t === "asc" ? "dataGrid.sorted_ascending" : t === "desc" ? "dataGrid.sorted_descending" : "dataGrid.sort_cleared", { column: n })), M(e.key, t);
|
|
124
128
|
},
|
|
125
129
|
...n,
|
|
126
|
-
tabIndex:
|
|
130
|
+
tabIndex: $.row === -1 && $.col === (H ? t + 1 : t) ? 0 : -1,
|
|
127
131
|
"data-row": -1,
|
|
128
132
|
"data-col": H ? t + 1 : t,
|
|
129
133
|
children: e.title
|
|
130
134
|
}, e.key);
|
|
131
|
-
})] }) }), /* @__PURE__ */
|
|
132
|
-
let
|
|
133
|
-
return /* @__PURE__ */
|
|
135
|
+
})] }) }), /* @__PURE__ */ h(a.Body, { children: v.map((e, t) => {
|
|
136
|
+
let r = X(e), i = H?.selectedRowKeys.includes(r);
|
|
137
|
+
return /* @__PURE__ */ g(a.Row, {
|
|
134
138
|
selected: i,
|
|
135
|
-
children: [H && /* @__PURE__ */
|
|
139
|
+
children: [H && /* @__PURE__ */ h(a.Cell, {
|
|
136
140
|
role: "gridcell",
|
|
137
141
|
selection: !0,
|
|
138
142
|
stickyLeft: !0,
|
|
@@ -140,57 +144,57 @@ function g({ columns: g, data: _, rowKey: v = "id", loading: y = !1, striped: b
|
|
|
140
144
|
stickyZIndex: 150,
|
|
141
145
|
"data-row": t,
|
|
142
146
|
"data-col": -1,
|
|
143
|
-
tabIndex:
|
|
144
|
-
children: /* @__PURE__ */
|
|
147
|
+
tabIndex: $.row === t && $.col === -1 ? 0 : -1,
|
|
148
|
+
children: /* @__PURE__ */ h(n, {
|
|
145
149
|
checked: i,
|
|
146
|
-
onChange: (t) =>
|
|
150
|
+
onChange: (t) => ne(e, t),
|
|
147
151
|
"aria-label": z("a11y.select_row_numbered", { row: t + 1 })
|
|
148
152
|
})
|
|
149
|
-
}),
|
|
150
|
-
let i =
|
|
151
|
-
return /* @__PURE__ */
|
|
153
|
+
}), _.map((n, r) => {
|
|
154
|
+
let i = Y(n.key, !1), o = e[n.dataIndex ?? n.key];
|
|
155
|
+
return /* @__PURE__ */ h(a.Cell, {
|
|
152
156
|
role: "gridcell",
|
|
153
157
|
label: typeof n.title == "string" ? n.title : void 0,
|
|
154
158
|
...i,
|
|
155
159
|
"data-row": t,
|
|
156
160
|
"data-col": H ? r + 1 : r,
|
|
157
|
-
tabIndex:
|
|
158
|
-
children: n.maxWidth == null ? n.render ? n.render(o, e, t) : o : /* @__PURE__ */
|
|
161
|
+
tabIndex: $.row === t && $.col === (H ? r + 1 : r) ? 0 : -1,
|
|
162
|
+
children: n.maxWidth == null ? n.render ? n.render(o, e, t) : o : /* @__PURE__ */ h("div", {
|
|
159
163
|
style: { maxWidth: n.maxWidth },
|
|
160
164
|
children: n.render ? n.render(o, e, t) : o
|
|
161
165
|
})
|
|
162
166
|
}, n.key);
|
|
163
167
|
})]
|
|
164
|
-
},
|
|
168
|
+
}, r);
|
|
165
169
|
}) })]
|
|
166
170
|
}),
|
|
167
|
-
|
|
171
|
+
v.length === 0 && E && /* @__PURE__ */ h("div", {
|
|
168
172
|
role: "status",
|
|
169
173
|
className: l.empty,
|
|
170
174
|
children: E
|
|
171
175
|
}),
|
|
172
|
-
P?.hasMore && /* @__PURE__ */
|
|
173
|
-
ref:
|
|
176
|
+
P?.hasMore && /* @__PURE__ */ h("div", {
|
|
177
|
+
ref: ae,
|
|
174
178
|
className: l.loader,
|
|
175
179
|
children: P.hasMore && z("dataGrid.loading_more")
|
|
176
180
|
})
|
|
177
181
|
]
|
|
178
182
|
}),
|
|
179
|
-
N && /* @__PURE__ */
|
|
183
|
+
N && /* @__PURE__ */ g("div", {
|
|
180
184
|
className: l.footer,
|
|
181
185
|
inert: V || void 0,
|
|
182
|
-
children: [/* @__PURE__ */
|
|
186
|
+
children: [/* @__PURE__ */ g("div", {
|
|
183
187
|
className: l.info,
|
|
184
188
|
children: [z("dataGrid.displaying", {
|
|
185
|
-
shown:
|
|
189
|
+
shown: v.length,
|
|
186
190
|
total: N.total
|
|
187
|
-
}), H?.selectedRowKeys && H.selectedRowKeys.length > 0 && /* @__PURE__ */
|
|
191
|
+
}), H?.selectedRowKeys && H.selectedRowKeys.length > 0 && /* @__PURE__ */ h("span", {
|
|
188
192
|
className: l.selectionInfo,
|
|
189
193
|
children: z("dataGrid.rows_selected", { selected: H.selectedRowKeys.length })
|
|
190
194
|
})]
|
|
191
|
-
}), /* @__PURE__ */
|
|
195
|
+
}), /* @__PURE__ */ h("div", {
|
|
192
196
|
className: l.pagination,
|
|
193
|
-
children: /* @__PURE__ */
|
|
197
|
+
children: /* @__PURE__ */ h(i, {
|
|
194
198
|
className: l.paginationContent,
|
|
195
199
|
current: N.current,
|
|
196
200
|
total: N.total,
|
|
@@ -203,4 +207,4 @@ function g({ columns: g, data: _, rowKey: v = "id", loading: y = !1, striped: b
|
|
|
203
207
|
});
|
|
204
208
|
}
|
|
205
209
|
//#endregion
|
|
206
|
-
export {
|
|
210
|
+
export { _ as DataGrid };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
let e=require("react");function t(e){return typeof e==`number`?e:typeof e==`string`&&e.endsWith(`px`)?parseInt(e,10):0}function
|
|
2
|
+
let e=require("react");function t(e){return typeof e==`number`?e:typeof e==`string`&&e.endsWith(`px`)?parseInt(e,10):0}var n=60;function r(r,i,a){return(0,e.useMemo)(()=>{let e={},o=i?a??n:0,s=100,c=r.filter(e=>e.fixed===`left`);c.forEach((n,r)=>{e[n.key]={offset:o===0?0:`${o}px`,zIndex:s--,isLast:r===c.length-1},o+=t(n.width)});let l={},u=0,d=100,f=r.filter(e=>e.fixed===`right`);return f.reverse().forEach((e,n)=>{l[e.key]={offset:u===0?0:`${u}px`,zIndex:d--,isFirst:n===f.length-1},u+=t(e.width)}),{fixedLeftOffsets:e,fixedRightOffsets:l}},[r,i,a])}exports.useFixedColumns=r;
|
|
@@ -3,7 +3,12 @@ export type FixedColumnInfo = {
|
|
|
3
3
|
offset: number | string;
|
|
4
4
|
zIndex: number;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param selectionWidth 選択の列の、測った幅(px)。選択の列は中身(チェックボックスと
|
|
8
|
+
* 密度で変わる余白)の幅なので、決め打ちの値で積むと、横にスクロールしたときに
|
|
9
|
+
* 左に固定した列とのあいだに隙間や重なりができる
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFixedColumns<T>(columns: DataGridColumn<T>[], selection: boolean, selectionWidth?: number): {
|
|
7
12
|
fixedLeftOffsets: Record<string, FixedColumnInfo>;
|
|
8
13
|
fixedRightOffsets: Record<string, FixedColumnInfo>;
|
|
9
14
|
};
|
|
@@ -4,28 +4,33 @@ import { useMemo as e } from "react";
|
|
|
4
4
|
function t(e) {
|
|
5
5
|
return typeof e == "number" ? e : typeof e == "string" && e.endsWith("px") ? parseInt(e, 10) : 0;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
var n = 60;
|
|
8
|
+
function r(r, i, a) {
|
|
8
9
|
return e(() => {
|
|
9
|
-
let e = {},
|
|
10
|
-
|
|
10
|
+
let e = {}, o = i ? a ?? n : 0, s = 100, c = r.filter((e) => e.fixed === "left");
|
|
11
|
+
c.forEach((n, r) => {
|
|
11
12
|
e[n.key] = {
|
|
12
|
-
offset:
|
|
13
|
-
zIndex:
|
|
14
|
-
isLast: r ===
|
|
15
|
-
},
|
|
13
|
+
offset: o === 0 ? 0 : `${o}px`,
|
|
14
|
+
zIndex: s--,
|
|
15
|
+
isLast: r === c.length - 1
|
|
16
|
+
}, o += t(n.width);
|
|
16
17
|
});
|
|
17
|
-
let
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
offset:
|
|
21
|
-
zIndex:
|
|
22
|
-
isFirst: n ===
|
|
23
|
-
},
|
|
18
|
+
let l = {}, u = 0, d = 100, f = r.filter((e) => e.fixed === "right");
|
|
19
|
+
return f.reverse().forEach((e, n) => {
|
|
20
|
+
l[e.key] = {
|
|
21
|
+
offset: u === 0 ? 0 : `${u}px`,
|
|
22
|
+
zIndex: d--,
|
|
23
|
+
isFirst: n === f.length - 1
|
|
24
|
+
}, u += t(e.width);
|
|
24
25
|
}), {
|
|
25
26
|
fixedLeftOffsets: e,
|
|
26
|
-
fixedRightOffsets:
|
|
27
|
+
fixedRightOffsets: l
|
|
27
28
|
};
|
|
28
|
-
}, [
|
|
29
|
+
}, [
|
|
30
|
+
r,
|
|
31
|
+
i,
|
|
32
|
+
a
|
|
33
|
+
]);
|
|
29
34
|
}
|
|
30
35
|
//#endregion
|
|
31
|
-
export {
|
|
36
|
+
export { r as useFixedColumns };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../hooks/useMergedRef.cjs"),r=require("../../form/Button/Button.cjs"),i=require("../../layout/Toolbar/Toolbar.cjs"),a=require("../../_internal/useAnnounce.cjs"),o=require("../../../i18n/generated/data-display.cjs"),s=require("./selection-bar.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=1e3,f=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,p=e=>{if(!e)return null;for(let t of Array.from(document.querySelectorAll(f))){if(e.contains(t)||!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING)||t.closest(`[hidden], [inert], [aria-hidden="true"]`))continue;let n=getComputedStyle(t);if(n.display!==`none`&&n.visibility!==`hidden`)return t}return null},m=c.default.forwardRef(({count:e,onClear:f,children:m,countLabel:h,clearLabel:g,returnFocusRef:_,className:v,onFocus:y,"aria-label":b,...x},S)=>{let{t:C}=t.useWimTranslation(o.dataDisplayNs),w=c.default.useRef(null),T=n.useMergedRef(S,w),E=e>0,D=a.useAnnounceValue(E?C(`selection_bar.selected`,{count:e}):C(`selection_bar.cleared`)),O=c.default.useRef(!1),k=e=>{O.current=!0,y?.(e)};return c.default.useLayoutEffect(()=>{if(E||!O.current)return;O.current=!1;let e=()=>{let e=document.activeElement;return e&&e!==document.body?!1:((_?.current??p(w.current)??w.current)?.focus(),!0)};if(e())return;let t=Date.now(),n=window.setInterval(()=>{(e()||Date.now()-t>d)&&window.clearInterval(n)},50);return()=>window.clearInterval(n)},[E,_]),(0,u.jsxs)(`div`,{...x,ref:T,tabIndex:-1,className:(0,l.default)(`wim-selection-bar`,s.default.root,v),onFocus:k,children:[D,E&&(0,u.jsxs)(i.Toolbar,{size:`sm`,"aria-label":b??C(`selection_bar.label`),className:s.default.bar,children:[(0,u.jsx)(`span`,{className:s.default.count,children:h?h(e):C(`selection_bar.selected`,{count:e})}),m&&(0,u.jsx)(i.Toolbar.Group,{children:m}),f&&(0,u.jsx)(i.Toolbar.Group,{className:s.default.end,children:(0,u.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:f,children:g??C(`selection_bar.clear`)})})]})]})});m.displayName=`SelectionBar`,exports.SelectionBar=m;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type SelectionBarProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Number of selected items. The bar shows while it is above 0. Keep the component mounted
|
|
5
|
+
* while the count is 0 as well: it holds the status region that announces the count, and a
|
|
6
|
+
* region that appears together with its text is not read by screen readers.
|
|
7
|
+
*/
|
|
8
|
+
count: number;
|
|
9
|
+
/**
|
|
10
|
+
* Called by the built-in "Clear selection" button. Leave it out to render no clear button.
|
|
11
|
+
*/
|
|
12
|
+
onClear?: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Actions for the selected items (`Button size="sm"`, `IconButton`, `Popconfirm` ...). They
|
|
15
|
+
* are placed in a `Toolbar`, so the arrow keys move between them.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Text that states the count. Defaults to the built-in "{count} selected" (en / ja / pt).
|
|
20
|
+
*/
|
|
21
|
+
countLabel?: (count: number) => React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Label of the clear button. Defaults to the built-in "Clear selection".
|
|
24
|
+
*/
|
|
25
|
+
clearLabel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Where focus goes when the bar closes after focus was in it — after the clear button, or
|
|
28
|
+
* after a confirmation opened from the bar (`Popconfirm`) whose trigger is gone. Without it,
|
|
29
|
+
* focus moves to the first focusable element after the bar (with `DataGrid`, the grid).
|
|
30
|
+
*/
|
|
31
|
+
returnFocusRef?: React.RefObject<HTMLElement | null>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* SelectionBar shows the number of selected rows, the actions for them and a way to clear the
|
|
35
|
+
* selection. Place it above the Table / DataGrid / List it acts on, and keep it mounted.
|
|
36
|
+
*
|
|
37
|
+
* - The count is announced from a status region that is always present, both when it changes
|
|
38
|
+
* and when the selection is cleared.
|
|
39
|
+
* - When the bar closes after focus was in it, focus moves to `returnFocusRef` or to the first
|
|
40
|
+
* focusable element after the bar, instead of falling to the top of the page.
|
|
41
|
+
*
|
|
42
|
+
* Composition Contract:
|
|
43
|
+
* - Managed by: App consumption (the selection state stays with the caller)
|
|
44
|
+
* - Scroll lock: No
|
|
45
|
+
* - Does not own action semantics — compose Button / IconButton / Popconfirm as children
|
|
46
|
+
*/
|
|
47
|
+
export declare const SelectionBar: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
|
|
48
|
+
/**
|
|
49
|
+
* Number of selected items. The bar shows while it is above 0. Keep the component mounted
|
|
50
|
+
* while the count is 0 as well: it holds the status region that announces the count, and a
|
|
51
|
+
* region that appears together with its text is not read by screen readers.
|
|
52
|
+
*/
|
|
53
|
+
count: number;
|
|
54
|
+
/**
|
|
55
|
+
* Called by the built-in "Clear selection" button. Leave it out to render no clear button.
|
|
56
|
+
*/
|
|
57
|
+
onClear?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Actions for the selected items (`Button size="sm"`, `IconButton`, `Popconfirm` ...). They
|
|
60
|
+
* are placed in a `Toolbar`, so the arrow keys move between them.
|
|
61
|
+
*/
|
|
62
|
+
children?: React.ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Text that states the count. Defaults to the built-in "{count} selected" (en / ja / pt).
|
|
65
|
+
*/
|
|
66
|
+
countLabel?: (count: number) => React.ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Label of the clear button. Defaults to the built-in "Clear selection".
|
|
69
|
+
*/
|
|
70
|
+
clearLabel?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Where focus goes when the bar closes after focus was in it — after the clear button, or
|
|
73
|
+
* after a confirmation opened from the bar (`Popconfirm`) whose trigger is gone. Without it,
|
|
74
|
+
* focus moves to the first focusable element after the bar (with `DataGrid`, the grid).
|
|
75
|
+
*/
|
|
76
|
+
returnFocusRef?: React.RefObject<HTMLElement | null>;
|
|
77
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
+
import { useMergedRef as t } from "../../../hooks/useMergedRef.js";
|
|
4
|
+
import { Button as n } from "../../form/Button/Button.js";
|
|
5
|
+
import { Toolbar as r } from "../../layout/Toolbar/Toolbar.js";
|
|
6
|
+
import { useAnnounceValue as i } from "../../_internal/useAnnounce.js";
|
|
7
|
+
import { dataDisplayNs as a } from "../../../i18n/generated/data-display.js";
|
|
8
|
+
import o from "./selection-bar.module.js";
|
|
9
|
+
import s from "react";
|
|
10
|
+
import c from "classnames";
|
|
11
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
12
|
+
//#region src/components/data-display/SelectionBar/SelectionBar.tsx
|
|
13
|
+
var d = 1e3, f = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", p = (e) => {
|
|
14
|
+
if (!e) return null;
|
|
15
|
+
for (let t of Array.from(document.querySelectorAll(f))) {
|
|
16
|
+
if (e.contains(t) || !(e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING) || t.closest("[hidden], [inert], [aria-hidden=\"true\"]")) continue;
|
|
17
|
+
let n = getComputedStyle(t);
|
|
18
|
+
if (n.display !== "none" && n.visibility !== "hidden") return t;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}, m = s.forwardRef(({ count: f, onClear: m, children: h, countLabel: g, clearLabel: _, returnFocusRef: v, className: y, onFocus: b, "aria-label": x, ...S }, C) => {
|
|
22
|
+
let { t: w } = e(a), T = s.useRef(null), E = t(C, T), D = f > 0, O = i(D ? w("selection_bar.selected", { count: f }) : w("selection_bar.cleared")), k = s.useRef(!1), A = (e) => {
|
|
23
|
+
k.current = !0, b?.(e);
|
|
24
|
+
};
|
|
25
|
+
return s.useLayoutEffect(() => {
|
|
26
|
+
if (D || !k.current) return;
|
|
27
|
+
k.current = !1;
|
|
28
|
+
let e = () => {
|
|
29
|
+
let e = document.activeElement;
|
|
30
|
+
return e && e !== document.body ? !1 : ((v?.current ?? p(T.current) ?? T.current)?.focus(), !0);
|
|
31
|
+
};
|
|
32
|
+
if (e()) return;
|
|
33
|
+
let t = Date.now(), n = window.setInterval(() => {
|
|
34
|
+
(e() || Date.now() - t > d) && window.clearInterval(n);
|
|
35
|
+
}, 50);
|
|
36
|
+
return () => window.clearInterval(n);
|
|
37
|
+
}, [D, v]), /* @__PURE__ */ u("div", {
|
|
38
|
+
...S,
|
|
39
|
+
ref: E,
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
className: c("wim-selection-bar", o.root, y),
|
|
42
|
+
onFocus: A,
|
|
43
|
+
children: [O, D && /* @__PURE__ */ u(r, {
|
|
44
|
+
size: "sm",
|
|
45
|
+
"aria-label": x ?? w("selection_bar.label"),
|
|
46
|
+
className: o.bar,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ l("span", {
|
|
49
|
+
className: o.count,
|
|
50
|
+
children: g ? g(f) : w("selection_bar.selected", { count: f })
|
|
51
|
+
}),
|
|
52
|
+
h && /* @__PURE__ */ l(r.Group, { children: h }),
|
|
53
|
+
m && /* @__PURE__ */ l(r.Group, {
|
|
54
|
+
className: o.end,
|
|
55
|
+
children: /* @__PURE__ */ l(n, {
|
|
56
|
+
variant: "ghost",
|
|
57
|
+
size: "sm",
|
|
58
|
+
onClick: m,
|
|
59
|
+
children: _ ?? w("selection_bar.clear")
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
m.displayName = "SelectionBar";
|
|
67
|
+
//#endregion
|
|
68
|
+
export { m as SelectionBar };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/data-display/SelectionBar/selection-bar.module.scss
|
|
3
|
+
var e = "_root_dyl0x_2", t = "_bar_dyl0x_5", n = "_count_dyl0x_9", r = "_end_dyl0x_17", i = {
|
|
4
|
+
root: e,
|
|
5
|
+
bar: t,
|
|
6
|
+
count: n,
|
|
7
|
+
end: r
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as bar, n as count, i as default, r as end, e as root };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_scope_9fctq_6`,t=`_container_9fctq_16`,n=`_mobileCard_9fctq_25`,r=`_mobileCardMd_9fctq_25`,i=`_sticky_9fctq_28`,a=`_cardContainer_9fctq_31`,o=`_root_9fctq_5`,s=`_fullWidth_9fctq_83`,c=`_striped_9fctq_86`,l=`_bordered_9fctq_90`,u=`_hoverable_9fctq_105`,d=`_stickyLeft_9fctq_109`,f=`_stickyRight_9fctq_109`,p=`_stickyHeader_9fctq_112`,m=`_selection_9fctq_238`,h=`_body_9fctq_22`,g=`_row_9fctq_22`,_=`_selected_9fctq_393`,v=`_head_9fctq_23`,y=`_sortable_9fctq_416`,b=`_cell_9fctq_490`,x=`_headContent_9fctq_552`,S=`_sortIcon_9fctq_560`,C=`_asc_9fctq_565`,w=`_desc_9fctq_569`,T=`_noScrollbar_9fctq_572`,E=`_subtleScrollbar_9fctq_580`,D={scope:e,container:t,mobileCard:n,mobileCardMd:r,sticky:i,cardContainer:a,root:o,fullWidth:s,striped:c,bordered:l,hoverable:u,stickyLeft:d,stickyRight:f,stickyHeader:p,selection:m,body:h,row:g,selected:_,head:v,sortable:y,cell:b,headContent:x,sortIcon:S,asc:C,desc:w,noScrollbar:T,subtleScrollbar:E};exports.asc=C,exports.body=h,exports.bordered=l,exports.cardContainer=a,exports.cell=b,exports.container=t,exports.default=D,exports.desc=w,exports.fullWidth=s,exports.head=v,exports.headContent=x,exports.hoverable=u,exports.mobileCard=n,exports.mobileCardMd=r,exports.noScrollbar=T,exports.root=o,exports.row=g,exports.scope=e,exports.selected=_,exports.selection=m,exports.sortIcon=S,exports.sortable=y,exports.sticky=i,exports.stickyHeader=p,exports.stickyLeft=d,exports.stickyRight=f,exports.striped=c,exports.subtleScrollbar=E;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/data-display/Table/table.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_scope_9fctq_6", t = "_container_9fctq_16", n = "_mobileCard_9fctq_25", r = "_mobileCardMd_9fctq_25", i = "_sticky_9fctq_28", a = "_cardContainer_9fctq_31", o = "_root_9fctq_5", s = "_fullWidth_9fctq_83", c = "_striped_9fctq_86", l = "_bordered_9fctq_90", u = "_hoverable_9fctq_105", d = "_stickyLeft_9fctq_109", f = "_stickyRight_9fctq_109", p = "_stickyHeader_9fctq_112", m = "_selection_9fctq_238", h = "_body_9fctq_22", g = "_row_9fctq_22", _ = "_selected_9fctq_393", v = "_head_9fctq_23", y = "_sortable_9fctq_416", b = "_cell_9fctq_490", x = "_headContent_9fctq_552", S = "_sortIcon_9fctq_560", C = "_asc_9fctq_565", w = "_desc_9fctq_569", T = "_noScrollbar_9fctq_572", E = "_subtleScrollbar_9fctq_580", D = {
|
|
4
4
|
scope: e,
|
|
5
5
|
container: t,
|
|
6
6
|
mobileCard: n,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../form/Button/Button.cjs"),n=require("../../_internal/useAnnounce.cjs"),r=require("../../_internal/FeedbackIcon.cjs"),i=require("../../_internal/FeedbackCloseButton.cjs"),a=require("./snackbar.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=({message:e,open:l=!1,intent:u=`default`,position:d=`bottom-center`,autoHideDuration:f=5e3,showCloseButton:p=!1,actionLabel:m,onAction:h,onClose:g,className:_})=>{let[v,y]=(0,o.useState)(!1),[b,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(l);l!==S&&(C(l),l?x(!0):y(!1)),(0,o.useEffect)(()=>{if(l){let e=setTimeout(()=>y(!0),10);return()=>clearTimeout(e)}{let e=setTimeout(()=>x(!1),300);return()=>clearTimeout(e)}},[l]);let w=(0,o.useCallback)(()=>{y(!1),setTimeout(()=>{g&&g()},300)},[g]),[T,E]=(0,o.useState)(f),[D,O]=(0,o.useState)(()=>Date.now()),[k,A]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(l&&f>0&&!k){let e=setTimeout(()=>{w()},T);return O(Date.now()),()=>clearTimeout(e)}},[l,f,w,k,T]);let j=()=>{if(f>0){A(!0);let e=Date.now()-D;E(t=>Math.max(0,t-e))}},M=()=>{f>0&&(O(Date.now()),A(!1))},N=()=>{h&&h()},P=n.useAnnounceValue(l?e:``,{role:u===`danger`||u===`warning`?`alert`:`status`,initial:!0});return(0,c.jsxs)(`div`,{className:(0,s.default)(a.default.wrapper,a.default[d]),children:[P,(b||l)&&(0,c.jsxs)(`div`,{className:(0,s.default)(`wim-snackbar`,a.default.root,u&&a.default[u],v&&a.default.visible,p&&a.default.hasCloseButton,_),onMouseEnter:j,onMouseLeave:M,onFocus:j,onBlur:M,children:[(0,c.jsxs)(`div`,{className:a.default.content,children:[(u===`success`||u===`warning`||u===`danger`)&&(0,c.jsx)(`div`,{className:a.default.icon,children:(0,c.jsx)(r.FeedbackIcon,{intent:u,size:`sm`})}),(0,c.jsx)(`span`,{className:a.default.message,children:e})]}),(0,c.jsxs)(`div`,{className:a.default.actions,children:[m&&(0,c.jsx)(t.Button,{variant:`ghost`,size:`sm`,onClick:N,className:a.default.actionButton,children:m}),(0,c.jsx)(i.FeedbackCloseButton,{onClose:p?w:void 0,className:a.default.closeButton,size:`sm`})]})]})]})},u=(0,o.createContext)(void 0),d=({children:e})=>{let[t,n]=(0,o.useState)(null),[r,i]=(0,o.useState)(!1),a=(0,o.useCallback)(e=>{let r=Math.random().toString(36).substr(2,9),a=typeof e==`string`?{message:e}:e;i(!1),setTimeout(()=>{n({...a,id:r}),i(!0)},t?300:0)},[t]),s=(0,o.useCallback)(()=>{i(!1)},[]);return(0,c.jsxs)(u.Provider,{value:{showMessage:a,hideMessage:s},children:[e,(0,c.jsx)(l,{message:``,...t,open:r&&t!==null,onClose:()=>{i(!1),t?.onClose&&t.onClose()}})]})},f=()=>{let e=(0,o.useContext)(u);if(!e)throw Error(`useSnackbar must be used within a SnackbarProvider`);return e};exports.Snackbar=l,exports.SnackbarProvider=d,exports.useSnackbar=f;
|