@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/index.js
CHANGED
|
@@ -1905,49 +1905,6 @@ function ProfileDiffForm({
|
|
|
1905
1905
|
] });
|
|
1906
1906
|
}
|
|
1907
1907
|
|
|
1908
|
-
// recce-source/js/src/utils/transforms.ts
|
|
1909
|
-
function dataFrameToRowObjects(dataFrame) {
|
|
1910
|
-
return dataFrame.data.map((row, index) => ({
|
|
1911
|
-
...dataFrame.columns.reduce(
|
|
1912
|
-
(obj, column, colIndex) => {
|
|
1913
|
-
obj[column.key] = row[colIndex];
|
|
1914
|
-
return obj;
|
|
1915
|
-
},
|
|
1916
|
-
{}
|
|
1917
|
-
),
|
|
1918
|
-
__status: void 0,
|
|
1919
|
-
_index: index + 1
|
|
1920
|
-
}));
|
|
1921
|
-
}
|
|
1922
|
-
function keyToNumber(key) {
|
|
1923
|
-
const parsed = Number(key);
|
|
1924
|
-
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
1925
|
-
return parsed;
|
|
1926
|
-
}
|
|
1927
|
-
return hashStringToNumber(key);
|
|
1928
|
-
}
|
|
1929
|
-
function hashStringToNumber(str) {
|
|
1930
|
-
let hash = 0;
|
|
1931
|
-
for (let i = 0; i < str.length; i++) {
|
|
1932
|
-
const char = str.charCodeAt(i);
|
|
1933
|
-
hash = (hash << 5) - hash + char;
|
|
1934
|
-
hash = hash & hash;
|
|
1935
|
-
}
|
|
1936
|
-
return Math.abs(hash);
|
|
1937
|
-
}
|
|
1938
|
-
function includesIgnoreCase(list, searchString) {
|
|
1939
|
-
const lowerSearch = searchString.toLowerCase();
|
|
1940
|
-
return list.some((item) => item.toLowerCase() === lowerSearch);
|
|
1941
|
-
}
|
|
1942
|
-
function getCaseInsensitive(obj, key) {
|
|
1943
|
-
const lowerKey = key.toLowerCase();
|
|
1944
|
-
if (lowerKey in obj) {
|
|
1945
|
-
return obj[lowerKey];
|
|
1946
|
-
}
|
|
1947
|
-
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
1948
|
-
return foundKey ? obj[foundKey] : void 0;
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
1908
|
// recce-source/js/src/lib/dataGrid/shared/columnBuilders.ts
|
|
1952
1909
|
function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
1953
1910
|
if (!changedOnly || !hasModifiedRows) {
|
|
@@ -1955,22 +1912,16 @@ function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
|
1955
1912
|
}
|
|
1956
1913
|
return columnStatus === "added" || columnStatus === "removed" || columnStatus === "modified";
|
|
1957
1914
|
}
|
|
1958
|
-
function isPrimaryKeyColumn(columnName, primaryKeys
|
|
1959
|
-
return
|
|
1915
|
+
function isPrimaryKeyColumn(columnName, primaryKeys) {
|
|
1916
|
+
return primaryKeys.includes(columnName);
|
|
1960
1917
|
}
|
|
1961
|
-
function isPinnedColumn(columnName, pinnedColumns
|
|
1962
|
-
return
|
|
1918
|
+
function isPinnedColumn(columnName, pinnedColumns) {
|
|
1919
|
+
return pinnedColumns.includes(columnName);
|
|
1963
1920
|
}
|
|
1964
|
-
function isExcludedColumn(columnName, excludeColumns
|
|
1965
|
-
return
|
|
1921
|
+
function isExcludedColumn(columnName, excludeColumns) {
|
|
1922
|
+
return excludeColumns.includes(columnName);
|
|
1966
1923
|
}
|
|
1967
|
-
function findColumn(columnMap, name
|
|
1968
|
-
if (caseInsensitive) {
|
|
1969
|
-
const entry = Object.entries(columnMap).find(
|
|
1970
|
-
([k]) => k.toLowerCase() === name.toLowerCase()
|
|
1971
|
-
);
|
|
1972
|
-
return entry?.[1];
|
|
1973
|
-
}
|
|
1924
|
+
function findColumn(columnMap, name) {
|
|
1974
1925
|
return columnMap[name];
|
|
1975
1926
|
}
|
|
1976
1927
|
function getDisplayColumns(config) {
|
|
@@ -1982,13 +1933,12 @@ function getDisplayColumns(config) {
|
|
|
1982
1933
|
changedOnly = false,
|
|
1983
1934
|
rowStats,
|
|
1984
1935
|
excludeColumns = [],
|
|
1985
|
-
caseInsensitive = false,
|
|
1986
1936
|
strictMode = false
|
|
1987
1937
|
} = config;
|
|
1988
1938
|
const hasModifiedRows = (rowStats?.modified ?? 0) > 0;
|
|
1989
1939
|
const columns = [];
|
|
1990
1940
|
primaryKeys.forEach((name) => {
|
|
1991
|
-
const col = findColumn(columnMap, name
|
|
1941
|
+
const col = findColumn(columnMap, name);
|
|
1992
1942
|
if (!col) {
|
|
1993
1943
|
if (strictMode) {
|
|
1994
1944
|
throw new Error(`Primary key column "${name}" not found in columnMap`);
|
|
@@ -2006,9 +1956,9 @@ function getDisplayColumns(config) {
|
|
|
2006
1956
|
});
|
|
2007
1957
|
});
|
|
2008
1958
|
pinnedColumns.forEach((name) => {
|
|
2009
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
2010
|
-
if (isExcludedColumn(name, excludeColumns
|
|
2011
|
-
const col = findColumn(columnMap, name
|
|
1959
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1960
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
1961
|
+
const col = findColumn(columnMap, name);
|
|
2012
1962
|
if (!col) {
|
|
2013
1963
|
if (strictMode) {
|
|
2014
1964
|
throw new Error(`Pinned column "${name}" not found in columnMap`);
|
|
@@ -2024,9 +1974,9 @@ function getDisplayColumns(config) {
|
|
|
2024
1974
|
});
|
|
2025
1975
|
});
|
|
2026
1976
|
Object.entries(columnMap).forEach(([name, col]) => {
|
|
2027
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
2028
|
-
if (isPinnedColumn(name, pinnedColumns
|
|
2029
|
-
if (isExcludedColumn(name, excludeColumns
|
|
1977
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1978
|
+
if (isPinnedColumn(name, pinnedColumns)) return;
|
|
1979
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
2030
1980
|
if (!shouldIncludeColumn(col.status, changedOnly, hasModifiedRows)) {
|
|
2031
1981
|
return;
|
|
2032
1982
|
}
|
|
@@ -2141,14 +2091,13 @@ function DataFrameColumnGroupHeader({
|
|
|
2141
2091
|
onPrimaryKeyChange,
|
|
2142
2092
|
pinnedColumns = [],
|
|
2143
2093
|
onPinnedColumnsChange,
|
|
2144
|
-
onColumnsRenderModeChanged
|
|
2145
|
-
caseInsensitive = false
|
|
2094
|
+
onColumnsRenderModeChanged
|
|
2146
2095
|
}) {
|
|
2147
2096
|
if (name === "index") {
|
|
2148
2097
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2149
2098
|
}
|
|
2150
|
-
const isPK =
|
|
2151
|
-
const isPinned =
|
|
2099
|
+
const isPK = primaryKeys.includes(name);
|
|
2100
|
+
const isPinned = pinnedColumns.includes(name);
|
|
2152
2101
|
const canBePk = columnStatus !== "added" && columnStatus !== "removed";
|
|
2153
2102
|
let selectOptions = [];
|
|
2154
2103
|
if (onColumnsRenderModeChanged) {
|
|
@@ -2159,7 +2108,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2159
2108
|
}
|
|
2160
2109
|
const handleRemovePk = () => {
|
|
2161
2110
|
if (!onPrimaryKeyChange) return;
|
|
2162
|
-
const newPrimaryKeys =
|
|
2111
|
+
const newPrimaryKeys = primaryKeys.filter((item) => item !== name);
|
|
2163
2112
|
onPrimaryKeyChange(newPrimaryKeys);
|
|
2164
2113
|
};
|
|
2165
2114
|
const handleAddPk = () => {
|
|
@@ -2172,9 +2121,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2172
2121
|
};
|
|
2173
2122
|
const handleUnpin = () => {
|
|
2174
2123
|
if (!onPinnedColumnsChange) return;
|
|
2175
|
-
const newPinnedColumns =
|
|
2176
|
-
(item) => item.toLowerCase() !== name.toLowerCase()
|
|
2177
|
-
) : pinnedColumns.filter((item) => item !== name);
|
|
2124
|
+
const newPinnedColumns = pinnedColumns.filter((item) => item !== name);
|
|
2178
2125
|
onPinnedColumnsChange(newPinnedColumns);
|
|
2179
2126
|
};
|
|
2180
2127
|
const handlePin = () => {
|
|
@@ -2352,6 +2299,45 @@ function mergeKeysWithStatus(_base, _curr) {
|
|
|
2352
2299
|
return result;
|
|
2353
2300
|
}
|
|
2354
2301
|
|
|
2302
|
+
// recce-source/js/src/utils/transforms.ts
|
|
2303
|
+
function dataFrameToRowObjects(dataFrame) {
|
|
2304
|
+
return dataFrame.data.map((row, index) => ({
|
|
2305
|
+
...dataFrame.columns.reduce(
|
|
2306
|
+
(obj, column, colIndex) => {
|
|
2307
|
+
obj[column.key] = row[colIndex];
|
|
2308
|
+
return obj;
|
|
2309
|
+
},
|
|
2310
|
+
{}
|
|
2311
|
+
),
|
|
2312
|
+
__status: void 0,
|
|
2313
|
+
_index: index + 1
|
|
2314
|
+
}));
|
|
2315
|
+
}
|
|
2316
|
+
function keyToNumber(key) {
|
|
2317
|
+
const parsed = Number(key);
|
|
2318
|
+
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
2319
|
+
return parsed;
|
|
2320
|
+
}
|
|
2321
|
+
return hashStringToNumber(key);
|
|
2322
|
+
}
|
|
2323
|
+
function hashStringToNumber(str) {
|
|
2324
|
+
let hash = 0;
|
|
2325
|
+
for (let i = 0; i < str.length; i++) {
|
|
2326
|
+
const char = str.charCodeAt(i);
|
|
2327
|
+
hash = (hash << 5) - hash + char;
|
|
2328
|
+
hash = hash & hash;
|
|
2329
|
+
}
|
|
2330
|
+
return Math.abs(hash);
|
|
2331
|
+
}
|
|
2332
|
+
function getCaseInsensitive(obj, key) {
|
|
2333
|
+
const lowerKey = key.toLowerCase();
|
|
2334
|
+
if (lowerKey in obj) {
|
|
2335
|
+
return obj[lowerKey];
|
|
2336
|
+
}
|
|
2337
|
+
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
2338
|
+
return foundKey ? obj[foundKey] : void 0;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2355
2341
|
// recce-source/js/src/lib/dataGrid/shared/gridUtils.ts
|
|
2356
2342
|
function buildColumnMap(df) {
|
|
2357
2343
|
const result = {};
|
|
@@ -2367,21 +2353,18 @@ function buildColumnMap(df) {
|
|
|
2367
2353
|
function buildJoinedColumnMap(df) {
|
|
2368
2354
|
const result = {};
|
|
2369
2355
|
df.columns.forEach((col, index) => {
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
};
|
|
2376
|
-
result[col.name.toLowerCase()] = {
|
|
2377
|
-
key: col.key,
|
|
2378
|
-
index,
|
|
2379
|
-
colType: col.type
|
|
2380
|
-
};
|
|
2381
|
-
} else {
|
|
2382
|
-
result[col.name] = { key: col.key, index, colType: col.type };
|
|
2383
|
-
}
|
|
2356
|
+
result[col.key] = {
|
|
2357
|
+
key: col.key,
|
|
2358
|
+
index,
|
|
2359
|
+
colType: col.type
|
|
2360
|
+
};
|
|
2384
2361
|
});
|
|
2362
|
+
if (!result.in_a) {
|
|
2363
|
+
throw new Error("Joined DataFrame missing required 'in_a' column");
|
|
2364
|
+
}
|
|
2365
|
+
if (!result.in_b) {
|
|
2366
|
+
throw new Error("Joined DataFrame missing required 'in_b' column");
|
|
2367
|
+
}
|
|
2385
2368
|
return result;
|
|
2386
2369
|
}
|
|
2387
2370
|
function buildMergedColumnMap(base, current) {
|
|
@@ -2403,10 +2386,10 @@ function buildMergedColumnMap(base, current) {
|
|
|
2403
2386
|
});
|
|
2404
2387
|
return result;
|
|
2405
2388
|
}
|
|
2406
|
-
function validatePrimaryKeys(columns, primaryKeys
|
|
2389
|
+
function validatePrimaryKeys(columns, primaryKeys) {
|
|
2407
2390
|
const keys = [];
|
|
2408
2391
|
for (const key of primaryKeys) {
|
|
2409
|
-
const found =
|
|
2392
|
+
const found = columns.find((col) => col.key === key);
|
|
2410
2393
|
if (!found) {
|
|
2411
2394
|
throw new Error(`Column ${key} not found`);
|
|
2412
2395
|
}
|
|
@@ -2414,17 +2397,17 @@ function validatePrimaryKeys(columns, primaryKeys, caseInsensitive = false) {
|
|
|
2414
2397
|
}
|
|
2415
2398
|
return keys;
|
|
2416
2399
|
}
|
|
2417
|
-
function getPrimaryKeyValue(columns, primaryKeys, row
|
|
2400
|
+
function getPrimaryKeyValue(columns, primaryKeys, row) {
|
|
2418
2401
|
if (primaryKeys.length === 0) {
|
|
2419
2402
|
return String(row._index);
|
|
2420
2403
|
}
|
|
2421
2404
|
const result = [];
|
|
2422
2405
|
for (const key of primaryKeys) {
|
|
2423
|
-
const col =
|
|
2406
|
+
const col = columns.find((c) => c.key === key);
|
|
2424
2407
|
if (!col) {
|
|
2425
2408
|
throw new Error(`Primary Column ${key} not found`);
|
|
2426
2409
|
}
|
|
2427
|
-
const value =
|
|
2410
|
+
const value = row[key];
|
|
2428
2411
|
result.push(`${col.name}=${value}`);
|
|
2429
2412
|
}
|
|
2430
2413
|
return result.join("|");
|
|
@@ -2686,7 +2669,7 @@ function toDiffColumn(config) {
|
|
|
2686
2669
|
{
|
|
2687
2670
|
key: `base__${name}`,
|
|
2688
2671
|
name: baseTitle,
|
|
2689
|
-
renderEditCell: reactDataGrid.
|
|
2672
|
+
renderEditCell: reactDataGrid.textEditor,
|
|
2690
2673
|
headerCellClass,
|
|
2691
2674
|
cellClass: cellClassBase,
|
|
2692
2675
|
renderCell: defaultRenderCell,
|
|
@@ -2697,7 +2680,7 @@ function toDiffColumn(config) {
|
|
|
2697
2680
|
{
|
|
2698
2681
|
key: `current__${name}`,
|
|
2699
2682
|
name: currentTitle,
|
|
2700
|
-
renderEditCell: reactDataGrid.
|
|
2683
|
+
renderEditCell: reactDataGrid.textEditor,
|
|
2701
2684
|
headerCellClass,
|
|
2702
2685
|
cellClass: cellClassCurrent,
|
|
2703
2686
|
renderCell: defaultRenderCell,
|
|
@@ -2791,8 +2774,8 @@ function buildDiffColumnDefinitions(config) {
|
|
|
2791
2774
|
function isMergeColumnMapEntry(entry) {
|
|
2792
2775
|
return "baseColumnKey" in entry && "currentColumnKey" in entry;
|
|
2793
2776
|
}
|
|
2794
|
-
function isPrimaryKey(columnName, primaryKeys
|
|
2795
|
-
return
|
|
2777
|
+
function isPrimaryKey(columnName, primaryKeys) {
|
|
2778
|
+
return primaryKeys.includes(columnName);
|
|
2796
2779
|
}
|
|
2797
2780
|
function getComparisonKeys(entry) {
|
|
2798
2781
|
if (isMergeColumnMapEntry(entry)) {
|
|
@@ -2806,10 +2789,10 @@ function getComparisonKeys(entry) {
|
|
|
2806
2789
|
currentKey: entry.key
|
|
2807
2790
|
};
|
|
2808
2791
|
}
|
|
2809
|
-
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys
|
|
2792
|
+
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys) {
|
|
2810
2793
|
columns.forEach((col) => {
|
|
2811
2794
|
const colKey = col.key;
|
|
2812
|
-
const isPK = isPrimaryKey(colKey, primaryKeys
|
|
2795
|
+
const isPK = isPrimaryKey(colKey, primaryKeys);
|
|
2813
2796
|
if (isPK) {
|
|
2814
2797
|
targetRow[String(colKey).toLowerCase()] = sourceRow[colKey];
|
|
2815
2798
|
} else {
|
|
@@ -2817,11 +2800,11 @@ function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys,
|
|
|
2817
2800
|
}
|
|
2818
2801
|
});
|
|
2819
2802
|
}
|
|
2820
|
-
function detectModifications(baseRow, currentRow, columnMap, primaryKeys
|
|
2803
|
+
function detectModifications(baseRow, currentRow, columnMap, primaryKeys) {
|
|
2821
2804
|
let isModified = false;
|
|
2822
2805
|
for (const [name, column] of Object.entries(columnMap)) {
|
|
2823
2806
|
if (name === "index") continue;
|
|
2824
|
-
if (isPrimaryKey(name, primaryKeys
|
|
2807
|
+
if (isPrimaryKey(name, primaryKeys)) continue;
|
|
2825
2808
|
const { baseKey, currentKey } = getComparisonKeys(column);
|
|
2826
2809
|
if (baseKey === "unknown" || currentKey === "unknown") continue;
|
|
2827
2810
|
const baseValue = baseRow[baseKey];
|
|
@@ -2841,7 +2824,6 @@ function buildDiffRows(config) {
|
|
|
2841
2824
|
currentColumns,
|
|
2842
2825
|
columnMap,
|
|
2843
2826
|
primaryKeys,
|
|
2844
|
-
caseInsensitive = false,
|
|
2845
2827
|
changedOnly = false
|
|
2846
2828
|
} = config;
|
|
2847
2829
|
const mergedMap = mergeKeysWithStatus(
|
|
@@ -2861,14 +2843,7 @@ function buildDiffRows(config) {
|
|
|
2861
2843
|
__status: void 0
|
|
2862
2844
|
};
|
|
2863
2845
|
if (baseRow) {
|
|
2864
|
-
populateRowValues(
|
|
2865
|
-
row,
|
|
2866
|
-
baseRow,
|
|
2867
|
-
baseColumns,
|
|
2868
|
-
"base__",
|
|
2869
|
-
primaryKeys,
|
|
2870
|
-
caseInsensitive
|
|
2871
|
-
);
|
|
2846
|
+
populateRowValues(row, baseRow, baseColumns, "base__", primaryKeys);
|
|
2872
2847
|
}
|
|
2873
2848
|
if (currentRow) {
|
|
2874
2849
|
populateRowValues(
|
|
@@ -2876,8 +2851,7 @@ function buildDiffRows(config) {
|
|
|
2876
2851
|
currentRow,
|
|
2877
2852
|
currentColumns,
|
|
2878
2853
|
"current__",
|
|
2879
|
-
primaryKeys
|
|
2880
|
-
caseInsensitive
|
|
2854
|
+
primaryKeys
|
|
2881
2855
|
);
|
|
2882
2856
|
}
|
|
2883
2857
|
if (!baseRow) {
|
|
@@ -2891,8 +2865,7 @@ function buildDiffRows(config) {
|
|
|
2891
2865
|
baseRow,
|
|
2892
2866
|
currentRow,
|
|
2893
2867
|
columnMap,
|
|
2894
|
-
primaryKeys
|
|
2895
|
-
caseInsensitive
|
|
2868
|
+
primaryKeys
|
|
2896
2869
|
);
|
|
2897
2870
|
if (isModified) {
|
|
2898
2871
|
row.__status = "modified";
|
|
@@ -3163,25 +3136,28 @@ function validateToDataDiffGridInputs(base, current, options) {
|
|
|
3163
3136
|
}
|
|
3164
3137
|
}
|
|
3165
3138
|
function validateToValueDiffGridInputs(df, primaryKeys) {
|
|
3166
|
-
|
|
3139
|
+
if (!df) {
|
|
3140
|
+
throw new DataGridValidationError("DataFrame is required for value diff");
|
|
3141
|
+
}
|
|
3142
|
+
validateDataFrame(df);
|
|
3143
|
+
if (!primaryKeys || primaryKeys.length === 0) {
|
|
3144
|
+
throw new DataGridValidationError(
|
|
3145
|
+
"Primary keys are required for value diff"
|
|
3146
|
+
);
|
|
3147
|
+
}
|
|
3167
3148
|
validatePrimaryKeyConfig(primaryKeys, df.columns, {
|
|
3168
3149
|
required: true,
|
|
3169
|
-
caseInsensitive: true,
|
|
3170
|
-
// valuediff uses case-insensitive matching
|
|
3171
3150
|
context: "toValueDiffGrid"
|
|
3172
3151
|
});
|
|
3173
|
-
const
|
|
3174
|
-
|
|
3175
|
-
const hasInB = columnKeysLower.includes("in_b");
|
|
3176
|
-
if (!hasInA || !hasInB) {
|
|
3152
|
+
const columnKeys = df.columns.map((c) => c.key);
|
|
3153
|
+
if (!columnKeys.includes("in_a")) {
|
|
3177
3154
|
throw new DataGridValidationError(
|
|
3178
|
-
"
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
}
|
|
3155
|
+
"Value diff DataFrame must include lowercase 'in_a' column"
|
|
3156
|
+
);
|
|
3157
|
+
}
|
|
3158
|
+
if (!columnKeys.includes("in_b")) {
|
|
3159
|
+
throw new DataGridValidationError(
|
|
3160
|
+
"Value diff DataFrame must include lowercase 'in_b' column"
|
|
3185
3161
|
);
|
|
3186
3162
|
}
|
|
3187
3163
|
}
|
|
@@ -3211,26 +3187,17 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3211
3187
|
currentMap[String(row._index)] = row;
|
|
3212
3188
|
});
|
|
3213
3189
|
} else {
|
|
3214
|
-
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys
|
|
3190
|
+
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys);
|
|
3215
3191
|
baseData.forEach((row) => {
|
|
3216
|
-
const key = getPrimaryKeyValue(base.columns, basePKKeys, row
|
|
3192
|
+
const key = getPrimaryKeyValue(base.columns, basePKKeys, row);
|
|
3217
3193
|
if (key in baseMap) {
|
|
3218
3194
|
invalidPKeyBase = true;
|
|
3219
3195
|
}
|
|
3220
3196
|
baseMap[key] = row;
|
|
3221
3197
|
});
|
|
3222
|
-
const currentPKKeys = validatePrimaryKeys(
|
|
3223
|
-
current.columns,
|
|
3224
|
-
primaryKeys,
|
|
3225
|
-
false
|
|
3226
|
-
);
|
|
3198
|
+
const currentPKKeys = validatePrimaryKeys(current.columns, primaryKeys);
|
|
3227
3199
|
currentData.forEach((row) => {
|
|
3228
|
-
const key = getPrimaryKeyValue(
|
|
3229
|
-
current.columns,
|
|
3230
|
-
currentPKKeys,
|
|
3231
|
-
row,
|
|
3232
|
-
false
|
|
3233
|
-
);
|
|
3200
|
+
const key = getPrimaryKeyValue(current.columns, currentPKKeys, row);
|
|
3234
3201
|
if (key in currentMap) {
|
|
3235
3202
|
invalidPKeyCurrent = true;
|
|
3236
3203
|
}
|
|
@@ -3244,8 +3211,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3244
3211
|
currentColumns: current.columns,
|
|
3245
3212
|
columnMap,
|
|
3246
3213
|
primaryKeys,
|
|
3247
|
-
caseInsensitive: false,
|
|
3248
|
-
// querydiff uses exact matching
|
|
3249
3214
|
changedOnly
|
|
3250
3215
|
});
|
|
3251
3216
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3256,7 +3221,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3256
3221
|
changedOnly,
|
|
3257
3222
|
rowStats,
|
|
3258
3223
|
excludeColumns: ["index"],
|
|
3259
|
-
caseInsensitive: false,
|
|
3260
3224
|
strictMode: false
|
|
3261
3225
|
// querydiff is lenient with missing columns
|
|
3262
3226
|
});
|
|
@@ -3272,8 +3236,7 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3272
3236
|
pinnedColumns,
|
|
3273
3237
|
onPrimaryKeyChange: options?.onPrimaryKeyChange,
|
|
3274
3238
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3275
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3276
|
-
caseInsensitive: false
|
|
3239
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3277
3240
|
}
|
|
3278
3241
|
});
|
|
3279
3242
|
return {
|
|
@@ -3927,15 +3890,15 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3927
3890
|
const columnMap = buildJoinedColumnMap(df);
|
|
3928
3891
|
const baseMap = {};
|
|
3929
3892
|
const currentMap = {};
|
|
3930
|
-
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys
|
|
3931
|
-
const
|
|
3932
|
-
const
|
|
3893
|
+
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys);
|
|
3894
|
+
const inBaseKey = columnMap.in_a.key;
|
|
3895
|
+
const inCurrentKey = columnMap.in_b.key;
|
|
3933
3896
|
transformedData.forEach((row) => {
|
|
3934
|
-
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row
|
|
3935
|
-
if (
|
|
3897
|
+
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row);
|
|
3898
|
+
if (row[inBaseKey]) {
|
|
3936
3899
|
baseMap[key.toLowerCase()] = row;
|
|
3937
3900
|
}
|
|
3938
|
-
if (
|
|
3901
|
+
if (row[inCurrentKey]) {
|
|
3939
3902
|
currentMap[key.toLowerCase()] = row;
|
|
3940
3903
|
}
|
|
3941
3904
|
});
|
|
@@ -3944,11 +3907,8 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3944
3907
|
currentMap,
|
|
3945
3908
|
baseColumns: df.columns,
|
|
3946
3909
|
currentColumns: df.columns,
|
|
3947
|
-
// Same columns for joined data
|
|
3948
3910
|
columnMap,
|
|
3949
3911
|
primaryKeys,
|
|
3950
|
-
caseInsensitive: true,
|
|
3951
|
-
// valuediff uses case-insensitive
|
|
3952
3912
|
changedOnly
|
|
3953
3913
|
});
|
|
3954
3914
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3958,24 +3918,21 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3958
3918
|
columnsRenderMode,
|
|
3959
3919
|
changedOnly,
|
|
3960
3920
|
rowStats,
|
|
3961
|
-
excludeColumns: ["
|
|
3962
|
-
|
|
3921
|
+
excludeColumns: ["in_a", "in_b"],
|
|
3922
|
+
// Only lowercase needed
|
|
3963
3923
|
strictMode: true
|
|
3964
|
-
// valuediff requires columns to exist
|
|
3965
3924
|
});
|
|
3966
3925
|
const { columns } = buildDiffColumnDefinitions({
|
|
3967
3926
|
columns: columnConfigs,
|
|
3968
3927
|
displayMode,
|
|
3969
3928
|
allowIndexFallback: false,
|
|
3970
|
-
// valuediff requires PKs
|
|
3971
3929
|
baseTitle: options?.baseTitle,
|
|
3972
3930
|
currentTitle: options?.currentTitle,
|
|
3973
3931
|
headerProps: {
|
|
3974
|
-
primaryKeys
|
|
3932
|
+
primaryKeys,
|
|
3975
3933
|
pinnedColumns,
|
|
3976
3934
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3977
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3978
|
-
caseInsensitive: true
|
|
3935
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3979
3936
|
}
|
|
3980
3937
|
});
|
|
3981
3938
|
return {
|
|
@@ -10144,7 +10101,7 @@ var PrivateLoadableRunView = ({
|
|
|
10144
10101
|
const isQuery = run?.type === "query" || run?.type === "query_diff" || run?.type === "query_base";
|
|
10145
10102
|
const { ref, onCopyToClipboard, onMouseEnter, onMouseLeave } = useCopyToClipboardButton();
|
|
10146
10103
|
const disableCopyToClipboard = !runId || !run?.result || !!error || tabValue !== "result";
|
|
10147
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { direction: "column", children: [
|
|
10104
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { direction: "column", height: "100%", children: [
|
|
10148
10105
|
showSingleEnvironmentSetupNotification && /* @__PURE__ */ jsxRuntime.jsx(SingleEnvironmentSetupNotification, { runType: run?.type }),
|
|
10149
10106
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10150
10107
|
react.Tabs.Root,
|