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

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [1.0.0-alpha.5](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2021-12-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **uikit:** fix list component http call with no pagination at all ([ebe4b61](https://github.com/lotrekagency/mapo/commit/ebe4b617f3be5ccb70c10c041c81868e9ee6b828))
12
+
13
+
14
+ ### Features
15
+
16
+ * added search field on list component ([0c845e2](https://github.com/lotrekagency/mapo/commit/0c845e26e30afed66b351cc7a0f940f9a20e0943))
17
+ * select all option on list component ([588d2c5](https://github.com/lotrekagency/mapo/commit/588d2c57ca5fd36477cf1ee3c33e2289eb979acf))
18
+ * slot for selected items' counter ([0551b5e](https://github.com/lotrekagency/mapo/commit/0551b5e916f25fc740a0cae58c5548ab0c6e35ff))
19
+
20
+
21
+
22
+
23
+
24
+ # [1.0.0-alpha.4](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2021-10-25)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * Display corret version of mapo in index page ([22ae4cf](https://github.com/lotrekagency/mapo/commit/22ae4cf55f1f3c6fcda64b085fe3c13c416bafb8))
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Lotrek 2021
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
@@ -8,11 +8,30 @@
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">
17
+ <!-- Overrides counter for selected items. -->
18
+ <slot name="item-counter" v-bind="{ selection, canSelectAll, allSelected, toggleSelectAll }">
19
+ <div class="caption mr-1">
20
+ <b v-if="allSelected">All items selected</b>
21
+ <span v-else-if="selection.length">
22
+ {{ selection.length }} items selected
23
+ <v-btn
24
+ v-if="selection != 'all' && canSelectAll"
25
+ @click="toggleSelectAll"
26
+ outlined
27
+ tile
28
+ x-small
29
+ class="ml-1 d-inline-flex"
30
+ >Select all</v-btn
31
+ >
32
+ </span>
33
+ </div>
34
+ </slot>
16
35
  <ListFilters v-bind="$attrs" v-model="filters">
17
36
  <template v-for="(_, slot) in $slots" :slot="slot">
18
37
  <!-- @vuese-ignore -->
@@ -26,9 +45,6 @@
26
45
  </v-col>
27
46
  </v-row>
28
47
  </div>
29
- <div v-if="selection.length">
30
- {{ selection.length }} elementi selezionati
31
- </div>
32
48
  <div>
33
49
  <ListTable
34
50
  v-model="selection"
@@ -54,7 +70,7 @@
54
70
  * 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
71
  * A use case example could be "build a page that lists all the products of an ecommerce". <br><br>
56
72
  * 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.
73
+ * The props and slots of this component are passed to its childs.
58
74
  * For detailed explanations see [Transparent Wrapping](#transparent-wrapping). <br> <h4>Index:</h4> [[toc]]
59
75
  */
60
76
  export default {
@@ -63,6 +79,7 @@ export default {
63
79
  return {
64
80
  tabActiveStatus: 1,
65
81
  selection: [],
82
+ allSelected: false,
66
83
  filters: []
67
84
  };
68
85
  },
@@ -72,16 +89,22 @@ export default {
72
89
  type: String,
73
90
  required: true,
74
91
  },
92
+ // Add option to select all items in all pages
93
+ canSelectAll: Boolean,
75
94
  },
76
95
  computed: {
77
96
  crud() {
78
97
  return this.$mapo.$api.crud(this.endpoint);
79
98
  },
99
+ selectionQuery() {
100
+ return this.$refs?.dtable?.getHttpParams();
101
+ }
80
102
  },
81
103
  watch: {
82
104
  selection(val) {
105
+ this.allSelected = val == 'all';
83
106
  // Fires when you select some row of the table.
84
- // @arg Emit the list of the selected rows.
107
+ // @arg Emit "all" if all items are selected, else the list of the selected rows.
85
108
  this.$emit("selectionChange", val);
86
109
  },
87
110
  },
@@ -89,6 +112,9 @@ export default {
89
112
  refresh() {
90
113
  return this.$refs.dtable.getDataFromApi();
91
114
  },
115
+ toggleSelectAll() {
116
+ return this.$refs?.dtable?.toggleSelectAll();
117
+ }
92
118
  },
93
119
  mounted() {},
94
120
  };
@@ -113,10 +139,7 @@ Each component within it inherits its props and slots.
113
139
  For the list of available prop refer to the documentation of each single part.
114
140
 
115
141
  ### 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
-
142
+ Other slots related to sub-components can be reached through these namespaces:
120
143
  - `"filter"` is the namespace of [`ListFilters`](../ListFilters/#slots) slots.
121
144
  - `"dtable"` is the namespace of [`ListTable`](../ListTable/#slots) slots.
122
145
  - `"qedit"` is the namespace of [`ListQuickEdit`](../ListQuickEdit/#slots) slots.
@@ -138,10 +161,12 @@ This is an interactive example. You can play with it but remember that all http
138
161
  show-select
139
162
  :headers="headers"
140
163
  :editFields="editFields"
141
- :filters="availableFilters"
164
+ :filters="availableFilters"
142
165
  endpoint="api/camomilla/articles"
143
166
  title="List Example"
144
167
  addItem
168
+ canSelectAll
169
+ searchable
145
170
  >
146
171
  </List>
147
172
  </v-app>
@@ -191,4 +216,4 @@ export default {
191
216
  :::
192
217
 
193
218
 
194
- </docs>
219
+ </docs>
@@ -4,13 +4,14 @@
4
4
  label="Group Actions"
5
5
  v-bind="$attrs"
6
6
  v-model="action"
7
- :items="actions"
7
+ :items="filteredActions"
8
8
  item-text="label"
9
9
  item-value="handler"
10
10
  outlined
11
11
  dense
12
12
  hide-details
13
13
  clearable
14
+ no-data-text="No actions available"
14
15
  ></v-select>
15
16
  <v-btn
16
17
  class="rounded-0 elevation-0 ml-2"
@@ -50,9 +51,7 @@ export default {
50
51
  {
51
52
  label: "Permanent delete",
52
53
  handler: function ({ selection, lookup, crud }) {
53
- return Promise.all(
54
- selection.map((i) => crud.delete(i[lookup]))
55
- );
54
+ return Promise.all(selection.map((i) => crud.delete(i[lookup])));
56
55
  },
57
56
  },
58
57
  ];
@@ -60,33 +59,52 @@ export default {
60
59
  },
61
60
  // ❌ This is an internal prop. Sorry..
62
61
  selection: {
63
- // -
64
- type: Array,
65
- // -
62
+ // -
63
+ type: [Array, String],
64
+ // -
66
65
  default: () => [],
67
66
  },
68
67
  // ❌ This is an internal prop. Sorry..
68
+ selectionQuery: {
69
+ // -
70
+ type: URLSearchParams,
71
+ // -
72
+ default: () => new URLSearchParams(),
73
+ },
74
+ // ❌ This is an internal prop. Sorry..
69
75
  crud: {
70
- // -
76
+ // -
71
77
  type: Object,
72
78
  required: true,
73
79
  },
74
80
  },
75
- computed:{
76
- isActive(){
77
- return this.$attrs['show-select'] !== undefined
81
+ computed: {
82
+ isActive() {
83
+ return this.$attrs["show-select"] !== undefined;
84
+ },
85
+ filteredActions() {
86
+ return this.actions.filter((action) => {
87
+ return (this.selection != "all" && (action.handleMultiple ?? true)) || (this.selection == "all" && (action.handleAll ?? false));
88
+ });
78
89
  }
79
90
  },
80
91
  methods: {
81
92
  handleAction() {
82
- if (!this.selection.length) {
93
+ if (!this.selectAll && !this.selection.length) {
83
94
  return this.$mapo.$snack.open({
84
95
  message: "You need to select at least one item.",
85
96
  color: "error",
86
97
  });
87
98
  }
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)) : () => {};
99
+ const ctx = {
100
+ selection: this.selection,
101
+ selectionQuery: this.selectionQuery,
102
+ lookup: this.lookup,
103
+ crud: this.crud,
104
+ };
105
+ return this.action
106
+ ? this.action(ctx).then((res) => this.$emit("actionCompleted", res))
107
+ : () => {};
90
108
  },
91
109
  },
92
110
  };
@@ -96,13 +114,16 @@ export default {
96
114
  ## Action config
97
115
 
98
116
 
99
- The actions prop is a list of `Action` objects made of two keys:
117
+ The actions prop is a list of `Action` objects containing these keys:
100
118
 
101
119
  - **"label"** `String` ==> The name of the action that will be renered inside the select button.
120
+ - **"handleMultiple"** `Boolean` ==> Make the action callable on multiple items. Default: `true`.
121
+ - **"handleAll"** `Boolean` ==> Make the action callable on all items. Default: `false`.
102
122
  - **"handler"** `Function` ==> The callback function that will be executed once the user confirms the action.
103
123
 
104
124
  The handler function will be called with a ctx containing:
105
- - **"selection"** `Array<Object>`==> The list of selected objects.
125
+ - **"selection"** `Array<Object>` or `String` ==> `"all"` if all items are selected else the list of selected objects.
126
+ - **"selectionQuery"** `URLSearchParams` ==> GET parameters for the current list of objects.
106
127
  - **"lookup"** `String` ==> The lookup prop.
107
128
  - **"crud"** [`Crud`](/core/#api.crud) ==> The inherited crud from [List](../List/) component.
108
129
 
@@ -122,4 +143,4 @@ const actions = [
122
143
  }
123
144
  ]
124
145
  ```
125
- </docs>
146
+ </docs>
@@ -6,18 +6,34 @@
6
6
  :items="httpEnabled ? items : filteredItems"
7
7
  :loading="loading"
8
8
  :options.sync="options"
9
+ :search="searchable && !httpEnabled ? searchValue : ''"
9
10
  :server-items-length="httpPaginator.count || -1"
11
+ :class="{ 'mapo__listtable__all_selected': selectAll }"
10
12
  >
11
13
  <template v-slot:top>
12
14
  <v-toolbar flat>
15
+ <v-text-field
16
+ v-if="searchable"
17
+ v-model="searchValue"
18
+ @input="loadingSearch = true; changeSearch()"
19
+ prepend-inner-icon="mdi-magnify"
20
+ label="Search"
21
+ single-line
22
+ hide-details
23
+ outlined
24
+ dense
25
+ clearable
26
+ :loading="loadingSearch"
27
+ style="max-width: 300px"
28
+ ></v-text-field>
29
+ <v-spacer></v-spacer>
30
+ <slot name="dtable.top.center"></slot>
31
+ <v-spacer></v-spacer>
13
32
  <v-btn text v-if="shouldEdit" @click="editItem()">
14
33
  <v-icon small left class="mr-2"> mdi-plus </v-icon>
15
34
  Quick add
16
35
  </v-btn>
17
- <v-spacer></v-spacer>
18
- <slot name="dtable.top.center"></slot>
19
- <v-spacer></v-spacer>
20
- <v-btn class="ma-2" @click="getDataFromApi" icon>
36
+ <v-btn class="ma-2" @click="getDataFromApi(false)" icon>
21
37
  <v-icon>mdi-update</v-icon>
22
38
  </v-btn>
23
39
  </v-toolbar>
@@ -28,6 +44,12 @@
28
44
  {{ item[firstColName] }}
29
45
  </NuxtLink>
30
46
  </template>
47
+ <template v-slot:item.data-table-select="{ isSelected, select }" v-if="selectAll">
48
+ <v-simple-checkbox v-model="selectAll" @input="select"></v-simple-checkbox>
49
+ </template>
50
+ <template v-slot:header.data-table-select="{ on, props }" v-if="selectAll">
51
+ <v-simple-checkbox v-model="selectAll" @input="on.input"></v-simple-checkbox>
52
+ </template>
31
53
  <template v-slot:[`item.actions`]="{ item }">
32
54
  <v-icon v-if="shouldEdit" small class="mr-2" @click="editItem(item)">
33
55
  mdi-pencil
@@ -52,19 +74,24 @@
52
74
  <template v-for="slot in filterSlots($slots, 'qedit.')" :slot="slot">
53
75
  <slot :name="`qedit.${slot}`"></slot>
54
76
  </template>
55
- <template
56
- v-for="slot in filterSlots($scopedSlots, 'qedit.')"
57
- v-slot:[slot]="props"
58
- >
77
+ <template v-for="slot in filterSlots($scopedSlots, 'qedit.')" v-slot:[slot]="props">
59
78
  <slot :name="`qedit.${slot}`" v-bind="props" />
60
79
  </template>
61
80
  </list-quick-edit>
62
81
  </div>
63
82
  </template>
64
83
 
84
+ <style lang="scss">
85
+ .mapo__listtable__all_selected {
86
+ .v-data-table__selected {
87
+ background: none !important;
88
+ }
89
+ }
90
+ </style>
65
91
 
66
92
  <script>
67
93
  import { getPointed } from "@mapomodule/utils/helpers/objHelpers";
94
+ import { debounce } from "@mapomodule/utils/helpers/debounce";
68
95
 
69
96
  export default {
70
97
  name: "ListTable",
@@ -72,8 +99,11 @@ export default {
72
99
  items: [],
73
100
  loading: true,
74
101
  selection: [],
102
+ selectAll: false,
75
103
  options: {},
76
104
  httpPaginator: {},
105
+ searchValue: "",
106
+ loadingSearch: false,
77
107
  disableHttp: false
78
108
  }),
79
109
  props: {
@@ -97,44 +127,62 @@ export default {
97
127
  type: Array,
98
128
  default: () => [],
99
129
  },
130
+ searchable: {
131
+ type: Boolean,
132
+ default: false,
133
+ },
100
134
  },
101
135
  watch: {
102
136
  selection(val) {
103
137
  this.$emit("input", val);
104
138
  },
105
- filters:{
139
+ selectAll(val) {
140
+ this.$emit("input", val ? "all" : this.selection);
141
+ },
142
+ filters: {
106
143
  deep: true,
107
- handler(){
144
+ handler() {
108
145
  this.httpEnabled && this.getDataFromApi();
109
- }
146
+ },
110
147
  },
111
148
  options: {
112
149
  deep: true,
113
150
  handler(options) {
114
151
  this.disableHttp = options.itemsPerPage === -1;
115
152
  this.setQparams(options);
116
- this.httpEnabled && this.getDataFromApi();
153
+ this.httpEnabled && this.getDataFromApi(false);
117
154
  },
118
155
  },
119
- disableHttp(){
156
+ disableHttp() {
120
157
  this.getDataFromApi();
121
- }
158
+ },
122
159
  },
123
160
  methods: {
124
- getDataFromApi() {
161
+ getDataFromApi(clearSelection = true) {
162
+ if (clearSelection) {
163
+ this.selection = [];
164
+ this.selectAll = false;
165
+ }
166
+ this.loading = true;
167
+ this.debouncedDataFromApi();
168
+ },
169
+ debouncedDataFromApi: debounce(function () {
125
170
  return new Promise((resolve, reject) => {
126
171
  this.selection = [];
127
- this.loading = true;
128
172
  if (!this.httpEnabled) {
129
- this.crud.list().then((data) => {
173
+ this.crud
174
+ .list()
175
+ .then((data) => {
130
176
  this.items = data;
131
177
  this.loading = false;
132
178
  resolve(data);
133
179
  })
134
180
  .catch((error) => reject(error));
135
181
  } else {
136
- const params = this.getHttpParams()
137
- this.crud.list({ params }).then((data) => {
182
+ const params = this.getHttpParams();
183
+ this.crud
184
+ .list({ params })
185
+ .then((data) => {
138
186
  this.items = data.items;
139
187
  this.httpPaginator = data.paginator;
140
188
  this.loading = false;
@@ -143,7 +191,7 @@ export default {
143
191
  .catch((error) => reject(error));
144
192
  }
145
193
  });
146
- },
194
+ }, 500),
147
195
  setQparams(options) {
148
196
  this.$router.push({
149
197
  query: {
@@ -152,13 +200,15 @@ export default {
152
200
  },
153
201
  });
154
202
  },
155
- restoreFromQparams(){
203
+ restoreFromQparams() {
156
204
  this.options = {
157
205
  ...this.options,
158
206
  sortBy: this.$route.query.sort?.split(".") || [],
159
207
  sortDesc: this.$route.query.order?.split(".").map((e) => e == "desc") || [],
160
- itemsPerPage: parseInt(this.$route.query.items) || this.options.itemsPerPage || 10,
208
+ itemsPerPage:
209
+ parseInt(this.$route.query.items) || this.options.itemsPerPage || 10,
161
210
  };
211
+ this.searchValue = this.$route.query.search;
162
212
  },
163
213
  getOrderParams(options) {
164
214
  const { sortBy, sortDesc, page, itemsPerPage } = options;
@@ -171,21 +221,26 @@ export default {
171
221
  getHttpParams() {
172
222
  const params = new URLSearchParams();
173
223
  for (const [key, value] of Object.entries(this.getOrderParams(this.options))) {
174
- value !== undefined && params.append(key, value)
224
+ value !== undefined && params.append(key, value);
175
225
  }
176
- this.filters.forEach(fi => {
177
- const query = []
178
- const format = (val) => val.replaceAll('.', '__')
179
- if (fi.datepicker){
180
- const dates = fi.active[0].value.split(',')
181
- query.push(`${format(fi.value)}__gte=${dates[0]}`, `${format(fi.value)}__lte=${dates[1]}`)
226
+ this.filters.forEach((fi) => {
227
+ const query = [];
228
+ const format = (val) => val.replaceAll(".", "__");
229
+ if (fi.datepicker) {
230
+ const dates = fi.active[0].value.split(",");
231
+ query.push(
232
+ `${format(fi.value)}__gte=${dates[0]}`,
233
+ `${format(fi.value)}__lte=${dates[1]}`
234
+ );
182
235
  } else if (fi.active.length > 1) {
183
- query.push(`${format(fi.value)}=[${ fi.active.map(a=>a.value).join(",")}]`)
236
+ query.push(`${format(fi.value)}=[${fi.active.map((a) => a.value).join(",")}]`);
184
237
  } else {
185
- query.push(`${format(fi.value)}=${ fi.active[0].value}`)
238
+ query.push(`${format(fi.value)}=${fi.active[0].value}`);
186
239
  }
187
240
  query.forEach(q => params.append('fltr', q))
188
- })
241
+ });
242
+ if (this.searchValue && this.searchable)
243
+ params.append("search", this.searchValue);
189
244
  return params;
190
245
  },
191
246
  editItem(item) {
@@ -194,18 +249,33 @@ export default {
194
249
  deleteItem(item) {
195
250
  const callback = (item) =>
196
251
  this.crud.delete(item[this.lookup]).then(this.getDataFromApi);
197
- this.$mapo.$confirm
198
- .open({
199
- title: "Delete",
200
- question: "Are you sure you want to delete this item?",
201
- approveButton: { text: "Delete", attrs: { color: "red" } }
202
- }).then((res) => (res ? callback(item) : null));
252
+ this.$mapo.$confirm
253
+ .open({
254
+ title: "Delete",
255
+ question: "Are you sure you want to delete this item?",
256
+ approveButton: { text: "Delete", attrs: { color: "red" } },
257
+ })
258
+ .then((res) => (res ? callback(item) : null));
203
259
  },
204
260
  filterSlots(slots, scope) {
205
261
  return Object.keys(slots)
206
262
  .filter((name) => name.startsWith(scope))
207
263
  .map((name) => name.replace(scope, ""));
208
264
  },
265
+ toggleSelectAll() {
266
+ this.selectAll = !this.selectAll;
267
+ },
268
+ changeSearch: debounce(function () {
269
+ this.$router.push({
270
+ query: {
271
+ ...this.$route.query,
272
+ search: this.searchValue,
273
+ },
274
+ });
275
+
276
+ this.httpEnabled && this.getDataFromApi();
277
+ this.loadingSearch = false;
278
+ }, 1000)
209
279
  },
210
280
  computed: {
211
281
  filteredItems() {
@@ -234,9 +304,7 @@ export default {
234
304
  },
235
305
  firstColName() {
236
306
  return (
237
- this.$attrs.headers &&
238
- this.$attrs.headers.length &&
239
- this.$attrs.headers[0].value
307
+ this.$attrs.headers && this.$attrs.headers.length && this.$attrs.headers[0].value
240
308
  );
241
309
  },
242
310
  shouldEdit() {
@@ -246,12 +314,12 @@ export default {
246
314
  (this.$attrs.editFields && this.$attrs.editFields.length)
247
315
  );
248
316
  },
249
- httpEnabled(){
250
- return this.http && !this.disableHttp
251
- }
317
+ httpEnabled() {
318
+ return this.http && !this.disableHttp;
319
+ },
252
320
  },
253
321
  mounted() {
254
- this.restoreFromQparams()
322
+ this.restoreFromQparams();
255
323
  this.httpEnabled || this.getDataFromApi();
256
324
  },
257
325
  };
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.5",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
7
7
  "repository": "https://github.com/lotrekagency/mapo",
8
8
  "main": "./module.js",
9
9
  "dependencies": {
10
- "@mapomodule/utils": "^1.0.0-alpha.0",
10
+ "@mapomodule/utils": "^1.0.0-alpha.1",
11
11
  "@nuxtjs/vuetify": "^1.12.1"
12
12
  },
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
- "gitHead": "801fe7de298f06e335793291c4955abf62edd077"
16
+ "gitHead": "abc5a9d9e50e791de00458de72961c76f3bc7a89"
17
17
  }
package/pages/index.vue CHANGED
@@ -1,81 +1,18 @@
1
1
  <template>
2
2
  <v-row justify="center" align="center">
3
3
  <v-col cols="12" sm="8" md="12">
4
-
5
- <v-btn
6
- class="elevation-0 rounded-0"
7
- color="primary"
8
- nuxt
9
- to="/login"
10
- style="margin-top: 1rem"
11
- >
12
- Test Login Page
13
- </v-btn>
14
- <hr />
15
-
16
4
  <div class="mapo-info">
17
- <h1 id="mapo">Mapo</h1>
18
- <h2 id="build-setup">Build Setup</h2>
19
- <h3 id="install-dependencies">install dependencies</h3>
20
- <p>$ yarn bootstrap</p>
21
- <h3 id="serve-with-hot-reload-at-localhost-3000">
22
- serve with hot reload at localhost:3000
23
- </h3>
24
- <p>$ yarn dev</p>
25
- <h3 id="to-install-this-module-in-a-nuxt-project">
26
- to install this module in a nuxt project
27
- </h3>
28
- <p>$ yarn add mapomodule</p>
29
- <h2 id="working-on-the-project">Working on the project</h2>
30
- <h3 id="how-to-contribute">How to contribute</h3>
31
- <p>
32
- Feel free to contribute to the project by making a
33
- <a
34
- href="https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request"
35
- >Pull Request</a
36
- >. Here&#39;s an example for a branch naming:
37
- </p>
38
- <p><code>feature/&lt;branch name&gt;</code></p>
39
- <p>
40
- Once you&#39;re done with your work and are ready to make a Pull
41
- Request, set the reviewers to Gabriele Baldi (bnznamco) and Andrea
42
- Morosi (andreamorosi).
43
- </p>
44
- <h3 id="documenting-components">Documenting components</h3>
45
- <p>
46
- Always write some documentation regarding the components you&#39;re
47
- developing. We are working on a StorybookJS implementation, which is
48
- going to help in this regard.
49
- </p>
50
- <h3 id="how-to-edit-and-add-configurations-and-settings">
51
- How to edit and add configurations and settings
52
- </h3>
53
- <p>
54
- Our library doesn&#39;t have a standard nuxt.config.js file, so in
55
- order to add the stuff which usually goes there you&#39;re going to
56
- either work on the defaults.js file, for configurations and such, or
57
- on the module.js file for modules and plugins. Both files are located
58
- in the root of the project.
59
- </p>
60
- <h3 id="urls-and-accessing-resources">URLs and accessing resources</h3>
61
- <p>
62
- We are using an alias (mapo) to access resources and files. Here&#39;s
63
- an example featuring a SCSS import in a component file:
64
- </p>
65
- <p>
66
- <code>@import &quot;@mapomodule/uikit/assets/custom-style.scss&quot;;</code>
67
- </p>
68
- <h2 id="external-resources">External resources</h2>
69
- <p>
70
- For detailed explanation on how things work, check out
71
- <a href="https://nuxtjs.org">Nuxt.js docs</a>.
72
- </p>
73
- <p>
74
- <a
75
- href="https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request"
76
- >https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request</a
77
- >
78
- </p>
5
+ <h1 id="mapo">
6
+ <code>mapomodule {{ version }}</code>
7
+ </h1>
8
+ <br>
9
+ <br>
10
+ <code>Congratulations!! 🥳 You succesfully installed Mapo! </code>
11
+ <br>
12
+ <br>
13
+ <code>
14
+ ## TODO INSERT HERE A LITTLE TUTORIAL.
15
+ </code>
79
16
  </div>
80
17
  </v-col>
81
18
  </v-row>
@@ -90,9 +27,10 @@
90
27
  }
91
28
  </style>
92
29
  <script>
30
+ import { version } from "mapomodule/package.json";
93
31
  export default {
94
- data() {
95
- return {};
96
- },
32
+ data: () => ({
33
+ version: version
34
+ }),
97
35
  };
98
36
  </script>