@mapomodule/uikit 1.0.0-alpha.0 → 1.0.0-alpha.12

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 (44) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/LICENSE.md +20 -0
  3. package/components/Detail/Detail.vue +209 -120
  4. package/components/Detail/DetailField.vue +57 -30
  5. package/components/Detail/DetailLangSwitch.vue +1 -1
  6. package/components/Detail/defaults.js +32 -25
  7. package/components/DropArea.vue +3 -3
  8. package/components/List/List.vue +100 -40
  9. package/components/List/ListActions.vue +56 -17
  10. package/components/List/ListFilters.vue +127 -113
  11. package/components/List/ListHead.vue +30 -12
  12. package/components/List/ListQuickEdit.vue +198 -55
  13. package/components/List/ListTable.vue +227 -78
  14. package/components/Login.vue +14 -5
  15. package/components/MediaManager/MediaEditor.vue +253 -107
  16. package/components/MediaManager/MediaFolders.vue +125 -41
  17. package/components/MediaManager/MediaGallery.vue +56 -52
  18. package/components/MediaManager/MediaManager.vue +114 -74
  19. package/components/MediaManager/MediaManagerDialog.vue +19 -22
  20. package/components/MediaManager/MediaPreview.vue +180 -0
  21. package/components/MediaManager/MediaUploader.vue +35 -32
  22. package/components/SnackBar.vue +3 -4
  23. package/components/fields/DateField.vue +9 -3
  24. package/components/fields/FileField.vue +108 -0
  25. package/components/fields/FksField.vue +60 -0
  26. package/components/fields/MediaField.vue +24 -6
  27. package/components/fields/MediaM2mField.vue +8 -3
  28. package/components/fields/SeoPreview.vue +89 -0
  29. package/components/fields/{TinyMce → wygEditor}/defaults.js +6 -4
  30. package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
  31. package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +7 -6
  32. package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
  33. package/components/fields/{TinyMce/TinyMce.vue → wygEditor/wygEditor.vue} +43 -21
  34. package/components/layout/Sidebar/Sidebar.vue +46 -24
  35. package/components/layout/Sidebar/SidebarFooter.vue +42 -46
  36. package/components/layout/Sidebar/SidebarList.vue +13 -14
  37. package/components/layout/Sidebar/SidebarListItem.vue +81 -38
  38. package/components/layout/Topbar/Topbar.vue +3 -36
  39. package/components/layout/routebuilder.js +1 -1
  40. package/defaults.js +2 -2
  41. package/layouts/default.vue +3 -14
  42. package/package.json +3 -3
  43. package/pages/index.vue +15 -78
  44. package/components/fields/M2mField.vue +0 -95
@@ -1,13 +1,24 @@
1
1
  <template>
2
- <component :is="is" v-model="model" v-bind="fieldProp"></component>
2
+ <div>
3
+ <span class="mapo-label" :class="`mapo-label-${conf.value}`">{{label}}</span>
4
+ <component :is="is" v-model="model" v-bind="fieldAttrs"></component>
5
+ </div>
3
6
  </template>
4
7
 
8
+ <style>
9
+ .mapo-label {
10
+ display: none;
11
+ }
12
+ </style>
13
+
5
14
  <script>
6
- import TinyMce from "@mapomodule/uikit/components/fields/TinyMce/TinyMce.vue";
15
+ import wygEditor from "@mapomodule/uikit/components/fields/wygEditor/wygEditor.vue";
7
16
  import DateField from "@mapomodule/uikit/components/fields/DateField.vue";
8
- import M2mField from "@mapomodule/uikit/components/fields/M2mField.vue";
17
+ import FksField from "@mapomodule/uikit/components/fields/FksField.vue";
9
18
  import MediaM2mField from "@mapomodule/uikit/components/fields/MediaM2mField.vue";
10
19
  import MediaField from "@mapomodule/uikit/components/fields/MediaField.vue";
20
+ import SeoPreview from "@mapomodule/uikit/components/fields/SeoPreview.vue";
21
+ import FileField from "@mapomodule/uikit/components/fields/FileField.vue";
11
22
 
12
23
  import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
13
24
  import defaults from "./defaults";
