wimui 0.5.2 → 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/_internal/status-content.module.cjs +1 -1
- package/dist/components/_internal/status-content.module.js +1 -1
- package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
- package/dist/components/ai/ChatUI/ChatUI.js +80 -79
- package/dist/components/data-display/Calendar/Calendar.cjs +1 -1
- package/dist/components/data-display/Calendar/Calendar.js +88 -87
- package/dist/components/data-display/Card/card.module.cjs +1 -1
- package/dist/components/data-display/Card/card.module.js +15 -12
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.d.ts +11 -4
- package/dist/components/data-display/DataGrid/DataGrid.js +52 -60
- package/dist/components/data-display/DataGrid/datagrid.module.cjs +1 -1
- package/dist/components/data-display/DataGrid/datagrid.module.js +15 -13
- package/dist/components/data-display/Kanban/Kanban.cjs +1 -1
- package/dist/components/data-display/Kanban/Kanban.js +87 -86
- package/dist/components/data-display/Table/Table.cjs +1 -1
- package/dist/components/data-display/Table/Table.d.ts +3 -2
- package/dist/components/data-display/Table/Table.js +1 -1
- package/dist/components/data-display/Table/table.module.cjs +1 -1
- package/dist/components/data-display/Table/table.module.js +28 -27
- package/dist/components/data-display/Tag/Tag.cjs +1 -1
- package/dist/components/data-display/Tag/Tag.js +34 -30
- package/dist/components/form/Button/button.module.cjs +1 -1
- package/dist/components/form/Button/button.module.js +2 -2
- package/dist/components/form/ImageCropper/ImageCropper.cjs +1 -1
- package/dist/components/form/ImageCropper/ImageCropper.js +1 -1
- package/dist/components/form/InlineEdit/InlineEdit.cjs +1 -1
- package/dist/components/form/InlineEdit/InlineEdit.js +31 -28
- package/dist/components/layout/Container/container.module.cjs +1 -1
- package/dist/components/layout/Container/container.module.js +1 -1
- package/dist/components/layout/Toolbar/toolbar.module.cjs +1 -1
- package/dist/components/layout/Toolbar/toolbar.module.js +4 -4
- package/dist/components/media/Audio/Audio.cjs +1 -1
- package/dist/components/media/Audio/Audio.js +66 -65
- package/dist/components/overlay/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/overlay/Dropdown/Dropdown.js +106 -73
- package/dist/components/overlay/Dropdown/dropdown.module.cjs +1 -1
- package/dist/components/overlay/Dropdown/dropdown.module.js +3 -5
- package/dist/i18n/generated/keys.d.ts +1 -1
- package/dist/i18n/generated/resources.cjs +1 -1
- package/dist/i18n/generated/resources.js +44 -2
- package/dist/llms-full.txt +12 -4
- package/dist/llms.txt +3 -1
- package/dist/locales/en/common.json +12 -0
- package/dist/locales/ja/common.json +13 -1
- package/dist/locales/pt/common.json +13 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +2 -2
- package/package.json +27 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../form/Checkbox/Checkbox.cjs"),r=require("../../navigation/Pagination/Pagination.cjs"),i=require("../Table/Table.cjs"),a=require("./useFixedColumns.cjs"),o=require("./useDataGridKeyboard.cjs"),s=require("./useInfiniteScroll.cjs"),c=require("./datagrid.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");function f({columns:e,data:f,rowKey:p=`id`,loading:m=!1,striped:h=!1,bordered:g=!1,hoverable:_=!0,stickyHeader:v=!0,height:y,maxHeight:b,emptyMessage:x,mobileCard:S=!1,selection:C,selectedRowKeys:w,onSelectionChange:T,sortConfig:E,onSortChange:D,pagination:O,infiniteScroll:k,className:A,ariaLabel:j}){let{t:M}=t.useWimTranslation(`common`),N=(0,l.useMemo)(()=>C?C===!0?{type:`checkbox`,selectedRowKeys:w??[],onChange:(e,t)=>{T?.(e,t)}}:C:null,[C,w,T]),{fixedLeftOffsets:
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../form/Checkbox/Checkbox.cjs"),r=require("../../navigation/Pagination/Pagination.cjs"),i=require("../Table/Table.cjs"),a=require("./useFixedColumns.cjs"),o=require("./useDataGridKeyboard.cjs"),s=require("./useInfiniteScroll.cjs"),c=require("./datagrid.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");function f({columns:e,data:f,rowKey:p=`id`,loading:m=!1,striped:h=!1,bordered:g=!1,hoverable:_=!0,stickyHeader:v=!0,height:y,maxHeight:b,emptyMessage:x,mobileCard:S=!1,selection:C,selectedRowKeys:w,onSelectionChange:T,sortConfig:E,onSortChange:D,pagination:O,infiniteScroll:k,className:A,ariaLabel:j}){let{t:M}=t.useWimTranslation(`common`),N=m!==!1&&m!==void 0,P=m===!0||m===`blocking`,F=(0,l.useMemo)(()=>C?C===!0?{type:`checkbox`,selectedRowKeys:w??[],onChange:(e,t)=>{T?.(e,t)}}:C:null,[C,w,T]),{fixedLeftOffsets:I,fixedRightOffsets:L}=a.useFixedColumns(e,!!F),R=(e,t=!1)=>{let n=I[e];if(n)return{stickyLeft:!0,leftOffset:n.offset,stickyZIndex:t?1e3+n.zIndex:n.zIndex,className:(0,u.default)(c.default.cellFixed,n.isLast&&c.default.cellFixedLeftLast)};let r=L[e];return r?{stickyRight:!0,rightOffset:r.offset,stickyZIndex:t?1e3+r.zIndex:r.zIndex,className:(0,u.default)(c.default.cellFixed,r.isFirst&&c.default.cellFixedRightFirst)}:{}},z=(0,l.useCallback)(e=>typeof p==`function`?p(e):e[p],[p]),B=(0,l.useMemo)(()=>!F||f.length===0?!1:f.every(e=>F.selectedRowKeys.includes(z(e))),[f,F,z]),V=(0,l.useMemo)(()=>F?!B&&f.some(e=>F.selectedRowKeys.includes(z(e))):!1,[f,F,B,z]),H=e=>{if(!F)return;let t=e.target.checked,n=t?f.map(z):[],r=t?f:[];F.onChange(n,r)},U=(e,t)=>{if(!F)return;let n=t.target.checked,r=z(e),i=n?[...F.selectedRowKeys,r]:F.selectedRowKeys.filter(e=>e!==r),a=f.filter(e=>i.includes(z(e)));F.onChange(i,a)},{focusedCell:W,handleKeyDown:G,containerRef:K}=o.useDataGridKeyboard(e,f,!!F),{loaderRef:q}=s.useInfiniteScroll(k),J=e.length+ +!!F;return(0,d.jsxs)(`div`,{className:(0,u.default)(`wim-data-grid`,c.default.root,P&&c.default.loading,S===`md`?c.default.mobileCardMd:S&&c.default.mobileCard,A),"aria-busy":N||void 0,children:[(0,d.jsxs)(`div`,{className:c.default.container,style:{height:y,maxHeight:b},inert:P||void 0,children:[(0,d.jsxs)(i.Table,{ref:K,onKeyDown:G,tabIndex:0,role:`grid`,"aria-label":j??M(`a11y.data_grid`),"aria-rowcount":f.length+1,"aria-colcount":J,striped:h,bordered:g,hoverable:_,stickyHeader:v,mobileCard:S,fullWidth:!0,className:(0,u.default)(`wim-table`,c.default.table),containerClassName:c.default.tableContainer,children:[(0,d.jsx)(i.Table.Header,{children:(0,d.jsxs)(i.Table.Row,{children:[F&&(0,d.jsx)(i.Table.Head,{role:`columnheader`,selection:!0,stickyLeft:!0,leftOffset:0,stickyZIndex:1150,"data-row":-1,"data-col":-1,"aria-label":M(`a11y.select_all_rows`),tabIndex:W.row===-1&&W.col===-1?0:-1,children:(F.type??`checkbox`)===`checkbox`&&(0,d.jsx)(n.Checkbox,{checked:B,indeterminate:V,onChange:H,"aria-label":M(`a11y.select_all_rows`)})}),e.map((e,t)=>{let n=R(e.key,!0);return(0,d.jsx)(i.Table.Head,{role:`columnheader`,style:{width:e.width,minWidth:e.width},sortable:e.sortable,sortDirection:E?.key===e.key?E.direction:`none`,onSort:()=>{if(!e.sortable||!D)return;let t=E?.key===e.key?E.direction===`asc`?`desc`:E.direction===`desc`?`none`:`asc`:`asc`;D(e.key,t)},...n,tabIndex:W.row===-1&&W.col===(F?t+1:t)?0:-1,"data-row":-1,"data-col":F?t+1:t,children:e.title},e.key)})]})}),(0,d.jsx)(i.Table.Body,{children:f.map((t,r)=>{let a=z(t),o=F?.selectedRowKeys.includes(a);return(0,d.jsxs)(i.Table.Row,{selected:o,children:[F&&(0,d.jsx)(i.Table.Cell,{role:`gridcell`,selection:!0,stickyLeft:!0,leftOffset:0,stickyZIndex:150,"data-row":r,"data-col":-1,tabIndex:W.row===r&&W.col===-1?0:-1,children:(0,d.jsx)(n.Checkbox,{checked:o,onChange:e=>U(t,e),"aria-label":M(`a11y.select_row`)})}),e.map((e,n)=>{let a=R(e.key,!1),o=t[e.dataIndex??e.key];return(0,d.jsx)(i.Table.Cell,{role:`gridcell`,label:typeof e.title==`string`?e.title:void 0,...a,"data-row":r,"data-col":F?n+1:n,tabIndex:W.row===r&&W.col===(F?n+1:n)?0:-1,children:e.render?e.render(o,t,r):o},e.key)})]},a)})})]}),f.length===0&&x&&(0,d.jsx)(`div`,{role:`status`,className:c.default.empty,children:x}),k?.hasMore&&(0,d.jsx)(`div`,{ref:q,className:c.default.loader,children:k.hasMore&&M(`dataGrid.loading_more`)})]}),O&&(0,d.jsxs)(`div`,{className:c.default.footer,inert:P||void 0,children:[(0,d.jsxs)(`div`,{className:c.default.info,children:[M(`dataGrid.displaying`,{shown:f.length,total:O.total}),F?.selectedRowKeys&&F.selectedRowKeys.length>0&&(0,d.jsx)(`span`,{className:c.default.selectionInfo,children:M(`dataGrid.rows_selected`,{selected:F.selectedRowKeys.length})})]}),(0,d.jsx)(`div`,{className:c.default.pagination,children:(0,d.jsx)(r.Pagination,{className:c.default.paginationContent,current:O.current,total:O.total,pageSize:O.pageSize,onChange:O.onChange})})]})]})}exports.DataGrid=f;
|
|
@@ -21,8 +21,15 @@ export type DataGridProps<T> = {
|
|
|
21
21
|
data: T[];
|
|
22
22
|
/** Row key: a field name or a function that derives the key from a record */
|
|
23
23
|
rowKey?: string | ((record: T) => string);
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Loading state.
|
|
26
|
+
* `true` / `"blocking"` fades the grid and blocks interaction (first load — the
|
|
27
|
+
* rows are not there yet, or are about to be replaced wholesale).
|
|
28
|
+
* `"refresh"` only announces `aria-busy`: the rows stay readable and usable while
|
|
29
|
+
* fresh data is fetched. It deliberately does not dim, because fading the content
|
|
30
|
+
* drops secondary text below the AA contrast floor.
|
|
31
|
+
*/
|
|
32
|
+
loading?: boolean | "blocking" | "refresh";
|
|
26
33
|
/** Whether to show striped (zebra) rows */
|
|
27
34
|
striped?: boolean;
|
|
28
35
|
/** Whether to show borders between cells */
|
|
@@ -37,8 +44,8 @@ export type DataGridProps<T> = {
|
|
|
37
44
|
maxHeight?: string | number;
|
|
38
45
|
/** Message or element to display when data is empty */
|
|
39
46
|
emptyMessage?: React.ReactNode;
|
|
40
|
-
/** Enable
|
|
41
|
-
mobileCard?: boolean;
|
|
47
|
+
/** Enable the card layout below a container width (`true`/`"sm"` = 576px, `"md"` = 768px) */
|
|
48
|
+
mobileCard?: boolean | "sm" | "md";
|
|
42
49
|
/** Row selection: a boolean shorthand or a full configuration object */
|
|
43
50
|
selection?: boolean | SelectionConfig<T>;
|
|
44
51
|
/** Selected row keys (used with boolean `selection`) */
|
|
@@ -12,7 +12,7 @@ import u from "classnames";
|
|
|
12
12
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
13
13
|
//#region src/components/data-display/DataGrid/DataGrid.tsx
|
|
14
14
|
function p({ columns: p, 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 }) {
|
|
15
|
-
let { t: P } = e("common"), F = l(() => T ? T === !0 ? {
|
|
15
|
+
let { t: P } = e("common"), F = g !== !1 && g !== void 0, I = g === !0 || g === "blocking", L = l(() => T ? T === !0 ? {
|
|
16
16
|
type: "checkbox",
|
|
17
17
|
selectedRowKeys: E ?? [],
|
|
18
18
|
onChange: (e, t) => {
|
|
@@ -22,58 +22,58 @@ function p({ columns: p, data: m, rowKey: h = "id", loading: g = !1, striped: _
|
|
|
22
22
|
T,
|
|
23
23
|
E,
|
|
24
24
|
D
|
|
25
|
-
]), { fixedLeftOffsets:
|
|
26
|
-
let n =
|
|
25
|
+
]), { fixedLeftOffsets: R, fixedRightOffsets: z } = i(p, !!L), B = (e, t = !1) => {
|
|
26
|
+
let n = R[e];
|
|
27
27
|
if (n) return {
|
|
28
28
|
stickyLeft: !0,
|
|
29
29
|
leftOffset: n.offset,
|
|
30
30
|
stickyZIndex: t ? 1e3 + n.zIndex : n.zIndex,
|
|
31
31
|
className: u(s.cellFixed, n.isLast && s.cellFixedLeftLast)
|
|
32
32
|
};
|
|
33
|
-
let r =
|
|
33
|
+
let r = z[e];
|
|
34
34
|
return r ? {
|
|
35
35
|
stickyRight: !0,
|
|
36
36
|
rightOffset: r.offset,
|
|
37
37
|
stickyZIndex: t ? 1e3 + r.zIndex : r.zIndex,
|
|
38
38
|
className: u(s.cellFixed, r.isFirst && s.cellFixedRightFirst)
|
|
39
39
|
} : {};
|
|
40
|
-
},
|
|
40
|
+
}, V = c((e) => typeof h == "function" ? h(e) : e[h], [h]), H = l(() => !L || m.length === 0 ? !1 : m.every((e) => L.selectedRowKeys.includes(V(e))), [
|
|
41
41
|
m,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
]),
|
|
42
|
+
L,
|
|
43
|
+
V
|
|
44
|
+
]), U = l(() => L ? !H && m.some((e) => L.selectedRowKeys.includes(V(e))) : !1, [
|
|
45
45
|
m,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]),
|
|
50
|
-
if (!
|
|
51
|
-
let t = e.target.checked, n = t ? m.map(
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
if (!
|
|
55
|
-
let n = t.target.checked, r =
|
|
56
|
-
|
|
57
|
-
}, { focusedCell:
|
|
46
|
+
L,
|
|
47
|
+
H,
|
|
48
|
+
V
|
|
49
|
+
]), W = (e) => {
|
|
50
|
+
if (!L) return;
|
|
51
|
+
let t = e.target.checked, n = t ? m.map(V) : [], r = t ? m : [];
|
|
52
|
+
L.onChange(n, r);
|
|
53
|
+
}, G = (e, t) => {
|
|
54
|
+
if (!L) return;
|
|
55
|
+
let n = t.target.checked, r = V(e), i = n ? [...L.selectedRowKeys, r] : L.selectedRowKeys.filter((e) => e !== r), a = m.filter((e) => i.includes(V(e)));
|
|
56
|
+
L.onChange(i, a);
|
|
57
|
+
}, { focusedCell: K, handleKeyDown: q, containerRef: J } = a(p, m, !!L), { loaderRef: Y } = o(j), X = p.length + +!!L;
|
|
58
58
|
return /* @__PURE__ */ f("div", {
|
|
59
|
-
className: u("wim-data-grid", s.root,
|
|
60
|
-
"aria-busy":
|
|
59
|
+
className: u("wim-data-grid", s.root, I && s.loading, w === "md" ? s.mobileCardMd : w && s.mobileCard, M),
|
|
60
|
+
"aria-busy": F || void 0,
|
|
61
61
|
children: [/* @__PURE__ */ f("div", {
|
|
62
62
|
className: s.container,
|
|
63
63
|
style: {
|
|
64
64
|
height: x,
|
|
65
65
|
maxHeight: S
|
|
66
66
|
},
|
|
67
|
-
inert:
|
|
67
|
+
inert: I || void 0,
|
|
68
68
|
children: [
|
|
69
69
|
/* @__PURE__ */ f(r, {
|
|
70
|
-
ref:
|
|
71
|
-
onKeyDown:
|
|
70
|
+
ref: J,
|
|
71
|
+
onKeyDown: q,
|
|
72
72
|
tabIndex: 0,
|
|
73
73
|
role: "grid",
|
|
74
74
|
"aria-label": N ?? P("a11y.data_grid"),
|
|
75
75
|
"aria-rowcount": m.length + 1,
|
|
76
|
-
"aria-colcount":
|
|
76
|
+
"aria-colcount": X,
|
|
77
77
|
striped: _,
|
|
78
78
|
bordered: v,
|
|
79
79
|
hoverable: y,
|
|
@@ -82,7 +82,7 @@ function p({ columns: p, data: m, rowKey: h = "id", loading: g = !1, striped: _
|
|
|
82
82
|
fullWidth: !0,
|
|
83
83
|
className: u("wim-table", s.table),
|
|
84
84
|
containerClassName: s.tableContainer,
|
|
85
|
-
children: [/* @__PURE__ */ d(r.Header, { children: /* @__PURE__ */ f(r.Row, { children: [
|
|
85
|
+
children: [/* @__PURE__ */ d(r.Header, { children: /* @__PURE__ */ f(r.Row, { children: [L && /* @__PURE__ */ d(r.Head, {
|
|
86
86
|
role: "columnheader",
|
|
87
87
|
selection: !0,
|
|
88
88
|
stickyLeft: !0,
|
|
@@ -91,15 +91,15 @@ function p({ columns: p, data: m, rowKey: h = "id", loading: g = !1, striped: _
|
|
|
91
91
|
"data-row": -1,
|
|
92
92
|
"data-col": -1,
|
|
93
93
|
"aria-label": P("a11y.select_all_rows"),
|
|
94
|
-
tabIndex:
|
|
95
|
-
children: (
|
|
96
|
-
checked:
|
|
97
|
-
indeterminate:
|
|
98
|
-
onChange:
|
|
94
|
+
tabIndex: K.row === -1 && K.col === -1 ? 0 : -1,
|
|
95
|
+
children: (L.type ?? "checkbox") === "checkbox" && /* @__PURE__ */ d(t, {
|
|
96
|
+
checked: H,
|
|
97
|
+
indeterminate: U,
|
|
98
|
+
onChange: W,
|
|
99
99
|
"aria-label": P("a11y.select_all_rows")
|
|
100
100
|
})
|
|
101
101
|
}), p.map((e, t) => {
|
|
102
|
-
let n =
|
|
102
|
+
let n = B(e.key, !0);
|
|
103
103
|
return /* @__PURE__ */ d(r.Head, {
|
|
104
104
|
role: "columnheader",
|
|
105
105
|
style: {
|
|
@@ -114,16 +114,16 @@ function p({ columns: p, data: m, rowKey: h = "id", loading: g = !1, striped: _
|
|
|
114
114
|
k(e.key, t);
|
|
115
115
|
},
|
|
116
116
|
...n,
|
|
117
|
-
tabIndex:
|
|
117
|
+
tabIndex: K.row === -1 && K.col === (L ? t + 1 : t) ? 0 : -1,
|
|
118
118
|
"data-row": -1,
|
|
119
|
-
"data-col":
|
|
119
|
+
"data-col": L ? t + 1 : t,
|
|
120
120
|
children: e.title
|
|
121
121
|
}, e.key);
|
|
122
122
|
})] }) }), /* @__PURE__ */ d(r.Body, { children: m.map((e, n) => {
|
|
123
|
-
let i =
|
|
123
|
+
let i = V(e), a = L?.selectedRowKeys.includes(i);
|
|
124
124
|
return /* @__PURE__ */ f(r.Row, {
|
|
125
125
|
selected: a,
|
|
126
|
-
children: [
|
|
126
|
+
children: [L && /* @__PURE__ */ d(r.Cell, {
|
|
127
127
|
role: "gridcell",
|
|
128
128
|
selection: !0,
|
|
129
129
|
stickyLeft: !0,
|
|
@@ -131,21 +131,21 @@ function p({ columns: p, data: m, rowKey: h = "id", loading: g = !1, striped: _
|
|
|
131
131
|
stickyZIndex: 150,
|
|
132
132
|
"data-row": n,
|
|
133
133
|
"data-col": -1,
|
|
134
|
-
tabIndex:
|
|
134
|
+
tabIndex: K.row === n && K.col === -1 ? 0 : -1,
|
|
135
135
|
children: /* @__PURE__ */ d(t, {
|
|
136
136
|
checked: a,
|
|
137
|
-
onChange: (t) =>
|
|
137
|
+
onChange: (t) => G(e, t),
|
|
138
138
|
"aria-label": P("a11y.select_row")
|
|
139
139
|
})
|
|
140
140
|
}), p.map((t, i) => {
|
|
141
|
-
let a =
|
|
141
|
+
let a = B(t.key, !1), o = e[t.dataIndex ?? t.key];
|
|
142
142
|
return /* @__PURE__ */ d(r.Cell, {
|
|
143
143
|
role: "gridcell",
|
|
144
144
|
label: typeof t.title == "string" ? t.title : void 0,
|
|
145
145
|
...a,
|
|
146
146
|
"data-row": n,
|
|
147
|
-
"data-col":
|
|
148
|
-
tabIndex:
|
|
147
|
+
"data-col": L ? i + 1 : i,
|
|
148
|
+
tabIndex: K.row === n && K.col === (L ? i + 1 : i) ? 0 : -1,
|
|
149
149
|
children: t.render ? t.render(o, e, n) : o
|
|
150
150
|
}, t.key);
|
|
151
151
|
})]
|
|
@@ -158,31 +158,23 @@ function p({ columns: p, data: m, rowKey: h = "id", loading: g = !1, striped: _
|
|
|
158
158
|
children: C
|
|
159
159
|
}),
|
|
160
160
|
j?.hasMore && /* @__PURE__ */ d("div", {
|
|
161
|
-
ref:
|
|
161
|
+
ref: Y,
|
|
162
162
|
className: s.loader,
|
|
163
|
-
children: j.hasMore && "
|
|
163
|
+
children: j.hasMore && P("dataGrid.loading_more")
|
|
164
164
|
})
|
|
165
165
|
]
|
|
166
166
|
}), A && /* @__PURE__ */ f("div", {
|
|
167
167
|
className: s.footer,
|
|
168
|
-
inert:
|
|
168
|
+
inert: I || void 0,
|
|
169
169
|
children: [/* @__PURE__ */ f("div", {
|
|
170
170
|
className: s.info,
|
|
171
|
-
children: [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
className: s.selectionInfo,
|
|
179
|
-
children: [
|
|
180
|
-
"(",
|
|
181
|
-
F.selectedRowKeys.length,
|
|
182
|
-
" row(s) selected)"
|
|
183
|
-
]
|
|
184
|
-
})
|
|
185
|
-
]
|
|
171
|
+
children: [P("dataGrid.displaying", {
|
|
172
|
+
shown: m.length,
|
|
173
|
+
total: A.total
|
|
174
|
+
}), L?.selectedRowKeys && L.selectedRowKeys.length > 0 && /* @__PURE__ */ d("span", {
|
|
175
|
+
className: s.selectionInfo,
|
|
176
|
+
children: P("dataGrid.rows_selected", { selected: L.selectedRowKeys.length })
|
|
177
|
+
})]
|
|
186
178
|
}), /* @__PURE__ */ d("div", {
|
|
187
179
|
className: s.pagination,
|
|
188
180
|
children: /* @__PURE__ */ d(n, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_root_1ka0q_3`,t=`_container_1ka0q_3`,n=`_footer_1ka0q_3`,r=`_mobileCard_1ka0q_53`,i=`_mobileCardMd_1ka0q_66`,a=`_info_1ka0q_78`,o=`_pagination_1ka0q_89`,s=`_paginationContent_1ka0q_100`,c=`_loading_1ka0q_104`,l=`_loader_1ka0q_109`,u=`_table_1ka0q_118`,d=`_tableContainer_1ka0q_123`,f=`_cellFixed_1ka0q_127`,p=`_cellFixedLeftLast_1ka0q_132`,m=`_cellFixedRightFirst_1ka0q_144`,h=`_selectionInfo_1ka0q_156`,g={root:e,container:t,footer:n,mobileCard:r,mobileCardMd:i,info:a,pagination:o,paginationContent:s,loading:c,loader:l,table:u,tableContainer:d,cellFixed:f,cellFixedLeftLast:p,cellFixedRightFirst:m,selectionInfo:h};exports.cellFixed=f,exports.cellFixedLeftLast=p,exports.cellFixedRightFirst=m,exports.container=t,exports.default=g,exports.footer=n,exports.info=a,exports.loader=l,exports.loading=c,exports.mobileCard=r,exports.mobileCardMd=i,exports.pagination=o,exports.paginationContent=s,exports.root=e,exports.selectionInfo=h,exports.table=u,exports.tableContainer=d;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/data-display/DataGrid/datagrid.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_root_1ka0q_3", t = "_container_1ka0q_3", n = "_footer_1ka0q_3", r = "_mobileCard_1ka0q_53", i = "_mobileCardMd_1ka0q_66", a = "_info_1ka0q_78", o = "_pagination_1ka0q_89", s = "_paginationContent_1ka0q_100", c = "_loading_1ka0q_104", l = "_loader_1ka0q_109", u = "_table_1ka0q_118", d = "_tableContainer_1ka0q_123", f = "_cellFixed_1ka0q_127", p = "_cellFixedLeftLast_1ka0q_132", m = "_cellFixedRightFirst_1ka0q_144", h = "_selectionInfo_1ka0q_156", g = {
|
|
4
4
|
root: e,
|
|
5
5
|
container: t,
|
|
6
6
|
footer: n,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
mobileCard: r,
|
|
8
|
+
mobileCardMd: i,
|
|
9
|
+
info: a,
|
|
10
|
+
pagination: o,
|
|
11
|
+
paginationContent: s,
|
|
12
|
+
loading: c,
|
|
13
|
+
loader: l,
|
|
14
|
+
table: u,
|
|
15
|
+
tableContainer: d,
|
|
16
|
+
cellFixed: f,
|
|
17
|
+
cellFixedLeftLast: p,
|
|
18
|
+
cellFixedRightFirst: m,
|
|
19
|
+
selectionInfo: h
|
|
18
20
|
};
|
|
19
21
|
//#endregion
|
|
20
|
-
export {
|
|
22
|
+
export { f as cellFixed, p as cellFixedLeftLast, m as cellFixedRightFirst, t as container, g as default, n as footer, a as info, l as loader, c as loading, r as mobileCard, i as mobileCardMd, o as pagination, s as paginationContent, e as root, h as selectionInfo, u as table, d as tableContainer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../icon/more-horizontal.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../../icon/more-horizontal.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("./kanban.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=(0,o.forwardRef)(({columns:e,onMove:r,onCardMove:i,className:l,forceMobileUI:d=!1,children:f,asChild:m=!1,...g},_)=>{let{t:v}=n.useWimTranslation(`common`),[y,b]=(0,o.useState)(null),[x,S]=(0,o.useState)(null),[C,w]=(0,o.useState)(null),T=r||i,E=(e,t,n)=>{b({itemId:t,columnId:n}),e.dataTransfer.setData(`text/plain`,`${n}:${t}`),e.dataTransfer.effectAllowed=`move`},D=(e,t)=>{e.preventDefault(),S(t)},O=(e,t)=>{e.preventDefault(),S(null);let[n,r]=e.dataTransfer.getData(`text/plain`).split(`:`);T?.(r,n,t),b(null)},k=(e,t,n)=>{T?.(e,t,n),w(null)},A=o.default.useMemo(()=>{if(e)return e;let t=[];return o.default.Children.forEach(f,e=>{if(o.default.isValidElement(e)){let n=e.props;typeof n.id==`string`&&typeof n.title==`string`&&t.push({id:n.id,title:n.title,items:[]})}}),t},[f,e]),j=()=>f||(e?e.map(e=>(0,c.jsx)(h,{id:e.id,title:e.title,cardCount:e.items.length,children:e.items.map(e=>(0,c.jsx)(p,{id:e.id,children:e.content},e.id))},e.id)):null),M=m?t.Root:`div`;return(0,c.jsx)(u.Provider,{value:{draggedItem:y,dragOverColumn:x,setDragOverColumn:S,handleDragStart:E,handleDragOver:D,handleDrop:O,handleMobileMove:k,activeMobileMenu:C,setActiveMobileMenu:w,columns:A},children:(0,c.jsx)(M,{...g,ref:_,className:(0,s.default)(`wim-kanban`,a.default.root,d&&a.default.touch,l),role:`region`,"aria-label":v(`a11y.kanban_board`),children:(0,c.jsx)(t.Slottable,{children:j()})})})}),u=o.default.createContext(null),d=()=>{let e=o.default.useContext(u);if(!e)throw Error(`Kanban compound components must be used within Kanban`);return e},f=({id:e,title:t,cardCount:n,children:r,className:i})=>{let{dragOverColumn:o,handleDragOver:l,handleDrop:u,setDragOverColumn:f}=d();return(0,c.jsxs)(`div`,{className:(0,s.default)(a.default.column,{[a.default.dragOver]:o===e},i),onDragOver:t=>l(t,e),onDrop:t=>u(t,e),onDragLeave:()=>f(null),children:[(0,c.jsxs)(`div`,{className:a.default.columnHeader,children:[(0,c.jsx)(`div`,{className:a.default.columnTitle,children:t}),n!==void 0&&(0,c.jsx)(`div`,{className:a.default.columnCount,"aria-label":`${n} cards`,children:n})]}),(0,c.jsx)(`div`,{className:a.default.columnBody,children:r})]})},p=({id:e,children:t,disabled:l,className:u})=>{let{t:f}=n.useWimTranslation(`common`),{draggedItem:p,handleDragStart:h,handleMobileMove:g,activeMobileMenu:_,setActiveMobileMenu:v,columns:y}=d(),b=o.default.useContext(m);return(0,c.jsxs)(`div`,{className:(0,s.default)(a.default.card,{[a.default.dragging]:p?.itemId===e,[a.default.disabled]:l},u),draggable:!l,onDragStart:t=>b&&h(t,e,b),children:[(0,c.jsx)(`div`,{className:a.default.cardContent,children:t}),(0,c.jsxs)(`div`,{className:a.default.cardMove,children:[(0,c.jsx)(`button`,{type:`button`,className:a.default.cardMoveBtn,onClick:()=>v(_===e?null:e),"aria-label":f(`a11y.move_card`),disabled:l,children:(0,c.jsx)(i.Icon,{component:r.default,size:`sm`})}),_===e&&(0,c.jsx)(`div`,{className:a.default.cardMoveMenu,role:`listbox`,"aria-label":f(`a11y.move_to_column`),children:y.filter(e=>e.id!==b).map(t=>(0,c.jsx)(`button`,{type:`button`,className:a.default.cardMoveOption,onClick:()=>b&&g(e,b,t.id),role:`option`,"aria-selected":!1,children:t.title},t.id))})]})]})},m=o.default.createContext(null),h=e=>(0,c.jsx)(m.Provider,{value:e.id,children:(0,c.jsx)(f,{...e})}),g=l;g.Column=h,g.Card=p,l.displayName=`Kanban`,g.displayName=`KanbanBoard`,f.displayName=`KanbanColumn`,p.displayName=`KanbanCard`,h.displayName=`KanbanColumnWrapper`,exports.Kanban=l,exports.KanbanBoard=g,exports.default=g,exports.KanbanCard=p,exports.KanbanColumn=f;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
|
-
import n from "../../../
|
|
4
|
-
import
|
|
5
|
-
import i from "
|
|
6
|
-
import a
|
|
7
|
-
import c from "
|
|
8
|
-
import
|
|
3
|
+
import { useWimTranslation as n } from "../../../i18n/useWimTranslation.js";
|
|
4
|
+
import r from "../../../icon/more-horizontal.js";
|
|
5
|
+
import { Icon as i } from "../../media/Icon/Icon.js";
|
|
6
|
+
import a from "./kanban.module.js";
|
|
7
|
+
import o, { forwardRef as s, useState as c } from "react";
|
|
8
|
+
import l from "classnames";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/data-display/Kanban/Kanban.tsx
|
|
10
|
-
var
|
|
11
|
-
let
|
|
12
|
-
|
|
11
|
+
var f = s(({ columns: r, onMove: i, onCardMove: s, className: d, forceMobileUI: f = !1, children: m, asChild: h = !1, ..._ }, y) => {
|
|
12
|
+
let { t: b } = n("common"), [x, S] = c(null), [C, w] = c(null), [T, E] = c(null), D = i || s, O = (e, t, n) => {
|
|
13
|
+
S({
|
|
13
14
|
itemId: t,
|
|
14
15
|
columnId: n
|
|
15
16
|
}), e.dataTransfer.setData("text/plain", `${n}:${t}`), e.dataTransfer.effectAllowed = "move";
|
|
16
|
-
},
|
|
17
|
-
e.preventDefault(),
|
|
18
|
-
},
|
|
19
|
-
e.preventDefault(),
|
|
17
|
+
}, k = (e, t) => {
|
|
18
|
+
e.preventDefault(), w(t);
|
|
19
|
+
}, A = (e, t) => {
|
|
20
|
+
e.preventDefault(), w(null);
|
|
20
21
|
let [n, r] = e.dataTransfer.getData("text/plain").split(":");
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
if (
|
|
22
|
+
D?.(r, n, t), S(null);
|
|
23
|
+
}, j = (e, t, n) => {
|
|
24
|
+
D?.(e, t, n), E(null);
|
|
25
|
+
}, M = o.useMemo(() => {
|
|
26
|
+
if (r) return r;
|
|
26
27
|
let e = [];
|
|
27
|
-
return
|
|
28
|
-
if (
|
|
28
|
+
return o.Children.forEach(m, (t) => {
|
|
29
|
+
if (o.isValidElement(t)) {
|
|
29
30
|
let n = t.props;
|
|
30
31
|
typeof n.id == "string" && typeof n.title == "string" && e.push({
|
|
31
32
|
id: n.id,
|
|
@@ -34,95 +35,95 @@ var d = o(({ columns: n, onMove: r, onCardMove: o, className: u, forceMobileUI:
|
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
}), e;
|
|
37
|
-
}, [
|
|
38
|
+
}, [m, r]), N = () => m || (r ? r.map((e) => /* @__PURE__ */ u(v, {
|
|
38
39
|
id: e.id,
|
|
39
40
|
title: e.title,
|
|
40
41
|
cardCount: e.items.length,
|
|
41
|
-
children: e.items.map((e) => /* @__PURE__ */
|
|
42
|
+
children: e.items.map((e) => /* @__PURE__ */ u(g, {
|
|
42
43
|
id: e.id,
|
|
43
44
|
children: e.content
|
|
44
45
|
}, e.id))
|
|
45
|
-
}, e.id)) : null),
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
}, e.id)) : null), P = h ? e : "div";
|
|
47
|
+
return /* @__PURE__ */ u(p.Provider, {
|
|
47
48
|
value: {
|
|
48
|
-
draggedItem:
|
|
49
|
-
dragOverColumn:
|
|
50
|
-
setDragOverColumn:
|
|
51
|
-
handleDragStart:
|
|
52
|
-
handleDragOver:
|
|
53
|
-
handleDrop:
|
|
54
|
-
handleMobileMove:
|
|
55
|
-
activeMobileMenu:
|
|
56
|
-
setActiveMobileMenu:
|
|
57
|
-
columns:
|
|
49
|
+
draggedItem: x,
|
|
50
|
+
dragOverColumn: C,
|
|
51
|
+
setDragOverColumn: w,
|
|
52
|
+
handleDragStart: O,
|
|
53
|
+
handleDragOver: k,
|
|
54
|
+
handleDrop: A,
|
|
55
|
+
handleMobileMove: j,
|
|
56
|
+
activeMobileMenu: T,
|
|
57
|
+
setActiveMobileMenu: E,
|
|
58
|
+
columns: M
|
|
58
59
|
},
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
...
|
|
61
|
-
ref:
|
|
62
|
-
className:
|
|
60
|
+
children: /* @__PURE__ */ u(P, {
|
|
61
|
+
..._,
|
|
62
|
+
ref: y,
|
|
63
|
+
className: l("wim-kanban", a.root, f && a.touch, d),
|
|
63
64
|
role: "region",
|
|
64
|
-
"aria-label": "
|
|
65
|
-
children: /* @__PURE__ */
|
|
65
|
+
"aria-label": b("a11y.kanban_board"),
|
|
66
|
+
children: /* @__PURE__ */ u(t, { children: N() })
|
|
66
67
|
})
|
|
67
68
|
});
|
|
68
|
-
}),
|
|
69
|
-
let e =
|
|
69
|
+
}), p = o.createContext(null), m = () => {
|
|
70
|
+
let e = o.useContext(p);
|
|
70
71
|
if (!e) throw Error("Kanban compound components must be used within Kanban");
|
|
71
72
|
return e;
|
|
72
|
-
},
|
|
73
|
-
let { dragOverColumn: o, handleDragOver: s, handleDrop:
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
-
className:
|
|
73
|
+
}, h = ({ id: e, title: t, cardCount: n, children: r, className: i }) => {
|
|
74
|
+
let { dragOverColumn: o, handleDragOver: s, handleDrop: c, setDragOverColumn: f } = m();
|
|
75
|
+
return /* @__PURE__ */ d("div", {
|
|
76
|
+
className: l(a.column, { [a.dragOver]: o === e }, i),
|
|
76
77
|
onDragOver: (t) => s(t, e),
|
|
77
|
-
onDrop: (t) =>
|
|
78
|
+
onDrop: (t) => c(t, e),
|
|
78
79
|
onDragLeave: () => f(null),
|
|
79
|
-
children: [/* @__PURE__ */
|
|
80
|
-
className:
|
|
81
|
-
children: [/* @__PURE__ */
|
|
82
|
-
className:
|
|
80
|
+
children: [/* @__PURE__ */ d("div", {
|
|
81
|
+
className: a.columnHeader,
|
|
82
|
+
children: [/* @__PURE__ */ u("div", {
|
|
83
|
+
className: a.columnTitle,
|
|
83
84
|
children: t
|
|
84
|
-
}), n !== void 0 && /* @__PURE__ */
|
|
85
|
-
className:
|
|
85
|
+
}), n !== void 0 && /* @__PURE__ */ u("div", {
|
|
86
|
+
className: a.columnCount,
|
|
86
87
|
"aria-label": `${n} cards`,
|
|
87
88
|
children: n
|
|
88
89
|
})]
|
|
89
|
-
}), /* @__PURE__ */
|
|
90
|
-
className:
|
|
90
|
+
}), /* @__PURE__ */ u("div", {
|
|
91
|
+
className: a.columnBody,
|
|
91
92
|
children: r
|
|
92
93
|
})]
|
|
93
94
|
});
|
|
94
|
-
},
|
|
95
|
-
let { draggedItem:
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
className:
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
},
|
|
101
|
-
draggable: !
|
|
102
|
-
onDragStart: (t) =>
|
|
103
|
-
children: [/* @__PURE__ */
|
|
104
|
-
className:
|
|
95
|
+
}, g = ({ id: e, children: t, disabled: s, className: c }) => {
|
|
96
|
+
let { t: f } = n("common"), { draggedItem: p, handleDragStart: h, handleMobileMove: g, activeMobileMenu: v, setActiveMobileMenu: y, columns: b } = m(), x = o.useContext(_);
|
|
97
|
+
return /* @__PURE__ */ d("div", {
|
|
98
|
+
className: l(a.card, {
|
|
99
|
+
[a.dragging]: p?.itemId === e,
|
|
100
|
+
[a.disabled]: s
|
|
101
|
+
}, c),
|
|
102
|
+
draggable: !s,
|
|
103
|
+
onDragStart: (t) => x && h(t, e, x),
|
|
104
|
+
children: [/* @__PURE__ */ u("div", {
|
|
105
|
+
className: a.cardContent,
|
|
105
106
|
children: t
|
|
106
|
-
}), /* @__PURE__ */
|
|
107
|
-
className:
|
|
108
|
-
children: [/* @__PURE__ */
|
|
107
|
+
}), /* @__PURE__ */ d("div", {
|
|
108
|
+
className: a.cardMove,
|
|
109
|
+
children: [/* @__PURE__ */ u("button", {
|
|
109
110
|
type: "button",
|
|
110
|
-
className:
|
|
111
|
-
onClick: () =>
|
|
112
|
-
"aria-label": "
|
|
113
|
-
disabled:
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
-
component:
|
|
111
|
+
className: a.cardMoveBtn,
|
|
112
|
+
onClick: () => y(v === e ? null : e),
|
|
113
|
+
"aria-label": f("a11y.move_card"),
|
|
114
|
+
disabled: s,
|
|
115
|
+
children: /* @__PURE__ */ u(i, {
|
|
116
|
+
component: r,
|
|
116
117
|
size: "sm"
|
|
117
118
|
})
|
|
118
|
-
}),
|
|
119
|
-
className:
|
|
119
|
+
}), v === e && /* @__PURE__ */ u("div", {
|
|
120
|
+
className: a.cardMoveMenu,
|
|
120
121
|
role: "listbox",
|
|
121
|
-
"aria-label": "
|
|
122
|
-
children:
|
|
122
|
+
"aria-label": f("a11y.move_to_column"),
|
|
123
|
+
children: b.filter((e) => e.id !== x).map((t) => /* @__PURE__ */ u("button", {
|
|
123
124
|
type: "button",
|
|
124
|
-
className:
|
|
125
|
-
onClick: () =>
|
|
125
|
+
className: a.cardMoveOption,
|
|
126
|
+
onClick: () => x && g(e, x, t.id),
|
|
126
127
|
role: "option",
|
|
127
128
|
"aria-selected": !1,
|
|
128
129
|
children: t.title
|
|
@@ -130,10 +131,10 @@ var d = o(({ columns: n, onMove: r, onCardMove: o, className: u, forceMobileUI:
|
|
|
130
131
|
})]
|
|
131
132
|
})]
|
|
132
133
|
});
|
|
133
|
-
},
|
|
134
|
+
}, _ = o.createContext(null), v = (e) => /* @__PURE__ */ u(_.Provider, {
|
|
134
135
|
value: e.id,
|
|
135
|
-
children: /* @__PURE__ */
|
|
136
|
-
}),
|
|
137
|
-
|
|
136
|
+
children: /* @__PURE__ */ u(h, { ...e })
|
|
137
|
+
}), y = f;
|
|
138
|
+
y.Column = v, y.Card = g, f.displayName = "Kanban", y.displayName = "KanbanBoard", h.displayName = "KanbanColumn", g.displayName = "KanbanCard", v.displayName = "KanbanColumnWrapper";
|
|
138
139
|
//#endregion
|
|
139
|
-
export {
|
|
140
|
+
export { f as Kanban, y as KanbanBoard, y as default, g as KanbanCard, h as KanbanColumn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../icon/chevron-down.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("./table.module.cjs"),a=require("./useTableSort.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=o.default.forwardRef(({asChild:e=!1,striped:n=!1,bordered:r=!1,hoverable:a=!1,fullWidth:o=!1,stickyHeader:l=!1,scrollbar:u=`default`,mobileCard:d=!1,height:f,maxHeight:p,containerClassName:m,card:h=!1,className:g,children:_,...v},y)=>{let b={height:f,maxHeight:p,overflow:f||p?`auto`:void 0},x=e?t.Root:`table`;return(0,c.jsx)(`div`,{className:(0,s.default)(i.default.container,l&&i.default.sticky,u===`subtle`&&i.default.subtleScrollbar,u===`hidden`&&i.default.noScrollbar,h&&i.default.cardContainer,m),style:b,tabIndex:f||p?0:void 0,role:`none`,"data-testid":`table-container`,children:(0,c.jsx)(x,{className:(0,s.default)(i.default.root,n&&i.default.striped,r&&i.default.bordered,a&&i.default.hoverable,o&&i.default.fullWidth,l&&i.default.stickyHeader,d&&i.default.mobileCard,`wim-table`,g),ref:y,"data-testid":`table-root`,...v,children:(0,c.jsx)(t.Slottable,{children:_})})})}),u=o.default.forwardRef(({asChild:e=!1,className:n,children:r,...a},o)=>(0,c.jsx)(e?t.Root:`thead`,{className:(0,s.default)(i.default.header,n),ref:o,"data-testid":`table-header`,...a,children:(0,c.jsx)(t.Slottable,{children:r})})),d=o.default.forwardRef(({asChild:e=!1,className:n,children:r,...a},o)=>(0,c.jsx)(e?t.Root:`tbody`,{className:(0,s.default)(i.default.body,n),ref:o,"data-testid":`table-body`,...a,children:(0,c.jsx)(t.Slottable,{children:r})})),f=o.default.forwardRef(({asChild:e=!1,className:n,children:r,...a},o)=>(0,c.jsx)(e?t.Root:`tfoot`,{className:(0,s.default)(i.default.footer,n),ref:o,"data-testid":`table-footer`,...a,children:(0,c.jsx)(t.Slottable,{children:r})})),p=o.default.forwardRef(({asChild:e=!1,selected:n=!1,className:r,children:a,...o},l)=>(0,c.jsx)(e?t.Root:`tr`,{className:(0,s.default)(i.default.row,n&&i.default.selected,r),ref:l,"data-testid":`table-row`,...o,children:(0,c.jsx)(t.Slottable,{children:a})})),m=o.default.forwardRef(({asChild:e=!1,sortable:a=!1,sortDirection:o=`none`,onSort:l,selection:u=!1,stickyLeft:d=!1,stickyRight:f=!1,leftOffset:p,rightOffset:m,stickyZIndex:h,className:g,style:_,children:v,...y},b)=>(0,c.jsx)(e?t.Root:`th`,{className:(0,s.default)(i.default.head,a&&i.default.sortable,u&&i.default.selection,d&&i.default.stickyLeft,f&&i.default.stickyRight,g),style:{..._,left:d?p===void 0?0:p:void 0,right:f?m===void 0?0:m:void 0,zIndex:h===void 0?void 0:h},ref:b,"data-testid":`table-head`,...y,onClick:a?l:y.onClick,tabIndex:y.tabIndex===void 0?a?0:void 0:y.tabIndex,"aria-sort":a?o===`asc`?`ascending`:o===`desc`?`descending`:`none`:void 0,onKeyDown:e=>{a&&l&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(e)),y.onKeyDown?.(e)},children:(0,c.jsxs)(`div`,{className:i.default.headContent,children:[(0,c.jsx)(t.Slottable,{children:v}),a&&(0,c.jsx)(`span`,{className:(0,s.default)(i.default.sortIcon,i.default[o]),children:(0,c.jsx)(r.Icon,{component:n.default,size:`sm`})})]})})),h=o.default.forwardRef(({asChild:e=!1,selection:n=!1,label:r,stickyLeft:a=!1,stickyRight:o=!1,leftOffset:l,rightOffset:u,stickyZIndex:d,className:f,style:p,children:m,...h},g)=>(0,c.jsx)(e?t.Root:`td`,{className:(0,s.default)(i.default.cell,n&&i.default.selection,a&&i.default.stickyLeft,o&&i.default.stickyRight,f),style:{...p,left:a?l===void 0?0:l:void 0,right:o?u===void 0?0:u:void 0,zIndex:d===void 0?void 0:d},"data-label":r,ref:g,"data-testid":`table-cell`,...h,children:(0,c.jsx)(t.Slottable,{children:m})}));l.displayName=`Table`,u.displayName=`Table.Header`,d.displayName=`Table.Body`,f.displayName=`Table.Footer`,p.displayName=`Table.Row`,m.displayName=`Table.Head`,h.displayName=`Table.Cell`;var g=l;g.Header=u,g.Body=d,g.Footer=f,g.Row=p,g.Head=m,g.Cell=h,exports.Table=g,exports.default=g,exports.TableBody=d,exports.TableCell=h,exports.TableFooter=f,exports.TableHead=m,exports.TableHeader=u,exports.TableRow=p,exports.getNextSortDirection=a.getNextSortDirection,exports.useTableSort=a.useTableSort;
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../icon/chevron-down.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("./table.module.cjs"),a=require("./useTableSort.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=o.default.forwardRef(({asChild:e=!1,striped:n=!1,bordered:r=!1,hoverable:a=!1,fullWidth:o=!1,stickyHeader:l=!1,scrollbar:u=`default`,mobileCard:d=!1,height:f,maxHeight:p,containerClassName:m,card:h=!1,className:g,children:_,...v},y)=>{let b={height:f,maxHeight:p,overflow:f||p?`auto`:void 0},x=e?t.Root:`table`;return(0,c.jsx)(`div`,{className:(0,s.default)(i.default.container,l&&i.default.sticky,u===`subtle`&&i.default.subtleScrollbar,u===`hidden`&&i.default.noScrollbar,h&&i.default.cardContainer,m),style:b,tabIndex:f||p?0:void 0,role:`none`,"data-testid":`table-container`,children:(0,c.jsx)(x,{className:(0,s.default)(i.default.root,n&&i.default.striped,r&&i.default.bordered,a&&i.default.hoverable,o&&i.default.fullWidth,l&&i.default.stickyHeader,d===`md`?i.default.mobileCardMd:d&&i.default.mobileCard,`wim-table`,g),ref:y,"data-testid":`table-root`,...v,children:(0,c.jsx)(t.Slottable,{children:_})})})}),u=o.default.forwardRef(({asChild:e=!1,className:n,children:r,...a},o)=>(0,c.jsx)(e?t.Root:`thead`,{className:(0,s.default)(i.default.header,n),ref:o,"data-testid":`table-header`,...a,children:(0,c.jsx)(t.Slottable,{children:r})})),d=o.default.forwardRef(({asChild:e=!1,className:n,children:r,...a},o)=>(0,c.jsx)(e?t.Root:`tbody`,{className:(0,s.default)(i.default.body,n),ref:o,"data-testid":`table-body`,...a,children:(0,c.jsx)(t.Slottable,{children:r})})),f=o.default.forwardRef(({asChild:e=!1,className:n,children:r,...a},o)=>(0,c.jsx)(e?t.Root:`tfoot`,{className:(0,s.default)(i.default.footer,n),ref:o,"data-testid":`table-footer`,...a,children:(0,c.jsx)(t.Slottable,{children:r})})),p=o.default.forwardRef(({asChild:e=!1,selected:n=!1,className:r,children:a,...o},l)=>(0,c.jsx)(e?t.Root:`tr`,{className:(0,s.default)(i.default.row,n&&i.default.selected,r),ref:l,"data-testid":`table-row`,...o,children:(0,c.jsx)(t.Slottable,{children:a})})),m=o.default.forwardRef(({asChild:e=!1,sortable:a=!1,sortDirection:o=`none`,onSort:l,selection:u=!1,stickyLeft:d=!1,stickyRight:f=!1,leftOffset:p,rightOffset:m,stickyZIndex:h,className:g,style:_,children:v,...y},b)=>(0,c.jsx)(e?t.Root:`th`,{className:(0,s.default)(i.default.head,a&&i.default.sortable,u&&i.default.selection,d&&i.default.stickyLeft,f&&i.default.stickyRight,g),style:{..._,left:d?p===void 0?0:p:void 0,right:f?m===void 0?0:m:void 0,zIndex:h===void 0?void 0:h},ref:b,"data-testid":`table-head`,...y,onClick:a?l:y.onClick,tabIndex:y.tabIndex===void 0?a?0:void 0:y.tabIndex,"aria-sort":a?o===`asc`?`ascending`:o===`desc`?`descending`:`none`:void 0,onKeyDown:e=>{a&&l&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(e)),y.onKeyDown?.(e)},children:(0,c.jsxs)(`div`,{className:i.default.headContent,children:[(0,c.jsx)(t.Slottable,{children:v}),a&&(0,c.jsx)(`span`,{className:(0,s.default)(i.default.sortIcon,i.default[o]),children:(0,c.jsx)(r.Icon,{component:n.default,size:`sm`})})]})})),h=o.default.forwardRef(({asChild:e=!1,selection:n=!1,label:r,stickyLeft:a=!1,stickyRight:o=!1,leftOffset:l,rightOffset:u,stickyZIndex:d,className:f,style:p,children:m,...h},g)=>(0,c.jsx)(e?t.Root:`td`,{className:(0,s.default)(i.default.cell,n&&i.default.selection,a&&i.default.stickyLeft,o&&i.default.stickyRight,f),style:{...p,left:a?l===void 0?0:l:void 0,right:o?u===void 0?0:u:void 0,zIndex:d===void 0?void 0:d},"data-label":r,ref:g,"data-testid":`table-cell`,...h,children:(0,c.jsx)(t.Slottable,{children:m})}));l.displayName=`Table`,u.displayName=`Table.Header`,d.displayName=`Table.Body`,f.displayName=`Table.Footer`,p.displayName=`Table.Row`,m.displayName=`Table.Head`,h.displayName=`Table.Cell`;var g=l;g.Header=u,g.Body=d,g.Footer=f,g.Row=p,g.Head=m,g.Cell=h,exports.Table=g,exports.default=g,exports.TableBody=d,exports.TableCell=h,exports.TableFooter=f,exports.TableHead=m,exports.TableHeader=u,exports.TableRow=p,exports.getNextSortDirection=a.getNextSortDirection,exports.useTableSort=a.useTableSort;
|
|
@@ -17,9 +17,10 @@ export interface TableProps extends React.TableHTMLAttributes<HTMLTableElement>
|
|
|
17
17
|
/** Scrollbar style of the container */
|
|
18
18
|
scrollbar?: "default" | "subtle" | "hidden";
|
|
19
19
|
/**
|
|
20
|
-
* Mobile view:
|
|
20
|
+
* Mobile view: switch to a card layout below a container width.
|
|
21
|
+
* `true` / `"sm"` switches under 576px, `"md"` under 768px (the old default).
|
|
21
22
|
*/
|
|
22
|
-
mobileCard?: boolean;
|
|
23
|
+
mobileCard?: boolean | "sm" | "md";
|
|
23
24
|
/** Height of the container (enables vertical scrolling) */
|
|
24
25
|
height?: string | number;
|
|
25
26
|
/** Maximum height of the container (enables vertical scrolling) */
|