ywana-core8 0.0.866 → 0.0.867
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 +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +9 -0
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +9 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +21 -19
package/package.json
CHANGED
package/src/html/table.js
CHANGED
@@ -123,7 +123,7 @@ export const DataTable = (props) => {
|
|
123
123
|
</thead>
|
124
124
|
<tbody>
|
125
125
|
|
126
|
-
{
|
126
|
+
{filterable ? <DataTableFiltersRow columns={columns} /> : null}
|
127
127
|
|
128
128
|
{rows.length > 0 ?
|
129
129
|
multiSort(rows, sortDir).map((row, index) => (
|
@@ -149,9 +149,11 @@ const DataTableFiltersRow = ({ columns }) => {
|
|
149
149
|
return (
|
150
150
|
<tr className="filters-row">
|
151
151
|
{columns.map(({ id, filterable, onFilter }) => {
|
152
|
-
|
153
|
-
|
154
|
-
|
152
|
+
return (
|
153
|
+
<td className='filter-cell'>
|
154
|
+
{filterable ? <TextField id={id} onChange={onFilter} /> : null}
|
155
|
+
</td>
|
156
|
+
)
|
155
157
|
})}
|
156
158
|
</tr>
|
157
159
|
)
|
@@ -279,20 +281,20 @@ const BooleanCellViewer = ({ id, value = false }) => {
|
|
279
281
|
* NumberCellViewer
|
280
282
|
*/
|
281
283
|
const NumberCellViewer = ({ id, value, format, maxDecimals }) => {
|
282
|
-
/*
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
*/
|
284
|
+
/*
|
285
|
+
function formatNumber(number) {
|
286
|
+
// convert number to numeric
|
287
|
+
if (number === null) return "null"
|
288
|
+
const number2 = Number(number)
|
289
|
+
let result = number2.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
290
|
+
// thousands separator is a dot
|
291
|
+
var parts = result.toString().split(",");
|
292
|
+
const numberPart = parts[0];
|
293
|
+
const decimalPart = parts[1];
|
294
|
+
const thousands = /\B(?=(\d{3})+(?!\d))/g;
|
295
|
+
return numberPart.replace(thousands, ".") + (decimalPart ? "," + decimalPart : "");
|
296
|
+
}
|
297
|
+
*/
|
296
298
|
function formatNumber(number, maxDecimals = 0) {
|
297
299
|
if (number === null) return "null"
|
298
300
|
let result = number.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
@@ -301,7 +303,7 @@ const NumberCellViewer = ({ id, value, format, maxDecimals }) => {
|
|
301
303
|
const numberPart = parts[0];
|
302
304
|
const decimalPart = parts[1];
|
303
305
|
const thousands = /\B(?=(\d{3})+(?!\d))/g;
|
304
|
-
|
306
|
+
|
305
307
|
// limit decimal part to maxdecimals
|
306
308
|
const decimal = decimalPart ? decimalPart.substring(0, maxDecimals) : null;
|
307
309
|
return numberPart.replace(thousands, ".") + (decimal ? "," + decimal : "");
|