ywana-core8 0.0.229 → 0.0.233

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.229",
3
+ "version": "0.0.233",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -248,16 +248,22 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
248
248
  return opts
249
249
  }
250
250
 
251
+ function renderFormat(format, options) {
252
+ switch (format) {
253
+ case FORMATS.HTML: return <Editor id={id} value={value} onChange={change} content={content} />
254
+ case FORMATS.DATE: return <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} />
255
+ default:
256
+ return options ? (
257
+ <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={predictive} />
258
+ ) : (
259
+ <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
260
+ )
261
+ }
262
+ }
263
+
251
264
  return (
252
265
  <div className='field-editor string-editor'>
253
-
254
- { format === FORMATS.HTML ? <Editor id={id} value={value} onChange={change} content={content}/> : null }
255
-
256
- {
257
- format === FORMATS.DATE ? <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} /> :
258
- options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={predictive} /> :
259
- <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
260
- }
266
+ {renderFormat(format, options)}
261
267
  </div>
262
268
  )
263
269
  }
@@ -272,12 +278,12 @@ const NumberEditor = ({ field, value, onChange, outlined = false }) => {
272
278
  if (onChange) onChange(id, value)
273
279
  }
274
280
 
275
- const val = value || value ==="" ? value : field.default
281
+ const val = value || value === "" ? value : field.default
276
282
  const min = field.min
277
283
  const max = field.max
278
284
  const disabled = !editable
279
285
 
280
- console.log('NumberEditor: ', label, val, value )
286
+ console.log('NumberEditor: ', label, val, value)
281
287
 
282
288
  return (
283
289
  <div className='field-editor number-editor'>
@@ -16,6 +16,7 @@ export const TYPES = {
16
16
  export const FORMATS = {
17
17
  NONE: '',
18
18
  DATE: 'date',
19
+ TIME: 'time',
19
20
  EMAIL: 'email',
20
21
  HTML: 'HTML',
21
22
  URL: 'URL'
@@ -310,15 +310,26 @@ const TableEditor = (props) => {
310
310
  })
311
311
  }
312
312
 
313
+ function renderGroupLabel(groupName) {
314
+ const grouper = schema[groupBy]
315
+ if (grouper.options) {
316
+ const options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options
317
+ const option = options.find(option => option.value === groupName)
318
+ return option.label
319
+ } else {
320
+ return groupName
321
+ }
322
+ }
323
+
313
324
  function renderGroups() {
314
325
 
315
326
  const items = filter ? filter(all) : all
316
327
 
317
- const groups = items.reduce((groups, filter) => {
318
- const groupName = filter[groupBy]
328
+ const groups = items.reduce((groups, item) => {
329
+ const groupName = item[groupBy]
319
330
  const group = groups[groupName]
320
331
  if (!group) groups[groupName] = []
321
- groups[groupName].push(filter)
332
+ groups[groupName].push(item)
322
333
  return groups
323
334
  }, {})
324
335
 
@@ -361,6 +372,7 @@ const TableEditor = (props) => {
361
372
  return (
362
373
  <Fragment key={groupName}>
363
374
  <Header title={groupName} >
375
+ {renderGroupLabel(groupName)}
364
376
  <span className="size">{groupSize}</span>
365
377
  </Header>
366
378
  <DataTable {...table} onRowSelection={select} editable={editable} onCheckAll={check} />
package/src/html/table.js CHANGED
@@ -203,8 +203,18 @@ const BooleanCellViewer = ({ id, value = false }) => {
203
203
  const StringCellViewer = ({ id, value, format, options }) => {
204
204
  const option = options ? options.find(o => o.value === value) : null
205
205
  let text = option ? option.label : value
206
+ const locale = window.navigator.userLanguage || window.navigator.language;
206
207
  switch (format) {
207
- case FORMATS.DATE: text = new Date(text).toLocaleString(); break;
208
+ case FORMATS.DATE: text = new Date(text).toLocaleString( locale, {
209
+ year: 'numeric',
210
+ month: 'numeric',
211
+ day: 'numeric'
212
+ }); break;
213
+ case FORMATS.TIME: text = new Date(text).toLocaleString( locale, {
214
+ year: 'hour',
215
+ month: 'minute',
216
+ day: 'second'
217
+ }); break;
208
218
  }
209
219
  return (<div className="field-editor string-viewer">{text}</div>)
210
220
  }
@@ -2,4 +2,5 @@ export * from './login/LoginBox'
2
2
  export * from './login/ResetPasswordBox'
3
3
  export * from './viewer/Viewer'
4
4
  export * from './kanban/Kanban'
5
- export * from './avatar/avatar'
5
+ export * from './avatar/avatar'
6
+ export * from './waiter'
@@ -0,0 +1 @@
1
+ export * from './waiter'
@@ -0,0 +1,11 @@
1
+ .wait-screen {
2
+ position:absolute;
3
+ top:0px;
4
+ left:0px;
5
+ width: 100%;
6
+ height: 100%;
7
+ background-color: rgba(200,200,200,.5);
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react'
2
+ import { CircularProgress } from '../../html'
3
+ import './waiter.css'
4
+
5
+ export const WaitScreen = () => {
6
+ return (
7
+ <div className="wait-screen">
8
+ <CircularProgress size="large"/>
9
+ </div>
10
+ )
11
+ }