@vacso/frameworkfrontend
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@vacso/frameworkfrontend", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Welcome to the Vacso Framework, an open-source project designed to streamline the development of enterprise React web applications. Brought to you by Vacso, this framework is a comprehensive solution for both front-end and back-end development, allowing you to focus on crafting your unique data model and business rules.", | ||
@@ -18,5 +18,5 @@ "main": "index.js", | ||
"primeicons": "^7.0.0", | ||
"primereact": "^10.6.3", | ||
"react": "^18.3.0", | ||
"react-dom": "^18.3.0", | ||
"primereact": "^10.6.5", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"react-router": "^6.23.0", | ||
@@ -23,0 +23,0 @@ "react-router-dom": "^6.23.0", |
@@ -20,2 +20,3 @@ import { useEffect, useState } from 'react'; | ||
recordFormData, | ||
columns, | ||
...props | ||
@@ -45,2 +46,11 @@ }) { | ||
const onSubmit = async (formData) => { | ||
for (const column in columns) { | ||
if (columns[column].columnType == 'datetime') { | ||
// Convert the date to a timestamp | ||
if (recordFormData[column]) { | ||
recordFormData[column] = new Date(recordFormData[column]).getTime(); | ||
} | ||
} | ||
} | ||
if (button.method) { | ||
@@ -47,0 +57,0 @@ const response = await api.fetch( |
@@ -14,2 +14,3 @@ import { useState } from 'react'; | ||
formData, | ||
columns, | ||
}) { | ||
@@ -42,2 +43,3 @@ const [showModal, setShowModal] = useState(false); | ||
recordFormData={formData} | ||
columns={columns} | ||
/> | ||
@@ -44,0 +46,0 @@ |
@@ -34,3 +34,2 @@ import React, { useState, useEffect } from 'react'; | ||
const [loading, setLoading] = useState(true); | ||
const [loadCount, setLoadCount] = useState(0); // Used to force a reload of the record data | ||
const [error, setError] = useState(null); | ||
@@ -176,34 +175,4 @@ const [dropdownOptions, setDropdownOptions] = useState({}); | ||
const handleDelete = async () => { | ||
//if (event) | ||
//event.preventDefault(); | ||
setError(null); | ||
try { | ||
const response = await api.fetch( | ||
`/api/db/${db}/${table}/recordDelete/${recordId}` | ||
); | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
if (onClose) { | ||
onClose(); | ||
} | ||
navigate(-1); | ||
} catch (err) { | ||
console.error(err); | ||
setError(err.message); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
// Create or update the record | ||
// Create a record | ||
const handleSubmit = async (params) => { | ||
//event.preventDefault(); | ||
setError(null); | ||
@@ -220,8 +189,3 @@ | ||
try { | ||
let action = 'recordCreate'; | ||
if (!newRecord) { | ||
action = `recordUpdate/${recordId}`; | ||
} | ||
const response = await api.fetch(`/api/db/${db}/${table}/${action}`, { | ||
const response = await api.fetch(`/api/db/${db}/${table}/recordCreate`, { | ||
data: postData, | ||
@@ -231,3 +195,3 @@ }); | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok', response); | ||
throw new Error('Server response was not ok', response); | ||
} | ||
@@ -239,13 +203,8 @@ | ||
if (action === 'recordCreate' && !closeOnCreate) { | ||
if (!closeOnCreate) { | ||
navigate(`/${db}/${table}/${response.data.id}`); | ||
} else if (action === 'recordCreate' && !closeOnCreate) { | ||
} else { | ||
if (onClose) { | ||
onClose(); | ||
} | ||
} else if (params.close) { | ||
navigate(-1); | ||
//navigate(`/${db}/${table}`); | ||
} else { | ||
forceReload(); | ||
} | ||
@@ -292,3 +251,6 @@ } catch (err) { | ||
}} | ||
options={settings.options} | ||
options={settings.options.map((item) => ({ | ||
label: item, | ||
value: item, | ||
}))} | ||
className="w-full md:w-14rem" | ||
@@ -312,7 +274,2 @@ size={settings.fieldWidth} | ||
); | ||
/*case 'html': | ||
return ( | ||
<Interweave content={formData[columnId]} /> | ||
); | ||
*/ | ||
default: | ||
@@ -333,3 +290,3 @@ // 'text' or other types | ||
}; | ||
//onSubmit={handleSubmit}> | ||
return ( | ||
@@ -410,3 +367,2 @@ <> | ||
} | ||
navigate(-1); | ||
}} | ||
@@ -428,2 +384,3 @@ /> | ||
formData={formData} | ||
columns={columns} | ||
/> | ||
@@ -430,0 +387,0 @@ ); |
66175
1947
+ Added@babel/runtime@7.26.9(transitive)
- Removed@babel/runtime@7.26.7(transitive)
Updatedprimereact@^10.6.5
Updatedreact@^18.3.1
Updatedreact-dom@^18.3.1