-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/change app structure (#1063)
* Move files * Move types * Clean load functions * Fix unit tests * Fix naming convention on API error type * Remove '.types' from type filenames --------- Co-authored-by: Johan Bisse Mattsson <[email protected]>
- Loading branch information
1 parent
41dc2bf
commit 638bd5a
Showing
39 changed files
with
765 additions
and
732 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...p)/[[lang=lang]]/(find)/FacetGroup.svelte → ...src/lib/components/find/FacetGroup.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...p)/[[lang=lang]]/(find)/FacetRange.svelte → ...src/lib/components/find/FacetRange.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...p)/[[lang=lang]]/(find)/Pagination.svelte → ...src/lib/components/find/Pagination.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
...p)/[[lang=lang]]/(find)/SearchCard.svelte → ...src/lib/components/find/SearchCard.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...[[lang=lang]]/(find)/SearchMapping.svelte → .../lib/components/find/SearchMapping.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
lxl-web/src/lib/utils/display.types.ts → lxl-web/src/lib/types/display.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import { JsonLd, type Link, type DisplayDecorated, type FramedData } from '$lib/types/xl'; | ||
import { type SecureImageResolution } from '$lib/types/auxd'; | ||
import { LxlLens } from '$lib/types/display'; | ||
|
||
export interface SearchResult { | ||
itemOffset: number; | ||
itemsPerPage: number; | ||
totalItems: number; | ||
maxItems: number; | ||
mapping: DisplayMapping[]; | ||
first: Link; | ||
last: Link; | ||
next?: Link; | ||
items: SearchResultItem[]; | ||
facetGroups: FacetGroup[]; | ||
predicates: MultiSelectFacet[]; | ||
} | ||
|
||
export interface SearchResultItem { | ||
[JsonLd.ID]: string; | ||
[JsonLd.TYPE]: string; | ||
[LxlLens.CardHeading]: DisplayDecorated; | ||
[LxlLens.CardBody]: DisplayDecorated; | ||
image: SecureImageResolution | undefined; | ||
typeStr: string; | ||
} | ||
|
||
type FacetGroupId = string; | ||
|
||
export type FacetSearch = { | ||
mapping: { | ||
greaterThanOrEquals: string; | ||
lessThanOrEquals: string; | ||
variable: FacetGroupId; | ||
}; | ||
template: string; | ||
}; | ||
|
||
export interface FacetGroup { | ||
label: string; | ||
dimension: FacetGroupId; | ||
search?: FacetSearch; | ||
// TODO better to do this distinction on the group level? | ||
facets: (Facet | MultiSelectFacet)[]; | ||
} | ||
|
||
export interface Facet { | ||
totalItems: number; | ||
view: Link; | ||
object: DisplayDecorated; | ||
str: string; | ||
discriminator: string; | ||
} | ||
|
||
export interface MultiSelectFacet extends Facet { | ||
selected: boolean; | ||
} | ||
|
||
export interface DisplayMapping { | ||
display?: DisplayDecorated; | ||
up?: Link; | ||
children?: DisplayMapping[]; | ||
label?: string; | ||
operator: keyof typeof SearchOperators; | ||
} | ||
|
||
export interface PartialCollectionView { | ||
[JsonLd.TYPE]: 'PartialCollectionView'; | ||
[JsonLd.ID]: string; | ||
[JsonLd.CONTEXT]: string; | ||
itemOffset: number; | ||
itemsPerPage: number; | ||
totalItems: number; | ||
maxItems: number; | ||
search: { | ||
mapping: SearchMapping[]; | ||
}; | ||
first: Link; | ||
last: Link; | ||
next?: Link; | ||
items: FramedData[]; | ||
stats?: { | ||
[JsonLd.ID]: '#stats'; | ||
sliceByDimension: Record<FacetGroupId, Slice>; | ||
_predicates: Observation[]; | ||
_boolFilters?: Observation[]; | ||
}; | ||
} | ||
|
||
interface Slice { | ||
alias: string; | ||
dimension: FacetGroupId; | ||
observation: Observation[]; | ||
search?: FacetSearch; | ||
} | ||
|
||
interface Observation { | ||
totalItems: number; | ||
view: Link; | ||
object: FramedData; | ||
_selected?: boolean; | ||
} | ||
|
||
export enum SearchOperators { | ||
and = 'and', | ||
or = 'or', | ||
not = 'not', | ||
equals = 'equals', | ||
notEquals = 'notEquals', | ||
greaterThan = 'greaterThan', | ||
greaterThanOrEquals = 'greaterThanOrEquals', | ||
lessThan = 'lessThan', | ||
lessThanOrEquals = 'lessThanOrEquals', | ||
existence = 'existence', | ||
notExistence = 'notExistence', | ||
none = 'none' | ||
} | ||
|
||
type MappingObj = { [key in SearchOperators]: SearchMapping[] | string | FramedData }; | ||
|
||
export interface SearchMapping extends MappingObj { | ||
alias: string; | ||
property?: ObjectProperty | DatatypeProperty | PropertyChainAxiom; | ||
object?: FramedData; | ||
up: { '@id': string }; | ||
} | ||
|
||
interface ObjectProperty {} | ||
|
||
export interface DatatypeProperty { | ||
'@type': 'DataTypeProperty'; | ||
'@id': string; | ||
} | ||
|
||
interface PropertyChainAxiom { | ||
propertyChainAxiom: (ObjectProperty | DatatypeProperty)[]; | ||
label: string; // e.g. "instanceOf language" | ||
_key: string; // e.g. "instanceOf.language" | ||
} |
Oops, something went wrong.