aio-table 11.1.1 → 11.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -358,11 +358,13 @@ const TableHeader = () => {
|
|
|
358
358
|
const TableTitle = (p) => {
|
|
359
359
|
const { column, colIndex } = p;
|
|
360
360
|
let { tableHook, DragColumns, getColumnOption } = useProvider();
|
|
361
|
-
|
|
361
|
+
const cellDetails = tableHook.getCellDetail({ column });
|
|
362
|
+
if (!getColumnOption('show', cellDetails)) {
|
|
362
363
|
return null;
|
|
363
364
|
}
|
|
365
|
+
const title = getColumnOption('title', cellDetails);
|
|
364
366
|
const attrs = Object.assign(Object.assign(Object.assign({}, tableHook.getTitleAttrs(column)), DragColumns.getDragAttrs(colIndex)), DragColumns.getDropAttrs(colIndex));
|
|
365
|
-
return _jsx("div", Object.assign({}, attrs, { children:
|
|
367
|
+
return _jsx("div", Object.assign({}, attrs, { children: title }));
|
|
366
368
|
};
|
|
367
369
|
const TableRow = (props) => {
|
|
368
370
|
const { rowDetail } = props;
|
|
@@ -429,7 +431,14 @@ const TableCell = (props) => {
|
|
|
429
431
|
const beforeValue = tableHook.getCellValue(cellDetail, before, undefined);
|
|
430
432
|
const afterValue = tableHook.getCellValue(cellDetail, after, undefined);
|
|
431
433
|
const subtextValue = tableHook.getCellValue(cellDetail, subtext, undefined);
|
|
432
|
-
|
|
434
|
+
let content;
|
|
435
|
+
if (templateValue !== undefined) {
|
|
436
|
+
content = templateValue;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
content = cellValue;
|
|
440
|
+
}
|
|
441
|
+
return (_jsx(Fragment, { children: _jsxs("div", Object.assign({}, tableHook.getCellAttrs(props.cellDetail, cellValue, isOdd, rootProps.striped), { children: [beforeValue !== undefined && _jsx("div", { className: "aio-table-cell-before", children: beforeValue }), _jsx("div", { className: `aio-table-cell-value${subtext !== undefined ? ' has-subtext' : ''}`, "data-subtext": subtextValue, children: content }), afterValue !== undefined && _jsx("div", { className: "aio-table-cell-after", children: afterValue })] })) }, rowId + ' ' + colId));
|
|
433
442
|
};
|
|
434
443
|
const useTable = (getProps, getPaging, getColumnOption) => {
|
|
435
444
|
const DragRows = UT.useDrag((dragIndex, dropIndex, reOrder) => {
|
|
@@ -500,7 +509,7 @@ const useTable = (getProps, getPaging, getColumnOption) => {
|
|
|
500
509
|
const width = getColumnOption('width', cellDetail);
|
|
501
510
|
const minWidth = getColumnOption('minWidth', cellDetail);
|
|
502
511
|
const className = `aio-table-cell` + (justify ? ` aio-table-cell-justify` : '');
|
|
503
|
-
const style = { width, minWidth, flex: width ? undefined : 1 };
|
|
512
|
+
const style = { width, minWidth, flex: width ? undefined : 1, direction: typeof cellValue === 'number' ? 'ltr' : undefined };
|
|
504
513
|
if (striped) {
|
|
505
514
|
style.background = isOdd ? striped[0] : striped[1];
|
|
506
515
|
}
|