@svgrid/grid 1.2.21 → 1.2.23

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.
Files changed (190) hide show
  1. package/dist/GridFooter.svelte +34 -20
  2. package/dist/GridFooter.svelte.d.ts +8 -0
  3. package/dist/SvAutoComplete.svelte +100 -0
  4. package/dist/SvAutoComplete.svelte.d.ts +16 -0
  5. package/dist/SvButton.svelte +97 -0
  6. package/dist/SvButton.svelte.d.ts +23 -0
  7. package/dist/SvCalendar.svelte +669 -0
  8. package/dist/SvCalendar.svelte.d.ts +70 -0
  9. package/dist/SvCheckBox.svelte +81 -0
  10. package/dist/SvCheckBox.svelte.d.ts +19 -0
  11. package/dist/SvColorInput.svelte +187 -0
  12. package/dist/SvColorInput.svelte.d.ts +15 -0
  13. package/dist/SvComboBox.svelte +130 -0
  14. package/dist/SvComboBox.svelte.d.ts +15 -0
  15. package/dist/SvCountryInput.svelte +123 -0
  16. package/dist/SvCountryInput.svelte.d.ts +14 -0
  17. package/dist/SvDateTimePicker.svelte +322 -0
  18. package/dist/SvDateTimePicker.svelte.d.ts +37 -0
  19. package/dist/SvDropDownList.svelte +143 -0
  20. package/dist/SvDropDownList.svelte.d.ts +15 -0
  21. package/dist/SvForm.svelte +147 -0
  22. package/dist/SvForm.svelte.d.ts +29 -0
  23. package/dist/SvGauge.svelte +99 -0
  24. package/dist/SvGauge.svelte.d.ts +31 -0
  25. package/dist/SvGrid.controller.svelte.d.ts +16 -2
  26. package/dist/SvGrid.controller.svelte.js +63 -8
  27. package/dist/SvGrid.css +84 -31
  28. package/dist/SvGrid.helpers.d.ts +4 -0
  29. package/dist/SvGrid.helpers.js +40 -12
  30. package/dist/SvGrid.svelte +84 -5
  31. package/dist/SvGrid.types.d.ts +36 -0
  32. package/dist/SvGridDropdown.svelte +16 -30
  33. package/dist/SvGridDropdown.svelte.d.ts +4 -0
  34. package/dist/SvListBox.svelte +122 -0
  35. package/dist/SvListBox.svelte.d.ts +19 -0
  36. package/dist/SvMaskedInput.svelte +0 -0
  37. package/dist/SvMaskedInput.svelte.d.ts +15 -0
  38. package/dist/SvNumberInput.svelte +0 -0
  39. package/dist/SvNumberInput.svelte.d.ts +22 -0
  40. package/dist/SvPasswordInput.svelte +110 -0
  41. package/dist/SvPasswordInput.svelte.d.ts +22 -0
  42. package/dist/SvPhoneInput.svelte +0 -0
  43. package/dist/SvPhoneInput.svelte.d.ts +19 -0
  44. package/dist/SvRadioGroup.svelte +108 -0
  45. package/dist/SvRadioGroup.svelte.d.ts +23 -0
  46. package/dist/SvRating.svelte +111 -0
  47. package/dist/SvRating.svelte.d.ts +20 -0
  48. package/dist/SvRepeatButton.svelte +89 -0
  49. package/dist/SvRepeatButton.svelte.d.ts +21 -0
  50. package/dist/SvSlider.svelte +182 -0
  51. package/dist/SvSlider.svelte.d.ts +25 -0
  52. package/dist/SvSwitchButton.svelte +94 -0
  53. package/dist/SvSwitchButton.svelte.d.ts +19 -0
  54. package/dist/SvTabs.svelte +122 -0
  55. package/dist/SvTabs.svelte.d.ts +26 -0
  56. package/dist/SvTagsInput.svelte +81 -0
  57. package/dist/SvTagsInput.svelte.d.ts +19 -0
  58. package/dist/SvTimePicker.svelte +359 -0
  59. package/dist/SvTimePicker.svelte.d.ts +27 -0
  60. package/dist/SvToggleButton.svelte +57 -0
  61. package/dist/SvToggleButton.svelte.d.ts +16 -0
  62. package/dist/SvTree.svelte +210 -0
  63. package/dist/SvTree.svelte.d.ts +29 -0
  64. package/dist/build-api.js +78 -1
  65. package/dist/cdn/svgrid.js +10022 -5904
  66. package/dist/cdn/svgrid.svelte-external.js +8531 -4429
  67. package/dist/cell-render.d.ts +4 -0
  68. package/dist/cell-render.js +35 -1
  69. package/dist/clipboard.js +19 -1
  70. package/dist/collaboration.d.ts +2 -0
  71. package/dist/collaboration.js +4 -0
  72. package/dist/core.d.ts +22 -1
  73. package/dist/countries.d.ts +15 -0
  74. package/dist/countries.js +61 -0
  75. package/dist/datetime/date-core.d.ts +88 -0
  76. package/dist/datetime/date-core.js +165 -0
  77. package/dist/datetime/date-format.d.ts +39 -0
  78. package/dist/datetime/date-format.js +371 -0
  79. package/dist/datetime/date-restrict.d.ts +23 -0
  80. package/dist/datetime/date-restrict.js +50 -0
  81. package/dist/datetime/date-selection.d.ts +25 -0
  82. package/dist/datetime/date-selection.js +94 -0
  83. package/dist/datetime/mask.d.ts +21 -0
  84. package/dist/datetime/mask.js +90 -0
  85. package/dist/editing.d.ts +1 -1
  86. package/dist/editing.js +7 -0
  87. package/dist/editors/cell-editors.d.ts +2 -2
  88. package/dist/editors/cell-editors.js +3 -1
  89. package/dist/export-format.d.ts +178 -0
  90. package/dist/export-format.js +419 -0
  91. package/dist/hyperformula-adapter.d.ts +4 -0
  92. package/dist/hyperformula-adapter.js +15 -6
  93. package/dist/index.d.ts +36 -0
  94. package/dist/index.js +41 -0
  95. package/dist/list-option.d.ts +10 -0
  96. package/dist/list-option.js +7 -0
  97. package/dist/menus.js +18 -2
  98. package/dist/popover.d.ts +48 -0
  99. package/dist/popover.js +65 -0
  100. package/dist/row-resize.d.ts +4 -4
  101. package/dist/row-resize.js +8 -5
  102. package/dist/selection.d.ts +6 -0
  103. package/dist/selection.js +31 -5
  104. package/dist/server-data-source.d.ts +43 -0
  105. package/dist/server-data-source.js +100 -0
  106. package/dist/sparkline.js +8 -4
  107. package/dist/svgrid-wrapper.types.d.ts +26 -1
  108. package/package.json +6 -1
  109. package/src/GridFooter.svelte +34 -20
  110. package/src/SvAutoComplete.svelte +100 -0
  111. package/src/SvButton.svelte +97 -0
  112. package/src/SvCalendar.svelte +669 -0
  113. package/src/SvCalendar.test.ts +211 -0
  114. package/src/SvCheckBox.svelte +81 -0
  115. package/src/SvColorInput.svelte +187 -0
  116. package/src/SvComboBox.svelte +130 -0
  117. package/src/SvCountryInput.svelte +123 -0
  118. package/src/SvDateTimePicker.svelte +322 -0
  119. package/src/SvDateTimePicker.test.ts +136 -0
  120. package/src/SvDropDownList.svelte +143 -0
  121. package/src/SvForm.svelte +147 -0
  122. package/src/SvGauge.svelte +99 -0
  123. package/src/SvGrid.controller.svelte.ts +74 -8
  124. package/src/SvGrid.css +84 -31
  125. package/src/SvGrid.helpers.ts +41 -12
  126. package/src/SvGrid.svelte +84 -5
  127. package/src/SvGrid.types.ts +33 -0
  128. package/src/SvGridDropdown.svelte +16 -30
  129. package/src/SvListBox.svelte +122 -0
  130. package/src/SvMaskedInput.svelte +0 -0
  131. package/src/SvNumberInput.svelte +0 -0
  132. package/src/SvPasswordInput.svelte +110 -0
  133. package/src/SvPhoneInput.svelte +0 -0
  134. package/src/SvRadioGroup.svelte +108 -0
  135. package/src/SvRating.svelte +111 -0
  136. package/src/SvRepeatButton.svelte +89 -0
  137. package/src/SvSlider.svelte +182 -0
  138. package/src/SvSwitchButton.svelte +94 -0
  139. package/src/SvTabs.svelte +122 -0
  140. package/src/SvTagsInput.svelte +81 -0
  141. package/src/SvTimePicker.svelte +359 -0
  142. package/src/SvTimePicker.test.ts +98 -0
  143. package/src/SvToggleButton.svelte +57 -0
  144. package/src/SvTree.svelte +210 -0
  145. package/src/build-api.ts +115 -0
  146. package/src/cell-render.test.ts +38 -0
  147. package/src/cell-render.ts +43 -0
  148. package/src/clipboard.test.ts +18 -0
  149. package/src/clipboard.ts +24 -1
  150. package/src/collaboration.test.ts +30 -0
  151. package/src/collaboration.ts +6 -0
  152. package/src/core.ts +27 -3
  153. package/src/countries.ts +71 -0
  154. package/src/datetime/date-core.test.ts +217 -0
  155. package/src/datetime/date-core.ts +204 -0
  156. package/src/datetime/date-format.test.ts +121 -0
  157. package/src/datetime/date-format.ts +317 -0
  158. package/src/datetime/date-restrict.ts +60 -0
  159. package/src/datetime/date-selection.test.ts +129 -0
  160. package/src/datetime/date-selection.ts +137 -0
  161. package/src/datetime/mask.test.ts +36 -0
  162. package/src/datetime/mask.ts +84 -0
  163. package/src/editing.test.ts +22 -0
  164. package/src/editing.ts +7 -1
  165. package/src/editors/cell-editors.ts +7 -1
  166. package/src/export-data-api.test.ts +126 -0
  167. package/src/export-format.test.ts +107 -0
  168. package/src/export-format.ts +598 -0
  169. package/src/hyperformula-adapter.test.ts +35 -1
  170. package/src/hyperformula-adapter.ts +18 -6
  171. package/src/index.ts +71 -0
  172. package/src/list-option.ts +15 -0
  173. package/src/menus.ts +21 -2
  174. package/src/popover.ts +79 -0
  175. package/src/row-resize.test.ts +25 -0
  176. package/src/row-resize.ts +8 -5
  177. package/src/selection.test.ts +36 -4
  178. package/src/selection.ts +30 -9
  179. package/src/server-data-source.test.ts +201 -0
  180. package/src/server-data-source.ts +148 -0
  181. package/src/sparkline.test.ts +9 -0
  182. package/src/sparkline.ts +9 -4
  183. package/src/svgrid-wrapper.types.ts +28 -1
  184. package/src/svgrid.behavior.test.ts +27 -0
  185. package/src/svgrid.new-features.wrapper.test.ts +27 -1
  186. package/src/ui-buttons.test.ts +105 -0
  187. package/src/ui-composite.test.ts +89 -0
  188. package/src/ui-inputs.test.ts +92 -0
  189. package/src/ui-range.test.ts +61 -0
  190. package/src/ui-selection.test.ts +106 -0
