ywana-core8 0.0.778 → 0.0.780

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.778",
3
+ "version": "0.0.780",
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
@@ -13,14 +13,19 @@ const isFunction = value => value && (Object.prototype.toString.call(value) ===
13
13
  */
14
14
  export const DataTable = (props) => {
15
15
 
16
- const { columns = [], rows = [], onRowSelection, onSort, onCheckAll, editable, outlined, expanded = false, className, emptyMessage = "No Results Found" } = props
16
+ const { columns = [], rows = [], onRowSelection, onSort, onCheckAll, editable, outlined, expanded = false, className, emptyMessage = "No Results Found", multisort = false } = props
17
17
  const [sortDir, setSortDir] = useState({})
18
18
  const [allChecked, setAllChecked] = useState(false)
19
19
 
20
20
  function changeSort(id) {
21
- const nextDir = sortDir[id] ? sortDir[id] * -1 : 1
22
- const next = Object.assign({}, sortDir, { [id]: nextDir })
23
- setSortDir(next)
21
+ if (multisort) {
22
+ const nextDir = sortDir[id] ? sortDir[id] * -1 : 1
23
+ const next = Object.assign({}, sortDir, { [id]: nextDir })
24
+ setSortDir(next)
25
+ } else {
26
+ const nextDir = sortDir[id] ? sortDir[id] * -1 : 1
27
+ setSortDir({ [id]: nextDir })
28
+ }
24
29
  }
25
30
 
26
31
  function multiSort(array, sortObject = {}) {
@@ -270,10 +275,10 @@ const NumberCellViewer = ({ id, value, format, maxDecimals }) => {
270
275
  case FORMATS.PERCENT:
271
276
  return <span>{value.toLocaleString('es-ES', { style: 'percent', minimumFractionDigits: 2 })}</span>
272
277
  case "ES_es":
273
-
278
+
274
279
  // convert value to number
275
280
  let number = Number(value)
276
-
281
+
277
282
  // if value is not a number, return value
278
283
  if (isNaN(number)) return value
279
284
 
@@ -6,15 +6,15 @@ 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 ", 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 ", color: "#CCFFFF" },
11
- { id: 3, checked: false, name: "Ann Martin" , description: "lorem ipsum ", color: "#CCFFFF" },
12
- { id: 4, checked: false, name: "Zack McCracken", description: "lorem ipsum ", color: "#CCFFFF" },
13
- { id: 5, checked: false, name: "Ann Martin" , description: "lorem ipsum ", color: "#CCFFFF" },
14
- { id: 6, checked: false, name: "John Smith" , description: "lorem ipsum ", color: "#CCFFFF" },
15
- { id: 7, checked: false, name: "Ann Martin" , description: "lorem ipsum ", color: "#CCFFFF" },
16
- { id: 8, checked: false, name: "Martin Freeman", description: "lorem ipsum ", color: "#CCFFFF" , num: 890.1234567890 },
17
- { id: 9, checked: false, name: "Ann Martin" , description: "lorem ipsum ", color: "#CCFFFF", date: new Date().toString() },
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" },
16
+ { id: 8, checked: false, name: "Martin Freeman", description: "lorem ipsum 4", color: "#CCFFFF" , num: 890.1234567890 },
17
+ { id: 9, checked: false, name: "Ann Martin" , description: "lorem ipsum 5", color: "#CCFFFF", date: new Date().toString() },
18
18
  ]
19
19
  )
20
20
 
@@ -44,7 +44,7 @@ export const TableTest = (prop) => {
44
44
  { id: "index" , label: "#" , type: "INDEX" },
45
45
  { id: "checked" , onChange: check },
46
46
  { id: "name" , label: "Name" , type: "String", sortable: true, filtrable: true },
47
- { id: "description", label: "Description", type: "String" },
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
50
  { id: "num" , label: "Num" , type: "Number", maxDecimals: 2 },
@@ -55,7 +55,7 @@ export const TableTest = (prop) => {
55
55
  return (
56
56
  <>
57
57
  <div style={{ maxHeight: "20rem", overflow: "auto", margin: "2rem", display: "flex" }}>
58
- <DataTable {...table1} onRowSelection={select} outlined />
58
+ x<DataTable {...table1} onRowSelection={select} outlined multisort={true}/>
59
59
  </div>
60
60
  <div style={{ maxHeight: "20rem", overflow: "auto", margin: "2rem" }}>
61
61
  <DataTable {...table1} onRowSelection={select} onCheckAll={checkAll} />
@@ -172,8 +172,6 @@ export const TaskMonitor = (props) => {
172
172
  refresh()
173
173
  }
174
174
 
175
- if (!tasks.length) return null
176
-
177
175
  const table = {
178
176
  columns: [
179
177
  { id: "state", label: "Estado" },