Skip to content

Commit 297a9b6

Browse files
Merge pull request #24 from AmshenShanu07/develop
Develop
2 parents 6636fc0 + 317f465 commit 297a9b6

28 files changed

+778
-2035
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
node-version: [18.x]
16+
node-version: [18.16.x]
1717

1818
steps:
1919
- uses: actions/checkout@v3

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:18
2+
WORKDIR /usr/src/app
3+
4+
EXPOSE 3000
5+
EXPOSE 3001
6+
EXPOSE 3002
7+
8+
COPY package*.json ./
9+
10+
RUN npm i -g [email protected]
11+
RUN npm install --legacy-peer-deps
12+
13+
COPY . .
14+
15+
RUN npm run clean
16+
RUN npm run bootstrap
17+
18+
CMD [ "npm", "run", "start:dev" ]

package-lock.json

Lines changed: 213 additions & 179 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
"scripts": {
1111
"bootstrap": "lerna bootstrap",
1212
"start:dev": "lerna run --parallel dev ",
13-
"start:package":"lerna run dev --scope=form-sculpt",
14-
"start:docs":"lerna run dev --scope=docs",
15-
"start:playground":"lerna run dev --scope=playground",
13+
"start:package": "lerna run dev --scope=form-sculpt",
14+
"start:docs": "lerna run dev --scope=docs",
15+
"start:playground": "lerna run dev --scope=playground",
1616
"lint": "lerna run lint",
17-
"cs-check":"lerna run cs-check",
18-
"cs-format":"lerna run cs-format",
17+
"cs-check": "lerna run cs-check",
18+
"cs-format": "lerna run cs-format",
1919
"build": "lerna run build --stream",
2020
"build:web": "lerna exec --parallel --scope '{playground,docs}' -- npm run build",
2121
"publish": "lerna run release --stream",
22-
"publish:package":"lerna run release --scope=form-sculpt --stream",
23-
"publish:docs":"lerna run release --scope=docs --stream",
24-
"publish:playground":"lerna run release --scope=playground --stream",
22+
"publish:package": "lerna run release --scope=form-sculpt --stream",
23+
"publish:docs": "lerna run release --scope=docs --stream",
24+
"publish:playground": "lerna run release --scope=playground --stream",
2525
"clean": "lerna clean --yes"
2626
},
2727
"workspaces": [
@@ -37,5 +37,6 @@
3737
"lerna": "^6.6.2",
3838
"prettier": "^2.8.8",
3939
"tslint-config-prettier": "^1.18.0"
40-
}
40+
},
41+
"version": "0.0.0"
4142
}

