wx-svelte-grid 2.6.0 → 2.6.2

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": "wx-svelte-grid",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "A fast, feature-rich Svelte DataGrid component",
5
5
  "productTag": "grid",
6
6
  "productTrial": false,
@@ -36,15 +36,15 @@
36
36
  "@svar-ui/lib-dom": "0.12.1",
37
37
  "@svar-ui/lib-state": "1.9.6",
38
38
  "@svar-ui/lib-svelte": "0.5.2",
39
- "@svar-ui/svelte-menu": "2.5.0",
40
- "@svar-ui/svelte-core": "2.5.0",
41
- "@svar-ui/svelte-toolbar": "2.5.0",
42
- "@svar-ui/grid-data-provider": "2.6.0",
43
- "@svar-ui/grid-locales": "2.6.0",
44
- "@svar-ui/grid-store": "2.6.0"
39
+ "@svar-ui/svelte-menu": "2.5.1",
40
+ "@svar-ui/svelte-core": "2.5.1",
41
+ "@svar-ui/svelte-toolbar": "2.5.1",
42
+ "@svar-ui/grid-data-provider": "2.6.2",
43
+ "@svar-ui/grid-locales": "2.6.2",
44
+ "@svar-ui/grid-store": "2.6.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@svar-ui/svelte-editor": "2.5.0",
47
+ "@svar-ui/svelte-editor": "2.5.1",
48
48
  "@svar-ui/svelte-filter": "2.5.0"
49
49
  },
50
50
  "files": [
@@ -120,12 +120,11 @@
120
120
  .filter(c => !c.hidden)
121
121
  .map(a => ({ ...a }));
122
122
  columns.forEach(a => {
123
- a.fixed = { left: 1 };
123
+ a.fixed = { left: 1, leftSize: $split.left };
124
124
  a.left = width;
125
125
  width += a.width;
126
126
  });
127
- if (columns.length)
128
- columns[columns.length - 1].fixed = { left: -1 };
127
+ if (columns.length) columns[columns.length - 1].fixed.left = -1;
129
128
  }
130
129
 
131
130
  return { columns, width };
@@ -3,10 +3,13 @@
3
3
  import { SuggestDropdown } from "@svar-ui/svelte-core";
4
4
  import { clickOutside } from "@svar-ui/lib-dom";
5
5
 
6
- let { editor, onaction, onsave, onapply } = $props();
6
+ let { editor, onaction, onsave, onapply, oncancel } = $props();
7
7
 
8
8
  let { value, renderedValue: text, options: filterOptions } = $state(editor);
9
- let { template, cell } = $state(editor?.config || {});
9
+
10
+ let { template, cell, dropdown = {} } = $state(editor?.config || {});
11
+
12
+ const dropdownOptions = $derived({ trackScroll: true, ...dropdown });
10
13
 
11
14
  let index = $derived(filterOptions.findIndex(a => a.id === value));
12
15
 
@@ -49,7 +52,13 @@
49
52
  onkeydown={e => keydown(e, index)}
50
53
  use:clickOutside={() => onsave(true)}
51
54
  />
