Skip to content

Commit af0a89c

Browse files
guynikanEdson Batista
andauthored
Refactor/form container and input types (#7)
* refactor: form-container→FormContainer, DatePicker→InputDate, add InputTextarea/InputNumber - form-container → FormContainer: core, factories, examples, docs, e2e - DatePicker → InputDate in schema-types and build-initial-values - Add InputTextarea and InputNumber to schema-types and build-initial-values * chore: remove dev:all script --------- Co-authored-by: Edson Batista <edson.batista@conduent.com>
1 parent a5de8f3 commit af0a89c

31 files changed

Lines changed: 140 additions & 222 deletions

File tree

docs/components/examples/VueInputComponents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ export const SubmitButton = defineComponent({
240240

241241
// Create component specs
242242
export const components = {
243-
'form-container': createComponentSpec({
244-
id: 'form-container',
245-
type: 'form-container',
243+
'FormContainer': createComponentSpec({
244+
id: 'FormContainer',
245+
type: 'FormContainer',
246246
factory: () => FormContainer,
247247
}),
248248
InputText: createComponentSpec({

docs/components/examples/VuetifyInputComponents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,9 @@ export const SubmitButton = defineComponent({
319319

320320
// Create component specs
321321
export const components = {
322-
'form-container': createComponentSpec({
323-
id: 'form-container',
324-
type: 'form-container',
322+
'FormContainer': createComponentSpec({
323+
id: 'FormContainer',
324+
type: 'FormContainer',
325325
factory: () => FormContainer,
326326
}),
327327
InputText: createComponentSpec({

docs/components/home/ExampleSection.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const example = computed(() => frontmatter.value.example || {});
2222
2323
const codeExample = `{
2424
"type": "object",
25-
"x-component": "form-container",
25+
"x-component": "FormContainer",
2626
"properties": {
2727
"email": {
2828
"type": "string",

docs/en-US/concepts/02-schema-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
```json
115115
{
116116
"type": "object",
117-
"x-component": "form-container",
117+
"x-component": "FormContainer",
118118
"properties": {
119119
"fieldKey1": { /* field schema */ },
120120
"fieldKey2": { /* field schema */ }

docs/en-US/guide/quick-start.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ schepta supports several component types:
7272
- **`field`** - Input fields (text, select, checkbox, etc.)
7373
- **`container`** - Container components (FormField, FormSection, etc.)
7474
- **`content`** - Content components (titles, buttons, etc.)
75-
- **`form-container`** - Root form container
75+
- **`FormContainer`** - Root form container
7676

7777
### Creating Component Specs
7878

@@ -163,9 +163,9 @@ const FormContainer = ({ children, ...props }: any) => {
163163

164164
// Register all components using createComponentSpec
165165
export const globalComponents = {
166-
'form-container': createComponentSpec({
167-
id: 'form-container',
168-
type: 'form-container',
166+
'FormContainer': createComponentSpec({
167+
id: 'FormContainer',
168+
type: 'FormContainer',
169169
factory: (props, runtime) => FormContainer,
170170
}),
171171
InputText: createComponentSpec({
@@ -207,7 +207,7 @@ Now let's create a complete example combining everything:
207207
"$schema": "../../packages/factories/src/schemas/form-schema.json",
208208
"$id": "my-first-form",
209209
"type": "object",
210-
"x-component": "form-container",
210+
"x-component": "FormContainer",
211211
"properties": {
212212
"personalInfo": {
213213
"type": "object",

docs/es-ES/concepts/02-schema-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
```json
115115
{
116116
"type": "object",
117-
"x-component": "form-container",
117+
"x-component": "FormContainer",
118118
"properties": {
119119
"fieldKey1": { /* field schema */ },
120120
"fieldKey2": { /* field schema */ }

docs/es-ES/guide/quick-start.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ schepta soporta varios tipos de componentes:
7272
- **`field`** - Campos de entrada (texto, select, checkbox, etc.)
7373
- **`container`** - Componentes contenedores (FormField, FormSection, etc.)
7474
- **`content`** - Componentes de contenido (títulos, botones, etc.)
75-
- **`form-container`** - Contenedor raíz del formulario
75+
- **`FormContainer`** - Contenedor raíz del formulario
7676

7777
### Creando Especificaciones de Componentes
7878

@@ -163,9 +163,9 @@ const FormContainer = ({ children, ...props }: any) => {
163163

164164
// Registrar todos los componentes usando createComponentSpec
165165
export const globalComponents = {
166-
'form-container': createComponentSpec({
167-
id: 'form-container',
168-
type: 'form-container',
166+
'FormContainer': createComponentSpec({
167+
id: 'FormContainer',
168+
type: 'FormContainer',
169169
factory: (props, runtime) => FormContainer,
170170
}),
171171
InputText: createComponentSpec({
@@ -207,7 +207,7 @@ Ahora vamos a crear un ejemplo completo combinando todo:
207207
"$schema": "../../packages/factories/src/schemas/form-schema.json",
208208
"$id": "my-first-form",
209209
"type": "object",
210-
"x-component": "form-container",
210+
"x-component": "FormContainer",
211211
"properties": {
212212
"personalInfo": {
213213
"type": "object",

docs/pt-BR/concepts/02-schema-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
```json
115115
{
116116
"type": "object",
117-
"x-component": "form-container",
117+
"x-component": "FormContainer",
118118
"properties": {
119119
"fieldKey1": { /* field schema */ },
120120
"fieldKey2": { /* field schema */ }

docs/pt-BR/guide/quick-start.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ O schepta suporta vários tipos de componentes:
7272
- **`field`** - Campos de entrada (texto, select, checkbox, etc.)
7373
- **`container`** - Componentes container (FormField, FormSection, etc.)
7474
- **`content`** - Componentes de conteúdo (títulos, botões, etc.)
75-
- **`form-container`** - Container raiz do formulário
75+
- **`FormContainer`** - Container raiz do formulário
7676

7777
### Criando Component Specs
7878

@@ -163,9 +163,9 @@ const FormContainer = ({ children, ...props }: any) => {
163163

164164
// Registrar todos os componentes usando createComponentSpec
165165
export const globalComponents = {
166-
'form-container': createComponentSpec({
167-
id: 'form-container',
168-
type: 'form-container',
166+
'FormContainer': createComponentSpec({
167+
id: 'FormContainer',
168+
type: 'FormContainer',
169169
factory: (props, runtime) => FormContainer,
170170
}),
171171
InputText: createComponentSpec({
@@ -207,7 +207,7 @@ Agora vamos criar um exemplo completo combinando tudo:
207207
"$schema": "../../packages/factories/src/schemas/form-schema.json",
208208
"$id": "meu-primeiro-formulario",
209209
"type": "object",
210-
"x-component": "form-container",
210+
"x-component": "FormContainer",
211211
"properties": {
212212
"personalInfo": {
213213
"type": "object",
Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
import React, { useState } from 'react';
2-
import { FormFactory } from '@schepta/factory-react';
3-
import { globalComponents } from './components/ProviderComponents';
4-
import { SubmittedValuesDisplay } from './components/SubmittedValuesDisplay';
5-
import templateFormSchemaJson from '../../../instances/form/template-form.json';
6-
import type { FormSchema } from '@schepta/core';
1+
// import React, { useState } from 'react';
2+
// import { FormFactory } from '@schepta/factory-react';
3+
// import { globalComponents } from './components/ProviderComponents';
4+
// import { SubmittedValuesDisplay } from './components/SubmittedValuesDisplay';
5+
// // import templateFormSchemaJson from '../../../instances/form/template-form.json';
6+
// import type { FormSchema } from '@schepta/core';
77

8-
const templateFormSchema = templateFormSchemaJson as FormSchema;
8+
// const templateFormSchema = templateFormSchemaJson as FormSchema;
99

10-
export function ExpressionExample() {
11-
const [submittedValues, setSubmittedValues] = useState<any>(null);
12-
const [providerInfo, setProviderInfo] = useState<string>('');
10+
// export function ExpressionExample() {
11+
// const [submittedValues, setSubmittedValues] = useState<any>(null);
12+
// const [providerInfo, setProviderInfo] = useState<string>('');
1313

14-
const handleSubmit = (values: any) => {
15-
console.log('Form submitted:', values);
16-
setSubmittedValues(values);
17-
setProviderInfo(`Form submitted. User ID from externalContext: 1`);
18-
};
14+
// const handleSubmit = (values: any) => {
15+
// console.log('Form submitted:', values);
16+
// setSubmittedValues(values);
17+
// setProviderInfo(`Form submitted. User ID from externalContext: 1`);
18+
// };
1919

20-
return (
21-
<div style={{ padding: '24px', maxWidth: '800px', margin: '0 auto' }}>
22-
<h1>schepta Template Expressions Example</h1>
20+
// return (
21+
// <div style={{ padding: '24px', maxWidth: '800px', margin: '0 auto' }}>
22+
// <h1>schepta Template Expressions Example</h1>
2323

24-
<div style={{
25-
marginBottom: '24px',
26-
padding: '20px',
27-
backgroundColor: '#fff3cd',
28-
border: '1px solid #ffc107',
29-
borderRadius: '8px'
30-
}}>
31-
<h3 style={{ marginTop: 0 }}>Template Expressions Features:</h3>
32-
<ul>
33-
<li>✅ Use {'{{ $externalContext.* }}'} in schema values</li>
34-
<li>✅ Use {'{{ $formState.* }}'} for dynamic form values</li>
35-
<li>✅ Automatic processing of all template expressions</li>
36-
<li>✅ Recursive processing in nested objects</li>
37-
</ul>
38-
</div>
24+
// <div style={{
25+
// marginBottom: '24px',
26+
// padding: '20px',
27+
// backgroundColor: '#fff3cd',
28+
// border: '1px solid #ffc107',
29+
// borderRadius: '8px'
30+
// }}>
31+
// <h3 style={{ marginTop: 0 }}>Template Expressions Features:</h3>
32+
// <ul>
33+
// <li>✅ Use {'{{ $externalContext.* }}'} in schema values</li>
34+
// <li>✅ Use {'{{ $formState.* }}'} for dynamic form values</li>
35+
// <li>✅ Automatic processing of all template expressions</li>
36+
// <li>✅ Recursive processing in nested objects</li>
37+
// </ul>
38+
// </div>
3939

40-
<div style={{ border: '1px solid #ddd', padding: '24px', borderRadius: '8px' }}>
41-
<h3 style={{ marginTop: 0 }}>Template Form (with {'{{ $externalContext.* }}'} and {'{{ $formState.* }}'})</h3>
42-
<p style={{ fontSize: '13px', color: '#666', marginBottom: '16px' }}>
43-
This example demonstrates two key template expression features you can observe:
44-
<br />
45-
<strong>1. $externalContext expressions:</strong> The First Name label uses {'{{ $externalContext.user.name }}'} which resolves to <strong>"Test User"</strong> from the factory's externalContext prop.
46-
<br />
47-
<strong>2. $formState expressions:</strong> The Email field's placeholder uses {'{{ $formState.personalInfo.firstName }}'} which dynamically updates to show the current value of the First Name field as you type.
48-
</p>
49-
<FormFactory
50-
schema={templateFormSchema}
51-
components={globalComponents}
52-
externalContext={{
53-
user: { id: 1, name: 'Test User' },
54-
api: 'https://api.example.com',
55-
fieldName: 'last name',
56-
}}
57-
onSubmit={handleSubmit}
58-
debug={true}
59-
/>
60-
</div>
40+
// <div style={{ border: '1px solid #ddd', padding: '24px', borderRadius: '8px' }}>
41+
// <h3 style={{ marginTop: 0 }}>Template Form (with {'{{ $externalContext.* }}'} and {'{{ $formState.* }}'})</h3>
42+
// <p style={{ fontSize: '13px', color: '#666', marginBottom: '16px' }}>
43+
// This example demonstrates two key template expression features you can observe:
44+
// <br />
45+
// <strong>1. $externalContext expressions:</strong> The First Name label uses {'{{ $externalContext.user.name }}'} which resolves to <strong>"Test User"</strong> from the factory's externalContext prop.
46+
// <br />
47+
// <strong>2. $formState expressions:</strong> The Email field's placeholder uses {'{{ $formState.personalInfo.firstName }}'} which dynamically updates to show the current value of the First Name field as you type.
48+
// </p>
49+
// <FormFactory
50+
// schema={templateFormSchema}
51+
// components={globalComponents}
52+
// externalContext={{
53+
// user: { id: 1, name: 'Test User' },
54+
// api: 'https://api.example.com',
55+
// fieldName: 'last name',
56+
// }}
57+
// onSubmit={handleSubmit}
58+
// debug={true}
59+
// />
60+
// </div>
6161

62-
<SubmittedValuesDisplay
63-
submittedValues={submittedValues}
64-
providerInfo={providerInfo}
65-
/>
66-
</div>
67-
);
68-
}
62+
// <SubmittedValuesDisplay
63+
// submittedValues={submittedValues}
64+
// providerInfo={providerInfo}
65+
// />
66+
// </div>
67+
// );
68+
// }
6969

0 commit comments

Comments
 (0)