@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,90 +0,0 @@
|
|
|
1
|
-
import { Datasource, DatasourceFactory, IDictionary } from '@zeedhi/core';
|
|
2
|
-
import { DynamicFilterDatasourceFactory } from '../../../../src';
|
|
3
|
-
|
|
4
|
-
describe('DynamicFilterDatasourceFactory', () => {
|
|
5
|
-
let factory: DynamicFilterDatasourceFactory;
|
|
6
|
-
let mockDatasourceFactory: jest.Mocked<typeof DatasourceFactory>;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
factory = new DynamicFilterDatasourceFactory();
|
|
10
|
-
|
|
11
|
-
// Create a mock for just the DatasourceFactory.factory method
|
|
12
|
-
mockDatasourceFactory = {
|
|
13
|
-
factory: jest.fn(),
|
|
14
|
-
} as unknown as jest.Mocked<typeof DatasourceFactory>;
|
|
15
|
-
|
|
16
|
-
// Replace the original implementation with our mock
|
|
17
|
-
jest.spyOn(DatasourceFactory, 'factory').mockImplementation(mockDatasourceFactory.factory);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
jest.restoreAllMocks();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe('factory', () => {
|
|
25
|
-
it('should create a datasource with correct configuration', () => {
|
|
26
|
-
const mockOptions: IDictionary<boolean> = {
|
|
27
|
-
option1: true,
|
|
28
|
-
option2: false,
|
|
29
|
-
};
|
|
30
|
-
const expectedData = [
|
|
31
|
-
{ text: 'TEKGRID_option1', value: 'option1' },
|
|
32
|
-
{ text: 'TEKGRID_option2', value: 'option2' },
|
|
33
|
-
];
|
|
34
|
-
const mockDatasource = {} as Datasource;
|
|
35
|
-
|
|
36
|
-
mockDatasourceFactory.factory.mockReturnValue(mockDatasource);
|
|
37
|
-
|
|
38
|
-
const result = factory.factory(mockOptions);
|
|
39
|
-
|
|
40
|
-
expect(mockDatasourceFactory.factory).toHaveBeenCalledWith({
|
|
41
|
-
data: expectedData,
|
|
42
|
-
loadAll: true,
|
|
43
|
-
translate: ['text'],
|
|
44
|
-
});
|
|
45
|
-
expect(result).toBe(mockDatasource);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should handle empty options', () => {
|
|
49
|
-
const mockOptions: IDictionary<boolean> = {};
|
|
50
|
-
const mockDatasource = {} as Datasource;
|
|
51
|
-
|
|
52
|
-
mockDatasourceFactory.factory.mockReturnValue(mockDatasource);
|
|
53
|
-
|
|
54
|
-
const result = factory.factory(mockOptions);
|
|
55
|
-
|
|
56
|
-
expect(mockDatasourceFactory.factory).toHaveBeenCalledWith({
|
|
57
|
-
data: [],
|
|
58
|
-
loadAll: true,
|
|
59
|
-
translate: ['text'],
|
|
60
|
-
});
|
|
61
|
-
expect(result).toBe(mockDatasource);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe('getFilterOptionsData', () => {
|
|
66
|
-
// Since this is a private method, we'll test it indirectly through the public factory method
|
|
67
|
-
// If you want to test it directly, you might need to make it public or use type assertions
|
|
68
|
-
|
|
69
|
-
it('should transform options correctly (tested through factory)', () => {
|
|
70
|
-
const mockOptions: IDictionary<boolean> = {
|
|
71
|
-
active: true,
|
|
72
|
-
inactive: false,
|
|
73
|
-
};
|
|
74
|
-
const mockDatasource = {} as Datasource;
|
|
75
|
-
|
|
76
|
-
mockDatasourceFactory.factory.mockReturnValue(mockDatasource);
|
|
77
|
-
|
|
78
|
-
factory.factory(mockOptions);
|
|
79
|
-
|
|
80
|
-
expect(mockDatasourceFactory.factory).toHaveBeenCalledWith({
|
|
81
|
-
data: [
|
|
82
|
-
{ text: 'TEKGRID_active', value: 'active' },
|
|
83
|
-
{ text: 'TEKGRID_inactive', value: 'inactive' },
|
|
84
|
-
],
|
|
85
|
-
loadAll: true,
|
|
86
|
-
translate: ['text'],
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { DateHelper } from '@zeedhi/core';
|
|
2
|
-
import { TekGridColumn, TekFilterHelper } from '../../../../src';
|
|
3
|
-
|
|
4
|
-
// Mock the DateHelper module
|
|
5
|
-
jest.mock('@zeedhi/core');
|
|
6
|
-
|
|
7
|
-
describe('TekFilterHelper', () => {
|
|
8
|
-
afterEach(() => {
|
|
9
|
-
jest.clearAllMocks();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
describe('getLabel', () => {
|
|
13
|
-
it('should call DateHelper.getLabel with the provided name', () => {
|
|
14
|
-
const testName = 'testFilter';
|
|
15
|
-
TekFilterHelper.getLabel(testName);
|
|
16
|
-
expect(DateHelper.getLabel).toHaveBeenCalledWith(testName);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('getValue', () => {
|
|
21
|
-
it('should call DateHelper.getValue with name and column dateFormat', () => {
|
|
22
|
-
const testName = 'testValue';
|
|
23
|
-
const mockColumn = {
|
|
24
|
-
componentProps: {
|
|
25
|
-
dateFormat: 'YYYY-MM-DD'
|
|
26
|
-
}
|
|
27
|
-
} as TekGridColumn;
|
|
28
|
-
|
|
29
|
-
TekFilterHelper.getValue(testName, mockColumn);
|
|
30
|
-
expect(DateHelper.getValue).toHaveBeenCalledWith(testName, mockColumn.componentProps.dateFormat);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('register', () => {
|
|
35
|
-
it('should call DateHelper.register with provided parameters', () => {
|
|
36
|
-
const testName = 'testRegister';
|
|
37
|
-
const testLabel = 'Test Register';
|
|
38
|
-
const testFn = () => new Date();
|
|
39
|
-
|
|
40
|
-
TekFilterHelper.register(testName, testLabel, testFn);
|
|
41
|
-
expect(DateHelper.register).toHaveBeenCalledWith(testName, testLabel, testFn);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('unregister', () => {
|
|
46
|
-
it('should call DateHelper.unregister with the provided name', () => {
|
|
47
|
-
const testName = 'testUnregister';
|
|
48
|
-
TekFilterHelper.unregister(testName);
|
|
49
|
-
expect(DateHelper.unregister).toHaveBeenCalledWith(testName);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|