@afeefa/vue-app 0.0.53 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/.afeefa/package/release/version.txt +1 -1
  2. package/package.json +3 -10
  3. package/src/api-resources/ApiActions.js +31 -0
  4. package/src/components/AAlert.vue +1 -1
  5. package/src/components/AAutocomplete.vue +1 -1
  6. package/src/components/ABadge.vue +1 -1
  7. package/src/components/ABreadcrumbs.vue +1 -1
  8. package/src/components/ACheckbox.vue +35 -0
  9. package/src/components/AContextMenu.vue +2 -2
  10. package/src/components/AContextMenuItem.vue +2 -2
  11. package/src/components/ADatePicker.vue +1 -1
  12. package/src/components/ADialog.vue +3 -1
  13. package/src/components/AGrid.vue +2 -1
  14. package/src/components/AIcon.vue +1 -1
  15. package/src/components/AIconButton.vue +1 -1
  16. package/src/components/ALoadingIndicator.vue +1 -1
  17. package/src/components/AModal.vue +1 -1
  18. package/src/components/APagination.vue +1 -1
  19. package/src/components/ARadioGroup.vue +1 -1
  20. package/src/components/ARichTextArea.vue +257 -0
  21. package/src/components/ARow.vue +1 -1
  22. package/src/components/ASaveIndicator.vue +1 -1
  23. package/src/components/ASearchSelect.vue +34 -18
  24. package/src/components/ASelect.vue +1 -1
  25. package/src/components/ATable.vue +1 -1
  26. package/src/components/ATableHeader.vue +1 -1
  27. package/src/components/ATableRow.vue +1 -1
  28. package/src/components/ATextArea.vue +1 -1
  29. package/src/components/ATextField.vue +1 -1
  30. package/src/components/form/EditForm.vue +2 -6
  31. package/src/components/form/EditModal.vue +23 -18
  32. package/src/components/form/FormFieldMixin.js +2 -3
  33. package/src/components/form/fields/FormFieldCheckbox.vue +18 -0
  34. package/src/components/form/fields/FormFieldDate.vue +1 -1
  35. package/src/components/form/fields/FormFieldRadioGroup.vue +1 -1
  36. package/src/components/form/fields/FormFieldRichTextArea.vue +14 -0
  37. package/src/components/form/fields/FormFieldSearchSelect.vue +1 -1
  38. package/src/components/form/fields/FormFieldSelect.vue +1 -1
  39. package/src/components/form/fields/FormFieldSelect2.vue +1 -1
  40. package/src/components/form/fields/FormFieldText.vue +1 -1
  41. package/src/components/form/fields/FormFieldTextArea.vue +1 -1
  42. package/src/components/index.js +4 -0
  43. package/src/components/list/ListFilterMixin.js +1 -1
  44. package/src/components/list/ListFilterRow.vue +1 -1
  45. package/src/components/list/ListViewMixin.js +7 -4
  46. package/src/components/list/filters/ListFilterPage.vue +1 -1
  47. package/src/components/list/filters/ListFilterSearch.vue +1 -1
  48. package/src/components/list/filters/ListFilterSelect.vue +1 -1
  49. package/src/components/mixins/ClickOutsideMixin.js +1 -1
  50. package/src/components/mixins/ComponentWidthMixin.js +1 -1
  51. package/src/components/search-select/SearchSelectFilters.vue +1 -1
  52. package/src/components/search-select/SearchSelectList.vue +13 -3
  53. package/src/components/vue/Component.js +46 -0
  54. package/src/index.js +4 -0
  55. package/src/plugins/api-resources/ApiResourcesPlugin.js +12 -0
  56. package/src/plugins/route-config/RouteConfigPlugin.js +25 -1
  57. package/src/services/escape/CancelOnEscMixin.js +1 -1
  58. package/src/services/position/UsesPositionServiceMixin.js +1 -1
  59. package/src/styles/forms.scss +8 -0
  60. package/src/styles/vue-app.scss +1 -0
  61. package/src-admin/bootstrap.js +2 -5
  62. package/src-admin/components/App.vue +1 -1
  63. package/src-admin/components/NotFound.vue +65 -0
  64. package/src-admin/components/SidebarMenu.vue +1 -1
  65. package/src-admin/components/Splash.vue +34 -34
  66. package/src-admin/components/Start.vue +2 -2
  67. package/src-admin/components/app/AppBarButton.vue +1 -1
  68. package/src-admin/components/app/AppBarButtons.vue +1 -1
  69. package/src-admin/components/app/AppBarTitle.vue +1 -1
  70. package/src-admin/components/app/AppBarTitleContainer.vue +1 -1
  71. package/src-admin/components/controls/SearchSelectFormField.vue +223 -0
  72. package/src-admin/components/detail/DetailProperty.vue +2 -4
  73. package/src-admin/components/list/ListColumnHeader.vue +5 -4
  74. package/src-admin/components/list/ListTitle.vue +1 -1
  75. package/src-admin/components/list/ListView.vue +12 -10
  76. package/src-admin/components/menu/SidebarMenuItem.vue +1 -1
  77. package/src-admin/components/model/ModelCount.vue +1 -1
  78. package/src-admin/components/model/ModelIcon.vue +1 -1
  79. package/src-admin/components/pages/CreatePage.vue +2 -3
  80. package/src-admin/components/pages/DetailPage.vue +4 -4
  81. package/src-admin/components/pages/EditPage.vue +5 -6
  82. package/src-admin/components/pages/EditPageMixin.js +1 -1
  83. package/src-admin/components/pages/ListPage.vue +3 -4
  84. package/src-admin/components/routes/CreateRoute.vue +1 -1
  85. package/src-admin/components/routes/DetailRoute.vue +4 -4
  86. package/src-admin/components/routes/EditRoute.vue +4 -4
  87. package/src-admin/components/routes/ListRoute.vue +4 -4
  88. package/src-admin/config/vuetify.js +3 -1
  89. package/src-admin/models/Model.js +13 -0
  90. package/src-admin/models/ModelAdminConfig.js +20 -0
  91. package/src-components/AMdiIcon.vue +18 -0
  92. package/src/utils/props-helper.js +0 -21
