@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.
- package/.afeefa/package/release/version.txt +1 -1
- package/package.json +1 -1
- package/src/api-resources/ApiActions.js +13 -309
- package/src/api-resources/DeleteAction.js +5 -1
- package/src/components/AAlert.vue +1 -1
- package/src/components/ABadge.vue +1 -1
- package/src/components/AContextMenuItem.vue +1 -1
- package/src/components/ADatePicker.vue +1 -1
- package/src/components/ADialog.vue +1 -1
- package/src/components/AModal.vue +15 -2
- package/src/components/APagination.vue +1 -1
- package/src/components/ARadioGroup.vue +1 -1
- package/src/components/ARichTextArea.vue +4 -6
- package/src/components/ASearchSelect.vue +2 -2
- package/src/components/ATable.vue +1 -1
- package/src/components/ATextArea.vue +1 -1
- package/src/components/ATextField.vue +1 -1
- package/src/components/form/EditModal.vue +1 -2
- package/src/components/form/FormFieldMixin.js +2 -3
- package/src/components/list/ListFilterRow.vue +1 -1
- package/src/components/list/ListViewMixin.js +3 -3
- package/src/components/list/filters/ListFilterSelect.vue +2 -3
- package/src-admin/components/SidebarMenu.vue +1 -1
- package/src-admin/components/controls/SearchSelectFormField.vue +4 -4
- package/src-admin/components/list/ListColumnHeader.vue +1 -1
- package/src/api-resources/ApiActions2.js +0 -14
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.87
|
package/package.json
CHANGED
@@ -1,310 +1,14 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
}
|
@@ -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
|
-
|
205
|
+
:deep(.v-dialog) {
|
193
206
|
position: absolute;
|
194
207
|
top: 0;
|
195
208
|
left: 0;
|
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
337
|
+
:deep(.a-table-row) {
|
338
338
|
&:not(.selected) {
|
339
339
|
cursor: pointer;
|
340
340
|
}
|
@@ -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)
|
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', '
|
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
|
62
|
-
.
|
63
|
-
.noEvents()
|
61
|
+
const {models} = await ListAction
|
62
|
+
.fromRequest(request)
|
64
63
|
.load()
|
65
64
|
|
66
65
|
return models.map(model => ({
|
@@ -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
|
147
|
-
.
|
148
|
-
.
|
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
|
59
|
-
.
|
60
|
-
.noEvents()
|
58
|
+
const {models} = await ListAction
|
59
|
+
.fromRequest(this.filter.createOptionsRequest())
|
61
60
|
.load()
|
62
61
|
|
63
62
|
return [
|
@@ -206,19 +206,19 @@ export default class SearchSelectFormField extends Vue {
|
|
206
206
|
|
207
207
|
|
208
208
|
<style scoped lang="scss">
|
209
|
-
.selectedIcon
|
209
|
+
.selectedIcon:deep() {
|
210
210
|
padding-right: .3rem !important;
|
211
211
|
}
|
212
212
|
|
213
|
-
.selectableIcon
|
213
|
+
.selectableIcon:deep() {
|
214
214
|
padding-right: 2rem !important;
|
215
215
|
}
|
216
216
|
|
217
|
-
.selectedContent
|
217
|
+
.selectedContent:deep() {
|
218
218
|
width: 100%;
|
219
219
|
}
|
220
220
|
|
221
|
-
.selectableContent
|
221
|
+
.selectableContent:deep() {
|
222
222
|
width: 100%;
|
223
223
|
}
|
224
224
|
</style>
|
@@ -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
|
-
}
|