1- import { fieldArrayPrimitive } from './triage/array-primitive' ;
21/* eslint-disable max-lines */
32/* eslint-disable class-methods-use-this */
43/* eslint-disable no-underscore-dangle */
98 unsafeCSS ,
109 type TemplateResult ,
1110 type CSSResult ,
11+ nothing ,
1212} from 'lit' ;
1313
1414import { property , state } from 'lit/decorators.js' ;
@@ -17,12 +17,11 @@ import { createRef, ref } from 'lit/directives/ref.js';
1717// import deepmerge from 'deepmerge';
1818import set from 'lodash-es/set' ;
1919
20- import type { JSONSchema7 } from '@jsfe/types' ;
21-
2220// import { alternateField } from './triage/alternate.js';
2321import { fieldArray } from './triage/array.js' ;
2422import { fieldObject } from './triage/object.js' ;
2523import { fieldPrimitive } from './triage/primitive.js' ;
24+ import { fieldArrayPrimitive } from './triage/array-primitive.js' ;
2625
2726import type {
2827 DataChangeCallback ,
@@ -31,6 +30,7 @@ import type {
3130 Path ,
3231 UiSchema ,
3332 Widgets ,
33+ JSONSchema7 ,
3434} from '@jsfe/types' ;
3535
3636export class Jsf extends LitElement {
@@ -50,9 +50,11 @@ export class Jsf extends LitElement {
5050
5151 @property ( { type : Object } ) public experimental ?: FeatureFlags = { } ;
5252
53+ @property ( { type : Boolean } ) public submitButton = true ;
54+
5355 @state ( ) private _uiState : unknown = { } ;
5456
55- protected _dig = (
57+ protected _dig (
5658 node : JSONSchema7 ,
5759 dataLevel : unknown ,
5860 path : Path ,
@@ -61,7 +63,7 @@ export class Jsf extends LitElement {
6163 schemaPath : Path ,
6264 required = false ,
6365 level = 0 ,
64- ) : TemplateResult < 1 > => {
66+ ) : TemplateResult < 1 > {
6567 let result : TemplateResult < 1 > | undefined ;
6668 const currentNode : JSONSchema7 = node ;
6769
@@ -291,13 +293,14 @@ export class Jsf extends LitElement {
291293 // )}`;
292294 // }
293295
294- if ( Object . entries ( node ) . length === 0 ) {
295- const error = `Empty schema` ;
296- return (
297- this . widgets ?. callout ?.( { id : '' , message : error } ) ??
298- html `< p > ${ error } </ p > `
299- ) ;
300- }
296+ // TODO: check for blank schema
297+ // if (Object.entries({ ...node, title: undefined }).length === 0) {
298+ // const error = `Empty schema`;
299+ // return (
300+ // this.widgets?.callout?.({ id: '', message: error }) ??
301+ // html`<p>${error}</p>`
302+ // );
303+ // }
301304
302305 if ( result ) return result ;
303306
@@ -308,7 +311,7 @@ export class Jsf extends LitElement {
308311 this . widgets ?. callout ?.( { id : '' , message : error } ) ??
309312 html `< p > ${ error } </ p > `
310313 ) ;
311- } ;
314+ }
312315
313316 protected _setToValue ( object : unknown , value : unknown , path : Path ) {
314317 // NOTE: Dirty method:
@@ -436,10 +439,9 @@ export class Jsf extends LitElement {
436439 [ ] ,
437440 false ,
438441 ) }
439- <!-- -->
440442
441- <!-- $ {JSON.stringify(this.widgets)} -->
442- ${ this . #submit( ) }
443+ <!-- -->
444+ ${ this . submitButton ? this . #submit( ) : nothing }
443445 </ form >
444446 ` ;
445447 }
0 commit comments