How to use the schema-based-json-editor.getDefaultValue function in schema-based-json-editor

To help you get started, we’ve selected a few schema-based-json-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plantain-00 / schema-based-json-editor / packages / angular / src / object-editor.component.ts View on Github external
ngOnInit() {
    this.collapsed = this.schema.collapsed
    this.value = common.getDefaultValue(this.required, this.schema, this.initialValue) as { [name: string]: common.ValueType }
    this.validate()
    if (this.value !== undefined) {
      for (const property in this.schema.properties) {
        if (this.schema.properties.hasOwnProperty(property)) {
          const schema = this.schema.properties[property]
          const propertyName = schema.propertyName || property
          if (this.isRequired(property) !== false) {
            const required = this.schema.required && this.schema.required.some(r => r === property)
            this.value[propertyName] = common.getDefaultValue(required, schema, this.value[propertyName]) as { [name: string]: common.ValueType }
          }

          this.properties.push({
            property,
            propertyName,
            schema
          })
github plantain-00 / schema-based-json-editor / packages / angular / src / any-editor.component.ts View on Github external
ngOnInit() {
    this.value = common.getDefaultValue(this.required, this.schema, this.initialValue) as string
    this.updateValue.emit({ value: this.value, isValid: true })
  }
  ngAfterViewInit() {
github plantain-00 / schema-based-json-editor / packages / vue / src / boolean-editor.ts View on Github external
beforeMount() {
    this.value = common.getDefaultValue(this.required, this.schema, this.initialValue) as boolean
    this.$emit('update-value', { value: this.value, isValid: true })
  }
github plantain-00 / schema-based-json-editor / packages / angular / src / array-editor.component.ts View on Github external
addItem() {
    this.value!.push(common.getDefaultValue(true, this.schema.items, undefined)!)
    this.updateValue.emit({ value: this.value, isValid: !this.errorMessage && this.invalidIndexes.length === 0 })
  }
  onDeleteFunction(i: number) {
github plantain-00 / schema-based-json-editor / packages / react / src / number-editor.tsx View on Github external
constructor(props: Props) {
    super(props)
    this.value = common.getDefaultValue(this.props.required, this.props.schema, this.props.initialValue) as number
    this.validate()
  }
  componentDidMount() {
github plantain-00 / schema-based-json-editor / packages / react / src / object-editor.tsx View on Github external
constructor(props: Props) {
    super(props)
    this.value = common.getDefaultValue(this.props.required, this.props.schema, this.props.initialValue) as { [name: string]: common.ValueType }
    this.validate()
    if (this.value !== undefined) {
      for (const property in this.props.schema.properties) {
        if (this.props.schema.properties.hasOwnProperty(property)) {
          const schema = this.props.schema.properties[property]
          const propertyName = schema.propertyName || property
          if (this.isRequired(property) !== false) {
            const required = this.props.schema.required && this.props.schema.required.some(r => r === property)
            this.value[propertyName] = common.getDefaultValue(required, schema, this.value[propertyName]) as { [name: string]: common.ValueType }
          }
          this.properties.push({
            property,
            propertyName,
            schema
          })
        }
github plantain-00 / schema-based-json-editor / packages / react / src / boolean-editor.tsx View on Github external
constructor(props: Props) {
    super(props)
    this.value = common.getDefaultValue(this.props.required, this.props.schema, this.props.initialValue) as boolean
  }
  componentDidMount() {
github plantain-00 / schema-based-json-editor / packages / react / src / any-editor.tsx View on Github external
constructor(props: Props) {
    super(props)
    this.value = common.getDefaultValue(this.props.required, this.props.schema, this.props.initialValue)
    this.monacoEditorRef = React.createRef()
  }
github plantain-00 / schema-based-json-editor / packages / react / src / array-editor.tsx View on Github external
private addItem = () => {
    this.value!.push(common.getDefaultValue(true, this.props.schema.items, undefined)!)
    this.setState({ value: this.value })
    this.props.updateValue(this.value, !this.errorMessage && this.invalidIndexes.length === 0)
  }
  private onChange = (i: number, value: common.ValueType | undefined, isValid: boolean) => {
github plantain-00 / schema-based-json-editor / packages / react / src / null-editor.tsx View on Github external
constructor(props: Props) {
    super(props)
    this.value = common.getDefaultValue(this.props.required, this.props.schema, this.props.initialValue) as null
  }
  componentDidMount() {