@qrvey/utils 1.13.0-6.performance.1 → 1.13.0-7.performance.0
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/dist/cache-managers/cache-theme-manager.d.ts +27 -0
- package/dist/cache-managers/cache-theme-manager.js +39 -0
- package/dist/cjs/cache-managers/cache-theme-manager.d.ts +27 -0
- package/dist/cjs/cache-managers/cache-theme-manager.js +43 -0
- package/dist/cjs/interfaces/themes/an-style-theme.d.ts +22 -0
- package/dist/cjs/interfaces/themes/an-style-theme.js +2 -0
- package/dist/cjs/interfaces/themes/an-theme.d.ts +15 -0
- package/dist/cjs/interfaces/themes/an-theme.js +2 -0
- package/dist/cjs/services/api/Charts.api.d.ts +0 -7
- package/dist/cjs/services/api/Themes.api.d.ts +3 -0
- package/dist/cjs/services/api/Themes.api.js +13 -0
- package/dist/cjs/services/constants/THEME_ENDPOINT.d.ts +2 -0
- package/dist/cjs/services/constants/THEME_ENDPOINT.js +7 -0
- package/dist/interfaces/themes/an-style-theme.d.ts +22 -0
- package/dist/interfaces/themes/an-style-theme.js +1 -0
- package/dist/interfaces/themes/an-theme.d.ts +15 -0
- package/dist/interfaces/themes/an-theme.js +1 -0
- package/dist/services/api/Charts.api.d.ts +0 -7
- package/dist/services/api/Themes.api.d.ts +3 -0
- package/dist/services/api/Themes.api.js +8 -0
- package/dist/services/constants/THEME_ENDPOINT.d.ts +2 -0
- package/dist/services/constants/THEME_ENDPOINT.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OnChangeType, QrveyCacheManager } from "./cache-manager";
|
|
2
|
+
import { AnTheme } from "../interfaces/themes/an-theme";
|
|
3
|
+
export interface IGetThemeConfig {
|
|
4
|
+
qv_token?: string;
|
|
5
|
+
api_key?: string;
|
|
6
|
+
app_id?: string;
|
|
7
|
+
user_id?: string;
|
|
8
|
+
domain?: string;
|
|
9
|
+
theme_id?: string;
|
|
10
|
+
}
|
|
11
|
+
interface IThemeStoreState {
|
|
12
|
+
theme: AnTheme;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
error: any;
|
|
15
|
+
}
|
|
16
|
+
export declare class ThemeCacheManager extends QrveyCacheManager<IThemeStoreState, IGetThemeConfig> {
|
|
17
|
+
static getInstance(): ThemeCacheManager;
|
|
18
|
+
protected getConfigPropertyName(): keyof IGetThemeConfig;
|
|
19
|
+
protected getStorePropertyName(): keyof IThemeStoreState;
|
|
20
|
+
protected buildStoreId({ theme_id, app_id }: IGetThemeConfig): string;
|
|
21
|
+
protected createStore(): {
|
|
22
|
+
state: IThemeStoreState;
|
|
23
|
+
onChange: OnChangeType;
|
|
24
|
+
};
|
|
25
|
+
protected fetchDataAndUpdateStore(state: IThemeStoreState, config: IGetThemeConfig): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createStore } from "@stencil/store";
|
|
2
|
+
import { QrveyCacheManager } from "./cache-manager";
|
|
3
|
+
import { getCurrentTheme, getThemeById } from "../services/api/Themes.api";
|
|
4
|
+
export class ThemeCacheManager extends QrveyCacheManager {
|
|
5
|
+
static getInstance() {
|
|
6
|
+
if (!window.themeCacheManager) {
|
|
7
|
+
window.themeCacheManager = new ThemeCacheManager();
|
|
8
|
+
}
|
|
9
|
+
return window.themeCacheManager;
|
|
10
|
+
}
|
|
11
|
+
getConfigPropertyName() {
|
|
12
|
+
return "theme_id";
|
|
13
|
+
}
|
|
14
|
+
getStorePropertyName() {
|
|
15
|
+
return "theme";
|
|
16
|
+
}
|
|
17
|
+
buildStoreId({ theme_id, app_id }) {
|
|
18
|
+
return `${app_id}-${theme_id !== null && theme_id !== void 0 ? theme_id : "current"}`;
|
|
19
|
+
}
|
|
20
|
+
createStore() {
|
|
21
|
+
return createStore({
|
|
22
|
+
theme: null,
|
|
23
|
+
loading: true,
|
|
24
|
+
error: null,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
fetchDataAndUpdateStore(state, config) {
|
|
28
|
+
(config.theme_id ? getThemeById(config) : getCurrentTheme(config))
|
|
29
|
+
.then((theme) => {
|
|
30
|
+
state.theme = theme;
|
|
31
|
+
state.error = null;
|
|
32
|
+
state.loading = false;
|
|
33
|
+
})
|
|
34
|
+
.catch((e) => {
|
|
35
|
+
state.error = e;
|
|
36
|
+
state.loading = false;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OnChangeType, QrveyCacheManager } from "./cache-manager";
|
|
2
|
+
import { AnTheme } from "../interfaces/themes/an-theme";
|
|
3
|
+
export interface IGetThemeConfig {
|
|
4
|
+
qv_token?: string;
|
|
5
|
+
api_key?: string;
|
|
6
|
+
app_id?: string;
|
|
7
|
+
user_id?: string;
|
|
8
|
+
domain?: string;
|
|
9
|
+
theme_id?: string;
|
|
10
|
+
}
|
|
11
|
+
interface IThemeStoreState {
|
|
12
|
+
theme: AnTheme;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
error: any;
|
|
15
|
+
}
|
|
16
|
+
export declare class ThemeCacheManager extends QrveyCacheManager<IThemeStoreState, IGetThemeConfig> {
|
|
17
|
+
static getInstance(): ThemeCacheManager;
|
|
18
|
+
protected getConfigPropertyName(): keyof IGetThemeConfig;
|
|
19
|
+
protected getStorePropertyName(): keyof IThemeStoreState;
|
|
20
|
+
protected buildStoreId({ theme_id, app_id }: IGetThemeConfig): string;
|
|
21
|
+
protected createStore(): {
|
|
22
|
+
state: IThemeStoreState;
|
|
23
|
+
onChange: OnChangeType;
|
|
24
|
+
};
|
|
25
|
+
protected fetchDataAndUpdateStore(state: IThemeStoreState, config: IGetThemeConfig): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeCacheManager = void 0;
|
|
4
|
+
const store_1 = require("@stencil/store");
|
|
5
|
+
const cache_manager_1 = require("./cache-manager");
|
|
6
|
+
const Themes_api_1 = require("../services/api/Themes.api");
|
|
7
|
+
class ThemeCacheManager extends cache_manager_1.QrveyCacheManager {
|
|
8
|
+
static getInstance() {
|
|
9
|
+
if (!window.themeCacheManager) {
|
|
10
|
+
window.themeCacheManager = new ThemeCacheManager();
|
|
11
|
+
}
|
|
12
|
+
return window.themeCacheManager;
|
|
13
|
+
}
|
|
14
|
+
getConfigPropertyName() {
|
|
15
|
+
return "theme_id";
|
|
16
|
+
}
|
|
17
|
+
getStorePropertyName() {
|
|
18
|
+
return "theme";
|
|
19
|
+
}
|
|
20
|
+
buildStoreId({ theme_id, app_id }) {
|
|
21
|
+
return `${app_id}-${theme_id !== null && theme_id !== void 0 ? theme_id : "current"}`;
|
|
22
|
+
}
|
|
23
|
+
createStore() {
|
|
24
|
+
return (0, store_1.createStore)({
|
|
25
|
+
theme: null,
|
|
26
|
+
loading: true,
|
|
27
|
+
error: null,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
fetchDataAndUpdateStore(state, config) {
|
|
31
|
+
(config.theme_id ? (0, Themes_api_1.getThemeById)(config) : (0, Themes_api_1.getCurrentTheme)(config))
|
|
32
|
+
.then((theme) => {
|
|
33
|
+
state.theme = theme;
|
|
34
|
+
state.error = null;
|
|
35
|
+
state.loading = false;
|
|
36
|
+
})
|
|
37
|
+
.catch((e) => {
|
|
38
|
+
state.error = e;
|
|
39
|
+
state.loading = false;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ThemeCacheManager = ThemeCacheManager;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface AnThemeStyle {
|
|
2
|
+
canvasBackgroundColor?: string;
|
|
3
|
+
panelIconsForegroundColor?: string;
|
|
4
|
+
font: string;
|
|
5
|
+
hideTitle: any;
|
|
6
|
+
chartTitles: string;
|
|
7
|
+
axisDataLabels: string;
|
|
8
|
+
values: string;
|
|
9
|
+
legends: string;
|
|
10
|
+
tooltips: string;
|
|
11
|
+
mainColor: string;
|
|
12
|
+
tableHeaderMainColor: string;
|
|
13
|
+
themePalette: any[];
|
|
14
|
+
showHeader?: boolean;
|
|
15
|
+
dataLabels?: string;
|
|
16
|
+
panelBackgroundColor?: string;
|
|
17
|
+
transparent?: boolean;
|
|
18
|
+
valuesSecondary?: string;
|
|
19
|
+
tableHeaderFont?: string;
|
|
20
|
+
tableVisualizationBarPositive?: string;
|
|
21
|
+
tableVisualizationBarNegative?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AnThemeStyle } from "./an-style-theme";
|
|
2
|
+
export interface AnTheme {
|
|
3
|
+
useInAllApplications: boolean;
|
|
4
|
+
currentChartTheme: boolean;
|
|
5
|
+
isDefaultTheme: boolean;
|
|
6
|
+
createDate?: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
modifyDate?: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
chartThemeId?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
style: AnThemeStyle;
|
|
14
|
+
lang?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentTheme = exports.getThemeById = void 0;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const THEME_ENDPOINT_1 = require("../constants/THEME_ENDPOINT");
|
|
6
|
+
function getThemeById(config) {
|
|
7
|
+
return helpers_1.Request.get(Object.assign(Object.assign({}, config), { endpoint: THEME_ENDPOINT_1.CHART_THEMES_ENDPOINT }), `/${config.theme_id}`);
|
|
8
|
+
}
|
|
9
|
+
exports.getThemeById = getThemeById;
|
|
10
|
+
function getCurrentTheme(config) {
|
|
11
|
+
return helpers_1.Request.get(Object.assign(Object.assign({}, config), { endpoint: THEME_ENDPOINT_1.CHART_THEMES_ENDPOINT }), "?current=true");
|
|
12
|
+
}
|
|
13
|
+
exports.getCurrentTheme = getCurrentTheme;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface AnThemeStyle {
|
|
2
|
+
canvasBackgroundColor?: string;
|
|
3
|
+
panelIconsForegroundColor?: string;
|
|
4
|
+
font: string;
|
|
5
|
+
hideTitle: any;
|
|
6
|
+
chartTitles: string;
|
|
7
|
+
axisDataLabels: string;
|
|
8
|
+
values: string;
|
|
9
|
+
legends: string;
|
|
10
|
+
tooltips: string;
|
|
11
|
+
mainColor: string;
|
|
12
|
+
tableHeaderMainColor: string;
|
|
13
|
+
themePalette: any[];
|
|
14
|
+
showHeader?: boolean;
|
|
15
|
+
dataLabels?: string;
|
|
16
|
+
panelBackgroundColor?: string;
|
|
17
|
+
transparent?: boolean;
|
|
18
|
+
valuesSecondary?: string;
|
|
19
|
+
tableHeaderFont?: string;
|
|
20
|
+
tableVisualizationBarPositive?: string;
|
|
21
|
+
tableVisualizationBarNegative?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AnThemeStyle } from "./an-style-theme";
|
|
2
|
+
export interface AnTheme {
|
|
3
|
+
useInAllApplications: boolean;
|
|
4
|
+
currentChartTheme: boolean;
|
|
5
|
+
isDefaultTheme: boolean;
|
|
6
|
+
createDate?: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
modifyDate?: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
chartThemeId?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
style: AnThemeStyle;
|
|
14
|
+
lang?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Request } from "../helpers";
|
|
2
|
+
import { CHART_THEMES_ENDPOINT } from "../constants/THEME_ENDPOINT";
|
|
3
|
+
export function getThemeById(config) {
|
|
4
|
+
return Request.get(Object.assign(Object.assign({}, config), { endpoint: CHART_THEMES_ENDPOINT }), `/${config.theme_id}`);
|
|
5
|
+
}
|
|
6
|
+
export function getCurrentTheme(config) {
|
|
7
|
+
return Request.get(Object.assign(Object.assign({}, config), { endpoint: CHART_THEMES_ENDPOINT }), "?current=true");
|
|
8
|
+
}
|
package/package.json
CHANGED