Repo for the search and displace core module including the interface to select files and search and displace operations to run on them. https://searchanddisplace.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.8 KiB

  1. <template>
  2. <Fieldset :legend="displayName" :toggleable="true" class="filter-container">
  3. <div v-for="option of optionsList" :key="option.name" class="filter-option">
  4. <h5>{{ option.name }}</h5>
  5. <SelectButton
  6. :key="option.name"
  7. v-model="selectedOption"
  8. :options="option.list"
  9. optionLabel="name" />
  10. </div>
  11. </Fieldset>
  12. </template>
  13. <script lang="ts">
  14. import { Vue, Component, Prop } from 'vue-property-decorator';
  15. import { FilterOptions } from '../../interfaces/FilterOptions';
  16. @Component
  17. export default class Filter extends Vue {
  18. @Prop(String)
  19. public readonly id!: string;
  20. @Prop(String)
  21. public readonly displayName!: string;
  22. @Prop({ default: [] })
  23. public readonly options!: FilterOptions;
  24. private optionsList = new Array;
  25. public selectedOption = null;
  26. public created()
  27. {
  28. for (let index in this.options) {
  29. let words = index.split('_');
  30. for (let i = 0; i < words.length; i++) {
  31. words[i] = words[i].charAt(0).toUpperCase() + words[i].substr(1);
  32. }
  33. let option = {
  34. name: words.join(' '),
  35. list: new Array
  36. };
  37. this.options[index].forEach( opt => {
  38. option.list.push({
  39. 'name': opt,
  40. 'value': opt
  41. });
  42. });
  43. this.optionsList.push(option);
  44. }
  45. }
  46. }
  47. </script>
  48. <style lang="scss">
  49. .filter-container,
  50. .filter-option {
  51. margin-bottom: 10px;
  52. }
  53. </style>