aloha-vue 1.0.243 → 1.0.245

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.
@@ -130,61 +130,64 @@ export default {
130
130
  isLoadingOptions: false,
131
131
  rowActions: [
132
132
  {
133
- isDivider: true,
133
+ type: "divider",
134
134
  },
135
135
  {
136
- isDivider: true,
136
+ type: "divider",
137
137
  },
138
138
  {
139
- label: "Click me",
139
+ type: "button",
140
+ text: "Click me",
140
141
  title: "Click me title",
141
142
  isHidden: false,
142
143
  callback: this.clickMe,
143
- class: "aloha",
144
+ class: "aloha a_dropdown__item",
144
145
  disabled: false,
145
146
  },
146
147
  {
147
- isDivider: true,
148
+ type: "divider",
148
149
  },
149
150
  {
150
- isDivider: true,
151
+ type: "divider",
151
152
  },
152
153
  {
153
- isDivider: true,
154
+ type: "divider",
154
155
  },
155
156
  {
156
- isDivider: true,
157
+ type: "divider",
157
158
  },
158
159
  {
159
- labelCallback: ({ row, rowIndex }) => `${ rowIndex } Click ${ row.aloha }`,
160
+ type: "button",
161
+ textCallback: ({ row, rowIndex }) => `${ rowIndex } Click ${ row.aloha }`,
160
162
  titleCallback: ({ row, rowIndex }) => `${ rowIndex } Click ${ row.aloha } title`,
161
163
  isHiddenCallback: ({ row, rowIndex }) => !!(rowIndex > 2 && row.aloha),
162
164
  disabledCallback: ({ row, rowIndex }) => !(rowIndex > 2 && row.aloha),
163
165
  callback: this.clickMe,
164
166
  },
165
167
  {
166
- icon: "Export",
168
+ iconLeft: "Export",
167
169
  type: "link",
168
- hrefCallback: ({ row }) => `dokumente/${ row.pk }/download/`,
169
- label: "Dokument herunterladen",
170
+ hrefCallback: ({ row }) => `dokumente/${ row.number }/download/`,
171
+ text: "Dokument herunterladen",
170
172
  target: "_blank",
171
173
  },
172
174
  {
173
- isDivider: true,
175
+ type: "divider",
174
176
  },
175
177
  {
176
- isDivider: true,
178
+ type: "divider",
177
179
  },
178
180
  ],
179
181
  multipleActions: [
180
182
  {
181
- isDivider: true,
183
+ type: "divider",
182
184
  },
183
185
  {
184
- isDivider: true,
186
+ type: "divider",
185
187
  },
186
188
  {
187
- label: "Aloha1",
189
+ type: "button",
190
+ text: "Aloha1",
188
191
  title: "Aloha1 Title",
189
192
  isHidden: false,
190
193
  callback: this.clickMe,
@@ -194,19 +197,20 @@ export default {
194
197
  isAllRowsSelected: true,
195
198
  },
196
199
  {
197
- isDivider: true,
200
+ type: "divider",
198
201
  },
199
202
  {
200
- isDivider: true,
203
+ type: "divider",
201
204
  },
202
205
  {
203
- isDivider: true,
206
+ type: "divider",
204
207
  },
205
208
  {
206
- isDivider: true,
209
+ type: "divider",
207
210
  },
208
211
  {
209
- label: "Aloha1 modal",
212
+ type: "button",
213
+ text: "Aloha1 modal",
210
214
  title: "Aloha1 Title",
211
215
  callback: this.clickMeModal,
212
216
  disabled: false,
@@ -215,71 +219,66 @@ export default {
215
219
  isHiddenCallback: this.isHiddenMultiple,
216
220
  },
217
221
  {
218
- isDivider: true,
222
+ type: "divider",
219
223
  },
220
224
  {
221
- isDivider: true,
225
+ type: "divider",
222
226
  },
223
227
  ],
224
228
  tableActions: [
225
229
  {
226
- label: "Aloha1",
230
+ text: "Aloha1",
227
231
  title: "Aloha1 Title",
228
232
  isHidden: false,
229
233
  callback: this.clickMe,
230
- disabled: true,
231
234
  type: "button",
232
235
  class: "a_btn a_btn_primary",
233
- icon: "Plus",
236
+ iconLeft: "Plus",
234
237
  id: "aloha_1"
235
238
  },
236
239
  {
237
- label: "Aloha2",
240
+ type: "divider",
241
+ },
242
+ {
243
+ text: "Aloha2",
238
244
  title: "Aloha2 Title",
239
245
  callback: this.clickMe,
240
246
  disabled: false,
241
247
  class: "a_btn a_btn_secondary",
242
- id: "aloha_2"
248
+ id: "aloha_2",
249
+ type: "button",
243
250
  },
244
251
  {
245
- label: "Aloha link to",
252
+ type: "divider",
253
+ },
254
+ {
255
+ text: "Aloha link to",
246
256
  title: "Aloha link Title",
247
257
  disabled: false,
248
258
  class: "a_btn a_btn_secondary",
249
259
  type: "link",
260
+ iconRight: "Plus",
250
261
  to: "/spinner",
251
262
  },
252
263
  {
253
- label: "Aloha link href",
264
+ text: "Aloha link href",
254
265
  title: "Aloha link Title",
255
266
  disabled: false,
256
267
  class: "a_btn a_btn_secondary",
257
268
  type: "link",
258
269
  href: "/spinner",
259
- icon: "Plus",
270
+ iconLeft: "Plus",
260
271
  },
261
272
  {
262
- title: "Aloha link Title",
263
- disabled: false,
264
- class: "a_btn a_btn_secondary",
265
- type: "link",
266
- href: "/spinner",
267
- icon: "Plus",
273
+ type: "divider",
268
274
  },
269
275
  {
270
- label: "Aloha3",
271
- title: "Aloha3 Title",
276
+ text: "Aloha link Title",
272
277
  disabled: false,
273
- type: "dropdown",
274
278
  class: "a_btn a_btn_secondary",
275
- children: [
276
- {
277
- label: "Aloha4",
278
- title: "Aloha4 Title",
279
- callback: this.clickMe,
280
- disabled: false,
281
- },
282
- ],
279
+ type: "link",
280
+ href: "/spinner",
281
+ iconLeft: "Plus",
283
282
  },
284
283
  ],
285
284
  modelQuickSearch: "",
@@ -16,7 +16,7 @@ div
16
16
  :filters="filters"
17
17
  :rows-footer="rowsFooter"
18
18
  :is-loading-table="false"
19
- :is-loading-multiple-actions="true"
19
+ :is-loading-multiple-actions="false"
20
20
  :views="views"
21
21
  :model-view="modelView"
22
22
  v-model:modelQuickSearch="modelQuickSearch"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.243",
4
+ "version": "1.0.245",
5
5
  "author": "Ilia Brykin",
6
6
  "scripts": {
7
7
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1"
@@ -7,7 +7,6 @@ import ASpinner from "../ASpinner/ASpinner";
7
7
  import ATranslation from "../ATranslation/ATranslation";
8
8
 
9
9
  import ClickAPI from "./comositionAPI/ClickAPI";
10
- import IconAPI from "./comositionAPI/IconAPI";
11
10
  import LoadingAPI from "./comositionAPI/LoadingAPI";
12
11
  import TextAPI from "./comositionAPI/TextAPI";
13
12
  import TitleAPI from "./comositionAPI/TitleAPI";
@@ -82,16 +81,15 @@ export default {
82
81
  default: "right",
83
82
  validator: value => ["right", "left"].indexOf(value) !== -1,
84
83
  },
85
- icon: {
84
+ iconLeft: {
86
85
  type: String,
87
86
  required: false,
88
87
  default: undefined,
89
88
  },
90
- iconAlign: {
89
+ iconRight: {
91
90
  type: String,
92
91
  required: false,
93
- default: "left",
94
- validator: value => ["right", "left"].indexOf(value) !== -1,
92
+ default: undefined,
95
93
  },
96
94
  iconClass: {
97
95
  type: String,
@@ -155,11 +153,6 @@ export default {
155
153
  isLoadingRight,
156
154
  } = LoadingAPI(props);
157
155
 
158
- const {
159
- isIconLeft,
160
- isIconRight,
161
- } = IconAPI(props);
162
-
163
156
  const {
164
157
  isTextScreenReaderVisible,
165
158
  isTextVisible,
@@ -170,8 +163,6 @@ export default {
170
163
  } = ClickAPI(props, context);
171
164
 
172
165
  return {
173
- isIconLeft,
174
- isIconRight,
175
166
  isLoadingLeft,
176
167
  isLoadingRight,
177
168
  isTextScreenReaderVisible,
@@ -213,8 +204,8 @@ export default {
213
204
  this.loadingClass,
214
205
  ],
215
206
  }),
216
- this.isIconLeft && h(AIcon, {
217
- icon: this.icon,
207
+ this.iconLeft && h(AIcon, {
208
+ icon: this.iconLeft,
218
209
  iconTag: this.iconTag,
219
210
  class: [
220
211
  "aloha_btn__icon_left",
@@ -230,8 +221,8 @@ export default {
230
221
  extra: this.extraTranslate,
231
222
  ariaHidden: this.textAriaHidden,
232
223
  }),
233
- this.isIconRight && h(AIcon, {
234
- icon: this.icon,
224
+ this.iconRight && h(AIcon, {
225
+ icon: this.iconRight,
235
226
  iconTag: this.iconTag,
236
227
  class: [
237
228
  "aloha_btn__icon_right",
@@ -105,16 +105,15 @@ export default {
105
105
  default: "right",
106
106
  validator: value => ["right", "left"].indexOf(value) !== -1,
107
107
  },
108
- buttonIcon: {
108
+ buttonIconLeft: {
109
109
  type: String,
110
110
  required: false,
111
111
  default: undefined,
112
112
  },
113
- buttonIconAlign: {
113
+ buttonIconRight: {
114
114
  type: String,
115
115
  required: false,
116
- default: "left",
117
- validator: value => ["right", "left"].indexOf(value) !== -1,
116
+ default: undefined,
118
117
  },
119
118
  buttonIconClass: {
120
119
  type: String,
@@ -217,6 +216,11 @@ export default {
217
216
  required: false,
218
217
  default: "div",
219
218
  },
219
+ useActionClass: {
220
+ type: Boolean,
221
+ required: false,
222
+ default: false,
223
+ },
220
224
  },
221
225
  setup(props) {
222
226
  const {
@@ -315,8 +319,8 @@ export default {
315
319
  loading: this.buttonLoading,
316
320
  loadingClass: this.buttonLoadingClass,
317
321
  loadingAlign: this.buttonLoadingAlign,
318
- icon: this.buttonIcon,
319
- iconAlign: this.buttonIconAlign,
322
+ iconLeft: this.buttonIconLeft,
323
+ iconRight: this.buttonIconRight,
320
324
  iconClass: this.buttonIconClass,
321
325
  iconAttributes: this.buttonIconAttributes,
322
326
  iconTag: this.buttonIconTag,
@@ -351,6 +355,7 @@ export default {
351
355
  return h(ADropdownAction, {
352
356
  key: actionIndex,
353
357
  action,
358
+ useActionClass: this.useActionClass,
354
359
  }, this.$slots);
355
360
  }),
356
361
  ],
@@ -5,6 +5,8 @@ import {
5
5
  import AButton from "../../AButton/AButton";
6
6
  import ALink from "../../ALink/ALink";
7
7
 
8
+ import AttributesAPI from "./compositionAPI/AttributesAPI";
9
+
8
10
  export default {
9
11
  name: "ADropdownAction",
10
12
  props: {
@@ -12,6 +14,19 @@ export default {
12
14
  type: Object,
13
15
  required: true,
14
16
  },
17
+ useActionClass: {
18
+ type: Boolean,
19
+ required: false,
20
+ },
21
+ },
22
+ setup(props) {
23
+ const {
24
+ attributesAction,
25
+ } = AttributesAPI(props);
26
+
27
+ return {
28
+ attributesAction,
29
+ };
15
30
  },
16
31
  render() {
17
32
  if (this.action.type === "button") {
@@ -19,8 +34,7 @@ export default {
19
34
  class: this.action.liClass,
20
35
  }, [
21
36
  h(AButton, {
22
- class: "a_dropdown__item",
23
- ...this.action,
37
+ ...this.attributesAction,
24
38
  onClick: this.action.callback,
25
39
  }),
26
40
  ]);
@@ -37,10 +51,7 @@ export default {
37
51
  return h("li", {
38
52
  class: this.action.liClass,
39
53
  }, [
40
- h(ALink, {
41
- class: "a_dropdown__item",
42
- ...this.action,
43
- })
54
+ h(ALink, this.attributesAction),
44
55
  ]);
45
56
  }
46
57
  if (this.action.type === "template" &&
@@ -0,0 +1,24 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function AttributesAPI(props) {
7
+ const action = toRef(props, "action");
8
+ const useActionClass = toRef(props, "useActionClass");
9
+
10
+ const attributesAction = computed(() => {
11
+ const ATTRIBUTES = {
12
+ class: "a_dropdown__item",
13
+ ...action.value,
14
+ };
15
+ if (!useActionClass.value) {
16
+ ATTRIBUTES.class = "a_dropdown__item";
17
+ }
18
+ return ATTRIBUTES;
19
+ });
20
+
21
+ return {
22
+ attributesAction,
23
+ };
24
+ }
@@ -22,6 +22,10 @@ export default {
22
22
  required: false,
23
23
  default: () => groupButtonDropdownPluginOptions.value.propsDefault.actionsClasses,
24
24
  },
25
+ disabled: {
26
+ type: Boolean,
27
+ required: false,
28
+ },
25
29
  dropdownAttributes: {
26
30
  type: Object,
27
31
  required: false,
@@ -36,19 +40,29 @@ export default {
36
40
  type: Number,
37
41
  required: false,
38
42
  default: () => groupButtonDropdownPluginOptions.value.propsDefault.indexFirstDropdownAction,
39
- validator: value => value > -1,
43
+ validator: value => value >= -1,
40
44
  },
41
45
  indexFirstDropdownActionMobile: {
42
46
  type: Number,
43
47
  required: false,
44
48
  default: () => groupButtonDropdownPluginOptions.value.propsDefault.indexFirstDropdownActionMobile,
45
- validator: value => value > -1,
49
+ validator: value => value >= -1,
46
50
  },
47
51
  minDropdownActions: {
48
52
  type: Number,
49
53
  required: false,
50
54
  default: () => groupButtonDropdownPluginOptions.value.propsDefault.minDropdownActions,
51
55
  },
56
+ useActionClass: {
57
+ type: Boolean,
58
+ required: false,
59
+ default: () => groupButtonDropdownPluginOptions.value.propsDefault.useActionClass,
60
+ },
61
+ useDropdownActionClass: {
62
+ type: Boolean,
63
+ required: false,
64
+ default: () => groupButtonDropdownPluginOptions.value.propsDefault.useDropdownActionClass,
65
+ }
52
66
  },
53
67
  setup(props) {
54
68
  const {
@@ -71,12 +85,15 @@ export default {
71
85
  ...this.actionsGrouped.buttons.map((item, itemIndex) => {
72
86
  return h(AGroupButtonDropdownItem, {
73
87
  data: item,
88
+ disabled: this.disabled,
74
89
  actionsDropdown: this.actionsGrouped.dropdown,
75
90
  hasDropdownActions: this.hasDropdownActions,
76
91
  dropdownAttributes: this.dropdownAttributes,
77
92
  actionsClasses: this.actionsClasses,
78
93
  isLast: itemIndex === this.actionsGrouped.buttons.length - 1,
79
94
  hasDividerBeforeDropdown: this.hasDividerBeforeDropdown,
95
+ useActionClass: this.useActionClass,
96
+ useDropdownActionClass: this.useDropdownActionClass,
80
97
  }, this.$slots);
81
98
  }),
82
99
  ]);
@@ -11,34 +11,46 @@ import DropdownAPI from "./compositionAPI/DropdownAPI";
11
11
  export default {
12
12
  name: "AGroupButtonDropdownItem",
13
13
  props: {
14
- data: {
15
- type: Object,
14
+ actionsClasses: {
15
+ type: Array,
16
16
  required: true,
17
17
  },
18
18
  actionsDropdown: {
19
19
  type: Array,
20
20
  required: true,
21
21
  },
22
- hasDropdownActions: {
23
- type: Boolean,
22
+ data: {
23
+ type: Object,
24
24
  required: true,
25
25
  },
26
+ disabled: {
27
+ type: Boolean,
28
+ required: false,
29
+ },
26
30
  dropdownAttributes: {
27
31
  type: Object,
28
32
  required: true,
29
33
  },
30
- isLast: {
34
+ hasDividerBeforeDropdown: {
31
35
  type: Boolean,
32
36
  required: true,
33
37
  },
34
- actionsClasses: {
35
- type: Array,
38
+ hasDropdownActions: {
39
+ type: Boolean,
36
40
  required: true,
37
41
  },
38
- hasDividerBeforeDropdown: {
42
+ isLast: {
39
43
  type: Boolean,
40
44
  required: true,
41
45
  },
46
+ useActionClass: {
47
+ type: Boolean,
48
+ required: false,
49
+ },
50
+ useDropdownActionClass: {
51
+ type: Boolean,
52
+ required: false,
53
+ },
42
54
  },
43
55
  setup(props) {
44
56
  const {
@@ -57,23 +69,28 @@ export default {
57
69
  class: "a_btn_group",
58
70
  }, [
59
71
  ...this.data.children.map(action => {
72
+ const CLASS = this.useActionClass && action.class ? action.class : this.actionsClasses[action.actionNotDividerIndex];
73
+ const DISABLED = this.disabled || action.disabled;
60
74
  if (action.type === "button") {
61
75
  return h(AButton, {
62
- class: this.actionsClasses[action.actionNotDividerIndex],
63
76
  ...action,
77
+ class: CLASS,
78
+ disabled: DISABLED,
64
79
  onClick: action.callback,
65
80
  });
66
81
  }
67
82
  if (action.type === "link") {
68
83
  return h(ALink, {
69
- class: this.actionsClasses[action.actionNotDividerIndex],
70
- ...action
84
+ ...action,
85
+ disabled: DISABLED,
86
+ class: CLASS,
71
87
  });
72
88
  }
73
89
  if (action.type === "template" &&
74
90
  action.slotName &&
75
91
  this.$slots[action.slotName]) {
76
92
  return this.$slots[action.slotName]({
93
+ class: CLASS,
77
94
  action: action,
78
95
  });
79
96
  }
@@ -81,12 +98,14 @@ export default {
81
98
  this.isDropdownActionsInGroup && h(ADropdown, {
82
99
  isHideWithoutActionAndSlot: true,
83
100
  actions: this.actionsDropdown,
101
+ useActionClass: this.useDropdownActionClass,
84
102
  ...this.dropdownAttributes,
85
103
  }, this.$slots),
86
104
  ]),
87
105
  this.isDropdownActionsAfterGroup && h(ADropdown, {
88
106
  isHideWithoutActionAndSlot: true,
89
107
  actions: this.actionsDropdown,
108
+ useActionClass: this.useDropdownActionClass,
90
109
  ...this.dropdownAttributes,
91
110
  }, this.$slots),
92
111
  ];
@@ -86,6 +86,7 @@ export default function ActionsAPI(props) {
86
86
  } else {
87
87
  last(ACTIONS_GROUPED.buttons).children.push(action);
88
88
  }
89
+ isPreviousActionDivider = false;
89
90
  } else {
90
91
  isPreviousActionDivider = true;
91
92
  }
@@ -7,7 +7,6 @@ import AIcon from "../AIcon/AIcon";
7
7
  import ASpinner from "../ASpinner/ASpinner";
8
8
  import ATranslation from "../ATranslation/ATranslation";
9
9
 
10
- import IconAPI from "../AButton/comositionAPI/IconAPI";
11
10
  import LoadingAPI from "../AButton/comositionAPI/LoadingAPI";
12
11
  import TextAPI from "../AButton/comositionAPI/TextAPI";
13
12
  import TitleAPI from "../AButton/comositionAPI/TitleAPI";
@@ -45,16 +44,15 @@ export default {
45
44
  required: false,
46
45
  default: undefined,
47
46
  },
48
- icon: {
47
+ iconLeft: {
49
48
  type: String,
50
49
  required: false,
51
50
  default: undefined,
52
51
  },
53
- iconAlign: {
52
+ iconRight: {
54
53
  type: String,
55
54
  required: false,
56
- default: "left",
57
- validator: value => ["right", "left"].indexOf(value) !== -1,
55
+ default: undefined,
58
56
  },
59
57
  iconAttributes: {
60
58
  type: Object,
@@ -148,19 +146,12 @@ export default {
148
146
  isLoadingRight,
149
147
  } = LoadingAPI(props);
150
148
 
151
- const {
152
- isIconLeft,
153
- isIconRight,
154
- } = IconAPI(props);
155
-
156
149
  const {
157
150
  isTextScreenReaderVisible,
158
151
  isTextVisible,
159
152
  } = TextAPI(props);
160
153
 
161
154
  return {
162
- isIconLeft,
163
- isIconRight,
164
155
  isLoadingLeft,
165
156
  isLoadingRight,
166
157
  isTextScreenReaderVisible,
@@ -187,14 +178,12 @@ export default {
187
178
  this.loadingClass,
188
179
  ],
189
180
  }),
190
- this.isIconLeft && h(AIcon, {
191
- icon: this.icon,
181
+ this.iconLeft && h(AIcon, {
182
+ icon: this.iconLeft,
192
183
  iconTag: this.iconTag,
193
184
  class: [
185
+ "aloha_link__icon_left",
194
186
  this.iconClass,
195
- {
196
- aloha_link__icon_left: this.isTextVisible || this.$slots.default,
197
- },
198
187
  ],
199
188
  ...this.iconAttributes,
200
189
  }),
@@ -206,15 +195,12 @@ export default {
206
195
  extra: this.extraTranslate,
207
196
  ariaHidden: this.textAriaHidden,
208
197
  }),
209
- this.isIconRight && h(AIcon, {
210
- icon: this.icon,
198
+ this.iconRight && h(AIcon, {
199
+ icon: this.iconRight,
211
200
  iconTag: this.iconTag,
212
201
  class: [
213
202
  "aloha_link__icon_right",
214
203
  this.iconClass,
215
- {
216
- aloha_link__icon_right: this.isTextVisible || this.$slots.default,
217
- },
218
204
  ],
219
205
  ...this.iconAttributes,
220
206
  }),
@@ -255,7 +241,7 @@ export default {
255
241
  },
256
242
  ],
257
243
  ariaDisabled: this.disabled,
258
- }, CHILDREN);
244
+ }, () => CHILDREN);
259
245
  }
260
246
  },
261
247
  };