@afeefa/vue-app 0.0.85 → 0.0.87

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.85
1
+ 0.0.87
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.85",
3
+ "version": "0.0.87",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -1,310 +1,14 @@
1
- import { AlertEvent, DialogEvent, LoadingEvent, SaveEvent } from '@a-vue/events'
2
- import { eventBus } from '@a-vue/plugins/event-bus/EventBus'
3
- import { sleep } from '@a-vue/utils/timeout'
4
-
5
- export class GetAction {
6
- action = null
7
- id = null
8
- fields = null
9
- events = true
10
-
11
- setAction (action) {
12
- this.action = action
13
- return this
14
- }
15
-
16
- setId (id) {
17
- this.id = id
18
- return this
19
- }
20
-
21
- setFields (fields) {
22
- this.fields = fields
23
- return this
24
- }
25
-
26
- noEvents (noEvents) {
27
- this.events = noEvents === undefined ? false : !noEvents
28
- return this
29
- }
30
-
31
- async load () {
32
- if (this.events) {
33
- eventBus.dispatch(new LoadingEvent(LoadingEvent.START_LOADING))
34
- }
35
-
36
- const result = await this.action.createRequest()
37
- .params({
38
- id: this.id
39
- })
40
- .fields(this.fields)
41
- .send()
42
-
43
- if (this.events) {
44
- eventBus.dispatch(new LoadingEvent(LoadingEvent.STOP_LOADING))
45
- }
46
-
47
- if (result.error) {
48
- eventBus.dispatch(new AlertEvent(AlertEvent.ERROR, {
49
- headline: 'Die Daten konntent nicht geladen werden.',
50
- message: result.message,
51
- detail: result.detail
52
- }))
53
- }
54
-
55
- return result.data || false
56
- }
57
- }
58
-
59
- export class SaveAction {
60
- action = null
61
- id = null
62
- fields = null
63
- data = null
64
- afterSaveHook = null
65
- returnAfterSaveHookResult = false
66
- dialog = null
67
-
68
- setAction (action) {
69
- this.action = action
70
- return this
71
- }
72
-
73
- setId (id) {
74
- this.id = id
75
- return this
76
- }
77
-
78
- setFields (fields) {
79
- this.fields = fields
80
- return this
81
- }
82
-
83
- setData (data) {
84
- this.data = data
85
- return this
86
- }
87
-
88
- setAfterSaveHook (afterSaveHook, returnAfterSaveHookResult = false) {
89
- this.afterSaveHook = afterSaveHook
90
- this.returnAfterSaveHookResult = returnAfterSaveHookResult
91
- return this
92
- }
93
-
94
- setDialog (dialog) {
95
- this.dialog = dialog
96
- return this
97
- }
98
-
99
- async save () {
100
- if (this.dialog) {
101
- const result = await eventBus.dispatch(new DialogEvent(DialogEvent.SHOW, this.dialog))
102
-
103
- if (result !== DialogEvent.RESULT_YES) {
104
- return null
105
- }
106
- }
107
-
108
- eventBus.dispatch(new SaveEvent(SaveEvent.START_SAVING))
109
-
110
- const startTime = Date.now()
111
-
112
- const result = await this.action.createRequest()
113
- .params({
114
- id: this.id || undefined
115
- })
116
- .fields(this.fields)
117
- .data(this.data)
118
- .send()
119
-
120
- const model = result.data
121
-
122
- let afterSaveHookResult = null
123
-
124
- if (!result.error) {
125
- if (this.afterSaveHook) {
126
- afterSaveHookResult = await this.afterSaveHook(model)
127
- }
128
- }
129
-
130
- const diffTime = Date.now() - startTime
131
- const restTime = Math.max(0, 400 - diffTime)
132
- if (restTime) {
133
- await sleep(restTime / 1000)
134
- }
135
-
136
- eventBus.dispatch(new SaveEvent(SaveEvent.STOP_SAVING))
137
-
138
- if (result.error) {
139
- eventBus.dispatch(new SaveEvent(SaveEvent.STOP_SAVING))
140
-
141
- eventBus.dispatch(new AlertEvent(AlertEvent.ERROR, {
142
- headline: 'Die Daten wurden nicht gespeichert',
143
- message: result.message,
144
- detail: result.detail
145
- }))
146
- return null
147
- }
148
-
149
- eventBus.dispatch(new AlertEvent(AlertEvent.MESSAGE, {
150
- message: 'Die Daten wurden gespeichert.'
151
- }))
152
-
153
- if (this.returnAfterSaveHookResult) {
154
- return afterSaveHookResult
155
- }
156
-
157
- return model
158
- }
159
- }
160
-
161
- export class RemoveAction {
162
- action = null
163
- id = null
164
- fields = null
165
- afterRemoveHook = null
166
- dialog = null
167
-
168
- setAction (action) {
169
- this.action = action
170
- return this
171
- }
172
-
173
- setId (id) {
174
- this.id = id
175
- return this
176
- }
177
-
178
- setAfterRemoveHook (afterRemoveHook) {
179
- this.afterRemoveHook = afterRemoveHook
180
- return this
181
- }
182
-
183
- setDialog (dialog) {
184
- this.dialog = dialog
185
- return this
186
- }
187
-
188
- async delete () {
189
- const result = await eventBus.dispatch(new DialogEvent(DialogEvent.SHOW, this.dialog))
190
-
191
- if (result === DialogEvent.RESULT_YES) {
192
- eventBus.dispatch(new SaveEvent(SaveEvent.START_SAVING))
193
-
194
- const startTime = Date.now()
195
-
196
- const result = await this.action.createRequest()
197
- .params({
198
- id: this.id
199
- })
200
- .data(null)
201
- .send()
202
-
203
- if (this.afterRemoveHook) {
204
- await this.afterRemoveHook()
205
- }
206
-
207
- const diffTime = Date.now() - startTime
208
- const restTime = Math.max(0, 400 - diffTime)
209
- if (restTime) {
210
- await sleep(restTime / 1000)
211
- }
212
-
213
- eventBus.dispatch(new SaveEvent(SaveEvent.STOP_SAVING))
214
-
215
- if (result) {
216
- eventBus.dispatch(new AlertEvent(AlertEvent.MESSAGE, {
217
- message: 'Die Daten wurden gelöscht.'
218
- }))
219
- return true
220
- } else {
221
- eventBus.dispatch(new AlertEvent(AlertEvent.ERROR, {
222
- message: 'Die Daten wurden nicht gelöscht.'
223
- }))
224
- }
225
- }
226
- return false
227
- }
228
- }
229
-
230
- export class ListAction {
231
- action = null
232
- request = null
233
- params = {}
234
- fields = {}
235
- filters = {}
236
- events = true
237
-
238
- setAction (action) {
239
- this.action = action
240
- return this
241
- }
242
-
243
- setRequest (request) {
244
- this.request = request
245
- return this
246
- }
247
-
248
- setParams (params) {
249
- this.params = params
250
- return this
251
- }
252
-
253
- setFields (fields) {
254
- this.fields = fields
255
- return this
256
- }
257
-
258
- setFilters (filters) {
259
- this.filters = filters
260
- return this
261
- }
262
-
263
- noEvents (noEvents) {
264
- this.events = noEvents === undefined ? false : !noEvents
265
- return this
266
- }
267
-
268
- async load () {
269
- if (this.events) {
270
- eventBus.dispatch(new LoadingEvent(LoadingEvent.START_LOADING))
271
- }
272
-
273
- if (!this.request) {
274
- this.request = this.action.createRequest()
275
- .params(this.params)
276
- .fields(this.fields)
277
- .filters(this.filters)
278
- }
279
-
280
- const result = await this.request.send()
281
-
282
- if (result.error) {
283
- if (this.events) {
284
- eventBus.dispatch(new LoadingEvent(LoadingEvent.STOP_LOADING))
285
- }
286
-
287
- eventBus.dispatch(new AlertEvent(AlertEvent.ERROR, {
288
- headline: 'Die Daten konntent nicht geladen werden.',
289
- message: result.message,
290
- detail: result.detail
291
- }))
292
-
293
- return false
294
- }
295
-
296
- const models = result.data
297
- const meta = result.meta
298
-
299
- // await sleep(2)
300
-
301
- if (this.events) {
302
- eventBus.dispatch(new LoadingEvent(LoadingEvent.STOP_LOADING))
303
- }
304
-
305
- return {
306
- models,
307
- meta
308
- }
309
- }
1
+ import { BulkAction, SequentialBulkAction } from './ApiAction'
2
+ import { DeleteAction } from './DeleteAction'
3
+ import { GetAction } from './GetAction'
4
+ import { ListAction } from './ListAction'
5
+ import { SaveAction } from './SaveAction'
6
+
7
+ export {
8
+ BulkAction,
9
+ SequentialBulkAction,
10
+ ListAction,
11
+ GetAction,
12
+ SaveAction,
13
+ DeleteAction
310
14
  }
@@ -4,9 +4,13 @@ export class DeleteAction extends ApiAction {
4
4
  _minDuration = 400
5
5
 
6
6
  delete () {
7
+ return this.execute()
8
+ }
9
+
10
+ execute () {
7
11
  this.data(null)
8
12
 
9
- return this.execute()
13
+ return super.execute()
10
14
  }
11
15
 
12
16
  async afterRequest () {
@@ -105,7 +105,7 @@ export default class AAlert extends Vue {
105
105
  font-size: 2rem;
106
106
  }
107
107
 
108
- ::v-deep {
108
+ :deep() {
109
109
  .v-snack__wrapper {
110
110
  width: 500px;
111
111
  // margin-top: 1rem;
@@ -36,7 +36,7 @@ export default class ABadge extends Vue {
36
36
 
37
37
 
38
38
  <style scoped lang="scss">
39
- ::v-deep .v-badge__badge {
39
+ :deep(.v-badge__badge) {
40
40
  color: #666666;
41
41
  }
42
42
  </style>
@@ -55,7 +55,7 @@ export default class AContextMenuItem extends Vue {
55
55
  background-color: #EEEEEE;
56
56
  }
57
57
 
58
- ::v-deep .v-icon {
58
+ :deep(.v-icon) {
59
59
  display: block;
60
60
  text-align: center;
61
61
  margin-right: 0.5rem;
@@ -146,7 +146,7 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin) {
146
146
 
147
147
 
148
148
  <style lang="scss" scoped>
149
- ::v-deep .v-select__slot {
149
+ :deep(.v-select__slot) {
150
150
  cursor: pointer;
151
151
  input {
152
152
  cursor: pointer;
@@ -233,7 +233,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
233
233
  padding: .8rem 1rem !important;
234
234
  }
235
235
 
236
- ::v-deep .v-dialog {
236
+ :deep(.v-dialog) {
237
237
  position: absolute;
238
238
  top: 0;
239
239
  left: 0;
@@ -23,6 +23,19 @@
23
23
 
24
24
  <v-card v-if="modal">
25
25
  <v-card-title v-if="title">
26
+ <v-avatar
27
+ v-if="icon"
28
+ color="#F4F4F4"
29
+ size="2rem"
30
+ class="mr-2"
31
+ >
32
+ <v-icon
33
+ :color="icon.color"
34
+ size="1.2rem"
35
+ v-text="icon.icon"
36
+ />
37
+ </v-avatar>
38
+
26
39
  {{ title }}
27
40
  </v-card-title>
28
41
 
@@ -43,7 +56,7 @@ import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
43
56
  import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
44
57
 
45
58
  @Component({
46
- props: ['show', 'title', 'beforeClose', 'triggerClass', 'anchorPosition']
59
+ props: ['show', 'icon', 'title', 'beforeClose', 'triggerClass', 'anchorPosition']
47
60
  })
48
61
  export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentWidthMixin, CancelOnEscMixin) {
49
62
  modalId = randomCssClass(10)
@@ -189,7 +202,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
189
202
  color: inherit !important;
190
203
  }
191
204
 
192
- ::v-deep .v-dialog {
205
+ :deep(.v-dialog) {
193
206
  position: absolute;
194
207
  top: 0;
195
208
  left: 0;
@@ -33,7 +33,7 @@ export default class APagination extends Vue {
33
33
 
34
34
 
35
35
  <style scoped lang="scss">
36
- ::v-deep .v-pagination {
36
+ :deep(.v-pagination) {
37
37
  gap: .3rem;
38
38
  .v-pagination__item,
39
39
  .v-pagination__more,
@@ -68,7 +68,7 @@ export default class ARadioGroup extends Vue {
68
68
  margin: 0;
69
69
 
70
70
  &:not(.hasLabel) {
71
- ::v-deep legend {
71
+ :deep(legend) {
72
72
  display: none;
73
73
  }
74
74
  }
@@ -200,10 +200,8 @@ export default class ARichTextArea extends Vue {
200
200
 
201
201
  <style lang="scss" scoped>
202
202
  .a-rich-text-editor {
203
- ::v-deep .ProseMirror {
204
- &-focused {
203
+ :deep(.ProseMirror-focused) {
205
204
  outline: none;
206
- }
207
205
  }
208
206
  }
209
207
 
@@ -226,14 +224,14 @@ export default class ARichTextArea extends Vue {
226
224
  box-shadow: none;
227
225
  border-radius: 0;
228
226
 
229
- ::v-deep .v-icon {
227
+ :deep(.v-icon) {
230
228
  font-size: 20px;
231
229
  width: 20px;
232
230
  height: 20px;
233
231
  }
234
232
 
235
233
  &.strike {
236
- ::v-deep .v-icon {
234
+ :deep(.v-icon) {
237
235
  width: 15px;
238
236
  }
239
237
  }
@@ -251,7 +249,7 @@ export default class ARichTextArea extends Vue {
251
249
  }
252
250
  }
253
251
 
254
- ::v-deep .ProseMirror {
252
+ :deep(.ProseMirror) {
255
253
  min-height: 200px;
256
254
 
257
255
  > :last-child {
@@ -319,7 +319,7 @@ export default class ASearchSelect extends Mixins(ComponentWidthMixin, UsesPosit
319
319
  display: block;
320
320
  padding: 0 .5rem;
321
321
 
322
- ::v-deep .a-row {
322
+ :deep(.a-row) {
323
323
  overflow: unset;
324
324
  }
325
325
  }
@@ -334,7 +334,7 @@ export default class ASearchSelect extends Mixins(ComponentWidthMixin, UsesPosit
334
334
  overflow-x: hidden;
335
335
  overscroll-behavior: contain;
336
336
 
337
- ::v-deep .a-table-row {
337
+ :deep(.a-table-row) {
338
338
  &:not(.selected) {
339
339
  cursor: pointer;
340
340
  }
@@ -48,7 +48,7 @@ export default class ATable extends Vue {
48
48
  > * {
49
49
  display: table-row;
50
50
 
51
- > ::v-deep * {
51
+ > :deep(*) {
52
52
  display: table-cell;
53
53
 
54
54
  white-space: nowrap;
@@ -38,7 +38,7 @@ export default class ATextArea extends Vue {
38
38
 
39
39
 
40
40
  <style lang="scss" scoped>
41
- .v-input:not(.v-input--is-focused) ::v-deep .v-counter {
41
+ .v-input:not(.v-input--is-focused) :deep(.v-counter) {
42
42
  display: none;
43
43
  }
44
44
  </style>
@@ -100,7 +100,7 @@ export default class ATextField extends Mixins(ComponentWidthMixin) {
100
100
 
101
101
 
102
102
  <style lang="scss" scoped>
103
- .v-input:not(.v-input--is-focused) ::v-deep .v-counter {
103
+ .v-input:not(.v-input--is-focused) :deep(.v-counter) {
104
104
  display: none;
105
105
  }
106
106
  </style>
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <a-modal
3
- :title="title"
4
3
  :beforeClose="beforeClose"
5
4
  :show.sync="show_"
6
5
  v-bind="$attrs"
@@ -61,7 +60,7 @@ import { Component, Vue, Watch } from '@a-vue'
61
60
  import { DialogEvent } from '@a-vue/events'
62
61
 
63
62
  @Component({
64
- props: ['model', 'createModelToEdit', 'title', 'show']
63
+ props: ['model', 'createModelToEdit', 'show']
65
64
  })
66
65
  export default class EditModal extends Vue {
67
66
  show_ = false
@@ -58,9 +58,8 @@ export class FormFieldMixin extends Vue {
58
58
  .addParams(this.optionRequestParams || {})
59
59
  .addFilters(filters)
60
60
 
61
- const {models} = await new ListAction()
62
- .setRequest(request)
63
- .noEvents()
61
+ const {models} = await ListAction
62
+ .fromRequest(request)
64
63
  .load()
65
64
 
66
65
  return models.map(model => ({
@@ -20,7 +20,7 @@ export default class ListFilterRow extends Vue {
20
20
 
21
21
 
22
22
  <style scoped lang="scss">
23
- ::v-deep .v-text-field__details {
23
+ :deep(.v-text-field__details) {
24
24
  display: none;
25
25
  }
26
26
  </style>
@@ -143,9 +143,9 @@ export class ListViewMixin extends Vue {
143
143
 
144
144
  const request = this.listViewModel.getApiRequest()
145
145
 
146
- const {models, meta} = await new ListAction()
147
- .setRequest(request)
148
- .noEvents(!this.events)
146
+ const {models, meta} = await ListAction
147
+ .fromRequest(request)
148
+ .dispatchGlobalLoadingEvents(this.events)
149
149
  .load()
150
150
 
151
151
  if (!models) { // error happened
@@ -55,9 +55,8 @@ export default class ListFilterSelect extends Mixins(ListFilterMixin) {
55
55
  }
56
56
 
57
57
  async loadRequestOptions () {
58
- const {models} = await new ListAction()
59
- .setRequest(this.filter.createOptionsRequest())
60
- .noEvents()
58
+ const {models} = await ListAction
59
+ .fromRequest(this.filter.createOptionsRequest())
61
60
  .load()
62
61
 
63
62
  return [
@@ -47,7 +47,7 @@ export default class SidebarMenu extends Vue {
47
47
 
48
48
 
49
49
  <style lang="scss" scoped>
50
- ::v-deep .v-list-group {
50
+ :deep(.v-list-group) {
51
51
  > .v-list-item {
52
52
  padding: 0;
53
53
  > .v-list-item {
@@ -206,19 +206,19 @@ export default class SearchSelectFormField extends Vue {
206
206
 
207
207
 
208
208
  <style scoped lang="scss">
209
- .selectedIcon::v-deep {
209
+ .selectedIcon:deep() {
210
210
  padding-right: .3rem !important;
211
211
  }
212
212
 
213
- .selectableIcon::v-deep {
213
+ .selectableIcon:deep() {
214
214
  padding-right: 2rem !important;
215
215
  }
216
216
 
217
- .selectedContent::v-deep {
217
+ .selectedContent:deep() {
218
218
  width: 100%;
219
219
  }
220
220
 
221
- .selectableContent::v-deep {
221
+ .selectableContent:deep() {
222
222
  width: 100%;
223
223
  }
224
224
  </style>
@@ -109,7 +109,7 @@ export default class ListColumnHeader extends Vue {
109
109
  }
110
110
  }
111
111
 
112
- ::v-deep .v-icon {
112
+ :deep(.v-icon) {
113
113
  color: #AAAAAA !important;
114
114
 
115
115
  &.active {
@@ -1,14 +0,0 @@
1
- import { BulkAction, SequentialBulkAction } from './ApiAction'
2
- import { DeleteAction } from './DeleteAction'
3
- import { GetAction } from './GetAction'
4
- import { ListAction } from './ListAction'
5
- import { SaveAction } from './SaveAction'
6
-
7
- export {
8
- BulkAction,
9
- SequentialBulkAction,
10
- ListAction,
11
- GetAction,
12
- SaveAction,
13
- DeleteAction
14
- }