<commit_before>import { getPropChildId, getWidget } from '../../utils'
import SchemaProp from './schema-prop'
import arrayMixin from '../mixins/array-mixin'

export default {
  name: 'draggable-prop',

  mixins: [arrayMixin],

  render: function (h) {
    return h('div', {
      'class': 'row col'
    }, [
      h('div', {
        attrs: {
          id: getPropChildId(this.idSchema, 'label'),
        },
        'class': 'col-12 mb-1 text-bold',
        slot: 'label'
      }, this.uiOptions.label),
      h(getWidget(this.schema,
        this.uiOptions.widget || 'draggable',
        this.registry.widgets), {
          'class': 'col-12',
          props: {
            list: this.value,
          },
        }, this.items.map((item, index) => {
          if (item.schema.type === 'object') {
            let uiOptions = item.uiSchema['ui:options']
            uiOptions = {
              ...uiOptions,
              widget: 'arrayItem',
              index: index,
              remove: this.onDropIndexClick.bind(null, index),
            }
            item.uiSchema = {...item.uiSchema, 'ui:options': uiOptions}
            return h(SchemaProp, {
              props: {
                schema: item.schema,
                uiSchema: item.uiSchema,
                errorSchema: item.errorSchema,
                idSchema: item.idSchema,
                required: this.isItemRequired(item.schema),
                value: item.value,
                registry: this.registry,
              },
              on: {
                input: itemVal => {
                  this.value.splice(item.index, 1, itemVal)
                  this.$emit('input', this.value)
                },
                blur: itemVal => {
                  this.value.splice(item.index, 1, itemVal)
                  this.$emit('blur', this.value)
                }
              },
            })
          } else {
            return h(getWidget(this.schema,
              this.uiOptions.widget || 'arrayItem',
              this.registry.widgets), {
                props: {
                  index: index,
                  remove: this.onDropIndexClick.bind(null, index),
                }
              }, [
                h(SchemaProp, {
                  props: {
                    schema: item.schema,
                    uiSchema: item.uiSchema,
                    errorSchema: item.errorSchema,
                    idSchema: item.idSchema,
                    required: this.isItemRequired(item.schema),
                    value: item.value,
                    registry: this.registry,
                  },
                  on: {
                    input: itemVal => {
                      this.value.splice(item.index, 1, itemVal)
                      this.$emit('input', this.value)
                    },
                    blur: itemVal => {
                      this.value.splice(item.index, 1, itemVal)
                      this.$emit('blur', this.value)
                    }
                  },
                })
              ])
          }
        })
      ),
      this.canAddItem(this.value) ? h('div', {
        'class': {
          'btn btn-primary mt-2': true,
          [this.uiOptions.classNames]: this.uiOptions.classNames,
        },
        on: {
          click: this.onAddClick,
        },
        domProps: {
          innerHTML: (this.uiOptions.addBtnText || '') + ' <i class="fa fa-plus"></i>',
        }
      }) : undefined,
      h('div', {
        'class': 'col-12',
        attrs: {
          id: getPropChildId(this.idSchema, 'description'),
        },
        slot: 'description'
      }, this.uiOptions.description)
    ])<commit_msg>style: add button cursor<commit_after>import { getPropChildId, getWidget } from '../../utils'
import SchemaProp from './schema-prop'
import arrayMixin from '../mixins/array-mixin'

export default {
  name: 'draggable-prop',

  mixins: [arrayMixin],

  render: function (h) {
    return h('div', {
      'class': 'row col'
    }, [
      h('div', {
        attrs: {
          id: getPropChildId(this.idSchema, 'label'),
        },
        'class': 'col-12 mb-1 text-bold',
        slot: 'label'
      }, this.uiOptions.label),
      h(getWidget(this.schema,
        this.uiOptions.widget || 'draggable',
        this.registry.widgets), {
          'class': 'col-12',
          props: {
            list: this.value,
          },
        }, this.items.map((item, index) => {
          if (item.schema.type === 'object') {
            let uiOptions = item.uiSchema['ui:options']
            uiOptions = {
              ...uiOptions,
              widget: 'arrayItem',
              index: index,
              remove: this.onDropIndexClick.bind(null, index),
            }
            item.uiSchema = {...item.uiSchema, 'ui:options': uiOptions}
            return h(SchemaProp, {
              props: {
                schema: item.schema,
                uiSchema: item.uiSchema,
                errorSchema: item.errorSchema,
                idSchema: item.idSchema,
                required: this.isItemRequired(item.schema),
                value: item.value,
                registry: this.registry,
              },
              on: {
                input: itemVal => {
                  this.value.splice(item.index, 1, itemVal)
                  this.$emit('input', this.value)
                },
                blur: itemVal => {
                  this.value.splice(item.index, 1, itemVal)
                  this.$emit('blur', this.value)
                }
              },
            })
          } else {
            return h(getWidget(this.schema,
              this.uiOptions.widget || 'arrayItem',
              this.registry.widgets), {
                props: {
                  index: index,
                  remove: this.onDropIndexClick.bind(null, index),
                }
              }, [
                h(SchemaProp, {
                  props: {
                    schema: item.schema,
                    uiSchema: item.uiSchema,
                    errorSchema: item.errorSchema,
                    idSchema: item.idSchema,
                    required: this.isItemRequired(item.schema),
                    value: item.value,
                    registry: this.registry,
                  },
                  on: {
                    input: itemVal => {
                      this.value.splice(item.index, 1, itemVal)
                      this.$emit('input', this.value)
                    },
                    blur: itemVal => {
                      this.value.splice(item.index, 1, itemVal)
                      this.$emit('blur', this.value)
                    }
                  },
                })
              ])
          }
        })
      ),
      this.canAddItem(this.value) ? h('div', {
        'class': {
          'btn btn-primary mt-2': true,
          [this.uiOptions.classNames]: this.uiOptions.classNames,
        },
        'style': 'cursor: pointer;',
        on: {
          click: this.onAddClick,
        },
        domProps: {
          innerHTML: (this.uiOptions.addBtnText || '') + ' <i class="fa fa-plus"></i>',
        }
      }) : undefined,
      h('div', {
        'class': 'col-12',
        attrs: {
          id: getPropChildId(this.idSchema, 'description'),
        },
        slot: 'description'
      }, this.uiOptions.description)
    ])
{'fraction_non_alphanumeric': 0.1298050893340552, 'fraction_numerical': 0.0032485110990795887, 'mean_word_length': 1.1815766164747563, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7044150', 'n_tokens_mistral': 2050, 'n_tokens_neox': 1945, 'n_words': 352}