@@ -18,26 +29,28 @@ import defaults from "./defaults";
18
29
  export default {
19
30
  name: "DetailField",
20
31
  components: {
21
- TinyMce,
32
+ wygEditor,
22
33
  DateField,
23
- M2mField,
34
+ FksField,
24
35
  MediaM2mField,
25
- MediaField
36
+ MediaField,
37
+ SeoPreview,
38
+ FileField,
26
39
  },
27
40
 
28
41
  data() {
29
42
  return {
30
43
  model: null,
31
- fieldsMap: defaults.mapping,
32
- fieldsProps: defaults.props,
33
- fieldsAccess: defaults.accessor
44
+ defaultMap: defaults.mapping,
45
+ defaultAttrs: defaults.props,
46
+ defaultAccess: defaults.accessor,
34
47
  };
35
48
  },
36
49
  props: {
37
50
  // V-model of the payload needed to edit the field value in realtime.
38
51
  value: {
39
52
  type: Object,
40
- required: true
53
+ required: true,
41
54
  },
42
55
  // An object representing all the errors of all fields. This means that this component will find the error of its field following the dottedPath of the value in the error dict.
43
56
  errors: Object,
@@ -45,18 +58,18 @@ export default {
45
58
  conf: {
46
59
  // [`FieldConfiguration`](/components/detail/Detail/#fieldconfiguration)
47
60
  type: Object,
48
- required: true
49
- }
61
+ required: true,
62
+ },
50
63
  },
51
64
  watch: {
52
65
  value: {
53
66
  deep: true,
54
67
  handler(val) {
55
68
  this.setModel(val);
56
- }
69
+ },
57
70
  },
58
- conf(newConf, oldConf) {
59
- if (newConf.value !== oldConf.value) {
71
+ "conf.value"(newValue, oldValue) {
72
+ if (newValue !== oldValue) {
60
73
  this.setModel();
61
74
  }
62
75
  },
@@ -70,43 +83,57 @@ export default {
70
83
  // Fired when the v-model changes.
71
84
  // @arg Emits the entire payload modified.
72
85
  this.$emit("input", dump);
73
- }
86
+ },
74
87
  },
75
88
  methods: {
76
89
  setModel(val = this.value) {
77
90
  var model = this.accessor.get({
78
91
  model: { ...val },
79
- val: getPointed({ ...val }, this.conf.value)
92
+ val: getPointed({ ...val }, this.conf.value),
80
93
  });
81
94
  if (val && JSON.stringify(this.model) !== JSON.stringify(model))
82
95
  this.model = model;
83
- }
96
+ },
84
97
  },
