File: /home/nepi/public_html/public/admin/js/chunk-264bd833.2601a01a.js.map
{"version":3,"sources":["webpack:///./src/interfaces/repeater/input.vue?2b14","webpack:///./src/interfaces/repeater/row.vue?a2f3","webpack:///src/interfaces/repeater/row.vue","webpack:///./src/interfaces/repeater/row.vue?c4f1","webpack:///./src/interfaces/repeater/row.vue","webpack:///src/interfaces/repeater/input.vue","webpack:///./src/interfaces/repeater/input.vue?739d","webpack:///./src/interfaces/repeater/input.vue","webpack:///./src/interfaces/repeater/row.vue?4e4d","webpack:///./src/interfaces/repeater/input.vue?9721","webpack:///./node_modules/@directus/extension-toolkit/mixins/interface.js","webpack:///./node_modules/core-js/modules/es.array.every.js"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","class","dragging","attrs","on","$event","endDrag","model","value","callback","$$v","rows","expression","_l","row","index","key","__key","repeaterFields","inline","options","template","duplicable","open","placeholder","toggleOpen","updateRow","removeRow","duplicateRow","addRow","_v","_s","createItemText","_e","staticRenderFns","ref","fields","length","field","interface","required","readonly","type","datatype","width","$emit","showPlaceholder","displayValue","rowOptions","rowOptionsClicked","directives","name","rawName","newItem","component","module","exports","props","id","String","default","Number","Boolean","collection","primaryKey","Object","relation","values","val","includes","$","$every","every","arrayMethodIsStrict","arrayMethodUsesToLength","STRICT_METHOD","USES_TO_LENGTH","target","proto","forced","callbackfn","arguments","undefined"],"mappings":"yHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACE,YAAY,sBAAsB,CAACF,EAAG,YAAY,CAACE,YAAY,gBAAgBC,MAAM,CAAEC,SAAUR,EAAIQ,UAAWC,MAAM,CAAC,OAAS,gBAAgBC,GAAG,CAAC,MAAQ,SAASC,GAAQX,EAAIQ,UAAW,GAAM,IAAMR,EAAIY,SAASC,MAAM,CAACC,MAAOd,EAAQ,KAAEe,SAAS,SAAUC,GAAMhB,E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S,EAAI4C,UAAU,QAAKC","file":"js/chunk-264bd833.2601a01a.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"interface-repeater\"},[_c('draggable',{staticClass:\"row-container\",class:{ dragging: _vm.dragging },attrs:{\"handle\":\".drag-handle\"},on:{\"start\":function($event){_vm.dragging = true},\"end\":_vm.endDrag},model:{value:(_vm.rows),callback:function ($$v) {_vm.rows=$$v},expression:\"rows\"}},_vm._l((_vm.rows),function(row,index){return _c('repeater-row',{key:row.__key,attrs:{\"row\":row,\"fields\":_vm.repeaterFields,\"inline\":_vm.inline,\"template\":_vm.options.template,\"duplicable\":_vm.options.duplicable,\"open\":_vm.open === index,\"placeholder\":_vm.options.placeholder},on:{\"open\":function($event){return _vm.toggleOpen(index)},\"input\":function($event){return _vm.updateRow(index, $event)},\"remove\":function($event){return _vm.removeRow(index)},\"duplicate\":function($event){return _vm.duplicateRow(index)}}})}),1),(_vm.addButtonVisible)?_c('div',{staticClass:\"add-new\",on:{\"click\":_vm.addRow}},[_c('v-icon',{attrs:{\"name\":\"add\",\"color\":\"--input-icon-color\"}}),_vm._v(\" \"+_vm._s(_vm.options.createItemText)+\" \")],1):_vm._e()],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-sheet',{ref:\"interfaceRoot\",staticClass:\"repeater-row\"},[_c('div',{staticClass:\"header\"},[_c('div',{staticClass:\"drag-handle\"},[_c('v-icon',{attrs:{\"name\":\"drag_handle\"}})],1),_c('div',{staticClass:\"content\",class:{ 'two-up': _vm.inline && _vm.fields.length === 2 }},[(_vm.inline)?_vm._l((_vm.fields),function(field){return _c('v-ext-input',{key:field.field,attrs:{\"id\":field.interface || 'text-input',\"name\":field.field,\"required\":field.required,\"readonly\":field.readonly,\"options\":field.options,\"type\":field.type,\"datatype\":field.datatype,\"value\":_vm.row[field.field],\"fields\":_vm.fields,\"values\":_vm.row,\"length\":field.length,\"width\":field.width},on:{\"input\":function($event){return _vm.$emit('input', {\n\t\t\t\t\t\t\tfield: field.field,\n\t\t\t\t\t\t\tvalue: $event\n\t\t\t\t\t\t})}}})}):_c('button',{class:_vm.showPlaceholder ? 'placeholder' : 'preview',attrs:{\"type\":\"button\"},on:{\"click\":function($event){return _vm.$emit('open')}}},[_vm._v(\" \"+_vm._s(_vm.showPlaceholder ? _vm.placeholder : _vm.displayValue)+\" \")])],2),(_vm.duplicable)?_c('v-contextual-menu',{staticClass:\"more-options\",attrs:{\"placement\":\"bottom-end\",\"options\":_vm.rowOptions},on:{\"click\":_vm.rowOptionsClicked}}):_c('button',{attrs:{\"type\":\"button\"},on:{\"click\":function($event){return _vm.$emit('remove')}}},[_c('v-icon',{staticClass:\"remove\",attrs:{\"name\":\"delete_outline\"}})],1)],1),(_vm.inline === false)?_c('div',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.open),expression:\"open\"}],staticClass:\"body\"},[_c('v-form',{attrs:{\"full-width\":\"\",\"fields\":_vm.fields,\"values\":_vm.row,\"new-item\":_vm.newItem},on:{\"stage-value\":function($event){return _vm.$emit('input', $event)}}})],1):_vm._e()])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n\t<v-sheet ref=\"interfaceRoot\" class=\"repeater-row\">\n\t\t<div class=\"header\">\n\t\t\t<div class=\"drag-handle\">\n\t\t\t\t<v-icon name=\"drag_handle\" />\n\t\t\t</div>\n\t\t\t<div class=\"content\" :class=\"{ 'two-up': inline && fields.length === 2 }\">\n\t\t\t\t<template v-if=\"inline\">\n\t\t\t\t\t<v-ext-input\n\t\t\t\t\t\tv-for=\"field in fields\"\n\t\t\t\t\t\t:id=\"field.interface || 'text-input'\"\n\t\t\t\t\t\t:key=\"field.field\"\n\t\t\t\t\t\t:name=\"field.field\"\n\t\t\t\t\t\t:required=\"field.required\"\n\t\t\t\t\t\t:readonly=\"field.readonly\"\n\t\t\t\t\t\t:options=\"field.options\"\n\t\t\t\t\t\t:type=\"field.type\"\n\t\t\t\t\t\t:datatype=\"field.datatype\"\n\t\t\t\t\t\t:value=\"row[field.field]\"\n\t\t\t\t\t\t:fields=\"fields\"\n\t\t\t\t\t\t:values=\"row\"\n\t\t\t\t\t\t:length=\"field.length\"\n\t\t\t\t\t\t:width=\"field.width\"\n\t\t\t\t\t\t@input=\"\n\t\t\t\t\t\t\t$emit('input', {\n\t\t\t\t\t\t\t\tfield: field.field,\n\t\t\t\t\t\t\t\tvalue: $event\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t\t<button\n\t\t\t\t\tv-else\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t:class=\"showPlaceholder ? 'placeholder' : 'preview'\"\n\t\t\t\t\t@click=\"$emit('open')\"\n\t\t\t\t>\n\t\t\t\t\t{{ showPlaceholder ? placeholder : displayValue }}\n\t\t\t\t</button>\n\t\t\t</div>\n\n\t\t\t<v-contextual-menu\n\t\t\t\tv-if=\"duplicable\"\n\t\t\t\tclass=\"more-options\"\n\t\t\t\tplacement=\"bottom-end\"\n\t\t\t\t:options=\"rowOptions\"\n\t\t\t\t@click=\"rowOptionsClicked\"\n\t\t\t></v-contextual-menu>\n\t\t\t<button v-else type=\"button\" @click=\"$emit('remove')\">\n\t\t\t\t<v-icon name=\"delete_outline\" class=\"remove\" />\n\t\t\t</button>\n\t\t</div>\n\t\t<div v-if=\"inline === false\" v-show=\"open\" class=\"body\">\n\t\t\t<v-form\n\t\t\t\tfull-width\n\t\t\t\t:fields=\"fields\"\n\t\t\t\t:values=\"row\"\n\t\t\t\t:new-item=\"newItem\"\n\t\t\t\t@stage-value=\"$emit('input', $event)\"\n\t\t\t/>\n\t\t</div>\n\t</v-sheet>\n</template>\n\n<script>\nimport getFieldsFromTemplate from '@/helpers/get-fields-from-template';\n\nexport default {\n\tname: 'RepeaterRow',\n\tprops: {\n\t\trow: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tfields: {\n\t\t\ttype: Array,\n\t\t\trequired: true\n\t\t},\n\t\tinline: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\ttemplate: {\n\t\t\ttype: String,\n\t\t\tdefault: null\n\t\t},\n\t\tduplicable: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\topen: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t}\n\t},\n\tcomputed: {\n\t\tnewItem() {\n\t\t\tif (this.row.newItem === true) return true;\n\t\t\treturn false;\n\t\t},\n\t\tdisplayValue() {\n\t\t\tif (!this.template) {\n\t\t\t\treturn this.row[this.fields[0].field];\n\t\t\t}\n\n\t\t\tlet preview = this.$helpers.micromustache.render(this.template, this.row);\n\n\t\t\treturn preview;\n\t\t},\n\t\tshowPlaceholder() {\n\t\t\tlet fields = [this.fields[0].field];\n\n\t\t\tif (this.template) {\n\t\t\t\tfields = getFieldsFromTemplate(this.template);\n\t\t\t}\n\n\t\t\tconst fieldsHaveValue = fields.every(field => {\n\t\t\t\treturn this.row[field] !== null && this.row[field]?.length > 0;\n\t\t\t});\n\n\t\t\treturn fieldsHaveValue === false;\n\t\t},\n\t\trowOptions() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttext: this.$t('delete'),\n\t\t\t\t\ticon: 'delete_outline'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttext: this.$t('duplicate'),\n\t\t\t\t\ticon: 'control_point_duplicate'\n\t\t\t\t}\n\t\t\t];\n\t\t}\n\t},\n\tmethods: {\n\t\trowOptionsClicked(option) {\n\t\t\tswitch (option) {\n\t\t\t\tcase 0:\n\t\t\t\t\tthis.$emit('remove');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tthis.$emit('duplicate');\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n};\n</script>\n\n<style lang=\"scss\" scoped>\n.repeater-row {\n\tmargin-bottom: 8px;\n\tpadding: 0;\n}\n\n.header {\n\t--form-vertical-gap: 24px;\n\t--form-horizontal-gap: 12px;\n\t--type-label-size: 15px;\n\t--input-height: 44px;\n\t--input-font-size: 14px;\n\t--input-label-margin: 4px;\n\t--input-background-color-alt: var(--input-background-color);\n\n\tdisplay: flex;\n\talign-items: center;\n\tmin-height: var(--input-height);\n\tpadding: var(--input-padding);\n\n\t.drag-handle {\n\t\tcolor: var(--input-icon-color);\n\t\tcursor: grab;\n\t}\n\n\t.content {\n\t\tflex-grow: 1;\n\t\tdisplay: grid;\n\t\tgrid-template-columns: repeat(1, 1fr);\n\t\tgrid-gap: 8px;\n\t\tpadding: 0 8px;\n\n\t\t&.two-up {\n\t\t\tgrid-template-columns: repeat(2, 1fr);\n\t\t}\n\n\t\t.placeholder {\n\t\t\tcolor: var(--input-placeholder-color);\n\t\t\tfont-style: italic;\n\t\t}\n\n\t\t.preview,\n\t\t.placeholder {\n\t\t\ttext-align: left;\n\t\t\tmin-height: 32px;\n\t\t}\n\t}\n\n\t.remove {\n\t\ttransition: color var(--fast) var(--transition);\n\t\tcolor: var(--input-icon-color);\n\t\t&:hover {\n\t\t\tcolor: var(--danger);\n\t\t}\n\t}\n}\n\n.body {\n\t--form-vertical-gap: 24px;\n\t--form-horizontal-gap: 12px;\n\t--type-label-size: 15px;\n\t--input-height: 44px;\n\t--input-font-size: 14px;\n\t--input-label-margin: 4px;\n\t--input-background-color-alt: var(--input-background-color);\n\tpadding: 8px;\n}\n</style>\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./row.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./row.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./row.vue?vue&type=template&id=c79d5056&scoped=true&\"\nimport script from \"./row.vue?vue&type=script&lang=js&\"\nexport * from \"./row.vue?vue&type=script&lang=js&\"\nimport style0 from \"./row.vue?vue&type=style&index=0&id=c79d5056&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"c79d5056\",\n null\n \n)\n\nexport default component.exports","<template>\n\t<div class=\"interface-repeater\">\n\t\t<draggable\n\t\t\tv-model=\"rows\"\n\t\t\thandle=\".drag-handle\"\n\t\t\tclass=\"row-container\"\n\t\t\t:class=\"{ dragging }\"\n\t\t\t@start=\"dragging = true\"\n\t\t\t@end=\"endDrag\"\n\t\t>\n\t\t\t<repeater-row\n\t\t\t\tv-for=\"(row, index) in rows\"\n\t\t\t\t:key=\"row.__key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:fields=\"repeaterFields\"\n\t\t\t\t:inline=\"inline\"\n\t\t\t\t:template=\"options.template\"\n\t\t\t\t:duplicable=\"options.duplicable\"\n\t\t\t\t:open=\"open === index\"\n\t\t\t\t:placeholder=\"options.placeholder\"\n\t\t\t\t@open=\"toggleOpen(index)\"\n\t\t\t\t@input=\"updateRow(index, $event)\"\n\t\t\t\t@remove=\"removeRow(index)\"\n\t\t\t\t@duplicate=\"duplicateRow(index)\"\n\t\t\t/>\n\t\t</draggable>\n\t\t<div v-if=\"addButtonVisible\" class=\"add-new\" @click=\"addRow\">\n\t\t\t<v-icon name=\"add\" color=\"--input-icon-color\" />\n\t\t\t{{ options.createItemText }}\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport mixin from '@directus/extension-toolkit/mixins/interface';\nimport RepeaterRow from './row';\nimport shortid from 'shortid';\nimport { clone, keyBy } from 'lodash';\n\nexport default {\n\tname: 'Repeater',\n\tcomponents: {\n\t\tRepeaterRow\n\t},\n\tmixins: [mixin],\n\tdata() {\n\t\treturn {\n\t\t\trows: [],\n\t\t\tdragging: false,\n\t\t\topen: null\n\t\t};\n\t},\n\tcomputed: {\n\t\t// If the interface is able to display the fields inline\n\t\tinline() {\n\t\t\t// Only render inline when there are 1 or two fields\n\t\t\tif (this.repeaterFields.length > 2) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// If there's only 1 field, render it regardless of size\n\t\t\tif (this.repeaterFields.length === 1) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Only render inline if there's enough space in the parent\n\t\t\t// We want to prevent the two interfaces being squashed togt\n\t\t\tif (['full', 'fill'].includes(this.width) === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Only render inline if every field is configured to be half width\n\t\t\treturn this.repeaterFields.every(field => field.width === 'half');\n\t\t},\n\t\taddButtonVisible() {\n\t\t\tif (!this.options.limit || this.options.limit === 0) return true;\n\t\t\tif (this.rows.length < this.options.limit) return true;\n\n\t\t\treturn false;\n\t\t},\n\n\t\t// This makes sure that the fields are always an array of fields. It makes sure the interface\n\t\t// is backwards compatible for people who have their repeater setup in an object structure\n\t\trepeaterFields() {\n\t\t\tif (Array.isArray(this.options.fields)) {\n\t\t\t\treturn this.options.fields;\n\t\t\t}\n\n\t\t\treturn Object.keys(this.options.fields).map(key => {\n\t\t\t\treturn {\n\t\t\t\t\t...this.options.fields[key],\n\t\t\t\t\tfield: key\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t},\n\tcreated() {\n\t\tthis.setRows();\n\t},\n\tmethods: {\n\t\taddRow() {\n\t\t\tthis.rows = [...this.rows, this.getNewRow()];\n\t\t\tthis.open = this.rows.length - 1;\n\t\t\tthis.emitValue();\n\t\t},\n\t\tupdateRow(index, { field, value }) {\n\t\t\tconst rows = clone(this.rows);\n\t\t\tconst currentRow = rows[index];\n\t\t\tconst newRow = {\n\t\t\t\t...currentRow,\n\t\t\t\t[field]: value\n\t\t\t};\n\n\t\t\trows[index] = newRow;\n\n\t\t\tthis.rows = rows;\n\t\t\tthis.emitValue();\n\t\t},\n\t\tremoveRow(index) {\n\t\t\tconst newRows = clone(this.rows);\n\t\t\tnewRows.splice(index, 1);\n\t\t\tthis.rows = newRows;\n\t\t\tthis.emitValue();\n\t\t},\n\t\tduplicateRow(index) {\n\t\t\tconst newRows = clone(this.rows);\n\t\t\tconst duplicatedRow = clone(this.rows[index]);\n\n\t\t\tnewRows.splice(index + 1, 0, duplicatedRow);\n\t\t\tthis.rows = newRows;\n\t\t\tthis.emitValue();\n\t\t},\n\n\t\temitValue() {\n\t\t\tlet value = clone(this.rows).map(row => {\n\t\t\t\tdelete row.__key;\n\t\t\t\treturn row;\n\t\t\t});\n\n\t\t\tif (value.length === 0) {\n\t\t\t\treturn this.$emit('input', null);\n\t\t\t}\n\n\t\t\tif (this.options.structure === 'object') {\n\t\t\t\tthis.$emit('input', keyBy(value, this.options.structure_key));\n\t\t\t} else {\n\t\t\t\tthis.$emit('input', value);\n\t\t\t}\n\t\t},\n\t\tgetNewRow() {\n\t\t\tconst row = {\n\t\t\t\t__key: shortid.generate(),\n\t\t\t\tnewItem: true\n\t\t\t};\n\n\t\t\tthis.repeaterFields.forEach(field => {\n\t\t\t\trow[field.field] = field.default;\n\t\t\t});\n\n\t\t\treturn row;\n\t\t},\n\t\t// There's two different structures in which the interface value can be saved\n\t\t// This method makes sure we're always using the same structure in the interface itself\n\t\tsetRows() {\n\t\t\tif (this.value === null) {\n\t\t\t\tthis.rows = [];\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (Array.isArray(this.value)) {\n\t\t\t\tthis.rows = this.value;\n\t\t\t} else if (typeof this.value === 'string') {\n\t\t\t\ttry {\n\t\t\t\t\tthis.rows = JSON.parse(this.value);\n\t\t\t\t} catch {\n\t\t\t\t\tconsole.warn('Invalid JSON passed to repeater');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.rows = Object.values(this.value);\n\t\t\t}\n\t\t},\n\t\tendDrag() {\n\t\t\tthis.dragging = false;\n\t\t\tthis.emitValue();\n\t\t},\n\t\ttoggleOpen(index) {\n\t\t\tif (this.open === index) {\n\t\t\t\tthis.open = null;\n\t\t\t} else {\n\t\t\t\tthis.open = index;\n\t\t\t}\n\t\t}\n\t}\n};\n</script>\n\n<style lang=\"scss\" scoped>\n.notice {\n\tmargin-bottom: 12px;\n}\n\n.add-new {\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: var(--input-padding);\n\tborder: var(--input-border-width) dotted var(--input-border-color);\n\tborder-radius: var(--border-radius);\n\tcolor: var(--input-text-color);\n\ttransition: var(--fast) var(--transition);\n\ttransition-property: color, border-color, padding;\n\tmin-height: var(--input-height);\n\tfont-size: var(--input-font-size);\n\tpadding: var(--input-padding);\n\tcursor: pointer;\n\t&:hover {\n\t\tborder-color: var(--input-border-color-hover);\n\t}\n\ti {\n\t\tmargin-right: 8px;\n\t}\n}\n</style>\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./input.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./input.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./input.vue?vue&type=template&id=518346e1&scoped=true&\"\nimport script from \"./input.vue?vue&type=script&lang=js&\"\nexport * from \"./input.vue?vue&type=script&lang=js&\"\nimport style0 from \"./input.vue?vue&type=style&index=0&id=518346e1&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"518346e1\",\n null\n \n)\n\nexport default component.exports","import mod from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./row.vue?vue&type=style&index=0&id=c79d5056&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./row.vue?vue&type=style&index=0&id=c79d5056&lang=scss&scoped=true&\"","import mod from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./input.vue?vue&type=style&index=0&id=518346e1&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./input.vue?vue&type=style&index=0&id=518346e1&lang=scss&scoped=true&\"","module.exports = {\n props: {\n // Unique id for this interface. Should be added to the lower level \n // HTML input element if applicable. This ID will be used in the label's\n // `for` attribute\n id: {\n type: String,\n required: true\n },\n // Name of the field\n name: {\n type: String,\n required: true\n },\n // The current value. This can either be the default value, the saved database\n // value or the current state after the user made an edit\n value: {\n type: null,\n default: null\n },\n // Type of the field, eg `string`, `hash`, or `array`\n type: {\n type: String,\n required: true\n },\n // Max length\n length: {\n type: [String, Number],\n default: null\n },\n // If the field is readonly or not\n readonly: {\n type: Boolean,\n default: false\n },\n // Name of the collection\n collection: {\n type: String,\n default: null\n },\n // Primary key of the item you're editing in this context\n primaryKey: {\n type: [Number, String],\n default: null\n },\n // If the field is required or not\n required: {\n type: Boolean,\n default: false\n },\n // Field options. A json object based on the interface's meta.json file\n options: {\n type: Object,\n default: () => ({})\n },\n // If the item that's currently being edited is new\n newItem: {\n type: Boolean,\n default: false\n },\n // The relation of the current field. Will contain information on the related\n // collection and field(s)\n relation: {\n type: Object,\n default: null\n },\n // The other fields in the current edit page\n fields: {\n type: Object,\n default: null\n },\n // The values of the other fields on the edit page. Can be used for things like\n // automatically generating a slug based on another field\n values: {\n type: Object,\n default: null\n },\n width: {\n type: String,\n default: null,\n validator(val) {\n return [\n 'half',\n 'half-left',\n 'half-right',\n 'full',\n 'fill'\n ].includes(val);\n }\n }\n }\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $every = require('../internals/array-iteration').every;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar STRICT_METHOD = arrayMethodIsStrict('every');\nvar USES_TO_LENGTH = arrayMethodUsesToLength('every');\n\n// `Array.prototype.every` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.every\n$({ target: 'Array', proto: true, forced: !STRICT_METHOD || !USES_TO_LENGTH }, {\n every: function every(callbackfn /* , thisArg */) {\n return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n"],"sourceRoot":""}