52
- <SuggestDropdown items={filterOptions} onready={ready} onselect={updateValue}>
55
+ <SuggestDropdown
56
+ items={filterOptions}
57
+ onready={ready}
58
+ onselect={updateValue}
59
+ {...dropdownOptions}
60
+ {oncancel}
61
+ >
53
62
  {#snippet children({ option })}
54
63
  {#if template}
55
64
  {template(option)}
@@ -7,9 +7,12 @@
7
7
  let { editor, onaction, onsave, onapply, oncancel } = $props();
8
8
 
9
9
  let value = $state(editor.value || new Date());
10
-
11
- let template = $state(editor.config?.template);
12
- let cell = $state(editor.config?.cell);
10
+ let { template, cell, dropdown = {} } = $state(editor?.config || {});
11
+ const dropdownOptions = $derived({
12
+ trackScroll: true,
13
+ width: "auto",
14
+ ...dropdown,
15
+ });
13
16
 
14
17
  function updateValue({ value }) {
15
18
  onapply(value);
@@ -42,7 +45,7 @@
42
45
  <SvelteComponent data={editor.value} {onaction} />
43
46
  {:else}<span class="wx-text">{editor.renderedValue}</span>{/if}
44
47
  </div>
45
- <Dropdown width={"auto"}>
48
+ <Dropdown {...dropdownOptions} {oncancel}>
46
49
  <div use:clickOutside={() => onsave(true)}>
47
50
  <Calendar
48
51
  {value}
@@ -93,7 +93,7 @@
93
93
  background-color: var(--wx-background);
94
94
  color: var(--wx-color-font);
95
95
  position: relative;
96
- z-index: 3;
96
+ z-index: 2;
97
97
  }
98
98
  .wx-cell :global(.wx-dropdown) {
99
99
  border: var(--wx-table-editor-dropdown-border);
@@ -3,17 +3,23 @@
3
3
  import { clickOutside } from "@svar-ui/lib-dom";
4
4
  import { onMount } from "svelte";
5
5
 
6
- let { editor, onaction, onsave, onapply, oncancel } = $props();
6
+ let { editor, onaction, onsave, onapply } = $props();
7
7
  let { config } = $state(editor);
8
8
 
9
9
  const options = $derived(editor?.options ?? []);
10
10
  let value = $derived(editor?.value || []);
11
11
  let renderedValue = $derived(editor?.renderedValue);
12
+
12
13
  let index = $derived.by(() => {
13
14
  const firstSelected = options.find(opt => value.includes(opt.id));
14
15
  return firstSelected ? options.indexOf(firstSelected) : -1;
15
16
  });
16
17
 
18
+ const dropdownOptions = $derived.by(() => {
19
+ const dropdown = config?.dropdown || {};
20
+ return { trackScroll: true, ...dropdown };
21
+ });
22
+
17
23
  function updateValue({ id }) {
18
24
  onapply(id);
19
25
  node.focus();
@@ -44,7 +50,7 @@
44
50
  bind:this={node}
45
51
  class="wx-value"
46
52
  tabindex="0"
47
- onclick={oncancel}
53
+ onclick={() => onsave()}
48
54
  onkeydown={ev => {
49
55
  keydown(ev, index);
50
56
  ev.preventDefault();
@@ -69,6 +75,8 @@
69
75
  onselect={updateValue}
70
76
  checkboxes={true}
71
77
  multiselect={true}
78
+ {...dropdownOptions}
79
+ oncancel={() => onsave()}
72
80
  {value}
73
81
  >
74
82
  {#snippet children({ option })}
@@ -7,7 +7,8 @@
7
7
 
8
8
  let data = $state(editor.options.find(opt => opt.id === editor.value));
9
9
  let { value, options } = $state(editor);
10
- let { template, cell } = $state(editor?.config || {});
10
+ let { template, cell, dropdown = {} } = $state(editor?.config || {});
11
+ const dropdownOptions = $derived({ trackScroll: true, ...dropdown });
11
12
 
12
13
  let index = $derived(options.findIndex(a => a.id === value));
13
14
 
@@ -55,7 +56,13 @@
55
56
  <SvelteComponent {data} {onaction} />
56
57
  {:else}<span class="wx-text">{editor.renderedValue}</span>{/if}
57
58
  </div>
58
- <SuggestDropdown items={options} onready={ready} onselect={updateValue}>
59
+ <SuggestDropdown
60
+ items={options}
61
+ onready={ready}
62
+ onselect={updateValue}
63
+ {...dropdownOptions}
64
+ {oncancel}
65
+ >
59
66
  {#snippet children({ option })}
60
67
  {#if template}
61
68
  {template(option)}
@@ -18,7 +18,12 @@ export function getCssName(column, cell, columnStyle) {
18
18
 
19
19
  if (column.fixed) {
20
20
  for (const pos in column.fixed) {
21
- css += column.fixed[pos] === -1 ? "wx-shadow " : "wx-fixed ";
21
+ let isShadow = column.fixed[pos] === -1;
22
+ if (!isShadow && column.fixed.leftSize && cell.colspan) {
23
+ const spanIndex = cell.colspan + column._colindex - 1;
24
+ isShadow = spanIndex === column.fixed.leftSize;
25
+ }
26
+ css += isShadow ? "wx-shadow " : "wx-fixed ";
22
27
  }
23
28
  }
24
29
  css += cell.rowspan > 1 ? "wx-rowspan " : "";
package/whatsnew.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 2.6.2
2
+
3
+ ### Fixes
4
+
5
+ - Incorrect type for `filterValues`
6
+ - Multiselect editor value is not applied
7
+
8
+ ## 2.6.1
9
+
10
+ ### Fixes
11
+
12
+ - Impossible to configure inline editor dropdown
13
+ - Inline editor dropdown is detached during scroll
14
+ - Editor state object is mutated instead of being reset
15
+ - DataProvider adds trailing slash to getData url
16
+ - Incorrect height of sidebar Editor
17
+
1
18
  ## 2.6.0
2
19
 
3
20
  ### New features
@@ -13,6 +30,7 @@
13
30
 
14
31
  - Dropdown editors are cut off in small tables
15
32
  - DataGrid fails to initialize in SvelteKit with serverside rendering
33
+ - Error in fetching Typescript definitions from store
16
34
 
17
35
  ## 2.5.1
18
36