@@ -0,0 +1,61 @@
1
+ /** Group E (slider + gauge) component tests. */
2
+ import { describe, expect, it } from 'vitest'
3
+ import { mount, unmount, flushSync } from 'svelte'
4
+ import SvSlider from './SvSlider.svelte'
5
+ import SvGauge from './SvGauge.svelte'
6
+
7
+ function mnt(Comp: any, props: Record<string, unknown>) {
8
+ const target = document.createElement('div')
9
+ document.body.appendChild(target)
10
+ const app = mount(Comp, { target, props: props as any })
11
+ flushSync()
12
+ return { target, destroy: () => { unmount(app); target.remove() } }
13
+ }
14
+
15
+ describe('SvSlider', () => {
16
+ it('single: arrow keys step within bounds', () => {
17
+ let got: any
18
+ const { target, destroy } = mnt(SvSlider, { value: 50, min: 0, max: 100, step: 5, onChange: (v: any) => (got = v) })
19
+ try {
20
+ const thumb = target.querySelector<HTMLElement>('[role="slider"]')!
21
+ expect(thumb.getAttribute('aria-valuenow')).toBe('50')
22
+ thumb.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowRight', bubbles: true }))
23
+ flushSync()
24
+ expect(got).toBe(55)
25
+ thumb.dispatchEvent(new KeyboardEvent('keydown', { key: 'Home', bubbles: true }))
26
+ flushSync()
27
+ expect(got).toBe(0)
28
+ } finally { destroy() }
29
+ })
30
+ it('range: two thumbs, low thumb capped at high value', () => {
31
+ let got: any
32
+ const { target, destroy } = mnt(SvSlider, { value: [20, 80], range: true, min: 0, max: 100, step: 10, onChange: (v: any) => (got = v) })
33
+ try {
34
+ const thumbs = target.querySelectorAll<HTMLElement>('[role="slider"]')
35
+ expect(thumbs.length).toBe(2)
36
+ thumbs[0]!.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowRight', bubbles: true }))
37
+ flushSync()
38
+ expect(got).toEqual([30, 80])
39
+ } finally { destroy() }
40
+ })
41
+ })
42
+
43
+ describe('SvGauge', () => {
44
+ it('exposes a meter role with clamped value + label', () => {
45
+ const { target, destroy } = mnt(SvGauge, { value: 150, min: 0, max: 100 })
46
+ try {
47
+ const meter = target.querySelector('[role="meter"]')!
48
+ expect(meter.getAttribute('aria-valuenow')).toBe('100') // clamped to max
49
+ expect(target.querySelector('.sv-gauge__label')!.textContent).toContain('100')
50
+ } finally { destroy() }
51
+ })
52
+ it('renders one path per band when bands are given', () => {
53
+ const { target, destroy } = mnt(SvGauge, {
54
+ value: 50, bands: [{ from: 0, to: 50, color: '#16a34a' }, { from: 50, to: 100, color: '#dc2626' }],
55
+ })
56
+ try {
57
+ // track + 2 bands = 3 paths, no value arc
58
+ expect(target.querySelectorAll('path').length).toBe(3)
59
+ } finally { destroy() }
60
+ })
61
+ })
@@ -0,0 +1,106 @@
1
+ /** Group D (selection overlays) component tests. Panels portal to <body>. */
2
+ import { describe, expect, it, afterEach } from 'vitest'
3
+ import { mount, unmount, flushSync } from 'svelte'
4
+ import SvListBox from './SvListBox.svelte'
5
+ import SvDropDownList from './SvDropDownList.svelte'
6
+ import SvComboBox from './SvComboBox.svelte'
7
+ import SvTagsInput from './SvTagsInput.svelte'
8
+ import SvCountryInput from './SvCountryInput.svelte'
9
+
10
+ function mnt(Comp: any, props: Record<string, unknown>) {
11
+ const target = document.createElement('div')
12
+ document.body.appendChild(target)
13
+ const app = mount(Comp, { target, props: props as any })
14
+ flushSync()
15
+ return { target, destroy: () => { unmount(app); target.remove() } }
16
+ }
17
+
18
+ afterEach(() => {
19
+ document.querySelectorAll('.sv-ddl__panel, .sv-country__panel').forEach((n) => n.remove())
20
+ })
21
+
22
+ const OPTS = [
23
+ { value: 'a', label: 'Apple' },
24
+ { value: 'b', label: 'Banana' },
25
+ { value: 'c', label: 'Cherry' },
26
+ ]
27
+
28
+ describe('SvListBox', () => {
29
+ it('single select emits scalar; multi toggles array', () => {
30
+ let got: any
31
+ const a = mnt(SvListBox, { options: OPTS, value: 'a', onChange: (v: any) => (got = v) })
32
+ try {
33
+ a.target.querySelectorAll<HTMLElement>('.sv-listbox__opt')[2]!.click(); flushSync()
34
+ expect(got).toBe('c')
35
+ } finally { a.destroy() }
36
+ const b = mnt(SvListBox, { options: OPTS, value: ['a'], multiple: true, onChange: (v: any) => (got = v) })
37
+ try {
38
+ b.target.querySelectorAll<HTMLElement>('.sv-listbox__opt')[1]!.click(); flushSync()
39
+ expect(got).toEqual(['a', 'b'])
40
+ } finally { b.destroy() }
41
+ })
42
+ })
43
+
44
+ describe('SvDropDownList', () => {
45
+ it('opens a portalled listbox and picks a value', () => {
46
+ let got: any
47
+ const { target, destroy } = mnt(SvDropDownList, { options: OPTS, value: null, onChange: (v: any) => (got = v) })
48
+ try {
49
+ target.querySelector<HTMLButtonElement>('.sv-ddl')!.click(); flushSync()
50
+ const panel = document.querySelector('.sv-ddl__panel')!
51
+ expect(panel).not.toBeNull()
52
+ panel.querySelectorAll<HTMLElement>('.sv-ddl__opt')[1]!.click(); flushSync()
53
+ expect(got).toBe('b')
54
+ expect(document.querySelector('.sv-ddl__panel')).toBeNull() // closed
55
+ } finally { destroy() }
56
+ })
57
+ })
58
+
59
+ describe('SvComboBox', () => {
60
+ it('filters as you type and picks a match', () => {
61
+ let got: any
62
+ const { target, destroy } = mnt(SvComboBox, { options: OPTS, value: null, onChange: (v: any) => (got = v) })
63
+ try {
64
+ const input = target.querySelector<HTMLInputElement>('.sv-combo__input')!
65
+ input.dispatchEvent(new FocusEvent('focus')); flushSync()
66
+ input.value = 'ban'
67
+ input.dispatchEvent(new Event('input', { bubbles: true })); flushSync()
68
+ const opts = document.querySelectorAll<HTMLElement>('.sv-ddl__opt')
69
+ expect(opts.length).toBe(1)
70
+ opts[0]!.click(); flushSync()
71
+ expect(got).toBe('b')
72
+ } finally { destroy() }
73
+ })
74
+ })
75
+
76
+ describe('SvTagsInput', () => {
77
+ it('adds on Enter and removes on Backspace', () => {
78
+ let tags: string[] = ['x']
79
+ const { target, destroy } = mnt(SvTagsInput, { value: tags, onChange: (t: string[]) => (tags = t) })
80
+ try {
81
+ const input = target.querySelector<HTMLInputElement>('.sv-tags__input')!
82
+ input.value = 'new'
83
+ // Svelte bind:value needs an input event before the keydown reads draft.
84
+ input.dispatchEvent(new Event('input', { bubbles: true })); flushSync()
85
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })); flushSync()
86
+ expect(tags).toEqual(['x', 'new'])
87
+ } finally { destroy() }
88
+ })
89
+ })
90
+
91
+ describe('SvCountryInput', () => {
92
+ it('searches and selects a country code', () => {
93
+ let got: any
94
+ const { target, destroy } = mnt(SvCountryInput, { value: null, onChange: (v: any) => (got = v) })
95
+ try {
96
+ target.querySelector<HTMLButtonElement>('.sv-country')!.click(); flushSync()
97
+ const search = document.querySelector<HTMLInputElement>('.sv-country__search')!
98
+ search.value = 'germ'
99
+ search.dispatchEvent(new Event('input', { bubbles: true })); flushSync()
100
+ const opts = document.querySelectorAll<HTMLElement>('.sv-country__opt')
101
+ expect(opts.length).toBe(1)
102
+ opts[0]!.click(); flushSync()
103
+ expect(got).toBe('DE')
104
+ } finally { destroy() }
105
+ })
106
+ })