@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.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';
|
|
@@ -1783,49 +1783,6 @@ function ProfileDiffForm({
|
|
|
1783
1783
|
] });
|
|
1784
1784
|
}
|
|
1785
1785
|
|
|
1786
|
-
// recce-source/js/src/utils/transforms.ts
|
|
1787
|
-
function dataFrameToRowObjects(dataFrame) {
|
|
1788
|
-
return dataFrame.data.map((row, index) => ({
|
|
1789
|
-
...dataFrame.columns.reduce(
|
|
1790
|
-
(obj, column, colIndex) => {
|
|
1791
|
-
obj[column.key] = row[colIndex];
|
|
1792
|
-
return obj;
|
|
1793
|
-
},
|
|
1794
|
-
{}
|
|
1795
|
-
),
|
|
1796
|
-
__status: void 0,
|
|
1797
|
-
_index: index + 1
|
|
1798
|
-
}));
|
|
1799
|
-
}
|
|
1800
|
-
function keyToNumber(key) {
|
|
1801
|
-
const parsed = Number(key);
|
|
1802
|
-
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
1803
|
-
return parsed;
|
|
1804
|
-
}
|
|
1805
|
-
return hashStringToNumber(key);
|
|
1806
|
-
}
|
|
1807
|
-
function hashStringToNumber(str) {
|
|
1808
|
-
let hash = 0;
|
|
1809
|
-
for (let i = 0; i < str.length; i++) {
|
|
1810
|
-
const char = str.charCodeAt(i);
|
|
1811
|
-
hash = (hash << 5) - hash + char;
|
|
1812
|
-
hash = hash & hash;
|
|
1813
|
-
}
|
|
1814
|
-
return Math.abs(hash);
|
|
1815
|
-
}
|
|
1816
|
-
function includesIgnoreCase(list, searchString) {
|
|
1817
|
-
const lowerSearch = searchString.toLowerCase();
|
|
1818
|
-
return list.some((item) => item.toLowerCase() === lowerSearch);
|
|
1819
|
-
}
|
|
1820
|
-
function getCaseInsensitive(obj, key) {
|
|
1821
|
-
const lowerKey = key.toLowerCase();
|
|
1822
|
-
if (lowerKey in obj) {
|
|
1823
|
-
return obj[lowerKey];
|
|
1824
|
-
}
|
|
1825
|
-
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
1826
|
-
return foundKey ? obj[foundKey] : void 0;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
1786
|
// recce-source/js/src/lib/dataGrid/shared/columnBuilders.ts
|
|
1830
1787
|
function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
1831
1788
|
if (!changedOnly || !hasModifiedRows) {
|
|
@@ -1833,22 +1790,16 @@ function shouldIncludeColumn(columnStatus, changedOnly, hasModifiedRows) {
|
|
|
1833
1790
|
}
|
|
1834
1791
|
return columnStatus === "added" || columnStatus === "removed" || columnStatus === "modified";
|
|
1835
1792
|
}
|
|
1836
|
-
function isPrimaryKeyColumn(columnName, primaryKeys
|
|
1837
|
-
return
|
|
1793
|
+
function isPrimaryKeyColumn(columnName, primaryKeys) {
|
|
1794
|
+
return primaryKeys.includes(columnName);
|
|
1838
1795
|
}
|
|
1839
|
-
function isPinnedColumn(columnName, pinnedColumns
|
|
1840
|
-
return
|
|
1796
|
+
function isPinnedColumn(columnName, pinnedColumns) {
|
|
1797
|
+
return pinnedColumns.includes(columnName);
|
|
1841
1798
|
}
|
|
1842
|
-
function isExcludedColumn(columnName, excludeColumns
|
|
1843
|
-
return
|
|
1799
|
+
function isExcludedColumn(columnName, excludeColumns) {
|
|
1800
|
+
return excludeColumns.includes(columnName);
|
|
1844
1801
|
}
|
|
1845
|
-
function findColumn(columnMap, name
|
|
1846
|
-
if (caseInsensitive) {
|
|
1847
|
-
const entry = Object.entries(columnMap).find(
|
|
1848
|
-
([k]) => k.toLowerCase() === name.toLowerCase()
|
|
1849
|
-
);
|
|
1850
|
-
return entry?.[1];
|
|
1851
|
-
}
|
|
1802
|
+
function findColumn(columnMap, name) {
|
|
1852
1803
|
return columnMap[name];
|
|
1853
1804
|
}
|
|
1854
1805
|
function getDisplayColumns(config) {
|
|
@@ -1860,13 +1811,12 @@ function getDisplayColumns(config) {
|
|
|
1860
1811
|
changedOnly = false,
|
|
1861
1812
|
rowStats,
|
|
1862
1813
|
excludeColumns = [],
|
|
1863
|
-
caseInsensitive = false,
|
|
1864
1814
|
strictMode = false
|
|
1865
1815
|
} = config;
|
|
1866
1816
|
const hasModifiedRows = (rowStats?.modified ?? 0) > 0;
|
|
1867
1817
|
const columns = [];
|
|
1868
1818
|
primaryKeys.forEach((name) => {
|
|
1869
|
-
const col = findColumn(columnMap, name
|
|
1819
|
+
const col = findColumn(columnMap, name);
|
|
1870
1820
|
if (!col) {
|
|
1871
1821
|
if (strictMode) {
|
|
1872
1822
|
throw new Error(`Primary key column "${name}" not found in columnMap`);
|
|
@@ -1884,9 +1834,9 @@ function getDisplayColumns(config) {
|
|
|
1884
1834
|
});
|
|
1885
1835
|
});
|
|
1886
1836
|
pinnedColumns.forEach((name) => {
|
|
1887
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
1888
|
-
if (isExcludedColumn(name, excludeColumns
|
|
1889
|
-
const col = findColumn(columnMap, name
|
|
1837
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1838
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
1839
|
+
const col = findColumn(columnMap, name);
|
|
1890
1840
|
if (!col) {
|
|
1891
1841
|
if (strictMode) {
|
|
1892
1842
|
throw new Error(`Pinned column "${name}" not found in columnMap`);
|
|
@@ -1902,9 +1852,9 @@ function getDisplayColumns(config) {
|
|
|
1902
1852
|
});
|
|
1903
1853
|
});
|
|
1904
1854
|
Object.entries(columnMap).forEach(([name, col]) => {
|
|
1905
|
-
if (isPrimaryKeyColumn(name, primaryKeys
|
|
1906
|
-
if (isPinnedColumn(name, pinnedColumns
|
|
1907
|
-
if (isExcludedColumn(name, excludeColumns
|
|
1855
|
+
if (isPrimaryKeyColumn(name, primaryKeys)) return;
|
|
1856
|
+
if (isPinnedColumn(name, pinnedColumns)) return;
|
|
1857
|
+
if (isExcludedColumn(name, excludeColumns)) return;
|
|
1908
1858
|
if (!shouldIncludeColumn(col.status, changedOnly, hasModifiedRows)) {
|
|
1909
1859
|
return;
|
|
1910
1860
|
}
|
|
@@ -2019,14 +1969,13 @@ function DataFrameColumnGroupHeader({
|
|
|
2019
1969
|
onPrimaryKeyChange,
|
|
2020
1970
|
pinnedColumns = [],
|
|
2021
1971
|
onPinnedColumnsChange,
|
|
2022
|
-
onColumnsRenderModeChanged
|
|
2023
|
-
caseInsensitive = false
|
|
1972
|
+
onColumnsRenderModeChanged
|
|
2024
1973
|
}) {
|
|
2025
1974
|
if (name === "index") {
|
|
2026
1975
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
2027
1976
|
}
|
|
2028
|
-
const isPK =
|
|
2029
|
-
const isPinned =
|
|
1977
|
+
const isPK = primaryKeys.includes(name);
|
|
1978
|
+
const isPinned = pinnedColumns.includes(name);
|
|
2030
1979
|
const canBePk = columnStatus !== "added" && columnStatus !== "removed";
|
|
2031
1980
|
let selectOptions = [];
|
|
2032
1981
|
if (onColumnsRenderModeChanged) {
|
|
@@ -2037,7 +1986,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2037
1986
|
}
|
|
2038
1987
|
const handleRemovePk = () => {
|
|
2039
1988
|
if (!onPrimaryKeyChange) return;
|
|
2040
|
-
const newPrimaryKeys =
|
|
1989
|
+
const newPrimaryKeys = primaryKeys.filter((item) => item !== name);
|
|
2041
1990
|
onPrimaryKeyChange(newPrimaryKeys);
|
|
2042
1991
|
};
|
|
2043
1992
|
const handleAddPk = () => {
|
|
@@ -2050,9 +1999,7 @@ function DataFrameColumnGroupHeader({
|
|
|
2050
1999
|
};
|
|
2051
2000
|
const handleUnpin = () => {
|
|
2052
2001
|
if (!onPinnedColumnsChange) return;
|
|
2053
|
-
const newPinnedColumns =
|
|
2054
|
-
(item) => item.toLowerCase() !== name.toLowerCase()
|
|
2055
|
-
) : pinnedColumns.filter((item) => item !== name);
|
|
2002
|
+
const newPinnedColumns = pinnedColumns.filter((item) => item !== name);
|
|
2056
2003
|
onPinnedColumnsChange(newPinnedColumns);
|
|
2057
2004
|
};
|
|
2058
2005
|
const handlePin = () => {
|
|
@@ -2230,6 +2177,45 @@ function mergeKeysWithStatus(_base, _curr) {
|
|
|
2230
2177
|
return result;
|
|
2231
2178
|
}
|
|
2232
2179
|
|
|
2180
|
+
// recce-source/js/src/utils/transforms.ts
|
|
2181
|
+
function dataFrameToRowObjects(dataFrame) {
|
|
2182
|
+
return dataFrame.data.map((row, index) => ({
|
|
2183
|
+
...dataFrame.columns.reduce(
|
|
2184
|
+
(obj, column, colIndex) => {
|
|
2185
|
+
obj[column.key] = row[colIndex];
|
|
2186
|
+
return obj;
|
|
2187
|
+
},
|
|
2188
|
+
{}
|
|
2189
|
+
),
|
|
2190
|
+
__status: void 0,
|
|
2191
|
+
_index: index + 1
|
|
2192
|
+
}));
|
|
2193
|
+
}
|
|
2194
|
+
function keyToNumber(key) {
|
|
2195
|
+
const parsed = Number(key);
|
|
2196
|
+
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
2197
|
+
return parsed;
|
|
2198
|
+
}
|
|
2199
|
+
return hashStringToNumber(key);
|
|
2200
|
+
}
|
|
2201
|
+
function hashStringToNumber(str) {
|
|
2202
|
+
let hash = 0;
|
|
2203
|
+
for (let i = 0; i < str.length; i++) {
|
|
2204
|
+
const char = str.charCodeAt(i);
|
|
2205
|
+
hash = (hash << 5) - hash + char;
|
|
2206
|
+
hash = hash & hash;
|
|
2207
|
+
}
|
|
2208
|
+
return Math.abs(hash);
|
|
2209
|
+
}
|
|
2210
|
+
function getCaseInsensitive(obj, key) {
|
|
2211
|
+
const lowerKey = key.toLowerCase();
|
|
2212
|
+
if (lowerKey in obj) {
|
|
2213
|
+
return obj[lowerKey];
|
|
2214
|
+
}
|
|
2215
|
+
const foundKey = Object.keys(obj).find((k) => k.toLowerCase() === lowerKey);
|
|
2216
|
+
return foundKey ? obj[foundKey] : void 0;
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2233
2219
|
// recce-source/js/src/lib/dataGrid/shared/gridUtils.ts
|
|
2234
2220
|
function buildColumnMap(df) {
|
|
2235
2221
|
const result = {};
|
|
@@ -2245,21 +2231,18 @@ function buildColumnMap(df) {
|
|
|
2245
2231
|
function buildJoinedColumnMap(df) {
|
|
2246
2232
|
const result = {};
|
|
2247
2233
|
df.columns.forEach((col, index) => {
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
};
|
|
2254
|
-
result[col.name.toLowerCase()] = {
|
|
2255
|
-
key: col.key,
|
|
2256
|
-
index,
|
|
2257
|
-
colType: col.type
|
|
2258
|
-
};
|
|
2259
|
-
} else {
|
|
2260
|
-
result[col.name] = { key: col.key, index, colType: col.type };
|
|
2261
|
-
}
|
|
2234
|
+
result[col.key] = {
|
|
2235
|
+
key: col.key,
|
|
2236
|
+
index,
|
|
2237
|
+
colType: col.type
|
|
2238
|
+
};
|
|
2262
2239
|
});
|
|
2240
|
+
if (!result.in_a) {
|
|
2241
|
+
throw new Error("Joined DataFrame missing required 'in_a' column");
|
|
2242
|
+
}
|
|
2243
|
+
if (!result.in_b) {
|
|
2244
|
+
throw new Error("Joined DataFrame missing required 'in_b' column");
|
|
2245
|
+
}
|
|
2263
2246
|
return result;
|
|
2264
2247
|
}
|
|
2265
2248
|
function buildMergedColumnMap(base, current) {
|
|
@@ -2281,10 +2264,10 @@ function buildMergedColumnMap(base, current) {
|
|
|
2281
2264
|
});
|
|
2282
2265
|
return result;
|
|
2283
2266
|
}
|
|
2284
|
-
function validatePrimaryKeys(columns, primaryKeys
|
|
2267
|
+
function validatePrimaryKeys(columns, primaryKeys) {
|
|
2285
2268
|
const keys = [];
|
|
2286
2269
|
for (const key of primaryKeys) {
|
|
2287
|
-
const found =
|
|
2270
|
+
const found = columns.find((col) => col.key === key);
|
|
2288
2271
|
if (!found) {
|
|
2289
2272
|
throw new Error(`Column ${key} not found`);
|
|
2290
2273
|
}
|
|
@@ -2292,17 +2275,17 @@ function validatePrimaryKeys(columns, primaryKeys, caseInsensitive = false) {
|
|
|
2292
2275
|
}
|
|
2293
2276
|
return keys;
|
|
2294
2277
|
}
|
|
2295
|
-
function getPrimaryKeyValue(columns, primaryKeys, row
|
|
2278
|
+
function getPrimaryKeyValue(columns, primaryKeys, row) {
|
|
2296
2279
|
if (primaryKeys.length === 0) {
|
|
2297
2280
|
return String(row._index);
|
|
2298
2281
|
}
|
|
2299
2282
|
const result = [];
|
|
2300
2283
|
for (const key of primaryKeys) {
|
|
2301
|
-
const col =
|
|
2284
|
+
const col = columns.find((c) => c.key === key);
|
|
2302
2285
|
if (!col) {
|
|
2303
2286
|
throw new Error(`Primary Column ${key} not found`);
|
|
2304
2287
|
}
|
|
2305
|
-
const value =
|
|
2288
|
+
const value = row[key];
|
|
2306
2289
|
result.push(`${col.name}=${value}`);
|
|
2307
2290
|
}
|
|
2308
2291
|
return result.join("|");
|
|
@@ -2564,7 +2547,7 @@ function toDiffColumn(config) {
|
|
|
2564
2547
|
{
|
|
2565
2548
|
key: `base__${name}`,
|
|
2566
2549
|
name: baseTitle,
|
|
2567
|
-
renderEditCell:
|
|
2550
|
+
renderEditCell: textEditor,
|
|
2568
2551
|
headerCellClass,
|
|
2569
2552
|
cellClass: cellClassBase,
|
|
2570
2553
|
renderCell: defaultRenderCell,
|
|
@@ -2575,7 +2558,7 @@ function toDiffColumn(config) {
|
|
|
2575
2558
|
{
|
|
2576
2559
|
key: `current__${name}`,
|
|
2577
2560
|
name: currentTitle,
|
|
2578
|
-
renderEditCell:
|
|
2561
|
+
renderEditCell: textEditor,
|
|
2579
2562
|
headerCellClass,
|
|
2580
2563
|
cellClass: cellClassCurrent,
|
|
2581
2564
|
renderCell: defaultRenderCell,
|
|
@@ -2669,8 +2652,8 @@ function buildDiffColumnDefinitions(config) {
|
|
|
2669
2652
|
function isMergeColumnMapEntry(entry) {
|
|
2670
2653
|
return "baseColumnKey" in entry && "currentColumnKey" in entry;
|
|
2671
2654
|
}
|
|
2672
|
-
function isPrimaryKey(columnName, primaryKeys
|
|
2673
|
-
return
|
|
2655
|
+
function isPrimaryKey(columnName, primaryKeys) {
|
|
2656
|
+
return primaryKeys.includes(columnName);
|
|
2674
2657
|
}
|
|
2675
2658
|
function getComparisonKeys(entry) {
|
|
2676
2659
|
if (isMergeColumnMapEntry(entry)) {
|
|
@@ -2684,10 +2667,10 @@ function getComparisonKeys(entry) {
|
|
|
2684
2667
|
currentKey: entry.key
|
|
2685
2668
|
};
|
|
2686
2669
|
}
|
|
2687
|
-
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys
|
|
2670
|
+
function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys) {
|
|
2688
2671
|
columns.forEach((col) => {
|
|
2689
2672
|
const colKey = col.key;
|
|
2690
|
-
const isPK = isPrimaryKey(colKey, primaryKeys
|
|
2673
|
+
const isPK = isPrimaryKey(colKey, primaryKeys);
|
|
2691
2674
|
if (isPK) {
|
|
2692
2675
|
targetRow[String(colKey).toLowerCase()] = sourceRow[colKey];
|
|
2693
2676
|
} else {
|
|
@@ -2695,11 +2678,11 @@ function populateRowValues(targetRow, sourceRow, columns, prefix3, primaryKeys,
|
|
|
2695
2678
|
}
|
|
2696
2679
|
});
|
|
2697
2680
|
}
|
|
2698
|
-
function detectModifications(baseRow, currentRow, columnMap, primaryKeys
|
|
2681
|
+
function detectModifications(baseRow, currentRow, columnMap, primaryKeys) {
|
|
2699
2682
|
let isModified = false;
|
|
2700
2683
|
for (const [name, column] of Object.entries(columnMap)) {
|
|
2701
2684
|
if (name === "index") continue;
|
|
2702
|
-
if (isPrimaryKey(name, primaryKeys
|
|
2685
|
+
if (isPrimaryKey(name, primaryKeys)) continue;
|
|
2703
2686
|
const { baseKey, currentKey } = getComparisonKeys(column);
|
|
2704
2687
|
if (baseKey === "unknown" || currentKey === "unknown") continue;
|
|
2705
2688
|
const baseValue = baseRow[baseKey];
|
|
@@ -2719,7 +2702,6 @@ function buildDiffRows(config) {
|
|
|
2719
2702
|
currentColumns,
|
|
2720
2703
|
columnMap,
|
|
2721
2704
|
primaryKeys,
|
|
2722
|
-
caseInsensitive = false,
|
|
2723
2705
|
changedOnly = false
|
|
2724
2706
|
} = config;
|
|
2725
2707
|
const mergedMap = mergeKeysWithStatus(
|
|
@@ -2739,14 +2721,7 @@ function buildDiffRows(config) {
|
|
|
2739
2721
|
__status: void 0
|
|
2740
2722
|
};
|
|
2741
2723
|
if (baseRow) {
|
|
2742
|
-
populateRowValues(
|
|
2743
|
-
row,
|
|
2744
|
-
baseRow,
|
|
2745
|
-
baseColumns,
|
|
2746
|
-
"base__",
|
|
2747
|
-
primaryKeys,
|
|
2748
|
-
caseInsensitive
|
|
2749
|
-
);
|
|
2724
|
+
populateRowValues(row, baseRow, baseColumns, "base__", primaryKeys);
|
|
2750
2725
|
}
|
|
2751
2726
|
if (currentRow) {
|
|
2752
2727
|
populateRowValues(
|
|
@@ -2754,8 +2729,7 @@ function buildDiffRows(config) {
|
|
|
2754
2729
|
currentRow,
|
|
2755
2730
|
currentColumns,
|
|
2756
2731
|
"current__",
|
|
2757
|
-
primaryKeys
|
|
2758
|
-
caseInsensitive
|
|
2732
|
+
primaryKeys
|
|
2759
2733
|
);
|
|
2760
2734
|
}
|
|
2761
2735
|
if (!baseRow) {
|
|
@@ -2769,8 +2743,7 @@ function buildDiffRows(config) {
|
|
|
2769
2743
|
baseRow,
|
|
2770
2744
|
currentRow,
|
|
2771
2745
|
columnMap,
|
|
2772
|
-
primaryKeys
|
|
2773
|
-
caseInsensitive
|
|
2746
|
+
primaryKeys
|
|
2774
2747
|
);
|
|
2775
2748
|
if (isModified) {
|
|
2776
2749
|
row.__status = "modified";
|
|
@@ -3041,25 +3014,28 @@ function validateToDataDiffGridInputs(base, current, options) {
|
|
|
3041
3014
|
}
|
|
3042
3015
|
}
|
|
3043
3016
|
function validateToValueDiffGridInputs(df, primaryKeys) {
|
|
3044
|
-
|
|
3017
|
+
if (!df) {
|
|
3018
|
+
throw new DataGridValidationError("DataFrame is required for value diff");
|
|
3019
|
+
}
|
|
3020
|
+
validateDataFrame(df);
|
|
3021
|
+
if (!primaryKeys || primaryKeys.length === 0) {
|
|
3022
|
+
throw new DataGridValidationError(
|
|
3023
|
+
"Primary keys are required for value diff"
|
|
3024
|
+
);
|
|
3025
|
+
}
|
|
3045
3026
|
validatePrimaryKeyConfig(primaryKeys, df.columns, {
|
|
3046
3027
|
required: true,
|
|
3047
|
-
caseInsensitive: true,
|
|
3048
|
-
// valuediff uses case-insensitive matching
|
|
3049
3028
|
context: "toValueDiffGrid"
|
|
3050
3029
|
});
|
|
3051
|
-
const
|
|
3052
|
-
|
|
3053
|
-
const hasInB = columnKeysLower.includes("in_b");
|
|
3054
|
-
if (!hasInA || !hasInB) {
|
|
3030
|
+
const columnKeys = df.columns.map((c) => c.key);
|
|
3031
|
+
if (!columnKeys.includes("in_a")) {
|
|
3055
3032
|
throw new DataGridValidationError(
|
|
3056
|
-
"
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
}
|
|
3033
|
+
"Value diff DataFrame must include lowercase 'in_a' column"
|
|
3034
|
+
);
|
|
3035
|
+
}
|
|
3036
|
+
if (!columnKeys.includes("in_b")) {
|
|
3037
|
+
throw new DataGridValidationError(
|
|
3038
|
+
"Value diff DataFrame must include lowercase 'in_b' column"
|
|
3063
3039
|
);
|
|
3064
3040
|
}
|
|
3065
3041
|
}
|
|
@@ -3089,26 +3065,17 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3089
3065
|
currentMap[String(row._index)] = row;
|
|
3090
3066
|
});
|
|
3091
3067
|
} else {
|
|
3092
|
-
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys
|
|
3068
|
+
const basePKKeys = validatePrimaryKeys(base.columns, primaryKeys);
|
|
3093
3069
|
baseData.forEach((row) => {
|
|
3094
|
-
const key = getPrimaryKeyValue(base.columns, basePKKeys, row
|
|
3070
|
+
const key = getPrimaryKeyValue(base.columns, basePKKeys, row);
|
|
3095
3071
|
if (key in baseMap) {
|
|
3096
3072
|
invalidPKeyBase = true;
|
|
3097
3073
|
}
|
|
3098
3074
|
baseMap[key] = row;
|
|
3099
3075
|
});
|
|
3100
|
-
const currentPKKeys = validatePrimaryKeys(
|
|
3101
|
-
current.columns,
|
|
3102
|
-
primaryKeys,
|
|
3103
|
-
false
|
|
3104
|
-
);
|
|
3076
|
+
const currentPKKeys = validatePrimaryKeys(current.columns, primaryKeys);
|
|
3105
3077
|
currentData.forEach((row) => {
|
|
3106
|
-
const key = getPrimaryKeyValue(
|
|
3107
|
-
current.columns,
|
|
3108
|
-
currentPKKeys,
|
|
3109
|
-
row,
|
|
3110
|
-
false
|
|
3111
|
-
);
|
|
3078
|
+
const key = getPrimaryKeyValue(current.columns, currentPKKeys, row);
|
|
3112
3079
|
if (key in currentMap) {
|
|
3113
3080
|
invalidPKeyCurrent = true;
|
|
3114
3081
|
}
|
|
@@ -3122,8 +3089,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3122
3089
|
currentColumns: current.columns,
|
|
3123
3090
|
columnMap,
|
|
3124
3091
|
primaryKeys,
|
|
3125
|
-
caseInsensitive: false,
|
|
3126
|
-
// querydiff uses exact matching
|
|
3127
3092
|
changedOnly
|
|
3128
3093
|
});
|
|
3129
3094
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3134,7 +3099,6 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3134
3099
|
changedOnly,
|
|
3135
3100
|
rowStats,
|
|
3136
3101
|
excludeColumns: ["index"],
|
|
3137
|
-
caseInsensitive: false,
|
|
3138
3102
|
strictMode: false
|
|
3139
3103
|
// querydiff is lenient with missing columns
|
|
3140
3104
|
});
|
|
@@ -3150,8 +3114,7 @@ function toDataDiffGrid(_base, _current, options) {
|
|
|
3150
3114
|
pinnedColumns,
|
|
3151
3115
|
onPrimaryKeyChange: options?.onPrimaryKeyChange,
|
|
3152
3116
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3153
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3154
|
-
caseInsensitive: false
|
|
3117
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3155
3118
|
}
|
|
3156
3119
|
});
|
|
3157
3120
|
return {
|
|
@@ -3805,15 +3768,15 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3805
3768
|
const columnMap = buildJoinedColumnMap(df);
|
|
3806
3769
|
const baseMap = {};
|
|
3807
3770
|
const currentMap = {};
|
|
3808
|
-
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys
|
|
3809
|
-
const
|
|
3810
|
-
const
|
|
3771
|
+
const primaryKeyKeys = validatePrimaryKeys(df.columns, primaryKeys);
|
|
3772
|
+
const inBaseKey = columnMap.in_a.key;
|
|
3773
|
+
const inCurrentKey = columnMap.in_b.key;
|
|
3811
3774
|
transformedData.forEach((row) => {
|
|
3812
|
-
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row
|
|
3813
|
-
if (
|
|
3775
|
+
const key = getPrimaryKeyValue(df.columns, primaryKeyKeys, row);
|
|
3776
|
+
if (row[inBaseKey]) {
|
|
3814
3777
|
baseMap[key.toLowerCase()] = row;
|
|
3815
3778
|
}
|
|
3816
|
-
if (
|
|
3779
|
+
if (row[inCurrentKey]) {
|
|
3817
3780
|
currentMap[key.toLowerCase()] = row;
|
|
3818
3781
|
}
|
|
3819
3782
|
});
|
|
@@ -3822,11 +3785,8 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3822
3785
|
currentMap,
|
|
3823
3786
|
baseColumns: df.columns,
|
|
3824
3787
|
currentColumns: df.columns,
|
|
3825
|
-
// Same columns for joined data
|
|
3826
3788
|
columnMap,
|
|
3827
3789
|
primaryKeys,
|
|
3828
|
-
caseInsensitive: true,
|
|
3829
|
-
// valuediff uses case-insensitive
|
|
3830
3790
|
changedOnly
|
|
3831
3791
|
});
|
|
3832
3792
|
const columnConfigs = getDisplayColumns({
|
|
@@ -3836,24 +3796,21 @@ function toValueDiffGrid(df, primaryKeys, options) {
|
|
|
3836
3796
|
columnsRenderMode,
|
|
3837
3797
|
changedOnly,
|
|
3838
3798
|
rowStats,
|
|
3839
|
-
excludeColumns: ["
|
|
3840
|
-
|
|
3799
|
+
excludeColumns: ["in_a", "in_b"],
|
|
3800
|
+
// Only lowercase needed
|
|
3841
3801
|
strictMode: true
|
|
3842
|
-
// valuediff requires columns to exist
|
|
3843
3802
|
});
|
|
3844
3803
|
const { columns } = buildDiffColumnDefinitions({
|
|
3845
3804
|
columns: columnConfigs,
|
|
3846
3805
|
displayMode,
|
|
3847
3806
|
allowIndexFallback: false,
|
|
3848
|
-
// valuediff requires PKs
|
|
3849
3807
|
baseTitle: options?.baseTitle,
|
|
3850
3808
|
currentTitle: options?.currentTitle,
|
|
3851
3809
|
headerProps: {
|
|
3852
|
-
primaryKeys
|
|
3810
|
+
primaryKeys,
|
|
3853
3811
|
pinnedColumns,
|
|
3854
3812
|
onPinnedColumnsChange: options?.onPinnedColumnsChange,
|
|
3855
|
-
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3856
|
-
caseInsensitive: true
|
|
3813
|
+
onColumnsRenderModeChanged: options?.onColumnsRenderModeChanged
|
|
3857
3814
|
}
|
|
3858
3815
|
});
|
|
3859
3816
|
return {
|
|
@@ -9942,7 +9899,7 @@ var PrivateLoadableRunView = ({
|
|
|
9942
9899
|
const isQuery = run?.type === "query" || run?.type === "query_diff" || run?.type === "query_base";
|
|
9943
9900
|
const { ref, onCopyToClipboard, onMouseEnter, onMouseLeave } = useCopyToClipboardButton();
|
|
9944
9901
|
const disableCopyToClipboard = !runId || !run?.result || !!error || tabValue !== "result";
|
|
9945
|
-
return /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
9902
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", height: "100%", children: [
|
|
9946
9903
|
showSingleEnvironmentSetupNotification && /* @__PURE__ */ jsx(SingleEnvironmentSetupNotification, { runType: run?.type }),
|
|
9947
9904
|
/* @__PURE__ */ jsx(
|
|
9948
9905
|
Tabs.Root,
|