@oliasoft-open-source/react-ui-library 7.6.0-beta-2 → 7.6.0-beta-3
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/diff-table/build-diff-rows.d.ts +15 -1
- package/dist/components/diff-table/build-diff-rows.d.ts.map +1 -1
- package/dist/components/diff-table/diff-table.d.ts +5 -1
- package/dist/components/diff-table/diff-table.d.ts.map +1 -1
- package/dist/components/diff-table/diff-table.stories.d.ts +10 -0
- package/dist/components/diff-table/diff-table.stories.d.ts.map +1 -1
- package/dist/index.js +50 -35
- package/package.json +1 -1
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { TRowType, TRowsType } from '../table/table.viewdata';
|
|
2
|
+
export type TDiffRowStatus = 'added' | 'deleted' | 'matched';
|
|
3
|
+
export type TDiffIndexEntry = {
|
|
4
|
+
status: TDiffRowStatus;
|
|
5
|
+
row: TRowType;
|
|
6
|
+
compareRow?: TRowType;
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Returns the identity key for a row (first cell value, stringified).
|
|
4
10
|
*/
|
|
5
11
|
export declare const getRowKey: (row: TRowType) => string;
|
|
6
12
|
/**
|
|
7
|
-
*
|
|
13
|
+
* Builds a lightweight merge index without cloning/annotating cells.
|
|
8
14
|
* Identity is the first cell value. Deleted compare rows are inserted before their
|
|
9
15
|
* next still-present successor from compareRows (or appended if none).
|
|
10
16
|
*/
|
|
17
|
+
export declare const buildDiffIndex: (rows?: TRowsType, compareRows?: TRowsType) => TDiffIndexEntry[];
|
|
18
|
+
/**
|
|
19
|
+
* Builds an annotated table row from a diff index entry (styles / tooltips).
|
|
20
|
+
*/
|
|
21
|
+
export declare const buildAnnotatedRow: (entry: TDiffIndexEntry) => TRowType;
|
|
22
|
+
/**
|
|
23
|
+
* Merges current rows with compareRows and annotates cells for diff highlighting.
|
|
24
|
+
*/
|
|
11
25
|
export declare const buildDiffRows: (rows?: TRowsType, compareRows?: TRowsType) => TRowsType;
|
|
12
26
|
//# sourceMappingURL=build-diff-rows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-diff-rows.d.ts","sourceRoot":"","sources":["../../../src/components/diff-table/build-diff-rows.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"build-diff-rows.d.ts","sourceRoot":"","sources":["../../../src/components/diff-table/build-diff-rows.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AActE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7D,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,GAAG,EAAE,QAAQ,CAAC;IACd,UAAU,CAAC,EAAE,QAAQ,CAAC;CACvB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,QAAQ,KAAG,MAMzC,CAAC;AA8BF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,OAAM,SAAc,EAAE,cAAa,SAAc,KAAG,eAAe,EAsDjG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,eAAe,KAAG,QAQ1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAM,SAAc,EAAE,cAAa,SAAc,KAAG,SAEjF,CAAC"}
|
|
@@ -4,5 +4,9 @@ export interface IDiffTableProps extends Omit<ITableProps, 'table'> {
|
|
|
4
4
|
table: ITableTableProps;
|
|
5
5
|
compareRows: TRowsType;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Skinny wrapper around Table that highlights row/cell differences between
|
|
9
|
+
* `table.rows` (current) and `compareRows` (previous).
|
|
10
|
+
*/
|
|
11
|
+
export declare const DiffTable: ({ table, compareRows, beforeRenderRow: beforeRenderRowProp, ...rest }: IDiffTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
12
|
//# sourceMappingURL=diff-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-table.d.ts","sourceRoot":"","sources":["../../../src/components/diff-table/diff-table.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAS,MAAM,wBAAwB,CAAC;AAC9E,OAAO,
|
|
1
|
+
{"version":3,"file":"diff-table.d.ts","sourceRoot":"","sources":["../../../src/components/diff-table/diff-table.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAS,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAY,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGtE,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IACjE,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,SAAS,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,uEAAuE,eAAe,4CA0B/G,CAAC"}
|
|
@@ -21,4 +21,14 @@ export declare const GotchaEmptyKey: import('storybook/internal/csf').AnnotatedS
|
|
|
21
21
|
* ReactNode values in the first cell stringify to "[object Object]" — unstable keys.
|
|
22
22
|
*/
|
|
23
23
|
export declare const GotchaReactNodeKey: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react-vite').ReactRenderer, IDiffTableProps>;
|
|
24
|
+
export declare const LargeVirtualized: {
|
|
25
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
parameters: {
|
|
27
|
+
docs: {
|
|
28
|
+
description: {
|
|
29
|
+
story: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
24
34
|
//# sourceMappingURL=diff-table.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-table.stories.d.ts","sourceRoot":"","sources":["../../../src/components/diff-table/diff-table.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"diff-table.stories.d.ts","sourceRoot":"","sources":["../../../src/components/diff-table/diff-table.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;AAKtD,OAAO,EAAa,eAAe,EAAE,MAAM,cAAc,CAAC;wBAqDrD,IAAI;AAPT,wBAOU;AAIV,eAAO,MAAM,OAAO,mHAAoB,CAAC;AAEzC,eAAO,MAAM,SAAS,mHAAoB,CAAC;AAM3C;;;GAGG;AACH,eAAO,MAAM,eAAe,mHAAoB,CAAC;AAcjD;;GAEG;AACH,eAAO,MAAM,mBAAmB,mHAAoB,CAAC;AAiBrD;;GAEG;AACH,eAAO,MAAM,cAAc,mHAAoB,CAAC;AAwBhD;;GAEG;AACH,eAAO,MAAM,kBAAkB,mHAAoB,CAAC;AA2BpD,eAAO,MAAM,gBAAgB;;;;;;;;;CAsG5B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8178,12 +8178,10 @@ var Co = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), wo =
|
|
|
8178
8178
|
})
|
|
8179
8179
|
}) });
|
|
8180
8180
|
}, yp = { backgroundColor: "var(--color-background-error-muted)" }, bp = { backgroundColor: "var(--color-background-success-muted)" }, xp = { backgroundColor: "var(--color-background-warning-muted)" }, Sp = (e) => {
|
|
8181
|
-
if ("value" in e) return e.value;
|
|
8182
|
-
}, Cp = (e) => {
|
|
8183
8181
|
var t;
|
|
8184
|
-
let n = (t = e.cells)
|
|
8182
|
+
let n = (t = e.cells) == null || (t = t[0]) == null ? void 0 : t.value;
|
|
8185
8183
|
return n == null ? "" : String(n);
|
|
8186
|
-
},
|
|
8184
|
+
}, Cp = (e, t) => ({
|
|
8187
8185
|
...e,
|
|
8188
8186
|
cells: e.cells.map((e) => ({
|
|
8189
8187
|
...e,
|
|
@@ -8192,58 +8190,75 @@ var Co = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), wo =
|
|
|
8192
8190
|
...t
|
|
8193
8191
|
}
|
|
8194
8192
|
}))
|
|
8195
|
-
}),
|
|
8193
|
+
}), wp = (e, t) => ({
|
|
8196
8194
|
...e,
|
|
8197
8195
|
cells: e.cells.map((e, n) => {
|
|
8198
8196
|
var r;
|
|
8199
|
-
let i = (r = t.cells) == null ? void 0 : r[n];
|
|
8200
|
-
return !i || ln(
|
|
8197
|
+
let i = (r = t.cells) == null ? void 0 : r[n], a = i == null ? void 0 : i.value;
|
|
8198
|
+
return !i || ln(e.value, a) ? e : {
|
|
8201
8199
|
...e,
|
|
8202
8200
|
style: {
|
|
8203
8201
|
...e.style,
|
|
8204
8202
|
...xp
|
|
8205
8203
|
},
|
|
8206
|
-
tooltip:
|
|
8204
|
+
tooltip: a
|
|
8207
8205
|
};
|
|
8208
8206
|
})
|
|
8209
|
-
}),
|
|
8207
|
+
}), Tp = (e = [], t = []) => {
|
|
8210
8208
|
let n = /* @__PURE__ */ new Map();
|
|
8211
|
-
for (let e of t) n.set(
|
|
8212
|
-
let r = new Set(e.map(
|
|
8213
|
-
for (let e =
|
|
8214
|
-
let n = t[e],
|
|
8215
|
-
if (r.has(
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
let e = Cp(t[n]);
|
|
8219
|
-
if (r.has(e)) {
|
|
8220
|
-
c = e;
|
|
8221
|
-
break;
|
|
8222
|
-
}
|
|
8209
|
+
for (let e of t) n.set(Sp(e), e);
|
|
8210
|
+
let r = new Set(e.map(Sp)), i = /* @__PURE__ */ new Map(), a = [], o = null;
|
|
8211
|
+
for (let e = t.length - 1; e >= 0; e--) {
|
|
8212
|
+
let n = t[e], c = Sp(n);
|
|
8213
|
+
if (r.has(c)) {
|
|
8214
|
+
o = c;
|
|
8215
|
+
continue;
|
|
8223
8216
|
}
|
|
8224
|
-
if (
|
|
8217
|
+
if (o === null) a.push(n);
|
|
8225
8218
|
else {
|
|
8226
|
-
var
|
|
8227
|
-
let e = (
|
|
8228
|
-
e.
|
|
8219
|
+
var s;
|
|
8220
|
+
let e = (s = i.get(o)) == null ? [] : s;
|
|
8221
|
+
e.unshift(n), i.set(o, e);
|
|
8229
8222
|
}
|
|
8230
8223
|
}
|
|
8231
|
-
|
|
8224
|
+
a.reverse();
|
|
8225
|
+
let c = [];
|
|
8232
8226
|
for (let t of e) {
|
|
8233
|
-
let e =
|
|
8234
|
-
if (r) for (let e of r)
|
|
8227
|
+
let e = Sp(t), r = i.get(e);
|
|
8228
|
+
if (r) for (let e of r) c.push({
|
|
8229
|
+
status: "deleted",
|
|
8230
|
+
row: e
|
|
8231
|
+
});
|
|
8235
8232
|
let a = n.get(e);
|
|
8236
|
-
a ?
|
|
8233
|
+
a ? c.push({
|
|
8234
|
+
status: "matched",
|
|
8235
|
+
row: t,
|
|
8236
|
+
compareRow: a
|
|
8237
|
+
}) : c.push({
|
|
8238
|
+
status: "added",
|
|
8239
|
+
row: t
|
|
8240
|
+
});
|
|
8237
8241
|
}
|
|
8238
|
-
for (let e of a)
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
+
for (let e of a) c.push({
|
|
8243
|
+
status: "deleted",
|
|
8244
|
+
row: e
|
|
8245
|
+
});
|
|
8246
|
+
return c;
|
|
8247
|
+
}, Ep = (e) => e.status === "deleted" ? Cp(e.row, yp) : e.status === "added" ? Cp(e.row, bp) : wp(e.row, e.compareRow), Dp = ({ table: e, compareRows: t, beforeRenderRow: n, ...r }) => {
|
|
8248
|
+
let i = m(() => Tp(e.rows, t), [e.rows, t]), a = m(() => i.map((e) => e.row), [i]), o = l(({ row: e, rowIndex: t }) => {
|
|
8249
|
+
let r = i[t], a = r ? Ep(r) : e;
|
|
8250
|
+
return n ? n({
|
|
8251
|
+
row: a,
|
|
8252
|
+
rowIndex: t
|
|
8253
|
+
}) : a;
|
|
8254
|
+
}, [i, n]);
|
|
8242
8255
|
return /* @__PURE__ */ x(Gl, {
|
|
8243
|
-
...
|
|
8256
|
+
...r,
|
|
8257
|
+
beforeRenderRow: o,
|
|
8244
8258
|
table: {
|
|
8245
8259
|
...e,
|
|
8246
|
-
rows:
|
|
8260
|
+
rows: a,
|
|
8261
|
+
rowCount: i.length,
|
|
8247
8262
|
striped: !1
|
|
8248
8263
|
}
|
|
8249
8264
|
});
|
package/package.json
CHANGED