Skip to content

Commit

Permalink
Merge pull request #501 from ghiscoding/feat/internal-group-item-meta…
Browse files Browse the repository at this point in the history
…data-provider

Feat/internal group item metadata provider
  • Loading branch information
ghiscoding authored Sep 26, 2021
2 parents fa35d28 + 9714847 commit 03962b9
Show file tree
Hide file tree
Showing 47 changed files with 1,097 additions and 496 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/editors/autoCompleteEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import {
SlickNamespace,
} from './../interfaces/index';
import { textValidator } from '../editorValidators/textValidator';
import { sanitizeTextByAvailableSanitizer, } from '../services/domUtilities';
import {
findOrDefault,
getDescendantProperty,
sanitizeTextByAvailableSanitizer,
setDeepValue,
toKebabCase
} from '../services/utilities';
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/editors/dateEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
import {
destroyObjectDomElementProps,
emptyElement,
} from '../services/domUtilities';
import {
getDescendantProperty,
mapFlatpickrDateFormatWithFieldType,
mapMomentDateFormatWithFieldType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ const mockAddon = jest.fn().mockImplementation(() => ({
destroy: jest.fn()
}));

jest.mock('slickgrid/slick.groupitemmetadataprovider', () => mockAddon);
jest.mock('slickgrid/plugins/slick.cellmenu', () => mockAddon);
jest.mock('slickgrid/plugins/slick.cellexternalcopymanager', () => mockAddon);
jest.mock('slickgrid/plugins/slick.contextmenu', () => mockAddon);
jest.mock('slickgrid/plugins/slick.draggablegrouping', () => mockAddon);
jest.mock('slickgrid/plugins/slick.headermenu', () => mockAddon);
jest.mock('slickgrid/plugins/slick.rowselectionmodel', () => mockAddon);
jest.mock('slickgrid/plugins/slick.rowdetailview', () => mockAddon);
jest.mock('slickgrid/plugins/slick.rowmovemanager', () => mockAddon);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { ExtensionUtility } from './extensionUtility';
import { BindingEventService } from '../services/bindingEvent.service';
import { SharedService } from '../services/shared.service';
import { sanitizeHtmlToText } from '../services/utilities';
import { sanitizeHtmlToText } from '../services/domUtilities';

// using external SlickGrid JS libraries
declare const Slick: SlickNamespace;
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/extensions/extensionCommonUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-this-alias */
import { Column, ColumnPickerOption, DOMEvent, GridMenuOption } from '../interfaces';
import { sanitizeTextByAvailableSanitizer } from '../services/utilities';
import { sanitizeTextByAvailableSanitizer } from '../services/domUtilities';
import { ColumnPickerControl } from '../controls/columnPicker.control';
import { GridMenuControl } from '../controls/gridMenu.control';

Expand Down
32 changes: 0 additions & 32 deletions packages/common/src/extensions/groupItemMetaProviderExtension.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/common/src/extensions/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './cellExternalCopyManagerExtension';
export * from './checkboxSelectorExtension';
export * from './extensionUtility';
export * from './groupItemMetaProviderExtension';
export * from './rowDetailViewExtension';
export * from './rowMoveManagerExtension';
export * from './rowSelectionExtension';
3 changes: 2 additions & 1 deletion packages/common/src/filters/autoCompleteFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
} from './../interfaces/index';
import { CollectionService } from '../services/collection.service';
import { collectionObserver, propertyObserver } from '../services/observers';
import { getDescendantProperty, sanitizeTextByAvailableSanitizer, toKebabCase, unsubscribeAll } from '../services/utilities';
import { sanitizeTextByAvailableSanitizer, } from '../services/domUtilities';
import { getDescendantProperty, toKebabCase, unsubscribeAll } from '../services/utilities';
import { TranslaterService } from '../services/translater.service';
import { renderCollectionOptionsAsync } from './filterUtilities';
import { RxJsFacade, Subscription } from '../services/rxjsFacade';
Expand Down
9 changes: 2 additions & 7 deletions packages/common/src/filters/compoundDateFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ import {
import { FieldType, OperatorString, OperatorType, SearchTerm } from '../enums/index';
import { Constants } from '../constants';
import { buildSelectOperator } from './filterUtilities';
import {
destroyObjectDomElementProps,
emptyElement,
getTranslationPrefix,
mapFlatpickrDateFormatWithFieldType,
mapOperatorToShorthandDesignation
} from '../services/utilities';
import { destroyObjectDomElementProps, emptyElement, } from '../services/domUtilities';
import { getTranslationPrefix, mapFlatpickrDateFormatWithFieldType, mapOperatorToShorthandDesignation } from '../services/utilities';
import { TranslaterService } from '../services/translater.service';
import { BindingEventService } from '../services/bindingEvent.service';

Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/filters/compoundInputFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
SlickGrid,
} from '../interfaces/index';
import { buildSelectOperator } from './filterUtilities';
import { emptyElement, getTranslationPrefix, mapOperatorToShorthandDesignation, toSentenceCase } from '../services/utilities';
import { emptyElement } from '../services/domUtilities';
import { getTranslationPrefix, mapOperatorToShorthandDesignation, toSentenceCase } from '../services/utilities';
import { BindingEventService } from '../services/bindingEvent.service';
import { TranslaterService } from '../services/translater.service';

Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/filters/compoundSliderFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
import { Constants } from '../constants';
import { OperatorString, OperatorType, SearchTerm } from '../enums/index';
import { buildSelectOperator } from './filterUtilities';
import { emptyElement, getTranslationPrefix, hasData, mapOperatorToShorthandDesignation, toSentenceCase } from '../services/utilities';
import { emptyElement } from '../services/domUtilities';
import { getTranslationPrefix, hasData, mapOperatorToShorthandDesignation, toSentenceCase } from '../services/utilities';
import { BindingEventService } from '../services/bindingEvent.service';
import { TranslaterService } from '../services/translater.service';

