@furystack/shades-common-components 9.0.0 → 10.0.1
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/esm/components/app-bar-link.d.ts +4 -4
- package/esm/components/app-bar-link.d.ts.map +1 -1
- package/esm/components/app-bar-link.js +1 -2
- package/esm/components/app-bar-link.js.map +1 -1
- package/esm/components/app-bar.d.ts +2 -2
- package/esm/components/app-bar.d.ts.map +1 -1
- package/esm/components/avatar.d.ts +3 -3
- package/esm/components/avatar.d.ts.map +1 -1
- package/esm/components/button.d.ts +4 -4
- package/esm/components/button.d.ts.map +1 -1
- package/esm/components/command-palette/command-palette-input.d.ts +2 -2
- package/esm/components/command-palette/command-palette-input.d.ts.map +1 -1
- package/esm/components/command-palette/command-palette-manager.d.ts +2 -2
- package/esm/components/command-palette/command-palette-manager.d.ts.map +1 -1
- package/esm/components/command-palette/command-palette-manager.js +6 -6
- package/esm/components/command-palette/command-palette-manager.js.map +1 -1
- package/esm/components/command-palette/command-palette-suggestion-list.d.ts +3 -3
- package/esm/components/command-palette/command-palette-suggestion-list.d.ts.map +1 -1
- package/esm/components/command-palette/index.d.ts +2 -2
- package/esm/components/command-palette/index.d.ts.map +1 -1
- package/esm/components/command-palette/index.js +3 -3
- package/esm/components/command-palette/index.js.map +1 -1
- package/esm/components/data-grid/body.d.ts +1 -1
- package/esm/components/data-grid/body.d.ts.map +1 -1
- package/esm/components/data-grid/body.js +2 -0
- package/esm/components/data-grid/body.js.map +1 -1
- package/esm/components/data-grid/footer.d.ts +2 -2
- package/esm/components/data-grid/footer.d.ts.map +1 -1
- package/esm/components/data-grid/header.d.ts +2 -2
- package/esm/components/data-grid/header.d.ts.map +1 -1
- package/esm/components/data-grid/header.js +3 -3
- package/esm/components/data-grid/header.js.map +1 -1
- package/esm/components/data-grid/selection-cell.d.ts +2 -2
- package/esm/components/data-grid/selection-cell.d.ts.map +1 -1
- package/esm/components/fab.d.ts +2 -2
- package/esm/components/fab.d.ts.map +1 -1
- package/esm/components/form.d.ts +2 -2
- package/esm/components/form.d.ts.map +1 -1
- package/esm/components/form.js +5 -6
- package/esm/components/form.js.map +1 -1
- package/esm/components/inputs/autocomplete.d.ts +5 -5
- package/esm/components/inputs/autocomplete.d.ts.map +1 -1
- package/esm/components/inputs/input.d.ts +2 -2
- package/esm/components/inputs/input.d.ts.map +1 -1
- package/esm/components/inputs/input.js +1 -1
- package/esm/components/inputs/input.js.map +1 -1
- package/esm/components/inputs/text-area.d.ts +2 -2
- package/esm/components/inputs/text-area.d.ts.map +1 -1
- package/esm/components/loader.d.ts +2 -2
- package/esm/components/loader.d.ts.map +1 -1
- package/esm/components/modal.d.ts +2 -2
- package/esm/components/modal.d.ts.map +1 -1
- package/esm/components/noty-list.d.ts +5 -5
- package/esm/components/noty-list.d.ts.map +1 -1
- package/esm/components/paper.d.ts +3 -3
- package/esm/components/paper.d.ts.map +1 -1
- package/esm/components/skeleton.d.ts +2 -2
- package/esm/components/skeleton.d.ts.map +1 -1
- package/esm/components/suggest/index.d.ts.map +1 -1
- package/esm/components/suggest/index.js +3 -3
- package/esm/components/suggest/index.js.map +1 -1
- package/esm/components/suggest/suggest-input.d.ts +2 -2
- package/esm/components/suggest/suggest-input.d.ts.map +1 -1
- package/esm/components/suggest/suggest-manager.d.ts +1 -2
- package/esm/components/suggest/suggest-manager.d.ts.map +1 -1
- package/esm/components/suggest/suggest-manager.js +7 -7
- package/esm/components/suggest/suggest-manager.js.map +1 -1
- package/esm/components/tabs.d.ts +5 -5
- package/esm/components/tabs.d.ts.map +1 -1
- package/esm/components/tabs.js +9 -10
- package/esm/components/tabs.js.map +1 -1
- package/esm/components/wizard/index.d.ts +2 -2
- package/esm/components/wizard/index.d.ts.map +1 -1
- package/esm/services/click-away-service.d.ts +1 -1
- package/esm/services/click-away-service.d.ts.map +1 -1
- package/esm/services/click-away-service.js +1 -1
- package/esm/services/click-away-service.js.map +1 -1
- package/esm/services/click-away-service.spec.js +3 -3
- package/esm/services/click-away-service.spec.js.map +1 -1
- package/esm/services/collection-service.d.ts +1 -2
- package/esm/services/collection-service.d.ts.map +1 -1
- package/esm/services/collection-service.js +6 -6
- package/esm/services/collection-service.js.map +1 -1
- package/esm/services/collection-service.spec.js +3 -3
- package/esm/services/collection-service.spec.js.map +1 -1
- package/esm/services/css-variable-theme.d.ts.map +1 -1
- package/esm/services/theme-provider-service.d.ts +1 -1
- package/esm/services/theme-provider-service.d.ts.map +1 -1
- package/esm/services/theme-provider-service.js +1 -1
- package/esm/services/theme-provider-service.js.map +1 -1
- package/package.json +8 -8
- package/src/components/app-bar-link.tsx +3 -4
- package/src/components/command-palette/command-palette-manager.ts +7 -7
- package/src/components/command-palette/index.tsx +3 -3
- package/src/components/data-grid/body.tsx +4 -2
- package/src/components/data-grid/header.tsx +3 -3
- package/src/components/form.tsx +7 -8
- package/src/components/inputs/input.tsx +1 -1
- package/src/components/suggest/index.tsx +5 -4
- package/src/components/suggest/suggest-manager.ts +7 -8
- package/src/components/tabs.tsx +13 -20
- package/src/services/click-away-service.spec.ts +3 -3
- package/src/services/click-away-service.ts +1 -1
- package/src/services/collection-service.spec.ts +3 -3
- package/src/services/collection-service.ts +6 -7
- package/src/services/theme-provider-service.ts +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { RouteLinkProps } from '@furystack/shades'
|
|
2
|
-
import { attachProps } from '@furystack/shades'
|
|
3
|
-
import {
|
|
4
|
-
import { match, type TokensToRegexpOptions } from 'path-to-regexp'
|
|
2
|
+
import { attachProps, createComponent, LocationService, RouteLink, Shade } from '@furystack/shades'
|
|
3
|
+
import { match, type MatchOptions } from 'path-to-regexp'
|
|
5
4
|
import { ThemeProviderService } from '../services/theme-provider-service.js'
|
|
6
5
|
|
|
7
|
-
export const AppBarLink = Shade<RouteLinkProps & { routingOptions?:
|
|
6
|
+
export const AppBarLink = Shade<RouteLinkProps & { routingOptions?: MatchOptions }>({
|
|
8
7
|
shadowDomName: 'shade-app-bar-link',
|
|
9
8
|
render: ({ children, props, useObservable, injector, element }) => {
|
|
10
9
|
const getAnchorStyle = (currentUrl: string) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Injector } from '@furystack/inject'
|
|
2
2
|
import { Injectable } from '@furystack/inject'
|
|
3
3
|
import { debounce, ObservableValue } from '@furystack/utils'
|
|
4
|
-
import type {
|
|
4
|
+
import type { CommandPaletteSuggestionResult, CommandProvider } from './command-provider.js'
|
|
5
5
|
|
|
6
6
|
@Injectable({ lifetime: 'singleton' })
|
|
7
7
|
export class CommandPaletteManager {
|
|
@@ -21,13 +21,13 @@ export class CommandPaletteManager {
|
|
|
21
21
|
}
|
|
22
22
|
}).bind(this)
|
|
23
23
|
|
|
24
|
-
public dispose() {
|
|
24
|
+
public [Symbol.dispose]() {
|
|
25
25
|
window.removeEventListener('keyup', this.keyPressListener)
|
|
26
|
-
this.isOpened.dispose()
|
|
27
|
-
this.isLoading.dispose()
|
|
28
|
-
this.term.dispose()
|
|
29
|
-
this.selectedIndex.dispose()
|
|
30
|
-
this.currentSuggestions.dispose()
|
|
26
|
+
this.isOpened[Symbol.dispose]()
|
|
27
|
+
this.isLoading[Symbol.dispose]()
|
|
28
|
+
this.term[Symbol.dispose]()
|
|
29
|
+
this.selectedIndex[Symbol.dispose]()
|
|
30
|
+
this.currentSuggestions[Symbol.dispose]()
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
public selectSuggestion(injector: Injector, index: number = this.selectedIndex.getValue()) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Shade, createComponent } from '@furystack/shades'
|
|
2
|
+
import { ClickAwayService } from '../../services/click-away-service.js'
|
|
3
|
+
import { ThemeProviderService } from '../../services/theme-provider-service.js'
|
|
2
4
|
import { promisifyAnimation } from '../../utils/promisify-animation.js'
|
|
3
5
|
import { Loader } from '../loader.js'
|
|
4
|
-
import { CommandPaletteManager } from './command-palette-manager.js'
|
|
5
6
|
import { CommandPaletteInput } from './command-palette-input.js'
|
|
7
|
+
import { CommandPaletteManager } from './command-palette-manager.js'
|
|
6
8
|
import { CommandPaletteSuggestionList } from './command-palette-suggestion-list.js'
|
|
7
9
|
import type { CommandProvider } from './command-provider.js'
|
|
8
|
-
import { ClickAwayService } from '../../services/click-away-service.js'
|
|
9
|
-
import { ThemeProviderService } from '../../services/theme-provider-service.js'
|
|
10
10
|
|
|
11
11
|
export * from './command-palette-input.js'
|
|
12
12
|
export * from './command-palette-manager.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CollectionService } from '../../services/collection-service.js'
|
|
2
1
|
import type { ChildrenList } from '@furystack/shades'
|
|
3
2
|
import { Shade, createComponent } from '@furystack/shades'
|
|
4
|
-
import type {
|
|
3
|
+
import type { CollectionService } from '../../services/collection-service.js'
|
|
5
4
|
import { DataGridRow } from './data-grid-row.js'
|
|
5
|
+
import type { DataRowCells } from './data-grid.js'
|
|
6
6
|
|
|
7
7
|
export interface DataGridBodyProps<T, Column extends string> {
|
|
8
8
|
service: CollectionService<T>
|
|
@@ -24,6 +24,8 @@ export const DataGridBody: <T, Column extends string>(
|
|
|
24
24
|
children: ChildrenList,
|
|
25
25
|
) => JSX.Element<any> = Shade<DataGridBodyProps<any, string>>({
|
|
26
26
|
shadowDomName: 'shade-data-grid-body',
|
|
27
|
+
elementBase: HTMLTableSectionElement,
|
|
28
|
+
elementBaseName: 'tbody',
|
|
27
29
|
style: {
|
|
28
30
|
display: 'table-row-group',
|
|
29
31
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { FilterType, FindOptions } from '@furystack/core'
|
|
2
2
|
import type { ChildrenList } from '@furystack/shades'
|
|
3
3
|
import { Shade, createComponent } from '@furystack/shades'
|
|
4
|
-
import { Input } from '../inputs/input.js'
|
|
5
|
-
import { Form } from '../form.js'
|
|
6
|
-
import { Button } from '../button.js'
|
|
7
4
|
import { ObservableValue, sleepAsync } from '@furystack/utils'
|
|
8
5
|
import { collapse, expand } from '../animations.js'
|
|
6
|
+
import { Button } from '../button.js'
|
|
7
|
+
import { Form } from '../form.js'
|
|
8
|
+
import { Input } from '../inputs/input.js'
|
|
9
9
|
|
|
10
10
|
export interface DataGridHeaderProps<T, Column extends string> {
|
|
11
11
|
field: Column
|
package/src/components/form.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ChildrenList, PartialElement } from '@furystack/shades'
|
|
2
|
-
import { attachProps } from '@furystack/shades'
|
|
3
|
-
import { Shade, createComponent } from '@furystack/shades'
|
|
4
|
-
import type { InputValidationResult } from './inputs/input.js'
|
|
5
1
|
import { Injectable } from '@furystack/inject'
|
|
2
|
+
import type { ChildrenList, PartialElement } from '@furystack/shades'
|
|
3
|
+
import { Shade, attachProps, createComponent } from '@furystack/shades'
|
|
6
4
|
import { ObservableValue } from '@furystack/utils'
|
|
5
|
+
import type { InputValidationResult } from './inputs/input.js'
|
|
7
6
|
|
|
8
7
|
type UnknownFormValidationResult = { isValid: null }
|
|
9
8
|
|
|
@@ -34,10 +33,10 @@ export class FormService<T> {
|
|
|
34
33
|
this.fieldErrors.setValue({ ...this.fieldErrors.getValue(), [key]: { validationResult, validity } })
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
public dispose() {
|
|
38
|
-
this.validatedFormData.dispose()
|
|
39
|
-
this.rawFormData.dispose()
|
|
40
|
-
this.validationResult.dispose()
|
|
36
|
+
public [Symbol.dispose]() {
|
|
37
|
+
this.validatedFormData[Symbol.dispose]()
|
|
38
|
+
this.rawFormData[Symbol.dispose]()
|
|
39
|
+
this.validationResult[Symbol.dispose]()
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PartialElement } from '@furystack/shades'
|
|
2
|
-
import { Shade,
|
|
2
|
+
import { Shade, attachStyles, createComponent } from '@furystack/shades'
|
|
3
3
|
import { ObservableValue } from '@furystack/utils'
|
|
4
4
|
import type { Palette } from '../../services/theme-provider-service.js'
|
|
5
5
|
import { ThemeProviderService } from '../../services/theme-provider-service.js'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ChildrenList } from '@furystack/shades'
|
|
2
2
|
import { Shade, createComponent } from '@furystack/shades'
|
|
3
|
+
import { ThemeProviderService } from '../../services/theme-provider-service.js'
|
|
3
4
|
import { promisifyAnimation } from '../../utils/promisify-animation.js'
|
|
4
5
|
import { Loader } from '../loader.js'
|
|
5
|
-
import { SuggestManager } from './suggest-manager.js'
|
|
6
|
-
import type { SuggestionResult } from './suggestion-result.js'
|
|
7
6
|
import { SuggestInput } from './suggest-input.js'
|
|
7
|
+
import { SuggestManager } from './suggest-manager.js'
|
|
8
8
|
import { SuggestionList } from './suggestion-list.js'
|
|
9
|
-
import {
|
|
9
|
+
import type { SuggestionResult } from './suggestion-result.js'
|
|
10
10
|
|
|
11
11
|
export * from './suggest-input.js'
|
|
12
12
|
export * from './suggest-manager.js'
|
|
@@ -31,9 +31,10 @@ export const Suggest: <T>(props: SuggestProps<T>, children: ChildrenList) => JSX
|
|
|
31
31
|
render: ({ props, injector, element, useDisposable }) => {
|
|
32
32
|
const manager = useDisposable('manager', () => new SuggestManager(props.getEntries, props.getSuggestionEntry))
|
|
33
33
|
const { theme } = injector.getInstance(ThemeProviderService)
|
|
34
|
-
const inputContainer = element.querySelector('.input-container') as HTMLDivElement
|
|
35
34
|
manager.element = element
|
|
36
35
|
manager.isOpened.subscribe((isOpened) => {
|
|
36
|
+
const inputContainer = element.querySelector('.input-container') as HTMLDivElement
|
|
37
|
+
|
|
37
38
|
const suggestions = element.querySelector('.close-suggestions')
|
|
38
39
|
const postControls = element.querySelector('.post-controls')
|
|
39
40
|
if (isOpened) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Injector } from '@furystack/inject'
|
|
2
2
|
import { Injectable } from '@furystack/inject'
|
|
3
|
-
import type { Disposable } from '@furystack/utils'
|
|
4
3
|
import { debounce, EventHub, ObservableValue } from '@furystack/utils'
|
|
5
4
|
import type { SuggestionResult } from './suggestion-result.js'
|
|
6
5
|
|
|
@@ -29,15 +28,15 @@ export class SuggestManager<T> extends EventHub<{ onSelectSuggestion: T }> imple
|
|
|
29
28
|
}
|
|
30
29
|
}).bind(this)
|
|
31
30
|
|
|
32
|
-
public dispose() {
|
|
31
|
+
public [Symbol.dispose]() {
|
|
33
32
|
window.removeEventListener('keyup', this.keyPressListener, true)
|
|
34
33
|
window.removeEventListener('click', this.clickOutsideListener, true)
|
|
35
|
-
this.isOpened.dispose()
|
|
36
|
-
this.isLoading.dispose()
|
|
37
|
-
this.term.dispose()
|
|
38
|
-
this.selectedIndex.dispose()
|
|
39
|
-
this.currentSuggestions.dispose()
|
|
40
|
-
super.dispose()
|
|
34
|
+
this.isOpened[Symbol.dispose]()
|
|
35
|
+
this.isLoading[Symbol.dispose]()
|
|
36
|
+
this.term[Symbol.dispose]()
|
|
37
|
+
this.selectedIndex[Symbol.dispose]()
|
|
38
|
+
this.currentSuggestions[Symbol.dispose]()
|
|
39
|
+
super[Symbol.dispose]()
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
public selectSuggestion(index: number = this.selectedIndex.getValue()) {
|
package/src/components/tabs.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocationService, Shade, attachProps, createComponent } from '@furystack/shades'
|
|
2
2
|
import { ThemeProviderService } from '../services/theme-provider-service.js'
|
|
3
3
|
|
|
4
4
|
export interface Tab {
|
|
@@ -7,16 +7,21 @@ export interface Tab {
|
|
|
7
7
|
hash: string
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const TabHeader = Shade<{
|
|
10
|
+
const TabHeader = Shade<{ hash: string }>({
|
|
11
11
|
shadowDomName: 'shade-tab-header',
|
|
12
12
|
style: {
|
|
13
13
|
padding: '1em 2.5em',
|
|
14
14
|
cursor: 'pointer',
|
|
15
15
|
transition: 'box-shadow 1s linear',
|
|
16
16
|
},
|
|
17
|
-
|
|
17
|
+
elementBase: HTMLAnchorElement,
|
|
18
|
+
elementBaseName: 'a',
|
|
19
|
+
render: ({ children, element, injector, props, useObservable }) => {
|
|
18
20
|
const { theme } = injector.getInstance(ThemeProviderService)
|
|
19
|
-
const
|
|
21
|
+
const locationService = injector.getInstance(LocationService)
|
|
22
|
+
|
|
23
|
+
const [hash] = useObservable('updateLocation', locationService.onLocationHashChanged)
|
|
24
|
+
const isActive = hash === props.hash
|
|
20
25
|
|
|
21
26
|
attachProps(element, {
|
|
22
27
|
style: {
|
|
@@ -25,7 +30,7 @@ const TabHeader = Shade<{ isActive?: boolean; onActivate: () => void }>({
|
|
|
25
30
|
color: isActive ? theme.text.primary : theme.text.secondary,
|
|
26
31
|
boxShadow: isActive ? `inset 0 -2px 0 ${theme.palette.primary.main}` : 'none',
|
|
27
32
|
},
|
|
28
|
-
|
|
33
|
+
href: `#${props.hash}`,
|
|
29
34
|
})
|
|
30
35
|
return <>{children}</>
|
|
31
36
|
},
|
|
@@ -44,7 +49,6 @@ export const Tabs = Shade<{
|
|
|
44
49
|
})
|
|
45
50
|
|
|
46
51
|
const [hash] = useObservable('updateLocation', injector.getInstance(LocationService).onLocationHashChanged)
|
|
47
|
-
|
|
48
52
|
const activeTab = props.tabs.find((t) => t.hash === hash.replace('#', ''))
|
|
49
53
|
|
|
50
54
|
return (
|
|
@@ -53,20 +57,9 @@ export const Tabs = Shade<{
|
|
|
53
57
|
className="shade-tabs-header-container"
|
|
54
58
|
style={{ display: 'inline-flex', borderRadius: '5px 5px 0 0', overflow: 'hidden', flexShrink: '0' }}
|
|
55
59
|
>
|
|
56
|
-
{props.tabs.map((tab) =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<TabHeader
|
|
61
|
-
isActive={isActive}
|
|
62
|
-
onActivate={() => {
|
|
63
|
-
window.history.pushState({}, '', `#${tab.hash}`)
|
|
64
|
-
}}
|
|
65
|
-
>
|
|
66
|
-
{tab.header}
|
|
67
|
-
</TabHeader>
|
|
68
|
-
)
|
|
69
|
-
})}
|
|
60
|
+
{props.tabs.map((tab) => (
|
|
61
|
+
<TabHeader hash={tab.hash}>{tab.header}</TabHeader>
|
|
62
|
+
))}
|
|
70
63
|
</div>
|
|
71
64
|
{activeTab?.component}
|
|
72
65
|
</>
|
|
@@ -4,7 +4,7 @@ import { ClickAwayService } from './click-away-service.js'
|
|
|
4
4
|
describe('ClickAwayService', () => {
|
|
5
5
|
it('Should be constructed and disposed', () => {
|
|
6
6
|
const service = new ClickAwayService(document.createElement('div'), () => {})
|
|
7
|
-
service.dispose()
|
|
7
|
+
service[Symbol.dispose]()
|
|
8
8
|
})
|
|
9
9
|
|
|
10
10
|
it('Should call onClickAway when clicking outside the element', () => {
|
|
@@ -17,7 +17,7 @@ describe('ClickAwayService', () => {
|
|
|
17
17
|
|
|
18
18
|
expect(onClickAway).toBeCalled()
|
|
19
19
|
|
|
20
|
-
service.dispose()
|
|
20
|
+
service[Symbol.dispose]()
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
it('Should not call onClickAway when clicking inside the element', () => {
|
|
@@ -30,6 +30,6 @@ describe('ClickAwayService', () => {
|
|
|
30
30
|
|
|
31
31
|
expect(onClickAway).not.toBeCalled()
|
|
32
32
|
|
|
33
|
-
service.dispose()
|
|
33
|
+
service[Symbol.dispose]()
|
|
34
34
|
})
|
|
35
35
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { using } from '@furystack/utils'
|
|
2
2
|
import { describe, expect, it } from 'vitest'
|
|
3
3
|
import { CollectionService } from './collection-service.js'
|
|
4
4
|
|
|
@@ -6,8 +6,8 @@ const testEntries = [{ foo: 1 }, { foo: 2 }, { foo: 3 }]
|
|
|
6
6
|
|
|
7
7
|
describe('CollectionService', () => {
|
|
8
8
|
describe('Selection', () => {
|
|
9
|
-
it('Should add and remove selection',
|
|
10
|
-
|
|
9
|
+
it('Should add and remove selection', () => {
|
|
10
|
+
using(new CollectionService({}), (collectionService) => {
|
|
11
11
|
collectionService.data.setValue({ count: 3, entries: testEntries })
|
|
12
12
|
testEntries.forEach((entry) => {
|
|
13
13
|
expect(collectionService.isSelected(entry)).toBe(false)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Disposable } from '@furystack/utils'
|
|
2
1
|
import { ObservableValue } from '@furystack/utils'
|
|
3
2
|
|
|
4
3
|
export interface CollectionData<T> {
|
|
@@ -26,12 +25,12 @@ export interface CollectionServiceOptions<T> {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export class CollectionService<T> implements Disposable {
|
|
29
|
-
public dispose() {
|
|
30
|
-
this.data.dispose()
|
|
31
|
-
this.selection.dispose()
|
|
32
|
-
this.searchTerm.dispose()
|
|
33
|
-
this.hasFocus.dispose()
|
|
34
|
-
this.focusedEntry.dispose()
|
|
28
|
+
public [Symbol.dispose]() {
|
|
29
|
+
this.data[Symbol.dispose]()
|
|
30
|
+
this.selection[Symbol.dispose]()
|
|
31
|
+
this.searchTerm[Symbol.dispose]()
|
|
32
|
+
this.hasFocus[Symbol.dispose]()
|
|
33
|
+
this.focusedEntry[Symbol.dispose]()
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
public isSelected = (entry: T) => this.selection.getValue().includes(entry)
|