ywana-core8 0.0.780 → 0.0.781

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.780",
3
+ "version": "0.0.781",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
package/src/html/table.js CHANGED
@@ -38,6 +38,12 @@ export const DataTable = (props) => {
38
38
  const keySort = (a, b, direction) => {
39
39
  direction = direction !== null ? direction : 1;
40
40
 
41
+ // check if a and b are numbers and compare as numbers
42
+ if (!isNaN(a) && !isNaN(b)) {
43
+ a = Number(a);
44
+ b = Number(b);
45
+ }
46
+
41
47
  if (a === b) { // If the values are the same, do not switch positions.
42
48
  return 0;
43
49
  }
@@ -6,13 +6,13 @@ export const TableTest = (prop) => {
6
6
 
7
7
  const [rows, setRows] = useState(
8
8
  [
9
- { id: 1, checked: false, name: "John Smith" , description: "lorem ipsum 9", thumb: "https://w7.pngwing.com/pngs/881/826/png-transparent-pikachu-ash-ketchum-pokemon-vrste-pikachu-leaf-flower-meme-thumbnail.png" },
10
- { id: 2, checked: false, name: "Ann Martin" , description: "lorem ipsum 2", color: "#CCFFFF" },
11
- { id: 3, checked: false, name: "Ann Martin" , description: "lorem ipsum 8", color: "#CCFFFF" },
12
- { id: 4, checked: false, name: "Zack McCracken", description: "lorem ipsum 4", color: "#CCFFFF" },
13
- { id: 5, checked: false, name: "Ann Martin" , description: "lorem ipsum 1", color: "#CCFFFF" },
14
- { id: 6, checked: false, name: "John Smith" , description: "lorem ipsum 2", color: "#CCFFFF" },
15
- { id: 7, checked: false, name: "Ann Martin" , description: "lorem ipsum 1", color: "#CCFFFF" },
9
+ { id: 1, checked: false, name: "John Smith" , description: "lorem ipsum 9", color: "#CACAFF", num: 25, thumb: "https://w7.pngwing.com/pngs/881/826/png-transparent-pikachu-ash-ketchum-pokemon-vrste-pikachu-leaf-flower-meme-thumbnail.png" },
10
+ { id: 2, checked: false, name: "Ann Martin" , description: "lorem ipsum 2", color: "#CCFFFF", num: 1234567890.1234567890 },
11
+ { id: 3, checked: false, name: "Ann Martin" , description: "lorem ipsum 8", color: "#CCFFFF", num: 12340.1234567890 },
12
+ { id: 4, checked: false, name: "Zack McCracken", description: "lorem ipsum 4", color: "#CCFFFF", num: 567890.1234567890 },
13
+ { id: 5, checked: false, name: "Ann Martin" , description: "lorem ipsum 1", color: "#CCFFFF", num: 23670.190 },
14
+ { id: 6, checked: false, name: "John Smith" , description: "lorem ipsum 2", color: "#CCFFFF", num: 71230.10 },
15
+ { id: 7, checked: false, name: "Ann Martin" , description: "lorem ipsum 1", color: "#CCFFFF", num: 3490.23 },
16
16
  { id: 8, checked: false, name: "Martin Freeman", description: "lorem ipsum 4", color: "#CCFFFF" , num: 890.1234567890 },
17
17
  { id: 9, checked: false, name: "Ann Martin" , description: "lorem ipsum 5", color: "#CCFFFF", date: new Date().toString() },
18
18
  ]
@@ -47,7 +47,7 @@ export const TableTest = (prop) => {
47
47
  { id: "description", label: "Description", type: "String", sortable: true },
48
48
  { id: "color" , label: "Color" , type: "String", format: FORMATS.COLOR },
49
49
  { id: "date" , label: "Date" , type: "String", format: FORMATS.DATE },
50
- { id: "num" , label: "Num" , type: "Number", maxDecimals: 2 },
50
+ { id: "num" , label: "Num" , type: "Number", maxDecimals: 2, sortable: true},
51
51
  ],
52
52
  rows
53
53
  }