@matdata/yasr 4.6.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/CHANGELOG.md +150 -0
- package/build/ts/src/bindingsToCsv.d.ts +2 -0
- package/build/ts/src/defaults.d.ts +2 -0
- package/build/ts/src/helpers/addCSS.d.ts +1 -0
- package/build/ts/src/helpers/addScript.d.ts +1 -0
- package/build/ts/src/helpers/index.d.ts +3 -0
- package/build/ts/src/helpers/sanitize.d.ts +2 -0
- package/build/ts/src/imgs.d.ts +4 -0
- package/build/ts/src/index.d.ts +130 -0
- package/build/ts/src/parsers/csv.d.ts +2 -0
- package/build/ts/src/parsers/index.d.ts +68 -0
- package/build/ts/src/parsers/json.d.ts +2 -0
- package/build/ts/src/parsers/tsv.d.ts +2 -0
- package/build/ts/src/parsers/turtleFamily.d.ts +4 -0
- package/build/ts/src/parsers/xml.d.ts +2 -0
- package/build/ts/src/plugins/boolean/index.d.ts +13 -0
- package/build/ts/src/plugins/error/index.d.ts +13 -0
- package/build/ts/src/plugins/index.d.ts +19 -0
- package/build/ts/src/plugins/response/index.d.ts +28 -0
- package/build/ts/src/plugins/table/index.d.ts +49 -0
- package/build/yasr.html +32 -0
- package/build/yasr.min.css +2 -0
- package/build/yasr.min.css.map +1 -0
- package/build/yasr.min.js +3 -0
- package/build/yasr.min.js.LICENSE.txt +34 -0
- package/build/yasr.min.js.map +1 -0
- package/package.json +56 -0
- package/src/bin/takeScreenshot.js +373 -0
- package/src/bindingsToCsv.ts +18 -0
- package/src/defaults.ts +28 -0
- package/src/helpers/addCSS.ts +7 -0
- package/src/helpers/addScript.ts +12 -0
- package/src/helpers/index.ts +3 -0
- package/src/helpers/sanitize.ts +11 -0
- package/src/imgs.ts +7 -0
- package/src/index.ts +688 -0
- package/src/jquery/extendJquery.js +1 -0
- package/src/jquery/tableToCsv.js +88 -0
- package/src/main.scss +229 -0
- package/src/parsers/csv.ts +30 -0
- package/src/parsers/index.ts +311 -0
- package/src/parsers/json.ts +22 -0
- package/src/parsers/tsv.ts +43 -0
- package/src/parsers/turtleFamily.ts +60 -0
- package/src/parsers/xml.ts +79 -0
- package/src/plugins/boolean/index.scss +11 -0
- package/src/plugins/boolean/index.ts +42 -0
- package/src/plugins/error/index.scss +57 -0
- package/src/plugins/error/index.ts +124 -0
- package/src/plugins/index.ts +24 -0
- package/src/plugins/response/index.scss +63 -0
- package/src/plugins/response/index.ts +170 -0
- package/src/plugins/table/index.scss +154 -0
- package/src/plugins/table/index.ts +437 -0
- package/src/scss/global.scss +10 -0
- package/src/scss/variables.scss +2 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## 4.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2285bff: Fix the display of results of DESCRIBE and CONSTRUCT queries.
|
|
8
|
+
- Updated dependencies [2285bff]
|
|
9
|
+
- @zazuko/yasqe@4.6.1
|
|
10
|
+
- @zazuko/yasgui-utils@4.6.1
|
|
11
|
+
|
|
12
|
+
## 4.6.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 2e04999: Upgrade various dependencies
|
|
17
|
+
- 0cd6b8e: Fix the documentation links
|
|
18
|
+
- Updated dependencies [2e04999]
|
|
19
|
+
- @zazuko/yasqe@4.6.0
|
|
20
|
+
- @zazuko/yasgui-utils@4.6.0
|
|
21
|
+
|
|
22
|
+
## 4.5.0
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- @zazuko/yasgui-utils@4.5.0
|
|
27
|
+
- @zazuko/yasqe@4.5.0
|
|
28
|
+
|
|
29
|
+
## 4.4.3
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [b835764]
|
|
34
|
+
- @zazuko/yasqe@4.4.3
|
|
35
|
+
- @zazuko/yasgui-utils@4.4.3
|
|
36
|
+
|
|
37
|
+
## 4.4.2
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [c7ae45e]
|
|
42
|
+
- @zazuko/yasqe@4.4.2
|
|
43
|
+
- @zazuko/yasgui-utils@4.4.2
|
|
44
|
+
|
|
45
|
+
## 4.4.1
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- @zazuko/yasgui-utils@4.4.1
|
|
50
|
+
- @zazuko/yasqe@4.4.1
|
|
51
|
+
|
|
52
|
+
## 4.4.0
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- 2489238: Replace `superagent` with standard `fetch` (from @vemonet in #19)
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [2489238]
|
|
61
|
+
- @zazuko/yasqe@4.4.0
|
|
62
|
+
- @zazuko/yasgui-utils@4.4.0
|
|
63
|
+
|
|
64
|
+
## 4.3.3
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- d918c63: Upgrade some dependencies
|
|
69
|
+
- Updated dependencies [d918c63]
|
|
70
|
+
- Updated dependencies [d918c63]
|
|
71
|
+
- Updated dependencies [d918c63]
|
|
72
|
+
- @zazuko/yasgui-utils@4.3.3
|
|
73
|
+
- @zazuko/yasqe@4.3.3
|
|
74
|
+
|
|
75
|
+
## 4.3.2
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- @zazuko/yasgui-utils@4.3.2
|
|
80
|
+
- @zazuko/yasqe@4.3.2
|
|
81
|
+
|
|
82
|
+
## 4.3.1
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- 8aef253: Upgrade datatables.net to 2.0.5
|
|
87
|
+
- cbf8286: Use the right type for DataTables configuration
|
|
88
|
+
- 6e78f30: This fixes the style of the table by using the new `layout` property from DataTables
|
|
89
|
+
- @zazuko/yasgui-utils@4.3.1
|
|
90
|
+
- @zazuko/yasqe@4.3.1
|
|
91
|
+
|
|
92
|
+
## 4.3.0
|
|
93
|
+
|
|
94
|
+
### Minor Changes
|
|
95
|
+
|
|
96
|
+
- 981b776: Upgrade datatables to v2
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- b14ed24: Update Git repository to https://github.com/zazuko/Yasgui
|
|
101
|
+
- Updated dependencies [b14ed24]
|
|
102
|
+
- @zazuko/yasgui-utils@4.3.0
|
|
103
|
+
- @zazuko/yasqe@4.3.0
|
|
104
|
+
|
|
105
|
+
All notable changes to this project will be documented in this file.
|
|
106
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
107
|
+
|
|
108
|
+
## [4.0.113](https://github.com/TriplyDB/yasgui/compare/v4.0.112...v4.0.113) (2020-04-08)
|
|
109
|
+
|
|
110
|
+
**Note:** Version bump only for package @triply/yasr
|
|
111
|
+
|
|
112
|
+
## [4.0.112](https://github.com/TriplyDB/yasgui/compare/v4.0.111...v4.0.112) (2020-04-07)
|
|
113
|
+
|
|
114
|
+
**Note:** Version bump only for package @triply/yasr
|
|
115
|
+
|
|
116
|
+
## [4.0.111](https://github.com/TriplyDB/yasgui/compare/v4.0.109...v4.0.111) (2020-03-20)
|
|
117
|
+
|
|
118
|
+
**Note:** Version bump only for package @triply/yasr
|
|
119
|
+
|
|
120
|
+
## [4.0.110](https://github.com/TriplyDB/yasgui/compare/v4.0.109...v4.0.110) (2020-03-20)
|
|
121
|
+
|
|
122
|
+
**Note:** Version bump only for package @triply/yasr
|
|
123
|
+
|
|
124
|
+
## [4.0.108](https://github.com/TriplyDB/yasgui/compare/v4.0.107...v4.0.108) (2020-03-10)
|
|
125
|
+
|
|
126
|
+
**Note:** Version bump only for package @triply/yasr
|
|
127
|
+
|
|
128
|
+
## [4.0.107](https://github.com/TriplyDB/yasgui/compare/v4.0.106...v4.0.107) (2020-03-01)
|
|
129
|
+
|
|
130
|
+
**Note:** Version bump only for package @triply/yasr
|
|
131
|
+
|
|
132
|
+
## [4.0.106](https://github.com/TriplyDB/yasgui/compare/v4.0.105...v4.0.106) (2020-02-25)
|
|
133
|
+
|
|
134
|
+
**Note:** Version bump only for package @triply/yasr
|
|
135
|
+
|
|
136
|
+
## [4.0.105](https://github.com/TriplyDB/yasgui/compare/v4.0.104...v4.0.105) (2020-02-10)
|
|
137
|
+
|
|
138
|
+
**Note:** Version bump only for package @triply/yasr
|
|
139
|
+
|
|
140
|
+
## [4.0.104](https://github.com/TriplyDB/yasgui/compare/v4.0.103...v4.0.104) (2020-02-10)
|
|
141
|
+
|
|
142
|
+
**Note:** Version bump only for package @triply/yasr
|
|
143
|
+
|
|
144
|
+
## [4.0.103](https://github.com/TriplyDB/yasgui/compare/v4.0.102...v4.0.103) (2020-02-10)
|
|
145
|
+
|
|
146
|
+
**Note:** Version bump only for package @triply/yasr
|
|
147
|
+
|
|
148
|
+
## [4.0.102](https://github.com/TriplyDB/yasgui/compare/v4.0.101...v4.0.102) (2020-02-07)
|
|
149
|
+
|
|
150
|
+
**Note:** Version bump only for package @triply/yasr
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function addCss(href: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function addScript(src: string, text?: string): Promise<void>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
import { Plugin } from "./plugins";
|
|
3
|
+
import { Storage as YStorage } from "@matdata/yasgui-utils";
|
|
4
|
+
import Parser from "./parsers";
|
|
5
|
+
export { default as Parser } from "./parsers";
|
|
6
|
+
import { addScript, addCss } from "./helpers";
|
|
7
|
+
export interface PersistentConfig {
|
|
8
|
+
selectedPlugin?: string;
|
|
9
|
+
pluginsConfig?: {
|
|
10
|
+
[pluginName: string]: any;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface Yasr {
|
|
14
|
+
on(event: "change", listener: (instance: Yasr) => void): this;
|
|
15
|
+
emit(event: "change", instance: Yasr): boolean;
|
|
16
|
+
on(event: "draw", listener: (instance: Yasr, plugin: Plugin<any>) => void): this;
|
|
17
|
+
emit(event: "draw", instance: Yasr, plugin: Plugin<any>): boolean;
|
|
18
|
+
on(event: "drawn", listener: (instance: Yasr, plugin: Plugin<any>) => void): this;
|
|
19
|
+
emit(event: "drawn", instance: Yasr, plugin: Plugin<any>): boolean;
|
|
20
|
+
on(event: "toggle-help", listener: (instance: Yasr) => void): this;
|
|
21
|
+
emit(event: "toggle-help", instance: Yasr): boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare class Yasr extends EventEmitter {
|
|
24
|
+
results?: Parser;
|
|
25
|
+
rootEl: HTMLDivElement;
|
|
26
|
+
headerEl: HTMLDivElement;
|
|
27
|
+
fallbackInfoEl: HTMLDivElement;
|
|
28
|
+
resultsEl: HTMLDivElement;
|
|
29
|
+
pluginControls: HTMLDivElement;
|
|
30
|
+
config: Config;
|
|
31
|
+
storage: YStorage;
|
|
32
|
+
plugins: {
|
|
33
|
+
[name: string]: Plugin<any>;
|
|
34
|
+
};
|
|
35
|
+
helpDrawn: Boolean;
|
|
36
|
+
private drawnPlugin;
|
|
37
|
+
private selectedPlugin;
|
|
38
|
+
private fullscreenBtn;
|
|
39
|
+
private isFullscreen;
|
|
40
|
+
private loadingEl;
|
|
41
|
+
private isLoading;
|
|
42
|
+
utils: {
|
|
43
|
+
addScript: typeof addScript;
|
|
44
|
+
addCSS: typeof addCss;
|
|
45
|
+
sanitize: (val: string | Node) => string;
|
|
46
|
+
};
|
|
47
|
+
constructor(parent: HTMLElement, conf?: Partial<Config>, data?: any);
|
|
48
|
+
private getConfigFromStorage;
|
|
49
|
+
renderError(error: Parser.ErrorSummary): Promise<HTMLElement | undefined>;
|
|
50
|
+
getStorageId(label: string, getter?: Config["persistenceId"]): string | undefined;
|
|
51
|
+
somethingDrawn(): boolean;
|
|
52
|
+
emptyFallbackElement(): void;
|
|
53
|
+
getSelectedPluginName(): string;
|
|
54
|
+
getSelectedPlugin(): Plugin<any>;
|
|
55
|
+
private updatePluginSelectors;
|
|
56
|
+
private getCompatiblePlugins;
|
|
57
|
+
draw(): void;
|
|
58
|
+
refresh(): void;
|
|
59
|
+
destroy(): void;
|
|
60
|
+
getPrefixes(): Prefixes;
|
|
61
|
+
selectPlugin(plugin: string): void;
|
|
62
|
+
private pluginSelectorsEl;
|
|
63
|
+
drawPluginSelectors(): void;
|
|
64
|
+
private fillFallbackBox;
|
|
65
|
+
private drawPluginElement;
|
|
66
|
+
private drawHeader;
|
|
67
|
+
private downloadBtn;
|
|
68
|
+
private drawDownloadIcon;
|
|
69
|
+
private dataElement;
|
|
70
|
+
private drawResponseInfo;
|
|
71
|
+
private updateResponseInfo;
|
|
72
|
+
private updateHelpButton;
|
|
73
|
+
updateExportHeaders(): void;
|
|
74
|
+
private drawFullscreenButton;
|
|
75
|
+
toggleFullscreen(): void;
|
|
76
|
+
getIsFullscreen(): boolean;
|
|
77
|
+
private createLoadingElement;
|
|
78
|
+
showLoading(): void;
|
|
79
|
+
hideLoading(): void;
|
|
80
|
+
private documentationLink;
|
|
81
|
+
private drawDocumentationButton;
|
|
82
|
+
download(): void;
|
|
83
|
+
handleLocalStorageQuotaFull(_e: any): void;
|
|
84
|
+
getResponseFromStorage(): unknown;
|
|
85
|
+
getPersistentConfig(): PersistentConfig;
|
|
86
|
+
storePluginConfig(pluginName: string, conf: any): void;
|
|
87
|
+
private storeConfig;
|
|
88
|
+
private storeResponse;
|
|
89
|
+
setResponse(data: any, duration?: number): void;
|
|
90
|
+
private initializePlugins;
|
|
91
|
+
static defaults: Config;
|
|
92
|
+
static plugins: {
|
|
93
|
+
[key: string]: typeof Plugin & {
|
|
94
|
+
defaults?: any;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
static registerPlugin(name: string, plugin: typeof Plugin, enable?: boolean): void;
|
|
98
|
+
static Dependencies: {
|
|
99
|
+
[name: string]: Promise<any>;
|
|
100
|
+
};
|
|
101
|
+
static storageNamespace: string;
|
|
102
|
+
static clearStorage(): void;
|
|
103
|
+
}
|
|
104
|
+
export type Prefixes = {
|
|
105
|
+
[prefixLabel: string]: string;
|
|
106
|
+
};
|
|
107
|
+
export interface PluginConfig {
|
|
108
|
+
dynamicConfig?: any;
|
|
109
|
+
staticConfig?: any;
|
|
110
|
+
enabled?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface Config {
|
|
113
|
+
persistenceId: ((yasr: Yasr) => string) | string | null;
|
|
114
|
+
persistenceLabelResponse: string;
|
|
115
|
+
persistenceLabelConfig: string;
|
|
116
|
+
maxPersistentResponseSize: number;
|
|
117
|
+
persistencyExpire: number;
|
|
118
|
+
getPlainQueryLinkToEndpoint: (() => string | undefined) | undefined;
|
|
119
|
+
getDownloadFileName?: () => string | undefined;
|
|
120
|
+
plugins: {
|
|
121
|
+
[pluginName: string]: PluginConfig;
|
|
122
|
+
};
|
|
123
|
+
pluginOrder: string[];
|
|
124
|
+
defaultPlugin: string;
|
|
125
|
+
prefixes: Prefixes | ((yasr: Yasr) => Prefixes);
|
|
126
|
+
errorRenderers?: ((error: Parser.ErrorSummary) => Promise<HTMLElement | undefined>)[];
|
|
127
|
+
}
|
|
128
|
+
export declare function registerPlugin(name: string, plugin: typeof Plugin, enable?: boolean): void;
|
|
129
|
+
export { Plugin, DownloadInfo } from "./plugins";
|
|
130
|
+
export default Yasr;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import N3 from "n3";
|
|
2
|
+
declare namespace Parser {
|
|
3
|
+
interface ErrorSummary {
|
|
4
|
+
status?: number;
|
|
5
|
+
text: string;
|
|
6
|
+
statusText?: string;
|
|
7
|
+
}
|
|
8
|
+
interface BindingValue {
|
|
9
|
+
value: string;
|
|
10
|
+
type: "uri" | "literal" | "typed-literal" | "bnode";
|
|
11
|
+
datatype?: string;
|
|
12
|
+
"xml:lang"?: string;
|
|
13
|
+
}
|
|
14
|
+
interface Binding {
|
|
15
|
+
[varname: string]: BindingValue;
|
|
16
|
+
}
|
|
17
|
+
interface SparqlResults {
|
|
18
|
+
head: {
|
|
19
|
+
vars: string[];
|
|
20
|
+
};
|
|
21
|
+
boolean?: boolean;
|
|
22
|
+
results?: {
|
|
23
|
+
bindings: Binding[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface ResponseSummary {
|
|
27
|
+
data?: any;
|
|
28
|
+
error?: ErrorSummary;
|
|
29
|
+
status?: number;
|
|
30
|
+
contentType?: string;
|
|
31
|
+
executionTime?: number;
|
|
32
|
+
}
|
|
33
|
+
type PostProcessBinding = (binding: Binding) => Binding;
|
|
34
|
+
}
|
|
35
|
+
type QueryResponse = Response & {
|
|
36
|
+
content: string;
|
|
37
|
+
};
|
|
38
|
+
declare class Parser {
|
|
39
|
+
private res;
|
|
40
|
+
private summary;
|
|
41
|
+
private errorSummary;
|
|
42
|
+
private error;
|
|
43
|
+
private type;
|
|
44
|
+
private executionTime;
|
|
45
|
+
constructor(responseOrObject: Parser.ResponseSummary | QueryResponse | Error | any, executionTime?: number);
|
|
46
|
+
setResponse(res: QueryResponse): void;
|
|
47
|
+
setSummary(summary: Parser.ResponseSummary | any): void;
|
|
48
|
+
hasError(): boolean;
|
|
49
|
+
getError(): Parser.ErrorSummary;
|
|
50
|
+
getContentType(): string;
|
|
51
|
+
private json;
|
|
52
|
+
getAsJson(): false | Parser.SparqlResults;
|
|
53
|
+
private getData;
|
|
54
|
+
getResponseTime(): number;
|
|
55
|
+
private getParserFromContentType;
|
|
56
|
+
private doLuckyGuess;
|
|
57
|
+
getVariables(): string[];
|
|
58
|
+
getBoolean(): boolean | undefined;
|
|
59
|
+
getBindings(): Parser.Binding[];
|
|
60
|
+
private statements;
|
|
61
|
+
getStatements(): N3.Quad[];
|
|
62
|
+
getOriginalResponseAsString(): string;
|
|
63
|
+
getType(): "json" | "xml" | "csv" | "tsv" | "ttl";
|
|
64
|
+
getStatus(): number | undefined;
|
|
65
|
+
getAsStoreObject(maxResponseSize: number): Parser.ResponseSummary | undefined;
|
|
66
|
+
asCsv(): string;
|
|
67
|
+
}
|
|
68
|
+
export default Parser;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Yasr from "../../";
|
|
2
|
+
import { Plugin } from "../";
|
|
3
|
+
export interface PluginConfig {
|
|
4
|
+
}
|
|
5
|
+
export default class Boolean implements Plugin<PluginConfig> {
|
|
6
|
+
private yasr;
|
|
7
|
+
priority: number;
|
|
8
|
+
hideFromSelection: boolean;
|
|
9
|
+
constructor(yasr: Yasr);
|
|
10
|
+
draw(): void;
|
|
11
|
+
canHandleResults(): boolean;
|
|
12
|
+
getIcon(): HTMLElement;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Plugin } from "../";
|
|
2
|
+
import Yasr from "../../";
|
|
3
|
+
export default class Error implements Plugin<never> {
|
|
4
|
+
private yasr;
|
|
5
|
+
constructor(yasr: Yasr);
|
|
6
|
+
canHandleResults(): boolean;
|
|
7
|
+
private getTryBtn;
|
|
8
|
+
private getCorsMessage;
|
|
9
|
+
draw(): Promise<void>;
|
|
10
|
+
getIcon(): HTMLElement;
|
|
11
|
+
priority: number;
|
|
12
|
+
hideFromSelection: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Plugin<Opts extends any> {
|
|
2
|
+
priority: number;
|
|
3
|
+
canHandleResults(): boolean;
|
|
4
|
+
hideFromSelection?: boolean;
|
|
5
|
+
label?: string;
|
|
6
|
+
options?: Opts;
|
|
7
|
+
initialize?(): Promise<void>;
|
|
8
|
+
destroy?(): void;
|
|
9
|
+
draw(persistentConfig: any, runtimeConfig?: any): Promise<void> | void;
|
|
10
|
+
getIcon(): Element | undefined;
|
|
11
|
+
download?(filename?: string): DownloadInfo | undefined;
|
|
12
|
+
helpReference?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DownloadInfo {
|
|
15
|
+
contentType: string;
|
|
16
|
+
getData: () => string;
|
|
17
|
+
filename: string;
|
|
18
|
+
title: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Plugin } from "../";
|
|
2
|
+
import Yasr from "../../";
|
|
3
|
+
export interface PluginConfig {
|
|
4
|
+
maxLines: number;
|
|
5
|
+
}
|
|
6
|
+
export default class Response implements Plugin<PluginConfig> {
|
|
7
|
+
private yasr;
|
|
8
|
+
label: string;
|
|
9
|
+
priority: number;
|
|
10
|
+
helpReference: string;
|
|
11
|
+
private config;
|
|
12
|
+
private overLay;
|
|
13
|
+
private cm;
|
|
14
|
+
constructor(yasr: Yasr);
|
|
15
|
+
canHandleResults(): boolean;
|
|
16
|
+
getIcon(): HTMLDivElement;
|
|
17
|
+
download(filename?: string): {
|
|
18
|
+
getData: () => string;
|
|
19
|
+
filename: string;
|
|
20
|
+
contentType: string;
|
|
21
|
+
title: string;
|
|
22
|
+
};
|
|
23
|
+
draw(persistentConfig: PluginConfig): void;
|
|
24
|
+
private limitData;
|
|
25
|
+
showLess(setValue?: boolean): void;
|
|
26
|
+
showMore(): void;
|
|
27
|
+
static defaults: PluginConfig;
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Plugin, DownloadInfo } from "../";
|
|
2
|
+
import Yasr from "../../";
|
|
3
|
+
import type { Config } from "datatables.net";
|
|
4
|
+
export interface PluginConfig {
|
|
5
|
+
openIriInNewWindow: boolean;
|
|
6
|
+
tableConfig: Config;
|
|
7
|
+
}
|
|
8
|
+
export interface PersistentConfig {
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
isEllipsed?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export default class Table implements Plugin<PluginConfig> {
|
|
14
|
+
private config;
|
|
15
|
+
private persistentConfig;
|
|
16
|
+
private yasr;
|
|
17
|
+
private tableControls;
|
|
18
|
+
private tableEl;
|
|
19
|
+
private dataTable;
|
|
20
|
+
private tableFilterField;
|
|
21
|
+
private tableSizeField;
|
|
22
|
+
private tableCompactSwitch;
|
|
23
|
+
private tableEllipseSwitch;
|
|
24
|
+
private tableResizer;
|
|
25
|
+
helpReference: string;
|
|
26
|
+
label: string;
|
|
27
|
+
priority: number;
|
|
28
|
+
getIcon(): HTMLDivElement;
|
|
29
|
+
constructor(yasr: Yasr);
|
|
30
|
+
static defaults: PluginConfig;
|
|
31
|
+
private getRows;
|
|
32
|
+
private getUriLinkFromBinding;
|
|
33
|
+
private getCellContent;
|
|
34
|
+
private formatLiteral;
|
|
35
|
+
private getColumns;
|
|
36
|
+
private getSizeFirstColumn;
|
|
37
|
+
draw(persistentConfig: PersistentConfig): void;
|
|
38
|
+
private setEllipsisHandlers;
|
|
39
|
+
private handleTableSearch;
|
|
40
|
+
private handleTableSizeSelect;
|
|
41
|
+
private handleSetCompactToggle;
|
|
42
|
+
private handleSetEllipsisToggle;
|
|
43
|
+
drawControls(): void;
|
|
44
|
+
download(filename?: string): DownloadInfo;
|
|
45
|
+
canHandleResults(): boolean;
|
|
46
|
+
private removeControls;
|
|
47
|
+
private destroyResizer;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
}
|
package/build/yasr.html
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!doctype html><html><head><meta charset="UTF-8"/><style>body {
|
|
2
|
+
font-family: "Roboto", sans-serif;
|
|
3
|
+
margin: 0px;
|
|
4
|
+
}
|
|
5
|
+
.navItem a {
|
|
6
|
+
color: #555;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
padding: 5px;
|
|
9
|
+
padding-right:15px;
|
|
10
|
+
}
|
|
11
|
+
.navItem a:hover {
|
|
12
|
+
color:#222
|
|
13
|
+
}
|
|
14
|
+
.navItem.active a {
|
|
15
|
+
color: black;
|
|
16
|
+
font-size:110%;
|
|
17
|
+
}</style><link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/><script src="../../packages/yasgui/static/yasgui.polyfill.min.js"></script><script defer="defer" src="/yasqe.min.js"></script><script defer="defer" src="/yasr.min.js"></script><link href="/yasqe.min.css" rel="stylesheet"><link href="/yasr.min.css" rel="stylesheet"></head><body><div style="background:#eee"><nav style="display: flex"><img src="webpack/yasgui.png" style="max-height:50px;padding:5px;margin-left: 10px" alt="Yasgui Logo"><ul style="display: flex; list-style: none; align-self: center"><li class="navItem false"><a class="nav-link" href="yasgui.html">Yasgui</a></li><li class="navItem false"><a class="nav-link" href="yasqe.html">Yasqe</a></li><li class="navItem active"><a class="nav-link" href="yasr.html">Yasr</a></li></ul></nav></div><div id="yasqe"></div><div id="yasr"></div><script>window.onpageshow = function() {
|
|
18
|
+
window.yasqe = new Yasqe(document.getElementById("yasqe"), {
|
|
19
|
+
requestConfig: {
|
|
20
|
+
endpoint: "https://dbpedia.org/sparql"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
yasqe.on("queryResponse", function(yasqe, response, duration) {
|
|
24
|
+
console.log({ response: response });
|
|
25
|
+
window.yasr.setResponse(response, duration);
|
|
26
|
+
});
|
|
27
|
+
window.yasr = new Yasr(document.getElementById("yasr"), {
|
|
28
|
+
prefixes: function() {
|
|
29
|
+
return yasqe.getPrefixesFromQuery();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};</script></body></html>
|