orc-shared 5.10.1-dev.6 → 5.10.1-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppFrame/MenuItem.js +3 -12
- package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
- package/dist/components/ToastList.js +95 -64
- package/dist/getTheme.js +0 -5
- package/dist/utils/toastHelper.js +52 -0
- package/package.json +1 -1
- package/src/components/AppFrame/MenuItem.js +1 -9
- package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
- package/src/components/MaterialUI/DataDisplay/Table.test.js +20 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
- package/src/components/ToastList.js +79 -90
- package/src/components/ToastList.test.js +29 -103
- package/src/getTheme.js +0 -5
- package/src/utils/toastHelper.js +8 -0
- package/src/utils/toastHelper.test.js +41 -0
- package/dist/components/CategoryList.js +0 -197
- package/dist/components/List/DataCell.js +0 -129
- package/dist/components/List/HeadCell.js +0 -125
- package/dist/components/List/HeadRow.js +0 -73
- package/dist/components/List/List.js +0 -274
- package/dist/components/List/Row.js +0 -109
- package/dist/components/List/enhanceColumnDefs.js +0 -111
- package/dist/components/List/index.js +0 -59
- package/src/components/CategoryList.js +0 -140
- package/src/components/CategoryList.test.js +0 -667
- package/src/components/List/DataCell.js +0 -77
- package/src/components/List/DataCell.test.js +0 -357
- package/src/components/List/HeadCell.js +0 -105
- package/src/components/List/HeadCell.test.js +0 -331
- package/src/components/List/HeadRow.js +0 -21
- package/src/components/List/HeadRow.test.js +0 -27
- package/src/components/List/List.js +0 -162
- package/src/components/List/List.test.js +0 -705
- package/src/components/List/Row.js +0 -72
- package/src/components/List/Row.test.js +0 -194
- package/src/components/List/enhanceColumnDefs.js +0 -54
- package/src/components/List/enhanceColumnDefs.test.js +0 -179
- package/src/components/List/index.js +0 -6
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { FormattedNumber, FormattedDate, FormattedTime } from "react-intl";
|
|
4
|
-
import { safeGet, getThemeProp } from "../../utils";
|
|
5
|
-
import Switch from "../Switch";
|
|
6
|
-
import Checkbox from "../Checkbox";
|
|
7
|
-
import Text from "../Text";
|
|
8
|
-
|
|
9
|
-
const arrify = thing => (Array.isArray(thing) ? thing : [thing]);
|
|
10
|
-
|
|
11
|
-
const renderByType = (value, def, rowId, selected, row) => {
|
|
12
|
-
const transformedValue = def.transform ? def.transform(value) : value;
|
|
13
|
-
switch (def.type) {
|
|
14
|
-
case "custom": {
|
|
15
|
-
const Comp = def.component;
|
|
16
|
-
return <Comp {...row} {...def.funcs} />;
|
|
17
|
-
}
|
|
18
|
-
case "currency": {
|
|
19
|
-
let currency = def.currency;
|
|
20
|
-
if (Array.isArray(currency)) {
|
|
21
|
-
currency = safeGet(row, ...currency);
|
|
22
|
-
}
|
|
23
|
-
return (
|
|
24
|
-
<FormattedNumber
|
|
25
|
-
style="currency" // eslint-disable-line react/style-prop-object
|
|
26
|
-
currency={currency}
|
|
27
|
-
value={transformedValue || "0"}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
case "date":
|
|
32
|
-
return <FormattedDate value={transformedValue} />;
|
|
33
|
-
case "datetime":
|
|
34
|
-
return (
|
|
35
|
-
<React.Fragment>
|
|
36
|
-
<FormattedDate value={transformedValue} /> <FormattedTime value={transformedValue} />
|
|
37
|
-
</React.Fragment>
|
|
38
|
-
);
|
|
39
|
-
case "select":
|
|
40
|
-
return <Checkbox id={"select_" + rowId} value={selected} data-row-id={rowId} onChange={def.onChange} />;
|
|
41
|
-
case "switch":
|
|
42
|
-
return <Switch value={!!transformedValue} {...def.switch} data-row-id={rowId} onChange={def.onChange} />;
|
|
43
|
-
default:
|
|
44
|
-
return transformedValue ? <Text message={transformedValue} /> : null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const TableData = styled.td`
|
|
49
|
-
border: 0 solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
50
|
-
border-top-width: 1px;
|
|
51
|
-
tr:first-child & {
|
|
52
|
-
border-top-width: 0;
|
|
53
|
-
}
|
|
54
|
-
tr:last-child & {
|
|
55
|
-
border-bottom-width: 1px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
height: 20px;
|
|
59
|
-
padding: 15px 20px;
|
|
60
|
-
white-space: nowrap;
|
|
61
|
-
overflow-x: hidden;
|
|
62
|
-
text-overflow: ellipsis;
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
const DataCell = ({ columnDef, row, rowId, selected }) => (
|
|
66
|
-
<TableData>
|
|
67
|
-
{renderByType(
|
|
68
|
-
safeGet(row, ...arrify(columnDef.fieldName)) || columnDef.defaultValue,
|
|
69
|
-
columnDef,
|
|
70
|
-
rowId,
|
|
71
|
-
selected,
|
|
72
|
-
row,
|
|
73
|
-
)}
|
|
74
|
-
</TableData>
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
export default DataCell;
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Provider } from "react-redux";
|
|
3
|
-
import { IntlProvider } from "react-intl";
|
|
4
|
-
import DataCell, { TableData } from "./DataCell";
|
|
5
|
-
import Switch from "../Switch";
|
|
6
|
-
import Checkbox from "../Checkbox";
|
|
7
|
-
|
|
8
|
-
const TestComp = () => <div />;
|
|
9
|
-
|
|
10
|
-
describe("DataCell", () => {
|
|
11
|
-
it("renders a cell as defined by column and row", () => {
|
|
12
|
-
const columnDef = { fieldName: "test" };
|
|
13
|
-
const row = { test: "A text", extraneous: "Don't show" };
|
|
14
|
-
return expect(
|
|
15
|
-
<Provider
|
|
16
|
-
store={{
|
|
17
|
-
subscribe: () => {},
|
|
18
|
-
dispatch: () => {},
|
|
19
|
-
getState: () => ({}),
|
|
20
|
-
}}
|
|
21
|
-
>
|
|
22
|
-
<table>
|
|
23
|
-
<tbody>
|
|
24
|
-
<tr>
|
|
25
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
26
|
-
</tr>
|
|
27
|
-
</tbody>
|
|
28
|
-
</table>
|
|
29
|
-
</Provider>,
|
|
30
|
-
"when mounted",
|
|
31
|
-
"to satisfy",
|
|
32
|
-
<table>
|
|
33
|
-
<tbody>
|
|
34
|
-
<tr>
|
|
35
|
-
<TableData>A text</TableData>
|
|
36
|
-
</tr>
|
|
37
|
-
</tbody>
|
|
38
|
-
</table>,
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("renders an empty cell", () => {
|
|
43
|
-
const columnDef = { fieldName: "test" };
|
|
44
|
-
const row = { extraneous: "Don't show" };
|
|
45
|
-
return expect(
|
|
46
|
-
<table>
|
|
47
|
-
<tbody>
|
|
48
|
-
<tr>
|
|
49
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
50
|
-
</tr>
|
|
51
|
-
</tbody>
|
|
52
|
-
</table>,
|
|
53
|
-
"when mounted",
|
|
54
|
-
"to satisfy",
|
|
55
|
-
<table>
|
|
56
|
-
<tbody>
|
|
57
|
-
<tr>
|
|
58
|
-
<TableData />
|
|
59
|
-
</tr>
|
|
60
|
-
</tbody>
|
|
61
|
-
</table>,
|
|
62
|
-
);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("renders a cell with a default value", () => {
|
|
66
|
-
const columnDef = { fieldName: ["test", "deep"], defaultValue: "empty" };
|
|
67
|
-
const row = { extraneous: "Don't show" };
|
|
68
|
-
return expect(
|
|
69
|
-
<Provider
|
|
70
|
-
store={{
|
|
71
|
-
subscribe: () => {},
|
|
72
|
-
dispatch: () => {},
|
|
73
|
-
getState: () => ({}),
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
<table>
|
|
77
|
-
<tbody>
|
|
78
|
-
<tr>
|
|
79
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
80
|
-
</tr>
|
|
81
|
-
</tbody>
|
|
82
|
-
</table>
|
|
83
|
-
</Provider>,
|
|
84
|
-
"when mounted",
|
|
85
|
-
"to satisfy",
|
|
86
|
-
<table>
|
|
87
|
-
<tbody>
|
|
88
|
-
<tr>
|
|
89
|
-
<TableData>empty</TableData>
|
|
90
|
-
</tr>
|
|
91
|
-
</tbody>
|
|
92
|
-
</table>,
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("renders a cell with type currency", () => {
|
|
97
|
-
const columnDef = { fieldName: "test", type: "currency", currency: "USD" };
|
|
98
|
-
const row = { test: 1200, extraneous: "Don't show" };
|
|
99
|
-
return expect(
|
|
100
|
-
<IntlProvider locale="en">
|
|
101
|
-
<table>
|
|
102
|
-
<tbody>
|
|
103
|
-
<tr>
|
|
104
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
105
|
-
</tr>
|
|
106
|
-
</tbody>
|
|
107
|
-
</table>
|
|
108
|
-
</IntlProvider>,
|
|
109
|
-
"when mounted",
|
|
110
|
-
"to satisfy",
|
|
111
|
-
<table>
|
|
112
|
-
<tbody>
|
|
113
|
-
<tr>
|
|
114
|
-
<TableData>$1,200.00</TableData>
|
|
115
|
-
</tr>
|
|
116
|
-
</tbody>
|
|
117
|
-
</table>,
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it("renders a cell with type currency for 0", () => {
|
|
122
|
-
const columnDef = { fieldName: "test", type: "currency", currency: "USD" };
|
|
123
|
-
const row = { test: 0, extraneous: "Don't show" };
|
|
124
|
-
return expect(
|
|
125
|
-
<IntlProvider locale="en">
|
|
126
|
-
<table>
|
|
127
|
-
<tbody>
|
|
128
|
-
<tr>
|
|
129
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
130
|
-
</tr>
|
|
131
|
-
</tbody>
|
|
132
|
-
</table>
|
|
133
|
-
</IntlProvider>,
|
|
134
|
-
"when mounted",
|
|
135
|
-
"to satisfy",
|
|
136
|
-
<table>
|
|
137
|
-
<tbody>
|
|
138
|
-
<tr>
|
|
139
|
-
<TableData>$0.00</TableData>
|
|
140
|
-
</tr>
|
|
141
|
-
</tbody>
|
|
142
|
-
</table>,
|
|
143
|
-
);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it("renders a cell with type currency and row-based currency code", () => {
|
|
147
|
-
const columnDef = {
|
|
148
|
-
fieldName: "test",
|
|
149
|
-
type: "currency",
|
|
150
|
-
currency: ["currency"],
|
|
151
|
-
};
|
|
152
|
-
const row = { test: 1200, extraneous: "Don't show", currency: "EUR" };
|
|
153
|
-
return expect(
|
|
154
|
-
<IntlProvider locale="en">
|
|
155
|
-
<table>
|
|
156
|
-
<tbody>
|
|
157
|
-
<tr>
|
|
158
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
159
|
-
</tr>
|
|
160
|
-
</tbody>
|
|
161
|
-
</table>
|
|
162
|
-
</IntlProvider>,
|
|
163
|
-
"when mounted",
|
|
164
|
-
"to satisfy",
|
|
165
|
-
<table>
|
|
166
|
-
<tbody>
|
|
167
|
-
<tr>
|
|
168
|
-
<TableData>€1,200.00</TableData>
|
|
169
|
-
</tr>
|
|
170
|
-
</tbody>
|
|
171
|
-
</table>,
|
|
172
|
-
);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it("renders a cell with type date", () => {
|
|
176
|
-
const columnDef = { fieldName: "test", type: "date" };
|
|
177
|
-
const row = {
|
|
178
|
-
test: "2018-01-23T08:28:46.0000000Z",
|
|
179
|
-
extraneous: "Don't show",
|
|
180
|
-
};
|
|
181
|
-
return expect(
|
|
182
|
-
<IntlProvider locale="en">
|
|
183
|
-
<table>
|
|
184
|
-
<tbody>
|
|
185
|
-
<tr>
|
|
186
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
187
|
-
</tr>
|
|
188
|
-
</tbody>
|
|
189
|
-
</table>
|
|
190
|
-
</IntlProvider>,
|
|
191
|
-
"when mounted",
|
|
192
|
-
"to satisfy",
|
|
193
|
-
<table>
|
|
194
|
-
<tbody>
|
|
195
|
-
<tr>
|
|
196
|
-
<TableData>1/23/2018</TableData>
|
|
197
|
-
</tr>
|
|
198
|
-
</tbody>
|
|
199
|
-
</table>,
|
|
200
|
-
);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it("renders a cell with type datetime", () => {
|
|
204
|
-
const columnDef = { fieldName: "test", type: "datetime" };
|
|
205
|
-
const row = {
|
|
206
|
-
test: "2018-01-23 09:28:46",
|
|
207
|
-
extraneous: "Don't show",
|
|
208
|
-
};
|
|
209
|
-
return expect(
|
|
210
|
-
<IntlProvider locale="en">
|
|
211
|
-
<table>
|
|
212
|
-
<tbody>
|
|
213
|
-
<tr>
|
|
214
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
215
|
-
</tr>
|
|
216
|
-
</tbody>
|
|
217
|
-
</table>
|
|
218
|
-
</IntlProvider>,
|
|
219
|
-
"when mounted",
|
|
220
|
-
"to satisfy",
|
|
221
|
-
<table>
|
|
222
|
-
<tbody>
|
|
223
|
-
<tr>
|
|
224
|
-
<TableData>
|
|
225
|
-
<>1/23/2018</> <>9:28 AM</>
|
|
226
|
-
</TableData>
|
|
227
|
-
</tr>
|
|
228
|
-
</tbody>
|
|
229
|
-
</table>,
|
|
230
|
-
);
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
it("renders a cell with type select", () => {
|
|
234
|
-
const onChange = () => {};
|
|
235
|
-
const columnDef = { type: "select", onChange };
|
|
236
|
-
const row = {
|
|
237
|
-
test: false,
|
|
238
|
-
extraneous: "Don't show",
|
|
239
|
-
};
|
|
240
|
-
return expect(
|
|
241
|
-
<table>
|
|
242
|
-
<tbody>
|
|
243
|
-
<tr>
|
|
244
|
-
<DataCell columnDef={columnDef} row={row} rowId="rowIdent" selected />
|
|
245
|
-
</tr>
|
|
246
|
-
</tbody>
|
|
247
|
-
</table>,
|
|
248
|
-
"when mounted",
|
|
249
|
-
"to satisfy",
|
|
250
|
-
<table>
|
|
251
|
-
<tbody>
|
|
252
|
-
<tr>
|
|
253
|
-
<TableData>
|
|
254
|
-
<Checkbox id="select_rowIdent" value={true} data-row-id="rowIdent" onChange={onChange} />
|
|
255
|
-
</TableData>
|
|
256
|
-
</tr>
|
|
257
|
-
</tbody>
|
|
258
|
-
</table>,
|
|
259
|
-
);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it("renders a cell with type switch", () => {
|
|
263
|
-
const onChange = () => {};
|
|
264
|
-
const columnDef = {
|
|
265
|
-
fieldName: "test",
|
|
266
|
-
type: "switch",
|
|
267
|
-
switch: { onColor: "#ff00ff" },
|
|
268
|
-
onChange,
|
|
269
|
-
};
|
|
270
|
-
const row = {
|
|
271
|
-
test: false,
|
|
272
|
-
extraneous: "Don't show",
|
|
273
|
-
};
|
|
274
|
-
return expect(
|
|
275
|
-
<table>
|
|
276
|
-
<tbody>
|
|
277
|
-
<tr>
|
|
278
|
-
<DataCell columnDef={columnDef} row={row} rowId="rowIdent" />
|
|
279
|
-
</tr>
|
|
280
|
-
</tbody>
|
|
281
|
-
</table>,
|
|
282
|
-
"when mounted",
|
|
283
|
-
"to satisfy",
|
|
284
|
-
<table>
|
|
285
|
-
<tbody>
|
|
286
|
-
<tr>
|
|
287
|
-
<TableData>
|
|
288
|
-
<Switch id="switch0" value={false} data-row-id="rowIdent" onColor="#ff00ff" onChange={onChange} />
|
|
289
|
-
</TableData>
|
|
290
|
-
</tr>
|
|
291
|
-
</tbody>
|
|
292
|
-
</table>,
|
|
293
|
-
);
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it("renders a cell with a value transformer", () => {
|
|
297
|
-
const columnDef = {
|
|
298
|
-
fieldName: "test",
|
|
299
|
-
transform: val => val.toUpperCase(),
|
|
300
|
-
};
|
|
301
|
-
const row = { test: "text", extraneous: "Don't show" };
|
|
302
|
-
return expect(
|
|
303
|
-
<Provider
|
|
304
|
-
store={{
|
|
305
|
-
subscribe: () => {},
|
|
306
|
-
dispatch: () => {},
|
|
307
|
-
getState: () => ({}),
|
|
308
|
-
}}
|
|
309
|
-
>
|
|
310
|
-
<table>
|
|
311
|
-
<tbody>
|
|
312
|
-
<tr>
|
|
313
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
314
|
-
</tr>
|
|
315
|
-
</tbody>
|
|
316
|
-
</table>
|
|
317
|
-
</Provider>,
|
|
318
|
-
"when mounted",
|
|
319
|
-
"to satisfy",
|
|
320
|
-
<table>
|
|
321
|
-
<tbody>
|
|
322
|
-
<tr>
|
|
323
|
-
<TableData>TEXT</TableData>
|
|
324
|
-
</tr>
|
|
325
|
-
</tbody>
|
|
326
|
-
</table>,
|
|
327
|
-
);
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
it("renders a cell with type custom", () => {
|
|
331
|
-
const columnDef = {
|
|
332
|
-
type: "custom",
|
|
333
|
-
component: TestComp,
|
|
334
|
-
};
|
|
335
|
-
const row = { test: "A text", extraneous: "Don't show" };
|
|
336
|
-
return expect(
|
|
337
|
-
<table>
|
|
338
|
-
<tbody>
|
|
339
|
-
<tr>
|
|
340
|
-
<DataCell columnDef={columnDef} row={row} />
|
|
341
|
-
</tr>
|
|
342
|
-
</tbody>
|
|
343
|
-
</table>,
|
|
344
|
-
"when mounted",
|
|
345
|
-
"to satisfy",
|
|
346
|
-
<table>
|
|
347
|
-
<tbody>
|
|
348
|
-
<tr>
|
|
349
|
-
<TableData>
|
|
350
|
-
<TestComp test="A text" extraneous="Don't show" />
|
|
351
|
-
</TableData>
|
|
352
|
-
</tr>
|
|
353
|
-
</tbody>
|
|
354
|
-
</table>,
|
|
355
|
-
);
|
|
356
|
-
});
|
|
357
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled, { css } from "styled-components";
|
|
3
|
-
import Text from "../Text";
|
|
4
|
-
import Checkbox from "../Checkbox";
|
|
5
|
-
import { ifFlag, getThemeProp } from "../../utils";
|
|
6
|
-
|
|
7
|
-
export const UpMark = styled.div`
|
|
8
|
-
display: inline-block;
|
|
9
|
-
margin: 0.05em;
|
|
10
|
-
margin-left: 0.5em;
|
|
11
|
-
height: 0;
|
|
12
|
-
border: 0.25em solid transparent;
|
|
13
|
-
border-top-width: 0;
|
|
14
|
-
border-bottom-color: ${getThemeProp(["colors", "border"], "#999999")};
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
export const DownMark = styled.div`
|
|
18
|
-
display: inline-block;
|
|
19
|
-
margin: 0.05em;
|
|
20
|
-
margin-left: 0.5em;
|
|
21
|
-
height: 0;
|
|
22
|
-
border: 0.25em solid transparent;
|
|
23
|
-
border-bottom-width: 0;
|
|
24
|
-
border-top-color: ${getThemeProp(["colors", "border"], "#999999")};
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
export const MarkBox = styled.div`
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
justify-content: space-around;
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
export const SortMark = ({ direction }) => {
|
|
34
|
-
switch (direction) {
|
|
35
|
-
case "desc":
|
|
36
|
-
return <DownMark />;
|
|
37
|
-
case "asc":
|
|
38
|
-
return <UpMark />;
|
|
39
|
-
default:
|
|
40
|
-
return (
|
|
41
|
-
<MarkBox>
|
|
42
|
-
<UpMark />
|
|
43
|
-
<DownMark />
|
|
44
|
-
</MarkBox>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const TableHeader = styled.th`
|
|
50
|
-
background-color: #f7f7f7;
|
|
51
|
-
position: sticky;
|
|
52
|
-
top: 0;
|
|
53
|
-
z-index: 10;
|
|
54
|
-
padding: 0;
|
|
55
|
-
|
|
56
|
-
${ifFlag(
|
|
57
|
-
"select",
|
|
58
|
-
css`
|
|
59
|
-
width: 56px;
|
|
60
|
-
`,
|
|
61
|
-
)};
|
|
62
|
-
|
|
63
|
-
${ifFlag(
|
|
64
|
-
"width",
|
|
65
|
-
css`
|
|
66
|
-
width: ${props => props.width + ""};
|
|
67
|
-
`,
|
|
68
|
-
)};
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
export const HeadBox = styled.div`
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
height: 20px;
|
|
75
|
-
width: calc(100% - 40px);
|
|
76
|
-
padding: 10px 20px;
|
|
77
|
-
border-bottom: 1px solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
78
|
-
|
|
79
|
-
& > span {
|
|
80
|
-
overflow-x: hidden;
|
|
81
|
-
white-space: nowrap;
|
|
82
|
-
text-overflow: ellipsis;
|
|
83
|
-
}
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
const HeadCell = ({ columnDef, rowIds = [], allSelected }) => (
|
|
87
|
-
<TableHeader onClick={columnDef.sort} select={columnDef.type === "select"} width={columnDef.width}>
|
|
88
|
-
<HeadBox>
|
|
89
|
-
{columnDef.type === "select" ? (
|
|
90
|
-
<Checkbox
|
|
91
|
-
id="select_headRow"
|
|
92
|
-
value={!!allSelected}
|
|
93
|
-
onChange={() => columnDef.onChange(allSelected ? [] : rowIds)}
|
|
94
|
-
/>
|
|
95
|
-
) : columnDef.label ? (
|
|
96
|
-
[
|
|
97
|
-
<Text key="msg" message={columnDef.label} />,
|
|
98
|
-
columnDef.sort ? <SortMark key="sort" direction={columnDef.sortDirection} /> : null,
|
|
99
|
-
]
|
|
100
|
-
) : null}
|
|
101
|
-
</HeadBox>
|
|
102
|
-
</TableHeader>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export default HeadCell;
|