{"id":19258934,"url":"https://github.com/lassehaslev/vue-item-input","last_synced_at":"2026-06-29T22:30:24.076Z","repository":{"id":89976161,"uuid":"76969450","full_name":"LasseHaslev/vue-item-input","owner":"LasseHaslev","description":"Vue 2 form item logic for selecting custom objects","archived":false,"fork":false,"pushed_at":"2017-02-17T21:20:28.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T09:29:18.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LasseHaslev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-20T15:45:27.000Z","updated_at":"2016-12-20T15:45:37.000Z","dependencies_parsed_at":"2023-05-30T18:00:36.800Z","dependency_job_id":null,"html_url":"https://github.com/LasseHaslev/vue-item-input","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasseHaslev%2Fvue-item-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasseHaslev%2Fvue-item-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasseHaslev%2Fvue-item-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasseHaslev%2Fvue-item-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LasseHaslev","download_url":"https://codeload.github.com/LasseHaslev/vue-item-input/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240356192,"owners_count":19788513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T19:14:50.025Z","updated_at":"2026-06-29T22:30:21.936Z","avatar_url":"https://github.com/LasseHaslev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @lassehaslev/vue-item-input\n\u003e Vue 2 form item logic for selecting custom objects\n\n## Install\nRun ```npm install @lassehaslev/vue-item-input --save``` in your project folder\n\n## Usage\nThis package is divided into two main modules. ```BaseInput``` and ```BaseInputItem```\n\nI am in the middle of a deadline, so I dont got time to write a good documentation today.\n\nPlease check out the [ the source ](https://github.com/LasseHaslev/vue-item-input/tree/master/src/tutorials/components) for documentation in anticipation of a better documentation,\nof how to make use of this simple, but yet powerful component.\n\n**Happy coding**\n\n\n#### Base input\n```js\nimport { BaseInput } from '../../index';\nimport { InputElement } from '../../index';\nimport ImageInputItem from './ImageInputItem';\n\nexport default {\n    template:`\n    \u003cdiv\u003e\n        \u003cdiv v-if=\"multiple\" class=\"columns is-mobile is-multiline\"\u003e\n            \u003cdiv v-for=\"( value, index ) in itemValues\" class=\"column is-2\"\u003e\n                \u003cimage-input-item @select=\"selectValue\" :index=\"index\" :value=\"value\"\u003e\u003c/image-input-item\u003e\n\n                \u003cbutton @click=\"remove( index )\" class=\"button is-danger is-fullwidth\"\u003eRemove\u003c/button\u003e\n            \u003c/div\u003e\n            \u003cdiv class=\"column is-2\" style=\"cursor:pointer;\"\u003e\n                \u003cdiv style=\"background-color:blue; padding-bottom: 100%\" @click=\"addEmptyValue\"\u003e\u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n        \u003cdiv v-else v-for=\"( value, index ) in itemValues\"\u003e\n            \u003cimage-input-item @select=\"selectValue\" :index=\"index\" :value=\"value\"\u003e\u003c/image-input-item\u003e\n            \u003cbutton @click=\"zeroOut( index )\" class=\"button is-warning is-fullwidth\"\u003eEmpty value\u003c/button\u003e\n        \u003c/div\u003e\n        \u003cinput-element :name=\"name\" :values=\"ids\"\u003e\u003c/input-element\u003e\n    \u003c/div\u003e\n    `,\n\n    mixins: [ BaseInput ],\n\n    components: {\n        ImageInputItem,\n        InputElement,\n    }\n}\n```\n#### Base input item\n```js\nimport { BaseInputItem } from '../../index';\nimport ImagePicker from './ImagePicker';\nexport default {\n    template: `\n            \u003cdiv\u003e\n                \u003cdiv @click=\"open\" \n                    style=\"\n                        padding-bottom: 100%;\n                        background-size: contain;\n                        background-position: center;\n                        background-repeat: no-repeat;\n                        background-color: #ccc;\n                        cursor: pointer;\n                        \" :style=\"{\n                            'background-image': value ? 'url(' + value.url + ')' : ''\n                        }\"\u003e\n                \u003c/div\u003e\n                \u003cimage-picker url=\"https://jsonplaceholder.typicode.com/photos?limit=10\"\n                :items-adaptor=\"imagesAdaptor\"\n                :item-adaptor=\"imageAdaptor\"\n                @confirm=\"selectItem\"\n                ref=\"imagePicker\"\u003e\u003c/image-picker\u003e\n            \u003c/div\u003e\n    `,\n\n    mixins: [ BaseInputItem ],\n\n    methods: {\n        open() {\n            this.$refs.imagePicker.open();\n        },\n        imagesAdaptor( images ) {\n            // return images;\n            return images.slice( 0, 20 );\n        },\n        imageAdaptor( image ) {\n            return {\n                id: image.id,\n                url: image.url,\n            };\n        },\n    },\n\n\n    components: {\n        ImagePicker,\n    }\n}\n```\n\n\n## Build Setup\n``` bash\n# install dependencies\nnpm install\n\n# serve with hot reload at localhost:8080\nnpm run dev\n\n# build for production with minification\nnpm run build\n```\n\nFor detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flassehaslev%2Fvue-item-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flassehaslev%2Fvue-item-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flassehaslev%2Fvue-item-input/lists"}