ywana-core8 0.0.375 → 0.0.376
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 +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +17 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +17 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentType.js +2 -1
- package/src/html/table.css +5 -1
- package/src/html/table.js +11 -2
- package/src/html/table.test.js +3 -2
- package/src/http/client.js +0 -1
package/package.json
CHANGED
package/src/html/table.css
CHANGED
package/src/html/table.js
CHANGED
@@ -144,8 +144,10 @@ const DataTableRow = (props) => {
|
|
144
144
|
*/
|
145
145
|
const DataTableCell = ({ row, column, cell, editable }) => {
|
146
146
|
|
147
|
+
|
147
148
|
const render = (type) => {
|
148
149
|
const { id, disabled = false, min, max, onChange, format, options, item } = column
|
150
|
+
|
149
151
|
if (id === "checked") {
|
150
152
|
return <CheckBox id={id} value={cell} onChange={(id, value) => onChange(row.id, id, value)} />
|
151
153
|
} else if (editable && onChange) {
|
@@ -208,18 +210,25 @@ const StringCellViewer = ({ id, value, format, options }) => {
|
|
208
210
|
}
|
209
211
|
|
210
212
|
const option = options ? buildOptions().find(o => o.value === value) : null
|
211
|
-
|
212
213
|
let text = option ? option.label : value
|
213
214
|
const locale = window.navigator.userLanguage || window.navigator.language;
|
214
215
|
switch (format) {
|
216
|
+
case FORMATS.URL:
|
217
|
+
text = <a href={text} target="download" download >{text}</a>
|
218
|
+
break;
|
219
|
+
case FORMATS.IMG:
|
220
|
+
text = <img src={text} />
|
221
|
+
break;
|
215
222
|
case FORMATS.DATE:
|
216
223
|
let fecha = new Date(text)
|
217
224
|
fecha.setMinutes(fecha.getMinutes() + fecha.getTimezoneOffset() + 1)
|
218
225
|
text = fecha.toLocaleString( locale, { year: 'numeric', month: 'numeric', day: 'numeric'});
|
219
226
|
break;
|
220
227
|
case FORMATS.TIME:
|
221
|
-
text = new Date(text).toLocaleString( locale, { year: 'hour', month: 'minute', day: 'second' });
|
228
|
+
text = new Date(text).toLocaleString( locale, { year: 'hour', month: 'minute', day: 'second' });
|
229
|
+
break;
|
222
230
|
}
|
231
|
+
console.log(value, format)
|
223
232
|
return (<div className="field-editor string-viewer">{text}</div>)
|
224
233
|
}
|
225
234
|
|
package/src/html/table.test.js
CHANGED
@@ -15,11 +15,12 @@ const TableTest = (prop) => {
|
|
15
15
|
columns : [
|
16
16
|
{ id: "checked", onChange: check },
|
17
17
|
{ id: "name", label: "Name" },
|
18
|
+
{ id: "thumb", label: "Thumb", type: "String", format: "IMG" },
|
18
19
|
|
19
20
|
],
|
20
21
|
rows: [
|
21
|
-
{ checked: true, name: "John Smith"},
|
22
|
-
{ checked: false, name: "Ann Martin"},
|
22
|
+
{ checked: true, name: "John Smith", thumb: "https://w7.pngwing.com/pngs/881/826/png-transparent-pikachu-ash-ketchum-pokemon-vrste-pikachu-leaf-flower-meme-thumbnail.png"},
|
23
|
+
{ checked: false, name: "Ann Martin" },
|
23
24
|
]
|
24
25
|
}
|
25
26
|
|