not-bulma 1.0.86 → 1.0.89

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.86",
3
+ "version": "1.0.89",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -0,0 +1,103 @@
1
+ <script>
2
+ import ErrorsList from "../various/ui.errors.list.svelte";
3
+ import { createEventDispatcher } from "svelte";
4
+ let dispatch = createEventDispatcher();
5
+
6
+ import { UIColumns, UIColumn } from "../layout";
7
+ import { UIButton } from "../button";
8
+ import UINumber from "../form/ui.number.svelte";
9
+ import UITextfield from "../form/ui.textfield.svelte";
10
+ import { UITitle } from "../various";
11
+
12
+ export let fieldname = "numbers_list";
13
+ export let value = {};
14
+ export let label = "named numbers list";
15
+
16
+ export let inputStarted = false;
17
+ export let placeholder = "new item";
18
+ export let readonly = false;
19
+ export let valid = true;
20
+ export let validated = false;
21
+ export let errors = false;
22
+ export let formErrors = false;
23
+
24
+ $: list = Object.keys(value).map((name) => {
25
+ return {
26
+ id: name,
27
+ title: name,
28
+ number: value[name],
29
+ };
30
+ });
31
+
32
+ $: allErrors = [].concat(
33
+ errors ? errors : [],
34
+ formErrors ? formErrors : []
35
+ );
36
+ $: showErrors = !(validated && valid) && inputStarted;
37
+ $: validationClasses =
38
+ valid === true || !inputStarted
39
+ ? UICommon.CLASS_OK
40
+ : UICommon.CLASS_ERR;
41
+
42
+ function remove(id) {
43
+ if (Object.hasOwn(value, id)) {
44
+ delete value[id];
45
+ value = value;
46
+ dispatch('change', {value: field: fieldname});
47
+ }
48
+ }
49
+
50
+ function add() {
51
+ const id = newVal.id.trim();
52
+ const number = parseInt(newVal.number);
53
+ if (id && id !== "" && !isNaN(number) && !Object.hasOwn(value, id)) {
54
+ value[id] = number;
55
+ }
56
+ dispatch('change', {value: field: fieldname});
57
+ }
58
+
59
+ const createNewVal = () => {
60
+ return {
61
+ id: placeholder,
62
+ number: 0,
63
+ };
64
+ };
65
+
66
+ let newVal = createNewVal();
67
+ </script>
68
+
69
+ <UITitle title={label} size={5} />
70
+ {#each list as item (item.id)}
71
+ <UIColumns>
72
+ <UIColumn classes="is-6">
73
+ {item.title}
74
+ </UIColumn>
75
+ <UIColumn classes="is-4">
76
+ {item.number}
77
+ </UIColumn>
78
+ {#if !readonly}
79
+ <UIColumn classes="is-2">
80
+ <UIButton icon={"minus"} action={() => remove(item.id)} />
81
+ </UIColumn>
82
+ {/if}
83
+ </UIColumns>
84
+ {/each}
85
+ {#if !readonly}
86
+ <UIColumns>
87
+ <UIColumn classes="is-6">
88
+ <UITextfield bind:value={newVal.id} />
89
+ </UIColumn>
90
+ <UIColumn classes="is-4">
91
+ <UINumber bind:value={newVal.number} />
92
+ </UIColumn>
93
+ <UIColumn classes="is-2">
94
+ <UIButton icon={"plus"} action={() => add()} />
95
+ </UIColumn>
96
+ </UIColumns>
97
+ {/if}
98
+ <ErrorsList
99
+ bind:errors={allErrors}
100
+ bind:show={showErrors}
101
+ bind:classes={validationClasses}
102
+ id="input-field-helper-{fieldname}"
103
+ />
@@ -4,6 +4,8 @@ import {
4
4
  UIEndlessList,
5
5
  } from "./endless";
6
6
 
7
+ import FUINamedNumbersList from "./field.ui.named.numbers.list.svelte";
8
+
7
9
  import UIList from "./ui.list.svelte";
8
10
  import UIListItem from "./ui.list.item.svelte";
9
11
  import UIListEmptyPlaceholder from "./ui.list.empty.placeholder.svelte";
@@ -20,4 +22,5 @@ export {
20
22
  UIListItem,
21
23
  UIListEmptyPlaceholder,
22
24
  UIListSelect,
25
+ FUINamedNumbersList,
23
26
  };
@@ -163,6 +163,7 @@ class notForm extends notBase {
163
163
  this.on(`change.${master}`, (value) => {
164
164
  this.#execSlaveRule(rule, master, slaves, value);
165
165
  });
166
+ this.emit(`change.${master}`, this.getFormData()[master]);
166
167
  }
167
168
 
168
169
  #execSlaveRule(rule, master, slaves, value) {
@@ -175,6 +175,7 @@ class CRUDGenericAction {
175
175
  },
176
176
  validators: controller.getOptions("Validators"),
177
177
  variants: controller.getOptions(`variants.${this.ACTION}`, {}),
178
+ masters: controller.getOptions(`${this.ACTION}.masters`, {}),
178
179
  },
179
180
  data: this.TRANSFORMER(response.result),
180
181
  };
@@ -1,5 +1,5 @@
1
1
  import CRUDGenericAction from "./action";
2
- import notCommon from '../../../common';
2
+ import notCommon from "../../../common";
3
3
  const ACTION = "create";
4
4
  const DEFAUL_BREADCRUMB_TAIL = "Создание";
5
5
 
@@ -41,7 +41,7 @@ class CRUDGenericActionCreate extends CRUDGenericAction {
41
41
  return !reponse;
42
42
  }
43
43
 
44
- static getTitle(contoller, params, response){
44
+ static getTitle(contoller, params, response) {
45
45
  return contoller.getItemTitle(response);
46
46
  }
47
47
 
@@ -55,12 +55,12 @@ class CRUDGenericActionCreate extends CRUDGenericAction {
55
55
  name: `${controller.getName()}.${this.ACTION}Form`,
56
56
  validators: controller.getOptions("Validators"),
57
57
  variants: controller.getOptions(`variants.${this.ACTION}`, {}),
58
+ masters: controller.getOptions(`${this.ACTION}.masters`, {}),
58
59
  },
59
60
  data: this.TRANSFORMER(response),
60
61
  };
61
62
  }
62
63
 
63
-
64
64
  /**
65
65
  * Binds events to action UI
66
66
  * @param {object} controller instance of controller
@@ -65,6 +65,7 @@ class CRUDGenericActionUpdate extends CRUDGenericAction {
65
65
  variants: controller.getOptions(`variants.${this.ACTION}`, {}),
66
66
  ui: controller.getOptions(`${this.ACTION}.ui`, {}),
67
67
  fields: controller.getOptions(`${this.ACTION}.fields`, {}),
68
+ masters: controller.getOptions(`${this.ACTION}.masters`, {}),
68
69
  },
69
70
  data: this.TRANSFORMER(notCommon.stripProxy(response.result)),
70
71
  };
@@ -36,6 +36,7 @@ import {
36
36
  UIForm,
37
37
  notForm,
38
38
  notFormSet,
39
+ notFormRules,
39
40
  notFormUtils,
40
41
  notFormHelpers,
41
42
  notBreadcrumbs,
@@ -69,6 +70,7 @@ export {
69
70
  notFormSet,
70
71
  notFormUtils,
71
72
  notFormHelpers,
73
+ notFormRules,
72
74
  notInterface,
73
75
  notPath,
74
76
  notRecord,