@slickgrid-universal/row-detail-view-plugin 1.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [1.1.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.2...v1.1.0) (2021-12-11)
7
+
8
+
9
+ ### Features
10
+
11
+ * **plugins:** add Row Detail plugin final code & tests ([045ea6d](https://github.com/ghiscoding/slickgrid-universal/commit/045ea6d0e49e55163edcbe1ec6e796f51349667b))
12
+ * **plugins:** move Row Detail View plugin to universal ([9700ff4](https://github.com/ghiscoding/slickgrid-universal/commit/9700ff49132e9408b808f916f634976d80e12579))
13
+ * **plugins:** move Row Detail View plugin to universal ([fb327a6](https://github.com/ghiscoding/slickgrid-universal/commit/fb327a6abe85b86683572cde2a550de43a01f9e1))
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2020-2021, Ghislain B. - Slickgrid-Universal
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
+ [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
3
+ [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
4
+ [![npm](https://img.shields.io/npm/v/@slickgrid-universal/row-detail-view-plugin.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/row-detail-view-plugin)
5
+ [![npm](https://img.shields.io/npm/dy/@slickgrid-universal/row-detail-view-plugin?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/row-detail-view-plugin)
6
+
7
+ [![Actions Status](https://github.com/ghiscoding/slickgrid-universal/workflows/CI%20Build/badge.svg)](https://github.com/ghiscoding/slickgrid-universal/actions)
8
+ [![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
9
+ [![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
10
+ [![codecov](https://codecov.io/gh/ghiscoding/slickgrid-universal/branch/master/graph/badge.svg)](https://codecov.io/gh/ghiscoding/slickgrid-universal)
11
+
12
+ ## Slick Row Detail View (plugin)
13
+ #### @slickgrid-universal/row-detail-view-plugin
14
+
15
+ A plugin to add Row Detail View Panel that can be expanded/collapsed, the plugin was created from an idea that came out of this Original StackOverflow question & article making this possible (thanks to violet313).
16
+ * [Can SlickGrid's row height be dynamically altered? - on Stack Overflow](https://stackoverflow.com/questions/10535164/can-slickgrids-row-height-be-dynamically-altered#29399927)
17
+ * [a responsive slickgrid with dynamic row-heights by violet313](https://violet313.github.io)
18
+
19
+ ### Internal Dependencies
20
+ - [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
21
+
22
+
23
+ ### Installation
24
+ Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
@@ -0,0 +1 @@
1
+ export * from './slickRowDetailView';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./slickRowDetailView"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC"}
@@ -0,0 +1,129 @@
1
+ import { Column, DOMMouseEvent, ExternalResource, FormatterResultObject, GridOption, PubSubService, RowDetailView, RowDetailViewOption, SlickDataView, SlickEventHandler, SlickGrid, SlickRowDetailView as UniversalRowDetailView, UsabilityOverrideFn } from '@slickgrid-universal/common';
2
+ /***
3
+ * A plugin to add Row Detail Panel View (for example providing order detail info when clicking on the order row in the grid)
4
+ * Original StackOverflow question & article making this possible (thanks to violet313)
5
+ * https://stackoverflow.com/questions/10535164/can-slickgrids-row-height-be-dynamically-altered#29399927
6
+ * http://violet313.org/slickgrids/#intro
7
+ */
8
+ export declare class SlickRowDetailView implements ExternalResource, UniversalRowDetailView {
9
+ protected _addonOptions: RowDetailView;
10
+ protected _dataViewIdProperty: string;
11
+ protected _eventHandler: SlickEventHandler;
12
+ protected _expandableOverride: UsabilityOverrideFn | null;
13
+ protected _expandedRows: any[];
14
+ protected _grid: SlickGrid;
15
+ protected _gridRowBuffer: number;
16
+ protected _gridUid: string;
17
+ protected _keyPrefix: string;
18
+ protected _lastRange: {
19
+ bottom: number;
20
+ top: number;
21
+ } | null;
22
+ protected _outsideRange: number;
23
+ protected _pubSubService: PubSubService | null;
24
+ protected _rowIdsOutOfViewport: Array<number | string>;
25
+ protected _visibleRenderedCellCount: number;
26
+ protected _defaults: RowDetailView;
27
+ pluginName: 'RowDetailView';
28
+ /** Fired when the async response finished */
29
+ onAsyncEndUpdate: import("@slickgrid-universal/common").SlickEvent<any>;
30
+ /** This event must be used with the "notify" by the end user once the Asynchronous Server call returns the item detail */
31
+ onAsyncResponse: import("@slickgrid-universal/common").SlickEvent<any>;
32
+ /** Fired after the row detail gets toggled */
33
+ onAfterRowDetailToggle: import("@slickgrid-universal/common").SlickEvent<any>;
34
+ /** Fired before the row detail gets toggled */
35
+ onBeforeRowDetailToggle: import("@slickgrid-universal/common").SlickEvent<any>;
36
+ /** Fired after the row detail gets toggled */
37
+ onRowBackToViewportRange: import("@slickgrid-universal/common").SlickEvent<any>;
38
+ /** Fired after a row becomes out of viewport range (when user can't see the row anymore) */
39
+ onRowOutOfViewportRange: import("@slickgrid-universal/common").SlickEvent<any>;
40
+ /** Constructor of the SlickGrid 3rd party plugin, it can optionally receive options */
41
+ constructor();
42
+ get addonOptions(): RowDetailView;
43
+ /** Getter of SlickGrid DataView object */
44
+ get dataView(): SlickDataView;
45
+ get dataViewIdProperty(): string;
46
+ get eventHandler(): SlickEventHandler;
47
+ /** Getter for the Grid Options pulled through the Grid Object */
48
+ get gridOptions(): GridOption;
49
+ get gridUid(): string;
50
+ set lastRange(range: {
51
+ bottom: number;
52
+ top: number;
53
+ });
54
+ set rowIdsOutOfViewport(rowIds: Array<string | number>);
55
+ get visibleRenderedCellCount(): number;
56
+ /**
57
+ * Initialize the Export Service
58
+ * @param _grid
59
+ * @param _containerService
60
+ */
61
+ init(grid: SlickGrid): void;
62
+ /** Dispose of the Slick Row Detail View */
63
+ dispose(): void;
64
+ create(columnDefinitions: Column[], gridOptions: GridOption): UniversalRowDetailView | null;
65
+ /** Get current plugin options */
66
+ getOptions(): RowDetailViewOption;
67
+ /** set or change some of the plugin options */
68
+ setOptions(options: Partial<RowDetailViewOption>): void;
69
+ /** Collapse all of the open items */
70
+ collapseAll(): void;
71
+ /** Colapse an Item so it is not longer seen */
72
+ collapseDetailView(item: any, isMultipleCollapsing?: boolean): void;
73
+ /** Expand a row given the dataview item that is to be expanded */
74
+ expandDetailView(item: any): void;
75
+ /** Saves the current state of the detail view */
76
+ saveDetailView(item: any): void;
77
+ /**
78
+ * subscribe to the onAsyncResponse so that the plugin knows when the user server side calls finished
79
+ * the response has to be as "args.item" (or "args.itemDetail") with it's data back
80
+ */
81
+ handleOnAsyncResponse(_e: Event, args: {
82
+ item: any;
83
+ itemDetail: any;
84
+ detailView?: any;
85
+ }): void;
86
+ /**
87
+ * TODO interface only has a GETTER not a SETTER..why?
88
+ * Override the logic for showing (or not) the expand icon (use case example: only every 2nd row is expandable)
89
+ * Method that user can pass to override the default behavior or making every row an expandable row.
90
+ * In order word, user can choose which rows to be an available row detail (or not) by providing his own logic.
91
+ * @param overrideFn: override function callback
92
+ */
93
+ expandableOverride(overrideFn: UsabilityOverrideFn): void;
94
+ getExpandableOverride(): UsabilityOverrideFn | null;
95
+ /** Get the Column Definition of the first column dedicated to toggling the Row Detail View */
96
+ getColumnDefinition(): Column;
97
+ /** return the currently expanded rows */
98
+ getExpandedRows(): Array<number | string>;
99
+ /** return the rows that are out of the viewport */
100
+ getOutOfViewportRows(): Array<number | string>;
101
+ /** Takes in the item we are filtering and if it is an expanded row returns it's parents row to filter on */
102
+ getFilterItem(item: any): any;
103
+ /** Resize the Row Detail View */
104
+ resizeDetailView(item: any): void;
105
+ /**
106
+ * create the detail ctr node. this belongs to the dev & can be custom-styled as per
107
+ */
108
+ protected applyTemplateNewLineHeight(item: any): void;
109
+ protected calculateOutOfRangeViews(): void;
110
+ protected calculateOutOfRangeViewsSimplerVersion(): void;
111
+ protected checkExpandableOverride(row: number, dataContext: any, grid: SlickGrid): boolean;
112
+ protected checkIsRowOutOfViewportRange(rowIndex: number, renderedRange: any): boolean;
113
+ /** Get the Row Detail padding (which are the rows dedicated to the detail panel) */
114
+ protected getPaddingItem(parent: any, offset: any): any;
115
+ /** The Formatter of the toggling icon of the Row Detail */
116
+ protected detailSelectionFormatter(row: number, cell: number, value: any, columnDef: Column, dataContext: any, grid: SlickGrid): FormatterResultObject | string;
117
+ /** When row is getting toggled, we will handle the action of collapsing/expanding */
118
+ protected handleAccordionShowHide(item: any): void;
119
+ /** Handle mouse click event */
120
+ protected handleClick(e: DOMMouseEvent<HTMLDivElement>, args: {
121
+ row: number;
122
+ cell: number;
123
+ }): void;
124
+ protected handleScroll(): void;
125
+ protected notifyOutOfViewport(item: any, rowId: number | string): void;
126
+ protected notifyBackToViewportWhenDomExist(item: any, rowId: number | string): void;
127
+ protected syncOutOfViewportArray(rowId: number | string, isAdding: boolean): (string | number)[];
128
+ protected toggleRowSelection(rowNumber: number, dataContext: any): void;
129
+ }