packages/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private":true,
55
"scripts": {
66
"docusaurus": "docusaurus",
7-
"dev": "docusaurus start",
7+
"dev": "docusaurus start --port 3002",
88
"build": "docusaurus build",
99
"swizzle": "docusaurus swizzle",
1010
"release": "npm run build",

packages/form-sculpt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "form-sculpt",
3-
"version": "0.3.13",
3+
"version": "0.3.20",
44
"description": "This package help to generate mui forms with yup validation from json data",
55
"homepage": "https://github.com/AmshenShanu07/form-sculpt",
66
"license": "Apache-2.0",

packages/form-sculpt/src/App.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
2+
23
import Form from './Components/Form';
3-
import { medAuth } from './sampleData';
4+
import { chartMar } from './sampleData';
45
import { ButtonTemplateProps } from './Context/PropContext/type';
56

6-
77
const ButtonTemplate: React.FC<ButtonTemplateProps> = ({ errors, values }) => {
8+
89
return (
910
<React.Fragment>
1011
<button type='submit'>Submit</button>
@@ -14,10 +15,8 @@ const ButtonTemplate: React.FC<ButtonTemplateProps> = ({ errors, values }) => {
1415
);
1516
};
1617

17-
18-
1918
const App = () => {
20-
// const [val, setVal] = useState<string>("Paracitamol");
19+
const [val, setVal] = useState<string>("12");
2120
const uploadFile = async (file: File) => {
2221
const url = await URL.createObjectURL(file);
2322
return url;
@@ -26,19 +25,17 @@ const App = () => {
2625
return (
2726
<div>
2827
<Form
29-
schema={medAuth}
28+
schema={chartMar}
3029
onSubmit={(d) => console.log(d)}
3130
onFileUpload={uploadFile}
3231
defaultValue={{
33-
TimesPerDay:'2',
34-
RXNumber:"Paracitamol",
35-
TimesPerDayIfValueOfTimeofMedicine1Is2:new Date(),
36-
TimesPerDayIfValueOfTimeofMedicine2Is2: new Date(),
32+
Dose: 0
3733
}}
3834
templates={{
39-
ButtonTemplates: ButtonTemplate,
35+
ButtonTemplates: ButtonTemplate
4036
}}
41-
/>
37+
/>
38+
<input type="text" value={val} onChange={(e) => setVal(e.target.value)} />
4239
</div>
4340
);
4441
};

packages/form-sculpt/src/Components/Fields/checkboxes.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const FormCheckboxes = (props: InputFieldProps) => {
2424
{data.options &&
2525
data.options.map((d: string, i: number) => {
2626
return (
27-
<Box key={i} sx={{ display:'flex', flexWrap:'wrap' }} >
27+
<Box key={i} sx={{ display: 'flex', flexWrap: 'wrap' }}>
2828
<Controller
2929
name={d}
3030
control={control}
@@ -51,10 +51,11 @@ const FormCheckboxes = (props: InputFieldProps) => {
5151
onClick={(e: any) => onChange(e, data, field.onChange)}
5252
checked={(values[data.key] && values[data.key].includes(d)) || false}
5353
control={
54-
<Checkbox
55-
sx={inputFieldStyle?.checkboxes?.fieldStyle || {}}
56-
disabled={Boolean(data.disable)}
57-
/>}
54+
<Checkbox
55+
sx={inputFieldStyle?.checkboxes?.fieldStyle || {}}
56+
disabled={Boolean(data.disable)}
57+
/>
58+
}
5859
/>
5960
</>
6061
);

packages/form-sculpt/src/Components/Fields/customComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useValueHolder } from '../../Context/DataHolderContext/hook';
88
const FormCustomElement = (props: InputFieldProps) => {
99
const { control, data, error, onChange } = props;
1010
const { values } = useValueHolder();
11-
const { customFields } = useProps();
11+
const { customFields, schema } = useProps();
1212

1313
return (
1414
<Grid item xs={data.fieldWidth * 12}>
@@ -26,7 +26,7 @@ const FormCustomElement = (props: InputFieldProps) => {
2626
value={field.value}
2727
error={error[data.key] || {}}
2828
onChange={(e: any) => onChange(e, data, field.onChange)}
29-
context={{ values, errors: error }}
29+
context={{ values, schema, errors: error }}
3030
/>
3131
);
3232
}

packages/form-sculpt/src/Components/Fields/date.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { Grid, InputLabel } from '@mui/material';
22
import { Controller } from 'react-hook-form';
33

44
import { InputFieldProps } from './type';
5-
// import moment from "moment";
6-
import { useProps } from '../../Context/PropContext/hook';
75
import { DatePicker } from '@mui/x-date-pickers';
6+
import { useProps } from '../../Context/PropContext/hook';
87
import { useValueHolder } from '../../Context/DataHolderContext/hook';
8+
import dayjs from 'dayjs';
99

1010
const FormDate = (props: InputFieldProps) => {
1111
const { control, data, error, onChange } = props;
@@ -39,16 +39,16 @@ const FormDate = (props: InputFieldProps) => {
3939
{data.isRequired && <span style={{ color: 'red' }}>*</span>}
4040
</InputLabel>
4141
<DatePicker
42-
value={new Date(values[data.key])}
42+
value={values[data.key]?dayjs(values[data.key]):null}
4343
disabled={Boolean(data.disable)}
4444
sx={inputFieldStyle?.textField?.fieldStyle || {}}
4545
onChange={(e: any) => onChange(e, data, field.onChange)}
4646
slotProps={{
4747
textField: {
4848
fullWidth: true,
4949
size: inputFieldSize,
50-
FormHelperTextProps:{
51-
sx:inputFieldStyle?.date?.errorStyle || {}
50+
FormHelperTextProps: {
51+
sx: inputFieldStyle?.date?.errorStyle || {},
5252
},
5353
error: error[data.key] || '' ? true : false,
5454
helperText:

0 commit comments

Comments
 (0)