@@ -16,6 +16,7 @@
16
16
  <div
17
17
  v-if="isOpen"
18
18
  class="controls"
19
+ :style="cwm_widthStyle"
19
20
  >
20
21
  <div class="background elevation-6" />
21
22
 
@@ -44,14 +45,17 @@
44
45
  <div :class="listCssClass">
45
46
  <search-select-list
46
47
  v-if="isOpen"
47
- v-bind="listConfig"
48
+ :listViewConfig="listViewConfig"
48
49
  :q="q"
50
+ :selectedItems="selectedItems"
49
51
  :events="false"
50
52
  :history="false"
51
53
  :filterSource="filterSource"
52
54
  :loadOnlyIfKeyword="_loadOnlyIfKeyword"
55
+ :filters.sync="filters"
53
56
  :count.sync="count"
54
57
  :isLoading.sync="isLoading"
58
+ :style="cwm_widthStyle"
55
59
  >
56
60
  <template #header>
57
61
  <div />
@@ -60,19 +64,11 @@
60
64
  </template>
61
65
 
62
66
  <template #row="{ model }">
63
- <v-icon
64
- :color="model.getIcon().color"
65
- size="1.5rem"
66
- v-text="model.getIcon().icon"
67
- />
68
-
69
67
  <slot
70
68
  name="row"
71
69
  :model="model"
72
70
  :on="{ click: selectHandler(model) }"
73
71
  />
74
-
75
- <div class="lastColumn" />
76
72
  </template>
77
73
 
78
74
  <template #not-found="{ filters }">
@@ -88,7 +84,7 @@
88
84
 
89
85
 
90
86
  <script>
91
- import { Component, Watch, Mixins } from 'vue-property-decorator'
87
+ import { Component, Watch, Mixins } from '@a-vue'
92
88
  import { UsesPositionServiceMixin } from '../services/position/UsesPositionServiceMixin'
