pace-table-lib 1.0.71 → 1.0.73
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/CommonHelperFunctions.d.ts +1 -0
- package/dist/components/PivotTable/NewPivotTable.d.ts +3 -0
- package/dist/components/PivotTable/NewPivotTable.types.d.ts +49 -0
- package/dist/components/PivotTable/PivotHelperFunctions.d.ts +5 -0
- package/dist/components/PivotTable/PivotTable.utils.d.ts +0 -1
- package/dist/components/PivotTable/PivotTableConsts.d.ts +1 -0
- package/dist/components/StaticTable/StaticTableConst.d.ts +1 -0
- package/dist/pace-table-lib.es.js +17 -30
- package/dist/pace-table-lib.es.js.map +1 -1
- package/dist/pace-table-lib.umd.js +17 -30
- package/dist/pace-table-lib.umd.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSparkLineStyleObj(sparkline: any): import("./StaticTable/SparkLine/jQuerySparkLine.types").SL_STYLE_OBJ_TYPE;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MeasureFormatObj } from "../StaticTable/StaticTableTypeDec.types";
|
|
2
|
+
export interface ColGroupInfo {
|
|
3
|
+
groupName: string;
|
|
4
|
+
parentDataIdx: number;
|
|
5
|
+
childDataIndices: number[];
|
|
6
|
+
}
|
|
7
|
+
export interface PivotNode {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
level: number;
|
|
11
|
+
valueArr?: any;
|
|
12
|
+
styleJsonArr?: any[];
|
|
13
|
+
isExpanded?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface PivotModel {
|
|
16
|
+
rowTree: PivotNode[];
|
|
17
|
+
columnTree: PivotNode[];
|
|
18
|
+
visibleRows: PivotNode[];
|
|
19
|
+
visibleColumns: PivotNode[];
|
|
20
|
+
values: number[][];
|
|
21
|
+
rowTotals: number[];
|
|
22
|
+
columnTotals: number[];
|
|
23
|
+
meta: {
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export type PivotTableProps = {
|
|
29
|
+
tableData: PivotTableData;
|
|
30
|
+
leftFixedCellNameList: string[];
|
|
31
|
+
tableStyleProps: any;
|
|
32
|
+
tableWidth: number;
|
|
33
|
+
tableHeight: number;
|
|
34
|
+
measureFormatConfigs: MeasureFormatObj[];
|
|
35
|
+
};
|
|
36
|
+
export interface PivotTableData {
|
|
37
|
+
rowData: number[][];
|
|
38
|
+
rowHeaders: string[];
|
|
39
|
+
columnHeaders: string[];
|
|
40
|
+
minValuesInRows: number[];
|
|
41
|
+
maxValuesInRows: number[];
|
|
42
|
+
minValuesInColumns: number[];
|
|
43
|
+
maxValuesInColumns: number[];
|
|
44
|
+
minValueInTable: number;
|
|
45
|
+
maxValueInTable: number;
|
|
46
|
+
rowTotal: number[];
|
|
47
|
+
columnTotal: number[];
|
|
48
|
+
uniqueTitleMembers: string[];
|
|
49
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColGroupInfo, PivotNode } from "./NewPivotTable.types";
|
|
2
|
+
export declare function parseColGroups(columnHeaders: string[]): ColGroupInfo[];
|
|
3
|
+
export declare function createRowTree(tableData: any, isRowHeaderVisible: boolean): PivotNode[];
|
|
4
|
+
export declare function createColumnHeaders(tableData: any, isRowTotalOn: boolean, isHeaderAtStart: boolean, isSparkLineVisible: boolean, isSlAtStart: boolean, sparkLineText: string): PivotNode[];
|
|
5
|
+
export declare function getNumberArr(valArr?: (string | number)[]): number[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MeasureFormatObj, TableStyleConfig } from "../StaticTable/StaticTableTypeDec.types";
|
|
2
2
|
import { BgColorPair, ParsedMeasureInfo } from "./PivotTable.types";
|
|
3
|
-
export declare const NO_ENTRY_TOKENS: string[];
|
|
4
3
|
/** Linearly interpolates between two hex colors by factor [0,1] */
|
|
5
4
|
export declare const interpolateColor: (minColor: string, maxColor: string, factor: number) => string;
|
|
6
5
|
/** Maps a value in [minValue, maxValue] to an interpolated RGB color string */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SUBTOTAL = "!subtotal";
|
|
@@ -7919,7 +7919,8 @@ const COLOR_BAND_TYPE = {
|
|
|
7919
7919
|
NO_FILL: "No Fill",
|
|
7920
7920
|
SINGLE: "Single",
|
|
7921
7921
|
ROW_BAND: "Row Band",
|
|
7922
|
-
COLUMN_BAND: "Column Band"
|
|
7922
|
+
COLUMN_BAND: "Column Band",
|
|
7923
|
+
ALT_ROW: "Alternate Rows"
|
|
7923
7924
|
};
|
|
7924
7925
|
const BACKGROUND_COLOR_KEY_MAP = {
|
|
7925
7926
|
row: {
|
|
@@ -8064,6 +8065,7 @@ function getBgColor(obj, type) {
|
|
|
8064
8065
|
result.oddColor = obj[map.customKey];
|
|
8065
8066
|
result.evenColor = obj[map.customKey];
|
|
8066
8067
|
break;
|
|
8068
|
+
case COLOR_BAND_TYPE.ALT_ROW:
|
|
8067
8069
|
case map.bandType:
|
|
8068
8070
|
result.oddColor = obj[map.oddKey];
|
|
8069
8071
|
result.evenColor = obj[map.evenKey];
|
|
@@ -8086,12 +8088,12 @@ function toDateFromExcel(value) {
|
|
|
8086
8088
|
function formatDate(value, formatKey) {
|
|
8087
8089
|
try {
|
|
8088
8090
|
const date = toDateFromExcel(value);
|
|
8089
|
-
const day = pad(date.
|
|
8090
|
-
const month = pad(date.
|
|
8091
|
-
const year = date.
|
|
8091
|
+
const day = pad(date.getUTCDate());
|
|
8092
|
+
const month = pad(date.getUTCMonth() + 1);
|
|
8093
|
+
const year = date.getUTCFullYear();
|
|
8092
8094
|
const shortYear = year.toString().slice(-2);
|
|
8093
|
-
const monthShort = MONTHS_SHORT[date.
|
|
8094
|
-
const monthFull = MONTHS_FULL[date.
|
|
8095
|
+
const monthShort = MONTHS_SHORT[date.getUTCMonth()];
|
|
8096
|
+
const monthFull = MONTHS_FULL[date.getUTCMonth()];
|
|
8095
8097
|
switch (formatKey) {
|
|
8096
8098
|
case DATE_FORMAT_OBJ.DD_MM_YYYY:
|
|
8097
8099
|
return `${day}-${month}-${year}`;
|
|
@@ -8172,8 +8174,8 @@ function formatValue(value, format, decimalValues = 2, displayUnit = DISPLAY_UNI
|
|
|
8172
8174
|
[VALUE_FORMAT_OBJ.CURRENCY_EUR_SHORT]: { currency: "EUR", locale: "en-US" },
|
|
8173
8175
|
[VALUE_FORMAT_OBJ.CURRENCY_CAD]: { currency: "CAD", locale: "en-US" },
|
|
8174
8176
|
[VALUE_FORMAT_OBJ.CURRENCY_CAD_SHORT]: { currency: "CAD", locale: "en-US" },
|
|
8175
|
-
[VALUE_FORMAT_OBJ.CURRENCY_CHF]: { currency: "CHF", locale: "
|
|
8176
|
-
[VALUE_FORMAT_OBJ.CURRENCY_CHF_SHORT]: { currency: "CHF", locale: "
|
|
8177
|
+
[VALUE_FORMAT_OBJ.CURRENCY_CHF]: { currency: "CHF", locale: "en-IN" },
|
|
8178
|
+
[VALUE_FORMAT_OBJ.CURRENCY_CHF_SHORT]: { currency: "CHF", locale: "en-IN" }
|
|
8177
8179
|
};
|
|
8178
8180
|
if (currencyMap[format]) {
|
|
8179
8181
|
const { currency, locale } = currencyMap[format];
|
|
@@ -8244,6 +8246,7 @@ function interpolateColor$1(minColor, maxColor, ratio) {
|
|
|
8244
8246
|
const rMix = Math.round(r2(minColor) + (r2(maxColor) - r2(minColor)) * ratio);
|
|
8245
8247
|
const gMix = Math.round(g(minColor) + (g(maxColor) - g(minColor)) * ratio);
|
|
8246
8248
|
const bMix = Math.round(b(minColor) + (b(maxColor) - b(minColor)) * ratio);
|
|
8249
|
+
if (isNaN(rMix) || isNaN(gMix) || isNaN(bMix)) return "rgb(255, 255, 255)";
|
|
8247
8250
|
return `rgb(${rMix},${gMix},${bMix})`;
|
|
8248
8251
|
}
|
|
8249
8252
|
function computeMatrix(rawDataMatrix, mode, transformFn) {
|
|
@@ -18819,7 +18822,6 @@ function StaticTable({
|
|
|
18819
18822
|
)
|
|
18820
18823
|
] });
|
|
18821
18824
|
}
|
|
18822
|
-
const NO_ENTRY_TOKENS = ["nolegendentryrow", "nocolentry"];
|
|
18823
18825
|
function hexToRgb(hex) {
|
|
18824
18826
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
18825
18827
|
return result ? {
|
|
@@ -18868,7 +18870,6 @@ function getRowDisplayName(segments, measureValue) {
|
|
|
18868
18870
|
for (let i = segments.length - 1; i >= 0; i--) {
|
|
18869
18871
|
const seg = segments[i];
|
|
18870
18872
|
if (seg && seg !== "!subtotal") {
|
|
18871
|
-
if (NO_ENTRY_TOKENS.includes(seg.toLowerCase())) return measureValue;
|
|
18872
18873
|
if (seg.includes("~$~")) {
|
|
18873
18874
|
return seg.split("~$~")[1]?.trim() ?? seg;
|
|
18874
18875
|
}
|
|
@@ -19036,7 +19037,7 @@ const PivotTable = ({
|
|
|
19036
19037
|
const isRowTotalOn = tableStyleProps?.DataField?.RowTotal;
|
|
19037
19038
|
const isRowHeaderVisible = !RowHeader?.HideRowHeader;
|
|
19038
19039
|
const isColHeaderVisible = !ColumnHeader?.HideColumnHeader;
|
|
19039
|
-
|
|
19040
|
+
Table2?.colOrRowHeaderName;
|
|
19040
19041
|
const isConditionalFormatOn = Table2?.ConditionalformattingOnOff;
|
|
19041
19042
|
const conditionalFormatArr = Table2?.Conditionalformatting;
|
|
19042
19043
|
const conditionalFormatsByType = useMemo(() => {
|
|
@@ -19086,10 +19087,7 @@ const PivotTable = ({
|
|
|
19086
19087
|
}
|
|
19087
19088
|
}
|
|
19088
19089
|
return rh?.map((rowPath, i) => {
|
|
19089
|
-
const
|
|
19090
|
-
(t) => rowPath.toLowerCase().includes(t)
|
|
19091
|
-
);
|
|
19092
|
-
const segments = isNoEntry ? [measureValue] : parseRowPath(rowPath);
|
|
19090
|
+
const segments = parseRowPath(rowPath);
|
|
19093
19091
|
const isSubtotal = segments.includes("!subtotal");
|
|
19094
19092
|
const nonSubSegs = segments?.filter((s) => s !== "!subtotal");
|
|
19095
19093
|
const lastSeg = nonSubSegs[nonSubSegs.length - 1] ?? "";
|
|
@@ -19105,7 +19103,7 @@ const PivotTable = ({
|
|
|
19105
19103
|
rowPath,
|
|
19106
19104
|
segments,
|
|
19107
19105
|
depth: 0,
|
|
19108
|
-
name:
|
|
19106
|
+
name: getRowDisplayName(segments),
|
|
19109
19107
|
measureIndex,
|
|
19110
19108
|
measureName,
|
|
19111
19109
|
isSubtotal,
|
|
@@ -19127,10 +19125,7 @@ const PivotTable = ({
|
|
|
19127
19125
|
const isSubtotal = parts[parts.length - 1] === "!subtotal";
|
|
19128
19126
|
const cleanedParts = parts?.filter((p) => p !== "!subtotal")?.map((p) => {
|
|
19129
19127
|
if (p.includes("~$~")) return p.split("~$~")[1]?.trim() ?? p;
|
|
19130
|
-
|
|
19131
|
-
(t) => p.toLowerCase().includes(t)
|
|
19132
|
-
);
|
|
19133
|
-
return isNoEntry ? "" : p;
|
|
19128
|
+
return p;
|
|
19134
19129
|
});
|
|
19135
19130
|
const year = cleanedParts[0] ?? `__col_${i}__`;
|
|
19136
19131
|
const measureDisplay = (cleanedParts && cleanedParts[cleanedParts.length - 1]) ?? year;
|
|
@@ -19601,11 +19596,7 @@ const PivotTable = ({
|
|
|
19601
19596
|
"column header"
|
|
19602
19597
|
);
|
|
19603
19598
|
let displayLabel = col.isSubtotal ? col.levels[col.levels.length - 1] ?? "" : col.levels?.[col.levels.length - 1] ?? col.measureDisplay;
|
|
19604
|
-
if (
|
|
19605
|
-
(t) => tableData?.rowHeaders?.[0]?.toLowerCase().includes(t)
|
|
19606
|
-
) && measureFormatConfigs?.[0]?.measureName) {
|
|
19607
|
-
displayLabel = measureFormatConfigs[0].measureName;
|
|
19608
|
-
} else if (tableStyleProps?.ColumnDateFormat) {
|
|
19599
|
+
if (tableStyleProps?.ColumnDateFormat) {
|
|
19609
19600
|
const parts = col.path.split("`");
|
|
19610
19601
|
const lastPart = parts[parts.length - 1];
|
|
19611
19602
|
if (tableStyleProps?.ColumnDateFormat?.[0] && (col.path == col.measureDisplay || col.isSubtotal)) {
|
|
@@ -19707,11 +19698,7 @@ const PivotTable = ({
|
|
|
19707
19698
|
const shouldWrap = Table2?.RowWrapText;
|
|
19708
19699
|
const rowConFormat = getConditionalFormat(row.name, "row header");
|
|
19709
19700
|
let displayLabel = row.name;
|
|
19710
|
-
if (
|
|
19711
|
-
(t) => tableData?.columnHeaders?.[0]?.toLowerCase().includes(t)
|
|
19712
|
-
) && measureFormatConfigs?.[0]?.measureName) {
|
|
19713
|
-
displayLabel = measureFormatConfigs[0].measureName;
|
|
19714
|
-
} else if (tableStyleProps?.RowDateFormat) {
|
|
19701
|
+
if (tableStyleProps?.RowDateFormat) {
|
|
19715
19702
|
if (tableStyleProps?.RowDateFormat?.[0] && (row.name === row.segments[0] || row.isSubtotal)) {
|
|
19716
19703
|
displayLabel = applyDateFormat(
|
|
19717
19704
|
row.name,
|