@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.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import './styles-LEL5RGUW.css';
|
|
|
25
25
|
import { VscKebabVertical, VscHistory, VscDiffAdded, VscDiffRemoved, VscDiffModified, VscFeedback, VscKey, VscClose, VscPinned, VscPin, VscCircleLarge } from 'react-icons/vsc';
|
|
26
26
|
import { PiWarning, PiCaretDown, PiInfo, PiX, PiRepeat, PiCopy, PiDotsThreeVertical, PiCheck, PiTrashFill, PiCheckCircle, PiInfoFill, PiPencilSimple, PiTrashSimple, PiBookmarkSimple, PiNotePencil, PiCircle, PiChatText, PiPlusCircle } from 'react-icons/pi';
|
|
27
27
|
import { useCopyToClipboard } from 'usehooks-ts';
|
|
28
|
-
import { DataGrid,
|
|
28
|
+
import { DataGrid, textEditor } from 'react-data-grid';
|
|
29
29
|
import 'react-data-grid/lib/styles.css';
|
|
30
30
|
import { formatDistanceToNow, format, parseISO, formatDistance } from 'date-fns';
|
|
31
31
|
import saveAs from 'file-saver';
|
|
@@ -1871,49 +1871,6 @@ function ProfileDiffForm({
|
|
|
1871
1871
|
] });
|
|
1872
1872
|
}
|
|
1873
1873
|
|
|
1874
|
-
// recce-source/js/src/utils/transforms.ts
|
|
1875
|
-
function dataFrameToRowObjects(dataFrame) {
|
|
1876
|
-
return dataFrame.data.map((row, index) => ({
|
|
1877
|
-
...dataFrame.columns.reduce(
|
|
1878
|
-
(obj, column, colIndex) => {
|
|
1879
|
-
obj[column.key] = row[colIndex];
|
|
1880
|
-
return obj;
|
|
1881
|
-
},
|
|
1882
|
-
{}
|
|
1883
|
-
),
|
|
1884
|
-
__status: void 0,
|
|
1885
|
-
_index: index + 1
|
|
1886
|
-
}));
|
|
1887
|
-
}
|
|
1888
|
-
function keyToNumber(key) {
|
|
1889
|
-
const parsed = Number(key);
|
|
1890
|
-
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
1891
|
-
return parsed;
|
|
1892
|
-
}
|
|
1893
|
-
return hashStringToNumber(key);
|
|
1894
|
-
}
|
|
1895
|
-
function hashStringToNumber(str) {
|
|
1896
|
-
let hash = 0;
|
|
1897
|
-
for (let i = 0; i < str.length; i++) {
|
|
1898
|
-
const char = str.charCodeAt(i);
|
|
1899
|
-
hash = (hash << 5) - hash + char;
|
|
1900
|
-
hash = hash & hash;
|
|
1901
|
-
}
|
|
1902
|
-
return Math.abs(hash);
|
|
1903
|
-
}
|
|
1904
|
-
function includesIgnoreCase(list, searchString) {
|
|
1905
|
-
const lowerSearch = searchString.toLowerCase();
|
|
1906
|
-
return list.some((item) => item.toLowerCase() === lowerSearch);
|
|
1907
|
-
}
|
|
1908
|
-
function getCaseInsensitive(obj, key) {
|
|
1909
|
-
const lowerKey = key.toLowerCase();
|
|
1910
|
-
if (lowerKey in obj) {
|
|
1911
|
-
return obj[lowerKey];
|
|
1912
|
-
}
|
|
1913
|
-
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
1914
|
-
return foundKey ? obj[foundKey] : void 0;
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
1874
|
// recce-source/js/src/lib/dataGrid/shared/columnBuilders.ts
|
|
1918
1875
|
function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
1919
1876
|
if (!changedOnly || !hasModifiedRows) {
|
|
@@ -1921,22 +1878,16 @@ function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
|
1921
1878
|
}
|
|
1922
1879
|
return columnStatus === "added" || columnStatus === "removed" || columnStatus === "modified";
|
|
1923
1880
|
}
|
|
1924
|
-
function isPrimaryKeyColumn(columnName, primaryKeys
|
|
1925
|
-
return
|
|
1881
|
+
function isPrimaryKeyColumn(columnName, primaryKeys) {
|
|
1882
|
+
return primaryKeys.includes(columnName);
|
|
1926
1883
|
}
|
|
1927
|
-
function isPinnedColumn(columnName, pinnedColumns
|
|
1928
|
-
return
|
|
1884
|
+
function isPinnedColumn(columnName, pinnedColumns) {
|
|
1885
|
+
return pinnedColumns.includes(columnName);
|
|
1929
1886
|
}
|
|
1930
|
-
function isExcludedColumn(columnName, excludeColumns
|
|
1931
|
-
return
|
|
1887
|
+
function isExcludedColumn(columnName, excludeColumns) {
|
|
1888
|
+
return excludeColumns.includes(columnName);
|
|
1932
1889
|
}
|
|
1933
|
-
function findColumn(columnMap, name
|
|
1934
|
-
if (caseInsensitive) {
|
|
1935
|
-
const entry = Object.entries(columnMap).find(
|
|
1936
|
-
([k]) => k.toLowerCase() === name.toLowerCase()
|
|
1937
|
-
);
|
|
1938
|
-
return entry?.[1];
|
|
1939
|
-
}
|
|
1890
|
+
function findColumn(columnMap, name) {
|
|
1940
1891
|
return columnMap[name];
|
|
1941
1892
|
}
|
|
1942
1893
|
function getDisplayColumns(config) {
|
|
@@ -1948,13 +1899,12 @@ function getDisplayColumns(config) {
|
|
|
1948
1899
|
changedOnly = false,
|
|
1949
1900
|
rowStats,
|
|
1950
1901
|
excludeColumns = [],
|
|
1951
|
-
caseInsensitive = false,
|
|
1952
1902
|
strictMode = false
|
|
1953
1903
|
} = config;
|
|
1954
1904
|
const hasModifiedRows = (rowStats?.modified ?? 0) > 0;
|
|
1955
1905
|
const columns = [];
|
|
1956
1906
|
primaryKeys.forEach((name) => {
|
|
1957
|
-
const col = findColumn(columnMap, name
|
|
1907
|
+
const col = findColumn(columnMap, name);
|
|
1958
1908
|
if (!col) {
|
|
1959
1909
|
if (strictMode) {
|
|
1960
1910
|
throw new Error(`Primary key column "${name}" not found in columnMap`);
|
|
@@ -1972,9 +1922,9 @@ function getDisplayColumns(config) {
|
|
|
1972
1922
|
});
|
|
1973
1923
|
});
|
|
1974
1924
|
pinnedColumns.forEach((name) => {
|
|
1975
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
1976
|
-
if (isExcludedColumn(name, excludeColumns
|
|
1977
|
-
const col = findColumn(columnMap, name
|
|
1925
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1926
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
1927
|
+
const col = findColumn(columnMap, name);
|
|
1978
1928
|
if (!col) {
|
|
1979
1929
|
if (strictMode) {
|
|
1980
1930
|
throw new Error(`Pinned column "${name}" not found in columnMap`);
|
|
@@ -1990,9 +1940,9 @@ function getDisplayColumns(config) {
|
|
|
1990
1940
|
});
|
|
1991
1941
|
});
|
|
1992
1942
|
Object.entries(columnMap).forEach(([name, col]) => {
|
|
1993
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
1994
|
-
if (isPinnedColumn(name, pinnedColumns
|
|
1995
|
-
if (isExcludedColumn(name, excludeColumns
|
|
1943
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1944
|
+
if (isPinnedColumn(name, pinnedColumns)) return;
|
|
1945
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
1996
1946
|
if (!shouldIncludeColumn(col.status, changedOnly, hasModifiedRows)) {
|
|
1997
1947
|
return;
|
|
1998
1948
|
}
|
|
@@ -2107,14 +2057,13 @@ function DataFrameColumnGroupHeader({
|
|
|
2107
2057
|
onPrimaryKeyChange,
|
|
2108
2058
|
pinnedColumns = [],
|
|
2109
2059
|
onPinnedColumnsChange,
|
|
2110
|
-
onColumnsRenderModeChanged
|
|
2111
|
-
caseInsensitive = false
|
|
2060
|
+
onColumnsRenderModeChanged
|
|
2112
2061
|
}) {
|
|
2113
2062
|
if (name === "index") {
|
|
2114
2063
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
2115
2064
|
}
|
|
2116
|
-
const isPK =
|
|
2117
|
-
const isPinned =
|
|
2065
|
+
const isPK = primaryKeys.includes(name);
|
|
2066
|
+
const isPinned = pinnedColumns.includes(name);
|
|
2118
2067
|
const canBePk = columnStatus !== "added" && columnStatus !== "removed";
|
|
2119
2068
|
let selectOptions = [];
|
|
2120
2069
|
if (onColumnsRenderModeChanged) {
|
|
@@ -2125,7 +2074,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2125
2074
|
}
|
|
2126
2075
|
const handleRemovePk = () => {
|
|
2127
2076
|
if (!onPrimaryKeyChange) return;
|
|
2128
|
-
const newPrimaryKeys =
|
|
2077
|
+
const newPrimaryKeys = primaryKeys.filter((item) => item !== name);
|
|
2129
2078
|
onPrimaryKeyChange(newPrimaryKeys);
|
|
2130
2079
|
};
|
|
2131
2080
|
const handleAddPk = () => {
|
|
@@ -2138,9 +2087,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2138
2087
|
};
|
|
2139
2088
|
const handleUnpin = () => {
|
|
2140
2089
|
if (!onPinnedColumnsChange) return;
|
|
2141
|
-
const newPinnedColumns =
|
|
2142
|
-
(item) => item.toLowerCase() !== name.toLowerCase()
|
|
2143
|
-
) : pinnedColumns.filter((item) => item !== name);
|
|
2090
|
+
const newPinnedColumns = pinnedColumns.filter((item) => item !== name);
|
|
2144
2091
|
onPinnedColumnsChange(newPinnedColumns);
|
|
2145
2092
|
};
|
|
2146
2093
|
const handlePin = () => {
|
|
@@ -2318,6 +2265,45 @@ function mergeKeysWithStatus(_base, _curr) {
|
|
|
2318
2265
|
return result;
|
|
2319
2266
|
}
|
|
2320
2267
|
|
|
2268
|
+
// recce-source/js/src/utils/transforms.ts
|
|
2269
|
+
function dataFrameToRowObjects(dataFrame) {
|
|
2270
|
+
return dataFrame.data.map((row, index) => ({
|
|
2271
|
+
...dataFrame.columns.reduce(
|
|
2272
|
+
(obj, column, colIndex) => {
|
|
2273
|
+
obj[column.key] = row[colIndex];
|
|
2274
|
+
return obj;
|
|
2275
|
+
},
|
|
2276
|
+
{}
|
|
2277
|
+
),
|
|
2278
|
+
__status: void 0,
|
|
2279
|
+
_index: index + 1
|
|
2280
|
+
}));
|
|
2281
|
+
}
|
|
2282
|
+
function keyToNumber(key) {
|
|
2283
|
+
const parsed = Number(key);
|
|
2284
|
+
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
2285
|
+
return parsed;
|
|
2286
|
+
}
|
|
2287
|
+
return hashStringToNumber(key);
|
|
2288
|
+
}
|
|
2289
|
+
function hashStringToNumber(str) {
|
|
2290
|
+
let hash = 0;
|
|
2291
|
+
for (let i = 0; i < str.length; i++) {
|
|
2292
|
+
const char = str.charCodeAt(i);
|
|
2293
|
+
hash = (hash << 5) - hash + char;
|
|
2294
|
+
hash = hash & hash;
|
|
2295
|
+
}
|
|
2296
|
+
return Math.abs(hash);
|
|
2297
|
+
}
|
|
2298
|
+
function getCaseInsensitive(obj, key) {
|
|
2299
|
+
const lowerKey = key.toLowerCase();
|
|
2300
|
+
if (lowerKey in obj) {
|
|
2301
|
+
return obj[lowerKey];
|
|
2302
|
+
}
|
|
2303
|
+
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
2304
|
+
return foundKey ? obj[foundKey] : void 0;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2321
2307
|
// recce-source/js/src/lib/dataGrid/shared/gridUtils.ts
|
|
2322
2308
|
function buildColumnMap(df) {
|
|
2323
2309
|
const result = {};
|
|
@@ -2333,21 +2319,18 @@ function buildColumnMap(df) {
|
|
|
2333
2319
|
function buildJoinedColumnMap(df) {
|
|
2334
2320
|
const result = {};
|
|
2335
2321
|
df.columns.forEach((col, index) => {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
};
|
|
2342
|
-
result[col.name.toLowerCase()] = {
|
|
2343
|
-
key: col.key,
|
|
2344
|
-
index,
|
|
2345
|
-
colType: col.type
|
|
2346
|
-
};
|
|
2347
|
-
} else {
|
|
2348
|
-
result[col.name] = { key: col.key, index, colType: col.type };
|
|
2349
|
-
}
|
|
2322
|
+
result[col.key] = {
|
|
2323
|
+
key: col.key,
|
|
2324
|
+
index,
|
|
2325
|
+
colType: col.type
|
|
2326
|
+
};
|
|
2350
2327
|
});
|
|
2328
|
+
if (!result.in_a) {
|
|
2329
|
+
throw new Error("Joined DataFrame missing required 'in_a' column");
|
|
2330
|
+
}
|
|
2331
|
+
if (!result.in_b) {
|
|
2332
|
+
throw new Error("Joined DataFrame missing required 'in_b' column");
|
|
2333
|
+
}
|
|
2351
2334
|
return result;
|
|
2352
2335
|
}
|
|
2353
2336
|
function buildMergedColumnMap(base, current) {
|
|
@@ -2369,10 +2352,10 @@ function buildMergedColumnMap(base, current) {
|
|
|
2369
2352
|
});
|
|
2370
2353
|
return result;
|
|
2371
2354
|
}
|
|
2372
|
-
function validatePrimaryKeys(columns, primaryKeys
|
|
2355
|
+
function validatePrimaryKeys(columns, primaryKeys) {
|
|
2373
2356
|
const keys = [];
|
|
2374
2357
|
for (const key of primaryKeys) {
|
|
2375
|
-
const found =
|
|
2358
|
+
const found = columns.find((col) => col.key === key);
|
|
2376
2359
|
if (!found) {
|
|
2377
2360
|
throw new Error(`Column ${key} not found`);
|
|
2378
2361
|
}
|
|
@@ -2380,17 +2363,17 @@ function validatePrimaryKeys(columns, primaryKeys, caseInsensitive = false) {
|
|
|
2380
2363
|
}
|
|
2381
2364
|
return keys;
|
|
2382
2365
|
}
|
|
2383
|
-
function getPrimaryKeyValue(columns, primaryKeys, row
|
|
2366
|
+
function getPrimaryKeyValue(columns, primaryKeys, row) {
|
|
2384
2367
|
if (primaryKeys.length === 0) {
|
|
2385
2368
|
return String(row._index);
|
|
2386
2369
|
}
|
|
2387
2370
|
const result = [];
|
|
2388
2371
|
for (const key of primaryKeys) {
|
|
2389
|
-
const col =
|
|
2372
|
+
const col = columns.find((c) => c.key === key);
|
|
2390
2373
|
if (!col) {
|
|
2391
2374
|
throw new Error(`Primary Column ${key} not found`);
|
|
2392
2375
|
}
|
|
2393
|
-
const value =
|
|
2376
|
+
const value = row[key];
|
|
2394
2377
|
result.push(`${col.name}=${value}`);
|
|
2395
2378
|
}
|
|
2396
2379
|
return result.join("|");
|
|
@@ -2652,7 +2635,7 @@ function toDiffColumn(config) {
|
|
|
2652
2635
|
{
|
|
2653
2636
|
key: `base__${name}`,
|
|
2654
2637
|
name: baseTitle,
|
|
2655
|
-
renderEditCell:
|
|
2638
|
+
renderEditCell: textEditor,
|
|
2656
2639
|
headerCellClass,
|
|
2657
2640
|
cellClass: cellClassBase,
|
|
2658
2641
|
renderCell: defaultRenderCell,
|
|
@@ -2663,7 +2646,7 @@ function toDiffColumn(config) {
|
|
|
2663
2646
|
{
|
|
2664
2647
|
key: `current__${name}`,
|
|
2665
2648
|
name: currentTitle,
|
|
2666
|
-
renderEditCell:
|
|
2649
|
+
renderEditCell: textEditor,
|
|
2667
2650
|
headerCellClass,
|
|
2668
2651
|
cellClass: cellClassCurrent,
|
|
2669
2652
|
renderCell: defaultRenderCell,
|
|
@@ -2757,8 +2740,8 @@ function buildDiffColumnDefinitions(config) {
|
|
|
2757
2740
|
function isMergeColumnMapEntry(entry) {
|
|
2758
2741
|
return "baseColumnKey" in entry && "currentColumnKey" in entry;
|
|
2759
2742
|
}
|
|
2760
|
-
function isPrimaryKey(columnName, primaryKeys
|
|
2761
|
-
return
|
|
2743
|
+
function isPrimaryKey(columnName, primaryKeys) {
|
|
2744
|
+
return primaryKeys.includes(columnName);
|
|
2762
2745
|
}
|
|
2763
2746
|
function getComparisonKeys(entry) {
|
|
2764
2747
|
if (isMergeColumnMapEntry(entry)) {
|
|
@@ -2772,10 +2755,10 @@ function getComparisonKeys(entry) {
|
|
|
2772
2755
|
currentKey: entry.key
|
|
2773
2756
|
};
|
|
2774
2757
|
}
|
|
2775
|
-
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys
|
|
2758
|
+
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys) {
|
|
2776
2759
|
columns.forEach((col) => {
|
|
2777
2760
|
const colKey = col.key;
|
|
2778
|
-
const isPK = isPrimaryKey(colKey, primaryKeys
|
|
2761
|
+
const isPK = isPrimaryKey(colKey, primaryKeys);
|
|
2779
2762
|
if (isPK) {
|
|
2780
2763
|
targetRow[String(colKey).toLowerCase()] = sourceRow[colKey];
|
|
2781
2764
|
} else {
|
|
@@ -2783,11 +2766,11 @@ function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys,
|
|
|
2783
2766
|
}
|
|
2784
2767
|
});
|
|
2785
2768
|
}
|
|
2786
|
-
function detectModifications(baseRow, currentRow, columnMap, primaryKeys
|
|
2769
|
+
function detectModifications(baseRow, currentRow, columnMap, primaryKeys) {
|
|
2787
2770
|
let isModified = false;
|
|
2788
2771
|
for (const [name, column] of Object.entries(columnMap)) {
|
|
2789
2772
|
if (name === "index") continue;
|
|
2790
|
-
if (isPrimaryKey(name, primaryKeys
|
|
2773
|
+
if (isPrimaryKey(name, primaryKeys)) continue;
|
|
2791
2774
|
const { baseKey, currentKey } = getComparisonKeys(column);
|
|
2792
2775
|
if (baseKey === "unknown" || currentKey === "unknown") continue;
|
|
2793
2776
|
const baseValue = baseRow[baseKey];
|
|
@@ -2807,7 +2790,6 @@ function buildDiffRows(config) {
|
|
|
2807
2790
|
currentColumns,
|
|
2808
2791
|
columnMap,
|
|
2809
2792
|
primaryKeys,
|
|
2810
|
-
caseInsensitive = false,
|
|
2811
2793
|
changedOnly = false
|
|
2812
2794
|
} = config;
|
|
2813
2795
|
const mergedMap = mergeKeysWithStatus(
|
|
@@ -2827,14 +2809,7 @@ function buildDiffRows(config) {
|
|
|
2827
2809
|
__status: void 0
|
|
2828
2810
|
};
|
|
2829
2811
|
if (baseRow) {
|
|
2830
|
-
populateRowValues(
|
|
2831
|
-
row,
|
|
2832
|
-
baseRow,
|
|
2833
|
-
baseColumns,
|
|
2834
|
-
"base__",
|
|
2835
|
-
primaryKeys,
|
|
2836
|
-
caseInsensitive
|
|
2837
|
-
);
|
|
2812
|
+
populateRowValues(row, baseRow, baseColumns, "base__", primaryKeys);
|
|
2838
2813
|
}
|
|
2839
2814
|
if (currentRow) {
|
|
2840
2815
|
populateRowValues(
|
|
@@ -2842,8 +2817,7 @@ function buildDiffRows(config) {
|
|
|
2842
2817
|
currentRow,
|
|
2843
2818
|
currentColumns,
|
|
2844
2819
|
"current__",
|
|
2845
|
-
primaryKeys
|
|
2846
|
-
caseInsensitive
|
|
2820
|
+
primaryKeys
|
|
2847
2821
|
);
|
|
2848
2822
|
}
|
|
2849
2823
|
if (!baseRow) {
|
|
@@ -2857,8 +2831,7 @@ function buildDiffRows(config) {
|
|
|
2857
2831
|
baseRow,
|
|
2858
2832
|
currentRow,
|
|
2859
2833
|
columnMap,
|
|
2860
|
-
primaryKeys
|
|
2861
|
-
caseInsensitive
|
|
2834
|
+
primaryKeys
|
|
2862
2835
|
);
|
|
2863
2836
|
if (isModified) {
|
|
2864
2837
|
row.__status = "modified";
|
|
@@ -3129,25 +3102,28 @@ function validateToDataDiffGridInputs(base, current, options) {
|
|
|
3129
3102
|
}
|
|
3130
3103
|
}
|
|
3131
3104
|
function validateToValueDiffGridInputs(df, primaryKeys) {
|
|
3132
|
-
|
|
3105
|
+
if (!df) {
|
|
3106
|
+
throw new DataGridValidationError("DataFrame is required for value diff");
|
|
3107
|
+
}
|
|
3108
|
+
validateDataFrame(df);
|
|
3109
|
+
if (!primaryKeys || primaryKeys.length === 0) {
|
|
3110
|
+
throw new DataGridValidationError(
|
|
3111
|
+
"Primary keys are required for value diff"
|
|
3112
|
+
);
|
|
3113
|
+
}
|
|
3133
3114
|
validatePrimaryKeyConfig(primaryKeys, df.columns, {
|
|
3134
3115
|
required: true,
|
|
3135
|
-
caseInsensitive: true,
|
|
3136
|
-
// valuediff uses case-insensitive matching
|
|
3137
3116
|
context: "toValueDiffGrid"
|
|
3138
3117
|
});
|
|
3139
|
-
const
|
|
3140
|
-
|
|
3141
|
-
const hasInB = columnKeysLower.includes("in_b");
|
|
3142
|
-
if (!hasInA || !hasInB) {
|
|
3118
|
+
const columnKeys = df.columns.map((c) => c.key);
|
|
3119
|
+
if (!columnKeys.includes("in_a")) {
|
|
3143
3120
|
throw new DataGridValidationError(
|
|
3144
|
-
"
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
}
|
|
3121
|
+
"Value diff DataFrame must include lowercase 'in_a' column"
|
|
3122
|
+
);
|
|
3123
|
+
}
|
|
3124
|
+
if (!columnKeys.includes("in_b")) {
|
|
3125
|
+
throw new DataGridValidationError(
|
|
3126
|
+
"Value diff DataFrame must include lowercase 'in_b' column"
|
|
3151
3127
|
);
|
|
3152
3128
|
}
|
|
3153
3129
|
}
|
|
@@ -3177,26 +3153,17 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3177
3153
|
currentMap[String(row._index)] = row;
|
|
3178
3154
|
});
|
|
3179
3155
|
} else {
|
|
3180
|
-
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys
|
|
3156
|
+
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys);
|
|
3181
3157
|
baseData.forEach((row) => {
|
|
3182
|
-
const key = getPrimaryKeyValue(base.columns, basePKKeys, row
|
|
3158
|
+
const key = getPrimaryKeyValue(base.columns, basePKKeys, row);
|
|
3183
3159
|
if (key in baseMap) {
|
|
3184
3160
|
invalidPKeyBase = true;
|
|
3185
3161
|
}
|
|
3186
3162
|
baseMap[key] = row;
|
|
3187
3163
|
});
|
|
3188
|
-
const currentPKKeys = validatePrimaryKeys(
|
|
3189
|
-
current.columns,
|
|
3190
|
-
primaryKeys,
|
|
3191
|
-
false
|
|
3192
|
-
);
|
|
3164
|
+
const currentPKKeys = validatePrimaryKeys(current.columns, primaryKeys);
|
|
3193
3165
|
currentData.forEach((row) => {
|
|
3194
|
-
const key = getPrimaryKeyValue(
|
|
3195
|
-
current.columns,
|
|
3196
|
-
currentPKKeys,
|
|
3197
|
-
row,
|
|
3198
|
-
false
|
|
3199
|
-
);
|
|
3166
|
+
const key = getPrimaryKeyValue(current.columns, currentPKKeys, row);
|
|
3200
3167
|
if (key in currentMap) {
|
|
3201
3168
|
invalidPKeyCurrent = true;
|
|
3202
3169
|
}
|
|
@@ -3210,8 +3177,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3210
3177
|
currentColumns: current.columns,
|
|
3211
3178
|
columnMap,
|
|
3212
3179
|
primaryKeys,
|
|
3213
|
-
caseInsensitive: false,
|
|
3214
|
-
// querydiff uses exact matching
|
|
3215
3180
|
changedOnly
|
|
3216
3181
|
});
|
|
3217
3182
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3222,7 +3187,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3222
3187
|
changedOnly,
|
|
3223
3188
|
rowStats,
|
|
3224
3189
|
excludeColumns: ["index"],
|
|
3225
|
-
caseInsensitive: false,
|
|
3226
3190
|
strictMode: false
|
|
3227
3191
|
// querydiff is lenient with missing columns
|
|
3228
3192
|
});
|
|
@@ -3238,8 +3202,7 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3238
3202
|
pinnedColumns,
|
|
3239
3203
|
onPrimaryKeyChange: options?.onPrimaryKeyChange,
|
|
3240
3204
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3241
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3242
|
-
caseInsensitive: false
|
|
3205
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3243
3206
|
}
|
|
3244
3207
|
});
|
|
3245
3208
|
return {
|
|
@@ -3893,15 +3856,15 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3893
3856
|
const columnMap = buildJoinedColumnMap(df);
|
|
3894
3857
|
const baseMap = {};
|
|
3895
3858
|
const currentMap = {};
|
|
3896
|
-
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys
|
|
3897
|
-
const
|
|
3898
|
-
const
|
|
3859
|
+
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys);
|
|
3860
|
+
const inBaseKey = columnMap.in_a.key;
|
|
3861
|
+
const inCurrentKey = columnMap.in_b.key;
|
|
3899
3862
|
transformedData.forEach((row) => {
|
|
3900
|
-
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row
|
|
3901
|
-
if (
|
|
3863
|
+
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row);
|
|
3864
|
+
if (row[inBaseKey]) {
|
|
3902
3865
|
baseMap[key.toLowerCase()] = row;
|
|
3903
3866
|
}
|
|
3904
|
-
if (
|
|
3867
|
+
if (row[inCurrentKey]) {
|
|
3905
3868
|
currentMap[key.toLowerCase()] = row;
|
|
3906
3869
|
}
|
|
3907
3870
|
});
|
|
@@ -3910,11 +3873,8 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3910
3873
|
currentMap,
|
|
3911
3874
|
baseColumns: df.columns,
|
|
3912
3875
|
currentColumns: df.columns,
|
|
3913
|
-
// Same columns for joined data
|
|
3914
3876
|
columnMap,
|
|
3915
3877
|
primaryKeys,
|
|
3916
|
-
caseInsensitive: true,
|
|
3917
|
-
// valuediff uses case-insensitive
|
|
3918
3878
|
changedOnly
|
|
3919
3879
|
});
|
|
3920
3880
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3924,24 +3884,21 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3924
3884
|
columnsRenderMode,
|
|
3925
3885
|
changedOnly,
|
|
3926
3886
|
rowStats,
|
|
3927
|
-
excludeColumns: ["
|
|
3928
|
-
|
|
3887
|
+
excludeColumns: ["in_a", "in_b"],
|
|
3888
|
+
// Only lowercase needed
|
|
3929
3889
|
strictMode: true
|
|
3930
|
-
// valuediff requires columns to exist
|
|
3931
3890
|
});
|
|
3932
3891
|
const { columns } = buildDiffColumnDefinitions({
|
|
3933
3892
|
columns: columnConfigs,
|
|
3934
3893
|
displayMode,
|
|
3935
3894
|
allowIndexFallback: false,
|
|
3936
|
-
// valuediff requires PKs
|
|
3937
3895
|
baseTitle: options?.baseTitle,
|
|
3938
3896
|
currentTitle: options?.currentTitle,
|
|
3939
3897
|
headerProps: {
|
|
3940
|
-
primaryKeys
|
|
3898
|
+
primaryKeys,
|
|
3941
3899
|
pinnedColumns,
|
|
3942
3900
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3943
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3944
|
-
caseInsensitive: true
|
|
3901
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3945
3902
|
}
|
|
3946
3903
|
});
|
|
3947
3904
|
return {
|
|
@@ -10110,7 +10067,7 @@ var PrivateLoadableRunView = ({
|
|
|
10110
10067
|
const isQuery = run?.type === "query" || run?.type === "query_diff" || run?.type === "query_base";
|
|
10111
10068
|
const { ref, onCopyToClipboard, onMouseEnter, onMouseLeave } = useCopyToClipboardButton();
|
|
10112
10069
|
const disableCopyToClipboard = !runId || !run?.result || !!error || tabValue !== "result";
|
|
10113
|
-
return /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
10070
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", height: "100%", children: [
|
|
10114
10071
|
showSingleEnvironmentSetupNotification && /* @__PURE__ */ jsx(SingleEnvironmentSetupNotification, { runType: run?.type }),
|
|
10115
10072
|
/* @__PURE__ */ jsx(
|
|
10116
10073
|
Tabs.Root,
|