ywana-core8 0.0.907 → 0.0.908

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.907",
3
+ "version": "0.0.908",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -458,7 +458,10 @@ export const TableEditor = (props) => {
458
458
  format: field.format,
459
459
  item: field.item ? field.item : [],
460
460
  onChange: field.id === "checked" ? checkOne : field.editable ? change : null, /* checked has it´s own handler */
461
- options
461
+ options,
462
+ sortable: field.sortable || false,
463
+ filterable: field.filterable || false,
464
+ resizable: field.resizable || false,
462
465
  }
463
466
  }),
464
467
  rows: groups[groupName]
@@ -0,0 +1,80 @@
1
+ import React, {useState, useEffect} from 'react';
2
+
3
+ function CompareImages({ images, orientation, zoom }) {
4
+ const [image1, setImage1] = useState(null);
5
+ const [image2, setImage2] = useState(null);
6
+ const [curtain, setCurtain] = useState({
7
+ position: orientation === "vertical" ? "50%" : "33.3333%",
8
+ width: orientation === "vertical" ? 0 : 1,
9
+ });
10
+ const [zoomFactor, setZoomFactor] = useState(zoom);
11
+
12
+ useEffect(() => {
13
+ setImage1(images[0]);
14
+ setImage2(images[1]);
15
+ }, [images]);
16
+
17
+ const handleZoom = (event) => {
18
+ setZoomFactor(event.deltaY / 10);
19
+ };
20
+
21
+ const handleMove = (event) => {
22
+ const { x, y } = event.touches[0] || event.clientX;
23
+ setCurtain({
24
+ position: orientation === "vertical" ? y / window.innerHeight : x / window.innerWidth,
25
+ width: orientation === "vertical" ? 0 : 1 - curtain.position,
26
+ });
27
+ };
28
+
29
+ return (
30
+ <div style={{ width: "100%", height: "100%" }}>
31
+ <div style={{ width: "100%", height: "100%" }}>
32
+ <div style={{ width: "50%" }}>
33
+ <img src={image1} style={{ zoom: zoomFactor }} />
34
+ </div>
35
+ <div style={{ width: "50%" }}>
36
+ <img src={image2} style={{ zoom: zoomFactor }} />
37
+ </div>
38
+ </div>
39
+ <div
40
+ style={{
41
+ position: "absolute",
42
+ top: 0,
43
+ left: 0,
44
+ width: "100%",
45
+ height: "100%",
46
+ zIndex: 1,
47
+ pointerEvents: "none",
48
+ }}
49
+ >
50
+ <div
51
+ style={{
52
+ position: "absolute",
53
+ width: curtain.width,
54
+ height: curtain.height,
55
+ top: curtain.position * window.innerHeight,
56
+ left: curtain.position * window.innerWidth,
57
+ backgroundColor: "black",
58
+ opacity: 0.5,
59
+ }}
60
+ ></div>
61
+ </div>
62
+ </div>
63
+ );
64
+ }
65
+
66
+
67
+ const CompareImagesTest = () => {
68
+ return (
69
+ <div style={{ width: "100%", height: "100%" }}>
70
+ <CompareImages
71
+ images={[
72
+ "https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg?size=626&ext=jpg&ga=GA1.1.1546980028.1702080000&semt=sph",
73
+ "https://t4.ftcdn.net/jpg/06/68/30/09/360_F_668300949_oDIKoExgMgVETBk9MuJicJ0MTrMHhTDW.jpg",
74
+ ]}
75
+ orientation="vertical"
76
+ zoom={1}
77
+ />
78
+ </div>
79
+ );
80
+ }