ywana-core8 0.0.245 → 0.0.249
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 +25 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +25 -5
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +25 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.js +1 -1
- package/src/html/index.js +1 -1
- package/src/html/label.css +0 -0
- package/src/html/label.js +29 -0
- package/src/html/label.test.js +0 -0
- package/src/html/property.test.js +0 -1
- package/src/html/text.js +25 -9
- package/src/html/text.test.js +11 -0
- package/src/html/textfield.js +2 -0
package/package.json
CHANGED
@@ -254,7 +254,7 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
|
|
254
254
|
case FORMATS.DATE: return <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} />
|
255
255
|
default:
|
256
256
|
return options ? (
|
257
|
-
<DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable}
|
257
|
+
<DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} predictive={predictive} />
|
258
258
|
) : (
|
259
259
|
<TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
|
260
260
|
)
|
package/src/html/index.js
CHANGED
@@ -12,7 +12,7 @@ export { RadioButton } from './radio'
|
|
12
12
|
export { Section } from './section'
|
13
13
|
export { Tabs, Tab, Stack } from './tab'
|
14
14
|
export { DataTable } from './table'
|
15
|
-
export { Text } from './text'
|
15
|
+
export { Text, TEXTFORMATS } from './text'
|
16
16
|
export { TextField, DropDown, TextArea } from './textfield'
|
17
17
|
export { TokenField } from './tokenfield'
|
18
18
|
export { Tree, TreeNode, TreeItem } from './tree'
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import './label.css'
|
3
|
+
|
4
|
+
export const Label = (props) => {
|
5
|
+
|
6
|
+
export const FORMATS = {
|
7
|
+
NONE: '',
|
8
|
+
NUMERIC: 'numeric',
|
9
|
+
DATE: 'date',
|
10
|
+
TIME: 'time',
|
11
|
+
EMAIL: 'email',
|
12
|
+
HTML: 'HTML',
|
13
|
+
URL: 'URL'
|
14
|
+
}
|
15
|
+
|
16
|
+
const { text, format = FORMATS.NONE } = props
|
17
|
+
|
18
|
+
let value = text
|
19
|
+
const formatter = Intl.NumberFormat()
|
20
|
+
switch (format) {
|
21
|
+
case FORMATS.NUMERIC: value = formatter.format(text); break;
|
22
|
+
}
|
23
|
+
|
24
|
+
return (
|
25
|
+
<label className={`label ${style}`}>
|
26
|
+
{value}
|
27
|
+
</label>
|
28
|
+
)
|
29
|
+
}
|
File without changes
|
package/src/html/text.js
CHANGED
@@ -1,20 +1,36 @@
|
|
1
1
|
import React, { useContext } from "react"
|
2
2
|
import { SiteContext } from "../site/siteContext"
|
3
3
|
|
4
|
+
export const TEXTFORMATS = {
|
5
|
+
NONE: '',
|
6
|
+
NUMERIC: 'numeric',
|
7
|
+
DATE: 'date',
|
8
|
+
TIME: 'time',
|
9
|
+
EMAIL: 'email',
|
10
|
+
HTML: 'HTML',
|
11
|
+
URL: 'URL'
|
12
|
+
}
|
13
|
+
|
4
14
|
/**
|
5
15
|
* Text
|
6
16
|
*/
|
7
|
-
export const Text = ({ children }) => {
|
17
|
+
export const Text = ({ format, children }) => {
|
8
18
|
|
9
|
-
|
19
|
+
const site = useContext(SiteContext)
|
20
|
+
let value = children
|
10
21
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
22
|
+
if (site) {
|
23
|
+
const { lang, dictionary = {} } = site
|
24
|
+
const term = dictionary[children]
|
25
|
+
const text = term ? term[lang] : children
|
26
|
+
if (text) value=text
|
27
|
+
}
|
28
|
+
|
29
|
+
const formatter = Intl.NumberFormat()
|
30
|
+
switch (format) {
|
31
|
+
case TEXTFORMATS.NUMERIC: value = formatter.format(children); break;
|
32
|
+
}
|
17
33
|
|
18
|
-
|
34
|
+
return children ? <span>{value}</span> : ''
|
19
35
|
|
20
36
|
}
|
package/src/html/textfield.js
CHANGED