wimui 0.64.3 → 0.64.4
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/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +180 -171
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.js +60 -47
- package/dist/i18n/generated/common.cjs +1 -1
- package/dist/i18n/generated/common.d.ts +1 -1
- package/dist/i18n/generated/common.js +15 -6
- package/dist/i18n/generated/form.cjs +1 -1
- package/dist/i18n/generated/form.d.ts +1 -1
- package/dist/i18n/generated/form.js +6 -3
- package/dist/llms-full.txt +1 -1
- package/dist/llms.txt +1 -1
- package/dist/locales/en/common.json +5 -1
- package/dist/locales/en/form.json +2 -1
- package/dist/locales/ja/common.json +5 -1
- package/dist/locales/ja/form.json +2 -1
- package/dist/locales/pt/common.json +5 -1
- package/dist/locales/pt/form.json +2 -1
- package/dist/wimui.umd.js +1 -1
- package/package.json +1 -1
|
@@ -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("../../form/Checkbox/Checkbox.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),i=require("../../form/Checkbox/Checkbox.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]),{fixedLeftOffsets:B,fixedRightOffsets:V}=s.useFixedColumns(e,!!z),H=(e,t=!1)=>{let n=B[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=V[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)}:{}},U=(0,d.useCallback)(e=>typeof h==`function`?h(e):e[h],[h]),W=(0,d.useMemo)(()=>!z||m.length===0?!1:m.every(e=>z.selectedRowKeys.includes(U(e))),[m,z,U]),G=(0,d.useMemo)(()=>z?!W&&m.some(e=>z.selectedRowKeys.includes(U(e))):!1,[m,z,W,U]),K=e=>{if(!z)return;let t=e.target.checked,n=t?m.map(U):[],r=t?m:[];z.onChange(n,r)},q=(e,t)=>{if(!z)return;let n=t.target.checked,r=U(e),i=n?[...z.selectedRowKeys,r]:z.selectedRowKeys.filter(e=>e!==r),a=m.filter(e=>i.includes(U(e)));z.onChange(i,a)},{focusedCell:J,handleKeyDown:Y,containerRef:X}=c.useDataGridKeyboard(e,m,!!z),{loaderRef:Z}=l.useInfiniteScroll(j),Q=e.length+ +!!z,[$,ee]=(0,d.useState)(``);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:[(0,p.jsx)(r.VisuallyHidden,{role:`status`,"aria-atomic":`true`,children:$}),(0,p.jsxs)(`div`,{className:u.default.container,style:{height:x,maxHeight:S},inert:R||void 0,children:[(0,p.jsxs)(o.Table,{ref:X,onKeyDown:Y,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":Q,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,{role:`columnheader`,selection:!0,stickyLeft:!0,leftOffset:0,stickyZIndex:1150,"data-row":-1,"data-col":-1,"aria-label":I(`a11y.select_all_rows`),tabIndex:J.row===-1&&J.col===-1?0:-1,children:(z.type??`checkbox`)===`checkbox`&&(0,p.jsx)(i.Checkbox,{checked:W,indeterminate:G,onChange:K,"aria-label":I(`a11y.select_all_rows`)})}),e.map((e,t)=>{let n=H(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;ee(I(t===`asc`?`dataGrid.sorted_ascending`:t===`desc`?`dataGrid.sorted_descending`:`dataGrid.sort_cleared`,{column:n})),k(e.key,t)},...n,tabIndex:J.row===-1&&J.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 r=U(t),a=z?.selectedRowKeys.includes(r);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:J.row===n&&J.col===-1?0:-1,children:(0,p.jsx)(i.Checkbox,{checked:a,onChange:e=>q(t,e),"aria-label":I(`a11y.select_row_numbered`,{row:n+1})})}),e.map((e,r)=>{let i=H(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:J.row===n&&J.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)})]},r)})})]}),m.length===0&&C&&(0,p.jsx)(`div`,{role:`status`,className:u.default.empty,children:C}),j?.hasMore&&(0,p.jsx)(`div`,{ref:Z,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,197 +1,206 @@
|
|
|
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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import c from "./
|
|
11
|
-
import
|
|
12
|
-
import d from "
|
|
13
|
-
import
|
|
4
|
+
import { VisuallyHidden as n } from "../../layout/VisuallyHidden/VisuallyHidden.js";
|
|
5
|
+
import { Checkbox as r } from "../../form/Checkbox/Checkbox.js";
|
|
6
|
+
import { Pagination as i } from "../../navigation/Pagination/Pagination.js";
|
|
7
|
+
import { Table as a } from "../Table/Table.js";
|
|
8
|
+
import { useFixedColumns as o } from "./useFixedColumns.js";
|
|
9
|
+
import { useDataGridKeyboard as s } from "./useDataGridKeyboard.js";
|
|
10
|
+
import { useInfiniteScroll as c } from "./useInfiniteScroll.js";
|
|
11
|
+
import l from "./datagrid.module.js";
|
|
12
|
+
import { useCallback as u, useMemo as d, useState as f } from "react";
|
|
13
|
+
import p from "classnames";
|
|
14
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
14
15
|
//#region src/components/data-display/DataGrid/DataGrid.tsx
|
|
15
|
-
function
|
|
16
|
-
let { t:
|
|
16
|
+
function g({ columns: g, data: _, rowKey: v = "id", loading: y = !1, striped: b = !1, bordered: x = !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 = y !== !1 && y !== void 0, V = y === !0 || y === "blocking", H = d(() => O ? O === !0 ? {
|
|
17
18
|
type: "checkbox",
|
|
18
|
-
selectedRowKeys:
|
|
19
|
+
selectedRowKeys: k ?? [],
|
|
19
20
|
onChange: (e, t) => {
|
|
20
|
-
|
|
21
|
+
A?.(e, t);
|
|
21
22
|
}
|
|
22
|
-
} :
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
]), { fixedLeftOffsets:
|
|
27
|
-
let n =
|
|
23
|
+
} : O : null, [
|
|
24
|
+
O,
|
|
25
|
+
k,
|
|
26
|
+
A
|
|
27
|
+
]), { fixedLeftOffsets: U, fixedRightOffsets: W } = o(g, !!H), G = (e, t = !1) => {
|
|
28
|
+
let n = U[e];
|
|
28
29
|
if (n) return {
|
|
29
30
|
stickyLeft: !0,
|
|
30
31
|
leftOffset: n.offset,
|
|
31
32
|
stickyZIndex: t ? 1e3 + n.zIndex : n.zIndex,
|
|
32
|
-
className:
|
|
33
|
+
className: p(l.cellFixed, n.isLast && l.cellFixedLeftLast)
|
|
33
34
|
};
|
|
34
|
-
let r =
|
|
35
|
+
let r = W[e];
|
|
35
36
|
return r ? {
|
|
36
37
|
stickyRight: !0,
|
|
37
38
|
rightOffset: r.offset,
|
|
38
39
|
stickyZIndex: t ? 1e3 + r.zIndex : r.zIndex,
|
|
39
|
-
className:
|
|
40
|
+
className: p(l.cellFixed, r.isFirst && l.cellFixedRightFirst)
|
|
40
41
|
} : {};
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
]),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]),
|
|
51
|
-
if (!
|
|
52
|
-
let t = e.target.checked, n = t ?
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
if (!
|
|
56
|
-
let n = t.target.checked, r =
|
|
57
|
-
|
|
58
|
-
}, { focusedCell:
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
className:
|
|
61
|
-
"aria-busy":
|
|
62
|
-
children: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"data-col": -1,
|
|
95
|
-
"aria-label": L("a11y.select_all_rows"),
|
|
96
|
-
tabIndex: Y.row === -1 && Y.col === -1 ? 0 : -1,
|
|
97
|
-
children: (B.type ?? "checkbox") === "checkbox" && /* @__PURE__ */ f(n, {
|
|
98
|
-
checked: G,
|
|
99
|
-
indeterminate: K,
|
|
100
|
-
onChange: q,
|
|
101
|
-
"aria-label": L("a11y.select_all_rows")
|
|
102
|
-
})
|
|
103
|
-
}), m.map((e, t) => {
|
|
104
|
-
let n = U(e.key, !0);
|
|
105
|
-
return /* @__PURE__ */ f(i.Head, {
|
|
42
|
+
}, K = u((e) => typeof v == "function" ? v(e) : e[v], [v]), q = d(() => !H || _.length === 0 ? !1 : _.every((e) => H.selectedRowKeys.includes(K(e))), [
|
|
43
|
+
_,
|
|
44
|
+
H,
|
|
45
|
+
K
|
|
46
|
+
]), J = d(() => H ? !q && _.some((e) => H.selectedRowKeys.includes(K(e))) : !1, [
|
|
47
|
+
_,
|
|
48
|
+
H,
|
|
49
|
+
q,
|
|
50
|
+
K
|
|
51
|
+
]), Y = (e) => {
|
|
52
|
+
if (!H) return;
|
|
53
|
+
let t = e.target.checked, n = t ? _.map(K) : [], r = t ? _ : [];
|
|
54
|
+
H.onChange(n, r);
|
|
55
|
+
}, X = (e, t) => {
|
|
56
|
+
if (!H) return;
|
|
57
|
+
let n = t.target.checked, r = K(e), i = n ? [...H.selectedRowKeys, r] : H.selectedRowKeys.filter((e) => e !== r), a = _.filter((e) => i.includes(K(e)));
|
|
58
|
+
H.onChange(i, a);
|
|
59
|
+
}, { focusedCell: Z, handleKeyDown: Q, containerRef: $ } = s(g, _, !!H), { loaderRef: ee } = c(P), te = g.length + +!!H, [ne, re] = f("");
|
|
60
|
+
return /* @__PURE__ */ h("div", {
|
|
61
|
+
className: p("wim-data-grid", l.root, V && l.loading, D === "md" ? l.mobileCardMd : D && l.mobileCard, F),
|
|
62
|
+
"aria-busy": B || void 0,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ m(n, {
|
|
65
|
+
role: "status",
|
|
66
|
+
"aria-atomic": "true",
|
|
67
|
+
children: ne
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ h("div", {
|
|
70
|
+
className: l.container,
|
|
71
|
+
style: {
|
|
72
|
+
height: w,
|
|
73
|
+
maxHeight: T
|
|
74
|
+
},
|
|
75
|
+
inert: V || void 0,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ h(a, {
|
|
78
|
+
ref: $,
|
|
79
|
+
onKeyDown: Q,
|
|
80
|
+
tabIndex: 0,
|
|
81
|
+
role: "grid",
|
|
82
|
+
"aria-label": R ? void 0 : L ?? I ?? z("a11y.data_grid"),
|
|
83
|
+
"aria-labelledby": R,
|
|
84
|
+
"aria-rowcount": _.length + 1,
|
|
85
|
+
"aria-colcount": te,
|
|
86
|
+
striped: b,
|
|
87
|
+
bordered: x,
|
|
88
|
+
hoverable: S,
|
|
89
|
+
stickyHeader: C,
|
|
90
|
+
mobileCard: D,
|
|
91
|
+
fullWidth: !0,
|
|
92
|
+
className: p("wim-table", l.table),
|
|
93
|
+
containerClassName: l.tableContainer,
|
|
94
|
+
children: [/* @__PURE__ */ m(a.Header, { children: /* @__PURE__ */ h(a.Row, { children: [H && /* @__PURE__ */ m(a.Head, {
|
|
106
95
|
role: "columnheader",
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
sortable: !!(e.sortable && A),
|
|
112
|
-
sortDirection: k?.key === e.key ? k.direction : "none",
|
|
113
|
-
onSort: () => {
|
|
114
|
-
if (!e.sortable || !A) return;
|
|
115
|
-
let t = k?.key === e.key ? k.direction === "asc" ? "desc" : k.direction === "desc" ? "none" : "asc" : "asc";
|
|
116
|
-
A(e.key, t);
|
|
117
|
-
},
|
|
118
|
-
...n,
|
|
119
|
-
tabIndex: Y.row === -1 && Y.col === (B ? t + 1 : t) ? 0 : -1,
|
|
96
|
+
selection: !0,
|
|
97
|
+
stickyLeft: !0,
|
|
98
|
+
leftOffset: 0,
|
|
99
|
+
stickyZIndex: 1150,
|
|
120
100
|
"data-row": -1,
|
|
121
|
-
"data-col":
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
101
|
+
"data-col": -1,
|
|
102
|
+
"aria-label": z("a11y.select_all_rows"),
|
|
103
|
+
tabIndex: Z.row === -1 && Z.col === -1 ? 0 : -1,
|
|
104
|
+
children: (H.type ?? "checkbox") === "checkbox" && /* @__PURE__ */ m(r, {
|
|
105
|
+
checked: q,
|
|
106
|
+
indeterminate: J,
|
|
107
|
+
onChange: Y,
|
|
108
|
+
"aria-label": z("a11y.select_all_rows")
|
|
109
|
+
})
|
|
110
|
+
}), g.map((e, t) => {
|
|
111
|
+
let n = G(e.key, !0);
|
|
112
|
+
return /* @__PURE__ */ m(a.Head, {
|
|
113
|
+
role: "columnheader",
|
|
114
|
+
style: {
|
|
115
|
+
width: e.width,
|
|
116
|
+
minWidth: e.width
|
|
117
|
+
},
|
|
118
|
+
sortable: !!(e.sortable && M),
|
|
119
|
+
sortDirection: j?.key === e.key ? j.direction : "none",
|
|
120
|
+
onSort: () => {
|
|
121
|
+
if (!e.sortable || !M) return;
|
|
122
|
+
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
|
+
re(z(t === "asc" ? "dataGrid.sorted_ascending" : t === "desc" ? "dataGrid.sorted_descending" : "dataGrid.sort_cleared", { column: n })), M(e.key, t);
|
|
124
|
+
},
|
|
125
|
+
...n,
|
|
126
|
+
tabIndex: Z.row === -1 && Z.col === (H ? t + 1 : t) ? 0 : -1,
|
|
127
|
+
"data-row": -1,
|
|
128
|
+
"data-col": H ? t + 1 : t,
|
|
129
|
+
children: e.title
|
|
130
|
+
}, e.key);
|
|
131
|
+
})] }) }), /* @__PURE__ */ m(a.Body, { children: _.map((e, t) => {
|
|
132
|
+
let n = K(e), i = H?.selectedRowKeys.includes(n);
|
|
133
|
+
return /* @__PURE__ */ h(a.Row, {
|
|
134
|
+
selected: i,
|
|
135
|
+
children: [H && /* @__PURE__ */ m(a.Cell, {
|
|
145
136
|
role: "gridcell",
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
selection: !0,
|
|
138
|
+
stickyLeft: !0,
|
|
139
|
+
leftOffset: 0,
|
|
140
|
+
stickyZIndex: 150,
|
|
148
141
|
"data-row": t,
|
|
149
|
-
"data-col":
|
|
150
|
-
tabIndex:
|
|
151
|
-
children:
|
|
152
|
-
|
|
153
|
-
|
|
142
|
+
"data-col": -1,
|
|
143
|
+
tabIndex: Z.row === t && Z.col === -1 ? 0 : -1,
|
|
144
|
+
children: /* @__PURE__ */ m(r, {
|
|
145
|
+
checked: i,
|
|
146
|
+
onChange: (t) => X(e, t),
|
|
147
|
+
"aria-label": z("a11y.select_row_numbered", { row: t + 1 })
|
|
154
148
|
})
|
|
155
|
-
}, n
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
149
|
+
}), g.map((n, r) => {
|
|
150
|
+
let i = G(n.key, !1), o = e[n.dataIndex ?? n.key];
|
|
151
|
+
return /* @__PURE__ */ m(a.Cell, {
|
|
152
|
+
role: "gridcell",
|
|
153
|
+
label: typeof n.title == "string" ? n.title : void 0,
|
|
154
|
+
...i,
|
|
155
|
+
"data-row": t,
|
|
156
|
+
"data-col": H ? r + 1 : r,
|
|
157
|
+
tabIndex: Z.row === t && Z.col === (H ? r + 1 : r) ? 0 : -1,
|
|
158
|
+
children: n.maxWidth == null ? n.render ? n.render(o, e, t) : o : /* @__PURE__ */ m("div", {
|
|
159
|
+
style: { maxWidth: n.maxWidth },
|
|
160
|
+
children: n.render ? n.render(o, e, t) : o
|
|
161
|
+
})
|
|
162
|
+
}, n.key);
|
|
163
|
+
})]
|
|
164
|
+
}, n);
|
|
165
|
+
}) })]
|
|
166
|
+
}),
|
|
167
|
+
_.length === 0 && E && /* @__PURE__ */ m("div", {
|
|
168
|
+
role: "status",
|
|
169
|
+
className: l.empty,
|
|
170
|
+
children: E
|
|
171
|
+
}),
|
|
172
|
+
P?.hasMore && /* @__PURE__ */ m("div", {
|
|
173
|
+
ref: ee,
|
|
174
|
+
className: l.loader,
|
|
175
|
+
children: P.hasMore && z("dataGrid.loading_more")
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}),
|
|
179
|
+
N && /* @__PURE__ */ h("div", {
|
|
180
|
+
className: l.footer,
|
|
181
|
+
inert: V || void 0,
|
|
182
|
+
children: [/* @__PURE__ */ h("div", {
|
|
183
|
+
className: l.info,
|
|
184
|
+
children: [z("dataGrid.displaying", {
|
|
185
|
+
shown: _.length,
|
|
186
|
+
total: N.total
|
|
187
|
+
}), H?.selectedRowKeys && H.selectedRowKeys.length > 0 && /* @__PURE__ */ m("span", {
|
|
188
|
+
className: l.selectionInfo,
|
|
189
|
+
children: z("dataGrid.rows_selected", { selected: H.selectedRowKeys.length })
|
|
190
|
+
})]
|
|
191
|
+
}), /* @__PURE__ */ m("div", {
|
|
192
|
+
className: l.pagination,
|
|
193
|
+
children: /* @__PURE__ */ m(i, {
|
|
194
|
+
className: l.paginationContent,
|
|
195
|
+
current: N.current,
|
|
196
|
+
total: N.total,
|
|
197
|
+
pageSize: N.pageSize,
|
|
198
|
+
onChange: N.onChange
|
|
199
|
+
})
|
|
182
200
|
})]
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
children: /* @__PURE__ */ f(r, {
|
|
186
|
-
className: c.paginationContent,
|
|
187
|
-
current: j.current,
|
|
188
|
-
total: j.total,
|
|
189
|
-
pageSize: j.pageSize,
|
|
190
|
-
onChange: j.onChange
|
|
191
|
-
})
|
|
192
|
-
})]
|
|
193
|
-
})]
|
|
201
|
+
})
|
|
202
|
+
]
|
|
194
203
|
});
|
|
195
204
|
}
|
|
196
205
|
//#endregion
|
|
197
|
-
export {
|
|
206
|
+
export { g as DataGrid };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),r=require("../Button/Button.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("./file-upload.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=({label:e,buttonLabel:u,noFileLabel:d,accept:f,multiple:p=!1,disabled:m=!1,value:h,onChange:g,className:_,iconName:v,iconPosition:y,size:b=`md`,error:x,required:S,layout:C=`vertical`,"aria-label":w,"aria-labelledby":T,"aria-describedby":E})=>{let{t:D}=t.useWimTranslation(i.formNs),O=`wim-fileupload-${s.default.useId()}`,k=e?`${O}-label`:void 0,A=x?`${O}-error`:void 0,j=S?`${O}-required`:void 0,M=[E,A,j].filter(Boolean).join(` `)
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),r=require("../Button/Button.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("./file-upload.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=({label:e,buttonLabel:u,noFileLabel:d,accept:f,multiple:p=!1,disabled:m=!1,value:h,onChange:g,className:_,iconName:v,iconPosition:y,size:b=`md`,error:x,required:S,layout:C=`vertical`,"aria-label":w,"aria-labelledby":T,"aria-describedby":E})=>{let{t:D}=t.useWimTranslation(i.formNs),O=`wim-fileupload-${s.default.useId()}`,k=e?`${O}-label`:void 0,A=x?`${O}-error`:void 0,j=S?`${O}-required`:void 0,M=`${O}-files`,N=[E,M,A,j].filter(Boolean).join(` `),P=(0,s.useRef)(null),[F,I]=(0,s.useState)(null),[L,R]=(0,s.useState)(``),z=(0,s.useRef)(void 0);(0,s.useEffect)(()=>()=>clearTimeout(z.current),[]);let B=()=>{P.current?.click()},V=e=>{let t=e.target.files;if(I(t),clearTimeout(z.current),R(``),t&&t.length>0){let e=Array.from(t).map(e=>e.name).join(`, `);z.current=setTimeout(()=>R(D(`fileupload.selected`,{files:e})),700)}g&&g(t)},H=h===void 0?F?Array.from(F).map(e=>e.name):[]:h,U=H.length>0?H.join(`, `):d??D(`fileupload.no_file`);return(0,l.jsx)(a.FieldTemplate,{label:e,error:x,required:S,layout:C,labelId:k,errorId:A,className:(0,c.default)(`wim-file-upload`,o.default.root,o.default[b],_),children:(0,l.jsxs)(`div`,{className:o.default.controls,children:[(0,l.jsx)(`input`,{type:`file`,ref:P,accept:f,multiple:p,disabled:m,onChange:V,className:o.default.input,"aria-hidden":`true`,tabIndex:-1}),(0,l.jsx)(r.Button,{onClick:B,disabled:m,variant:`outline`,icon:v,iconPosition:y,size:b,"aria-labelledby":k??T,"aria-label":k||T?void 0:w,"aria-describedby":N,"aria-invalid":x?!0:void 0,children:u??D(`fileupload.button`)}),S&&(0,l.jsx)(n.VisuallyHidden,{id:j,children:D(`form.required`)}),(0,l.jsx)(n.VisuallyHidden,{role:`status`,"aria-atomic":`true`,children:L}),(0,l.jsx)(`span`,{id:M,className:(0,c.default)(o.default.fileNames,o.default[b],m&&o.default.disabled),"aria-disabled":m||void 0,children:U})]})})};exports.FileUpload=u;
|
|
@@ -5,68 +5,81 @@ import { Button as n } from "../Button/Button.js";
|
|
|
5
5
|
import { formNs as r } from "../../../i18n/generated/form.js";
|
|
6
6
|
import { FieldTemplate as i } from "../FieldTemplate/FieldTemplate.js";
|
|
7
7
|
import a from "./file-upload.module.js";
|
|
8
|
-
import o, {
|
|
9
|
-
import
|
|
10
|
-
import { jsx as
|
|
8
|
+
import o, { useEffect as s, useRef as c, useState as l } from "react";
|
|
9
|
+
import u from "classnames";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/form/FileUpload/FileUpload.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
P
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
var p = ({ label: p, buttonLabel: m, noFileLabel: h, accept: g, multiple: _ = !1, disabled: v = !1, value: y, onChange: b, className: x, iconName: S, iconPosition: C, size: w = "md", error: T, required: E, layout: D = "vertical", "aria-label": O, "aria-labelledby": k, "aria-describedby": A }) => {
|
|
13
|
+
let { t: j } = e(r), M = `wim-fileupload-${o.useId()}`, N = p ? `${M}-label` : void 0, P = T ? `${M}-error` : void 0, F = E ? `${M}-required` : void 0, I = `${M}-files`, L = [
|
|
14
|
+
A,
|
|
15
|
+
I,
|
|
16
|
+
P,
|
|
17
|
+
F
|
|
18
|
+
].filter(Boolean).join(" "), R = c(null), [z, B] = l(null), [V, H] = l(""), U = c(void 0);
|
|
19
|
+
s(() => () => clearTimeout(U.current), []);
|
|
20
|
+
let W = () => {
|
|
21
|
+
R.current?.click();
|
|
22
|
+
}, G = (e) => {
|
|
20
23
|
let t = e.target.files;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
if (B(t), clearTimeout(U.current), H(""), t && t.length > 0) {
|
|
25
|
+
let e = Array.from(t).map((e) => e.name).join(", ");
|
|
26
|
+
U.current = setTimeout(() => H(j("fileupload.selected", { files: e })), 700);
|
|
27
|
+
}
|
|
28
|
+
b && b(t);
|
|
29
|
+
}, K = y === void 0 ? z ? Array.from(z).map((e) => e.name) : [] : y, q = K.length > 0 ? K.join(", ") : h ?? j("fileupload.no_file");
|
|
30
|
+
return /* @__PURE__ */ d(i, {
|
|
31
|
+
label: p,
|
|
32
|
+
error: T,
|
|
33
|
+
required: E,
|
|
34
|
+
layout: D,
|
|
35
|
+
labelId: N,
|
|
36
|
+
errorId: P,
|
|
37
|
+
className: u("wim-file-upload", a.root, a[w], x),
|
|
38
|
+
children: /* @__PURE__ */ f("div", {
|
|
32
39
|
className: a.controls,
|
|
33
40
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ d("input", {
|
|
35
42
|
type: "file",
|
|
36
|
-
ref:
|
|
37
|
-
accept:
|
|
38
|
-
multiple:
|
|
39
|
-
disabled:
|
|
40
|
-
onChange:
|
|
43
|
+
ref: R,
|
|
44
|
+
accept: g,
|
|
45
|
+
multiple: _,
|
|
46
|
+
disabled: v,
|
|
47
|
+
onChange: G,
|
|
41
48
|
className: a.input,
|
|
42
49
|
"aria-hidden": "true",
|
|
43
50
|
tabIndex: -1
|
|
44
51
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
onClick:
|
|
47
|
-
disabled:
|
|
52
|
+
/* @__PURE__ */ d(n, {
|
|
53
|
+
onClick: W,
|
|
54
|
+
disabled: v,
|
|
48
55
|
variant: "outline",
|
|
49
|
-
icon:
|
|
50
|
-
iconPosition:
|
|
51
|
-
size:
|
|
52
|
-
"aria-labelledby":
|
|
53
|
-
"aria-label":
|
|
54
|
-
"aria-describedby":
|
|
55
|
-
"aria-invalid":
|
|
56
|
-
children:
|
|
56
|
+
icon: S,
|
|
57
|
+
iconPosition: C,
|
|
58
|
+
size: w,
|
|
59
|
+
"aria-labelledby": N ?? k,
|
|
60
|
+
"aria-label": N || k ? void 0 : O,
|
|
61
|
+
"aria-describedby": L,
|
|
62
|
+
"aria-invalid": T ? !0 : void 0,
|
|
63
|
+
children: m ?? j("fileupload.button")
|
|
57
64
|
}),
|
|
58
|
-
|
|
59
|
-
id:
|
|
60
|
-
children:
|
|
65
|
+
E && /* @__PURE__ */ d(t, {
|
|
66
|
+
id: F,
|
|
67
|
+
children: j("form.required")
|
|
61
68
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
"aria-
|
|
65
|
-
children:
|
|
69
|
+
/* @__PURE__ */ d(t, {
|
|
70
|
+
role: "status",
|
|
71
|
+
"aria-atomic": "true",
|
|
72
|
+
children: V
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ d("span", {
|
|
75
|
+
id: I,
|
|
76
|
+
className: u(a.fileNames, a[w], v && a.disabled),
|
|
77
|
+
"aria-disabled": v || void 0,
|
|
78
|
+
children: q
|
|
66
79
|
})
|
|
67
80
|
]
|
|
68
81
|
})
|
|
69
82
|
});
|
|
70
83
|
};
|
|
71
84
|
//#endregion
|
|
72
|
-
export {
|
|
85
|
+
export { p as FileUpload };
|