ywana-core8 0.0.762 → 0.0.764
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/index.cjs +24 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +24 -4
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +24 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +3 -1
- package/src/html/table.js +18 -2
- package/src/html/textfield.js +1 -0
package/package.json
CHANGED
@@ -303,7 +303,9 @@ export const CollectionTree = (props) => {
|
|
303
303
|
}
|
304
304
|
|
305
305
|
function renderNodes(nodes) {
|
306
|
-
return nodes
|
306
|
+
return nodes
|
307
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
308
|
+
.map(node => {
|
307
309
|
const title = typeof node.name === 'boolean' ? `${node.field} = ${node.name}` : node.title
|
308
310
|
return (
|
309
311
|
<TreeNode key={node.name} icon={null} label={title} open={true}>
|
package/src/html/table.js
CHANGED
@@ -165,7 +165,7 @@ const DataTableCell = ({ index, row, column, cell, editable }) => {
|
|
165
165
|
const render = (type) => {
|
166
166
|
const { id, disabled = false, min, max, onChange, format, options, item, action } = column
|
167
167
|
|
168
|
-
|
168
|
+
|
169
169
|
if (id === "checked") {
|
170
170
|
return <CheckBox id={id} value={cell} onChange={(id, value) => onChange(row.id, id, value)} />
|
171
171
|
} else if (editable && onChange) {
|
@@ -249,12 +249,28 @@ const BooleanCellViewer = ({ id, value = false }) => {
|
|
249
249
|
* NumberCellViewer
|
250
250
|
*/
|
251
251
|
const NumberCellViewer = ({ id, value, format, maxDecimals }) => {
|
252
|
+
|
253
|
+
function formatNumber(number) {
|
254
|
+
if (number === null) return "null"
|
255
|
+
let result = number.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
256
|
+
// thousands separator is a dot
|
257
|
+
var parts = result.toString().split(",");
|
258
|
+
const numberPart = parts[0];
|
259
|
+
const decimalPart = parts[1];
|
260
|
+
const thousands = /\B(?=(\d{3})+(?!\d))/g;
|
261
|
+
return numberPart.replace(thousands, ".") + (decimalPart ? "," + decimalPart : "");
|
262
|
+
}
|
263
|
+
|
252
264
|
if (format) {
|
253
265
|
switch (format) {
|
254
266
|
case FORMATS.CURRENCY:
|
255
267
|
return <span>{value.toLocaleString('es-ES', { style: 'currency', currency: 'EUR' })}</span>
|
256
268
|
case FORMATS.PERCENT:
|
257
269
|
return <span>{value.toLocaleString('es-ES', { style: 'percent', minimumFractionDigits: 2 })}</span>
|
270
|
+
case "ES_es":
|
271
|
+
const decimals = maxDecimals ? maxDecimals : 2
|
272
|
+
if (typeof value === "string") value = parseFloat(value)
|
273
|
+
return (value && !isNaN(value)) ? <span>{formatNumber(value.toFixed(decimals))}</span> : ""
|
258
274
|
default:
|
259
275
|
return <span>{value}</span>
|
260
276
|
}
|
@@ -293,7 +309,7 @@ const StringCellViewer = ({ id, value, format, options, action }) => {
|
|
293
309
|
text = <a href={text} target="download" download >{text}</a>
|
294
310
|
break;
|
295
311
|
case FORMATS.IMG:
|
296
|
-
text = <img src={text} onClick={onClick}/>
|
312
|
+
text = <img src={text} onClick={onClick} />
|
297
313
|
break;
|
298
314
|
case FORMATS.DATE:
|
299
315
|
let fecha = new Date(text)
|
package/src/html/textfield.js
CHANGED
@@ -99,6 +99,7 @@ export const TextArea = (props) => {
|
|
99
99
|
if (onChange) onChange(id, "")
|
100
100
|
}
|
101
101
|
|
102
|
+
const borderStyle = outlined ? "textarea-outlined" : "textarea"
|
102
103
|
const labelStyle = label ? "" : "no-label"
|
103
104
|
const style = `textarea ${labelStyle} textarea-${type}`
|
104
105
|
const labelTxt = <Text>{label}</Text>
|