not-bulma 1.0.50 → 1.0.52

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.50",
3
+ "version": "1.0.52",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -56,6 +56,7 @@
56
56
  "dependencies": {
57
57
  "babel-polyfill": "^6.26.0",
58
58
  "bulma": "^0.9.4",
59
+ "bulma-slider": "*",
59
60
  "bulma-pageloader": "*",
60
61
  "bulma-switch": "^2.0.4",
61
62
  "core-js": "^3.27.2",
@@ -1,97 +1,106 @@
1
1
  <script>
2
+ import "bulma-slider/src/sass/index.sass";
2
3
 
3
- import UICommon from '../common.js';
4
- import ErrorsList from '../various/ui.errors.list.svelte';
5
- import {createEventDispatcher} from 'svelte';
6
- let dispatch = createEventDispatcher();
4
+ import UICommon from "../common.js";
5
+ import ErrorsList from "../various/ui.errors.list.svelte";
6
+ import { createEventDispatcher } from "svelte";
7
+ let dispatch = createEventDispatcher();
7
8
 
8
- export let inputStarted = false;
9
- export let value = 10;
10
- export let min = 0;
11
- export let max = 100;
12
- export let step = 1;
13
- export let tickmarks = false;
14
- export let placeholder = 'range placeholder';
15
- export let fieldname = 'range';
16
- export let icon = false;
17
- export let required = true;
18
- export let disabled = false;
19
- export let readonly = false;
20
- export let valid = true;
21
- export let validated = false;
22
- export let errors = false;
23
- export let formErrors = false;
24
- export let formLevelError = false;
9
+ export let inputStarted = false;
10
+ export let value = 10;
11
+ export let min = 0;
12
+ export let max = 100;
13
+ export let step = 1;
14
+ export let tickmarks = false;
15
+ export let placeholder = "range placeholder";
16
+ export let fieldname = "range";
17
+ export let icon = false;
18
+ export let required = true;
19
+ export let disabled = false;
20
+ export let readonly = false;
21
+ export let valid = true;
22
+ export let validated = false;
23
+ export let errors = false;
24
+ export let formErrors = false;
25
+ export let formLevelError = false;
25
26
 
26
- $: iconClasses = (icon? ' has-icons-left ':'') + ' has-icons-right ';
27
- $: allErrors = [].concat(errors?errors:[], formErrors?formErrors:[]);
28
- $: showErrors = (!(validated && valid) && (inputStarted));
29
- $: invalid = ((valid===false) || (formLevelError));
30
- $: validationClasses = (valid===true || !inputStarted)?UICommon.CLASS_OK:UICommon.CLASS_ERR;
27
+ $: iconClasses = (icon ? " has-icons-left " : "") + " has-icons-right ";
28
+ $: allErrors = [].concat(
29
+ errors ? errors : [],
30
+ formErrors ? formErrors : []
31
+ );
32
+ $: showErrors = !(validated && valid) && inputStarted;
33
+ $: invalid = valid === false || formLevelError;
34
+ $: validationClasses =
35
+ valid === true || !inputStarted
36
+ ? UICommon.CLASS_OK
37
+ : UICommon.CLASS_ERR;
31
38
 
32
- function onBlur(/*ev*/){
33
- let data = {
34
- field: fieldname,
35
- value
36
- };
37
- inputStarted = true;
38
- dispatch('change', data);
39
- return true;
40
- }
41
-
42
- function onInput(ev){
43
- let data = {
44
- field: fieldname,
45
- value: ev.currentTarget.value
46
- };
47
- inputStarted = true;
48
- dispatch('change', data);
49
- return true;
50
- }
39
+ function onBlur(/*ev*/) {
40
+ let data = {
41
+ field: fieldname,
42
+ value,
43
+ };
44
+ inputStarted = true;
45
+ dispatch("change", data);
46
+ return true;
47
+ }
51
48
 
49
+ function onInput(ev) {
50
+ let data = {
51
+ field: fieldname,
52
+ value: ev.currentTarget.value,
53
+ };
54
+ inputStarted = true;
55
+ dispatch("change", data);
56
+ return true;
57
+ }
52
58
  </script>
53
- <div class="control {iconClasses}">
54
- {#if readonly }
55
- <p>{value}</p>
59
+
60
+ <div class="control {iconClasses}">
61
+ {#if readonly}
62
+ <p>{value}</p>
56
63
  {:else}
57
- <input id="form-field-range-{fieldname}"
58
- class="input {validationClasses}"
59
- type="range" name="{fieldname}"
60
- {min} {max} {step}
61
- list="form-field-range-{fieldname}-tickmarks"
62
- {invalid}
63
- {disabled}
64
- {required} {readonly}
65
- placeholder="{placeholder}"
66
- bind:value={value} autocomplete="{fieldname}"
67
- aria-controls="input-field-helper-{fieldname}"
68
- on:change={onBlur} on:input={onInput}
69
- aria-describedby="input-field-helper-{fieldname}" />
70
- {#if Array.isArray(tickmarks) && tickmarks.length }
71
- <datalist id="form-field-range-{fieldname}-tickmarks">
72
- {#each tickmarks as tickmark }
73
- <option value={tickmark.value} label={tickmark.label} />
74
- {/each}
75
- </datalist>
76
- {/if}
77
-
78
- {#if icon }
79
- <span class="icon is-small is-left"><i class="fas fa-{icon}"></i></span>
80
- {/if}
81
- {#if validated === true }
82
- <span class="icon is-small is-right">
83
- {#if valid === true }
84
- <i class="fas fa-check"></i>
85
- {:else if (valid === false) }
86
- <i class="fas fa-exclamation-triangle"></i>
87
- {/if}
88
- </span>
89
- {/if}
64
+ <input
65
+ id="form-field-range-{fieldname}"
66
+ class="input big-number slider has-output is-fullwidth is-success {validationClasses}"
67
+ type="range"
68
+ name={fieldname}
69
+ {min}
70
+ {max}
71
+ {step}
72
+ list="form-field-range-{fieldname}-tickmarks"
73
+ {invalid}
74
+ {disabled}
75
+ {required}
76
+ {readonly}
77
+ {placeholder}
78
+ bind:value
79
+ autocomplete={fieldname}
80
+ aria-controls="input-field-helper-{fieldname}"
81
+ on:change={onBlur}
82
+ on:input={onInput}
83
+ aria-describedby="input-field-helper-{fieldname}"
84
+ />
85
+ <output for="form-field-range-{fieldname}">{value}</output>
86
+ {#if Array.isArray(tickmarks) && tickmarks.length}
87
+ <datalist id="form-field-range-{fieldname}-tickmarks">
88
+ {#each tickmarks as tickmark}
89
+ <option value={tickmark.value} label={tickmark.label} />
90
+ {/each}
91
+ </datalist>
92
+ {/if}
93
+
94
+ {#if icon}
95
+ <span class="icon is-small is-left"
96
+ ><i class="fas fa-{icon}" /></span
97
+ >
98
+ {/if}
90
99
  {/if}
91
- </div>
92
- <ErrorsList
100
+ </div>
101
+ <ErrorsList
93
102
  bind:errors={allErrors}
94
103
  bind:show={showErrors}
95
104
  bind:classes={validationClasses}
96
105
  id="input-field-helper-{fieldname}"
97
- />
106
+ />
@@ -467,7 +467,7 @@ class notCommon {
467
467
  }
468
468
 
469
469
  static strLengthCap(str, MAX_TITLE_LENGTH = 50, POST_FIX = "...") {
470
- if (str.length > MAX_TITLE_LENGTH) {
470
+ if (typeof str === "string" && str.length > MAX_TITLE_LENGTH) {
471
471
  return str.substr(0, MAX_TITLE_LENGTH) + POST_FIX;
472
472
  } else {
473
473
  return str;
@@ -12,7 +12,7 @@ class notSideMenu extends Menu {
12
12
  section: "any",
13
13
  sectionTitle: "Меню",
14
14
  priority: 0,
15
- open: false,
15
+ open: true,
16
16
  };
17
17
 
18
18
  static options = {
@@ -22,9 +22,11 @@ class notSideMenu extends Menu {
22
22
  targetSelector: `#${TYPE}-menu`,
23
23
  toggleSelector: `.${TYPE}-menu-toggle`,
24
24
  root: "/",
25
- open: false,
25
+ open: true,
26
26
  navigate: (urls) => {
27
- this.hide();
27
+ if (this.isTouch()) {
28
+ this.hide();
29
+ }
28
30
  if (!this.isDirectNavigation() && this.app) {
29
31
  let func = this.app.getWorking("router");
30
32
  if (func) {
@@ -109,10 +111,12 @@ class notSideMenu extends Menu {
109
111
  this.resizeAsideAndMain(this.aside, this.main, this.nav);
110
112
  this.resizeMain(this.main, this.aside);
111
113
  window.addEventListener("resize", this.resizeMain.bind(this));
112
- if (this.getOptions().open) {
113
- this.show();
114
- } else {
115
- this.hide();
114
+ if (this.isTouch()) {
115
+ if (this.getOptions().open) {
116
+ this.show();
117
+ } else {
118
+ this.hide();
119
+ }
116
120
  }
117
121
  }
118
122
 
@@ -192,7 +196,11 @@ class notSideMenu extends Menu {
192
196
 
193
197
  static isOpen() {
194
198
  if (this.aside) {
195
- return this.aside.classList.contains("is-active");
199
+ if (this.isTouch()) {
200
+ return this.aside.classList.contains("is-active");
201
+ } else {
202
+ return !this.aside.classList.contains("is-closed");
203
+ }
196
204
  } else {
197
205
  return true;
198
206
  }