85
98
  computed: {
86
99
  accessor() {
87
- let func = function({ val }) {
100
+ let func = function ({ val }) {
88
101
  return val;
89
102
  };
90
103
  return {
91
104
  get: func,
92
105
  set: func,
93
- ...(this.fieldsAccess[this.is] || {}),
94
- ...this.conf.accessor
106
+ ...(this.defaultAccess[this.is] || {}),
107
+ ...this.conf.accessor,
95
108
  };
96
109
  },
97
- fieldProp() {
110
+ fieldAttrs() {
98
111
  return {
99
112
  label: this.label,
100
- errorMessages: getPointed(this.errors || {}, this.conf.value, []),
101
- ...(this.fieldsProps[this.is] || {}),
102
- ...this.conf.attrs
113
+ errorMessages: this.conf.value
114
+ .split(".")
115
+ .map((_, i, a) => a.slice(0, i + 1).join("."))
116
+ .reduce((acc, next) => {
117
+ const error = getPointed(this.errors || {}, next, []);
118
+ if (Array.isArray(error)) {
119
+ acc = [...acc, ...error];
120
+ } else if (typeof error == "string") {
121
+ acc = [...acc, error];
122
+ }
123
+ return acc;
124
+ }, []),
125
+ ...this.defaultAttrs.All,
126
+ ...(this.defaultAttrs[
127
+ this.is.replace(/-./g, (x) => x[1].toUpperCase())
128
+ ] || {}),
129
+ ...this.conf.attrs,
103
130
  };
104
131
  },
105
132
  label() {
106
133
  if (this.conf.label !== undefined) {
107
134
  return this.conf.label;
108
135
  }
109
- const titleCase = string =>
136
+ const titleCase = (string) =>
110
137
  (string && string[0].toUpperCase() + string.slice(1).toLowerCase()) ||
111
138
  "";
112
139
  return titleCase(
@@ -120,10 +147,10 @@ export default {
120
147
  is() {
121
148
  return (
122
149
  this.conf.is ||
123
- (this.conf.type && this.fieldsMap[this.conf.type]) ||
124
- "v-text-field"
150
+ (this.conf.type && this.defaultMap[this.conf.type]) ||
151
+ "vTextField"
125
152
  );
126
- }
127
- }
153
+ },
154
+ },
128
155
  };
129
156
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-tabs v-model="tab">
2
+ <v-tabs v-model="tab" show-arrows>
3
3
  <v-tab v-for="lang in langs" :key="lang">
4
4
  <v-badge :value="hasErrors(lang)" color="error" dot>
5
5
  {{ lang }}
@@ -1,35 +1,38 @@
1
1
  const mapping = {
2
- text: "v-text-field",
3
- select: "v-select",
4
- date: "date-field",
5
- textarea: "v-textarea",
6
- switch: "v-switch",
7
- slider: "v-slider",
8
- file: "v-file-input",
9
- editor: "tiny-mce",
10
- media: "media-field",
11
- m2m: "m2m-field",
12
- mediaList: "media-m2m-field"
2
+ text: "vTextField",
3
+ select: "vSelect",
4
+ date: "DateField",
5
+ textarea: "vTextarea",
6
+ switch: "vSwitch",
7
+ slider: "vSlider",
8
+ file: "FileField",
9
+ editor: "wygEditor",
10
+ media: "MediaField",
11
+ fks: "FksField",
12
+ m2m: "FksField",
13
+ mediaList: "MediaM2mField",
14
+ seoPreview: "SeoPreview"
13
15
  }
14
16
 
15
17
  const props = {
16
- "v-text-field": {
17
- outlined: true
18
- },
19
- "v-textarea": {
20
- outlined: true
21
- },
22
- "date-field": {
23
- outlined: true
24
- },
25
- "v-select": {
26
- outlined: true,
18
+ vSelect: {
27
19
  itemText: "text",
28
20
  itemValue: "value"
29
21
  },
30
- "v-switch": {
22
+ MediaField: {
23
+ outlined: false
24
+ },
25
+ vSwitch: {
31
26
  inset: true,
32
27
  ripple: false
28
+ },
29
+ FksField:{
30
+ itemValue: "id",
31
+ returnObject: true,
32
+ },
33
+ All : {
34
+ outlined: true,
35
+ class: "rounded-0",
33
36
  }
34
37
  }
35
38
 
@@ -38,11 +41,15 @@ const dateFunc = function ({ val }) {
38
41
  };
39
42
 
40
43
  const accessor = {
41
- "v-date-picker": {
44
+ vDatePicker: {
42
45
  get: dateFunc, set: dateFunc
43
46
  },
44
- "date-field": {
47
+ DateField: {
45
48
  get: dateFunc, set: dateFunc
49
+ },
50
+ SeoPreview: {
51
+ get: ({ val }) => ({ title: "", permalink: "", description: "", ...val }),
52
+ set: ({ val }) => ({ title: "", permalink: "", description: "", ...val })
46
53
  }
47
54
  }
48
55
  export default {
@@ -69,7 +69,7 @@
69
69
  <!-- Slot to provide custom button actions inside the drop area -->
70
70
  <slot v-bind:clearList="clearList" name="actions">
71
71
  <!-- `<v-btn @click="clearList" icon><v-icon>mdi-close</v-icon></v-btn>` -->
72
- <v-btn @click="clearList" icon>
72
+ <v-btn v-if="uploadedFiles && uploadedFiles.length" @click="clearList" icon>
73
73
  <v-icon>mdi-close</v-icon>
74
74
  </v-btn>
75
75
  </slot>
@@ -112,8 +112,8 @@
112
112
 
113
113
  <v-card-actions>
114
114
  <v-spacer></v-spacer>
115
- <v-btn color="green darken-1" text @click="closeEdit"> Cancel </v-btn>
116
- <v-btn color="green darken-1" text @click="saveEdit"> Save </v-btn>
115
+ <v-btn color="primary" text @click="closeEdit"> Cancel </v-btn>
116
+ <v-btn color="primary" text @click="saveEdit"> Save </v-btn>
117
117
  </v-card-actions>
118
118
  </v-card>
119
119
  </v-dialog>
@@ -3,16 +3,17 @@
3
3
  <ListHead v-bind="$attrs" />
4
4
 
5
5
  <div>
6
- <v-row class="mb-4">
6
+ <v-row class="mb-1">
7
7
  <v-col cols="12" md="4">
8
8
  <ListActions
9
9
  v-bind="$attrs"
10
10
  :crud="crud"
11
- :selection="selection"
11
+ :selection="allSelected ? 'all' : selection"
12
+ :selectionQuery="selectionQuery"
12
13
  @actionCompleted="refresh"
13
14
  />
14
15
  </v-col>
15
- <v-col cols="12" md="8">
16
+ <v-col cols="12" md="8" class="d-flex flex-nowrap justify-end align-center">
16
17
  <ListFilters v-bind="$attrs" v-model="filters">
17
18
  <template v-for="(_, slot) in $slots" :slot="slot">
18
19
  <!-- @vuese-ignore -->
@@ -25,9 +26,26 @@
25
26
  </ListFilters>
26
27
  </v-col>
27
28
  </v-row>
28
- </div>
29
- <div v-if="selection.length">
30
- {{ selection.length }} elementi selezionati
29
+ <div class="d-flex justify-end">
30
+ <!-- Overrides counter for selected items. -->
31
+ <slot name="item-counter" v-bind="{ selection, canSelectAll, allSelected, toggleSelectAll }">
32
+ <div v-if="selection" class="caption mr-1 mb-1">
33
+ <b v-if="allSelected">All items selected</b>
34
+ <span v-else-if="selection.length">
35
+ {{ selection.length }} items selected
36
+ <v-btn
37
+ v-if="selection != 'all' && canSelectAll"
38
+ @click="toggleSelectAll"
39
+ outlined
40
+ tile
41
+ x-small
42
+ class="ml-1 d-inline-flex"
43
+ >Select all</v-btn
44
+ >
45
+ </span>
46
+ </div>
47
+ </slot>
48
+ </div>
31
49
  </div>
32
50
  <div>
33
51
  <ListTable
@@ -54,7 +72,7 @@
54
72
  * The purpose of this component is to provide you with a very quick way to create a page that can show a list of resources retrieved from the server.
55
73
  * A use case example could be "build a page that lists all the products of an ecommerce". <br><br>
56
74
  * This component is a wrapper and is made up of several parts.
57
- * The props and slots of this component are passed to its childs.
75
+ * The props and slots of this component are passed to its childs.
58
76
  * For detailed explanations see [Transparent Wrapping](#transparent-wrapping). <br> <h4>Index:</h4> [[toc]]
59
77
  */
60
78
  export default {
@@ -63,25 +81,31 @@ export default {
63
81
  return {
64
82
  tabActiveStatus: 1,
65
83
  selection: [],
84
+ allSelected: false,
66
85
  filters: []
67
86
  };
68
87
  },
69
88
  props: {
70
89
  // The url of the endpoint that provides the data to display. From this url a complete crud (See [this.$mapo.$api.crud](/core/#$api.crud)) will be created.
71
90
  endpoint: {
72
- type: String,
73
- required: true,
91
+ type: String
74
92
  },
93
+ // Add option to select all items in all pages
94
+ canSelectAll: Boolean,
75
95
  },
76
96
  computed: {
77
97
  crud() {
78
98
  return this.$mapo.$api.crud(this.endpoint);
79
99
  },
100
+ selectionQuery() {
101
+ return this.$refs?.dtable?.getHttpParams();
102
+ }
80
103
  },
81
104
  watch: {
82
105
  selection(val) {
106
+ this.allSelected = val == 'all';
83
107
  // Fires when you select some row of the table.
84
- // @arg Emit the list of the selected rows.
108
+ // @arg Emit "all" if all items are selected, else the list of the selected rows.
85
109
  this.$emit("selectionChange", val);
86
110
  },
87
111
  },
@@ -89,6 +113,9 @@ export default {
89
113
  refresh() {
90
114
  return this.$refs.dtable.getDataFromApi();
91
115
  },
116
+ toggleSelectAll() {
117
+ return this.$refs?.dtable?.toggleSelectAll();
118
+ }
92
119
  },
93
120
  mounted() {},
94
121
  };
@@ -113,10 +140,7 @@ Each component within it inherits its props and slots.
113
140
  For the list of available prop refer to the documentation of each single part.
114
141
 
115
142
  ### Slots
116
- This component has not individual slots, but reflects down to its parts each assigned slot.
117
-
118
- Each part can be reached with a namespace.
119
-
143
+ Other slots related to sub-components can be reached through these namespaces:
120
144
  - `"filter"` is the namespace of [`ListFilters`](../ListFilters/#slots) slots.
121
145
  - `"dtable"` is the namespace of [`ListTable`](../ListTable/#slots) slots.
122
146
  - `"qedit"` is the namespace of [`ListQuickEdit`](../ListQuickEdit/#slots) slots.
@@ -133,18 +157,25 @@ This is an interactive example. You can play with it but remember that all http
133
157
 
134
158
  ::: demo
135
159
  <template>
136
- <v-app >
137
- <List
160
+ <v-app>
161
+ <List
138
162
  show-select
163
+ title="Sweets archive:"
164
+ lookup="name"
139
165
  :headers="headers"
140
166
  :editFields="editFields"
141
- :filters="availableFilters"
142
- endpoint="api/camomilla/articles"
143
- title="List Example"
144
- addItem
145
- >
146
- </List>
147
- </v-app>
167
+ :filters="availableFilters"
168
+ multi-sort
169
+ can-select-all
170
+ searchable
171
+ :data.sync="desserts"
172
+ :actions="[]"
173
+ >
174
+ </List>
175
+ <br>
176
+ <h3> Data: </h3>
177
+ <pre>{{ desserts }}</pre>
178
+ </v-app>
148
179
  </template>
149
180
 
150
181
  <script>
@@ -153,37 +184,66 @@ export default {
153
184
  return {
154
185
  headers: [
155
186
  {
156
- text: "ID",
187
+ text: "Dessert (100g serving)",
157
188
  align: "start",
158
189
  sortable: false,
159
- value: "id",
190
+ value: "name",
160
191
  },
161
- { text: "Title", value: "title" },
162
- { text: "Identifier", value: "identifier" },
192
+ { text: "Protein (g)", value: "protein" },
193
+ { text: "Gluten-Free", value: "glutenfree" },
163
194
  { text: "Actions", value: "actions", sortable: false },
164
195
  ],
165
196
  editFields: [
166
- { attrs: { rules:[v => !!v || 'Title is required'] }, value: "title" },
167
- { attrs: { rules:[v => !!v || 'Permalink is required'] }, value: "permalink" },
168
- { attrs: { rules:[v => !!v || 'Identifier is required'] }, value: "identifier" },
197
+ { attrs: { rules: [(v) => !!v || "Name is required"] }, value: "name" },
198
+ { value: "protein" }
169
199
  ],
170
200
  availableFilters: [
171
201
  {
172
- text: "Status",
173
- value: "status",
202
+ text: "Gluten Free",
203
+ value: "glutenfree",
174
204
  choices: [
175
- { text: "Draft", value: "DRF" },
176
- { text: "Published", value: "PUB" },
177
- { text: "Trash", value: "TRS" },
205
+ { text: "Yes", value: true },
206
+ { text: "No", value: false },
178
207
  ],
179
208
  },
209
+ ],
210
+ desserts: [
180
211
  {
181
- text: "Date",
182
- value: "date",
183
- datepicker: true
212
+ name: "Frozen Yogurt",
213
+ protein: 4.0,
214
+ glutenfree: true,
215
+ },
216
+ {
217
+ name: "Ice cream sandwich",
218
+ protein: 4.3,
219
+ glutenfree: false,
220
+ },
221
+ {
222
+ name: "Eclair",
223
+ protein: 6.0,
224
+ glutenfree: false,
225
+ },
226
+ {
227
+ name: "Jelly bean",
228
+ protein: 0.0,
229
+ glutenfree: true,
230
+ },
231
+ {
232
+ name: "Lollipop",
233
+ protein: 0,
234
+ glutenfree: true,
235
+ },
236
+ {
237
+ name: "KitKat",
238
+ protein: 7,
239
+ glutenfree: false,
240
+ },
241
+ {
242
+ name: "KitKat2",
243
+ protein: 77,
244
+ glutenfree: false,
184
245
  },
185
246
  ],
186
-
187
247
  };
188
248
  },
189
249
  };
@@ -191,4 +251,4 @@ export default {
191
251
  :::
192
252
 
193
253
 
194
- </docs>
254
+ </docs>
@@ -4,13 +4,16 @@
4
4
  label="Group Actions"
5
5
  v-bind="$attrs"
6
6
  v-model="action"
7
- :items="actions"
7
+ :items="filteredActions"
8
+ :item-disabled="isDisabled"
8
9
  item-text="label"
9
10
  item-value="handler"
10
11
  outlined
11
12
  dense
12
13
  hide-details
13
14
  clearable
15
+ no-data-text="No actions available"
16
+ class="rounded-0"
14
17
  ></v-select>
15
18
  <v-btn
16
19
  class="rounded-0 elevation-0 ml-2"
@@ -50,43 +53,74 @@ export default {
50
53
  {
51
54
  label: "Permanent delete",
52
55
  handler: function ({ selection, lookup, crud }) {
53
- return Promise.all(
54
- selection.map((i) => crud.delete(i[lookup]))
55
- );
56
+ return Promise.all(selection.map((i) => crud && crud.delete(i[lookup])));
56
57
  },
58
+ permissions: "delete"
57
59
  },
58
60
  ];
59
61
  },
60
62
  },
61
63
  // ❌ This is an internal prop. Sorry..
62
64
  selection: {
63
- // -
64
- type: Array,
65
- // -
65
+ // -
66
+ type: [Array, String],
67
+ // -
66
68
  default: () => [],
67
69
  },
68
70
  // ❌ This is an internal prop. Sorry..
71
+ selectionQuery: {
72
+ // -
73
+ type: URLSearchParams,
74
+ // -
75
+ default: () => new URLSearchParams(),
76
+ },
77
+ // ❌ This is an internal prop. Sorry..
69
78
  crud: {
70
- // -
79
+ // -
71
80
  type: Object,
72
81
  required: true,
73
82
  },
74
83
  },
75
- computed:{
76
- isActive(){
77
- return this.$attrs['show-select'] !== undefined
84
+ computed: {
85
+ isActive() {
86
+ return this.$attrs["show-select"] !== undefined;
87
+ },
88
+ filteredActions() {
89
+ return this.actions.filter((action) => {
90
+ return (this.selection != "all" && (action.handleMultiple ?? true)) || (this.selection == "all" && (action.handleAll ?? false));
91
+ });
78
92
  }
79
93
  },
80
94
  methods: {
95
+ isDisabled(action){
96
+ const p = typeof action.permissions == "string" ? [action.permissions] : action.permissions || []
97
+ if (p.length){
98
+ return !p.every(a => this.userCan(a))
99
+ }
100
+ return false
101
+ },
102
+ userCan(action) {
103
+ if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
104
+ return this.$mapo.$auth.user.permissions.includes(action)
105
+ }
106
+ return true
107
+ },
81
108
  handleAction() {
82
- if (!this.selection.length) {
109
+ if (!this.selectAll && !this.selection.length) {
83
110
  return this.$mapo.$snack.open({
84
111
  message: "You need to select at least one item.",
85
112
  color: "error",
86
113
  });
87
114
  }
88
- const ctx = { selection: this.selection, lookup: this.lookup, crud: this.crud }
89
- return this.action ? this.action(ctx).then((res) => this.$emit('actionCompleted', res)) : () => {};
115
+ const ctx = {
116
+ selection: this.selection,
117
+ selectionQuery: this.selectionQuery,
118
+ lookup: this.lookup,
119
+ crud: this.crud,
120
+ };
121
+ return this.action
122
+ ? this.action(ctx).then((res) => this.$emit("actionCompleted", res))
123
+ : () => {};
90
124
  },
91
125
  },
92
126
  };
@@ -96,13 +130,17 @@ export default {
96
130
  ## Action config
97
131
 
98
132
 
99
- The actions prop is a list of `Action` objects made of two keys:
133
+ The actions prop is a list of `Action` objects containing these keys:
100
134
 
101
135
  - **"label"** `String` ==> The name of the action that will be renered inside the select button.
136
+ - **"handleMultiple"** `Boolean` ==> Make the action callable on multiple items. Default: `true`.
137
+ - **"handleAll"** `Boolean` ==> Make the action callable on all items. Default: `false`.
102
138
  - **"handler"** `Function` ==> The callback function that will be executed once the user confirms the action.
139
+ - **"permissions"** `String | Array` ==> The list of permissions needed by the user to perform action in a page with permission middleware
103
140
 
104
141
  The handler function will be called with a ctx containing:
105
- - **"selection"** `Array<Object>`==> The list of selected objects.
142
+ - **"selection"** `Array<Object>` or `String` ==> `"all"` if all items are selected else the list of selected objects.
143
+ - **"selectionQuery"** `URLSearchParams` ==> GET parameters for the current list of objects.
106
144
  - **"lookup"** `String` ==> The lookup prop.
107
145
  - **"crud"** [`Crud`](/core/#api.crud) ==> The inherited crud from [List](../List/) component.
108
146
 
@@ -119,7 +157,8 @@ const actions = [
119
157
  selection.map((i) => crud.delete(i[lookup]))
120
158
  );
121
159
  },
160
+ permissions: "delete"
122
161
  }
123
162
  ]
124
163
  ```
125
- </docs>
164
+ </docs>