93
89
  import { PositionConfig } from '../services/PositionService'
94
90
  import { randomCssClass } from '../utils/random'
@@ -96,15 +92,25 @@ import { FilterSourceType } from '@a-vue/components/list/FilterSourceType'
96
92
  import SearchSelectFilters from './search-select/SearchSelectFilters'
97
93
  import SearchSelectList from './search-select/SearchSelectList'
98
94
  import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
95
+ import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
99
96
 
100
97
  @Component({
101
- props: ['listConfig', 'q', 'width', 'closeOnSelect', 'loadOnlyIfKeyword'],
98
+ props: [
99
+ 'listViewConfig',
100
+ 'q',
101
+ 'width',
102
+ 'closeOnSelect',
103
+ 'loadOnlyIfKeyword',
104
+ {
105
+ selectedItems: []
106
+ }
107
+ ],
102
108
  components: {
103
109
  SearchSelectFilters,
104
110
  SearchSelectList
105
111
  }
106
112
  })
107
- export default class ASearchSelect extends Mixins(UsesPositionServiceMixin, CancelOnEscMixin) {
113
+ export default class ASearchSelect extends Mixins(ComponentWidthMixin, UsesPositionServiceMixin, CancelOnEscMixin) {
108
114
  selectId = randomCssClass(10)
109
115
  isOpen = false
110
116
  items_ = []
@@ -196,7 +202,7 @@ export default class ASearchSelect extends Mixins(UsesPositionServiceMixin, Canc
196
202
  p
197
203
  .anchorTop()
198
204
  .targetBottom()
199
- .diffY('-1rem')
205
+ .diffY('-.5rem')
200
206
  })
201
207
  .onPosition(this.onListPositionChanged)
202
208
 
@@ -307,24 +313,34 @@ export default class ASearchSelect extends Mixins(UsesPositionServiceMixin, Canc
307
313
  }
308
314
 
309
315
  .controls {
310
- min-width: 400px;
316
+ width: 400px;
311
317
  position: absolute;
312
318
  z-index: 300;
313
319
  display: block;
314
- padding: 0 0.5rem;
320
+ padding: 0 .5rem;
321
+
322
+ ::v-deep .a-row {
323
+ overflow: unset;
324
+ }
315
325
  }
316
326
 
317
327
  .searchSelectList {
318
- min-width: 400px;
328
+ width: 400px;
319
329
  position: absolute;
320
330
  z-index: 301;
321
331
 
322
332
  max-height: 40vh;
323
333
  overflow-y: auto;
334
+ overflow-x: hidden;
324
335
  overscroll-behavior: contain;
325
336
 
326
- ::v-deep .a-table-row > * {
327
- cursor: pointer;
337
+ ::v-deep .a-table-row {
338
+ &:not(.selected) {
339
+ cursor: pointer;
340
+ }
341
+ &.selected {
342
+ pointer-events: none;
343
+ }
328
344
  }
329
345
  }
330
346
 
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
  <script>
15
- import { Component, Mixins, Watch } from 'vue-property-decorator'
15
+ import { Component, Mixins, Watch } from '@a-vue'
16
16
  import { Model } from '@afeefa/api-resources-client'
17
17
  import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
18
18
 
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
  <script>
9
- import { Component, Vue } from 'vue-property-decorator'
9
+ import { Component, Vue } from '@a-vue'
10
10
 
11
11
  @Component({
12
12
  props: ['width', 'fixed']
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
  <script>
9
- import { Component, Vue } from 'vue-property-decorator'
9
+ import { Component, Vue } from '@a-vue'
10
10
 
11
11
  @Component({
12
12
  props: ['small']
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
  <script>
12
- import { Component, Vue } from 'vue-property-decorator'
12
+ import { Component, Vue } from '@a-vue'
13
13
 
14
14
  @Component({
15
15
  props: ['small', 'selected']
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
  <script>
13
- import { Component, Vue } from 'vue-property-decorator'
13
+ import { Component, Vue } from '@a-vue'
14
14
 
15
15
  @Component({
16
16
  props: ['validator']
@@ -15,7 +15,7 @@
15
15
 
16
16
 
17
17
  <script>
18
- import { Component, Watch, Mixins } from 'vue-property-decorator'
18
+ import { Component, Watch, Mixins } from '@a-vue'
19
19
  import { debounce } from '@a-vue/utils/debounce'
20
20
  import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
21
21
 
@@ -8,14 +8,14 @@
8
8
  <slot
9
9
  :changed="changed"
10
10
  :valid="valid"
11
+ :model="model"
11
12
  />
12
13
  </v-form>
13
14
  </template>
14
15
 
15
16
 
16
17
  <script>
17
- import { Component, Vue, Watch } from 'vue-property-decorator'
18
- import { apiResources } from '@afeefa/api-resources-client'
18
+ import { Component, Vue, Watch } from '@a-vue'
19
19
 
20
20
  @Component({
21
21
  props: ['model']
@@ -52,9 +52,5 @@ export default class EditForm extends Vue {
52
52
  changedChanged () {
53
53
  this.$emit('update:changed', this.changed)
54
54
  }
55
-
56
- get type () {
57
- return apiResources.getType(this.model.type)
58
- }
59
55
  }
60
56
  </script>
@@ -21,7 +21,7 @@
21
21
 
22
22
  <template #default="{changed, valid}">
23
23
  <a-row
24
- class="mt-8 mb-2 gap-4"
24
+ class="mt-8 mb-1 pb-1 gap-4"
25
25
  right
26
26
  >
27
27
  <v-btn
@@ -31,23 +31,25 @@
31
31
  Schließen
32
32
  </v-btn>
33
33
 
34
- <v-btn
35
- small
36
- :disabled="!changed || !valid"
37
- color="green white--text"
38
- @click="save"
39
- >
40
- Speichern
41
- </v-btn>
34
+ <a-row gap="2">
35
+ <v-btn
36
+ small
37
+ :disabled="!changed || !valid"
38
+ color="green white--text"
39
+ @click="save"
40
+ >
41
+ Speichern
42
+ </v-btn>
42
43
 
43
- <v-btn
44
- v-if="changed"
45
- small
46
- text
47
- @click="reset"
48
- >
49
- Zurücksetzen
50
- </v-btn>
44
+ <v-icon
45
+ v-if="changed"
46
+ small
47
+ text
48
+ @click="reset"
49
+ >
50
+ {{ undoIcon }}
51
+ </v-icon>
52
+ </a-row>
51
53
  </a-row>
52
54
  </template>
53
55
  </edit-form>
@@ -56,7 +58,8 @@
56
58
 
57
59
 
58
60
  <script>
59
- import { Component, Vue, Watch } from 'vue-property-decorator'
61
+ import { Component, Vue, Watch } from '@a-vue'
62
+ import { mdiRotateLeft} from '@mdi/js'
60
63
 
61
64
  @Component({
62
65
  props: ['model', 'title', 'show']
@@ -64,6 +67,8 @@ import { Component, Vue, Watch } from 'vue-property-decorator'
64
67
  export default class EditModal extends Vue {
65
68
  show_ = false
66
69
 
70
+ undoIcon = mdiRotateLeft
71
+
67
72
  /**
68
73
  * visiblility changes from outside
69
74
  * this will trigger the show_ watcher,
@@ -1,6 +1,5 @@
1
+ import { Component, Vue } from '@a-vue'
1
2
  import { ListAction } from '@a-vue/api-resources/ApiActions'
2
- import { apiResources } from '@afeefa/api-resources-client'
3
- import { Component, Vue } from 'vue-property-decorator'
4
3
 
5
4
  @Component({
6
5
  props: ['name', 'label']
@@ -17,7 +16,7 @@ export class FormFieldMixin extends Vue {
17
16
  }
18
17
 
19
18
  get modelType () {
20
- return apiResources.getType(this.model.type)
19
+ return this.$apiResources.getType(this.model.type)
21
20
  }
22
21
 
23
22
  get field () {
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <a-checkbox
3
+ v-model="model[name]"
4
+ :label="label || name"
5
+ :validator="validator"
6
+ v-bind="$attrs"
7
+ v-on="$listeners"
8
+ />
9
+ </template>
10
+
11
+ <script>
12
+ import { Component, Mixins } from '@a-vue'
13
+ import { FormFieldMixin } from '../FormFieldMixin'
14
+
15
+ @Component
16
+ export default class FormFieldCheckbox extends Mixins(FormFieldMixin) {
17
+ }
18
+ </script>
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script>
11
- import { Component, Mixins } from 'vue-property-decorator'
11
+ import { Component, Mixins } from '@a-vue'
12
12
  import { FormFieldMixin } from '../FormFieldMixin'
13
13
 
14
14
  @Component
@@ -10,7 +10,7 @@
10
10
  </template>
11
11
 
12
12
  <script>
13
- import { Component, Mixins } from 'vue-property-decorator'
13
+ import { Component, Mixins } from '@a-vue'
14
14
  import { FormFieldMixin } from '../FormFieldMixin'
15
15
 
16
16
  @Component
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <a-rich-text-area
3
+ v-model="model[name]"
4
+ />
5
+ </template>
6
+
7
+ <script>
8
+ import { Component, Mixins } from '@a-vue'
9
+ import { FormFieldMixin } from '../FormFieldMixin'
10
+
11
+ @Component
12
+ export default class FormFieldRichTextArea extends Mixins(FormFieldMixin) {
13
+ }
14
+ </script>
@@ -35,7 +35,7 @@
35
35
  </template>
36
36
 
37
37
  <script>
38
- import { Component, Mixins } from 'vue-property-decorator'
38
+ import { Component, Mixins } from '@a-vue'
39
39
  import { FormFieldMixin } from '../FormFieldMixin'
40
40
 
41
41
  @Component({
@@ -13,7 +13,7 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
- import { Component, Mixins } from 'vue-property-decorator'
16
+ import { Component, Mixins } from '@a-vue'
17
17
  import { FormFieldMixin } from '../FormFieldMixin'
18
18
 
19
19
  @Component
@@ -14,7 +14,7 @@
14
14
  </template>
15
15
 
16
16
  <script>
17
- import { Component, Mixins } from 'vue-property-decorator'
17
+ import { Component, Mixins } from '@a-vue'
18
18
  import { FormFieldMixin } from '../FormFieldMixin'
19
19
  import { ComponentWidthMixin } from '../../mixins/ComponentWidthMixin'
20
20
 
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script>
11
- import { Component, Mixins } from 'vue-property-decorator'
11
+ import { Component, Mixins } from '@a-vue'
12
12
  import { FormFieldMixin } from '../FormFieldMixin'
13
13
 
14
14
  @Component
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script>
11
- import { Component, Mixins } from 'vue-property-decorator'
11
+ import { Component, Mixins } from '@a-vue'
12
12
  import { FormFieldMixin } from '../FormFieldMixin'
13
13
 
14
14
  @Component
@@ -2,8 +2,10 @@ import Vue from 'vue'
2
2
 
3
3
  import EditForm from './form/EditForm'
4
4
  import EditModal from './form/EditModal'
5
+ import FormFieldCheckbox from './form/fields/FormFieldCheckbox'
5
6
  import FormFieldDate from './form/fields/FormFieldDate'
6
7
  import FormFieldRadioGroup from './form/fields/FormFieldRadioGroup'
8
+ import FormFieldRichTextArea from './form/fields/FormFieldRichTextArea'
7
9
  import FormFieldSearchSelect from './form/fields/FormFieldSearchSelect'
8
10
  import FormFieldSelect from './form/fields/FormFieldSelect'
9
11
  import FormFieldSelect2 from './form/fields/FormFieldSelect2'
@@ -18,7 +20,9 @@ Vue.component('EditForm', EditForm)
18
20
  Vue.component('EditModal', EditModal)
19
21
  Vue.component('FormFieldText', FormFieldText)
20
22
  Vue.component('FormFieldTextArea', FormFieldTextArea)
23
+ Vue.component('FormFieldRichTextArea', FormFieldRichTextArea)
21
24
  Vue.component('FormFieldRadioGroup', FormFieldRadioGroup)
25
+ Vue.component('FormFieldCheckbox', FormFieldCheckbox)
22
26
  Vue.component('FormFieldDate', FormFieldDate)
23
27
  Vue.component('FormFieldSearchSelect', FormFieldSearchSelect)
24
28
  Vue.component('FormFieldSelect', FormFieldSelect)
@@ -1,4 +1,4 @@
1
- import { Component, Vue } from 'vue-property-decorator'
1
+ import { Component, Vue } from '@a-vue'
2
2
 
3
3
  @Component({
4
4
  props: ['name', 'label']
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
  <script>
12
- import { Component, Vue } from 'vue-property-decorator'
12
+ import { Component, Vue } from '@a-vue'
13
13
 
14
14
  @Component({
15
15
  props: ['gap']
@@ -1,13 +1,12 @@
1
+ import { Component, Vue, Watch } from '@a-vue'
1
2
  import { ListAction } from '@a-vue/api-resources/ApiActions'
2
- import { propsWithDefaults } from '@a-vue/utils/props-helper'
3
3
  import { ListViewModel } from '@afeefa/api-resources-client'
4
- import { Component, Vue, Watch } from 'vue-property-decorator'
5
4
 
6
5
  import { CurrentRouteFilterSource } from './CurrentRouteFilterSource'
7
6
  import { FilterSourceType } from './FilterSourceType'
8
7
 
9
8
  @Component({
10
- ...propsWithDefaults([
9
+ props: [
11
10
  'models', 'meta', // given, if already loaded
12
11
  'listViewConfig',
13
12
  'filterHistoryKey',
@@ -17,7 +16,7 @@ import { FilterSourceType } from './FilterSourceType'
17
16
  events: true,
18
17
  history: true
19
18
  }
20
- ])
19
+ ]
21
20
  })
22
21
  export class ListViewMixin extends Vue {
23
22
  LIST_VIEW = true
@@ -93,6 +92,10 @@ export class ListViewMixin extends Vue {
93
92
  this.load()
94
93
  }
95
94
 
95
+ reload () {
96
+ this.load()
97
+ }
98
+
96
99
  resetFilters () {
97
100
  this.listViewModel.resetFilters()
98
101
  }
@@ -27,7 +27,7 @@
27
27
 
28
28
 
29
29
  <script>
30
- import { Component, Mixins } from 'vue-property-decorator'
30
+ import { Component, Mixins } from '@a-vue'
31
31
  import { ListFilterMixin } from '../ListFilterMixin'
32
32
 
33
33
  @Component({
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
  <script>
15
- import { Component, Mixins } from 'vue-property-decorator'
15
+ import { Component, Mixins } from '@a-vue'
16
16
  import { ListFilterMixin } from '../ListFilterMixin'
17
17
 
18
18
  @Component
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
  <script>
16
- import { Component, Mixins } from 'vue-property-decorator'
16
+ import { Component, Mixins } from '@a-vue'
17
17
  import { ListFilterMixin } from '../ListFilterMixin'
18
18
  import { ListAction } from '@a-vue/api-resources/ApiActions'
19
19
 
@@ -1,4 +1,4 @@
1
- import { Component, Vue } from 'vue-property-decorator'
1
+ import { Component, Vue } from '@a-vue'
2
2
  import { getZIndex } from 'vuetify/lib/util/helpers'
3
3
 
4
4
  @Component
@@ -1,4 +1,4 @@
1
- import { Component, Vue } from 'vue-property-decorator'
1
+ import { Component, Vue } from '@a-vue'
2
2
 
3
3
  @Component({
4
4
  props: ['maxWidth', 'width']
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
  <script>
12
- import { Component, Vue } from 'vue-property-decorator'
12
+ import { Component, Vue } from '@a-vue'
13
13
 
14
14
  @Component({
15
15
  props: ['filters', 'count']
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="searchSelectList">
2
+ <div :class="['searchSelectList', {isLoading}]">
3
3
  <template v-if="models_.length">
4
4
  <a-table v-bind="$attrs">
5
5
  <a-table-header
@@ -13,6 +13,7 @@
13
13
  v-for="model in models_"
14
14
  :key="model.id"
15
15
  small
16
+ :class="{selected: isSelected(model)}"
16
17
  >
17
18
  <slot
18
19
  name="row"
@@ -38,11 +39,11 @@
38
39
 
39
40
 
40
41
  <script>
41
- import { Component, Mixins } from 'vue-property-decorator'
42
+ import { Component, Mixins } from '@a-vue'
42
43
  import { ListViewMixin } from '@a-vue/components/list/ListViewMixin'
43
44
 
44
45
  @Component({
45
- props: ['q']
46
+ props: ['q', 'selectedItems']
46
47
  })
47
48
  export default class SearchSelectList extends Mixins(ListViewMixin) {
48
49
  get hasHeader () {
@@ -58,16 +59,25 @@ export default class SearchSelectList extends Mixins(ListViewMixin) {
58
59
  }
59
60
  }
60
61
 
62
+ isSelected (model) {
63
+ return !!this.selectedItems.find(i => i.equals(model))
64
+ }
65
+
61
66
  _filtersInitialized () {
62
67
  if (this.q) {
63
68
  this.filters.q.value = this.q
64
69
  }
70
+ this.$emit('update:filters', this.filters)
65
71
  }
66
72
  }
67
73
  </script>
68
74
 
69
75
 
70
76
  <style scoped lang="scss">
77
+ .isLoading {
78
+ opacity: .6;
79
+ }
80
+
71
81
  .notFound {
72
82
  padding: 0 .5rem .3rem;
73
83
  }
@@ -0,0 +1,46 @@
1
+ import { Component as VueComponent } from 'vue-property-decorator'
2
+
3
+ const Component = function (options) {
4
+ if (options.props) {
5
+ options.props = propsWithDefaults(options.props)
6
+ }
7
+ return VueComponent(options)
8
+ }
9
+
10
+ Component.registerHooks = VueComponent.registerHooks
11
+
12
+ export { Component }
13
+
14
+ function propsWithDefaults (props) {
15
+ if (props && typeof props === 'object' && props.constructor === Object) {
16
+ return props
17
+ }
18
+
19
+ const normalizedProps = {}
20
+
21
+ for (const prop of props) {
22
+ if (typeof prop === 'object') {
23
+ Object.keys(prop).forEach(subProp => {
24
+ const value = prop[subProp]
25
+ // property: []
26
+ if (Array.isArray(value)) {
27
+ normalizedProps[subProp] = {
28
+ default () { // must be a function according to vue spec
29
+ return value
30
+ }
31
+ }
32
+ // property: { some object }, should be a normal vue props object
33
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
34
+ normalizedProps[subProp] = value
35
+ // property: true, null, ...
36
+ } else {
37
+ normalizedProps[subProp] = { default: value }
38
+ }
39
+ })
40
+ } else {
41
+ normalizedProps[prop] = null
42
+ }
43
+ }
44
+
45
+ return normalizedProps
46
+ }
package/src/index.js CHANGED
@@ -0,0 +1,4 @@
1
+ import './styles/vue-app.scss'
2
+
3
+ export { Mixins, Vue, Watch } from 'vue-property-decorator'
4
+ export { Component } from '@a-vue/components/vue/Component'
@@ -1,6 +1,18 @@
1
1
  import { apiResources } from '@afeefa/api-resources-client'
2
2
 
3
3
  class ApiResourcesPlugin {
4
+ apiResources = apiResources
5
+
6
+ register (models, apis) {
7
+ apiResources
8
+ .registerModels(models)
9
+ .registerApis(apis)
10
+ }
11
+
12
+ schemasLoaded () {
13
+ return apiResources.schemasLoaded()
14
+ }
15
+
4
16
  install (Vue) {
5
17
  Object.defineProperty(Vue.prototype, '$apiResources', {
6
18
  get () {