@agilant/toga-blox 1.0.104-t → 1.0.104
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.
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
/****************************************************************************************
|
|
2
|
+
* FILE: myTableLib.ts
|
|
3
|
+
*
|
|
4
|
+
* A reusable library function ("baseFormatTableData") that handles the shared logic:
|
|
5
|
+
* - Checking config.hasLeftIcon, config.type, etc.
|
|
6
|
+
* - Delegating to "renderers" for icons, images, status, currency, etc.
|
|
7
|
+
* - Returning columns with a basic "Cell" function.
|
|
8
|
+
*
|
|
9
|
+
* Each app (Supply, Desk, etc.) can call this and then add extra columns or logic.
|
|
10
|
+
****************************************************************************************/
|
|
1
11
|
import React from "react";
|
|
2
12
|
import { CellProps } from "react-table";
|
|
13
|
+
/** The shape of each column config in your library. */
|
|
3
14
|
export interface SharedColumnConfig {
|
|
4
15
|
key: string;
|
|
5
16
|
type?: string;
|
|
@@ -10,6 +21,7 @@ export interface SharedColumnConfig {
|
|
|
10
21
|
rightImage?: string;
|
|
11
22
|
transform?: (value: any) => any;
|
|
12
23
|
}
|
|
24
|
+
/** The shape of columns returned for React Table. */
|
|
13
25
|
export interface TableColumn {
|
|
14
26
|
Header: string | (() => JSX.Element);
|
|
15
27
|
accessor: string;
|
|
@@ -9,7 +9,6 @@ export function baseFormatTableData(columnTitles, accessors, columnConfigs, // T
|
|
|
9
9
|
renderers = {}, options = {}) {
|
|
10
10
|
/** A helper that returns the "Cell" function for each column. */
|
|
11
11
|
function renderCellContent(config) {
|
|
12
|
-
console.log(config, "CONFIG IN LIB");
|
|
13
12
|
return ({ value }) => {
|
|
14
13
|
// 1) Check leftIcon/rightIcon
|
|
15
14
|
if (config.leftIcon && renderers.renderIcon) {
|