Expand Down
8 changes: 2 additions & 6 deletions packages/common/src/filters/dateRangeFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ import {
GridOption,
SlickGrid,
} from '../interfaces/index';
import {
destroyObjectDomElementProps,
emptyElement,
mapFlatpickrDateFormatWithFieldType,
mapMomentDateFormatWithFieldType
} from '../services/utilities';
import { destroyObjectDomElementProps, emptyElement, } from '../services/domUtilities';
import { mapFlatpickrDateFormatWithFieldType, mapMomentDateFormatWithFieldType } from '../services/utilities';
import { BindingEventService } from '../services/bindingEvent.service';
import { TranslaterService } from '../services/translater.service';

Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/filters/filterUtilities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { OperatorString } from '../enums/operatorString.type';
import { Column, GridOption } from '../interfaces/index';
import { Observable, RxJsFacade, Subject, Subscription } from '../services/rxjsFacade';
import { castObservableToPromise, getDescendantProperty, htmlEncodedStringWithPadding, sanitizeTextByAvailableSanitizer } from '../services/utilities';
import { htmlEncodedStringWithPadding, sanitizeTextByAvailableSanitizer, } from '../services/domUtilities';
import { castObservableToPromise, getDescendantProperty, } from '../services/utilities';

/**
* Create and return a select dropdown HTML element with a list of Operators with descriptions
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/filters/nativeSelectFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
SlickGrid,
} from '../interfaces/index';
import { OperatorType, OperatorString, SearchTerm } from '../enums/index';
import { emptyElement, toSentenceCase } from '../services/utilities';
import { emptyElement, } from '../services/domUtilities';
import { toSentenceCase } from '../services/utilities';
import { TranslaterService } from '../services/translater.service';
import { BindingEventService } from '../services/bindingEvent.service';

Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/filters/sliderFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
FilterCallback,
SlickGrid,
} from './../interfaces/index';
import { emptyElement, hasData, toSentenceCase } from '../services/utilities';
import { emptyElement, } from '../services/domUtilities';
import { hasData, toSentenceCase } from '../services/utilities';
import { BindingEventService } from '../services/bindingEvent.service';

const DEFAULT_MIN_VALUE = 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/formatters/hyperlinkFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Formatter } from './../interfaces/index';
import { sanitizeTextByAvailableSanitizer } from '../services/utilities';
import { sanitizeTextByAvailableSanitizer, } from '../services/domUtilities';

/**
* Takes an hyperlink cell value and transforms it into a real hyperlink, given that the value starts with 1 of these (http|ftp|https).
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/formatters/treeExportFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Constants } from '../constants';
import { Formatter } from './../interfaces/index';
import { addWhiteSpaces, getCellValueFromQueryFieldGetter, sanitizeHtmlToText, } from '../services/utilities';
import { sanitizeHtmlToText, } from '../services/domUtilities';
import { addWhiteSpaces, getCellValueFromQueryFieldGetter, } from '../services/utilities';
import { parseFormatterWhenExist } from './formatterUtilities';

/** Formatter that must be use with a Tree Data column */
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/formatters/treeFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Constants } from '../constants';
import { Formatter } from './../interfaces/index';
import { parseFormatterWhenExist } from './formatterUtilities';
import { getCellValueFromQueryFieldGetter, sanitizeTextByAvailableSanitizer } from '../services/utilities';
import { sanitizeTextByAvailableSanitizer, } from '../services/domUtilities';
import { getCellValueFromQueryFieldGetter, } from '../services/utilities';

