@teambit/defender.ui.test-compare 0.0.221 → 0.0.223
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/compare-tests.tsx +11 -35
- package/dist/compare-tests.js +9 -32
- package/dist/compare-tests.js.map +1 -1
- package/package-tar/teambit-defender.ui.test-compare-0.0.223.tgz +0 -0
- package/package.json +4 -5
- package/package-tar/teambit-defender.ui.test-compare-0.0.221.tgz +0 -0
- /package/dist/{preview-1692297727886.js → preview-1692674301863.js} +0 -0
package/compare-tests.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { CompareSplitLayoutPreset } from '@teambit/component.ui.component-compare.layouts.compare-split-layout-preset';
|
|
2
2
|
import { useComponentCompare } from '@teambit/component.ui.component-compare.context';
|
|
3
3
|
import { EmptyStateSlot } from '@teambit/compositions';
|
|
4
|
-
import { Toggle } from '@teambit/design.inputs.toggle-switch';
|
|
5
4
|
import { RoundLoader } from '@teambit/design.ui.round-loader';
|
|
6
|
-
import React, { HTMLAttributes,
|
|
5
|
+
import React, { HTMLAttributes, useMemo } from 'react';
|
|
7
6
|
import { CompareTestsPage } from './compare-tests-page';
|
|
8
7
|
import styles from './compare-tests.module.scss';
|
|
9
8
|
|
|
@@ -14,45 +13,26 @@ export type CompareTestsProps = {
|
|
|
14
13
|
export function CompareTests(props: CompareTestsProps) {
|
|
15
14
|
const { emptyState } = props;
|
|
16
15
|
const componentCompare = useComponentCompare();
|
|
17
|
-
const [isScrollingSynced, setIsScrollingSynced] = useState<boolean>(true);
|
|
18
|
-
|
|
19
|
-
const leftPanelRef = useRef<HTMLDivElement>(null);
|
|
20
|
-
const rightPanelRef = useRef<HTMLDivElement>(null);
|
|
21
|
-
|
|
22
|
-
function handleLeftPanelScroll(event: UIEvent<HTMLDivElement>) {
|
|
23
|
-
if (!isScrollingSynced) return;
|
|
24
|
-
rightPanelRef.current?.scrollTo({ top: event.currentTarget.scrollTop, left: event.currentTarget.scrollLeft });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function handleRightPanelScroll(event: UIEvent<HTMLDivElement>) {
|
|
28
|
-
if (!isScrollingSynced) return;
|
|
29
|
-
leftPanelRef.current?.scrollTo({ top: event.currentTarget.scrollTop, left: event.currentTarget.scrollLeft });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function handleScrollingSyncChange() {
|
|
33
|
-
rightPanelRef.current?.scrollTo({ top: leftPanelRef.current?.scrollTop, left: leftPanelRef.current?.scrollLeft });
|
|
34
|
-
setIsScrollingSynced((prev) => !prev);
|
|
35
|
-
}
|
|
36
16
|
|
|
37
17
|
const BaseLayout = useMemo(() => {
|
|
38
18
|
if (componentCompare?.base === undefined) {
|
|
39
|
-
return
|
|
19
|
+
return null;
|
|
40
20
|
}
|
|
41
21
|
|
|
42
22
|
return (
|
|
43
|
-
<div className={styles.subView}
|
|
23
|
+
<div className={styles.subView}>
|
|
44
24
|
<CompareTestsPage component={componentCompare.base?.model} emptyState={emptyState} />
|
|
45
25
|
</div>
|
|
46
26
|
);
|
|
47
|
-
}, [componentCompare?.base
|
|
27
|
+
}, [componentCompare?.base]);
|
|
48
28
|
|
|
49
29
|
const CompareLayout = useMemo(() => {
|
|
50
30
|
if (componentCompare?.compare === undefined) {
|
|
51
|
-
return
|
|
31
|
+
return null;
|
|
52
32
|
}
|
|
53
33
|
|
|
54
34
|
return (
|
|
55
|
-
<div className={styles.subView}
|
|
35
|
+
<div className={styles.subView}>
|
|
56
36
|
<CompareTestsPage
|
|
57
37
|
component={componentCompare.compare.model}
|
|
58
38
|
isCompareVersionWorkspace={componentCompare.compare.hasLocalChanges}
|
|
@@ -60,22 +40,18 @@ export function CompareTests(props: CompareTestsProps) {
|
|
|
60
40
|
/>
|
|
61
41
|
</div>
|
|
62
42
|
);
|
|
63
|
-
}, [componentCompare?.compare
|
|
43
|
+
}, [componentCompare?.compare]);
|
|
44
|
+
|
|
45
|
+
const key = `${componentCompare?.base?.model.id.toString()}-${componentCompare?.compare?.model.id.toString()}-compare-tests`;
|
|
64
46
|
|
|
65
47
|
return (
|
|
66
|
-
|
|
48
|
+
<React.Fragment key={key}>
|
|
67
49
|
{componentCompare?.loading && (
|
|
68
50
|
<div className={styles.loader}>
|
|
69
51
|
<RoundLoader />
|
|
70
52
|
</div>
|
|
71
53
|
)}
|
|
72
|
-
<div className={styles.checkboxContainer}>
|
|
73
|
-
<div className={styles.toggleContainer}>
|
|
74
|
-
<Toggle checked={isScrollingSynced} onInputChanged={handleScrollingSyncChange} className={styles.toggle} />
|
|
75
|
-
Synchronize Scrolling
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
54
|
<CompareSplitLayoutPreset base={BaseLayout} compare={CompareLayout} className={styles.splitLayout} />
|
|
79
|
-
|
|
55
|
+
</React.Fragment>
|
|
80
56
|
);
|
|
81
57
|
}
|
package/dist/compare-tests.js
CHANGED
|
@@ -29,56 +29,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.CompareTests = void 0;
|
|
30
30
|
const component_ui_component_compare_layouts_compare_split_layout_preset_1 = require("@teambit/component.ui.component-compare.layouts.compare-split-layout-preset");
|
|
31
31
|
const component_ui_component_compare_context_1 = require("@teambit/component.ui.component-compare.context");
|
|
32
|
-
const design_inputs_toggle_switch_1 = require("@teambit/design.inputs.toggle-switch");
|
|
33
32
|
const design_ui_round_loader_1 = require("@teambit/design.ui.round-loader");
|
|
34
33
|
const react_1 = __importStar(require("react"));
|
|
35
34
|
const compare_tests_page_1 = require("./compare-tests-page");
|
|
36
35
|
const compare_tests_module_scss_1 = __importDefault(require("./compare-tests.module.scss"));
|
|
37
36
|
function CompareTests(props) {
|
|
37
|
+
var _a, _b;
|
|
38
38
|
const { emptyState } = props;
|
|
39
39
|
const componentCompare = (0, component_ui_component_compare_context_1.useComponentCompare)();
|
|
40
|
-
const [isScrollingSynced, setIsScrollingSynced] = (0, react_1.useState)(true);
|
|
41
|
-
const leftPanelRef = (0, react_1.useRef)(null);
|
|
42
|
-
const rightPanelRef = (0, react_1.useRef)(null);
|
|
43
|
-
function handleLeftPanelScroll(event) {
|
|
44
|
-
var _a;
|
|
45
|
-
if (!isScrollingSynced)
|
|
46
|
-
return;
|
|
47
|
-
(_a = rightPanelRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ top: event.currentTarget.scrollTop, left: event.currentTarget.scrollLeft });
|
|
48
|
-
}
|
|
49
|
-
function handleRightPanelScroll(event) {
|
|
50
|
-
var _a;
|
|
51
|
-
if (!isScrollingSynced)
|
|
52
|
-
return;
|
|
53
|
-
(_a = leftPanelRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ top: event.currentTarget.scrollTop, left: event.currentTarget.scrollLeft });
|
|
54
|
-
}
|
|
55
|
-
function handleScrollingSyncChange() {
|
|
56
|
-
var _a, _b, _c;
|
|
57
|
-
(_a = rightPanelRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ top: (_b = leftPanelRef.current) === null || _b === void 0 ? void 0 : _b.scrollTop, left: (_c = leftPanelRef.current) === null || _c === void 0 ? void 0 : _c.scrollLeft });
|
|
58
|
-
setIsScrollingSynced((prev) => !prev);
|
|
59
|
-
}
|
|
60
40
|
const BaseLayout = (0, react_1.useMemo)(() => {
|
|
61
41
|
var _a;
|
|
62
42
|
if ((componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.base) === undefined) {
|
|
63
|
-
return
|
|
43
|
+
return null;
|
|
64
44
|
}
|
|
65
|
-
return (react_1.default.createElement("div", { className: compare_tests_module_scss_1.default.subView
|
|
45
|
+
return (react_1.default.createElement("div", { className: compare_tests_module_scss_1.default.subView },
|
|
66
46
|
react_1.default.createElement(compare_tests_page_1.CompareTestsPage, { component: (_a = componentCompare.base) === null || _a === void 0 ? void 0 : _a.model, emptyState: emptyState })));
|
|
67
|
-
}, [componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.base
|
|
47
|
+
}, [componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.base]);
|
|
68
48
|
const CompareLayout = (0, react_1.useMemo)(() => {
|
|
69
49
|
if ((componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.compare) === undefined) {
|
|
70
|
-
return
|
|
50
|
+
return null;
|
|
71
51
|
}
|
|
72
|
-
return (react_1.default.createElement("div", { className: compare_tests_module_scss_1.default.subView
|
|
52
|
+
return (react_1.default.createElement("div", { className: compare_tests_module_scss_1.default.subView },
|
|
73
53
|
react_1.default.createElement(compare_tests_page_1.CompareTestsPage, { component: componentCompare.compare.model, isCompareVersionWorkspace: componentCompare.compare.hasLocalChanges, emptyState: emptyState })));
|
|
74
|
-
}, [componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.compare
|
|
75
|
-
|
|
54
|
+
}, [componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.compare]);
|
|
55
|
+
const key = `${(_a = componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.base) === null || _a === void 0 ? void 0 : _a.model.id.toString()}-${(_b = componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.compare) === null || _b === void 0 ? void 0 : _b.model.id.toString()}-compare-tests`;
|
|
56
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: key },
|
|
76
57
|
(componentCompare === null || componentCompare === void 0 ? void 0 : componentCompare.loading) && (react_1.default.createElement("div", { className: compare_tests_module_scss_1.default.loader },
|
|
77
58
|
react_1.default.createElement(design_ui_round_loader_1.RoundLoader, null))),
|
|
78
|
-
react_1.default.createElement("div", { className: compare_tests_module_scss_1.default.checkboxContainer },
|
|
79
|
-
react_1.default.createElement("div", { className: compare_tests_module_scss_1.default.toggleContainer },
|
|
80
|
-
react_1.default.createElement(design_inputs_toggle_switch_1.Toggle, { checked: isScrollingSynced, onInputChanged: handleScrollingSyncChange, className: compare_tests_module_scss_1.default.toggle }),
|
|
81
|
-
"Synchronize Scrolling")),
|
|
82
59
|
react_1.default.createElement(component_ui_component_compare_layouts_compare_split_layout_preset_1.CompareSplitLayoutPreset, { base: BaseLayout, compare: CompareLayout, className: compare_tests_module_scss_1.default.splitLayout })));
|
|
83
60
|
}
|
|
84
61
|
exports.CompareTests = CompareTests;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare-tests.js","sourceRoot":"","sources":["../compare-tests.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oKAAuH;AACvH,4GAAsF;AAEtF,
|
|
1
|
+
{"version":3,"file":"compare-tests.js","sourceRoot":"","sources":["../compare-tests.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oKAAuH;AACvH,4GAAsF;AAEtF,4EAA8D;AAC9D,+CAAuD;AACvD,6DAAwD;AACxD,4FAAiD;AAMjD,SAAgB,YAAY,CAAC,KAAwB;;IACnD,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC7B,MAAM,gBAAgB,GAAG,IAAA,4DAAmB,GAAE,CAAC;IAE/C,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;;QAC9B,IAAI,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,MAAK,SAAS,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CACL,uCAAK,SAAS,EAAE,mCAAM,CAAC,OAAO;YAC5B,8BAAC,qCAAgB,IAAC,SAAS,EAAE,MAAA,gBAAgB,CAAC,IAAI,0CAAE,KAAK,EAAE,UAAU,EAAE,UAAU,GAAI,CACjF,CACP,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,CAAC,CAAC,CAAC;IAE7B,MAAM,aAAa,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACjC,IAAI,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,OAAO,MAAK,SAAS,EAAE;YAC3C,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CACL,uCAAK,SAAS,EAAE,mCAAM,CAAC,OAAO;YAC5B,8BAAC,qCAAgB,IACf,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,EACzC,yBAAyB,EAAE,gBAAgB,CAAC,OAAO,CAAC,eAAe,EACnE,UAAU,EAAE,UAAU,GACtB,CACE,CACP,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,OAAO,CAAC,CAAC,CAAC;IAEhC,MAAM,GAAG,GAAG,GAAG,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,0CAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,OAAO,0CAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IAE7H,OAAO,CACL,8BAAC,eAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,GAAG;QACrB,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,OAAO,KAAI,CAC5B,uCAAK,SAAS,EAAE,mCAAM,CAAC,MAAM;YAC3B,8BAAC,oCAAW,OAAG,CACX,CACP;QACD,8BAAC,6FAAwB,IAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,mCAAM,CAAC,WAAW,GAAI,CACtF,CAClB,CAAC;AACJ,CAAC;AA5CD,oCA4CC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/defender.ui.test-compare",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.223",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/defender/ui/test-compare",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "ui/test-compare",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.223"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"classnames": "2.2.6",
|
|
13
13
|
"core-js": "^3.0.0",
|
|
14
14
|
"@teambit/design.ui.alert-card": "0.0.26",
|
|
15
15
|
"@teambit/design.ui.empty-box": "0.0.363",
|
|
16
|
-
"@teambit/design.inputs.toggle-switch": "0.0.6",
|
|
17
16
|
"@teambit/design.ui.round-loader": "0.0.355",
|
|
18
17
|
"@teambit/defender.ui.test-loader": "0.0.499",
|
|
19
18
|
"@teambit/defender.ui.test-page": "0.0.20",
|
|
20
19
|
"@teambit/defender.ui.test-table": "0.0.505",
|
|
21
20
|
"@teambit/mdx.ui.mdx-layout": "1.0.1",
|
|
22
|
-
"@teambit/component.ui.component-compare.context": "0.0.
|
|
23
|
-
"@teambit/component.ui.component-compare.layouts.compare-split-layout-preset": "0.0.
|
|
21
|
+
"@teambit/component.ui.component-compare.context": "0.0.85",
|
|
22
|
+
"@teambit/component.ui.component-compare.layouts.compare-split-layout-preset": "0.0.4"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"@types/classnames": "2.2.11",
|
|
Binary file
|
|
File without changes
|