File tree Expand file tree Collapse file tree 9 files changed +26
-13
lines changed Expand file tree Collapse file tree 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,
922922like people did for the [ React JSON Schema Form] ( https://github.com/rjsf-team/react-jsonschema-form ) project.
923923Core maintainers are working on the reference implementation, and community can add things of their interest.
924924
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!
926926Just take a peek on the [ Shoelace package] ( ./packages/shoelace ) ,
927927which is the canonical implementation (meaning it's the most complete, API-wise).
928928Then, 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';
77export const submit : Widgets [ 'submit' ] = ( options ) => html `
88 <!-- -->
99 < 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+ >
1113 </ div >
1214` ;
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ export class Jsf extends LitElement {
5252
5353 @property ( { type : Boolean } ) public submitButton = true ;
5454
55+ @property ( { type : String } ) public submitButtonText = 'Submit' ;
56+
5557 @state ( ) private _uiState : unknown = { } ;
5658
5759 protected _dig (
@@ -127,7 +129,7 @@ export class Jsf extends LitElement {
127129 // return flag('allOf');
128130 }
129131
130- let nodeParsed = node ;
132+ const nodeParsed = node ;
131133
132134 // if (currentNode.allOf) {
133135 // node.allOf?.forEach((subSchema) => {
@@ -394,12 +396,15 @@ export class Jsf extends LitElement {
394396 }
395397
396398 #submit = ( ) => {
397- const options = { id : '__submit' } ;
399+ const options : Widgets [ 'submit' ] = {
400+ id : '__submit_button' ,
401+ label : this . submitButtonLabel ,
402+ } ;
398403 const error = 'Missing submit widget.' ;
399404 return (
400405 this . widgets ?. submit ?.( options ) ??
401406 // systemWidgets?.submit?.(options) ??
402- this . widgets ?. callout ?.( { ... options , message : error } ) ??
407+ this . widgets ?. callout ?.( { message : error } ) ??
403408 error
404409 ) ;
405410 } ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import '@material/web/button/filled-button.js';
77export const submit : Widgets [ 'submit' ] = ( options ) => html `
88 <!-- -->
99 < 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+ >
1113 </ div >
1214` ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import '@shoelace-style/shoelace/dist/components/button/button.js';
77export const submit : Widgets [ 'submit' ] = ( options ) => html `
88 <!-- -->
99 < 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+ >
1113 </ div >
1214` ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import '@spectrum-web-components/button/sp-button.js';
77export const submit : Widgets [ 'submit' ] = ( options ) => html `
88 <!-- -->
99 < 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+ >
1113 </ div >
1214` ;
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ import type { Widgets } from '@jsfe/types';
55export const submit : Widgets [ 'submit' ] = ( options ) => html `
66 <!-- -->
77 < div id =${ options . id } class ="theme-system widget-submit">
8- < button type ="submit "> Submit</ button >
8+ < button type ="submit "> ${ options . label ?? ' Submit' } </ button >
99 </ div >
1010` ;
Original file line number Diff line number Diff line change @@ -146,5 +146,5 @@ export interface Widgets {
146146 type ?: 'tip' | 'warning' | 'danger' ;
147147 } > ;
148148
149- submit ?: Widget < undefined > ;
149+ submit ?: Widget < { id ?: string ; label ?: string } > ;
150150}
Original file line number Diff line number Diff line change 1+ import 'wired-elements/lib/wired-button.js' ;
2+
13import { html } from 'lit' ;
24
35import type { Widgets } from '@jsfe/types' ;
46
5- import 'wired-elements/lib/wired-button.js' ;
6-
77export const submit : Widgets [ 'submit' ] = ( options ) => html `
88 <!-- -->
99 < div id =${ options . id } class ="theme-wired widget-submit">
@@ -13,7 +13,7 @@ export const submit: Widgets['submit'] = (options) => html`
1313 @click =${ ( event : Event ) =>
1414 // FIXME: !!!
1515 event . target ?. dispatchEvent ( new Event ( 'submit' , { bubbles : true } ) ) }
16- > Submit</ wired-button
16+ > ${ options . label ?? ' Submit' } </ wired-button
1717 >
1818 </ div >
1919` ;
You can’t perform that action at this time.
0 commit comments