/** Formatter that must be use with a Tree Data column */
export const treeFormatter: Formatter = (row, cell, value, columnDef, dataContext, grid) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/interfaces/dataViewOption.interface.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { GroupItemMetadataProviderService } from '../services/groupItemMetadataProvider.service';
import { SlickGroupItemMetadataProvider } from './slickGroupItemMetadataProvider.interface';

export interface DataViewOption {
/** Defaults to false, use with great care as this will break built-in filters */
inlineFilters?: boolean;

/** Optionally provide a Group Item Metatadata Provider when using Grouping/DraggableGrouping feature */
groupItemMetadataProvider?: SlickGroupItemMetadataProvider;
groupItemMetadataProvider?: SlickGroupItemMetadataProvider | GroupItemMetadataProviderService;
}
6 changes: 5 additions & 1 deletion packages/common/src/interfaces/gridOption.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from './index';
import { ColumnReorderFunction, EventNamingStyle, GridAutosizeColsMode, OperatorType, OperatorString, } from '../enums/index';
import { TranslaterService } from '../services/translater.service';
import { GroupItemMetadataProviderOption } from '..';

export interface GridOption {
/** CSS class name used on newly added row */
Expand Down Expand Up @@ -442,10 +443,13 @@ export interface GridOption {

/**
* When using a fixed grid width, can be a number or a string.
* if a number is provided it will add the `px` suffix for pixels, or if a string is passed it will use it as is.
* if a number is provided it will add the `px` suffix for pixels, or if a string is passed it will use it as it is.
*/
gridWidth?: number | string;

/** Optional option to provide to the GroupItemMetadataProvider */
groupItemMetadataOption?: GroupItemMetadataProviderOption;

/** Header row height in pixels (only type the number). Header row is where the filters are. */
headerRowHeight?: number;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
import { Formatter } from './formatter.interface';
import { GroupTotalsFormatter } from './groupTotalsFormatter.interface';
import { SlickCheckboxSelectColumn } from './slickCheckboxSelectColumn.interface';

export interface GroupItemMetadataProviderOption {
/** Whether or not we want to use group select checkbox. */
checkboxSelect: boolean;
checkboxSelect?: boolean;

/** Defaults to "slick-group-select-checkbox" */
checkboxSelectCssClass: string;
checkboxSelectCssClass?: string;

/** Plugin to select row(s) via checkboxes typically shown as the 1st column in the grid. */
checkboxSelectPlugin: SlickCheckboxSelectColumn;
checkboxSelectPlugin?: SlickCheckboxSelectColumn;

/** Defaults to "slick-group" */
groupCssClass: string;
groupCssClass?: string;

/** Defaults to "slick-group-title" */
groupTitleCssClass: string;
groupTitleCssClass?: string;

/** Defaults to 15(px), margin-left indentation to use (it will be multiplied by the group level number) */
indentation?: number;

/** Defaults to "slick-group-totals" */
totalsCssClass: string;
totalsCssClass?: string;

/** Whether or not the group is focusable. */
groupFocusable: boolean;
groupFocusable?: boolean;

/** Whether or not the group totals is focusable. */
totalsFocusable: boolean;
totalsFocusable?: boolean;

/** Defaults to "slick-group-toggle" */
toggleCssClass: string;
toggleCssClass?: string;

/** Defaults to "expanded" */
toggleExpandedCssClass: string;
toggleExpandedCssClass?: string;

/** Defaults to "collapsed" */
toggleCollapsedCssClass: string;
toggleCollapsedCssClass?: string;

/** Whether or not we want to enable the group expanding/collapsing */
enableExpandCollapse: boolean;
enableExpandCollapse?: boolean;

/** A custom group cell formatter. */
groupFormatter: Formatter;
groupFormatter?: Formatter;

/** A custom total formatter. */
totalsFormatter: GroupTotalsFormatter;
totalsFormatter?: Formatter;

/** Whether or not we want to include header totals */
includeHeaderTotals: boolean;
includeHeaderTotals?: boolean;
}
1 change: 1 addition & 0 deletions packages/common/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export * from './slickEventData.interface';
export * from './slickGrid.interface';
export * from './slickEventHandler.interface';
export * from './slickGridMenu.interface';
export * from './slickGroup.interface';
export * from './slickGroupItemMetadataProvider.interface';
export * from './slickHeaderButtons.interface';
export * from './slickHeaderMenu.interface';
Expand Down
Loading

0 comments on commit 03962b9

Please sign in to comment.