not-bulma 1.0.21 → 1.0.24

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.21",
3
+ "version": "1.0.24",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -58,6 +58,9 @@
58
58
  <UITextfield value={value?value.title:''} {fieldname} {placeholder} {icon} />
59
59
  {:else}
60
60
  <div class="control">
61
+ {#if readonly }
62
+ <p>{value}</p>
63
+ {:else}
61
64
  <AutoComplete
62
65
  {showClear}
63
66
  {disabled}
@@ -73,6 +76,7 @@
73
76
  {maxItemsToShowInList}
74
77
  bind:selectedItem={value}
75
78
  />
79
+ {/if}
76
80
  </div>
77
81
  <ErrorsList
78
82
  bind:errors={allErrors}
@@ -51,9 +51,13 @@ $: showErrors = (!(validated && valid) && (inputStarted));
51
51
 
52
52
  <div class="control {iconClasses}">
53
53
  <label class="checkbox" disabled={disabled} for="form-field-checkbox-{fieldname}">
54
+ {#if readonly }
55
+ <UIBooleans LC_TRUE={label} LC_FALSE={label} values={[{value}]} />
56
+ {:else}
54
57
  <input type="checkbox" id="form-field-checkbox-{fieldname}" bind:checked={value} placeholder="{placeholder}" name="{fieldname}" required={required} {readonly} invalid="{invalid}" on:change={onBlur} on:input={onInput} aria-controls="input-field-helper-{fieldname}"
55
58
  aria-describedby="input-field-helper-{fieldname}" disabled={disabled}>
56
- {$LOCALE[label]}
59
+ {$LOCALE[label]}
60
+ {/if}
57
61
  </label>
58
62
  </div>
59
63
  <ErrorsList
@@ -49,6 +49,9 @@
49
49
  </script>
50
50
 
51
51
  <div class="control {iconClasses}">
52
+ {#if readonly }
53
+ <p>{value}</p>
54
+ {:else}
52
55
  <input class="input {validationClasses}"
53
56
  id="form-field-date-{fieldname}"
54
57
  type="date" name="{fieldname}"
@@ -69,6 +72,7 @@
69
72
  {/if}
70
73
  </span>
71
74
  {/if}
75
+ {/if}
72
76
  </div>
73
77
  <ErrorsList
74
78
  bind:errors={allErrors}
@@ -50,6 +50,9 @@
50
50
 
51
51
 
52
52
  <div class="control {iconClasses}">
53
+ {#if readonly }
54
+ <p>{value}</p>
55
+ {:else}
53
56
  <input class="input {validationClasses}"
54
57
  id="form-field-email-{fieldname}"
55
58
  type="email" name="{fieldname}"
@@ -62,17 +65,18 @@
62
65
  aria-controls="input-field-helper-{fieldname}"
63
66
  on:change={onBlur} on:input={onInput}
64
67
  aria-describedby="input-field-helper-{fieldname}" />
65
- {#if icon }
66
- <span class="icon is-small is-left"><i class="fas fa-{icon}"></i></span>
67
- {/if}
68
- {#if validated === true }
69
- <span class="icon is-small is-right">
70
- {#if valid === true }
71
- <i class="fas fa-check"></i>
72
- {:else if (valid === false) }
73
- <i class="fas fa-exclamation-triangle"></i>
68
+ {#if icon }
69
+ <span class="icon is-small is-left"><i class="fas fa-{icon}"></i></span>
70
+ {/if}
71
+ {#if validated === true }
72
+ <span class="icon is-small is-right">
73
+ {#if valid === true }
74
+ <i class="fas fa-check"></i>
75
+ {:else if (valid === false) }
76
+ <i class="fas fa-exclamation-triangle"></i>
77
+ {/if}
78
+ </span>
74
79
  {/if}
75
- </span>
76
80
  {/if}
77
81
  </div>
78
82
  <ErrorsList
@@ -1,7 +1,8 @@
1
1
  <script>
2
2
  import {LOCALE} from '../../locale';
3
- import ErrorsList from '../various/ui.errors.list.svelte';
3
+ import ErrorsList from '../various/ui.errors.list.svelte';
4
4
  import UICommon from '../common.js';
5
+
5
6
  const CLEAR_MACRO = '__CLEAR__';
6
7
 
7
8
  import {createEventDispatcher} from 'svelte';
@@ -29,6 +30,17 @@
29
30
  $: invalid = ((valid===false) || (formLevelError));
30
31
  $: validationClasses = (valid===true || !inputStarted)?UICommon.CLASS_OK:UICommon.CLASS_ERR;
31
32
  $: multipleClass = multiple?' is-multiple ':'';
33
+ $: selectedVariants = Array.isArray(variants)?variants.filter(filterSelectedVariants):[];
34
+
35
+ function filterSelectedVariants(variant){
36
+ if(Array.isArray(value) && multiple){
37
+ return value.indexOf(variant.id) > -1;
38
+ }else if(value){
39
+ return value == variant.id;
40
+ }else{
41
+ return false;
42
+ }
43
+ }
32
44
 
33
45
  function onBlur(ev){
34
46
  let data = {
@@ -75,6 +87,11 @@
75
87
  </script>
76
88
 
77
89
  <div class="control {iconClasses}">
90
+ {#if readonly }
91
+ {#each selectedVariants as selectedVariant }
92
+ <span class="mr-2">{selectedVariant.title}</span>
93
+ {/each}
94
+ {:else}
78
95
  <div class="select {validationClasses} {multipleClass}">
79
96
  <select
80
97
  id="form-field-select-{fieldname}"
@@ -111,6 +128,7 @@
111
128
  {/if}
112
129
  </span>
113
130
  {/if}
131
+ {/if}
114
132
  </div>
115
133
  <ErrorsList
116
134
  bind:errors={allErrors}
@@ -3,6 +3,7 @@
3
3
  import 'bulma-switch';
4
4
  import UICommon from '../common.js';
5
5
  import ErrorsList from '../various/ui.errors.list.svelte';
6
+ import UIBooleans from '../various/ui.booleans.svelte';
6
7
  import {createEventDispatcher} from 'svelte';
7
8
  let dispatch = createEventDispatcher();
8
9
 
@@ -51,6 +52,14 @@ function onInput(ev){
51
52
  </script>
52
53
 
53
54
  <div class="control">
55
+ {#if readonly }
56
+ {#if value }
57
+ <UIBooleans values={[{value: false}]} />
58
+ {:else}
59
+ <UIBooleans values={[{value: true}]} />
60
+ {/if}
61
+ {:else}
62
+ <UIBooleans values={[{value: false}]} />
54
63
  <input type="checkbox"
55
64
  class="switch {styling}"
56
65
  id="form-field-switch-{fieldname}"
@@ -63,7 +72,8 @@ function onInput(ev){
63
72
  aria-controls="input-field-helper-{fieldname}"
64
73
  aria-describedby="input-field-helper-{fieldname}"
65
74
  />
66
- <label class="label" for="form-field-switch-{fieldname}">{$LOCALE[label]}</label>
75
+ <label class="label" for="form-field-switch-{fieldname}"><UIBooleans values={[{value: true }]} /></label>
76
+ {/if}
67
77
  </div>
68
78
  <ErrorsList
69
79
  bind:errors={allErrors}
@@ -53,6 +53,9 @@ function onInput(ev){
53
53
  </script>
54
54
 
55
55
  <div class="control {iconClasses}">
56
+ {#if readonly }
57
+ <p>{value}</p>
58
+ {:else}
56
59
  <input id="form-field-telephone-{fieldname}"
57
60
  class="input {validationClasses}"
58
61
  type="tel"
@@ -80,6 +83,7 @@ function onInput(ev){
80
83
  {/if}
81
84
  </span>
82
85
  {/if}
86
+ {/if}
83
87
  </div>
84
88
  <ErrorsList
85
89
  bind:errors={allErrors}
@@ -49,6 +49,9 @@ let dispatch = createEventDispatcher();
49
49
  </script>
50
50
 
51
51
  <div class="control {iconClasses}">
52
+ {#if readonly }
53
+ <p>{value}</p>
54
+ {:else}
52
55
  <textarea
53
56
  id="form-field-textarea-{fieldname}"
54
57
  {invalid}
@@ -73,6 +76,7 @@ let dispatch = createEventDispatcher();
73
76
  {/if}
74
77
  </span>
75
78
  {/if}
79
+ {/if}
76
80
  </div>
77
81
  <ErrorsList
78
82
  bind:errors={allErrors}
@@ -47,6 +47,9 @@
47
47
 
48
48
  </script>
49
49
  <div class="control {iconClasses}">
50
+ {#if readonly }
51
+ <p>{value}</p>
52
+ {:else}
50
53
  <input id="form-field-textfield-{fieldname}"
51
54
  class="input {validationClasses}"
52
55
  type="text" name="{fieldname}"
@@ -70,6 +73,7 @@
70
73
  {/if}
71
74
  </span>
72
75
  {/if}
76
+ {/if}
73
77
  </div>
74
78
  <ErrorsList
75
79
  bind:errors={allErrors}
@@ -6,4 +6,4 @@ import UITitle from './ui.title.svelte';
6
6
  import UIErrorsList from './ui.errors.list.svelte';
7
7
  import UIUserCard from './ui.user.card.svelte';
8
8
 
9
- export { UIBooleans, UIIndicator, UIProgress, UITag, UIUserCard, UITitle };
9
+ export { UIErrorsList, UIBooleans, UIIndicator, UIProgress, UITag, UIUserCard, UITitle };
@@ -52,7 +52,7 @@ export default class CRUDActionUpdate{
52
52
  });
53
53
 
54
54
  controller.ui[ACTION].on('submit', async (ev) => {
55
- const success = await controller.onActionSubmit(ACTION, ev.detail);
55
+ const success = await controller.onActionSubmit(ACTION, ev);
56
56
  if(success){
57
57
  setTimeout(() => controller.goDetails(id), 1000);
58
58
  }
@@ -192,7 +192,7 @@ class notCRUD extends notController {
192
192
  }
193
193
 
194
194
  async onActionSubmit(action, item){
195
- let result = true;
195
+ let state = true;
196
196
  const actionUI = this.ui[action];
197
197
  if(actionUI){
198
198
  try{