@zeedhi/teknisa-components-common 3.0.4 → 3.2.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/teknisa-components-common.es.js +3536 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/tek-breadcrumb-header/breadcrumb-header.d.ts +2 -2
- package/dist/types/components/tek-breadcrumb-header/interfaces.d.ts +1 -1
- package/dist/types/components/tek-datasource/tek-memory-datasource.d.ts +1 -21
- package/dist/types/components/tek-datasource/tek-rest-datasource.d.ts +6 -30
- package/dist/types/components/tek-grid/filter-helper.d.ts +2 -2
- package/dist/types/components/tek-grid/grid-filter-button.d.ts +1 -0
- package/dist/types/components/tek-grid/grouped-data-manager.d.ts +8 -1
- package/dist/types/components/tek-grid/grouped-data-navigator.d.ts +12 -0
- package/dist/types/components/tek-grid/index.d.ts +1 -1
- package/dist/types/components/tek-grid/interfaces.d.ts +8 -1
- package/dist/types/components/tek-grid/tek-grid-controller.d.ts +19 -17
- package/dist/types/components/tek-grid/tek-grid-data-editor.d.ts +11 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.d.ts +1 -1
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.d.ts +8 -1
- package/dist/types/components/tek-grid/tek-grid.d.ts +24 -6
- package/dist/types/components/tek-loading/interfaces.d.ts +6 -0
- package/dist/types/components/tek-loading/loading.d.ts +16 -0
- package/dist/types/components/tek-user-info/TekUserInfoController.d.ts +4 -4
- package/dist/types/utils/extract-properties/extract-properties.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/report-filter/report-filter.d.ts +12 -0
- package/package.json +32 -12
- package/coverage/clover.xml +0 -6
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -0
- package/dist/teknisa-components-common.js +0 -3802
- package/dist/teknisa-components-common.min.js +0 -3802
- package/dist/types/components/tek-grid/grouped-view-navigator.d.ts +0 -14
- package/dist/types/error/delete-rows-error.d.ts +0 -6
- package/environments.json +0 -14
- package/jest.config.js +0 -1
- package/src/components/index.ts +0 -101
- package/src/components/tek-breadcrumb-header/breadcrumb-header.ts +0 -29
- package/src/components/tek-breadcrumb-header/interfaces.ts +0 -7
- package/src/components/tek-datasource/index.ts +0 -3
- package/src/components/tek-datasource/interfaces.ts +0 -36
- package/src/components/tek-datasource/tek-memory-datasource.ts +0 -314
- package/src/components/tek-datasource/tek-rest-datasource.ts +0 -224
- package/src/components/tek-grid/columns-searcher.ts +0 -22
- package/src/components/tek-grid/dynamic-filter-datasource-factory.ts +0 -20
- package/src/components/tek-grid/filter-helper.ts +0 -20
- package/src/components/tek-grid/grid-filter-button.ts +0 -419
- package/src/components/tek-grid/grouped-data-manager.ts +0 -448
- package/src/components/tek-grid/grouped-data-selector.ts +0 -40
- package/src/components/tek-grid/grouped-view-navigator.ts +0 -84
- package/src/components/tek-grid/index.ts +0 -18
- package/src/components/tek-grid/interfaces.ts +0 -329
- package/src/components/tek-grid/keymap-grouped.ts +0 -20
- package/src/components/tek-grid/layout-options.ts +0 -248
- package/src/components/tek-grid/tek-grid-column.ts +0 -193
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.ts +0 -28
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.ts +0 -38
- package/src/components/tek-grid/tek-grid-controller.ts +0 -140
- package/src/components/tek-grid/tek-grid-events.ts +0 -105
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.ts +0 -26
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/index.ts +0 -3
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.ts +0 -6
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.ts +0 -85
- package/src/components/tek-grid/tek-grid-toolbar-provider/index.ts +0 -2
- package/src/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.ts +0 -365
- package/src/components/tek-grid/tek-grid.ts +0 -1118
- package/src/components/tek-user-info/TekUserInfoController.ts +0 -87
- package/src/components/tek-user-info/interfaces.ts +0 -21
- package/src/components/tek-user-info/tek-user-info-list.ts +0 -64
- package/src/components/tek-user-info/tek-user-info.ts +0 -337
- package/src/error/tek-grid-delete-rows-error.ts +0 -15
- package/src/error/teknisa-common-error.ts +0 -8
- package/src/utils/config/config.ts +0 -8
- package/src/utils/index.ts +0 -3
- package/src/utils/is-filled-object/is-filled-object.ts +0 -5
- package/src/utils/is-nil.ts +0 -3
- package/tests/__helpers__/component-event-helper.ts +0 -5
- package/tests/__helpers__/flush-promises-helper.ts +0 -3
- package/tests/__helpers__/get-child-helper.ts +0 -27
- package/tests/__helpers__/index.ts +0 -3
- package/tests/__helpers__/mock-created-helper.ts +0 -12
- package/tests/__mocks__/@zeedhi/core/i18n.js +0 -75
- package/tests/__mocks__/@zeedhi/core.js +0 -5
- package/tests/unit/components/crud/crud-add-button.spec.ts +0 -56
- package/tests/unit/components/crud/crud-button.spec.ts +0 -94
- package/tests/unit/components/crud/crud-cancel-button.spec.ts +0 -91
- package/tests/unit/components/crud/crud-delete-button.spec.ts +0 -122
- package/tests/unit/components/crud/crud-form.spec.ts +0 -165
- package/tests/unit/components/crud/crud-save-button.spec.ts +0 -118
- package/tests/unit/components/tek-breadcrumb-header/tek-breadcrumb-header.spec.ts +0 -42
- package/tests/unit/components/tek-card-title/CardTitle.spec.ts +0 -34
- package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +0 -460
- package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +0 -362
- package/tests/unit/components/tek-drag-grid/tek-drag-grid.spec.ts +0 -112
- package/tests/unit/components/tek-grid/button-option.spec.ts +0 -49
- package/tests/unit/components/tek-grid/columns-searcher.spec.ts +0 -112
- package/tests/unit/components/tek-grid/dynamic-filter-datasource-factory.spec.ts +0 -90
- package/tests/unit/components/tek-grid/filter-helper.spec.ts +0 -52
- package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +0 -842
- package/tests/unit/components/tek-grid/grouped-data-manager.spec.ts +0 -593
- package/tests/unit/components/tek-grid/grouped-data-selector.spec.ts +0 -136
- package/tests/unit/components/tek-grid/grouped-view-navigator.spec.ts +0 -244
- package/tests/unit/components/tek-grid/keymap-grouped.spec.ts +0 -20
- package/tests/unit/components/tek-grid/layout-options.spec.ts +0 -1020
- package/tests/unit/components/tek-grid/multi-option.spec.ts +0 -139
- package/tests/unit/components/tek-grid/tek-grid-column.spec.ts +0 -312
- package/tests/unit/components/tek-grid/tek-grid-columns-button.spec.ts +0 -228
- package/tests/unit/components/tek-grid/tek-grid-controller.spec.ts +0 -253
- package/tests/unit/components/tek-grid/tek-grid-events.spec.ts +0 -186
- package/tests/unit/components/tek-grid/tek-grid-toolbar-provider.spec.ts +0 -34
- package/tests/unit/components/tek-grid/tek-grid.spec.ts +0 -895
- package/tests/unit/components/tek-grid/tek-memory-datasource.spec.ts +0 -482
- package/tests/unit/components/tek-grid/tek-rest-datasource.spec.ts +0 -422
- package/tests/unit/components/tek-image/Image.spec.ts +0 -67
- package/tests/unit/components/tek-iterable-carousel/iterable-carousel.spec.ts +0 -37
- package/tests/unit/components/tek-iterable-component-render/iterable-component-render.spec.ts +0 -200
- package/tests/unit/components/tek-loading/Loading.spec.ts +0 -30
- package/tests/unit/components/tek-notifications/notifications.spec.ts +0 -201
- package/tests/unit/components/tek-product-card/product-card.spec.ts +0 -61
- package/tests/unit/components/tek-user-info/TekUserInfoContoller.spec.ts +0 -220
- package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +0 -86
- package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +0 -430
- package/tests/unit/components/tree-grid/tree-grid.spec.ts +0 -776
- package/tests/unit/utils/grid-base/export-options/button-option.spec.ts +0 -44
- package/tests/unit/utils/grid-base/export-options/multi-option.spec.ts +0 -135
- package/tests/unit/utils/grid-base/grid-controller.spec.ts +0 -174
- package/tests/unit/utils/report-filter/report-filter.spec.ts +0 -66
- package/tsconfig.build.json +0 -7
- package/tsconfig.eslint.json +0 -9
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { TekUserInfo } from './tek-user-info';
|
|
2
|
-
|
|
3
|
-
class TekUserInfoController {
|
|
4
|
-
component: TekUserInfo;
|
|
5
|
-
|
|
6
|
-
get versionInfo() {
|
|
7
|
-
return this.component.versionInfo;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
constructor(component: TekUserInfo) {
|
|
11
|
-
this.component = component;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
get name() {
|
|
15
|
-
return this.versionInfo?.name || '';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
set name(value: string) {
|
|
19
|
-
if (!this.versionInfo) return;
|
|
20
|
-
this.versionInfo.name = value;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get version() {
|
|
24
|
-
return this.versionInfo?.version || '';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
set version(value: string) {
|
|
28
|
-
if (!this.versionInfo) return;
|
|
29
|
-
this.versionInfo.version = value;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get hasDefaultEmail() {
|
|
33
|
-
return !!this.component.defaultEmail;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get hasAboutImage() {
|
|
37
|
-
return !!this.component.aboutImage;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
mergeText(name: string, version: string) {
|
|
41
|
-
return `<li>${name} - <b>${version}</b></li>`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
get mainVersion() {
|
|
45
|
-
if (!this.versionInfo?.name || !this.versionInfo.version) return '';
|
|
46
|
-
|
|
47
|
-
return `${this.versionInfo.name} - <b>${this.versionInfo.version}</b>`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
protected getItems(tab: 'frontend' | 'backend' | 'modules') {
|
|
51
|
-
if (!this.versionInfo) return [];
|
|
52
|
-
|
|
53
|
-
const tabInfo = this.versionInfo[tab];
|
|
54
|
-
|
|
55
|
-
return `<ul>${tabInfo.map((item) => this.mergeText(item.name, item.version)).join('')}</ul>`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
get frontendItems() {
|
|
59
|
-
return this.getItems('frontend');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get backendItems() {
|
|
63
|
-
return this.getItems('backend');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
get modulesItems() {
|
|
67
|
-
return this.getItems('modules');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get showReportError() {
|
|
71
|
-
const { reportError } = this.component.visibleItems;
|
|
72
|
-
return reportError || reportError === undefined;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get showVersionInfo() {
|
|
76
|
-
const { versionInfo } = this.component.visibleItems;
|
|
77
|
-
return versionInfo || versionInfo === undefined;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
get showAbout() {
|
|
81
|
-
const { about } = this.component.visibleItems;
|
|
82
|
-
return about || about === undefined;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export { TekUserInfoController };
|
|
87
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IList } from '@zeedhi/common';
|
|
2
|
-
import { IUserInfo } from '@zeedhi/zd-user-info-common';
|
|
3
|
-
|
|
4
|
-
export interface IVersionInfo {
|
|
5
|
-
name: string,
|
|
6
|
-
version: string,
|
|
7
|
-
frontend: { name: string, version: string }[],
|
|
8
|
-
backend: { name: string, version: string }[],
|
|
9
|
-
modules: { name: string, version: string }[],
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ITekUserInfo extends IUserInfo {
|
|
13
|
-
aboutImage?: string;
|
|
14
|
-
defaultEmail?: string;
|
|
15
|
-
versionInfo?: IVersionInfo | null;
|
|
16
|
-
versionUrl?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ITekUserInfoList extends IList {
|
|
20
|
-
parentName?: string;
|
|
21
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { List } from '@zeedhi/common';
|
|
2
|
-
import { Metadata } from '@zeedhi/core';
|
|
3
|
-
import { ITekUserInfoList } from './interfaces';
|
|
4
|
-
import { TekUserInfo } from './tek-user-info';
|
|
5
|
-
|
|
6
|
-
export class TekUserInfoList extends List implements ITekUserInfoList {
|
|
7
|
-
/**
|
|
8
|
-
* Name of the user info component
|
|
9
|
-
*/
|
|
10
|
-
public parentName = '';
|
|
11
|
-
|
|
12
|
-
public dense = true;
|
|
13
|
-
|
|
14
|
-
constructor(props: ITekUserInfoList) {
|
|
15
|
-
super(props);
|
|
16
|
-
this.parentName = props.parentName || '';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
onCreated(): void {
|
|
20
|
-
super.onCreated();
|
|
21
|
-
this.items = this.getItems();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
protected getItems() {
|
|
25
|
-
const parent = this.parentName ? Metadata.getInstance<TekUserInfo>(this.parentName) : this.parent;
|
|
26
|
-
|
|
27
|
-
if (!(parent instanceof TekUserInfo)) {
|
|
28
|
-
throw Error(`Could not find the TekUserInfo component associated with ${this.name} TekUserInfoList`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return [
|
|
32
|
-
{
|
|
33
|
-
name: `${parent.name}_version`,
|
|
34
|
-
component: 'ZdListItem',
|
|
35
|
-
title: `{{TekUserInfoController_${parent.componentId}.name}}`,
|
|
36
|
-
subtitle: `{{TekUserInfoController_${parent.componentId}.version}}`,
|
|
37
|
-
isVisible: `{{TekUserInfoController_${parent.componentId}.showVersionInfo}}`,
|
|
38
|
-
cssClass: 'zd-px-2',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: `${parent.name}_about`,
|
|
42
|
-
component: 'ZdListItem',
|
|
43
|
-
title: 'TEKUSERINFO_ABOUT',
|
|
44
|
-
prependIcon: 'infoOutline',
|
|
45
|
-
cssClass: 'zd-px-2',
|
|
46
|
-
isVisible: `{{TekUserInfoController_${parent.componentId}.showAbout}}`,
|
|
47
|
-
events: {
|
|
48
|
-
click: () => parent.onAboutClick(),
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: `${parent.name}_report`,
|
|
53
|
-
component: 'ZdListItem',
|
|
54
|
-
title: 'TEKUSERINFO_REPORT_ERROR',
|
|
55
|
-
prependIcon: 'mdi-ladybug',
|
|
56
|
-
cssClass: 'zd-px-2',
|
|
57
|
-
isVisible: `{{TekUserInfoController_${parent.componentId}.showReportError}}`,
|
|
58
|
-
events: {
|
|
59
|
-
click: () => parent.onReportClick(),
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { Button, Form, IComponentRender, Modal, ModalService } from '@zeedhi/common';
|
|
2
|
-
import {
|
|
3
|
-
Http, IEventParam, Loader, Messages, Metadata,
|
|
4
|
-
} from '@zeedhi/core';
|
|
5
|
-
import { ITekUserInfo, IVersionInfo } from './interfaces';
|
|
6
|
-
import { TekUserInfoController } from './TekUserInfoController';
|
|
7
|
-
import { UserInfo } from '@zeedhi/zd-user-info-common';
|
|
8
|
-
|
|
9
|
-
export class TekUserInfo extends UserInfo implements ITekUserInfo {
|
|
10
|
-
public aboutModal?: Modal;
|
|
11
|
-
|
|
12
|
-
public reportModal?: Modal;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Data about the application version
|
|
16
|
-
*/
|
|
17
|
-
public versionInfo: IVersionInfo | null = null;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Default email address to be defined in the Report Bug form
|
|
21
|
-
*/
|
|
22
|
-
public defaultEmail = '';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Url from which the version info will be retrieved
|
|
26
|
-
*/
|
|
27
|
-
public versionUrl = '';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Path to the image to be shown on about modal
|
|
31
|
-
*/
|
|
32
|
-
public aboutImage = '';
|
|
33
|
-
|
|
34
|
-
protected propBottomSlot?: IComponentRender[];
|
|
35
|
-
|
|
36
|
-
constructor(props: ITekUserInfo) {
|
|
37
|
-
super(props);
|
|
38
|
-
this.versionInfo = this.getInitValue('versionInfo', props.versionInfo, this.versionInfo);
|
|
39
|
-
this.defaultEmail = this.getInitValue('defaultEmail', props.defaultEmail, this.defaultEmail);
|
|
40
|
-
this.versionUrl = this.getInitValue('versionUrl', props.versionUrl, this.versionUrl);
|
|
41
|
-
this.aboutImage = this.getInitValue('aboutImage', props.aboutImage, this.aboutImage);
|
|
42
|
-
|
|
43
|
-
this.createAccessors();
|
|
44
|
-
this.propBottomSlot = props.bottomSlot;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
protected getBottomSlot(): IComponentRender[] {
|
|
48
|
-
return [
|
|
49
|
-
{
|
|
50
|
-
name: `${this.name}_bottom_list`,
|
|
51
|
-
component: 'TekUserInfoList',
|
|
52
|
-
parentName: this.name,
|
|
53
|
-
},
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public onAboutClick() {
|
|
58
|
-
if (!this.aboutModal) {
|
|
59
|
-
this.aboutModal = ModalService.create({
|
|
60
|
-
name: `${this.name}_about_modal`,
|
|
61
|
-
cssClass: 'about-modal',
|
|
62
|
-
grid: { cols: 8, sm: 4, lg: 5 },
|
|
63
|
-
children: [
|
|
64
|
-
{
|
|
65
|
-
name: `${this.name}_about_header`,
|
|
66
|
-
component: 'ZdHeader',
|
|
67
|
-
color: 'transparent',
|
|
68
|
-
padless: true,
|
|
69
|
-
elevation: 0,
|
|
70
|
-
rightSlot: [
|
|
71
|
-
{
|
|
72
|
-
name: `${this.name}_about_close_button`,
|
|
73
|
-
component: 'ZdModalCloseButton',
|
|
74
|
-
small: true,
|
|
75
|
-
modalName: `${this.name}_about_modal`,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: `${this.name}_about_row`,
|
|
81
|
-
component: 'ZdTag',
|
|
82
|
-
tag: 'div',
|
|
83
|
-
cssClass: 'zd-justify-center zd-px-6',
|
|
84
|
-
isVisible: `{{TekUserInfoController_${this.componentId}.hasAboutImage}}`,
|
|
85
|
-
children: [
|
|
86
|
-
{
|
|
87
|
-
name: `${this.name}_about_image`,
|
|
88
|
-
component: 'ZdImage',
|
|
89
|
-
width: '100%',
|
|
90
|
-
src: this.aboutImage,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: `${this.name}_version_tabs`,
|
|
96
|
-
cssClass: 'zd-pt-3 zd-tekUserInfo-tab',
|
|
97
|
-
component: 'ZdTabs',
|
|
98
|
-
tabs: [
|
|
99
|
-
{
|
|
100
|
-
name: `${this.name}_version_frontend_tab`,
|
|
101
|
-
tabTitle: 'Frontend',
|
|
102
|
-
children: this.getVersionTree('frontend'),
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: `${this.name}_version_backend_tab`,
|
|
106
|
-
tabTitle: 'Backend',
|
|
107
|
-
children: this.getVersionTree('backend'),
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: `${this.name}_version_modules_tab`,
|
|
111
|
-
tabTitle: 'Modules',
|
|
112
|
-
children: this.getVersionTree('modules'),
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
this.aboutModal.show();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
protected getVersionTree(tab: 'frontend' | 'backend' | 'modules') {
|
|
124
|
-
if (!this.versionInfo) return [];
|
|
125
|
-
|
|
126
|
-
const main = {
|
|
127
|
-
name: `${this.name}_version_${tab}_main`,
|
|
128
|
-
component: 'ZdText',
|
|
129
|
-
text: `{{TekUserInfoController_${this.componentId}.mainVersion}}`,
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const itemsComponent = {
|
|
133
|
-
name: `${this.name}_version_${tab}`,
|
|
134
|
-
component: 'ZdText',
|
|
135
|
-
cssClass: 'zd-pl-4',
|
|
136
|
-
text: `{{TekUserInfoController_${this.componentId}.${tab}Items}}`,
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
return [main, itemsComponent];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
public onReportClick() {
|
|
143
|
-
if (!this.reportModal) {
|
|
144
|
-
this.reportModal = ModalService.create({
|
|
145
|
-
name: `${this.name}_report_modal`,
|
|
146
|
-
children: [
|
|
147
|
-
{
|
|
148
|
-
name: `${this.name}_report_header`,
|
|
149
|
-
component: 'ZdHeader',
|
|
150
|
-
color: 'transparent',
|
|
151
|
-
padless: true,
|
|
152
|
-
elevation: 0,
|
|
153
|
-
leftSlot: [
|
|
154
|
-
{
|
|
155
|
-
name: `${this.name}_report_title`,
|
|
156
|
-
component: 'ZdText',
|
|
157
|
-
text: 'TEKUSERINFO_REPORT_ERROR',
|
|
158
|
-
cssClass: 'zd-theme-font-title',
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
rightSlot: [
|
|
162
|
-
{
|
|
163
|
-
name: `${this.name}_report_close_button`,
|
|
164
|
-
component: 'ZdModalCloseButton',
|
|
165
|
-
small: true,
|
|
166
|
-
modalName: `${this.name}_report_modal`,
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: `${this.name}_report_form`,
|
|
172
|
-
component: 'ZdForm',
|
|
173
|
-
cssClass: 'zd-pt-4',
|
|
174
|
-
children: [
|
|
175
|
-
{
|
|
176
|
-
name: 'report_email',
|
|
177
|
-
component: 'ZdTextInput',
|
|
178
|
-
label: 'E-mail',
|
|
179
|
-
grid: {
|
|
180
|
-
cols: '12',
|
|
181
|
-
},
|
|
182
|
-
value: this.defaultEmail,
|
|
183
|
-
readonly: `{{TekUserInfoController_${this.componentId}.hasDefaultEmail}}`,
|
|
184
|
-
validations: {
|
|
185
|
-
required: {},
|
|
186
|
-
email: {},
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: 'report_cc',
|
|
191
|
-
component: 'ZdTextInput',
|
|
192
|
-
label: 'CC',
|
|
193
|
-
placeholder: 'TEKUSERINFO_EMAIL_PLACEHOLDER',
|
|
194
|
-
grid: {
|
|
195
|
-
cols: '12',
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: 'report_type',
|
|
200
|
-
component: 'ZdSelect',
|
|
201
|
-
label: 'TEKUSERINFO_TYPE',
|
|
202
|
-
dataValue: 'value',
|
|
203
|
-
dataText: 'text',
|
|
204
|
-
datasource: {
|
|
205
|
-
uniqueKey: 'value',
|
|
206
|
-
translate: true,
|
|
207
|
-
data: [
|
|
208
|
-
{ value: '0', text: 'TEKUSERINFO_ERROR' },
|
|
209
|
-
{ value: '1', text: 'TEKUSERINFO_IMPROVEMENT' },
|
|
210
|
-
],
|
|
211
|
-
},
|
|
212
|
-
grid: {
|
|
213
|
-
cols: '12',
|
|
214
|
-
},
|
|
215
|
-
validations: {
|
|
216
|
-
required: {},
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: 'report_description',
|
|
221
|
-
component: 'ZdTextarea',
|
|
222
|
-
label: 'TEKUSERINFO_DESCRIPTION',
|
|
223
|
-
grid: {
|
|
224
|
-
cols: '12',
|
|
225
|
-
},
|
|
226
|
-
validations: {
|
|
227
|
-
required: {},
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: `${this.name}_report_footer`,
|
|
234
|
-
component: 'ZdFooter',
|
|
235
|
-
color: 'transparent',
|
|
236
|
-
padless: true,
|
|
237
|
-
rightSlot: [
|
|
238
|
-
{
|
|
239
|
-
name: `${this.name}_report_cancel`,
|
|
240
|
-
component: 'ZdButton',
|
|
241
|
-
label: 'TEKUSERINFO_CANCEL',
|
|
242
|
-
outline: true,
|
|
243
|
-
events: {
|
|
244
|
-
click: () => { this.reportModal?.hide(); },
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: `${this.name}_report_send`,
|
|
249
|
-
component: 'ZdButton',
|
|
250
|
-
label: 'TEKUSERINFO_SEND',
|
|
251
|
-
events: {
|
|
252
|
-
click: (args: IEventParam<Button>) => this.onSendReport(args),
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
},
|
|
257
|
-
],
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
this.reportModal.show();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
public async onSendReport({ event, element }: IEventParam<Button>) {
|
|
265
|
-
if (!this.reportModal) return;
|
|
266
|
-
|
|
267
|
-
const form = Metadata.getInstance<Form>(`${this.name}_report_form`);
|
|
268
|
-
|
|
269
|
-
const validation = await form.validate();
|
|
270
|
-
|
|
271
|
-
if (!validation.valid) return;
|
|
272
|
-
|
|
273
|
-
this.callEvent('onSendReport', {
|
|
274
|
-
event, element, component: this, form,
|
|
275
|
-
});
|
|
276
|
-
this.reportModal.hide();
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
public onCreated() {
|
|
280
|
-
super.onCreated();
|
|
281
|
-
Loader.addController(`TekUserInfoController_${this.componentId}`, TekUserInfoController, [this]);
|
|
282
|
-
|
|
283
|
-
this.bottomSlot = this.propBottomSlot ? this.propBottomSlot : this.getBottomSlot();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
public async onMounted(element: any) {
|
|
287
|
-
super.onMounted(element);
|
|
288
|
-
|
|
289
|
-
if (this.versionUrl) {
|
|
290
|
-
const res = await Http.get(this.versionUrl);
|
|
291
|
-
|
|
292
|
-
this.versionInfo = res.data.versionInfo;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
Messages.add({
|
|
298
|
-
'pt-BR': {
|
|
299
|
-
translation: {
|
|
300
|
-
TEKUSERINFO_ABOUT: 'Sobre',
|
|
301
|
-
TEKUSERINFO_REPORT_ERROR: 'Reportar Erro',
|
|
302
|
-
TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separe e-mails usando ";"',
|
|
303
|
-
TEKUSERINFO_TYPE: 'Tipo',
|
|
304
|
-
TEKUSERINFO_ERROR: 'Erro',
|
|
305
|
-
TEKUSERINFO_IMPROVEMENT: 'Melhoria',
|
|
306
|
-
TEKUSERINFO_DESCRIPTION: 'Descrição',
|
|
307
|
-
TEKUSERINFO_CANCEL: 'Cancelar',
|
|
308
|
-
TEKUSERINFO_SEND: 'Enviar',
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
'en-US': {
|
|
312
|
-
translation: {
|
|
313
|
-
TEKUSERINFO_ABOUT: 'About',
|
|
314
|
-
TEKUSERINFO_REPORT_ERROR: 'Report Bug',
|
|
315
|
-
TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separate e-mails using ";"',
|
|
316
|
-
TEKUSERINFO_TYPE: 'Type',
|
|
317
|
-
TEKUSERINFO_ERROR: 'Bug',
|
|
318
|
-
TEKUSERINFO_IMPROVEMENT: 'Improvement',
|
|
319
|
-
TEKUSERINFO_DESCRIPTION: 'Description',
|
|
320
|
-
TEKUSERINFO_CANCEL: 'Cancel',
|
|
321
|
-
TEKUSERINFO_SEND: 'Send',
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
-
'es-CL': {
|
|
325
|
-
translation: {
|
|
326
|
-
TEKUSERINFO_ABOUT: 'Sobre',
|
|
327
|
-
TEKUSERINFO_REPORT_ERROR: 'Reportar Error',
|
|
328
|
-
TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separar e-mails usando ";"',
|
|
329
|
-
TEKUSERINFO_TYPE: 'Tipo',
|
|
330
|
-
TEKUSERINFO_ERROR: 'Error',
|
|
331
|
-
TEKUSERINFO_IMPROVEMENT: 'Mejora',
|
|
332
|
-
TEKUSERINFO_DESCRIPTION: 'Descripción',
|
|
333
|
-
TEKUSERINFO_CANCEL: 'Cancelar',
|
|
334
|
-
TEKUSERINFO_SEND: 'Enviar',
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TeknisaCommonError } from './teknisa-common-error';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* TekGridDelete rows error
|
|
5
|
-
*/
|
|
6
|
-
export class TekGridDeleteRowsError extends TeknisaCommonError {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(
|
|
9
|
-
"TekGrid can't automatically delete rows when selectAllPages property is true." +
|
|
10
|
-
' You should delete them manually using the beforeDelete event and preventing' +
|
|
11
|
-
' the default execution',
|
|
12
|
-
);
|
|
13
|
-
this.name = 'TekGridDeleteRowsError';
|
|
14
|
-
}
|
|
15
|
-
}
|
package/src/utils/index.ts
DELETED
package/src/utils/is-nil.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { IComponent } from '@zeedhi/common';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Search for a component inside an array of children
|
|
5
|
-
*
|
|
6
|
-
* The children array can be either an array of IComponent or an array of Component
|
|
7
|
-
*/
|
|
8
|
-
const getChild = <T extends IComponent>(children: any[], name: string): T => {
|
|
9
|
-
let found: any;
|
|
10
|
-
|
|
11
|
-
children.forEach((child) => {
|
|
12
|
-
if (child.name === name) {
|
|
13
|
-
found = child;
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (child.children && child.children.length > 0) {
|
|
18
|
-
const result = getChild<T>(child.children, name) as T;
|
|
19
|
-
|
|
20
|
-
if (result) found = result;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return found;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export { getChild };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ComponentRender } from '@zeedhi/common';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Function used to spy on a class' onCreated and always assign the componentId as 1
|
|
5
|
-
*/
|
|
6
|
-
const mockCreated = <T extends ComponentRender>(component: T, prototype: any) => {
|
|
7
|
-
jest.spyOn(prototype, 'onCreated').mockImplementation(() => {
|
|
8
|
-
component.componentId = 1;
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { mockCreated };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock for @zeedhi/core I18n API
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const words = {
|
|
6
|
-
TEKGRID_CONTAINS: 'contains',
|
|
7
|
-
TEKGRID_NOT_CONTAINS: 'does not contain',
|
|
8
|
-
TEKGRID_EQUALS: 'is equal to',
|
|
9
|
-
TEKGRID_NOT_EQUALS: 'is different from',
|
|
10
|
-
TEKGRID_GREATER_THAN: 'is greater than',
|
|
11
|
-
TEKGRID_LESS_THAN: 'is less than',
|
|
12
|
-
TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
|
|
13
|
-
TEKGRID_LESS_THAN_EQUALS: 'is less or equals to',
|
|
14
|
-
TEKGRID_IN: 'is in',
|
|
15
|
-
TEKGRID_NOT_IN: 'is not in',
|
|
16
|
-
TEKGRID_BETWEEN: 'is between',
|
|
17
|
-
TEKGRID_AND: 'and',
|
|
18
|
-
TEKGRID_OR: 'or',
|
|
19
|
-
TEKGRID_ADD: 'Add',
|
|
20
|
-
TEKGRID_DELETE: 'Delete',
|
|
21
|
-
TEKGRID_REFRESH: 'Refresh',
|
|
22
|
-
TEKGRID_COLUMNS: 'Columns',
|
|
23
|
-
TEKGRID_SAVE: 'Save',
|
|
24
|
-
TEKGRID_CANCEL: 'Cancel',
|
|
25
|
-
TEKGRID_FILTER: 'Filter',
|
|
26
|
-
TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
|
|
27
|
-
TEKGRID_EXPORT: 'Export',
|
|
28
|
-
TEKGRID_EXPORT_AS: 'Export as {{type}}',
|
|
29
|
-
TEKGRID_COLUMN_VISIBLE: 'Visible',
|
|
30
|
-
TEKGRID_COLUMN_GROUPED: 'Grouped',
|
|
31
|
-
TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
|
|
32
|
-
TEKGRID_AGGREGATION_SUM: 'Sum',
|
|
33
|
-
TEKGRID_AGGREGATION_AVG: 'Average',
|
|
34
|
-
TEKGRID_AGGREGATION_MAX: 'Maximum',
|
|
35
|
-
TEKGRID_AGGREGATION_MIN: 'Minimum',
|
|
36
|
-
TEKGRID_AGGREGATION_COUNT: 'Count',
|
|
37
|
-
NO_NOTIFICATIONS: 'No Notifications',
|
|
38
|
-
MARK_ALL_AS_READ: 'Mark all as read',
|
|
39
|
-
NOTIFICATIONS: 'Notifications',
|
|
40
|
-
SEE_ALL_NOTIFICATIONS: 'See all notifications',
|
|
41
|
-
UNAVAILABLE_IMAGE: 'Unavailable image',
|
|
42
|
-
REFRESH: 'Refresh',
|
|
43
|
-
ACTIONS: 'Actions',
|
|
44
|
-
FILTER: 'Filter',
|
|
45
|
-
LAYOUT: 'Layout: ',
|
|
46
|
-
NEW_LAYOUT: 'New layout',
|
|
47
|
-
DEFAULT_LAYOUT: 'Default',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const notImplemented = (name, isMethod = true) => {
|
|
51
|
-
const member = isMethod ? `I18n.${name}() method` : `I18n.${name} property`;
|
|
52
|
-
throw new Error(`The ${member} is not yet implemented/mocked by the mock in 'tests/__mocks__/@zeedhi/core/i18n.ts'.`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const mock = {
|
|
56
|
-
translate: (value, variables) => {
|
|
57
|
-
let result = words[value] || value;
|
|
58
|
-
const keys = variables ? Object.keys(variables) : undefined;
|
|
59
|
-
if (keys) {
|
|
60
|
-
keys.forEach((key) => {
|
|
61
|
-
result = result.replace(`{{${key}}}`, variables[key]);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return result;
|
|
66
|
-
},
|
|
67
|
-
registerChangeListener: () => notImplemented('registerChangeListener'),
|
|
68
|
-
unregisterChangeListener: () => notImplemented('unregisterChangeListener'),
|
|
69
|
-
init: () => notImplemented('init'),
|
|
70
|
-
changeLanguage: () => notImplemented('changeLanguage'),
|
|
71
|
-
get instance() { return { language: 'en-US'} },
|
|
72
|
-
set instance(_value) { notImplemented('instance setter') },
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
module.exports = mock;
|