@itrocks/list 0.0.3 → 0.0.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/cjs/list.html CHANGED
@@ -13,12 +13,15 @@
13
13
  <main>
14
14
  <!--BEGIN-->
15
15
 
16
+ <!--#main-->
16
17
  <article data-action="list" data-class="{type.name}" data-route="{type.@route}">
17
18
  <header>
18
19
  <h2>{type.@output.ucFirst} list</h2>
19
20
  <section class="summary">{objects.length} elements</section>
20
21
  <ul class="general actions">
21
- <li class="new"><a href="app://(type.@route)/new" target="main">New</a></li>
22
+ <!--generalActions-->
23
+ <li class="{action}">{{template}}</li>
24
+ <!--end-->
22
25
  </ul>
23
26
  </header>
24
27
  <form action="app://(type.@route)" autocomplete="off" method="post" target="main">
@@ -44,13 +47,14 @@
44
47
  </table>
45
48
  <footer>
46
49
  <ul class="selection actions">
47
- <li class="delete">
48
- <input formaction="app://(type.@route)/delete" formtarget="#notification" type="submit" value="Delete">
49
- </li>
50
+ <!--selectionActions-->
51
+ <li class="{action}">{{template}}</li>
52
+ <!--end-->
50
53
  </ul>
51
54
  </footer>
52
55
  </form>
53
56
  </article>
57
+ <!--#end-->
54
58
 
55
59
  <!--END-->
56
60
  </main>
package/cjs/list.js CHANGED
@@ -37,10 +37,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.List = void 0;
38
38
  const action_1 = require("@itrocks/action");
39
39
  const action_2 = require("@itrocks/action");
40
+ const action_3 = require("@itrocks/action");
40
41
  const route_1 = require("@itrocks/route");
42
+ const route_2 = require("@itrocks/route");
41
43
  const storage_1 = require("@itrocks/storage");
42
44
  let List = (() => {
43
- let _classDecorators = [(0, action_2.Need)('Store', 'new'), (0, route_1.Route)('/list')];
45
+ let _classDecorators = [(0, action_3.Need)('Store', 'new'), (0, route_1.Route)('/list')];
44
46
  let _classDescriptor;
45
47
  let _classExtraInitializers = [];
46
48
  let _classThis;
@@ -57,7 +59,14 @@ let List = (() => {
57
59
  async html(request) {
58
60
  const type = request.type;
59
61
  const objects = await (0, storage_1.dataSource)().search(type);
60
- return this.htmlTemplateResponse({ objects, type }, request, __dirname + '/list.html');
62
+ const generalActions = [];
63
+ const selectionActions = [];
64
+ const route = (0, route_2.routeOf)(this);
65
+ for (const action of (0, action_2.getActions)(type, route.slice(route.lastIndexOf('/') + 1))) {
66
+ const actions = (action.need === 'object') ? selectionActions : generalActions;
67
+ actions.push(action);
68
+ }
69
+ return this.htmlTemplateResponse({ generalActions, objects, selectionActions, type }, request, __dirname + '/list.html');
61
70
  }
62
71
  async json(request) {
63
72
  const objects = await (0, storage_1.dataSource)().search(request.type);
package/package.json CHANGED
@@ -4,14 +4,9 @@
4
4
  "email": "baptiste@pillot.fr"
5
5
  },
6
6
  "dependencies": {
7
- "@itrocks/action": "latest",
8
- "@itrocks/action-bar": "latest",
9
- "@itrocks/action-request": "latest",
7
+ "@itrocks/action-pack": "latest",
10
8
  "@itrocks/build": "latest",
11
- "@itrocks/route": "latest",
12
- "@itrocks/storage": "latest",
13
9
  "@itrocks/table": "latest",
14
- "@itrocks/ux-core": "latest",
15
10
  "@itrocks/xtarget": "latest"
16
11
  },
17
12
  "description": "Generic action-based object list navigation in HTML and JSON",
@@ -69,5 +64,5 @@
69
64
  "prepare": "prepare-module esm"
70
65
  },
71
66
  "types": "./cjs/list.d.ts",
72
- "version": "0.0.3"
67
+ "version": "0.0.5"
73
68
  }