not-bulma 2.0.16 → 2.0.18

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": "2.0.16",
3
+ "version": "2.0.18",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -1,6 +1,4 @@
1
1
  <script>
2
- import { run } from 'svelte/legacy';
3
-
4
2
  import UIBlock from "./ui.block.svelte";
5
3
  /**
6
4
  * @typedef {Object} Props
@@ -10,14 +8,15 @@
10
8
  */
11
9
 
12
10
  /** @type {Props} */
13
- let { id = $bindable(""), classes = "", children } = $props();
11
+ let { id, class: classes = "", children } = $props();
14
12
 
15
13
  let classesInner;
16
- run(() => {
14
+
15
+ $effect(() => {
17
16
  classesInner = `block-inner-vertical ${classes}`;
18
17
  });
19
18
  </script>
20
19
 
21
- <UIBlock bind:id bind:classes={classesInner}>
20
+ <UIBlock {id} class={classesInner}>
22
21
  {@render children?.()}
23
22
  </UIBlock>
@@ -1,9 +1,4 @@
1
1
  <script>
2
- import { createBubbler } from 'svelte/legacy';
3
-
4
- const bubble = createBubbler();
5
- import { createEventDispatcher } from "svelte";
6
- const dispatch = createEventDispatcher();
7
2
  /**
8
3
  * @typedef {Object} Props
9
4
  * @property {string} [id]
@@ -12,15 +7,17 @@
12
7
  */
13
8
 
14
9
  /** @type {Props} */
15
- let { id = "", classes = "", children } = $props();
10
+ let {
11
+ id = "",
12
+ class: classes = "",
13
+ role = "button",
14
+ onclick,
15
+ onkeyup,
16
+ onkeydown,
17
+ children,
18
+ } = $props();
16
19
  </script>
17
20
 
18
- <div
19
- {id}
20
- class="block {classes}"
21
- onclick={bubble('click')}
22
- onkeyup={() => dispatch("click")}
23
- role="button"
24
- >
21
+ <div {id} class="block {classes}" {role} {onclick} {onkeyup} {onkeydown}>
25
22
  {@render children?.()}
26
23
  </div>
@@ -1,9 +1,4 @@
1
1
  <script>
2
- import { createBubbler } from 'svelte/legacy';
3
-
4
- const bubble = createBubbler();
5
- import { createEventDispatcher } from "svelte";
6
- const dispatch = createEventDispatcher();
7
2
  /**
8
3
  * @typedef {Object} Props
9
4
  * @property {string} [id]
@@ -12,15 +7,17 @@
12
7
  */
13
8
 
14
9
  /** @type {Props} */
15
- let { id = "", classes = "", children } = $props();
10
+ let {
11
+ id = "",
12
+ class: classes = "",
13
+ role = "button",
14
+ onclick,
15
+ onkeyup,
16
+ onkeydown,
17
+ children,
18
+ } = $props();
16
19
  </script>
17
20
 
18
- <div
19
- {id}
20
- class="box {classes} "
21
- onclick={bubble('click')}
22
- onkeyup={() => dispatch("click")}
23
- role="button"
24
- >
21
+ <div {id} class="box {classes} " {onclick} {onkeyup} {onkeydown} {role}>
25
22
  {@render children?.()}
26
23
  </div>
@@ -1,9 +1,4 @@
1
1
  <script>
2
- import { createBubbler } from 'svelte/legacy';
3
-
4
- const bubble = createBubbler();
5
- import { createEventDispatcher } from "svelte";
6
- const dispatch = createEventDispatcher();
7
2
  /**
8
3
  * @typedef {Object} Props
9
4
  * @property {string} [id]
@@ -12,16 +7,17 @@
12
7
  */
13
8
 
14
9
  /** @type {Props} */
15
- let { id = "", classes = "", children } = $props();
10
+ let {
11
+ id = "",
12
+ class: classes = "",
13
+ role = "button",
14
+ onclick,
15
+ onkeyup,
16
+ onkeydown,
17
+ children,
18
+ } = $props();
16
19
  </script>
17
20
 
18
- <div
19
- role="button"
20
- tabindex="0"
21
- {id}
22
- class="content {classes}"
23
- onclick={bubble('click')}
24
- onkeyup={() => dispatch("click")}
25
- >
21
+ <div {id} class="content {classes} " {onclick} {onkeyup} {onkeydown} {role}>
26
22
  {@render children?.()}
27
23
  </div>
@@ -34,6 +34,11 @@
34
34
  descriptionComponentProps = {},
35
35
  imageComponent,
36
36
  imageComponentProps = {},
37
+ onclick = () => {},
38
+ onclickContent = () => {},
39
+ onclickDescription = () => {},
40
+ onclickImage = () => {},
41
+ onclickTitle = () => {},
37
42
  } = $props();
38
43
  </script>
39
44
 
@@ -52,15 +57,15 @@
52
57
  listActions={actions}
53
58
  listLinks={links}
54
59
  commonClasses={itemClasses}
55
- bind:value={items[index]}
60
+ bindvalue={items[index]}
56
61
  {index}
57
62
  first={index === 0}
58
63
  last={index === items.length - 1}
59
- on:click
60
- on:clickContent
61
- on:clickDescription
62
- on:clickImage
63
- on:clickTitle
64
+ {onclick}
65
+ {onclickContent}
66
+ {onclickDescription}
67
+ {onclickImage}
68
+ {onclickTitle}
64
69
  />
65
70
  {/each}
66
71
  {/if}
@@ -1,20 +1,12 @@
1
1
  <script>
2
- import { run, preventDefault } from 'svelte/legacy';
2
+ import { preventDefault } from "svelte/legacy";
3
3
 
4
- import { createEventDispatcher, onMount } from "svelte";
5
- const dispatch = createEventDispatcher();
4
+ import { onMount } from "svelte";
6
5
 
7
6
  import UITitle from "../various/ui.title.svelte";
8
7
  import UIButtons from "../button/ui.buttons.svelte";
9
8
  import UILinks from "../link/ui.links.svelte";
10
9
 
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
10
  /**
19
11
  * @typedef {Object} Props
20
12
  * @property {any} title
@@ -58,22 +50,27 @@
58
50
  descriptionComponent,
59
51
  descriptionComponentProps = {},
60
52
  imageComponent,
61
- imageComponentProps = {}
53
+ imageComponentProps = {},
54
+ onclick = () => {},
55
+ onclickImage = () => {},
56
+ onclickContent = () => {},
57
+ onclickTitle = () => {},
58
+ onclickDescription = () => {},
62
59
  } = $props();
63
60
 
64
61
  function onClick() {
65
- dispatch("click", value);
62
+ onclick(value);
66
63
  }
67
64
 
68
65
  let allActions = $state([]);
69
- run(() => {
66
+ $effect(() => {
70
67
  allActions = [...actions, ...listActions].map((btn) => {
71
68
  return { ...btn, action: () => btn.action(value) };
72
69
  });
73
70
  });
74
71
 
75
72
  let allLinks = $state([]);
76
- run(() => {
73
+ $effect(() => {
77
74
  allLinks = [...links, ...listLinks];
78
75
  });
79
76
  </script>
@@ -102,27 +99,21 @@
102
99
  onkeyup={preventDefault((e) => {
103
100
  if (e && e.key == "Enter") {
104
101
  onClick();
105
- dispatch("clickImage", value);
102
+ onclickImage(value);
106
103
  }
107
104
  })}
108
105
  onclick={preventDefault(() => {
109
106
  onClick();
110
- dispatch("clickImage", value);
107
+ onclickImage(value);
111
108
  })}
112
109
  >
113
110
  {#if imageComponent}
114
111
  {#if typeof image === "string"}
115
112
  {@const SvelteComponent = imageComponent}
116
- <SvelteComponent
117
- value={image}
118
- {...imageComponentProps}
119
- />
113
+ <SvelteComponent value={image} {...imageComponentProps} />
120
114
  {:else}
121
115
  {@const SvelteComponent_1 = imageComponent}
122
- <SvelteComponent_1
123
- {...image}
124
- {...imageComponentProps}
125
- />
116
+ <SvelteComponent_1 {...image} {...imageComponentProps} />
126
117
  {/if}
127
118
  {:else}
128
119
  <figure class="image is-64x64">
@@ -137,12 +128,12 @@
137
128
  class="list-item-content"
138
129
  onclick={preventDefault(() => {
139
130
  onClick();
140
- dispatch("clickContent", value);
131
+ onclickContent(value);
141
132
  })}
142
133
  onkeyup={preventDefault((e) => {
143
134
  if (e && e.key == "Enter") {
144
135
  onClick();
145
- dispatch("clickContent", value);
136
+ onclickContent(value);
146
137
  }
147
138
  })}
148
139
  >
@@ -154,12 +145,12 @@
154
145
  onkeyup={preventDefault((e) => {
155
146
  if (e && e.key == "Enter") {
156
147
  onClick();
157
- dispatch("clickTitle", value);
148
+ onclickTitle(value);
158
149
  }
159
150
  })}
160
151
  onclick={preventDefault(() => {
161
152
  onClick();
162
- dispatch("clickTitle", value);
153
+ onclickTitle(value);
163
154
  })}
164
155
  >
165
156
  {#if titleComponent}
@@ -168,14 +159,14 @@
168
159
  <SvelteComponent_2
169
160
  {title}
170
161
  {...titleComponentProps}
171
- on:change
162
+ {onchange}
172
163
  />
173
164
  {:else}
174
165
  {@const SvelteComponent_3 = titleComponent}
175
166
  <SvelteComponent_3
176
167
  {...title}
177
168
  {...titleComponentProps}
178
- on:change
169
+ {onchange}
179
170
  />
180
171
  {/if}
181
172
  {:else}
@@ -190,13 +181,13 @@
190
181
  onkeyup={preventDefault((e) => {
191
182
  if (e && e.key == "Enter") {
192
183
  onClick();
193
- dispatch("clickDescription", value);
184
+ onclickDescription(value);
194
185
  }
195
186
  })}
196
187
  class="list-item-description"
197
188
  onclick={preventDefault(() => {
198
189
  onClick();
199
- dispatch("clickDescription", value);
190
+ onclickDescription(value);
200
191
  })}
201
192
  >
202
193
  {#if descriptionComponent}
@@ -205,16 +196,16 @@
205
196
  <SvelteComponent_4
206
197
  value={description}
207
198
  {...descriptionComponentProps}
208
- on:change
209
- on:click
199
+ {onchange}
200
+ {onclick}
210
201
  />
211
202
  {:else}
212
203
  {@const SvelteComponent_5 = descriptionComponent}
213
204
  <SvelteComponent_5
214
205
  {...description}
215
206
  {...descriptionComponentProps}
216
- on:change
217
- on:click
207
+ {onchange}
208
+ {onclick}
218
209
  />
219
210
  {/if}
220
211
  {:else}
@@ -1,6 +1,6 @@
1
1
  <script>
2
- import { onMount, createEventDispatcher } from "svelte";
3
- const dispatch = createEventDispatcher();
2
+ import { onMount } from "svelte";
3
+
4
4
  //
5
5
  import UIList from "./ui.list.svelte";
6
6
  import UITitle from "../various/ui.title.svelte";
@@ -8,16 +8,6 @@
8
8
  import UIButtons from "../button/ui.buttons.svelte";
9
9
  import UIButtonsSwitchers from "../button/ui.buttons.switchers.svelte";
10
10
 
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
11
  /**
22
12
  * @typedef {Object} Props
23
13
  * @property {string} [fieldname]
@@ -82,11 +72,12 @@ value: variantId
82
72
  listComponentProps = {},
83
73
  actionsList = ["selectAll", "deselectAll"],
84
74
  sublimeValue = (value) => {
85
- return {
86
- groupId: value.group,
87
- valueId: value.id,
88
- };
89
- }
75
+ return {
76
+ groupId: value.group,
77
+ valueId: value.id,
78
+ };
79
+ },
80
+ onchange = () => {},
90
81
  } = $props();
91
82
  //
92
83
 
@@ -187,7 +178,7 @@ value: variantId
187
178
 
188
179
  function triggerChange() {
189
180
  value = getSelectedItems();
190
- dispatch("change", {
181
+ onchange({
191
182
  fieldname,
192
183
  value,
193
184
  });
@@ -200,7 +191,7 @@ value: variantId
200
191
 
201
192
  <SvelteComponent
202
193
  {...listComponentProps}
203
- bind:items={variants}
194
+ items={variants}
204
195
  {titleComponent}
205
196
  {titleComponentProps}
206
197
  {descriptionComponent}
@@ -1,26 +1,12 @@
1
1
  <script>
2
- import { onMount, createEventDispatcher } from "svelte";
3
- const dispatch = createEventDispatcher();
2
+ import { onMount } from "svelte";
3
+
4
4
  //
5
5
  import UIList from "./ui.list.svelte";
6
6
  import UITitle from "../various/ui.title.svelte";
7
7
  import UIImage from "../image/ui.image.svelte";
8
8
  import UIButtons from "../button/ui.buttons.svelte";
9
9
 
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
10
  /**
25
11
  * @typedef {Object} Props
26
12
  * @property {string} [fieldname]
@@ -72,22 +58,23 @@ value:object
72
58
  listComponentProps = {},
73
59
  sublimeValue = (value) => value.id,
74
60
  getItem = ({ valueId }) => {
75
- return variants.find((btnVal) => btnVal.value.id === valueId);
76
- },
61
+ return variants.find((btnVal) => btnVal.value.id === valueId);
62
+ },
77
63
  getItemValue = ({ valueId }) => {
78
- return getItem({ valueId }).value;
79
- },
64
+ return getItem({ valueId }).value;
65
+ },
80
66
  getDefaultItemSublime = () => {
81
- return variants[0].id;
82
- },
67
+ return variants[0].id;
68
+ },
83
69
  uiOn = (item) => {
84
- item.color = "success";
85
- item.outlined = false;
86
- },
70
+ item.color = "success";
71
+ item.outlined = false;
72
+ },
87
73
  uiOff = (item) => {
88
- item.color = false;
89
- item.outlined = true;
90
- }
74
+ item.color = false;
75
+ item.outlined = true;
76
+ },
77
+ onchange = () => {},
91
78
  } = $props();
92
79
 
93
80
  onMount(() => {
@@ -172,7 +159,7 @@ value:object
172
159
  //
173
160
  updateValue();
174
161
  //
175
- dispatch("change", {
162
+ onchange({
176
163
  field: fieldname,
177
164
  value,
178
165
  });
@@ -217,7 +204,7 @@ value:object
217
204
 
218
205
  <SvelteComponent
219
206
  {...listComponentProps}
220
- bind:items={variants}
207
+ items={variants}
221
208
  {titleComponent}
222
209
  {titleComponentProps}
223
210
  {descriptionComponent}
@@ -1,23 +1,12 @@
1
1
  <script>
2
- import { onMount, createEventDispatcher } from "svelte";
3
- const dispatch = createEventDispatcher();
2
+ import { onMount } from "svelte";
3
+
4
4
  //
5
5
  import UIList from "./ui.list.svelte";
6
6
  import UITitle from "../various/ui.title.svelte";
7
7
  import UIImage from "../image/ui.image.svelte";
8
8
  import UIButtons from "../button/ui.buttons.svelte";
9
9
 
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
10
  /**
22
11
  * @typedef {Object} Props
23
12
  * @property {string} [fieldname]
@@ -91,33 +80,36 @@ value: variantId
91
80
  listComponent = UIList,
92
81
  listComponentProps = {},
93
82
  sublimeValue = (value) => {
94
- return {
95
- groupId: value.group,
96
- valueId: value.id,
97
- };
98
- },
83
+ return {
84
+ groupId: value.group,
85
+ valueId: value.id,
86
+ };
87
+ },
99
88
  getItem = ({ groupId, valueId }) => {
100
- return variants
101
- .find((group) => group.id === groupId)
102
- .description.values.find((btnVal) => btnVal.value.id === valueId);
103
- },
89
+ return variants
90
+ .find((group) => group.id === groupId)
91
+ .description.values.find(
92
+ (btnVal) => btnVal.value.id === valueId
93
+ );
94
+ },
104
95
  getItemValue = ({ groupId, valueId }) => {
105
- return getItem({ groupId, valueId }).value;
106
- },
96
+ return getItem({ groupId, valueId }).value;
97
+ },
107
98
  getDefaultItemSublime = () => {
108
- return {
109
- groupId: variants[0].id,
110
- valueId: variants[0].description.values[0].value.id,
111
- };
112
- },
99
+ return {
100
+ groupId: variants[0].id,
101
+ valueId: variants[0].description.values[0].value.id,
102
+ };
103
+ },
113
104
  uiOn = (item) => {
114
- item.color = "success";
115
- item.outlined = false;
116
- },
105
+ item.color = "success";
106
+ item.outlined = false;
107
+ },
117
108
  uiOff = (item) => {
118
- item.color = false;
119
- item.outlined = false;
120
- }
109
+ item.color = false;
110
+ item.outlined = false;
111
+ },
112
+ onchange = () => {},
121
113
  } = $props();
122
114
 
123
115
  onMount(() => {
@@ -236,12 +228,12 @@ value: variantId
236
228
  //
237
229
  function toggle(detail) {
238
230
  let ui = updateSelected(detail);
239
- console.log("image value", value, ui);
231
+
240
232
  updateUI(ui);
241
233
  //
242
234
  updateValue();
243
235
  //
244
- dispatch("change", {
236
+ onchange({
245
237
  field: fieldname,
246
238
  value,
247
239
  });
@@ -313,7 +305,7 @@ value: variantId
313
305
 
314
306
  <SvelteComponent
315
307
  {...listComponentProps}
316
- bind:items={variants}
308
+ items={variants}
317
309
  {titleComponent}
318
310
  {titleComponentProps}
319
311
  {descriptionComponent}
@@ -4,13 +4,8 @@
4
4
  import UIListBlock from "./ui.list.block.svelte";
5
5
  import UITitle from "../various/ui.title.svelte";
6
6
 
7
-
8
-
9
-
10
7
  //customization
11
-
12
-
13
-
8
+
14
9
  /**
15
10
  * @typedef {Object} Props
16
11
  * @property {string} [classes]
@@ -58,7 +53,13 @@
58
53
  descriptionComponent,
59
54
  descriptionComponentProps = {},
60
55
  imageComponent,
61
- imageComponentProps = {}
56
+ imageComponentProps = {},
57
+ onchange = () => {},
58
+ onclick = () => {},
59
+ onclickContent = () => {},
60
+ onclickDescription = () => {},
61
+ onclickImage = () => {},
62
+ onclickTitle = () => {},
62
63
  } = $props();
63
64
  </script>
64
65
 
@@ -87,17 +88,15 @@
87
88
  {imageComponentProps}
88
89
  {actions}
89
90
  {links}
90
- on:change
91
- on:click
92
- on:clickContent
93
- on:clickDescription
94
- on:clickImage
95
- on:clickTitle
91
+ {onchange}
92
+ {onclick}
93
+ {onclickContent}
94
+ {onclickDescription}
95
+ {onclickImage}
96
+ {onclickTitle}
96
97
  />
97
98
  </div>
98
99
  {:else}
99
100
  {@const SvelteComponent = emptyListPlaceholderComponent}
100
- <SvelteComponent
101
- {...emptyListPlaceholderComponentProps}
102
- />
101
+ <SvelteComponent {...emptyListPlaceholderComponentProps} />
103
102
  {/if}
@@ -9,8 +9,6 @@
9
9
  import UITitle from "../various/ui.title.svelte";
10
10
  import UIButtonsRow from "../button/ui.buttons.row.svelte";
11
11
 
12
-
13
-
14
12
  /**
15
13
  * @typedef {Object} Props
16
14
  * @property {string} [buttonsPosition]
@@ -39,10 +37,10 @@
39
37
  title = "Modal window",
40
38
  subtitle = "",
41
39
  classes = "",
42
- overlayClasses = "",
40
+ overlayClasses = "modal-selector",
43
41
  buttonsClasses = "",
44
42
  WAITING_TEXT = "Обработка",
45
- children
43
+ children,
46
44
  } = $props();
47
45
  </script>
48
46
 
@@ -14,18 +14,28 @@
14
14
 
15
15
  /** @type {Props} */
16
16
  let {
17
+ class: classes = "loader-size-40-100",
17
18
  loading = false,
18
19
  size = "container",
19
20
  title = "Waiting...",
21
+ loaderContent,
22
+ children,
20
23
  } = $props();
24
+
25
+ const showWhenSizeIs = ["page", "container"];
21
26
  </script>
22
27
 
23
- {#if size !== "hidden"}
24
- <div
25
- class="{size === 'page' ? 'pageloader' : 'containerloader'} {loading
26
- ? 'is-active'
27
- : ''}"
28
- >
29
- <span class="title">{$LOCALE[title]}</span>
30
- </div>
31
- {/if}
28
+ {#snippet loaderTitle()}
29
+ <span class="title">{$LOCALE[title]}</span>
30
+ {/snippet}
31
+
32
+ <div class="loader-wrapper">
33
+ {@render children?.()}
34
+ {#if showWhenSizeIs.includes(size) && loading}
35
+ <div class={`${size}loader is-active ${classes}`}>
36
+ {#if loaderContent}
37
+ {@render loaderContent(size, title)}
38
+ {:else}{/if}
39
+ </div>
40
+ {/if}
41
+ </div>
@@ -99,9 +99,9 @@
99
99
  }
100
100
 
101
101
  function _onSelectAllToggle() {
102
- items.forEach((item) => {
102
+ /*items.forEach((item) => {
103
103
  selected[getItemId(item)] = selectAll;
104
- });
104
+ });*/
105
105
  if (selectAll) {
106
106
  onSelectAll(selected);
107
107
  } else {
@@ -157,6 +157,7 @@
157
157
  <UIButtons values={actions} />
158
158
  </div>
159
159
  {/if}
160
+
160
161
  {#if showSearch}
161
162
  {#if filterUI}
162
163
  {@const SvelteComponent = filterUI}
@@ -179,15 +180,25 @@
179
180
  </div>
180
181
  {/if}
181
182
  {/if}
182
- {#if state.updating}
183
- <UILoader loading={true} title="Загрузка..." size="container"></UILoader>
184
- {:else}
185
- {#if showTotals}
186
- <ul class="pagination-list">
187
- <li>Страниц: {state?.pagination?.pages?.count ?? 0}</li>
188
- <li>Записей: {state?.count ?? 0}</li>
189
- </ul>
190
- {/if}
183
+
184
+ {#if showTotals}
185
+ <UIButtons
186
+ disabled={true}
187
+ centered={true}
188
+ values={[
189
+ {
190
+ id: 1,
191
+ title: `Страниц: ${state?.pagination?.pages?.count ?? 0}`,
192
+ },
193
+ {
194
+ id: 2,
195
+ title: `Записей: ${state?.count ?? 0}`,
196
+ },
197
+ ]}
198
+ />
199
+ {/if}
200
+
201
+ <UILoader loading={state.updating} title="Загрузка..." size="container">
191
202
  <table class="table">
192
203
  <thead>
193
204
  {#if showSelect}
@@ -239,61 +250,62 @@
239
250
  {/each}
240
251
  </tbody>
241
252
  </table>
242
- {#if state?.pagination?.pages?.list.length >= 1}
243
- <nav class="pagination is-centered" aria-label="pagination">
244
- {#if enableButtonFirst}
245
- <a
246
- href
247
- class="pagination-first"
248
- onclick={preventDefault(onGoToFirstPage)}>Первая</a
249
- >
250
- {/if}
251
- {#if enableButtonPrev}
252
- <a
253
- href
254
- class="pagination-previous"
255
- onclick={preventDefault(onGoToPrevPage)}>Назад</a
256
- >
257
- {/if}
258
- {#if enableButtonNext}
259
- <a
260
- href
261
- class="pagination-next"
262
- onclick={preventDefault(onGoToNextPage)}>Вперед</a
263
- >
264
- {/if}
265
- {#if enableButtonLast}
266
- <a
267
- href
268
- class="pagination-last"
269
- onclick={preventDefault(onGoToLastPage)}
270
- >Последняя {state?.pagination.pages.count + 1}</a
271
- >
253
+ </UILoader>
254
+
255
+ {#if state?.pagination?.pages?.list.length >= 1}
256
+ <nav class="pagination is-centered" aria-label="pagination">
257
+ {#if enableButtonFirst}
258
+ <a
259
+ href
260
+ class="pagination-previous"
261
+ onclick={preventDefault(onGoToFirstPage)}>1</a
262
+ >
263
+ {/if}
264
+ {#if enableButtonPrev}
265
+ <a
266
+ href
267
+ class="pagination-previous"
268
+ onclick={preventDefault(onGoToPrevPage)}>Назад</a
269
+ >
270
+ {/if}
271
+ {#if enableButtonNext}
272
+ <a
273
+ href
274
+ class="pagination-next"
275
+ onclick={preventDefault(onGoToNextPage)}>Вперед</a
276
+ >
277
+ {/if}
278
+ {#if enableButtonLast}
279
+ <a
280
+ href
281
+ class="pagination-next"
282
+ onclick={preventDefault(onGoToLastPage)}
283
+ >{state?.pagination.pages.count}</a
284
+ >
285
+ {/if}
286
+ <ul class="pagination-list">
287
+ {#if state && state?.pagination && state?.pagination.pages && state?.pagination.pages.list}
288
+ {#each state?.pagination.pages.list as page (page.index)}
289
+ <li>
290
+ {#if page.active}
291
+ <a
292
+ href
293
+ class="pagination-link is-current"
294
+ aria-label="Страница {page.index}"
295
+ aria-current="page">{page.index + 1}</a
296
+ >
297
+ {:else}
298
+ <a
299
+ href
300
+ class="pagination-link"
301
+ aria-label="Страница {page.index}"
302
+ data-page={page.index}
303
+ onclick={_goTo}>{page.index + 1}</a
304
+ >
305
+ {/if}
306
+ </li>
307
+ {/each}
272
308
  {/if}
273
- <ul class="pagination-list">
274
- {#if state && state?.pagination && state?.pagination.pages && state?.pagination.pages.list}
275
- {#each state?.pagination.pages.list as page (page.index)}
276
- <li>
277
- {#if page.active}
278
- <a
279
- href
280
- class="pagination-link is-current"
281
- aria-label="Страница {page.index}"
282
- aria-current="page">{page.index + 1}</a
283
- >
284
- {:else}
285
- <a
286
- href
287
- class="pagination-link"
288
- aria-label="Страница {page.index}"
289
- data-page={page.index}
290
- onclick={_goTo}>{page.index + 1}</a
291
- >
292
- {/if}
293
- </li>
294
- {/each}
295
- {/if}
296
- </ul>
297
- </nav>
298
- {/if}
309
+ </ul>
310
+ </nav>
299
311
  {/if}
@@ -144,6 +144,10 @@ class notTable extends EventEmitter {
144
144
  }
145
145
  }
146
146
 
147
+ refresh(){
148
+ this.updateData();
149
+ }
150
+
147
151
  onWorkingUpdate(val) {
148
152
  this.#data.working = val;
149
153
  return val;
@@ -163,6 +167,7 @@ class notTable extends EventEmitter {
163
167
  onRefinedUpdate(val) {
164
168
  this.#data.refined = val;
165
169
  this.clearSelected();
170
+ this.afterSelectedUpdated();
166
171
  if (this.#ui && this.#ui.table) {
167
172
  this.#ui.table.set("items", this.#data.refined);
168
173
  }
@@ -195,9 +200,40 @@ class notTable extends EventEmitter {
195
200
  this.resetFilter();
196
201
  }
197
202
  }
203
+
204
+ onRowSelectChange({id, selected}){
205
+ if(selected){
206
+ this.#data.selected[id] = true
207
+ }else if(Object.hasOwn(this.#data.selected, id)){
208
+ delete this.#data.selected[id];
209
+ }
210
+ this.afterSelectedUpdated();
211
+ }
212
+
213
+
214
+ allFilteredSelected(){
215
+ return Object.keys(this.#data.selected).length === this.#data.filtered.length;
216
+ }
217
+
218
+ afterSelectedUpdated() {
219
+ if(this.#ui.table){
220
+ this.#ui.table.set("selected", this.#data.selected);
221
+ this.#ui.table.set(`selectAll`, this.allFilteredSelected());
222
+ }
223
+ }
224
+
225
+ selectAll() {
226
+ this.#data.filtered.forEach((item) => {
227
+ this.#data.selected[this.getItemId(item)] = true;
228
+ });
229
+ this.afterSelectedUpdated();
230
+ this.#ui.table.set(`selectAll`, true);
231
+ }
198
232
 
199
- onSelectedUpdate(val) {
200
- this.#data.selected = val;
233
+ selectNone() {
234
+ this.clearSelected();
235
+ this.afterSelectedUpdated();
236
+ this.#ui.table.set(`selectAll`, false);
201
237
  }
202
238
 
203
239
  clearSelected() {
@@ -227,18 +263,7 @@ class notTable extends EventEmitter {
227
263
  return this.getOptions("getItemId", DEFAULT_OPTIONS.getItemId)(item);
228
264
  }
229
265
 
230
- selectAll() {
231
- this.#data.filtered.forEach((item) => {
232
- this.#ui.table.set(`selected.${this.getItemId(item)}`, true);
233
- });
234
- }
235
-
236
- selectNone() {
237
- this.#data.filtered.forEach((item) => {
238
- this.#ui.table.set(`selected.${this.getItemId(item)}`, false);
239
- });
240
- }
241
-
266
+
242
267
  render() {
243
268
  if (!this.#ui.table) {
244
269
  this.#ui.table = new UIAdapterSvelte(
@@ -249,11 +274,9 @@ class notTable extends EventEmitter {
249
274
  filterUI: this.getOptions("filterUI", undefined),
250
275
  helpers: Object.assign({}, this.getHelpers()),
251
276
  fields: this.getOptions("fields"),
252
-
253
277
  actions: this.getActions(),
254
278
  links: this.getLinks(),
255
279
  search: "",
256
-
257
280
  showSelect: this.getOptions("showSelect"),
258
281
  showSearch: this.getOptions("showSearch"),
259
282
  showSort: this.getOptions("showSort"),
@@ -270,14 +293,17 @@ class notTable extends EventEmitter {
270
293
  );
271
294
  }
272
295
 
273
- this.#ui.table.$on("onSearchChange", (e) => this.onSearchChange(e));
274
- this.#ui.table.$on("onSorterChange", (e) => this.onSorterChange(e));
275
- this.#ui.table.$on("onFilterChange", (e) => this.onFilterChange(e));
276
- this.#ui.table.$on("onGoToPage", (e) => this.goToPage(e));
277
- this.#ui.table.$on("onGoToNextPage", () => this.goToNext());
278
- this.#ui.table.$on("onGoToPrevPage", () => this.goToPrev());
279
- this.#ui.table.$on("onGoToFirstPage", () => this.goToFirst());
280
- this.#ui.table.$on("onGoToLastPage", () => this.goToLast());
296
+ this.#ui.table.$on("onSelectAll", this.selectAll.bind(this));
297
+ this.#ui.table.$on("onSelectNone", this.selectNone.bind(this));
298
+ this.#ui.table.$on("onSearchChange", this.onSearchChange.bind(this));
299
+ this.#ui.table.$on("onSorterChange", this.onSorterChange.bind(this));
300
+ this.#ui.table.$on("onFilterChange", this.onFilterChange.bind(this));
301
+ this.#ui.table.$on("onRowSelectChange", this.onRowSelectChange.bind(this));
302
+ this.#ui.table.$on("onGoToPage", this.goToPage.bind(this));
303
+ this.#ui.table.$on("onGoToNextPage", this.goToNext.bind(this));
304
+ this.#ui.table.$on("onGoToPrevPage", this.goToPrev.bind(this));
305
+ this.#ui.table.$on("onGoToFirstPage", this.goToFirst.bind(this));
306
+ this.#ui.table.$on("onGoToLastPage", this.goToLast.bind(this));
281
307
  }
282
308
 
283
309
  getActions() {
@@ -578,12 +604,12 @@ class notTable extends EventEmitter {
578
604
  }
579
605
 
580
606
  goToFirst() {
581
- this.setState("pager.page", this.getState("pagination.pages.from"));
607
+ this.setState("pager.page", 0);
582
608
  this.updateData();
583
609
  }
584
610
 
585
611
  goToLast() {
586
- this.setState("pager.page", this.getState("pagination.pages.to"));
612
+ this.setState("pager.page", parseInt(this.getState("pagination.pages.count")) - 1);
587
613
  this.updateData();
588
614
  }
589
615
 
@@ -35,7 +35,7 @@
35
35
  e.preventDefault();
36
36
  onRowSelectChange({
37
37
  id: itemId,
38
- selected: e.currentTraget.checked,
38
+ selected: e.currentTarget.checked,
39
39
  });
40
40
  return false;
41
41
  }
@@ -115,45 +115,40 @@ export default class CRUDActionList {
115
115
  }
116
116
  }
117
117
 
118
- static prepareOptions(controller) {
119
- const DEFAULT_OPTIONS_TABLE = {
118
+ static defaultTableOptions(controller){
119
+ return {
120
120
  interface: controller.getOptions(`${ACTION}.interface`, {
121
121
  combined: true,
122
122
  factory: controller.getInterface(),
123
- }),
124
- fields: undefined,
125
- showSelect: undefined,
126
- getItemId: undefined,
127
- idField: undefined,
128
- preload: {},
123
+ }),
124
+ preload: {},
129
125
  filterUI: controller.getOptions(`${ACTION}.filterUI`),
130
126
  pager: { size: 50, page: 0 },
131
127
  sorter: {
132
128
  id: -1,
133
- },
134
- filter: undefined,
135
- ui: undefined,
129
+ },
136
130
  };
131
+ }
132
+
133
+ static prepareOptions(controller) {
137
134
  //forming actions buttons list
138
135
  let ACTIONS_LIST = [...controller.getOptions(`${ACTION}.actions`, [])];
139
136
  ACTIONS_LIST = this.tweakActionsList(controller, ACTIONS_LIST);
140
137
  //
138
+ const controllerOptions = {...controller.getOptions(ACTION)};
139
+ for (const key in controllerOptions){
140
+ if(typeof controllerOptions[key] === 'undefined'){
141
+ delete controllerOptions[key];
142
+ }
143
+ }
141
144
  const TABLE_OPTIONS = {
142
145
  options: {
143
- targetEl: controller.getContainerInnerElement(),
144
- endless: false,
146
+ ...this.defaultTableOptions(controller),
147
+ ...controllerOptions,
148
+ targetEl: controller.getContainerInnerElement(),
145
149
  actions: ACTIONS_LIST,
146
150
  },
147
151
  };
148
- Object.keys(DEFAULT_OPTIONS_TABLE).forEach((key) => {
149
- let optVal = controller.getOptions(
150
- `${ACTION}.${key}`,
151
- DEFAULT_OPTIONS_TABLE[key]
152
- );
153
- if (typeof optVal !== "undefined") {
154
- TABLE_OPTIONS.options[key] = optVal;
155
- }
156
- });
157
152
  return TABLE_OPTIONS;
158
153
  }
159
154
  }
@@ -71,6 +71,11 @@ export default class UIAdapterSvelte {
71
71
  return this;
72
72
  }
73
73
 
74
+ delete(propKey){
75
+ notPath.delete(propKey, this.#props, {});
76
+ return this;
77
+ }
78
+
74
79
  changeProp(propKey, changer){
75
80
  this.set(propKey, changer(this.get(propKey)));
76
81
  return this;
@@ -57,3 +57,12 @@
57
57
  transform:translateX(-50%);
58
58
  white-space:nowrap
59
59
  }
60
+
61
+ .loader-wrapper{
62
+ position: relative;
63
+ }
64
+
65
+ .loader-size-40-100{
66
+ min-height: 40vh;
67
+ min-width: 100%;
68
+ }
@@ -1,6 +1,6 @@
1
1
  .modal-selector.box {
2
2
  margin: 5vh auto auto auto;
3
- max-height: 90vh;
3
+ max-height: 100vh;
4
4
 
5
5
  &.fullscreen {
6
6
  width: 100vw;