File tree 9 files changed +26
-13
lines changed
9 files changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -922,7 +922,7 @@ I encourage you to contribute,
922
922
like people did for the [ React JSON Schema Form] ( https://github.com/rjsf-team/react-jsonschema-form ) project.
923
923
Core maintainers are working on the reference implementation, and community can add things of their interest.
924
924
925
- If you want to enhance the lib. by supporting for more fields, it's quite easy!
925
+ If you want to enhance the lib. by bringing support for more fields, it's quite easy!
926
926
Just take a peek on the [ Shoelace package] ( ./packages/shoelace ) ,
927
927
which is the canonical implementation (meaning it's the most complete, API-wise).
928
928
Then, you are welcome to make a pull request with new features, or bug fixes.
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import '@carbon/web-components/es/components/button/index.js';
7
7
export const submit : Widgets [ 'submit' ] = ( options ) => html `
8
8
<!-- -->
9
9
< div id =${ options . id } class ="theme-carbon widget-submit">
10
- < cds-button type ="submit " isExpressive size ="lg "> Submit</ cds-button >
10
+ < cds-button type ="submit " isExpressive size ="lg "
11
+ > ${ options . label ?? 'Submit' } </ cds-button
12
+ >
11
13
</ div >
12
14
` ;
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ export class Jsf extends LitElement {
52
52
53
53
@property ( { type : Boolean } ) public submitButton = true ;
54
54
55
+ @property ( { type : String } ) public submitButtonText = 'Submit' ;
56
+
55
57
@state ( ) private _uiState : unknown = { } ;
56
58
57
59
protected _dig (
@@ -127,7 +129,7 @@ export class Jsf extends LitElement {
127
129
// return flag('allOf');
128
130
}
129
131
130
- let nodeParsed = node ;
132
+ const nodeParsed = node ;
131
133
132
134
// if (currentNode.allOf) {
133
135
// node.allOf?.forEach((subSchema) => {
@@ -394,12 +396,15 @@ export class Jsf extends LitElement {
394
396
}
395
397
396
398
#submit = ( ) => {
397
- const options = { id : '__submit' } ;
399
+ const options : Widgets [ 'submit' ] = {
400
+ id : '__submit_button' ,
401
+ label : this . submitButtonLabel ,
402
+ } ;
398
403
const error = 'Missing submit widget.' ;
399
404
return (
400
405
this . widgets ?. submit ?.( options ) ??
401
406
// systemWidgets?.submit?.(options) ??
402
- this . widgets ?. callout ?.( { ... options , message : error } ) ??
407
+ this . widgets ?. callout ?.( { message : error } ) ??
403
408
error
404
409
) ;
405
410
} ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import '@material/web/button/filled-button.js';
7
7
export const submit : Widgets [ 'submit' ] = ( options ) => html `
8
8
<!-- -->
9
9
< div id =${ options . id } class ="theme-material widget-submit">
10
- < md-filled-button type ="submit "> Submit</ md-filled-button >
10
+ < md-filled-button type ="submit "
11
+ > ${ options . submitButtonText ?? 'Submit' } </ md-filled-button
12
+ >
11
13
</ div >
12
14
` ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import '@shoelace-style/shoelace/dist/components/button/button.js';
7
7
export const submit : Widgets [ 'submit' ] = ( options ) => html `
8
8
<!-- -->
9
9
< div id =${ options . id } class ="theme-shoelace widget-submit">
10
- < sl-button type ="submit " size ="large "> Submit</ sl-button >
10
+ < sl-button type ="submit " size ="large "
11
+ > ${ options . label ?? 'Submit' } </ sl-button
12
+ >
11
13
</ div >
12
14
` ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import '@spectrum-web-components/button/sp-button.js';
7
7
export const submit : Widgets [ 'submit' ] = ( options ) => html `
8
8
<!-- -->
9
9
< div id =${ options . id } class ="theme-spectrum widget-submit">
10
- < sp-button type ="submit " size ="large "> Submit</ sp-button >
10
+ < sp-button type ="submit " size ="large "
11
+ > ${ options . label ?? 'Submit' } </ sp-button
12
+ >
11
13
</ div >
12
14
` ;
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ import type { Widgets } from '@jsfe/types';
5
5
export const submit : Widgets [ 'submit' ] = ( options ) => html `
6
6
<!-- -->
7
7
< div id =${ options . id } class ="theme-system widget-submit">
8
- < button type ="submit "> Submit</ button >
8
+ < button type ="submit "> ${ options . label ?? ' Submit' } </ button >
9
9
</ div >
10
10
` ;
Original file line number Diff line number Diff line change @@ -146,5 +146,5 @@ export interface Widgets {
146
146
type ?: 'tip' | 'warning' | 'danger' ;
147
147
} > ;
148
148
149
- submit ?: Widget < undefined > ;
149
+ submit ?: Widget < { id ?: string ; label ?: string } > ;
150
150
}
Original file line number Diff line number Diff line change
1
+ import 'wired-elements/lib/wired-button.js' ;
2
+
1
3
import { html } from 'lit' ;
2
4
3
5
import type { Widgets } from '@jsfe/types' ;
4
6
5
- import 'wired-elements/lib/wired-button.js' ;
6
-
7
7
export const submit : Widgets [ 'submit' ] = ( options ) => html `
8
8
<!-- -->
9
9
< div id =${ options . id } class ="theme-wired widget-submit">
@@ -13,7 +13,7 @@ export const submit: Widgets['submit'] = (options) => html`
13
13
@click =${ ( event : Event ) =>
14
14
// FIXME: !!!
15
15
event . target ?. dispatchEvent ( new Event ( 'submit' , { bubbles : true } ) ) }
16
- > Submit</ wired-button
16
+ > ${ options . label ?? ' Submit' } </ wired-button
17
17
>
18
18
</ div >
19
19
` ;
You can’t perform that action at this time.
0 commit comments