Skip to content

Commit 7fc7c5e

Browse files
committed
fix children structure
1 parent 59998d1 commit 7fc7c5e

34 files changed

Lines changed: 237 additions & 204 deletions

Signum.React.Extensions/Alerts/Templates/Alert.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ export default function Alert(p: { ctx: TypeContext<AlertEntity> }) {
4141
<ValueLine ctx={ctx.subCtx(n => n.titleField)} label={AlertMessage.Title.niceToString()} valueHtmlAttributes={{ placeholder: (ctx.value.alertType && AlertsClient.getTitle(null, ctx.value.alertType)) ?? undefined }} />
4242
{
4343
!ctx.value.isNew && !edit ?
44-
<FormGroup ctx={ctx.subCtx(n => n.titleField)} label={AlertMessage.Text.niceToString()}
45-
children={() => <div style={{ whiteSpace: "pre-wrap" }}>
44+
<FormGroup ctx={ctx.subCtx(n => n.titleField)} label={AlertMessage.Text.niceToString()} >
45+
{() => <div style={{ whiteSpace: "pre-wrap" }}>
4646
{AlertsClient.format(ctx.value.textField || ctx.value.textFromAlertType || "", ctx.value)}
4747
<br />
4848
<a href="#" className="text-muted" onClick={e => { e.preventDefault(); setEdit(true) }}>Edit</a>
4949
</div>}
50-
/>
50+
</FormGroup>
51+
5152
:
5253
<ValueLine ctx={ctx.subCtx(n => n.textField)} label={AlertMessage.Text.niceToString()} valueHtmlAttributes={{ style: { height: "180px" } }} />
5354
}

Signum.React.Extensions/Authorization/Templates/DoublePassword.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ export function DoublePassword(p: { ctx: TypeContext<string>, initialOpen: boole
3232

3333
if (!isOpen) {
3434
return (
35-
<FormGroup label={LoginAuthMessage.NewPassword.niceToString()} ctx={p.ctx}
36-
children={() => <a className="btn btn-light btn-sm" onClick={() => setIsOpen(true)}>
37-
<FontAwesomeIcon icon="key" /> {LoginAuthMessage.ChangePassword.niceToString()}
38-
</a>}
39-
/>
35+
<FormGroup label={LoginAuthMessage.NewPassword.niceToString()} ctx={p.ctx}>
36+
{() => <a className="btn btn-light btn-sm" onClick={() => setIsOpen(true)}>
37+
<FontAwesomeIcon icon="key" /> {LoginAuthMessage.ChangePassword.niceToString()}
38+
</a>}
39+
</FormGroup>
4040
);
4141
}
4242

4343
return (
4444
<div>
45-
<FormGroup ctx={p.ctx} label={LoginAuthMessage.NewPassword.niceToString()}
46-
children={inputId => <input id={inputId} type="password" ref={newPass} autoComplete="off" placeholder={LoginAuthMessage.NewPassword.niceToString()} className={classes(p.ctx.formControlClass, p.mandatory && !newPass.current?.value ? "sf-mandatory" : null)} onBlur={handlePasswordBlur} />}
47-
/>
48-
<FormGroup ctx={p.ctx} label={LoginAuthMessage.ConfirmNewPassword.niceToString()}
49-
children={inputId => <input id={inputId} type="password" ref={newPass2} autoComplete="off" placeholder={LoginAuthMessage.ConfirmNewPassword.niceToString()} className={classes(p.ctx.formControlClass, p.mandatory && !newPass2.current?.value ? "sf-mandatory" : null)} onBlur={handlePasswordBlur} />}
50-
/>
45+
<FormGroup ctx={p.ctx} label={LoginAuthMessage.NewPassword.niceToString()}>
46+
{inputId => <input id={inputId} type="password" ref={newPass} autoComplete="off" placeholder={LoginAuthMessage.NewPassword.niceToString()} className={classes(p.ctx.formControlClass, p.mandatory && !newPass.current?.value ? "sf-mandatory" : null)} onBlur={handlePasswordBlur} />}
47+
</FormGroup>
48+
<FormGroup ctx={p.ctx} label={LoginAuthMessage.ConfirmNewPassword.niceToString()}>
49+
{inputId => <input id={inputId} type="password" ref={newPass2} autoComplete="off" placeholder={LoginAuthMessage.ConfirmNewPassword.niceToString()} className={classes(p.ctx.formControlClass, p.mandatory && !newPass2.current?.value ? "sf-mandatory" : null)} onBlur={handlePasswordBlur} />}
50+
</FormGroup>
5151
</div>
5252
);
5353
}

Signum.React.Extensions/Basics/Templates/IconTypeahead.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ export function IconTypeaheadLine(p : IconTypeaheadLineProps){
2929
var ctx = p.ctx;
3030

3131
return (
32-
<FormGroup ctx={ctx} label={ctx.niceName()}
33-
children={inputId => <IconTypeahead icon={ctx.value}
32+
<FormGroup ctx={ctx} label={ctx.niceName()}>
33+
{inputId => <IconTypeahead icon={ctx.value}
3434
placeholder={p.ctx.placeholderLabels ? p.ctx.niceName() : undefined}
3535
extraIcons={p.extraIcons}
3636
formControlClass={ctx.formControlClass}
3737
inputAttrs={p.inputAttrs}
3838
onChange={handleChange} />}
39-
/>
39+
</FormGroup>
4040
);
4141
}
4242

Signum.React.Extensions/Chart/Templates/ChartColumn.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,8 @@ export function ChartPaletteLink(p: ChartPaletteLinkProps) {
197197
const [palette, reload] = useAPIWithReload(() => ColorPaletteClient.getColorPalette(p.type.name), [p.type.name]);
198198

199199
return (
200-
<FormGroup ctx={p.ctx}
201-
label={ChartMessage.ColorsFor0.niceToString(p.type.niceName)}
202-
children={() => palette === undefined ?
200+
<FormGroup ctx={p.ctx} label={ChartMessage.ColorsFor0.niceToString(p.type.niceName)}>
201+
{() => palette === undefined ?
203202
<span className={p.ctx.formControlPlainTextClass}>
204203
{JavascriptMessage.loading.niceToString()}
205204
</span> :
@@ -219,7 +218,7 @@ export function ChartPaletteLink(p: ChartPaletteLinkProps) {
219218
{palette ? ChartMessage.ViewPalette.niceToString() : ChartMessage.CreatePalette.niceToString()}
220219
</a>
221220
}
222-
/>
221+
</FormGroup>
223222
);
224223
}
225224

Signum.React.Extensions/Chart/UserChart/UserChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ export default function UserChart(p : { ctx: TypeContext<UserChartEntity> }){
4141
<div>
4242
<EntityLine ctx={ctx.subCtx(e => e.owner)} />
4343
<ValueLine ctx={ctx.subCtx(e => e.displayName)} />
44-
<FormGroup ctx={ctx.subCtx(e => e.query)}
45-
children={() =>
44+
<FormGroup ctx={ctx.subCtx(e => e.query)}>
45+
{() =>
4646
Finder.isFindable(queryKey, true) ?
4747
<a className="form-control-static" href={Finder.findOptionsPath({ queryName: queryKey })}>{getQueryNiceName(queryKey)}</a> :
4848
<span>{getQueryNiceName(queryKey)}</span>
4949
}
50-
/>
50+
</FormGroup>
5151
<EntityLine ctx={ctx.subCtx(e => e.entityType)} onChange={() => forceUpdate()}
5252
helpText={
5353
<div>

Signum.React.Extensions/Dashboard/View/ValueUserQueryListPart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export function ValueUserQueryElement(p: ValueUserQueryElementProps) {
5454

5555
return (
5656
<div>
57-
<FormGroup ctx={ctx} label={ctx.value.label ?? getQueryNiceName(fo.queryName)}
58-
children={() =>
57+
<FormGroup ctx={ctx} label={ctx.value.label ?? getQueryNiceName(fo.queryName)}>
58+
{() =>
5959
<div className="row align-items-center">
6060
<div className="col-auto">
6161
<span>{ctx.value.label ?? getQueryNiceName(fo!.queryName)}</span>
@@ -65,7 +65,7 @@ export function ValueUserQueryElement(p: ValueUserQueryElementProps) {
6565
customRequest={p.cachedQuery && ((qr, fo, token) => p.cachedQuery!.then(cq => executeQueryValueCached(qr, fo, token, cq)))} />
6666
</div>
6767
</div>}
68-
/>
68+
</FormGroup>
6969
</div>
7070
);
7171
}

Signum.React.Extensions/Dynamic/DynamicPanelSimplePage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ export function CheckEvalType(p: CheckEvalTypeProps) {
144144
}
145145

146146
return (
147-
<FormGroup ctx={p.ctx} label={getQueryNiceName(p.findOptions.queryName)}
148-
children={() => <>
147+
<FormGroup ctx={p.ctx} label={getQueryNiceName(p.findOptions.queryName)}>
148+
{() => <>
149149
<SearchValue findOptions={p.findOptions} isLink={true} />
150150
{
151151
state == "loading" ?
@@ -174,7 +174,7 @@ export function CheckEvalType(p: CheckEvalTypeProps) {
174174

175175
}
176176
</>}
177-
/>
177+
</FormGroup>
178178
);
179179
}
180180

Signum.React.Extensions/Dynamic/Validation/DynamicValidation.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ export default function DynamicValidation(p: DynamicValidationProps) {
145145
<div>
146146
<ValueLine ctx={ctx.subCtx(d => d.name)} />
147147
<EntityLine ctx={ctx.subCtx(d => d.entityType)} onChange={handleEntityTypeChange} />
148-
<FormGroup ctx={ctx.subCtx(d => d.subEntity)}
149-
children={() => ctx.value.entityType && <PropertyRouteCombo ctx={ctx.subCtx(d => d.subEntity)} type={ctx.value.entityType} onChange={forceUpdate} routes={PropertyRoute.generateAll(ctx.value.entityType.cleanName).filter(a => a.propertyRouteType == "Mixin" || a.typeReference().isEmbedded && !a.typeReference().isCollection)} />}
150-
/>
148+
<FormGroup ctx={ctx.subCtx(d => d.subEntity)}>
149+
{() => ctx.value.entityType && <PropertyRouteCombo ctx={ctx.subCtx(d => d.subEntity)} type={ctx.value.entityType} onChange={forceUpdate} routes={PropertyRoute.generateAll(ctx.value.entityType.cleanName).filter(a => a.propertyRouteType == "Mixin" || a.typeReference().isEmbedded && !a.typeReference().isCollection)} />}
150+
</FormGroup>
151151
{ctx.value.entityType &&
152152
<div>
153153
<br />

Signum.React.Extensions/Dynamic/View/DynamicViewOverride.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ export default function DynamicViewOverrideComponent(p: DynamicViewOverrideCompo
261261
<EntityLine ctx={ctx.subCtx(a => a.entityType)} onChange={forceUpdate} onRemove={handleTypeRemove} />
262262
{
263263
ctx.value.entityType && viewNames &&
264-
<FormGroup ctx={ctx.subCtx(d => d.viewName)} label={ctx.niceName(d => d.viewName)}
265-
children={inputId => <select id={inputId} value={ctx.value.viewName ? ctx.value.viewName : ""} className="form-select" onChange={handleViewNameChange}>
264+
<FormGroup ctx={ctx.subCtx(d => d.viewName)} label={ctx.niceName(d => d.viewName)}>
265+
{inputId => <select id={inputId} value={ctx.value.viewName ? ctx.value.viewName : ""} className="form-select" onChange={handleViewNameChange}>
266266
<option value="">{" - "}</option>
267267
{(viewNames ?? []).map((v, i) => <option key={i} value={v}>{v}</option>)}
268268
</select>
269269
}
270-
/>
270+
</FormGroup>
271271
}
272272

273273
{ctx.value.entityType &&

Signum.React.Extensions/Files/FileImageLine.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export const FileImageLine = React.forwardRef(function FileImageLine(props: File
6868
<FormGroup ctx={p.ctx} label={p.label}
6969
labelHtmlAttributes={p.labelHtmlAttributes}
7070
htmlAttributes={{ ...c.baseHtmlAttributes(), ...EntityBaseController.entityHtmlAttributes(p.ctx.value), ...p.formGroupHtmlAttributes }}
71-
helpText={c.props.helpText}
72-
children={() => hasValue ? renderImage() : p.ctx.readOnly ? undefined :
71+
helpText={c.props.helpText}>
72+
{() => hasValue ? renderImage() : p.ctx.readOnly ? undefined :
7373
<FileUploader
7474
accept={p.accept}
7575
maxSizeInBytes={p.maxSizeInBytes}
@@ -81,7 +81,7 @@ export const FileImageLine = React.forwardRef(function FileImageLine(props: File
8181
buttonCss={p.ctx.buttonClass}
8282
divHtmlAttributes={{ className: "sf-file-line-new" }} />
8383
}
84-
/>
84+
</FormGroup>
8585
);
8686

8787
function renderImage() {

0 commit comments

Comments
 (0)