@zeedhi/teknisa-components-common 1.95.0 → 1.96.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/coverage/clover.xml +640 -619
- package/coverage/coverage-final.json +11 -11
- package/coverage/lcov-report/index.html +11 -11
- package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +9 -9
- package/coverage/lcov-report/tests/__helpers__/index.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/index.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +1 -1
- package/coverage/lcov.info +1165 -1125
- package/dist/tek-components-common.esm.js +70 -42
- package/dist/tek-components-common.umd.js +68 -40
- package/package.json +2 -2
- package/tests/__mocks__/@zeedhi/core/i18n.js +1 -1
- package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +129 -2
- package/tests/unit/components/tek-grid/grid.spec.ts +22 -3
- package/types/components/tek-grid/grid-filter-button.d.ts +2 -0
- package/types/components/tek-grid/grid.d.ts +5 -4
- package/types/components/tek-grid/interfaces.d.ts +4 -1
- package/types/components/tek-tree-grid/interfaces.d.ts +1 -0
- package/types/components/tek-tree-grid/tree-grid.d.ts +1 -0
- package/types/utils/config/config.d.ts +2 -0
- package/types/utils/grid-base/grid-base.d.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { KeyMap, I18n, FormatterParserProvider, Messages, DatasourceFactory, Metadata, MemoryDatasource, URL, Utils, RestDatasource, Loader, DateHelper,
|
|
2
|
-
import { Form, Button, Tooltip, GridEditable, Grid, ComponentRender, Iterable, Carousel, IterableComponentRender as IterableComponentRender$1, Loading as Loading$1, GridColumnEditable, Report, ColumnNotFoundError, IterableColumnsButtonController, IterableColumnsButton, ModalService, TreeGridEditable, List } from '@zeedhi/common';
|
|
1
|
+
import { KeyMap, I18n, FormatterParserProvider, Messages, DatasourceFactory, Metadata, MemoryDatasource, URL, Utils, RestDatasource, Config, Loader, DateHelper, Http, Singleton, VersionService } from '@zeedhi/core';
|
|
2
|
+
import { Form, Button, Tooltip, GridEditable, Grid, ComponentRender, Iterable, Carousel, IterableComponentRender as IterableComponentRender$1, Loading as Loading$1, GridColumnEditable, Report, ColumnNotFoundError, IterableColumnsButtonController, IterableColumnsButton, ModalService, SelectMultiple, TreeGridEditable, List } from '@zeedhi/common';
|
|
3
3
|
import debounce from 'lodash.debounce';
|
|
4
4
|
import merge from 'lodash.merge';
|
|
5
5
|
import { UserInfo } from '@zeedhi/zd-user-info-common';
|
|
@@ -1032,6 +1032,7 @@ class GridBase {
|
|
|
1032
1032
|
component: 'TekGridFilterButton',
|
|
1033
1033
|
grid: this.grid,
|
|
1034
1034
|
gridName: this.grid.name,
|
|
1035
|
+
showCheckboxAll: this.grid.showCheckboxAllFilter,
|
|
1035
1036
|
isVisible: `{{GridController_${this.grid.componentId}.showFilterButton}}`,
|
|
1036
1037
|
events: {
|
|
1037
1038
|
onCreated: this.loadFilterButton.bind(this),
|
|
@@ -1226,7 +1227,7 @@ Messages.add({
|
|
|
1226
1227
|
TEKGRID_CONTAINS: 'contains',
|
|
1227
1228
|
TEKGRID_NOT_CONTAINS: 'does not contain',
|
|
1228
1229
|
TEKGRID_EQUALS: 'is equal to',
|
|
1229
|
-
TEKGRID_NOT_EQUALS: 'is
|
|
1230
|
+
TEKGRID_NOT_EQUALS: 'is different from',
|
|
1230
1231
|
TEKGRID_GREATER_THAN: 'is greater than',
|
|
1231
1232
|
TEKGRID_LESS_THAN: 'is less than',
|
|
1232
1233
|
TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
|
|
@@ -2220,6 +2221,7 @@ class TekGrid extends GridEditable {
|
|
|
2220
2221
|
this.groupedData = [];
|
|
2221
2222
|
this.toolbarSlotProps = false;
|
|
2222
2223
|
this.editNewRowsOnly = false;
|
|
2224
|
+
this.showCheckboxAllFilter = Config.gridShowCheckboxAllFilter || false;
|
|
2223
2225
|
this.defaultLazy = false;
|
|
2224
2226
|
this.groups = [];
|
|
2225
2227
|
this.summary = {};
|
|
@@ -2250,6 +2252,7 @@ class TekGrid extends GridEditable {
|
|
|
2250
2252
|
this.exportActions = props.exportActions || this.exportActions;
|
|
2251
2253
|
this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
|
|
2252
2254
|
this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
|
|
2255
|
+
this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
|
|
2253
2256
|
this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
|
|
2254
2257
|
this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
|
|
2255
2258
|
this.actions = props.actions || this.actions;
|
|
@@ -2426,9 +2429,9 @@ class TekGrid extends GridEditable {
|
|
|
2426
2429
|
*/
|
|
2427
2430
|
loadAfterTasks() {
|
|
2428
2431
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2429
|
-
|
|
2432
|
+
Promise.all(this.tasksBeforeLoad.map((promise) => promise.catch(() => undefined)));
|
|
2430
2433
|
this.tasksBeforeLoad = [];
|
|
2431
|
-
this.request();
|
|
2434
|
+
return this.request();
|
|
2432
2435
|
});
|
|
2433
2436
|
}
|
|
2434
2437
|
initGrouping(lazyLoad) {
|
|
@@ -2453,6 +2456,7 @@ class TekGrid extends GridEditable {
|
|
|
2453
2456
|
}
|
|
2454
2457
|
updateGroupedData(lazyLoad) {
|
|
2455
2458
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2459
|
+
this.initSummaryColumns();
|
|
2456
2460
|
this.groupedData = [];
|
|
2457
2461
|
this.groupColumns = this.columns.filter((column) => column.grouped);
|
|
2458
2462
|
this.groupColumnNames = this.groupColumns.map((column) => column.name);
|
|
@@ -2759,7 +2763,7 @@ class TekGrid extends GridEditable {
|
|
|
2759
2763
|
}
|
|
2760
2764
|
this.datasource.currentRow = newRow;
|
|
2761
2765
|
}
|
|
2762
|
-
directionalLeft() {
|
|
2766
|
+
directionalLeft(params) {
|
|
2763
2767
|
var _a;
|
|
2764
2768
|
const { currentRow } = this.datasource;
|
|
2765
2769
|
if (currentRow.group && currentRow.groupOpened) {
|
|
@@ -2770,15 +2774,15 @@ class TekGrid extends GridEditable {
|
|
|
2770
2774
|
this.datasource.currentRow = currentRow.groupHeaders[currentRow.groupHeaders.length - 1];
|
|
2771
2775
|
return;
|
|
2772
2776
|
}
|
|
2773
|
-
this.navigateLeft();
|
|
2777
|
+
this.navigateLeft(params);
|
|
2774
2778
|
}
|
|
2775
|
-
directionalRight() {
|
|
2779
|
+
directionalRight(params) {
|
|
2776
2780
|
const { currentRow } = this.datasource;
|
|
2777
2781
|
if (currentRow.group && !currentRow.groupOpened) {
|
|
2778
2782
|
currentRow.groupOpened = true;
|
|
2779
2783
|
return;
|
|
2780
2784
|
}
|
|
2781
|
-
this.navigateRight();
|
|
2785
|
+
this.navigateRight(params);
|
|
2782
2786
|
}
|
|
2783
2787
|
/**
|
|
2784
2788
|
* Dispatches row click event
|
|
@@ -2924,9 +2928,11 @@ class TekFilterHelper {
|
|
|
2924
2928
|
class TekGridFilterButton extends Button {
|
|
2925
2929
|
constructor(props) {
|
|
2926
2930
|
super(props);
|
|
2931
|
+
this.showCheckboxAll = false;
|
|
2927
2932
|
this.filterFormInputs = {};
|
|
2928
2933
|
this.gridName = this.getInitValue('gridName', props.gridName, this.gridName);
|
|
2929
2934
|
this.grid = this.getInitValue('grid', props.grid, undefined);
|
|
2935
|
+
this.showCheckboxAll = this.getInitValue('showCheckboxAll', props.showCheckboxAll, this.showCheckboxAll);
|
|
2930
2936
|
this.createAccessors();
|
|
2931
2937
|
if (!this.grid)
|
|
2932
2938
|
this.loadGrid();
|
|
@@ -3008,6 +3014,7 @@ class TekGridFilterButton extends Button {
|
|
|
3008
3014
|
if (!this.filterModal) {
|
|
3009
3015
|
const originalProps = {
|
|
3010
3016
|
height: 'auto',
|
|
3017
|
+
maxHeight: '18.75rem',
|
|
3011
3018
|
persistent: true,
|
|
3012
3019
|
title: 'FILTER',
|
|
3013
3020
|
};
|
|
@@ -3028,31 +3035,24 @@ class TekGridFilterButton extends Button {
|
|
|
3028
3035
|
{
|
|
3029
3036
|
name: `${this.grid.name}-filter-header-container`,
|
|
3030
3037
|
component: 'ZdContainer',
|
|
3031
|
-
cssClass: 'zd-pa-0',
|
|
3038
|
+
cssClass: 'zd-pa-0 zd-display-flex',
|
|
3032
3039
|
children: [
|
|
3033
3040
|
{
|
|
3034
|
-
name: `${this.grid.name}-filter-
|
|
3035
|
-
component: '
|
|
3036
|
-
color: '
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
{
|
|
3050
|
-
name: `${this.grid.name}-filter-close-button`,
|
|
3051
|
-
component: 'ZdModalCloseButton',
|
|
3052
|
-
small: true,
|
|
3053
|
-
modalName: `${this.grid.name}-filter-modal`,
|
|
3054
|
-
},
|
|
3055
|
-
],
|
|
3041
|
+
name: `${this.grid.name}-filter-title`,
|
|
3042
|
+
component: 'ZdText',
|
|
3043
|
+
cssStyle: `color: ${'var(--v-primary-base);'}`,
|
|
3044
|
+
text: mergeModalFilterProps.title,
|
|
3045
|
+
tag: 'h3',
|
|
3046
|
+
},
|
|
3047
|
+
{
|
|
3048
|
+
name: `${this.grid.name}-filter-spacer`,
|
|
3049
|
+
component: 'VSpacer',
|
|
3050
|
+
},
|
|
3051
|
+
{
|
|
3052
|
+
name: `${this.grid.name}-filter-close-button`,
|
|
3053
|
+
component: 'ZdModalCloseButton',
|
|
3054
|
+
small: true,
|
|
3055
|
+
modalName: `${this.grid.name}-filter-modal`,
|
|
3056
3056
|
},
|
|
3057
3057
|
],
|
|
3058
3058
|
},
|
|
@@ -3060,14 +3060,14 @@ class TekGridFilterButton extends Button {
|
|
|
3060
3060
|
name: `${this.grid.name}-filter-content-container`,
|
|
3061
3061
|
component: 'ZdContainer',
|
|
3062
3062
|
scrollView: true,
|
|
3063
|
-
cssClass: 'zd-my-2 zd-pa-0',
|
|
3064
|
-
maxHeight:
|
|
3065
|
-
height:
|
|
3063
|
+
cssClass: 'zd-my-2 zd-pa-0 tek-grid-filter-content-container',
|
|
3064
|
+
maxHeight: mergeModalFilterProps.maxHeight,
|
|
3065
|
+
height: mergeModalFilterProps.height,
|
|
3066
3066
|
children: [
|
|
3067
3067
|
{
|
|
3068
3068
|
name: `${this.grid.name}-filter-form`,
|
|
3069
3069
|
component: 'ZdForm',
|
|
3070
|
-
cssClass: 'zd-my-2',
|
|
3070
|
+
cssClass: 'zd-my-2 zd-pa-0',
|
|
3071
3071
|
children: this.getFilterModalComponents(),
|
|
3072
3072
|
events: {
|
|
3073
3073
|
onMounted: this.loadFilterValues.bind(this),
|
|
@@ -3149,14 +3149,36 @@ class TekGridFilterButton extends Button {
|
|
|
3149
3149
|
super.onBeforeDestroy();
|
|
3150
3150
|
this.destroyFilterModal();
|
|
3151
3151
|
}
|
|
3152
|
+
formatFormValue(filterForm) {
|
|
3153
|
+
return Object.keys(filterForm.value).reduce((result, item) => {
|
|
3154
|
+
try {
|
|
3155
|
+
const itemInstance = filterForm.getChildInstance(item);
|
|
3156
|
+
if (!(itemInstance instanceof SelectMultiple) || !itemInstance.checkboxAll)
|
|
3157
|
+
return result;
|
|
3158
|
+
// when selectmultiple with checkboxAll, should either remove it from the filter or
|
|
3159
|
+
// change the value to T, depending on selectAllCompatibilityMode
|
|
3160
|
+
if (Config.selectAllCompatibilityMode) {
|
|
3161
|
+
result[item] = 'T';
|
|
3162
|
+
return result;
|
|
3163
|
+
}
|
|
3164
|
+
delete result[item];
|
|
3165
|
+
return result;
|
|
3166
|
+
}
|
|
3167
|
+
catch (e) {
|
|
3168
|
+
return result;
|
|
3169
|
+
}
|
|
3170
|
+
}, Object.assign({}, filterForm.value));
|
|
3171
|
+
}
|
|
3152
3172
|
applyFilter({ event }) {
|
|
3153
3173
|
const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
|
|
3154
3174
|
if (filterForm.validate()) {
|
|
3155
3175
|
const { datasource } = this.grid;
|
|
3156
3176
|
const filter = {};
|
|
3177
|
+
const formValue = this.formatFormValue(filterForm);
|
|
3157
3178
|
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
3158
|
-
Object.keys(
|
|
3159
|
-
|
|
3179
|
+
Object.keys(formValue).forEach((item) => {
|
|
3180
|
+
const itemValue = formValue[item];
|
|
3181
|
+
if (itemValue && !(Array.isArray(itemValue) && !itemValue.length)) {
|
|
3160
3182
|
const relationAndOperationAndName = item.split(`${this.grid.name}-filter-`)[1];
|
|
3161
3183
|
const [relation, operation] = relationAndOperationAndName.split('-');
|
|
3162
3184
|
let columnName = relationAndOperationAndName.split(`${relation}-${operation}-`)[1];
|
|
@@ -3164,7 +3186,7 @@ class TekGridFilterButton extends Button {
|
|
|
3164
3186
|
if (!filter[columnName]) {
|
|
3165
3187
|
filter[columnName] = [];
|
|
3166
3188
|
}
|
|
3167
|
-
const value =
|
|
3189
|
+
const value = itemValue;
|
|
3168
3190
|
filter[columnName].push({
|
|
3169
3191
|
relation,
|
|
3170
3192
|
operation,
|
|
@@ -3176,11 +3198,11 @@ class TekGridFilterButton extends Button {
|
|
|
3176
3198
|
this.setFilter(filter, event, datasource.setDynamicFilter.bind(datasource));
|
|
3177
3199
|
}
|
|
3178
3200
|
else {
|
|
3179
|
-
Object.keys(
|
|
3201
|
+
Object.keys(formValue).forEach((item) => {
|
|
3180
3202
|
let columnName = item.split(`${this.grid.name}-filter-AND-CONTAINS-`)[1];
|
|
3181
3203
|
columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
|
|
3182
|
-
if (
|
|
3183
|
-
filter[columnName] =
|
|
3204
|
+
if (formValue[item]) {
|
|
3205
|
+
filter[columnName] = formValue[item];
|
|
3184
3206
|
}
|
|
3185
3207
|
});
|
|
3186
3208
|
datasource.filter = filter;
|
|
@@ -3223,6 +3245,7 @@ class TekGridFilterButton extends Button {
|
|
|
3223
3245
|
if (column.filterable && filterProps && filterProps.length > 0) {
|
|
3224
3246
|
this.filterFormInputs[column.name] = [];
|
|
3225
3247
|
filterProps.forEach((filterItem, index) => {
|
|
3248
|
+
var _a;
|
|
3226
3249
|
const { datasource } = this.grid;
|
|
3227
3250
|
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
3228
3251
|
const relation = filterItem.relation || 'AND';
|
|
@@ -3239,6 +3262,9 @@ class TekGridFilterButton extends Button {
|
|
|
3239
3262
|
newColumnComponent.events = {};
|
|
3240
3263
|
newColumnComponent.events.change = this.changeHelperEvent.bind(this, column);
|
|
3241
3264
|
}
|
|
3265
|
+
if (newColumnComponent.component === 'ZdSelectMultiple') {
|
|
3266
|
+
newColumnComponent.showCheckboxAll = (_a = newColumnComponent.showCheckboxAll) !== null && _a !== void 0 ? _a : this.showCheckboxAll;
|
|
3267
|
+
}
|
|
3242
3268
|
filterColumns.push(newColumnComponent);
|
|
3243
3269
|
});
|
|
3244
3270
|
}
|
|
@@ -3558,6 +3584,7 @@ class TekTreeGrid extends TreeGridEditable {
|
|
|
3558
3584
|
},
|
|
3559
3585
|
];
|
|
3560
3586
|
this.toolbarSlotProps = false;
|
|
3587
|
+
this.showCheckboxAllFilter = false;
|
|
3561
3588
|
this.title = this.getInitValue('title', props.title, this.title);
|
|
3562
3589
|
this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
|
|
3563
3590
|
this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
|
|
@@ -3573,6 +3600,7 @@ class TekTreeGrid extends TreeGridEditable {
|
|
|
3573
3600
|
this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
|
|
3574
3601
|
this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
|
|
3575
3602
|
this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
|
|
3603
|
+
this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
|
|
3576
3604
|
this.exportActions = props.exportActions || this.exportActions;
|
|
3577
3605
|
this.actions = props.actions || this.actions;
|
|
3578
3606
|
this.toolbarSlotProps = props.toolbarSlot !== undefined;
|
|
@@ -1036,6 +1036,7 @@
|
|
|
1036
1036
|
component: 'TekGridFilterButton',
|
|
1037
1037
|
grid: this.grid,
|
|
1038
1038
|
gridName: this.grid.name,
|
|
1039
|
+
showCheckboxAll: this.grid.showCheckboxAllFilter,
|
|
1039
1040
|
isVisible: `{{GridController_${this.grid.componentId}.showFilterButton}}`,
|
|
1040
1041
|
events: {
|
|
1041
1042
|
onCreated: this.loadFilterButton.bind(this),
|
|
@@ -1230,7 +1231,7 @@
|
|
|
1230
1231
|
TEKGRID_CONTAINS: 'contains',
|
|
1231
1232
|
TEKGRID_NOT_CONTAINS: 'does not contain',
|
|
1232
1233
|
TEKGRID_EQUALS: 'is equal to',
|
|
1233
|
-
TEKGRID_NOT_EQUALS: 'is
|
|
1234
|
+
TEKGRID_NOT_EQUALS: 'is different from',
|
|
1234
1235
|
TEKGRID_GREATER_THAN: 'is greater than',
|
|
1235
1236
|
TEKGRID_LESS_THAN: 'is less than',
|
|
1236
1237
|
TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
|
|
@@ -2224,6 +2225,7 @@
|
|
|
2224
2225
|
this.groupedData = [];
|
|
2225
2226
|
this.toolbarSlotProps = false;
|
|
2226
2227
|
this.editNewRowsOnly = false;
|
|
2228
|
+
this.showCheckboxAllFilter = core.Config.gridShowCheckboxAllFilter || false;
|
|
2227
2229
|
this.defaultLazy = false;
|
|
2228
2230
|
this.groups = [];
|
|
2229
2231
|
this.summary = {};
|
|
@@ -2254,6 +2256,7 @@
|
|
|
2254
2256
|
this.exportActions = props.exportActions || this.exportActions;
|
|
2255
2257
|
this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
|
|
2256
2258
|
this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
|
|
2259
|
+
this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
|
|
2257
2260
|
this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
|
|
2258
2261
|
this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
|
|
2259
2262
|
this.actions = props.actions || this.actions;
|
|
@@ -2430,9 +2433,9 @@
|
|
|
2430
2433
|
*/
|
|
2431
2434
|
loadAfterTasks() {
|
|
2432
2435
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2433
|
-
|
|
2436
|
+
Promise.all(this.tasksBeforeLoad.map((promise) => promise.catch(() => undefined)));
|
|
2434
2437
|
this.tasksBeforeLoad = [];
|
|
2435
|
-
this.request();
|
|
2438
|
+
return this.request();
|
|
2436
2439
|
});
|
|
2437
2440
|
}
|
|
2438
2441
|
initGrouping(lazyLoad) {
|
|
@@ -2457,6 +2460,7 @@
|
|
|
2457
2460
|
}
|
|
2458
2461
|
updateGroupedData(lazyLoad) {
|
|
2459
2462
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2463
|
+
this.initSummaryColumns();
|
|
2460
2464
|
this.groupedData = [];
|
|
2461
2465
|
this.groupColumns = this.columns.filter((column) => column.grouped);
|
|
2462
2466
|
this.groupColumnNames = this.groupColumns.map((column) => column.name);
|
|
@@ -2763,7 +2767,7 @@
|
|
|
2763
2767
|
}
|
|
2764
2768
|
this.datasource.currentRow = newRow;
|
|
2765
2769
|
}
|
|
2766
|
-
directionalLeft() {
|
|
2770
|
+
directionalLeft(params) {
|
|
2767
2771
|
var _a;
|
|
2768
2772
|
const { currentRow } = this.datasource;
|
|
2769
2773
|
if (currentRow.group && currentRow.groupOpened) {
|
|
@@ -2774,15 +2778,15 @@
|
|
|
2774
2778
|
this.datasource.currentRow = currentRow.groupHeaders[currentRow.groupHeaders.length - 1];
|
|
2775
2779
|
return;
|
|
2776
2780
|
}
|
|
2777
|
-
this.navigateLeft();
|
|
2781
|
+
this.navigateLeft(params);
|
|
2778
2782
|
}
|
|
2779
|
-
directionalRight() {
|
|
2783
|
+
directionalRight(params) {
|
|
2780
2784
|
const { currentRow } = this.datasource;
|
|
2781
2785
|
if (currentRow.group && !currentRow.groupOpened) {
|
|
2782
2786
|
currentRow.groupOpened = true;
|
|
2783
2787
|
return;
|
|
2784
2788
|
}
|
|
2785
|
-
this.navigateRight();
|
|
2789
|
+
this.navigateRight(params);
|
|
2786
2790
|
}
|
|
2787
2791
|
/**
|
|
2788
2792
|
* Dispatches row click event
|
|
@@ -2928,9 +2932,11 @@
|
|
|
2928
2932
|
class TekGridFilterButton extends common.Button {
|
|
2929
2933
|
constructor(props) {
|
|
2930
2934
|
super(props);
|
|
2935
|
+
this.showCheckboxAll = false;
|
|
2931
2936
|
this.filterFormInputs = {};
|
|
2932
2937
|
this.gridName = this.getInitValue('gridName', props.gridName, this.gridName);
|
|
2933
2938
|
this.grid = this.getInitValue('grid', props.grid, undefined);
|
|
2939
|
+
this.showCheckboxAll = this.getInitValue('showCheckboxAll', props.showCheckboxAll, this.showCheckboxAll);
|
|
2934
2940
|
this.createAccessors();
|
|
2935
2941
|
if (!this.grid)
|
|
2936
2942
|
this.loadGrid();
|
|
@@ -3012,6 +3018,7 @@
|
|
|
3012
3018
|
if (!this.filterModal) {
|
|
3013
3019
|
const originalProps = {
|
|
3014
3020
|
height: 'auto',
|
|
3021
|
+
maxHeight: '18.75rem',
|
|
3015
3022
|
persistent: true,
|
|
3016
3023
|
title: 'FILTER',
|
|
3017
3024
|
};
|
|
@@ -3032,31 +3039,24 @@
|
|
|
3032
3039
|
{
|
|
3033
3040
|
name: `${this.grid.name}-filter-header-container`,
|
|
3034
3041
|
component: 'ZdContainer',
|
|
3035
|
-
cssClass: 'zd-pa-0',
|
|
3042
|
+
cssClass: 'zd-pa-0 zd-display-flex',
|
|
3036
3043
|
children: [
|
|
3037
3044
|
{
|
|
3038
|
-
name: `${this.grid.name}-filter-
|
|
3039
|
-
component: '
|
|
3040
|
-
color: '
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
{
|
|
3054
|
-
name: `${this.grid.name}-filter-close-button`,
|
|
3055
|
-
component: 'ZdModalCloseButton',
|
|
3056
|
-
small: true,
|
|
3057
|
-
modalName: `${this.grid.name}-filter-modal`,
|
|
3058
|
-
},
|
|
3059
|
-
],
|
|
3045
|
+
name: `${this.grid.name}-filter-title`,
|
|
3046
|
+
component: 'ZdText',
|
|
3047
|
+
cssStyle: `color: ${'var(--v-primary-base);'}`,
|
|
3048
|
+
text: mergeModalFilterProps.title,
|
|
3049
|
+
tag: 'h3',
|
|
3050
|
+
},
|
|
3051
|
+
{
|
|
3052
|
+
name: `${this.grid.name}-filter-spacer`,
|
|
3053
|
+
component: 'VSpacer',
|
|
3054
|
+
},
|
|
3055
|
+
{
|
|
3056
|
+
name: `${this.grid.name}-filter-close-button`,
|
|
3057
|
+
component: 'ZdModalCloseButton',
|
|
3058
|
+
small: true,
|
|
3059
|
+
modalName: `${this.grid.name}-filter-modal`,
|
|
3060
3060
|
},
|
|
3061
3061
|
],
|
|
3062
3062
|
},
|
|
@@ -3064,14 +3064,14 @@
|
|
|
3064
3064
|
name: `${this.grid.name}-filter-content-container`,
|
|
3065
3065
|
component: 'ZdContainer',
|
|
3066
3066
|
scrollView: true,
|
|
3067
|
-
cssClass: 'zd-my-2 zd-pa-0',
|
|
3068
|
-
maxHeight:
|
|
3069
|
-
height:
|
|
3067
|
+
cssClass: 'zd-my-2 zd-pa-0 tek-grid-filter-content-container',
|
|
3068
|
+
maxHeight: mergeModalFilterProps.maxHeight,
|
|
3069
|
+
height: mergeModalFilterProps.height,
|
|
3070
3070
|
children: [
|
|
3071
3071
|
{
|
|
3072
3072
|
name: `${this.grid.name}-filter-form`,
|
|
3073
3073
|
component: 'ZdForm',
|
|
3074
|
-
cssClass: 'zd-my-2',
|
|
3074
|
+
cssClass: 'zd-my-2 zd-pa-0',
|
|
3075
3075
|
children: this.getFilterModalComponents(),
|
|
3076
3076
|
events: {
|
|
3077
3077
|
onMounted: this.loadFilterValues.bind(this),
|
|
@@ -3153,14 +3153,36 @@
|
|
|
3153
3153
|
super.onBeforeDestroy();
|
|
3154
3154
|
this.destroyFilterModal();
|
|
3155
3155
|
}
|
|
3156
|
+
formatFormValue(filterForm) {
|
|
3157
|
+
return Object.keys(filterForm.value).reduce((result, item) => {
|
|
3158
|
+
try {
|
|
3159
|
+
const itemInstance = filterForm.getChildInstance(item);
|
|
3160
|
+
if (!(itemInstance instanceof common.SelectMultiple) || !itemInstance.checkboxAll)
|
|
3161
|
+
return result;
|
|
3162
|
+
// when selectmultiple with checkboxAll, should either remove it from the filter or
|
|
3163
|
+
// change the value to T, depending on selectAllCompatibilityMode
|
|
3164
|
+
if (core.Config.selectAllCompatibilityMode) {
|
|
3165
|
+
result[item] = 'T';
|
|
3166
|
+
return result;
|
|
3167
|
+
}
|
|
3168
|
+
delete result[item];
|
|
3169
|
+
return result;
|
|
3170
|
+
}
|
|
3171
|
+
catch (e) {
|
|
3172
|
+
return result;
|
|
3173
|
+
}
|
|
3174
|
+
}, Object.assign({}, filterForm.value));
|
|
3175
|
+
}
|
|
3156
3176
|
applyFilter({ event }) {
|
|
3157
3177
|
const filterForm = core.Metadata.getInstance(`${this.grid.name}-filter-form`);
|
|
3158
3178
|
if (filterForm.validate()) {
|
|
3159
3179
|
const { datasource } = this.grid;
|
|
3160
3180
|
const filter = {};
|
|
3181
|
+
const formValue = this.formatFormValue(filterForm);
|
|
3161
3182
|
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
3162
|
-
Object.keys(
|
|
3163
|
-
|
|
3183
|
+
Object.keys(formValue).forEach((item) => {
|
|
3184
|
+
const itemValue = formValue[item];
|
|
3185
|
+
if (itemValue && !(Array.isArray(itemValue) && !itemValue.length)) {
|
|
3164
3186
|
const relationAndOperationAndName = item.split(`${this.grid.name}-filter-`)[1];
|
|
3165
3187
|
const [relation, operation] = relationAndOperationAndName.split('-');
|
|
3166
3188
|
let columnName = relationAndOperationAndName.split(`${relation}-${operation}-`)[1];
|
|
@@ -3168,7 +3190,7 @@
|
|
|
3168
3190
|
if (!filter[columnName]) {
|
|
3169
3191
|
filter[columnName] = [];
|
|
3170
3192
|
}
|
|
3171
|
-
const value =
|
|
3193
|
+
const value = itemValue;
|
|
3172
3194
|
filter[columnName].push({
|
|
3173
3195
|
relation,
|
|
3174
3196
|
operation,
|
|
@@ -3180,11 +3202,11 @@
|
|
|
3180
3202
|
this.setFilter(filter, event, datasource.setDynamicFilter.bind(datasource));
|
|
3181
3203
|
}
|
|
3182
3204
|
else {
|
|
3183
|
-
Object.keys(
|
|
3205
|
+
Object.keys(formValue).forEach((item) => {
|
|
3184
3206
|
let columnName = item.split(`${this.grid.name}-filter-AND-CONTAINS-`)[1];
|
|
3185
3207
|
columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
|
|
3186
|
-
if (
|
|
3187
|
-
filter[columnName] =
|
|
3208
|
+
if (formValue[item]) {
|
|
3209
|
+
filter[columnName] = formValue[item];
|
|
3188
3210
|
}
|
|
3189
3211
|
});
|
|
3190
3212
|
datasource.filter = filter;
|
|
@@ -3227,6 +3249,7 @@
|
|
|
3227
3249
|
if (column.filterable && filterProps && filterProps.length > 0) {
|
|
3228
3250
|
this.filterFormInputs[column.name] = [];
|
|
3229
3251
|
filterProps.forEach((filterItem, index) => {
|
|
3252
|
+
var _a;
|
|
3230
3253
|
const { datasource } = this.grid;
|
|
3231
3254
|
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
3232
3255
|
const relation = filterItem.relation || 'AND';
|
|
@@ -3243,6 +3266,9 @@
|
|
|
3243
3266
|
newColumnComponent.events = {};
|
|
3244
3267
|
newColumnComponent.events.change = this.changeHelperEvent.bind(this, column);
|
|
3245
3268
|
}
|
|
3269
|
+
if (newColumnComponent.component === 'ZdSelectMultiple') {
|
|
3270
|
+
newColumnComponent.showCheckboxAll = (_a = newColumnComponent.showCheckboxAll) !== null && _a !== void 0 ? _a : this.showCheckboxAll;
|
|
3271
|
+
}
|
|
3246
3272
|
filterColumns.push(newColumnComponent);
|
|
3247
3273
|
});
|
|
3248
3274
|
}
|
|
@@ -3562,6 +3588,7 @@
|
|
|
3562
3588
|
},
|
|
3563
3589
|
];
|
|
3564
3590
|
this.toolbarSlotProps = false;
|
|
3591
|
+
this.showCheckboxAllFilter = false;
|
|
3565
3592
|
this.title = this.getInitValue('title', props.title, this.title);
|
|
3566
3593
|
this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
|
|
3567
3594
|
this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
|
|
@@ -3577,6 +3604,7 @@
|
|
|
3577
3604
|
this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
|
|
3578
3605
|
this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
|
|
3579
3606
|
this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
|
|
3607
|
+
this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
|
|
3580
3608
|
this.exportActions = props.exportActions || this.exportActions;
|
|
3581
3609
|
this.actions = props.actions || this.actions;
|
|
3582
3610
|
this.toolbarSlotProps = props.toolbarSlot !== undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/teknisa-components-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.96.1",
|
|
4
4
|
"description": "Teknisa Components Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@zeedhi/core": "*"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "baaea258f392a9bd1b2379ab8660a03f618eeb6a"
|
|
36
36
|
}
|
|
@@ -6,7 +6,7 @@ const words = {
|
|
|
6
6
|
TEKGRID_CONTAINS: 'contains',
|
|
7
7
|
TEKGRID_NOT_CONTAINS: 'does not contain',
|
|
8
8
|
TEKGRID_EQUALS: 'is equal to',
|
|
9
|
-
TEKGRID_NOT_EQUALS: 'is
|
|
9
|
+
TEKGRID_NOT_EQUALS: 'is different from',
|
|
10
10
|
TEKGRID_GREATER_THAN: 'is greater than',
|
|
11
11
|
TEKGRID_LESS_THAN: 'is less than',
|
|
12
12
|
TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
|