not-bulma 1.0.74 → 1.0.75

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-bulma",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -3,6 +3,7 @@
3
3
  import UITitle from "../various/ui.title.svelte";
4
4
  export let idFieldName = "id";
5
5
  export let items = [];
6
+ export let actions = [];
6
7
 
7
8
  export let itemClasses = "";
8
9
 
@@ -28,6 +29,7 @@
28
29
  {imageComponent}
29
30
  {imageComponentProps}
30
31
  {...item}
32
+ listActions={actions}
31
33
  classes={itemClasses}
32
34
  value={item}
33
35
  on:click
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { createEventDispatcher } from "svelte";
2
+ import { createEventDispatcher, onMount } from "svelte";
3
3
  const dispatch = createEventDispatcher();
4
4
 
5
5
  import UITitle from "../various/ui.title.svelte";
@@ -8,6 +8,7 @@
8
8
  export let title;
9
9
  export let description;
10
10
  export let actions = [];
11
+ export let listActions = [];
11
12
  export let classes = "";
12
13
  export let image = "";
13
14
  //value of item, will be passed to event handlers
@@ -23,6 +24,10 @@
23
24
  function onClick() {
24
25
  dispatch("click", value);
25
26
  }
27
+ let allActions = [];
28
+ $: allActions = [...actions, ...listActions].map((btn) => {
29
+ return { ...btn, action: () => btn.action(value) };
30
+ });
26
31
  </script>
27
32
 
28
33
  <div class="list-item {classes}" on:click|preventDefault={onClick}>
@@ -101,9 +106,9 @@
101
106
  </div>
102
107
  {/if}
103
108
  </div>
104
- {#if actions && actions.length}
109
+ {#if allActions && allActions.length}
105
110
  <div class="list-item-controls">
106
- <UIButtons values={actions} right={true} />
111
+ <UIButtons values={allActions} right={true} />
107
112
  </div>
108
113
  {/if}
109
114
  </div>
@@ -6,6 +6,7 @@
6
6
 
7
7
  export let classes = "";
8
8
  export let items = [];
9
+ export let actions = [];
9
10
 
10
11
  export let actionsVisible = false;
11
12
  export let itemsHoverable = false;
@@ -54,6 +55,7 @@
54
55
  {descriptionComponentProps}
55
56
  {imageComponent}
56
57
  {imageComponentProps}
58
+ {actions}
57
59
  on:click
58
60
  on:clickContent
59
61
  on:clickDescription
@@ -655,6 +655,14 @@ class notCommon {
655
655
  notCommon.getApp() &&
656
656
  notCommon.getApp().getWorking("router").navigate(url);
657
657
  }
658
+
659
+ static select(variantsSet, value, def) {
660
+ if (Object.hasOwn(variantsSet, value)) {
661
+ return variantsSet[value];
662
+ } else {
663
+ return def;
664
+ }
665
+ }
658
666
  }
659
667
 
660
668
  function absorbServices(target, src) {