@ouroboros/mouth-mui 1.0.2 → 1.1.0
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 +6 -5
- package/src/components/pages/Templates/Create.js +3 -3
- package/src/components/pages/Templates/Create.tsx +3 -3
- package/src/components/pages/Templates/Template/Content/Update/index.js +1 -1
- package/src/components/pages/Templates/Template/Content/Update/index.tsx +1 -1
- package/src/components/pages/Templates/Template/Variables.js +1 -1
- package/src/components/pages/Templates/Template/Variables.tsx +1 -1
- package/src/components/pages/Templates/index.js +1 -1
- package/src/components/pages/Templates/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouroboros/mouth-mui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Components for use with the Mouth service",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"url": "https://github.com/ouroboroscoding/mouth-mui/issues"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@ouroboros/body": "^1.0.2",
|
|
29
30
|
"@types/node": "^18.14.0",
|
|
30
31
|
"@types/react": "^18.0.28",
|
|
31
32
|
"@types/uuid": "^9.0.0",
|
|
@@ -46,10 +47,10 @@
|
|
|
46
47
|
"@emotion/react": "^11.8.2",
|
|
47
48
|
"@emotion/styled": "^11.8.1",
|
|
48
49
|
"@mui/material": "^5.5.1",
|
|
49
|
-
"@ouroboros/body": "^1.0.
|
|
50
|
-
"@ouroboros/brain-mui": "^1.
|
|
51
|
-
"@ouroboros/mouth": "^1.
|
|
50
|
+
"@ouroboros/body": "^1.0.2",
|
|
51
|
+
"@ouroboros/brain-mui": "^1.1.0",
|
|
52
|
+
"@ouroboros/mouth": "^1.1.0",
|
|
52
53
|
"react": "^17.0.2",
|
|
53
54
|
"react-dom": "^17.0.2"
|
|
54
55
|
}
|
|
55
|
-
}
|
|
56
|
+
}
|
|
@@ -45,7 +45,7 @@ export default function Create(props) {
|
|
|
45
45
|
// Called when record changes
|
|
46
46
|
function change(field, value) {
|
|
47
47
|
// Set the new record
|
|
48
|
-
recordSet(o => {
|
|
48
|
+
recordSet((o) => {
|
|
49
49
|
const oRecord = clone(o);
|
|
50
50
|
oRecord[field] = value;
|
|
51
51
|
return oRecord;
|
|
@@ -54,12 +54,12 @@ export default function Create(props) {
|
|
|
54
54
|
// Called to create the template
|
|
55
55
|
function create() {
|
|
56
56
|
// Create the data in the system
|
|
57
|
-
mouth.create('template', record).then(data => {
|
|
57
|
+
mouth.create('template', record).then((data) => {
|
|
58
58
|
// Add the ID to the record
|
|
59
59
|
record._id = data;
|
|
60
60
|
// Let the parent know
|
|
61
61
|
props.onCreated(clone(record));
|
|
62
|
-
}, error => {
|
|
62
|
+
}, (error) => {
|
|
63
63
|
if (error.code === errors.body.DB_DUPLICATE) {
|
|
64
64
|
refName.current?.error('Duplicate');
|
|
65
65
|
}
|
|
@@ -64,7 +64,7 @@ export default function Create(props: CreateProps) {
|
|
|
64
64
|
function change(field: string, value: any) {
|
|
65
65
|
|
|
66
66
|
// Set the new record
|
|
67
|
-
recordSet(o => {
|
|
67
|
+
recordSet((o: templateStruct) => {
|
|
68
68
|
const oRecord = clone(o);
|
|
69
69
|
oRecord[field] = value;
|
|
70
70
|
return oRecord;
|
|
@@ -75,14 +75,14 @@ export default function Create(props: CreateProps) {
|
|
|
75
75
|
function create() {
|
|
76
76
|
|
|
77
77
|
// Create the data in the system
|
|
78
|
-
mouth.create('template', record).then(data => {
|
|
78
|
+
mouth.create('template', record).then((data: string) => {
|
|
79
79
|
|
|
80
80
|
// Add the ID to the record
|
|
81
81
|
record._id = data;
|
|
82
82
|
|
|
83
83
|
// Let the parent know
|
|
84
84
|
props.onCreated(clone(record));
|
|
85
|
-
}, error => {
|
|
85
|
+
}, (error: responseErrorStruct) => {
|
|
86
86
|
if(error.code === errors.body.DB_DUPLICATE) {
|
|
87
87
|
refName.current?.error('Duplicate');
|
|
88
88
|
} else {
|
|
@@ -39,7 +39,7 @@ export default function Update(props) {
|
|
|
39
39
|
// Called to create the new content record
|
|
40
40
|
function update() {
|
|
41
41
|
// Send the record data to the server
|
|
42
|
-
mouth.update(`template/${props.value.type}`, record).then(
|
|
42
|
+
mouth.update(`template/${props.value.type}`, record).then(() => {
|
|
43
43
|
props.onUpdated({ type: props.value.type, ...record });
|
|
44
44
|
}, (error) => {
|
|
45
45
|
if (error.code === errors.body.DATA_FIELDS) {
|
|
@@ -58,7 +58,7 @@ export default function Update(props: UpdateProps) {
|
|
|
58
58
|
function update() {
|
|
59
59
|
|
|
60
60
|
// Send the record data to the server
|
|
61
|
-
mouth.update(`template/${props.value.type}`, record).then(
|
|
61
|
+
mouth.update(`template/${props.value.type}`, record).then(() => {
|
|
62
62
|
props.onUpdated({type: props.value.type, ...record});
|
|
63
63
|
}, (error: responseErrorStruct) => {
|
|
64
64
|
if(error.code === errors.body.DATA_FIELDS) {
|
|
@@ -68,7 +68,7 @@ export default function Variables(props) {
|
|
|
68
68
|
// Render
|
|
69
69
|
return (React.createElement(Box, null,
|
|
70
70
|
React.createElement(Grid, { container: true, spacing: 1 },
|
|
71
|
-
omap(props.value, (v, k) => React.createElement(React.Fragment,
|
|
71
|
+
omap(props.value, (v, k) => React.createElement(React.Fragment, { key: k },
|
|
72
72
|
React.createElement(Grid, { item: true, xs: 5 }, k),
|
|
73
73
|
React.createElement(Grid, { item: true, xs: 5 }, v),
|
|
74
74
|
React.createElement(Grid, { item: true, xs: 2 },
|
|
@@ -93,7 +93,7 @@ export default function Variables(props: VariablesProps) {
|
|
|
93
93
|
<Box>
|
|
94
94
|
<Grid container spacing={1}>
|
|
95
95
|
{omap(props.value, (v,k) =>
|
|
96
|
-
<React.Fragment>
|
|
96
|
+
<React.Fragment key={k}>
|
|
97
97
|
<Grid item xs={5}>{k}</Grid>
|
|
98
98
|
<Grid item xs={5}>{v}</Grid>
|
|
99
99
|
<Grid item xs={2}>
|
|
@@ -43,7 +43,7 @@ export default function Templates(props) {
|
|
|
43
43
|
useEffect(() => {
|
|
44
44
|
// If we have template read permissions
|
|
45
45
|
if (rightsTemplate.read) {
|
|
46
|
-
mouth.read('
|
|
46
|
+
mouth.read('locales').then((data) => {
|
|
47
47
|
const oLocales = {};
|
|
48
48
|
for (const o of data) {
|
|
49
49
|
oLocales[o._id] = o.name;
|
|
@@ -60,7 +60,7 @@ export default function Templates(props: TemplatesProps) {
|
|
|
60
60
|
|
|
61
61
|
// If we have template read permissions
|
|
62
62
|
if(rightsTemplate.read) {
|
|
63
|
-
mouth.read('
|
|
63
|
+
mouth.read('locales').then((data: Record<string, any>[]) => {
|
|
64
64
|
const oLocales: Record<string, string> = {};
|
|
65
65
|
for(const o of data) {
|
|
66
66
|
oLocales[o._id] = o.name;
|