@datarecce/ui 0.1.0 → 0.1.1
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.js +118 -161
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +119 -162
- package/dist/components.mjs.map +1 -1
- package/dist/index.js +118 -161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +119 -162
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
package/dist/components.js
CHANGED
|
@@ -1817,49 +1817,6 @@ function ProfileDiffForm({
|
|
|
1817
1817
|
] });
|
|
1818
1818
|
}
|
|
1819
1819
|
|
|
1820
|
-
// recce-source/js/src/utils/transforms.ts
|
|
1821
|
-
function dataFrameToRowObjects(dataFrame) {
|
|
1822
|
-
return dataFrame.data.map((row, index) => ({
|
|
1823
|
-
...dataFrame.columns.reduce(
|
|
1824
|
-
(obj, column, colIndex) => {
|
|
1825
|
-
obj[column.key] = row[colIndex];
|
|
1826
|
-
return obj;
|
|
1827
|
-
},
|
|
1828
|
-
{}
|
|
1829
|
-
),
|
|
1830
|
-
__status: void 0,
|
|
1831
|
-
_index: index + 1
|
|
1832
|
-
}));
|
|
1833
|
-
}
|
|
1834
|
-
function keyToNumber(key) {
|
|
1835
|
-
const parsed = Number(key);
|
|
1836
|
-
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
1837
|
-
return parsed;
|
|
1838
|
-
}
|
|
1839
|
-
return hashStringToNumber(key);
|
|
1840
|
-
}
|
|
1841
|
-
function hashStringToNumber(str) {
|
|
1842
|
-
let hash = 0;
|
|
1843
|
-
for (let i = 0; i < str.length; i++) {
|
|
1844
|
-
const char = str.charCodeAt(i);
|
|
1845
|
-
hash = (hash << 5) - hash + char;
|
|
1846
|
-
hash = hash & hash;
|
|
1847
|
-
}
|
|
1848
|
-
return Math.abs(hash);
|
|
1849
|
-
}
|
|
1850
|
-
function includesIgnoreCase(list, searchString) {
|
|
1851
|
-
const lowerSearch = searchString.toLowerCase();
|
|
1852
|
-
return list.some((item) => item.toLowerCase() === lowerSearch);
|
|
1853
|
-
}
|
|
1854
|
-
function getCaseInsensitive(obj, key) {
|
|
1855
|
-
const lowerKey = key.toLowerCase();
|
|
1856
|
-
if (lowerKey in obj) {
|
|
1857
|
-
return obj[lowerKey];
|
|
1858
|
-
}
|
|
1859
|
-
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
1860
|
-
return foundKey ? obj[foundKey] : void 0;
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
1820
|
// recce-source/js/src/lib/dataGrid/shared/columnBuilders.ts
|
|
1864
1821
|
function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
1865
1822
|
if (!changedOnly || !hasModifiedRows) {
|
|
@@ -1867,22 +1824,16 @@ function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
|
1867
1824
|
}
|
|
1868
1825
|
return columnStatus === "added" || columnStatus === "removed" || columnStatus === "modified";
|
|
1869
1826
|
}
|
|
1870
|
-
function isPrimaryKeyColumn(columnName, primaryKeys
|
|
1871
|
-
return
|
|
1827
|
+
function isPrimaryKeyColumn(columnName, primaryKeys) {
|
|
1828
|
+
return primaryKeys.includes(columnName);
|
|
1872
1829
|
}
|
|
1873
|
-
function isPinnedColumn(columnName, pinnedColumns
|
|
1874
|
-
return
|
|
1830
|
+
function isPinnedColumn(columnName, pinnedColumns) {
|
|
1831
|
+
return pinnedColumns.includes(columnName);
|
|
1875
1832
|
}
|
|
1876
|
-
function isExcludedColumn(columnName, excludeColumns
|
|
1877
|
-
return
|
|
1833
|
+
function isExcludedColumn(columnName, excludeColumns) {
|
|
1834
|
+
return excludeColumns.includes(columnName);
|
|
1878
1835
|
}
|
|
1879
|
-
function findColumn(columnMap, name
|
|
1880
|
-
if (caseInsensitive) {
|
|
1881
|
-
const entry = Object.entries(columnMap).find(
|
|
1882
|
-
([k]) => k.toLowerCase() === name.toLowerCase()
|
|
1883
|
-
);
|
|
1884
|
-
return entry?.[1];
|
|
1885
|
-
}
|
|
1836
|
+
function findColumn(columnMap, name) {
|
|
1886
1837
|
return columnMap[name];
|
|
1887
1838
|
}
|
|
1888
1839
|
function getDisplayColumns(config) {
|
|
@@ -1894,13 +1845,12 @@ function getDisplayColumns(config) {
|
|
|
1894
1845
|
changedOnly = false,
|
|
1895
1846
|
rowStats,
|
|
1896
1847
|
excludeColumns = [],
|
|
1897
|
-
caseInsensitive = false,
|
|
1898
1848
|
strictMode = false
|
|
1899
1849
|
} = config;
|
|
1900
1850
|
const hasModifiedRows = (rowStats?.modified ?? 0) > 0;
|
|
1901
1851
|
const columns = [];
|
|
1902
1852
|
primaryKeys.forEach((name) => {
|
|
1903
|
-
const col = findColumn(columnMap, name
|
|
1853
|
+
const col = findColumn(columnMap, name);
|
|
1904
1854
|
if (!col) {
|
|
1905
1855
|
if (strictMode) {
|
|
1906
1856
|
throw new Error(`Primary key column "${name}" not found in columnMap`);
|
|
@@ -1918,9 +1868,9 @@ function getDisplayColumns(config) {
|
|
|
1918
1868
|
});
|
|
1919
1869
|
});
|
|
1920
1870
|
pinnedColumns.forEach((name) => {
|
|
1921
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
1922
|
-
if (isExcludedColumn(name, excludeColumns
|
|
1923
|
-
const col = findColumn(columnMap, name
|
|
1871
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1872
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
1873
|
+
const col = findColumn(columnMap, name);
|
|
1924
1874
|
if (!col) {
|
|
1925
1875
|
if (strictMode) {
|
|
1926
1876
|
throw new Error(`Pinned column "${name}" not found in columnMap`);
|
|
@@ -1936,9 +1886,9 @@ function getDisplayColumns(config) {
|
|
|
1936
1886
|
});
|
|
1937
1887
|
});
|
|
1938
1888
|
Object.entries(columnMap).forEach(([name, col]) => {
|
|
1939
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
1940
|
-
if (isPinnedColumn(name, pinnedColumns
|
|
1941
|
-
if (isExcludedColumn(name, excludeColumns
|
|
1889
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1890
|
+
if (isPinnedColumn(name, pinnedColumns)) return;
|
|
1891
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
1942
1892
|
if (!shouldIncludeColumn(col.status, changedOnly, hasModifiedRows)) {
|
|
1943
1893
|
return;
|
|
1944
1894
|
}
|
|
@@ -2053,14 +2003,13 @@ function DataFrameColumnGroupHeader({
|
|
|
2053
2003
|
onPrimaryKeyChange,
|
|
2054
2004
|
pinnedColumns = [],
|
|
2055
2005
|
onPinnedColumnsChange,
|
|
2056
|
-
onColumnsRenderModeChanged
|
|
2057
|
-
caseInsensitive = false
|
|
2006
|
+
onColumnsRenderModeChanged
|
|
2058
2007
|
}) {
|
|
2059
2008
|
if (name === "index") {
|
|
2060
2009
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2061
2010
|
}
|
|
2062
|
-
const isPK =
|
|
2063
|
-
const isPinned =
|
|
2011
|
+
const isPK = primaryKeys.includes(name);
|
|
2012
|
+
const isPinned = pinnedColumns.includes(name);
|
|
2064
2013
|
const canBePk = columnStatus !== "added" && columnStatus !== "removed";
|
|
2065
2014
|
let selectOptions = [];
|
|
2066
2015
|
if (onColumnsRenderModeChanged) {
|
|
@@ -2071,7 +2020,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2071
2020
|
}
|
|
2072
2021
|
const handleRemovePk = () => {
|
|
2073
2022
|
if (!onPrimaryKeyChange) return;
|
|
2074
|
-
const newPrimaryKeys =
|
|
2023
|
+
const newPrimaryKeys = primaryKeys.filter((item) => item !== name);
|
|
2075
2024
|
onPrimaryKeyChange(newPrimaryKeys);
|
|
2076
2025
|
};
|
|
2077
2026
|
const handleAddPk = () => {
|
|
@@ -2084,9 +2033,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2084
2033
|
};
|
|
2085
2034
|
const handleUnpin = () => {
|
|
2086
2035
|
if (!onPinnedColumnsChange) return;
|
|
2087
|
-
const newPinnedColumns =
|
|
2088
|
-
(item) => item.toLowerCase() !== name.toLowerCase()
|
|
2089
|
-
) : pinnedColumns.filter((item) => item !== name);
|
|
2036
|
+
const newPinnedColumns = pinnedColumns.filter((item) => item !== name);
|
|
2090
2037
|
onPinnedColumnsChange(newPinnedColumns);
|
|
2091
2038
|
};
|
|
2092
2039
|
const handlePin = () => {
|
|
@@ -2264,6 +2211,45 @@ function mergeKeysWithStatus(_base, _curr) {
|
|
|
2264
2211
|
return result;
|
|
2265
2212
|
}
|
|
2266
2213
|
|
|
2214
|
+
// recce-source/js/src/utils/transforms.ts
|
|
2215
|
+
function dataFrameToRowObjects(dataFrame) {
|
|
2216
|
+
return dataFrame.data.map((row, index) => ({
|
|
2217
|
+
...dataFrame.columns.reduce(
|
|
2218
|
+
(obj, column, colIndex) => {
|
|
2219
|
+
obj[column.key] = row[colIndex];
|
|
2220
|
+
return obj;
|
|
2221
|
+
},
|
|
2222
|
+
{}
|
|
2223
|
+
),
|
|
2224
|
+
__status: void 0,
|
|
2225
|
+
_index: index + 1
|
|
2226
|
+
}));
|
|
2227
|
+
}
|
|
2228
|
+
function keyToNumber(key) {
|
|
2229
|
+
const parsed = Number(key);
|
|
2230
|
+
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
2231
|
+
return parsed;
|
|
2232
|
+
}
|
|
2233
|
+
return hashStringToNumber(key);
|
|
2234
|
+
}
|
|
2235
|
+
function hashStringToNumber(str) {
|
|
2236
|
+
let hash = 0;
|
|
2237
|
+
for (let i = 0; i < str.length; i++) {
|
|
2238
|
+
const char = str.charCodeAt(i);
|
|
2239
|
+
hash = (hash << 5) - hash + char;
|
|
2240
|
+
hash = hash & hash;
|
|
2241
|
+
}
|
|
2242
|
+
return Math.abs(hash);
|
|
2243
|
+
}
|
|
2244
|
+
function getCaseInsensitive(obj, key) {
|
|
2245
|
+
const lowerKey = key.toLowerCase();
|
|
2246
|
+
if (lowerKey in obj) {
|
|
2247
|
+
return obj[lowerKey];
|
|
2248
|
+
}
|
|
2249
|
+
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
2250
|
+
return foundKey ? obj[foundKey] : void 0;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2267
2253
|
// recce-source/js/src/lib/dataGrid/shared/gridUtils.ts
|
|
2268
2254
|
function buildColumnMap(df) {
|
|
2269
2255
|
const result = {};
|
|
@@ -2279,21 +2265,18 @@ function buildColumnMap(df) {
|
|
|
2279
2265
|
function buildJoinedColumnMap(df) {
|
|
2280
2266
|
const result = {};
|
|
2281
2267
|
df.columns.forEach((col, index) => {
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
};
|
|
2288
|
-
result[col.name.toLowerCase()] = {
|
|
2289
|
-
key: col.key,
|
|
2290
|
-
index,
|
|
2291
|
-
colType: col.type
|
|
2292
|
-
};
|
|
2293
|
-
} else {
|
|
2294
|
-
result[col.name] = { key: col.key, index, colType: col.type };
|
|
2295
|
-
}
|
|
2268
|
+
result[col.key] = {
|
|
2269
|
+
key: col.key,
|
|
2270
|
+
index,
|
|
2271
|
+
colType: col.type
|
|
2272
|
+
};
|
|
2296
2273
|
});
|
|
2274
|
+
if (!result.in_a) {
|
|
2275
|
+
throw new Error("Joined DataFrame missing required 'in_a' column");
|
|
2276
|
+
}
|
|
2277
|
+
if (!result.in_b) {
|
|
2278
|
+
throw new Error("Joined DataFrame missing required 'in_b' column");
|
|
2279
|
+
}
|
|
2297
2280
|
return result;
|
|
2298
2281
|
}
|
|
2299
2282
|
function buildMergedColumnMap(base, current) {
|
|
@@ -2315,10 +2298,10 @@ function buildMergedColumnMap(base, current) {
|
|
|
2315
2298
|
});
|
|
2316
2299
|
return result;
|
|
2317
2300
|
}
|
|
2318
|
-
function validatePrimaryKeys(columns, primaryKeys
|
|
2301
|
+
function validatePrimaryKeys(columns, primaryKeys) {
|
|
2319
2302
|
const keys = [];
|
|
2320
2303
|
for (const key of primaryKeys) {
|
|
2321
|
-
const found =
|
|
2304
|
+
const found = columns.find((col) => col.key === key);
|
|
2322
2305
|
if (!found) {
|
|
2323
2306
|
throw new Error(`Column ${key} not found`);
|
|
2324
2307
|
}
|
|
@@ -2326,17 +2309,17 @@ function validatePrimaryKeys(columns, primaryKeys, caseInsensitive = false) {
|
|
|
2326
2309
|
}
|
|
2327
2310
|
return keys;
|
|
2328
2311
|
}
|
|
2329
|
-
function getPrimaryKeyValue(columns, primaryKeys, row
|
|
2312
|
+
function getPrimaryKeyValue(columns, primaryKeys, row) {
|
|
2330
2313
|
if (primaryKeys.length === 0) {
|
|
2331
2314
|
return String(row._index);
|
|
2332
2315
|
}
|
|
2333
2316
|
const result = [];
|
|
2334
2317
|
for (const key of primaryKeys) {
|
|
2335
|
-
const col =
|
|
2318
|
+
const col = columns.find((c) => c.key === key);
|
|
2336
2319
|
if (!col) {
|
|
2337
2320
|
throw new Error(`Primary Column ${key} not found`);
|
|
2338
2321
|
}
|
|
2339
|
-
const value =
|
|
2322
|
+
const value = row[key];
|
|
2340
2323
|
result.push(`${col.name}=${value}`);
|
|
2341
2324
|
}
|
|
2342
2325
|
return result.join("|");
|
|
@@ -2598,7 +2581,7 @@ function toDiffColumn(config) {
|
|
|
2598
2581
|
{
|
|
2599
2582
|
key: `base__${name}`,
|
|
2600
2583
|
name: baseTitle,
|
|
2601
|
-
renderEditCell: reactDataGrid.
|
|
2584
|
+
renderEditCell: reactDataGrid.textEditor,
|
|
2602
2585
|
headerCellClass,
|
|
2603
2586
|
cellClass: cellClassBase,
|
|
2604
2587
|
renderCell: defaultRenderCell,
|
|
@@ -2609,7 +2592,7 @@ function toDiffColumn(config) {
|
|
|
2609
2592
|
{
|
|
2610
2593
|
key: `current__${name}`,
|
|
2611
2594
|
name: currentTitle,
|
|
2612
|
-
renderEditCell: reactDataGrid.
|
|
2595
|
+
renderEditCell: reactDataGrid.textEditor,
|
|
2613
2596
|
headerCellClass,
|
|
2614
2597
|
cellClass: cellClassCurrent,
|
|
2615
2598
|
renderCell: defaultRenderCell,
|
|
@@ -2703,8 +2686,8 @@ function buildDiffColumnDefinitions(config) {
|
|
|
2703
2686
|
function isMergeColumnMapEntry(entry) {
|
|
2704
2687
|
return "baseColumnKey" in entry && "currentColumnKey" in entry;
|
|
2705
2688
|
}
|
|
2706
|
-
function isPrimaryKey(columnName, primaryKeys
|
|
2707
|
-
return
|
|
2689
|
+
function isPrimaryKey(columnName, primaryKeys) {
|
|
2690
|
+
return primaryKeys.includes(columnName);
|
|
2708
2691
|
}
|
|
2709
2692
|
function getComparisonKeys(entry) {
|
|
2710
2693
|
if (isMergeColumnMapEntry(entry)) {
|
|
@@ -2718,10 +2701,10 @@ function getComparisonKeys(entry) {
|
|
|
2718
2701
|
currentKey: entry.key
|
|
2719
2702
|
};
|
|
2720
2703
|
}
|
|
2721
|
-
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys
|
|
2704
|
+
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys) {
|
|
2722
2705
|
columns.forEach((col) => {
|
|
2723
2706
|
const colKey = col.key;
|
|
2724
|
-
const isPK = isPrimaryKey(colKey, primaryKeys
|
|
2707
|
+
const isPK = isPrimaryKey(colKey, primaryKeys);
|
|
2725
2708
|
if (isPK) {
|
|
2726
2709
|
targetRow[String(colKey).toLowerCase()] = sourceRow[colKey];
|
|
2727
2710
|
} else {
|
|
@@ -2729,11 +2712,11 @@ function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys,
|
|
|
2729
2712
|
}
|
|
2730
2713
|
});
|
|
2731
2714
|
}
|
|
2732
|
-
function detectModifications(baseRow, currentRow, columnMap, primaryKeys
|
|
2715
|
+
function detectModifications(baseRow, currentRow, columnMap, primaryKeys) {
|
|
2733
2716
|
let isModified = false;
|
|
2734
2717
|
for (const [name, column] of Object.entries(columnMap)) {
|
|
2735
2718
|
if (name === "index") continue;
|
|
2736
|
-
if (isPrimaryKey(name, primaryKeys
|
|
2719
|
+
if (isPrimaryKey(name, primaryKeys)) continue;
|
|
2737
2720
|
const { baseKey, currentKey } = getComparisonKeys(column);
|
|
2738
2721
|
if (baseKey === "unknown" || currentKey === "unknown") continue;
|
|
2739
2722
|
const baseValue = baseRow[baseKey];
|
|
@@ -2753,7 +2736,6 @@ function buildDiffRows(config) {
|
|
|
2753
2736
|
currentColumns,
|
|
2754
2737
|
columnMap,
|
|
2755
2738
|
primaryKeys,
|
|
2756
|
-
caseInsensitive = false,
|
|
2757
2739
|
changedOnly = false
|
|
2758
2740
|
} = config;
|
|
2759
2741
|
const mergedMap = mergeKeysWithStatus(
|
|
@@ -2773,14 +2755,7 @@ function buildDiffRows(config) {
|
|
|
2773
2755
|
__status: void 0
|
|
2774
2756
|
};
|
|
2775
2757
|
if (baseRow) {
|
|
2776
|
-
populateRowValues(
|
|
2777
|
-
row,
|
|
2778
|
-
baseRow,
|
|
2779
|
-
baseColumns,
|
|
2780
|
-
"base__",
|
|
2781
|
-
primaryKeys,
|
|
2782
|
-
caseInsensitive
|
|
2783
|
-
);
|
|
2758
|
+
populateRowValues(row, baseRow, baseColumns, "base__", primaryKeys);
|
|
2784
2759
|
}
|
|
2785
2760
|
if (currentRow) {
|
|
2786
2761
|
populateRowValues(
|
|
@@ -2788,8 +2763,7 @@ function buildDiffRows(config) {
|
|
|
2788
2763
|
currentRow,
|
|
2789
2764
|
currentColumns,
|
|
2790
2765
|
"current__",
|
|
2791
|
-
primaryKeys
|
|
2792
|
-
caseInsensitive
|
|
2766
|
+
primaryKeys
|
|
2793
2767
|
);
|
|
2794
2768
|
}
|
|
2795
2769
|
if (!baseRow) {
|
|
@@ -2803,8 +2777,7 @@ function buildDiffRows(config) {
|
|
|
2803
2777
|
baseRow,
|
|
2804
2778
|
currentRow,
|
|
2805
2779
|
columnMap,
|
|
2806
|
-
primaryKeys
|
|
2807
|
-
caseInsensitive
|
|
2780
|
+
primaryKeys
|
|
2808
2781
|
);
|
|
2809
2782
|
if (isModified) {
|
|
2810
2783
|
row.__status = "modified";
|
|
@@ -3075,25 +3048,28 @@ function validateToDataDiffGridInputs(base, current, options) {
|
|
|
3075
3048
|
}
|
|
3076
3049
|
}
|
|
3077
3050
|
function validateToValueDiffGridInputs(df, primaryKeys) {
|
|
3078
|
-
|
|
3051
|
+
if (!df) {
|
|
3052
|
+
throw new DataGridValidationError("DataFrame is required for value diff");
|
|
3053
|
+
}
|
|
3054
|
+
validateDataFrame(df);
|
|
3055
|
+
if (!primaryKeys || primaryKeys.length === 0) {
|
|
3056
|
+
throw new DataGridValidationError(
|
|
3057
|
+
"Primary keys are required for value diff"
|
|
3058
|
+
);
|
|
3059
|
+
}
|
|
3079
3060
|
validatePrimaryKeyConfig(primaryKeys, df.columns, {
|
|
3080
3061
|
required: true,
|
|
3081
|
-
caseInsensitive: true,
|
|
3082
|
-
// valuediff uses case-insensitive matching
|
|
3083
3062
|
context: "toValueDiffGrid"
|
|
3084
3063
|
});
|
|
3085
|
-
const
|
|
3086
|
-
|
|
3087
|
-
const hasInB = columnKeysLower.includes("in_b");
|
|
3088
|
-
if (!hasInA || !hasInB) {
|
|
3064
|
+
const columnKeys = df.columns.map((c) => c.key);
|
|
3065
|
+
if (!columnKeys.includes("in_a")) {
|
|
3089
3066
|
throw new DataGridValidationError(
|
|
3090
|
-
"
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
}
|
|
3067
|
+
"Value diff DataFrame must include lowercase 'in_a' column"
|
|
3068
|
+
);
|
|
3069
|
+
}
|
|
3070
|
+
if (!columnKeys.includes("in_b")) {
|
|
3071
|
+
throw new DataGridValidationError(
|
|
3072
|
+
"Value diff DataFrame must include lowercase 'in_b' column"
|
|
3097
3073
|
);
|
|
3098
3074
|
}
|
|
3099
3075
|
}
|
|
@@ -3123,26 +3099,17 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3123
3099
|
currentMap[String(row._index)] = row;
|
|
3124
3100
|
});
|
|
3125
3101
|
} else {
|
|
3126
|
-
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys
|
|
3102
|
+
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys);
|
|
3127
3103
|
baseData.forEach((row) => {
|
|
3128
|
-
const key = getPrimaryKeyValue(base.columns, basePKKeys, row
|
|
3104
|
+
const key = getPrimaryKeyValue(base.columns, basePKKeys, row);
|
|
3129
3105
|
if (key in baseMap) {
|
|
3130
3106
|
invalidPKeyBase = true;
|
|
3131
3107
|
}
|
|
3132
3108
|
baseMap[key] = row;
|
|
3133
3109
|
});
|
|
3134
|
-
const currentPKKeys = validatePrimaryKeys(
|
|
3135
|
-
current.columns,
|
|
3136
|
-
primaryKeys,
|
|
3137
|
-
false
|
|
3138
|
-
);
|
|
3110
|
+
const currentPKKeys = validatePrimaryKeys(current.columns, primaryKeys);
|
|
3139
3111
|
currentData.forEach((row) => {
|
|
3140
|
-
const key = getPrimaryKeyValue(
|
|
3141
|
-
current.columns,
|
|
3142
|
-
currentPKKeys,
|
|
3143
|
-
row,
|
|
3144
|
-
false
|
|
3145
|
-
);
|
|
3112
|
+
const key = getPrimaryKeyValue(current.columns, currentPKKeys, row);
|
|
3146
3113
|
if (key in currentMap) {
|
|
3147
3114
|
invalidPKeyCurrent = true;
|
|
3148
3115
|
}
|
|
@@ -3156,8 +3123,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3156
3123
|
currentColumns: current.columns,
|
|
3157
3124
|
columnMap,
|
|
3158
3125
|
primaryKeys,
|
|
3159
|
-
caseInsensitive: false,
|
|
3160
|
-
// querydiff uses exact matching
|
|
3161
3126
|
changedOnly
|
|
3162
3127
|
});
|
|
3163
3128
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3168,7 +3133,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3168
3133
|
changedOnly,
|
|
3169
3134
|
rowStats,
|
|
3170
3135
|
excludeColumns: ["index"],
|
|
3171
|
-
caseInsensitive: false,
|
|
3172
3136
|
strictMode: false
|
|
3173
3137
|
// querydiff is lenient with missing columns
|
|
3174
3138
|
});
|
|
@@ -3184,8 +3148,7 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3184
3148
|
pinnedColumns,
|
|
3185
3149
|
onPrimaryKeyChange: options?.onPrimaryKeyChange,
|
|
3186
3150
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3187
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3188
|
-
caseInsensitive: false
|
|
3151
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3189
3152
|
}
|
|
3190
3153
|
});
|
|
3191
3154
|
return {
|
|
@@ -3839,15 +3802,15 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3839
3802
|
const columnMap = buildJoinedColumnMap(df);
|
|
3840
3803
|
const baseMap = {};
|
|
3841
3804
|
const currentMap = {};
|
|
3842
|
-
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys
|
|
3843
|
-
const
|
|
3844
|
-
const
|
|
3805
|
+
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys);
|
|
3806
|
+
const inBaseKey = columnMap.in_a.key;
|
|
3807
|
+
const inCurrentKey = columnMap.in_b.key;
|
|
3845
3808
|
transformedData.forEach((row) => {
|
|
3846
|
-
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row
|
|
3847
|
-
if (
|
|
3809
|
+
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row);
|
|
3810
|
+
if (row[inBaseKey]) {
|
|
3848
3811
|
baseMap[key.toLowerCase()] = row;
|
|
3849
3812
|
}
|
|
3850
|
-
if (
|
|
3813
|
+
if (row[inCurrentKey]) {
|
|
3851
3814
|
currentMap[key.toLowerCase()] = row;
|
|
3852
3815
|
}
|
|
3853
3816
|
});
|
|
@@ -3856,11 +3819,8 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3856
3819
|
currentMap,
|
|
3857
3820
|
baseColumns: df.columns,
|
|
3858
3821
|
currentColumns: df.columns,
|
|
3859
|
-
// Same columns for joined data
|
|
3860
3822
|
columnMap,
|
|
3861
3823
|
primaryKeys,
|
|
3862
|
-
caseInsensitive: true,
|
|
3863
|
-
// valuediff uses case-insensitive
|
|
3864
3824
|
changedOnly
|
|
3865
3825
|
});
|
|
3866
3826
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3870,24 +3830,21 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3870
3830
|
columnsRenderMode,
|
|
3871
3831
|
changedOnly,
|
|
3872
3832
|
rowStats,
|
|
3873
|
-
excludeColumns: ["
|
|
3874
|
-
|
|
3833
|
+
excludeColumns: ["in_a", "in_b"],
|
|
3834
|
+
// Only lowercase needed
|
|
3875
3835
|
strictMode: true
|
|
3876
|
-
// valuediff requires columns to exist
|
|
3877
3836
|
});
|
|
3878
3837
|
const { columns } = buildDiffColumnDefinitions({
|
|
3879
3838
|
columns: columnConfigs,
|
|
3880
3839
|
displayMode,
|
|
3881
3840
|
allowIndexFallback: false,
|
|
3882
|
-
// valuediff requires PKs
|
|
3883
3841
|
baseTitle: options?.baseTitle,
|
|
3884
3842
|
currentTitle: options?.currentTitle,
|
|
3885
3843
|
headerProps: {
|
|
3886
|
-
primaryKeys
|
|
3844
|
+
primaryKeys,
|
|
3887
3845
|
pinnedColumns,
|
|
3888
3846
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3889
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3890
|
-
caseInsensitive: true
|
|
3847
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3891
3848
|
}
|
|
3892
3849
|
});
|
|
3893
3850
|
return {
|
|
@@ -9976,7 +9933,7 @@ var PrivateLoadableRunView = ({
|
|
|
9976
9933
|
const isQuery = run?.type === "query" || run?.type === "query_diff" || run?.type === "query_base";
|
|
9977
9934
|
const { ref, onCopyToClipboard, onMouseEnter, onMouseLeave } = useCopyToClipboardButton();
|
|
9978
9935
|
const disableCopyToClipboard = !runId || !run?.result || !!error || tabValue !== "result";
|
|
9979
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { direction: "column", children: [
|
|
9936
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { direction: "column", height: "100%", children: [
|
|
9980
9937
|
showSingleEnvironmentSetupNotification && /* @__PURE__ */ jsxRuntime.jsx(SingleEnvironmentSetupNotification, { runType: run?.type }),
|
|
9981
9938
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9982
9939
|
react.Tabs.Root,
|